d3d12: carry #2580 - mesh pipelines draw through compute without mesh shaders (D3D12-MESH-COMPUTE-FALLBACK) #3128
Open
MoonEyes wants to merge 13 commits from
upstream-pr/3128 into main
pull from: upstream-pr/3128
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!3128
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3128"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:47:04Z.
Claimed in the coordination issue as: D3D12-MESH-COMPUTE-FALLBACK (the claim of the original author, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7239097845)
Depends on: #2557 (merged)
What and why
Carry of #2580 (qhukz13), in conflict with
mainind3d12/crates/leonida-gpu/src/pipeline/host.rs,shader_cache.rsandd3d12/crates/leonida-shader/src/emit/{lower,mod,shader}.rs. This branch ismain(40ac04183) merged with the head of #2580 (74ac98c64), so the author's commits are kept. My only change is the merge.The change itself is #2580's: on a GPU without D3D12 mesh shaders (Pascal and older) every mesh pipeline was refused and the world drew nothing. A mesh program is now translated as a
cs_6_6compute shader writing to a buffer, drawn as a triangle list through a pass-through vertex shader (LEONIDA_MESH_COMPUTE=1forces it on any card). The review fixes of the original (sink slot, topology restore, offsets beside their elements, no native mesh signature on that path) are already in its head.How each conflict was resolved (both sides kept):
emit/mod.rs,emit/shader.rs: main'smesh_counts,mesh_payload,SLOT_TLAS_*andray_queriesstay beside the PR'smesh_vs,MeshOut,SLOT_MESH_*andmesh_out.constant_colorstayspub(super)(main'smesh_countstests use it) and builds on the PR'stest_programs::color_ps.emit/lower.rs:host_settings()has six words, main's inline ray tracing switch then the PR's mesh switch; both setters and theTEST_MESH_COMPUTEhook stay.shader_cache.rs: a record writes the mesh layout (0 or 1 plus the layout), then main's optional ray query record; the decoder reads them in that order.paired_overridekeeps main'shost_settings()[..4]test.pipeline/host.rs:HostPipelinehas bothamplifyandmesh_compute; the root slots the host owns includeSLOT_MESH_INand the TLAS range; main'seffective_depth_bounds_descstays and the PR'simpl HostPipelinefollows it.HostShader,Parts,Draw) take the fields of both sides (ray_queries,mesh_out,mesh_compute,vertex_count,instances); two imports that main'sconstant_coloralone used are gone.Tested
Windows 11, NVIDIA GeForce RTX 4060 (driver 32.0.16.1088), on current
main(40ac04183) plus this branch (016c7765b), debug build:cargo check -p leonida-shader -p leonida-gpu --tests: no error (oneunused mutwarning inhost.rs, also on main with thediagnosticsfeature off).cargo test -p leonida-shader --lib mesh: 18 passed (the device tests ran on the hardware adapter and on WARP: "the mesh program drew as compute (mesh shaders there: true)").cargo test -p leonida-gpu --lib shader_cache: 6 passed;--lib mesh_fallback: 1 passed;--lib pipeline::host: 11 passed.cargo test -p leonida-shader --lib: 432 passed, 0 failed, 6 ignored;cargo test -p leonida-gpu --lib: 692 passed, 0 failed, 59 ignored.host_mesh_compute()forced tofalseinemit/lower.rs(mesh programs stay mesh) 3 of the 18 shader mesh tests fail (a_mesh_program_translates_as_compute_without_mesh_shaders,a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_draws,the_mesh_sink_slot_draws_nothing) andmesh_fallback::tests::mesh_runs_in_one_list_draw_their_own_groups_and_the_strip_after_them_its_stripfails; restored, git status clean. On main itself the new tests do not build (MeshOut,mesh_vs,TEST_MESH_COMPUTEare absent).python -I scripts/check_no_game_data.pyon the 30 changed files: clean.GPUs tested: NVIDIA GeForce RTX 4060 (mesh shaders present, so the comparison with the native mesh pipeline ran) and WARP, Windows 11.
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly.docs/design.md. (n/a: no new translation rule, a host mode that lowers mesh programs as compute; the original did not touch the table)Supersedes #2580 once merged; the original stays open until a maintainer decides.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:01:11Z.
Ran natively on Windows 11, head
016c7765bmerged into currentmain(69cd4106c, 98 commits past the carry's base;git merge --no-ffclean, no conflict). Debug build, Rust fromrust-toolchain.toml,--locked. Synthetic fixtures only, no game data.One gap the carry introduces:
LEONIDA_MESH_COUNTS=1together with the compute fallbackmesh_counts.rs(main'sLEONIDA_MESH_COUNTS, off by default) is not on #2580's head; it meets the fallback for the first time in this merge. With both on, a mesh program translated as compute still gets the mesh-only DXIL ops:lower.rsthe plan is made whenevermesh_counts::on(), whateverx.mesh_computesays;mesh_prologuethen returns early (if self.mesh_counts.is_some()) before the compute branch, so the header's instance-count atomic is not emitted (read from the code, not run: an indirect run would then draw 0 instances);own_mesh_countsemitssetMeshOutputCountsandemitIndicesunconditionally.Throwaway test (the
mesh(prims, own)fixture ofmesh_counts::testswithTEST_MESH_COMPUTE = Some(true)), checked with dxil.dll:cs_6_6CreateComputePipelineState&& !x.mesh_computeadded to themesh_counts::on()check inlower.rsWARP created the pipeline from the invalid module; I did not trace whether the runtime validates a translation before it gets there, and I did not feed it to the card. It needs an opt-in switch plus a card without mesh shaders (or
LEONIDA_MESH_COMPUTE=1), so it is not blocking for default runs, but in that combination every mesh program that gets a counts plan comes out wrong. The one-line guard above is the smallest fix I found; it means the fallback ignores the program's own counts and keeps the declared maxima, as it does today with the switch off. Carrying the counts into the compute layout would be a separate change.Also checked with the throwaway:
LEONIDA_MESH_AMPLIFY's payload (MESH_PAYLOAD_HERE) with the compute variant validates, and the runtime cannot reach the amplification branch on this path (the fallback's graphics pipeline is built from vertex and pixel stages, soamplifyisNone).Edge case: declared maxima above the lane count
Throwaway copy of
a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_drawswith the 32-lane triangle program declaring 256 vertices and 256 primitives:Debug layer on the PR's device tests
LEONIDA_D3D12_DEBUG=1, with the info queue read at the end of each device iteration (throwaway lines, removed afterwards; the queue was present, so the layer was on):a_mesh_program_run_as_compute_draws_what_the_mesh_pipeline_drawsmesh_fallback::tests::mesh_runs_in_one_list_…(passes)The 25 errors in the recorder test come from the test's own root signatures, not from
MeshRunas the runtime uses it:…HEAP_DIRECTLY_INDEXED" (the test never binds heaps);SetGraphicsRootShaderResourceView: the mesh buffer inNON_PIXEL_SHADER_RESOURCE(or| INDIRECT_ARGUMENT) "is invalid for use as a root shader resource", missingPIXEL_SHADER_RESOURCE;Dispatch/ExecuteIndirect: the buffer "is bound as DATA_STATIC_WHILE_SET_AT_EXECUTE … and had a change to a writable state" (the previous run's root SRV still points at it).The last two kinds exist because the harness (
emit::host) declares root descriptors withD3D12_ROOT_DESCRIPTOR_FLAG_NONE, which for an SRV means static-while-set-at-execute. The runtime's root signatures (pipeline/host.rs) declare themDATA_VOLATILE, so those checks should not fire there; I did not run the draw path under the layer to confirm. Suggestion: declare the test's root descriptorsDATA_VOLATILEand bind a heap, so this test can serve as a clean debug-layer check of the recorder.Suites on the merge (clean tree)
leonida-gpu --features diagnostics --libtimeline::report::tests::real_waits_are_recorded_with_who_ended_them("no entry found for key"), which passed 3/3 alone (timing under a loaded machine, not mesh code)LEONIDA_MESH_COMPUTE=1 LEONIDA_D3D12_DEBUG=1, cardLEONIDA_MESH_COMPUTE=1 LEONIDA_D3D12_DEBUG=1 LEONIDA_D3D12_WARP=1leonida-shader --lib--test-threads=2). A first run at the default thread count ended in an access violation (0xc0000005) after 142 tests, while other GPU jobs shared the machine; the PR's mesh tests had not run yet in it. It did not recur in one rerun at--test-threads=2; not rerun at the default count, not tried onmaincargo clippy --all-targets -p leonida-shader -p leonida-gpuNote on the forced runs: the counts match the unforced run, and I found no test in the
leonida-gpulib suite that reachesHostPipeline::mesh_computeordraw.rs'smesh_as_compute/mesh_indirect_as_compute(their only callers are the runtime's pipeline and draw paths), so the switch probably changes little there. The device coverage of the runtime side is theMeshRunrecorder test; the bind and root-argument steps indraw.rsaround it are covered only in game.Not checked: a card without mesh shaders, the game, a mesh program whose outputs pass 32 KiB (where the mesh path lowers the maxima and the fallback keeps them), stale primitives in a reused mesh buffer beyond the recorder test's culled run (the shader-crate comparison uploads a fresh buffer), the multi-record indirect case (left out by design), dispatches past 65,535 groups or past
groups_cap()beyond the existing sink test, and mesh programs reading group ids other than x.GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:27:12Z.
VERIFY-3128 — parcial, y el tamaño es la noticia: 9 commits, 31 ficheros, +2129
b3fd0c857head) —meshprograms, the fallback's shaders,emit::test_programs, …Ran at the head
That is what passed, and it is not enough to call this verified. A nine-commit branch that touches 31 files cannot be reviewed as one pull request, and the honest statement is: the mesh filter is green, and I have not read 2 129 added lines.
What I did read, from the commit messages, is the shape:
b3fd0c857— mesh programs run as compute keep the maxima underLEONIDA_MESH_COUNTS: a count cap, which is the kind of thing that either holds or silently drops the last workgroup.74ac98c64— the mesh fallback's shaders take main's sample-mask fields: a merge ofmain's change into a branch that had its own copy — the classic way for a stack to lose a fix.eab9c1e0f—emit::test_programs, built on every platform: a portability fix, which is what tonight's#3164was missing.And the process point, which is the same one I made in #2570 in the first hours: a branch that carries nine commits should be nine pull requests, or one pull request with
Depends on: #nfor each of the others. As it stands, a reviewer who says "no" to one commit says no to all nine, and the merge queue sees one 31-file item where it should see a stack.#3247 landed on
mainwhile I was writing this (d5b30be1c), andmainis still green (cargo test -p leonida-lua→ 47 passed) — so this branch's rebase is against a moving but healthy base.What I could not test
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T01:06:39Z.
RUN (in game, gate-style): head
32039d441merged alone withgit merge --no-ffontomainf3865cae8(no conflict). Built withdiagnostics,mimalloc, targetx86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). This card has mesh shaders, so the fallback only runs when forced withLEONIDA_MESH_COMPUTE=1; both were run with the same exe and the same save, each with a warm-up run first in a data folder of its own (the change touches the translator).Launcher defaults except
-PrecompileUsed(on thismainthe launcher's default precompiles every recorded pipeline, 88,671 here, which takes hours on a first start), Series S settings,-NoDlss -NoFrameGen, standing at the save, memory safety stop on, each run ended 330 s (default) or 300 s (fallback) after reaching the world:LEONIDA_MESH_COMPUTE=1mesh=true forced=false)mesh=true forced=true)Fallback forced on a card with mesh shaders: 90.8 ms vs 32.9 ms a frame (same exe, same save). The warm-ups gave the same picture (94.0 vs 38.7 ms), and with the fallback the frame stays at 90-95 ms in every minute in the world, so this is the cost of the path itself (the card is at 100 %), not compilation still going on. It is the fallback's price on a card that does not need it; on the cards it is meant for (no mesh shaders) the comparison is with a world that drew nothing.
The fallback draws. 834 mesh pipelines were made as a compute program and a triangle list in the measured run (822 in its warm-up), and none was refused: no "no host pipeline" line in either run. Window snapshots at 150, 250 and 350 s after the start (all in the world) show the same scene in both, all its geometry and characters present, with no empty screen and no broken or stretched triangles. The differences between the two are animation timing (moving characters are elsewhere at the same second) and a shadow on the left wall that shows in the three fallback snapshots and in none of the three default ones; another run of this
mainwithout the switch shows that same shadow at a later moment, so it looks like a scene shadow that comes and goes, but the timing was not matched to settle it. Frames saved by frame number (up to 4096 with the fallback) fall at different moments at 10 and 30 fps and were not compared.Warnings: the default run printed only kinds that a run of the same
mainwith nine other pull requests printed too, in about the same numbers. The fallback run printed one kind more, 4 times: "a placed texture view lies in the memory of a texture the host copied into: it is filled from title memory, which the copy never reached". It is absent from the default run, both warm-ups and the other batch. Both runs have the same 29 "creation method that is not implemented" lines asmain.Verdict: PASS. With the switch absent nothing changes on this card: mesh programs are not run as compute, and there is no new warning or failure. Forced on, the fallback draws the world correctly, with no device loss, crash or refused pipeline, at the cost given above. Not covered here: a card without mesh shaders (Pascal and older, the case it is for),
-RayTracing, DLSS and frame generation, Wine/Proton.AI-assisted: Claude Code (Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T01:23:01Z.
Review: COMMENTED
I checked
32039d441merged ontomainat1a163523. The unmodifiedas_compute_the_program_keeps_the_maximatest passes in the Windows MSVC build under Wine 11.22.I also ran a disposable probe that requires the DXIL validator from DXC 1.8.2505.1 to load. For 0, 1 and 3 requested primitives, the current compute DXIL was byte-identical with mesh counts on and off, and the validator accepted both forms. Making only the old counts-plan condition selectable in the probe reproduced
SetMeshOutputCountsandEmitIndicesrejection incs_6_6for all three counts. The PR's own regression test also failed with that condition restored.Merge-order detail for #3270: both changes merge textually, but their resulting catalog has 684 runtime rows and a 683-name header. The new
--checkcatches that combination. Regenerating on the combined tree updates the header to 684, refreshes theLEONIDA_FG_WITH_RTgenerated marker, and passes--checkand all 21 switch tests. These were synthetic checks. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T10:14:14Z.
RUN #3128 — in-game, 300 s walking in the world, RTX 4070 Laptop 8 GB
Verified by OreoFR
maind9b618f10. Head tested:879604d4d, merged--no-ffinto that main.build-nvidia.ps1).-SeriesS -NoDlss -NoFrameGen,LEONIDA_WINDOWS_BAR_MB=0,LEONIDA_TEXTURE_BUDGET_MB=1024.LEONIDA_MESH_COMPUTEwas unset, so the 4070 keeps its native mesh shaders. No mesh-fallback line appears in any log.Every row is the last 240 s in the world.
Stability: PASS.
Performance: slower with the PR, MEASURED n=2, PROVISIONAL.
leonida-shader/src/emit/*, which reach every card. This is a hypothesis and not bisected.Safe to merge into main? Not yet.
git merge-treeagainst current main: clean.879604d4d: all 6 jobs green.LEONIDA_MESH_COMPUTEunset, the 4070 still gets a different shader translation (it retranslates on first start), and it is about 9 % slower than main.A suggestion: keep the emitter output byte-identical when the fallback is off, then re-run the A/B. A per-commit bisect of the
emit/changes would also show which one costs the frames. I can run the A/B again on a new head.AI-assisted (oreofr-agent, Claude Code), run on OreoFR's machine.
Imported from ubiquitarianism/leonida. Originally posted by upipibi on 2026-12-03T17:12:55Z.
A run on a real card without mesh shaders: AMD Radeon RX 580 (Polaris; mesh shader tier 0, highest shader model 6.7, 64-lane waves), driver 31.0.21927.4000, Windows 11, in the same PC as an RTX 3070 (621.40). Head
879604d4das it is (it conflicts with currentmain), debug,--locked, synthetic tests only.leonida-gpuhonoursLEONIDA_ADAPTER.leonida-shader's testHostalways takes the high-performance adapter, so for these runs I patched it locally (not part of this PR) to take the cardLEONIDA_ADAPTERnames.cargo test -p leonida-shader --lib meshcargo test -p leonida-gpu --lib mesh_fallbackThe failure is
mesh_runs_in_one_list_draw_their_own_groups_and_the_strip_after_them_its_strip: "128 of 256 texels differ, first (0, 0): got [1, 1, 0, 1], wanted [0, 1, 0, 1]". Step 4, the counted indirect run with count 0, draws yellow over the whole left half. On this driver, a countedExecuteIndirectdispatch with a count of 0 still runs its record:WriteBufferImmediateinMARKER_OUTmode for the header still fails, 3 of 3.LEONIDA_D3D12_DEBUG=1) reports nothing.On such a card, then, a title's counted mesh dispatch whose count is 0 draws the record's groups anyway.
A workaround that passes on both cards: wrap the counted
ExecuteIndirectinMeshRun::indirectinSetPredication(count buffer, offset, D3D12_PREDICATION_OP_EQUAL_ZERO)and clear it after. That gave 3 of 3 passes on the RX 580 and 3 of 3 on the 3070, with the debug layer silent. It works only becauseMeshRun::indirectasks for at most one command. Predication reads 64 bits at an 8-byte-aligned offset, so a real version would first copy the title's count dword into a zeroed 8-byte slot of ours and predicate on that. I measured this with the test's count buffer only (padded zeros).For completeness, the whole suites on the RX 580 also fail tests that fail on
mainthere too:leonida-gpu:views_are_made_beside_the_heap_and_copied_in, the same as on #2995.leonida-shader: 7 device tests (pack, permlane,ds_min/max_f32, LDS subtracts, a whole-wave f64 sum, a partial dispatch), the same 7 onmain. All 7 are pipeline refusals ("The parameter is incorrect") of programs the translator declares withWaveSize(32)(emit/lower.rs:2595,:2773onmain717b90233), which a card with only 64-lane waves cannot make (this one reports lanes 64 to 64). That is outside this PR. But it means the fallback alone won't make pre-RDNA AMD cards (Polaris, Vega) run the title. Pascal-era NVIDIA cards, whose waves are 32 lanes, don't have this problem.Tested with the help of Claude Code (Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.