1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 10:24:12 +01:00

[dxvk] Fix poor API design around defining resource slots

This commit is contained in:
Philip Rebohle 2019-06-23 15:49:29 +02:00
parent 326eb0bf80
commit f58242c58d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 10 additions and 19 deletions

View File

@ -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);
}
}

View File

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

View File

@ -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,