[Fix] (MG_Impl/GetProcAddress, Exporting): properly get proc address, clear reliance on dlsym

This commit is contained in:
2026-01-17 09:19:38 +08:00
parent 97cbb35dbd
commit 80bb46cbb9
15 changed files with 2144 additions and 35 deletions
+3 -1
View File
@@ -52,8 +52,10 @@
#include <spirv_cross/spirv_cross_c.h>
// Include OpenGL and EGL headers
#include <GL/gl.h>
#include <EGL/egl.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glcorearb.h>
#undef GL_GLEXT_PROTOTYPES
#include <GL/glext.h>
#include <GLES3/gl32.h>
@@ -6,6 +6,9 @@
// End of Source File Header
#include "EGLWrapper.h"
#include "MG_Impl/GetProcAddress.h"
#include <Config.h>
#include <MG_Util/BackendLoaders/OpenGL/Loader.h>
@@ -96,20 +99,121 @@ namespace MobileGL {
return MG_External::EGL::eglCreatePbufferSurface(dpy, config, attrib_list);
}
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
return MG_External::EGL::eglBindTexImage(dpy, surface, buffer);
}
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
return MG_External::EGL::eglReleaseTexImage(dpy, surface, buffer);
}
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
return MG_External::EGL::eglCopyBuffers(dpy, surface, target);
}
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint* attrib_list) {
return MG_External::EGL::eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
}
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
const EGLint* attrib_list) {
return MG_External::EGL::eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
}
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
return MG_External::EGL::eglGetConfigs(dpy, configs, config_size, num_config);
}
EGLDisplay GetCurrentDisplay(void) {
return MG_External::EGL::eglGetCurrentDisplay();
}
EGLenum QueryAPI(void) {
return MG_External::EGL::eglQueryAPI();
}
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
return MG_External::EGL::eglQueryContext(dpy, ctx, attribute, value);
}
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
return MG_External::EGL::eglSurfaceAttrib(dpy, surface, attribute, value);
}
EGLBoolean WaitClient(void) {
return MG_External::EGL::eglWaitClient();
}
EGLBoolean WaitGL(void) {
return MG_External::EGL::eglWaitGL();
}
EGLBoolean WaitNative(EGLint engine) {
return MG_External::EGL::eglWaitNative(engine);
}
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name) {
MGLOG_D("eglGetProcAddress(%s)", name);
#if !defined(WIN32) && !defined(__APPLE__)
void* proc = dlsym(RTLD_DEFAULT, (const char*)name);
#else
void* proc = NULL;
#endif
void* proc = MG_Impl::GetProcAddress(name);
if (!proc) {
MGLOG_W("Failed to get function: %s", (const char*)name);
return nullptr;
}
return (__eglMustCastToProperFunctionPointerType)proc;
}
EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib * attrib_list) {
return MG_External::EGL::eglCreateSync(dpy, type, attrib_list);
}
EGLBoolean DestroySync(EGLDisplay dpy, EGLSync sync) {
return MG_External::EGL::eglDestroySync(dpy, sync);
}
EGLint ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) {
return MG_External::EGL::eglClientWaitSync(dpy, sync, flags, timeout);
}
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib * value) {
return MG_External::EGL::eglGetSyncAttrib(dpy, sync, attribute, value);
}
EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list) {
return MG_External::EGL::eglCreateImage(dpy, ctx, target, buffer, attrib_list);
}
EGLBoolean DestroyImage(EGLDisplay dpy, EGLImage image) {
return MG_External::EGL::eglDestroyImage(dpy, image);
}
EGLDisplay GetPlatformDisplay(EGLenum platform, void * native_display, const EGLAttrib * attrib_list) {
return MG_External::EGL::eglGetPlatformDisplay(platform, native_display, attrib_list);
}
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list) {
return MG_External::EGL::eglCreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
}
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLAttrib * attrib_list) {
return MG_External::EGL::eglCreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
}
EGLBoolean WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) {
return MG_External::EGL::eglWaitSync(dpy, sync, flags);
}
} // namespace MG_Impl::EGLImpl
} // namespace MobileGL
#endif
#endif
@@ -103,3 +103,102 @@ MOBILEGL_EGL_API EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig co
MOBILEGL_EGL_API __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* name) {
return MobileGL::MG_Impl::EGLImpl::GetProcAddress(name);
}
MOBILEGL_EGL_API EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
return MobileGL::MG_Impl::EGLImpl::BindTexImage(dpy, surface, buffer);
}
MOBILEGL_EGL_API EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
return MobileGL::MG_Impl::EGLImpl::ReleaseTexImage(dpy, surface, buffer);
}
MOBILEGL_EGL_API EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
return MobileGL::MG_Impl::EGLImpl::CopyBuffers(dpy, surface, target);
}
MOBILEGL_EGL_API EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
EGLClientBuffer buffer, EGLConfig config,
const EGLint* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
}
MOBILEGL_EGL_API EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
const EGLint* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
}
MOBILEGL_EGL_API EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
return MobileGL::MG_Impl::EGLImpl::GetConfigs(dpy, configs, config_size, num_config);
}
MOBILEGL_EGL_API EGLDisplay eglGetCurrentDisplay(void) {
return MobileGL::MG_Impl::EGLImpl::GetCurrentDisplay();
}
MOBILEGL_EGL_API EGLenum eglQueryAPI(void) {
return MobileGL::MG_Impl::EGLImpl::QueryAPI();
}
MOBILEGL_EGL_API EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
return MobileGL::MG_Impl::EGLImpl::QueryContext(dpy, ctx, attribute, value);
}
MOBILEGL_EGL_API EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
return MobileGL::MG_Impl::EGLImpl::SurfaceAttrib(dpy, surface, attribute, value);
}
MOBILEGL_EGL_API EGLBoolean eglWaitClient(void) {
return MobileGL::MG_Impl::EGLImpl::WaitClient();
}
MOBILEGL_EGL_API EGLBoolean eglWaitGL(void) {
return MobileGL::MG_Impl::EGLImpl::WaitGL();
}
MOBILEGL_EGL_API EGLBoolean eglWaitNative(EGLint engine) {
return MobileGL::MG_Impl::EGLImpl::WaitNative(engine);
}
MOBILEGL_EGL_API EGLSync eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::CreateSync(dpy, type, attrib_list);
}
MOBILEGL_EGL_API EGLBoolean eglDestroySync(EGLDisplay dpy, EGLSync sync) {
return MobileGL::MG_Impl::EGLImpl::DestroySync(dpy, sync);
}
MOBILEGL_EGL_API EGLint eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) {
return MobileGL::MG_Impl::EGLImpl::ClientWaitSync(dpy, sync, flags, timeout);
}
MOBILEGL_EGL_API EGLBoolean eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value) {
return MobileGL::MG_Impl::EGLImpl::GetSyncAttrib(dpy, sync, attribute, value);
}
MOBILEGL_EGL_API EGLImage eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const EGLAttrib* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::CreateImage(dpy, ctx, target, buffer, attrib_list);
}
MOBILEGL_EGL_API EGLBoolean eglDestroyImage(EGLDisplay dpy, EGLImage image) {
return MobileGL::MG_Impl::EGLImpl::DestroyImage(dpy, image);
}
MOBILEGL_EGL_API EGLDisplay eglGetPlatformDisplay(EGLenum platform, void* native_display,
const EGLAttrib* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::GetPlatformDisplay(platform, native_display, attrib_list);
}
MOBILEGL_EGL_API EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
const EGLAttrib* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
}
MOBILEGL_EGL_API EGLSurface eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
const EGLAttrib* attrib_list) {
return MobileGL::MG_Impl::EGLImpl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
}
MOBILEGL_EGL_API EGLBoolean eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) {
return MobileGL::MG_Impl::EGLImpl::WaitSync(dpy, sync, flags);
}
@@ -113,6 +113,69 @@ namespace MobileGL {
return (EGLSurface)1;
}
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
return EGL_TRUE;
}
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
return EGL_TRUE;
}
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
return EGL_TRUE;
}
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint* attrib_list) {
return (EGLSurface)1;
}
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
const EGLint* attrib_list) {
return (EGLSurface)1;
}
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
if (num_config) {
*num_config = 1;
}
if (configs && config_size > 0) {
configs[0] = (EGLConfig)1;
}
return EGL_TRUE;
}
EGLDisplay GetCurrentDisplay(void) {
return (EGLDisplay)1;
}
EGLenum QueryAPI(void) {
return EGL_OPENGL_API;
}
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
if (value) {
*value = 0;
}
return EGL_TRUE;
}
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
return EGL_TRUE;
}
EGLBoolean WaitClient(void) {
return EGL_TRUE;
}
EGLBoolean WaitGL(void) {
return EGL_TRUE;
}
EGLBoolean WaitNative(EGLint engine) {
return EGL_TRUE;
}
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name) {
MGLOG_D("eglGetProcAddress(%s)", name);
#if !defined(WIN32) && !defined(__APPLE__)
@@ -128,4 +191,4 @@ namespace MobileGL {
}
} // namespace MG_Impl::EGLImpl
} // namespace MobileGL
#endif
#endif
@@ -32,6 +32,31 @@ namespace MobileGL {
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval);
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw);
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list);
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint* attrib_list);
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
const EGLint* attrib_list);
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config);
EGLDisplay GetCurrentDisplay(void);
EGLenum QueryAPI(void);
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value);
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
EGLBoolean WaitClient(void);
EGLBoolean WaitGL(void);
EGLBoolean WaitNative(EGLint engine);
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name);
EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib * attrib_list);
EGLBoolean DestroySync(EGLDisplay dpy, EGLSync sync);
EGLint ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib * value);
EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list);
EGLBoolean DestroyImage(EGLDisplay dpy, EGLImage image);
EGLDisplay GetPlatformDisplay(EGLenum platform, void * native_display, const EGLAttrib * attrib_list);
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list);
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLAttrib * attrib_list);
EGLBoolean WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags);
} // namespace MG_Impl::EGLImpl
} // namespace MobileGL
} // namespace MobileGL
@@ -1107,6 +1107,7 @@ DECLARE_GL_FUNCTION_STUB_HEAD(void, SpecializeShader, GLuint shader, const GLcha
DECLARE_GL_FUNCTION_STUB_HEAD(void, MultiDrawArraysIndirectCount, GLenum mode, const void* indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, MultiDrawArraysIndirectCount, mode, indirect, drawcount, maxdrawcount, stride)
DECLARE_GL_FUNCTION_STUB_HEAD(void, MultiDrawElementsIndirectCount, GLenum mode, GLenum type, const void* indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, MultiDrawElementsIndirectCount, mode, type, indirect, drawcount, maxdrawcount, stride)
DECLARE_GL_FUNCTION_STUB_HEAD(void, PolygonOffsetClamp, GLfloat factor, GLfloat units, GLfloat clamp) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, PolygonOffsetClamp, factor, units, clamp)
DECLARE_GL_FUNCTION_STUB_HEAD(void, PrimitiveBoundingBoxARB, GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) DECLARE_GL_FUNCTION_STUB_END(void, PrimitiveBoundingBoxARB, minX, minY, minZ, minW, maxX, maxY, maxZ, maxW)
DECLARE_GL_FUNCTION_STUB_HEAD(GLuint64, GetTextureHandleARB, GLuint texture) DECLARE_GL_FUNCTION_STUB_END(GLuint64, GetTextureHandleARB, texture)
DECLARE_GL_FUNCTION_STUB_HEAD(GLuint64, GetTextureSamplerHandleARB, GLuint texture, GLuint sampler) DECLARE_GL_FUNCTION_STUB_END(GLuint64, GetTextureSamplerHandleARB, texture, sampler)
DECLARE_GL_FUNCTION_STUB_HEAD(void, MakeTextureHandleResidentARB, GLuint64 handle) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, MakeTextureHandleResidentARB, handle)
@@ -2827,3 +2828,274 @@ DECLARE_GL_FUNCTION_STUB_HEAD(void, ReplacementCodeuiTexCoord2fNormal3fVertex3fS
DECLARE_GL_FUNCTION_STUB_HEAD(void, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN, const GLuint* rc, const GLfloat* tc, const GLfloat* n, const GLfloat* v) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN, rc, tc, n, v)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN, GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN, rc, s, t, r, g, b, a, nx, ny, nz, x, y, z)
DECLARE_GL_FUNCTION_STUB_HEAD(void, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN, const GLuint* rc, const GLfloat* tc, const GLfloat* c, const GLfloat* n, const GLfloat* v) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN, rc, tc, c, n, v)
MOBILEGL_GL_API void glDebugMessageControlARB(GLenum source, GLenum type, GLenum severity, GLsizei count,
const GLuint* ids, GLboolean enabled) {
glDebugMessageControl(source, type, severity, count, ids, enabled);
}
MOBILEGL_GL_API void glDebugMessageInsertARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
const GLchar* buf) {
glDebugMessageInsert(source, type, id, severity, length, buf);
}
MOBILEGL_GL_API void glDebugMessageCallbackARB(GLDEBUGPROC callback, const void* userParam) {
glDebugMessageCallback(callback, userParam);
}
MOBILEGL_GL_API GLuint glGetDebugMessageLogARB(GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types,
GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog) {
return glGetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
}
MOBILEGL_GL_API void glDrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) {
glDrawArraysInstanced(mode, first, count, instancecount);
}
MOBILEGL_GL_API void glDrawArraysInstancedEXT(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) {
glDrawArraysInstanced(mode, first, count, instancecount);
}
MOBILEGL_GL_API void glDrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type, const void* indices,
GLsizei instancecount) {
glDrawElementsInstanced(mode, count, type, indices, instancecount);
}
MOBILEGL_GL_API void glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void* indices,
GLsizei instancecount) {
glDrawElementsInstanced(mode, count, type, indices, instancecount);
}
MOBILEGL_GL_API void glFramebufferTextureARB(GLenum target, GLenum attachment, GLuint texture, GLint level) {
glFramebufferTexture(target, attachment, texture, level);
}
MOBILEGL_GL_API void glFramebufferTextureLayerARB(GLenum target, GLenum attachment, GLuint texture, GLint level,
GLint layer) {
glFramebufferTextureLayer(target, attachment, texture, level, layer);
}
MOBILEGL_GL_API void glGetFramebufferParameterivEXT(GLenum target, GLenum pname, GLint* params) {
glGetFramebufferParameteriv(target, pname, params);
}
MOBILEGL_GL_API GLenum glGetGraphicsResetStatusARB(void) {
return glGetGraphicsResetStatus();
}
MOBILEGL_GL_API void glGetnUniformfvARB(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) {
glGetnUniformfv(program, location, bufSize, params);
}
MOBILEGL_GL_API void glGetnUniformivARB(GLuint program, GLint location, GLsizei bufSize, GLint* params) {
glGetnUniformiv(program, location, bufSize, params);
}
MOBILEGL_GL_API void glGetnUniformuivARB(GLuint program, GLint location, GLsizei bufSize, GLuint* params) {
glGetnUniformuiv(program, location, bufSize, params);
}
MOBILEGL_GL_API void glGetObjectLabelEXT(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length,
GLchar* label) {
glGetObjectLabel(identifier, name, bufSize, length, label);
}
MOBILEGL_GL_API void* glMapNamedBuffer(GLuint buffer, GLenum access) {
MGLOG_W("Stub function: %s(...)", __FUNCTION__);
return nullptr;
}
MOBILEGL_GL_API void* glMapNamedBufferEXT(GLuint buffer, GLenum access) {
return glMapNamedBuffer(buffer, access);
}
MOBILEGL_GL_API void* glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) {
MGLOG_W("Stub function: %s(...)", __FUNCTION__);
return nullptr;
}
MOBILEGL_GL_API void* glMapNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) {
return glMapNamedBufferRange(buffer, offset, length, access);
}
MOBILEGL_GL_API void glMinSampleShadingARB(GLfloat value) {
glMinSampleShading(value);
}
MOBILEGL_GL_API void glProgramParameteriARB(GLuint program, GLenum pname, GLint value) {
glProgramParameteri(program, pname, value);
}
MOBILEGL_GL_API void glProgramUniform1fEXT(GLuint program, GLint location, GLfloat v0) {
glProgramUniform1f(program, location, v0);
}
MOBILEGL_GL_API void glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) {
glProgramUniform1fv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform1iEXT(GLuint program, GLint location, GLint v0) {
glProgramUniform1i(program, location, v0);
}
MOBILEGL_GL_API void glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) {
glProgramUniform1iv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform1uiEXT(GLuint program, GLint location, GLuint v0) {
glProgramUniform1ui(program, location, v0);
}
MOBILEGL_GL_API void glProgramUniform1uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) {
glProgramUniform1uiv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform2fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1) {
glProgramUniform2f(program, location, v0, v1);
}
MOBILEGL_GL_API void glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) {
glProgramUniform2fv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform2iEXT(GLuint program, GLint location, GLint v0, GLint v1) {
glProgramUniform2i(program, location, v0, v1);
}
MOBILEGL_GL_API void glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) {
glProgramUniform2iv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform2uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1) {
glProgramUniform2ui(program, location, v0, v1);
}
MOBILEGL_GL_API void glProgramUniform2uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) {
glProgramUniform2uiv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform3fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
glProgramUniform3f(program, location, v0, v1, v2);
}
MOBILEGL_GL_API void glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) {
glProgramUniform3fv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform3iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) {
glProgramUniform3i(program, location, v0, v1, v2);
}
MOBILEGL_GL_API void glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) {
glProgramUniform3iv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform3uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) {
glProgramUniform3ui(program, location, v0, v1, v2);
}
MOBILEGL_GL_API void glProgramUniform3uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) {
glProgramUniform3uiv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform4fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
GLfloat v3) {
glProgramUniform4f(program, location, v0, v1, v2, v3);
}
MOBILEGL_GL_API void glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat* value) {
glProgramUniform4fv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform4iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) {
glProgramUniform4i(program, location, v0, v1, v2, v3);
}
MOBILEGL_GL_API void glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint* value) {
glProgramUniform4iv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniform4uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2,
GLuint v3) {
glProgramUniform4ui(program, location, v0, v1, v2, v3);
}
MOBILEGL_GL_API void glProgramUniform4uivEXT(GLuint program, GLint location, GLsizei count, const GLuint* value) {
glProgramUniform4uiv(program, location, count, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix2fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix2x3fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix2x3fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix2x4fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix2x4fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix3fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix3x2fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix3x2fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix3x4fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix3x4fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix4fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix4x2fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix4x2fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glProgramUniformMatrix4x3fvEXT(GLuint program, GLint location, GLsizei count,
GLboolean transpose, const GLfloat* value) {
glProgramUniformMatrix4x3fv(program, location, count, transpose, value);
}
MOBILEGL_GL_API void glReadnPixelsARB(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
GLsizei bufSize, void* data) {
glReadnPixels(x, y, width, height, format, type, bufSize, data);
}
MOBILEGL_GL_API void glTexBufferARB(GLenum target, GLenum internalformat, GLuint buffer) {
glTexBuffer(target, internalformat, buffer);
}
MOBILEGL_GL_API void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) {
glTexStorage1DEXT(target, levels, internalformat, width);
}
MOBILEGL_GL_API void glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
GLsizei height) {
glTexStorage2D(target, levels, internalformat, width, height);
}
MOBILEGL_GL_API void glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth) {
glTexStorage3D(target, levels, internalformat, width, height, depth);
}
MOBILEGL_GL_API void glVertexAttribDivisorARB(GLuint index, GLuint divisor) {
glVertexAttribDivisor(index, divisor);
}
MOBILEGL_GL_API void glWindowRectanglesEXT(GLenum mode, GLsizei count, const GLint* box) {
MGLOG_W("Stub function: %s(...)", __FUNCTION__);
}
+1 -5
View File
@@ -12,11 +12,7 @@ namespace MG_Impl::GLXImpl {
void* GetProcAddress(const char* name) {
MGLOG_D("glXGetProcAddress(\"%s\")", name);
#if !defined(WIN32) && !defined(__APPLE__)
void* proc = dlsym(RTLD_DEFAULT, (const char*)name);
#else
void* proc = NULL;
#endif
void* proc = MobileGL::MG_Impl::GetProcAddress(name);
if (!proc) {
MGLOG_W("Failed to get function: %s", (const char*)name);
return nullptr;
+1
View File
@@ -7,6 +7,7 @@
#pragma once
#include <Includes.h>
#include "MG_Impl/GetProcAddress.h"
namespace MG_Impl {
namespace GLXImpl {
File diff suppressed because it is too large Load Diff
+15
View File
@@ -0,0 +1,15 @@
// MobileGL - MobileGL/MG_Impl/GetProcAddress.h
// Copyright (c) 2025-2026 MobileGL-Dev
// Licensed under the GNU Lesser General Public License v2.1:
// http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
// SPDX-License-Identifier: LGPL-2.1-only
// End of Source File Header
#pragma once
#include <Includes.h>
namespace MobileGL {
namespace MG_Impl {
void* GetProcAddress(const char* name);
} // namespace MG_Impl
} // namespace MobileGL
@@ -425,6 +425,14 @@ namespace MobileGL {
EGL_FUNC_DECL(eglWaitClient)
EGL_FUNC_DECL(eglWaitGL)
EGL_FUNC_DECL(eglWaitNative)
EGL_FUNC_DECL(eglCreateSync)
EGL_FUNC_DECL(eglDestroySync)
EGL_FUNC_DECL(eglClientWaitSync)
EGL_FUNC_DECL(eglGetSyncAttrib)
EGL_FUNC_DECL(eglCreateImage)
EGL_FUNC_DECL(eglDestroyImage)
EGL_FUNC_DECL(eglCreatePlatformPixmapSurface)
EGL_FUNC_DECL(eglWaitSync)
} // namespace EGL
} // namespace MG_External
@@ -911,6 +919,7 @@ namespace MobileGL {
INIT_EGL_FUNC(eglCreatePbufferFromClientBuffer)
INIT_EGL_FUNC(eglCreatePbufferSurface)
INIT_EGL_FUNC(eglCreatePixmapSurface)
INIT_EGL_FUNC(eglCreatePlatformPixmapSurface)
INIT_EGL_FUNC(eglCreatePlatformWindowSurface)
INIT_EGL_FUNC(eglCreateWindowSurface)
INIT_EGL_FUNC(eglDestroyContext)
@@ -941,6 +950,14 @@ namespace MobileGL {
INIT_EGL_FUNC(eglWaitClient)
INIT_EGL_FUNC(eglWaitGL)
INIT_EGL_FUNC(eglWaitNative)
INIT_EGL_FUNC(eglCreateSync)
INIT_EGL_FUNC(eglDestroySync)
INIT_EGL_FUNC(eglClientWaitSync)
INIT_EGL_FUNC(eglGetSyncAttrib)
INIT_EGL_FUNC(eglCreateImage)
INIT_EGL_FUNC(eglDestroyImage)
INIT_EGL_FUNC(eglGetPlatformDisplay)
INIT_EGL_FUNC(eglWaitSync)
EGLint configAttribs[] = {EGL_RED_SIZE,
8,
@@ -1037,4 +1054,4 @@ namespace MobileGL {
} // namespace BackendLoader::GLES
} // namespace MG_Util
} // namespace MobileGL
} // namespace MobileGL
@@ -473,7 +473,7 @@ namespace MobileGL {
typedef EGLSurface (*eglCreatePixmapSurface_PTR)(EGLDisplay dpy, EGLConfig config,
EGLNativePixmapType pixmap, const EGLint* attrib_list);
typedef EGLSurface (*eglCreatePlatformWindowSurface_PTR)(EGLDisplay display, EGLConfig config,
void* native_window, const EGLint* attrib_list);
void* native_window, const EGLAttrib* attrib_list);
typedef EGLSurface (*eglCreateWindowSurface_PTR)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win,
const EGLint* attrib_list);
typedef EGLBoolean (*eglDestroyContext_PTR)(EGLDisplay dpy, EGLContext ctx);
@@ -487,7 +487,7 @@ namespace MobileGL {
typedef EGLSurface (*eglGetCurrentSurface_PTR)(EGLint readdraw);
typedef EGLDisplay (*eglGetDisplay_PTR)(EGLNativeDisplayType display_id);
typedef EGLDisplay (*eglGetPlatformDisplay_PTR)(EGLenum platform, void* native_display,
const EGLint* attrib_list);
const EGLAttrib* attrib_list);
typedef EGLint (*eglGetError_PTR)();
typedef __eglMustCastToProperFunctionPointerType (*eglGetProcAddress_PTR)(const char* procname);
typedef EGLBoolean (*eglInitialize_PTR)(EGLDisplay dpy, EGLint* major, EGLint* minor);
@@ -510,6 +510,15 @@ namespace MobileGL {
typedef EGLBoolean (*eglWaitClient_PTR)();
typedef EGLBoolean (*eglWaitGL_PTR)();
typedef EGLBoolean (*eglWaitNative_PTR)(EGLint engine);
typedef EGLSync (*eglCreateSync_PTR)(EGLDisplay dpy, EGLenum type, const EGLAttrib * attrib_list);
typedef EGLBoolean (*eglDestroySync_PTR)(EGLDisplay dpy, EGLSync sync);
typedef EGLint (*eglClientWaitSync_PTR)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
typedef EGLBoolean (*eglGetSyncAttrib_PTR)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib * value);
typedef EGLImage (*eglCreateImage_PTR)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list);
typedef EGLBoolean (*eglDestroyImage_PTR)(EGLDisplay dpy, EGLImage image);
typedef EGLSurface (*eglCreatePlatformPixmapSurface_PTR)(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLAttrib * attrib_list);
typedef EGLBoolean (*eglWaitSync_PTR)(EGLDisplay dpy, EGLSync sync, EGLint flags);
EGL_FUNC_DECL(eglBindAPI)
EGL_FUNC_DECL(eglBindTexImage)
@@ -549,6 +558,14 @@ namespace MobileGL {
EGL_FUNC_DECL(eglWaitClient)
EGL_FUNC_DECL(eglWaitGL)
EGL_FUNC_DECL(eglWaitNative)
EGL_FUNC_DECL(eglCreateSync)
EGL_FUNC_DECL(eglDestroySync)
EGL_FUNC_DECL(eglClientWaitSync)
EGL_FUNC_DECL(eglGetSyncAttrib)
EGL_FUNC_DECL(eglCreateImage)
EGL_FUNC_DECL(eglDestroyImage)
EGL_FUNC_DECL(eglCreatePlatformPixmapSurface)
EGL_FUNC_DECL(eglWaitSync)
}; // namespace EGL
@@ -957,4 +974,4 @@ namespace MobileGL {
} // namespace MobileGL
#define INIT_GLES_FUNC(name) \
{ MG_External::GLES::name = (name##_PTR)ProcAddress(libGLES, #name); }
{ MG_External::GLES::name = (name##_PTR)ProcAddress(libGLES, #name); }
@@ -6,6 +6,7 @@
// End of Source File Header
#include "GLEnumConverter.h"
#include <GL/gl.h>
namespace MobileGL {
namespace MG_Util {