Skip to content

Shaders: a uniform branch can choose between two immediate samplers (40 programs) - #1096

Open
m335671 wants to merge 1 commit into
fxceless:mainfrom
m335671:port/sampler-choice
Open

m335671 wants to merge 1 commit into
fxceless:mainfrom
m335671:port/sampler-choice

Conversation

@m335671

@m335671 m335671 commented Nov 25, 2026

Copy link
Copy Markdown

What

On current main, 40 programs fail translation with emit: a descriptor chosen by control flow. In each of them, a uniform branch picks one of two immediate (constant) samplers before an image sample. This ports DexNom's fix from DexNom/VIctory ddb7332 (GPL-3.0, the lower.rs part only):

  • When the sampler is a phi of two constants, the sample is taken with both static samplers and the original derivatives.
  • The result from the edge that supplied the console's sampler is kept, through a phi on the join block.
  • If one side has no host block, the other sampler is used directly.
  • image now takes the sampler and calls image_with_sampler; everything else is unchanged.

The commit also carries DexNom's unit test, a_uniform_branch_can_choose_between_immediate_samplers.

Testing

RTX 4070 12 GB (32-lane waves), driver 32.0.16.2124, Windows 11 Pro 26300.

Offline, VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelines over the title's whole shader pack, compared program by program by hash:

pipelines created a descriptor chosen by control flow
main d510ee4 25,608 40
this PR 25,648 0
  • All 40 now translate and the driver creates their pipelines. No program that main creates is lost, and no other failure count changes.
  • By name, the 40 are PS_TexturedDeferred (10); PS_TexturedLit_ReflectionMap, PS_TexturedLit_8 and PS_MirrorReflectionTexturedDeferred (7 each); PS_PuddleDetect (6); MST_DS_TerrainTransform (2); and MST_DS_CascadeShadows_PNTriTexture (1).
  • cargo test -p victory-shader immediate_samplers passes.

In the title (diagnostics build, prewarmed cache, checkpoint to the first room, then idle; VICTORY_INDIRECT_WINDOW=1 VICTORY_LEVELS_ON_DEMAND=1 VICTORY_JOIN_PARTS=1 VICTORY_BACK_OWN_VIEW=1 VICTORY_COPY_PLAIN=1 VICTORY_INDIRECT_GATHER=1 VICTORY_CARD_REHASH_RUNS=1, with #1093 at VICTORY_AMBIENT=0.6):

fps ms/frame on the GPU
without this PR 6.61 151 61
with it 6.51 154 63
  • No device removal, 0 refused dynamic slots, and the same 7 wave64 compute pipelines refused as without it.
  • None of the 40 is used in that room: none of their hashes appears in the run's log. So this shows no regression there, but not the picture they fix. They should matter outdoors (terrain, puddles, reflective surfaces), which I haven't reached in a scripted run.

Not tested: scenes that use these programs, other GPUs, and DexNom's integer-target blending change from the same commit (left out here).

Credit: the lowering and its test are DexNom's; this PR only applies them to this tree.

AI use: Claude Code (Claude Opus 5.5) ported the change, ran the checks on my machine and wrote this description.

🤖 Generated with Claude Code

…40 programs)

Ported from DexNom/VIctory ddb7332 (GPL-3.0): both samples are taken with the
original derivatives, and the texel from the edge that supplied the console's
sampler is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ExoCalibra added a commit to ExoCalibra/victory-exo that referenced this pull request Nov 25, 2026
notquiteog added a commit to notquiteog/victory-nvidia that referenced this pull request Nov 26, 2026
…e between two immediate samplers (40 programs) (by m335671)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant