dx12: Handle present texture in a specially

PRESENT is an exclusive flag in NXT and can't be combined with other flags. The existing implementation treats the D3D12_RESOURCE_STATE_PRESENT as flag which is confusing due to being 0.
This commit is contained in:
msiglreith 2018-02-08 14:23:28 +01:00 committed by Corentin Wallez
parent 6569f9f0a4
commit adb152bff1
1 changed files with 5 additions and 3 deletions

View File

@ -24,6 +24,11 @@ namespace backend { namespace d3d12 {
nxt::TextureFormat format) { nxt::TextureFormat format) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON; D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
// Present is an exclusive flag.
if (usage & nxt::TextureUsageBit::Present) {
return D3D12_RESOURCE_STATE_PRESENT;
}
if (usage & nxt::TextureUsageBit::TransferSrc) { if (usage & nxt::TextureUsageBit::TransferSrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE; resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
} }
@ -44,9 +49,6 @@ namespace backend { namespace d3d12 {
resourceState |= D3D12_RESOURCE_STATE_RENDER_TARGET; resourceState |= D3D12_RESOURCE_STATE_RENDER_TARGET;
} }
} }
if (usage & nxt::TextureUsageBit::Present) {
resourceState |= D3D12_RESOURCE_STATE_PRESENT;
}
return resourceState; return resourceState;
} }