COREGL_ERR("GL symbol missing! Check client version!\n");
}
+#define FINDSYM(libhandle, getproc, dst, sym) \
+ if (!dst || (void *)dst == (void *)_sym_missing) \
+ if (getproc) dst = (__typeof__(dst))getproc(sym); \
+ if (!dst || (void *)dst == (void *)_sym_missing) \
+ dst = (__typeof__(dst))dlsym(libhandle, sym); \
+ if (!dst) dst = (__typeof__(dst))_sym_missing;
+
static int
_glue_sym_init(void)
{
-#define FINDSYM(libhandle, getproc, dst, sym) \
- if ((!dst) && (getproc)) dst = (__typeof__(dst))getproc(sym); \
- if (!dst) dst = (__typeof__(dst))dlsym(libhandle, sym);
-
-#define FALLBAK(dst) \
- if (!dst) { dst = (__typeof__(dst))_sym_missing; }
-
#define _COREGL_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST) \
- FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME); \
- if (IS_EXTENSION == GL_TRUE) { \
- FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME"EXT"); \
- FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME"KHR"); \
- } else { FALLBAK(_sym_##FUNC_NAME); }
+ FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME);
+#define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME) \
+ FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##ALIAS_NAME, #FUNC_NAME);
+
#include "headers/sym_egl.h"
-#undef _COREGL_SYMBOL
-#undef FINDSYM
-#undef FALLBAK
+#undef _COREGL_EXT_SYMBOL_ALIAS
+#undef _COREGL_SYMBOL
return 1;
}
_gl_sym_init(void)
{
-#define FINDSYM(libhandle, getproc, dst, sym) \
- if ((!dst) && (getproc)) dst = (__typeof__(dst))getproc(sym); \
- if (!dst) dst = (__typeof__(dst))dlsym(gl_lib_handle, sym);
-#define FALLBAK(dst) \
- if (!dst) { dst = (__typeof__(dst))_sym_missing; }
-
#define _COREGL_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST) \
- FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME); \
- if (IS_EXTENSION == GL_TRUE) { \
- FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME"EXT"); \
- FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME"OES"); \
- } else { FALLBAK(_sym_##FUNC_NAME); }
+ FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME);
+#define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME) \
+ FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##ALIAS_NAME, #FUNC_NAME);
+
#include "headers/sym_gl.h"
-#undef _COREGL_SYMBOL
-#undef FINDSYM
-#undef FALLBAK
+#undef _COREGL_EXT_SYMBOL_ALIAS
+#undef _COREGL_SYMBOL
return 1;
}
+#undef FINDSYM
+
+
COREGL_API void coregl_symbol_exported()
{
COREGL_ERR("\E[40;31;1mInvalid library link! (Check linkage of libCOREGL)\E[0m\n");
/* ES 3.0 BLOCK */
COREGL_OVERRIDE(fastpath_, glReadBuffer);
COREGL_OVERRIDE(fastpath_, glDrawRangeElements);
- COREGL_OVERRIDE(fastpath_, glTexImage3D);
- COREGL_OVERRIDE(fastpath_, glTexSubImage3D);
- COREGL_OVERRIDE(fastpath_, glCopyTexSubImage3D);
- COREGL_OVERRIDE(fastpath_, glCompressedTexImage3D);
- COREGL_OVERRIDE(fastpath_, glCompressedTexSubImage3D);
COREGL_OVERRIDE(fastpath_, glGenQueries);
COREGL_OVERRIDE(fastpath_, glDeleteQueries);
COREGL_OVERRIDE(fastpath_, glIsQuery);
COREGL_OVERRIDE(fastpath_, glUniformMatrix4x2fv);
COREGL_OVERRIDE(fastpath_, glUniformMatrix3x4fv);
COREGL_OVERRIDE(fastpath_, glUniformMatrix4x3fv);
- COREGL_OVERRIDE(fastpath_, glBlitFramebuffer);
- COREGL_OVERRIDE(fastpath_, glRenderbufferStorageMultisample);
COREGL_OVERRIDE(fastpath_, glFramebufferTextureLayer);
COREGL_OVERRIDE(fastpath_, glMapBufferRange);
COREGL_OVERRIDE(fastpath_, glFlushMappedBufferRange);
COREGL_OVERRIDE(fastpath_, glGetProgramBinary); // OPEN
COREGL_OVERRIDE(fastpath_, glProgramBinary); // OPEN
COREGL_OVERRIDE(fastpath_, glProgramParameteri);
- COREGL_OVERRIDE(fastpath_, glInvalidateFramebuffer);
COREGL_OVERRIDE(fastpath_, glInvalidateSubFramebuffer);
COREGL_OVERRIDE(fastpath_, glTexStorage2D);
COREGL_OVERRIDE(fastpath_, glTexStorage3D);
}
void
-fastpath_glTexImage3D(GLenum target, GLint level, GLint GLinternalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glTexImage3D(target, level, GLinternalFormat, width, height, depth, border, format, type, pixels);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
-fastpath_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
-fastpath_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
-fastpath_glCompressedTexImage3D(GLenum target, GLint level, GLenum GLinternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glCompressedTexImage3D(target, level, GLinternalformat, width, height, depth, border, imageSize, data);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
-fastpath_glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
fastpath_glGenQueries(GLsizei n, GLuint* ids)
{
_COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
}
void
-fastpath_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
-fastpath_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-
-}
-
-void
fastpath_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
_COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
}
void
-fastpath_glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
-{
- _COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
- _orig_fastpath_glInvalidateFramebuffer(target, numAttachments, attachments);
-
- goto finish;
-
-finish:
- _COREGL_FASTPATH_FUNC_END();
-}
-
-void
fastpath_glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
{
_COREGL_FASTPATH_FUNC_BEGIN(); SIGILL_ERROR(); // BLOCK API
#include <stdio.h>
#include <dlfcn.h>
-// Include GL/EGL/GLX types
# include <EGL/eglplatform.h>
# include "../headers/egl.h"
#undef _COREGL_SYMBOL
#define _COREGL_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST) RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST = NULL;
+#define _COREGL_EXT_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST)
# include "../headers/sym_egl.h"
+#undef _COREGL_EXT_SYMBOL
#undef _COREGL_SYMBOL
#define INIT_EXPORT()
#undef _COREGL_SYMBOL
#define _COREGL_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST) RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST = NULL;
+#define _COREGL_EXT_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST)
# include "../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL
#undef _COREGL_SYMBOL
#define INIT_EXPORT()
LOGE("\E[40;31;1mCan't find a symbol '%s'!\E[0m\n\n", #FUNC_NAME); \
LOGE("\E[40;31;1mInvalid library link! (Check linkage of libGLESv2 -> libCOREGL)\E[0m\n"); \
}
+
+#define _COREGL_EXT_SYMBOL(IS_EXTENSION, RET_TYPE, FUNC_NAME, PARAM_LIST)
#include "../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL
#undef _COREGL_SYMBOL
return 1;