gpu: add D3D12 meshlet amplification and mesh shader pipeline with vertex fallback #2454

Merged
R0D4X merged 5 commits from upstream-pr/2462 into main 2026-11-26 07:11:01 +00:00
R0D4X commented 2026-11-25 17:22:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-25T17:22:54Z.


Change

Implements a self-contained Direct3D 12 / HLSL meshlet and amplification/mesh shader pipeline (as_6_5 + ms_6_5 + ps_6_0) with an automatic fallback to the classic Input-Assembler vertex pipeline (vs_6_0 + ps_6_0) when D3D12_MESH_SHADER_TIER_1 or Shader Model 6.5 is unavailable.

Architecture decisions

  • Meshlet builder (src/meshlet_builder.h, src/meshlet_builder.cpp):
    • Partitions indexed triangle geometry into meshlets bounded by kMaxMeshletVertices = 64 and kMaxMeshletPrimitives = 126 (hardware limits up to 256/256), deduplicating per-meshlet vertices into unique_vertex_indices and packing local triangle indices into 32-bit words (packed_primitives).
    • Computes per-meshlet MeshletBounds (48-byte GPU-aligned): bounding sphere (center, radius) and left-handed CW normal cone (cone_apex, cone_cutoff, cone_axis), disabling cone culling (cone_cutoff = 2.0f) when triangle normals oppose or span too wide a cone.
    • Preserves source_indices alongside meshlet buffers so the vertex fallback renders the exact same geometry without re-conversion.
  • HLSL shaders (src/shaders/meshlet_pipeline.hlsl):
    • ASMain (as_6_5, [numthreads(32, 1, 1)]) performs per-meshlet frustum sphere culling against 6 frustum planes and normal-cone backface culling, records statistics in g_cull_stats (u0), compacts visible meshlet IDs into a groupshared payload, and invokes DispatchMesh.
    • MSMain (ms_6_5, [outputtopology("triangle")], [numthreads(64, 1, 1)]) reads the compacted meshlet ID from the payload, calls SetMeshOutputCounts, transforms vertices via view_proj, and unpacks triangle indices.
    • VSMain (vs_6_0) and PSMain (ps_6_0) provide the matching classic vertex/pixel path sharing the same SceneConstants (b0) and MeshletVertex stride (48 bytes).
  • D3D12 pipeline & fallback (src/mesh_shader_pipeline.h, src/mesh_shader_pipeline.cpp):
    • query_mesh_shader_capabilities inspects D3D12_FEATURE_D3D12_OPTIONS7 (MeshShaderTier), D3D12_FEATURE_SHADER_MODEL (probing SM 6.5+), and ID3D12Device2.
    • Builds a D3D12_PIPELINE_STATE_STREAM_DESC stream (equivalent to D3DX12_MESH_SHADER_PIPELINE_STATE_DESC, with separate AS+MS+PS and MS+PS stream structs so an empty AS subobject is never passed) and dispatches via ID3D12GraphicsCommandList6::DispatchMesh.
    • Falls back cleanly to a D3D12_GRAPHICS_PIPELINE_STATE_DESC vertex pipeline (DrawIndexedInstanced with matching CULL_MODE_BACK, FrontCounterClockwise = FALSE, and LESS_EQUAL depth) in Auto mode when unsupported or when ForceVertexFallback is requested.

Verification

  • Commit: 56967492 (feat/mesh-shaders)
  • Environment: Windows 11 (10.0.26300.0), MSVC 19.44, DXC 1.9.2602.17, D3D12 debug layer enabled
    • Hardware GPU: NVIDIA GeForce RTX 5080 (vendor=10de device=2c02, driver 32.0.16.2124)
    • Software adapter: Microsoft Basic Render Driver (vendor=1414 device=008c, driver 10.0.26100.9818)

Commands and observed results:

