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

Function Tex2D

engine/PoseidonGL33/GL33BindCache.cpp:44–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void Tex2D(int unit, unsigned int tex)
45{
46 ++g_texReq;
47 if (unit >= 0 && unit < kUnits && g_tex[unit] == tex)
48 {
49 ActiveUnit(unit);
50 // B-007 tripwire (active in every build, incl. RWDI/test): the skip is
51 // honest only if GL really holds `tex` on this unit. A mismatch is the
52 // divergence class from a deleted/recycled handle or a bind outside the
53 // cache without Invalidate. Non-fatal: the next non-skip bind
54 // self-corrects. The readback is on the renderer's hottest path, so sample
55 // 1 of every 64 skips per unit — a divergence is persistent (a poisoned
56 // binding stays wrong until rebound), so per-unit sampling still catches it
57 // within a sub-frame while keeping glGetIntegerv off the per-skip path.
58 if ((g_texSkipCtr[unit]++ & 63u) == 0)
59 {
60 GLint live = 0;
61 glGetIntegerv(GL_TEXTURE_BINDING_2D, &live);
62 if (auto v = Poseidon::render::frame::DetectBindCacheDivergence(unit, tex, static_cast<unsigned int>(live)))
63 LOG_ERROR(Graphics, "GL33 [{}] {}", v->ruleId, v->detail);
64 }
65 return;
66 }
67 ActiveUnit(unit);
68 glBindTexture(GL_TEXTURE_2D, tex);
69 if (unit >= 0 && unit < kUnits)
70 g_tex[unit] = tex;
71 ++g_texBind;
72}
73
74void OnVaoDeleted(unsigned int vao)
75{

Callers 10

AUTO_STATIC_ARRAYFunction · 0.85
InitFromRGBAMethod · 0.85
UpdateRGBAMethod · 0.85
RenderCascadeArrayFunction · 0.85
UploadToGPUMethod · 0.85
EmitDrawMethod · 0.85
SetTextureMethod · 0.85
SetMultiTexturingMethod · 0.85
PreResetMethod · 0.85
InitGLMethod · 0.85

Calls 2

ActiveUnitFunction · 0.85

Tested by

no test coverage detected