[AMD/Linux] Faces of story characters deform and flicker (neural face rig), Proton + RADV — translations clean #110

Open
opened 2026-12-05 18:49:23 +00:00 by github-bot · 13 comments
Owner

@⁠texx2818 on GitHub · 2026-12-05 18:48 UTC · original

Build: iceboerg00/larp-amd at 05e4140 (built from source; replacement shaders compiled from shaders/replace, same 154 files as v2026.12.05-amd-3)

What happens

Lighting, textures, water, hair, clothes and background characters all render correctly. The faces of main / story characters (Lucia, named inmates in the prison, etc.) are wrong:

  • the face changes shape from frame to frame: an eye rolls up, one brow jumps, the mouth twists or hangs open as a dark hole, then partly snaps back
  • background peds look fine; a named inmate in the cell (Yolanda) looked stable while Lucia's face flickered in the same session

This looks like the same symptom as #39 (closed after 750aabb), but it remains on Linux with 750aabb and everything after it applied.

System

GPU AMD Radeon RX 7900 XT (RDNA3, Navi 31), 20 GB
OS Arch Linux, kernel 7.3.6
Driver Mesa 26.3.1 RADV (radv 26.3.1)
Proton GE-Proton11-16 (Wine 11), vkd3d-proton v3.1-102-g020fc9441-GE-Proton, DXVK dxgi
Output 3840x2160 into gamescope 3.17 (fit to 3440x1440)
Settings Series X, FSR quality, ray tracing on; default wave_lanes

Relevant log lines (default settings):

host device: wave lanes min=32 max=64
host view heaps: hold 1000000 views ...
vkd3d-proton: VK_EXT_descriptor_heap enabled (32 / 16 size, raw uav counter off)
host ray tracing: the device's ray-tracing tier tier=1.1
WARN host view heap: title slots past 606782 read a null slot count=1245184 end=606782
WARN buffer view: not on an element of its host copy, left null offset=108320 element=12
WARN unordered buffer view: the host would refuse it, left null format=39 first=... count=0 stride=0 raw=true width=182452224

No does not translate and no shader replacement not used lines.

The face shaders translate

The four programs from #39 (b22a16a178976e1b, a26a38d61f256901, 926c46bab3b86bd6, 6871d6e4b3ac9a10) all translate. The two face ones are compute_graph_ops:CS_TransposeVecMatMulAlignedOperation / CS_TransposeVecMatMulOperation; the rig is the compute_graph_ops: family (65 programs: MatMul, Dot, Add/Mult/Div broadcast, LeakyRelu, Exp, Reduce*, Quantize*, ...).

An offline larp.exe translate shaders.rpf --list at 32 lanes: 2677 of 2682 compute programs emitted (the 5 not emitted are shadowmask:CS_TraceShadowRays_*, which have replacements), every compute_graph_ops: program among the emitted ones.

What was tried (each in-game, Lucia close up)

Change Result
Default (64-lane translation, 750aabb fallbacks, WaveSize(32) replacements) broken, flickers
LARP_HOST_MAX_WAVE=32 only (driver still runs wave64 by default) broken
LARP_HOST_MAX_WAVE=32 + RADV_PERFTEST=cswave32,pswave32,gewave32 (everything really runs wave32, as on NVIDIA) broken, somewhat less
F10: async compute off + transfer queues off better: the face moves/animates, but still deforms
VKD3D_CONFIG=no_descriptor_heap (descriptor buffer path instead of VK_EXT_descriptor_heap) no change
LARP_ONE_QUEUE=1 + a null UAV barrier after every title Dispatch / indirect dispatch (local patch, wave32 as above) same as async off: moves, still wrong
Same barriers + one queue at 64 lanes (driver default) much worse
VIctory-xmem's patched RADV (memory-model fix for image_heap_* / bindless image loads) — tested before the view-heap fix lighting was black then, faces not assessable

Notes:

  • VKD3D_CONFIG=breadcrumbs_sync does nothing on GE's release vkd3d-proton (breadcrumbs are compiled out), so the dispatch barriers above were done in larp instead.
  • Turning off async compute / transfer queues clearly helped, so part of it is ordering between queues. With barriers after every dispatch on one queue it does not get fully right, so the rest looks like values, not races: the rig computes wrong numbers on this stack, and 32 vs 64 lanes changes how wrong.

Guesses (unverified)

  • The fp16 paths in compute_graph_ops (halves moved as uint, 16-bit wave sums): dxil-spirv → ACO may treat fp16 denormals / rounding / packed math differently from AMD's Windows driver.
  • The cross-lane reductions in the MatMul/Reduce ops when the wave size the driver picks differs from the one translated for (RADV defaults compute and pixel to wave64; WaveSize(32) only on the four replacements).
  • A barrier between the rig's last dispatch and the skinning/mesh draws that read its output (barriers were added only after dispatches).

Can test

Happy to run a diagnostics build, dump translations (LARP_EMIT_DUMP), try a patch, or send logs and screenshots of the face across consecutive frames.

**@⁠texx2818** on GitHub · 2026-12-05 18:48 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110) **Build:** `iceboerg00/larp-amd` at `05e4140` (built from source; replacement shaders compiled from `shaders/replace`, same 154 files as `v2026.12.05-amd-3`) ## What happens Lighting, textures, water, hair, clothes and background characters all render correctly. The faces of **main / story characters** (Lucia, named inmates in the prison, etc.) are wrong: - the face changes shape **from frame to frame**: an eye rolls up, one brow jumps, the mouth twists or hangs open as a dark hole, then partly snaps back - background peds look fine; a named inmate in the cell (Yolanda) looked stable while Lucia's face flickered in the same session This looks like the same symptom as #39 (closed after `750aabb`), but it remains on Linux with `750aabb` and everything after it applied. ## System | | | |---|---| | GPU | AMD Radeon RX 7900 XT (RDNA3, Navi 31), 20 GB | | OS | Arch Linux, kernel 7.3.6 | | Driver | Mesa 26.3.1 RADV (`radv 26.3.1`) | | Proton | GE-Proton11-16 (Wine 11), vkd3d-proton `v3.1-102-g020fc9441-GE-Proton`, DXVK dxgi | | Output | 3840x2160 into gamescope 3.17 (fit to 3440x1440) | | Settings | Series X, FSR quality, ray tracing on; default `wave_lanes` | Relevant log lines (default settings): ``` host device: wave lanes min=32 max=64 host view heaps: hold 1000000 views ... vkd3d-proton: VK_EXT_descriptor_heap enabled (32 / 16 size, raw uav counter off) host ray tracing: the device's ray-tracing tier tier=1.1 WARN host view heap: title slots past 606782 read a null slot count=1245184 end=606782 WARN buffer view: not on an element of its host copy, left null offset=108320 element=12 WARN unordered buffer view: the host would refuse it, left null format=39 first=... count=0 stride=0 raw=true width=182452224 ``` No `does not translate` and no `shader replacement not used` lines. ## The face shaders translate The four programs from #39 (`b22a16a178976e1b`, `a26a38d61f256901`, `926c46bab3b86bd6`, `6871d6e4b3ac9a10`) all translate. The two face ones are `compute_graph_ops:CS_TransposeVecMatMulAlignedOperation` / `CS_TransposeVecMatMulOperation`; the rig is the `compute_graph_ops:` family (65 programs: MatMul, Dot, Add/Mult/Div broadcast, LeakyRelu, Exp, Reduce*, Quantize*, ...). An offline `larp.exe translate shaders.rpf --list` at 32 lanes: **2677 of 2682 compute programs emitted** (the 5 not emitted are `shadowmask:CS_TraceShadowRays_*`, which have replacements), every `compute_graph_ops:` program among the emitted ones. ## What was tried (each in-game, Lucia close up) | Change | Result | |---|---| | Default (64-lane translation, `750aabb` fallbacks, `WaveSize(32)` replacements) | broken, flickers | | `LARP_HOST_MAX_WAVE=32` only (driver still runs wave64 by default) | broken | | `LARP_HOST_MAX_WAVE=32` + `RADV_PERFTEST=cswave32,pswave32,gewave32` (everything really runs wave32, as on NVIDIA) | broken, somewhat less | | F10: async compute **off** + transfer queues **off** | **better**: the face moves/animates, but still deforms | | `VKD3D_CONFIG=no_descriptor_heap` (descriptor buffer path instead of `VK_EXT_descriptor_heap`) | no change | | `LARP_ONE_QUEUE=1` + a **null UAV barrier after every title Dispatch / indirect dispatch** (local patch, wave32 as above) | same as async off: moves, still wrong | | Same barriers + one queue at **64** lanes (driver default) | much worse | | VIctory-xmem's patched RADV (memory-model fix for `image_heap_*` / bindless image loads) — tested before the view-heap fix | lighting was black then, faces not assessable | Notes: - `VKD3D_CONFIG=breadcrumbs_sync` does nothing on GE's release vkd3d-proton (breadcrumbs are compiled out), so the dispatch barriers above were done in larp instead. - Turning off async compute / transfer queues clearly helped, so part of it is ordering between queues. With barriers after every dispatch on one queue it does **not** get fully right, so the rest looks like **values**, not races: the rig computes wrong numbers on this stack, and 32 vs 64 lanes changes how wrong. ## Guesses (unverified) - The fp16 paths in `compute_graph_ops` (halves moved as `uint`, 16-bit wave sums): dxil-spirv → ACO may treat fp16 denormals / rounding / packed math differently from AMD's Windows driver. - The cross-lane reductions in the MatMul/Reduce ops when the wave size the driver picks differs from the one translated for (RADV defaults compute and pixel to wave64; `WaveSize(32)` only on the four replacements). - A barrier between the rig's last dispatch and the skinning/mesh draws that read its output (barriers were added only after dispatches). ## Can test Happy to run a diagnostics build, dump translations (`LARP_EMIT_DUMP`), try a patch, or send logs and screenshots of the face across consecutive frames.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 18:49:24 +00:00
Author
Owner

