Cleanup handling of GL versions, fix function names
Review URL: http://codereview.appspot.com/5097044/
git-svn-id: http://skia.googlecode.com/svn/trunk@2308 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrGLInterface.h b/gpu/include/GrGLInterface.h
index d3e27f8..303a853 100644
--- a/gpu/include/GrGLInterface.h
+++ b/gpu/include/GrGLInterface.h
@@ -24,17 +24,17 @@
* Helpers for glGetString()
*/
+typedef GrFixed GrGLVersion;
+
+#define GR_GL_VER(major, minor) (((int)(major) << 16) | ((int)(minor)))
+
// these variants assume caller already has a string from glGetString()
-void gl_version_from_string(int* major, int* minor,
- const char* versionString);
-float gl_version_as_float_from_string(const char* versionString);
-bool has_gl_extension_from_string(const char* ext,
- const char* extensionString);
+GrGLVersion GrGLGetVersionFromString(const char* versionString);
+bool GrGLHasExtensionFromString(const char* ext, const char* extensionString);
// these variants call glGetString()
-bool has_gl_extension(const GrGLInterface*, const char* ext);
-void gl_version(const GrGLInterface*, int* major, int* minor);
-float gl_version_as_float(const GrGLInterface*);
+bool GrGLGetString(const GrGLInterface*, const char* ext);
+GrGLVersion GrGLGetVersion(const GrGLInterface*);
////////////////////////////////////////////////////////////////////////////////
diff --git a/gpu/src/GrGLInterface.cpp b/gpu/src/GrGLInterface.cpp
index e943d58..0b433d1 100644
--- a/gpu/src/GrGLInterface.cpp
+++ b/gpu/src/GrGLInterface.cpp
@@ -19,58 +19,31 @@
}
#endif
-void gl_version_from_string(int* major, int* minor,
- const char* versionString) {
- if (NULL == versionString) {
- GrAssert(0);
- *major = 0;
- *minor = 0;
- return;
- }
+GrGLVersion GrGLGetVersionFromString(const char* versionString) {
+ GrAssert(versionString);
+ int major, minor;
- int n = sscanf(versionString, "%d.%d", major, minor);
+ int n = sscanf(versionString, "%d.%d", &major, &minor);
if (2 == n) {
- return;
+ return GR_GL_VER(major, minor);
}
char profile[2];
n = sscanf(versionString, "OpenGL ES-%c%c %d.%d", profile, profile+1,
- major, minor);
- bool ok = 4 == n;
- if (!ok) {
- n = sscanf(versionString, "OpenGL ES %d.%d", major, minor);
- ok = 2 == n;
+ &major, &minor);
+ if (4 == n) {
+ return GR_GL_VER(major, minor);
+ }
+
+ n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor);
+ if (2 == n) {
+ return GR_GL_VER(major, minor);
}
- if (!ok) {
- GrAssert(0);
- *major = 0;
- *minor = 0;
- return;
- }
+ return 0;
}
-float gl_version_as_float_from_string(const char* versionString) {
- int major, minor;
- gl_version_from_string(&major, &minor, versionString);
- GrAssert(minor >= 0);
- // AFAIK there are only single digit minor numbers
- if (minor < 10) {
- return major + minor / 10.f;
- } else if (minor < 100) {
- return major + minor / 100.f;
- } else if (minor < 1000) {
- return major + minor / 1000.f;
- } else {
- GrAssert(!"Why so many digits in minor revision number?");
- char temp[32];
- sprintf(temp, "%d.%d", major, minor);
- return (float) atof(temp);
- }
-}
-
-bool has_gl_extension_from_string(const char* ext,
- const char* extensionString) {
+bool GrGLHasExtensionFromString(const char* ext, const char* extensionString) {
int extLength = strlen(ext);
while (true) {
@@ -87,22 +60,16 @@
return false;
}
-bool has_gl_extension(const GrGLInterface* gl, const char* ext) {
+bool GrGLHasExtension(const GrGLInterface* gl, const char* ext) {
const GrGLubyte* glstr;
GR_GL_CALL_RET(gl, glstr, GetString(GR_GL_EXTENSIONS));
- return has_gl_extension_from_string(ext, (const char*) glstr);
+ return GrGLHasExtensionFromString(ext, (const char*) glstr);
}
-void gl_version(const GrGLInterface* gl, int* major, int* minor) {
+GrGLVersion GrGLGetVersion(const GrGLInterface* gl) {
const GrGLubyte* v;
GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION));
- gl_version_from_string(major, minor, (const char*) v);
-}
-
-float gl_version_as_float(const GrGLInterface* gl) {
- const GrGLubyte* v;
- GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION));
- return gl_version_as_float_from_string((const char*)v);
+ return GrGLGetVersionFromString((const char*) v);
}
GrGLInterface::GrGLInterface() {
@@ -379,10 +346,8 @@
return false;
}
- int major, minor;
const char* ext;
-
- gl_version(this, &major, &minor);
+ GrGLVersion glVer = GrGLGetVersion(this);
ext = (const char*)fGetString(GR_GL_EXTENSIONS);
// Now check that baseline ES/Desktop fns not covered above are present
@@ -400,24 +365,24 @@
return false;
}
} else if (kDesktop_GrGLBinding == fBindingsExported) {
- if (major >= 2) {
+ if (glVer >= GR_GL_VER(2,0)) {
if (NULL == fStencilFuncSeparate ||
NULL == fStencilMaskSeparate ||
NULL == fStencilOpSeparate) {
return false;
}
}
- if (major >= 3 && NULL == fBindFragDataLocation) {
+ if (glVer >= GR_GL_VER(3,0) && NULL == fBindFragDataLocation) {
return false;
}
- if (major >= 2 ||
- has_gl_extension_from_string("GL_ARB_draw_buffers", ext)) {
+ if (glVer >= GR_GL_VER(2,0) ||
+ GrGLHasExtensionFromString("GL_ARB_draw_buffers", ext)) {
if (NULL == fDrawBuffers) {
return false;
}
}
- if (1 < major || (1 == major && 4 <= minor) ||
- has_gl_extension_from_string("GL_EXT_blend_color", ext)) {
+ if (glVer >= GR_GL_VER(1,4) ||
+ GrGLHasExtensionFromString("GL_EXT_blend_color", ext)) {
if (NULL == fBlendColor) {
return false;
}
@@ -426,8 +391,8 @@
// optional function on desktop before 1.3
if (kDesktop_GrGLBinding != fBindingsExported ||
- (1 < major || (1 == major && 3 <= minor)) ||
- has_gl_extension_from_string("GL_ARB_texture_compression", ext)) {
+ (glVer >= GR_GL_VER(1,3) ||
+ GrGLHasExtensionFromString("GL_ARB_texture_compression", ext))) {
if (NULL == fCompressedTexImage2D) {
return false;
}
@@ -445,29 +410,29 @@
// FBO MSAA
if (kDesktop_GrGLBinding == fBindingsExported) {
// GL 3.0 and the ARB extension have multisample + blit
- if ((major >= 3) || has_gl_extension_from_string("GL_ARB_framebuffer_object", ext)) {
+ if (glVer >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuffer_object", ext)) {
if (NULL == fRenderbufferStorageMultisample ||
NULL == fBlitFramebuffer) {
return false;
}
} else {
- if (has_gl_extension_from_string("GL_EXT_framebuffer_blit", ext) &&
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit", ext) &&
NULL == fBlitFramebuffer) {
return false;
}
- if (has_gl_extension_from_string("GL_EXT_framebuffer_multisample", ext) &&
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", ext) &&
NULL == fRenderbufferStorageMultisample) {
return false;
}
}
} else {
- if (has_gl_extension_from_string("GL_CHROMIUM_framebuffer_multisample", ext)) {
+ if (GrGLHasExtensionFromString("GL_CHROMIUM_framebuffer_multisample", ext)) {
if (NULL == fRenderbufferStorageMultisample ||
NULL == fBlitFramebuffer) {
return false;
}
}
- if (has_gl_extension_from_string("GL_APPLE_framebuffer_multisample", ext)) {
+ if (GrGLHasExtensionFromString("GL_APPLE_framebuffer_multisample", ext)) {
if (NULL == fRenderbufferStorageMultisample ||
NULL == fResolveMultisampleFramebuffer) {
return false;
@@ -479,7 +444,7 @@
// buffer mapping was part of original VBO extension
// which we require.
if (kDesktop_GrGLBinding == fBindingsExported ||
- has_gl_extension_from_string("GL_OES_mapbuffer", ext)) {
+ GrGLHasExtensionFromString("GL_OES_mapbuffer", ext)) {
if (NULL == fMapBuffer ||
NULL == fUnmapBuffer) {
return false;
@@ -488,8 +453,8 @@
// Dual source blending
if (kDesktop_GrGLBinding == fBindingsExported &&
- (has_gl_extension_from_string("GL_ARB_blend_func_extended", ext) ||
- (3 < major) || (3 == major && 3 <= minor))) {
+ (glVer >= GR_GL_VER(3,3) ||
+ GrGLHasExtensionFromString("GL_ARB_blend_func_extended", ext))) {
if (NULL == fBindFragDataLocationIndexed) {
return false;
}
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp
index fefc914..9906037 100644
--- a/gpu/src/GrGpuGL.cpp
+++ b/gpu/src/GrGpuGL.cpp
@@ -297,7 +297,8 @@
GrPrintf("------ EXTENSIONS\n %s \n", ext);
}
- fGLVersion = gl_version_as_float(gl);
+ fGLVersion = GrGLGetVersion(gl);
+ GrAssert(0 != fGLVersion);
fExtensionString = (const char*) ext;
this->resetDirtyFlags();
@@ -361,7 +362,7 @@
fMSFBOType = kAppleES_MSFBO;
}
} else {
- if ((fGLVersion >= 3.f) || this->hasExtension("GL_ARB_framebuffer_object")) {
+ if ((fGLVersion >= GR_GL_VER(3,0)) || this->hasExtension("GL_ARB_framebuffer_object")) {
fMSFBOType = kDesktopARB_MSFBO;
} else if (this->hasExtension("GL_EXT_framebuffer_multisample") &&
this->hasExtension("GL_EXT_framebuffer_blit")) {
@@ -405,10 +406,11 @@
fFSAASupport = fAASamples[kHigh_GrAALevel] > 0;
if (kDesktop_GrGLBinding == this->glBinding()) {
- fHasStencilWrap = (fGLVersion >= 1.4f) ||
+ fHasStencilWrap = (fGLVersion >= GR_GL_VER(1,4)) ||
this->hasExtension("GL_EXT_stencil_wrap");
} else {
- fHasStencilWrap = (fGLVersion >= 2.0f) || this->hasExtension("GL_OES_stencil_wrap");
+ fHasStencilWrap = (fGLVersion >= GR_GL_VER(2,0)) ||
+ this->hasExtension("GL_OES_stencil_wrap");
}
if (gPrintStartupSpew) {
GrPrintf("Stencil Wrap: %s\n", (fHasStencilWrap ? "YES" : "NO"));
@@ -418,16 +420,16 @@
// we could also look for GL_ATI_separate_stencil extension or
// GL_EXT_stencil_two_side but they use different function signatures
// than GL2.0+ (and than each other).
- fTwoSidedStencilSupport = (fGLVersion >= 2.f);
+ fTwoSidedStencilSupport = (fGLVersion >= GR_GL_VER(2,0));
// supported on GL 1.4 and higher or by extension
- fStencilWrapOpsSupport = (fGLVersion >= 1.4f) ||
+ fStencilWrapOpsSupport = (fGLVersion >= GR_GL_VER(1,4)) ||
this->hasExtension("GL_EXT_stencil_wrap");
} else {
// ES 2 has two sided stencil but 1.1 doesn't. There doesn't seem to be
// an ES1 extension.
- fTwoSidedStencilSupport = (fGLVersion >= 2.f);
+ fTwoSidedStencilSupport = (fGLVersion >= GR_GL_VER(2,0));
// stencil wrap support is in ES2, ES1 requires extension.
- fStencilWrapOpsSupport = (fGLVersion >= 2.f) ||
+ fStencilWrapOpsSupport = (fGLVersion >= GR_GL_VER(2,0)) ||
this->hasExtension("GL_OES_stencil_wrap");
}
if (gPrintStartupSpew) {
@@ -464,7 +466,7 @@
}
if (kDesktop_GrGLBinding == this->glBinding()) {
- if (fGLVersion >= 2.f ||
+ if (fGLVersion >= GR_GL_VER(2,0) ||
this->hasExtension("GL_ARB_texture_non_power_of_two")) {
fNPOTTextureTileSupport = true;
fNPOTTextureSupport = true;
@@ -473,7 +475,7 @@
fNPOTTextureSupport = false;
}
} else {
- if (fGLVersion >= 2.f) {
+ if (fGLVersion >= GR_GL_VER(2,0)) {
fNPOTTextureSupport = true;
fNPOTTextureTileSupport = this->hasExtension("GL_OES_texture_npot");
} else {
@@ -717,7 +719,7 @@
gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true };
if (kDesktop_GrGLBinding == this->glBinding()) {
- bool supportsPackedDS = fGLVersion >= 3.0f ||
+ bool supportsPackedDS = fGLVersion >= GR_GL_VER(3,0) ||
this->hasExtension("GL_EXT_packed_depth_stencil") ||
this->hasExtension("GL_ARB_framebuffer_object");
@@ -741,7 +743,8 @@
// GL_OES_packed_depth_stencil adds DEPTH24_STENCIL8
// ES doesn't support using the unsized formats.
- if (fGLVersion >= 2.f || this->hasExtension("GL_OES_stencil8")) {
+ if (fGLVersion >= GR_GL_VER(2,0) ||
+ this->hasExtension("GL_OES_stencil8")) {
fStencilFormats.push_back() = gS8;
}
//fStencilFormats.push_back() = gS16;
diff --git a/gpu/src/GrGpuGL.h b/gpu/src/GrGpuGL.h
index 67df419..a38d6b6 100644
--- a/gpu/src/GrGpuGL.h
+++ b/gpu/src/GrGpuGL.h
@@ -26,7 +26,7 @@
const GrGLInterface* glInterface() const { return fGL; }
GrGLBinding glBinding() const { return fGLBinding; }
- float glVersion() const { return fGLVersion; }
+ GrGLVersion glVersion() const { return fGLVersion; }
protected:
GrGpuGL(const GrGLInterface* glInterface, GrGLBinding glBinding);
@@ -129,7 +129,7 @@
GrBlendCoeff dstCoeff);
bool hasExtension(const char* ext) {
- return has_gl_extension_from_string(ext, fExtensionString.c_str());
+ return GrGLHasExtensionFromString(ext, fExtensionString.c_str());
}
// adjusts texture matrix to account for orientation, size, and npotness
@@ -192,7 +192,7 @@
// read these once at begining and then never again
SkString fExtensionString;
- float fGLVersion;
+ GrGLVersion fGLVersion;
SkTArray<GrGLStencilBuffer::Format, true> fStencilFormats;
// we want to clear stencil buffers when they are created. We want to clear
diff --git a/gpu/src/GrGpuGLShaders.cpp b/gpu/src/GrGpuGLShaders.cpp
index 28a6e07..7d15c4f 100644
--- a/gpu/src/GrGpuGLShaders.cpp
+++ b/gpu/src/GrGpuGLShaders.cpp
@@ -141,12 +141,13 @@
namespace {
-GrGLProgram::GLSLVersion get_glsl_version(GrGLBinding binding, float glVersion) {
+GrGLProgram::GLSLVersion get_glsl_version(GrGLBinding binding, GrGLVersion glVersion) {
switch (binding) {
case kDesktop_GrGLBinding:
// TODO: proper check of the glsl version string
- return (glVersion >= 3.0) ? GrGLProgram::k130_GLSLVersion :
- GrGLProgram::k120_GLSLVersion;
+ return (glVersion >= GR_GL_VER(3,0)) ?
+ GrGLProgram::k130_GLSLVersion :
+ GrGLProgram::k120_GLSLVersion;
case kES2_GrGLBinding:
return GrGLProgram::k120_GLSLVersion;
default:
@@ -292,8 +293,7 @@
fShaderSupport = true;
if (kDesktop_GrGLBinding == this->glBinding()) {
fDualSourceBlendingSupport =
- this->glVersion() >= 3.25f || // TODO: when resolving Issue 387 change
- // this back to 3.3
+ this->glVersion() >= GR_GL_VER(3,3) ||
this->hasExtension("GL_ARB_blend_func_extended");
fShaderDerivativeSupport = true;
} else {
diff --git a/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp b/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp
index 15eedec..793e65c 100644
--- a/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp
+++ b/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp
@@ -20,12 +20,11 @@
const GrGLInterface* GrGLDefaultInterface() {
if (NULL != OSMesaGetCurrentContext()) {
- int major, minor;
const char* versionString = (const char*) glGetString(GL_VERSION);
const char* extString = (const char*) glGetString(GL_EXTENSIONS);
- gl_version_from_string(&major, &minor, versionString);
+ GrGLVersion glVer = GrGLGetVersionFromString(versionString);
- if (major == 1 && minor < 5) {
+ if (glVer < GR_GL_VER(1,5)) {
// We must have array and element_array buffer objects.
return NULL;
}
@@ -34,7 +33,7 @@
interface->fMinRenderTargetHeight = kProbe_GrGLCapability;
interface->fMinRenderTargetWidth = kProbe_GrGLCapability;
- interface->fActiveTexture = glActiveTexture;
+ interface->fActiveTexture = glActiveTexture;GrGLIn
GR_GL_GET_PROC(AttachShader);
GR_GL_GET_PROC(BindAttribLocation);
GR_GL_GET_PROC(BindBuffer);
@@ -136,8 +135,9 @@
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
- if (major >= 3 || has_gl_extension_from_string(
- "GL_ARB_framebuffer_object", extString)) {
+ if (glVer >= GR_GL_VER(3,0) ||
+ GrGLHasExtensionFromString("GL_ARB_framebuffer_object",
+ extString)) {
GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
@@ -152,8 +152,8 @@
GR_GL_GET_PROC(BindRenderbuffer);
GR_GL_GET_PROC(RenderbufferStorageMultisample);
GR_GL_GET_PROC(BlitFramebuffer);
- } else if (has_gl_extension_from_string("GL_EXT_framebuffer_object",
- extString)) {
+ } else if (GrGLHasExtensionFromString("GL_EXT_framebuffer_object",
+ extString)) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
@@ -166,12 +166,12 @@
GR_GL_GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
GR_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT);
- if (has_gl_extension_from_string("GL_EXT_framebuffer_multisample",
- extString)) {
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample",
+ extString)) {
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
}
- if (has_gl_extension_from_string("GL_EXT_framebuffer_blit",
- extString)) {
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit",
+ extString)) {
GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT);
}
} else {
diff --git a/gpu/src/unix/GrGLDefaultInterface_unix.cpp b/gpu/src/unix/GrGLDefaultInterface_unix.cpp
index 04c6e30..041caec 100644
--- a/gpu/src/unix/GrGLDefaultInterface_unix.cpp
+++ b/gpu/src/unix/GrGLDefaultInterface_unix.cpp
@@ -21,12 +21,11 @@
const GrGLInterface* GrGLDefaultInterface() {
if (NULL != glXGetCurrentContext()) {
- int major, minor;
const char* versionString = (const char*) glGetString(GL_VERSION);
const char* extString = (const char*) glGetString(GL_EXTENSIONS);
- gl_version_from_string(&major, &minor, versionString);
+ GrGLVersion glVer = GrGLGetVersionFromString(versionString);
- if (major == 1 && minor < 5) {
+ if (glVer < GR_GL_VER(1,5)) {
// We must have array and element_array buffer objects.
return NULL;
}
@@ -139,8 +138,9 @@
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
- if (major >= 3 || has_gl_extension_from_string(
- "GL_ARB_framebuffer_object", extString)) {
+ if (glVer >= GR_GL_VER(3,0) ||
+ GrGLHasExtensionFromString("GL_ARB_framebuffer_object",
+ extString)) {
GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
@@ -155,8 +155,8 @@
GR_GL_GET_PROC(BindRenderbuffer);
GR_GL_GET_PROC(RenderbufferStorageMultisample);
GR_GL_GET_PROC(BlitFramebuffer);
- } else if (has_gl_extension_from_string("GL_EXT_framebuffer_object",
- extString)) {
+ } else if (GrGLHasExtensionFromString("GL_EXT_framebuffer_object",
+ extString)) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
@@ -169,11 +169,11 @@
GR_GL_GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
GR_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT);
- if (has_gl_extension_from_string("GL_EXT_framebuffer_multisample",
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample",
extString)) {
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
}
- if (has_gl_extension_from_string("GL_EXT_framebuffer_blit",
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit",
extString)) {
GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT);
}
diff --git a/gpu/src/win/GrGLDefaultInterface_win.cpp b/gpu/src/win/GrGLDefaultInterface_win.cpp
index b257b94..faa72a9 100644
--- a/gpu/src/win/GrGLDefaultInterface_win.cpp
+++ b/gpu/src/win/GrGLDefaultInterface_win.cpp
@@ -27,12 +27,11 @@
// context. For that reason we create a new GrGLInterface each time we're
// called.
if (NULL != wglGetCurrentContext()) {
- int major, minor;
const char* versionString = (const char*) glGetString(GL_VERSION);
const char* extString = (const char*) glGetString(GL_EXTENSIONS);
- gl_version_from_string(&major, &minor, versionString);
+ GrGLVersion glVer = GrGLGetVersionFromString(versionString);
- if (major == 1 && minor < 5) {
+ if (glVer < GR_GL_VER(1,5)) {
// We must have array and element_array buffer objects.
return NULL;
}
@@ -145,7 +144,8 @@
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
- if (major >= 3 || has_gl_extension_from_string("GL_ARB_framebuffer_object", extString)) {
+ if (glVer > GR_GL_VER(3,0) ||
+ GrGLHasExtensionFromString("GL_ARB_framebuffer_object", extString)) {
GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
@@ -160,7 +160,8 @@
GR_GL_GET_PROC(BindRenderbuffer);
GR_GL_GET_PROC(RenderbufferStorageMultisample);
GR_GL_GET_PROC(BlitFramebuffer);
- } else if (has_gl_extension_from_string("GL_EXT_framebuffer_object", extString)) {
+ } else if (GrGLHasExtensionFromString("GL_EXT_framebuffer_object",
+ extString)) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
@@ -173,10 +174,10 @@
GR_GL_GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
GR_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT);
- if (has_gl_extension_from_string("GL_EXT_framebuffer_multisample", extString)) {
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", extString)) {
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
}
- if (has_gl_extension_from_string("GL_EXT_framebuffer_blit", extString)) {
+ if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit", extString)) {
GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT);
}
} else {