Skip to content

d3d12: mesh pipelines draw through compute on a GPU without mesh shaders (D3D12-MESH-COMPUTE-FALLBACK) - #2580

Open
qhukz13 wants to merge 73 commits into
ProjectLeonida:mainfrom
qhukz13:cont/d3d12-mesh-compute
Open

qhukz13 wants to merge 73 commits into
ProjectLeonida:mainfrom
qhukz13:cont/d3d12-mesh-compute

Conversation

@qhukz13

@qhukz13 qhukz13 commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D12-MESH-COMPUTE-FALLBACK (#2570#issuecomment-7239097845)

What and why

leonida.exe refuses every mesh pipeline on a GPU without D3D12 mesh shaders (mesh shader tier 0: Pascal and older), so the world draws nothing there. This translates each mesh program as an ordinary compute shader writing its outputs to a buffer, and draws that buffer as a triangle list through a pass-through vertex shader of ours.

  • Translator: set_host_mesh_shaders(false):
    • a mesh program becomes cs_6_6; its four mesh output ops become raw stores into the root UAV SLOT_MESH_OUT, one MeshOut slot per group;
    • a 256-byte header holds the draw arguments, which the groups fill (no CPU read for indirect calls);
    • groups past the 64 MiB buffer go to a sink slot and draw nothing;
    • mesh_vs() reads it back: SV_VertexID gives primitive and corner, SV_InstanceID the group, and per-primitive outputs are constant inputs where the pixel shader reads them;
    • the shader cache keys on it.
  • Runtime:
    • the device check turns it on (LEONIDA_MESH_COMPUTE=1 forces it on any card, for comparison);
    • a mesh pipeline becomes a compute pipeline plus a graphics pipeline;
    • a direct dispatch becomes Dispatch + DrawInstanced;
    • an indirect dispatch becomes WriteBufferImmediate + two ExecuteIndirects (dispatch signature over the title's own record, then draw from the header).
  • shortcut: an indirect call with several records is still left out (logged).

On Windows 10 this needs #2557 (shader model 6.6).

Tested

  • MEASURED: GTX 1050 Ti 4 GB, Windows 10, 582.66, with d3d12: Windows 10 runs the D3D12 runtime with the Agility SDK (D3D12-RUNTIME-WIN10-AGILITY) #2557 merged locally. The title goes from its start screen through the opening cutscenes into the first playable scene at 2–5 fps. Before: the world drew nothing, and every mesh pipeline logged no host pipeline: the host GPU has no mesh shaders. Fallback pipelines made in a run: up to 567; no device removal.
  • Unit/device tests (cargo test -p leonida-shader --lib mesh, -p leonida-gpu --lib shader_cache): 7 + 2 pass on the 1050 Ti. The device test draws the triangle mesh fixture as compute and checks the texels, and compares them with the mesh pipeline texel for texel on a device with mesh shaders. dxil.dll validates the compute variant and the vertex shader.
    • Note: on Windows 10 the shader crate's device tests need the Agility SDK in the test process; I ran them with it exported locally (not part of this PR).
  • Not tested: a native comparison (no mesh-shader card here). LEONIDA_MESH_COMPUTE=1 on an RTX card would show it.

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

AI-assisted (Claude Code).

🤖 Generated with Claude Code

EdenBendheim and others added 26 commits November 24, 2026 00:38
Require a non-empty file before the manifest or exporter considers a DDS complete. Rebuild empty outputs through the atomic writer and cover skipped rows and surviving siblings with synthetic tests.
…write_json_atomic (WORLD-BUILD-STAGE-CLEANUP)

When writing world JSON atomically, if os.replace fails (for instance due to
permission errors), resetting os.chmod to 0o600 ensures unlinking the
temporary file does not fail on Windows with PermissionError.

agent: yes
AI-assisted: yes
…(DDS-PNG-STAGE-CLEANUP)

When previewing/saving PNG in CLI main(), if os.replace fails after
shutil.copymode set the destination's permissions, resetting os.chmod to
0o600 ensures TemporaryDirectory cleanup does not fail with PermissionError
on Windows if the output was read-only.

agent: yes
AI-assisted: yes
…publish mode (WORLD-NAMES-STAGE-CLEANUP)

When writing dictionary JSON atomically in _write_json, apply published_mode
to the staged file and reset os.chmod to 0o600 before exiting TemporaryDirectory
if os.replace fails, ensuring cleanup does not fail with PermissionError on
Windows when replacing a read-only file.

agent: yes
AI-assisted: yes
… driver 582.66 too

Follow-up to ProjectLeonida#1364 from its review: the row named only 582.78, while that PR's run was on 582.66.

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

normcase(abspath()) kept Game/missing.rpf and game/missing.rpf apart on macOS when neither file existed, so two reports of one archive were rejected. The archive key now uses the shared path key.

Co-authored-by: Cursor <cursoragent@cursor.com>
--budget is a count of random elements per format, and a negative one was
accepted with exit 0 and no message. `for _ in range(budget)` simply does not
run, so -1, -100 and -1000000 produced exactly the run of 0 -- 1026 instead of
1106 elements for 8_8_8_8_UNORM -- and every format still reported "ok".
--self-test was worse: it builds its own patterns with a hardcoded budget of 2
and never reads the option, so `--self-test --budget -100` and `--budget
1000000` both printed the same "self-test: ok" in the same 1.4 s.

Before:
  $ python -I tools/buffer_format_fuzz.py --self-test --budget -1
  self-test: ok                                # exit 0
  $ python -I tools/buffer_format_fuzz.py --oracle hw --budget -3
  hardware oracle unavailable: ...             # exit 77, no GPU needed to know

After, one check next to the other argument guards and before both the
self-test and the oracle, so the value is validated even where it is not used:

  $ python -I tools/buffer_format_fuzz.py --self-test --budget -1
  buffer_format_fuzz.py: error: --budget cannot be negative   # exit 2
  $ python -I tools/buffer_format_fuzz.py --self-test --budget 0
  self-test: ok                                # 0 stays legal: sweeps only

tests/test_buffer_format_fuzz.py (CPU only, hw_oracle stubbed) covers the
negative value on both paths, that it is refused before the oracle is opened,
that 0 stays legal and that -1 is otherwise indistinguishable from 0.
3 of its 7 tests fail without this change, 7 pass with it.
A zero --programs ran the sweep and nothing else with exit 0, and a zero --max-ops reached random.randint(1, 0)'s ValueError traceback. Both are now usage errors: --max-ops and --programs must be at least 1, checked right after parsing and before any work, and argparse exits 2 with the message. main() takes argv so the tests can drive it.
Write JSON to a same-directory temporary file and replace the report only after serialization succeeds. On write failure, keep the existing report and remove the temporary file; preserve the current error message and exit code.

Evidence (run from /home/hampa/work/leonida-feature-scan):

Tests:
- Original: git checkout upstream/main -- tools/feature_scan.py && /home/hampa/work/.venv/bin/python -m pytest tests/test_feature_scan.py -q -> rc 1; 1 failed, 15 passed. The existing report was empty instead of the 23-byte sentinel.
- Fixed: git checkout HEAD -- tools/feature_scan.py && /home/hampa/work/.venv/bin/python -m pytest tests/test_feature_scan.py -q -> rc 0; 16 passed.

File-size-limit reproduction (synthetic shaders only):
- Setup: mkdir -p /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/shaders/dxbc /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/out; python3 -c 'import json,sys; json.dump([{"stage":"synthetic_stage_"+str(i)+"_"+("x"*80)} for i in range(40)], open(sys.argv[1],"w"))' /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/shaders/dxbc/index.json; printf '{"previous": "sentinel report"}\\n' > /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/out/report.json
- Before: bash -c 'ulimit -f 1; python3 -I -B tools/feature_scan.py "$1" --out "$2" >/dev/null' _ /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/shaders /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/out/report.json -> rc 2; report 32 bytes before, 1024 bytes after (old contents replaced by partial JSON).
- After: bash -c 'trap "" XFSZ; ulimit -f 1; python3 -I -B tools/feature_scan.py "$1" --out "$2" >/dev/null' _ /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/shaders /home/hampa/.hermes/profiles/mikuling/cache/scratch/feature-scan-ulimit1.hlUt9B/out/report.json -> rc 2; report 32 bytes before and after, with no temp file remaining.
Write the generated JSON to a temporary file in the destination directory, then atomically replace the output. Remove the temporary file on write errors and preserve output permissions.

Before: with 128 synthetic classes and an existing 14-byte output, `bash -c 'trap "" XFSZ; ulimit -f 1; python3 -I tools/gen_gdk_runtime_classes.py /home/hampa/.hermes/profiles/mikuling/cache/scratch/gdk-atomic-repro/docs --out /home/hampa/.hermes/profiles/mikuling/cache/scratch/gdk-atomic-repro/out.json'` returned 1 (Errno 27, File too large); output grew to 1024 bytes (partial JSON).

After: the same command returned 1, left the 14-byte sentinel unchanged, and left no temporary file. Tests against upstream/main: 1 failed, 2 passed; against the fix: 3 passed.
…nd publish mode (BVH-SLOT-CHECK-STAGE-CLEANUP)

Apply published_mode(path) to temporary file before atomic replacement,
and restore write permission (0o600) before unlinking in finally block
when replace fails, preventing Windows PermissionError [WinError 5] and
stranded temporary files.

agent: yes
AI-assisted: yes
…t tests (RT-XS-ALLOC-SIZE-GUARDS-AND-TESTS)

Guard align_up_saturating against zero alignment (to == 0) in runtime/shims/d3d12_xs_alloc_size.h, avoiding division by zero and underflow.

Add standalone CPU-only unit test runtime/test/d3d12_xs_alloc_size_test.cpp covering align_up_saturating, render_target_element_bytes, console_depth_planes, console_render_target_size, console_depth_stencil_size, and console_placement.

Register test executable and CTest in runtime/CMakeLists.txt.

AI-assisted (Claude Code)
…te in the executable (D3D12-DEVICE-SLOT-ARITY)
…ling mips

When a BC6H or BC7 stream still references an unfitted built-in predictor slot after adjacent-mip fitting, pair its mips with the closest raw or zlib mip on the same layer across multi-level mip distances before running the full-stream constraint pass. Existing adjacent-mip, array, and cubemap fits keep precedence.
Run fit_distant_mips ahead of fit_decoded_neighbors so mixed-codec BC6H and BC7 streams fit directly against lossless raw/zlib mips across multi-level distances before iterative BCPack sibling decoding, eliminating all 10 remaining BC6H stream refusals on 1.0.2.1 (210 -> 226/256 endpoints, 249 -> 251/256 indices) and cutting fit_decoded_neighbors runtime by 46%.
Exercise the public history.build(...) pipeline end-to-end across all four
synthetic multi-level BPTC mip fitting tests so running the test file against
main reaches value assertions (4 AssertionErrors, 0 AttributeErrors) instead
of stopping on the missing fit_distant_mips helper.
…in multilevel mip fit

- Keep secret_entry >= 192 with ref_count <= secret_entry across all synthetic
  BPTC streams so predictor distances never wrap mod 256 and main leaves
  unknown slots at zero rather than self-fitting wrapped blocks.
- Drive dual-slot BC6H and BC7 chunks (missing slot 240 + pre-populated slot
  241 with conflicting pool colors) so extend_missing precedence is genuinely
  exercised for both codecs.
- Assert fitted BC6H endpoint values, zero confirmed-bit masks, and per-block
  decoded RGBA / unquantized HDR pixels across both parent-downsample and
  child-upsample streams, and include codec mode in fit_distant_mips wanted keys.

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 094e948e9 merged locally with main aa918e5d9. The synthetic triangle variants (plain, edge flags, culled) matched the native mesh pipeline on RTX 5070 (610.88), Windows 10 22H2 with Agility SDK 1.614.1 and DXIL validator 1.9.2609. The mesh-filtered suite reported 7 passing entries, with the optional compiler comparison and WARP device subcase skipped. One extra GPU fixture reproduced the sink-slot boundary below.

AI-assisted.

let corner = s.m.bin(b, Bin::URem, id, three);
// A group past the cap wrote to the sink slot: it draws nothing.
let cap = k(&mut s, layout.groups_cap());
let past = s.m.cmp(b, super::bitcode::pred::IUGT, group, cap);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

groups_cap() counts usable slots, so slot indices below it are usable and the slot at that index is already the sink. The unsigned greater-than predicate still renders instance group == cap. I made the existing synthetic triangle fixture use a 4 KiB scratch cap, giving three usable slots. With only the last valid slot populated, it lit all 256 pixels as expected. With only the sink populated, instance 3 also lit all 256. Changing the comparison to unsigned greater-or-equal gave 0, as intended. Both the direct draw's instance count and the indirect header can currently include the sink instance. Could we exclude it at the comparison or cap the submitted draw count?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested after the rebase at dc5818bb8424d96b642ba07cd03a3251d529a147, merged with main 02944d4ca1. The crate builds here, and the translation test passes with DXIL validator 1.9.2609. The sink-slot case still reproduces.

With synthetic triangle data and a 4 KiB scratch buffer, I drew four instances and populated one slot at a time. On RTX 5070 (610.88), Windows 10 22H2, Agility SDK 1.614.1, slot 2 lit 256/256 pixels and the sink at slot 3 also lit 256/256. Changing just IUGT to IUGE kept slot 2 at 256/256 and took the sink to 0/256. The plain, edge-flag, and culled comparisons with the native mesh pipeline passed with that local one-line change. WARP skipped for lack of SM 6.6 here.

AI-assisted. Codex (GPT-6).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested the sink fix at 74ac98c64 on native Windows 10 22H2, RTX 5070 (610.88), with Agility SDK 1.614.1 and DXIL validator 1.9.2609. The committed sink fixture ran on hardware: slot 0 lit 256/256 pixels and slot groups_cap() lit 0/256. The compute and native mesh draw comparison also passed. I used local Agility loader exports for the test binary and made the sink fixture require a hardware device. The optional WARP and external shader-compiler cases skipped.

This resolves my sink-slot finding. AI-assisted.

@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Windows 11 + RTX 3090 D3D12 & WARP Verification (094e948e99) — GPU Verified + Rebase Needed Against main (E0063)

Verified commit 094e948e99a48d1476ac8adb33c5ce24ac8cb68d on Windows 11 (x86_64-pc-windows-msvc) with physical NVIDIA GeForce RTX 3090 (Ampere, D3D12 driver 610.88, native SM 6.6 mesh shaders enabled for direct hardware comparison) and WARP + dxil.dll.

1. Red -> Green Physical GPU & DXIL Verification

  • Red (main 1bc055e6c2): shader_cache MeshOut round-trip fails to compile (E0422/E0609/E0560: MeshOut and HostShader::mesh_out absent).
  • Green (094e948e99 standalone & merged onto main 1bc055e6c2 with the 2-field Translated update below):
    • cargo test --locked -p leonida-shader --lib -- --nocapture --test-threads=4 mesh: 7/7 passed (0.76s):
      • a_mesh_program_translates_as_compute_without_mesh_shaders: dxil.dll validated both the lowered cs_6_6 compute shader and the generated mesh_vs pass-through vertex shader.
      • a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_draws: passed texel-for-texel against the native mesh pipeline on both physical RTX 3090 (hardware: the mesh program drew as compute (mesh shaders there: true)) and WARP (warp: the mesh program drew as compute (mesh shaders there: true)).
    • cargo test --locked -p leonida-gpu --lib -- --nocapture --test-threads=4 shader_cache: 2/2 passed (MeshOut cache round-trip and damage rejection).
    • 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. Blocking Rebase Note Against Current main (aa918e5d9f)

Although Git merges 094e948e99 into main (aa918e5d9f) without textual conflicts, leonida-gpu fails to compile after the merge because struct Translated in d3d12/crates/leonida-gpu/src/pipeline.rs gained stores_past_views and bound on main since c1ecf04edc:

error[E0063]: missing fields `bound` and `stores_past_views` in initializer of `Translated`
  --> crates/leonida-gpu/src/pipeline.rs:224:35

Adding stores_past_views: false, and bound: Default::default(), to the synthetic vs Translated literal in Shader::mesh_fallback (d3d12/crates/leonida-gpu/src/pipeline.rs) resolves the compile error cleanly and passes all tests above on main.

3. Non-Blocking Notes

  • Host topology restoration (d3d12/crates/leonida-gpu/src/draw.rs): mesh_as_compute and mesh_indirect_as_compute call l.IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST) on the host command list without restoring self.topology afterwards (if self.topology_set { self.set_topology(list, self.topology); }, analogous to self.mesh_scissor(list, false)). If an earlier draw on the same command list bound a non-TRIANGLELIST topology (e.g. TRIANGLESTRIP or LINELIST) and a subsequent VS/PS draw after the mesh dispatch does not re-issue IASetPrimitiveTopology, it would inherit TRIANGLELIST.
  • Visibility lint (d3d12/crates/leonida-shader/src/emit/shader.rs:260): MeshOut::new triggers #[warn(private_interfaces)] because SigElement is pub(crate) (pub(crate) fn new silences it).

AI-assisted.

qhukz13 and others added 19 commits November 29, 2026 20:28
… on a device

The commands the mesh fallback records between and after the pipelines the
draw path binds (barriers, the dispatch or counted indirect dispatch, the
header of the indirect draw, the triangle list drawn from the buffer, the
title's topology again) move from draw.rs into mesh_fallback::MeshRun, which
draw.rs calls. A test records the same commands on a device of its own,
as a title does in one list: a counted indirect run (count 1), a direct run
of three groups, a run whose triangle is culled, a counted indirect run with
a count of 0, then the title's triangle strip; every texel comes out as the
runs and the strip draw it. Without the topology restored the strip draws
one triangle (64 texels differ); without the header's instance count reset
the count-0 run draws the first run's groups again (100 differ).

leonida-shader's host checks (emit::host) take the test programs this needs:
triangle_mesh_program (the triangle mesh program its own tests used),
color_ps and position_vs; dxbc::build is there for them too. draw.rs
names its topology mapping (host_topology).

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

f16misc_diff: reject a zero or negative --max-ops and --programs
buffer_format_fuzz: reject a negative --budget
…tomic-out

feature_scan: write --out atomically and keep the existing report on failure
…e-classes-atomic-out

gen_gdk_runtime_classes: write --out atomically
…ault-context

windows-boot: report the loss API, fault query and checkpoint counts
docs: D3D-56 descriptor lookup numbers on RTX 3070 (Ampere, ReBAR off) (OLD-9801)
…c-base-gpu

docs: the s_load vcc-base row is GPU-checked on RDNA2 and under wave64 emulation (SHADER-VCC-BASE-GPU-VERIFIED)
…tore-status

docs(testing): note V100 cube-store failure
…s-alloc-size-guards-and-tests

runtime: guard align_up_saturating against zero alignment and add unit tests (RT-XS-ALLOC-SIZE-GUARDS-AND-TESTS)
…h-gpu-vulkan-links

docs: refresh GPU testing and Vulkan links
…nan-rows

docs/testing: record the two ps_* KosmicKrisp NaN cases
…-stage-cleanup

world_build: restore write mode before unlink on replace failure in _write_json_atomic (WORLD-BUILD-STAGE-CLEANUP)
…ge-cleanup

dds_png: restore write mode before unlink on replace failure in main (DDS-PNG-STAGE-CLEANUP)
…-stage-cleanup

world_names: restore write mode before unlink on replace failure and publish mode (WORLD-NAMES-STAGE-CLEANUP)
…eck-stage-cleanup

bvh_slot_check: restore write mode before unlink on replace failure and publish mode (BVH-SLOT-CHECK-STAGE-CLEANUP)
…rifier-stage-cleanup

manifest_verifier: restore write mode before unlink on replace failure and publish mode (MANIFEST-VERIFIER-STAGE-CLEANUP)
…rce-census-dataflow-io

sampler_source_census: fix V#/pointer/SMEM/v_mov dataflow and harden JSON I/O (SAMPLER-SOURCE-CENSUS-DATAFLOW-AND-IO)
…evel-bcpack-fit

build_dstorage_history: fit missing BPTC history slots across multi-level sibling mips (DSTORAGE-MULTILEVEL-MIP-FIT)
@qhukz13

qhukz13 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the audit, @timbot103. All six points held up in the code and are fixed in bc0c72f:

  • the fallback makes no mesh command signature;
  • an instance from groups_cap on (the sink) draws nothing, and the direct path draws at most cap instances;
  • the title's topology is set again after the fallback's triangle list;
  • MeshOut's OSG1/PSG1 keep elements in the order of their offsets (the test fails without it);
  • the host is made before a pipeline picks the path;
  • the mesh program's own stores count after the draw.

Also: 1b33fa2 puts drew()'s doc comment back on drew(), and 1b6b223 makes MeshOut::new crate-private (the private_interfaces warning).

A per-primitive layer/viewport index is refused by mesh_vs for now: the translator does not export those yet (lower.rs refuses them), so there is nothing to carry until it does.

Runtime coverage (924b294). What the fallback records around the pipelines the draw path binds (barriers, the direct or counted indirect dispatch, the indirect draw's header, the triangle list from the buffer, the title's topology again) is now one recorder, mesh_fallback::MeshRun, which draw.rs calls. mesh_runs_in_one_list_draw_their_own_groups_and_the_strip_after_them_its_strip records it on a device the way a title does, in one list:

  1. a counted indirect run, count 1;
  2. a direct run of three groups;
  3. a run whose triangle is culled (the buffer still holds the previous run's triangles);
  4. a counted indirect run with a count of 0;
  5. the title's triangle strip.

Every texel must come out as the runs and the strip draw it. As a check, without the topology restore the strip draws one triangle (64 of 256 texels differ), and without the header's instance count reset the count-0 run draws the first run's groups again (100 differ). The first overflow group is the_mesh_sink_slot_draws_nothing.

Tested on GTX 1050 Ti 4 GB / NVIDIA 582.66 / Windows 10 (no mesh shaders):

  • leonida-shader --lib with the Agility SDK: 233 passed, 0 failed, including a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_draws and the_mesh_sink_slot_draws_nothing on the card;
  • the new leonida-gpu test passes on the card;
  • leonida-gpu --lib: 517 passed, 3 failed. The same 3 fail on the base without this PR on this card: a_raw_view_is_moved_only_where_its_descriptor_says_where_it_is, views_are_made_beside_the_heap_and_copied_in, and depth_bounds_pipeline_loads_and_filters_draws (E_INVALIDARG).

AI-assisted (Claude Code).

qhukz13 and others added 3 commits November 29, 2026 21:07
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 <noreply@anthropic.com>
The mesh, colour and position programs 924b294 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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
@qhukz13

qhukz13 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (7c330c7) in 58c3333, plus:

  • eab9c1e: the test programs from 924b294 move to emit::test_programs (built on every platform), since a portable test needs them and emit::host is Windows-only. Before this the Linux test build did not resolve them.
  • 74ac98c: the fallback's shaders take main's new Shader::mask / masked_twins.

The fallback now takes the per-dispatch mesh_test() mode as main's mesh paths do.

GTX 1050 Ti / 582.66 / Windows 10:

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

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

@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 29, 2026
@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Partial check by OreoFR on macOS 27.2.1 (26B131), Apple M5, Rust 1.98.1 (d3d12/rust-toolchain.toml), main 060c471 (merges cleanly; does not force a rebase of #2566 at eade956), PR head 74ac98c

  • 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 (cargo test -p leonida-shader --locked): the new tests live in emit/mod.rs with the code, so red = main where they do not exist: main 224 passed / 2 ignored → merge 226 passed / 2 ignored, 0 failed. New: emit::tests::a_mesh_program_translates_as_compute_without_mesh_shaders, emit::tests::mesh_out_parts_keep_their_elements_beside_their_offsets (MEASURED n=3, alone).
  • Cross-check cargo check --target x86_64-pc-windows-msvc --features host --tests: 0 errors. Clippy -D warnings: nothing new on macOS; on the Windows target 2 new unused imports in emit/mod.rs tests (super::bitcode::Attr l.1768, super::shader::Shader l.1919) — main already fails -D warnings there (6 lints).
  • Reviews: timbot103's requests are addressed by bc0c72f; lixonik retested 74ac98c on an RTX 5070. No game data in the diff.

Verdict: leonida-shader part green (no red possible); leonida-gpu not buildable on macOS — needs a Windows/GPU verifier.

AI-assisted: Claude Code

@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

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

PR head 74ac98c64 merged with git merge --no-ff onto main 060c47160, no conflict. Windows 11 Pro 10.0.26300, RTX 4070 Laptop 8 GB (native mesh shaders), 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 new GPU test mesh_fallback::tests::mesh_runs_in_one_list_draw_their_own_groups_and_the_strip_after_them_its_strip runs and passes on the 4070.
  • cargo test -p leonida-shader --locked on Windows (where the emit::host D3D12 tests also run): 372 passed / 0 failed / 4 ignored (main 368/0/4).
  • Red: NO RED possible. The leonida-gpu test drives mesh_fallback, a module the PR adds, so without the change it does not compile. 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.
  • [integration] PageMirror, GPU detile, async queue & RDNA2->SPIR-V performance stack (INTEGRATION-PERF-CPU-GPU-R6) #2566 (eade9562c) rebase needed after this: no (git merge-tree is clean).

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.