summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_triangle.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-01-22 21:11:55 -0700
committerBrian <[email protected]>2008-01-22 21:11:55 -0700
commit2a077500a84819d1e6ac62e84ded130aa655c5e9 (patch)
treee16cbba8051acc5ee5fc4409e5697e11d0041989 /src/mesa/swrast/s_triangle.c
parente1ae5b89fce51ce1138a5cbe93caa0e1fccf219f (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/s_triangle.c')
-rw-r--r--src/mesa/swrast/s_triangle.c10
1 files changed, 4 insertions, 6 deletions
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; \
}