mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-13 09:15:36 +00:00
Remove use of GetWrapper while capturing
This commit is contained in:
@@ -194,6 +194,7 @@ private:
|
||||
VkQueue m_Queue; // the queue used for our own command buffer work
|
||||
|
||||
vector<VkPhysicalDevice> m_PhysicalDevices;
|
||||
vector<VkQueue*> m_QueueFamilies;
|
||||
|
||||
vector<uint32_t *> m_MemIdxMaps;
|
||||
void RemapMemoryIndices(VkPhysicalDeviceMemoryProperties *memProps, uint32_t **memIdxMap);
|
||||
|
||||
@@ -329,7 +329,7 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(
|
||||
GetResourceManager()->WrapResource(Unwrap(device), cmd);
|
||||
}
|
||||
|
||||
m_PartialReplayData.resultPartialCmdPool = (VkCommandPool)uint64_t(GetResourceManager()->GetWrapper(ToTypedHandle(allocInfo.commandPool)));
|
||||
m_PartialReplayData.resultPartialCmdPool = GetResourceManager()->GetNonDispWrapper(allocInfo.commandPool)->real.As<VkCommandPool>();
|
||||
m_PartialReplayData.resultPartialCmdBuffer = cmd;
|
||||
m_PartialReplayData.partialDevice = device;
|
||||
|
||||
|
||||
@@ -212,6 +212,13 @@ void WrappedVulkan::Shutdown()
|
||||
m_Device = VK_NULL_HANDLE;
|
||||
m_Instance = VK_NULL_HANDLE;
|
||||
|
||||
m_PhysicalDevices.clear();
|
||||
|
||||
for(size_t i=0; i < m_QueueFamilies.size(); i++)
|
||||
delete[] m_QueueFamilies[i];
|
||||
|
||||
m_QueueFamilies.clear();
|
||||
|
||||
// finally destroy device then instance
|
||||
vt->DestroyDevice(dev, NULL);
|
||||
vit->DestroyInstance(inst, NULL);
|
||||
@@ -333,9 +340,9 @@ VkResult WrappedVulkan::vkEnumeratePhysicalDevices(
|
||||
// it's perfectly valid for enumerate type functions to return the same handle
|
||||
// each time. If that happens, we will already have a wrapper created so just
|
||||
// return the wrapped object to the user and do nothing else
|
||||
if(GetResourceManager()->HasWrapper(ToTypedHandle(devices[i])))
|
||||
if(m_PhysicalDevices[i] != VK_NULL_HANDLE)
|
||||
{
|
||||
devices[i] = (VkPhysicalDevice)GetResourceManager()->GetWrapper(ToTypedHandle(devices[i]));
|
||||
devices[i] = m_PhysicalDevices[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -667,6 +674,18 @@ VkResult WrappedVulkan::vkCreateDevice(
|
||||
|
||||
RDCDEBUG("Might want to fiddle with createinfo - e.g. to remove VK_RenderDoc from set of extensions or similar");
|
||||
|
||||
m_QueueFamilies.resize(createInfo.queueCreateInfoCount);
|
||||
for(size_t i=0; i < m_QueueFamilies.size(); i++)
|
||||
{
|
||||
uint32_t family = createInfo.pQueueCreateInfos[i].queueFamilyIndex;
|
||||
uint32_t count = createInfo.pQueueCreateInfos[i].queueCount;
|
||||
m_QueueFamilies.resize(RDCMAX(m_QueueFamilies.size(), size_t(family+1)));
|
||||
|
||||
m_QueueFamilies[family] = new VkQueue[count];
|
||||
for(uint32_t q=0; q < count; q++)
|
||||
m_QueueFamilies[family][q] = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
VkResult ret = GetDeviceDispatchTable(*pDevice)->CreateDevice(Unwrap(physicalDevice), &createInfo, pAllocator, pDevice);
|
||||
|
||||
if(ret == VK_SUCCESS)
|
||||
|
||||
@@ -69,19 +69,20 @@ void WrappedVulkan::vkGetDeviceQueue(
|
||||
{
|
||||
ObjDisp(device)->GetDeviceQueue(Unwrap(device), queueFamilyIndex, queueIndex, pQueue);
|
||||
|
||||
RDCASSERT(m_State >= WRITING);
|
||||
|
||||
{
|
||||
// it's perfectly valid for enumerate type functions to return the same handle
|
||||
// each time. If that happens, we will already have a wrapper created so just
|
||||
// return the wrapped object to the user and do nothing else
|
||||
if(GetResourceManager()->HasWrapper(ToTypedHandle(*pQueue)))
|
||||
if(m_QueueFamilies[queueFamilyIndex][queueIndex] != VK_NULL_HANDLE)
|
||||
{
|
||||
*pQueue = (VkQueue)GetResourceManager()->GetWrapper(ToTypedHandle(*pQueue));
|
||||
*pQueue = m_QueueFamilies[queueFamilyIndex][queueIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pQueue);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
@@ -108,10 +109,8 @@ void WrappedVulkan::vkGetDeviceQueue(
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, *pQueue);
|
||||
}
|
||||
|
||||
m_QueueFamilies[queueFamilyIndex][queueIndex] = *pQueue;
|
||||
|
||||
if(queueFamilyIndex == m_QueueFamilyIdx)
|
||||
{
|
||||
|
||||
@@ -523,34 +523,27 @@ VkResult WrappedVulkan::vkCreateSemaphore(
|
||||
|
||||
if(ret == VK_SUCCESS)
|
||||
{
|
||||
if(GetResourceManager()->HasWrapper(ToTypedHandle(*pSemaphore)))
|
||||
ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pSemaphore);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
*pSemaphore = (VkSemaphore)(uint64_t)GetResourceManager()->GetWrapper(ToTypedHandle(*pSemaphore));
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_SEMAPHORE);
|
||||
Serialise_vkCreateSemaphore(localSerialiser, device, pCreateInfo, NULL, pSemaphore);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pSemaphore);
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pSemaphore);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_SEMAPHORE);
|
||||
Serialise_vkCreateSemaphore(localSerialiser, device, pCreateInfo, NULL, pSemaphore);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pSemaphore);
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, *pSemaphore);
|
||||
}
|
||||
GetResourceManager()->AddLiveResource(id, *pSemaphore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,13 +106,15 @@ VkResult WrappedVulkan::vkGetSwapchainImagesKHR(
|
||||
{
|
||||
uint32_t numImages = *pCount;
|
||||
|
||||
VkResourceRecord *swapRecord = GetRecord(swapchain);
|
||||
|
||||
for(uint32_t i=0; i < numImages; i++)
|
||||
{
|
||||
// these were all wrapped and serialised on swapchain create - we just have to
|
||||
// return the wrapped image in that case
|
||||
if(GetResourceManager()->HasWrapper(ToTypedHandle(pSwapchainImages[i])))
|
||||
if(swapRecord->swapInfo->images[i].im != VK_NULL_HANDLE)
|
||||
{
|
||||
pSwapchainImages[i] = (VkImage)(uint64_t)GetResourceManager()->GetWrapper(ToTypedHandle(pSwapchainImages[i]));
|
||||
pSwapchainImages[i] = swapRecord->swapInfo->images[i].im;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -378,6 +380,12 @@ VkResult WrappedVulkan::vkCreateSwapchainKHR(
|
||||
|
||||
swapInfo.lastPresent = 0;
|
||||
swapInfo.images.resize(numSwapImages);
|
||||
for(uint32_t i=0; i < numSwapImages; i++)
|
||||
{
|
||||
swapInfo.images[i].im = VK_NULL_HANDLE;
|
||||
swapInfo.images[i].view = VK_NULL_HANDLE;
|
||||
swapInfo.images[i].fb = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
VkImage* images = new VkImage[numSwapImages];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user