mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-25 02:43:29 +00:00 
			
		
		
		
	Wayland: report when video drivers can't be loaded or found
This brings it to parity with the X11 backend.
This commit is contained in:
		
							parent
							
								
									c01f9361b1
								
							
						
					
					
						commit
						33e414cf75
					
				
					 1 changed files with 51 additions and 8 deletions
				
			
		|  | @ -1349,23 +1349,39 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win | ||||||
| 
 | 
 | ||||||
| 	rendering_driver = p_rendering_driver; | 	rendering_driver = p_rendering_driver; | ||||||
| 
 | 
 | ||||||
|  | 	bool driver_found = false; | ||||||
|  | 	String executable_name = OS::get_singleton()->get_executable_path().get_file(); | ||||||
|  | 
 | ||||||
| #ifdef RD_ENABLED | #ifdef RD_ENABLED | ||||||
| #ifdef VULKAN_ENABLED | #ifdef VULKAN_ENABLED | ||||||
| 	if (rendering_driver == "vulkan") { | 	if (rendering_driver == "vulkan") { | ||||||
| 		rendering_context = memnew(RenderingContextDriverVulkanWayland); | 		rendering_context = memnew(RenderingContextDriverVulkanWayland); | ||||||
| 	} | 	} | ||||||
| #endif | #endif // VULKAN_ENABLED
 | ||||||
| 
 | 
 | ||||||
| 	if (rendering_context) { | 	if (rendering_context) { | ||||||
| 		if (rendering_context->initialize() != OK) { | 		if (rendering_context->initialize() != OK) { | ||||||
| 			ERR_PRINT(vformat("Could not initialize %s", rendering_driver)); |  | ||||||
| 			memdelete(rendering_context); | 			memdelete(rendering_context); | ||||||
| 			rendering_context = nullptr; | 			rendering_context = nullptr; | ||||||
| 			r_error = ERR_CANT_CREATE; | 			r_error = ERR_CANT_CREATE; | ||||||
| 			return; | 
 | ||||||
|  | 			if (p_rendering_driver == "vulkan") { | ||||||
|  | 				OS::get_singleton()->alert( | ||||||
|  | 						vformat("Your video card drivers seem not to support the required Vulkan 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 recently updated your video card drivers, try rebooting.", | ||||||
|  | 								executable_name), | ||||||
|  | 						"Unable to initialize Vulkan video driver"); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver)); | ||||||
| 		} | 		} | ||||||
|  | 
 | ||||||
|  | 		driver_found = true; | ||||||
| 	} | 	} | ||||||
| #endif | #endif // RD_ENABLED
 | ||||||
| 
 | 
 | ||||||
