Bug 969632 - More const cleanup in gfx/gl. - r=bjacob
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 13 Feb 2014 15:02:03 -0800
changeset 185898 b135788f78ea21dd3b3edb89280fba5848849e83
parent 185897 6c0de95352141245259b16996935a7fedf5da25f
child 185899 e8a7d2c8607c1138096533a2ed9810f507b4a925
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs969632
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 969632 - More const cleanup in gfx/gl. - r=bjacob
gfx/gl/GLContext.h
gfx/gl/GLContextSkia.cpp
gfx/gl/GLContextSymbols.h
gfx/gl/SharedSurfaceGL.cpp
gfx/gl/SharedSurfaceGralloc.cpp
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1157,17 +1157,17 @@ public:
 
     void fGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label) {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fGetObjectLabel);
         mSymbols.fGetObjectLabel(identifier, name, bufSize, length, label);
         AFTER_GL_CALL;
     }
 
-    void fGetObjectPtrLabel(GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) {
+    void fGetObjectPtrLabel(const GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fGetObjectPtrLabel);
         mSymbols.fGetObjectPtrLabel(ptr, bufSize, length, label);
         AFTER_GL_CALL;
     }
 
     void fGenerateMipmap(GLenum target) {
         BEFORE_GL_CALL;
@@ -1188,17 +1188,17 @@ public:
     }
 
     void fTexParameteri(GLenum target, GLenum pname, GLint param) {
         BEFORE_GL_CALL;
         mSymbols.fTexParameteri(target, pname, param);
         AFTER_GL_CALL;
     }
 
-    void fTexParameteriv(GLenum target, GLenum pname, GLint* params) {
+    void fTexParameteriv(GLenum target, GLenum pname, const GLint* params) {
         BEFORE_GL_CALL;
         mSymbols.fTexParameteriv(target, pname, params);
         AFTER_GL_CALL;
     }
 
     void fTexParameterf(GLenum target, GLenum pname, GLfloat param) {
         BEFORE_GL_CALL;
         mSymbols.fTexParameterf(target, pname, param);
@@ -1222,23 +1222,23 @@ public:
     void fGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
     {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fGetTexLevelParameteriv);
         mSymbols.fGetTexLevelParameteriv(target, level, pname, params);
         AFTER_GL_CALL;
     }
 
-    void fGetTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) {
+    void fGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) {
         BEFORE_GL_CALL;
         mSymbols.fGetTexParameterfv(target, pname, params);
         AFTER_GL_CALL;
     }
 
-    void fGetTexParameteriv(GLenum target, GLenum pname, const GLint *params) {
+    void fGetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
         BEFORE_GL_CALL;
         mSymbols.fGetTexParameteriv(target, pname, params);
         AFTER_GL_CALL;
     }
 
     void fGetUniformfv(GLuint program, GLint location, GLfloat* params) {
         BEFORE_GL_CALL;
         mSymbols.fGetUniformfv(program, location, params);
@@ -1331,17 +1331,17 @@ public:
 
     void fObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar* label) {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fObjectLabel);
         mSymbols.fObjectLabel(identifier, name, length, label);
         AFTER_GL_CALL;
     }
 