.\tools\dev.ps1
cmake --preset dev
cmake --build --preset dev --target meshlet_builder_check offscreen_check
ctest --preset dev --no-tests=error -R "^(meshlet_builder|mesh_shader_pipeline_.*|offscreen_capability_table_self_test)$" -V
  • meshlet_builder: Passed (0.03s) — single triangle, multi-meshlet grid partitioning, double-sided cone disable, 4-meshlet culling scene, and negative controls.
  • offscreen_capability_table_self_test: Passed (0.03s).
  • mesh_shader_pipeline_hardware: Passed (0.42s) — mesh_shader_tier=10 shader_model=0x66 mode=mesh, cull_stats tested=4 frustum_culled=1 backface_culled=1 dispatched=2, fallback_parity=exact, debug_errors=0 debug_warnings=0.
  • mesh_shader_pipeline_fallback_hardware: Passed (0.23s) — mesh_shader_tier=10 mode=vertex_fallback, debug_errors=0 debug_warnings=0.
  • mesh_shader_pipeline_warp: Passed (0.05s) — mesh_shader_tier=10 shader_model=0x66 mode=mesh, cull_stats tested=4 frustum_culled=1 backface_culled=1 dispatched=2, fallback_parity=exact, debug_errors=0 debug_warnings=0.
  • mesh_shader_pipeline_fallback_warp: Passed (0.04s) — mesh_shader_tier=10 mode=vertex_fallback, debug_errors=0 debug_warnings=0.

Also verified existing mesh amplification and root signature tests after final edits:

ctest --preset dev --no-tests=error -R "^(mesh_amplified_draw_|desktop_root_signature)" -V
  • desktop_root_signature: Passed (0.02s).
  • mesh_amplified_draw_hardware: Passed (1.37s, debug_errors=0 debug_warnings=0).
  • mesh_amplified_draw_warp: Passed (0.43s, debug_errors=0 debug_warnings=0).

