use layer specific dispatch table maps

This commit is contained in:
GregF
2016-02-07 18:40:13 +01:00
committed by baldurk
parent bc2dca08ba
commit 4816bcfa7b
5 changed files with 25 additions and 15 deletions
@@ -49,3 +49,7 @@ VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void*
void destroy_device_dispatch_table(dispatch_key key);
void destroy_instance_dispatch_table(dispatch_key key);
void destroy_dispatch_table(device_table_map &map, dispatch_key key);
void destroy_dispatch_table(instance_table_map &map, dispatch_key key);
+6 -6
View File
@@ -208,7 +208,7 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice device, co
/* loader uses this to force layer initialization; device object is wrapped */
if (!strcmp("vkGetDeviceProcAddr", pName)) {
initDeviceTable((const VkBaseLayerObject *) device);
initDeviceTable(renderdoc_device_table_map, (const VkBaseLayerObject *) device);
return (PFN_vkVoidFunction) vkGetDeviceProcAddr;
}
@@ -220,9 +220,9 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice device, co
return (PFN_vkVoidFunction) vkDestroyDevice;
else
{
if (device_dispatch_table(device)->GetDeviceProcAddr == NULL)
if (get_dispatch_table(renderdoc_device_table_map, device)->GetDeviceProcAddr == NULL)
return NULL;
return device_dispatch_table(device)->GetDeviceProcAddr(device, pName);
return get_dispatch_table(renderdoc_device_table_map, device)->GetDeviceProcAddr(device, pName);
}
}
@@ -233,7 +233,7 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(VkInstance instan
/* loader uses this to force layer initialization; instance object is wrapped */
if (!strcmp("vkGetInstanceProcAddr", pName)) {
initInstanceTable((const VkBaseLayerObject *) instance);
initInstanceTable(renderdoc_instance_table_map, (const VkBaseLayerObject *) instance);
if (shadowVulkan == NULL) {
shadowVulkan = new WrappedVulkan("");
}
@@ -249,8 +249,8 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(VkInstance instan
if (!strcmp("vkGetGlobalLayerProperties", pName))
return (PFN_vkVoidFunction) vkGetGlobalLayerProperties;
if (instance_dispatch_table(instance)->GetInstanceProcAddr == NULL)
if (get_dispatch_table(renderdoc_instance_table_map, instance)->GetInstanceProcAddr == NULL)
return NULL;
return instance_dispatch_table(instance)->GetInstanceProcAddr(instance, pName);
return get_dispatch_table(renderdoc_instance_table_map, instance)->GetInstanceProcAddr(instance, pName);
}
+8 -5
View File
@@ -31,6 +31,9 @@
#include "jpeg-compressor/jpge.h"
device_table_map renderdoc_device_table_map;
instance_table_map renderdoc_instance_table_map;
// VKTODOLOW dirty buffers should propagate through to their memory somehow
// images can be separately dirty since we can't just copy their memory
// (tiling could be different)
@@ -460,7 +463,7 @@ VkResult WrappedVulkan::vkCreateInstance(
VkInstance inst = *pInstance;
VkResult ret = instance_dispatch_table(*pInstance)->CreateInstance(pCreateInfo, &inst);
VkResult ret = get_dispatch_table(renderdoc_instance_table_map, *pInstance)->CreateInstance(pCreateInfo, &inst);
GetResourceManager()->WrapResource(inst);
@@ -515,7 +518,7 @@ VkResult WrappedVulkan::vkDestroyInstance(
GetResourceManager()->ReleaseCurrentResource(GetResID(instance));
destroy_instance_dispatch_table(key);
destroy_dispatch_table(renderdoc_instance_table_map, key);
return VK_SUCCESS;
}
@@ -851,7 +854,7 @@ VkResult WrappedVulkan::vkCreateDevice(
RDCDEBUG("Might want to fiddle with createinfo - e.g. to remove VK_RenderDoc from set of extensions or similar");
VkResult ret = device_dispatch_table(*pDevice)->CreateDevice(Unwrap(physicalDevice), &createInfo, pDevice);
VkResult ret = get_dispatch_table(renderdoc_device_table_map, *pDevice)->CreateDevice(Unwrap(physicalDevice), &createInfo, pDevice);
if(ret == VK_SUCCESS)
{
@@ -965,7 +968,7 @@ VkResult WrappedVulkan::vkDestroyDevice(VkDevice device)
dispatch_key key = get_dispatch_key(device);
VkResult ret = ObjDisp(device)->DestroyDevice(device);
destroy_device_dispatch_table(key);
destroy_dispatch_table(renderdoc_device_table_map, key);
GetResourceManager()->ReleaseCurrentResource(GetResID(device));
@@ -5672,7 +5675,7 @@ bool WrappedVulkan::ReleaseResource(WrappedVkRes *res)
VkInstance instance = disp->real.As<VkInstance>();
dispatch_key key = get_dispatch_key(instance);
ObjDisp(instance)->DestroyInstance(instance);
destroy_instance_dispatch_table(key);
destroy_dispatch_table(renderdoc_instance_table_map, key);
break;
}
case eResDevice:
+5 -2
View File
@@ -51,14 +51,17 @@
extern VkLayerDispatchTable *dummyDeviceTable;
extern VkLayerInstanceDispatchTable *dummyInstanceTable;
extern device_table_map renderdoc_device_table_map;
extern instance_table_map renderdoc_instance_table_map;
template<typename wrappedtype>
void SetDispatchTable(bool writing, wrappedtype *wrapped)
{
if(writing)
{
wrapped->table = wrappedtype::UseInstanceDispatchTable
? (uintptr_t)instance_dispatch_table((void *)wrapped->real.handle)
: (uintptr_t)device_dispatch_table((void *)wrapped->real.handle);
? (uintptr_t)get_dispatch_table(renderdoc_instance_table_map, (void *)wrapped->real.handle)
: (uintptr_t)get_dispatch_table(renderdoc_device_table_map, (void *)wrapped->real.handle);
}
else
{
+2 -2
View File
@@ -34,8 +34,8 @@ struct VkResourceRecord;
// VKTODOLOW move layer dispatch table stuff to vk_common.h
struct VkLayerDispatchTable_;
struct VkLayerInstanceDispatchTable_;
VkLayerDispatchTable_ *device_dispatch_table(void* object);
VkLayerInstanceDispatchTable_ *instance_dispatch_table(void* object);
//VkLayerDispatchTable_ *device_dispatch_table(void* object);
//VkLayerInstanceDispatchTable_ *instance_dispatch_table(void* object);
// empty base class for dispatchable/non-dispatchable. Unfortunately
// we can't put any members here as the base class is always first,