| 42 | } |
| 43 | |
| 44 | void 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 | |
| 74 | void OnVaoDeleted(unsigned int vao) |
| 75 | { |
no test coverage detected