Evidence and follow-up

  • All fixtures and tests (tests/meshlet_builder_check.cpp, tests/mesh_shader_pipeline_draw.cpp) use original source-built synthetic geometry (build_culling_test_scene()) with 4 meshlets (2 visible front-facing quads, 1 back-facing quad, 1 frustum-culled quad).
  • Negative controls cover invalid builder inputs (std::invalid_argument on non-multiple-of-3 indices, out-of-range vertex index, invalid vertex/primitive limits) and pixel-level rejection of culled red/yellow meshlets on GPU readback.
  • On adapters with MeshShaderTier < 1, MeshShaderPipelineMode::Auto selects the classic vertex pipeline automatically; forced fallback parity is verified against the mesh shader output on both RTX 5080 and WARP.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted contribution.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6609913759 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2462). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-25T17:22:54Z. --- ## Change Implements a self-contained Direct3D 12 / HLSL meshlet and amplification/mesh shader pipeline (`as_6_5` + `ms_6_5` + `ps_6_0`) with an automatic fallback to the classic Input-Assembler vertex pipeline (`vs_6_0` + `ps_6_0`) when `D3D12_MESH_SHADER_TIER_1` or Shader Model 6.5 is unavailable. ### Architecture decisions - **Meshlet builder (`src/meshlet_builder.h`, `src/meshlet_builder.cpp`)**: - Partitions indexed triangle geometry into meshlets bounded by `kMaxMeshletVertices = 64` and `kMaxMeshletPrimitives = 126` (hardware limits up to 256/256), deduplicating per-meshlet vertices into `unique_vertex_indices` and packing local triangle indices into 32-bit words (`packed_primitives`). - Computes per-meshlet `MeshletBounds` (48-byte GPU-aligned): bounding sphere (`center`, `radius`) and left-handed CW normal cone (`cone_apex`, `cone_cutoff`, `cone_axis`), disabling cone culling (`cone_cutoff = 2.0f`) when triangle normals oppose or span too wide a cone. - Preserves `source_indices` alongside meshlet buffers so the vertex fallback renders the exact same geometry without re-conversion. - **HLSL shaders (`src/shaders/meshlet_pipeline.hlsl`)**: - `ASMain` (`as_6_5`, `[numthreads(32, 1, 1)]`) performs per-meshlet frustum sphere culling against 6 frustum planes and normal-cone backface culling, records statistics in `g_cull_stats` (`u0`), compacts visible meshlet IDs into a `groupshared` payload, and invokes `DispatchMesh`. - `MSMain` (`ms_6_5`, `[outputtopology("triangle")]`, `[numthreads(64, 1, 1)]`) reads the compacted meshlet ID from the payload, calls `SetMeshOutputCounts`, transforms vertices via `view_proj`, and unpacks triangle indices. - `VSMain` (`vs_6_0`) and `PSMain` (`ps_6_0`) provide the matching classic vertex/pixel path sharing the same `SceneConstants` (`b0`) and `MeshletVertex` stride (48 bytes). - **D3D12 pipeline & fallback (`src/mesh_shader_pipeline.h`, `src/mesh_shader_pipeline.cpp`)**: - `query_mesh_shader_capabilities` inspects `D3D12_FEATURE_D3D12_OPTIONS7` (`MeshShaderTier`), `D3D12_FEATURE_SHADER_MODEL` (probing SM 6.5+), and `ID3D12Device2`. - Builds a `D3D12_PIPELINE_STATE_STREAM_DESC` stream (equivalent to `D3DX12_MESH_SHADER_PIPELINE_STATE_DESC`, with separate `AS+MS+PS` and `MS+PS` stream structs so an empty AS subobject is never passed) and dispatches via `ID3D12GraphicsCommandList6::DispatchMesh`. - Falls back cleanly to a `D3D12_GRAPHICS_PIPELINE_STATE_DESC` vertex pipeline (`DrawIndexedInstanced` with matching `CULL_MODE_BACK`, `FrontCounterClockwise = FALSE`, and `LESS_EQUAL` depth) in `Auto` mode when unsupported or when `ForceVertexFallback` is requested. ## Verification - **Commit**: `56967492` (`feat/mesh-shaders`) - **Environment**: Windows 11 (`10.0.26300.0`), MSVC 19.44, DXC `1.9.2602.17`, D3D12 debug layer enabled - Hardware GPU: `NVIDIA GeForce RTX 5080` (`vendor=10de device=2c02`, driver `32.0.16.2124`) - Software adapter: `Microsoft Basic Render Driver` (`vendor=1414 device=008c`, driver `10.0.26100.9818`) Commands and observed results: ```powershell .\tools\dev.ps1 cmake --preset dev cmake --build --preset dev --target meshlet_builder_check offscreen_check ctest --preset dev --no-tests=error -R "^(meshlet_builder|mesh_shader_pipeline_.*|offscreen_capability_table_self_test)$" -V ``` - `meshlet_builder`: Passed (`0.03s`) — single triangle, multi-meshlet grid partitioning, double-sided cone disable, 4-meshlet culling scene, and negative controls. - `offscreen_capability_table_self_test`: Passed (`0.03s`). - `mesh_shader_pipeline_hardware`: Passed (`0.42s`) — `mesh_shader_tier=10 shader_model=0x66 mode=mesh`, `cull_stats tested=4 frustum_culled=1 backface_culled=1 dispatched=2`, `fallback_parity=exact`, `debug_errors=0 debug_warnings=0`. - `mesh_shader_pipeline_fallback_hardware`: Passed (`0.23s`) — `mesh_shader_tier=10 mode=vertex_fallback`, `debug_errors=0 debug_warnings=0`. - `mesh_shader_pipeline_warp`: Passed (`0.05s`) — `mesh_shader_tier=10 shader_model=0x66 mode=mesh`, `cull_stats tested=4 frustum_culled=1 backface_culled=1 dispatched=2`, `fallback_parity=exact`, `debug_errors=0 debug_warnings=0`. - `mesh_shader_pipeline_fallback_warp`: Passed (`0.04s`) — `mesh_shader_tier=10 mode=vertex_fallback`, `debug_errors=0 debug_warnings=0`. Also verified existing mesh amplification and root signature tests after final edits: ```powershell ctest --preset dev --no-tests=error -R "^(mesh_amplified_draw_|desktop_root_signature)" -V ``` - `desktop_root_signature`: Passed (`0.02s`). - `mesh_amplified_draw_hardware`: Passed (`1.37s`, `debug_errors=0 debug_warnings=0`). - `mesh_amplified_draw_warp`: Passed (`0.43s`, `debug_errors=0 debug_warnings=0`). ## Evidence and follow-up - All fixtures and tests (`tests/meshlet_builder_check.cpp`, `tests/mesh_shader_pipeline_draw.cpp`) use original source-built synthetic geometry (`build_culling_test_scene()`) with 4 meshlets (2 visible front-facing quads, 1 back-facing quad, 1 frustum-culled quad). - Negative controls cover invalid builder inputs (`std::invalid_argument` on non-multiple-of-3 indices, out-of-range vertex index, invalid vertex/primitive limits) and pixel-level rejection of culled red/yellow meshlets on GPU readback. - On adapters with `MeshShaderTier < 1`, `MeshShaderPipelineMode::Auto` selects the classic vertex pipeline automatically; forced fallback parity is verified against the mesh shader output on both RTX 5080 and WARP. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. *AI-assisted contribution.*
