mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (Retrace): load ANGLE through LD_LIBRARY_PATH
This commit is contained in:
+2
-4
@@ -35,10 +35,8 @@ namespace MobileGL::MG_Config {
|
||||
struct FeaturesTable {
|
||||
// MOBILEGL_DISABLE_TIMERQUERY: do not advertise or use GPU timer queries.
|
||||
Bool DisableTimerQuery = false;
|
||||
// MOBILEGL_RETRACE_USE_ANGLE: load ANGLE EGL/GLES libraries for retrace runs.
|
||||
Bool RetraceUseAngle = false;
|
||||
// MOBILEGL_RETRACE_ANGLE_DIR: directory searched first for the ANGLE libraries.
|
||||
String RetraceAngleDir;
|
||||
// MOBILEGL_USE_ANGLE: load ANGLE EGL/GLES libraries.
|
||||
Bool UseAngle = false;
|
||||
// MOBILEGL_DISABLE_SUBGROUP: force-disable Vulkan shader subgroup support.
|
||||
Bool DisableSubgroup = false;
|
||||
// MOBILEGL_MAGMA_R11G11B10F_FALLBACK: use fallback format for R11G11B10F on Vulkan.
|
||||
|
||||
@@ -110,8 +110,7 @@ namespace MobileGL::MG_ConfigLoader {
|
||||
inline void InitFeatures() {
|
||||
auto& features = MG_Config::Features;
|
||||
features.DisableTimerQuery = QueryEnvFlag("MOBILEGL_DISABLE_TIMERQUERY");
|
||||
features.RetraceUseAngle = QueryEnvFlag("MOBILEGL_RETRACE_USE_ANGLE");
|
||||
QueryEnvVariable("MOBILEGL_RETRACE_ANGLE_DIR", features.RetraceAngleDir, "");
|
||||
features.UseAngle = QueryEnvFlag("MOBILEGL_USE_ANGLE");
|
||||
features.DisableSubgroup = QueryEnvFlag("MOBILEGL_DISABLE_SUBGROUP");
|
||||
features.MagmaR11G11B10FFallback = QueryEnvFlag("MOBILEGL_MAGMA_R11G11B10F_FALLBACK");
|
||||
features.MagmaFramesInFlight = QueryEnvUint32("MOBILEGL_MAGMA_FRAMESINFLIGHT", 3, 1, 64);
|
||||
|
||||
@@ -14,21 +14,8 @@
|
||||
#endif
|
||||
|
||||
namespace MobileGL::MG_Util::BackendLoader {
|
||||
static Bool UseRetraceAngle() {
|
||||
return MG_Config::Features.RetraceUseAngle;
|
||||
}
|
||||
|
||||
static Vector<String> AngleLibNames(const char* name) {
|
||||
const String& angleDir = MG_Config::Features.RetraceAngleDir;
|
||||
if (!angleDir.empty()) {
|
||||
String path = angleDir;
|
||||
if (path.back() != '/') {
|
||||
path += "/";
|
||||
}
|
||||
path += name;
|
||||
return {path, name};
|
||||
}
|
||||
return {name};
|
||||
static Bool UseAngle() {
|
||||
return MG_Config::Features.UseAngle;
|
||||
}
|
||||
|
||||
static void* OpenLib(const Vector<String>& names) {
|
||||
@@ -40,7 +27,7 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
"/opt/vc/lib/", "/usr/local/lib/", "/usr/lib/", "/usr/lib/x86_64-linux-gnu/",
|
||||
"/usr/lib64/", "/lib64/",
|
||||
#endif
|
||||
"" // We should put this to the end of the list to avoid breaking `LD_LIBRARY_PATH` usage
|
||||
"" // Keep this last so the dynamic loader can use LD_LIBRARY_PATH.
|
||||
};
|
||||
|
||||
void* lib = nullptr;
|
||||
@@ -473,13 +460,13 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
|
||||
void AcquireEGLFunctions(MG_External::EGLFunctionsTable& funcs) {
|
||||
void* eglLib = nullptr;
|
||||
if (UseRetraceAngle()) {
|
||||
void* glesLib = OpenLib(AngleLibNames("libGLESv2_angle.so"));
|
||||
if (UseAngle()) {
|
||||
void* glesLib = OpenLib({"libGLESv2_angle.so"});
|
||||
if (!glesLib) {
|
||||
MGLOG_E("Failed to open ANGLE libGLESv2_angle.so");
|
||||
return;
|
||||
}
|
||||
eglLib = OpenLib(AngleLibNames("libEGL_angle.so"));
|
||||
eglLib = OpenLib({"libEGL_angle.so"});
|
||||
if (!eglLib) {
|
||||
MGLOG_E("Failed to open ANGLE libEGL_angle.so");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user