From 4b3eae7d46122b9598d134483887a9583eff26e0 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Wed, 16 Sep 2015 12:57:55 -0600 Subject: [PATCH] shader_checker: Do not hold lock across API call. --- layers/shader_checker.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/layers/shader_checker.cpp b/layers/shader_checker.cpp index 678b5671..e0f36938 100644 --- a/layers/shader_checker.cpp +++ b/layers/shader_checker.cpp @@ -521,11 +521,13 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateShaderModule( const VkShaderModuleCreateInfo *pCreateInfo, VkShaderModule *pShaderModule) { - loader_platform_thread_lock_mutex(&globalLock); VkResult res = get_dispatch_table(shader_checker_device_table_map, device)->CreateShaderModule(device, pCreateInfo, pShaderModule); - shader_module_map[pShaderModule->handle] = new shader_module(device, pCreateInfo); - loader_platform_thread_unlock_mutex(&globalLock); + if (res == VK_SUCCESS) { + loader_platform_thread_lock_mutex(&globalLock); + shader_module_map[pShaderModule->handle] = new shader_module(device, pCreateInfo); + loader_platform_thread_unlock_mutex(&globalLock); + } return res; } @@ -534,9 +536,9 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateShader( const VkShaderCreateInfo *pCreateInfo, VkShader *pShader) { - loader_platform_thread_lock_mutex(&globalLock); VkResult res = get_dispatch_table(shader_checker_device_table_map, device)->CreateShader(device, pCreateInfo, pShader); + loader_platform_thread_lock_mutex(&globalLock); shader_object_map[pShader->handle] = new shader_object(pCreateInfo); loader_platform_thread_unlock_mutex(&globalLock); return res; @@ -547,9 +549,9 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass( const VkRenderPassCreateInfo *pCreateInfo, VkRenderPass *pRenderPass) { - loader_platform_thread_lock_mutex(&globalLock); VkResult res = get_dispatch_table(shader_checker_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pRenderPass); + loader_platform_thread_lock_mutex(&globalLock); render_pass_map[pRenderPass->handle] = new render_pass(pCreateInfo); loader_platform_thread_unlock_mutex(&globalLock); return res; -- 2.34.1