tedin7 commented 2026-11-25 20:04:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:17:07Z.

Review: COMMENTED


Review of head 56967492 (comment only, no merge).

Not mergeable by us yet

  • The branch is 40 commits behind main. The merge rule allows at most 20, so it needs update-branch and a fresh check first.
  • The change adds a new D3D12 mesh shader pipeline (about 1500 lines). No Win2025 run exists for this head. The PR body cites a local Windows 11 run with real GPU hardware, which we cannot reproduce.

What I checked

  • src/meshlet_builder.cpp plus tests/meshlet_builder_check.cpp build and pass on Linux with plain g++ (meshlet_builder_check: PASS).
  • python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py and git diff --check origin/main...HEAD are clean.
  • The HLSL (src/shaders/meshlet_pipeline.hlsl) reads correctly. DispatchMesh is called from all threads outside the cull branch. The payload slot count (32) matches the group size. The row-vector mul is the same in MSMain and VSMain.

Findings

  1. Weak guard on the cone math. I changed compute_bounds and the builder test still passed in both cases:
    • src/meshlet_builder.cpp (if (min_dot <= 0.1f)): changed the threshold to -2.0f.
    • src/meshlet_builder.cpp (result.cone_cutoff = std::sqrt(...)): replaced it with a constant 1.0f.
      tests/meshlet_builder_check.cpp only asserts that opposing normals give cone_cutoff > 1.0f (line 138). Please add a case with a known flat patch where the expected cone_cutoff and apex are computed by hand. Also add a case where a meshlet just over the threshold must stay culled or kept.
  2. Builder and shader limits disagree. build_meshlets accepts max_vertices and max_primitives up to 256. MSMain declares verts[64] and tris[126], and numthreads(64). Any caller using more than 64 vertices or 126 primitives would overrun the output arrays. Please clamp the public limits to 64/126, or document and assert it in mesh_shader_pipeline.cpp.
  3. tests/mesh_shader_pipeline_draw.cpp does check GPU pixels against the vertex fallback and checks the cull stats ({4,1,1,2}). I could not run it here. A Win2025 WARP run is still needed to confirm WARP supports mesh shader tier 1 and that the test skips cleanly when it does not.