@⁠tmalik1116 on GitHub · 2026-12-05 19:53 UTC · original

Same symptom on RDNA2 / Linux, plus two data points that may narrow it down.

System: RX 6800 XT (Navi 21), CachyOS, kernel 7.3.5, Mesa 26.3.1 RADV, Proton (proton-cachyos-slr), vkd3d-proton 3.2 (71cae091). Series X, 4K output, title's own upscaler, ray tracing on. Log: wave lanes min=32 max=64, buffer views by byte offset ... supported=true (so the RX 6000 Windows crash paths don't apply here, and it never crashes).

What I see: Jason's mouth hangs open in idle and in close-ups (porch idle at the start of a save, and a walk through the house). It never closes, even when other parts of the face move.

Builds tested, same save and spot:

Build Mouth
gamingwithhomie larp release package 57b0877 (+ local changes, 2026-12-05 05:57), replacements off so lighting is right on AMD open, with a torn-looking block hanging below the jaw (worst)
iceboerg00 v2026.12.05-amd-fix (45cc4f6) open, lips and teeth deformed
iceboerg00 v2026.12.05-amd-2 (3f3763a), defaults open, no tearing (better than the two above)
amd-2 + LARP_HOST_MAX_WAVE=32 open
amd-2 + LARP_SHADER_REPLACE pointing at an empty folder open

So the replacement shaders aren't the cause, and it was already there before the AMD fork; amd-2 made it milder. With amd-fix the log still had 4 untranslated programs and 14 without a host pipeline per frame; with amd-2 it's 0. So the remaining fault is in programs that do translate, which matches your findings.

A different translator on the same driver stack gets it right: VIctory-xmem (lobomfz) renders the same scene on the same machine, Mesa build and vkd3d-proton, and Jason's mouth is closed in every capture. That makes a generic RADV/ACO fp16 or denormal problem less likely to be the whole story. Either larp's translation of the compute_graph_ops rig hits something RADV runs differently, or it's missing a barrier or ordering between the rig and its consumers that xmem keeps.

Happy to test a build, dump translations (LARP_EMIT_DUMP), or compare against xmem on the same frames.

**@⁠tmalik1116** on GitHub · 2026-12-05 19:53 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7444360610) Same symptom on **RDNA2 / Linux**, plus two data points that may narrow it down. **System:** RX 6800 XT (Navi 21), CachyOS, kernel 7.3.5, Mesa 26.3.1 RADV, Proton (proton-cachyos-slr), vkd3d-proton 3.2 (`71cae091`). Series X, 4K output, title's own upscaler, ray tracing on. Log: `wave lanes min=32 max=64`, `buffer views by byte offset ... supported=true` (so the RX 6000 Windows crash paths don't apply here, and it never crashes). **What I see:** Jason's mouth hangs open in idle and in close-ups (porch idle at the start of a save, and a walk through the house). It never closes, even when other parts of the face move. **Builds tested, same save and spot:** | Build | Mouth | |---|---| | gamingwithhomie larp release package `57b0877` (+ local changes, 2026-12-05 05:57), replacements **off** so lighting is right on AMD | open, with a torn-looking block hanging below the jaw (worst) | | iceboerg00 `v2026.12.05-amd-fix` (`45cc4f6`) | open, lips and teeth deformed | | iceboerg00 `v2026.12.05-amd-2` (`3f3763a`), defaults | open, no tearing (better than the two above) | | amd-2 + `LARP_HOST_MAX_WAVE=32` | open | | amd-2 + `LARP_SHADER_REPLACE` pointing at an empty folder | open | So the replacement shaders aren't the cause, and it was already there before the AMD fork; amd-2 made it milder. With amd-fix the log still had 4 untranslated programs and `14 without a host pipeline` per frame; with amd-2 it's 0. So the remaining fault is in programs that *do* translate, which matches your findings. **A different translator on the same driver stack gets it right:** VIctory-xmem (lobomfz) renders the same scene on the same machine, Mesa build and vkd3d-proton, and Jason's mouth is closed in every capture. That makes a generic RADV/ACO fp16 or denormal problem less likely to be the whole story. Either larp's translation of the `compute_graph_ops` rig hits something RADV runs differently, or it's missing a barrier or ordering between the rig and its consumers that xmem keeps. Happy to test a build, dump translations (`LARP_EMIT_DUMP`), or compare against xmem on the same frames.
Author
Owner

@⁠tib1rgitta-eng on GitHub · 2026-12-05 20:07 UTC · original

Another RDNA2 / Linux data point — and on a 12 GB card where VRAM is saturated, which may help separate "rig maths" from "memory pressure".

System

  • GPU: AMD Radeon RX 6750 GRE 12GB (Navi 22, RDNA2), RADV, Mesa 25.2.8-0ubuntu0.24.04.5, Vulkan 1.4.318
  • CPU / RAM: AMD Ryzen 5 5600, 16 GB
  • OS: Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.3.2-070302-generic, X11
  • Proton: GE-Proton11-16 (version 1796087067), umu-launcher 1.4.4, steamrt4
  • larp: built from main at 30b2fd3 (2026-12-06) via linux/build.sh, 85 replacement DXILs, launched with linux/run.sh
  • Settings: 2560x1440, upscaler FSR, frame generation 2x (FSR generator), ray tracing on, texture_detail = 1 level down, bvh_quality = low, directional_shadow_quality = low, motion_blur = off

Symptom

Matches the "torn block hanging below the jaw" description in @⁠tmalik1116's comment rather than the frame-to-frame flicker in the original report:

  • Lucia, close-ups in the prologue (cell and corridor): the mouth and chin render as a black, jagged, horizontally smeared block hanging below the jaw.
  • It is stable across frames — it does not flicker or snap back in my captures, it just stays wrong.
  • Eyes and brows look correct. Hair, clothes, lighting, reflections, shadows and background peds all look right; a named inmate in the same cell looked fine.

Log, this build (play.log)

host device: wave lanes min=32 max=64
WARN host view heap: title slots past 606782 read a null slot count=1245184 end=606782
WARN buffer view: not on an element of its host copy, left null offset=130592 ...
WARN unordered buffer view: the host would refuse it, left null format=39 ...
dropped per frame: 14 without a host pipeline (0 being made), 0 indirect executions

Four compute programs do not translate, and none of them is a face program — both are the water volumetrics ones:

  • 6871d6e4b3ac9a10 — CS_TransmissionVolumetrics
  • 926c46bab3b86bd6 — CS_TransmissionVolumetricsSubmerged
  • reasons: GFX10 code at 0x22c / 0x360: a wave sum of 16-bit floats where not every lane runs is not supported, at 0x13c8 / 0x1f98: a lane mask holding lanes elsewhere read as data is not supported

So this build reproduces the same 14 without a host pipeline marker that @⁠tmalik1116 saw on amd-fix, while the untranslated programs are only water. That again points at programs which do translate, consistent with both of your findings — and with xmem rendering the same scene correctly on the same driver stack.

VRAM note (may be unrelated)

12.80 / 12.87 GB VRAM used (99.5 %), GPU 98–99 %, 10–13 fps in the prison corridor scene at 1440p with RT on; 14 draws dropped per frame, rising to 28 in the heaviest spots. If it would help separate memory pressure from rig maths I can re-test with texture_detail = 2 levels down and lower RT shadow quality and report whether the chin changes.

Also, for whatever it is worth: the two untranslated water programs are the only thing this build refuses, so if a build that emits them would help isolate the rig, I am happy to test it.

Can test

Happy to run a diagnostics build, LARP_EMIT_DUMP, dump translations, send consecutive-frame screenshots of the chin, or A/B against VIctory-xmem on this machine.


