[d3d11] Fix potential UAV binding issue

When rebinding an already active UAV, we still need to
update the counter unless the app passed a value of -1.

Ref #712.
This commit is contained in:
Philip Rebohle 2018-11-26 17:16:29 +01:00
parent 500d67e002
commit 08b403f655
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 11 additions and 7 deletions

View File

@ -2976,8 +2976,8 @@ namespace dxvk {
void D3D11DeviceContext::BindUnorderedAccessView( void D3D11DeviceContext::BindUnorderedAccessView(
UINT UavSlot, UINT UavSlot,
UINT CtrSlot,
D3D11UnorderedAccessView* pUav, D3D11UnorderedAccessView* pUav,
UINT CtrSlot,
UINT Counter) { UINT Counter) {
EmitCs([ EmitCs([
cUavSlotId = UavSlot, cUavSlotId = UavSlot,
@ -3129,11 +3129,14 @@ namespace dxvk {
for (uint32_t i = 0; i < NumUAVs; i++) { for (uint32_t i = 0; i < NumUAVs; i++) {
auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]); auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]);
auto ctr = pUAVInitialCounts ? pUAVInitialCounts[i] : ~0u;
if (Bindings[StartSlot + i] != uav) { if (Bindings[StartSlot + i] != uav || ctr != ~0u) {
Bindings[StartSlot + i] = uav; Bindings[StartSlot + i] = uav;
BindUnorderedAccessView(uavSlotId + i, ctrSlotId + i, uav,
pUAVInitialCounts ? pUAVInitialCounts[i] : ~0u); BindUnorderedAccessView(
uavSlotId + i, uav,
ctrSlotId + i, ctr);
} }
} }
} }
@ -3285,8 +3288,9 @@ namespace dxvk {
for (uint32_t i = 0; i < Bindings.size(); i++) { for (uint32_t i = 0; i < Bindings.size(); i++) {
BindUnorderedAccessView( BindUnorderedAccessView(
uavSlotId + i, ctrSlotId + i, uavSlotId + i,
Bindings[i].ptr(), ~0u); Bindings[i].ptr(),
ctrSlotId + i, ~0u);
} }
} }

View File

@ -716,8 +716,8 @@ namespace dxvk {
void BindUnorderedAccessView( void BindUnorderedAccessView(
UINT UavSlot, UINT UavSlot,
UINT CtrSlot,
D3D11UnorderedAccessView* pUav, D3D11UnorderedAccessView* pUav,
UINT CtrSlot,
UINT Counter); UINT Counter);
void DiscardBuffer( void DiscardBuffer(