-
-
Notifications
You must be signed in to change notification settings - Fork 22.7k
Disable creating RD projects in project manager if RD is not supported #91172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,14 @@ | |
#include "scene/resources/texture.h" | ||
#include "servers/display_server_headless.h" | ||
|
||
#if defined(VULKAN_ENABLED) | ||
#include "drivers/vulkan/rendering_context_driver_vulkan.h" | ||
#undef CursorShape | ||
#endif | ||
#if defined(D3D12_ENABLED) | ||
#include "drivers/d3d12/rendering_context_driver_d3d12.h" | ||
#endif | ||
|
||
DisplayServer *DisplayServer::singleton = nullptr; | ||
|
||
bool DisplayServer::hidpi_allowed = false; | ||
|
@@ -1211,6 +1219,40 @@ void DisplayServer::_input_set_custom_mouse_cursor_func(const Ref<Resource> &p_i | |
singleton->cursor_set_custom_image(p_image, (CursorShape)p_shape, p_hostspot); | ||
} | ||
|
||
bool DisplayServer::can_create_rendering_device() { | ||
#if defined(RD_ENABLED) | ||
Error err; | ||
RenderingContextDriver *rcd = nullptr; | ||
|
||
#if defined(VULKAN_ENABLED) | ||
rcd = memnew(RenderingContextDriverVulkan); | ||
#endif | ||
#ifdef D3D12_ENABLED | ||
if (rcd == nullptr) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non blocking as I'm not super-experienced with this kind of context driver swapping: could this cause issues with devices where Vulkan fails to initialize but D3D12 succeeds, if a device like that even exists? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, such devices exist if they have broken Vulkan layers that prevent Vulkan from initializing altogether. There's also Windows ARM devices without the Vulkan/OpenGL support pack installed. |
||
rcd = memnew(RenderingContextDriverD3D12); | ||
} | ||
#endif | ||
|
||
if (rcd != nullptr) { | ||
err = rcd->initialize(); | ||
if (err == OK) { | ||
RenderingDevice *rd = memnew(RenderingDevice); | ||
err = rd->initialize(rcd); | ||
memdelete(rd); | ||
rd = nullptr; | ||
if (err == OK) { | ||
return true; | ||
} | ||
} | ||
|
||
memdelete(rcd); | ||
rcd = nullptr; | ||
} | ||
|
||
#endif // RD_ENABLED | ||
return false; | ||
} | ||
|
||
DisplayServer::DisplayServer() { | ||
singleton = this; | ||
Input::set_mouse_mode_func = _input_set_mouse_mode; | ||
|
Uh oh!
There was an error while loading. Please reload this page.