Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Barriers: D3D12_TEXTURE_BARRIER_FLAG_DISCARD metadata initialisation #167

Open
GertyP opened this issue Feb 7, 2024 · 0 comments

Comments

@GertyP
Copy link

GertyP commented Feb 7, 2024

Looking through the Enhanced Barriers specs, I see that when activating aliased resources, a texture barrier using LayoutBefore = D3D12_BARRIER_LAYOUT_UNDEFINED, AccessBefore = D3D12_BARRIER_ACCESS_NO_ACCESS, and (D3D12_TEXTURE_BARRIER::)Flags = D3D12_TEXTURE_BARRIER_FLAG_DISCARD is the way to ensure any leftover data in place of the newly activated, aliased resource's colour/depth metadata is suitably initialised, but I can't see anything that specifies exactly what the effect of such discard initialisation is.

Even the documentation on ID3D12GraphicsCommandList::DiscardResource has nothing more than the same mysterious 'may initialize metadata' comment, which makes me wonder whether the resultant state is intentionally undefined for reasons like helping out driver implementations. But with it being so undefined, it does leave a few questions for the user. For example -

  • Does it have the effect of clearing a depth or colour target? And if so, is it always guaranteed to be the pOptimizedClearValue set on the resource's creation?
  • What does it do to a target without any metadata to initialise?
  • If use of an activated aliased texture resource needs it cleared to a specific value/depth, then after a suitable discard barrier, is a clearing 'Draw...' or 'Clear...View' ever redundant or is it still always necessary... or is it implementation-dependent, leaving the user to have to 'play it safe' by always performaing a clear even if, for some implementations, a metadata init might be sufficient to clear the resource?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant