Split Rend2's printing OpenGL extensions string (> 1024 characters) into separate function and merged into opengl1 renderer. (Fixes bug #5559.)

This commit is contained in:
Zack Middleton 2012-10-26 07:23:49 +00:00
parent 64ed856dfd
commit 3dfd2dac7e
2 changed files with 48 additions and 23 deletions

View file

@ -944,6 +944,27 @@ void GL_SetDefaultState( void )
qglDisable( GL_BLEND ); qglDisable( GL_BLEND );
} }
/*
================
R_PrintLongString
Workaround for ri.Printf's 1024 characters buffer limit.
================
*/
void R_PrintLongString(const char *string) {
char buffer[1024];
const char *p;
int size = strlen(string);
p = string;
while(size > 0)
{
Q_strncpyz(buffer, p, sizeof (buffer) );
ri.Printf( PRINT_ALL, "%s", buffer );
p += 1023;
size -= 1023;
}
}
/* /*
================ ================
@ -966,28 +987,9 @@ void GfxInfo_f( void )
ri.Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string ); ri.Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string );
ri.Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string ); ri.Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string );
ri.Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string ); ri.Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string );
// this was really bugging me ri.Printf( PRINT_ALL, "GL_EXTENSIONS: " );
if (strlen(glConfig.extensions_string) > 1008) R_PrintLongString( glConfig.extensions_string );
{ ri.Printf( PRINT_ALL, "\n" );
char buffer[1024];
char *p;
int size = strlen(glConfig.extensions_string);
ri.Printf( PRINT_ALL, "GL_EXTENSIONS: ");
p = glConfig.extensions_string;
while(size > 0)
{
Q_strncpyz(buffer, p, 1024);
ri.Printf( PRINT_ALL, "%s", buffer );
p += 1023;
size -= 1023;
}
ri.Printf( PRINT_ALL, "\n" );
}
else
{
ri.Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
}
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize ); ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits ); ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits );
ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits ); ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );

View file

@ -879,6 +879,27 @@ void GL_SetDefaultState( void )
qglDisable( GL_BLEND ); qglDisable( GL_BLEND );
} }
/*
================
R_PrintLongString
Workaround for ri.Printf's 1024 characters buffer limit.
================
*/
void R_PrintLongString(const char *string) {
char buffer[1024];
const char *p;
int size = strlen(string);
p = string;
while(size > 0)
{
Q_strncpyz(buffer, p, sizeof (buffer) );
ri.Printf( PRINT_ALL, "%s", buffer );
p += 1023;
size -= 1023;
}
}
/* /*
================ ================
@ -901,7 +922,9 @@ void GfxInfo_f( void )
ri.Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string ); ri.Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string );
ri.Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string ); ri.Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string );
ri.Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string ); ri.Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string );
ri.Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", glConfig.extensions_string ); ri.Printf( PRINT_ALL, "GL_EXTENSIONS: " );
R_PrintLongString( glConfig.extensions_string );
ri.Printf( PRINT_ALL, "\n" );
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize ); ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits ); ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits );
ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits ); ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );