Shaders: lower buffer record-count reads without buffer uses #58
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/58"
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 IAmTheSween on 2026-11-25T06:46:40Z.
Fixes
ShallowWaterSim:CS_MinTimestepReduce_5447091c_Wrapped(ceb5eb68cd99cb07, named in #38) failing inemitwith"a descriptor's address or format read as data".Cause
At
0x28,ShallowWaterSimCS_MinTimestepReduceloads a 4-dword structured SRV descriptor (s_load_dwordx4 s[0:3], s[4:5], null) and checks dword 2 (s2 == 0at0x34) for an empty buffer before doing any work, without issuing anybuffer_*instructions againsts[0:3]. Becauseuse_atwasNone,descriptor_datafell through to theview_addressfallback, which populated dwords0..1(even though unread) and marked dword 2 (num_records) asVal::Missing("a descriptor's address or format read as data").What is in it
crates/victory-shader/src/emit/lower.rs:Lower::buffer_props,Lower::dimensions, andLower::buffer_recordsto sharedx.op.getDimensionsand raw-stride record-count calculation across both paths ofdescriptor_data.Tablebuffer descriptor (SrvorUav) has nobuffer_*use (use_atisNone), resolves itsUsedResourceentry: readsview_addressonly when the low address dwords0..1are actually read (avoiding spuriousUSER_VIEW_ADDRESSuser-data requests), and populates dword 2 (num_records) viadimensions+buffer_recordswhen dword 2 is read.buffer_record_count_without_buffer_ops_lowersverifying that checking dword 2 compiles cleanly without requestingUSER_VIEW_ADDRESSfor the unread low dwords.Shader pack check
ShallowWaterSimCS_MinTimestepReduce_5447091c_Wrapped(ceb5eb68cd99cb07) withvictory.exe translate --validate --pipelines:1 emitted of 1 compute programs; 1 validated, 1 pipelines(passesdxil.dll10.0.26100.0validation and RTX 5070 pipeline creation).Tested
dxil.dll10.0.26100.0.cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings).cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings).cargo test --workspace --locked -- --test-threads=1: all suites passed with 0 failures (victory1,victory_core11,victory_formats24 / 4 ignored,victory_game2,victory_gpu110 / 1 ignored,victory_hle95 +no_dll_planting1,victory_loader24 +load_probe2 +title_dlls1,victory_pe7,victory_pipeline4,victory_shader211 / 2 ignored,xtask4). Single-threaded execution was used for the full workspace run due to pre-existing WARP device contention whenvictory_gpuGPU tests run concurrently (valu_tests.rs:198).AI use
Written with Antigravity.
Imported from Zettrox/ztrx. Originally posted by futurepro62 on 2026-11-25T15:15:08Z.
Full-suite run on Windows, since this PR has no test report yet. Tested exact head
dcb71f8(on its base90b529f).Tested
rust-toolchain.toml), DXC + dxil.dll 1.9.2602.17, debug.cargo test --workspace --locked: 497 passed, 0 failed, 7 ignored (main90b529fon this machine: 492 passed, 0 failed, 7 ignored).cargo clippy --workspace --all-targets --locked -- -D warnings(the CI lint step): passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings(the CI lint step): passed.buffer_record_count_without_buffer_ops_lowers.Not tested
AI use
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.