Merge pull request #94796 from kus04e4ek/backfall
Windows: Fall back to D3D12 if Vulkan is not supported and vice versa
This commit is contained in:
commit
9a8f18b9bf
|
@ -2765,6 +2765,14 @@
|
|||
<member name="rendering/rendering_device/driver.windows" type="String" setter="" getter="">
|
||||
Windows override for [member rendering/rendering_device/driver].
|
||||
</member>
|
||||
<member name="rendering/rendering_device/fallback_to_d3d12" type="bool" setter="" getter="" default="true">
|
||||
If [code]true[/code], the forward renderer will fall back to Direct3D 12 if Vulkan is not supported.
|
||||
[b]Note:[/b] This setting is implemented only on Windows.
|
||||
</member>
|
||||
<member name="rendering/rendering_device/fallback_to_vulkan" type="bool" setter="" getter="" default="true">
|
||||
If [code]true[/code], the forward renderer will fall back to Vulkan if Direct3D 12 is not supported.
|
||||
[b]Note:[/b] This setting is implemented only on Windows.
|
||||
</member>
|
||||
<member name="rendering/rendering_device/pipeline_cache/enable" type="bool" setter="" getter="" default="true">
|
||||
Enable the pipeline cache that is saved to disk if the graphics API supports it.
|
||||
[b]Note:[/b] This property is unable to control the pipeline caching the GPU driver itself does. Only turn this off along with deleting the contents of the driver's cache if you wish to simulate the experience a user will get when starting the game for the first time.
|
||||
|
|
|
@ -1956,6 +1956,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.android", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.ios", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.macos", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
|
||||
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_vulkan", true);
|
||||
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_d3d12", true);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -5947,12 +5947,39 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
|||
|
||||
if (rendering_context) {
|
||||
if (rendering_context->initialize() != OK) {
|
||||
bool failed = true;
|
||||
#if defined(VULKAN_ENABLED)
|
||||
bool fallback_to_vulkan = GLOBAL_GET("rendering/rendering_device/fallback_to_vulkan");
|
||||
if (failed && fallback_to_vulkan && rendering_driver != "vulkan") {
|
||||
memdelete(rendering_context);
|
||||
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
||||
if (rendering_context->initialize() == OK) {
|
||||
WARN_PRINT("Your video card drivers seem not to support Direct3D 12, switching to Vulkan.");
|
||||
rendering_driver = "vulkan";
|
||||
failed = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(D3D12_ENABLED)
|
||||
bool fallback_to_d3d12 = GLOBAL_GET("rendering/rendering_device/fallback_to_d3d12");
|
||||
if (failed && fallback_to_d3d12 && rendering_driver != "d3d12") {
|
||||
memdelete(rendering_context);
|
||||
rendering_context = memnew(RenderingContextDriverD3D12);
|
||||
if (rendering_context->initialize() == OK) {
|
||||
WARN_PRINT("Your video card drivers seem not to support Vulkan, switching to Direct3D 12.");
|
||||
rendering_driver = "d3d12";
|
||||
failed = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (failed) {
|
||||
memdelete(rendering_context);
|
||||
rendering_context = nullptr;
|
||||
r_error = ERR_UNAVAILABLE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Init context and rendering device
|
||||
#if defined(GLES3_ENABLED)
|
||||
|
|
Loading…
Reference in New Issue