Use Khronos OpenGL headers in libretro builds instead of SDL OpenGL headers

SDL disables OpenGL headers when building for iOS and tvOS, but that
causes our builds to fail. I'm getting conflicting answers on whether or
not OpenGL is supported on iOS and tvOS, but it's the libretro
frontend's job to care about this, not mine. Regardless, I'm gonna need
these OpenGL headers for software rendering on platforms with no OpenGL
support, so I can't tolerate the headers being disabled.
This commit is contained in:
刘皓 2025-03-10 17:31:39 -04:00
parent ccceeeb75b
commit 497d6788c6
No known key found for this signature in database
GPG key ID: 7901753DB465B711
6 changed files with 29 additions and 6 deletions

View file

@ -115,6 +115,8 @@ if is_libretro
'-DSHARED_FLUID',
'-D_FILE_OFFSET_BITS=64',
'-DMPG123_NO_LARGENAME',
'-DPGL_PREFIX_TYPES',
'-DPGL_PREFIX_GLSL',
]
if host_endian == 'big'
@ -514,6 +516,7 @@ if is_libretro
cmake.subproject('libsndfile', options: libsndfile_options).dependency('sndfile'),
cmake.subproject('pixman-region', options: pixman_region_options).dependency('pixman-region'),
subproject('stb').get_variable('stb'),
subproject('opengl-registry').get_variable('opengl_registry'),
subproject('portablegl').get_variable('portablegl'),
subproject('freetype', default_options: freetype_options).get_variable('freetype_dep'),
declare_dependency(

View file

@ -22,12 +22,18 @@
#ifndef GLFUN_H
#define GLFUN_H
#ifdef GLES2_HEADER
#include <SDL_opengles2.h>
#define APIENTRYP GL_APIENTRYP
#ifdef MKXPZ_RETRO
# include <GLES3/gl3.h>
# define APIENTRY GL_APIENTRY
# define APIENTRYP GL_APIENTRYP
#else
#include <SDL_opengl.h>
#endif
# ifdef GLES2_HEADER
# include <SDL_opengles2.h>
# define APIENTRYP GL_APIENTRYP
# else
# include <SDL_opengl.h>
# endif // GLES2_HEADER
#endif // MKXPZ_RETRO
/* Etc */
typedef GLenum (APIENTRYP _PFNGLGETERRORPROC) (void);
@ -58,7 +64,7 @@ typedef void (APIENTRYP _PFNGLGENERATEMIPMAPPROC) (GLenum target);
typedef void (APIENTRYP _PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture);
/* Debugging */
typedef void (APIENTRY * _GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void *userParam);
typedef void (APIENTRYP _GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void *userParam);
typedef void (APIENTRYP _PFNGLDEBUGMESSAGECALLBACKPROC) (_GLDEBUGPROC callback, const void *userParam);
typedef void (APIENTRYP _PFNGLSTRINGMARKERPROC) (GLsizei len, const GLvoid *string);

View file

@ -0,0 +1,5 @@
[wrap-git]
url = https://github.com/KhronosGroup/EGL-Registry
revision = 29c4314e0ef04c730992d295f91b76635019fbba
depth = 1
patch_directory = egl-registry

View file

@ -0,0 +1,5 @@
[wrap-git]
url = https://github.com/KhronosGroup/OpenGL-Registry
revision = b53ca669bea4715b6d5fa53c459f47a1fecd7944
depth = 1
patch_directory = opengl-registry

View file

@ -0,0 +1,2 @@
project('egl-registry', 'c', meson_version: '>=1.3.0')
egl_registry = declare_dependency(include_directories: 'api')

View file

@ -0,0 +1,2 @@
project('opengl-registry', 'c', meson_version: '>=1.3.0')
opengl_registry = declare_dependency(include_directories: 'api', dependencies: [subproject('egl-registry').get_variable('egl_registry')])