我将 JavaFX 与 Java 8 结合使用,并在启动我的应用程序之前设置了此属性
System.setProperty("prism.forceGPU","true");
System.setProperty("prism.order","d3d,sw");
棱镜的详细模式给了我这个:
Prism pipeline init order: d3d sw
Using native-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Threshold to enable UI scaling factor: 1.5
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
Loading D3D native library ...
succeeded.
D3DPipelineManager: Created D3D9Ex device
Direct3D initialization succeeded
(X) Got class = class com.sun.prism.d3d.D3DPipeline
Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline
Maximum supported texture size: 8192
Maximum texture size clamped to 4096
OS Information:
Windows version 10.0 build 19044
D3D Driver Information:
Intel(R) HD Graphics 630
\\.\DISPLAY1
Driver igdumdim64.dll, version 25.20.100.6373
Pixel Shader version 3.0
Device : ven_8086, dev_591B, subsys_11C81462
Max Multisamples supported: 4
vsync: true vpipe: true
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_16
这表明支持硬件加速,但我完美安装和设置了 Nvidia GTX 1050m TI,而 JavaFX 似乎不想使用它,它始终使用 Intel(R) HD Graphics 630。
有没有办法强制使用 gpu?
回答:
经过数小时的研究,我通过简单地将 java.exe 默认 gpu 设置为 nvidia 的 gpu 来解决问题,它似乎可以工作,但无法通过应用程序代码完成。
最佳答案
对于那些试图解决类似问题的人,它可能来自 java.exe 可执行文件,没有使用您想要作为默认设备的 gpu,您可以在 Windows 的设置中更改它。
关于java - 如何使用 JavaFX 强制使用 gpu?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71365052/