I was wondering what would be the quickest / most performant way to clear a 2D texture using DirectX 11?
Context: I am using an RWTexture object as a head pointer to implement linked lists on the GPU (essentially, to implement Order-Independent Transparency as known from the AMD Tech Demo) and I need to reset this buffer to a fixed value every Frame.
The following ideas come to my mind:
- Declare it as a Render Target and use ClearRenderTargetView to set it. Seems unnatural to me since I don't actually render to it directly, also I am not sure if it actually works with an uint datatype
- Actually Map it as a render target and render a fullscreen quad, using the pixel shader to set the value
- Use a compute shader to set the fixed value
Is there some obvious way I am missing or an API for this that I am not aware of?
ClearUnorderedAccessViewUintandClearUnorderedAccessViewFloatis better and simpler if you need to clear, the best solution would be to not have to clear. - galop1n