支持通过环境变量强制使用 GPU 渲染和控制动画帧率 (#4164)

This commit is contained in:
Glavo 2025-07-31 19:39:45 +08:00 committed by GitHub
parent 7f51e0395c
commit 9298fe48e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,6 +47,21 @@ public final class EntryPoint {
createHMCLDirectories();
LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs"));
if ("true".equalsIgnoreCase(System.getenv("HMCL_FORCE_GPU")))
System.getProperties().putIfAbsent("prism.forceGPU", "true");
String animationFrameRate = System.getenv("HMCL_ANIMATION_FRAME_RATE");
if (animationFrameRate != null) {
try {
if (Integer.parseInt(animationFrameRate) <= 0)
throw new NumberFormatException(animationFrameRate);
System.getProperties().putIfAbsent("javafx.animation.pulse", animationFrameRate);
} catch (NumberFormatException e) {
LOG.warning("Invalid animation frame rate: " + animationFrameRate);
}
}
checkDirectoryPath();
if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS)