Skip to content

Commit

Permalink
Generalized declaration of DECL_GLPROC for GL extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBanana committed Jul 29, 2023
1 parent f77f40e commit a167622
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 38 deletions.
5 changes: 3 additions & 2 deletions sources/Renderer/OpenGL/GLCoreProfile/GLCoreExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ namespace LLGL
{


#define LLGL_DEF_GL_EXT_PROCS
#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
PFNTYPE NAME = nullptr

// Include inline header for object definitions
#include "GLCoreExtensionsDecl.inl"

#undef LLGL_DEF_GL_EXT_PROCS
#undef DECL_GLPROC


} // /namespace LLGL
Expand Down
6 changes: 6 additions & 0 deletions sources/Renderer/OpenGL/GLCoreProfile/GLCoreExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ namespace LLGL
{



#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
extern PFNTYPE NAME

// Include inline header for object declarations
#include "GLCoreExtensionsDecl.inl"

#undef DECL_GLPROC


} // /namespace LLGL

Expand Down
34 changes: 2 additions & 32 deletions sources/Renderer/OpenGL/GLCoreProfile/GLCoreExtensionsDecl.inl
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,11 @@

// THIS FILE MUST NOT HAVE A HEADER GUARD

/*
All OpenGL extension functions are declared here.
Depending on the following macros being defined, the respective implementation is enabled:
- LLGL_DEF_GL_PROXY_PROCS: defines the proxy functions for potentially unsupported GL extensions
- LLGL_DECL_GL_PROXY_PROCS: declares the proxy functions for potentially unsupported GL extensions
- LLGL_DEF_GL_EXT_PROCS: defines the global function pointer for GL extensions
- None: declares the global function pointer for GL extensions
*/


#ifndef __APPLE__

#if defined LLGL_DEF_GL_PROXY_PROCS

#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
RTYPE APIENTRY Proxy_##NAME ARGS \
{ \
ErrUnsupportedGLProc(#NAME); \
}

#elif defined LLGL_DECL_GL_PROXY_PROCS

#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
RTYPE APIENTRY Proxy_##NAME ARGS

#elif defined LLGL_DEF_GL_EXT_PROCS

#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
PFNTYPE NAME = nullptr

#else

#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
extern PFNTYPE NAME

#ifndef DECL_GLPROC
#error Missing definition of macro DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS)
#endif

/* Platform specific GL extensions */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ namespace LLGL
{


#define LLGL_DEF_GL_PROXY_PROCS
#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
RTYPE APIENTRY Proxy_##NAME ARGS \
{ \
ErrUnsupportedGLProc(#NAME); \
}

// Include inline header for proxy function definitions
#include "GLCoreExtensionsDecl.inl"

#undef LLGL_DEF_GL_PROXY_PROCS
#undef DECL_GLPROC


} // /namespace LLGL
Expand Down
5 changes: 3 additions & 2 deletions sources/Renderer/OpenGL/GLCoreProfile/GLCoreExtensionsProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ namespace LLGL
{


#define LLGL_DECL_GL_PROXY_PROCS
#define DECL_GLPROC(PFNTYPE, NAME, RTYPE, ARGS) \
RTYPE APIENTRY Proxy_##NAME ARGS

// Include inline header for proxy function declarations
#include "GLCoreExtensionsDecl.inl"

#undef LLGL_DECL_GL_PROXY_PROCS
#undef DECL_GLPROC


} // /namespace LLGL
Expand Down

0 comments on commit a167622

Please sign in to comment.