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.
This commit is contained in:
Rémi Verschelde 2020-10-27 16:00:15 +01:00
parent 67f64ef4fe
commit 54e6338c9b
No known key found for this signature in database
GPG key ID: C3336907360768E1
6 changed files with 53 additions and 47 deletions

View file

@ -181,6 +181,14 @@ String Engine::get_license_text() const {
return String(GODOT_LICENSE_TEXT);
}
bool Engine::is_abort_on_gpu_errors_enabled() const {
return abort_on_gpu_errors;
}
bool Engine::is_validation_layers_enabled() const {
return use_validation_layers;
}
void Engine::add_singleton(const Singleton &p_singleton) {
singletons.push_back(p_singleton);
singleton_ptrs[p_singleton.name] = p_singleton.ptr;
@ -208,10 +216,6 @@ Engine *Engine::get_singleton() {
return singleton;
}
bool Engine::is_abort_on_gpu_errors_enabled() const {
return abort_on_gpu_errors;
}
Engine::Engine() {
singleton = this;
}

View file

@ -64,6 +64,7 @@ private:
uint64_t _physics_frames = 0;
float _physics_interpolation_fraction = 0.0f;
bool abort_on_gpu_errors = false;
bool use_validation_layers = false;
uint64_t _idle_frames = 0;
bool _in_physics = false;
@ -127,6 +128,7 @@ public:
String get_license_text() const;
bool is_abort_on_gpu_errors_enabled() const;
bool is_validation_layers_enabled() const;
Engine();
virtual ~Engine() {}