In _mesa_RenderbufferStorageEXT(), try to avoid needless reallocation.
Simplify _mesa_GetRenderbufferParameterivEXT() queries.
This commit is contained in:
@@ -744,6 +744,13 @@ _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
|
|||||||
|
|
||||||
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
|
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
|
||||||
|
|
||||||
|
if (rb->InternalFormat == internalFormat &&
|
||||||
|
rb->Width == width &&
|
||||||
|
rb->Height == height) {
|
||||||
|
/* no change in allocation needed */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now allocate the storage */
|
/* Now allocate the storage */
|
||||||
ASSERT(rb->AllocStorage);
|
ASSERT(rb->AllocStorage);
|
||||||
if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
|
if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
|
||||||
@@ -802,60 +809,23 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)
|
|||||||
*params = ctx->CurrentRenderbuffer->InternalFormat;
|
*params = ctx->CurrentRenderbuffer->InternalFormat;
|
||||||
return;
|
return;
|
||||||
case GL_RENDERBUFFER_RED_SIZE_EXT:
|
case GL_RENDERBUFFER_RED_SIZE_EXT:
|
||||||
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
|
*params = ctx->CurrentRenderbuffer->RedBits;
|
||||||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
|
|
||||||
*params = ctx->CurrentRenderbuffer->RedBits;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*params = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GL_RENDERBUFFER_GREEN_SIZE_EXT:
|
case GL_RENDERBUFFER_GREEN_SIZE_EXT:
|
||||||
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
|
*params = ctx->CurrentRenderbuffer->GreenBits;
|
||||||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
|
|
||||||
*params = ctx->CurrentRenderbuffer->GreenBits;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*params = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GL_RENDERBUFFER_BLUE_SIZE_EXT:
|
case GL_RENDERBUFFER_BLUE_SIZE_EXT:
|
||||||
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
|
*params = ctx->CurrentRenderbuffer->BlueBits;
|
||||||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
|
|
||||||
*params = ctx->CurrentRenderbuffer->BlueBits;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*params = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
|
case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
|
||||||
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
|
*params = ctx->CurrentRenderbuffer->AlphaBits;
|
||||||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
|
|
||||||
*params = ctx->CurrentRenderbuffer->AlphaBits;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*params = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
|
case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
|
||||||
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_COMPONENT ||
|
*params = ctx->CurrentRenderbuffer->DepthBits;
|
||||||
ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
|
|
||||||
*params = ctx->CurrentRenderbuffer->DepthBits;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*params = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
|
case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
|
||||||
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_STENCIL_INDEX ||
|
*params = ctx->CurrentRenderbuffer->StencilBits;
|
||||||
ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
|
|
||||||
*params = ctx->CurrentRenderbuffer->StencilBits;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*params = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glGetRenderbufferParameterivEXT(target)");
|
"glGetRenderbufferParameterivEXT(target)");
|
||||||
|
Reference in New Issue
Block a user