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

Open
KyleS98 wants to merge 4 commits from upstream-pr/1112 into main
KyleS98 commented 2026-11-25 19:56:43 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by KyleS98 on 2026-11-25T19:56:43Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6612569379 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1112). Originally posted by [KyleS98](https://github.com/KyleS98) on 2026-11-25T19:56:43Z. --- 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.
Ym1r1710 commented 2026-11-25 21:05:55 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Ym1r1710 on 2026-11-25T20:32:36Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7173827476 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1112#issuecomment-7173827476). Originally posted by [Ym1r1710](https://github.com/Ym1r1710) on 2026-11-25T20:32:36Z. --- 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 commented 2026-11-25 21:05:55 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HLVM04 on 2026-11-25T20:34:27Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7173871429 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1112#issuecomment-7173871429). Originally posted by [HLVM04](https://github.com/HLVM04) on 2026-11-25T20:34:27Z. --- 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.
upstream-sync changed title from [PR #1112] 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 to [PR #1112] Shaders: four fixes from other forks (mesh index edge flags, cube level log2, two-sampler branch, wave64 mask copies): 42 more shaders translate 2026-11-25 23:09:41 +00:00
grosterr commented 2026-11-25 23:09:57 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by grosterr on 2026-11-25T22:40:20Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7176650181 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1112#issuecomment-7176650181). Originally posted by [grosterr](https://github.com/grosterr) on 2026-11-25T22:40:20Z. --- 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`](https://github.com/grosterr/victory-fork/tree/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: ```rust assert!(!opaque(&alone), "two scalar copies of the pair are the compare's mask"); ``` It is in [`6a53386`](https://github.com/grosterr/victory-fork/commit/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.
KyleS98 commented 2026-11-26 02:08:42 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by KyleS98 on 2026-11-26T01:25:14Z.


Thanks for the three reports.

  • @HLVM04 and @Ym1r1710: your "hair did not change" matches the correction I've since put in the description. Across 17 runs here the hair colour followed whether pipelines were still compiling during loading, not these commits. So the claim this PR makes is only the translation count and "nothing broken", which is what you both saw.
  • @grosterr: agreed on the test. With the last commit here Lanes::move_source follows the two scalar copies back to the pair, so a_mask_parked_in_lanes_another_scalar_shares_comes_back_whole_with_shared_slots should expect a non-opaque mask, as in your 6a53386. Whichever of this and #770 merges second should take that one-line change. I'm happy to add it here if the maintainer prefers this PR to carry it. Also useful: on top of #854 the count doesn't move (232 both ways), so the 42 shaders are the ones #854's paired form already recovers.

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

<!-- greyfinch-sync:fxceless/victory-fork:comment:7179754769 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1112#issuecomment-7179754769). Originally posted by [KyleS98](https://github.com/KyleS98) on 2026-11-26T01:25:14Z. --- Thanks for the three reports. - @HLVM04 and @Ym1r1710: your "hair did not change" matches the correction I've since put in the description. Across 17 runs here the hair colour followed whether pipelines were still compiling during loading, not these commits. So the claim this PR makes is only the translation count and "nothing broken", which is what you both saw. - @grosterr: agreed on the test. With the last commit here `Lanes::move_source` follows the two scalar copies back to the pair, so `a_mask_parked_in_lanes_another_scalar_shares_comes_back_whole_with_shared_slots` should expect a non-opaque mask, as in your `6a53386`. Whichever of this and #770 merges second should take that one-line change. I'm happy to add it here if the maintainer prefers this PR to carry it. Also useful: on top of #854 the count doesn't move (232 both ways), so the 42 shaders are the ones #854's paired form already recovers. AI-assisted (Claude Code, Claude Fable 5.2).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1112:upstream-pr/1112'
git switch 'upstream-pr/1112'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1112'
git switch 'upstream-pr/1112'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1112'
git switch 'upstream-pr/1112'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1112'
git switch 'main'
git merge --squash 'upstream-pr/1112'
git switch 'main'
git merge --ff-only 'upstream-pr/1112'
git switch 'main'
git merge 'upstream-pr/1112'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1109
No description provided.