PS — separate issue, unrelated to the face bug: docs/setup-and-quickstart.md / linux/setup.sh install the native d3dcompiler_47.dll via winetricks, and that DLL is the 2013 build (6.3.9600), which only supports shader model 5.0. larp's own host shaders are compiled as vs_5_1 / ps_5_1 / cs_5_1, so on Linux they all fail with error X3506: unrecognized compiler target, the present/composite path breaks (whole screen renders in blocky tiles) and host ray tracing switches itself off. Swapping in the Windows 10 SDK d3dcompiler_47.dll (4.7 MB, has vs_5_1) fixes it — verified by A/B with a standalone D3DCompile test in the same prefix. If you want I can file that one separately with the details.

**@⁠tib1rgitta-eng** on GitHub · 2026-12-05 20:07 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7444545445) Another RDNA2 / Linux data point — and on a 12 GB card where VRAM is saturated, which may help separate "rig maths" from "memory pressure". **System** - GPU: **AMD Radeon RX 6750 GRE 12GB** (Navi 22, RDNA2), RADV, `Mesa 25.2.8-0ubuntu0.24.04.5`, Vulkan 1.4.318 - CPU / RAM: AMD Ryzen 5 5600, 16 GB - OS: Linux Mint 22.3 (Ubuntu 24.04 base), kernel `7.3.2-070302-generic`, X11 - Proton: GE-Proton11-16 (`version` 1796087067), umu-launcher 1.4.4, steamrt4 - larp: built from `main` at `30b2fd3` (2026-12-06) via `linux/build.sh`, 85 replacement DXILs, launched with `linux/run.sh` - Settings: 2560x1440, upscaler FSR, frame generation 2x (FSR generator), ray tracing on, `texture_detail = 1 level down`, `bvh_quality = low`, `directional_shadow_quality = low`, `motion_blur = off` **Symptom** Matches the "torn block hanging below the jaw" description in @⁠tmalik1116's comment rather than the frame-to-frame flicker in the original report: - Lucia, close-ups in the prologue (cell and corridor): the mouth and chin render as a **black, jagged, horizontally smeared block hanging below the jaw**. - It is **stable across frames** — it does not flicker or snap back in my captures, it just stays wrong. - Eyes and brows look correct. Hair, clothes, lighting, reflections, shadows and background peds all look right; a named inmate in the same cell looked fine. **Log, this build** (`play.log`) ``` host device: wave lanes min=32 max=64 WARN host view heap: title slots past 606782 read a null slot count=1245184 end=606782 WARN buffer view: not on an element of its host copy, left null offset=130592 ... WARN unordered buffer view: the host would refuse it, left null format=39 ... dropped per frame: 14 without a host pipeline (0 being made), 0 indirect executions ``` Four compute programs do not translate, and **none of them is a face program** — both are the water volumetrics ones: - `6871d6e4b3ac9a10` — `CS_TransmissionVolumetrics` - `926c46bab3b86bd6` — `CS_TransmissionVolumetricsSubmerged` - reasons: `GFX10 code at 0x22c / 0x360: a wave sum of 16-bit floats where not every lane runs is not supported`, `at 0x13c8 / 0x1f98: a lane mask holding lanes elsewhere read as data is not supported` So this build reproduces the same `14 without a host pipeline` marker that @⁠tmalik1116 saw on `amd-fix`, while the untranslated programs are only water. That again points at programs which **do** translate, consistent with both of your findings — and with xmem rendering the same scene correctly on the same driver stack. **VRAM note (may be unrelated)** 12.80 / 12.87 GB VRAM used (99.5 %), GPU 98–99 %, 10–13 fps in the prison corridor scene at 1440p with RT on; `14` draws dropped per frame, rising to `28` in the heaviest spots. If it would help separate memory pressure from rig maths I can re-test with `texture_detail = 2 levels down` and lower RT shadow quality and report whether the chin changes. Also, for whatever it is worth: the two untranslated water programs are the *only* thing this build refuses, so if a build that emits them would help isolate the rig, I am happy to test it. **Can test** Happy to run a diagnostics build, `LARP_EMIT_DUMP`, dump translations, send consecutive-frame screenshots of the chin, or A/B against VIctory-xmem on this machine. --- PS — separate issue, unrelated to the face bug: `docs/setup-and-quickstart.md` / `linux/setup.sh` install the native `d3dcompiler_47.dll` via winetricks, and that DLL is the 2013 build (`6.3.9600`), which **only supports shader model 5.0**. larp's own host shaders are compiled as `vs_5_1 / ps_5_1 / cs_5_1`, so on Linux they all fail with `error X3506: unrecognized compiler target`, the present/composite path breaks (whole screen renders in blocky tiles) and `host ray tracing` switches itself off. Swapping in the Windows 10 SDK `d3dcompiler_47.dll` (4.7 MB, has `vs_5_1`) fixes it — verified by A/B with a standalone `D3DCompile` test in the same prefix. If you want I can file that one separately with the details.
Author
Owner

@⁠thiagonl on GitHub · 2026-12-05 20:27 UTC · original

Same symptom here on a different card, plus a lead on the cause from another fork.

Setup: iceboerg00/larp-amd (built from source; first 05e4140, now f6954fc), Series X and Series S, 30/60 fps. Arch-based Linux, Mesa 26.3.1 RADV (GFX1200), RX 9060 XT 16 GB (RDNA4), GE-Proton11-7 wine with vkd3d-proton 3.2.0. Replacement shaders as shipped in larp-amd-fix-3.

What I see: faces of story characters now render (eyes, hair, skin, teeth), but the inside of the mouth is wrong while talking: a dark hole, no teeth or tongue, and the lips look torn. Background characters are fine. Not flickering as in the report above, but the same family of symptom.

What does not change it:

  • wave_lanes = 32 (full re-translation): same.
  • F10: async compute off, transfer queues off, subsurface scattering, tessellation, people texture limit, hair settings: same.
  • The log has shader replacements: ... refused=0 and no translation errors, so this is not a refused program.

Probable cause (from the cool_fox fork, not verified on larp): its docs/proton.md, section "Faces still, eyes glowing, or faces torn", describes exactly this ("mouths agape, teeth under the nose") on RADV through vkd3d-proton. In compute programs that store to UAVs and use s_barrier, a typed (texel buffer) 16-bit integer load after the group barrier can return the value from before another wave's store that preceded the barrier. A raw (storage buffer) load of the same bytes sees the store. They traced it to the face network's interpreter, program 0aa7934094794dbf (1,024 threads keep a register file in an R16_UINT view, a barrier between its 12 stages): replayed alone, typed loads diverged from a CPU model from stage 2, while one dispatch per stage or raw loads matched at every stage. They also tried globally coherent views and RADV's LLVM backend, with no change. Their fix is commit 01878ee in the cool_fox repository (switch VICTORY_RAW_TYPED_LOADS): for _d16 typed UAV loads of 1, 2 or 4 channels in such programs, also load through the slot's raw view and select at run time for views marked 16-bit integer.

This also fits the table above: turning async compute off helps because it removes some cross-queue ordering, but the values stay wrong because the stale typed load is inside one dispatch.

Where it would go in larp: the face network views are already R16_UINT / R16G16B16A16_UINT, which crates/larp-gpu/src/halves.rs uses as they are (no twin is made for unsigned formats). A raw twin of those slots (see twin_entry / half_twins in draw.rs) plus a rawBufferLoad in the half branch of the typed buffer load in larp-shader/src/emit/lower.rs, only for compute programs with UAV stores and s_barrier, would be the equivalent. Stores through the raw view would need dword-safe 16-bit writes. I have not tried it: the host has to create the raw view in the same list entry.

Can test: a patch, a diagnostics build or gpu_debug logs on RDNA4 + RADV, and screenshots of the mouth (I can attach them).

**@⁠thiagonl** on GitHub · 2026-12-05 20:27 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7444828053) Same symptom here on a different card, plus a lead on the cause from another fork. **Setup:** `iceboerg00/larp-amd` (built from source; first `05e4140`, now `f6954fc`), Series X and Series S, 30/60 fps. Arch-based Linux, Mesa 26.3.1 RADV (GFX1200), **RX 9060 XT 16 GB (RDNA4)**, GE-Proton11-7 wine with vkd3d-proton 3.2.0. Replacement shaders as shipped in `larp-amd-fix-3`. **What I see:** faces of story characters now render (eyes, hair, skin, teeth), but the inside of the mouth is wrong while talking: a dark hole, no teeth or tongue, and the lips look torn. Background characters are fine. Not flickering as in the report above, but the same family of symptom. **What does not change it:** - `wave_lanes = 32` (full re-translation): same. - F10: async compute off, transfer queues off, subsurface scattering, tessellation, people texture limit, hair settings: same. - The log has `shader replacements: ... refused=0` and no translation errors, so this is not a refused program. **Probable cause (from the cool_fox fork, not verified on larp):** its `docs/proton.md`, section "Faces still, eyes glowing, or faces torn", describes exactly this ("mouths agape, teeth under the nose") on RADV through vkd3d-proton. In compute programs that store to UAVs and use `s_barrier`, a typed (texel buffer) 16-bit integer load after the group barrier can return the value from before another wave's store that preceded the barrier. A raw (storage buffer) load of the same bytes sees the store. They traced it to the face network's interpreter, program `0aa7934094794dbf` (1,024 threads keep a register file in an `R16_UINT` view, a barrier between its 12 stages): replayed alone, typed loads diverged from a CPU model from stage 2, while one dispatch per stage or raw loads matched at every stage. They also tried globally coherent views and RADV's LLVM backend, with no change. Their fix is commit `01878ee` in the cool_fox repository (switch `VICTORY_RAW_TYPED_LOADS`): for `_d16` typed UAV loads of 1, 2 or 4 channels in such programs, also load through the slot's raw view and select at run time for views marked 16-bit integer. This also fits the table above: turning async compute off helps because it removes some cross-queue ordering, but the values stay wrong because the stale typed load is inside one dispatch. **Where it would go in larp:** the face network views are already `R16_UINT` / `R16G16B16A16_UINT`, which `crates/larp-gpu/src/halves.rs` uses as they are (no twin is made for unsigned formats). A raw twin of those slots (see `twin_entry` / `half_twins` in `draw.rs`) plus a `rawBufferLoad` in the `half` branch of the typed buffer load in `larp-shader/src/emit/lower.rs`, only for compute programs with UAV stores and `s_barrier`, would be the equivalent. Stores through the raw view would need dword-safe 16-bit writes. I have not tried it: the host has to create the raw view in the same list entry. **Can test:** a patch, a diagnostics build or `gpu_debug` logs on RDNA4 + RADV, and screenshots of the mouth (I can attach them).
Author
Owner

@⁠gamingwithhomie on GitHub · 2026-12-05 20:52 UTC · original

Please retest on v1.1.1 [Linux/Proton] (FULL zip in the v1.1.1 release). It includes #142s wave64 stall-guard retry, #135s Wine fixes and #147. If faces still deform on RADV, also try forcing the wave32 translation path (LARP_HOST_WAVE=32 / LARP_HOST_MAX_WAVE=32) and tell us whether the flicker changes - that separates 'rig maths at wave64' from memory pressure. zip-logs output welcome.

**@⁠gamingwithhomie** on GitHub · 2026-12-05 20:52 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7445185880) Please retest on **v1.1.1 [Linux/Proton]** (FULL zip in the v1.1.1 release). It includes #142s wave64 stall-guard retry, #135s Wine fixes and #147. If faces still deform on RADV, also try forcing the wave32 translation path (`LARP_HOST_WAVE=32` / `LARP_HOST_MAX_WAVE=32`) and tell us whether the flicker changes - that separates 'rig maths at wave64' from memory pressure. zip-logs output welcome.
Author
Owner

@⁠tmalik1116 on GitHub · 2026-12-05 20:57 UTC · original

Follow-up: a driver-side workaround fixes it here (RX 6800 XT, Mesa 26.3.1 RADV, vkd3d-proton 3.2). This confirms the barrier/visibility lead from the cool_fox fork above.

RADV runs compute shaders that use no LDS in WGP mode (radv_should_use_wgp_mode). In that mode one workgroup's waves can be spread over both CUs of a WGP, each CU with its own L0. A local, env-gated one-liner that returns false there for compute (CU mode, one L0 per workgroup) makes the face rig come out right:

/* in radv_should_use_wgp_mode(), after the gfx_level < GFX10 check */
if (stage == MESA_SHADER_COMPUTE && getenv("RADV_CS_NO_WGP"))
   return false;

Same build, save and spot, Mesa shader cache disabled for both runs (RADV's cache key doesn't include the env var, so a fresh larp cache and Mesa cache are needed when switching):

iceboerg00/larp-amd v2026.12.05-amd-4 (d444d19) Mouth fps (porch, 4K out)
RADV_CS_NO_WGP=1 closed in every capture, matches VIctory-xmem ~34.4
control, unset stuck open ~33.5

So the stale value is a cross-CU L0 visibility problem within one workgroup. A store from a wave on the other CU before s_barrier isn't seen by the following typed _d16 load. That fits the typed-vs-raw difference described above. Either the translated program's barrier needs device- or workgroup-coherent semantics that cover the texel-buffer loads (so ACO emits the buffer_gl0_inv), or RADV/ACO misses the L0 invalidate for typed buffer loads in WGP mode. I haven't checked which side is at fault. A raw-load path in larp (as cool_fox did) or forcing CU mode only for the compute_graph_ops programs would avoid it without a driver patch.

Not tested on RDNA3/4, but the WGP/L0 layout is the same there, so it's worth a try with a patched Mesa.

**@⁠tmalik1116** on GitHub · 2026-12-05 20:57 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7445244032) Follow-up: **a driver-side workaround fixes it here** (RX 6800 XT, Mesa 26.3.1 RADV, vkd3d-proton 3.2). This confirms the barrier/visibility lead from the cool_fox fork above. RADV runs compute shaders that use no LDS in **WGP mode** (`radv_should_use_wgp_mode`). In that mode one workgroup's waves can be spread over both CUs of a WGP, each CU with its own L0. A local, env-gated one-liner that returns `false` there for compute (CU mode, one L0 per workgroup) makes the face rig come out right: ```c /* in radv_should_use_wgp_mode(), after the gfx_level < GFX10 check */ if (stage == MESA_SHADER_COMPUTE && getenv("RADV_CS_NO_WGP")) return false; ``` Same build, save and spot, Mesa shader cache disabled for both runs (RADV's cache key doesn't include the env var, so a fresh larp cache and Mesa cache are needed when switching): | `iceboerg00/larp-amd` `v2026.12.05-amd-4` (`d444d19`) | Mouth | fps (porch, 4K out) | |---|---|---| | `RADV_CS_NO_WGP=1` | closed in every capture, matches VIctory-xmem | ~34.4 | | control, unset | stuck open | ~33.5 | So the stale value is a cross-CU L0 visibility problem within one workgroup. A store from a wave on the other CU before `s_barrier` isn't seen by the following typed `_d16` load. That fits the typed-vs-raw difference described above. Either the translated program's barrier needs device- or workgroup-coherent semantics that cover the texel-buffer loads (so ACO emits the `buffer_gl0_inv`), or RADV/ACO misses the L0 invalidate for typed buffer loads in WGP mode. I haven't checked which side is at fault. A raw-load path in larp (as cool_fox did) or forcing CU mode only for the `compute_graph_ops` programs would avoid it without a driver patch. Not tested on RDNA3/4, but the WGP/L0 layout is the same there, so it's worth a try with a patched Mesa.
Author
Owner

@⁠dev-kreg on GitHub · 2026-12-05 21:01 UTC · original

Confirmed fix on Linux / RX 9070 (RDNA4) / RADV / GE-Proton11-14: prologue faces render correctly (mouths no longer stuck open, no stretched lips/teeth/jaw).

This follows the lead above (stale _d16 typed UAV loads after s_barrier on RADV) and is ported from VIctory-xmem's raw_typed_loads. Behind an env switch, LARP_RAW_HALF_LOADS=raw, which is keyed into the shader cache (added to larp_shader::SWITCHES). It applies to compute programs that write UAVs, wait at a group barrier and do buffer_load_format_d16_*. For each 1/2/4-channel d16 typed UAV load at a half place, the same bytes are also read through a raw handle of the same heap slot. The raw result is selected at run time where the raw view's byte size equals typed elements × 2 × channels, and the typed result is used otherwise. No host-side changes were needed: vkd3d-proton exposes the raw view of the typed UAV slot. There is also LARP_RAW_HALF_LOADS=coherent (globallycoherent typed handles instead), which I haven't tested.

Patch (against main around v1.1.0)
diff --git a/crates/larp-shader/src/emit/lower.rs b/crates/larp-shader/src/emit/lower.rs
index a547266..819678b 100644
--- a/crates/larp-shader/src/emit/lower.rs
+++ b/crates/larp-shader/src/emit/lower.rs
@@ -347,6 +347,9 @@ struct Lower<'a> {
     tail: Vec<Option<usize>>,
     /// The program writes UAVs: barriers fence them too.
     writes_uavs: bool,
+    /// [`raw_half_loads`] for this program: 0 unless it is compute code that writes UAVs, waits
+    /// at group barriers and reads 16-bit halves through typed views (the face rig).
+    raw_half_loads: u8,
     /// src0 of the current instruction as DPP fetched it.
     src0: Option<V>,
     /// Compute code that reads other lanes: thread ids follow the host
@@ -2115,6 +2118,21 @@ pub fn heap_first_lane() -> bool {
     }
 }
 
