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

Method TextBankGL33

engine/PoseidonGL33/TextureBankGL33_Core.cpp:47–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47TextBankGL33::TextBankGL33(EngineGL33* engine) : _totalAllocated(0)
48{
49 _reserveTextureMemory = 0;
50 _engine = engine;
51
52 CheckTextureMemory();
53
54 _maxTextureMemory = FreeTextureMemory();
55
56 // Small texture limit: use ~1/8 of texture memory for small textures
57 int limitPixels = _limitAllocatedTextures / (2 * 1024 * 8);
58 int limitPixelsPow2 = 1;
59 while (limitPixelsPow2 + limitPixelsPow2 < limitPixels)
60 {
61 limitPixelsPow2 += limitPixelsPow2;
62 }
63
64 _maxSmallTexturePixels = limitPixelsPow2;
65 saturateMax(_maxSmallTexturePixels, 4 * 4);
66 LOG_DEBUG(Graphics, "GL33 Max small texture pixels: {}, {:.0f}", _maxSmallTexturePixels,
67 sqrt(_maxSmallTexturePixels));
68
69 // Surface texture residency in the memory-budget panel. Textures are the
70 // largest consumer; _totalAllocated is live GPU bytes, _maxTextureMemory the
71 // detected VRAM budget. Observability only — no Free hook (see header).
72 _memProbe.Register(
73 "Textures", 0.5f, [this] { return (size_t)_totalAllocated; }, [this] { return (size_t)_maxTextureMemory; },
74 [this] { return (size_t)_texture.Size(); });
75}
76
77TextBankGL33::~TextBankGL33()
78{

Callers

nothing calls this directly

Calls 4

saturateMaxFunction · 0.85
sqrtFunction · 0.85
RegisterMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected