aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/drawpix.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-11-17 02:05:42 +0000
committerBrian Paul <[email protected]>2005-11-17 02:05:42 +0000
commit547113c16cbef5db7753f4835ed7b7dd72e77380 (patch)
tree7ba6630ceff19d12a69be94aac7fe8840d6eab03 /src/mesa/main/drawpix.c
parent154cc16d08c5de175f8bdf83c685991a8b2cd71b (diff)
improved error checking in error_check_format_type()
Diffstat (limited to 'src/mesa/main/drawpix.c')
-rw-r--r--src/mesa/main/drawpix.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 701ac6aa773..a95ee02097c 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -43,6 +43,7 @@ error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
GLboolean drawing)
{
const char *readDraw = drawing ? "Draw" : "Read";
+ struct gl_framebuffer *fb = drawing ? ctx->DrawBuffer : ctx->ReadBuffer;
if (ctx->Extensions.EXT_packed_depth_stencil
&& type == GL_UNSIGNED_INT_24_8_EXT
@@ -86,14 +87,14 @@ error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
}
break;
case GL_STENCIL_INDEX:
- if (ctx->DrawBuffer->Visual.stencilBits == 0) {
+ if (fb->Visual.stencilBits == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"gl%sPixels(no stencil buffer)", readDraw);
return GL_TRUE;
}
break;
case GL_DEPTH_COMPONENT:
- if (ctx->DrawBuffer->Visual.depthBits == 0) {
+ if (fb->Visual.depthBits == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"gl%sPixels(no depth buffer)", readDraw);
return GL_TRUE;
@@ -105,14 +106,13 @@ error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
_mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw);
return GL_TRUE;
}
- if (ctx->DrawBuffer->Visual.depthBits == 0 ||
- ctx->ReadBuffer->Visual.depthBits == 0 ||
- ctx->DrawBuffer->Visual.stencilBits == 0 ||
- ctx->ReadBuffer->Visual.stencilBits == 0) {
+ if (fb->Visual.depthBits == 0 || fb->Visual.stencilBits == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"gl%sPixels(no depth or stencil buffer)", readDraw);
return GL_TRUE;
}
+ ASSERT(fb->Attachment[BUFFER_DEPTH].Renderbuffer);
+ ASSERT(fb->Attachment[BUFFER_STENCIL].Renderbuffer);
break;
default:
/* this should have been caught in _mesa_is_legal_format_type() */