From d1e60636503b07552e2ea34a062c0919c5ed95e1 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 31 Oct 2021 20:59:20 +0600 Subject: [PATCH] ref_gl: add close_gl4es, fix #258 --- ref_gl/gl_context.c | 5 ++++- ref_gl/gl_opengl.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ref_gl/gl_context.c b/ref_gl/gl_context.c index 89a50d21..c95c0155 100644 --- a/ref_gl/gl_context.c +++ b/ref_gl/gl_context.c @@ -18,6 +18,10 @@ GNU General Public License for more details. #include "gl_local.h" #include "gl_export.h" +#ifdef XASH_GL4ES +#include "gl4es/include/gl4esinit.h" +#endif + ref_api_t gEngfuncs; ref_globals_t *gpGlobals; @@ -337,7 +341,6 @@ qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int offset_x, int static void* GAME_EXPORT R_GetProcAddress( const char *name ) { #ifdef XASH_GL4ES - extern void *gl4es_GetProcAddress( const char *name ); return gl4es_GetProcAddress( name ); #else // TODO: other wrappers return gEngfuncs.GL_GetProcAddress( name ); diff --git a/ref_gl/gl_opengl.c b/ref_gl/gl_opengl.c index 75580da3..9c5f2545 100644 --- a/ref_gl/gl_opengl.c +++ b/ref_gl/gl_opengl.c @@ -1,5 +1,9 @@ #include "gl_local.h" +#if XASH_GL4ES +#include "gl4es/include/gl4esinit.h" +#include "gl4es/include/gl4eshint.h" +#endif // XASH_GL4ES cvar_t *gl_extensions; cvar_t *gl_texture_anisotropy; @@ -648,7 +652,6 @@ void GL_InitExtensionsBigGL( void ) const char *version = pglGetString( GL_VERSION | 0x10000 ); const char *extensions = pglGetString( GL_EXTENSIONS | 0x10000 ); glConfig.wrapper = GLES_WRAPPER_GL4ES; - } // multitexture @@ -991,6 +994,10 @@ void R_Shutdown( void ) Mem_FreePool( &r_temppool ); +#ifdef XASH_GL4ES + close_gl4es(); +#endif // XASH_GL4ES + // shut down OS specific OpenGL stuff like contexts, etc. gEngfuncs.R_Free_Video(); } @@ -1171,8 +1178,6 @@ void GL_SetupAttributes( int safegl ) void wes_init( const char *gles2 ); int nanoGL_Init( void ); #ifdef XASH_GL4ES -#include "gl4es/include/gl4esinit.h" -#include "gl4es/include/gl4eshint.h" void GL4ES_GetMainFBSize( int *width, int *height ) { *width = gpGlobals->width; @@ -1185,7 +1190,6 @@ void *GL4ES_GetProcAddress( const char *name ) return NULL; return gEngfuncs.GL_GetProcAddress( name ); } - #endif void GL_OnContextCreated( void ) @@ -1220,5 +1224,4 @@ void GL_OnContextCreated( void ) // dxt unpacked to 16-bit looks ugly pglHint( GL_AVOID16BITS_HINT_GL4ES, 1 ); #endif - }