shader: take a descriptor's address however many dwords the load reads #118
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/118"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T12:39:02Z.
shader: take a descriptor's address however many dwords the load reads
A descriptor read only as data — nothing uses it as a descriptor, the code
just wants its address — is answered with the host's
USER_VIEW_ADDRESSdwords. That path required
count <= 4, sos_load_dwordx8(8) ands_load_dwordx16(16) were refused outright:Four shaders in #38 hit this (
2fd01fca16993001,6b6db9f1a526daeb,abc6a80d46edc294,7d0f14ce44746d7e). Nothing about the host side needs thelimit: it fills dwords 0 and 1 from the view at that table offset
(
draw.rs,USER_VIEW_ADDRESS,descriptor::view(table + dword * 4)) andnever looks at how many dwords were read.
The rest of the load's dwords are
Missing, exactly as dwords 2 and 3already were for a
s_load_dwordx4. So a program that only takes the addressworks at any length, and one that does arithmetic on the other dwords is
refused where it uses them — the same contract at 1, 2, 4, 8 and 16.
view_addressalso accepted only a 4-dword table entry; it now takes theconsole's other buffer size, 8.
Tests, and both directions of each
Mine —
a_descriptor_load_of_eight_dwords_answers_with_the_address, as_load_dwordx8 s[8:15], s[4:5], 0x0of an unused table entry, asserted to askthe host for exactly the two address dwords. Fails on the code before this
change, passes after.
Zhelezniak Artem's (@Artking175, from
ecfda9ec), which cover the case minedoes not — a
s_load_dwordx16, and what happens when a consuming store readsa dword the host has no value for:
a_sixteen_dword_descriptor_load_supplies_both_address_words— stores bothaddress dwords to a separate UAV, for 4- and 8-dword table entries, and
validates the DXIL.
a_sixteen_dword_descriptor_load_refuses_storing_a_missing_word— uses dword15 in the stored value and asserts the refusal at the store,
0x24:a descriptor's address or format read as data.I reproduced his result before taking the patch: reinstating
count <= 4onthis branch makes both his tests fail with
a descriptor read only as dataatoffset: 36(0x24), which is what he reported formain.Verification
Windows 11, RTX 5070 Ti, Rust 1.98.1 (pinned), MSVC 14.44.35207, Windows SDK
10.0.26100.0,
VICTORY_DXILset. No game files.What is not claimed
I have not seen those four shaders translate. What is established: the length
is no longer a reason to refuse, the address path is exercised at 8 and 16 by
tests that fail without the change, and 218 tests pass. Whether each of the
four now lowers, or stops at a later and real limit, is what
victory translate --listovershaders.rpfwould say — and that needs gamefiles.
The fifth shader I first counted,
ceb5eb68cd99cb07, reads a descriptor'sformat as data rather than only its address. It is a different code path and
this change does not move it;
…refuses_storing_a_missing_wordabove is whatpins where it stops.
Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T14:14:20Z.
I added two synthetic regression tests for the
s_load_dwordx16case on top ofab387f1. Test commit · Patch0x24) witha descriptor's address or format read as data.With the same tests on main (
90b529f), both reproduceda descriptor read only as dataat0x24. Reinstating just thecount <= 4guard on this PR also reproduced that refusal in the first test.Both tests passed on macOS and on Windows 10 22H2 with an RTX 2060 (driver 531.41). On Windows both builds included #121 and #11 for the test runtime, used Agility SDK 1.608.2 and confirmed hardware SM 6.6. DXIL for both address cases passed the pinned 1.8.2505.32 validator. The full Windows shader suite finished with 214 passed, 0 failed, and 3 ignored. Windows Clippy passed with all targets, all features, and
-D warnings.This was a synthetic check. The five shader containers from #38 still need an offline comparison.
Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T14:35:27Z.
Thanks — I took both, and I reproduced your result before doing it.
What I checked, on this branch (
ab387f1+ yourecfda9ecapplied):That matches what you reported for
main, which is the part that matters: it says the guard is what those two tests depend on, and not something incidental to how I wrote the branch.Your second test is the one I was missing. Mine only asserts that a
s_load_dwordx8of an unused entry asks for the two address dwords — it never reaches a consumer, so it cannot tell "the address is right" from "the missing dwords behave". Using dword 15 in a stored value and pinning the refusal at0x24is exactly the case that distinguishes them, and it also settles a thing I had only asserted in prose:Your
…refuses_storing_a_missing_wordis now the executable statement of that sentence, so I corrected the comment inlower.rs— it said "five shaders", which I had already amended in the description but not in the code. It says four now, and points at your test for where the fifth stops.What is now on the branch:
a_descriptor_load_of_eight_dwords_answers_with_the_addressa_sixteen_dword_descriptor_load_supplies_both_address_wordsa_sixteen_dword_descriptor_load_refuses_storing_a_missing_wordcargo test -p victory-shader --libis 218 passed, 0 failed, 2 ignored; clippy clean;cargo xtask policy172 files ok, on Windows 11 / RTX 5070 Ti / Rust 1.98.1 / MSVC 14.44.35207 withVICTORY_DXILset.One thing I cannot do that you can: you ran this on macOS and on Windows 10 with an RTX 2060; I have only Windows 11 and one card, so your run is the wider evidence for the container and validator behaviour, not mine.
You are right that this is synthetic. The five containers from #38 still want the offline comparison — I have no game files, so
victory translate --listovershaders.rpfis not something I can run. If you have them, the interesting question is whether the four name a different reason now or disappear; either answer is worth having, and the fifth should stay ona descriptor's address or format read as dataif I have read it correctly.Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T16:11:03Z.
Offline retest on RTX 2060 (driver 531.41), with app-local Agility SDK 1.608.2 and DXIL validator from DXC 1.8.2505.32. I ran
translate --jobs 1 --validate --pipelines --liston the same local 1.0.2.1 shader archive.All five #38 containers were present. The exact head
2dd6396failed to compile invictory-shader. Three unrelated lowering hunks inlower.rsreference missingflags::DOUBLES,Types::f64,Cast::FPTruncandCast::FPExt. I removed those three hunks in a local test build, retaining both descriptor hunks and the fullemit/mod.rsfrom this head.2fd01fca16993001a descriptor read only as data0x51c46b6db9f1a526daeb0x49dcabc6a80d46edc2940x48087d0f14ce44746d7e0x5204ceb5eb68cd99cb07a descriptor's address or format read as data0x38The first four did emit, validate and create PSOs on #69 (
811d2ca) in the same run matrix. The fifth still refuses there.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.