mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +00:00
Add support for VK_NV_dedicated_allocation
This commit is contained in:
@@ -2845,6 +2845,15 @@ static void SerialiseNext(Serialiser *ser, VkStructureType &sType, const void *&
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
// for now we don't serialise dedicated memory on replay as it's only a performance hint,
|
||||
// and is only required in conjunction with shared memory (which we don't replay). In future
|
||||
// it might be helpful to serialise this for informational purposes.
|
||||
else if(next->sType == VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV ||
|
||||
next->sType == VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV ||
|
||||
next->sType == VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCERR("Unrecognised extension structure type %d", next->sType);
|
||||
|
||||
@@ -792,6 +792,9 @@ static const VkExtensionProperties supportedExtensions[] = {
|
||||
VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_SPEC_VERSION,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION,
|
||||
},
|
||||
{
|
||||
VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME, VK_NV_EXTERNAL_MEMORY_SPEC_VERSION,
|
||||
},
|
||||
|
||||
@@ -252,6 +252,34 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
|
||||
ObjDisp(device)->DestroyBuffer(Unwrap(device), buf, NULL);
|
||||
}
|
||||
|
||||
VkDedicatedAllocationMemoryAllocateInfoNV unwrappedDedicated;
|
||||
unwrappedDedicated.sType = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV;
|
||||
|
||||
VkGenericStruct *curStruct = (VkGenericStruct *)&info;
|
||||
const void *next = info.pNext;
|
||||
while(next)
|
||||
{
|
||||
const VkGenericStruct *nextStruct = (const VkGenericStruct *)next;
|
||||
|
||||
// unwrap and replace the dedicated allocation struct in the chain
|
||||
if(nextStruct->sType == VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV)
|
||||
{
|
||||
const VkDedicatedAllocationMemoryAllocateInfoNV *dedicated =
|
||||
(const VkDedicatedAllocationMemoryAllocateInfoNV *)nextStruct;
|
||||
unwrappedDedicated.pNext = nextStruct->pNext;
|
||||
unwrappedDedicated.buffer = Unwrap(dedicated->buffer);
|
||||
unwrappedDedicated.image = Unwrap(dedicated->image);
|
||||
curStruct->pNext = (const VkGenericStruct *)&unwrappedDedicated;
|
||||
curStruct = (VkGenericStruct *)&unwrappedDedicated;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
next = nextStruct->pNext;
|
||||
}
|
||||
|
||||
VkResult ret = ObjDisp(device)->AllocateMemory(Unwrap(device), &info, pAllocator, pMemory);
|
||||
|
||||
// restore the memoryTypeIndex to the original, as that's what we want to serialise,
|
||||
|
||||
Reference in New Issue
Block a user