[quake3-commits] r1807 - trunk/code/renderer
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Dec 19 13:17:56 EST 2010
Author: tma
Date: 2010-12-19 13:17:56 -0500 (Sun, 19 Dec 2010)
New Revision: 1807
Modified:
trunk/code/renderer/tr_shader.c
Log:
* (bug #4842) Speedup shader buffer creation (Eugene C.)
Modified: trunk/code/renderer/tr_shader.c
===================================================================
--- trunk/code/renderer/tr_shader.c 2010-12-19 17:45:03 UTC (rev 1806)
+++ trunk/code/renderer/tr_shader.c 2010-12-19 18:17:56 UTC (rev 1807)
@@ -2866,7 +2866,6 @@
ri.Printf (PRINT_ALL, "------------------\n");
}
-
/*
====================
ScanAndLoadShaderFiles
@@ -2883,7 +2882,7 @@
char *p;
int numShaderFiles;
int i;
- char *oldp, *token, *hashMem;
+ char *oldp, *token, *hashMem, *textEnd;
int shaderTextHashTableSizes[MAX_SHADERTEXT_HASH], hash, size;
long sum = 0, summand;
@@ -2944,20 +2943,22 @@
// build single large buffer
s_shaderText = ri.Hunk_Alloc( sum + numShaderFiles*2, h_low );
s_shaderText[ 0 ] = '\0';
-
+ textEnd = s_shaderText;
+
// free in reverse order, so the temp files are all dumped
for ( i = numShaderFiles - 1; i >= 0 ; i-- )
{
- if(buffers[i])
- {
- p = &s_shaderText[strlen(s_shaderText)];
- strcat( s_shaderText, buffers[i] );
- ri.FS_FreeFile( buffers[i] );
- COM_Compress(p);
- strcat( s_shaderText, "\n" );
- }
+ if ( !buffers[i] )
+ continue;
+
+ strcat( textEnd, buffers[i] );
+ strcat( textEnd, "\n" );
+ textEnd += strlen( textEnd );
+ ri.FS_FreeFile( buffers[i] );
}
+ COM_Compress( s_shaderText );
+
// free up memory
ri.FS_FreeFileList( shaderFiles );
More information about the quake3-commits
mailing list