mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 814716 - correct the way that we tweak max sizes - r=jgilbert
This commit is contained in:
parent
1e198b525f
commit
e1e4bb7a0f
@ -159,6 +159,7 @@ WebGLContext::WebGLContext()
|
||||
mGLMaxTextureUnits = 0;
|
||||
mGLMaxTextureSize = 0;
|
||||
mGLMaxCubeMapTextureSize = 0;
|
||||
mGLMaxRenderbufferSize = 0;
|
||||
mGLMaxTextureImageUnits = 0;
|
||||
mGLMaxVertexTextureImageUnits = 0;
|
||||
mGLMaxVaryingVectors = 0;
|
||||
|
@ -858,6 +858,7 @@ protected:
|
||||
int32_t mGLMaxTextureUnits;
|
||||
int32_t mGLMaxTextureSize;
|
||||
int32_t mGLMaxCubeMapTextureSize;
|
||||
int32_t mGLMaxRenderbufferSize;
|
||||
int32_t mGLMaxTextureImageUnits;
|
||||
int32_t mGLMaxVertexTextureImageUnits;
|
||||
int32_t mGLMaxVaryingVectors;
|
||||
|
@ -1965,15 +1965,12 @@ WebGLContext::GetParameter(JSContext* cx, WebGLenum pname, ErrorResult& rv)
|
||||
case LOCAL_GL_UNPACK_ALIGNMENT:
|
||||
case LOCAL_GL_PACK_ALIGNMENT:
|
||||
case LOCAL_GL_SUBPIXEL_BITS:
|
||||
case LOCAL_GL_MAX_TEXTURE_SIZE:
|
||||
case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
|
||||
case LOCAL_GL_SAMPLE_BUFFERS:
|
||||
case LOCAL_GL_SAMPLES:
|
||||
case LOCAL_GL_MAX_VERTEX_ATTRIBS:
|
||||
case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
|
||||
case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
|
||||
case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS:
|
||||
case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
|
||||
case LOCAL_GL_RED_BITS:
|
||||
case LOCAL_GL_GREEN_BITS:
|
||||
case LOCAL_GL_BLUE_BITS:
|
||||
@ -1996,6 +1993,15 @@ WebGLContext::GetParameter(JSContext* cx, WebGLenum pname, ErrorResult& rv)
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
case LOCAL_GL_MAX_TEXTURE_SIZE:
|
||||
return JS::Int32Value(mGLMaxTextureSize);
|
||||
|
||||
case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
|
||||
return JS::Int32Value(mGLMaxCubeMapTextureSize);
|
||||
|
||||
case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
|
||||
return JS::Int32Value(mGLMaxRenderbufferSize);
|
||||
|
||||
case LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS:
|
||||
return JS::Int32Value(mGLMaxVertexUniformVectors);
|
||||
|
||||
@ -3376,8 +3382,8 @@ WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, We
|
||||
if (width < 0 || height < 0)
|
||||
return ErrorInvalidValue("renderbufferStorage: width and height must be >= 0");
|
||||
|
||||
if (!mBoundRenderbuffer || !mBoundRenderbuffer->GLName())
|
||||
return ErrorInvalidOperation("renderbufferStorage called on renderbuffer 0");
|
||||
if (width > mGLMaxRenderbufferSize || height > mGLMaxRenderbufferSize)
|
||||
return ErrorInvalidValue("renderbufferStorage: width or height exceeds maximum renderbuffer size");
|
||||
|
||||
// certain OpenGL ES renderbuffer formats may not exist on desktop OpenGL
|
||||
WebGLenum internalformatForGL = internalformat;
|
||||
|
@ -912,11 +912,13 @@ WebGLContext::InitAndValidateGL()
|
||||
if (MinCapabilityMode()) {
|
||||
mGLMaxTextureSize = MINVALUE_GL_MAX_TEXTURE_SIZE;
|
||||
mGLMaxCubeMapTextureSize = MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE;
|
||||
mGLMaxRenderbufferSize = MINVALUE_GL_MAX_RENDERBUFFER_SIZE;
|
||||
mGLMaxTextureImageUnits = MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS;
|
||||
mGLMaxVertexTextureImageUnits = MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS;
|
||||
} else {
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mGLMaxTextureSize);
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE, &mGLMaxCubeMapTextureSize);
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_RENDERBUFFER_SIZE, &mGLMaxRenderbufferSize);
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, &mGLMaxTextureImageUnits);
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &mGLMaxVertexTextureImageUnits);
|
||||
}
|
||||
|
@ -1332,7 +1332,6 @@ public:
|
||||
static bool ListHasExtension(const GLubyte *extensions,
|
||||
const char *extension);
|
||||
|
||||
GLint GetMaxTextureSize() { return mMaxTextureSize; }
|
||||
GLint GetMaxTextureImageSize() { return mMaxTextureImageSize; }
|
||||
void SetFlipped(bool aFlipped) { mFlipped = aFlipped; }
|
||||
|
||||
|
@ -200,8 +200,11 @@ TiledTextureImage::TiledTextureImage(GLContext* aGL,
|
||||
, mGL(aGL)
|
||||
, mTextureState(Created)
|
||||
{
|
||||
mTileSize = (!(aFlags & TextureImage::ForceSingleTile) && mGL->WantsSmallTiles())
|
||||
? 256 : mGL->GetMaxTextureSize();
|
||||
if (!(aFlags & TextureImage::ForceSingleTile) && mGL->WantsSmallTiles()) {
|
||||
mTileSize = 256;
|
||||
} else {
|
||||
mGL->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, (GLint*) &mTileSize);
|
||||
}
|
||||
if (aSize.width != 0 && aSize.height != 0) {
|
||||
Resize(aSize);
|
||||
}
|
||||
|
@ -162,7 +162,8 @@ 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()->GetMaxTextureSize();
|
||||
GLint texSize;
|
||||
gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &texSize);
|
||||
if (mBounds.width > (2 + texSize) || mBounds.height > (2 + texSize)) {
|
||||
mDelayedUpdates = true;
|
||||
MakeTextureIfNeeded(gl(), mTexture);
|
||||
|
@ -62,7 +62,9 @@ LayerManagerOGL::Initialize(bool force)
|
||||
int32_t
|
||||
LayerManagerOGL::GetMaxTextureSize() const
|
||||
{
|
||||
return mGLContext->GetMaxTextureSize();
|
||||
int32_t maxSize;
|
||||
mGLContext->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxSize);
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user