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

Unified Diff: src/gpu/GrGeometryProcessor.h

Issue 772513002: create and thread batch tracker object (Closed) Base URL: https://skia.googlesource.com/skia.git@2_vertex_attr
Patch Set: rebase 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/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOptDrawState.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 17344d2bb4c251df6469aff20512bb4ba98fdf13..27383a4df49df6dd3e618f24f72fed5a5e745a1d 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -12,6 +12,30 @@
#include "GrProcessor.h"
#include "GrShaderVar.h"
+/*
+ * A struct for tracking batching decisions. While this lives on GrOptState, it is managed
+ * entirely by the derived classes of the GP.
+ */
+class GrBatchTracker {
+public:
+ template <typename T> const T& cast() const {
+ SkASSERT(sizeof(T) <= kMaxSize);
+ return *reinterpret_cast<const T*>(fData);
+ }
+
+ template <typename T> T* cast() {
+ SkASSERT(sizeof(T) <= kMaxSize);
+ return reinterpret_cast<T*>(fData);
+ }
+
+ static const size_t kMaxSize = 32;
+
+private:
+ uint8_t fData[kMaxSize];
+};
+
+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 +97,15 @@ public:
return this->onIsEqual(that);
}
+ struct InitBT {
+ 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; }
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698