upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRafael <rafaelalvesp2005@gmail.com>2026-11-22 15:54:40 -0300
committerRafael <rafaelalvesp2005@gmail.com>2026-11-22 17:03:37 -0300
commitf36e3af8e196f5cb0a0abc0a38dbec24d09dbc54 (patch)
tree5884c45871c13dabd4dddcd0648564e546aa2c82 /docs
parent97c065b42021cffd07b1b4ce68f8a26f8f827ed9 (diff)
docs/models.md: effect-record ordinals count within one of shaders.rpf's two SGD5 databases
The group walk (@jeremygold02) reproduced on the same archive: 11,018 / 10,944 / 195 / 0 / 0 / 2,647 programs and 910 effects in the first database, 500 / 1,157 / 0 / 0 / 0 / 42 and 22 in the second, adding up to the whole carve. Group 2 is the GS. His census of both databases' effect tables is reported as his. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/models.md42
1 files changed, 29 insertions, 13 deletions
diff --git a/docs/models.md b/docs/models.md
index 1fb612694..5f5e1abbe 100644
--- a/docs/models.md
+++ b/docs/models.md
@@ -519,15 +519,27 @@ are little-endian:
5191. **The effect record.** It starts with a one-byte name length and the name, including its terminator, then a 5191. **The effect record.** It starts with a one-byte name length and the name, including its terminator, then a
520 u32 whose meaning is not known. Six stage lists follow, each a u32 count and that many u32 ordinals. 520 u32 whose meaning is not known. Six stage lists follow, each a u32 count and that many u32 ordinals.
521 521
522 An ordinal is a program's position, in `shaders.rpf` offset order, within its group of the carve index 522 `shaders.rpf` holds **two shader databases** (SGD5), and an ordinal counts within one of them (found by
523 (`<work>/shaders/dxbc/index.json`, sorted by `offset`). The groups are: 523 @jeremygold02). Each database stores six program groups, each a u32 count followed by its programs. A program
524 524 is a u8-length label including its NUL, one tag byte, a u32-length payload, 152 fixed bytes and a u32-length
525 - **List 0:** the VS and MS together, 11,518 programs. The three records' lists hold both kinds: the rim's 41 525 trailer. The u32 after group 5 is the database's effect count. An ordinal is the zero-based position in the
526 entries are 37 MS and 4 VS. 526 group of the effect's own database, so a lookup needs the database, the group and the ordinal.
527 - **List 1:** the PS, 12,101 programs. 527
528 - **List 5:** the CS. On the rim and the tire its three entries are exactly the effect's own 528 | Database (group walk starts at) | 0: VS + MS | 1: PS | 2: GS | 3 | 4 | 5: CS | Effects declared |
529 `<effect>:RaytracingResolve` programs, the ones the material hash leads to in the table above. 529 |---|---:|---:|---:|---:|---:|---:|---:|
530 - **Lists 2–4:** empty in all three records, so their stages are not identified. 530 | `0x10E39` | 11,018 | 10,944 | 195 | 0 | 0 | 2,647 | 910 |
531 | `0x10289C81` | 500 | 1,157 | 0 | 0 | 0 | 42 | 22 |
532
533 The two databases add up to the whole carve: 11,518 VS + MS, 12,101 PS, 195 GS and 2,689 CS. Groups 3 and 4 are
534 empty and their stages are not identified. The first database's programs come first in the archive, so for its
535 effects the ordinal also equals the program's position among the carve index's programs of that group, sorted
536 by `offset`. The three records here are all in the first database: the wiper's 11017 is the last entry of its
537 group 0.
538
539 On the rim and the tire, list 5's three entries are exactly the effect's own `<effect>:RaytracingResolve`
540 programs, the ones the material hash leads to in the table above. In the second database all 42 group-5
541 references resolve to programs that carry their effect's name; resolved against the archive-wide CS list
542 instead, none of them do (@jeremygold02).
5312. **The technique table.** A u32 count, then one 4-byte entry per technique: the low 15 bits of its first u16 are 5432. **The technique table.** A u32 count, then one 4-byte entry per technique: the low 15 bits of its first u16 are
532 the name's offset in a string block, and byte 3 is the pass count. A u32 pass total follows, then 24-byte pass 544 the name's offset in a string block, and byte 3 is the pass count. A u32 pass total follows, then 24-byte pass
533 records. Where the table and its string block sit relative to the record is not derived yet: the three 545 records. Where the table and its string block sit relative to the record is not derived yet: the three
@@ -535,8 +547,11 @@ are little-endian:
5353. **The pass records.** The first six bytes of each pass select an entry of each stage list: 0 is unused, 5473. **The pass records.** The first six bytes of each pass select an entry of each stage list: 0 is unused,
536 otherwise `stage_list[selector - 1]`. 548 otherwise `stage_list[selector - 1]`.
537 549
538This is checked on **three records** of a 1.0.2.1 copy (the same `shaders.rpf`, SHA-256 `0bc16345…`). It has not 550The group walk and its counts above were reproduced on a 1.0.2.1 copy (the same `shaders.rpf`, SHA-256
539been counted over all effects, so for the rest it is a **hypothesis** (AGENTS.md: count over the whole corpus): 551`0bc16345…`), and the record and pass format on the three records below. @jeremygold02 reports a census of
552both databases' effects found by a validated search, with no per-effect offsets given. 913 effects have one
553matching technique table: 891 + 22 tables, 23,938 + 1,099 techniques and 27,536 + 1,262 passes. Until that
554census is reproduced, the format beyond these three records is reported rather than confirmed here:
540 555
541| Record | Stage list sizes | Techniques | Passes (total = sum of counts) | First pass list 0 / list 1 ordinal | 556| Record | Stage list sizes | Techniques | Passes (total = sum of counts) | First pass list 0 / list 1 ordinal |
542|---|---|---:|---:|---| 557|---|---|---:|---:|---|
@@ -546,8 +561,9 @@ been counted over all effects, so for the rest it is a **hypothesis** (AGENTS.md
546 561
547Two things are still open: 562Two things are still open:
548 563
549- **Finding effect records in general.** The three were found by their offsets; there is no general locator for 564- **Finding effect records in general.** The three were found by their offsets. The census locates technique
550 all effects yet, and the format becomes a rule only once it holds for every one of them. 565 tables by a validated search inside each effect, not by a decoded pointer, and the u32 after an effect's name
566 is still opaque.
551- **Which technique and pass the game draws with.** That is a run-time choice; it is presumably made in the 567- **Which technique and pass the game draws with.** That is a run-time choice; it is presumably made in the
552 executable (RT-5). 568 executable (RT-5).
553 569