diff options
author | Brian <[email protected]> | 2008-01-22 21:11:55 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2008-01-22 21:11:55 -0700 |
commit | 2a077500a84819d1e6ac62e84ded130aa655c5e9 (patch) | |
tree | e16cbba8051acc5ee5fc4409e5697e11d0041989 /src/mesa/swrast | |
parent | e1ae5b89fce51ce1138a5cbe93caa0e1fccf219f (diff) |
Fix some issues with glDrawBuffer(GL_NONE), bug 14198
Set _ColorDrawBuffers[0] = NULL if no renderbuffers enabled.
Check that _ColorDrawBuffers[0] is non-null before dereferencing in a few places.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_blit.c | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 7 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 10 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c index a2c40bd9a6b..af4350990c0 100644 --- a/src/mesa/swrast/s_blit.c +++ b/src/mesa/swrast/s_blit.c @@ -745,6 +745,9 @@ _swrast_BlitFramebuffer(GLcontext *ctx, }; GLint i; + if (!ctx->DrawBuffer->_NumColorDrawBuffers) + return; + if (!clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1, &dstX0, &dstY0, &dstX1, &dstY1)) { return; diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 7bab14f200e..4733d10bb59 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -54,7 +54,7 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, { const GLint imgX = x, imgY = y; struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; - const GLenum rbType = rb->DataType; + GLenum rbType; SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; GLboolean simpleZoom; @@ -62,6 +62,11 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, struct gl_pixelstore_attrib unpack; GLint destX, destY, drawWidth, drawHeight; /* post clipping */ + if (!rb) + return GL_TRUE; /* no-op */ + + rbType = rb->DataType; + if ((swrast->_RasterMask & ~CLIP_BIT) || ctx->Texture._EnabledCoordUnits || userUnpack->SwapBytes || diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 5036020b7c4..59e15645f3f 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -130,7 +130,7 @@ _swrast_culltriangle( GLcontext *ctx, #define T_SCALE theight #define SETUP_CODE \ - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];\ + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ @@ -139,8 +139,7 @@ _swrast_culltriangle( GLcontext *ctx, const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ - if (!texture) { \ - /* this shouldn't happen */ \ + if (!rb || !texture) { \ return; \ } @@ -182,7 +181,7 @@ _swrast_culltriangle( GLcontext *ctx, #define T_SCALE theight #define SETUP_CODE \ - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];\ + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ @@ -191,8 +190,7 @@ _swrast_culltriangle( GLcontext *ctx, const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ - if (!texture) { \ - /* this shouldn't happen */ \ + if (!rb || !texture) { \ return; \ } |