Shader effects: pass bindings, parameter blocks and state fields #250

Manually merged
github merged 1 commit from gh-pr/250/head into gh-pr/250/base 2026-11-26 20:21:34 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 06:14 UTC · original
holdmysocks:claude/shader-effect-fields → master · +366 −24 · 2 files · 1 commits · merged 2026-11-25 06:36 UTC

More of the shader effect record is read, and shader-bindings prints it.

What is read now

  • Pass bindings. The u16 at 16 of a pass record, added to the address of the record's byte 4, is the address of the pass's entry in the u32 list after the passes. An entry is four hash lists (resources read, resources written, a list that is always empty, constant buffers) and an optional extra word.
  • Pass bytes 19 and 20: two indices into the effect's parameter blocks (ff = none).
  • Parameter blocks: u64 id, u16 n, 14 bytes, n entries of name hash, two kind bytes and a slot. Shared blocks of a database are read the same way.
  • State items as one-byte-per-field state descriptions: blend (alpha to coverage, independent, eight targets), depth-stencil (depth, stencil, masks, both faces), rasterizer (fill, cull), sampler (address modes, filter, comparison, level range).
  • Variable table: the third u16 of the header is a count of 8-byte entries after the records. A resource can point at one of them; a member can point at its default value.
  • The second sized block is a variable table with one constant buffer.

Checked on one install (932 effects, 28,798 passes)

Check Result
Passes whose u16 lands on an entry that reads 28,798 of 28,798
Entries with the extra word 23,656
Pass block indices out of range 0
Stored parameter blocks with size 24 + 8 x n 10,432 of 10,432
Second block = one constant buffer, no members 932 of 932
Members with a default value 30,319
Resources that point at a table entry 5,036
Blend targets with every field inside the enum ranges 3,184 of 3,184
Loaded size formula still holds 932 of 932

Unit tests: a synthetic effect with two passes and their entries, a stored block, the four state readers, default values and table entries. cargo test -p sixng-core shaderfx passes (3 tests).

Not decoded

  • Pass bytes 18 and 23, and the extra word of a binding entry.
  • The 14 header bytes of a parameter block, and what a block or the two pass indices are for.
  • What the 8-byte table entries are for; the length of a default value is not stored (taken to run to the next one).
  • The last ten bytes of a depth-stencil item and the last 14 of a rasterizer item (constant over the install), sampler byte 0 and bit 0x20 of byte 8. The sampler's four floats at 12 are taken to be the border colour without a check.
  • The state readings were not compared with the pipeline cache; which winding is the front face was not checked.
**@⁠holdmysocks** on GitHub · 2026-11-25 06:14 UTC · [original](https://github.com/holdmysocks/SixNG/pull/250) `holdmysocks:claude/shader-effect-fields` → `master` · +366 −24 · 2 files · 1 commits · merged 2026-11-25 06:36 UTC More of the shader effect record is read, and `shader-bindings` prints it. ## What is read now - **Pass bindings.** The `u16` at 16 of a pass record, added to the address of the record's byte 4, is the address of the pass's entry in the `u32` list after the passes. An entry is four hash lists (resources read, resources written, a list that is always empty, constant buffers) and an optional extra word. - **Pass bytes 19 and 20**: two indices into the effect's parameter blocks (`ff` = none). - **Parameter blocks**: `u64 id`, `u16 n`, 14 bytes, `n` entries of name hash, two kind bytes and a slot. Shared blocks of a database are read the same way. - **State items** as one-byte-per-field state descriptions: blend (alpha to coverage, independent, eight targets), depth-stencil (depth, stencil, masks, both faces), rasterizer (fill, cull), sampler (address modes, filter, comparison, level range). - **Variable table**: the third `u16` of the header is a count of 8-byte entries after the records. A resource can point at one of them; a member can point at its default value. - **The second sized block** is a variable table with one constant buffer. ## Checked on one install (932 effects, 28,798 passes) | Check | Result | |---|---| | Passes whose `u16` lands on an entry that reads | 28,798 of 28,798 | | Entries with the extra word | 23,656 | | Pass block indices out of range | 0 | | Stored parameter blocks with size 24 + 8 x n | 10,432 of 10,432 | | Second block = one constant buffer, no members | 932 of 932 | | Members with a default value | 30,319 | | Resources that point at a table entry | 5,036 | | Blend targets with every field inside the enum ranges | 3,184 of 3,184 | | Loaded size formula still holds | 932 of 932 | Unit tests: a synthetic effect with two passes and their entries, a stored block, the four state readers, default values and table entries. `cargo test -p sixng-core shaderfx` passes (3 tests). ## Not decoded - Pass bytes 18 and 23, and the extra word of a binding entry. - The 14 header bytes of a parameter block, and what a block or the two pass indices are for. - What the 8-byte table entries are for; the length of a default value is not stored (taken to run to the next one). - The last ten bytes of a depth-stencil item and the last 14 of a rasterizer item (constant over the install), sampler byte 0 and bit 0x20 of byte 8. The sampler's four floats at 12 are taken to be the border colour without a check. - The state readings were not compared with the pipeline cache; which winding is the front face was not checked.
A pass record's u16 at 16 locates its entry in the list after the passes:
four hash lists (read, written, an empty one, constant buffers) and an
optional word. Parameter blocks read as id + entries. State items read as
one-byte-per-field state descriptions. A variable table's third count is a
list of 8-byte entries; members point at default values. The second sized
block is a table with one constant buffer.

shader-bindings prints these per effect and counts them over the archive.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:21:33 +00:00
github manually merged commit f4f815d870 into gh-pr/250/base 2026-11-26 20:21:34 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.