Skip to content

Shaders: four fixes from other forks (mesh index edge flags, cube level log2, two-sampler branch, wave64 mask copies): 42 more shaders translate - #1112

Open
KyleS98 wants to merge 4 commits into
fxceless:mainfrom
KyleS98:shaders/fork-fixes
Open

KyleS98 wants to merge 4 commits into
fxceless:mainfrom
KyleS98:shaders/fork-fixes

Conversation

@KyleS98

@KyleS98 KyleS98 commented Nov 25, 2026 •

Copy link
Copy Markdown

Four small translator fixes from other forks, brought onto main. Each is its own commit with the original author. All four are vendor-neutral.

commit from what was wrong
mesh primitive indices are 9 bits Marvisak/VIctory c0228d9 (tjthebigbearcat-hub) A GFX10 exp prim corner is a 9-bit vertex index plus an edge flag above it (bits 9, 19, 29). We read 10 bits, so a corner with its edge flag set named a vertex ≥ 512. That's past the written ones, so the triangle was culled.
cube sample with explicit gradients: log2 once, plus its _cl DexNom/VIctory 921d8d3 DXIL Log (op 23) is already base 2, and we multiplied by log2(e) again, so the level was 1.44× too coarse. The console's minimum level was also dropped: sampleLevel has no clamp, so it's now applied to the level.
a uniform branch choosing between two immediate samplers DexNom/VIctory ddb7332 Example: a root constant picks wrap or clamp. The sampler was untracked and the program didn't translate. Now it samples with both and selects by the edge taken.
a wave64 mask restored from two 32-bit scalar copies DexNom/VIctory 76749ce The restored value is the mask again.

