diff options
author | 2012-04-18 14:39:58 +0000 | |
---|---|---|
committer | 2012-04-18 14:39:58 +0000 | |
commit | e788430144d1474329878abd1ddb39cc0ca52a0a (patch) | |
tree | 59be883ff714b0d930707c787194164e9720ec92 /src | |
parent | 7dadc748d96fdf6c1eadc960f1481807d2ac90cf (diff) |
Added glBlendEquation to GL interface
http://codereview.appspot.com/6057047/
git-svn-id: http://skia.googlecode.com/svn/trunk@3720 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/android/GrGLCreateNativeInterface_android.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCreateNullInterface.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLInterface.cpp | 13 | ||||
-rw-r--r-- | src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp | 18 | ||||
-rw-r--r-- | src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp | 16 | ||||
-rw-r--r-- | src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp | 16 | ||||
-rw-r--r-- | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp | 16 | ||||
-rw-r--r-- | src/gpu/ios/GrGLDefaultInterface_iOS.cpp | 1 |
10 files changed, 74 insertions, 12 deletions
diff --git a/src/gpu/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/android/GrGLCreateNativeInterface_android.cpp index db629f20d6..41bcab8325 100644 --- a/src/gpu/android/GrGLCreateNativeInterface_android.cpp +++ b/src/gpu/android/GrGLCreateNativeInterface_android.cpp @@ -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; diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index 5095079ab6..7fd4d0df8d 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -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; diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index 39732dbb68..57de3e03fc 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -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 || diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp index 8cc7ad59ce..19c4532737 100644 --- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp +++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp @@ -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); diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index ff744c0e66..120381e29e 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -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; diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp index 5ae214ae9e..6a56eb5b9a 100644 --- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp +++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp @@ -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; diff --git a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp index 4686438c62..7fb58958ef 100644 --- a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp +++ b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp @@ -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); diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp index be915ace81..0da63b57f7 100644 --- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp +++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp @@ -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; diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp index 2048974add..5b2d10b99d 100644 --- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp +++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp @@ -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); diff --git a/src/gpu/ios/GrGLDefaultInterface_iOS.cpp b/src/gpu/ios/GrGLDefaultInterface_iOS.cpp index 9fc953fdfc..8923f6e7fd 100644 --- a/src/gpu/ios/GrGLDefaultInterface_iOS.cpp +++ b/src/gpu/ios/GrGLDefaultInterface_iOS.cpp @@ -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; |