fix gl error of 'invalid enum' from GL_COLOR_TABLE
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 18 Jun 2012 12:47:06 +0000 (12:47 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 18 Jun 2012 12:47:06 +0000 (12:47 +0000)
Committed on behalf of Guanqun.Lu@gmail.com

Review URL: http://codereview.appspot.com/6300106/

git-svn-id: http://skia.googlecode.com/svn/trunk@4272 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/gl/GrGLCaps.cpp
src/gpu/gl/GrGLCaps.h
src/gpu/gl/GrGpuGL.cpp

index 7b2bb35..ec125b7 100644 (file)
@@ -34,6 +34,7 @@ void GrGLCaps::reset() {
     fTextureUsageSupport = false;
     fTexStorageSupport = false;
     fTextureRedSupport = false;
+    fImagingSupport = false;
 }
 
 GrGLCaps::GrGLCaps(const GrGLCaps& caps) {
@@ -61,6 +62,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
     fTextureUsageSupport = caps.fTextureUsageSupport;
     fTexStorageSupport = caps.fTexStorageSupport;
     fTextureRedSupport = caps.fTextureRedSupport;
+    fImagingSupport = caps.fImagingSupport;
 
     return *this;
 }
@@ -146,6 +148,9 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) {
         fTextureRedSupport = ctxInfo.hasExtension("GL_EXT_texture_rg");
     }
 
+    fImagingSupport = kDesktop_GrGLBinding == binding &&
+                      ctxInfo.hasExtension("GL_ARB_imaging");
+
     this->initFSAASupport(ctxInfo);
     this->initStencilFormats(ctxInfo);
 }
index 70f17bd..ec75a53 100644 (file)
@@ -211,6 +211,9 @@ public:
     /// Is there support for GL_RED and GL_R8
     bool textureRedSupport() const { return fTextureRedSupport; }
 
+    /// Is GL_ARB_IMAGING supported
+    bool imagingSupport() const { return fImagingSupport; }
+
 private:
     /**
      * Maintains a bit per GrPixelConfig. It is used to avoid redundantly
@@ -281,6 +284,7 @@ private:
     bool fTextureUsageSupport : 1;
     bool fTexStorageSupport : 1;
     bool fTextureRedSupport : 1;
+    bool fImagingSupport  : 1;
 };
 
 #endif
index 6549e05..dd65394 100644 (file)
@@ -468,7 +468,9 @@ void GrGpuGL::onResetContext() {
         GL_CALL(Disable(GR_GL_POLYGON_SMOOTH));
         GL_CALL(Disable(GR_GL_POLYGON_STIPPLE));
         GL_CALL(Disable(GR_GL_COLOR_LOGIC_OP));
-        GL_CALL(Disable(GR_GL_COLOR_TABLE));
+        if (this->glCaps().imagingSupport()) {
+            GL_CALL(Disable(GR_GL_COLOR_TABLE));
+        }
         GL_CALL(Disable(GR_GL_INDEX_LOGIC_OP));
         GL_CALL(Disable(GR_GL_POLYGON_OFFSET_FILL));
         // Since ES doesn't support glPointSize at all we always use the VS to