mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-05 05:15:47 +00:00
Unify handling of extension fetching between capture & replay
* Instead of hardcoding which extension functions we fetch on replay, we do the same as on capture and fetch all functions for the extensions that are actually enabled.
This commit is contained in:
@@ -67,50 +67,11 @@ void InitReplayTables(void *vulkanModule)
|
||||
table->func = \
|
||||
(CONCAT(PFN_vk, func))table->GetInstanceProcAddr(instance, STRINGIZE(CONCAT(vk, func)))
|
||||
|
||||
void InitInstanceReplayTables(VkInstance instance)
|
||||
{
|
||||
VkLayerInstanceDispatchTable *table = GetInstanceDispatchTable(instance);
|
||||
RDCASSERT(table);
|
||||
|
||||
// we know we'll only have one instance, so this is safe
|
||||
|
||||
InstanceGPA(EnumerateDeviceExtensionProperties);
|
||||
InstanceGPA(EnumerateDeviceLayerProperties);
|
||||
|
||||
InstanceGPA(GetPhysicalDeviceSurfaceCapabilitiesKHR);
|
||||
InstanceGPA(GetPhysicalDeviceSurfaceFormatsKHR);
|
||||
InstanceGPA(GetPhysicalDeviceSurfacePresentModesKHR);
|
||||
InstanceGPA(GetPhysicalDeviceSurfaceSupportKHR);
|
||||
InstanceGPA(CreateDebugReportCallbackEXT);
|
||||
InstanceGPA(DestroyDebugReportCallbackEXT);
|
||||
InstanceGPA(DebugReportMessageEXT);
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
InstanceGPA(CreateWin32SurfaceKHR);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
InstanceGPA(CreateAndroidSurfaceKHR);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
InstanceGPA(CreateXcbSurfaceKHR);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
InstanceGPA(CreateXlibSurfaceKHR);
|
||||
#endif
|
||||
|
||||
InstanceGPA(DestroySurfaceKHR);
|
||||
}
|
||||
|
||||
void InitInstanceExtensionTables(VkInstance instance)
|
||||
void InitInstanceExtensionTables(VkInstance instance, InstanceDeviceInfo *info)
|
||||
{
|
||||
VkLayerInstanceDispatchTableExtended *table = GetInstanceDispatchTable(instance);
|
||||
RDCASSERT(table);
|
||||
|
||||
InstanceDeviceInfo *info = GetRecord(instance)->instDevInfo;
|
||||
|
||||
instance = Unwrap(instance);
|
||||
|
||||
#undef HookInitExtension
|
||||
@@ -120,6 +81,9 @@ void InitInstanceExtensionTables(VkInstance instance)
|
||||
InstanceGPA(func); \
|
||||
}
|
||||
|
||||
InstanceGPA(EnumerateDeviceExtensionProperties);
|
||||
InstanceGPA(EnumerateDeviceLayerProperties);
|
||||
|
||||
HookInitVulkanInstanceExts();
|
||||
}
|
||||
|
||||
@@ -128,24 +92,11 @@ void InitInstanceExtensionTables(VkInstance instance)
|
||||
#define DeviceGPA(func) \
|
||||
table->func = (CONCAT(PFN_vk, func))table->GetDeviceProcAddr(device, STRINGIZE(CONCAT(vk, func)));
|
||||
|
||||
void InitDeviceReplayTables(VkDevice device)
|
||||
{
|
||||
VkLayerDispatchTable *table = GetDeviceDispatchTable(device);
|
||||
RDCASSERT(table);
|
||||
|
||||
// MULTIDEVICE each device will need a replay table
|
||||
|
||||
DeviceGPA(CreateSwapchainKHR) DeviceGPA(DestroySwapchainKHR) DeviceGPA(GetSwapchainImagesKHR)
|
||||
DeviceGPA(AcquireNextImageKHR) DeviceGPA(QueuePresentKHR)
|
||||
}
|
||||
|
||||
void InitDeviceExtensionTables(VkDevice device)
|
||||
void InitDeviceExtensionTables(VkDevice device, InstanceDeviceInfo *info)
|
||||
{
|
||||
VkLayerDispatchTableExtended *table = GetDeviceDispatchTable(device);
|
||||
RDCASSERT(table);
|
||||
|
||||
InstanceDeviceInfo *info = GetRecord(device)->instDevInfo;
|
||||
|
||||
device = Unwrap(device);
|
||||
|
||||
#undef HookInitExtension
|
||||
|
||||
@@ -36,11 +36,25 @@
|
||||
|
||||
void InitReplayTables(void *vulkanModule);
|
||||
|
||||
void InitInstanceReplayTables(VkInstance instance);
|
||||
void InitDeviceReplayTables(VkDevice device);
|
||||
struct InstanceDeviceInfo
|
||||
{
|
||||
#undef CheckExt
|
||||
#define CheckExt(name) ext_##name = false;
|
||||
InstanceDeviceInfo()
|
||||
{
|
||||
CheckDeviceExts();
|
||||
CheckInstanceExts();
|
||||
}
|
||||
|
||||
void InitInstanceExtensionTables(VkInstance instance);
|
||||
void InitDeviceExtensionTables(VkDevice device);
|
||||
#undef CheckExt
|
||||
#define CheckExt(name) bool ext_##name;
|
||||
|
||||
CheckDeviceExts();
|
||||
CheckInstanceExts();
|
||||
};
|
||||
|
||||
void InitInstanceExtensionTables(VkInstance instance, InstanceDeviceInfo *info);
|
||||
void InitDeviceExtensionTables(VkDevice device, InstanceDeviceInfo *info);
|
||||
|
||||
VkLayerDispatchTableExtended *GetDeviceDispatchTable(void *device);
|
||||
VkLayerInstanceDispatchTableExtended *GetInstanceDispatchTable(void *instance);
|
||||
|
||||
@@ -838,23 +838,6 @@ struct SwapchainInfo
|
||||
uint32_t lastPresent;
|
||||
};
|
||||
|
||||
struct InstanceDeviceInfo
|
||||
{
|
||||
#undef CheckExt
|
||||
#define CheckExt(name) ext_##name = false;
|
||||
InstanceDeviceInfo()
|
||||
{
|
||||
CheckDeviceExts();
|
||||
CheckInstanceExts();
|
||||
}
|
||||
|
||||
#undef CheckExt
|
||||
#define CheckExt(name) bool ext_##name;
|
||||
|
||||
CheckDeviceExts();
|
||||
CheckInstanceExts();
|
||||
};
|
||||
|
||||
struct SparseMapping
|
||||
{
|
||||
SparseMapping()
|
||||
|
||||
@@ -220,6 +220,20 @@ ReplayStatus WrappedVulkan::Initialise(VkInitParams ¶ms)
|
||||
|
||||
VkResult ret = GetInstanceDispatchTable(NULL)->CreateInstance(&instinfo, NULL, &m_Instance);
|
||||
|
||||
InstanceDeviceInfo extInfo;
|
||||
|
||||
#undef CheckExt
|
||||
#define CheckExt(name) \
|
||||
if(!strcmp(instinfo.ppEnabledExtensionNames[i], #name)) \
|
||||
{ \
|
||||
extInfo.ext_##name = true; \
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < instinfo.enabledExtensionCount; i++)
|
||||
{
|
||||
CheckInstanceExts();
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY(layerscstr);
|
||||
SAFE_DELETE_ARRAY(extscstr);
|
||||
|
||||
@@ -228,11 +242,11 @@ ReplayStatus WrappedVulkan::Initialise(VkInitParams ¶ms)
|
||||
|
||||
RDCASSERTEQUAL(ret, VK_SUCCESS);
|
||||
|
||||
InitInstanceReplayTables(m_Instance);
|
||||
|
||||
GetResourceManager()->WrapResource(m_Instance, m_Instance);
|
||||
GetResourceManager()->AddLiveResource(params.InstanceID, m_Instance);
|
||||
|
||||
InitInstanceExtensionTables(m_Instance, &extInfo);
|
||||
|
||||
m_DbgMsgCallback = VK_NULL_HANDLE;
|
||||
m_PhysicalDevice = VK_NULL_HANDLE;
|
||||
m_Device = VK_NULL_HANDLE;
|
||||
@@ -377,7 +391,7 @@ VkResult WrappedVulkan::vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo
|
||||
|
||||
delete[] addedExts;
|
||||
|
||||
InitInstanceExtensionTables(m_Instance);
|
||||
InitInstanceExtensionTables(m_Instance, record->instDevInfo);
|
||||
|
||||
RenderDoc::Inst().AddDeviceFrameCapturer(LayerDisp(m_Instance), this);
|
||||
|
||||
@@ -1102,7 +1116,21 @@ bool WrappedVulkan::Serialise_vkCreateDevice(Serialiser *localSerialiser,
|
||||
GetResourceManager()->WrapResource(device, device);
|
||||
GetResourceManager()->AddLiveResource(devId, device);
|
||||
|
||||
InitDeviceReplayTables(Unwrap(device));
|
||||
InstanceDeviceInfo extInfo;
|
||||
|
||||
#undef CheckExt
|
||||
#define CheckExt(name) \
|
||||
if(!strcmp(createInfo.ppEnabledExtensionNames[i], #name)) \
|
||||
{ \
|
||||
extInfo.ext_##name = true; \
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < createInfo.enabledExtensionCount; i++)
|
||||
{
|
||||
CheckDeviceExts();
|
||||
}
|
||||
|
||||
InitDeviceExtensionTables(device, &extInfo);
|
||||
|
||||
RDCASSERT(m_Device == VK_NULL_HANDLE); // MULTIDEVICE
|
||||
|
||||
@@ -1399,7 +1427,7 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
CheckDeviceExts();
|
||||
}
|
||||
|
||||
InitDeviceExtensionTables(*pDevice);
|
||||
InitDeviceExtensionTables(*pDevice, record->instDevInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user