Sign in to follow this  

Help with capturing the depth buffer

This topic is 4205 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 guys Maybe someone can help whit this? I try to capture the depth buffer, but it don't work, my code look like this: descNormal=*pBackBufferSurfaceDesc; pd3dDevice->CreateDepthStencilSurface(descNormal.Width, descNormal.Height, D3DFMT_D16_LOCKABLE, descNormal.MultiSampleType, descNormal.MultiSampleQuality, FALSE, &g_pDepthSurface, NULL); V(pd3dDevice->GetDepthStencilSurface(&g_pDepthSurface)); IDirect3DDevice9::GetDepthStencilSurface don't return any error message but g_pDepthSurface is a bad pointer. Thanks [Edited by - Xmon on June 13, 2006 7:23:49 AM]

Share this post


Link to post
Share on other sites
If you've received a bad pointer (is it NULL, or does it just not change?) then it almost certainly means that CreateDepthStencilSurface() has failed.

Two things in particular:

1. You're using D3DFMT_D16_LOCKABLE - is it supported by your hardware? The card-caps spreadsheet indicates ATI hardware will handle it but Nvidia's wont. Either way you should make sure you check before just using it [wink]

2. Multisampling with depth/stencil's isn't always guaranteed - are you sure that you're passing in an acceptable format? Also note that it should match whatever the render-targets MSAA settings are.

Finally - what do the debug runtimes tell you? Normally they'll elaborate on any failed calls by telling you which parameter is incorrect.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
If you've received a bad pointer (is it NULL, or does it just not change?) then it almost certainly means that CreateDepthStencilSurface() has failed.

Two things in particular:

1. You're using D3DFMT_D16_LOCKABLE - is it supported by your hardware? The card-caps spreadsheet indicates ATI hardware will handle it but Nvidia's wont. Either way you should make sure you check before just using it [wink]

2. Multisampling with depth/stencil's isn't always guaranteed - are you sure that you're passing in an acceptable format? Also note that it should match whatever the render-targets MSAA settings are.

Finally - what do the debug runtimes tell you? Normally they'll elaborate on any failed calls by telling you which parameter is incorrect.

hth
Jack


My card (6600GT) did'nt support D3DFMT_D16_LOCKABLE just D3DFMT_D16 does this mean that i cant have the CPU operate on the values in the depthbuffer :(

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
If D3DFMT_D32F_LOCKABLE doesn't work either, then no - you can't lock the depth buffer.


OK, so there is no way to stream it over. I could allways render it to a seperate color buffer but it had been convinient to use the depth buffer directly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Xmon
Quote:
Original post by Evil Steve
If D3DFMT_D32F_LOCKABLE doesn't work either, then no - you can't lock the depth buffer.


OK, so there is no way to stream it over. I could allways render it to a seperate color buffer but it had been convinient to use the depth buffer directly.
Convenient for you as the programmer, but not so good for the hardware. Messing with the implicit (or explicit) render targets and depth/stencils is often a good way of killing your performance.

Doing a render-to-texture and reading back can still be slow, but the added flexibility and some smart thinking allows you to get pretty good performance.

hth
Jack

Share this post


Link to post
Share on other sites

This topic is 4205 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this