-    void fObjectPtrLabel(GLvoid* ptr, GLsizei length, const GLchar* label) {
+    void fObjectPtrLabel(const GLvoid* ptr, GLsizei length, const GLchar* label) {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fObjectPtrLabel);
         mSymbols.fObjectPtrLabel(ptr, length, label);
         AFTER_GL_CALL;
     }
 
     void fPixelStorei(GLenum pname, GLint param) {
         BEFORE_GL_CALL;
--- a/gfx/gl/GLContextSkia.cpp
+++ b/gfx/gl/GLContextSkia.cpp
@@ -137,42 +137,42 @@ GrGLuint glCreateShader_mozilla(GrGLenum
 
 GrGLvoid glCullFace_mozilla(GrGLenum mode)
 {
     return sGLContext.get()->fCullFace(mode);
 }
 
 GrGLvoid glDeleteBuffers_mozilla(GrGLsizei n, const GrGLuint* buffers)
 {
-    return sGLContext.get()->fDeleteBuffers(n, const_cast<GrGLuint*>(buffers));
+    return sGLContext.get()->fDeleteBuffers(n, buffers);
 }
 
 GrGLvoid glDeleteFramebuffers_mozilla(GrGLsizei n, const GrGLuint* framebuffers)
 {
-    return sGLContext.get()->fDeleteFramebuffers(n, const_cast<GrGLuint*>(framebuffers));
+    return sGLContext.get()->fDeleteFramebuffers(n, framebuffers);
 }
 
 GrGLvoid glDeleteProgram_mozilla(GrGLuint program)
 {
     return sGLContext.get()->fDeleteProgram(program);
 }
 
 GrGLvoid glDeleteRenderbuffers_mozilla(GrGLsizei n, const GrGLuint* renderbuffers)
 {
-    return sGLContext.get()->fDeleteRenderbuffers(n, const_cast<GrGLuint*>(renderbuffers));
+    return sGLContext.get()->fDeleteRenderbuffers(n, renderbuffers);
 }
 
 GrGLvoid glDeleteShader_mozilla(GrGLuint shader)
 {
     return sGLContext.get()->fDeleteShader(shader);
 }
 
 GrGLvoid glDeleteTextures_mozilla(GrGLsizei n, const GrGLuint* textures)
 {
-    return sGLContext.get()->fDeleteTextures(n, const_cast<GrGLuint*>(textures));
+    return sGLContext.get()->fDeleteTextures(n, textures);
 }
 
 GrGLvoid glDepthMask_mozilla(GrGLboolean flag)
 {
     return sGLContext.get()->fDepthMask(flag);
 }
 
 GrGLvoid glDisable_mozilla(GrGLenum cap)
@@ -442,17 +442,17 @@ GrGLvoid glTexImage2D_mozilla(GrGLenum t
 
 GrGLvoid glTexParameteri_mozilla(GrGLenum target, GrGLenum pname, GrGLint param)
 {
     return sGLContext.get()->fTexParameteri(target, pname, param);
 }
 
 GrGLvoid glTexParameteriv_mozilla(GrGLenum target, GrGLenum pname, const GrGLint* params)
 {
-    return sGLContext.get()->fTexParameteriv(target, pname, const_cast<GrGLint*>(params));
+    return sGLContext.get()->fTexParameteriv(target, pname, params);
 }
 
 GrGLvoid glTexSubImage2D_mozilla(GrGLenum target, GrGLint level,
                                  GrGLint xoffset, GrGLint yoffset,
                                  GrGLsizei width, GrGLsizei height,
                                  GrGLenum format, GrGLenum type, const void* pixels)
 {
     return sGLContext.get()->fTexSubImage2D(target, level,
@@ -614,17 +614,17 @@ GrGLvoid glReadBuffer_mozilla(GrGLenum m
 
 GrGLvoid glGenQueries_mozilla(GrGLsizei n, GrGLuint* ids)
 {
     return sGLContext.get()->fGenQueries(n, ids);
 }
 
 GrGLvoid glDeleteQueries_mozilla(GrGLsizei n, const GrGLuint* ids)
 {
-    return sGLContext.get()->fDeleteQueries(n, const_cast<GrGLuint*>(ids));
+    return sGLContext.get()->fDeleteQueries(n, ids);
 }
 
 GrGLvoid glBeginQuery_mozilla(GrGLenum target, GrGLuint id)
 {
     return sGLContext.get()->fBeginQuery(target, id);
 }
 
 GrGLvoid glEndQuery_mozilla(GrGLenum target)
@@ -646,17 +646,17 @@ GrGLvoid glGetQueryObjectuiv_mozilla(GrG
 {
     return sGLContext.get()->fGetQueryObjectuiv(id, pname, params);
 }
 
 // Desktop OpenGL version >= 2.0
 
 GrGLvoid glDrawBuffers_mozilla(GrGLsizei n, const GrGLenum* bufs)
 {
-    return sGLContext.get()->fDrawBuffers(n, const_cast<GrGLenum*>(bufs));
+    return sGLContext.get()->fDrawBuffers(n, bufs);
 }
 
 // GLContext supports glMapBuffer on everything (GL_OES_mapbuffer)
 
 GrGLvoid* glMapBuffer_mozilla(GrGLenum target, GrGLenum access)
 {
     return sGLContext.get()->fMapBuffer(target, access);
 }
--- a/gfx/gl/GLContextSymbols.h
+++ b/gfx/gl/GLContextSymbols.h
@@ -134,29 +134,29 @@ struct GLContextSymbols
     typedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);
     PFNGLGETQUERYIVPROC fGetQueryiv;
     typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);
     PFNGLGETQUERYOBJECTIVPROC fGetQueryObjectiv;
     typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);
     PFNGLGETQUERYOBJECTUIVPROC fGetQueryObjectuiv;
     typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
     PFNGLTEXPARAMETERIPROC fTexParameteri;
-    typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* param);
+    typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint* param);
     PFNGLTEXPARAMETERIVPROC fTexParameteriv;
     typedef void (GLAPIENTRY * PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
     PFNGLTEXPARAMETERFPROC fTexParameterf;
     typedef GLubyte* (GLAPIENTRY * PFNGLGETSTRINGPROC) (GLenum);
     PFNGLGETSTRINGPROC fGetString;
     typedef void (GLAPIENTRY * PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid* image);
     PFNGLGETTEXIMAGEPROC fGetTexImage;
     typedef void (GLAPIENTRY * PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
     PFNGLGETTEXLEVELPARAMETERIVPROC fGetTexLevelParameteriv;
-    typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+    typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
     PFNGLGETTEXPARAMETERFVPROC fGetTexParameterfv;
-    typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+    typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
     PFNGLGETTEXPARAMETERIVPROC fGetTexParameteriv;
     typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);
     PFNGLGETUNIFORMFVPROC fGetUniformfv;
     typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);
     PFNGLGETUNIFORMIVPROC fGetUniformiv;
     typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLint programObj, const GLchar* name);
     PFNGLGETUNIFORMLOCATIONPROC fGetUniformLocation;
     typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);
