d3d12: pixel shaders read barycentrics through a geometry stage on a GPU without them (D3D12-BARYCENTRICS-FALLBACK) #2581

Closed
github-bot wants to merge 19 commits from github-bot/gh-2581 into main AGit
Owner

@⁠qhukz13 on GitHub · 2026-11-28 17:44 UTC · original
qhukz13:cont/d3d12-bary-fallback → main · +3662 −215 · 30 files · 19 commits · closed without merging

Claimed in the coordination issue as: D3D12-BARYCENTRICS-FALLBACK (#2570#issuecomment-7242150584)
Depends on: #2580 (built on it; the shader-cache key words follow on).

What and why

Without D3D12 barycentrics (before Turing) every pixel shader that reads SV_Barycentrics or attributeAtVertex is refused at pipeline creation. The debug layer says Shader uses Barycentrics, but the device does not support this. On a GTX 1050 Ti that is 369 refused pipelines (bloom and more).

  • Translator: set_host_barycentrics(false):
    • pixel shaders read ordinary inputs instead: LEONIDA_BARY (a float3 per interpolation mode), and LEONIDA_VTX (constant values at vertices 1 and 2 for attributeAtVertex), packed past the title's own rows;
    • more than 32 rows is refused.
  • bary_gs():
    • a geometry stage that passes the vertex shader's outputs through and writes one-hot weights per corner plus the corners' values;
    • it moves a system value out of the way if a stand-in lands on it.
  • Runtime:
    • OPTIONS3.BarycentricsSupported decides (LEONIDA_BARY_FALLBACK=1 forces it);
    • pipelines whose pixel shader reads the stand-ins get the stage.
  • shortcut: rectangle lists drop their own geometry stage for it (logged); mesh-as-compute pipelines don't get it yet.

Tested

  • MEASURED before coding (the title's translated pixel shaders): 4058 read barycentrics, 4040 through attributeAtVertex; packed, 54 would need more than 32 rows.
  • MEASURED in game (GTX 1050 Ti, Windows 10, #2557 + #2580, D3D12 debug layer, 10 min of play):
    • host pipeline refused 369 → 0;
    • Shader uses Barycentrics 435 → 0;
    • no geometry/pixel linkage messages;
    • 2 pixel shaders refused for 32 rows; no device removal.
  • Tests (cargo test -p leonida-shader --lib barycentric): 18 pass on the 1050 Ti.
    • Seven hand-worked programs read the stand-ins; dxil.dll validates the pixel shaders and the stage.
    • A device test draws through the stage against the hand-worked values; it compares with native barycentrics where the device has them (not here).
    • A weight-rotation mutant fails it.

GPUs tested: GTX 1050 Ti 4 GB (Pascal, profile S), 582.66, Windows 10.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠qhukz13** on GitHub · 2026-11-28 17:44 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581) `qhukz13:cont/d3d12-bary-fallback` → `main` · +3662 −215 · 30 files · 19 commits · closed without merging Claimed in the coordination issue as: D3D12-BARYCENTRICS-FALLBACK (#2570#issuecomment-7242150584) Depends on: #2580 (built on it; the shader-cache key words follow on). ### What and why Without D3D12 barycentrics (before Turing) every pixel shader that reads `SV_Barycentrics` or `attributeAtVertex` is refused at pipeline creation. The debug layer says `Shader uses Barycentrics, but the device does not support this`. On a GTX 1050 Ti that is 369 refused pipelines (bloom and more). - **Translator:** `set_host_barycentrics(false)`: - pixel shaders read ordinary inputs instead: `LEONIDA_BARY` (a float3 per interpolation mode), and `LEONIDA_VTX` (constant values at vertices 1 and 2 for `attributeAtVertex`), packed past the title's own rows; - more than 32 rows is refused. - **`bary_gs()`:** - a geometry stage that passes the vertex shader's outputs through and writes one-hot weights per corner plus the corners' values; - it moves a system value out of the way if a stand-in lands on it. - **Runtime:** - `OPTIONS3.BarycentricsSupported` decides (`LEONIDA_BARY_FALLBACK=1` forces it); - pipelines whose pixel shader reads the stand-ins get the stage. - shortcut: rectangle lists drop their own geometry stage for it (logged); mesh-as-compute pipelines don't get it yet. ### Tested - MEASURED before coding (the title's translated pixel shaders): 4058 read barycentrics, 4040 through `attributeAtVertex`; packed, 54 would need more than 32 rows. - MEASURED in game (GTX 1050 Ti, Windows 10, #2557 + #2580, D3D12 debug layer, 10 min of play): - `host pipeline refused` 369 → 0; - `Shader uses Barycentrics` 435 → 0; - no geometry/pixel linkage messages; - 2 pixel shaders refused for 32 rows; no device removal. - Tests (`cargo test -p leonida-shader --lib barycentric`): 18 pass on the 1050 Ti. - Seven hand-worked programs read the stand-ins; dxil.dll validates the pixel shaders and the stage. - A device test draws through the stage against the hand-worked values; it compares with native barycentrics where the device has them (not here). - A weight-rotation mutant fails it. GPUs tested: GTX 1050 Ti 4 GB (Pascal, profile S), 582.66, Windows 10. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
set_host_mesh_shaders(false) lowers a mesh program as cs_6_6. setMeshOutputCounts goes. emitIndices,
storeVertexOutput and storePrimitiveOutput become raw stores into the root UAV SLOT_MESH_OUT (251), in the
group's MeshOut slot: max_vertices vertices, then max_primitives primitives (three indices, then the per-primitive
outputs).
- The buffer is MESH_OUT_BYTES (64 MiB). A 256-byte header holds a draw's arguments: lane 0 of each group raises
  its instance count to the group id + 1, so an indirect dispatch's draw needs no CPU read.
- Groups past MeshOut::groups_cap write to one sink slot after the last.
- mesh_vs() builds the pass-through vertex shader that draws it. SV_VertexID gives primitive and corner,
  SV_InstanceID the group. It reads the root SRV SLOT_MESH_IN (250) and outputs the program's vertex outputs
  register for register, plus the per-primitive outputs where the pixel shader reads them, constant. A group past
  the cap draws a triangle of no area.
- HostShader carries the layout and the signatures, and the shader cache encodes them. host_settings() has a word
  for it, so a translation for one kind of host never serves the other.

Tests: the triangle mesh fixture translates as compute (layout, root UAV, empty output signature; dxil.dll takes
it for plain, edge-flagged and culled primitives) and stays a mesh shader with mesh shaders. Its vertex shader
validates. On a device, the program run as compute and drawn lights the texels the mesh pipeline lights, compared
texel for texel where the device has mesh shaders. The test harness gets a root UAV for dispatches, root SRVs in
draws and a vertex count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At device creation the translator is told whether the host has mesh shaders at shader model 6.6
(LEONIDA_MESH_COMPUTE=1 takes the fallback on any card). Without them, a mesh pipeline is made as two:
- the mesh program as a compute pipeline;
- the pass-through vertex shader with the title's pixel shader and state, drawing triangle lists with no vertex input.

The draw path:
- A mesh dispatch binds the compute pipeline with the title's graphics root arguments (roots_ref reads them while
  title_side_graphics is set).
- It dispatches and draws 3 * max_primitives vertices, one instance a group.
- An indirect one writes the header's draw arguments (WriteBufferImmediate), runs the title's record with a
  dispatch signature, and draws from the header with ExecuteIndirect.
- The buffer goes common -> UAV -> shader resource and indirect argument -> common.

shortcut: an indirect call of several records is left out (each would fill the same slots).

MEASURED on a GTX 1050 Ti (Pascal: mesh shader tier 0), Windows 10 with #2557: the title gets past its start screen
through the opening cutscenes into the first playable scene. Without this, every mesh pipeline was refused and the
world drew nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without D3D12 barycentrics (before Turing) every pixel shader that reads SV_Barycentrics or attributeAtVertex is
refused at pipeline creation (the debug layer: "Shader uses Barycentrics, but the device does not support this").
set_host_barycentrics(false) translates them with ordinary inputs instead:
- LEONIDA_BARY, a float3 per interpolation mode, for SV_Barycentrics;
- LEONIDA_VTX, constant one-channel inputs whose semantic index names the element, column and vertex, for
  attributeAtVertex at vertices 1 and 2 (vertex 0 is the element itself).
- They take rows past the title's own, packed four to a row; a shader that would need more than 32 rows is refused.

bary_gs() builds the geometry stage that writes them. It passes the vertex shader's outputs through, register for
register, and adds:
- one-hot weights (1,0,0) / (0,1,0) / (0,0,1) at the corners;
- each corner's value of the elements read at a vertex;
- the primitive id if the pixel shader wants it.
A stand-in that lands on a vertex shader register moves a system value to a free row and drops a user output the
pixel shader does not read.

host_settings() gets a sixth word.

MEASURED before coding (the title's translated pixel shaders): 4058 read barycentrics, 4040 of them through
attributeAtVertex; packed, 54 need more than 32 rows.

Tests: seven hand-worked barycentric programs read the stand-ins; the pixel shaders and the geometry stage validate
in dxil.dll. A device test draws them through the stage and checks the hand-worked values (compared with native
barycentrics where the device has them). A weight rotation mutant fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At device creation, OPTIONS3.BarycentricsSupported tells the translator whether to use stand-ins
(LEONIDA_BARY_FALLBACK=1 takes the fallback on any card).

A graphics pipeline whose pixel shader reads them gets bary_gs between its vertex and pixel shaders, named apart in
the pipeline library.
shortcut: a rectangle list drops its own geometry stage for it (logged); mesh-as-compute pipelines do not get it yet.

MEASURED on a GTX 1050 Ti, Windows 10 with #2557 and the D3D12 debug layer, 10 minutes of play:
- "host pipeline refused": 0 (369 before);
- "Shader uses Barycentrics": 0 (435 before);
- no geometry/pixel stage linkage messages;
- 2 pixel shaders refused for 32 rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 17:49:55 +00:00
A pixel shader drawn behind a mesh program on a host without barycentrics reads LEONIDA_BARY and LEONIDA_VTX, which
no geometry stage writes on that path: they read zero, and what the title draws with mesh shaders came out black.
mesh_vs writes them itself, since every corner is its own vertex there:
- the weights are 1 at the corner's column;
- vertex k's value is read through the primitive's corner-k index, the same at all three corners.
A vertex output on a stand-in's register is left out, or moves past them if it is a system value (as bary_gs).
Pipelines that draw through mesh_vs do not get bary_gs.

Test: for the seven barycentric programs, every stand-in their pixel shader reads is a mesh_vs output in the same
register, and dxil.dll takes the vertex shader (mesh 8, barycentric 19 tests pass on a GTX 1050 Ti).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-28 18:51 UTC · original

Pushed d16847611: mesh_vs now writes the barycentrics stand-ins itself.

On the mesh-as-compute path (#2580) the pixel shader behind a mesh program still read LEONIDA_BARY / LEONIDA_VTX, but no geometry stage wrote them there, so they read zero. mesh_vs writes them now:

  • each corner is its own vertex, so the weights are 1 at the corner's column;
  • vertex k's value is read through the primitive's corner-k index;
  • mesh_vs pipelines no longer get bary_gs.

MEASURED on the 1050 Ti:

  • tests: mesh 8/8, barycentric 19/19, including a new one; for the seven barycentric programs every stand-in the pixel shader reads is a mesh_vs output in the same register, and dxil.dll takes the shader;
  • a game run: 0 refused pipelines, 0 "Shader uses Barycentrics", no device removal.

NOT measured: the visual difference in game (no side-by-side capture yet).

AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-28 18:51 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7244109469) Pushed d16847611: mesh_vs now writes the barycentrics stand-ins itself. On the mesh-as-compute path (#2580) the pixel shader behind a mesh program still read `LEONIDA_BARY` / `LEONIDA_VTX`, but no geometry stage wrote them there, so they read zero. mesh_vs writes them now: - each corner is its own vertex, so the weights are 1 at the corner's column; - vertex k's value is read through the primitive's corner-k index; - mesh_vs pipelines no longer get bary_gs. MEASURED on the 1050 Ti: - tests: mesh 8/8, barycentric 19/19, including a new one; for the seven barycentric programs every stand-in the pixel shader reads is a mesh_vs output in the same register, and dxil.dll takes the shader; - a game run: 0 refused pipelines, 0 "Shader uses Barycentrics", no device removal. NOT measured: the visual difference in game (no side-by-side capture yet). AI-assisted (Claude Code).
Author
Owner

@⁠lixonik on GitHub · 2026-11-28 21:04 UTC · original · reviewed

Reviewed d16847611 (including #2580) merged locally with main 1bc055e6c. All 19 barycentric tests passed in profile diag on Windows 10 22H2, RTX 5070 (610.88), with DXIL validator 1.9.2609 and Agility SDK 1.614.1. The unit-test executable used local Agility exports so the GPU checks actually reached SM 6.6. Hardware readbacks matched native barycentrics; WARP did not run on this host.

I also reran the draw fixture with clip W values of 0.5, 1, and 2, scaling clip XYZ per vertex to keep the same screen-space triangle. The fallback and native path still matched all 64 pixels for each of the seven synthetic programs, at the fixture's 1e-4 tolerance. Unequal W is a useful permanent test case because the existing W=1 triangle cannot distinguish linear from perspective-correct interpolation. The mesh fallback check here validates the generated stage and matching signatures.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-28 21:04 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#pullrequestreview-6100082149) · **reviewed** Reviewed `d16847611` (including #2580) merged locally with `main` `1bc055e6c`. All 19 barycentric tests passed in profile `diag` on Windows 10 22H2, RTX 5070 (610.88), with DXIL validator 1.9.2609 and Agility SDK 1.614.1. The unit-test executable used local Agility exports so the GPU checks actually reached SM 6.6. Hardware readbacks matched native barycentrics; WARP did not run on this host. I also reran the draw fixture with clip W values of 0.5, 1, and 2, scaling clip XYZ per vertex to keep the same screen-space triangle. The fallback and native path still matched all 64 pixels for each of the seven synthetic programs, at the fixture's 1e-4 tolerance. Unequal W is a useful permanent test case because the existing W=1 triangle cannot distinguish linear from perspective-correct interpolation. The mesh fallback check here validates the generated stage and matching signatures. AI-assisted.
Author
Owner

@⁠zmasi on GitHub · 2026-11-28 21:20 UTC · original

Windows 11 + RTX 3090 D3D12 & WARP Verification (d168476112) — GPU Verified + Inherits #2580 main Rebase (E0063)

Verified commit d168476112dee576bb6146de4b77f2a112bc9e8a (stacked on #2580) on Windows 11 (x86_64-pc-windows-msvc) with physical NVIDIA GeForce RTX 3090 (Ampere, D3D12 driver 610.88, BarycentricsSupported == true and SM 6.6 mesh shaders enabled for direct hardware comparison) and WARP + dxil.dll.

1. Red -> Green Physical GPU & DXIL Verification

  • Red (#2580 094e948e99 without #2581): barycentric stand-in / bary_gs / mesh_vs tests fail to compile (bary_gs, needs_bary_gs, BARY_INPUT, VERTEX_INPUT, and vertex_source absent).
  • Green (d168476112 standalone & merged onto main 1bc055e6c2 with #2580's 2-field Translated rebase update):
    • cargo test --locked -p leonida-shader --lib -- --nocapture --test-threads=4 barycentric: 19/19 passed (1.37s):
      • without_host_barycentrics_pixel_programs_read_stand_ins & the_barycentrics_stage_is_a_valid_geometry_shader: all 7 barycentric pixel programs (values, two modes, interpolation and a value, computed i, constant weights, computed and loaded, p10) and their generated gs_6_6 bary_gs geometry shaders validated cleanly with dxil.dll with 0 SV_Barycentrics / Barycentrics feature flags.
      • the_barycentrics_stage_draws_what_host_barycentrics_draw: passed texel-for-texel against both analytical reference values and native SV_Barycentrics / attributeAtVertex across all 7 pixel programs on physical RTX 3090 (the barycentrics stage draws on hardware (compared: true)) and WARP (the barycentrics stage draws on WARP (compared: true)).
    • cargo test --locked -p leonida-shader --lib -- --nocapture --test-threads=4 mesh: 8/8 passed (0.72s), including mesh_vs_writes_the_barycentrics_stand_ins (dxil.dll validated for all 7 programs) and a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_draws on both RTX 3090 (hardware) and warp.
    • cargo test --locked -p leonida-gpu --lib -- --nocapture --test-threads=4 shader_cache: 2/2 passed (host_settings() 6-element key updated cleanly).
    • LEONIDA_BARY_FALLBACK=1 LEONIDA_MESH_COMPUTE=1 LEONIDA_D3D12_DEBUG=1 cargo test --locked -p leonida-gpu --features diagnostics --lib -- --nocapture --test-threads=4 pipeline::host::tests: 9/9 passed on RTX 3090 (0 D3D12 debug-layer errors) and 8/8 applicable tests passed on WARP (LEONIDA_D3D12_WARP=1).
    • python -I scripts/check_no_game_data.py (0 issues) and git diff --check clean.

2. Rebase Note Against Current main (aa918e5d9f)

Because #2581 stacks on #2580 (094e948e99), merging d168476112 directly into current main (aa918e5d9f) hits the same E0063 in Shader::mesh_fallback (d3d12/crates/leonida-gpu/src/pipeline.rs:224: missing fields bound and stores_past_views in initializer of Translated). Verified that adding stores_past_views: false, bound: Default::default() in Shader::mesh_fallback makes #2581 + main compile cleanly and pass all GPU tests above.

AI-assisted.

**@⁠zmasi** on GitHub · 2026-11-28 21:20 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7245944562) ### Windows 11 + RTX 3090 D3D12 & WARP Verification (`d168476112`) — GPU Verified + Inherits `#2580` `main` Rebase (`E0063`) Verified commit `d168476112dee576bb6146de4b77f2a112bc9e8a` (stacked on `#2580`) on Windows 11 (`x86_64-pc-windows-msvc`) with physical **NVIDIA GeForce RTX 3090** (Ampere, D3D12 driver `610.88`, `BarycentricsSupported == true` and SM 6.6 mesh shaders enabled for direct hardware comparison) and **WARP** + `dxil.dll`. #### 1. Red -> Green Physical GPU & DXIL Verification - **Red (`#2580` `094e948e99` without `#2581`)**: `barycentric` stand-in / `bary_gs` / `mesh_vs` tests fail to compile (`bary_gs`, `needs_bary_gs`, `BARY_INPUT`, `VERTEX_INPUT`, and `vertex_source` absent). - **Green (`d168476112` standalone & merged onto `main` `1bc055e6c2` with `#2580`'s 2-field `Translated` rebase update)**: - `cargo test --locked -p leonida-shader --lib -- --nocapture --test-threads=4 barycentric`: **`19/19` passed (`1.37s`)**: - `without_host_barycentrics_pixel_programs_read_stand_ins` & `the_barycentrics_stage_is_a_valid_geometry_shader`: all 7 barycentric pixel programs (`values`, `two modes`, `interpolation and a value`, `computed i`, `constant weights`, `computed and loaded`, `p10`) and their generated `gs_6_6` `bary_gs` geometry shaders validated cleanly with `dxil.dll` with `0` `SV_Barycentrics` / `Barycentrics` feature flags. - `the_barycentrics_stage_draws_what_host_barycentrics_draw`: **passed texel-for-texel against both analytical reference values and native `SV_Barycentrics` / `attributeAtVertex` across all 7 pixel programs on physical RTX 3090 (`the barycentrics stage draws on hardware (compared: true)`) and WARP (`the barycentrics stage draws on WARP (compared: true)`)**. - `cargo test --locked -p leonida-shader --lib -- --nocapture --test-threads=4 mesh`: **`8/8` passed (`0.72s`)**, including `mesh_vs_writes_the_barycentrics_stand_ins` (`dxil.dll` validated for all 7 programs) and `a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_draws` on both RTX 3090 (`hardware`) and `warp`. - `cargo test --locked -p leonida-gpu --lib -- --nocapture --test-threads=4 shader_cache`: **`2/2` passed** (`host_settings()` 6-element key updated cleanly). - `LEONIDA_BARY_FALLBACK=1 LEONIDA_MESH_COMPUTE=1 LEONIDA_D3D12_DEBUG=1 cargo test --locked -p leonida-gpu --features diagnostics --lib -- --nocapture --test-threads=4 pipeline::host::tests`: **`9/9` passed** on RTX 3090 (`0` D3D12 debug-layer errors) and **`8/8` applicable tests passed** on WARP (`LEONIDA_D3D12_WARP=1`). - `python -I scripts/check_no_game_data.py` (`0` issues) and `git diff --check` clean. #### 2. Rebase Note Against Current `main` (`aa918e5d9f`) Because `#2581` stacks on `#2580` (`094e948e99`), merging `d168476112` directly into current `main` (`aa918e5d9f`) hits the same `E0063` in `Shader::mesh_fallback` (`d3d12/crates/leonida-gpu/src/pipeline.rs:224`: `missing fields bound and stores_past_views in initializer of Translated`). Verified that adding `stores_past_views: false, bound: Default::default()` in `Shader::mesh_fallback` makes `#2581 + main` compile cleanly and pass all GPU tests above. AI-assisted.
github-bot force-pushed github-bot/gh-2581 from d168476112 to c2f4cd35a8 2026-11-28 23:50:16 +00:00 Compare
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-28 23:47 UTC · original

Rebased onto main a9e247cd6.

  • The E0063 the reviewers hit is fixed: the vertex half of a mesh program run as compute builds its Translated with the two fields main added (stores_past_views: false, bound).
  • draw.rs: main's is_depth_companion is kept beside mesh_buffer.

MEASURED on a GTX 1050 Ti (582.66), Windows 10, with Agility 1.614.1 for the test binary:

  • leonida-shader: 356/356 passed.
  • leonida-gpu: 516 passed; 3 WARP/device tests fail on main too.

Thanks @⁠lixonik, @⁠zmasi and @⁠merzleckeier for the runs.

AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-28 23:47 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7247665812) Rebased onto `main` `a9e247cd6`. - The `E0063` the reviewers hit is fixed: the vertex half of a mesh program run as compute builds its `Translated` with the two fields `main` added (`stores_past_views: false`, `bound`). - `draw.rs`: `main`'s `is_depth_companion` is kept beside `mesh_buffer`. MEASURED on a GTX 1050 Ti (582.66), Windows 10, with Agility 1.614.1 for the test binary: - `leonida-shader`: 356/356 passed. - `leonida-gpu`: 516 passed; 3 WARP/device tests fail on `main` too. Thanks @⁠lixonik, @⁠zmasi and @⁠merzleckeier for the runs. AI-assisted (Claude Code).
Author
Owner

@⁠timbot103 on GitHub · 2026-11-29 01:06 UTC · original · reviewed

Static audit of c2f4cd35a against 48bae6cad. The patch applies cleanly in check mode. Please address these before merge.

  • d3d12/crates/leonida-shader/src/emit/bary_gs.rs:79 reassigns a packed flat float and integer different interpolation modes in the same row. Preserve the VS output modes from PSV0.
  • d3d12/crates/leonida-gpu/src/pipeline/host.rs:658 can keep native mesh while forced barycentrics lowering makes the PS require stand-ins. Route this pairing through a path that emits those inputs.
  • d3d12/crates/leonida-gpu/src/pipeline/host.rs:963 removes the rectangle GS, which drops indexed rectangles. Combine rectangle completion and barycentrics in one GS.
  • d3d12/crates/leonida-gpu/src/draw.rs:4707 and d3d12/crates/leonida-gpu/src/draw.rs:4782 leave IA topology set to triangle list. Restore it before the next conventional draw.
  • d3d12/crates/leonida-shader/src/emit/bary_gs.rs:186 emits only a triangle-input GS, which is incompatible with triangle adjacency draws. Select an adjacency variant at draw time.
  • d3d12/crates/leonida-shader/src/emit/bary_gs.rs:112 and d3d12/crates/leonida-shader/src/emit/mesh_vs.rs:134 can reject system-value relocation despite free rows below the highest occupied row. Allocate from those holes.
  • d3d12/crates/leonida-shader/src/emit/mesh_vs.rs:207 allows instance cap to rasterize from the shared overflow slot. Exclude group >= cap and cap the instance count.

No builds or GPU tests were run for this review.

AI-assisted.

**@⁠timbot103** on GitHub · 2026-11-29 01:06 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#pullrequestreview-6100839543) · **reviewed** Static audit of c2f4cd35a against 48bae6cad. The patch applies cleanly in check mode. Please address these before merge. - `d3d12/crates/leonida-shader/src/emit/bary_gs.rs:79` reassigns a packed flat float and integer different interpolation modes in the same row. Preserve the VS output modes from PSV0. - `d3d12/crates/leonida-gpu/src/pipeline/host.rs:658` can keep native mesh while forced barycentrics lowering makes the PS require stand-ins. Route this pairing through a path that emits those inputs. - `d3d12/crates/leonida-gpu/src/pipeline/host.rs:963` removes the rectangle GS, which drops indexed rectangles. Combine rectangle completion and barycentrics in one GS. - `d3d12/crates/leonida-gpu/src/draw.rs:4707` and `d3d12/crates/leonida-gpu/src/draw.rs:4782` leave IA topology set to triangle list. Restore it before the next conventional draw. - `d3d12/crates/leonida-shader/src/emit/bary_gs.rs:186` emits only a triangle-input GS, which is incompatible with triangle adjacency draws. Select an adjacency variant at draw time. - `d3d12/crates/leonida-shader/src/emit/bary_gs.rs:112` and `d3d12/crates/leonida-shader/src/emit/mesh_vs.rs:134` can reject system-value relocation despite free rows below the highest occupied row. Allocate from those holes. - `d3d12/crates/leonida-shader/src/emit/mesh_vs.rs:207` allows instance `cap` to rasterize from the shared overflow slot. Exclude `group >= cap` and cap the instance count. No builds or GPU tests were run for this review. AI-assisted.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 17:38 UTC · original

Mechanical note, no review: this branch conflicts with main (4364a4fa6) on a rebase, and the conflict is smaller than it sounds.

git merge-tree --write-tree origin/main refs/pull/2581/head reports 1 conflicted file(s):

  • d3d12/crates/leonida-shader/src/emit/mod.rs

main has changed that file in three recent commits (0bc6e21a1, 804280d80, 0807f9cba), which is the whole reason. #2580 touches the same file, and I checked: the two branches merge with each other without conflict, so they do not fight over the order - each one only needs its own rebase.

So a rebase is all it needs - the change itself may well be fine, I have not looked at its content, only at whether git can apply it.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 17:38 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7259854626) Mechanical note, no review: this branch **conflicts with `main`** (`4364a4fa6`) on a rebase, and the conflict is smaller than it sounds. `git merge-tree --write-tree origin/main refs/pull/2581/head` reports **1** conflicted file(s): - `d3d12/crates/leonida-shader/src/emit/mod.rs` `main` has changed that file in three recent commits (`0bc6e21a1`, `804280d80`, `0807f9cba`), which is the whole reason. **#2580** touches the same file, and I checked: the two branches **merge with each other without conflict**, so they do not fight over the order - each one only needs its own rebase. So a rebase is all it needs - the change itself may well be fine, I have not looked at its content, only at whether git can apply it. Written with an AI assistant.
github-bot force-pushed github-bot/gh-2581 from c2f4cd35a8 to 66afbce629 2026-11-29 18:53:19 +00:00 Compare
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-29 18:51 UTC · original

Thanks, @⁠timbot103. Fixed in 7e691b652, 8bd30f5b8 and 66afbce62 (rebased on #2580; the sink and topology points are fixed there):

  • bary_gs takes the vertex shader's interpolation from its PSV0;
  • with the stand-ins, mesh programs run as compute (mesh_vs writes them);
  • moved system values take the lowest free register;
  • rectangles + barycentrics (8bd30f5b8): rectangle lists whose pixel shader needs the stand-ins now get one geometry stage, rect_bary_gs. It completes the rectangle and writes the stand-ins for both triangles (six vertices), so indexed and indirect rectangles draw too. The shortcut is gone.
  • adjacency (66afbce62): triangle lists/strips with adjacency draw through a variant whose stage, bary_gs_adjacency, takes six vertices (DXIL input primitive 7) and draws the triangle at 0, 2, 4. It is made lazily at the first such draw, on the same chain as the per-format variants, so barycentrics pipelines are not all made twice. The flag is in the pipeline's description and in the pipeline book (bit 1 of the depth-bounds byte; older books read as without), so the next run makes it ahead of time.
  • Points and lines with the stage are still left out and logged once (no title draw like that seen).

New tests:

  • the_rectangle_barycentrics_stage_writes_the_stand_ins and the_adjacency_stage_takes_triangles_with_adjacency (portable);
  • the_rectangle_barycentrics_stage_is_a_valid_geometry_shader and ..._draws_what_host_barycentrics_draw (Windows);
  • the pipeline-book round trip now covers the adjacency flag.

Tested on GTX 1050 Ti 4 GB / NVIDIA 582.66 / Windows 10 (no SV_Barycentrics, so the stand-ins path):

  • leonida-shader --lib with the Agility SDK: 243 passed, 0 failed; the validator accepts both new stages;
  • leonida-gpu --lib: 517 passed, 3 failed: the same 3 that fail on the base without these PRs on this card (see #2580);
  • the mesh fallback's runtime test from #2580 passes on this branch.

Not run here: a pixel-for-pixel comparison against hardware barycentrics. The 1050 Ti has none, so on it those tests check the stand-in path's output only.

AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-29 18:51 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7260809239) Thanks, @⁠timbot103. Fixed in 7e691b652, 8bd30f5b8 and 66afbce62 (rebased on #2580; the sink and topology points are fixed there): - `bary_gs` takes the vertex shader's interpolation from its PSV0; - with the stand-ins, mesh programs run as compute (`mesh_vs` writes them); - moved system values take the lowest free register; - **rectangles + barycentrics (8bd30f5b8):** rectangle lists whose pixel shader needs the stand-ins now get one geometry stage, `rect_bary_gs`. It completes the rectangle and writes the stand-ins for both triangles (six vertices), so indexed and indirect rectangles draw too. The shortcut is gone. - **adjacency (66afbce62):** triangle lists/strips with adjacency draw through a variant whose stage, `bary_gs_adjacency`, takes six vertices (DXIL input primitive 7) and draws the triangle at 0, 2, 4. It is made lazily at the first such draw, on the same chain as the per-format variants, so barycentrics pipelines are not all made twice. The flag is in the pipeline's description and in the pipeline book (bit 1 of the depth-bounds byte; older books read as without), so the next run makes it ahead of time. - Points and lines with the stage are still left out and logged once (no title draw like that seen). New tests: - `the_rectangle_barycentrics_stage_writes_the_stand_ins` and `the_adjacency_stage_takes_triangles_with_adjacency` (portable); - `the_rectangle_barycentrics_stage_is_a_valid_geometry_shader` and `..._draws_what_host_barycentrics_draw` (Windows); - the pipeline-book round trip now covers the adjacency flag. Tested on GTX 1050 Ti 4 GB / NVIDIA 582.66 / Windows 10 (no SV_Barycentrics, so the stand-ins path): - leonida-shader `--lib` with the Agility SDK: 243 passed, 0 failed; the validator accepts both new stages; - leonida-gpu `--lib`: 517 passed, 3 failed: the same 3 that fail on the base without these PRs on this card (see #2580); - the mesh fallback's runtime test from #2580 passes on this branch. Not run here: a pixel-for-pixel comparison against hardware barycentrics. The 1050 Ti has none, so on it those tests check the stand-in path's output only. AI-assisted (Claude Code).
Conflicts: draw.rs (the signature is an Option for the mesh fallback, and
main reads mesh_test() once per dispatch: the fallback takes that mode too),
emit/mod.rs (both sets of exports; main's pixel mask test with the mesh test
programs from emit::host). Main's new test initializers take the fields this
branch adds (Parts::mesh_compute, Draw::vertex_count/instances,
HostShader::mesh_out).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mesh, colour and position programs 924b29417 put in emit::host are
needed by portable tests too (primitive_export_indices_drop_the_edge_flags),
and emit::host is Windows-only: the Linux test build did not resolve them.
They need no device, so they live in emit::test_programs, built for tests
and the host feature on every platform.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: draw.rs (main picks the pipeline through graphics_pipeline(), the
sample mask's twin; a draw of triangles with adjacency then takes the
barycentrics variant, which draws every pixel as the title's pipeline does
while its masked twin is made), pipeline.rs (host_pipeline_adjacency beside
main's host_pipeline_masked), emit/mod.rs (both sets of exports).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's Shader gained mask and masked_twins (the sample mask's pixel shader
twins); the mesh program seen as compute and its pass-through vertex shader
are the title's own forms: no mask, no twins yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
masked_for (main) picks a variant of the masked pipeline for the bound
formats through variant(), which now also says whether the variant is for
triangles with adjacency: these are not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-29 20:03 UTC · original

Merged main (through #2580's merge) in ae1ecd264, d5f666aad and 1e13fef64.

Conflicts:

  • main's graphics_pipeline() now picks the sample mask's twin. A draw of triangles with adjacency takes the barycentrics variant, which draws every pixel, as the title's pipeline does while the masked twin is made.
  • host_pipeline_adjacency sits beside main's host_pipeline_masked.
  • main's masked_for calls variant(…, false): a masked twin in other formats is no adjacency variant.

GTX 1050 Ti / 582.66 / Windows 10:

  • leonida-shader with Agility: 255 passed, 0 failed;
  • mesh_runs_in_one_list… passes;
  • leonida-gpu --lib: 542 passed, 3 failed, the same 3 as clean main on this card (3 runs each).

Linux: leonida-shader 232 passed. AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-29 20:03 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7261772776) Merged main (through #2580's merge) in ae1ecd264, d5f666aad and 1e13fef64. Conflicts: - main's `graphics_pipeline()` now picks the sample mask's twin. A draw of triangles with adjacency takes the barycentrics variant, which draws every pixel, as the title's pipeline does while the masked twin is made. - `host_pipeline_adjacency` sits beside main's `host_pipeline_masked`. - main's `masked_for` calls `variant(…, false)`: a masked twin in other formats is no adjacency variant. GTX 1050 Ti / 582.66 / Windows 10: - leonida-shader with Agility: 255 passed, 0 failed; - `mesh_runs_in_one_list…` passes; - leonida-gpu `--lib`: 542 passed, 3 failed, the same 3 as clean main on this card (3 runs each). Linux: leonida-shader 232 passed. AI-assisted (Claude Code).
Author
Owner

@⁠OneB1t on GitHub · 2026-11-29 20:47 UTC · original

this makes it work on VEGA64 / Radeon MI25 / Radeon Pro WX9100 👍

image
**@⁠OneB1t** on GitHub · 2026-11-29 20:47 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7262361481) this makes it work on VEGA64 / Radeon MI25 / Radeon Pro WX9100 👍 <img width="2495" height="1086" alt="image" src="https://github.com/user-attachments/assets/89c6256e-ed74-45e7-9ea1-7c2b3d8352d6" />
Author
Owner

@⁠lixonik on GitHub · 2026-11-29 21:07 UTC · original

One follow-up on the 1e13fef64 merge. The adjacency case appears to bypass OMSetSampleMaskX even after the masked twin is ready. graphics_pipeline() can return that twin, but prepare_for() then replaces it via host_pipeline_adjacency(self.pipeline, ...), which builds the variant from pipeline(this).host and the masked pipeline lives in a separate field. Could the ready masked pipeline supply the six-vertex variant, with the unmasked one used only while it builds? A masked adjacency draw with both PSOs already warm would distinguish the two cases.

Static review of this interaction. AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-29 21:07 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7262622832) One follow-up on the `1e13fef64` merge. The adjacency case appears to bypass `OMSetSampleMaskX` even after the masked twin is ready. `graphics_pipeline()` can return that twin, but `prepare_for()` then replaces it via `host_pipeline_adjacency(self.pipeline, ...)`, which builds the variant from `pipeline(this).host` and the masked pipeline lives in a separate field. Could the ready masked pipeline supply the six-vertex variant, with the unmasked one used only while it builds? A masked adjacency draw with both PSOs already warm would distinguish the two cases. Static review of this interaction. AI-assisted.
Author
Owner

@⁠OreoFR on GitHub · 2026-11-29 21:43 UTC · original

Partial check by OreoFR on macOS 27.2.1 (26B131), Apple M5, Rust 1.98.1 (d3d12/rust-toolchain.toml), main 060c47160 (merges cleanly; does not force a rebase of #2566 at eade9562c), PR head 1e13fef64 (stacked on #2580)

  • leonida-gpu does not build on macOS, already on main (Windows-only code not isolated: queue.rs:1417/1446, list.rs:2556/2562 use #[cfg(windows)] modules from lib.rs:53/126, resource.rs:712), so its tests (incl. GPU tests) are not covered here. In-game behaviour is not covered either.
  • leonida-shader: red = main (new tests are inline): 224 passed / 2 ignored → merge 232 passed / 2 ignored, 0 failed. 8 new tests, each 3/3 alone: the 2 from #2580 plus emit::bary_gs::tests::the_adjacency_stage_takes_triangles_with_adjacency, emit::bary_gs::tests::the_vertex_shaders_interpolation_comes_from_its_psv0, emit::barycentric_tests::mesh_vs_writes_the_barycentrics_stand_ins, emit::barycentric_tests::without_host_barycentrics_pixel_programs_read_stand_ins, emit::rect::tests::the_rectangle_barycentrics_stage_writes_the_stand_ins, emit::tests::moved_outputs_take_the_lowest_free_register.
  • Windows cross-check (lib + tests): 0 errors. Clippy: same as #2580.
  • Reviews: timbot103's requests addressed (7e691b652, 66afbce62). Open question from lixonik after this head: on an adjacency draw, draw.rs:2738-2745 swaps the masked pipeline for host_pipeline_adjacency() built from the unmasked one, so OMSetSampleMaskX is ignored there (documented in a comment; the "both PSOs ready" case is still to decide). No game data.

Verdict: leonida-shader part green (no red possible); leonida-gpu not buildable on macOS; one open review question.

AI-assisted: Claude Code

**@⁠OreoFR** on GitHub · 2026-11-29 21:43 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7263095917) Partial check by OreoFR on macOS 27.2.1 (26B131), Apple M5, Rust 1.98.1 (d3d12/rust-toolchain.toml), main 060c47160 (merges cleanly; does not force a rebase of #2566 at eade9562c), PR head 1e13fef64 (stacked on #2580) - **leonida-gpu does not build on macOS, already on main** (Windows-only code not isolated: `queue.rs:1417/1446`, `list.rs:2556/2562` use `#[cfg(windows)]` modules from `lib.rs:53/126`, `resource.rs:712`), so its tests (incl. GPU tests) are **not covered** here. In-game behaviour is not covered either. - **leonida-shader**: red = main (new tests are inline): 224 passed / 2 ignored → merge **232 passed** / 2 ignored, 0 failed. 8 new tests, each 3/3 alone: the 2 from #2580 plus `emit::bary_gs::tests::the_adjacency_stage_takes_triangles_with_adjacency`, `emit::bary_gs::tests::the_vertex_shaders_interpolation_comes_from_its_psv0`, `emit::barycentric_tests::mesh_vs_writes_the_barycentrics_stand_ins`, `emit::barycentric_tests::without_host_barycentrics_pixel_programs_read_stand_ins`, `emit::rect::tests::the_rectangle_barycentrics_stage_writes_the_stand_ins`, `emit::tests::moved_outputs_take_the_lowest_free_register`. - Windows cross-check (lib + tests): 0 errors. Clippy: same as #2580. - Reviews: timbot103's requests addressed (7e691b652, 66afbce62). **Open question** from lixonik after this head: on an adjacency draw, `draw.rs:2738-2745` swaps the masked pipeline for `host_pipeline_adjacency()` built from the unmasked one, so `OMSetSampleMaskX` is ignored there (documented in a comment; the "both PSOs ready" case is still to decide). No game data. **Verdict: leonida-shader part green (no red possible); leonida-gpu not buildable on macOS; one open review question.** AI-assisted: Claude Code
Author
Owner

@⁠OreoFR on GitHub · 2026-11-29 22:58 UTC · original

Verified by OreoFR (Windows part: leonida-gpu, plus leonida-shader's Windows-only tests; oreofr-mac covered leonida-shader on macOS)

PR head 1e13fef64 (stacked on #2580) merged with git merge --no-ff onto main 060c47160, no conflict. Windows 11 Pro 10.0.26300, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Rust 1.98.1. The GPU is used by the D3D12 host tests.

  • cargo test -p leonida-gpu --locked: 550 passed / 0 failed / 47 ignored (main 549/0/47; the +1 is #2580's mesh-fallback GPU test, which passes; this PR adds no leonida-gpu test).
  • cargo test -p leonida-shader --locked on Windows (where the emit::host D3D12 tests also run): 382 passed / 0 failed / 4 ignored (main 368/0/4; #2580 alone 372).
  • Red: NO RED possible. No leonida-gpu test of its own, and the leonida-shader tests are inline in the modules they test, as noted for macOS.
  • Clippy (--all-targets, leonida-gpu): no new lint in the files the PR touches.
  • #2566 (eade9562c) rebase needed after this: no (git merge-tree is clean).
  • Still open, not checked here: lixonik's question about draws of triangles with adjacency taking the barycentrics variant built from the unmasked pipeline, so the sample mask (OMSetSampleMaskX) would be ignored even once the masked twin is ready.

Verdict: NO RED (green on Windows, no failing test possible without the change).

This verification was AI-assisted (Claude Code, oreofr-agent).

**@⁠OreoFR** on GitHub · 2026-11-29 22:58 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7264090924) **Verified by OreoFR** (Windows part: leonida-gpu, plus leonida-shader's Windows-only tests; oreofr-mac covered leonida-shader on macOS) PR head `1e13fef64` (stacked on #2580) merged with `git merge --no-ff` onto main `060c47160`, no conflict. Windows 11 Pro 10.0.26300, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Rust 1.98.1. The GPU is used by the D3D12 host tests. - `cargo test -p leonida-gpu --locked`: **550 passed / 0 failed / 47 ignored** (main 549/0/47; the +1 is #2580's mesh-fallback GPU test, which passes; this PR adds no leonida-gpu test). - `cargo test -p leonida-shader --locked` on Windows (where the `emit::host` D3D12 tests also run): **382 passed / 0 failed / 4 ignored** (main 368/0/4; #2580 alone 372). - Red: **NO RED possible**. No leonida-gpu test of its own, and the leonida-shader tests are inline in the modules they test, as noted for macOS. - Clippy (`--all-targets`, leonida-gpu): no new lint in the files the PR touches. - #2566 (`eade9562c`) rebase needed after this: **no** (`git merge-tree` is clean). - Still open, not checked here: lixonik's question about draws of triangles with adjacency taking the barycentrics variant built from the unmasked pipeline, so the sample mask (`OMSetSampleMaskX`) would be ignored even once the masked twin is ready. Verdict: **NO RED** (green on Windows, no failing test possible without the change). This verification was AI-assisted (Claude Code, oreofr-agent).
Author
Owner

@⁠Neutron-0 on GitHub · 2026-12-01 12:01 UTC · original

Measured on Windows 11 with the Windows SDK's dxil.dll (101.7.2308.24), and the result is worth passing on: this pull request's head fails the DXIL validator for the same reason main does, and one small change makes all of those failures go away.

On this pull request's head (1e13fef64), cargo test -p leonida-shader --lib --locked -- emit:: gives

test result: FAILED. 244 passed; 11 failed; 4 ignored; 0 measured; 125 filtered out

and every one of the 11 says the same thing:

thread '...' panicked at crates\leonida-shader\src\emit\rect.rs:409:41:
called `Result::unwrap()` on an `Err` value: "error: Container part 'Pipeline State Validation' does not match expected for module.
Validation failed."

The cause is not in the geometry stage this pull request builds: the PSV0 part's name table holds one copy of a semantic's name for all the elements that share it, while the validator computes the table from the module with a copy per element. Every element after the first then carries a name offset the module's table does not have, and the validator refuses the program. #2864 writes the table the way DXC writes it (one copy per element, in element order).

With that change applied to this pull request's head (the patch applies cleanly to emit/container.rs, the same file this pull request touches, in another part of it):

test result: FAILED. 255 passed; 1 failed; 4 ignored; 0 measured; 125 filtered out

All the validator failures are gone; the one that is left is not the validator:

thread 'emit::valu_tests::rdna_forms_give_what_the_spelled_out_ones_give' panicked at crates\leonida-shader\src\emit\valu_tests.rs:2190:9:
assertion `left != right` failed: mad_legacy: written alike

It fails on this pull request's head without #2864 as well, and it passes on the current main (bf30e2585), so it comes from this branch's own work rather than from the container - flagged here only because it is red.

One thing to know before reading a green CI run as a check of the container: the windows-latest job cannot see any of this. validate() (d3d12/crates/leonida-shader/src/emit/mod.rs) is #[cfg(windows)] and only validates when a dxil.dll loads; without one it returns without validating and the test passes. No dxil.dll loads on the runner - it is in the log of main's run 46634364807: emit::rect::tests::rectangles_are_drawn_whole ... ok and emit::rect::tests::the_rectangle_stage_is_a_geometry_shader ... ok, i.e. the tests pass without validating anything. LEONIDA_DXIL points the validator at a specific dxil.dll, so it can be checked by hand in a minute on a machine that has one.

No game files and no GPU were needed for this check; the validator is the Windows SDK's dxil.dll.

**@⁠Neutron-0** on GitHub · 2026-12-01 12:01 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7310518549) Measured on Windows 11 with the Windows SDK's `dxil.dll` (101.7.2308.24), and the result is worth passing on: **this pull request's head fails the DXIL validator for the same reason `main` does, and one small change makes all of those failures go away.** On this pull request's head (`1e13fef64`), `cargo test -p leonida-shader --lib --locked -- emit::` gives ``` test result: FAILED. 244 passed; 11 failed; 4 ignored; 0 measured; 125 filtered out ``` and every one of the 11 says the same thing: ``` thread '...' panicked at crates\leonida-shader\src\emit\rect.rs:409:41: called `Result::unwrap()` on an `Err` value: "error: Container part 'Pipeline State Validation' does not match expected for module. Validation failed." ``` The cause is not in the geometry stage this pull request builds: the `PSV0` part's name table holds **one copy of a semantic's name for all the elements that share it**, while the validator computes the table from the module with **a copy per element**. Every element after the first then carries a name offset the module's table does not have, and the validator refuses the program. #2864 writes the table the way DXC writes it (one copy per element, in element order). With that change applied to this pull request's head (the patch applies cleanly to `emit/container.rs`, the same file this pull request touches, in another part of it): ``` test result: FAILED. 255 passed; 1 failed; 4 ignored; 0 measured; 125 filtered out ``` All the validator failures are gone; the one that is left is not the validator: ``` thread 'emit::valu_tests::rdna_forms_give_what_the_spelled_out_ones_give' panicked at crates\leonida-shader\src\emit\valu_tests.rs:2190:9: assertion `left != right` failed: mad_legacy: written alike ``` It fails on this pull request's head without #2864 as well, and it passes on the current `main` (`bf30e2585`), so it comes from this branch's own work rather than from the container - flagged here only because it is red. One thing to know before reading a green CI run as a check of the container: **the `windows-latest` job cannot see any of this.** `validate()` (`d3d12/crates/leonida-shader/src/emit/mod.rs`) is `#[cfg(windows)]` and only validates when a `dxil.dll` loads; without one it returns without validating and the test passes. No `dxil.dll` loads on the runner - it is in the log of `main`'s run 46634364807: `emit::rect::tests::rectangles_are_drawn_whole ... ok` and `emit::rect::tests::the_rectangle_stage_is_a_geometry_shader ... ok`, i.e. the tests pass without validating anything. `LEONIDA_DXIL` points the validator at a specific `dxil.dll`, so it can be checked by hand in a minute on a machine that has one. No game files and no GPU were needed for this check; the validator is the Windows SDK's `dxil.dll`.
github-bot closed this pull request 2026-12-02 11:55:16 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-12-02 11:50 UTC · original · edited 2026-12-02 11:51 UTC

Closing: this pull request no longer applies to current main (merge conflict in d3d12/crates/leonida-gpu/src/pipeline/host.rs, d3d12/crates/leonida-gpu/src/pipeline/make.rs, d3d12/crates/leonida-gpu/src/shader_cache.rs, d3d12/crates/leonida-shader/src/emit/lower.rs, d3d12/crates/leonida-shader/src/emit/mod.rs, d3d12/crates/leonida-shader/src/emit/shader.rs), and open pull requests that have fallen out of step with main are being closed so the list stays workable. If you still want this change, rebase it on current main and reopen it (or open a new pull request); it will be looked at again.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-12-02 11:50 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2581#issuecomment-7344471017) · edited 2026-12-02 11:51 UTC Closing: this pull request no longer applies to current `main` (merge conflict in `d3d12/crates/leonida-gpu/src/pipeline/host.rs`, `d3d12/crates/leonida-gpu/src/pipeline/make.rs`, `d3d12/crates/leonida-gpu/src/shader_cache.rs`, `d3d12/crates/leonida-shader/src/emit/lower.rs`, `d3d12/crates/leonida-shader/src/emit/mod.rs`, `d3d12/crates/leonida-shader/src/emit/shader.rs`), and open pull requests that have fallen out of step with `main` are being closed so the list stays workable. If you still want this change, rebase it on current `main` and reopen it (or open a new pull request); it will be looked at again. AI-assisted (Claude Code).

Pull request closed

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/ubiquitarianism--leonida!2581
No description provided.