ANDROID: Add GLAD support

This commit is contained in:
Le Philousophe 2022-01-04 23:18:51 +01:00 committed by Paweł Kołodziejski
parent a9418f8f63
commit 1c18c269dc
9 changed files with 30 additions and 8 deletions

View File

@ -223,8 +223,7 @@ void AndroidGraphicsManager::touchControlNotifyChanged() {
void *AndroidGraphicsManager::getProcAddress(const char *name) const {
ENTER("%s", name);
// TODO: Support dynamically loaded OpenGL
return nullptr;
return androidGLgetProcAddress(name);
}
bool AndroidGraphicsManager::notifyMousePosition(Common::Point &mouse) {

View File

@ -134,8 +134,6 @@ protected:
void refreshScreen();
void *getProcAddress(const char *name) const;
private:
void initOverlay();

View File

@ -40,6 +40,7 @@
// for the Android port
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
#include <EGL/egl.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/system_properties.h>
@ -120,6 +121,11 @@ void checkGlError(const char *expr, const char *file, int line) {
}
#endif
void *androidGLgetProcAddress(const char *name) {
// This exists since Android 2.3 (API Level 9)
return (void *)eglGetProcAddress(name);
}
OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_audio_sample_rate(audio_sample_rate),
_audio_buffer_size(audio_buffer_size),

View File

@ -93,6 +93,8 @@ extern void checkGlError(const char *expr, const char *file, int line);
#define GLTHREADCHECK do { } while (false)
#endif
void *androidGLgetProcAddress(const char *name);
class OSystem_Android : public ModularGraphicsBackend, Common::EventSource {
private:
// passed from the dark side

View File

@ -40,6 +40,7 @@
// for the Android port
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
#include <EGL/egl.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/system_properties.h>
@ -118,6 +119,11 @@ void checkGlError(const char *expr, const char *file, int line) {
}
#endif
void *androidGLgetProcAddress(const char *name) {
// This exists since Android 2.3 (API Level 9)
return (void *)eglGetProcAddress(name);
}
OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_audio_sample_rate(audio_sample_rate),
_audio_buffer_size(audio_buffer_size),

View File

@ -100,6 +100,8 @@ extern void checkGlError(const char *expr, const char *file, int line);
#define GLTHREADCHECK do { } while (false)
#endif
void *androidGLgetProcAddress(const char *name);
class OSystem_Android : public ModularGraphicsBackend, Common::EventSource {
private:
// passed from the dark side

View File

@ -114,8 +114,6 @@ protected:
void refreshScreen();
void *getProcAddress(const char *name) const;
private:
void setCursorPaletteInternal(const byte *colors, uint start, uint num);
void disableCursorPalette();

6
configure vendored
View File

@ -5334,10 +5334,12 @@ if test "$_opengl_mode" != none ; then
android)
# We require API level 16 while GLES2 APIs have been added in level 8 so we are safe for compilation
_opengl_mode=gles2
_opengl_glad=yes
;;
android3d)
# We require API level 16 while GLES2 APIs have been added in level 8 so we are safe for compilation
_opengl_mode=gles2
_opengl_glad=yes
;;
openpandora)
# Enable GLES only if user explicitely requested it
@ -6125,7 +6127,7 @@ case $_host_os in
system_libs=''
for lib in $LIBS; do
case $lib in
-lz|-lm|-ldl|-lGLESv2)
-lz|-lm|-ldl)
system_libs="$system_libs $lib"
;;
*)
@ -6137,7 +6139,7 @@ case $_host_os in
# -lgcc is carefully placed here - we want to catch
# all toolchain symbols in *our* libraries rather
# than pick up anything unhygenic from the Android libs.
LIBS="-Wl,-Bstatic $static_libs -Wl,-Bdynamic -lgcc $system_libs -llog -landroid -ljnigraphics -lGLESv2"
LIBS="-Wl,-Bstatic $static_libs -Wl,-Bdynamic -lgcc $system_libs -llog -landroid -ljnigraphics -lEGL"
;;
ds)
# Moved -Wl,--gc-sections here to avoid it interfering with the library checks

View File

@ -38,6 +38,15 @@
static GLADapiproc loadFunc(void *userptr, const char *name) {
return (GLADapiproc)SDL_GL_GetProcAddress(name);
}
#elif defined(__ANDROID__)
// To keep includes light, don't include EGL here and don't include Android headers
void *androidGLgetProcAddress(const char *name);
static GLADapiproc loadFunc(void *userptr, const char *name) {
return (GLADapiproc)androidGLgetProcAddress(name);
}
#else
#error Not implemented
#endif