Shaders: s_buffer descriptor reads, signature/PSV0 fixes, gather4_l, a16 samples (+479 VS/PS, +200 mesh validated) #136
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!136
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/136/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?
@mpDom on GitHub · 2026-11-24 00:51 UTC · original
mpDom:pr/shader-sbuffer-psv0-gather4l→main· +307 −51 · 3 files · 2 commits · closed without mergingRaises the number of GTA VI shaders in shaders.rpf that translate and pass dxil.dll validation (translate --validate, all 26,503 containers):
vertex/pixel 12,690 -> 13,169 of 13,169 emitted (0 validator errors), mesh ~8,100 -> 8,302 of 8,506, compute 1,672 -> 1,717 validated (2,032 emitted).
Tested: cargo test -p victory-shader -p xtask (0 failures).
@DaviTostes on GitHub · 2026-11-24 00:53 UTC · original
Tested
8ae232fon Arch Linux x86_64, rustc 1.98.1:cargo test -p victory-shader: 51 passed, 0 failed (2 test binaries). The full workspace still needs #112 for thevictory-gpuE0425.calculateLOD,image_gather4_l). A regression in one of them would not show in this run; small fixtures per feature (or splitting the PR) would make review and bisecting much easier.victory-shadertests; the new paths are simply unexercised here.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
@HenriqueSBueno on GitHub · 2026-11-24 01:05 UTC · original
Tested on NVIDIA. This PR turns the menus black here. Windows 11, RTX 3080 (10 GB, driver 616.92), i5-10400F, 32 GB RAM, retail title, diagnostics build, no pad input.
mainat9aef3d9: the first-boot screens and the account prompt render. Captured frames ~1200–2400 are real images.mainat9aef3d9+ this PR (8ae232f), same run: every captured frame is black (0,0,0), and there is no audio.E_OUTOFMEMORY. The driver is out of memory compiling them; it isn't host memory, since the process sits far below the limit there.mainhas none of these:Counts in the same ~110 s run:
E_OUTOFMEMORYrefusals 0 onmain, 11 with this PR.E_INVALIDARGrefusals are 3 in both runs.Bisect, 110 s each:
mainrenders.main+ #135 + #136 + #40 is black.main+ #136 alone is black. Happy to rerun a newer head on this card.AI-assisted (Claude Code)
@Sunkiller-qc on GitHub · 2026-11-24 01:05 UTC · original
The a16 sampling part here (full-dword offset/bias/compare, packed coordinates,
_clclamp,lower.rs:5324and:5559) is almost line for line the same as #73 (lower.rs:5233and:5461there), and the two PRs conflict. #138 is also stacked on #73. Would you consider rebasing this on #73, or dropping that part, so only one version lands? The other changes (s_buffer descriptor reads, ISG1/OSG1/PSV0, gather4_l) don't overlap.Static review, not built or run.
@ifBars on GitHub · 2026-11-24 01:16 UTC · original
I tested the three scalar-buffer hunks from
8ae232fon Windows 10 with Microsoft's DXIL validator and a native D3D12 device (RTX 3060 Ti, driver 610.88). The input was a private sample of 50 previously rejected shaders from first-story loading. Baseline was 9 validated programs and 9 host pipelines. With just the scalar load and descriptor changes it was 13 validated and 13 pipelines. The four additions were vertex shaders. All nine baseline successes remained.This measurement isolates the scalar changes from the sampling, gather and signature changes. It covers pipeline creation; it does not measure output pixels.
@ifBars on GitHub · 2026-11-24 01:24 UTC · original
A follow-up title test found a startup regression worth isolating. With the three scalar-buffer hunks together, four shaders gained pipelines but the returning-profile Player screen rendered uniformly black. Keeping the descriptor reconstruction hunks while restoring the ordinary scalar SRV load path kept all four vertex pipeline gains. On that build the Player capture matched the known-good reference pixel for pixel, and the original movie and the first two story cards rendered. One run per configuration, with cold host pipeline libraries.
@Sunkiller-qc on GitHub · 2026-11-24 01:29 UTC · original
Follow-up to my earlier note: I suggested rebasing the a16 part on #73, but both versions read an a16 LOD bias as a full f32 dword (
lower.rs:5660-5661here). Witha16it's an f16 in the low half of its dword, and the high half is undefined (LLVMlowerImage, D111754). #160 handles it that way. So whichever version lands should convert the low half (legacyF16ToF32) instead ofas_floaton the dword.Static review, not built or run.
@Raxstreams on GitHub · 2026-11-24 01:26 UTC · original · edited 2026-11-24 01:31 UTC
I tested the explicit-mip gather change on seven
meshlet_culling:CS_BatchCull*compute shaders from a world-loading run. This was an offline A/B on Windows with an RTX 3080 Ti (617.14), using the 10.0.26100 DXIL validator and D3D12 compute pipeline creation.Before adding this PR to my integration branch, all four shaders using
image_gather4_lstopped at that instruction. With the change, all four validated and created pipelines: the threeCS_BatchCullPreSkinnedMeshletsvariants andCS_BatchCullBatchCSMeshlets. The three other batch-cull variants still stop ata hardware SGPR inputin both builds.Both builds include the local integration of #180. I kept the pre-PR ordinary scalar SRV read path in the second build given the Player-screen report above. This result covers translation and pipeline creation. I did not run a frame or compare gather output pixels.
The complete 311-shader replay has now finished. Adding this integration to the #180 build raised the count passing both checks from 53 to 65. In addition to the four gathers, eight shaders previously stopped at
a scalar memory read as datapassed, including aCS_PedStandardSkinningvariant. All 53 previous successes still passed.@r4tedx on GitHub · 2026-11-24 01:43 UTC · original
A note on the a16 samples in this PR, from comparing with #160 (same family): the bias dword is read here as a full f32 (
addr_dword, with the comment that offset, bias and z-compare are always 32-bit). For the bias that does not hold with a16. LLVM'sSITargetLowering::lowerImage:The bias keeps its own dword but is an f16 in the low half; offset and comparison reference are 32-bit as the comment says. Read as an f32, an f16 bias is a denormal near zero, so a biased a16 sample would silently lose its bias.
Also, in case it applies here: on GFX10.3 a16 packs the coordinates and the level but not the derivatives (only
_g16opcodes have 16-bit derivatives); LLVM'sgfx10_asm_mimg.shasimage_sample_d ... 2D a16with five address dwords. The decoder onmaincounts them packed, which I fixed in #160.From the sources only, not run on hardware. No game data used.
@r4tedx on GitHub · 2026-11-24 03:08 UTC · original
Two more review notes on this PR (besides the a16 bias above), both about results that can change without a refusal:
image_gather4_las fourtextureLoads. The emulation clamps the texel coordinates to the edge and never uses the sampler, so a gather through a wrap, mirror or border sampler reads different texels at the edges than the console does. For level 0 a realtextureGatherkeeps the sampler's address mode (#160 does that and refuses other levels); the emulation is only needed for levels other than 0, and there it could apply the address mode from the sampler state, or refuse samplers that are not clamp.fill_phis. A phi edge that isMissing("a descriptor's address or format read as data" | "a descriptor read only as data")now becomesi32(0)whenever another edge carries data. Nothing checks that the value is dead on the path that takes the edge, so a program that does use it there gets 0 instead of a refusal.The s_buffer descriptor-read fix (the part behind the 726 to 0 count, and the
a scalar memory read as datarow of #293) looks like the piece testers need most. Would you consider splitting it into its own PR, so it can go in without the two points above?From reading the diff only; I have no copy of the title.
@MichailiK on GitHub · 2026-11-24 03:43 UTC · original
Ran the full corpus (26,084 programs) and the game on an NVIDIA RTX 3060 12 GB
a scalar memory read as data: 573 -> 0. Emitted +41 VS/PS, +11 CS, +29 MS. 80 of the 81 validate, 80 create host pipelines (one invalid module, one wave64 compute the host refuses, as on main).a descriptor's address or format read as data71 -> 547.E_OUTOFMEMORYrefusals (21 compute, 10 mesh).@claude-GTA6 on GitHub · 2026-11-24 06:01 UTC · original
From a tester working with Claude (AI-assisted); measured on my own machine.
Heads-up from an RTX 5090 (driver 621.24, Windows 11 26200): #136 alone turns every first-boot and loading screen black. #437 fixes it, so the two should probably land together, or #437 first.
How I found it: I bisected with a diag build, capturing presented frame 256 (the start screen), no input:
d2a4bae+ #305 + #177 + #197d112889, a16 samples)8ae232f)Within
8ae232f, it isn't the PSV0 interpolation modes or the signature sort order (both reverted, still black). It's in thelower.rspart. Given #437's title ("keep scalar byte-offset loads compatible with raw buffer views"), I'd guess it's the raw-to-structured switch for scalar/buffer loads when a stride is declared.Same effect on the loading screen: its art is drawn into a colour target, but the pass that copies it into the sRGB target outputs nothing. With #437 the art shows again.
Validated counts over the whole package don't show it: #136 is +651 validated, but those shaders draw the wrong thing.
@jeremygold02 on GitHub · 2026-11-24 06:56 UTC · original
Verified the scalar structured-SRV path on two vertex shaders at
8ae232f1d7on Windows 11. Both fail on the same scalar descriptor-data read on the PR merge base (9aef3d9) and on my mission build. Both emit DXIL and pass Windows SDK 10.0.26100.0 validation with this PR.I checked the descriptor actually supplied by the title at draw entry, before the missing host PSO rejects the draw. Across the two shaders the observer recorded 14 and 11 distinct declarations for the relevant table slot. All were buffer SRVs with
DXGI_FORMAT_UNKNOWN, the RAW flag clear andStructureByteStride=80; element counts ranged from 10 to 256 overall. Each original shader also has a singleton structured-SRV declaration covering that register. This verifies the shape of this slot for these observations.In both validated outputs the count comes from
GetDimensionsonStructuredBuffer<stride=80>. The scalar load uses(record_count - 1) * 80as its byte address and splits it into the record index and the offset within that record. All 21 scalar dword loads on that table expression in each shader use the same stride.I exercised the changed lowering separately on a physical RTX 5070 with a one-thread synthetic shader and three 80-byte records. It reported 3 records. With a matching guard, reads at bytes 160 and 164 returned the two expected third-record words; with a mismatched guard, both initialized output words remained intact. The adjacent sentinels stayed intact and both fences completed with the device reporting
S_OK.The two guest vertex shaders were checked through SDK validation. Their graphics PSOs, actual draws, and effect on the mission picture remain unverified.
@iurysf on GitHub · 2026-11-24 07:21 UTC · original
Measured offline against main
d2a4baewithvictory translate --list --validateover the title'sshaders.rpf+ executable (26,096 programs), dxil.dll 1.9.2602.17:dx.valvercase that #306 fixes.descriptor_datainlower.rs. Resolved by hand, the union is strictly better than either one alone: +39 programs over this PR, and every vertex/pixel and compute module that emits validates. The resolution (~40 lines) is on a branch you're welcome to take: https://github.com/iurysf/VIctory/commits/union-136-180 (merge commitdf69a52). I'm not opening a PR for it, since it's your and #180's work.lower.rsand 2 ofmod.rs. Part of that is because it repeats #306's a16/centroid/ISG1/PSV0 fixes, so dropping those here would shrink the conflict.AI-assisted.
@slint6614-dev on GitHub · 2026-11-24 07:32 UTC · original
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate, against maind2a4bae(emitted / validated):cargo test -p victory-shaderimage_gather4_l(12 refusals, all compute): cleared by #694, #160 and #136; the 12 programs then validate.image_sample_d_cl(27 refusals): cleared by #694, #563 and #160, but only #563 (cube gradients) turns 25 of them into validated pixel programs; with #694 they stop on another reason.Windows 11, dxil.dll from SDK 10.0.26100.
Pull request closed