Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: src/gpu/GrGeometryProcessor.h

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: bug fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGeometryProcessor.h
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index 9e621d82a04a66e603976c7305745bd2da34c742..4801069005fdd21ccc4a9103e1f8b9fac4905059 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -8,6 +8,7 @@
#ifndef GrGeometryProcessor_DEFINED
#define GrGeometryProcessor_DEFINED
+#include "GrColor.h"
#include "GrGeometryData.h"
#include "GrProcessor.h"
#include "GrShaderVar.h"
@@ -50,8 +51,10 @@ class GrOptDrawState;
*/
class GrGeometryProcessor : public GrProcessor {
public:
- GrGeometryProcessor()
+ GrGeometryProcessor(GrColor color, uint8_t coverage = 0xff)
: fVertexStride(0)
+ , fColor(color)
+ , fCoverage(coverage)
, fWillUseGeoShader(false)
, fHasVertexColor(false)
, fHasVertexCoverage(false)
@@ -107,6 +110,14 @@ public:
if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)) {
return false;
}
+
+ if (!fHasVertexColor && this->getColor() != that.getColor()) {
+ return false;
+ }
+
+ if (!fHasVertexCoverage && this->getCoverage() != that.getCoverage()) {
+ return false;
+ }
return this->onIsEqual(that);
}
@@ -119,12 +130,17 @@ public:
virtual void initBatchTracker(GrBatchTracker*, const InitBT&) const {}
+ GrColor getColor() const { return fColor; }
+ uint8_t getCoverage() const { return fCoverage; }
+
// TODO this is a total hack until the gp can own whether or not it uses uniform
// color / coverage
bool hasVertexColor() const { return fHasVertexColor; }
bool hasVertexCoverage() const { return fHasVertexCoverage; }
bool hasLocalCoords() const { return fHasLocalCoords; }
+ void computeInvariantColor(GrInvariantOutput* inout) const;
+
protected:
/**
* Subclasses call this from their constructor to register vertex attributes. Attributes
@@ -149,6 +165,8 @@ private:
SkSTArray<kMaxVertexAttribs, GrAttribute, true> fAttribs;
size_t fVertexStride;
+ GrColor fColor;
+ uint8_t fCoverage;
bool fWillUseGeoShader;
bool fHasVertexColor;
bool fHasVertexCoverage;
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698