Jump to content
  • Advertisement
Sign in to follow this  
Quadrovisual

Howto interpret Depth-Stencil (D24S8) combination on the CPU?

This topic is 3349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi out there, I am trying to save a combined depth stencil target in DX10 separately out into a bitmap file on disk. However, I am not able to make sense of the depth data that is contained in the D24S8- data, when I map it into main memory. To my current understanding, the first 3 bytes of the each mapped pixel are a 24-bit float followed by a 8 bit stencil. High bit Low Bit byte4 | byte3 | byte2 byte1 | stencil | 1 sign 7bit exponent | 16 bit mantissa | However, the returned values don't make much sense when I recombine them into a 32bit float. I get values above 1.0 which IMHO are not supposed to show up in a depth buffer. E.g. "1.0f"-float values show up as 0xFFFFFF. Are they 24bit integers? Any pointers and clues? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Are you talking about DXGI_FORMAT_D24_UNORM_S8_UINT? That format doesn't use floating-point for the depth portion, it's just a fixed-point integer. Hence 1.0f showing up as 0xffffff.

Also if you're just doing this for debugging purposes, PIX can display a depth buffer for you as well as save it to a variety of image formats.

Share this post


Link to post
Share on other sites
Thanks for the clarification, I have figured it out by myself in the mean-time. That 0xFFFFFF got me thinking :)

Where would I find that information btw?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!