Skip to content

Commit

Permalink
Fix crash when enumerating adapters without an OpenGL ICD
Browse files Browse the repository at this point in the history
Closes #2591
  • Loading branch information
jellysquid3 committed Aug 15, 2024
1 parent d616178 commit ae70bec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ private static void showCriticalErrorAndClose(String title, String message, Stri
for (var adapter : GraphicsAdapterProbe.getAdapters()) {
if (adapter instanceof D3DKMT.WDDMAdapterInfo wddmAdapterInfo) {
@Nullable var driverName = wddmAdapterInfo.getOpenGlIcdName();
var driverVersion = wddmAdapterInfo.openglIcdVersion();

if (driverName == null) {
continue;
}

var driverVersion = wddmAdapterInfo.openglIcdVersion();

// Intel OpenGL ICD for Generation 7 GPUs
if (driverName.matches("ig7icd(32|64)")) {
// https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ public record WDDMAdapterInfo(
@NotNull GraphicsAdapterVendor vendor,
@NotNull String name,
int adapterType,
String openglIcdFilePath,
WindowsFileVersion openglIcdVersion
@Nullable String openglIcdFilePath,
@Nullable WindowsFileVersion openglIcdVersion
) implements GraphicsAdapterInfo {
public String getOpenGlIcdName() {
return D3DKMT.getOpenGlIcdName(this.name);
public @Nullable String getOpenGlIcdName() {
return D3DKMT.getOpenGlIcdName(this.openglIcdFilePath);
}

@Override
Expand All @@ -206,6 +206,7 @@ public String toString() {
}
}

// Returns (null) if input is (null).
private static String getOpenGlIcdName(String path) {
return FilenameUtils.removeExtension(FilenameUtils.getName(path));
}
Expand Down

0 comments on commit ae70bec

Please sign in to comment.