+/// `LARP_RAW_HALF_LOADS`: how compute programs that write UAVs, wait at group barriers and read
+/// 16-bit halves through typed UAVs (`_d16`, the face rig's register file in `R16_UINT` views)
+/// read them. 0 (unset, `0`): typed loads as before. 1 (`1`, `raw`): the same bytes also loaded
+/// through a raw handle of the slot, taken where the raw view's size says it holds those
+/// elements (else the typed result): RADV returns stale values for such typed loads after a
+/// barrier (larp issue 110; cool_fox `VICTORY_RAW_TYPED_LOADS`, VIctory-xmem `raw_typed_loads`).
+/// 2 (`coherent`): typed UAV handles of those programs marked globally coherent instead.
+pub fn raw_half_loads() -> u8 {
+    match std::env::var("LARP_RAW_HALF_LOADS").ok().as_deref().map(str::trim) {
+        Some("1" | "raw") => 1,
+        Some("2" | "coherent") => 2,
+        _ => 0,
+    }
+}
+
 /// Whether the program is being lowered with console lanes in pairs ([`with_lane_pairs`]),
 /// where a wave operation in a lane branch is not expected.
 pub(super) fn in_lane_pairs() -> bool {
@@ -2599,6 +2617,15 @@ impl<'a> Lower<'a> {
             matches!(i.fields, Fields::Image { .. } | Fields::Buffer { .. })
                 && (i.name().contains("store") || i.name().contains("atomic"))
         });
+        let raw_half_loads = if x.native.stage == HwStage::Cs
+            && writes_uavs
+            && insts().any(|i| i.name() == "s_barrier")
+            && insts().any(|i| i.name().starts_with("buffer_load_format_d16_"))
+        {
+            raw_half_loads()
+        } else {
+            0
+        };
         let mut console_lanes = false;
         // LDS accesses get a group barrier each (a console wave split in two host waves)
         let mut split_lds = false;
@@ -2960,6 +2987,7 @@ impl<'a> Lower<'a> {
             rpo: vec![usize::MAX; p.blocks.len()],
             tail: vec![None; p.blocks.len()],
             writes_uavs,
+            raw_half_loads,
             src0: None,
             console_lanes,
             split_lds,
@@ -13745,7 +13773,8 @@ impl<'a> Lower<'a> {
                     // Four unsigned integers.
                     self.half_views.insert(place);
                     self.half_accesses += 1;
-                    args.push(self.handle(site, src, false, (10 | u, 0x405))?);
+                    let gc = if self.raw_half_loads == 2 { 0x4000 } else { 0 };
+                    args.push(self.handle(site, src, false, (10 | u | gc, 0x405))?);
                     args.extend([index.unwrap_or(self.s.m.i32(0)), iu]);
                     args.extend(vals);
                     (69, "bufferStore.i32")
@@ -13792,6 +13821,9 @@ impl<'a> Lower<'a> {
             }
             return Ok(());
         }
+        // `LARP_RAW_HALF_LOADS=raw`: the d16 load's bytes read raw as well (`raw_half_loads`),
+        // with whether to take them.
+        let mut raw: Option<(V, Vec<V>)> = None;
         let r = if typed {
             if *offen || matches!(off, V::Inst(_)) || *offset != 0 {
                 return Err("a typed buffer load at an offset");
@@ -13800,11 +13832,15 @@ impl<'a> Lower<'a> {
                 self.s.flags |= flags::TYPED_UAV_LOADS;
             }
             let index = index.unwrap_or(self.s.m.i32(0));
+            let gc = if uav && halves && self.raw_half_loads == 2 { 0x4000 } else { 0 };
+            if uav && halves && d16 && self.raw_half_loads == 1 && matches!(count, 1 | 2 | 4) {
+                raw = Some(self.raw_half_load(site, src, index, count)?);
+            }
             if let Some(place) = half {
                 // Unsigned integers.
                 self.half_views.insert(place);
                 self.half_accesses += 1;
-                let h = self.handle(site, src, false, (10 | u, 0x405))?;
+                let h = self.handle(site, src, false, (10 | u | gc, 0x405))?;
                 let i32t = self.s.t.i32;
                 let ret = self.s.m.named_struct("dx.types.ResRet.i32", vec![i32t; 5]);
                 self.s.op(c, "bufferLoad.i32", Attr::ReadOnly, ret, 68, &[h, index, iu])
@@ -13863,7 +13899,11 @@ impl<'a> Lower<'a> {
                         None => h,
                     });
                 }
-                self.write(inst, Reg::V(reg + k as u8), x.expect("a channel"), guard);
+                let mut x = x.expect("a channel");
+                if let Some((taken, ws)) = &raw {
+                    x = self.s.m.select(c, *taken, ws[k as usize], x);
+                }
+                self.write(inst, Reg::V(reg + k as u8), x, guard);
             }
             return Ok(());
         }
@@ -13876,6 +13916,49 @@ impl<'a> Lower<'a> {
         Ok(())
     }
 
