Index: src/gpu/gl/GrGLProgramDesc.cpp |
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp |
index a1646618e8b6eb91ce43686ab14b981316edd152..172aca77ab3e78fca75711711e89263ebe9ec5a3 100644 |
--- a/src/gpu/gl/GrGLProgramDesc.cpp |
+++ b/src/gpu/gl/GrGLProgramDesc.cpp |
@@ -31,16 +31,11 @@ |
static uint32_t gen_texture_key(const GrProcessor& proc, const GrGLCaps& caps) { |
uint32_t key = 0; |
int numTextures = proc.numTextures(); |
- int shift = 0; |
for (int t = 0; t < numTextures; ++t) { |
const GrTextureAccess& access = proc.textureAccess(t); |
if (swizzle_requires_alpha_remapping(*caps.glslCaps(), access.getTexture()->config())) { |
- key |= 1 << shift; |
+ key |= 1 << t; |
} |
- if (GR_GL_TEXTURE_EXTERNAL == static_cast<GrGLTexture*>(access.getTexture())->target()) { |
- key |= 2 << shift; |
- } |
- shift += 2; |
} |
return key; |
} |
@@ -53,8 +48,10 @@ |
* which must be different for every GrProcessor subclass. It can fail if an effect uses too many |
* textures, transforms, etc, for the space allotted in the meta-key. NOTE, both FPs and GPs share |
* this function because it is hairy, though FPs do not have attribs, and GPs do not have transforms |
+ * |
+ * TODO: A better name for this function would be "compute" instead of "get". |
*/ |
-static bool gen_meta_key(const GrProcessor& proc, |
+static bool get_meta_key(const GrProcessor& proc, |
const GrGLCaps& caps, |
uint32_t transformKey, |
GrProcessorKeyBuilder* b) { |
@@ -78,12 +75,15 @@ |
return true; |
} |
-static bool gen_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc, |
+/* |
+ * TODO: A better name for this function would be "compute" instead of "get". |
+ */ |
+static bool get_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc, |
const GrFragmentProcessor& fp, |
const GrGLCaps& caps, |
GrProcessorKeyBuilder* b) { |
for (int i = 0; i < fp.numChildProcessors(); ++i) { |
- if (!gen_frag_proc_and_meta_keys(primProc, fp.childProcessor(i), caps, b)) { |
+ if (!get_frag_proc_and_meta_keys(primProc, fp.childProcessor(i), caps, b)) { |
return false; |
} |
} |
@@ -91,7 +91,7 @@ |
fp.getGLSLProcessorKey(*caps.glslCaps(), b); |
//**** use glslCaps here? |
- return gen_meta_key(fp, caps, primProc.getTransformKey(fp.coordTransforms(), |
+ return get_meta_key(fp, caps, primProc.getTransformKey(fp.coordTransforms(), |
fp.numTransformsExclChildren()), b); |
} |
@@ -115,14 +115,14 @@ |
primProc.getGLSLProcessorKey(*gpu->glCaps().glslCaps(), &b); |
//**** use glslCaps here? |
- if (!gen_meta_key(primProc, gpu->glCaps(), 0, &b)) { |
+ if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) { |
glDesc->key().reset(); |
return false; |
} |
for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) { |
const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i); |
- if (!gen_frag_proc_and_meta_keys(primProc, fp, gpu->glCaps(), &b)) { |
+ if (!get_frag_proc_and_meta_keys(primProc, fp, gpu->glCaps(), &b)) { |
glDesc->key().reset(); |
return false; |
} |
@@ -131,7 +131,7 @@ |
const GrXferProcessor& xp = *pipeline.getXferProcessor(); |
xp.getGLSLProcessorKey(*gpu->glCaps().glslCaps(), &b); |
//**** use glslCaps here? |
- if (!gen_meta_key(xp, gpu->glCaps(), 0, &b)) { |
+ if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) { |
glDesc->key().reset(); |
return false; |
} |