[Test] (Pipe): reproduce the texture, framebuffer, renderbuffer, sampler, view and program handle ABA through public GL and prove the pre-rekey guards are what stops it

This commit is contained in:
2026-09-08 19:08:12 -04:00
parent 4399976942
commit 11044b990f
5 changed files with 1229 additions and 47 deletions
@@ -20,11 +20,24 @@ namespace MGITest {
#if defined(MGITEST_PIPE_SLOT_PEEK_LIVE)
namespace {
// One arm per member, and NO `default:` on purpose: adding a PipeSlotKind without
// deciding which MGPipeKind it names is a compiler warning here (-Wswitch) rather than
// a row that silently counts VertexElementsCso and reports "did not leak" about a kind
// it never looked at. The trailing return is the unreachable one the compiler needs.
MobileGL::MG_Pipe::MGPipeKind Translate(PipeSlotKind kind) {
switch (kind) {
case PipeSlotKind::Buffer: return MobileGL::MG_Pipe::MGPipeKind::Buffer;
default: return MobileGL::MG_Pipe::MGPipeKind::VertexElementsCso;
case PipeSlotKind::VertexElementsCso:
return MobileGL::MG_Pipe::MGPipeKind::VertexElementsCso;
case PipeSlotKind::Texture: return MobileGL::MG_Pipe::MGPipeKind::Texture;
case PipeSlotKind::Renderbuffer: return MobileGL::MG_Pipe::MGPipeKind::Renderbuffer;
case PipeSlotKind::Framebuffer: return MobileGL::MG_Pipe::MGPipeKind::Framebuffer;
case PipeSlotKind::SamplerCso: return MobileGL::MG_Pipe::MGPipeKind::SamplerCso;
case PipeSlotKind::SamplerViewCso:
return MobileGL::MG_Pipe::MGPipeKind::SamplerViewCso;
case PipeSlotKind::ShaderCso: return MobileGL::MG_Pipe::MGPipeKind::ShaderCso;
}
return MobileGL::MG_Pipe::MGPipeKind::None;
}
} // namespace
@@ -30,6 +30,29 @@ namespace MGITest {
enum class PipeSlotKind {
Buffer,
VertexElementsCso,
// P4a's six (G8b). Every one of them is a kind the CLIENT mints and the client alone
// frees (BRIEF-P4A.md D-I1: one death helper per kind, called from the frontend
// object's own destructor, whatever backend is running), so every one of them can leak
// the P3a C-1 way - and the leak is invisible in pixels, in GL names and in
// glGetError, exactly as the VertexElementsCso one was.
Texture,
Renderbuffer,
// Framebuffer has a HANDLE but no wire lifetime (D-I2): no create_*, no destroy row in
// the catalogue, and its death helper does the notice and the free and emits nothing.
// That makes the allocator the ONLY observable of its lifetime, so this row matters
// more here than the others rather than less.
Framebuffer,
SamplerCso,
SamplerViewCso,
// ShaderCso covers BOTH the ordinary program slots and the program-pipeline COMPOSITES
// minted out of the reserved high band (MGPipeHandles.h:86-97, D-H7). One kind, because
// that is what the allocator has: the band is a second dense table inside the same
// kind, LiveCount counts both and HighWater is one past the highest slot handed out in
// either. The composite's leak case is a separate CASE rather than a separate kind for
// that reason - what makes it its own case is that a composite's slot has TWO
// independent release paths (the pipeline cache's LRU eviction and the composite
// ProgramObject's destructor), not that it is counted anywhere else.
ShaderCso,
};
// Live slots of this kind right now, and one past the highest slot ever handed out.