From 1e0413230648f5ed18bfbdfcb87bf63473ed91b2 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 17 Dec 2007 12:20:56 +0100 Subject: i915: Fix issues with glDrawBuffer(GL_NONE). Don't dereference NULL renderbuffer pointer, and make sure the software fallback sticks. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=13694 . --- src/mesa/drivers/dri/intel/intel_buffers.c | 50 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'src/mesa/drivers/dri/intel/intel_buffers.c') diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 44a55bbed9..c32d54a2f9 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -564,7 +564,8 @@ intel_wait_flips(struct intel_context *intel, GLuint batch_flags) BUFFER_BIT_FRONT_LEFT ? BUFFER_FRONT_LEFT : BUFFER_BACK_LEFT); - if (intel_fb->Base.Name == 0 && intel_rb->pf_pending == intel_fb->pf_seq) { + if (intel_fb->Base.Name == 0 && intel_rb && + intel_rb->pf_pending == intel_fb->pf_seq) { GLint pf_planes = intel_fb->pf_planes; BATCH_LOCALS; @@ -863,16 +864,11 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) /* * How many color buffers are we drawing into? */ - if (fb->_NumColorDrawBuffers[0] != 1 -#if 0 - /* XXX FBO temporary - always use software rendering */ - || 1 -#endif - ) { + if (fb->_NumColorDrawBuffers[0] != 1) { /* writing to 0 or 2 or 4 color buffers */ /*_mesa_debug(ctx, "Software rendering\n");*/ FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE); - front = 1; /* might not have back color buffer */ + colorRegion = NULL; } else { /* draw to exactly one color buffer */ @@ -881,30 +877,30 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) { front = 1; } - } - /* - * Get the intel_renderbuffer for the colorbuffer we're drawing into. - * And set up cliprects. - */ - if (fb->Name == 0) { - /* drawing to window system buffer */ - if (front) { - intelSetFrontClipRects(intel); - colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); + /* + * Get the intel_renderbuffer for the colorbuffer we're drawing into. + * And set up cliprects. + */ + if (fb->Name == 0) { + /* drawing to window system buffer */ + if (front) { + intelSetFrontClipRects(intel); + colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); + } + else { + intelSetBackClipRects(intel); + colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT); + } } else { - intelSetBackClipRects(intel); - colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT); + /* drawing to user-created FBO */ + struct intel_renderbuffer *irb; + intelSetRenderbufferClipRects(intel); + irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]); + colorRegion = (irb && irb->region) ? irb->region : NULL; } } - else { - /* drawing to user-created FBO */ - struct intel_renderbuffer *irb; - intelSetRenderbufferClipRects(intel); - irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]); - colorRegion = (irb && irb->region) ? irb->region : NULL; - } /* Update culling direction which changes depending on the * orientation of the buffer: -- cgit v1.2.3