Repository navigation
Shaders: lower image_store with any non-zero channel mask (including sparse) - #146
davi713albano-coder wants to merge 1 commit into
Conversation
e232f2a to
67f7ff0
Compare
|
RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main |
Port of fxceless/victory-fork#146 (67f7ff0) by davi713albano-coder. image_store packs the channels its dmask enables into consecutive VGPRs (16-bit halves with d16), in channel order, and writes 0 to the others. DXIL's typed textureStore writes all four channels, and the host format drops those past its width, so the disabled ones are written as 0.0. A store with dmask 0 writes nothing. Before, only dmask 0xF was taken, and the 0x218 programs' partial stores were refused ("an image store of some channels", 60 of the 200 descriptions captured in game). Of those 200, 64 now reach a hardware pipeline (24 before). The channel order and the zeroed channels follow AMD's MIMG description as the PR and other RDNA2 translators read it; the test checks this lowering (10 masks, sparse and d16 ones included) on the host, not the console's hardware. Adapted here: the test's HostShader takes the two fields this tree adds. Co-Authored-By: Castyan <120135015+Castyan@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for this change. It is ported to DexNom/VIctory#64 as How it does on real code there: the compute programs a title passes to device method 0x218 use partial The same rule (given channels first, the others written as 0) was applied to typed buffer stores of fewer than four channels ( Details: DexNom/VIctory#64 (comment) 🤖 Generated with Claude Code |
…zero channel mask (including s) head 67f7ff0
Summary
Lowers
image_storefor all non-zero channel masks (0x1..=0xF, including sparse masks such as0x5,0x9,0xD, both 32-bit float andd16packed f16) and treatsdmask == 0as a no-op (without normalizing it to0x1as loads/samples do).In RDNA2,
image_storepacks only the channels enabled bydmaskinto consecutive VGPRs (or 16-bit halves whend16is set) and writes0.0to disabled channels. DXIL typed UAVdx.op.textureStore.f32requires a full0xFwrite mask on 4-component declarations (the host format drops channels past its width), so disabled channels are zero-padded with0.0f32.Changes
crates/victory-shader/src/emit/lower.rs:dmask == 0intact forimage_store(returningOk(())as a no-op instead of normalizing to&1).d16halves for each enabled bit indmask(0x1..=0xF), zero-padding unselected channels with0.0f32, and emitdx.op.textureStore.f32(..., 0xF).crates/victory-shader/src/emit/valu_tests.rs:image_store_partial_dmask_writes_expected_channelstesting 10 cases (0x0,0x1,0x3,0x7, sparse0x5,0x9, andd160x1,0x3,0x7,0xD) againstdxil.dllvalidation and live D3D12 WARP 4-channel RGBA readback.Verification
windows-latest): https://github.com/davi713albano-coder/victory-fork/actions/runs/45494029704cargo clippy --workspace --all-targets --locked -- -D warnings: passedcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passedcargo test --workspace --locked(includingxtaskasset-policy check,dxil.dllvalidation, and D3D12 WARP readback): 497 passed, 0 failed (emit::valu_tests::image_store_partial_dmask_writes_expected_channels ... ok)(No title data used. AI-assisted.)