[dxvk] Bind consecutive descriptor sets in one go

Most of the time we'll be able to bind all sets in one iteration. Binding
sets is expected to be cheap in the driver, but we should avoid unnecessary
function call overhead for this frequently called function.
This commit is contained in:
Philip Rebohle 2022-06-20 01:32:33 +02:00
parent e2b7522034
commit a27448bc76
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 5 additions and 4 deletions

View File

@ -4384,18 +4384,19 @@ namespace dxvk {
m_cmd->updateDescriptorSets(k, m_descriptorWrites.data());
// Bind all descriptor sets that need updating
uint32_t bindSetMask = layoutSetMask & ~((1u << firstUpdated) - 1);
uint32_t bindSetMask = layoutSetMask & ((~0u) << firstUpdated);
while (bindSetMask) {
uint32_t setIndex = bit::tzcnt(bindSetMask);
uint32_t setCount = bit::tzcnt(~(bindSetMask >> setIndex));
VkDescriptorSet& set = m_descriptorState.getSet<BindPoint>(setIndex);
VkDescriptorSet* sets = &m_descriptorState.getSet<BindPoint>(setIndex);
m_cmd->cmdBindDescriptorSets(BindPoint,
layout->getPipelineLayout(),
setIndex, 1, &set, 0, nullptr);
setIndex, setCount, sets, 0, nullptr);
bindSetMask &= bindSetMask - 1;
bindSetMask &= (~0u) << (setIndex + setCount);
}
// Update pipeline if there are unbound resources