Index: src/gpu/gl/GrGLProgramDesc.cpp |
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp |
index 4c95e2b532adc8501e285a3d98fb19b4ce336247..450908d30a620bc75a37cdfdf7835d451cf2c447 100644 |
--- a/src/gpu/gl/GrGLProgramDesc.cpp |
+++ b/src/gpu/gl/GrGLProgramDesc.cpp |
@@ -7,12 +7,28 @@ |
#include "GrGLProgramDesc.h" |
#include "GrProcessor.h" |
-#include "GrGLGpu.h" |
#include "GrPipeline.h" |
#include "SkChecksum.h" |
+#include "gl/GrGLDefines.h" |
+#include "gl/GrGLTexture.h" |
+#include "gl/GrGLTypes.h" |
#include "glsl/GrGLSLFragmentProcessor.h" |
#include "glsl/GrGLSLFragmentShaderBuilder.h" |
- |
+#include "glsl/GrGLSLCaps.h" |
+ |
+static uint16_t texture_target_key(GrGLenum target) { |
jvanverth1
2016/01/14 16:47:21
Could you use TextureTargetToCopyProgramIdx as the
bsalomon
2016/01/14 17:11:50
Actually I can just use the GLenum... they're all
|
+ switch (target) { |
+ case GR_GL_TEXTURE_2D: |
+ return 0; |
+ case GR_GL_TEXTURE_EXTERNAL: |
+ return 1; |
+ case GR_GL_TEXTURE_RECTANGLE: |
+ return 2; |
+ default: |
+ SkFAIL("Unexpected texture target type."); |
+ return 0; |
+ } |
+} |
static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, |
const GrGLSLCaps& caps) { |
@@ -25,10 +41,9 @@ static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, |
uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count)); |
for (int i = 0; i < numTextures; ++i) { |
const GrTextureAccess& access = proc.textureAccess(i); |
- bool isExternal = (GR_GL_TEXTURE_EXTERNAL == |
- static_cast<GrGLTexture*>(access.getTexture())->target()); |
- k16[i] = caps.configTextureSwizzle(access.getTexture()->config()).asKey() | |
- (isExternal ? 0xFF00 : 0x0000); |
+ GrGLTexture* texture = static_cast<GrGLTexture*>(access.getTexture()); |
+ k16[i] = caps.configTextureSwizzle(texture->config()).asKey() | |
+ (texture_target_key(texture->target()) << 16); |
} |
// zero the last 16 bits if the number of textures is odd. |
if (numTextures & 0x1) { |