Repository navigation
docs/models.md: material shader hashes lead to effects; effect records select the draw programs - #2519
Conversation
|
Code read + CPU tests, 4d15315: the docs link test fails, so this would not pass CI as it stands: `docs/models.md` links to `first_light.md`, which is not in the tree. Either add the page in this PR or point the link at the existing file (if it is meant to be `character_skeleton.md` or `models.md` itself, say so in the PR). The other four checks pass. |
4d15315 to
bc66db1
Compare
|
Re-tested bc66db1: pass, |
|
I checked the effect-to-draw-program link on a local Xbox 1.0.2.1 package. For three Banshee materials from These are absolute byte offsets in
To reproduce on your own copy, all multi-byte fields below are little-endian.
I verified these three anchored records. I haven't established a general locator for all effects or the runtime conditions that select a pass. This also gives the isolated-draw work in #1889 a way to pick independently checkable program pairs. AI-assisted analysis and verification. |
…'s mesh and pixel programs Found by @jeremygold02 in ItsNotRexed#2519 and reproduced on three records of the same shaders.rpf. The run-time choice of technique and pass, and a general locator for effect records, stay open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bc66db1 to
240180e
Compare
|
Thanks @jeremygold02, this is the missing link. I reproduced all three records on my copy, which has the same
All match your table. In 240180e the section describes the effect record, the technique table and the pass selectors, credited to you, with these three rows as the measurement. The open part is now narrower:
The earlier negatives still stand as they are, since the names, order and suffixes alone don't carry the link. I also retitled the PR. |
|
Code read of 240180e, three questions about reproducibility:
Docs tests pass on this head. I didn't re-measure (that needs the game files). AI-assisted code read (Claude Code). |
|
Thanks @ramenbellic, all three points hold. I re-measured on my copy (counts only) and addressed them in 61ab2b1:
|
|
Thanks for remeasuring in 61ab2b1. I walked both native SGD5 databases in the same Xbox 1.0.2.1 archive (SHA-256 Program ordinals restart at each database. The six counted groups have the following contents, classified using the DXIL program-kind field in each of the 26,503 containers.
The windshield's 11017 is the last zero-based entry in the first database's group 0. Group 2 can now be identified from its 195 geometry programs. Groups 3 and 4 remain untyped. There is a direct check on indexing in the second database: all 42 group-5 ordinal references resolve to a program carrying the referring effect's name prefix in its own compute group. The same 42 ordinals give zero prefix matches if resolved against the archive-wide compute list sorted by offset. A lookup key therefore needs the database as well as the group and ordinal. Effect-table census. Starting at the effect counts following group 5, I got these results without supplying any per-effect table or string offsets:
For reproduction on a local copy:
Exactly one named table satisfied these checks for each of the 913 effects in the named-table column. There are 20 effects with no program references. Nineteen have just the single-NUL pool. The remaining one has a named technique and one pass with all six selectors zero. It is included in the table above. The forward walk and the independent search agree for every named table. For all 19 nameless effects the forward walk lands on two explicit zero counts (techniques and passes). The u32 after the effect name remains opaque. The fixed widths establish the record boundaries in this build; the meanings of individual state fields need separate checks. This measures stored candidates across this archive; runtime technique selection is still open. AI-assisted local verification. Only format observations and aggregate counts are included here. |
|
Reproduced your group walk on my copy (same SHA-256), with the starts at
These match your table exactly, and the two databases add up to the whole carve: 11,518 VS + MS, 12,101 PS, 195 GS and 2,689 CS. That's also why my offset-order rank worked: all three records are in the first database, whose programs come first in the archive. In 49cad88 the doc says ordinals count per database and the lookup key is (database, group, ordinal). It names group 2 as the GS, leaves groups 3–4 untyped, includes the walk table above, and records your second-database CS check. I haven't re-run the effect-table census yet, so the doc credits it to you and keeps the format beyond the three checked records as reported rather than confirmed. It also notes that the tables are found by a validated search, not a pointer, and that the u32 after the name is still opaque. |
Accept the shader hash emitted by rpf9dump, retain every matching effect, and expose its techniques and stored passes even when it has no named compute program. Refs: ItsNotRexed#2519, ItsNotRexed#3036
|
I reproduced the I compared those same slots against both native SGD5 effect directories. This resolves the ten material hashes missing from the compute-name lookup.
Each of the 18 material hashes has exactly one native effect record. The effect for the remaining slot has one technique with four compute-only passes. This distinction matters when deciding whether to look for a draw program for every material. Gameplay's choice among authored passes remains open. To repeat the hash comparison with an existing model manifest, run AI-assisted, CPU-only package check on Windows. |
|
Reproduced with your
Against my This also reproduces your earlier census, so in 48cf8db it's no longer marked as "reported". The material table gains a row for the native match (18 of 18) next to the carved-compute-name one (8 of 18). The open points are now only the decoded pointers (the tables are found by a validated search) and the run-time pass choice. I haven't separately re-checked your 17/18 figure for effects with a vertex/mesh + pixel pass, so the doc doesn't state it. |
Follow the post-pass tables through the counted string pool and next record. Check both database terminators and keep opaque payload contents out of structural matching. Refs: ItsNotRexed#2519, ItsNotRexed#3036
|
Thanks for independently checking the 18 material hashes. The effect-record locator now has a forward walk in #3036, commit After the pass records, the cursor consumes a counted array of four-byte words, a marker, two length-prefixed byte blocks and a packed entry count. For each entry, the tag I compared both readers on the same package. All 932 effect starts, string-pool starts and next-record boundaries agreed, as did every technique, pass and program reference (25,037 / 28,798 / 51,535). A synthetic opaque block containing a plausible effect header and a string pool containing an apparent second length prefix both parse at their declared boundaries. To repeat: One constraint on runtime selection: all 3,339 draw-capable material slots reference effects with multiple distinct vertex/mesh–pixel program pairs. Treating the material’s bucket (low seven bits) as the zero-based technique ordinal yields an in-range technique for every one, but that technique lacks a paired vertex/mesh and pixel pass for 3,246 of those slots. The bucket by itself therefore cannot serve as a general draw-technique ordinal. Which technique the runtime selects remains open. AI-assisted, CPU-only checks on Windows 11 25H2 build 26200.9974, Python 3.12.10, Intel Core Ultra 7 265K. Installed GPUs: NVIDIA GeForce RTX 5070 (621.01) and Intel Graphics (32.0.101.9150). |
|
Ran In the latest commit, the doc drops the "validated search" caveat and describes the forward walk from stored lengths, with the test as the check. The only open format point is now the u32 after the name. I left out the bucket-vs-technique observation for now, since I haven't re-measured it. Thanks again, this turned a negative section into a working lookup. |
|
Following up on the remaining u32 immediately after the effect name. I can now reproduce its numeric value from the independently counted fields on 932/932 records. It never equals the serialized record length in this build. Its runtime use is still unknown. Using byte lengths that exclude their own prefixes, let An exact rational fit to 728 first-database rows recovered integer coefficients. I held out every fifth first-database row (182/182 matches) and the entire second database (22/22 matches). I then computed the expression independently using #3036's forward reader and also matched 910/910 and 22/22. Always rounding up misses all 22 empty entry tables by six bytes. Rounding only when an inline entry exists misses all 10 tagged-only tables. Groups 3 and 4 are empty here, so their contributions in a build that uses them are unmeasured. The evidence supports a derived size value for 1.0.2.1. Calling it a runtime allocation size or using it to jump to the next record would require different evidence. The verified sequential walk remains the way to locate the next record. AI-assisted CPU-only checks on Intel Core Ultra 7 265K, Windows 11 Home 25H2 (26200.9974), Python 3.12.10. NVIDIA GeForce RTX 5070 (621.01) and integrated Intel Graphics (32.0.101.9150) were installed. |
…'s mesh and pixel programs Found by @jeremygold02 in ItsNotRexed#2519 and reproduced on three records of the same shaders.rpf. The run-time choice of technique and pass, and a general locator for effect records, stay open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f76ee8e to
db4ddd6
Compare
|
I checked one concrete case of the material-to-program lookup on my 1.0.2.1 copy. A mesh's stored material slot resolved through #3036 to a pass with a vertex and a pixel program. The vertex signature declares only the system vertex ID. I selected the packed-index branch as a test input and supplied the vertex and index buffers referenced by that same geometry record.
This ties a pass stored on one material to the same packed-geometry rules documented in #752 and #2601. The check supplies the descriptor contents and chooses the branch explicitly. Which pass and descriptor addresses the game installs at draw time, the later transforms, and the rendered pixels remain open. CPU-only on an Intel Core Ultra 7 265K, Windows 11 Home 25H2 build 26200.9974, Python 3.12.10 and the pinned .NET decoder. NVIDIA GeForce RTX 5070 (621.01) and Intel Graphics (32.0.101.9150) were installed and idle. All derived data stayed local. AI-assisted. |
|
Thanks @jeremygold02, this ties the material → effect → pass chain to the packed-geometry rules (#752, #2601) in a concrete case. The negative controls (swapped corners, a missing meshlet start, the wrong axis word) make it convincing. I haven't reproduced the VS replay here, so I've kept this docs PR to what it measures and reproduces: the format, the lookup and the counts. Your replay would make a strong section of its own next to #3036. |
|
Following your suggestion, I put the worked replay in #3808. It includes the mesh/pass selection checks for a second local run. The paired vertex shader writes a record indexed by the first draw constant, and six compute shaders read the matching two-index layout. The RTX test identifies where those indices become indistinguishable in the currently tested translation. The same drawable's surface pass separately resolves all 46 authored material members. The actual frame's pass selection and bindings remain open. |
# Conflicts: # docs/models.md
|
Thanks @jeremygold02, #3808 is the right home for the replay. Keeping it out of this PR also leaves this one limited to the format and counts I reproduced here. |
…the record's fields @jeremygold02's formula, recomputed here on all 932 records (910 + 22); the value never equals the serialized record length, so the walk still finds the next record. Runtime use unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
db4ddd6 to
203b207
Compare
|
Tested head
AI-assisted review (Gemini 4 Neon). |
Step 1 of my materials → shader programs claim (#2078; narrowed in #2300 after the measurements below).
What
A new section in
docs/models.md, after "Shader render buckets", records what a drawable material's shader hash leads to and what it doesn't, so nobody repeats the search. Measured on my 1.0.2.1 copy (counts only, no names):rpf9dump models→manifest.json→Materials[].Shader) is the joaat of its effect name.<effect>:<entry>_<8 hex>_Wrapped, after a one-byte length prefix.RaytracingResolveprograms: 3,211 ofdata.rpf's 3,340 materials (96%), 8 of the 18 distinct hashes. 341 effects have such programs, 1,004 in all.shaders.rpfstores programs grouped by kind, not by effect.shaders.rpfdo lead there. @jeremygold02 found and documented them in this thread: per-stage program lists, a technique table and 24-byte pass records whose first six bytes select a program from each list. I reproduced all three of his records on my copy (the sameshaders.rpfSHA-256): technique counts 1/106/106, passes 1/108/108, and first-pass mesh/pixel ordinals 11017/10943, 9143/8925 and 9089/8835. The doc now describes the format and narrows the open part to two things: a general locator for effect records, and which technique and pass the game picks at run time (RT-5).Docs only. Rebased on
mainso thefirst_light.mdlink resolves;tests/test_docs_links.pypasses (5/5).tests/test_docs_design_rows.pyfails 3 subtests (design.md,README.md,testing.md) identically onmain, which is PROC-106; this PR doesn't touch those pages.Thanks
first_light.mdlink on the old base.Thanks
By @rafaelpssz, with Claude Code (AI-assisted).