ref: gles3compat: Fix crashes on stubs under windows, probably due to signature missmatch

This commit is contained in:
lewa_j 2025-07-27 01:20:20 +03:00 committed by a1batross
parent af69df15e1
commit ae2808dff7

View File

@ -1704,64 +1704,54 @@ static void APIENTRY GL2_ClientActiveTextureARB( GLenum tex )
pgl ## name = GL2_ ## name; \ pgl ## name = GL2_ ## name; \
} }
static void APIENTRY stub( void ) static void APIENTRY GL2_Normal3fv(const GLfloat *v)
{ {
;
} }
#define GL2_STUB( name ) \ static void APIENTRY GL2_Hint(GLenum target, GLenum mode)
{ \ {
*((void **)&pgl ## name) = (void *)stub; \ }
static void APIENTRY GL2_Scalef(GLfloat x, GLfloat y, GLfloat z)
{
}
static void APIENTRY GL2_Translatef(GLfloat x, GLfloat y, GLfloat z)
{
}
static void APIENTRY GL2_TexEnvi(GLenum target, GLenum pname, GLint param)
{
}
static void APIENTRY GL2_TexEnvf(GLenum target, GLenum pname, GLfloat param)
{
}
static void APIENTRY GL2_Fogi(GLenum pname, GLint param)
{
}
static void APIENTRY GL2_ShadeModel(GLenum mode)
{
}
static void APIENTRY GL2_PolygonMode(GLenum face, GLenum mode)
{
}
static void APIENTRY GL2_PointSize(GLfloat size)
{
}
static void APIENTRY GL2_DrawBuffer(GLenum mode)
{
} }
#if XASH_EMSCRIPTEN #if XASH_EMSCRIPTEN
static void GL2_PolygonMode( GLenum face, GLenum mode )
{
}
static void GL2_PolygonOffset( GLfloat factor, GLfloat units ) static void GL2_PolygonOffset( GLfloat factor, GLfloat units )
{ {
} }
static void GL2_ShadeModel( GLenum mode )
{
}
static void GL2_PointSize( GLfloat size )
{
}
static void GL2_Normal3fv( const GLfloat *v )
{
}
static void GL2_Hint( GLenum target, GLenum mode )
{
}
static void GL2_Scalef( GLfloat x, GLfloat y, GLfloat z )
{
}
static void GL2_Translatef( GLfloat x, GLfloat y, GLfloat z )
{
}
static void GL2_TexEnvi( GLenum target, GLenum pname, GLint param )
{
}
static void GL2_TexEnvf( GLenum target, GLenum pname, GLfloat param )
{
}
static void GL2_Fogi( GLenum pname, GLint param )
{
}
static void GL2_DrawBuffer( GLenum mode )
{
}
#endif // XASH_EMSCRIPTEN #endif // XASH_EMSCRIPTEN
void GL2_ShimInstall( void ) void GL2_ShimInstall( void )
@ -1773,13 +1763,13 @@ void GL2_ShimInstall( void )
GL2_OVERRIDE_PTR( Color4f ) GL2_OVERRIDE_PTR( Color4f )
GL2_OVERRIDE_PTR( Color4ub ) GL2_OVERRIDE_PTR( Color4ub )
GL2_OVERRIDE_PTR( Color4ubv ) GL2_OVERRIDE_PTR( Color4ubv )
GL2_STUB( Normal3fv ) GL2_OVERRIDE_PTR( Normal3fv )
GL2_OVERRIDE_PTR( TexCoord2f ) GL2_OVERRIDE_PTR( TexCoord2f )
GL2_OVERRIDE_PTR( MultiTexCoord2f ) GL2_OVERRIDE_PTR( MultiTexCoord2f )
GL2_OVERRIDE_PTR( AlphaFunc ) GL2_OVERRIDE_PTR( AlphaFunc )
GL2_OVERRIDE_PTR( Fogf ) GL2_OVERRIDE_PTR( Fogf )
GL2_OVERRIDE_PTR( Fogfv ) GL2_OVERRIDE_PTR( Fogfv )
GL2_STUB( Hint ) // fog GL2_OVERRIDE_PTR( Hint ) // fog
GL2_OVERRIDE_PTR( Begin ) GL2_OVERRIDE_PTR( Begin )
GL2_OVERRIDE_PTR( End ) GL2_OVERRIDE_PTR( End )
GL2_OVERRIDE_PTR_B( Enable ) GL2_OVERRIDE_PTR_B( Enable )
@ -1788,20 +1778,20 @@ void GL2_ShimInstall( void )
GL2_OVERRIDE_PTR( LoadIdentity ) GL2_OVERRIDE_PTR( LoadIdentity )
GL2_OVERRIDE_PTR( Ortho ) GL2_OVERRIDE_PTR( Ortho )
GL2_OVERRIDE_PTR( LoadMatrixf ) GL2_OVERRIDE_PTR( LoadMatrixf )
GL2_STUB( Scalef ) GL2_OVERRIDE_PTR( Scalef )
GL2_STUB( Translatef ) GL2_OVERRIDE_PTR( Translatef )
GL2_STUB( TexEnvi ) GL2_OVERRIDE_PTR( TexEnvi )
GL2_STUB( TexEnvf ) GL2_OVERRIDE_PTR( TexEnvf )
GL2_OVERRIDE_PTR( ClientActiveTextureARB ) GL2_OVERRIDE_PTR( ClientActiveTextureARB )
//GL2_OVERRIDE_PTR( ActiveTextureARB ) //GL2_OVERRIDE_PTR( ActiveTextureARB )
GL2_STUB( Fogi ) GL2_OVERRIDE_PTR( Fogi )
GL2_STUB( ShadeModel ) GL2_OVERRIDE_PTR( ShadeModel )
#ifdef XASH_GLES #ifdef XASH_GLES
_pglDepthRangef = gEngfuncs.GL_GetProcAddress( "glDepthRangef" ); _pglDepthRangef = gEngfuncs.GL_GetProcAddress( "glDepthRangef" );
GL2_STUB( PolygonMode ) GL2_OVERRIDE_PTR( PolygonMode )
GL2_STUB( PointSize ) GL2_OVERRIDE_PTR( PointSize )
GL2_OVERRIDE_PTR( DepthRange ) GL2_OVERRIDE_PTR( DepthRange )
GL2_STUB( DrawBuffer ) GL2_OVERRIDE_PTR( DrawBuffer )
#endif #endif
if( glConfig.context != CONTEXT_TYPE_GL ) if( glConfig.context != CONTEXT_TYPE_GL )
{ {
@ -1809,18 +1799,7 @@ void GL2_ShimInstall( void )
GL2_OVERRIDE_PTR_B( TexParameteri ) GL2_OVERRIDE_PTR_B( TexParameteri )
} }
#if XASH_EMSCRIPTEN #if XASH_EMSCRIPTEN
GL2_OVERRIDE_PTR( Normal3fv )
GL2_OVERRIDE_PTR( Hint )
GL2_OVERRIDE_PTR( Scalef )
GL2_OVERRIDE_PTR( Translatef )
GL2_OVERRIDE_PTR( TexEnvi )
GL2_OVERRIDE_PTR( TexEnvf )
GL2_OVERRIDE_PTR( Fogi )
GL2_OVERRIDE_PTR( ShadeModel )
GL2_OVERRIDE_PTR( PolygonMode )
GL2_OVERRIDE_PTR( PointSize )
GL2_OVERRIDE_PTR( PolygonOffset ) GL2_OVERRIDE_PTR( PolygonOffset )
GL2_OVERRIDE_PTR( DrawBuffer )
#endif // XASH_EMSCRIPTEN #endif // XASH_EMSCRIPTEN
GL2_OVERRIDE_PTR_B( IsEnabled ) GL2_OVERRIDE_PTR_B( IsEnabled )
GL2_OVERRIDE_PTR_B( DrawRangeElements ) GL2_OVERRIDE_PTR_B( DrawRangeElements )