mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-18 09:08:31 +09:00
[Fix] (MG_Impl/GetProcAddress, Exporting): properly get proc address, clear reliance on dlsym
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user