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);
GLPtr<GrGLBindTextureProc> fBindTexture;
GLPtr<GrGLBlendColorProc> fBlendColor;
GLPtr<GrGLBlendFuncProc> fBlendFunc;
+ GLPtr<GrGLBlendEquationProc> fBlendEquation;
GLPtr<GrGLBlitFramebufferProc> fBlitFramebuffer;
GLPtr<GrGLBufferDataProc> fBufferData;
GLPtr<GrGLBufferSubDataProc> fBufferSubData;
interface->fBindTexture = glBindTexture;
interface->fBlendColor = glBlendColor;
interface->fBlendFunc = glBlendFunc;
+ interface->fBlendEquation = glBlendEquation;
interface->fBufferData = glBufferData;
interface->fBufferSubData = glBufferSubData;
interface->fClear = glClear;
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) {}
interface->fBindTexture = nullGLBindTexture;
interface->fBlendColor = nullGLBlendColor;
interface->fBlendFunc = nullGLBlendFunc;
+ interface->fBlendEquation = nullGLBlendEquation;
interface->fBufferData = nullGLBufferData;
interface->fBufferSubData = nullGLBufferSubData;
interface->fClear = nullGLClear;
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 ||
// 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 ||
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 ||
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);
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) {
interface->fBindTexture = debugGLBindTexture;
interface->fBlendColor = debugGLBlendColor;
interface->fBlendFunc = debugGLBlendFunc;
+ interface->fBlendEquation = debugGLBlendEquation;
interface->fBufferData = debugGLBufferData;
interface->fBufferSubData = debugGLBufferSubData;
interface->fClear = debugGLClear;
#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;
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);
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;
// 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;
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);
interface->fBindBuffer = glBindBuffer;
interface->fBindTexture = glBindTexture;
interface->fBlendColor = glBlendColor;
+ interface->fBlendEquation = glBlendEquation;
interface->fBlendFunc = glBlendFunc;
interface->fBufferData = (GrGLBufferDataProc)glBufferData;
interface->fBufferSubData = (GrGLBufferSubDataProc)glBufferSubData;