mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Ensure invalid memory indices in the remap table aren't used. Refs #627
This commit is contained in:
@@ -88,11 +88,12 @@ uint32_t WrappedVulkan::PhysicalDeviceData::GetMemoryIndex(uint32_t resourceRequ
|
||||
void WrappedVulkan::RemapMemoryIndices(VkPhysicalDeviceMemoryProperties *memProps,
|
||||
uint32_t **memIdxMap)
|
||||
{
|
||||
uint32_t *memmap = new uint32_t[32];
|
||||
uint32_t *memmap = new uint32_t[VK_MAX_MEMORY_TYPES];
|
||||
*memIdxMap = memmap;
|
||||
m_MemIdxMaps.push_back(memmap);
|
||||
|
||||
RDCEraseMem(memmap, sizeof(uint32_t) * 32);
|
||||
for(size_t i = 0; i < VK_MAX_MEMORY_TYPES; i++)
|
||||
memmap[i] = ~0U;
|
||||
|
||||
// basic idea here:
|
||||
// We want to discourage coherent memory maps as much as possible while capturing,
|
||||
|
||||
@@ -137,8 +137,8 @@ void WrappedVulkan::vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buff
|
||||
// for each of our fake memory indices, check if the real
|
||||
// memory type it points to is set - if so, set our fake bit
|
||||
for(uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; i++)
|
||||
if(bits & (1 << memIdxMap[i]))
|
||||
pMemoryRequirements->memoryTypeBits |= (1 << i);
|
||||
if(memIdxMap[i] < 32U && (bits & (1U << memIdxMap[i])))
|
||||
pMemoryRequirements->memoryTypeBits |= (1U << i);
|
||||
}
|
||||
|
||||
void WrappedVulkan::vkGetImageMemoryRequirements(VkDevice device, VkImage image,
|
||||
@@ -158,8 +158,8 @@ void WrappedVulkan::vkGetImageMemoryRequirements(VkDevice device, VkImage image,
|
||||
// for each of our fake memory indices, check if the real
|
||||
// memory type it points to is set - if so, set our fake bit
|
||||
for(uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; i++)
|
||||
if(bits & (1 << memIdxMap[i]))
|
||||
pMemoryRequirements->memoryTypeBits |= (1 << i);
|
||||
if(memIdxMap[i] < 32U && (bits & (1U << memIdxMap[i])))
|
||||
pMemoryRequirements->memoryTypeBits |= (1U << i);
|
||||
}
|
||||
|
||||
void WrappedVulkan::vkGetImageSparseMemoryRequirements(
|
||||
|
||||
Reference in New Issue
Block a user