1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[dxvk] Cache memory type mask with global buffer support

This commit is contained in:
Philip Rebohle 2024-09-23 00:20:33 +02:00 committed by Philip Rebohle
parent 3bee390d91
commit e80dd6db5f
2 changed files with 15 additions and 1 deletions

View File

@ -938,6 +938,9 @@ namespace dxvk {
// Only use a minimal set of usage flags for the global buffer if the
// full combination of flags is not supported for whatever reason.
m_globalBufferUsageFlags = ~0u;
m_globalBufferMemoryTypes = 0u;
for (uint32_t i = 0; i < m_memTypeCount; i++) {
bufferInfo.usage = m_memTypes[i].bufferUsage;
@ -947,7 +950,15 @@ namespace dxvk {
| VK_BUFFER_USAGE_TRANSFER_DST_BIT
| VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
}
if (m_memTypes[i].bufferUsage) {
m_globalBufferUsageFlags &= m_memTypes[i].bufferUsage;
m_globalBufferMemoryTypes |= 1u << i;
}
}
Logger::info(str::format("Memory type mask for buffer resources: "
"0x", std::hex, m_globalBufferMemoryTypes, ", usage: 0x", m_globalBufferUsageFlags));
}

View File

@ -876,7 +876,10 @@ namespace dxvk {
std::array<DxvkMemoryType, VK_MAX_MEMORY_TYPES> m_memTypes = { };
std::array<DxvkMemoryHeap, VK_MAX_MEMORY_HEAPS> m_memHeaps = { };
uint32_t m_sparseMemoryTypes = 0u;
VkBufferUsageFlags m_globalBufferUsageFlags = 0u;
uint32_t m_globalBufferMemoryTypes = 0u;
uint32_t m_sparseMemoryTypes = 0u;
std::array<uint32_t, 16> m_memTypesByPropertyFlags = { };