-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use alternative workaround for NVIDIA drivers
The NVIDIA driver enables a driver feature called "Threaded Optimizations" when it finds Minecraft, which causes severe performance issues and sometimes even crashes. Newer versions of the driver seem to use a slightly different heuristic which our workaround doesn't address. So, instead, use an alternative method that enables GL_DEBUG_OUTPUT_SYNCHRONOUS. This seems to reliably disable the functionality *even if* the user has configured it otherwise in their driver settings. Additionally, on Windows, we now always indicate to the driver that Minecraft is running, so that users with hybrid graphics don't see regressed performance.
- Loading branch information
1 parent
990cf64
commit cb9d728
Showing
15 changed files
with
323 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
common/src/main/java/net/caffeinemc/mods/sodium/client/gl/GlContextInfo.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ounds/java/net/caffeinemc/mods/sodium/client/compatibility/environment/GlContextInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package net.caffeinemc.mods.sodium.client.compatibility.environment; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
import org.lwjgl.opengl.GL11C; | ||
|
||
import java.util.Objects; | ||
|
||
public record GlContextInfo(String vendor, String renderer, String version) { | ||
public static GlContextInfo create() { | ||
String vendor = Objects.requireNonNull(GL11C.glGetString(GL11C.GL_VENDOR), | ||
"GL_VENDOR is NULL"); | ||
String renderer = Objects.requireNonNull(GL11C.glGetString(GL11C.GL_RENDERER), | ||
"GL_RENDERER is NULL"); | ||
String version = Objects.requireNonNull(GL11C.glGetString(GL11C.GL_VERSION), | ||
"GL_VERSION is NULL"); | ||
|
||
return new GlContextInfo(vendor, renderer, version); | ||
} | ||
} |
27 changes: 19 additions & 8 deletions
27
...workarounds/java/net/caffeinemc/mods/sodium/client/compatibility/environment/OsUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
cb9d728
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really sad that NVIDIA is trying their hardest to break Sodium's workarounds :/ hopefully, they cut it out eventually
Does this GL_DEBUG_OUTPUT_SYNCHRONOUS have any negative performance implications?
What does NVIDIA even have to gain by repeatedly targeting Sodium's workarounds for this and making it impossible for Sodium to disable this behavior in any official manner? Do they WANT their drivers to be associated with instability and bad performance?
Sorry if this comment brings a harmful tone, I am genuinely curious 👍 ❤