Skip to content

Commit a0b4b49

Browse files
committed
Improve fix
1 parent d58684e commit a0b4b49

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

  • common/src/backend/java/dev/engine_room/flywheel/backend/gl

common/src/backend/java/dev/engine_room/flywheel/backend/gl/GlCompat.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ public final class GlCompat {
3939
public static final boolean ALLOW_DSA = true;
4040
public static final GlslVersion MAX_GLSL_VERSION = maxGlslVersion();
4141

42-
public static final String VENDOR = glGetString(GL20C.GL_VENDOR);
43-
public static final String RENDERER = glGetString(GL20C.GL_RENDERER);
44-
public static final String VERSION = glGetString(GL20C.GL_VERSION);
45-
public static final String EXTENSIONS = glGetString(GL20C.GL_EXTENSIONS);
46-
4742
public static final boolean SUPPORTS_DSA = ALLOW_DSA && isDsaSupported();
4843

4944
public static final boolean SUPPORTS_INSTANCING = isInstancingSupported();
@@ -108,18 +103,20 @@ private static Driver readVendorString() {
108103
return Driver.UNKNOWN;
109104
}
110105

111-
if (VENDOR == null) {
106+
String vendor = GL20C.glGetString(GL20C.GL_VENDOR);
107+
108+
if (vendor == null) {
112109
return Driver.UNKNOWN;
113110
}
114111

115112
// vendor string I got was "ATI Technologies Inc."
116-
if (VENDOR.contains("ATI") || VENDOR.contains("AMD")) {
113+
if (vendor.contains("ATI") || vendor.contains("AMD")) {
117114
return Driver.AMD;
118-
} else if (VENDOR.contains("NVIDIA")) {
115+
} else if (vendor.contains("NVIDIA")) {
119116
return Driver.NVIDIA;
120-
} else if (VENDOR.contains("Intel")) {
117+
} else if (vendor.contains("Intel")) {
121118
return Driver.INTEL;
122-
} else if (VENDOR.contains("Mesa")) {
119+
} else if (vendor.contains("Mesa")) {
123120
return Driver.MESA;
124121
}
125122

@@ -219,15 +216,11 @@ void main() {}
219216
return success;
220217
}
221218

222-
private static String glGetString(int name) {
223-
String s = GL20.glGetString(name);
224-
return s != null ? s : "";
225-
}
226-
227219
// Intel HD Graphics support* instancing and indirect rendering.
228220
// * However, in reality the support is horrible and doesn't actually work
229221
// so whenever we encounter these, we have to fall back to flywheel:off
230222
public static boolean isIntelHDGraphics() {
231-
return VENDOR.contains("Intel(R) HD Graphics");
223+
String vendor = GL20C.glGetString(GL20C.GL_VENDOR);
224+
return vendor != null && vendor.contains("Intel(R) HD Graphics");
232225
}
233226
}

0 commit comments

Comments
 (0)