1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Fixed UAV counter buffer binding

This commit is contained in:
Philip Rebohle 2018-01-11 17:12:39 +01:00
parent 69c5af4455
commit 32078033c6
2 changed files with 15 additions and 6 deletions

View File

@ -1919,10 +1919,14 @@ namespace dxvk {
UINT StartSlot, UINT StartSlot,
UINT NumUAVs, UINT NumUAVs,
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews) { ID3D11UnorderedAccessView* const* ppUnorderedAccessViews) {
const uint32_t slotId = computeResourceSlotId( const uint32_t uavSlotId = computeResourceSlotId(
ShaderStage, DxbcBindingType::UnorderedAccessView, ShaderStage, DxbcBindingType::UnorderedAccessView,
StartSlot); StartSlot);
const uint32_t ctrSlotId = computeResourceSlotId(
ShaderStage, DxbcBindingType::UavCounter,
StartSlot);
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]);
@ -1933,16 +1937,19 @@ namespace dxvk {
// Figure out what we have to bind based on the resource type // Figure out what we have to bind based on the resource type
if (uav->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) { if (uav->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) {
m_context->bindResourceTexelBuffer( m_context->bindResourceTexelBuffer(
slotId + i, uav->GetBufferView()); uavSlotId + i, uav->GetBufferView());
m_context->bindResourceBuffer(
ctrSlotId + i, uav->GetCounterSlice());
} else { } else {
m_context->bindResourceImage( m_context->bindResourceImage(
slotId + i, uav->GetImageView()); uavSlotId + i, uav->GetImageView());
} }
} else { } else {
// When unbinding a resource, it doesn't really matter if // When unbinding a resource, it doesn't really matter if
// the resource type is correct, so we'll just bind a null // the resource type is correct, so we'll just bind a null
// image to the given resource slot // 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 DxvkBufferSlice counterSlice = uav->GetCounterSlice();
const D3D11UavCounter counterValue = { pUAVInitialCounts[i] }; const D3D11UavCounter counterValue = { pUAVInitialCounts[i] };
if (counterSlice.handle() != VK_NULL_HANDLE) { if (counterSlice.handle() != VK_NULL_HANDLE
&& counterValue.atomicCtr != 0xFFFFFFFFu) {
m_context->updateBuffer( m_context->updateBuffer(
counterSlice.buffer(), counterSlice.buffer(),
counterSlice.offset(), counterSlice.offset(),

View File

@ -21,7 +21,8 @@ namespace dxvk {
VkDescriptorSet DxvkDescriptorAlloc::alloc(VkDescriptorSetLayout layout) { 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 (set == VK_NULL_HANDLE) {
if (++m_poolId >= m_pools.size()) if (++m_poolId >= m_pools.size())