diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGLAssembleInterface.cpp | 28 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCreateNullInterface.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/GrGLDefines.h | 22 | ||||
-rw-r--r-- | src/gpu/gl/GrGLInterface.cpp | 10 | ||||
-rw-r--r-- | src/gpu/gl/GrGLNoOpInterface.cpp | 10 | ||||
-rw-r--r-- | src/gpu/gl/GrGLNoOpInterface.h | 8 | ||||
-rw-r--r-- | src/gpu/gl/SkNullGLContext.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 1 |
9 files changed, 72 insertions, 11 deletions
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp index b0f0430ffb..89b21fdec3 100644 --- a/src/gpu/gl/GrGLAssembleInterface.cpp +++ b/src/gpu/gl/GrGLAssembleInterface.cpp @@ -70,14 +70,28 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { } GET_PROC(BeginQuery); GET_PROC(BindTexture); - GET_PROC(BlendFunc); + + if (extensions.has("GL_KHR_blend_equation_advanced")) { + GET_PROC_SUFFIX(BlendBarrier, KHR); + } else if (extensions.has("GL_NV_blend_equation_advanced")) { + GET_PROC_SUFFIX(BlendBarrier, NV); + } if (glVer >= GR_GL_VER(1,4) || - extensions.has("GL_ARB_imaging") || - extensions.has("GL_EXT_blend_color")) { + extensions.has("GL_ARB_imaging")) { GET_PROC(BlendColor); + } else if (extensions.has("GL_EXT_blend_color")) { + GET_PROC_SUFFIX(BlendColor, EXT); + } + + if (glVer >= GR_GL_VER(1,4) || + extensions.has("GL_ARB_imaging")) { + GET_PROC(BlendEquation); + } else if (extensions.has("GL_EXT_blend_subtract")) { + GET_PROC_SUFFIX(BlendEquation, EXT); } + GET_PROC(BlendFunc); GET_PROC(BufferData); GET_PROC(BufferSubData); GET_PROC(Clear); @@ -341,7 +355,15 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) { GET_PROC(BindBuffer); GET_PROC(BindTexture); GET_PROC_SUFFIX(BindVertexArray, OES); + + if (extensions.has("GL_KHR_blend_equation_advanced")) { + GET_PROC_SUFFIX(BlendBarrier, KHR); + } else if (extensions.has("GL_NV_blend_equation_advanced")) { + GET_PROC_SUFFIX(BlendBarrier, NV); + } + GET_PROC(BlendColor); + GET_PROC(BlendEquation); GET_PROC(BlendFunc); GET_PROC(BufferData); GET_PROC(BufferSubData); diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index c86a0bd2fd..512c672a65 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -357,6 +357,7 @@ const GrGLInterface* GrGLCreateNullInterface() { functions->fBindTexture = nullGLBindTexture; functions->fBindVertexArray = nullGLBindVertexArray; functions->fBlendColor = noOpGLBlendColor; + functions->fBlendEquation = noOpGLBlendEquation; functions->fBlendFunc = noOpGLBlendFunc; functions->fBufferData = nullGLBufferData; functions->fBufferSubData = noOpGLBufferSubData; diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h index ae4050014b..511659c492 100644 --- a/src/gpu/gl/GrGLDefines.h +++ b/src/gpu/gl/GrGLDefines.h @@ -45,6 +45,28 @@ /* GL_GEQUAL */ /* GL_ALWAYS */ +/* Basic OpenGL blend equations */ +#define GR_GL_FUNC_ADD 0x8006 +#define GR_GL_FUNC_SUBTRACT 0x800A +#define GR_GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* GL_KHR_blend_equation_advanced */ +#define GR_GL_SCREEN 0x9295 +#define GR_GL_OVERLAY 0x9296 +#define GR_GL_DARKEN 0x9297 +#define GR_GL_LIGHTEN 0x9298 +#define GR_GL_COLORDODGE 0x9299 +#define GR_GL_COLORBURN 0x929A +#define GR_GL_HARDLIGHT 0x929B +#define GR_GL_SOFTLIGHT 0x929C +#define GR_GL_DIFFERENCE 0x929E +#define GR_GL_EXCLUSION 0x92A0 +#define GR_GL_MULTIPLY 0x9294 +#define GR_GL_HSL_HUE 0x92AD +#define GR_GL_HSL_SATURATION 0x92AE +#define GR_GL_HSL_COLOR 0x92AF +#define GR_GL_HSL_LUMINOSITY 0x92B0 + /* BlendingFactorDest */ #define GR_GL_ZERO 0 #define GR_GL_ONE 1 diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index da1c3fc0e1..89f1f9ba65 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -114,8 +114,9 @@ bool GrGLInterface::validate() const { NULL == fFunctions.fBindAttribLocation || NULL == fFunctions.fBindBuffer || NULL == fFunctions.fBindTexture || + NULL == fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0 + NULL == fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0 NULL == fFunctions.fBlendFunc || - NULL == fFunctions.fBlendColor || // -> GL >= 1.4, ES >= 2.0 or extension NULL == fFunctions.fBufferData || NULL == fFunctions.fBufferSubData || NULL == fFunctions.fClear || @@ -321,6 +322,13 @@ bool GrGLInterface::validate() const { } } + if (fExtensions.has("GL_KHR_blend_equation_advanced") || + fExtensions.has("GL_NV_blend_equation_advanced")) { + if (NULL == fFunctions.fBlendBarrier) { + RETURN_FALSE_INTERFACE + } + } + if (fExtensions.has("GL_EXT_discard_framebuffer")) { // FIXME: Remove this once Chromium is updated to provide this function #if 0 diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp index 6b8880ed81..f588046455 100644 --- a/src/gpu/gl/GrGLNoOpInterface.cpp +++ b/src/gpu/gl/GrGLNoOpInterface.cpp @@ -27,7 +27,6 @@ static const char* kExtensions[] = { "GL_ARB_timer_query", "GL_ARB_draw_buffers", "GL_ARB_occlusion_query", - "GL_EXT_blend_color", "GL_EXT_stencil_wrap" }; @@ -48,15 +47,18 @@ const GrGLubyte* combined_extensions_string() { } } +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocation(GrGLuint program, + GrGLuint colorNumber, + const GrGLchar* name) { +} + GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) { } -GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocation(GrGLuint program, - GrGLuint colorNumber, - const GrGLchar* name) { +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendEquation(GrGLenum mode) { } GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendFunc(GrGLenum sfactor, diff --git a/src/gpu/gl/GrGLNoOpInterface.h b/src/gpu/gl/GrGLNoOpInterface.h index c7bc9d8cbb..b803b46097 100644 --- a/src/gpu/gl/GrGLNoOpInterface.h +++ b/src/gpu/gl/GrGLNoOpInterface.h @@ -13,14 +13,16 @@ // These are constants/functions that are common to the Null and Debug GL interface implementations. +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocation(GrGLuint program, + GrGLuint colorNumber, + const GrGLchar* name); + GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha); -GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocation(GrGLuint program, - GrGLuint colorNumber, - const GrGLchar* name); +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendEquation(GrGLenum mode); GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendFunc(GrGLenum sfactor, GrGLenum dfactor); diff --git a/src/gpu/gl/SkNullGLContext.cpp b/src/gpu/gl/SkNullGLContext.cpp index 69b559629c..cf07cb3ca2 100644 --- a/src/gpu/gl/SkNullGLContext.cpp +++ b/src/gpu/gl/SkNullGLContext.cpp @@ -360,6 +360,7 @@ static GrGLInterface* create_null_interface(State* state) { functions->fBindTexture = nullGLBindTexture; functions->fBindVertexArray = nullGLBindVertexArray; functions->fBlendColor = noOpGLBlendColor; + functions->fBlendEquation = noOpGLBlendEquation; functions->fBlendFunc = noOpGLBlendFunc; functions->fBufferData = nullGLBufferData; functions->fBufferSubData = noOpGLBufferSubData; diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp index 99219d0fd5..4569cc8f23 100644 --- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp +++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp @@ -30,6 +30,8 @@ static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) { return (GrGLFuncPtr) glBindTexture; } else if (0 == strcmp("glBlendColor", name)) { return (GrGLFuncPtr) glBlendColor; + } else if (0 == strcmp("glBlendEquation", name)) { + return (GrGLFuncPtr) glBlendEquation; } else if (0 == strcmp("glBlendFunc", name)) { return (GrGLFuncPtr) glBlendFunc; } else if (0 == strcmp("glBufferData", name)) { diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index 4c2acc3fc4..e60c519be3 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -850,6 +850,7 @@ const GrGLInterface* GrGLCreateDebugInterface() { functions->fBindTexture = debugGLBindTexture; functions->fBindVertexArray = debugGLBindVertexArray; functions->fBlendColor = noOpGLBlendColor; + functions->fBlendEquation = noOpGLBlendEquation; functions->fBlendFunc = noOpGLBlendFunc; functions->fBufferData = debugGLBufferData; functions->fBufferSubData = noOpGLBufferSubData; |