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

[dxvk] Rearrange descriptor sets

This allows us not to unnecessarily dirty the FS UBO set when
changing tetxure bindings, leading to a cleaner separation.
This commit is contained in:
Philip Rebohle 2023-01-13 02:22:53 +01:00 committed by Philip Rebohle
parent 4a30933359
commit a8f9fdb21d
3 changed files with 12 additions and 12 deletions

View File

@ -1792,14 +1792,16 @@ namespace dxvk {
~(VK_BUFFER_USAGE_TRANSFER_DST_BIT |
VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
if (usage & (VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT))
// Fast early-out for plain uniform buffers, very common
if (likely(usage == VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)) {
m_descriptorState.dirtyBuffers(buffer->getShaderStages());
return;
}
if (usage & (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT))
m_descriptorState.dirtyBuffers(buffer->getShaderStages());
// Fast early-out for plain buffers, very common
if (likely(!(usage & ~(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT))))
return;
if (usage & (VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT))
if (usage & (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT))
m_descriptorState.dirtyViews(buffer->getShaderStages());
if (usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT)

View File

@ -14,11 +14,9 @@ namespace dxvk {
return DxvkDescriptorSets::CsAll;
} else if (stage == VK_SHADER_STAGE_FRAGMENT_BIT) {
// For fragment shaders, create a separate set for UBOs
if (descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
|| descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
return DxvkDescriptorSets::FsBuffers;
return DxvkDescriptorSets::FsViews;
return uboSet
? DxvkDescriptorSets::FsBuffers
: DxvkDescriptorSets::FsViews;
} else {
// Put all vertex shader resources into the last set.
// Vertex shader UBOs are usually updated every draw,

View File

@ -552,7 +552,7 @@ namespace dxvk {
if (m_dirtyBuffers & VK_SHADER_STAGE_FRAGMENT_BIT)
result |= (1u << DxvkDescriptorSets::FsBuffers);
if (m_dirtyViews & VK_SHADER_STAGE_FRAGMENT_BIT)
result |= (1u << DxvkDescriptorSets::FsViews) | (1u << DxvkDescriptorSets::FsBuffers);
result |= (1u << DxvkDescriptorSets::FsViews);
if ((m_dirtyBuffers | m_dirtyViews) & (VK_SHADER_STAGE_ALL_GRAPHICS & ~VK_SHADER_STAGE_FRAGMENT_BIT))
result |= (1u << DxvkDescriptorSets::VsAll);
return result;