From 6ff6dabfb32d99772c8d36f49a9b70beb4864803 Mon Sep 17 00:00:00 2001 From: John Sebastian Peterson Date: Mon, 10 Feb 2025 02:55:08 +1100 Subject: [PATCH] add epoxy_set_library_path for android angle this is used in termux to load angle platform for a lack of other ideas I don't know how to use lib glvnd to load angle this didn't work only the LD library path worked $PREFIX/share/glvnd/egl_vendor.d/angle.json "library_path" : "libEGL_angle.so" or this failed too "library_path" : "libGLESv2_angle.so" this works LD_LIBRARY_PATH=$P/opt/angle-android/gl/ ~/demos/out/src/egl/opengl/eglinfo -p angle -B one horrible bug this introduced in virgl renderer is a glx failure if epoxy support glx. I am looking for a solution for this an a better approach overall glXGetCurrentContext() not found: undefined symbol: glXGetCurrentContext --- include/epoxy/common.h | 3 +++ src/dispatch_common.c | 16 ++++++++++++---- src/gen_dispatch.py | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/epoxy/common.h b/include/epoxy/common.h index cf58ab2f..f7dd5de7 100644 --- a/include/epoxy/common.h +++ b/include/epoxy/common.h @@ -57,6 +57,9 @@ EPOXY_BEGIN_DECLS EPOXY_PUBLIC bool epoxy_extension_in_string(const char *extension_list, const char *ext); +#if defined(__ANDROID__) +EPOXY_PUBLIC void epoxy_set_library_path(const char * path, const char * suffix); +#endif EPOXY_END_DECLS diff --git a/src/dispatch_common.c b/src/dispatch_common.c index 9f3dac46..58b45af4 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -179,10 +179,18 @@ #define GLES1_LIB "libGLESv1_CM.so" #define GLES2_LIB "libGLESv2.so" #elif defined(__ANDROID__) -#define GLX_LIB "libGLESv2.so" -#define EGL_LIB "libEGL.so" -#define GLES1_LIB "libGLESv1_CM.so" -#define GLES2_LIB "libGLESv2.so" +#define GLX_LIB GLES2_LIB +static char EGL_LIB[PATH_MAX] = "libEGL.so"; +static char GLES1_LIB[PATH_MAX] = "libGLESv1_CM.so"; +static char GLES2_LIB[PATH_MAX] = "libGLESv2.so"; +/* example for angle-gl platform */ +/* epoxy_set_library_path("opt/angle-android/gl", "_angle); */ +EPOXY_PUBLIC void epoxy_set_library_path(const char * path, const char * suffix) { + char *prefix = getenv("PREFIX"); + sprintf(EGL_LIB, "%s/%s/libEGL%s.so", prefix, path, suffix); + sprintf(GLES1_LIB, "%s/%s/libGLESv1_CM%s.so", prefix, path, suffix); + sprintf(GLES2_LIB, "%s/%s/libGLESv2%s.so", prefix, path, suffix); +} #elif defined(_WIN32) #define EGL_LIB "libEGL.dll" #define GLES1_LIB "libGLES_CM.dll" diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 3daad842..728db11f 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/bin/env python3 # -*- coding: utf-8 -*- # Copyright © 2013 Intel Corporation