Reputation:
In many of D3D 12 tutorials and books, just clear depth stencil buffer when clear the render target view. It is most situation but I encountered special case, I wonder that whether data of a buffer data has been preserved even though another buffer had been cleared. For example, whether data of depth stencil buffer has been preserved when render target had been cleared.
In Vulkan, even Metal, provides LoadOp and StoreOp to guarantee the buffer data when command queue started or finished executions. However, I cannot find such like options in D3D 12.
As I know that in historically, the D3D does not guarantee the buffer data when cleared. Is it right?
Otherwise, is it always guaranteed to preserve? If there is any Microsoft's article about this, please tell me.
Upvotes: 0
Views: 347
Reputation: 377
You can use 'ID3D12GraphicsCommandList::ClearRenderTargetView' to clear a single render target. All other buffers remaim unchanged. 'ID3D12GraphicsCommandList::ClearDepthStencilView' can be used to clear depth and/or stencil. You pass nullptr to either depth or stencil if you don't want them cleared. There is also a 'ClearUnorderedAccessViewFloat/Int' for non render targets
Upvotes: 0