Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to clear a part of DepthStencil in DX11?

Started by artint Sep 8, 2012 at 6:50 AM 3 replies 1.8k views
Original Post
artint
artint
In DX9, clear() can set a part of depth stencil, But ClearDepthStencilView can not set rectangles in DX11.Have any solutions?
thanks.
Erik Rufelt
Erik Rufelt
Render a quad with always-pass depth-testing and depth 1.0, or whichever value you wish to clear it to.
artint
artint

Render a quad with always-pass depth-testing and depth 1.0, or whichever value you wish to clear it to.

thx, but this must prepare render data and change state( shader, primitive stream, DepthStencil State), I want to avoid this.
Erik Rufelt
Erik Rufelt
[s]Keep a second buffer around that has the static contents of the particular depth value you wish to clear to, and use CopySubresourceRegion. http://msdn.microsof...4(v=vs.85).aspx[/s]

Actually never mind, the docs say you can't do that for a depth stencil resource. Unless you clear very many times per frame state-changes won't be a problem for drawing a quad.
artint
artint

[s]Keep a second buffer around that has the static contents of the particular depth value you wish to clear to, and use CopySubresourceRegion. http://msdn.microsof...4(v=vs.85).aspx[/s]

Actually never mind, the docs say you can't do that for a depth stencil resource. Unless you clear very many times per frame state-changes won't be a problem for drawing a quad.

Ok, I'll try it,thank you.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.