Merge
This is shared GPU runtime code and is not tied to a game startup claim. Once findings 1 and 2 are addressed and the branch is updated, it can be re-reviewed and run on Win2025. I did not merge.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6063559029 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2462#pullrequestreview-6063559029). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T19:17:07Z. **Review:** COMMENTED --- Review of head `56967492` (comment only, no merge). **Not mergeable by us yet** - The branch is 40 commits behind main. The merge rule allows at most 20, so it needs `update-branch` and a fresh check first. - The change adds a new D3D12 mesh shader pipeline (about 1500 lines). No Win2025 run exists for this head. The PR body cites a local Windows 11 run with real GPU hardware, which we cannot reproduce. **What I checked** - `src/meshlet_builder.cpp` plus `tests/meshlet_builder_check.cpp` build and pass on Linux with plain g++ (`meshlet_builder_check: PASS`). - `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py` and `git diff --check origin/main...HEAD` are clean. - The HLSL (`src/shaders/meshlet_pipeline.hlsl`) reads correctly. `DispatchMesh` is called from all threads outside the cull branch. The payload slot count (32) matches the group size. The row-vector `mul` is the same in `MSMain` and `VSMain`. **Findings** 1. Weak guard on the cone math. I changed `compute_bounds` and the builder test still passed in both cases: - `src/meshlet_builder.cpp` (`if (min_dot <= 0.1f)`): changed the threshold to `-2.0f`. - `src/meshlet_builder.cpp` (`result.cone_cutoff = std::sqrt(...)`): replaced it with a constant `1.0f`. `tests/meshlet_builder_check.cpp` only asserts that opposing normals give `cone_cutoff > 1.0f` (line 138). Please add a case with a known flat patch where the expected `cone_cutoff` and apex are computed by hand. Also add a case where a meshlet just over the threshold must stay culled or kept. 2. Builder and shader limits disagree. `build_meshlets` accepts `max_vertices` and `max_primitives` up to 256. `MSMain` declares `verts[64]` and `tris[126]`, and `numthreads(64)`. Any caller using more than 64 vertices or 126 primitives would overrun the output arrays. Please clamp the public limits to 64/126, or document and assert it in `mesh_shader_pipeline.cpp`. 3. `tests/mesh_shader_pipeline_draw.cpp` does check GPU pixels against the vertex fallback and checks the cull stats (`{4,1,1,2}`). I could not run it here. A Win2025 WARP run is still needed to confirm WARP supports mesh shader tier 1 and that the test skips cleanly when it does not. **Merge** This is shared GPU runtime code and is not tied to a game startup claim. Once findings 1 and 2 are addressed and the branch is updated, it can be re-reviewed and run on Win2025. I did not merge. AI-assisted; commands listed were executed locally.
ChazY11 commented 2026-11-25 20:04:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T19:34:28Z.


Built and run here: 5/5 pass on WARP and a physical GPU, and the five mutations split along the builder-versus-pipeline line

ctest --preset dev -R 'meshlet_builder|mesh_shader_pipeline'
    1/5 Test #309: meshlet_builder ..........................  Passed
    2/5 Test #567: mesh_shader_pipeline_hardware ............  Passed
    3/5 Test #568: mesh_shader_pipeline_fallback_hardware ...  Passed
    4/5 Test #569: mesh_shader_pipeline_warp ................  Passed
    5/5 Test #570: mesh_shader_pipeline_fallback_warp .......  Passed
    100% tests passed, 0 tests failed out of 5

The four pipeline cases are worth what they cost: the same work on hardware and on WARP, each with and without the
fallback path, so an amplification-shader/draw-shader pair is exercised on two implementations. meshlet_builder is
the CPU side and runs device-free.

Built with cmake --build --preset dev --target meshlet_builder_check and … --target offscreen_check; the pipeline
cases drive offscreen_check.exe <adapter> --mesh-shader-pipeline, not a separate executable, which is worth knowing
before hunting for a mesh_shader_pipeline_draw target that does not exist.

Five mutations of src/meshlet_builder.cpp

mutation result
default cone cutoff 2.0f → 1.0f (enables backface cone culling by default) caught
degenerate cone-axis refusal removed (planes.empty() || !normalize(…) → false) caught
degenerate-triangle epsilon 1e-12f → 1e-30f survived
zero-vertex early return disabled survived
cone rejection threshold min_dot <= 0.1f → -0.1f survived

The two caught ones are the ones a reader would most want pinned. cone_cutoff = 2.0f with the comment "> 1.0
disables backface cone culling by default" is a deliberate, non-obvious default — flipping it to 1.0f silently culls
backfacing cones, and the fixture notices. And dropping the degenerate-axis refusal means a meshlet is emitted with a
cone axis that was never normalised, which the fixture also notices.

