1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00

[dxvk] Use DxvkBindingLayoutObjects for set lookup directly

Avoids pointer dereferencing on a really hot code path. This is also
safe since there's a 1:1 mapping between the VkPipelineLayout and the
given ovbject type.
This commit is contained in:
Philip Rebohle 2022-08-16 15:35:57 +02:00
parent 9f9324c421
commit e0af668f6c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 16 additions and 8 deletions

View File

@ -161,14 +161,13 @@ namespace dxvk {
DxvkDescriptorSetMap* DxvkDescriptorPool::getSetMap(
const DxvkBindingLayoutObjects* layout) {
auto pair = m_setMaps.find(layout->getPipelineLayout(false));
if (likely(pair != m_setMaps.end())) {
auto pair = m_setMaps.find(layout);
if (likely(pair != m_setMaps.end()))
return &pair->second;
}
auto iter = m_setMaps.emplace(
std::piecewise_construct,
std::tuple(layout->getPipelineLayout(false)),
std::tuple(layout),
std::tuple());
for (uint32_t i = 0; i < DxvkDescriptorSets::SetCount; i++) {

View File

@ -136,10 +136,19 @@ namespace dxvk {
DxvkDescriptorManager* m_manager;
DxvkContextType m_contextType;
std::vector<VkDescriptorPool> m_descriptorPools;
std::unordered_map<VkDescriptorSetLayout, DxvkDescriptorSetList> m_setLists;
std::unordered_map<VkPipelineLayout, DxvkDescriptorSetMap> m_setMaps;
std::pair<const DxvkBindingLayoutObjects*, DxvkDescriptorSetMap*> m_cachedEntry;
std::vector<VkDescriptorPool> m_descriptorPools;
std::unordered_map<
VkDescriptorSetLayout,
DxvkDescriptorSetList> m_setLists;
std::unordered_map<
const DxvkBindingLayoutObjects*,
DxvkDescriptorSetMap> m_setMaps;
std::pair<
const DxvkBindingLayoutObjects*,
DxvkDescriptorSetMap*> m_cachedEntry;
uint32_t m_setsAllocated = 0;
uint32_t m_setsUsed = 0;