+    /// `LARP_RAW_HALF_LOADS=raw` ([`raw_half_loads`]): the `count` (1, 2 or 4) 16-bit channels of
+    /// element `index` of the typed UAV `src` read through a raw handle of the same slot, packed
+    /// two a dword as a d16 load leaves them, and whether to take them: where the raw view's
+    /// bytes are its typed elements of `2 * count` bytes each (a view of that layout the host's
+    /// driver also shows raw; any other reads its typed result).
+    fn raw_half_load(&mut self, site: Site, src: &Source, index: V, count: u32) -> Result<(V, Vec<V>), Why> {
+        let c = self.cur;
+        let i32t = self.s.t.i32;
+        let iu = self.s.m.undef(i32t);
+        let dims = self.s.m.named_struct("dx.types.Dimensions", vec![i32t; 4]);
+        let typed_h = self.handle(site, src, false, (10 | 0x1000, 0x405))?;
+        let raw_h = self.handle(site, src, false, (11 | 0x1000, 0))?;
+        let elements = self.s.op(c, "getDimensions", Attr::ReadOnly, dims, 72, &[typed_h, iu]);
+        let elements = self.s.m.extract(c, elements, 0);
+        let bytes = self.s.op(c, "getDimensions", Attr::ReadOnly, dims, 72, &[raw_h, iu]);
+        let bytes = self.s.m.extract(c, bytes, 0);
+        let size = self.s.m.i32(2 * count);
+        let want = self.s.m.bin(c, Bin::Mul, elements, size);
+        let zero = self.s.m.i32(0);
+        let some = self.s.m.cmp(c, pred::NE, elements, zero);
+        let same = self.s.m.cmp(c, pred::EQ, bytes, want);
+        let taken = self.s.m.bin(c, Bin::And, some, same);
+        let byte = self.s.m.bin(c, Bin::Mul, index, size);
+        let k3 = self.s.m.i32(3);
+        let within = self.s.m.bin(c, Bin::And, byte, k3);
+        let aligned = self.s.m.bin(c, Bin::Sub, byte, within);
+        let dwords = count.div_ceil(2);
+        let (mask, align) = (self.s.m.i8((1u8 << dwords) - 1), self.s.m.i32(4));
+        let l = self.s.op(c, "rawBufferLoad.f32", Attr::ReadOnly, self.s.t.res_ret, 139, &[raw_h, aligned, iu, mask, align]);
+        let mut ws = Vec::new();
+        for d in 0..dwords {
+            let f = self.s.m.extract(c, l, d);
+            ws.push(self.as_int(f));
+        }
+        if count == 1 {
+            let sh = self.s.m.bin(c, Bin::Shl, within, k3);
+            let x = self.s.m.bin(c, Bin::LShr, ws[0], sh);
+            let low = self.s.m.i32(0xFFFF);
+            ws[0] = self.s.m.bin(c, Bin::And, x, low);
+        }
+        Ok((taken, ws))
+    }
+
     fn export(&mut self, b: usize, i: usize) -> Result<(), Why> {
         let e = *self
             .exports
diff --git a/crates/larp-shader/src/lib.rs b/crates/larp-shader/src/lib.rs
index c81b3a0..5a3b20d 100644
--- a/crates/larp-shader/src/lib.rs
+++ b/crates/larp-shader/src/lib.rs
@@ -95,6 +95,7 @@ pub const SWITCHES: &[&str] = &[
     "LARP_LOOP_REPORT",
     "LARP_MESH_COUNTS",
     "LARP_MESH_EDGE_FLAGS",
+    "LARP_RAW_HALF_LOADS",
     "LARP_SHADER_LOOP_LIMIT",
     "LARP_SHADER_OPT",
 ];
**@⁠dev-kreg** on GitHub · 2026-12-05 21:01 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7445298784) Confirmed fix on Linux / RX 9070 (RDNA4) / RADV / GE-Proton11-14: prologue faces render correctly (mouths no longer stuck open, no stretched lips/teeth/jaw). This follows the lead above (stale `_d16` typed UAV loads after `s_barrier` on RADV) and is ported from VIctory-xmem's `raw_typed_loads`. Behind an env switch, `LARP_RAW_HALF_LOADS=raw`, which is keyed into the shader cache (added to `larp_shader::SWITCHES`). It applies to compute programs that write UAVs, wait at a group barrier and do `buffer_load_format_d16_*`. For each 1/2/4-channel d16 typed UAV load at a half place, the same bytes are also read through a raw handle of the same heap slot. The raw result is selected at run time where the raw view's byte size equals typed elements × 2 × channels, and the typed result is used otherwise. No host-side changes were needed: vkd3d-proton exposes the raw view of the typed UAV slot. There is also `LARP_RAW_HALF_LOADS=coherent` (globallycoherent typed handles instead), which I haven't tested. <details><summary>Patch (against main around v1.1.0)</summary> ```diff diff --git a/crates/larp-shader/src/emit/lower.rs b/crates/larp-shader/src/emit/lower.rs index a547266..819678b 100644 --- a/crates/larp-shader/src/emit/lower.rs +++ b/crates/larp-shader/src/emit/lower.rs @@ -347,6 +347,9 @@ struct Lower<'a> { tail: Vec<Option<usize>>, /// The program writes UAVs: barriers fence them too. writes_uavs: bool, + /// [`raw_half_loads`] for this program: 0 unless it is compute code that writes UAVs, waits + /// at group barriers and reads 16-bit halves through typed views (the face rig). + raw_half_loads: u8, /// src0 of the current instruction as DPP fetched it. src0: Option<V>, /// Compute code that reads other lanes: thread ids follow the host @@ -2115,6 +2118,21 @@ pub fn heap_first_lane() -> bool { } } +/// `LARP_RAW_HALF_LOADS`: how compute programs that write UAVs, wait at group barriers and read +/// 16-bit halves through typed UAVs (`_d16`, the face rig's register file in `R16_UINT` views) +/// read them. 0 (unset, `0`): typed loads as before. 1 (`1`, `raw`): the same bytes also loaded +/// through a raw handle of the slot, taken where the raw view's size says it holds those +/// elements (else the typed result): RADV returns stale values for such typed loads after a +/// barrier (larp issue 110; cool_fox `VICTORY_RAW_TYPED_LOADS`, VIctory-xmem `raw_typed_loads`). +/// 2 (`coherent`): typed UAV handles of those programs marked globally coherent instead. +pub fn raw_half_loads() -> u8 { + match std::env::var("LARP_RAW_HALF_LOADS").ok().as_deref().map(str::trim) { + Some("1" | "raw") => 1, + Some("2" | "coherent") => 2, + _ => 0, + } +} + /// Whether the program is being lowered with console lanes in pairs ([`with_lane_pairs`]), /// where a wave operation in a lane branch is not expected. pub(super) fn in_lane_pairs() -> bool { @@ -2599,6 +2617,15 @@ impl<'a> Lower<'a> { matches!(i.fields, Fields::Image { .. } | Fields::Buffer { .. }) && (i.name().contains("store") || i.name().contains("atomic")) }); + let raw_half_loads = if x.native.stage == HwStage::Cs + && writes_uavs + && insts().any(|i| i.name() == "s_barrier") + && insts().any(|i| i.name().starts_with("buffer_load_format_d16_")) + { + raw_half_loads() + } else { + 0 + }; let mut console_lanes = false; // LDS accesses get a group barrier each (a console wave split in two host waves) let mut split_lds = false; @@ -2960,6 +2987,7 @@ impl<'a> Lower<'a> { rpo: vec![usize::MAX; p.blocks.len()], tail: vec![None; p.blocks.len()], writes_uavs, + raw_half_loads, src0: None, console_lanes, split_lds, @@ -13745,7 +13773,8 @@ impl<'a> Lower<'a> { // Four unsigned integers. self.half_views.insert(place); self.half_accesses += 1; - args.push(self.handle(site, src, false, (10 | u, 0x405))?); + let gc = if self.raw_half_loads == 2 { 0x4000 } else { 0 }; + args.push(self.handle(site, src, false, (10 | u | gc, 0x405))?); args.extend([index.unwrap_or(self.s.m.i32(0)), iu]); args.extend(vals); (69, "bufferStore.i32") @@ -13792,6 +13821,9 @@ impl<'a> Lower<'a> { } return Ok(()); } + // `LARP_RAW_HALF_LOADS=raw`: the d16 load's bytes read raw as well (`raw_half_loads`), + // with whether to take them. + let mut raw: Option<(V, Vec<V>)> = None; let r = if typed { if *offen || matches!(off, V::Inst(_)) || *offset != 0 { return Err("a typed buffer load at an offset"); @@ -13800,11 +13832,15 @@ impl<'a> Lower<'a> { self.s.flags |= flags::TYPED_UAV_LOADS; } let index = index.unwrap_or(self.s.m.i32(0)); + let gc = if uav && halves && self.raw_half_loads == 2 { 0x4000 } else { 0 }; + if uav && halves && d16 && self.raw_half_loads == 1 && matches!(count, 1 | 2 | 4) { + raw = Some(self.raw_half_load(site, src, index, count)?); + } if let Some(place) = half { // Unsigned integers. self.half_views.insert(place); self.half_accesses += 1; - let h = self.handle(site, src, false, (10 | u, 0x405))?; + let h = self.handle(site, src, false, (10 | u | gc, 0x405))?; let i32t = self.s.t.i32; let ret = self.s.m.named_struct("dx.types.ResRet.i32", vec![i32t; 5]); self.s.op(c, "bufferLoad.i32", Attr::ReadOnly, ret, 68, &[h, index, iu]) @@ -13863,7 +13899,11 @@ impl<'a> Lower<'a> { None => h, }); } - self.write(inst, Reg::V(reg + k as u8), x.expect("a channel"), guard); + let mut x = x.expect("a channel"); + if let Some((taken, ws)) = &raw { + x = self.s.m.select(c, *taken, ws[k as usize], x); + } + self.write(inst, Reg::V(reg + k as u8), x, guard); } return Ok(()); } @@ -13876,6 +13916,49 @@ impl<'a> Lower<'a> { Ok(()) } + /// `LARP_RAW_HALF_LOADS=raw` ([`raw_half_loads`]): the `count` (1, 2 or 4) 16-bit channels of + /// element `index` of the typed UAV `src` read through a raw handle of the same slot, packed + /// two a dword as a d16 load leaves them, and whether to take them: where the raw view's + /// bytes are its typed elements of `2 * count` bytes each (a view of that layout the host's + /// driver also shows raw; any other reads its typed result). + fn raw_half_load(&mut self, site: Site, src: &Source, index: V, count: u32) -> Result<(V, Vec<V>), Why> { + let c = self.cur; + let i32t = self.s.t.i32; + let iu = self.s.m.undef(i32t); + let dims = self.s.m.named_struct("dx.types.Dimensions", vec![i32t; 4]); + let typed_h = self.handle(site, src, false, (10 | 0x1000, 0x405))?; + let raw_h = self.handle(site, src, false, (11 | 0x1000, 0))?; + let elements = self.s.op(c, "getDimensions", Attr::ReadOnly, dims, 72, &[typed_h, iu]); + let elements = self.s.m.extract(c, elements, 0); + let bytes = self.s.op(c, "getDimensions", Attr::ReadOnly, dims, 72, &[raw_h, iu]); + let bytes = self.s.m.extract(c, bytes, 0); + let size = self.s.m.i32(2 * count); + let want = self.s.m.bin(c, Bin::Mul, elements, size); + let zero = self.s.m.i32(0); + let some = self.s.m.cmp(c, pred::NE, elements, zero); + let same = self.s.m.cmp(c, pred::EQ, bytes, want); + let taken = self.s.m.bin(c, Bin::And, some, same); + let byte = self.s.m.bin(c, Bin::Mul, index, size); + let k3 = self.s.m.i32(3); + let within = self.s.m.bin(c, Bin::And, byte, k3); + let aligned = self.s.m.bin(c, Bin::Sub, byte, within); + let dwords = count.div_ceil(2); + let (mask, align) = (self.s.m.i8((1u8 << dwords) - 1), self.s.m.i32(4)); + let l = self.s.op(c, "rawBufferLoad.f32", Attr::ReadOnly, self.s.t.res_ret, 139, &[raw_h, aligned, iu, mask, align]); + let mut ws = Vec::new(); + for d in 0..dwords { + let f = self.s.m.extract(c, l, d); + ws.push(self.as_int(f)); + } + if count == 1 { + let sh = self.s.m.bin(c, Bin::Shl, within, k3); + let x = self.s.m.bin(c, Bin::LShr, ws[0], sh); + let low = self.s.m.i32(0xFFFF); + ws[0] = self.s.m.bin(c, Bin::And, x, low); + } + Ok((taken, ws)) + } + fn export(&mut self, b: usize, i: usize) -> Result<(), Why> { let e = *self .exports diff --git a/crates/larp-shader/src/lib.rs b/crates/larp-shader/src/lib.rs index c81b3a0..5a3b20d 100644 --- a/crates/larp-shader/src/lib.rs +++ b/crates/larp-shader/src/lib.rs @@ -95,6 +95,7 @@ pub const SWITCHES: &[&str] = &[ "LARP_LOOP_REPORT", "LARP_MESH_COUNTS", "LARP_MESH_EDGE_FLAGS", + "LARP_RAW_HALF_LOADS", "LARP_SHADER_LOOP_LIMIT", "LARP_SHADER_OPT", ]; ``` </details>
Author
Owner

@⁠gamingwithhomie on GitHub · 2026-12-05 21:18 UTC · original

Update: PR #183 (wide-heap lighting/water/facial replacements + FP16 wave-sum facial fix) is merged to the AMD/Linux branches and shipped in v1.1.2-amd and v1.1.2 [Linux/Proton] - use the UPDATE zip (it carries the new bin\shader-replace\heap-2097152 shaders, exe-only wont). Please retest the prison/Lucia scenes and tell us if faces are stable now.

**@⁠gamingwithhomie** on GitHub · 2026-12-05 21:18 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7445537484) Update: PR #183 (wide-heap lighting/water/facial replacements + FP16 wave-sum facial fix) is merged to the AMD/Linux branches and shipped in **v1.1.2-amd** and **v1.1.2 [Linux/Proton]** - use the UPDATE zip (it carries the new `bin\shader-replace\heap-2097152` shaders, exe-only wont). Please retest the prison/Lucia scenes and tell us if faces are stable now.
Author
Owner

