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

Unified Diff: src/gpu/gl/GrGLProgramDesc.cpp

Issue 1593643002: Fix GL texture target program key (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tiny fix Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgramDesc.cpp
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 5edacf5721859d86e484f882d52053dca3eacc73..cfb10b2eaa91935370aea8bdf4917ef1d74028e6 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -17,8 +17,17 @@
#include "glsl/GrGLSLCaps.h"
static uint16_t texture_target_key(GrGLenum target) {
- SkASSERT((uint32_t)target < SK_MaxU16);
- return target;
+ 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.");
+ return 0;
+ }
}
static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
@@ -33,8 +42,8 @@ static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
for (int i = 0; i < numTextures; ++i) {
const GrTextureAccess& access = proc.textureAccess(i);
GrGLTexture* texture = static_cast<GrGLTexture*>(access.getTexture());
- k16[i] = caps.configTextureSwizzle(texture->config()).asKey() |
- (texture_target_key(texture->target()) << 16);
+ k16[i] = SkToU16(caps.configTextureSwizzle(texture->config()).asKey() |
+ (texture_target_key(texture->target()) << 8));
egdaniel 2016/01/15 15:40:28 Do we want texture_target_key to return a uint8_t?
}
// zero the last 16 bits if the number of textures is odd.
if (numTextures & 0x1) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698