Skip to content

Commit

Permalink
Fix detection for specific Intel OpenGL ICDs
Browse files Browse the repository at this point in the history
The OpenGL ICD name now includes the file extension,
which the regex expressions were not matching.
  • Loading branch information
jellysquid3 committed Dec 4, 2024
1 parent 3f5d853 commit 57e1ccb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package net.caffeinemc.mods.sodium.client.compatibility.workarounds;

import net.caffeinemc.mods.sodium.client.compatibility.environment.OsUtils;
import net.caffeinemc.mods.sodium.client.compatibility.environment.probe.GraphicsAdapterProbe;
import net.caffeinemc.mods.sodium.client.compatibility.workarounds.intel.IntelWorkarounds;
import net.caffeinemc.mods.sodium.client.compatibility.workarounds.nvidia.NvidiaWorkarounds;
import net.caffeinemc.mods.sodium.client.platform.windows.api.d3dkmt.D3DKMT;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -43,7 +41,7 @@ private static Set<Reference> findNecessaryWorkarounds() {
workarounds.add(Reference.NVIDIA_THREADED_OPTIMIZATIONS_BROKEN);
}

if (isUsingIntelGen8OrOlder()) {
if (IntelWorkarounds.isUsingIntelGen8OrOlder()) {
workarounds.add(Reference.INTEL_FRAMEBUFFER_BLIT_CRASH_WHEN_UNFOCUSED);
workarounds.add(Reference.INTEL_DEPTH_BUFFER_COMPARISON_UNRELIABLE);
}
Expand All @@ -65,25 +63,6 @@ private static Set<Reference> findNecessaryWorkarounds() {
return Collections.unmodifiableSet(workarounds);
}

private static boolean isUsingIntelGen8OrOlder() {
if (OsUtils.getOs() != OsUtils.OperatingSystem.WIN) {
return false;
}

for (var adapter : GraphicsAdapterProbe.getAdapters()) {
if (adapter instanceof D3DKMT.WDDMAdapterInfo wddmAdapterInfo) {
@Nullable var driverName = wddmAdapterInfo.getOpenGlIcdName();

// Intel OpenGL ICD for legacy GPUs
if (driverName != null && driverName.matches("ig(7|75|8)icd(32|64)")) {
return true;
}
}
}

return false;
}

public static boolean isWorkaroundEnabled(Reference id) {
return ACTIVE_WORKAROUNDS.get()
.contains(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class IntelWorkarounds {
var driverVersion = wddmAdapterInfo.openglIcdVersion();

// Intel OpenGL ICD for Generation 7 GPUs
if (driverName.matches("ig7icd(32|64)")) {
if (driverName.matches("ig7icd(32|64).dll")) {
// https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html
// Anything which matches the 15.33 driver scheme (WDDM x.y.10.w) should be checked
// Drivers before build 5161 are assumed to have bugs with synchronization primitives
Expand All @@ -37,4 +37,23 @@ public class IntelWorkarounds {

return null;
}

public static boolean isUsingIntelGen8OrOlder() {
if (OsUtils.getOs() != OsUtils.OperatingSystem.WIN) {
return false;
}

for (var adapter : GraphicsAdapterProbe.getAdapters()) {
if (adapter instanceof D3DKMT.WDDMAdapterInfo wddmAdapterInfo) {
@Nullable var driverName = wddmAdapterInfo.getOpenGlIcdName();

// Intel OpenGL ICD for legacy GPUs
if (driverName != null && driverName.matches("ig(7|75|8)icd(32|64)\\.dll")) {
return true;
}
}
}

return false;
}
}

0 comments on commit 57e1ccb

Please sign in to comment.