@⁠St5sz2Jk on GitHub · 2026-12-05 21:34 UTC · original

RDNA4 data point for the Mesa RADV_CS_NO_WGP workaround from @⁠tmalik1116: it works here too.

System: RX 9070 XT (RADV GFX1201), Mesa 26.3.1 with the env-gated one-liner in radv_should_use_wgp_mode(), Wine 11 + vkd3d-proton, larp built from source at v1.1.1 (8e166ad) with amd-test and linux-test merged. Series X, 1080p, LARP_FRAME_RATE=60.

Run Faces
WGP mode (unset) mouths wrong in the prison scene: teeth and the inside of the mouth drawn in front of the lips
RADV_CS_NO_WGP=1, fresh larp pipeline cache and Mesa cache faces correct almost everywhere. Two leftovers in about 18 min of play: one baby's face still deformed, and the main character's eye once closed unnaturally

There was no fps cost that I could see (median 47.9 fps at the 60 cap, GPU about 81% busy). As noted above, RADV's cache key ignores the env var, so the old pipeline blobs and the Mesa cache have to be moved aside or the fix silently does nothing.

I haven't tried LARP_RAW_HALF_LOADS=raw or v1.1.2 yet. I'll report back if either one fixes the leftovers without the driver patch.

**@⁠St5sz2Jk** on GitHub · 2026-12-05 21:34 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7445797687) RDNA4 data point for the Mesa `RADV_CS_NO_WGP` workaround from @⁠tmalik1116: it works here too. **System:** RX 9070 XT (RADV GFX1201), Mesa 26.3.1 with the env-gated one-liner in `radv_should_use_wgp_mode()`, Wine 11 + vkd3d-proton, larp built from source at v1.1.1 (`8e166ad`) with `amd-test` and `linux-test` merged. Series X, 1080p, `LARP_FRAME_RATE=60`. | Run | Faces | |---|---| | WGP mode (unset) | mouths wrong in the prison scene: teeth and the inside of the mouth drawn in front of the lips | | `RADV_CS_NO_WGP=1`, fresh larp pipeline cache and Mesa cache | faces correct almost everywhere. Two leftovers in about 18 min of play: one baby's face still deformed, and the main character's eye once closed unnaturally | There was no fps cost that I could see (median 47.9 fps at the 60 cap, GPU about 81% busy). As noted above, RADV's cache key ignores the env var, so the old pipeline blobs and the Mesa cache have to be moved aside or the fix silently does nothing. I haven't tried `LARP_RAW_HALF_LOADS=raw` or v1.1.2 yet. I'll report back if either one fixes the leftovers without the driver patch.
Author
Owner

@⁠thiagonl on GitHub · 2026-12-05 22:01 UTC · original

Confirmed on RDNA4 / RX 9060 XT 16 GB: PR #183 on top of iceboerg00/larp-amd fixes the faces here.

Build: larp-amd f6954fc (the base of v2026.12.05-amd-4.2) with the diff of PR #183 applied (it applied cleanly, one hunk with a small fuzz), built from source for Windows x86-64 MSVC on Linux. shader-replace compiled with Microsoft's dxc 1.10.2611, including the new 0aa7934094794dbf and 6d7fe7745ab9c6d8 replacements. Mesa 26.3.1 RADV (GFX1200), GE-Proton11-7 wine, vkd3d-proton 3.2.0, Series X, 60 fps cap.

Build (same cutscenes) Mouth
larp-amd stock dark hole, no teeth or tongue, lips torn
v1.1.1-amd, defaults (wave64) lips torn, spikes of teeth, jaw stretched
larp-amd + PR #183 much better; the faces are stable and look right

So this matches the PR description (the facial rig replacement plus the FP16 partial-wave sum handling) and answers the request to retest the prison/Lucia scenes: the faces are stable now on this card.

A note for people on a 16 GB machine: at 1440p the game process grew to about 6.6 GB and was killed at the end of a session by my own 8 GB memory cap, so I am retrying at 1080p. This is a memory limit of my setup, not a faces problem.

Thanks @⁠gamingwithhomie and @⁠iws322112 for the fix, and @⁠dev-kreg and @⁠tmalik1116 for narrowing it down. I can test follow-ups on this card.

**@⁠thiagonl** on GitHub · 2026-12-05 22:01 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7446257518) **Confirmed on RDNA4 / RX 9060 XT 16 GB: PR #183 on top of `iceboerg00/larp-amd` fixes the faces here.** Build: `larp-amd` `f6954fc` (the base of `v2026.12.05-amd-4.2`) with the diff of PR #183 applied (it applied cleanly, one hunk with a small fuzz), built from source for Windows x86-64 MSVC on Linux. `shader-replace` compiled with Microsoft's `dxc` 1.10.2611, including the new `0aa7934094794dbf` and `6d7fe7745ab9c6d8` replacements. Mesa 26.3.1 RADV (GFX1200), GE-Proton11-7 wine, vkd3d-proton 3.2.0, Series X, 60 fps cap. | Build (same cutscenes) | Mouth | |---|---| | `larp-amd` stock | dark hole, no teeth or tongue, lips torn | | `v1.1.1-amd`, defaults (wave64) | lips torn, spikes of teeth, jaw stretched | | `larp-amd` + PR #183 | much better; the faces are stable and look right | So this matches the PR description (the facial rig replacement plus the FP16 partial-wave sum handling) and answers the request to retest the prison/Lucia scenes: the faces are stable now on this card. A note for people on a 16 GB machine: at 1440p the game process grew to about 6.6 GB and was killed at the end of a session by my own 8 GB memory cap, so I am retrying at 1080p. This is a memory limit of my setup, not a faces problem. Thanks @⁠gamingwithhomie and @⁠iws322112 for the fix, and @⁠dev-kreg and @⁠tmalik1116 for narrowing it down. I can test follow-ups on this card.
Author
Owner

@⁠Luislariosss on GitHub · 2026-12-05 22:06 UTC · original

