diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 1529622c292..3056acedb48 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -319,11 +319,7 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height) gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, gl->GetOffscreenFBO()); gl->fViewport(0, 0, mWidth, mHeight); gl->fClearColor(0.0f, 0.0f, 0.0f, 0.0f); -#ifdef USE_GLES2 - gl->fClearDepthf(1.0f); -#else gl->fClearDepth(1.0f); -#endif gl->fClearStencil(0); gl->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT); diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index 4ab749b6c8e..631e11d62ed 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -526,11 +526,7 @@ WebGLContext::Clear(PRUint32 mask) GL_SAME_METHOD_4(ClearColor, ClearColor, WebGLfloat, WebGLfloat, WebGLfloat, WebGLfloat) -#ifdef USE_GLES2 -GL_SAME_METHOD_1(ClearDepthf, ClearDepth, WebGLfloat) -#else GL_SAME_METHOD_1(ClearDepth, ClearDepth, WebGLfloat) -#endif GL_SAME_METHOD_1(ClearStencil, ClearStencil, WebGLint) @@ -834,11 +830,7 @@ WebGLContext::DepthFunc(WebGLenum func) GL_SAME_METHOD_1(DepthMask, DepthMask, WebGLboolean) -#ifdef USE_GLES2 -GL_SAME_METHOD_2(DepthRangef, DepthRange, WebGLfloat, WebGLfloat) -#else GL_SAME_METHOD_2(DepthRange, DepthRange, WebGLfloat, WebGLfloat) -#endif NS_IMETHODIMP WebGLContext::DisableVertexAttribArray(WebGLuint index) @@ -1342,18 +1334,18 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval) case LOCAL_GL_MAX_VARYING_VECTORS: { - #ifdef USE_GLES2 + if (gl->IsGLES2()) { GLint i = 0; gl->fGetIntegerv(pname, &i); wrval->SetAsInt32(i); - #else + } else { // since this pname is absent from desktop OpenGL, we have to implement it by hand. // The formula below comes from the public_webgl list, "problematic GetParameter pnames" thread GLint i = 0, j = 0; gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &i); gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &j); wrval->SetAsInt32(PR_MIN(i,j)/4); - #endif + } } break; diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index 1f663b98832..db93abd43b0 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -407,20 +407,27 @@ WebGLContext::InitAndValidateGL() gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxTextureImageUnits); gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxVertexTextureImageUnits); -#ifdef USE_GLES2 - gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors); - gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors); - gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors); -#else - gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, (GLint*) &mGLMaxFragmentUniformVectors); - mGLMaxFragmentUniformVectors /= 4; - gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors); - mGLMaxVertexUniformVectors /= 4; - gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_FLOATS, (GLint*) &mGLMaxVaryingVectors); - mGLMaxVaryingVectors /= 4; -#endif + if (gl->IsGLES2()) { + gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors); + gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors); + } else { + gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, (GLint*) &mGLMaxFragmentUniformVectors); + mGLMaxFragmentUniformVectors /= 4; + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors); + mGLMaxVertexUniformVectors /= 4; + gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_FLOATS, (GLint*) &mGLMaxVaryingVectors); + mGLMaxVaryingVectors /= 4; + } +#if 0 + // Leaving this code in here, even though it's ifdef'd out, for + // when we support more than 1 color attachment. gl->fGetIntegerv(LOCAL_GL_MAX_COLOR_ATTACHMENTS, (GLint*) &val); +#else + // Always 1 for GLES2 + val = 1; +#endif mFramebufferColorAttachments.SetLength(val); #if defined(DEBUG_vladimir) && defined(USE_GLES2) @@ -431,11 +438,11 @@ WebGLContext::InitAndValidateGL() fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_TYPE: 0x%04x\n", val); #endif -#ifndef USE_GLES2 - // gl_PointSize is always available in ES2 GLSL, but has to be - // specifically enabled on desktop GLSL. - gl->fEnable(LOCAL_GL_VERTEX_PROGRAM_POINT_SIZE); -#endif + if (!gl->IsGLES2()) { + // gl_PointSize is always available in ES2 GLSL, but has to be + // specifically enabled on desktop GLSL. + gl->fEnable(LOCAL_GL_VERTEX_PROGRAM_POINT_SIZE); + } #if !defined(USE_GLES2) && defined(USE_ANGLE) // initialize shader translator diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp index 898c4faeb30..b93810345ce 100644 --- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -701,15 +701,15 @@ BasicCanvasLayer::Updated(const nsIntRect& aRect) // For simplicity, we read the entire framebuffer for now -- in // the future we should use mUpdatedRect, though with WebGL we don't // have an easy way to generate one. -#ifndef USE_GLES2 - mGLContext->fReadPixels(0, 0, mBounds.width, mBounds.height, - LOCAL_GL_BGRA, LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV, - isurf->Data()); -#else - mGLContext->fReadPixels(0, 0, mBounds.width, mBounds.height, - LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, - isurf->Data()); -#endif + if (mGLContext->IsGLES2()) { + mGLContext->fReadPixels(0, 0, mBounds.width, mBounds.height, + LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, + isurf->Data()); + } else { + mGLContext->fReadPixels(0, 0, mBounds.width, mBounds.height, + LOCAL_GL_BGRA, LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV, + isurf->Data()); + } // Put back the previous framebuffer binding. if (currentFramebuffer != mCanvasFramebuffer) diff --git a/gfx/thebes/GLContext.cpp b/gfx/thebes/GLContext.cpp index 8f306c66649..20f848cd702 100644 --- a/gfx/thebes/GLContext.cpp +++ b/gfx/thebes/GLContext.cpp @@ -173,33 +173,17 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl) { (PRFuncPtr*) &fBufferSubData, { "BufferSubData", NULL } }, { (PRFuncPtr*) &fClear, { "Clear", NULL } }, { (PRFuncPtr*) &fClearColor, { "ClearColor", NULL } }, -#ifdef USE_GLES2 - { (PRFuncPtr*) &fClearDepthf, { "ClearDepthf", NULL } }, -#else - { (PRFuncPtr*) &fClearDepth, { "ClearDepth", NULL } }, -#endif { (PRFuncPtr*) &fClearStencil, { "ClearStencil", NULL } }, { (PRFuncPtr*) &fColorMask, { "ColorMask", NULL } }, { (PRFuncPtr*) &fCullFace, { "CullFace", NULL } }, { (PRFuncPtr*) &fDetachShader, { "DetachShader", "DetachShaderARB", NULL } }, { (PRFuncPtr*) &fDepthFunc, { "DepthFunc", NULL } }, { (PRFuncPtr*) &fDepthMask, { "DepthMask", NULL } }, -#ifdef USE_GLES2 - { (PRFuncPtr*) &fDepthRangef, { "DepthRangef", NULL } }, -#else - { (PRFuncPtr*) &fDepthRange, { "DepthRange", NULL } }, -#endif { (PRFuncPtr*) &fDisable, { "Disable", NULL } }, -#ifndef USE_GLES2 - { (PRFuncPtr*) &fDisableClientState, { "DisableClientState", NULL } }, -#endif { (PRFuncPtr*) &fDisableVertexAttribArray, { "DisableVertexAttribArray", "DisableVertexAttribArrayARB", NULL } }, { (PRFuncPtr*) &fDrawArrays, { "DrawArrays", NULL } }, { (PRFuncPtr*) &fDrawElements, { "DrawElements", NULL } }, { (PRFuncPtr*) &fEnable, { "Enable", NULL } }, -#ifndef USE_GLES2 - { (PRFuncPtr*) &fEnableClientState, { "EnableClientState", NULL } }, -#endif { (PRFuncPtr*) &fEnableVertexAttribArray, { "EnableVertexAttribArray", "EnableVertexAttribArrayARB", NULL } }, { (PRFuncPtr*) &fFinish, { "Finish", NULL } }, { (PRFuncPtr*) &fFlush, { "Flush", NULL } }, @@ -215,9 +199,6 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl) { (PRFuncPtr*) &fGetError, { "GetError", NULL } }, { (PRFuncPtr*) &fGetProgramiv, { "GetProgramiv", "GetProgramivARB", NULL } }, { (PRFuncPtr*) &fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", NULL } }, -#ifndef USE_GLES2 - { (PRFuncPtr*) &fTexCoordPointer, { "TexCoordPointer", NULL } }, -#endif { (PRFuncPtr*) &fTexParameteri, { "TexParameteri", NULL } }, { (PRFuncPtr*) &fTexParameterf, { "TexParameterf", NULL } }, { (PRFuncPtr*) &fGetString, { "GetString", NULL } }, @@ -238,9 +219,6 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl) { (PRFuncPtr*) &fLinkProgram, { "LinkProgram", "LinkProgramARB", NULL } }, { (PRFuncPtr*) &fPixelStorei, { "PixelStorei", NULL } }, { (PRFuncPtr*) &fPolygonOffset, { "PolygonOffset", NULL } }, -#ifndef USE_GLES2 - { (PRFuncPtr*) &fReadBuffer, { "ReadBuffer", NULL } }, -#endif { (PRFuncPtr*) &fReadPixels, { "ReadPixels", NULL } }, { (PRFuncPtr*) &fSampleCoverage, { "SampleCoverage", NULL } }, { (PRFuncPtr*) &fScissor, { "Scissor", NULL } }, @@ -250,9 +228,6 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl) { (PRFuncPtr*) &fStencilMaskSeparate, { "StencilMaskSeparate", "StencilMaskSeparateEXT", NULL } }, { (PRFuncPtr*) &fStencilOp, { "StencilOp", NULL } }, { (PRFuncPtr*) &fStencilOpSeparate, { "StencilOpSeparate", "StencilOpSeparateEXT", NULL } }, -#ifndef USE_GLES2 - { (PRFuncPtr*) &fTexEnvf, { "TexEnvf", NULL } }, -#endif { (PRFuncPtr*) &fTexImage2D, { "TexImage2D", NULL } }, { (PRFuncPtr*) &fTexSubImage2D, { "TexSubImage2D", NULL } }, { (PRFuncPtr*) &fUniform1f, { "Uniform1f", NULL } }, @@ -285,9 +260,6 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl) { (PRFuncPtr*) &fVertexAttrib2fv, { "VertexAttrib2fv", NULL } }, { (PRFuncPtr*) &fVertexAttrib3fv, { "VertexAttrib3fv", NULL } }, { (PRFuncPtr*) &fVertexAttrib4fv, { "VertexAttrib4fv", NULL } }, -#ifndef USE_GLES2 - { (PRFuncPtr*) &fVertexPointer, { "VertexPointer", NULL } }, -#endif { (PRFuncPtr*) &fViewport, { "Viewport", NULL } }, { (PRFuncPtr*) &fCompileShader, { "CompileShader", NULL } }, { (PRFuncPtr*) &fCopyTexImage2D, { "CopyTexImage2D", NULL } }, @@ -323,6 +295,15 @@ GLContext::InitWithPrefix(const char *prefix, PRBool trygl) { (PRFuncPtr*) &priv_fDeleteFramebuffers, { "DeleteFramebuffers", "DeleteFramebuffersEXT", NULL } }, { (PRFuncPtr*) &priv_fDeleteRenderbuffers, { "DeleteRenderbuffers", "DeleteRenderbuffersEXT", NULL } }, + { mIsGLES2 ? (PRFuncPtr*) &priv_fClearDepthf : (PRFuncPtr*) &priv_fClearDepth, + { mIsGLES2 ? "ClearDepthf" : "ClearDepth", NULL } }, + { mIsGLES2 ? (PRFuncPtr*) &priv_fDepthRangef : (PRFuncPtr*) &priv_fDepthRange, + { mIsGLES2 ? "DepthRangef" : "DepthRange", NULL } }, + + // XXX FIXME -- we shouldn't be using glReadBuffer! + { mIsGLES2 ? (PRFuncPtr*) NULL : (PRFuncPtr*) &fReadBuffer, + { mIsGLES2 ? NULL : "ReadBuffer", NULL } }, + { NULL, { NULL } }, }; @@ -655,21 +636,13 @@ GLContext::ClearSafely() fClearColor(0.0f, 0.0f, 0.0f, 0.0f); fClearStencil(0); -#ifdef USE_GLES2 - fClearDepthf(1.0f); -#else - fClearDepth(1.0); -#endif + fClearDepth(1.0f); fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT); fClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); fClearStencil(clearStencil); -#ifdef USE_GLES2 - fClearDepthf(clearDepth); -#else fClearDepth(clearDepth); -#endif } void diff --git a/gfx/thebes/GLContext.h b/gfx/thebes/GLContext.h index c971bb1dbbe..6d6c4038733 100644 --- a/gfx/thebes/GLContext.h +++ b/gfx/thebes/GLContext.h @@ -332,8 +332,13 @@ public: PRBool aIsOffscreen = PR_FALSE, GLContext *aSharedContext = nsnull) : mInitialized(PR_FALSE), - mCreationFormat(aFormat), mIsOffscreen(aIsOffscreen), +#ifdef USE_GLES2 + mIsGLES2(PR_TRUE), +#else + mIsGLES2(PR_FALSE), +#endif + mCreationFormat(aFormat), mSharedContext(aSharedContext), mOffscreenTexture(0), mOffscreenFBO(0), @@ -397,6 +402,15 @@ public: * If this context is double-buffered, returns TRUE. */ virtual PRBool IsDoubleBuffered() { return PR_FALSE; } + + /** + * If this context is the GLES2 API, returns TRUE. + * This means that various GLES2 restrictions might be in effect (modulo + * extensions). + */ + PRBool IsGLES2() { + return mIsGLES2; + } /** * If this context wraps a double-buffered target, swap the back @@ -542,8 +556,9 @@ public: protected: PRPackedBool mInitialized; - ContextFormat mCreationFormat; PRPackedBool mIsOffscreen; + PRPackedBool mIsGLES2; + ContextFormat mCreationFormat; nsRefPtr mSharedContext; void UpdateActualFormat(); @@ -568,6 +583,11 @@ protected: nsDataHashtable mUserData; + void SetIsGLES2(PRBool aIsGLES2) { + NS_ASSERTION(!mInitialized, "SetIsGLES2 can only be called before initialization!"); + mIsGLES2 = aIsGLES2; + } + PRBool InitWithPrefix(const char *prefix, PRBool trygl); PRBool IsExtensionSupported(const char *extension); @@ -615,13 +635,6 @@ public: PFNGLCLEARPROC fClear; typedef void (GLAPIENTRY * PFNGLCLEARCOLORPROC) (GLclampf, GLclampf, GLclampf, GLclampf); PFNGLCLEARCOLORPROC fClearColor; -#ifdef USE_GLES2 - typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf); - PFNGLCLEARDEPTHFPROC fClearDepthf; -#else - typedef void (GLAPIENTRY * PFNGLCLEARDEPTHPROC) (GLclampd); - PFNGLCLEARDEPTHPROC fClearDepth; -#endif typedef void (GLAPIENTRY * PFNGLCLEARSTENCILPROC) (GLint); PFNGLCLEARSTENCILPROC fClearStencil; typedef void (GLAPIENTRY * PFNGLCOLORMASKPROC) (realGLboolean red, realGLboolean green, realGLboolean blue, realGLboolean alpha); @@ -634,17 +647,8 @@ public: PFNGLDEPTHFUNCPROC fDepthFunc; typedef void (GLAPIENTRY * PFNGLDEPTHMASKPROC) (realGLboolean); PFNGLDEPTHMASKPROC fDepthMask; -#ifdef USE_GLES2 - typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf, GLclampf); - PFNGLDEPTHRANGEFPROC fDepthRangef; -#else - typedef void (GLAPIENTRY * PFNGLDEPTHRANGEPROC) (GLclampd, GLclampd); - PFNGLDEPTHRANGEPROC fDepthRange; -#endif typedef void (GLAPIENTRY * PFNGLDISABLEPROC) (GLenum); PFNGLDISABLEPROC fDisable; - typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEPROC) (GLenum); - PFNGLDISABLECLIENTSTATEPROC fDisableClientState; typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); PFNGLDISABLEVERTEXATTRIBARRAYPROC fDisableVertexAttribArray; typedef void (GLAPIENTRY * PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); @@ -653,8 +657,6 @@ public: PFNGLDRAWELEMENTSPROC fDrawElements; typedef void (GLAPIENTRY * PFNGLENABLEPROC) (GLenum); PFNGLENABLEPROC fEnable; - typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEPROC) (GLenum); - PFNGLENABLECLIENTSTATEPROC fEnableClientState; typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint); PFNGLENABLEVERTEXATTRIBARRAYPROC fEnableVertexAttribArray; typedef void (GLAPIENTRY * PFNGLFINISHPROC) (void); @@ -687,8 +689,6 @@ public: PFNGLGETPROGRAMIVPROC fGetProgramiv; typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog); PFNGLGETPROGRAMINFOLOGPROC fGetProgramInfoLog; - typedef void (GLAPIENTRY * PFNGLTEXENVFPROC) (GLenum, GLenum, GLfloat); - PFNGLTEXENVFPROC fTexEnvf; typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); PFNGLTEXPARAMETERIPROC fTexParameteri; typedef void (GLAPIENTRY * PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); @@ -749,11 +749,6 @@ public: PFNGLSTENCILOPPROC fStencilOp; typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); PFNGLSTENCILOPSEPARATEPROC fStencilOpSeparate; - typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERPROC) (GLint, - GLenum, - GLsizei, - const GLvoid *); - PFNGLTEXCOORDPOINTERPROC fTexCoordPointer; typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); PFNGLTEXIMAGE2DPROC fTexImage2D; typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); @@ -818,11 +813,6 @@ public: PFNGLVERTEXATTRIB3FVPROC fVertexAttrib3fv; typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v); PFNGLVERTEXATTRIB4FVPROC fVertexAttrib4fv; - typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERPROC) (GLint, - GLenum, - GLsizei, - const GLvoid *); - PFNGLVERTEXPOINTERPROC fVertexPointer; typedef void (GLAPIENTRY * PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); PFNGLVIEWPORTPROC fViewport; typedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader); @@ -861,7 +851,36 @@ public: typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGE) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height); PFNGLRENDERBUFFERSTORAGE fRenderbufferStorage; + void fDepthRange(GLclampf a, GLclampf b) { + if (mIsGLES2) { + priv_fDepthRangef(a, b); + } else { + priv_fDepthRange(a, b); + } + } + + void fClearDepth(GLclampf v) { + if (mIsGLES2) { + priv_fClearDepthf(v); + } else { + priv_fClearDepth(v); + } + } + protected: + /* These are different between GLES2 and desktop GL; we hide those differences, use the GL + * names, but the most limited data type. + */ + typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf, GLclampf); + PFNGLDEPTHRANGEFPROC priv_fDepthRangef; + typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf); + PFNGLCLEARDEPTHFPROC priv_fClearDepthf; + + typedef void (GLAPIENTRY * PFNGLDEPTHRANGEPROC) (GLclampd, GLclampd); + PFNGLDEPTHRANGEPROC priv_fDepthRange; + typedef void (GLAPIENTRY * PFNGLCLEARDEPTHPROC) (GLclampd); + PFNGLCLEARDEPTHPROC priv_fClearDepth; + /* These are special -- they create or delete GL resources that can live * in a shared namespace. In DEBUG, we wrap these calls so that we can * check when we have something that failed to do cleanup at the time the