ref_gl: fix codestyle

This commit is contained in:
mittorn 2023-10-15 04:30:18 +03:00 committed by Alibek Omarov
parent ddf3f2ffdb
commit a2b992d865
2 changed files with 59 additions and 39 deletions

View File

@ -1083,9 +1083,9 @@ static void GL_TextureImageRAW( gl_texture_t *tex, GLint side, GLint level, GLin
samplesCount = 1;
}
pglTexImage2DMultisample( tex->target, samplesCount, tex->format, width, height, GL_TRUE );
#else /* !XASH_GLES && !XASH_GL4ES */
#else /* !XASH_GL_STATIC !XASH_GLES && !XASH_GL4ES */
gEngfuncs.Con_Printf( S_ERROR "GLES renderer don't support GL_TEXTURE_2D_MULTISAMPLE!\n" );
#endif /* !XASH_GLES && !XASH_GL4ES */
#endif /* !XASH_GL_STATIC !XASH_GLES && !XASH_GL4ES */
}
else // 2D or RECT
{

View File

@ -334,6 +334,19 @@ static dllfunc_t shaderobjectsfuncs[] =
{ NULL, NULL }
};
/*
==================
Even if *ARB functions may work in GL driver in Core context,
renderdoc completely ignores this calls, so we cannot workaround this
by removing ARB suffix after failed function resolve
I desided not to remove ARB suffix from function declarations because
it historicaly related to ARB_shader_object extension, not GL2+ functions
and all shader code from XashXT/ancient xash3d uses it too
Commented out lines left there intentionally to prevent usage on core/gles
==================
*/
static dllfunc_t shaderobjectsfuncs_gles[] =
{
{ "glDeleteShader" , (void **)&pglDeleteObjectARB },
@ -384,9 +397,11 @@ static dllfunc_t shaderobjectsfuncs_gles[] =
{ "glVertexAttrib2f" , (void **)&pglVertexAttrib2fARB },
{ "glVertexAttrib2fv" , (void **)&pglVertexAttrib2fvARB },
{ "glVertexAttrib3fv" , (void **)&pglVertexAttrib3fvARB },
{ "glGetProgramiv" , (void**)&pglGetProgramiv },
{ "glDeleteProgram" , (void**)&pglDeleteProgram },
{ "glGetProgramInfoLog" , (void **)&pglGetProgramInfoLog },
// Core/GLES only
{ GL_CALL( glGetProgramiv ) },
{ GL_CALL( glDeleteProgram ) },
{ GL_CALL( glGetProgramInfoLog ) },
//{ "glVertexAttrib4f" , (void **)&pglVertexAttrib4fARB },
//{ "glVertexAttrib4fv" , (void **)&pglVertexAttrib4fvARB },
//{ "glVertexAttrib4ubv" , (void **)&pglVertexAttrib4ubvARB },
@ -395,10 +410,10 @@ static dllfunc_t shaderobjectsfuncs_gles[] =
static dllfunc_t vaofuncs[] =
{
{ "glBindVertexArray" , (void **)&pglBindVertexArray },
{ "glDeleteVertexArrays" , (void **)&pglDeleteVertexArrays },
{ "glGenVertexArrays" , (void **)&pglGenVertexArrays },
{ "glIsVertexArray" , (void **)&pglIsVertexArray },
{ GL_CALL( glBindVertexArray ) },
{ GL_CALL( glDeleteVertexArrays ) },
{ GL_CALL( glGenVertexArrays ) },
{ GL_CALL( glIsVertexArray ) },
{ NULL, NULL }
};
@ -541,9 +556,11 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char
if(str)
{
string name;
Q_strncpy( name, func->name, MAX_STRING );
name[str - func->name] = '\0';
*func->func = gEngfuncs.GL_GetProcAddress( name );
if( !*func->func )
GL_SetExtension( r_ext, false );
}
@ -750,13 +767,14 @@ void GL_InitExtensionsGLES( void )
break;
case GL_ARB_MULTITEXTURE:
if( !GL_CheckExtension( "multitexture", multitexturefuncs, "gl_arb_multitexture", GL_ARB_MULTITEXTURE, 1.0 ) && glConfig.wrapper == GLES_WRAPPER_NONE )
{
#ifndef XASH_GL_STATIC
if( !GL_CheckExtension( "multitexture_es1", multitexturefuncs_es, "gl_arb_multitexture", GL_ARB_MULTITEXTURE, 1.0 ) )
if( !GL_CheckExtension( "multitexture_es2", multitexturefuncs_es2, "gl_arb_multitexture", GL_ARB_MULTITEXTURE, 2.0 ) )
#else
if( !GL_CheckExtension( "multitexture_es1", multitexturefuncs_es, "gl_arb_multitexture", GL_ARB_MULTITEXTURE, 1.0 )
&& !GL_CheckExtension( "multitexture_es2", multitexturefuncs_es2, "gl_arb_multitexture", GL_ARB_MULTITEXTURE, 2.0 ))
break;
#endif
//GL_SetExtension( extid, true ); // required to be supported by wrapper
}
GL_SetExtension( extid, true ); // required to be supported by wrapper
pglGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &glConfig.max_texture_units );
if( glConfig.max_texture_units <= 1 )
@ -791,7 +809,7 @@ void GL_InitExtensionsGLES( void )
break;
case GL_ARB_VERTEX_ARRAY_OBJECT_EXT:
if( !GL_CheckExtension( "GL_OES_vertex_array_object", vaofuncs, "gl_vertex_array_object", extid, 3.0 ))
!GL_CheckExtension( "GL_EXT_vertex_array_object", vaofuncs, "gl_vertex_array_object", extid, 3.0 );
GL_CheckExtension( "GL_EXT_vertex_array_object", vaofuncs, "gl_vertex_array_object", extid, 3.0 );
break;
case GL_DRAW_RANGEELEMENTS_EXT:
if( !GL_CheckExtension( "GL_EXT_draw_range_elements", drawrangeelementsfuncs, "gl_drawrangeelements", extid, 3.0 ))
@ -1035,13 +1053,15 @@ void GL_InitExtensions( void )
pglGetIntegerv( GL_NUM_EXTENSIONS, &n );
if( n && pglGetStringi )
{
int i;
int len = 1;
int i, len = 1;
char *str;
for( i = 0; i < n; i++ )
len += Q_strlen((const char *)pglGetStringi( GL_EXTENSIONS, i )) + 1;
str = (char*)Mem_Calloc( r_temppool, len );
glConfig.extensions_string = str;
for( i = 0; i < n; i++ )
{
int l = Q_strncpy( str, pglGetStringi( GL_EXTENSIONS, i ), len );