From d8c3002b929852929cccdc8cb21fc907859ba4cc Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 11 Oct 2019 14:21:49 +0200 Subject: [PATCH] [dxvk] Don't use dynamic storage buffers Doesn't really help in pracrice, but getting rid of them reduces the number of dynamic offsets we have to update per draw/dispatch. --- src/dxvk/dxvk_context.cpp | 14 -------------- src/dxvk/dxvk_descriptor.cpp | 3 +-- src/dxvk/dxvk_pipelayout.cpp | 6 +----- src/dxvk/dxvk_pipelayout.h | 9 ++++----- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index bf2f7ffd..a165881f 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -3860,18 +3860,6 @@ namespace dxvk { descriptors[i].buffer = m_common->dummyResources().bufferDescriptor(); } break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - if (res.bufferSlice.defined()) { - descriptors[i] = res.bufferSlice.getDescriptor(); - descriptors[i].buffer.offset = 0; - - if (m_rcTracked.set(binding.slot)) - m_cmd->trackResource(res.bufferSlice.buffer()); - } else { - bindMask.clr(i); - descriptors[i].buffer = m_common->dummyResources().bufferDescriptor(); - } break; - default: Logger::err(str::format("DxvkContext: Unhandled descriptor type: ", binding.type)); } @@ -4236,7 +4224,6 @@ namespace dxvk { switch (binding.type) { case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: if (binding.access & VK_ACCESS_SHADER_WRITE_BIT) dstAccess.set(DxvkAccess::Write); /* fall through */ @@ -4305,7 +4292,6 @@ namespace dxvk { switch (binding.type) { case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: if (binding.access & VK_ACCESS_SHADER_WRITE_BIT) access |= VK_ACCESS_SHADER_WRITE_BIT; /* fall through */ diff --git a/src/dxvk/dxvk_descriptor.cpp b/src/dxvk/dxvk_descriptor.cpp index e4da463a..cdd2ae67 100644 --- a/src/dxvk/dxvk_descriptor.cpp +++ b/src/dxvk/dxvk_descriptor.cpp @@ -7,7 +7,7 @@ namespace dxvk { : m_vkd(vkd) { constexpr uint32_t MaxSets = 2048; - std::array pools = {{ + std::array pools = {{ { VK_DESCRIPTOR_TYPE_SAMPLER, MaxSets * 2 }, { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, MaxSets * 3 }, { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, MaxSets / 8 }, @@ -16,7 +16,6 @@ namespace dxvk { { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, MaxSets * 3 }, { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, MaxSets / 8 }, { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, MaxSets * 3 }, - { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, MaxSets / 8 }, { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MaxSets * 2 } }}; VkDescriptorPoolCreateInfo info; diff --git a/src/dxvk/dxvk_pipelayout.cpp b/src/dxvk/dxvk_pipelayout.cpp index 9cd88775..cf43acb3 100644 --- a/src/dxvk/dxvk_pipelayout.cpp +++ b/src/dxvk/dxvk_pipelayout.cpp @@ -57,9 +57,6 @@ namespace dxvk { uint32_t storageBuffers) { if (this->countDescriptors(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) <= uniformBuffers) this->replaceDescriptors(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC); - - if (this->countDescriptors(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) <= storageBuffers) - this->replaceDescriptors(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC); } @@ -115,8 +112,7 @@ namespace dxvk { tEntries[i].offset = sizeof(DxvkDescriptorInfo) * i; tEntries[i].stride = 0; - if (bindingInfos[i].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC - || bindingInfos[i].type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) + if (bindingInfos[i].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) m_dynamicSlots.push_back(i); m_descriptorTypes.set(bindingInfos[i].type); diff --git a/src/dxvk/dxvk_pipelayout.h b/src/dxvk/dxvk_pipelayout.h index f88e22d8..9e96b34b 100644 --- a/src/dxvk/dxvk_pipelayout.h +++ b/src/dxvk/dxvk_pipelayout.h @@ -235,13 +235,12 @@ namespace dxvk { * \brief Checks for static buffer bindings * * Returns \c true if there is at least one - * descriptor of the static uniform or storage - * buffer type. + * descriptor of the static uniform buffer + * type. */ bool hasStaticBufferBindings() const { - return m_descriptorTypes.any( - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); + return m_descriptorTypes.test( + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); } /**