Browse Source

ref_gl: move GLES and GL_STATIC defintions to gl_export.h. Add REF_GL_KEEP_MANGLED_FUNCTIONS, to keep use pgl instead of re-defining everything to gl. Used in conjuction with GL_STATIC

pull/2/head
Alibek Omarov 6 years ago
parent
commit
228dab5965
  1. 22
      ref_gl/gl_export.h
  2. 7
      ref_gl/gl_local.h

22
ref_gl/gl_export.h

@ -19,6 +19,12 @@ GNU General Public License for more details. @@ -19,6 +19,12 @@ GNU General Public License for more details.
#define APIENTRY
#endif
#if defined XASH_NANOGL || defined XASH_WES || defined XASH_REGAL
#define XASH_GLES
#define XASH_GL_STATIC
#define REF_GL_KEEP_MANGLED_FUNCTIONS
#endif
typedef uint GLenum;
typedef byte GLboolean;
typedef uint GLbitfield;
@ -861,8 +867,10 @@ typedef float GLmatrix[16]; @@ -861,8 +867,10 @@ typedef float GLmatrix[16];
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#ifdef XASH_GL_STATIC
#if defined( XASH_GL_STATIC ) && !defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
#define GL_FUNCTION( name ) name
#elif defined( XASH_GL_STATIC ) && defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
#define GL_FUNCTION( name ) APIENTRY p##name
#else
#define GL_FUNCTION( name ) (APIENTRY *p##name)
#endif
@ -1308,13 +1316,11 @@ void GL_FUNCTION( glEndQueryARB )(GLenum target); @@ -1308,13 +1316,11 @@ void GL_FUNCTION( glEndQueryARB )(GLenum target);
void GL_FUNCTION( glGetQueryivARB )(GLenum target, GLenum pname, GLint *params);
void GL_FUNCTION( glGetQueryObjectivARB )(GLuint id, GLenum pname, GLint *params);
void GL_FUNCTION( glGetQueryObjectuivARB )(GLuint id, GLenum pname, GLuint *params);
#ifndef XASH_GL_STATIC // can't use gldebug in static
typedef void GL_FUNCTION( glDebugProcARB )( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLcharARB* message, GLvoid* userParam );
typedef void ( APIENTRY *GL_DEBUG_PROC_ARB )( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLcharARB* message, GLvoid* userParam );
void GL_FUNCTION( glDebugMessageControlARB )( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled );
void GL_FUNCTION( glDebugMessageInsertARB )( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* buf );
void GL_FUNCTION( glDebugMessageCallbackARB )( pglDebugProcARB callback, void* userParam );
void GL_FUNCTION( glDebugMessageCallbackARB )( GL_DEBUG_PROC_ARB callback, void* userParam );
GLuint GL_FUNCTION( glGetDebugMessageLogARB )( GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLuint* severities, GLsizei* lengths, char* messageLog );
#endif
GLboolean GL_FUNCTION( glIsRenderbuffer )(GLuint renderbuffer);
void GL_FUNCTION( glBindRenderbuffer )(GLenum target, GLuint renderbuffer);
void GL_FUNCTION( glDeleteRenderbuffers )(GLsizei n, const GLuint *renderbuffers);
@ -1342,7 +1348,7 @@ void GL_FUNCTION( glGenVertexArrays )( GLsizei n, const GLuint *arrays ); @@ -1342,7 +1348,7 @@ void GL_FUNCTION( glGenVertexArrays )( GLsizei n, const GLuint *arrays );
GLboolean GL_FUNCTION( glIsVertexArray )( GLuint array );
void GL_FUNCTION( glSwapInterval ) ( int interval );
#ifdef XASH_GL_STATIC
#if defined( XASH_GL_STATIC ) && !defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
#define pglGetError glGetError
#define pglGetString glGetString
#define pglAccum glAccum
@ -1781,6 +1787,10 @@ void GL_FUNCTION( glSwapInterval ) ( int interval ); @@ -1781,6 +1787,10 @@ void GL_FUNCTION( glSwapInterval ) ( int interval );
#define pglGetQueryivARB glGetQueryivARB
#define pglGetQueryObjectivARB glGetQueryObjectivARB
#define pglGetQueryObjectuivARB glGetQueryObjectuivARB
#define pglDebugMessageControlARB glDebugMessageControlARB
#define pglDebugMessageInsertARB glDebugMessageInsertARB
#define pglDebugMessageCallbackARB glDebugMessageCallbackARB
#define pglGetDebugMessageLogARB glGetDebugMessageLogARB
#define pglIsRenderbuffer glIsRenderbuffer
#define pglBindRenderbuffer glBindRenderbuffer
#define pglDeleteRenderbuffers glDeleteRenderbuffers

7
ref_gl/gl_local.h

@ -20,7 +20,6 @@ GNU General Public License for more details. @@ -20,7 +20,6 @@ GNU General Public License for more details.
#include "cvardef.h"
#include "const.h"
#include "com_model.h"
#include "gl_export.h"
#include "cl_entity.h"
#include "render_api.h"
#include "protocol.h"
@ -33,11 +32,7 @@ GNU General Public License for more details. @@ -33,11 +32,7 @@ GNU General Public License for more details.
#include "com_strings.h"
#include "pm_movevars.h"
//#include "cvar.h"
#if defined XASH_NANOGL || defined XASH_WES || defined XASH_REGAL
#define XASH_GLES
#define XASH_GL_STATIC
#endif
#include "gl_export.h"
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)

Loading…
Cancel
Save