typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLBindFramebufferProc)(GrGLenum target, GrGLuint framebuffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLBindRenderbufferProc)(GrGLenum target, GrGLuint renderbuffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLBindTextureProc)(GrGLenum target, GrGLuint texture);
- 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* GrGLBindVertexArrayProc)(GrGLuint array);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLBlendBarrierProc)();
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLBlendColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
+ 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);
GLPtr<GrGLBindRenderbufferProc> fBindRenderbuffer;
GLPtr<GrGLBindTextureProc> fBindTexture;
GLPtr<GrGLBindVertexArrayProc> fBindVertexArray;
+ GLPtr<GrGLBlendBarrierProc> fBlendBarrier;
GLPtr<GrGLBlendColorProc> fBlendColor;
+ GLPtr<GrGLBlendEquationProc> fBlendEquation;
GLPtr<GrGLBlendFuncProc> fBlendFunc;
GLPtr<GrGLBlitFramebufferProc> fBlitFramebuffer;
GLPtr<GrGLBufferDataProc> fBufferData;
}
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);
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);
functions->fBindTexture = nullGLBindTexture;
functions->fBindVertexArray = nullGLBindVertexArray;
functions->fBlendColor = noOpGLBlendColor;
+ functions->fBlendEquation = noOpGLBlendEquation;
functions->fBlendFunc = noOpGLBlendFunc;
functions->fBufferData = nullGLBufferData;
functions->fBufferSubData = noOpGLBufferSubData;
/* 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
NULL == fFunctions.fBindAttribLocation ||
NULL == fFunctions.fBindBuffer ||
NULL == fFunctions.fBindTexture ||
+ NULL == fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0
+#if 0
+ // TODO: Re-enable validation for fBlendEquation when Chrome has it hooked up.
+ NULL == fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0
+#endif
NULL == fFunctions.fBlendFunc ||
- NULL == fFunctions.fBlendColor || // -> GL >= 1.4, ES >= 2.0 or extension
NULL == fFunctions.fBufferData ||
NULL == fFunctions.fBufferSubData ||
NULL == fFunctions.fClear ||
}
}
+ 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
"GL_ARB_timer_query",
"GL_ARB_draw_buffers",
"GL_ARB_occlusion_query",
- "GL_EXT_blend_color",
"GL_EXT_stencil_wrap"
};
}
}
+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,
// 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);
functions->fBindTexture = nullGLBindTexture;
functions->fBindVertexArray = nullGLBindVertexArray;
functions->fBlendColor = noOpGLBlendColor;
+ functions->fBlendEquation = noOpGLBlendEquation;
functions->fBlendFunc = noOpGLBlendFunc;
functions->fBufferData = nullGLBufferData;
functions->fBufferSubData = noOpGLBufferSubData;
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)) {
functions->fBindTexture = debugGLBindTexture;
functions->fBindVertexArray = debugGLBindVertexArray;
functions->fBlendColor = noOpGLBlendColor;
+ functions->fBlendEquation = noOpGLBlendEquation;
functions->fBlendFunc = noOpGLBlendFunc;
functions->fBufferData = debugGLBufferData;
functions->fBufferSubData = noOpGLBufferSubData;