MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / EndLevelLoad

Method EndLevelLoad

neo/renderer/Image_init.cpp:2073–2127  ·  view source on GitHub ↗

==================== EndLevelLoad Free all images marked as unused, and load all images that are necessary. This architecture prevents us from having the union of two level's worth of data present at one time. preload everything, never free preload everything, free unused after level load blocking load on demand preload low mip levels, background load remainder on demand ==================== */

Source from the content-addressed store, hash-verified

2071====================
2072*/
2073void idImageManager::EndLevelLoad() {
2074 int start = Sys_Milliseconds();
2075
2076 insideLevelLoad = false;
2077 if ( idAsyncNetwork::serverDedicated.GetInteger() ) {
2078 return;
2079 }
2080
2081 common->Printf( "----- idImageManager::EndLevelLoad -----\n" );
2082
2083 int purgeCount = 0;
2084 int keepCount = 0;
2085 int loadCount = 0;
2086
2087 // purge the ones we don't need
2088 for ( int i = 0 ; i < images.Num() ; i++ ) {
2089 idImage *image = images[ i ];
2090 if ( image->generatorFunction ) {
2091 continue;
2092 }
2093
2094 if ( !image->levelLoadReferenced && !image->referencedOutsideLevelLoad ) {
2095// common->Printf( "Purging %s\n", image->imgName.c_str() );
2096 purgeCount++;
2097 image->PurgeImage();
2098 } else if ( image->texnum != idImage::TEXTURE_NOT_LOADED ) {
2099// common->Printf( "Keeping %s\n", image->imgName.c_str() );
2100 keepCount++;
2101 }
2102 }
2103
2104 // load the ones we do need, if we are preloading
2105 for ( int i = 0 ; i < images.Num() ; i++ ) {
2106 idImage *image = images[ i ];
2107 if ( image->generatorFunction ) {
2108 continue;
2109 }
2110
2111 if ( image->levelLoadReferenced && image->texnum == idImage::TEXTURE_NOT_LOADED && !image->partialImage ) {
2112// common->Printf( "Loading %s\n", image->imgName.c_str() );
2113 loadCount++;
2114 image->ActuallyLoadImage( true, false );
2115
2116 if ( ( loadCount & 15 ) == 0 ) {
2117 session->PacifierUpdate();
2118 }
2119 }
2120 }
2121
2122 int end = Sys_Milliseconds();
2123 common->Printf( "%5i purged from previous\n", purgeCount );
2124 common->Printf( "%5i kept from previous\n", keepCount );
2125 common->Printf( "%5i new loaded\n", loadCount );
2126 common->Printf( "all images loaded in %5.1f seconds\n", (end-start) * 0.001 );
2127}
2128
2129/*
2130===============

Callers

nothing calls this directly

Calls 7

Sys_MillisecondsFunction · 0.85
GetIntegerMethod · 0.80
PurgeImageMethod · 0.80
ActuallyLoadImageMethod · 0.80
PrintfMethod · 0.45
NumMethod · 0.45
PacifierUpdateMethod · 0.45

Tested by

no test coverage detected