| #ifdef GLES3_ENABLED | #ifdef GLES3_ENABLED | ||||||
| 	if (rendering_driver == "opengl3" || rendering_driver == "opengl3_es") { | 	if (rendering_driver == "opengl3" || rendering_driver == "opengl3_es") { | ||||||
|  | @ -1431,26 +1447,53 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win | ||||||
| 					rendering_driver = "opengl3_es"; | 					rendering_driver = "opengl3_es"; | ||||||
| 				} else { | 				} else { | ||||||
| 					r_error = ERR_UNAVAILABLE; | 					r_error = ERR_UNAVAILABLE; | ||||||
|  | 
 | ||||||
|  | 					OS::get_singleton()->alert( | ||||||
|  | 							vformat("Your video card drivers seem not to support the required OpenGL 3.3 version.\n\n" | ||||||
|  | 									"If possible, consider updating your video card drivers or using the Vulkan driver.\n\n" | ||||||
|  | 									"You can enable the Vulkan driver by starting the engine from the\n" | ||||||
|  | 									"command line with the command:\n\n    \"%s\" --rendering-driver vulkan\n\n" | ||||||
|  | 									"If you recently updated your video card drivers, try rebooting.", | ||||||
|  | 									executable_name), | ||||||
|  | 							"Unable to initialize OpenGL video driver"); | ||||||
|  | 
 | ||||||
| 					ERR_FAIL_MSG("Could not initialize OpenGL."); | 					ERR_FAIL_MSG("Could not initialize OpenGL."); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				RasterizerGLES3::make_current(true); | 				RasterizerGLES3::make_current(true); | ||||||
|  | 				driver_found = true; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (rendering_driver == "opengl3_es") { | 		if (rendering_driver == "opengl3_es") { | ||||||
| 			egl_manager = memnew(EGLManagerWaylandGLES); | 			egl_manager = memnew(EGLManagerWaylandGLES); | ||||||
| 
 | 
 | ||||||
| 			if (egl_manager->initialize(wayland_thread.get_wl_display()) != OK) { | 			if (egl_manager->initialize(wayland_thread.get_wl_display()) != OK || egl_manager->open_display(wayland_thread.get_wl_display()) != OK) { | ||||||
| 				memdelete(egl_manager); | 				memdelete(egl_manager); | ||||||
| 				egl_manager = nullptr; | 				egl_manager = nullptr; | ||||||
| 				r_error = ERR_CANT_CREATE; | 				r_error = ERR_CANT_CREATE; | ||||||
| 				ERR_FAIL_MSG("Could not initialize GLES3."); | 
 | ||||||
|  | 				OS::get_singleton()->alert( | ||||||
|  | 						vformat("Your video card drivers seem not to support the required OpenGL ES 3.0 version.\n\n" | ||||||
|  | 								"If possible, consider updating your video card drivers or using the Vulkan driver.\n\n" | ||||||
|  | 								"You can enable the Vulkan driver by starting the engine from the\n" | ||||||
|  | 								"command line with the command:\n\n    \"%s\" --rendering-driver vulkan\n\n" | ||||||
|  | 								"If you recently updated your video card drivers, try rebooting.", | ||||||
|  | 								executable_name), | ||||||
|  | 						"Unable to initialize OpenGL ES video driver"); | ||||||
|  | 
 | ||||||
|  | 				ERR_FAIL_MSG("Could not initialize OpenGL ES."); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			RasterizerGLES3::make_current(false); | 			RasterizerGLES3::make_current(false); | ||||||
|  | 			driver_found = true; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	if (!driver_found) { | ||||||
|  | 		r_error = ERR_UNAVAILABLE; | ||||||
|  | 		ERR_FAIL_MSG("Video driver not found."); | ||||||
|  | 	} | ||||||
| #endif // GLES3_ENABLED
 | #endif // GLES3_ENABLED
 | ||||||
| 
 | 
 | ||||||
| 	cursor_set_shape(CURSOR_BUSY); | 	cursor_set_shape(CURSOR_BUSY); | ||||||
|  | @ -1481,12 +1524,12 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win | ||||||
| 
 | 
 | ||||||
| 		RendererCompositorRD::make_current(); | 		RendererCompositorRD::make_current(); | ||||||
| 	} | 	} | ||||||
| #endif | #endif // RD_ENABLED
 | ||||||
| 
 | 
 | ||||||
| #ifdef DBUS_ENABLED | #ifdef DBUS_ENABLED | ||||||
| 	portal_desktop = memnew(FreeDesktopPortalDesktop); | 	portal_desktop = memnew(FreeDesktopPortalDesktop); | ||||||
| 	screensaver = memnew(FreeDesktopScreenSaver); | 	screensaver = memnew(FreeDesktopScreenSaver); | ||||||
| #endif | #endif // DBUS_ENABLED
 | ||||||
| 
 | 
 | ||||||
| 	screen_set_keep_on(GLOBAL_GET("display/window/energy_saving/keep_screen_on")); | 	screen_set_keep_on(GLOBAL_GET("display/window/energy_saving/keep_screen_on")); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Riteo
						Riteo