The canonical cache key for a descriptor: every field, in a fixed order,
separated by a character no field value contains.
Fixed order and total coverage are both load-bearing. Fixed order makes the
key a deterministic function of the value (§33). Total coverage makes a cache
hit mean something: a field left out of the key is a pipeline reused with
the wrong state baked in, which is the failure mode this function exists to
make impossible — so a new field on WgpuPipelineDescriptor is a
compile error here until it is added below.
The optional fields (§67's stencil, §65's batch, §68's normals,
§70's effect, §69's shadow, §59's metalRoughness) append a prefixed
segment only when carried — shadow and metalRoughness only when carried
true, since false names the same pipeline content as absence. That is
still a total, injective function — absence appends nothing, and no
required field's value can spell the prefixes — and it is what keeps every
earlier packet's key, and therefore every fourJS:<key> pipeline label
already recorded in landed transcripts, byte-identical for a descriptor
that does not carry them.
The canonical cache key for a descriptor: every field, in a fixed order, separated by a character no field value contains.
Fixed order and total coverage are both load-bearing. Fixed order makes the key a deterministic function of the value (§33). Total coverage makes a cache hit mean something: a field left out of the key is a pipeline reused with the wrong state baked in, which is the failure mode this function exists to make impossible — so a new field on WgpuPipelineDescriptor is a compile error here until it is added below.
The optional fields (§67's
stencil, §65'sbatch, §68'snormals, §70'seffect, §69'sshadow, §59'smetalRoughness) append a prefixed segment only when carried —shadowandmetalRoughnessonly when carried true, sincefalsenames the same pipeline content as absence. That is still a total, injective function — absence appends nothing, and no required field's value can spell the prefixes — and it is what keeps every earlier packet's key, and therefore everyfourJS:<key>pipeline label already recorded in landed transcripts, byte-identical for a descriptor that does not carry them.