Version of the GPU layout below. The layout is part of the package's API:
a WGSL walk written against it reads every word position here. Any change
to a size, a word position or a meaning bumps this number, and that is a
breaking change. Code with its own walk checks it at startup; serialized
trees (serialize.ts) carry it and are refused when it differs.
History: 1, the first layout. 2, instance records carry an 8-bit instance
mask in bits 8-15 of their flags word (written as 0xff, visible to every
ray, unless the instance gives one). Also in 2, before its release: merged
static meshes. Instance flags bit 3 (merged) says the hit's instance is
the triangle's padding word (the source instance index), and triangle
flags bit 1 flips frontFace. Builders still write 0 to both; nothing moved.
Also in 2, before its release: bits 16-31 of the instance flags word hold
the instance's material + 1 (0 for none), and bits 16-31 of each
triangle's flags word the triangle's (MeshInput.triangleMaterials,
which builders write; in a merged mesh its source's, which the scene
assembly writes). A hit takes the triangle's, else the instance's.
Also in 2, before its release: indexed leaves, a second triangle format
beside the records (GpuLayoutTriangleLeaves). It is a variant of
version 2, not a new version: serialized trees name their format in header
word 7 (0 records, 1 indexed), and records are unchanged.
Also in 2, before its release: quantized nodes, a second node format beside
the 64-byte nodes (GpuLayoutNodeFormat). A variant of version 2 too:
serialized trees name it in bits 8-15 of header word 7 (0 f32, 1
quantized), and 64-byte nodes are unchanged.
Version of the GPU layout below. The layout is part of the package's API: a WGSL walk written against it reads every word position here. Any change to a size, a word position or a meaning bumps this number, and that is a breaking change. Code with its own walk checks it at startup; serialized trees (serialize.ts) carry it and are refused when it differs.
History: 1, the first layout. 2, instance records carry an 8-bit instance mask in bits 8-15 of their
flagsword (written as 0xff, visible to every ray, unless the instance gives one). Also in 2, before its release: merged static meshes. Instance flags bit 3 (merged) says the hit's instance is the triangle'spaddingword (the source instance index), and triangle flags bit 1 flipsfrontFace. Builders still write 0 to both; nothing moved. Also in 2, before its release: bits 16-31 of the instanceflagsword hold the instance's material + 1 (0 for none), and bits 16-31 of each triangle'sflagsword the triangle's (MeshInput.triangleMaterials, which builders write; in a merged mesh its source's, which the scene assembly writes). A hit takes the triangle's, else the instance's. Also in 2, before its release: indexed leaves, a second triangle format beside the records (GpuLayoutTriangleLeaves). It is a variant of version 2, not a new version: serialized trees name their format in header word 7 (0 records, 1 indexed), and records are unchanged. Also in 2, before its release: quantized nodes, a second node format beside the 64-byte nodes (GpuLayoutNodeFormat). A variant of version 2 too: serialized trees name it in bits 8-15 of header word 7 (0f32, 1 quantized), and 64-byte nodes are unchanged.