Bug 14198 - [i965] glBitmap should not render when draw buffer is set to GL_NONE
Summary: [i965] glBitmap should not render when draw buffer is set to GL_NONE
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: haihao
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-22 00:17 UTC by Shuang He
Modified: 2008-01-23 17:50 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
test case (1.39 KB, text/plain)
2008-01-22 00:17 UTC, Shuang He
Details

Description Shuang He 2008-01-22 00:17:46 UTC
Created attachment 13852 [details]
test case

System Environment:
--------------------------

--Platform: Q965 & GM965
--Architecture(32-bit,64-bit,compatiblity): 32bit 

kernel: 
2.6.23

drm   
commit c6f175cbea1dba3fc26426243acc55b89b8a8064

mesa 
commit 02d5ba849197e19843dad164239b51f18fb16faf

xf86_video_intel 
commit 633dbd28218fd8a746c1735fd44a14f35bd07faa 


Bug detailed description:
--------------------------
this issue doesn't happen in software rendering mode.
this issue doesn't happen on i915

specify draw buffer as GL_NONE
then render with glBitmap, it should render nothing, but it still renders.

it seems either _mesa_drawbuffers() or intel_drawbuf_region() should be checked to make this correct.


Reproduce steps:
----------------
1. start X
2. compile and run attached test case


Current result:
----------------
still renders


Expected result:
----------------
should not render
Comment 1 Shuang He 2008-01-22 17:26:47 UTC
seems when draw buffer is set to GL_NONE, _NumColorDrawBuffers will be set to 0, so 
_ColorDrawBuffers will not be updated accordingly, in update_color_draw_buffers()
this patch works for me:

--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -640,6 +640,10 @@ static void
 update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
 {
    GLuint output;
+   if (fb->_NumColorDrawBuffers == 0) {
+      fb->_ColorDrawBuffers[0] = NULL;
+      return;
+   }

    for (output = 0; output < fb->_NumColorDrawBuffers; output++) {
       GLint buf = fb->_ColorDrawBufferIndexes[output];
Comment 2 Brian Paul 2008-01-22 20:14:38 UTC
I've made a change similar to what you suggest.  Also, I added checks in a few places for ctx->DrawBuffer->_ColorDrawBuffer[0] == NULL.
Please test and close this bug if resolved.  Thanks.
Comment 3 Shuang He 2008-01-23 17:50:45 UTC
verified, thanks


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.