Repository navigation
Conversation
…der_link_check batch manifest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… keep only the stage sets shader_link_check takes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ch batch refuses Reported by whattheflop in ItsNotRexed#5207: an empty --spirv-dir left no set, the tool wrote {"pipelines": []} and exited 0, and shader_link_check.py batch then exited 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…offset Reported by kacper-serewis in ItsNotRexed#5207: with such entries the selected shader depended on the index order. The same entry listed twice is still accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… blend rows Locate the four state tables per effect in sgd5_effects, decode the fields the stored rows pin down (cull mode, depth enable/write/compare, stencil enable, blend target enable and write mask; the rest stays raw), add raster_state/depth_state/blend_state to the --passes rows and a --states file. Offsets and counts in docs/sgd5_render_states.md. The manifest is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and the open winding behind cull names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mes are the D3D11 reading, range errors for depth and blend tested Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
AI-assisted review of The default manifest path retains a separate copy of the decoded render states for each pass. The input below has 10,000 passes in one effect. All passes select the same three state rows. The input is 245,760 bytes. The caller requests neither
The manifest needs the stage keys. It does not use the decoded state objects. Cache each decoded row by table and selector within its effect. This lets repeated passes share one decoded row and preserves range checks. The synthetic effects and pipeline tests pass (19 pass, one package test skips). To repeat, run this script with import sys, tempfile, tracemalloc, subprocess, types
from pathlib import Path
sys.path[:0] = ['tests','tools']
import test_sgd5_pass_pipelines as t
import sgd5_pass_pipelines as head
prior = types.ModuleType('prior')
prior.__file__ = head.__file__
exec(subprocess.check_output(['git','show','a4a87bab:tools/sgd5_pass_pipelines.py']),prior.__dict__)
passes = [t.PASSES[0]] * 250
_, _, index = t.build(passes)
item = t.effect('Mock',{0:(0,1),1:(0,1),2:(0,),5:(0,)},[('T',passes)]*40)
data,layout = t.database(t.NAMES,[item])
with tempfile.TemporaryDirectory() as d:
path = Path(d)/'synthetic.bin'
path.write_bytes(data)
for tool in (prior,head):
tracemalloc.start()
rows,counts = tool.census(path,index,[layout])
print(len(data),len(rows),tracemalloc.get_traced_memory())
tracemalloc.stop()
del rows |
…ed object Reported by shdann in ItsNotRexed#5342: each pass kept its own copy of the decoded rows, so a census of 10,000 passes on one row peaked at 49.8 MB against 12.5 MB before the decoding. Rows are now decoded once per effect and selector (14.3 MB there); range checks are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @shdann, good find, and thanks for the script. Fixed in c4767f6: each effect keeps one decoded object per (table, selector), and its passes share it; range checks are unchanged. With your script: parent a4a87ba 12.4 MB peak, 30c9e59 49.8 MB, now 14.3 MB. A new test checks that two passes on one row get the same object. On the real archive, AI-assisted (Claude Code). |
|
At I grouped graphics passes by the complete stage-to-program mapping, then counted distinct triples of decoded rasterizer, depth/stencil and blend rows within each group. Equality includes the retained raw fields and treats an empty table as null. I checked that the generated manifest matched my #5207 manifest before joining its
Among the compatible sets, rasterizer state varies within 175, depth/stencil within 2, and blend within 197 (overlap possible). A shader-only key would therefore collapse 378 additional recorded state variants in the compatible subset. These are distinct database selections; the number of distinct Vulkan create infos will depend on how the raw fields and defaults map. CPU census on CachyOS, AI-assisted (OpenAI Codex). |
|
Thanks @Kev-Ball, that's the number the next step needs. When AI-assisted (Claude Code). |
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted independent review at c4767f6. Across both databases all 28,797 emitted rows matched independent parsing of selectors and selected state records, including all eight blend targets. Histograms matched across 28,798 stored passes. One selected no program. The comparison reused the effect-boundary reader. All 11 focused CPU tests passed. Runtime defaults and rendering were outside this check.
|
Tested c4767f6 on Linux, Python 3.13 (CPU only, no GPU, no game files): pass with notes Ran
Read
AI-assisted (Claude Code). Generated by Claude Code |
Kam471
left a comment
There was a problem hiding this comment.
Head c4767f62 — stacked on #5207 (still OPEN, head a4a87bab). The PR's own commits are 8aa02e75..c4767f62 (+218/−24): tools/sgd5_pass_pipelines.py, tools/sgd5_effects.py, docs/sgd5_render_states.md, two tests.
- Blocked on merge order, not on content:
git diff origin/main...HEADalso contains all of #5207 (the file shows as new). Merge #5207 first, then rebase this. python -I -m pytest tests/test_sgd5_pass_pipelines.py -q→ 11 passed, 10 subtests;tests/test_sgd5_effects.py→ 9 passed, 1 skipped, 29 subtests;tests/test_docs_links.py6 OK;tests/test_text_write_line_endings.py3 OK.- Decoding cross-checked against the pre-existing doc: table order
(16, 24, 68, 36)and pass bytes 6/7/8.pass_statesallows selector 0 on an empty table (null), errors on nonzero-into-empty and selector ≥ count, and slices atfirst + selector*widthfromeffect_records. Blend enable/write-mask offsets (4+8i / 11+8i) match the table in the doc. - Shared row cache is per effect keyed
(kind, selector); the manifest output is unchanged and a test pins the shared object. git diff --check origin/main...HEAD→ clean.- Not reproducible here (needs the game's
shaders.rpf): the 28,798-pass census and the per-value distributions in the doc.
Verdict: new work LGTM; hold until #5207 lands.
… say which bytes are range-checked Review by King1565 in ItsNotRexed#5342: depth off also turns writes off in D3D and Vulkan, so the swapped reading is just as legal (nine rows with depth off, one read-only). The doc now calls the order the D3D11 reading and says a pipeline sets the write only when depth is enabled. The docstring says only the decoded fields are range-checked; the raw bytes are kept unchecked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @King1565, both notes were right; fixed in dc6be36. The doc no longer argues for the order: depth off turns writes off, so either reading is legal. It calls the order the D3D11 reading and says a pipeline sets the depth write only when depth is enabled, so the (0, 1) row writes nothing. The docstring now says only the decoded fields are range-checked and the raw bytes are not. Body updated. Thanks also for the mutation run. @Kam471 thanks; agreed on the merge order. AI-assisted (Claude Code). |
Kam471
left a comment
There was a problem hiding this comment.
Head now dc6be36e — one commit on top of the c4767f62 I reviewed; doc and docstring wording only.
- The depth row no longer claims the (1,0)/(0,1) pairs prove the enable/write order: both orders are legal because depth-off suppresses writes, and the row now says the order is the D3D11 reading and that a row's pipeline sets the depth write only when depth is enabled. That is the honest reading.
- The docstring now says a decoded field outside its range is an error while the raw bytes are not range-checked, matching
decode_raster/decode_depth/decode_blend. python -I -m pytest tests/test_sgd5_pass_pipelines.py -q→ 11 passed, 10 subtests.git diff --check origin/main...HEAD→ clean.- Stacking note unchanged: #5207 is still OPEN and the diff against main contains its commits, so merge #5207 first and rebase this.
Verdict: LGTM once #5207 lands.
|
Tested dc6be36 merged with main 561b65a on Linux (WSL2), Python 3.12.16: pass
Not rechecked: the per-byte "Measured values" column of the new table (e.g. byte 1 of the rasterizer row is 1 in 25 rows, 2 in 35, 3 in 4), which is a different tally from the pass counts above. The doc is careful to call the D3D11 order of the names a reading rather than a measurement. |
larpinguser
left a comment
There was a problem hiding this comment.
Summary: Adds tools/sgd5_pass_pipelines.py to decode the rasterizer, depth/stencil, and blend rows each SGD5 pass selects, emitting a distinct graphics-program-set manifest plus pass rows for link checking. docs/sgd5_render_states.md records measured field tables; tests build synthetic passes and state rows.
Why merge: Measured state bytes become actionable pipeline sets for shader_link_check.py, with the evidence documented alongside.
Verdict: Approve
|
Summary: Adds Why merge: Measured state bytes become actionable pipeline sets for Verdict: Approve |
Claimed in the coordination issue as: SHADER-888 (build the graphics pipelines the effect database defines, claim). This is its render-state step.
Depends on: #5207 (stacked on it: this branch contains #5207's three commits; the new work is the commits from 8aa02e7 on).
What and why
Each stored SGD5 pass selects one rasterizer, one depth/stencil and one blend row (pass bytes 6, 7, 8;
docs/sgd5_render_states.md). The rows were located but not read. To build each pass's pipeline with the game's own states, the measured fields need to be decoded, and the ones the data doesn't pin need to stay raw.tools/sgd5_effects.py:Effect.tableskeeps(count, first_row, width)for the four state tables. They are recorded in the existing width loop, so there is still one parser.tools/sgd5_pass_pipelines.py:--passesrows gainraster_state,depth_stateandblend_state, withnullfor an empty table.--states FILEwrites the distinct decoded rows with the number of passes that use each.docs/sgd5_render_states.md: an offset table from the byte distributions over every stored row (64 rasterizer, 124 depth/stencil, 398 blend), and the per-pass distributions.What the data pins, and what stays raw:
frontorbackculls is not established, and those bytes stay raw.Tested
Windows 11, own 1.0.2.1 copy, Python 3.13. CPU only.
--passesand--statesare byte-identical before and after the shared-row change.python -I tests/test_sgd5_pass_pipelines.py: 11 tests OK. Six are new, on synthetic databases fromtests/test_sgd5_effects.py's builders, which take astates=argument now. They cover a decoded row of each kind, an empty table givingnull, an out-of-range selector on each of bytes 6/7/8, a nonzero selector into an empty table, rows outside the measured ranges for all three kinds,--statescounts, and passes on one row sharing its decoded object.tests/test_sgd5_effects.py(OK, 1 package test skipped),tests/test_docs_links.py,tests/test_text_write_line_endings.py,python -m compileall -q tools tests: OK.AI-assisted: yes (Claude Code).
Checklist
docs/design.md, with how it was confirmed. N/A: no translator change.🤖 Generated with Claude Code