From f58242c58d32c5dfea408b0cd3a3c35dcc925b65 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 23 Jun 2019 15:49:29 +0200 Subject: [PATCH] [dxvk] Fix poor API design around defining resource slots --- src/dxvk/dxvk_pipelayout.cpp | 17 +++++++---------- src/dxvk/dxvk_pipelayout.h | 10 ++-------- src/dxvk/dxvk_shader.cpp | 2 +- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/dxvk/dxvk_pipelayout.cpp b/src/dxvk/dxvk_pipelayout.cpp index a5555ff7..9cd88775 100644 --- a/src/dxvk/dxvk_pipelayout.cpp +++ b/src/dxvk/dxvk_pipelayout.cpp @@ -10,23 +10,20 @@ namespace dxvk { void DxvkDescriptorSlotMapping::defineSlot( - uint32_t slot, - VkDescriptorType type, - VkImageViewType view, VkShaderStageFlagBits stage, - VkAccessFlags access) { - uint32_t bindingId = this->getBindingId(slot); + const DxvkResourceSlot& desc) { + uint32_t bindingId = this->getBindingId(desc.slot); if (bindingId != InvalidBinding) { m_descriptorSlots[bindingId].stages |= stage; - m_descriptorSlots[bindingId].access |= access; + m_descriptorSlots[bindingId].access |= desc.access; } else { DxvkDescriptorSlot slotInfo; - slotInfo.slot = slot; - slotInfo.type = type; - slotInfo.view = view; + slotInfo.slot = desc.slot; + slotInfo.type = desc.type; + slotInfo.view = desc.view; slotInfo.stages = stage; - slotInfo.access = access; + slotInfo.access = desc.access; m_descriptorSlots.push_back(slotInfo); } } diff --git a/src/dxvk/dxvk_pipelayout.h b/src/dxvk/dxvk_pipelayout.h index 38c1b75f..f88e22d8 100644 --- a/src/dxvk/dxvk_pipelayout.h +++ b/src/dxvk/dxvk_pipelayout.h @@ -81,18 +81,12 @@ namespace dxvk { * defined by another shader stage, this will extend * the stage mask by the given stage. Otherwise, an * entirely new binding is added. - * \param [in] slot Resource slot - * \param [in] type Resource type - * \param [in] view Image view type * \param [in] stage Shader stage - * \param [in] access Access flags + * \param [in] desc Slot description */ void defineSlot( - uint32_t slot, - VkDescriptorType type, - VkImageViewType view, VkShaderStageFlagBits stage, - VkAccessFlags access); + const DxvkResourceSlot& desc); /** * \brief Defines new push constant range diff --git a/src/dxvk/dxvk_shader.cpp b/src/dxvk/dxvk_shader.cpp index d24273e2..d258f799 100644 --- a/src/dxvk/dxvk_shader.cpp +++ b/src/dxvk/dxvk_shader.cpp @@ -150,7 +150,7 @@ namespace dxvk { void DxvkShader::defineResourceSlots( DxvkDescriptorSlotMapping& mapping) const { for (const auto& slot : m_slots) - mapping.defineSlot(slot.slot, slot.type, slot.view, m_stage, slot.access); + mapping.defineSlot(m_stage, slot); if (m_interface.pushConstSize) { mapping.definePushConstRange(m_stage,