mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 07:31:16 +00:00 
			
		
		
		
	Merge pull request #94943 from bruvzg/arm64_gl_switch
[Windows] Improve OpenGL/ANGLE switching on ARM64.
This commit is contained in:
		
						commit
						3e0c10d393
					
				
					 1 changed files with 28 additions and 8 deletions
				
			
		| 
						 | 
					@ -5984,13 +5984,32 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
 | 
				
			||||||
// Init context and rendering device
 | 
					// Init context and rendering device
 | 
				
			||||||
#if defined(GLES3_ENABLED)
 | 
					#if defined(GLES3_ENABLED)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
 | 
					 | 
				
			||||||
	// There's no native OpenGL drivers on Windows for ARM, switch to ANGLE over DX.
 | 
					 | 
				
			||||||
	if (rendering_driver == "opengl3") {
 | 
					 | 
				
			||||||
		rendering_driver = "opengl3_angle";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
#elif defined(EGL_STATIC)
 | 
					 | 
				
			||||||
	bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_angle");
 | 
						bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_angle");
 | 
				
			||||||
 | 
						bool show_warning = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (rendering_driver == "opengl3") {
 | 
				
			||||||
 | 
							// There's no native OpenGL drivers on Windows for ARM, always enable fallback.
 | 
				
			||||||
 | 
					#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
 | 
				
			||||||
 | 
							fallback = true;
 | 
				
			||||||
 | 
							show_warning = false;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							typedef BOOL(WINAPI * IsWow64Process2Ptr)(HANDLE, USHORT *, USHORT *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							IsWow64Process2Ptr IsWow64Process2 = (IsWow64Process2Ptr)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process2");
 | 
				
			||||||
 | 
							if (IsWow64Process2) {
 | 
				
			||||||
 | 
								USHORT process_arch = 0;
 | 
				
			||||||
 | 
								USHORT machine_arch = 0;
 | 
				
			||||||
 | 
								if (!IsWow64Process2(GetCurrentProcess(), &process_arch, &machine_arch)) {
 | 
				
			||||||
 | 
									machine_arch = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								if (machine_arch == 0xAA64) {
 | 
				
			||||||
 | 
									fallback = true;
 | 
				
			||||||
 | 
									show_warning = false;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fallback && (rendering_driver == "opengl3")) {
 | 
						if (fallback && (rendering_driver == "opengl3")) {
 | 
				
			||||||
		Dictionary gl_info = detect_wgl();
 | 
							Dictionary gl_info = detect_wgl();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6016,11 +6035,12 @@ 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)) {
 | 
				
			||||||
 | 
								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.");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			rendering_driver = "opengl3_angle";
 | 
								rendering_driver = "opengl3_angle";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (rendering_driver == "opengl3") {
 | 
						if (rendering_driver == "opengl3") {
 | 
				
			||||||
		gl_manager_native = memnew(GLManagerNative_Windows);
 | 
							gl_manager_native = memnew(GLManagerNative_Windows);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue