AnsweredAssumed Answered

Reading Incorrect Depth Values from Packed Depth Stencil Texture in OpenGL

Question asked by sanpol on Feb 4, 2013
Latest reply on Feb 21, 2013 by swoop

Hello, everyone. OpenGL question here.

I am trying to use DEPTH32F_STENCIL8 format with the FLOAT_32_UNSIGNED_INT_24_8_REV type. My use case is the following. I am doing deferred rendering. Depth is generated in the geometry pass and I reconstruct position from depth during lighting passes. Before I do a lighting pass and use depth for getting the position, I stencil my light volume. When I sample depth in the lighting pass, I don't do writes to the depth_stencil texture (neither depth values, nor stencil values).

What I get is shown in depth32F_stencil8.jpg attachment.

Using FLOAT32F I lose stencilling, but everything looks fine, see depth32F.jpg attachment.

Same issue when using DEPTH24_STENCIL8 format with UNSIGNED_INT_24_8 type.

I am aware of TexParameter GL_DEPTH_STENCIL_TEXTURE_MODE, which should be set (and is by default set) to DEPTH_COMPONENT to indicate which value I want to get when I sample. However this parameter is only available since GL 4.3, whereas I am using GL 3.3.


Configuration: AMD HD5145, Win7 x64, 13.1 Legacy Driver.


Question is, should I expect reading depth from packed depth_stencil texture to work under GL 3.3 or is this a bug? I don't have access to Nvidia hardware, so I can't tell if it behaves the same.


I've seen pretty much the same questions here and the OpenGL forum. It was suggested by a person from AMD that a fix was supposed to hit the driver quite some time ago. Is AMD aware this is still an issue? This is kind of a big deal.


I am willing to conjure up a code sample for verification and testing purposes, if someone from AMD shows up.