From 9cff8595a2ef4237d8dda476766f546f9cfe8af5 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Tue, 5 Mar 2013 13:56:27 -0500 Subject: [PATCH] Bug 848023 - Use the same adjusted max texture size everywhere. r=bjacob --- gfx/gl/GLContext.h | 1 + gfx/gl/GLTextureImage.cpp | 2 +- gfx/layers/opengl/CanvasLayerOGL.cpp | 3 +-- gfx/layers/opengl/ContainerLayerOGL.cpp | 3 +-- gfx/layers/opengl/LayerManagerOGL.cpp | 7 ++++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index e07b41a1a9e..f49962a773c 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -1015,6 +1015,7 @@ public: const char *extension); GLint GetMaxTextureImageSize() { return mMaxTextureImageSize; } + GLint GetMaxTextureSize() { MOZ_ASSERT(mMaxTextureSize>0); return mMaxTextureSize; } void SetFlipped(bool aFlipped) { mFlipped = aFlipped; } // this should just be a std::bitset, but that ended up breaking diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index f622d555498..890d5fe53ec 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -203,7 +203,7 @@ TiledTextureImage::TiledTextureImage(GLContext* aGL, if (!(aFlags & TextureImage::ForceSingleTile) && mGL->WantsSmallTiles()) { mTileSize = 256; } else { - mGL->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, (GLint*) &mTileSize); + mTileSize = mGL->GetMaxTextureSize(); } if (aSize.width != 0 && aSize.height != 0) { Resize(aSize); diff --git a/gfx/layers/opengl/CanvasLayerOGL.cpp b/gfx/layers/opengl/CanvasLayerOGL.cpp index 0f783c8346a..9f1abbc7dd9 100644 --- a/gfx/layers/opengl/CanvasLayerOGL.cpp +++ b/gfx/layers/opengl/CanvasLayerOGL.cpp @@ -169,8 +169,7 @@ CanvasLayerOGL::Initialize(const Data& aData) // Check the maximum texture size supported by GL. glTexImage2D supports // images of up to 2 + GL_MAX_TEXTURE_SIZE - GLint texSize; - gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &texSize); + GLint texSize = gl()->GetMaxTextureSize(); if (mBounds.width > (2 + texSize) || mBounds.height > (2 + texSize)) { mDelayedUpdates = true; MakeTextureIfNeeded(gl(), mUploadTexture); diff --git a/gfx/layers/opengl/ContainerLayerOGL.cpp b/gfx/layers/opengl/ContainerLayerOGL.cpp index fce3d4e9588..5ffb3e49ca0 100644 --- a/gfx/layers/opengl/ContainerLayerOGL.cpp +++ b/gfx/layers/opengl/ContainerLayerOGL.cpp @@ -200,8 +200,7 @@ ContainerRender(Container* aContainer, // of just clamping the framebuffer's size to the max supported size. // This gives us a lower resolution rendering of the intermediate surface (children layers). // See bug 827170 for a discussion. - GLint maxTexSize; - aContainer->gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxTexSize); + GLint maxTexSize = aContainer->gl()->GetMaxTextureSize(); framebufferRect.width = std::min(framebufferRect.width, maxTexSize); framebufferRect.height = std::min(framebufferRect.height, maxTexSize); diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index b453e68b87f..9fab59a25ae 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -63,10 +63,11 @@ LayerManagerOGL::Initialize(bool force) int32_t LayerManagerOGL::GetMaxTextureSize() const { - int32_t maxSize; + // TODO: It seems wrong that this call should have a side effect + // of making mGLContext current, but to be safe, leave it in + // and sort it out in another bug. mGLContext->MakeCurrent(); - mGLContext->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxSize); - return maxSize; + return (int32_t) mGLContext->GetMaxTextureSize(); } void