The three survivors, each with the input it would need

  • 1e-12f epsilon. Reached only by a triangle whose cross product is near zero. The fixture's shapes are
    non-degenerate, so a threshold change from 1e-12 to 1e-30 cannot change any verdict it takes. A single
    degenerate triangle (three collinear vertices) would pin it, and that is the case the guard exists for.
  • vertex_count == 0. No meshlet in the fixture has zero vertices. Whether the early return is load-bearing is
    the interesting part: without it the loops do not run, and control falls through to the cone computation, where
    planes.empty() would refuse — so the two paths may well differ in the returned cone, not just in speed. Worth an
    explicit case either way.
  • min_dot <= 0.1f. The threshold decides when a cone is too wide to be worth culling. No fixture meshlet lands in
    the band (-0.1, 0.1], so widening the acceptance is invisible. A meshlet whose triangles sweep most of a
    hemisphere would pin it.

None of the three is a defect I can demonstrate: both guards read correctly, and each simply has no input whose
behaviour would change if it were removed or loosened. All three are cheap CPU-side cases in a device-free test.

One measurement I could not make

offscreen_check.exe in this repository is a shared harness — tests/offscreen_check.cpp gains 12 lines in this PR to
add the pipeline mode. So the pipeline cases assert whatever that mode asserts, which I ran but did not read closely.
If the mode's assertions are "the draw produced a non-empty image" rather than "these pixels", say so and I will read
that file rather than infer from the pass.

Environment

Windows 11 build 26300.9974; adapters: the installed physical GPU and Microsoft Basic Render Driver (WARP); the
fallback cases run the same work without the amplification path. Each mutation was built, run, reverted and rebuilt;
final state 5/5 green.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7172484613 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2462#issuecomment-7172484613). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T19:34:28Z. --- ## Built and run here: 5/5 pass on WARP and a physical GPU, and the five mutations split along the builder-versus-pipeline line ```text ctest --preset dev -R 'meshlet_builder|mesh_shader_pipeline' 1/5 Test #309: meshlet_builder .......................... Passed 2/5 Test #567: mesh_shader_pipeline_hardware ............ Passed 3/5 Test #568: mesh_shader_pipeline_fallback_hardware ... Passed 4/5 Test #569: mesh_shader_pipeline_warp ................ Passed 5/5 Test #570: mesh_shader_pipeline_fallback_warp ....... Passed 100% tests passed, 0 tests failed out of 5 ``` The four pipeline cases are worth what they cost: the same work on hardware and on WARP, each with and without the fallback path, so an amplification-shader/draw-shader pair is exercised on two implementations. `meshlet_builder` is the CPU side and runs device-free. Built with `cmake --build --preset dev --target meshlet_builder_check` and `… --target offscreen_check`; the pipeline cases drive `offscreen_check.exe <adapter> --mesh-shader-pipeline`, not a separate executable, which is worth knowing before hunting for a `mesh_shader_pipeline_draw` target that does not exist. ## Five mutations of `src/meshlet_builder.cpp` | mutation | result | |---|---| | default cone cutoff `2.0f` → `1.0f` (enables backface cone culling by default) | **caught** | | degenerate cone-axis refusal removed (`planes.empty() \|\| !normalize(…)` → `false`) | **caught** | | degenerate-triangle epsilon `1e-12f` → `1e-30f` | survived | | zero-vertex early return disabled | survived | | cone rejection threshold `min_dot <= 0.1f` → `-0.1f` | survived | The two caught ones are the ones a reader would most want pinned. `cone_cutoff = 2.0f` with the comment "> 1.0 disables backface cone culling by default" is a deliberate, non-obvious default — flipping it to `1.0f` silently culls backfacing cones, and the fixture notices. And dropping the degenerate-axis refusal means a meshlet is emitted with a cone axis that was never normalised, which the fixture also notices. ## The three survivors, each with the input it would need - **`1e-12f` epsilon.** Reached only by a triangle whose cross product is near zero. The fixture's shapes are non-degenerate, so a threshold change from `1e-12` to `1e-30` cannot change any verdict it takes. A single degenerate triangle (three collinear vertices) would pin it, and that is the case the guard exists for. - **`vertex_count == 0`.** No meshlet in the fixture has zero vertices. Whether the early return is load-bearing is the interesting part: without it the loops do not run, and control falls through to the cone computation, where `planes.empty()` would refuse — so the two paths may well differ in the returned cone, not just in speed. Worth an explicit case either way. - **`min_dot <= 0.1f`.** The threshold decides when a cone is too wide to be worth culling. No fixture meshlet lands in the band `(-0.1, 0.1]`, so widening the acceptance is invisible. A meshlet whose triangles sweep most of a hemisphere would pin it. None of the three is a defect I can demonstrate: both guards read correctly, and each simply has no input whose behaviour would change if it were removed or loosened. All three are cheap CPU-side cases in a device-free test. ## One measurement I could not make `offscreen_check.exe` in this repository is a shared harness — `tests/offscreen_check.cpp` gains 12 lines in this PR to add the pipeline mode. So the pipeline cases assert whatever that mode asserts, which I ran but did not read closely. If the mode's assertions are "the draw produced a non-empty image" rather than "these pixels", say so and I will read that file rather than infer from the pass. ## Environment Windows 11 build 26300.9974; adapters: the installed physical GPU and Microsoft Basic Render Driver (WARP); the `fallback` cases run the same work without the amplification path. Each mutation was built, run, reverted and rebuilt; final state 5/5 green. AI-assisted.
Makto94 commented 2026-11-25 21:01:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T20:37:30Z.


