ref_gl: add close_gl4es, fix #258

This commit is contained in:
Alibek Omarov 2021-10-31 20:59:20 +06:00
parent 42db1faa51
commit d1e6063650
2 changed files with 12 additions and 6 deletions

View File

@ -18,6 +18,10 @@ GNU General Public License for more details.
#include "gl_local.h" #include "gl_local.h"
#include "gl_export.h" #include "gl_export.h"
#ifdef XASH_GL4ES
#include "gl4es/include/gl4esinit.h"
#endif
ref_api_t gEngfuncs; ref_api_t gEngfuncs;
ref_globals_t *gpGlobals; 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 ) static void* GAME_EXPORT R_GetProcAddress( const char *name )
{ {
#ifdef XASH_GL4ES #ifdef XASH_GL4ES
extern void *gl4es_GetProcAddress( const char *name );
return gl4es_GetProcAddress( name ); return gl4es_GetProcAddress( name );
#else // TODO: other wrappers #else // TODO: other wrappers
return gEngfuncs.GL_GetProcAddress( name ); return gEngfuncs.GL_GetProcAddress( name );

View File

@ -1,5 +1,9 @@
#include "gl_local.h" #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_extensions;
cvar_t *gl_texture_anisotropy; cvar_t *gl_texture_anisotropy;
@ -648,7 +652,6 @@ void GL_InitExtensionsBigGL( void )
const char *version = pglGetString( GL_VERSION | 0x10000 ); const char *version = pglGetString( GL_VERSION | 0x10000 );
const char *extensions = pglGetString( GL_EXTENSIONS | 0x10000 ); const char *extensions = pglGetString( GL_EXTENSIONS | 0x10000 );
glConfig.wrapper = GLES_WRAPPER_GL4ES; glConfig.wrapper = GLES_WRAPPER_GL4ES;
} }
// multitexture // multitexture
@ -991,6 +994,10 @@ void R_Shutdown( void )
Mem_FreePool( &r_temppool ); Mem_FreePool( &r_temppool );
#ifdef XASH_GL4ES
close_gl4es();
#endif // XASH_GL4ES
// shut down OS specific OpenGL stuff like contexts, etc. // shut down OS specific OpenGL stuff like contexts, etc.
gEngfuncs.R_Free_Video(); gEngfuncs.R_Free_Video();
} }
@ -1171,8 +1178,6 @@ void GL_SetupAttributes( int safegl )
void wes_init( const char *gles2 ); void wes_init( const char *gles2 );
int nanoGL_Init( void ); int nanoGL_Init( void );
#ifdef XASH_GL4ES #ifdef XASH_GL4ES
#include "gl4es/include/gl4esinit.h"
#include "gl4es/include/gl4eshint.h"
void GL4ES_GetMainFBSize( int *width, int *height ) void GL4ES_GetMainFBSize( int *width, int *height )
{ {
*width = gpGlobals->width; *width = gpGlobals->width;
@ -1185,7 +1190,6 @@ void *GL4ES_GetProcAddress( const char *name )
return NULL; return NULL;
return gEngfuncs.GL_GetProcAddress( name ); return gEngfuncs.GL_GetProcAddress( name );
} }
#endif #endif
void GL_OnContextCreated( void ) void GL_OnContextCreated( void )
@ -1220,5 +1224,4 @@ void GL_OnContextCreated( void )
// dxt unpacked to 16-bit looks ugly // dxt unpacked to 16-bit looks ugly
pglHint( GL_AVOID16BITS_HINT_GL4ES, 1 ); pglHint( GL_AVOID16BITS_HINT_GL4ES, 1 );
#endif #endif
} }