diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-10-27 16:00:15 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-10-27 16:19:15 +0100 |
commit | 54e6338c9bf87719908b173ab9023c7b56a9df6a (patch) | |
tree | 864ab04fafc99f1548dc562acb715256055a2b7b /main | |
parent | 67f64ef4fe61d0c9c8f46804448fcf1196cae525 (diff) |
Vulkan: Make validation layers optional
They're now disabled by default, and can be enabled with the command line
argument `--vk-layers`.
When enabled, the errors about them being missing are now warnings, as
users were confused and thought this meant Vulkan is broken for them.
Fix crash in `~VulkanContext` when validation layers are disabled (exposed by
this PR since before they could not be disabled without source modification).
Also moved VulkanContext member initializations to header.
Fixes #37102.
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp index 5ebd0138d3..a0a993ec64 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -334,7 +334,10 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n"); OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n"); OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n"); +#if DEBUG_ENABLED + OS::get_singleton()->print(" --vk-layers Enable Vulkan Validation layers for debugging.\n"); OS::get_singleton()->print(" --gpu-abort Abort on GPU errors (usually validation layer errors), may help see the problem if your system freezes.\n"); +#endif OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n"); #if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED) OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n"); @@ -695,9 +698,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window init_windowed = true; - } else if (I->get() == "--gpu-abort") { // force windowed window - +#ifdef DEBUG_ENABLED + } else if (I->get() == "--vk-layers") { + Engine::singleton->use_validation_layers = true; + } else if (I->get() == "--gpu-abort") { Engine::singleton->abort_on_gpu_errors = true; +#endif } else if (I->get() == "--tablet-driver") { if (I->next()) { tablet_driver = I->next()->get(); |