SKCraft / Launcher

🚀 Distribute your Minecraft modpacks with a custom launcher
Other
624 stars 437 forks source link

CRIT skcraft runs only on integrated graphics (does not use gpu) #520

Open Envel-Nikita-Gutsenkov opened 1 year ago

Envel-Nikita-Gutsenkov commented 1 year ago

I haven't been able to figure out why skcraft doesn't use, say, rtx, but uses integrated intel graphics. There is no such problem in the official launcher. An unmodified version from the skcraft source code has been tested. Tested on various hardware.

hedgehog1029 commented 1 year ago

Do you mean the launcher itself, or the game?

In #86 it seems the solution is running the game with javaw; my guess is that this initializes the graphics context earlier and the GPU switching software picks up on it. I can put in a patch to try this. But it's probably difficult to do much else; switchable graphics isn't a standard and doesn't have any standardized APIs, to my knowledge.

Envel-Nikita-Gutsenkov commented 1 year ago

Do you mean the launcher itself, or the game?

In #86 it seems the solution is running the game with javaw; my guess is that this initializes the graphics context earlier and the GPU switching software picks up on it. I can put in a patch to try this. But it's probably difficult to do much else; switchable graphics isn't a standard and doesn't have any standardized APIs, to my knowledge.

I mean the game. Unfortunately, the problem is not in the java/javaw choice (I also tried java flags), and the code that is proposed in #86 is no longer available, so I can’t try it. The problem is observed only in skcraft :( I tested on different hardware and in no case did it run on the GPU

hedgehog1029 commented 1 year ago

I imagine the diff was changing the following line in JavaProcessBuilder to invoke javaw instead:

https://github.com/SKCraft/Launcher/blob/60030695b38d58dd7bdfcf3aa166d5dcb5f740e3/launcher/src/main/java/com/skcraft/launcher/launch/JavaProcessBuilder.java#L91

But yeah I can't confirm this is a solution. Can you also provide the following details for each affected system:

I have a laptop with switchable graphics myself (Linux, intel + nvidia) so I'll be able to do some Linux-specific debugging at least.

Envel-Nikita-Gutsenkov commented 1 year ago

I imagine the diff was changing the following line in JavaProcessBuilder to invoke javaw instead:

https://github.com/SKCraft/Launcher/blob/60030695b38d58dd7bdfcf3aa166d5dcb5f740e3/launcher/src/main/java/com/skcraft/launcher/launch/JavaProcessBuilder.java#L91

But yeah I can't confirm this is a solution. Can you also provide the following details for each affected system:

  • Operating system
  • Model of the Integrated GPU
  • Model of the Dedicated GPU

I have a laptop with switchable graphics myself (Linux, intel + nvidia) so I'll be able to do some Linux-specific debugging at least.

It was all so simple, but I didn’t realize it :D Thank you very much! The problem is solved by replacing it with File javaBinary = new File(getJavaBinPath(), "javaw");

Envel-Nikita-Gutsenkov commented 1 year ago

Although I think this should be fixed in this skcraft repository?

hedgehog1029 commented 1 year ago

Yeah I'll apply this change here.