Browse Source

ref: add export that returns GL_GetProcAddress for renderapi

pull/2/head
mittorn 5 years ago
parent
commit
8f8c8e6614
  1. 3
      engine/client/cl_render.c
  2. 2
      engine/ref_api.h
  3. 13
      ref_gl/gl_context.c

3
engine/client/cl_render.c

@ -252,7 +252,7 @@ static render_api_t gRenderAPI =
NULL, // GL_TexGen, NULL, // GL_TexGen,
NULL, // GL_TextureTarget, NULL, // GL_TextureTarget,
NULL, // GL_SetTexCoordArrayMode, NULL, // GL_SetTexCoordArrayMode,
GL_GetProcAddress, NULL, // GL_GetProcAddress,
NULL, // GL_UpdateTexSize, NULL, // GL_UpdateTexSize,
NULL, NULL,
NULL, NULL,
@ -309,6 +309,7 @@ static void R_FillRenderAPIFromRef( render_api_t *to, const ref_interface_t *fro
to->GL_DrawParticles = from->GL_DrawParticles; to->GL_DrawParticles = from->GL_DrawParticles;
to->LightVec = from->LightVec; to->LightVec = from->LightVec;
to->StudioGetTexture = from->StudioGetTexture; to->StudioGetTexture = from->StudioGetTexture;
to->GL_GetProcAddress = from->R_GetProcAddress;
} }
/* /*

2
engine/ref_api.h

@ -583,6 +583,8 @@ typedef struct ref_interface_s
void (*R_NewMap)( void ); void (*R_NewMap)( void );
// clear the render entities before each frame // clear the render entities before each frame
void (*R_ClearScene)( void ); void (*R_ClearScene)( void );
// GL_GetProcAddress for client renderer
void* (*R_GetProcAddress)( const char *name );
// TriAPI Interface // TriAPI Interface
// NOTE: implementation isn't required to be compatible // NOTE: implementation isn't required to be compatible

13
ref_gl/gl_context.c

@ -332,6 +332,16 @@ qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int offset_x, int
return ret; return ret;
} }
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 );
#endif
}
static const char *R_GetConfigName( void ) static const char *R_GetConfigName( void )
{ {
return "opengl"; return "opengl";
@ -453,6 +463,7 @@ ref_interface_t gReffuncs =
Mod_GetCurrentVis, Mod_GetCurrentVis,
R_NewMap, R_NewMap,
R_ClearScene, R_ClearScene,
R_GetProcAddress,
TriRenderMode, TriRenderMode,
TriBegin, TriBegin,
@ -503,6 +514,8 @@ void EXPORT GetRefHumanReadableName( char *out, size_t size )
Q_strncpy( out, "GLES1(NanoGL)", size ); Q_strncpy( out, "GLES1(NanoGL)", size );
#elif defined XASH_WES #elif defined XASH_WES
Q_strncpy( out, "GLES2(gl-wes-v2)", size ); Q_strncpy( out, "GLES2(gl-wes-v2)", size );
#elif defined XASH_GL4ES
Q_strncpy( out, "GLES2(gl4es)", size );
#else #else
Q_strncpy( out, "OpenGL", size ); Q_strncpy( out, "OpenGL", size );
#endif #endif

Loading…
Cancel
Save