diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp index a1570e6b9..4937044f1 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp @@ -39,6 +39,8 @@ // Also we assume correctness from the application, that all objects are destroyed before the device and // instance are destroyed. We only clean up after our own objects. +//#define FORCE_VALIDATION_LAYERS + void WrappedVulkan::Initialise(VkInitParams ¶ms) { m_InitParams = params; @@ -58,14 +60,24 @@ void WrappedVulkan::Initialise(VkInitParams ¶ms) } } +#if defined(FORCE_VALIDATION_LAYERS) + params.Layers.push_back("Threading"); + params.Layers.push_back("MemTracker"); + params.Layers.push_back("ObjectTracker"); + params.Layers.push_back("DrawState"); + params.Layers.push_back("ParamChecker"); + params.Layers.push_back("ShaderChecker"); + params.Layers.push_back("Swapchain"); + params.Layers.push_back("DeviceLimits"); + params.Layers.push_back("Image"); + + params.Extensions.push_back("DEBUG_REPORT"); +#endif + const char **layerscstr = new const char *[params.Layers.size()]; for(size_t i=0; i < params.Layers.size(); i++) layerscstr[i] = params.Layers[i].c_str(); -#if defined(FORCE_VALIDATION_LAYER) - params.Extensions.push_back("DEBUG_REPORT"); -#endif - const char **extscstr = new const char *[params.Extensions.size()]; for(size_t i=0; i < params.Extensions.size(); i++) extscstr[i] = params.Extensions[i].c_str(); @@ -103,7 +115,7 @@ void WrappedVulkan::Initialise(VkInitParams ¶ms) { ObjDisp(m_Instance)->DbgCreateMsgCallback(Unwrap(m_Instance), VK_DBG_REPORT_WARN_BIT|VK_DBG_REPORT_PERF_WARN_BIT|VK_DBG_REPORT_ERROR_BIT, - (PFN_vkDbgMsgCallback)&DebugCallbackStatic, this, &m_DbgMsgCallback); + &DebugCallbackStatic, this, &m_DbgMsgCallback); } SAFE_DELETE_ARRAY(layerscstr); @@ -399,6 +411,26 @@ bool WrappedVulkan::Serialise_vkCreateDevice( createInfo.layerCount--; } } + +#if defined(FORCE_VALIDATION_LAYERS) + vector layers; + + for(uint32_t i=0; i < createInfo.layerCount; i++) + layers.push_back(createInfo.ppEnabledLayerNames[i]); + + layers.push_back("Threading"); + layers.push_back("MemTracker"); + layers.push_back("ObjectTracker"); + layers.push_back("DrawState"); + layers.push_back("ParamChecker"); + layers.push_back("ShaderChecker"); + layers.push_back("Swapchain"); + layers.push_back("DeviceLimits"); + layers.push_back("Image"); + + createInfo.layerCount = (uint32_t)layers.size(); + createInfo.ppEnabledLayerNames = &layers[0]; +#endif physicalDevice = GetResourceManager()->GetLiveHandle(physId);