jkxr/Projects/Android/jni/SupportLibs/gl4es/spec/template/eglwrap.c.j2
Simon 4597b03873 Initial Commit
Opens in Android Studio but haven't even tried to build it yet (it won't.. I know that much!)
2022-09-18 16:37:21 +01:00

23 lines
1.1 KiB
Django/Jinja

{% extends "base/wrap.c.j2" %}
{% block headers %}
{{ super() }}
void *egl_lib;
#define WARN_NULL(name) if (name == NULL) printf("LIBGL: warning, " #name " is NULL\n");
#define LOAD_EGL(type, name, args...) \
typedef type (*eglptr_##name)(args); \
static eglptr_##name egl_##name; \
if (egl##name == NULL) { \
if (egl_lib == NULL) { \
egl_lib = dlopen("libEGL.so", RTLD_LOCAL | RTLD_LAZY); \
WARN_NULL(egl_lib); \
} \
egl_##name = (eglptr_##name)dlsym(egl_lib, #name); \
WARN_NULL(egl_lib_##name); \
} \
{% endblock %}
{% block load %}
LOAD_EGL({{ func.return }}, {{ func.name }}
{%- if func.args %}, {{ func.args|args }}{% endif %});
{% endblock %}
{% block prefix %}egl{% endblock %}