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

Method ReserveMemory

engine/PoseidonGL33/TextureBankGL33_Core.cpp:292–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292bool TextBankGL33::ReserveMemory(GL33MipCacheRoot& root, int limit)
293{
294 bool someReleased = false;
295 while (_freeTextures.Size() > 0 && _totalAllocated > limit)
296 {
297 DeleteLastReleased();
298 someReleased = true;
299 }
300 HMipCacheGL33* last = root.Last();
301 while (_totalAllocated > limit)
302 {
303 if (!last)
304 break;
305
306 TextureGL33* texture = last->texture;
307 if (texture->_inUse)
308 {
309 last = root.Prev(last);
310 continue;
311 }
312
313 PoseidonAssert(texture->_cache == last);
314 someReleased = true;
315 texture->ReleaseMemory(false);
316 last = root.Last();
317 }
318 return someReleased;
319}
320
321void TextBankGL33::ReportTextures(const char* name) {}
322

Callers 2

LoadLevelsMethod · 0.80
LoadSmallMethod · 0.80

Calls 4

LastMethod · 0.80
ReleaseMemoryMethod · 0.80
SizeMethod · 0.45
PrevMethod · 0.45

Tested by

no test coverage detected