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

Unified Diff: include/gpu/GrBackendEffectFactory.h

Issue 385713005: Allow GrGLEffects to produce variable length keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: rebase Created 6 years, 5 months 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 | « no previous file | include/gpu/GrEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrBackendEffectFactory.h
diff --git a/include/gpu/GrBackendEffectFactory.h b/include/gpu/GrBackendEffectFactory.h
index ef9e436401d72466f64603c1e4b1672b95646ef8..e6362520fc2b2e3b59e43b18343dfd86ced7bfd9 100644
--- a/include/gpu/GrBackendEffectFactory.h
+++ b/include/gpu/GrBackendEffectFactory.h
@@ -48,6 +48,31 @@ private:
};
/**
+ * This class is used to pass the key that was created for a GrGLEffect back to it
+ * when it emits code. It may allow the emit step to skip calculations that were
+ * performed when computing the key.
+ */
+class GrEffectKey {
+public:
+ GrEffectKey(const uint32_t* key, int count) : fKey(key), fCount(count) {
+ SkASSERT(0 == reinterpret_cast<intptr_t>(key) % sizeof(uint32_t));
+ }
+
+ /** Gets the uint32_t values that the effect inserted into the key. */
+ uint32_t get32(int index) const {
+ SkASSERT(index >=0 && index < fCount);
+ return fKey[index];
+ }
+
+ /** Gets the number of uint32_t values that the effect inserted into the key. */
+ int count32() const { return fCount; }
+
+private:
+ const uint32_t* fKey; // unowned ptr into the larger key.
+ int fCount; // number of uint32_ts inserted by the effect into its key.
+};
+
+/**
* Given a GrEffect of a particular type, creates the corresponding graphics-backend-specific
* effect object. It also tracks equivalence of shaders generated via a key. The factory for an
* effect is accessed via GrEffect::getFactory(). Each factory instance is assigned an ID at
@@ -66,8 +91,6 @@ private:
*/
class GrBackendEffectFactory : SkNoncopyable {
public:
- typedef uint32_t EffectKey;
-
/**
* Generates an effect's key. The key is based on the aspects of the GrEffect object's
* configuration that affect GLSL code generation. Two GrEffect instances that would cause
« no previous file with comments | « no previous file | include/gpu/GrEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698