aboutsummaryrefslogtreecommitdiff
path: root/layers/screenshot.cpp
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-25 18:01:43 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-29 11:45:16 -0600
commitcfa6643201d47ccb6ccc630d60ad4b1f4cdf0102 (patch)
tree1482269daa565a428ecffad7047f0e6b9dab1fa4 /layers/screenshot.cpp
parent1f221b264ed51952fcecd34af0bfa405b0f27734 (diff)
downloadusermoji-cfa6643201d47ccb6ccc630d60ad4b1f4cdf0102.tar.xz
loader: Move CreateDevice to device table
Discovered an issue where a layer was doing cleanup in it's DestroyDevice function but the CreateDevice was never called. This happened because the extension was only enabled on the device chain and the device chain doesn't actually call CreateDevice. That happens on the Instance chain. Making it so that we can call down the device chain - which is terminated by the ICD. We need to know the real device object to construct the device chain heiarchy and when calling down the device chain it should end with the ICD doing the actual device object creation. This patch fixes the issue by using the same process as CreateInstance. The loader will call the ICD's CreateDevice and pass that in the *pDevice argument. The layers then ignore the PhysicalDevice parameter and use the *pDevice to access the device chain. To prevent the ICD from being called twice needed to stub in a special loader_GetDeviceChainProcAddr to provide a stub for only CreateDevice as the end of the chain. integrate review feedback.
Diffstat (limited to 'layers/screenshot.cpp')
-rw-r--r--layers/screenshot.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/layers/screenshot.cpp b/layers/screenshot.cpp
index d46205b3..f7927df3 100644
--- a/layers/screenshot.cpp
+++ b/layers/screenshot.cpp
@@ -311,8 +311,8 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(
const VkDeviceCreateInfo *pCreateInfo,
VkDevice *pDevice)
{
- VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(screenshot_instance_table_map, gpu);
- VkResult result = pInstanceTable->CreateDevice(gpu, pCreateInfo, pDevice);
+ VkLayerDispatchTable *pDisp = get_dispatch_table(screenshot_device_table_map, *pDevice);
+ VkResult result = pDisp->CreateDevice(gpu, pCreateInfo, pDevice);
if (result == VK_SUCCESS) {
createDeviceRegisterExtensions(pCreateInfo, *pDevice);
@@ -321,6 +321,8 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(
return result;
}
+/* TODO: Probably need a DestroyDevice as well */
+
#define SCREENSHOT_LAYER_EXT_ARRAY_SIZE 2
static const VkExtensionProperties ssExts[SCREENSHOT_LAYER_EXT_ARRAY_SIZE] = {
{
@@ -561,6 +563,9 @@ VK_LAYER_EXPORT void* VKAPI vkGetDeviceProcAddr(
initDeviceTable(screenshot_device_table_map, (const VkBaseLayerObject *) dev);
return (void *) vkGetDeviceProcAddr;
}
+ if (!strcmp(funcName, "vkCreateDevice"))
+ return (void*) vkCreateDevice;
+
if (!strcmp(funcName, "vkGetDeviceQueue"))
return (void*) vkGetDeviceQueue;
@@ -610,8 +615,6 @@ VK_LAYER_EXPORT void* VKAPI vkGetInstanceProcAddr(
return (void *) vkDestroyInstance;
if (!strcmp(funcName, "vkCreateInstance"))
return (void*) vkCreateInstance;
- if (!strcmp(funcName, "vkCreateDevice"))
- return (void*) vkCreateDevice;
if (get_dispatch_table(screenshot_instance_table_map, instance)->GetInstanceProcAddr == NULL)
return NULL;