mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-23 04:12:39 +00:00
* (bug #4842) Speedup shader buffer creation (Eugene C.)
This commit is contained in:
parent
7000b9a315
commit
35c1e98934
1 changed files with 12 additions and 11 deletions
|
@ -2866,7 +2866,6 @@ void R_ShaderList_f (void) {
|
||||||
ri.Printf (PRINT_ALL, "------------------\n");
|
ri.Printf (PRINT_ALL, "------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
ScanAndLoadShaderFiles
|
ScanAndLoadShaderFiles
|
||||||
|
@ -2883,7 +2882,7 @@ static void ScanAndLoadShaderFiles( void )
|
||||||
char *p;
|
char *p;
|
||||||
int numShaderFiles;
|
int numShaderFiles;
|
||||||
int i;
|
int i;
|
||||||
char *oldp, *token, *hashMem;
|
char *oldp, *token, *hashMem, *textEnd;
|
||||||
int shaderTextHashTableSizes[MAX_SHADERTEXT_HASH], hash, size;
|
int shaderTextHashTableSizes[MAX_SHADERTEXT_HASH], hash, size;
|
||||||
|
|
||||||
long sum = 0, summand;
|
long sum = 0, summand;
|
||||||
|
@ -2944,20 +2943,22 @@ static void ScanAndLoadShaderFiles( void )
|
||||||
// build single large buffer
|
// build single large buffer
|
||||||
s_shaderText = ri.Hunk_Alloc( sum + numShaderFiles*2, h_low );
|
s_shaderText = ri.Hunk_Alloc( sum + numShaderFiles*2, h_low );
|
||||||
s_shaderText[ 0 ] = '\0';
|
s_shaderText[ 0 ] = '\0';
|
||||||
|
textEnd = s_shaderText;
|
||||||
|
|
||||||
// free in reverse order, so the temp files are all dumped
|
// free in reverse order, so the temp files are all dumped
|
||||||
for ( i = numShaderFiles - 1; i >= 0 ; i-- )
|
for ( i = numShaderFiles - 1; i >= 0 ; i-- )
|
||||||
{
|
{
|
||||||
if(buffers[i])
|
if ( !buffers[i] )
|
||||||
{
|
continue;
|
||||||
p = &s_shaderText[strlen(s_shaderText)];
|
|
||||||
strcat( s_shaderText, buffers[i] );
|
strcat( textEnd, buffers[i] );
|
||||||
ri.FS_FreeFile( buffers[i] );
|
strcat( textEnd, "\n" );
|
||||||
COM_Compress(p);
|
textEnd += strlen( textEnd );
|
||||||
strcat( s_shaderText, "\n" );
|
ri.FS_FreeFile( buffers[i] );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COM_Compress( s_shaderText );
|
||||||
|
|
||||||
// free up memory
|
// free up memory
|
||||||
ri.FS_FreeFileList( shaderFiles );
|
ri.FS_FreeFileList( shaderFiles );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue