Shaders: lower static samplers and uniform descriptor trees across control flow #135
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/135"
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 VastyViz on 2026-11-25T13:39:21Z.
Support immediate (static) samplers chosen by uniform control flow (
Source::Phi/Source::Select), and generalize uniform descriptor lowering to arbitrary nestedLoaded/Phi/Selecttrees:SamplerChoice,resolve_sampler,sampler_tag, andwith_samplerincrates/victory-shader/src/emit/lower.rs:Source::PhiandSource::Selecttrees containingSource::Constantstatic samplers (optionally mixed withSource::Loadedheap samplers), deduplicates static sampler descriptors inself.samplers, and produces a wave-uniformi32selector tag (collapsing straight toSamplerChoice::Singlewith no extra blocks when all paths pick the same static sampler).D3D12_STATIC_SAMPLER_DESCkeeps a constant binding handle (no dynamic indexing of static samplers), extracting the active scalar channels in each arm and joining them with scalar phis in a fresh join block while preserving wave-uniform derivatives.descriptor_phiand two-leafSource::Selectpaths with a unified recursiveuniform_heap_indexhelper handling nestedSource::Loaded,Source::Phi, andSource::Selectdescriptor trees.emit::waterfall_tests::static_samplers_chosen_by_control_flow_and_select_sample_correctlytestingSource::Phi(static WRAP vs static CLAMP),Source::Select(s_cselect_b32), and mixedSource::Phi(static WRAP vs heap CLAMP) on a 2x1 texture atu = 1.25.Verification
26,503containers,dxil.dllvalidation):emit: a descriptor chosen by control flow:40 -> 0(all 40 eliminated).14,156 -> 14,193emitted (+37),14,045 -> 14,082validated (+37, 100% of new emissions validated).8,762 -> 8,765emitted (+3, reaching 8,765 / 8,765 = 100% mesh emission),8,657 -> 8,660validated (+3).26,084translated programs.2/2pipelines created).cargo clippy --workspace --all-targets --locked -- -D warnings— passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings— passed.cargo test --workspace --locked— passed (victory-shader:211 passed, including the new RTX 3080 + WARP sampler dispatch tests).cargo xtask policyandgit diff --check— passed.Imported from Zettrox/ztrx. Originally posted by azimaus970 on 2026-11-25T14:51:16Z.
Independently tested
a989523on Windows build 26300.9974 with NVIDIA driver 32.0.16.2140. The focused static_samplers_chosen_by_control_flow_and_select_sample_correctly test passed (1 passed, 0 failed, 0.89 s).A rerun from a temporary copy with adapter logging confirmed that all three sampler cases passed on both the NVIDIA GeForce RTX 3060 Laptop GPU and Microsoft WARP (Microsoft Basic Render Driver). The rerun passed in 0.90 s with Cargo exit code 0. No game files were used.
Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T15:01:27Z.
Independent synthetic sampler retest on
a989523, Windows 10 22H2, RTX 2060, driver 531.41. I applied #121 for the unit-test executable's Agility SDK 1.608.2 support and logged each adapter and readback. The validator was pinned todxil.dll1.8.2505.32.The RTX 2060 reported SM 6.6. All three cases (static
Phi, staticSelect, and mixed static/heapPhi) created compute pipelines and returned1forcond=0and4forcond=1, as expected. The completeemit::waterfall_testsgroup had 6 passed, 0 failed. The new test skipped its WARP executions because WARP on this machine reported SM 6.2. No game files were used.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.