Added glBlendEquation to GL interface
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 18 Apr 2012 14:39:58 +0000 (14:39 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 18 Apr 2012 14:39:58 +0000 (14:39 +0000)
http://codereview.appspot.com/6057047/

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

include/gpu/gl/GrGLInterface.h
src/gpu/android/GrGLCreateNativeInterface_android.cpp
src/gpu/gl/GrGLCreateNullInterface.cpp
src/gpu/gl/GrGLInterface.cpp
src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
src/gpu/ios/GrGLDefaultInterface_iOS.cpp

index 876c072f9458fc021886a08366f13daedabfeb8e..4b76defa5b74ead13c50a704bd307869f24bfc12 100644 (file)
@@ -155,6 +155,7 @@ extern "C" {
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationProc)(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationIndexedProc)(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name);
+    typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendEquationProc)(GrGLenum mode);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendFuncProc)(GrGLenum sfactor, GrGLenum dfactor);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlitFramebufferProc)(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferDataProc)(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage);
@@ -318,6 +319,7 @@ public:
     GLPtr<GrGLBindTextureProc> fBindTexture;
     GLPtr<GrGLBlendColorProc> fBlendColor;
     GLPtr<GrGLBlendFuncProc> fBlendFunc;
+    GLPtr<GrGLBlendEquationProc> fBlendEquation;
     GLPtr<GrGLBlitFramebufferProc> fBlitFramebuffer;
     GLPtr<GrGLBufferDataProc> fBufferData;
     GLPtr<GrGLBufferSubDataProc> fBufferSubData;
index db629f20d6f47f7980291fa2d0d1f379decbc42c..41bcab8325c90fd50bae8a99432e6865ed7c62e6 100644 (file)
@@ -26,6 +26,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
         interface->fBindTexture = glBindTexture;
         interface->fBlendColor = glBlendColor;
         interface->fBlendFunc = glBlendFunc;
+        interface->fBlendEquation = glBlendEquation;
         interface->fBufferData = glBufferData;
         interface->fBufferSubData = glBufferSubData;
         interface->fClear = glClear;
index 5095079ab6757cd72c7007d309e86da85bf4fc3e..7fd4d0df8d57cea60cdc012e6cd88c75c490db49 100644 (file)
@@ -18,6 +18,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture
 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBlendColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) {}
 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFragDataLocation(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name) {}
 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBlendFunc(GrGLenum sfactor, GrGLenum dfactor) {}
+GrGLvoid GR_GL_FUNCTION_TYPE nullGLBlendEquation(GrGLenum mode) {}
 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage) {}
 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferSubData(GrGLenum target, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid* data) {}
 GrGLvoid GR_GL_FUNCTION_TYPE nullGLClear(GrGLbitfield mask) {}
@@ -394,6 +395,7 @@ const GrGLInterface* GrGLCreateNullInterface() {
         interface->fBindTexture = nullGLBindTexture;
         interface->fBlendColor = nullGLBlendColor;
         interface->fBlendFunc = nullGLBlendFunc;
+        interface->fBlendEquation = nullGLBlendEquation;
         interface->fBufferData = nullGLBufferData;
         interface->fBufferSubData = nullGLBufferSubData;
         interface->fClear = nullGLClear;
index 39732dbb683dcc37571ecd8f334dedc42e9a043c..57de3e03fc05ef6172191ac1660a89b03f8a5503 100644 (file)
@@ -174,6 +174,8 @@ bool GrGLInterface::validate(GrGLBinding binding) const {
         NULL == fBindBuffer ||
         NULL == fBindTexture ||
         NULL == fBlendFunc ||
+        NULL == fBlendColor ||      // -> GL >= 1.4, ES >= 2.0 or extension
+        NULL == fBlendEquation ||   // -> GL >= 1.4, ES >= 2.0 or extension
         NULL == fBufferData ||
         NULL == fBufferSubData ||
         NULL == fClear ||
@@ -270,13 +272,13 @@ bool GrGLInterface::validate(GrGLBinding binding) const {
     // On the desktop we assume they are available if the extension
     // is present or GL version is high enough.
     if (kES2_GrGLBinding == binding) {
-        if (NULL == fBlendColor ||
-            NULL == fStencilFuncSeparate ||
+        if (NULL == fStencilFuncSeparate ||
             NULL == fStencilMaskSeparate ||
             NULL == fStencilOpSeparate) {
             return false;
         }
     } else if (kDesktop_GrGLBinding == binding) {
+
         if (glVer >= GR_GL_VER(2,0)) {
             if (NULL == fStencilFuncSeparate ||
                 NULL == fStencilMaskSeparate ||
@@ -293,12 +295,7 @@ bool GrGLInterface::validate(GrGLBinding binding) const {
                 return false;
             }
         }
-        if (glVer >= GR_GL_VER(1,4) ||
-            GrGLHasExtensionFromString("GL_EXT_blend_color", ext)) {
-            if (NULL == fBlendColor) {
-                return false;
-            }
-        }
+
         if (glVer >= GR_GL_VER(1,5) ||
             GrGLHasExtensionFromString("GL_ARB_occlusion_query", ext)) {
             if (NULL == fGenQueries ||
index 8cc7ad59ced377b0387cc8ef0072f42f75682302..19c453273759b274eff91ca6383842dd0d597b77 100644 (file)
@@ -46,6 +46,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
         GR_GET_PROC(GrGLBindTextureProc,        BindTexture);
         GR_GET_PROC(GrGLBlendColorProc,         BlendColor);
         GR_GET_PROC(GrGLBlendFuncProc,          BlendFunc);
+        GR_GET_PROC(GrGLBlendEquationProc,      BlendEquation);
         GR_GET_PROC(GrGLBufferDataProc,         BufferData);
         GR_GET_PROC(GrGLBufferSubDataProc,      BufferSubData);
         GR_GET_PROC(GrGLClearProc,              Clear);
index ff744c0e66ff7e39440ccebefbbd475ec58dd9bb..120381e29edd82ef838db705101ac60c2b91e8dc 100644 (file)
@@ -70,6 +70,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindTexture(GrGLenum target, GrGLuint textur
 GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) {}
 GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFragDataLocation(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name) {}
 GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendFunc(GrGLenum sfactor, GrGLenum dfactor) {}
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendEquation(GrGLenum mode) {}
 
 ////////////////////////////////////////////////////////////////////////////////
 GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage) {
@@ -924,6 +925,7 @@ const GrGLInterface* GrGLCreateDebugInterface() {
         interface->fBindTexture = debugGLBindTexture;
         interface->fBlendColor = debugGLBlendColor;
         interface->fBlendFunc = debugGLBlendFunc;
+        interface->fBlendEquation = debugGLBlendEquation;
         interface->fBufferData = debugGLBufferData;
         interface->fBufferSubData = debugGLBufferSubData;
         interface->fClear = debugGLClear;
index 5ae214ae9efb006f74df2ee0642a6fe0d0027229..6a56eb5b9a98d473bbb26b626187cd2ea04e281e 100644 (file)
@@ -52,8 +52,24 @@ const GrGLInterface* GrGLCreateNativeInterface() {
             #endif
         }
         interface->fBindTexture = glBindTexture;
-        interface->fBlendColor = glBlendColor;
         interface->fBlendFunc = glBlendFunc;
+
+        if (ver >= GR_GL_VER(1,4)) {
+            interface->fBlendColor = glBlendColor;
+            interface->fBlendEquation = glBlendEquation;
+        } else if (GrGLHasExtensionFromString("GL_ARB_imaging", extStr)) {
+            GET_PROC(BlendColor);
+            GET_PROC(BlendEquation);
+        } else {
+            if (GrGLHasExtensionFromString("GL_EXT_blend_color", extStr)) {
+                GET_PROC_SUFFIX(BlendColor, EXT);
+            } 
+            if (GrGLHasExtensionFromString("GL_EXT_blend_minmax", extStr) ||
+                GrGLHasExtensionFromString("GL_EXT_blend_subtract", extStr)) {
+                GET_PROC_SUFFIX(BlendEquation, EXT);
+            } 
+        } 
+
         interface->fBufferData = glBufferData;
         interface->fBufferSubData = glBufferSubData;
         interface->fClear = glClear;
index 4686438c620746b0a993ec258a1f311ca3288fea..7fb58958ef3ff389d105ce0e7dbed2fbb8dcc688 100644 (file)
@@ -40,8 +40,22 @@ const GrGLInterface* GrGLCreateMesaInterface() {
         GR_GL_GET_PROC(BindBuffer);
         GR_GL_GET_PROC(BindFragDataLocation);
         GR_GL_GET_PROC(BindTexture);
-        GR_GL_GET_PROC(BlendColor);
         GR_GL_GET_PROC(BlendFunc);
+
+        if (glVer >= GR_GL_VER(1,4) ||
+            GrGLHasExtensionFromString("GL_ARB_imaging", extString)) {
+            GR_GL_GET_PROC(BlendColor);
+            GR_GL_GET_PROC(BlendEquation);
+        } else {
+            if (GrGLHasExtensionFromString("GL_EXT_blend_color", extString)) {
+                GR_GL_GET_PROC_SUFFIX(BlendColor, EXT);
+            } 
+            if (GrGLHasExtensionFromString("GL_EXT_blend_minmax", extString) ||
+                GrGLHasExtensionFromString("GL_EXT_blend_subtract", extString)) {
+                GR_GL_GET_PROC_SUFFIX(BlendEquation, EXT);
+            } 
+        } 
+
         GR_GL_GET_PROC(BufferData);
         GR_GL_GET_PROC(BufferSubData);
         GR_GL_GET_PROC(Clear);
index be915ace81327daecfc0269e89915004695c33e8..0da63b57f71ec5b22302089625e6deb1c5907476 100644 (file)
@@ -39,8 +39,22 @@ const GrGLInterface* GrGLCreateNativeInterface() {
         GR_GL_GET_PROC(BindFragDataLocation);
         GR_GL_GET_PROC(BeginQuery);
         interface->fBindTexture = glBindTexture;
-        interface->fBlendColor = glBlendColor;
         interface->fBlendFunc = glBlendFunc;
+
+        if (glVer >= GR_GL_VER(1,4) ||
+            GrGLHasExtensionFromString("GL_ARB_imaging", extString)) {
+            GR_GL_GET_PROC(BlendColor);
+            GR_GL_GET_PROC(BlendEquation);
+        } else {
+            if (GrGLHasExtensionFromString("GL_EXT_blend_color", extString)) {
+                GR_GL_GET_PROC_SUFFIX(BlendColor, EXT);
+            } 
+            if (GrGLHasExtensionFromString("GL_EXT_blend_minmax", extString) ||
+                GrGLHasExtensionFromString("GL_EXT_blend_subtract", extString)) {
+                GR_GL_GET_PROC_SUFFIX(BlendEquation, EXT);
+            } 
+        } 
+
         GR_GL_GET_PROC(BufferData);
         GR_GL_GET_PROC(BufferSubData);
         interface->fClear = glClear;
index 2048974adde2c7b6a151b4d003c08d7ddc27aac7..5b2d10b99d4f5403f37cf59873b111d16b471e9c 100644 (file)
@@ -41,6 +41,21 @@ const GrGLInterface* GrGLCreateNativeInterface() {
         // wglGetProcAddress
         interface->fBindTexture = glBindTexture;
         interface->fBlendFunc = glBlendFunc;
+
+        if (glVer >= GR_GL_VER(1,4) ||
+            GrGLHasExtensionFromString("GL_ARB_imaging", extString)) {
+            GR_GL_GET_PROC(BlendColor);
+            GR_GL_GET_PROC(BlendEquation);
+        } else {
+            if (GrGLHasExtensionFromString("GL_EXT_blend_color", extString)) {
+                GR_GL_GET_PROC_SUFFIX(BlendColor, EXT);
+            } 
+            if (GrGLHasExtensionFromString("GL_EXT_blend_minmax", extString) ||
+                GrGLHasExtensionFromString("GL_EXT_blend_subtract", extString)) {
+                GR_GL_GET_PROC_SUFFIX(BlendEquation, EXT);
+            } 
+        } 
+
         interface->fClear = glClear;
         interface->fClearColor = glClearColor;
         interface->fClearStencil = glClearStencil;
@@ -87,7 +102,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
         GR_GL_GET_PROC(BindAttribLocation);
         GR_GL_GET_PROC(BindBuffer);
         GR_GL_GET_PROC(BindFragDataLocation);
-        GR_GL_GET_PROC(BlendColor);
         GR_GL_GET_PROC(BufferData);
         GR_GL_GET_PROC(BufferSubData);
         GR_GL_GET_PROC(CompileShader);
index 9fc953fdfca42b11d7b57e8e7b60fa84c71bae4b..8923f6e7fdff81d5be0f19d4c2a3ec64ba3664dd 100644 (file)
@@ -24,6 +24,7 @@ const GrGLInterface* GrGLDefaultInterface() {
         interface->fBindBuffer = glBindBuffer;
         interface->fBindTexture = glBindTexture;
         interface->fBlendColor = glBlendColor;
+        interface->fBlendEquation = glBlendEquation;
         interface->fBlendFunc = glBlendFunc;
         interface->fBufferData = (GrGLBufferDataProc)glBufferData;
         interface->fBufferSubData = (GrGLBufferSubDataProc)glBufferSubData;