Hardware run at head 56967492. The branch is behind main; this run tests the head as it stands, without a merge. This adds the adapter, driver and printed values to the earlier 5/5 report on this head.

Environment: NVIDIA GeForce RTX 3070 Ti (vendor=10de device=2482), driver 32.0.16.2101 (NVIDIA 621.01), Windows 11 Pro build 26300.9974, dev preset (MSVC). The runs were serial (-j1). Every offscreen test prints debug_layer=enabled and debug_errors=0 debug_warnings=0.

Command: ctest --preset dev --no-tests=error -j1 -V -R 'meshlet_builder|mesh_shader_pipeline'

Result: 5/5 passed, 0 failed. By suffix: 2 _hardware, 2 _warp, 1 other (meshlet_builder, CPU only: meshlet_builder_check: PASS). 0 capability skips (77).

mesh_shader_pipeline_hardware (test 567):

  • mesh_shader_tier=10 shader_model=0x66 mode=mesh
  • cull_stats tested=4 frustum_culled=1 backface_culled=1 dispatched=2
  • fallback_parity=exact

mesh_shader_pipeline_fallback_hardware (568) prints mesh_shader_tier=10 mode=vertex_fallback.

WARP (Microsoft Basic Render Driver, 1414:008c, driver 10.0.26100.9818) prints the same mode, cull_stats and fallback_parity values.

Not covered by this run: AMD, and any test outside the filter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7173945610 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2462#issuecomment-7173945610). Originally posted by [Makto94](https://github.com/Makto94) on 2026-11-25T20:37:30Z. --- Hardware run at head `56967492`. The branch is behind `main`; this run tests the head as it stands, without a merge. This adds the adapter, driver and printed values to the earlier 5/5 report on this head. Environment: NVIDIA GeForce RTX 3070 Ti (`vendor=10de device=2482`), driver 32.0.16.2101 (NVIDIA 621.01), Windows 11 Pro build 26300.9974, `dev` preset (MSVC). The runs were serial (`-j1`). Every offscreen test prints `debug_layer=enabled` and `debug_errors=0 debug_warnings=0`. Command: `ctest --preset dev --no-tests=error -j1 -V -R 'meshlet_builder|mesh_shader_pipeline'` Result: 5/5 passed, 0 failed. By suffix: 2 `_hardware`, 2 `_warp`, 1 other (`meshlet_builder`, CPU only: `meshlet_builder_check: PASS`). 0 capability skips (77). `mesh_shader_pipeline_hardware` (test 567): - `mesh_shader_tier=10 shader_model=0x66 mode=mesh` - `cull_stats tested=4 frustum_culled=1 backface_culled=1 dispatched=2` - `fallback_parity=exact` `mesh_shader_pipeline_fallback_hardware` (568) prints `mesh_shader_tier=10 mode=vertex_fallback`. WARP (`Microsoft Basic Render Driver`, `1414:008c`, driver 10.0.26100.9818) prints the same `mode`, `cull_stats` and `fallback_parity` values. Not covered by this run: AMD, and any test outside the filter above.
tedin7 commented 2026-11-26 03:03:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:06:53Z.


