소스 검색

Merge pull request #23463 from hpvb/use-dri-prime-default

Set DRI_PRIME=1 by default on X11 if not already set
Rémi Verschelde 6 년 전
부모
커밋
e7cb47e686
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      platform/x11/os_x11.cpp

+ 4 - 0
platform/x11/os_x11.cpp

@@ -267,6 +267,10 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
 
 
 // maybe contextgl wants to be in charge of creating the window
 // maybe contextgl wants to be in charge of creating the window
 #if defined(OPENGL_ENABLED)
 #if defined(OPENGL_ENABLED)
+	// Set DRI_PRIME if not set. This means that Godot should default to a higher-power GPU if it exists.
+	// Note: Due to the final '0' parameter to setenv any existing DRI_PRIME environment variables will not
+	// be overwritten.
+	setenv("DRI_PRIME", "1", 0);
 
 
 	ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
 	ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;