diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 980db139..e24e14f6 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -1919,10 +1919,14 @@ namespace dxvk { UINT StartSlot, UINT NumUAVs, ID3D11UnorderedAccessView* const* ppUnorderedAccessViews) { - const uint32_t slotId = computeResourceSlotId( + const uint32_t uavSlotId = computeResourceSlotId( ShaderStage, DxbcBindingType::UnorderedAccessView, StartSlot); + const uint32_t ctrSlotId = computeResourceSlotId( + ShaderStage, DxbcBindingType::UavCounter, + StartSlot); + for (uint32_t i = 0; i < NumUAVs; i++) { auto uav = static_cast(ppUnorderedAccessViews[i]); @@ -1933,16 +1937,19 @@ namespace dxvk { // Figure out what we have to bind based on the resource type if (uav->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) { m_context->bindResourceTexelBuffer( - slotId + i, uav->GetBufferView()); + uavSlotId + i, uav->GetBufferView()); + m_context->bindResourceBuffer( + ctrSlotId + i, uav->GetCounterSlice()); } else { m_context->bindResourceImage( - slotId + i, uav->GetImageView()); + uavSlotId + i, uav->GetImageView()); } } else { // When unbinding a resource, it doesn't really matter if // the resource type is correct, so we'll just bind a null // image to the given resource slot - m_context->bindResourceImage(slotId + i, nullptr); + m_context->bindResourceTexelBuffer(uavSlotId + i, nullptr); + m_context->bindResourceBuffer (ctrSlotId + i, DxvkBufferSlice()); } } } @@ -1960,7 +1967,8 @@ namespace dxvk { const DxvkBufferSlice counterSlice = uav->GetCounterSlice(); const D3D11UavCounter counterValue = { pUAVInitialCounts[i] }; - if (counterSlice.handle() != VK_NULL_HANDLE) { + if (counterSlice.handle() != VK_NULL_HANDLE + && counterValue.atomicCtr != 0xFFFFFFFFu) { m_context->updateBuffer( counterSlice.buffer(), counterSlice.offset(), diff --git a/src/dxvk/dxvk_descriptor.cpp b/src/dxvk/dxvk_descriptor.cpp index 69acda1e..24db9dc7 100644 --- a/src/dxvk/dxvk_descriptor.cpp +++ b/src/dxvk/dxvk_descriptor.cpp @@ -21,7 +21,8 @@ namespace dxvk { VkDescriptorSet DxvkDescriptorAlloc::alloc(VkDescriptorSetLayout layout) { - VkDescriptorSet set = allocFrom(m_pools[m_poolId], layout); +// VkDescriptorSet set = allocFrom(m_pools[m_poolId], layout); + VkDescriptorSet set = VK_NULL_HANDLE; if (set == VK_NULL_HANDLE) { if (++m_poolId >= m_pools.size())