Allow precaching image manually with r_precacheimages

This commit is contained in:
smallmodel 2024-08-07 20:01:38 +02:00
parent d22dea5e8e
commit 7b59f07181
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
3 changed files with 16 additions and 6 deletions

View file

@ -1294,7 +1294,7 @@ was there. This is used to test for texture thrashing.
Also called by RE_EndRegistration
===============
*/
void RB_ShowImages( void ) {
void RB_ShowImages( qboolean quiet ) {
int i;
image_t *image;
float x, y, w, h;
@ -1340,8 +1340,10 @@ void RB_ShowImages( void ) {
qglFinish();
end = ri.Milliseconds();
ri.Printf( PRINT_ALL, "%i msec to draw all images\n", end - start );
if (!quiet) {
ri.Printf(PRINT_ALL, "%i msec to draw all images\n", end - start);
}
}
@ -1361,7 +1363,7 @@ const void *RB_SwapBuffers( const void *data ) {
// texture swapping test
if ( r_showImages->integer ) {
RB_ShowImages();
RB_ShowImages(qfalse);
}
cmd = (const swapBuffersCommand_t *)data;

View file

@ -1602,8 +1602,16 @@ Touch all images to make sure they are resident
*/
void RE_EndRegistration( void ) {
R_SyncRenderThread();
if (!Sys_LowPhysicalMemory()) {
RB_ShowImages();
if (r_precacheimages->integer) {
int start, end;
start = Sys_Milliseconds();
RB_ShowImages(qtrue);
end = Sys_Milliseconds();
Com_Printf("RB_ShowImages: %5.2f seconds\n", (float)((end - start) / 1000.f));
}
}

View file

@ -1902,7 +1902,7 @@ void RB_StageIteratorLightmappedMultitextureUnfogged( void );
void RB_AddQuadStamp( vec3_t origin, vec3_t left, vec3_t up, byte *color );
void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 );
void RB_ShowImages( void );
void RB_ShowImages( qboolean quiet );
/*