Bug 79115

Summary: glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0) doesn't unbind stencil buffer
Product: Mesa Reporter: James Legg <jlegg>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 10.1   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case
Patch

Description James Legg 2014-05-23 11:32:44 UTC
Created attachment 99627 [details]
Test case

glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0) should unbind both the depth and the stencil attachment. However, when using mesa 10.1 with Intel Haswell graphics, the stencil buffer is not unbound.

_mesa_framebuffer_renderbuffer has a special path to bind a stencil buffer when using GL_DEPTH_STENCIL_ATTACHMENT for a non-null renderbuffer, but for a null renderbuffer, it only calls remove_attachment with the depth attachment returned by get_attachment. It also needs to handle the stencil buffer when GL_DEPTH_STENCIL_ATTACHMENT is used for null renderbuffers.

I have attached a test case to demonstrate the problem. An assertion fails on line 61 when the bug occurs.
Comment 1 James Legg 2014-05-23 11:35:15 UTC
Created attachment 99628 [details]
Patch

This patch made against the mesa-10.1.4 tag fixes the bug for me.
Comment 2 Brian Paul 2014-05-23 14:06:34 UTC
The patch looks good, but I think I'll improve the comments.
I'll commit/push this and tag it for the stable branches too.
Thanks, James.
Comment 3 Brian Paul 2014-05-23 14:10:53 UTC
commit 846c715abb17e13a5d39c565d0995404b6178d98.

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.