MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ForceReloadAll

Method ForceReloadAll

engine/PoseidonGL33/TextureBankGL33_Cache.cpp:262–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 DeleteLastReleased();
261 }
262}
263
264void TextBankGL33::ForceReloadAll()
265{
266 // Drop GPU handles + cached headers + decoded source for every
267 // disk-backed texture so the next bind re-reads from disk. Skip
268 // dynamic textures (no ITextureSource — font glyph atlas pages,
269 // CreateDynamic / InitFromRGBA callers): clearing _initialized on
270 // them routes the next bind through DoLoadHeaders, which then
271 // PAA-decodes whatever raw RGBA was uploaded and fails in pactext.
272 // Only safe to call when nothing is mid-render.
273 int dropped = 0;
274 int skipped = 0;
275 for (int i = 0; i < _texture.Size(); i++)
276 {
277 TextureGL33* tex = _texture[i];
278 if (!tex)
279 continue;
280 if (!tex->_src)
281 {
282 ++skipped;
283 continue;
284 }
285 tex->ReleaseMemory(false);
286 tex->ReleaseSmall(false);
287 tex->_src = nullptr;
288 tex->_initialized = false;
289 tex->_levelLoaded = MAX_MIPMAPS;
290 tex->_smallLoaded = MAX_MIPMAPS;
291 tex->_levelNeededThisFrame = MAX_MIPMAPS;
292 tex->_levelNeededLastFrame = MAX_MIPMAPS;
293 ++dropped;
294 }
295 LOG_INFO(Graphics, "TextBankGL33::ForceReloadAll: dropped {} textures, kept {} dynamic", dropped, skipped);
296}
297

Callers

nothing calls this directly

Calls 3

ReleaseMemoryMethod · 0.80
ReleaseSmallMethod · 0.80
SizeMethod · 0.45

Tested by

no test coverage detected