ref: gl: add stubs for WebGL

This commit is contained in:
yohimik
2025-06-03 20:10:33 +04:00
committed by Alibek Omarov
parent 582fe9a2fc
commit 2234f91c38
2 changed files with 72 additions and 1 deletions

View File

@@ -1714,6 +1714,56 @@ static void APIENTRY stub( void )
*((void **)&pgl ## name) = (void *)stub; \
}
#if XASH_EMSCRIPTEN
static void GL2_PolygonMode( GLenum face, GLenum mode )
{
}
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
void GL2_ShimInstall( void )
{
GL2_OVERRIDE_PTR( Vertex2f )
@@ -1758,6 +1808,20 @@ void GL2_ShimInstall( void )
GL2_OVERRIDE_PTR_B( TexImage2D )
GL2_OVERRIDE_PTR_B( TexParameteri )
}
#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( DrawBuffer )
#endif // XASH_EMSCRIPTEN
GL2_OVERRIDE_PTR_B( IsEnabled )
GL2_OVERRIDE_PTR_B( DrawRangeElements )
GL2_OVERRIDE_PTR_B( DrawElements )

View File

@@ -123,7 +123,7 @@ REFDLLS = [
RefDll('gles1', False, 'NANOGL'),
RefDll('gles2', False, 'GLWES'),
RefDll('gl4es', False),
RefDll('gles3compat', False),
RefDll('gles3compat', False, 'GLES3COMPAT'),
RefDll('null', False),
]
@@ -191,6 +191,9 @@ def options(opt):
grp.add_option('--enable-fuzzer', action = 'store_true', dest = 'ENABLE_FUZZER', default = False,
help = 'enable building libFuzzer runner [default: %(default)s]' )
grp.add_option('--enable-emscripten', action = 'store_true', dest = 'ENABLE_EMSCRIPTEN', default = False,
help = 'enable emscripten support [default: %(default)s]' )
for i in SUBDIRS:
if not i.is_exists(opt):
continue
@@ -252,6 +255,10 @@ def configure(conf):
conf.options.GLES3COMPAT = True
conf.options.GL = False
if conf.options.ENABLE_EMSCRIPTEN:
conf.options.GLES3COMPAT = True
conf.options.GL = False
# psvita needs -fPIC set manually and static builds are incompatible with -fPIC
enforce_pic = conf.env.DEST_OS != 'psvita' and not conf.env.STATIC_LINKING
conf.check_pic(enforce_pic)