Confirming on Windows 11 + RX 9060 XT (RDNA4), native D3D12 driver (not Proton/RADV): the masked FP16 wave-sum change in half_sum (the same change that is in 44b6a8d / PR #183) fixes the faces here too.

  • Base: amd-test at f0d4e50 + only the half_sum change in crates/larp-shader/src/emit/lower.rs (lanes that are elsewhere read as +0 via a ballot and the first lane of each partner run, as the console masks them).
  • Before: b22a16a178976e1b and a26a38d61f256901 (compute_graph_ops:CS_TransposeVecMatMul*) were refused at 64 lanes with a wave sum of 16-bit floats where not every lane runs. The baby at the end of the prologue scene had a melted eye, a shifted upper lip, dark patches in the mouth and displaced teeth; Lucia's eyes and brows were also off.
  • After: both programs translate. More than 10 consecutive frames of the baby crying (mouth open, eyes closing and opening) are clean, and Lucia looks right.
  • Still refused at 64 lanes with that change alone: 926c46bab3b86bd6 and 6871d6e4b3ac9a10 (water_shading:CS_TransmissionVolumetrics*), a lane mask holding lanes elsewhere read as data. These are water, not face, and I haven't yet checked whether the new .interface replacements in 44b6a8d cover them.
**@⁠Luislariosss** on GitHub · 2026-12-05 22:06 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7446338470) Confirming on **Windows 11 + RX 9060 XT (RDNA4)**, native D3D12 driver (not Proton/RADV): the masked FP16 wave-sum change in `half_sum` (the same change that is in `44b6a8d` / PR #183) fixes the faces here too. - Base: `amd-test` at `f0d4e50` + only the `half_sum` change in `crates/larp-shader/src/emit/lower.rs` (lanes that are elsewhere read as +0 via a ballot and the first lane of each partner run, as the console masks them). - Before: `b22a16a178976e1b` and `a26a38d61f256901` (`compute_graph_ops:CS_TransposeVecMatMul*`) were refused at 64 lanes with `a wave sum of 16-bit floats where not every lane runs`. The baby at the end of the prologue scene had a melted eye, a shifted upper lip, dark patches in the mouth and displaced teeth; Lucia's eyes and brows were also off. - After: both programs translate. More than 10 consecutive frames of the baby crying (mouth open, eyes closing and opening) are clean, and Lucia looks right. - Still refused at 64 lanes with that change alone: `926c46bab3b86bd6` and `6871d6e4b3ac9a10` (`water_shading:CS_TransmissionVolumetrics*`), `a lane mask holding lanes elsewhere read as data`. These are water, not face, and I haven't yet checked whether the new `.interface` replacements in `44b6a8d` cover them.
Author
Owner

@⁠St5sz2Jk on GitHub · 2026-12-05 22:23 UTC · original

Follow-up from the RX 9070 XT (RDNA4, RADV 26.3.1, Wine 11 + vkd3d-proton). Faces look right on current code. One caveat: this run had three face fixes on at once, so I can't say which one did it.

Build: from source, amd-test at c07ed28 (v1.1.3 batch, includes PR #183) + linux-test + @⁠dev-kreg's LARP_RAW_HALF_LOADS patch from the comment above (applied with small offsets).
Switches: RADV_CS_NO_WGP=1 (patched Mesa), LARP_RAW_HALF_LOADS=raw, LARP_FRAME_RATE=60, Series X, 1080p.

  • About 12 min of play from the prison prologue onwards: no face problems seen at all. The previous run (v1.1.1, RADV_CS_NO_WGP only) still had a deformed baby's face and an unnatural eye close.
  • The log has no does not translate lines any more; the four water volumetrics programs from #39 now translate. No faults.
  • 42.7 fps median at the 60 cap, GPU about 90% busy, no frames over 1 s.

Since #183 alone fixes faces for others above, LARP_RAW_HALF_LOADS and the Mesa patch may not be needed any more. If it would help, I can do A/B runs (each fix off in turn) on this card.

Off-topic for this issue, but useful for Linux testers: on a 16-core CPU, larp's defaults (LARP_PRELOAD_THREADS 75%, LARP_DSTORAGE_WORKERS = all logical cores) gave 1–6 s freezes with the GPU idle. The values linux/run.sh uses (18 / 16 workers / 128 MB staging) removed every freeze over 1 s here.

**@⁠St5sz2Jk** on GitHub · 2026-12-05 22:23 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7446655961) Follow-up from the RX 9070 XT (RDNA4, RADV 26.3.1, Wine 11 + vkd3d-proton). Faces look right on current code. One caveat: this run had three face fixes on at once, so I can't say which one did it. **Build:** from source, `amd-test` at `c07ed28` (v1.1.3 batch, includes PR #183) + `linux-test` + @⁠dev-kreg's `LARP_RAW_HALF_LOADS` patch from the comment above (applied with small offsets). **Switches:** `RADV_CS_NO_WGP=1` (patched Mesa), `LARP_RAW_HALF_LOADS=raw`, `LARP_FRAME_RATE=60`, Series X, 1080p. - About 12 min of play from the prison prologue onwards: no face problems seen at all. The previous run (v1.1.1, `RADV_CS_NO_WGP` only) still had a deformed baby's face and an unnatural eye close. - The log has no `does not translate` lines any more; the four water volumetrics programs from #39 now translate. No faults. - 42.7 fps median at the 60 cap, GPU about 90% busy, no frames over 1 s. Since #183 alone fixes faces for others above, `LARP_RAW_HALF_LOADS` and the Mesa patch may not be needed any more. If it would help, I can do A/B runs (each fix off in turn) on this card. Off-topic for this issue, but useful for Linux testers: on a 16-core CPU, larp's defaults (`LARP_PRELOAD_THREADS` 75%, `LARP_DSTORAGE_WORKERS` = all logical cores) gave 1–6 s freezes with the GPU idle. The values `linux/run.sh` uses (18 / 16 workers / 128 MB staging) removed every freeze over 1 s here.
Author
Owner

@⁠tmalik1116 on GitHub · 2026-12-05 22:28 UTC · original

Retested on v1.1.2-amd (FULL zip, sha256 checked): faces are fixed here with stock Mesa, no driver patch and no LARP_RAW_HALF_LOADS.

System: RX 6800 XT (RDNA2, RADV), Mesa 26.3.1, vkd3d-proton 3.2, Wine/Proton on Linux. 4K output, 2560x1440 internal. Fresh larp pipeline cache and Mesa cache.

Build Driver workaround Mouth (outdoor porch idle) fps
larp-amd amd-4 none stuck open ~34
amd-4 + RADV_CS_NO_WGP=1 (Mesa patch) yes correct ~34
amd-4 source + @⁠dev-kreg's LARP_RAW_HALF_LOADS=raw patch none correct ~34
v1.1.2-amd none correct 33.5–34.9

0 exceptions and 0 dropped dispatches in the v1.1.2-amd run. I can only check the outdoor porch scene from our save, so I haven't verified the prison or Lucia scenes.

Thanks @⁠dev-kreg for the patch. It confirmed the cause independently of the driver.

**@⁠tmalik1116** on GitHub · 2026-12-05 22:28 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7446736441) Retested on **v1.1.2-amd** (FULL zip, sha256 checked): **faces are fixed here with stock Mesa**, no driver patch and no `LARP_RAW_HALF_LOADS`. **System:** RX 6800 XT (RDNA2, RADV), Mesa 26.3.1, vkd3d-proton 3.2, Wine/Proton on Linux. 4K output, 2560x1440 internal. Fresh larp pipeline cache and Mesa cache. | Build | Driver workaround | Mouth (outdoor porch idle) | fps | |---|---|---|---| | larp-amd amd-4 | none | stuck open | ~34 | | amd-4 + `RADV_CS_NO_WGP=1` (Mesa patch) | yes | correct | ~34 | | amd-4 source + @⁠dev-kreg's `LARP_RAW_HALF_LOADS=raw` patch | none | correct | ~34 | | **v1.1.2-amd** | none | **correct** | 33.5–34.9 | 0 exceptions and 0 dropped dispatches in the v1.1.2-amd run. I can only check the outdoor porch scene from our save, so I haven't verified the prison or Lucia scenes. Thanks @⁠dev-kreg for the patch. It confirmed the cause independently of the driver.
Author
Owner

@⁠texx2818 on GitHub · 2026-12-05 22:31 UTC · original

RDNA3 confirmation for LARP_RAW_HALF_LOADS=raw (the patch from @⁠dev-kreg above): it fixes the faces here.

System: RX 7900 XT (Navi 31), Arch, Mesa 26.3.1 RADV (stock, no WGP patch), GE-Proton11-16 (vkd3d-proton v3.1-102-g020fc9441), Series X, 4K output with FSR Quality, 30 fps cap + FSR frame generation 2x.

Build: iceboerg00/larp-amd f6954fc + gamingwithhomie/larp v1.1.0 merged, plus the patch applied unchanged (applied cleanly with offsets). Fresh larp shader cache, since the switch is keyed in it.

Offline check (translate --list with LARP_EMIT_DUMP, the switch off vs. raw): exactly 11 emitted programs differ, all compute_graph_ops: (MatMul / TransposeMatMul / VecMatMul, the Aligned variants, Formula, QuantizeU8, NLargestU8, FindThresholdU8, BuildHistogramU8). All 25,692 dumps are present both ways, and the failure summary is identical, so there are no new failures.

In game: the story characters' faces that deformed and flickered in my original report now render correctly, with no other visual problems.

**@⁠texx2818** on GitHub · 2026-12-05 22:31 UTC · [original](https://github.com/gamingwithhomie/larp/issues/110#issuecomment-7446807365) **RDNA3 confirmation for `LARP_RAW_HALF_LOADS=raw`** (the patch from @⁠dev-kreg above): it fixes the faces here. **System:** RX 7900 XT (Navi 31), Arch, Mesa 26.3.1 RADV (stock, no WGP patch), GE-Proton11-16 (vkd3d-proton `v3.1-102-g020fc9441`), Series X, 4K output with FSR Quality, 30 fps cap + FSR frame generation 2x. **Build:** `iceboerg00/larp-amd` `f6954fc` + `gamingwithhomie/larp` `v1.1.0` merged, plus the patch applied unchanged (applied cleanly with offsets). Fresh larp shader cache, since the switch is keyed in it. **Offline check (`translate --list` with `LARP_EMIT_DUMP`, the switch off vs. `raw`):** exactly **11** emitted programs differ, all `compute_graph_ops:` (MatMul / TransposeMatMul / VecMatMul, the Aligned variants, Formula, QuantizeU8, NLargestU8, FindThresholdU8, BuildHistogramU8). All 25,692 dumps are present both ways, and the failure summary is identical, so there are no new failures. **In game:** the story characters' faces that deformed and flickered in my original report now render correctly, with no other visual problems.
This discussion has been locked. Commenting is limited to contributors.
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/gamingwithhomie--larp#110
No description provided.