Don't call glTexSubImage2D w/ indexed texture format on desktop GL
Review URL: http://codereview.appspot.com/6374048/
git-svn-id: http://skia.googlecode.com/svn/trunk@4509 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 0e2036c..7c1306e 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -712,20 +712,17 @@
// in case we need a temporary, trimmed copy of the src pixels
SkAutoSMalloc<128 * 128> tempStorage;
+ // paletted textures cannot be partially updated
bool useTexStorage = isNewTexture &&
+ desc.fConfig != kIndex_8_GrPixelConfig &&
this->glCaps().texStorageSupport();
- if (useTexStorage) {
- if (kDesktop_GrGLBinding == this->glBinding()) {
- // 565 is not a sized internal format on desktop GL. So on desktop
- // with 565 we always use an unsized internal format to let the
- // system pick the best sized format to convert the 565 data to.
- // Since glTexStorage only allows sized internal formats we will
- // instead fallback to glTexImage2D.
- useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig;
- } else {
- // ES doesn't allow paletted textures to be used with tex storage
- useTexStorage = desc.fConfig != kIndex_8_GrPixelConfig;
- }
+
+ if (useTexStorage && kDesktop_GrGLBinding == this->glBinding()) {
+ // 565 is not a sized internal format on desktop GL. So on desktop with
+ // 565 we always use an unsized internal format to let the system pick
+ // the best sized format to convert the 565 data to. Since TexStorage
+ // only allows sized internal formats we will instead use TexImage2D.
+ useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig;
}
GrGLenum internalFormat;