diff options
| author | Chia-I Wu <olv@google.com> | 2016-05-16 11:21:03 +0800 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-05-24 06:29:14 -0600 |
| commit | 2b7352c6df0f03ce3b426390cc4c20ecec29ac92 (patch) | |
| tree | 008a610544731f0e87122792fab97618093286cd /layers/threading.cpp | |
| parent | ef2202c358d9ea062003fb73c9d4f9cbe5bb2c22 (diff) | |
| download | usermoji-2b7352c6df0f03ce3b426390cc4c20ecec29ac92.tar.xz | |
threading: avoid invalid GIPA call in vkCreateDevice
Save VkInstance in layer_data so that we query vkCreateDevice with a valid
instance.
Diffstat (limited to 'layers/threading.cpp')
| -rw-r--r-- | layers/threading.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/layers/threading.cpp b/layers/threading.cpp index c97722e8..2de00522 100644 --- a/layers/threading.cpp +++ b/layers/threading.cpp @@ -65,6 +65,7 @@ CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallba return result; layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); + my_data->instance = *pInstance; my_data->instance_dispatch_table = new VkLayerInstanceDispatchTable; layer_init_instance_dispatch_table(*pInstance, my_data->instance_dispatch_table, fpGetInstanceProcAddr); @@ -120,12 +121,13 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { + layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); assert(chain_info->u.pLayerInfo); PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; - PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(NULL, "vkCreateDevice"); + PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice"); if (fpCreateDevice == NULL) { return VK_ERROR_INITIALIZATION_FAILED; } @@ -138,7 +140,6 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDevice return result; } - layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); // Setup device dispatch table |
