From dd503e748c430d26b6adda57b59f04177e4105fa Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 13 Mar 2022 10:02:06 +0200 Subject: [PATCH] Make it possible to disable Vulkan validation This can be useful when profiling an optimized debug build. --- source/backends/vulkan/device_backend.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/backends/vulkan/device_backend.cpp b/source/backends/vulkan/device_backend.cpp index efdd596c..3be29c63 100644 --- a/source/backends/vulkan/device_backend.cpp +++ b/source/backends/vulkan/device_backend.cpp @@ -1,8 +1,11 @@ +#include #include #include "device.h" #include "device_backend.h" #include "vulkan.h" +using namespace std; + namespace Msp { namespace GL { @@ -27,7 +30,11 @@ Graphics::VulkanOptions VulkanDevice::create_default_options() Graphics::VulkanOptions opts; opts.enable_geometry_shader = true; #ifdef DEBUG - opts.enable_validation = true; + const char *disable_ptr = getenv("MSPGL_DISABLE_VALIDATION"); + if(disable_ptr && *disable_ptr) + opts.enable_validation = !lexical_cast(string(disable_ptr)); + else + opts.enable_validation = true; opts.enable_debug_report = true; #endif return opts; -- 2.43.0