]> git.tdb.fi Git - libs/gl.git/commitdiff
Make it possible to disable Vulkan validation
authorMikko Rasa <tdb@tdb.fi>
Sun, 13 Mar 2022 08:02:06 +0000 (10:02 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 13 Mar 2022 08:02:06 +0000 (10:02 +0200)
This can be useful when profiling an optimized debug build.

source/backends/vulkan/device_backend.cpp

index efdd596cdc873a1e3bcb02acb0263fe35e11de0e..3be29c63c9524b04be53aedff3fe808222f4b334 100644 (file)
@@ -1,8 +1,11 @@
+#include <cstdlib>
 #include <msp/graphics/vulkancontext_platform.h>
 #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<bool>(string(disable_ptr));
+       else
+               opts.enable_validation = true;
        opts.enable_debug_report = true;
 #endif
        return opts;