Vixen
02b45cc4
csharp
public sealed class QueryArityGenerator

Emits the query surface for one to sixteen component types: the description builders, the delegates, the struct-visitor interfaces and the iteration that drives them.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

What [04](../../docs/plan/04-ecs-and-scripting.md) § Queries asks for, and what Arch produces with T4 templates. Sixteen arities across four families is roughly two thousand lines of code whose only variable is a number; writing that by hand means sixteen chances to transpose an index in a place where the compiler cannot help, because every arity type-checks whether or not the body is right.

Emitted at post-initialisation, because the output does not depend on anything in the compilation. It is registered only by Vixen.Ecs itself and does not travel in the package: an assembly that referenced it would emit a second copy of the same partial and the same extension class. The generators that do belong in a user's compilation — system read/write inference, the behaviour dispatch table — join this project with the layers that need them.

The generated loops walk with Unsafe.Add over the first element rather than indexing the spans. A span's bounds check is elided when the loop bound is its own Length, and here the bound is the chunk's count, shared by every column — so indexing would pay for n bounds checks per entity that no arrangement of the loop can remove.

Methods (1)

  • public void Initialize(IncrementalGeneratorInitializationContext context)

    Called to initialize the generator and register generation steps via callbacks on the