Move graphics initialization code around in method
This commit is contained in:
parent
f5af9b34a0
commit
24e26e6a82
1 changed files with 16 additions and 15 deletions
|
@ -217,24 +217,25 @@ public final class GraphicsSubsystem implements SubsystemMainClass {
|
||||||
} else
|
} else
|
||||||
logger.diag(apiName + " is incompatible with this system");
|
logger.diag(apiName + " is incompatible with this system");
|
||||||
|
|
||||||
logger.diag("Compatible is/are " + ListFormatter.formatList(compatibleApis));
|
if (compatibleApis.isEmpty()) {
|
||||||
|
|
||||||
// Choose last item in list.
|
|
||||||
if (!compatibleApis.isEmpty()) {
|
|
||||||
api = registeredApis.get(compatibleApis.getLast());
|
|
||||||
try {
|
|
||||||
logger.diag("Initializing Graphics API");
|
|
||||||
logger.diag("Initialized Graphics API in " + Miscellaneous.measureExecutionTime(() -> api.initializeApi()) + "ms");
|
|
||||||
} catch (Throwable throwable) {
|
|
||||||
logger.crash("Graphics API failed to initialize", throwable, true);
|
|
||||||
throw throwable;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
logger.error("No compatible Graphics API was found");
|
logger.error("No compatible Graphics API was found");
|
||||||
return false;
|
return false;
|
||||||
|
} else if (compatibleApis.size() == 1)
|
||||||
|
logger.diag("Compatible is " + compatibleApis.getFirst());
|
||||||
|
else
|
||||||
|
logger.diag("Compatible are " + ListFormatter.formatList(compatibleApis));
|
||||||
|
|
||||||
|
// Choose last item in list.
|
||||||
|
api = registeredApis.get(compatibleApis.getLast());
|
||||||
|
try {
|
||||||
|
logger.diag("Initializing Graphics API");
|
||||||
|
logger.diag("Initialized Graphics API in " + Miscellaneous.measureExecutionTime(() -> api.initializeApi()) + "ms");
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
logger.crash("Graphics API failed to initialize", throwable, true);
|
||||||
|
throw throwable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue