[Windows] Improve video driver error messages.
This commit is contained in:
parent
3e0c10d393
commit
68ae413893
|
@ -5596,6 +5596,8 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BitField<DisplayServerWindows::DriverID> DisplayServerWindows::tested_drivers = 0;
|
||||||
|
|
||||||
// WinTab API.
|
// WinTab API.
|
||||||
bool DisplayServerWindows::wintab_available = false;
|
bool DisplayServerWindows::wintab_available = false;
|
||||||
WTOpenPtr DisplayServerWindows::wintab_WTOpen = nullptr;
|
WTOpenPtr DisplayServerWindows::wintab_WTOpen = nullptr;
|
||||||
|
@ -5758,6 +5760,8 @@ void DisplayServerWindows::tablet_set_current_driver(const String &p_driver) {
|
||||||
DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error) {
|
DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error) {
|
||||||
KeyMappingWindows::initialize();
|
KeyMappingWindows::initialize();
|
||||||
|
|
||||||
|
tested_drivers.clear();
|
||||||
|
|
||||||
drop_events = false;
|
drop_events = false;
|
||||||
key_event_pos = 0;
|
key_event_pos = 0;
|
||||||
|
|
||||||
|
@ -5926,7 +5930,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
wc.lpszClassName = L"Engine";
|
wc.lpszClassName = L"Engine";
|
||||||
|
|
||||||
if (!RegisterClassExW(&wc)) {
|
if (!RegisterClassExW(&wc)) {
|
||||||
MessageBoxW(nullptr, L"Failed To Register The Window Class.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
|
|
||||||
r_error = ERR_UNAVAILABLE;
|
r_error = ERR_UNAVAILABLE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5937,11 +5940,13 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
if (rendering_driver == "vulkan") {
|
if (rendering_driver == "vulkan") {
|
||||||
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_RD_VULKAN);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(D3D12_ENABLED)
|
#if defined(D3D12_ENABLED)
|
||||||
if (rendering_driver == "d3d12") {
|
if (rendering_driver == "d3d12") {
|
||||||
rendering_context = memnew(RenderingContextDriverD3D12);
|
rendering_context = memnew(RenderingContextDriverD3D12);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_RD_D3D12);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5953,6 +5958,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
if (failed && fallback_to_vulkan && rendering_driver != "vulkan") {
|
if (failed && fallback_to_vulkan && rendering_driver != "vulkan") {
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
rendering_context = memnew(RenderingContextDriverVulkanWindows);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_RD_VULKAN);
|
||||||
if (rendering_context->initialize() == OK) {
|
if (rendering_context->initialize() == OK) {
|
||||||
WARN_PRINT("Your video card drivers seem not to support Direct3D 12, switching to Vulkan.");
|
WARN_PRINT("Your video card drivers seem not to support Direct3D 12, switching to Vulkan.");
|
||||||
rendering_driver = "vulkan";
|
rendering_driver = "vulkan";
|
||||||
|
@ -5965,6 +5971,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
if (failed && fallback_to_d3d12 && rendering_driver != "d3d12") {
|
if (failed && fallback_to_d3d12 && rendering_driver != "d3d12") {
|
||||||
memdelete(rendering_context);
|
memdelete(rendering_context);
|
||||||
rendering_context = memnew(RenderingContextDriverD3D12);
|
rendering_context = memnew(RenderingContextDriverD3D12);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_RD_D3D12);
|
||||||
if (rendering_context->initialize() == OK) {
|
if (rendering_context->initialize() == OK) {
|
||||||
WARN_PRINT("Your video card drivers seem not to support Vulkan, switching to Direct3D 12.");
|
WARN_PRINT("Your video card drivers seem not to support Vulkan, switching to Direct3D 12.");
|
||||||
rendering_driver = "d3d12";
|
rendering_driver = "d3d12";
|
||||||
|
@ -6035,6 +6042,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force_angle || (gl_info["version"].operator int() < 30003)) {
|
if (force_angle || (gl_info["version"].operator int() < 30003)) {
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||||
if (show_warning) {
|
if (show_warning) {
|
||||||
WARN_PRINT("Your video card drivers seem not to support the required OpenGL 3.3 version, switching to ANGLE.");
|
WARN_PRINT("Your video card drivers seem not to support the required OpenGL 3.3 version, switching to ANGLE.");
|
||||||
}
|
}
|
||||||
|
@ -6044,6 +6052,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
|
|
||||||
if (rendering_driver == "opengl3") {
|
if (rendering_driver == "opengl3") {
|
||||||
gl_manager_native = memnew(GLManagerNative_Windows);
|
gl_manager_native = memnew(GLManagerNative_Windows);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_OPENGL3);
|
||||||
|
|
||||||
if (gl_manager_native->initialize() != OK) {
|
if (gl_manager_native->initialize() != OK) {
|
||||||
memdelete(gl_manager_native);
|
memdelete(gl_manager_native);
|
||||||
|
@ -6056,6 +6065,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
}
|
}
|
||||||
if (rendering_driver == "opengl3_angle") {
|
if (rendering_driver == "opengl3_angle") {
|
||||||
gl_manager_angle = memnew(GLManagerANGLE_Windows);
|
gl_manager_angle = memnew(GLManagerANGLE_Windows);
|
||||||
|
tested_drivers.set_flag(DRIVER_ID_COMPAT_ANGLE_D3D11);
|
||||||
|
|
||||||
if (gl_manager_angle->initialize() != OK) {
|
if (gl_manager_angle->initialize() != OK) {
|
||||||
memdelete(gl_manager_angle);
|
memdelete(gl_manager_angle);
|
||||||
|
@ -6178,32 +6188,41 @@ Vector<String> DisplayServerWindows::get_rendering_drivers_func() {
|
||||||
DisplayServer *DisplayServerWindows::create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error) {
|
DisplayServer *DisplayServerWindows::create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error) {
|
||||||
DisplayServer *ds = memnew(DisplayServerWindows(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, p_screen, p_context, r_error));
|
DisplayServer *ds = memnew(DisplayServerWindows(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, p_screen, p_context, r_error));
|
||||||
if (r_error != OK) {
|
if (r_error != OK) {
|
||||||
if (p_rendering_driver == "vulkan") {
|
if (tested_drivers == 0) {
|
||||||
|
OS::get_singleton()->alert("Failed to register the window class.", "Unable to initialize DisplayServer");
|
||||||
|
} else if (tested_drivers.has_flag(DRIVER_ID_RD_VULKAN) || tested_drivers.has_flag(DRIVER_ID_RD_D3D12)) {
|
||||||
|
Vector<String> drivers;
|
||||||
|
if (tested_drivers.has_flag(DRIVER_ID_RD_VULKAN)) {
|
||||||
|
drivers.push_back("Vulkan");
|
||||||
|
}
|
||||||
|
if (tested_drivers.has_flag(DRIVER_ID_RD_D3D12)) {
|
||||||
|
drivers.push_back("Direct3D 12");
|
||||||
|
}
|
||||||
String executable_name = OS::get_singleton()->get_executable_path().get_file();
|
String executable_name = OS::get_singleton()->get_executable_path().get_file();
|
||||||
OS::get_singleton()->alert(
|
OS::get_singleton()->alert(
|
||||||
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
|
vformat("Your video card drivers seem not to support the required %s version.\n\n"
|
||||||
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
|
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
|
||||||
"You can enable the OpenGL 3 driver by starting the engine from the\n"
|
"You can enable the OpenGL 3 driver by starting the engine from the\n"
|
||||||
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
|
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
|
||||||
"If you have recently updated your video card drivers, try rebooting.",
|
"If you have recently updated your video card drivers, try rebooting.",
|
||||||
|
String(" or ").join(drivers),
|
||||||
executable_name),
|
executable_name),
|
||||||
"Unable to initialize Vulkan video driver");
|
"Unable to initialize video driver");
|
||||||
} else if (p_rendering_driver == "d3d12") {
|
|
||||||
String executable_name = OS::get_singleton()->get_executable_path().get_file();
|
|
||||||
OS::get_singleton()->alert(
|
|
||||||
vformat("Your video card drivers seem not to support the required DirectX 12 version.\n\n"
|
|
||||||
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
|
|
||||||
"You can enable the OpenGL 3 driver by starting the engine from the\n"
|
|
||||||
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
|
|
||||||
"If you have recently updated your video card drivers, try rebooting.",
|
|
||||||
executable_name),
|
|
||||||
"Unable to initialize DirectX 12 video driver");
|
|
||||||
} else {
|
} else {
|
||||||
|
Vector<String> drivers;
|
||||||
|
if (tested_drivers.has_flag(DRIVER_ID_COMPAT_OPENGL3)) {
|
||||||
|
drivers.push_back("OpenGL 3.3");
|
||||||
|
}
|
||||||
|
if (tested_drivers.has_flag(DRIVER_ID_COMPAT_ANGLE_D3D11)) {
|
||||||
|
drivers.push_back("Direct3D 11");
|
||||||
|
}
|
||||||
OS::get_singleton()->alert(
|
OS::get_singleton()->alert(
|
||||||
"Your video card drivers seem not to support the required OpenGL 3.3 version.\n\n"
|
vformat(
|
||||||
"If possible, consider updating your video card drivers.\n\n"
|
"Your video card drivers seem not to support the required %s version.\n\n"
|
||||||
"If you have recently updated your video card drivers, try rebooting.",
|
"If possible, consider updating your video card drivers.\n\n"
|
||||||
"Unable to initialize OpenGL video driver");
|
"If you have recently updated your video card drivers, try rebooting.",
|
||||||
|
String(" or ").join(drivers)),
|
||||||
|
"Unable to initialize video driver");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ds;
|
return ds;
|
||||||
|
|
|
@ -388,6 +388,14 @@ class DisplayServerWindows : public DisplayServer {
|
||||||
String tablet_driver;
|
String tablet_driver;
|
||||||
Vector<String> tablet_drivers;
|
Vector<String> tablet_drivers;
|
||||||
|
|
||||||
|
enum DriverID {
|
||||||
|
DRIVER_ID_COMPAT_OPENGL3 = 1 << 0,
|
||||||
|
DRIVER_ID_COMPAT_ANGLE_D3D11 = 1 << 1,
|
||||||
|
DRIVER_ID_RD_VULKAN = 1 << 2,
|
||||||
|
DRIVER_ID_RD_D3D12 = 1 << 3,
|
||||||
|
};
|
||||||
|
static BitField<DriverID> tested_drivers;
|
||||||
|
|
||||||
enum TimerID {
|
enum TimerID {
|
||||||
TIMER_ID_MOVE_REDRAW = 1,
|
TIMER_ID_MOVE_REDRAW = 1,
|
||||||
TIMER_ID_WINDOW_ACTIVATION = 2,
|
TIMER_ID_WINDOW_ACTIVATION = 2,
|
||||||
|
|
Loading…
Reference in New Issue