[Fix] (Magma): drop the per-kind ABA wrapper no build ever evaluates and say why the constexpr table and the knob stand alone

This commit is contained in:
Swung0x48
2026-09-08 19:08:12 -04:00
committed by rereview
parent 9a0a7f7608
commit e62abff6b6
@@ -287,11 +287,21 @@ namespace MobileGL::MG_Backend::DirectVulkan {
"MG_IntegrationTest's two-symbol probe over MG_Backend/DirectVulkan is what " "MG_IntegrationTest's two-symbol probe over MG_Backend/DirectVulkan is what "
"carries the answer into the lane"); "carries the answer into the lane");
// The per-kind form of MagmaPipeAbaControlDefeatsIdentity(): true only where there is both a // THERE IS DELIBERATELY NO PER-KIND WRAPPER HERE, and review F-v2-m3 is why. An earlier
// key to defeat here AND the operator asked for it. // round carried `MagmaPipeAbaControlCoversKind(kind)` - the conjunction of the two
inline Bool MagmaPipeAbaControlCoversKind(MG_Pipe::MGPipeKind kind) { // statements above - and it had no caller anywhere in the tree: the knob's only two
return MagmaPipeAbaControlKindIsRekeyedHere(kind) && MagmaPipeAbaControlDefeatsIdentity(); // consumers (VulkanRenderer.cpp's VAO draw memo and VertexInputStateFactory.cpp's pipeline
} // key) each hold ONE kind, VertexElementsCso, by construction, so the kind is not a
// variable at either site. A conjunction no build ever evaluates cannot be pinned the way
// the predicate above is pinned - it is not constexpr, because it reads MG_Config::Features,
// so no static_assert can reach it - which makes it exactly the rot F-m5 was raised about,
// one level up: an `&&` whose operands could be inverted or dropped with nothing to say so.
//
// The two pieces stand alone instead, and each is pinned by something that runs:
// MagmaPipeAbaControlKindIsRekeyedHere is constexpr and asserted in BOTH directions by the
// three static_asserts above, which compile in every Magma build; MagmaPipeAbaControlDefeats
// Identity is the knob, and its two consumers are what make it true or false. A call site
// that ever does hold a variable kind writes the `&&` there, where a build will run it.
// The single consumer-table entry every VAO collapses onto while the control is on. Slot // The single consumer-table entry every VAO collapses onto while the control is on. Slot
// 0 is a real, ordinary entry of both tables (MagmaPipeSlotIndex maps the first allocatable // 0 is a real, ordinary entry of both tables (MagmaPipeSlotIndex maps the first allocatable