I left out the integer-target blend part of ddb7332 (that's #715) and the tests of c0228d9.

Tested on an RTX 3090 Ti, --console series-s. The tree was d510ee4 plus this branch, plus #798 and #1081 so the S profile renders the world. Warm cache, from boot into the prologue cell:

  • Translation warm-up: shaders that don't translate went from 286 to 244.
  • Cell frame time: 112–123 ms both ways (8.1–8.9 fps with upstream's frame-rate switches on), so no cost.
  • The picture in the cell is unchanged by this PR as far as I can tell (see the correction below).
  • Still there either way: the noisy face of the woman in the pink shirt, and blocky patches on the cell's right-hand wall.
  • cargo test -p victory-shader: 217 passed.

Correction (same day): I first wrote here that Lucia's hair went from pale orange-blond to dark brown with this PR. That was wrong. Over 17 runs the hair colour follows something else:

  • It was dark brown in exactly the four runs that came first after a shader-cache warm-up, when about 1,900 pipelines are compiled during loading and draws are dropped while they are being made.
  • It was blond in every other run, with and without these commits.

So some pass that normally runs is skipped in those first runs and changes the hair. I'm looking for which one; it has nothing to do with this PR. The count of shaders that translate (286 → 244 that do not) is from the warm-up itself and stands.

AI-assisted (Claude Code; opened with Claude Opus 5.5, corrected with Claude Fable 5.2); runs and grabs on my machine; no game data.

tjthebigbearcat-hub and others added 4 commits November 25, 2026 14:45
…ve them are no part of the index)

A GFX10 primitive export holds three corners of ten bits: a 9-bit vertex
index and its edge flag (bits 9, 19 and 29). The index was read with all
ten bits, so a corner with its edge flag set named a vertex at 512 or
past it, beyond the written ones, and the primitive was culled.

From Marvisak/VIctory c0228d9 by tjthebigbearcat-hub (the index mask;
its tests were not carried over), as also carried by DexNom/VIctory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…print once, and its minimum level

DXIL's Log (op 23) is already base 2; it was multiplied by log2(e) once
more, so the level such a sample picked was 1.44 times too coarse. The
console's minimum level (`_cl`) was also dropped: sampleLevel has no
clamp operand, so it is applied to the level.

From DexNom/VIctory 921d8d3 (the cube level hunk).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… samples with both and selects

A sampler descriptor built from constants on two edges of a branch (a root
constant choosing wrap or clamp) was an untracked sampler, and the program
did not translate. Each immediate sampler is a static binding of its own:
the image is sampled with both and the result taken from the edge the
console's sampler came from. 42 more of the title's shaders translate
(286 -> 244 that do not).

From DexNom/VIctory ddb7332 (the translator part; its integer-target blend
part is fxceless#715).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the mask again

From DexNom/VIctory 76749ce ("Recover voxel visibility shader when a
wave64 mask is restored from scalar copies").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ym1r1710

Copy link
Copy Markdown
Contributor

Tried this on an RTX 5080 (Series X profile, not S), on top of current main plus a few open PRs. Warm cache after the first run retranslated. In the cell scene at world+400 and +800 the picture looks the same as before as far as I can see: hair, faces and walls unchanged, nothing new broken. Frame time 104 ms vs 97 ms on the run before without it, but that's inside the 10 ms or so my runs wander by, so I wouldn't read anything into it. So no visible win on S-less X profile here, no regression either. Keeping it.

@HLVM04

HLVM04 commented Nov 25, 2026

Copy link
Copy Markdown

A Series S data point from an RTX 5070 Ti (Ryzen 7 9800X3D, Windows 11 build 26200) where the hair did not change.

I cherry-picked the four commits onto our own Series S stack (an older fork main plus several open PRs, #798 among them, and some local changes). The median frame in the first gameplay scene was 74 ms, about where our runs without them sit, and I saw no visible regression.

The main character's hair still renders pale blond on this card with the four commits in. Since this is the same profile as your 3090 Ti test, the hair fix may depend on something else in your tree, or on timing. On our stack her skin and hair colour already varied between runs before this PR (lit or black, dark or blond), so this is weak evidence either way. I didn't count untranslated shaders before and after.

@KyleS98 KyleS98 changed the title Shaders: four fixes from other forks (mesh index edge flags, cube level log2, two-sampler branch, wave64 mask copies): 42 more shaders translate, hair renders right Shaders: four fixes from other forks (mesh index edge flags, cube level log2, two-sampler branch, wave64 mask copies): 42 more shaders translate Nov 25, 2026
grosterr added a commit to grosterr/victory-fork that referenced this pull request Nov 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
grosterr added a commit to grosterr/victory-fork that referenced this pull request Nov 25, 2026
…compare's mask without shared slots too

The fxceless#854 test a_mask_parked_in_lanes_another_scalar_shares_comes_back_whole_with_shared_slots
asserted the old limit (opaque without shared slots). fxceless#1112's Lanes::move_source follows the
two s_mov_b32 copies back to the pair, which is the right answer; the expectation follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grosterr

Copy link
Copy Markdown
Contributor

A data point from an RTX 3060 12 GB, and one test that fails when this meets #770.

Machine: RTX 3060 12 GB, Ryzen 7 5700X, 32 GB, Windows 11, Series X profile.
Tree: the #770 stack (d034ac1) + main 9c184b3 + #1057, this PR (4bc83a6), #1044, #1101 and #1014. Branch: grosterr/victory-fork rtx3060.

One test fails after the merge. ir::tests::a_mask_parked_in_lanes_another_scalar_shares_comes_back_whole_with_shared_slots (from #854, carried in #770) passes on the stack and on the stack + main + #1057, and fails once this PR is in:

panicked at crates\victory-shader\src\ir.rs:2183:9:
two scalars make an opaque mask

Both #854 and the last commit here fix PS_VoxelizeVisiblity, in two ways. #854 brings the parked mask back as a pair through with_shared_slots. With this PR, Lanes::move_source follows the two s_mov_b32 copies back to that pair, so even without shared slots EXEC comes out as the compare's lanes. The test had recorded the old limit ("built as it is, the mask comes back as two scalars, which the structurisation cannot see into"). The new answer is the right one, so only the expectation has to change:

assert!(!opaque(&alone), "two scalar copies of the pair are the compare's mask");

It is in 6a53386, together with the doc comment above the test. After it, victory-shader has 245 passed and 0 failed. Whoever merges this and #770 second will meet it.

In the game (10 minutes, prologue cell block and corridor, 11 switches): 179 ms a frame at 5,564 draws, against 174 ms at 4,944 draws on the same tree with main d510ee4 and without these four PRs. That is the same within noise. Hair, faces, sunlight through the window and the corridor looked as before. Lucia's hair was dark both before and after, so on this tree the hair change cannot be seen either way. No errors in the log.

Warm-up count: translate --warm all with VICTORY_HOST_WAVE=32: 232 of 25,985 do not translate, the same number as before this PR. On top of #854's paired wave64 form, the 42 shaders this PR adds over main seem to translate already. I did not compare which 232 they are.

Lynkes pushed a commit to Lynkes/victory-fork that referenced this pull request Nov 26, 2026
…ption for lower.rs alone)

lower.rs outgrew the common 512 KiB limit with the shader fixes taken in
(PRs fxceless#1112, fxceless#215), so repository_passes_policy failed and the pre-commit
hook refused any commit touching it. It now has a limit of its own, as the
RX 7900 XTX fork gives it; every other file keeps 512 KiB (tested).
Lynkes pushed a commit to Lynkes/victory-fork that referenced this pull request Nov 26, 2026
…integer views keeps its bits, unordered views of vertex programs are declared

Ported by hand from the RX 7900 XTX fork's 9a6c829 (avatarmanz/VIctory-7900XTX),
without its cube part (already here from PR fxceless#1112):
- VIctory da82e44: normalized codes of up to 16 bits load as the float nearest
  their quotient, and their ends exactly; the host's division was one ulp off
  for some codes, and a material index truncated back from one was the code
  below. Tests on hardware and WARP: every 8- and 10-bit code, sampled 16-bit
  ones, and codes truncated back to themselves.
- VIctory 4243a96: the table of strides marks typed buffer views of integer
  formats (VIEW_INTEGER, VIEW_SIGNED beside the stride, masked out with
  VIEW_STRIDE_BITS); their d16 accesses pass 16-bit integers, not halves (the
  face network keeps its halves in UINT views).
- VIctory a1a2077: unordered views outside pixel and compute programs set the
  shader flag and feature bit DXC sets.
ExoCalibra added a commit to ExoCalibra/victory-exo that referenced this pull request Nov 26, 2026
@KyleS98

KyleS98 commented Nov 26, 2026

Copy link
Copy Markdown
Author

Thanks for the three reports.

AI-assisted (Claude Code, Claude Fable 5.2).

fxceless added a commit that referenced this pull request Nov 26, 2026
…e), 4 KiB dirty tracking, gather segments, the black-face texture fixes, shadow and translator fixes from pull requests

Measured in in-run on/off splits on an RTX 4070 (diagnostics builds, the
same switches for every run):
- VICTORY_CARD_HASH_WIDE=1|alt: the card's hashes of copies' pieces by a group
  of 64 threads a piece, alternating per submission: card -10 ms a frame
  (86.5 vs 96.5), world frames -5 ms.
- VICTORY_GATHER_SEGMENTS=1|alt (after flipflop877 c69bff1): one clamp pass
  per segment once a list stops gathering: ~30 records a pass, neutral to
  slightly faster at equal draws.
- VICTORY_DIRTY_4K=1|alt: refreshes copy only the written 4 KiB pages of a
  stale write-watched page: -45 % of those bytes; faster in loading, no world
  gain.
Fixes:
- Textures under a DirectStorage write or a landed plain read are made due
  again (VICTORY_PAGE_WRITES default 1|2|8): textures uploaded before their
  data landed kept zeros (black faces); VICTORY_HEAP_RECHECK_EVERY=<frames>
  keeps looking at uploaded textures after the schedule (after RyanCase94).
- Pull requests #646 (builder dispatches count threads), #1002 (alpha-tested
  geometry casts cascade shadows), #1314, #1324, #589, #702, #1112 (mesh
  triangle corners masked 9 bits, cube-map levels, two-sampler branches,
  split 64-lane masks); upstream #3198 (textures without card room retried).
- VICTORY_WAVE_WIDE_ONLY=<hashes>: listed refused programs may take the
  wave-wide form (after #823's a416e39; the water's colour, with dark patches
  still under investigation).
- VICTORY_MERGE_RUNS_ALT, VICTORY_CLAMP_LEAN, VICTORY_CLAMP_WINDOW,
  VICTORY_OCCLUSION: measured, no gain; off.
The shader translator changed: delete both shader caches before the first run.
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
… part 2)

9613092 alone does not build (its second deep-skips form call lacks the
label 93db653 adds), so the fifth merge goes on to e4245f3, the commit
it was meant to bring; nothing after it (fxceless#1320, fxceless#1321, fxceless#1353, fxceless#1336,
fxceless#1324 of 13:05 are left for later).

- 93db653: build fix for 9613092 (VICTORY_WAVE_WHY form label).
- e4245f3: VICTORY_CARD_HASH_WIDE=alt (1 was already there; default
  still a thread a piece), VICTORY_GATHER_SEGMENTS and
  VICTORY_GATHER_DISPATCHES (off), VICTORY_DIRTY_4K (off),
  VICTORY_MERGE_RUNS_ALT (unset), VICTORY_HEAP_RECHECK_EVERY (0),
  VICTORY_WAVE_WIDE_ONLY (empty); VICTORY_PAGE_WRITES default now
  guards+slots+plain reads' textures (1|2|8; "guards" is the old one);
  host callbacks check due textures first; textures without card room
  asked again (upstream VIctory #3198); a released view heap forgets its
  title-memory run (fxceless#589); shader fixes: mesh corners masked 9 bits,
  two immediate samplers behind a uniform branch, sampleLevel log2 and
  _cl clamp, split wave64 mask moves (fxceless#1112, fxceless#702).

Conflicts, our structure kept: HostList hunks moved to host/host_list.rs;
image hunks to emit/image_buffer.rs; copy_stale takes both COLD_SKIP
marks and DIRTY_4K pieces; Journal keeps cold_skip::Written plus the 4K
map; translate_listed wraps translate_counted; MERGE_RUNS_ALT before our
card_steps split. Duplicates kept once (ours): fxceless#1324 (HEAP_IDENTITY),
fxceless#1002 (SHADER_CASCADE_EXACT), and fxceless#646: upstream's DispatchX thread
counts (USER_DISPATCH_THREADS, same code 0x106) dropped for our port of
fxceless#1292 (USER_THREAD_LIMIT, which also covers the paired 64-lane form).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
…ure fixes), cascade shadows, render-target snapshots, and switches for rays, memory and input

Twenty-two commits, tested as fe2ede8 (cargo check of the workspace with
diagnostics clean; victory-gpu --lib 356 passed, 0 failed) and built by
Codex as fe2ede8-diagnostics.

On by default, each with a way back:
- the original's fifth merge up to e4245f3 with 93db653: VICTORY_PAGE_WRITES
  now also sends back to pending the textures written by slots and by
  plain reads (1|2|8; =guards is the default of before), textures without
  room on the card are asked for again (VIctory #3198), a released view
  heap forgets its run of title memory (fxceless#589), shader fixes (fxceless#1112, fxceless#702,
  mesh corners, samplers behind a uniform branch, sampleLevel);
- fxceless#1002: exact cascade shadows on cards of 32 lanes
  (VICTORY_SHADER_CASCADE_EXACT=0 goes back);
- fxceless#1371: render targets replayed from a copy taken at SetRenderTargets
  (VICTORY_RT_SNAPSHOT=0 goes back).

Off by default: VICTORY_RT_SKIN_SKIP, VICTORY_RT_RESOLVE_SKIP,
VICTORY_ACTIVATE_RAYS_SKIP, VICTORY_HAIR_VB_SKIP (with a census of such
programs), VICTORY_ALT_FLIP (fxceless#1341), VICTORY_RAM_TRIM, VICTORY_WINDOW_REUSE
(fxceless#1362), VICTORY_COLD_SKIP (fxceless#1358), the worker chain of fxceless#1290,
VICTORY_KEYS_FILE, VICTORY_NULL_SAMPLES, and the merge's CARD_HASH_WIDE=alt,
GATHER_SEGMENTS, GATHER_DISPATCHES, DIRTY_4K, MERGE_RUNS_ALT,
HEAP_RECHECK_EVERY and WAVE_WIDE_ONLY. The profiler test walks only modules
that never unload.

Left out: diagnostics/translate-water-5dc3-6f22-2026-11-26.txt, a
translation diagnostic of the original's run that lists offsets and
instructions of two of the title's shaders.

Measured by Codex on fe2ede8, the ten switches of Status, screenshots
every second, one pair of sessions of 480 s, the same binary: in the
opening's cafeteria two faces were drawn with their features with the new
default, and one of them came out without features and the background
washed out with VICTORY_PAGE_WRITES=guards, at different moments and
poses; in the reverse pair a face came out almost all black with the new
default (the guards session was stopped by the memory guard at 391 s), so
these fixes are not the whole answer to black faces. Not measured for
frame rate yet. Neither session crashed; frames of a second
or more between 150 and 450 s: 49 (longest 5.7 s) with guards, 52 (6.8 s)
with the default. A first session with a cold shader cache was ended at
388 s by the title itself after a frame of 21.5 s spent waiting for the
runtime's remapping.

Co-Authored-By: Claude Opus 5.5 <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.

6 participants