Pushed 1be1f6ffe to this branch: a merge of current main (no rebase) plus one test commit.

What I added, answering the weak cone-test point: tests/meshlet_builder_check.cpp now has two cases.

  • Cone width: a moderate cone (half angle 60 deg) keeps cutoff = sin(60 deg), a wide cone (87 deg) disables culling, and a cone at 80 deg still culls. This pins the min_dot <= 0.1f threshold.
  • Sliver triangle: a near-degenerate triangle wound the other way must not enter the cone. This pins the 1e-12f guard.

Mutations (each makes the new test fail; the previous test still passed -0.1f):

  • min_dot <= 0.1f -> -0.1f or 0.5f
  • len_sq <= 1e-12f -> 1e-30f

The vertex_count == 0 early return is not reachable through build_meshlets (a meshlet is only flushed with at least one primitive), so I did not add a case for it.

Verification:

  • Linux: g++ -std=c++17 -Isrc tests/meshlet_builder_check.cpp src/meshlet_builder.cpp -> PASS; the three mutations above -> FAIL as listed.
  • Win2025 (WARP, Windows Server 2025 build 26100), with the test commit applied on 56967492: ctest --preset dev -R 'meshlet_builder|mesh_shader_pipeline' 5/5 passed; ctest --preset release same selection 5/5 passed.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7180473145 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2462#issuecomment-7180473145). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T02:06:53Z. --- Pushed `1be1f6ffe` to this branch: a merge of current `main` (no rebase) plus one test commit. What I added, answering the weak cone-test point: `tests/meshlet_builder_check.cpp` now has two cases. - Cone width: a moderate cone (half angle 60 deg) keeps `cutoff = sin(60 deg)`, a wide cone (87 deg) disables culling, and a cone at 80 deg still culls. This pins the `min_dot <= 0.1f` threshold. - Sliver triangle: a near-degenerate triangle wound the other way must not enter the cone. This pins the `1e-12f` guard. Mutations (each makes the new test fail; the previous test still passed `-0.1f`): - `min_dot <= 0.1f` -> `-0.1f` or `0.5f` - `len_sq <= 1e-12f` -> `1e-30f` The `vertex_count == 0` early return is not reachable through `build_meshlets` (a meshlet is only flushed with at least one primitive), so I did not add a case for it. Verification: - Linux: `g++ -std=c++17 -Isrc tests/meshlet_builder_check.cpp src/meshlet_builder.cpp` -> PASS; the three mutations above -> FAIL as listed. - Win2025 (WARP, Windows Server 2025 build 26100), with the test commit applied on `56967492`: `ctest --preset dev -R 'meshlet_builder|mesh_shader_pipeline'` 5/5 passed; `ctest --preset release` same selection 5/5 passed. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 08:01:42 +00:00
R0Y00 commented 2026-11-26 08:01:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T07:06:26Z.

Review: APPROVED


Fixed the shader capacity mismatch identified in the earlier review. The general builder can make wider meshlets, but GPU upload on the mesh path now refuses more than 64 vertices or 126 primitives. Before the fix the new valid-input control exposed the issue on both WARP and RTX 4060 Laptop. With the fix, all 8 Windows Release CTests passed serially, including cone width and sliver coverage, mesh and vertex fallback on both adapters, and the adjacent amplification tests. Zero skips and no debug-layer warnings or errors.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069833224 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2462#pullrequestreview-6069833224). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T07:06:26Z. **Review:** APPROVED --- Fixed the shader capacity mismatch identified in the earlier review. The general builder can make wider meshlets, but GPU upload on the mesh path now refuses more than 64 vertices or 126 primitives. Before the fix the new valid-input control exposed the issue on both WARP and RTX 4060 Laptop. With the fix, all 8 Windows Release CTests passed serially, including cone width and sliver coverage, mesh and vertex fallback on both adapters, and the adjacent amplification tests. Zero skips and no debug-layer warnings or errors.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
R0Y00/Xbox2Windows!2454
No description provided.