From b96f87c6cd2a18f810d0b10ec0b211409d6e75a6 Mon Sep 17 00:00:00 2001 From: denarmkill46-coder Date: Sat, 22 Aug 2026 06:21:01 +0200 Subject: [PATCH 1/2] =?UTF-8?q?PATCH=202:=20Adicionar=20-ldl=20flag=20para?= =?UTF-8?q?=20dlopen/dlsym=20expl=C3=ADcito?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ltw/src/main/tinywrapper/Android.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ltw/src/main/tinywrapper/Android.mk b/ltw/src/main/tinywrapper/Android.mk index 47cb1ec..55158a7 100644 --- a/ltw/src/main/tinywrapper/Android.mk +++ b/ltw/src/main/tinywrapper/Android.mk @@ -163,8 +163,8 @@ LOCAL_SRC_FILES := glsl_optimizer/src/code/ir_print_glsl_visitor.cpp \ glsl_optimizer/src/mesa/main/errors.c \ glsl_optimizer/src/mesa/main/extensions_table.c \ glsl_optimizer/src/mesa/main/imports.c \ - glsl_optimizer/src/mesa/program/symbol_table.c \ - glsl_optimizer/src/mesa/program/prog_parameter.c \ + glsl_optimizer/src/program/symbol_table.c \ + glsl_optimizer/src/program/prog_parameter.c \ glsl_optimizer/src/compiler/glsl/gl_nir_link_uniform_initializers.c \ glsl_optimizer/src/compiler/glsl/gl_nir_lower_packed_varyings.c \ glsl_optimizer/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c \ @@ -414,5 +414,5 @@ LOCAL_STATIC_LIBRARIES := glsl_optimizer LOCAL_LDFLAGS := -ffunction-sections -fdata-sections -Wl,--version-script=$(LOCAL_PATH)/version.script # Comment for debugging LOCAL_LDFLAGS += -flto -Wl,--gc-sections -LOCAL_LDLIBS := -llog +LOCAL_LDLIBS := -llog -ldl include $(BUILD_SHARED_LIBRARY) From 61bf61dced29720b78203d3833a6915b8587d9ad Mon Sep 17 00:00:00 2001 From: denarmkill46-coder Date: Sat, 22 Aug 2026 06:21:23 +0200 Subject: [PATCH 2/2] PATCH 1: Modificar carregamento de EGL para ANGLE first (sem fallback) --- ltw/src/main/tinywrapper/proc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/ltw/src/main/tinywrapper/proc.c b/ltw/src/main/tinywrapper/proc.c index 56b6118..a34ba21 100644 --- a/ltw/src/main/tinywrapper/proc.c +++ b/ltw/src/main/tinywrapper/proc.c @@ -20,7 +20,7 @@ INTERNAL eglMustCastToProperFunctionPointerType (*host_eglGetProcAddress)(const INTERNAL es3_functions_t es3_functions; static void error_sysegl() { - printf("LTWInit: Failed to load system EGL: %s\n", dlerror()); + printf("LTWInit: Failed to load EGL: %s\n", dlerror()); abort(); } @@ -39,16 +39,30 @@ static void init_es3_proc() { } __attribute__((constructor, used)) void proc_init(){ + // ANGLE-first strategy for Vulkan rendering + const char* angleEglPath = "libEGL_angle.so"; const char* systemEglPath = "libEGL.so"; - const char* eglPath = getenv("LIBGL_EGL") != NULL ? getenv("LIBGL_EGL") : systemEglPath; + const char* eglPath = NULL; + + // Priority 1: Environment override (testing only) + if(getenv("LIBGL_EGL") != NULL) { + eglPath = getenv("LIBGL_EGL"); + printf("LTWInit: Using LIBGL_EGL override: %s\n", eglPath); + } + // Priority 2: ANGLE (LD_LIBRARY_PATH must be set by launcher) + else { + eglPath = angleEglPath; + } + int flags = RTLD_LAZY | RTLD_LOCAL; void* eglHandle = dlopen(eglPath, flags); - if(eglHandle == NULL){ - printf("LTWInit: failed loading custom libEGL, using default\n"); - eglHandle = dlopen(systemEglPath, flags); - if(eglHandle == NULL) - error_sysegl(); + + if(eglHandle == NULL) { + printf("LTWInit: FATAL - Failed to load %s: %s\n", eglPath, dlerror()); + printf("LTWInit: Ensure launcher called setLdLibraryPath(nativedir) before loading LTW\n"); + error_sysegl(); } + host_eglGetProcAddress = dlsym(eglHandle, "eglGetProcAddress"); if(host_eglGetProcAddress == NULL) error_sysegl(); init_egl();