Shaders: preserve raw scalar buffer loads on NVIDIA #437
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!437
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/437/head"
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?
@bodnjenie14 on GitHub · 2026-11-24 03:21 UTC · original
bodnjenie14:fix/rtx-scalar-byte-loads→main· +378 −53 · 4 files · 3 commits · closed without mergingDepends on #136 by mpDom. This draft carries that PR's commits. The focused follow-up is 598d221.
Scalar GPU loads use byte offsets. When the host descriptor is a raw buffer, emitting a structured DXIL handle based on the console stride can return zero on NVIDIA. This change emits a raw handle and uses the byte offset directly. The plain-buffer descriptor data path also uses the raw handle.
A synthetic shader test binds a raw SRV, supplies console metadata with a 16-byte stride, and reads at byte offset 20. On the same Windows machine, the test returned
0on the unpatched #136 head and86with this change. The shader suite reported 70 passing tests. The asset policy check passed.The executable built from this draft rendered the intro and loading screens in a local run. World loading later ended with
DXGI_ERROR_DEVICE_HUNG. The synthetic test above isolates the startup shader fix.@marquezinii on GitHub · 2026-11-24 03:43 UTC · original
Verified on an NVIDIA RTX 5070 (driver 621.24, the only adapter in the machine), Windows 11, rustc 1.98.1, debug, each head built in its own target directory:
scalar_buffer_load_uses_byte_offsets_with_a_raw_host_view8ae232f+ only this PR'svalu_tests.rsleft: [0],right: [86]598d221cargo test -p victory-shaderon598d221: 70 passed, 0 failed, 3 runs in parallel. The validator picked up the Windows SDK'sdxil.dll(10.0.26100.0), so the modules were validated, not skipped.Not covered: the title (no game data here) and other GPU vendors.
@QemmHD on GitHub · 2026-11-24 05:11 UTC · original
Tested
598d221merged ontomaind2a4bae, native Windows 11, RTX 4070 SUPER (driver 621.24).cargo test --workspace --locked: 265 passed, 0 failed, 4 ignored (main: 264 / 0 / 4). One new clippy warning:type_complexityatemit/mod.rs:322(from #136's8ae232f).Your test on
mainalone reads 86 on hardware and on WARP; with #136'slower.rsit reads 0 on the 4070 SUPER and 86 on WARP.mainalready uses a raw handle for SRV scalar loads (lower.rs:2768), so this repairs #136; folding it into #136 would be safer than landing both.The reverse case also reads 0 on NVIDIA. The host view follows the title's view kind (
descriptor/host.rs,buffer_srv), so a titleStructuredBuffergets a structured host view. Same program withStride::Structured(16): a raw handle (this PR) reads 0 on the 4070 SUPER, a structured handle (#136) reads 86. WARP reads 86 in all four combinations:So on NVIDIA the handle kind has to match the host view kind, and neither fixed choice is right for every title buffer. The test is
scalar_buffer_load_reads_a_structured_host_viewon QemmHD/VIctoryrepro/437-view-kind-both-ways(2f15ef1); it fails on the 4070 SUPER (left: [0], right: [86]) and passes withVICTORY_WARP=1. Keying the handle kind on the host view per slot, or making title buffer views one kind, would cover both rows.No game data used.
AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.
@fuzeofficlal on GitHub · 2026-11-24 05:53 UTC · original
I tested the descriptor reconstruction on
598d221by reading both the scalar load at byte offset 20 and descriptor word 2 in the same synthetic dispatch. With an actual raw host SRV, both stride-metadata settings (0 and 16) returned[86, 32]on the RTX 5090 (32.0.16.1656) and WARP. The translated shaders passed the Windows SDK DXIL validator (1.8.2502.11).For comparison, independent DXC HLSL on the same 32-byte allocation returned
[86, 32]with a raw view and[86, 2]with a 16-byte structured view on both adapters. The second value is bytes for the raw view and records for the structured view. The translated result covers the matched raw binding. The structured result is the HLSL reference for testing the view-kind selection discussed above.@slint6614-dev on GitHub · 2026-11-24 10:54 UTC · original
Corpus run on the full retail shader pack (26,503 containers), Windows 11, AMD RX 9070 (Adrenalin), dxil.dll from SDK 10.0.26100. This PR conflicts with current main, so it was built at its own base (main before #612; there
translate --validate --pipelinescompletes, with VS/PS 12272 / 12172, CS 1693 / 1670, MS 8191 / 8129).victory translate shaders.rpf --validate --pipelinescrashes with an access violation (exit code 0xC0000005) right after loading the validator, with no Rust panic message. It reproduced twice, on two separate builds.victory translate shaders.rpf --validate --jobs 1(no host pipelines) completes: VS/PS 12619 / 12619, CS 1796 / 1697, MS 8355 / 8302 (the same counts as #136, which this branch seems to include).So one of the modules this PR emits seems to crash the host pipeline path (the driver or our D3D12 calls) on AMD. My earlier #136 run did not create pipelines, so I cannot say yet whether the crash comes from #136 or from this PR. I have not isolated the module yet.
@bodnjenie14 on GitHub · 2026-11-24 15:44 UTC · original · edited 2026-11-24 15:45 UTC
Rebased onto
mainatffe310eand pushed7a29f52. GitHub now reports no merge conflicts, so this is ready for another look. The scalar byte-load regression passed, and the shader suite finished with 121 passed and 1 ignored.@DeerSilver on GitHub · 2026-11-24 17:48 UTC · original
Tested head
7a29f52merged ontomainffe310e(clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only.scalar_buffer_load_uses_byte_offsets_with_a_raw_host_viewpasses on the RTX 5060 (hardware device, not WARP), and so does the rest of the workspace: 343 passed, 0 failed, 6 ignored, against 342 / 6 onmain.valu_tests.rsontomainffe310eand keptmain'slower.rs: the test passes there too, reading86. So on currentmain, on Blackwell, I can't reproduce the0you saw on the #136 head. Either something onmainalready covers this case, or the failure is specific to the #136 head or your GPU. Which GPU did you see the0on?-D warnings, as CI runs it, on lines this PR adds:type_complexityatemit/mod.rs:334:fn psv_interp(...) -> Option<Vec<(Option<u32>, u8, u8, u8)>>needless_borrowatemit/valu_tests.rs:133:io::raise(&p, &native)inlower_compute, wherenativeis already a referenceAI-assisted (Claude Code).
@Daniel333313131 on GitHub · 2026-11-24 22:18 UTC · original
Translation census with this PR merged alone onto
mainffe310e: it adds the most programs of the 12 shader PRs I ran.Setup: release build,
victory translate <dump>/shaders.rpf --list(26,084 programs, no--validate, no--pipelines), Windows 11, RX 7900 XTX. The PR's head is7a29f52.mainThe first refusal per program changes like this (
main→ #437):mainIn game (diag build, two runs each, stopped after 180 s):
main981 / 976 ms per world frame, #437 1202 / 1167 ms. With #437, more draws per frame were dropped while their pipelines were still being made (2281 / 1542 against 1242 / 915). That is expected with ~850 more programs to build, and 180 s is too short to see it settle. Both setups still end in the freed-texture page fault that #431 addresses:mainafter 161 s and 106 s; #437 after 68 s in one run, and the other's log stopped at 134 s. So this run says nothing yet about whether the newly translated programs render correctly.AI use: Claude Code (Claude Opus 5.5) merged and built the commits, ran the census and the title, compared the outputs and wrote this comment. The numbers come from the runs above.
Pull request closed