Shaders: lower immediate samplers chosen by uniform control flow (100% mesh, +37 PS) #25
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!25
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-25"
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?
@MartinIndra02 on GitHub · 2026-11-24 20:24 UTC · original
MartinIndra02:feat/fxceless-descriptor-phi→main· +381 −61 · 2 files · 1 commits · openSummary
Lowers immediate (constant) samplers chosen by uniform control flow (
Source::PhiofSource::Constant) incrates/victory-shader/src/emit/lower.rs, without requiringphi %dx.types.Handleor dynamically indexed static sampler arrays (both rejected by DXIL / D3D12):Source::Phi(recursively through nestedSource::Phis).self.s.sampler_handle) with no phi or branch.i32phi of the choice index at the join block and emits a uniform branch chain at theimagesample/gather site, where each arm binds its own standard static sampler (s<n>) and merges the 4 sampledf32channels via scalarphi f32.Verification
emit::waterfall_tests::immediate_sampler_chosen_by_control_flowpasses on both RTX 3080 hardware and WARP for both identical and distinct immediate samplers across branches.cargo clippy --workspace -- -D warnings(default +--features diagnostics): 0 warnings.cargo xtask policy: 167 files ok.7b0f736(aggregate counts only, no game data):emit: a descriptor chosen by control flow:40 → 08,762 → 8,765of8,765(100%of all mesh shaders) (+3terrain/shadow mesh shaders)14,140 → 14,177of14,247(+37material, puddle, and reflection pixel shaders)AI-assisted contribution (Antigravity); all code, tests, and hardware verification run and reviewed locally. No game data.
@adriaespii on GitHub · 2026-11-24 20:54 UTC · original
Independent test run on commit
cb80bf0(AMD RDNA4):x86_64-pc-windows-msvc)cargo clippy --workspace --all-targets -- -D warnings: 0 warningscargo test --workspace: 497 passed, 0 failed, 7 ignored (victory-shader: 211 passed, 0 failed, 2 ignored;victory-gpu: 110 passed, 0 failed, 1 ignored)AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.
@m335671 on GitHub · 2026-11-24 21:02 UTC · original
Test run on
cb80bf0(this PR's head) with #23's one-line pad change on top (input only). RTX 4070, Windows. No regression, and no visible change in the prologue scene I tested.Tested
VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024, the same pipeline library as the run it is compared with (#27, run 4 on7b0f736).What changed
1684989and this PR change many translations, about 2,000 pipelines had to be rebuilt. For the first few minutes, frames took up to 9 s and the screen was black or frozen.7b0f736in the same scene (#27, run 4): 4.1 fps, 246 ms, 4,973 draws, 355 dropped. That is within run-to-run noise.shader does not translatehashes and 6 distinct refused pipelines, with identical hashes. So none of the programs this PR fixes is bound in this part of the prologue on my run.Not tested
AI use: the run was done on my machine. Claude Code (Claude Opus 5.5) built it, ran it, read the logs, worked out the figures and wrote this comment.
@arminkhaleghirod on GitHub · 2026-11-24 22:23 UTC · original
Merged onto main
90228a7and ranvictory translate --validateover the full title (26,148 programs) on Windows 11 / RTX 4080.a descriptor chosen by control flow: 40 → 0@nuiiv on GitHub · 2026-11-25 05:14 UTC · original
Test run of this PR on AMD RDNA 2 (merged onto current
main310c6eb, clean merge).Setup
dxil.dllfrom Windows SDK 10.0.26100.0.Results
a descriptor chosen by control flow(selected withVICTORY_TRANSLATE_ONLY),translate --validate --pipelines: 40 of 40 translate, 40 validate, 40 host pipelines created on the card (37 Ps, 3 Ms).immediate_sampler_chosen_by_control_flowpasses on the RX 6650 XT hardware device and WARP (neither was skipped).A possibly simpler alternative, for what it is worth
Independently, I tried picking the sampler by number instead of branching at the sample site: a uniform
i32phi of the immediate sampler numbers at the join, then onecreateHandleFromBindingover the ranges<lo>..s<hi>of the pipeline's static samplers, indexed by that phi (likes[i]of aSamplerState s[]). On this machine, for the same 40 programs, that form also passeddxil.dll10.0.26100 and the driver created all 40 pipelines. A fulltranslate --pipelinesover the title showed 40 gained and none lost. I have only tested it on this one AMD card, so the "rejected by D3D12" case in the description may be NVIDIA-specific or about a different binding shape. I'm only mentioning it as an option, not asking for a change.In the title with this PR (own 1.0.2.1, Series X, fresh shader cache, about 5 minutes into the prologue, full log kept): no device removal, no error. None of the 40 programs was bound: the log has a
shader translatedline for every program used, and none of the 40 hashes is among them (the runtime and offline hashes match; checked with the programs that do fail). That is the same as the RTX 4070 run above. World frames averaged 1.7 fps, 3,883 draws/frame. The programs that failed in this run are 2 Ps "a descriptor read only as data" and 1 Cs "a wave sum of 16-bit floats", none of them this PR's.Not tested: a scene that binds these programs; a visual check of the sampled result.
AI use: Claude Code (Claude Opus 5.5) built the PR, ran the tests and the translation on my machine, and wrote this comment.
@JRamos1993 on GitHub · 2026-11-25 06:08 UTC · original
Offline check on the retail shader pack: this PR, merged onto current
main310c6eb, fixes all 40 "descriptor chosen by control flow" programs, loses none, and changes nothing else.Setup: RTX 5090, Windows 11.
victory translate --validate --listover the title's full shader pack (26,084 programs), with a local DXIL hash on each validated line.main310c6ebmain, and it still merges cleanly.AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.
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.