mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-16 23:10:54 +00:00
Fix device memory selection on replay as well
This commit is contained in:
@@ -978,6 +978,8 @@ public:
|
||||
uint32_t GetUploadMemoryIndex(uint32_t resourceCompatibleBitmask);
|
||||
uint32_t GetGPULocalMemoryIndex(uint32_t resourceCompatibleBitmask);
|
||||
|
||||
void ChooseMemoryIndices();
|
||||
|
||||
EventFlags GetEventFlags(uint32_t eid) { return m_EventFlags[eid]; }
|
||||
rdcarray<EventUsage> GetUsage(ResourceId id) { return m_ResourceUses[id]; }
|
||||
// return the pre-selected device and queue
|
||||
|
||||
@@ -24,6 +24,41 @@
|
||||
|
||||
#include "vk_core.h"
|
||||
|
||||
void WrappedVulkan::ChooseMemoryIndices()
|
||||
{
|
||||
// we need to do this little dance because Get*MemoryIndex checks to see if the existing
|
||||
// readback index is valid, and if so just returns it without doing the proper checks.
|
||||
// so first we set the indices to something invalid then call the function
|
||||
m_PhysicalDeviceData.readbackMemIndex = m_PhysicalDeviceData.uploadMemIndex =
|
||||
m_PhysicalDeviceData.GPULocalMemIndex = ~0U;
|
||||
|
||||
m_PhysicalDeviceData.readbackMemIndex = GetReadbackMemoryIndex(~0U);
|
||||
m_PhysicalDeviceData.uploadMemIndex = GetUploadMemoryIndex(~0U);
|
||||
m_PhysicalDeviceData.GPULocalMemIndex = GetGPULocalMemoryIndex(~0U);
|
||||
|
||||
for(uint32_t i = 0; i < m_PhysicalDeviceData.memProps.memoryTypeCount; i++)
|
||||
{
|
||||
rdcstr selected;
|
||||
|
||||
if(m_PhysicalDeviceData.GPULocalMemIndex == i)
|
||||
selected += "GPULocal|";
|
||||
if(m_PhysicalDeviceData.readbackMemIndex == i)
|
||||
selected += "readback|";
|
||||
if(m_PhysicalDeviceData.uploadMemIndex == i)
|
||||
selected += "upload|";
|
||||
|
||||
selected.pop_back();
|
||||
|
||||
const VkMemoryType &type = m_PhysicalDeviceData.memProps.memoryTypes[i];
|
||||
const VkMemoryHeap &heap = m_PhysicalDeviceData.memProps.memoryHeaps[type.heapIndex];
|
||||
|
||||
RDCLOG(" Memory type %u: %s in heap %u (%s) (%.1f GB) [%s]", i,
|
||||
ToStr((VkMemoryPropertyFlagBits)type.propertyFlags).c_str(), type.heapIndex,
|
||||
ToStr((VkMemoryHeapFlagBits)heap.flags).c_str(),
|
||||
float(heap.size) / (1024.0f * 1024.0f * 1024.0f), selected.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t WrappedVulkan::GetReadbackMemoryIndex(uint32_t resourceCompatibleBitmask)
|
||||
{
|
||||
if(m_PhysicalDeviceData.readbackMemIndex < 32 &&
|
||||
|
||||
@@ -3001,12 +3001,7 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
|
||||
m_PhysicalDeviceData.queueCount = qCount;
|
||||
memcpy(m_PhysicalDeviceData.queueProps, props, qCount * sizeof(VkQueueFamilyProperties));
|
||||
|
||||
m_PhysicalDeviceData.readbackMemIndex =
|
||||
m_PhysicalDeviceData.GetMemoryIndex(~0U, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, 0);
|
||||
m_PhysicalDeviceData.uploadMemIndex =
|
||||
m_PhysicalDeviceData.GetMemoryIndex(~0U, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, 0);
|
||||
m_PhysicalDeviceData.GPULocalMemIndex = m_PhysicalDeviceData.GetMemoryIndex(
|
||||
~0U, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
|
||||
ChooseMemoryIndices();
|
||||
|
||||
APIProps.vendor = GetDriverInfo().Vendor();
|
||||
|
||||
@@ -3465,37 +3460,7 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
->GetPhysicalDeviceFormatProperties(Unwrap(physicalDevice), VkFormat(i),
|
||||
&m_PhysicalDeviceData.fmtprops[i]);
|
||||
|
||||
// we need to do this little dance because Get*MemoryIndex checks to see if the existing
|
||||
// readback index is valid, and if so just returns it without doing the proper checks.
|
||||
// so first we set the indices to something invalid then call the function
|
||||
m_PhysicalDeviceData.readbackMemIndex = m_PhysicalDeviceData.uploadMemIndex =
|
||||
m_PhysicalDeviceData.GPULocalMemIndex = ~0U;
|
||||
|
||||
m_PhysicalDeviceData.readbackMemIndex = GetReadbackMemoryIndex(~0U);
|
||||
m_PhysicalDeviceData.uploadMemIndex = GetUploadMemoryIndex(~0U);
|
||||
m_PhysicalDeviceData.GPULocalMemIndex = GetGPULocalMemoryIndex(~0U);
|
||||
|
||||
for(uint32_t i = 0; i < m_PhysicalDeviceData.memProps.memoryTypeCount; i++)
|
||||
{
|
||||
rdcstr selected;
|
||||
|
||||
if(m_PhysicalDeviceData.GPULocalMemIndex == i)
|
||||
selected += "GPULocal|";
|
||||
if(m_PhysicalDeviceData.readbackMemIndex == i)
|
||||
selected += "readback|";
|
||||
if(m_PhysicalDeviceData.uploadMemIndex == i)
|
||||
selected += "upload|";
|
||||
|
||||
selected.pop_back();
|
||||
|
||||
const VkMemoryType &type = m_PhysicalDeviceData.memProps.memoryTypes[i];
|
||||
const VkMemoryHeap &heap = m_PhysicalDeviceData.memProps.memoryHeaps[type.heapIndex];
|
||||
|
||||
RDCLOG(" Memory type %u: %s in heap %u (%s) (%.1f GB) [%s]", i,
|
||||
ToStr((VkMemoryPropertyFlagBits)type.propertyFlags).c_str(), type.heapIndex,
|
||||
ToStr((VkMemoryHeapFlagBits)heap.flags).c_str(),
|
||||
float(heap.size) / (1024.0f * 1024.0f * 1024.0f), selected.c_str());
|
||||
}
|
||||
ChooseMemoryIndices();
|
||||
|
||||
m_PhysicalDeviceData.queueCount = qCount;
|
||||
memcpy(m_PhysicalDeviceData.queueProps, props, qCount * sizeof(VkQueueFamilyProperties));
|
||||
|
||||
Reference in New Issue
Block a user