Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Adept I

Reading Incorrect Depth Values from Packed Depth Stencil Texture in OpenGL

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.


1 Reply
Adept I

Re: Reading Incorrect Depth Values from Packed Depth Stencil Texture in OpenGL

I have similar issues with the 24bit EXT_packed_depth_stencil format across multiple drivers, if i switch to the straight 32bit depth with no stencil it works fine.

Im also finding the problems when reconstructing position from depth, all of these problems seem to be AMD related. When I run it on my nvidia 670 I dont get the problem, so there seems to be a problem with packed depth stencil formats.

The 24_8 format was promoted to core 3.0.