Index: src/gpu/GrGeometryProcessor.h |
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h |
index 4bf06140db28dd9d6354ad5d1957c4c7b43ede09..28b027b43e273459839635b02de82a5472ef16ca 100644 |
--- a/src/gpu/GrGeometryProcessor.h |
+++ b/src/gpu/GrGeometryProcessor.h |
@@ -12,6 +12,26 @@ |
#include "GrProcessor.h" |
#include "GrShaderVar.h" |
+/* |
+ * A struct for tracking batching decisions. While this lives on optstate, it is managed |
bsalomon
2014/12/03 14:58:52
Can you make optstate be GrOptState? I've noticed
|
+ * entirely by the derived classes of the GP. |
+ */ |
+class GrBatchTracker { |
+public: |
+ template <typename T> const T& cast() const { |
+ return *reinterpret_cast<const T*>(fStorage.begin()); |
+ } |
+ |
+ template <typename T> T* cast() { return reinterpret_cast<T*>(fStorage.begin()); } |
+ |
+private: |
+ // kPreAllocSize is actually more like a maxsize. |
bsalomon
2014/12/03 14:38:19
huh?
bsalomon
2014/12/03 14:58:52
If it's a max size and it's preallocated then SkST
|
+ static const size_t kPreAllocSize = 32; |
+ SkSTArray<kPreAllocSize, uint8_t, true> fStorage; |
+}; |
+ |
+class GrOptDrawState; |
+ |
/** |
* A GrGeometryProcessor is used to perform computation in the vertex shader and |
* add support for custom vertex attributes. A GrGemeotryProcessor is typically |
@@ -73,6 +93,15 @@ public: |
return this->onIsEqual(that); |
} |
+ struct InitBT { |
bsalomon
2014/12/03 14:38:19
comments?
We're getting rid of fColor and fCovera
bsalomon
2014/12/03 14:58:52
What I meant is that GrGP shouldn't have an input
|
+ bool fOutputColor; |
+ bool fOutputCoverage; |
+ GrColor fColor; |
+ GrColor fCoverage; |
+ }; |
+ |
+ virtual void initBatchTracker(GrBatchTracker*, const InitBT&) const {} |
+ |
// TODO this is a total hack until the gp can own whether or not it uses uniform |
// color / coverage |
bool hasVertexColor() const { return fHasVertexColor; } |