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 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<D3D11UnorderedAccessView*>(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(),

View File

@ -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())