Shaders: revert #2357's integer folds (hair scrambled since v2026.11.30.01) [pr-fix] #4568

Open
github-bot wants to merge 1 commit from github-bot/gh-4567 into main AGit
Owner

@⁠cafeoh on GitHub · 2026-11-30 22:47 UTC · original
cafeoh:fix/revert-2357 → main · +35 −372 · 1 files · 1 commits · open

Fixes #4188 (also #4261, #4314, #4065)

What it changes

Reverts #2357 (merge 467a002d4). Since .30.01, head hair on every character with physics hair is drawn as long spiky strands.

Bisected over main's merges between .29.05 and .30.02: first bad #2357, last good #2349. With a local switch over its rules, (x >> s) & m -> x >> s alone brings the broken hair back; (x << s) & m -> x << s alone does not. The rule is correct on paper, so either it or a later pass reading its output is at fault. Until that is found, the whole PR goes: its folds showed no gain (20 bytes on one large shader in the PR's own check), and the driver's compiler does the same integer folds itself.

The revert applies cleanly on e1251c319 (opt.rs only).

How it was tested

  • GPU and profile: RTX 2080 Ti (Turing), Windows 10, driver 617.14, Series S, DLSS off, frame generation off, ray tracing on.
  • Before: main e1251c319: hair scrambled (and at every bisect step from #2357 on).
  • After: this branch: hair normal (prologue cutscenes, several characters).
  • Wave sizes: 32 lanes.
  • cargo test passed for the crates it touches: cargo test -p victory-shader --lib: 471 passed. The 64 failures are the same on main e1251c319 (this card has no SM 6.6 device for the hardware tests); main's one extra pass is #2357's own test, which the revert removes.

Checked for overlap

  • No open PR reverts or changes #2357's folds. Workaround (VICTORY_SHADER_OPT=445) posted in #4188.
**@⁠cafeoh** on GitHub · 2026-11-30 22:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567) `cafeoh:fix/revert-2357` → `main` · +35 −372 · 1 files · 1 commits · open Fixes #4188 (also #4261, #4314, #4065) ## What it changes Reverts #2357 (merge 467a002d4). Since .30.01, head hair on every character with physics hair is drawn as long spiky strands. Bisected over main's merges between .29.05 and .30.02: first bad #2357, last good #2349. With a local switch over its rules, `(x >> s) & m -> x >> s` alone brings the broken hair back; `(x << s) & m -> x << s` alone does not. The rule is correct on paper, so either it or a later pass reading its output is at fault. Until that is found, the whole PR goes: its folds showed no gain (20 bytes on one large shader in the PR's own check), and the driver's compiler does the same integer folds itself. The revert applies cleanly on e1251c319 (opt.rs only). ## How it was tested - GPU and profile: RTX 2080 Ti (Turing), Windows 10, driver 617.14, Series S, DLSS off, frame generation off, ray tracing on. - Before: main e1251c319: hair scrambled (and at every bisect step from #2357 on). - After: this branch: hair normal (prologue cutscenes, several characters). - Wave sizes: 32 lanes. - `cargo test` passed for the crates it touches: `cargo test -p victory-shader --lib`: 471 passed. The 64 failures are the same on main e1251c319 (this card has no SM 6.6 device for the hardware tests); main's one extra pass is #2357's own test, which the revert removes. ## Checked for overlap - [x] No open PR reverts or changes #2357's folds. Workaround (`VICTORY_SHADER_OPT=445`) posted in #4188.
This reverts merge 467a002d4 (PR #2357, "shader: fold shift-mask, masked
bitwise, associative mul, and complement ops in DXIL opt").

Hair (head hair on every character with physics hair) is drawn as long
spiky strands from v2026.11.30.01 on (NV#4187, #4260, #4313, #4065).
Bisected over the merges of main between v2026.11.29.05 and .30.02: first
bad is #2357. On main e1251c319 with the fold pass off
(VICTORY_SHADER_OPT=445) the hair is normal; with only #2357's
`(x >> s) & m -> x >> s` rule on, it is scrambled again.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 22:52:07 +00:00
Author
Owner

@⁠VibeCodeGuy on GitHub · 2026-12-01 00:01 UTC · original · edited 2026-12-01 00:31 UTC

Offline check of the rule itself. In short: on this title's shaders, (x >> s) & m -> x >> s doesn't change what any hair program computes.

What I did. On main e1251c31 I added an env switch that turns off only that rule, the Bin::LShr arm in Bin::And in opt.rs. Then I ran victory translate shaders.rpf --list with it on and off (VICTORY_EMIT_DUMP, VICTORY_HOST_WAVE=32, and play's shader-key settings VICTORY_EARLY_DEPTH=1 VICTORY_NAN_SCRUB=1 VICTORY_BVH_MISS=1 VICTORY_SAMPLED_MARKS=1), on a v1.0.2.1 dump, cross-built and run under Wine.

  • The rule changes the DXIL of 16,007 of 25,694 programs. 174 of them are the hair path, every changed program named smh* or *hair*: smh_sim_*, smh_pose_*, smh_gen_*:CS_InterpolateStrands, smh_modify, smh_accessory, smh_draw_*:CS_VisHair, bvh_skinning_smh:CSGenerateHairVB, VS_HairStrandGeometry, PS_HairStrandGBuffer (list below).

  • I disassembled each pair with DXC 1.9.2609 (dxc -dumpbin) and compared them as expression graphs. Every value was hashed from its operands, with stores, void calls, terminators and phis as roots. In all 174, only two kinds of difference remain:

    1. and i32 (lshr i32 %x, s), M is gone where M keeps every bit the shift can leave.
    2. As a result, LegacyF16ToF32(and(lshr %x, 16), 65535) and the LegacyF16ToF32(lshr %x, 16) that the translator already emits next to it become the same call, and the duplicate is merged.

    Nothing else differs: no operand, constant, branch, store or atomic. Only the DXIL part differs; PSV0, RTS0 and the signatures are byte-identical. The checker does catch a changed shift, mask or operand (self-tested by perturbing one of these files).

  • Example, smh_sim_0:CS_EstimateStartPosition. With the rule off it has %108 = and i32 %104, 65535 (%104 = lshr i32 %82, 16) feeding LegacyF16ToF32, and also %163 = LegacyF16ToF32(%104) with no mask. With the rule on, the two calls are one. Before #2357 the program already had both forms side by side.

  • Across a random 400 of the 16,007, 385 compare equal with the checker. The other 15 use folds the checker's simple rewrites don't cover. The one I followed by hand is (lshr %x, 30) & 0xFFFF0000, folded to 0 by the rule's other arm, which is correct.

So the rule is right, and no later translator pass misreads its output, at least on these programs. What's left is either NVIDIA's compiler handling the two equivalent forms differently, or something timing-sensitive in the hair passes that the shorter code exposes; the per-frame flicker fits the second. The revert hides both, which is fine as a stopgap. To pin it down, someone with a card could bisect over these 174 programs: keep the fold everywhere except in one family at a time, e.g. a switch that skips the fold pass for listed program hashes. That would point at the one program whose equivalent DXIL breaks the hair, and then either a minimal driver repro or a missing barrier in it.

The 174 hair-path programs the rule changes (all equivalent), by family
  • 2 × PS_HairStrandGBuffer (Ps)
  • 1 × PS_MIRROR_PBR_MATERIAL_HAIR (Ps)
  • 1 × PS_STUDIOSHOT_PBR_MATERIAL_HAIR_LIGHTING (Ps)
  • 1 × PS_SmhPedEntityMask (Ps)
  • 1 × TL_PS_NoDir_PBR_MATERIAL_HAIR (Ps)
  • 1 × TL_PS_NoDir_PBR_MATERIAL_HAIR_GLOBAL_GLINTS (Ps)
  • 1 × TL_PS_NoDir_PBR_MATERIAL_HAIR_UNDERWATER (Ps)
  • 1 × TL_PS_NoDir_PBR_MATERIAL_HAIR_WETNESS (Ps)
  • 1 × TL_PS_PBR_MATERIAL_HAIR (Ps)
  • 1 × TL_PS_PBR_MATERIAL_HAIR_GLOBAL_GLINTS (Ps)
  • 1 × TL_PS_PBR_MATERIAL_HAIR_UNDERWATER (Ps)
  • 1 × TL_PS_PBR_MATERIAL_HAIR_WETNESS (Ps)
  • 6 × VS_HairStrandGeometry (Vs)
  • 1 × bvh_skinning_smh:CSGenerateHairVB (Cs)
  • 1 × cascadeshadows_rendering:CS_ShadowRenderTiledMiscHair (Cs)
  • 1 × cascadeshadows_rendering:CS_ShadowRenderTiledMiscHairAlpha (Cs)
  • 1 × cascadeshadows_rendering:CS_ShadowRenderTiledMiscHairAlphaPPPC (Cs)
  • 1 × cascadeshadows_rendering:CS_ShadowRenderTiledMiscHairPPPC (Cs)
  • 2 × hair_bvh_resolve:CS_RaytracingResolve (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_0 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_1 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_2 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_3 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_4 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_5 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_6 (Cs)
  • 1 × hair_resolve:CS_ResolveToGBufferTiled_7 (Cs)
  • 1 × hair_resolve:CS_ResolveToMirrorGBuffer (Cs)
  • 3 × horse_standard_hair:CS_RaytracingResolve (Cs)
  • 1 × shadowmask:CS_GenerateShadowMasksCheckerboard_SampleHairScreenSpace (Cs)
  • 1 × shadowmask:CS_GenerateShadowMasksHairOnly_SampleHairScreenSpace (Cs)
  • 1 × shadowmask:CS_GenerateShadowMasks_Checkerboard_NoHair (Cs)
  • 1 × shadowmask:CS_GenerateShadowMasks_HairOnly (Cs)
  • 1 × shadowmask:CS_GenerateShadowMasks_SampleHairScreenSpace (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories0 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories1 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories2 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories3 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories4 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories5 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories6 (Cs)
  • 1 × smh_accessory:CS_GenerateAccessories7 (Cs)
  • 2 × smh_draw:CS_VisHair (Cs)
  • 80 × smh_gen:CS_InterpolateStrands (Cs)
  • 1 × smh_modify:CS_CalculateFireVolumes (Cs)
  • 1 × smh_modify:CS_CullMaskPass (Cs)
  • 1 × smh_modify:CS_InterpolateStrandStyle (Cs)
  • 1 × smh_modify:CS_ProjDecalCut (Cs)
  • 3 × smh_pose:CS_PreSkinSimGuides (Cs)
  • 3 × smh_pose:CS_PreSkinSimNodes (Cs)
  • 3 × smh_pose:CS_UpdatePosePosition (Cs)
  • 1 × smh_sim:CS_CachePrevPosition (Cs)
  • 1 × smh_sim:CS_CachePrevVelocity (Cs)
  • 4 × smh_sim:CS_EstimateStartPosition (Cs)
  • 4 × smh_sim:CS_InitSimBuffer (Cs)
  • 1 × smh_sim:CS_LodBlend (Cs)
  • 4 × smh_sim:CS_SolvePerSplineConstraint (Cs)
  • 8 × smh_sim:CS_SolvePerVertConstraint (Cs)
  • 2 × smh_sim:CS_WavePerSplineConstraint_32 (Cs)
  • 3 × standard_hair_accessory:CS_RaytracingResolve (Cs)

Hashes: 0ce887704e52e51d, 4454eab1bf64eca9, cdeb13e0fa34536d, dd98419eb738db95, 316642a29f9cd8b4, a944b2f732760372, 0ec92cc4249a78bb, a526d35fb055216b, 6714207ed48b0464, e5a6ec7657990b89, 0267195778c9df59, 6992feba843e3b84, 8be3f98f633e3561, f9f378aa4d487320, e38865315b050ed9, 643101624bd14159, ae6c164eea5aa84b, 1df91ec81a678fd0, 43cfb5b69105e332, 72f552f4553fb5f9, abd7a22106898c66, 1d44a723bdebbf27, b4b0427232707598, 240cb516c1af0bc3, bff3758517ad9142, 9f1e01df5796c330, 1c8165626a581de4, 0ccc14877cbec21e, a83a0864ccef9b67, 738350c1a01b713a, d240837d597ce9d1, f7fecc64e2b98ed5, 0c0380d9ec648626, 54bcc8478432ba15, 1204a7eb55bdb895, b69ef139ecd3b757, 721c6b98cc129aa5, a98b2d2aa2acfffe, 47608b6c13152cd1, 888af37a584acf98, 5cf00dc39042edaf, 0a5ecfee6b79e13b, 2889c21328c69e58, fd0abf1557673a1b, 9be0368502fe75a0, f9528bddae9d784c, 00f607218c949e38, c2dc7073dd57d0bd, 39c8537b029be0c3, 43a695e99d51bee3, abefa9e679c3f985, b6df66af105d8b2d, edc43d3e658a4b9d, 7b2881ff62faba9d, 58b1400a40af4738, 23d107380df81cf1, 8080af82aaac33df, f7c4f227a2a4c4b2, a68c4b8fc7bc4b5c, 07fdf30955c4abbc, b3e7781d53ff8326, 52089284117a310b, dabecdf6a76f6ac5, 0a37689d055d5b44, c4f1becd11afec3e, 25c5ee5063e1a41f, 2e7a71c083a79dd7, ae83305f523f4b1b, 77a7af30c430cd16, 688acec013d202f3, 010a50ce68d02c16, 142831c820dca7a3, 9aa4a785e0800cda, 72b5ddf9b24d98d2, c2403765027d12b6, f384ff9b2bb127c5, b63e7606ee1302fa, 3bfbe3f43cf57636, 9aa3629668b8e7ab, 44bb2d65d51ba5d1, f5f5e06abea6e83a, 8c970301dd4eee4f, ee26678cdf63cf32, 9ba277f4542cfd9c, b00958f7e581464d, bda486f4b8a3fd0f, e4688ae9d52294f8, 1547305c505a7559, 37322e35397bcb4f, cb31a20c7aeafb86, a3e722830cfa55fe, 4814890b920fe12e, e7c9e7210ffff1fc, ac4c69f7c2aaa95a, d6e372a386b9e253, 161bc88937af764c, a8b9e7724b6a6fdc, 0743686596b14ec9, 0d550b5f17df9bc1, 029dfbaa64951060, f21917075db73dad, 83b44924ab6657c2, 5b6eed17c131f881, 21d27f785da6d2b1, 006d583a371f22ec, 35813c04e939bc21, 098fc28e44347a00, bd0dfdfb50657f60, b24d68169f04159a, 0115b73d7e531e04, cbff6f05ed99958b, 9ac37ee176bd2353, dedcc49075cfc1d9, 45b8c316ec2f3e8c, 9216e90f97b19283, 64f4384125e1993b, 234d47be72397f85, b5e3137b54ba16c4, 6006c34443033b5a, ce3bba2e7a2c2c7b, 54ccf3d13b5bf091, 9267f0cfc6452000, 7239c0d4326c9967, f29138d2ea4a0b9e, 2a3522dae6b66c17, 4e425adf8edeb96f, 76ebccca0fd3851e, beee29e2da2b1461, ebce8db62fe43ed9, 444715459ad11d5c, e6b1160ee45c1666, 4220c55ebf8602de, 706d91607b2b5516, e99d19aac5b0bcb4, 31430354dd5c259c, 269b802f878c24e1, 3e28ebd6128bd351, d3d595d35a4ee7bb, b2b782b5d732607d, da1656ad2910e4c7, 9b885ee6fdda77f5, 0e45e59e93b736e4, d3e44e754b3eb6aa, 38faf850f130d4dc, 65732e201b1230d2, 0102eac428002832, b8c6ee7eb35f23ea, dbfb6f9d172b3a43, 959a530059731c41, d474a0f15cd0f545, 251d57fa0adf0b53, deec5fb86d9cc5f3, fe71a5c67edd3d84, 889d32cc4e668148, 4a05640ec16718ad, 1ea7e2dbf731c8dc, ab82f8d3b0809138, 96ed122706539da9, 7353bdc4c2c79fd1, f38afa09308835a3, 418f3fdf020b9eda, 93c52598be113a6b, 9faf21803c0d8eea, c47e03e0e3946741, e35b7de6a9d2bfd4, 746fd4d8b0d88c3c, dfba1b3a39e9a19d, 27afb6546fe3e225, 021587bdd5335e89, c8c53d32de5c858d, 611e727832ef1ab9, 3d03a8a88ad6670e, c0b9134fa622f802, f7abaa39145df433

The revert itself, same corpus run (translate --validate --list over the whole dump, main e1251c31 against main + this PR, 32 lanes, play's shader-key settings, DXC 1.9.2609 validator): 0 newly failing, 0 newly passing. 17,902 of 25,699 programs change DXIL, and all of them validate (apart from the 71 oversized mesh programs that already fail on main). It is safe to merge as far as translation goes. Expect every player's shader cache to be rebuilt for most programs.

**@⁠VibeCodeGuy** on GitHub · 2026-12-01 00:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7295823138) · edited 2026-12-01 00:31 UTC **Offline check of the rule itself.** In short: on this title's shaders, `(x >> s) & m -> x >> s` doesn't change what any hair program computes. What I did. On `main` e1251c31 I added an env switch that turns off only that rule, the `Bin::LShr` arm in `Bin::And` in `opt.rs`. Then I ran `victory translate shaders.rpf --list` with it on and off (`VICTORY_EMIT_DUMP`, `VICTORY_HOST_WAVE=32`, and play's shader-key settings `VICTORY_EARLY_DEPTH=1 VICTORY_NAN_SCRUB=1 VICTORY_BVH_MISS=1 VICTORY_SAMPLED_MARKS=1`), on a v1.0.2.1 dump, cross-built and run under Wine. - The rule changes the DXIL of **16,007 of 25,694** programs. **174** of them are the hair path, every changed program named `smh*` or `*hair*`: `smh_sim_*`, `smh_pose_*`, `smh_gen_*:CS_InterpolateStrands`, `smh_modify`, `smh_accessory`, `smh_draw_*:CS_VisHair`, `bvh_skinning_smh:CSGenerateHairVB`, `VS_HairStrandGeometry`, `PS_HairStrandGBuffer` (list below). - I disassembled each pair with DXC 1.9.2609 (`dxc -dumpbin`) and compared them as expression graphs. Every value was hashed from its operands, with stores, void calls, terminators and phis as roots. In **all 174**, only two kinds of difference remain: 1. `and i32 (lshr i32 %x, s), M` is gone where `M` keeps every bit the shift can leave. 2. As a result, `LegacyF16ToF32(and(lshr %x, 16), 65535)` and the `LegacyF16ToF32(lshr %x, 16)` that the translator already emits next to it become the same call, and the duplicate is merged. Nothing else differs: no operand, constant, branch, store or atomic. Only the `DXIL` part differs; `PSV0`, `RTS0` and the signatures are byte-identical. The checker does catch a changed shift, mask or operand (self-tested by perturbing one of these files). - Example, `smh_sim_0:CS_EstimateStartPosition`. With the rule off it has `%108 = and i32 %104, 65535` (`%104 = lshr i32 %82, 16`) feeding `LegacyF16ToF32`, and also `%163 = LegacyF16ToF32(%104)` with no mask. With the rule on, the two calls are one. Before #2357 the program already had both forms side by side. - Across a random 400 of the 16,007, 385 compare equal with the checker. The other 15 use folds the checker's simple rewrites don't cover. The one I followed by hand is `(lshr %x, 30) & 0xFFFF0000`, folded to `0` by the rule's other arm, which is correct. So the rule is right, and no later translator pass misreads its output, at least on these programs. What's left is either NVIDIA's compiler handling the two equivalent forms differently, or something timing-sensitive in the hair passes that the shorter code exposes; the per-frame flicker fits the second. The revert hides both, which is fine as a stopgap. To pin it down, someone with a card could bisect over these 174 programs: keep the fold everywhere except in one family at a time, e.g. a switch that skips the fold pass for listed program hashes. That would point at the one program whose equivalent DXIL breaks the hair, and then either a minimal driver repro or a missing barrier in it. <details><summary>The 174 hair-path programs the rule changes (all equivalent), by family</summary> - 2 × `PS_HairStrandGBuffer` (Ps) - 1 × `PS_MIRROR_PBR_MATERIAL_HAIR` (Ps) - 1 × `PS_STUDIOSHOT_PBR_MATERIAL_HAIR_LIGHTING` (Ps) - 1 × `PS_SmhPedEntityMask` (Ps) - 1 × `TL_PS_NoDir_PBR_MATERIAL_HAIR` (Ps) - 1 × `TL_PS_NoDir_PBR_MATERIAL_HAIR_GLOBAL_GLINTS` (Ps) - 1 × `TL_PS_NoDir_PBR_MATERIAL_HAIR_UNDERWATER` (Ps) - 1 × `TL_PS_NoDir_PBR_MATERIAL_HAIR_WETNESS` (Ps) - 1 × `TL_PS_PBR_MATERIAL_HAIR` (Ps) - 1 × `TL_PS_PBR_MATERIAL_HAIR_GLOBAL_GLINTS` (Ps) - 1 × `TL_PS_PBR_MATERIAL_HAIR_UNDERWATER` (Ps) - 1 × `TL_PS_PBR_MATERIAL_HAIR_WETNESS` (Ps) - 6 × `VS_HairStrandGeometry` (Vs) - 1 × `bvh_skinning_smh:CSGenerateHairVB` (Cs) - 1 × `cascadeshadows_rendering:CS_ShadowRenderTiledMiscHair` (Cs) - 1 × `cascadeshadows_rendering:CS_ShadowRenderTiledMiscHairAlpha` (Cs) - 1 × `cascadeshadows_rendering:CS_ShadowRenderTiledMiscHairAlphaPPPC` (Cs) - 1 × `cascadeshadows_rendering:CS_ShadowRenderTiledMiscHairPPPC` (Cs) - 2 × `hair_bvh_resolve:CS_RaytracingResolve` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_0` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_1` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_2` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_3` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_4` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_5` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_6` (Cs) - 1 × `hair_resolve:CS_ResolveToGBufferTiled_7` (Cs) - 1 × `hair_resolve:CS_ResolveToMirrorGBuffer` (Cs) - 3 × `horse_standard_hair:CS_RaytracingResolve` (Cs) - 1 × `shadowmask:CS_GenerateShadowMasksCheckerboard_SampleHairScreenSpace` (Cs) - 1 × `shadowmask:CS_GenerateShadowMasksHairOnly_SampleHairScreenSpace` (Cs) - 1 × `shadowmask:CS_GenerateShadowMasks_Checkerboard_NoHair` (Cs) - 1 × `shadowmask:CS_GenerateShadowMasks_HairOnly` (Cs) - 1 × `shadowmask:CS_GenerateShadowMasks_SampleHairScreenSpace` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories0` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories1` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories2` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories3` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories4` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories5` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories6` (Cs) - 1 × `smh_accessory:CS_GenerateAccessories7` (Cs) - 2 × `smh_draw:CS_VisHair` (Cs) - 80 × `smh_gen:CS_InterpolateStrands` (Cs) - 1 × `smh_modify:CS_CalculateFireVolumes` (Cs) - 1 × `smh_modify:CS_CullMaskPass` (Cs) - 1 × `smh_modify:CS_InterpolateStrandStyle` (Cs) - 1 × `smh_modify:CS_ProjDecalCut` (Cs) - 3 × `smh_pose:CS_PreSkinSimGuides` (Cs) - 3 × `smh_pose:CS_PreSkinSimNodes` (Cs) - 3 × `smh_pose:CS_UpdatePosePosition` (Cs) - 1 × `smh_sim:CS_CachePrevPosition` (Cs) - 1 × `smh_sim:CS_CachePrevVelocity` (Cs) - 4 × `smh_sim:CS_EstimateStartPosition` (Cs) - 4 × `smh_sim:CS_InitSimBuffer` (Cs) - 1 × `smh_sim:CS_LodBlend` (Cs) - 4 × `smh_sim:CS_SolvePerSplineConstraint` (Cs) - 8 × `smh_sim:CS_SolvePerVertConstraint` (Cs) - 2 × `smh_sim:CS_WavePerSplineConstraint_32` (Cs) - 3 × `standard_hair_accessory:CS_RaytracingResolve` (Cs) Hashes: `0ce887704e52e51d`, `4454eab1bf64eca9`, `cdeb13e0fa34536d`, `dd98419eb738db95`, `316642a29f9cd8b4`, `a944b2f732760372`, `0ec92cc4249a78bb`, `a526d35fb055216b`, `6714207ed48b0464`, `e5a6ec7657990b89`, `0267195778c9df59`, `6992feba843e3b84`, `8be3f98f633e3561`, `f9f378aa4d487320`, `e38865315b050ed9`, `643101624bd14159`, `ae6c164eea5aa84b`, `1df91ec81a678fd0`, `43cfb5b69105e332`, `72f552f4553fb5f9`, `abd7a22106898c66`, `1d44a723bdebbf27`, `b4b0427232707598`, `240cb516c1af0bc3`, `bff3758517ad9142`, `9f1e01df5796c330`, `1c8165626a581de4`, `0ccc14877cbec21e`, `a83a0864ccef9b67`, `738350c1a01b713a`, `d240837d597ce9d1`, `f7fecc64e2b98ed5`, `0c0380d9ec648626`, `54bcc8478432ba15`, `1204a7eb55bdb895`, `b69ef139ecd3b757`, `721c6b98cc129aa5`, `a98b2d2aa2acfffe`, `47608b6c13152cd1`, `888af37a584acf98`, `5cf00dc39042edaf`, `0a5ecfee6b79e13b`, `2889c21328c69e58`, `fd0abf1557673a1b`, `9be0368502fe75a0`, `f9528bddae9d784c`, `00f607218c949e38`, `c2dc7073dd57d0bd`, `39c8537b029be0c3`, `43a695e99d51bee3`, `abefa9e679c3f985`, `b6df66af105d8b2d`, `edc43d3e658a4b9d`, `7b2881ff62faba9d`, `58b1400a40af4738`, `23d107380df81cf1`, `8080af82aaac33df`, `f7c4f227a2a4c4b2`, `a68c4b8fc7bc4b5c`, `07fdf30955c4abbc`, `b3e7781d53ff8326`, `52089284117a310b`, `dabecdf6a76f6ac5`, `0a37689d055d5b44`, `c4f1becd11afec3e`, `25c5ee5063e1a41f`, `2e7a71c083a79dd7`, `ae83305f523f4b1b`, `77a7af30c430cd16`, `688acec013d202f3`, `010a50ce68d02c16`, `142831c820dca7a3`, `9aa4a785e0800cda`, `72b5ddf9b24d98d2`, `c2403765027d12b6`, `f384ff9b2bb127c5`, `b63e7606ee1302fa`, `3bfbe3f43cf57636`, `9aa3629668b8e7ab`, `44bb2d65d51ba5d1`, `f5f5e06abea6e83a`, `8c970301dd4eee4f`, `ee26678cdf63cf32`, `9ba277f4542cfd9c`, `b00958f7e581464d`, `bda486f4b8a3fd0f`, `e4688ae9d52294f8`, `1547305c505a7559`, `37322e35397bcb4f`, `cb31a20c7aeafb86`, `a3e722830cfa55fe`, `4814890b920fe12e`, `e7c9e7210ffff1fc`, `ac4c69f7c2aaa95a`, `d6e372a386b9e253`, `161bc88937af764c`, `a8b9e7724b6a6fdc`, `0743686596b14ec9`, `0d550b5f17df9bc1`, `029dfbaa64951060`, `f21917075db73dad`, `83b44924ab6657c2`, `5b6eed17c131f881`, `21d27f785da6d2b1`, `006d583a371f22ec`, `35813c04e939bc21`, `098fc28e44347a00`, `bd0dfdfb50657f60`, `b24d68169f04159a`, `0115b73d7e531e04`, `cbff6f05ed99958b`, `9ac37ee176bd2353`, `dedcc49075cfc1d9`, `45b8c316ec2f3e8c`, `9216e90f97b19283`, `64f4384125e1993b`, `234d47be72397f85`, `b5e3137b54ba16c4`, `6006c34443033b5a`, `ce3bba2e7a2c2c7b`, `54ccf3d13b5bf091`, `9267f0cfc6452000`, `7239c0d4326c9967`, `f29138d2ea4a0b9e`, `2a3522dae6b66c17`, `4e425adf8edeb96f`, `76ebccca0fd3851e`, `beee29e2da2b1461`, `ebce8db62fe43ed9`, `444715459ad11d5c`, `e6b1160ee45c1666`, `4220c55ebf8602de`, `706d91607b2b5516`, `e99d19aac5b0bcb4`, `31430354dd5c259c`, `269b802f878c24e1`, `3e28ebd6128bd351`, `d3d595d35a4ee7bb`, `b2b782b5d732607d`, `da1656ad2910e4c7`, `9b885ee6fdda77f5`, `0e45e59e93b736e4`, `d3e44e754b3eb6aa`, `38faf850f130d4dc`, `65732e201b1230d2`, `0102eac428002832`, `b8c6ee7eb35f23ea`, `dbfb6f9d172b3a43`, `959a530059731c41`, `d474a0f15cd0f545`, `251d57fa0adf0b53`, `deec5fb86d9cc5f3`, `fe71a5c67edd3d84`, `889d32cc4e668148`, `4a05640ec16718ad`, `1ea7e2dbf731c8dc`, `ab82f8d3b0809138`, `96ed122706539da9`, `7353bdc4c2c79fd1`, `f38afa09308835a3`, `418f3fdf020b9eda`, `93c52598be113a6b`, `9faf21803c0d8eea`, `c47e03e0e3946741`, `e35b7de6a9d2bfd4`, `746fd4d8b0d88c3c`, `dfba1b3a39e9a19d`, `27afb6546fe3e225`, `021587bdd5335e89`, `c8c53d32de5c858d`, `611e727832ef1ab9`, `3d03a8a88ad6670e`, `c0b9134fa622f802`, `f7abaa39145df433` </details> **The revert itself**, same corpus run (`translate --validate --list` over the whole dump, `main` e1251c31 against `main` + this PR, 32 lanes, play's shader-key settings, DXC 1.9.2609 validator): **0** newly failing, **0** newly passing. **17,902** of 25,699 programs change DXIL, and all of them validate (apart from the 71 oversized mesh programs that already fail on `main`). It is safe to merge as far as translation goes. Expect every player's shader cache to be rebuilt for most programs.
Author
Owner

@⁠BitWuehler on GitHub · 2026-12-01 00:41 UTC · original

Tested on Linux (CachyOS) / GE-Proton 11-14 (vkd3d-proton master) / Ryzen 7 9800X3D / RTX 5080 16 GB (driver 620.73.04) on top of 7d93ee07 (Series X profile, 1440p, DLSS Balanced + DLSS Frame Generation 2x):

  • Clean cherry-pick, 0 host pipeline failures across a 22-minute playtest (188 in-world intervals, 26,249 DLSS upscalings).
  • Hair rendering is completely clean again with no scrambling or regressions.

(Test summary compiled with AI assistance.)

**@⁠BitWuehler** on GitHub · 2026-12-01 00:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7296630840) Tested on **Linux (CachyOS) / GE-Proton 11-14 (`vkd3d-proton master`) / Ryzen 7 9800X3D / RTX 5080 16 GB (driver 620.73.04)** on top of `7d93ee07` (Series X profile, 1440p, DLSS Balanced + DLSS Frame Generation 2x): - Clean cherry-pick, **0 host pipeline failures** across a 22-minute playtest (188 in-world intervals, 26,249 DLSS upscalings). - Hair rendering is completely clean again with no scrambling or regressions. *(Test summary compiled with AI assistance.)*
Author
Owner

@⁠KyleS98 on GitHub · 2026-12-01 02:55 UTC · original

An independent bisect on other hardware landed on the same merge, so here is what it adds to the above: in-game runs for @⁠VibeCodeGuy's point 2, the one case of the rule that matters, and that this rule is also a frame-time regression.

Setup. RTX 3090 Ti (driver 616.92), Ryzen 9 9950X3D, Windows 11, Series X profile at 2560x1440, DLSS performance, FSR 3 frame generation 2x; the prologue's cell with the character at the window. Hair judged from screenshots by a script and by eye at the end points; every run from an empty shader cache.

The bisect agrees: last good #2349 (4308f5ce), first bad #2357 (467a002d), over main's first-parent line from f889bb07, each step built with 87dd67e1 on top because of #1939's Rmw::Sub.

It needs REUSE, measured in game. With a switch around the rule and the passes chosen by VICTORY_SHADER_OPT, on a tree that has e1251c31 merged into our fork (KyleS98/VIctory-Neo):

hair fps frames over 50 ms, per 1000
everything on torn 24.5 141
the lshr arm of the rule off whole 30.5 13
rule on, no REUSE (VICTORY_SHADER_OPT=443) whole 30.7 7
rule on, no LOADS (431) torn 25.3 138
rule on, no FACTS (439) torn 25.2 131
rule on, no LICM (319) torn 25.5 132
rule on for every pair except shift 16 with mask 0xFFFF whole 30.7 8
rule on for that pair alone torn 24.9 134

So it is not the missing mask by itself. It is the mask gone from (x >> 16) & 0xFFFF and REUSE then merging the two LegacyF16ToF32 calls into one, exactly the second difference in the offline check above. With the two calls kept apart, masked or not, the hair is whole. That points at one shape to look at: a single LegacyF16ToF32(lshr %x, 16) carrying the uses of both former calls.

It is the frame-time regression too. The fps and long-frame columns move with the hair in every row. On e1251c31 as released, VICTORY_SHADER_OPT=445 gives whole hair and 30.3 fps where the default gives torn hair and 23.3 (166 frames per 1000 over 50 ms down to 22). The strands across the screen are what costs the frames, so the revert should bring back frame rate on cards like this one, not only the hair.

For the fix: the revert is fine by me. If you would rather keep the other folds, a smaller change also holds here: dropping only the "mask covers the shift" arm for lshr (the arm that folds to zero can stay) gave whole hair on 7d93ee07 in one full run (29.6 fps), with the optimizer's 31 unit tests passing after the rule's own test is adjusted. I can send that as a pull request if it is wanted; I did not want to open a second one beside this.

Not checked here: AMD and Intel cards, and why the card's compiler treats the merged call differently.

AI-assisted (Claude Code, Claude Fable 5.2)

**@⁠KyleS98** on GitHub · 2026-12-01 02:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7299136229) An independent bisect on other hardware landed on the same merge, so here is what it adds to the above: in-game runs for @⁠VibeCodeGuy's point 2, the one case of the rule that matters, and that this rule is also a frame-time regression. **Setup.** RTX 3090 Ti (driver 616.92), Ryzen 9 9950X3D, Windows 11, Series X profile at 2560x1440, DLSS performance, FSR 3 frame generation 2x; the prologue's cell with the character at the window. Hair judged from screenshots by a script and by eye at the end points; every run from an empty shader cache. **The bisect agrees:** last good #2349 (`4308f5ce`), first bad #2357 (`467a002d`), over main's first-parent line from `f889bb07`, each step built with `87dd67e1` on top because of #1939's `Rmw::Sub`. **It needs REUSE, measured in game.** With a switch around the rule and the passes chosen by `VICTORY_SHADER_OPT`, on a tree that has `e1251c31` merged into our fork (KyleS98/VIctory-Neo): | | hair | fps | frames over 50 ms, per 1000 | |---|---|---|---| | everything on | torn | 24.5 | 141 | | the `lshr` arm of the rule off | whole | 30.5 | 13 | | rule on, no REUSE (`VICTORY_SHADER_OPT=443`) | whole | 30.7 | 7 | | rule on, no LOADS (431) | torn | 25.3 | 138 | | rule on, no FACTS (439) | torn | 25.2 | 131 | | rule on, no LICM (319) | torn | 25.5 | 132 | | rule on for every pair except shift 16 with mask 0xFFFF | whole | 30.7 | 8 | | rule on for that pair alone | torn | 24.9 | 134 | So it is not the missing mask by itself. It is the mask gone from `(x >> 16) & 0xFFFF` **and** REUSE then merging the two `LegacyF16ToF32` calls into one, exactly the second difference in the offline check above. With the two calls kept apart, masked or not, the hair is whole. That points at one shape to look at: a single `LegacyF16ToF32(lshr %x, 16)` carrying the uses of both former calls. **It is the frame-time regression too.** The fps and long-frame columns move with the hair in every row. On `e1251c31` as released, `VICTORY_SHADER_OPT=445` gives whole hair and 30.3 fps where the default gives torn hair and 23.3 (166 frames per 1000 over 50 ms down to 22). The strands across the screen are what costs the frames, so the revert should bring back frame rate on cards like this one, not only the hair. **For the fix:** the revert is fine by me. If you would rather keep the other folds, a smaller change also holds here: dropping only the "mask covers the shift" arm for `lshr` (the arm that folds to zero can stay) gave whole hair on `7d93ee07` in one full run (29.6 fps), with the optimizer's 31 unit tests passing after the rule's own test is adjusted. I can send that as a pull request if it is wanted; I did not want to open a second one beside this. Not checked here: AMD and Intel cards, and why the card's compiler treats the merged call differently. AI-assisted (Claude Code, Claude Fable 5.2)
Author
Owner

@⁠nick0451 on GitHub · 2026-12-01 03:44 UTC · original

@⁠cafeoh A note on the branch, since the description says it's opt.rs only: the PR currently shows 14 commits and 33 files (+990 −1219). The branch starts from the release commit e1251c31, and that commit isn't on main. The release line carries its own copies of 13 of main's commits (for example ec3ac62b there and 9e405ccb on main, "keep 512 MB below 4 GiB …"), so GitHub counts them as part of this PR. Your commit 43e0df14 on its own cherry-picks cleanly onto current main (5fabb46e): opt.rs only, +35 −372. Rebasing the branch onto main would leave just the revert.

One more data point for the change, on an RTX 3090 (Ampere), driver 610.88, Series S, DLSS performance. On the official v2026.11.30.03 at a balcony railing: the default build gave scrambled hair in 2 of 2 off-screen starts and in a watched session, and a 40-frame burst at about 12 frames/s caught the strands spread wide around the head in almost every frame. VICTORY_SHADER_OPT=445 gave whole hair and beard in 2 of 2 starts and in a watched session, with 40 of 40 frames clean in the burst, and 28–30 fps against 22–23 at the same spot. That agrees with KyleS98's frame-time finding.

**@⁠nick0451** on GitHub · 2026-12-01 03:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7300013568) @⁠cafeoh A note on the branch, since the description says it's `opt.rs` only: the PR currently shows 14 commits and 33 files (+990 −1219). The branch starts from the release commit `e1251c31`, and that commit isn't on `main`. The release line carries its own copies of 13 of main's commits (for example `ec3ac62b` there and `9e405ccb` on main, "keep 512 MB below 4 GiB …"), so GitHub counts them as part of this PR. Your commit `43e0df14` on its own cherry-picks cleanly onto current `main` (`5fabb46e`): `opt.rs` only, +35 −372. Rebasing the branch onto `main` would leave just the revert. One more data point for the change, on an RTX 3090 (Ampere), driver 610.88, Series S, DLSS performance. On the official v2026.11.30.03 at a balcony railing: the default build gave scrambled hair in 2 of 2 off-screen starts and in a watched session, and a 40-frame burst at about 12 frames/s caught the strands spread wide around the head in almost every frame. `VICTORY_SHADER_OPT=445` gave whole hair and beard in 2 of 2 starts and in a watched session, with 40 of 40 frames clean in the burst, and 28–30 fps against 22–23 at the same spot. That agrees with KyleS98's frame-time finding.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 09:03 UTC · original

I cherry-picked your exact revert 43e0df14 onto current main 5fabb46e as 86db371f4ab317011efeab41375d468d01dc65f4, preserving the Git author. The patch ID matches. The comparison with current main has one commit and one changed file, crates/victory-shader/src/emit/bitcode/opt.rs. This leaves the unrelated release-branch commits out of the diff. Rebased commit

The focused extended_fold_algebraic_bitwise_shifts_and_strength_reduction unit test passed on Windows/MSVC with Rust 1.98.1, and cargo xtask policy --staged accepted the exact diff. The game has yet to be tested on this rebased commit. The original in-game bisect remains the evidence for the visual fix.

If this base works for you, the review commit is ready to use in the existing PR.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 09:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7306151642) I cherry-picked your exact revert `43e0df14` onto current `main` `5fabb46e` as `86db371f4ab317011efeab41375d468d01dc65f4`, preserving the Git author. The patch ID matches. The comparison with current main has one commit and one changed file, `crates/victory-shader/src/emit/bitcode/opt.rs`. This leaves the unrelated release-branch commits out of the diff. [Rebased commit](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/86db371f4ab317011efeab41375d468d01dc65f4) The focused `extended_fold_algebraic_bitwise_shifts_and_strength_reduction` unit test passed on Windows/MSVC with Rust 1.98.1, and `cargo xtask policy --staged` accepted the exact diff. The game has yet to be tested on this rebased commit. The original in-game bisect remains the evidence for the visual fix. If this base works for you, the review commit is ready to use in the existing PR. AI-assisted with OpenAI Codex.
github-bot force-pushed github-bot/gh-4567 from 43e0df1466 to c95ef843ed 2026-12-01 09:45:36 +00:00 Compare
Author
Owner

@⁠cafeoh on GitHub · 2026-12-01 09:44 UTC · original

A speed data point, besides the hair: on main f5c3d2434 (RTX 2080 Ti, Windows 10, Series S, ray tracing on, DLSS off, launcher defaults, release, warm, 89 s after the world, PresentMon last 40 s), two runs each:

fps card ms/frame
main 11.84 / 12.47 72.6 / 71.2
main + this revert 17.01 / 15.57 58.2 / 64.5

(Both with the same unrelated ray-tracing fix on top, so the only difference is this PR.) Whatever the folds do on the card, on this NVIDIA card the frame is about 4 fps slower with them.

Tested: the above. Not tested: other cards, which of the 174 programs costs the time.

**@⁠cafeoh** on GitHub · 2026-12-01 09:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7307146585) A speed data point, besides the hair: on main f5c3d2434 (RTX 2080 Ti, Windows 10, Series S, ray tracing on, DLSS off, launcher defaults, release, warm, 89 s after the world, PresentMon last 40 s), two runs each: | | fps | card ms/frame | |---|---|---| | main | 11.84 / 12.47 | 72.6 / 71.2 | | main + this revert | 17.01 / 15.57 | 58.2 / 64.5 | (Both with the same unrelated ray-tracing fix on top, so the only difference is this PR.) Whatever the folds do on the card, on this NVIDIA card the frame is about 4 fps slower with them. Tested: the above. Not tested: other cards, which of the 174 programs costs the time.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 10:29 UTC · original

SauliusGA confirmed the fix in #4794 on an RTX 3090: the long, jumping hair strands disappeared with the rebased 86db371 in the same save, with DLSS Ultra Performance, frame generation off and Skip Big Copy-Backs on. Tester report

I verified that the tested 86db371f4ab317011efeab41375d468d01dc65f4 and current PR head c95ef843ed have the identical source tree 7addc5a45d.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 10:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4567#issuecomment-7308275789) SauliusGA confirmed the fix in #4794 on an RTX 3090: the long, jumping hair strands disappeared with the rebased 86db371 in the same save, with DLSS Ultra Performance, frame generation off and Skip Big Copy-Backs on. [Tester report](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/4794) I verified that the tested 86db371f4ab317011efeab41375d468d01dc65f4 and current PR head c95ef843edb8d74297c1c0ec5dbd0a0b0f2325cd have the identical source tree 7addc5a45d94fc7862749678c094725813bdadb0. AI-assisted with OpenAI Codex.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4568/head:github-bot/gh-4567'
git switch 'github-bot/gh-4567'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4567'
git switch 'github-bot/gh-4567'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4567'
git switch 'github-bot/gh-4567'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4567'
git switch 'main'
git merge --squash 'github-bot/gh-4567'
git switch 'main'
git merge --ff-only 'github-bot/gh-4567'
git switch 'main'
git merge 'github-bot/gh-4567'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4568
No description provided.