I want to clear only a sub area of a DSV, I wonder how to make it in DX11 ? Like what can be done using ID3D12GraphicsCommandList::ClearDepthStencilView.
Anyone has some advise?
I want to clear only a sub area of a DSV, I wonder how to make it in DX11 ? Like what can be done using ID3D12GraphicsCommandList::ClearDepthStencilView.
Anyone has some advise?
One way is to set depth and color write mask to false and set up a manual screen space quad to render with desired stencil write mask and to always depth/stencil pass.
Yep, rendering quads seems the only way. The documentation (see remarks) states no cropping is applied (viewport, scissors).
If you don't mind requiring Direct3D 11.1, ID3D11DeviceContext1 has a ClearView method that will do what you want: https://docs.microsoft.com/en-us/windows/desktop/api/d3d11_1/nf-d3d11_1-id3d11devicecontext1-clearview
Greate thanks to all of you!
I finally decided to use “CopySubresourceRegion” as an alternative way to achive this.
wooops,looks like CopySubresourceRegion not work but CopyResource works fine....
9 hours ago, Hogknuckle said:If you don't mind requiring Direct3D 11.1, ID3D11DeviceContext1 has a ClearView method that will do what you want: https://docs.microsoft.com/en-us/windows/desktop/api/d3d11_1/nf-d3d11_1-id3d11devicecontext1-clearview
This is an only-color clear method.
Seems to work for depth-only though, so no stencil.
But it gets worse. I liked the idea about using CopySubresourceRegion as a workaround, though it doesn't allow arbitrary regions for ... wait for it ... depth textures (see final not in the remarks).
Yeah, if all fails, blitting quads it is. :P