Skip to content

Commit 554e573

Browse files
authored
[release/3.6] 支持通过环境变量强制使用 GPU 渲染和控制动画帧率 (#4426)
#4164
1 parent 3096f93 commit 554e573

File tree

1 file changed

+15
-0
lines changed
  • HMCL/src/main/java/org/jackhuang/hmcl

1 file changed

+15
-0
lines changed

HMCL/src/main/java/org/jackhuang/hmcl/Main.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ public static void main(String[] args) {
6262
createHMCLDirectories();
6363
LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs"));
6464

65+
if ("true".equalsIgnoreCase(System.getenv("HMCL_FORCE_GPU")))
66+
System.getProperties().putIfAbsent("prism.forceGPU", "true");
67+
68+
String animationFrameRate = System.getenv("HMCL_ANIMATION_FRAME_RATE");
69+
if (animationFrameRate != null) {
70+
try {
71+
if (Integer.parseInt(animationFrameRate) <= 0)
72+
throw new NumberFormatException(animationFrameRate);
73+
74+
System.getProperties().putIfAbsent("javafx.animation.pulse", animationFrameRate);
75+
} catch (NumberFormatException e) {
76+
LOG.warning("Invalid animation frame rate: " + animationFrameRate);
77+
}
78+
}
79+
6580
checkDirectoryPath();
6681

6782
if (JavaRuntime.CURRENT_VERSION < 9)

0 commit comments

Comments
 (0)