@@ -459,18 +459,18 @@ struct GLContextSymbols
     typedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUP) (GLenum source, GLuint id, GLsizei length, const GLchar* message);
     PFNGLPUSHDEBUGGROUP fPushDebugGroup;
     typedef void (GLAPIENTRY * PFNGLPOPDEBUGGROUP) (void);
     PFNGLPOPDEBUGGROUP fPopDebugGroup;
     typedef void (GLAPIENTRY * PFNGLOBJECTLABEL) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label);
     PFNGLOBJECTLABEL fObjectLabel;
     typedef void (GLAPIENTRY * PFNGLGETOBJECTLABEL) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label);
     PFNGLGETOBJECTLABEL fGetObjectLabel;
-    typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABEL) (GLvoid* ptr, GLsizei length, const GLchar* label);
+    typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABEL) (const GLvoid* ptr, GLsizei length, const GLchar* label);
     PFNGLOBJECTPTRLABEL fObjectPtrLabel;
-    typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABEL) (GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label);
+    typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABEL) (const GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label);
     PFNGLGETOBJECTPTRLABEL fGetObjectPtrLabel;
 };
 
 }
 }
 
 #endif /* GLCONTEXTSYMBOLS_H_ */
--- a/gfx/gl/SharedSurfaceGL.cpp
+++ b/gfx/gl/SharedSurfaceGL.cpp
@@ -289,18 +289,17 @@ SharedSurface_Basic::SharedSurface_Basic
               GetAlignedStride<4>(size.width * BytesPerPixel(format)));
 }
 
 SharedSurface_Basic::~SharedSurface_Basic()
 {
     if (!mGL->MakeCurrent())
         return;
 
-    GLuint tex = mTex;
-    mGL->fDeleteTextures(1, &tex);
+    mGL->fDeleteTextures(1, &mTex);
 }
 
 void
 SharedSurface_Basic::Fence()
 {
     MOZ_ASSERT(mData->GetSize() == mGL->OffscreenSize());
 
     mGL->MakeCurrent();
@@ -334,18 +333,17 @@ SharedSurface_GLTexture::Create(GLContex
     return new SharedSurface_GLTexture(prodGL, consGL, size, hasAlpha, tex);
 }
 
 SharedSurface_GLTexture::~SharedSurface_GLTexture()
 {
     if (!mGL->MakeCurrent())
         return;
 
-    GLuint tex = mTex;
-    mGL->fDeleteTextures(1, &tex);
+    mGL->fDeleteTextures(1, &mTex);
 
     if (mSync) {
         mGL->fDeleteSync(mSync);
     }
 }
 
 void
 SharedSurface_GLTexture::Fence()
--- a/gfx/gl/SharedSurfaceGralloc.cpp
+++ b/gfx/gl/SharedSurfaceGralloc.cpp
@@ -136,17 +136,17 @@ SharedSurface_Gralloc::HasExtensions(GLL
 }
 
 SharedSurface_Gralloc::~SharedSurface_Gralloc()
 {
 
     DEBUG_PRINT("[SharedSurface_Gralloc %p] destroyed\n", this);
 
     mGL->MakeCurrent();
-    mGL->fDeleteTextures(1, (GLuint*)&mProdTex);
+    mGL->fDeleteTextures(1, &mProdTex);
 }
 
 void
 SharedSurface_Gralloc::Fence()
 {
     // We should be able to rely on genlock write locks/read locks.
     // But they're broken on some configs, and even a glFinish doesn't
     // work.  glReadPixels seems to, though.