Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

D3D11DeviceContext::CopyResource incorrect for depth/stencil buffers

I'm having trouble using D3D11DeviceContext::CopyResource on depth/stencil buffers with GCN1.0 and newer cards. It works on all NVIDIA and Intel GPUs as well as anything pre-GCN1.0 such as TeraScale. Specifically, it appears that stencil data is not being properly copied over. Is there a good workaround for this?

What I'm doing is the following:

Frame 1:

1) Clear a depth/stencil render target (D24S8)

2) Render a scene to the buffer

3) Copy the buffer to another, identically created depth/stencil render target (also D24S8) using D3D11DeviceContext::CopyResource

4) Render more objects to this buffer and eventually present

Frame 2+ does just steps 3 + 4 (Skipping the clear and initial scene render).

This allows me to render unchanging objects to color, depth, and stencil in one frame, and then re-use that data in future frames (if it hasn't changed.)

As stated above, this works great on all GPUs except for GCN1.0 and newer AMD GPUs. What would be the recommended way to quickly and exactly copy depth and stencil data from one render target to another in D3D11 for newer AMD GPUs?

0 Replies