Repository navigation
ms_pass: one real drawable through its own translated game mesh shader, checked against the CPU (TEST-362) - #4815
lunarminus wants to merge 7 commits into
Conversation
Based on ItsNotRexed#4770's 1fc8fc7 by @illusionart453-max (commit retained). - VKH_COVERAGE_MASK reads a stencil mask, so a fragment writing (-1,-1,-1,-1) is still covered; ps_coverage_clear regression. - CPU projection snaps vertices to the 8-bit subpixel grid, ties to even; Kev-Ball 4.5009765625 and CuteBooty half-tie cases. - Coverage and raw readbacks are streamed; CPU mask is a bytearray. 512x512 peak 591,276 bytes traced. - ms_coverage fetches six synthetic vertices through a 4-dword V# at 0x1000 and samples an 8-dword T# at 0x100; 52x52 mask, IoU 1.0 on RTX 3060 / NVIDIA 617.14 / Vulkan 1.4.351. - Docs describe the no-game fixture and leave the game-drawable pass chain as the coordinator's follow-up. AI-assisted.
|
Both documented poses reproduce on an RTX 3080 Ti, NVIDIA 620.73.04, CachyOS, at
All three negative controls failed at both poses as expected. The displaced meshlet descriptor drew zero pixels. One portability detail for interpreting these passes: This measures the real mesh shader and drawable with the constant-colour PS. Aggregate results only. AI-assisted. |
whattheflop
left a comment
There was a problem hiding this comment.
Independent Windows CPU review, AI-assisted, using uv CPython 3.12.13 and synthetic inputs. The CPU projection and independently decoded packed float32 matrix agreed across 135 points per path. Two stubbed draws verified descriptor slots, heap bytes and child-process settings; the independent 811-pixel frame rechecked at IoU 1.0.
Two scope issues for the result:
- A synthetic two-geometry export listed 8 vertices and 4 triangles, but the drawable loader returned only the first geometry (4 vertices and 2 triangles), and a stubbed
--runcould report a pass for that subset. Please filter or reject multi-geometry candidates, or name the tested geometry and counts in the result. - With a front-facing square, a 128×128 target projects to 51.269×51.269 pixels, while 192×96 projects to 76.903×38.451. The packed matrix and CPU reference share the stretch, so IoU alone does not expose it. Apply the viewport aspect in the projection or document the behavior for rectangular targets.
One wording detail: the documented exact color check currently accepts absolute per-channel differences up to 1e-6. A one-pixel synthetic recheck with green 0.5000004768371582 in place of 0.5 exits 0. No GPU or game data was used for this review.
|
Following up on the question about reusing #4809: I’d use its snapped CPU rasterizer and stencil readback for coverage, and keep this PR’s colour and silhouette checks. #4809 (
I tried the combination locally: use the nonzero indices of #4809’s These were hand-built vertex/fragment draws testing the saved-draw checker and shared rasterizer. No game files or mesh-shader execution. AI-assisted. Retest at |
|
@Kev-Ball thank you, that was a real gap. Fixed in
Your run already showed native-at-32 and emulated give the same frame on NVIDIA. On the 760M, native-at-64 and emulated are byte-identical in both poses too, all exact, and the controls fail in both modes. One more harness detail I noticed: AI-assisted (Claude Code). |
|
Tested AI-assisted (Devin); no game files. |
|
Confirmed the subgroup fix at |
…r, checked against the CPU (TEST-362) tools/ms_pass.py reads one static drawable raw from the user's data.rpf (its 42 40 vertex block and meshlet group, unchanged), places it in the vk_harness heap next to a hand-built s17 table of raw V#s, an identity object matrix and a view-projection, and draws it with the game's position-only meshlet mesh shader (VKH_MESH) and a constant-colour fixture pixel shader. The covered pixels are compared with the same triangles projected and rasterised on the CPU: IoU, missing/extra, and every mismatch away from a silhouette edge. --controls runs three negative controls that must fail. Measured on a Radeon 760M (RADV 26.3.1): IoU 1.0000 with 0 mismatches in two oblique poses; the controls (CPU camera 3 degrees off, swapped axes, V# in the wrong slot) all fail. tests/test_ms_pass.py covers everything but the draw on synthetic inputs; with LEONIDA_MS_PASS_DIR it re-checks a real draw. docs/ms_pass.md records the tables, the check, the results and the limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzPoR7BgcXfXLLrqxDrn7Y
…t the mode The mesh shader is wave64. vk_harness prints nothing when a required mesh subgroup size takes effect and carries on without it when it is unavailable, so on a 32-wide GPU the draw ran with a native wave64 module at the wrong size and still looked like a pass (reported by Kev-Ball on an RTX 3080 Ti). --wave64-emulate auto (the default) now asks tools/vk_subgroup_info.py, as make_game.py does, and translates with --wave64-emulate where the GPU can't require 64-wide mesh subgroups; on/off force it. An emulated draw requests no subgroup size. A native draw whose size the harness reports as not available fails. The mode is printed with the result and recorded in manifest.json. On the Radeon 760M native and emulated frames are byte-identical in both poses, all exact, with the controls failing in both modes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzPoR7BgcXfXLLrqxDrn7Y
…iser); NaN is a wrong colour PingasMech found two faults in the saved-draw check (ItsNotRexed#4815): an unsnapped CPU rasteriser fails correct draws whose edges sit between two 1/256-pixel steps (IoU 0.79 on a 16x16 draw), and a NaN channel passed the colour test because abs(NaN - x) > 1e-6 is false. The branch now sits on ItsNotRexed#4809. GPU coverage is vk_harness's VKH_COVERAGE_MASK stencil readback, so a covered pixel counts whatever its colour. CPU coverage is mesh_pass_coverage.rasterize with the vertices snapped to the subpixel grid (--subpixel-bits, default 8, recorded in manifest.json). The silhouette band, the colour check (math.isclose, so NaN fails) and the negative controls stay in ms_pass. On the Radeon 760M the real draw is still exact in both poses, natively and emulated, and the three controls still fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzPoR7BgcXfXLLrqxDrn7Y
0f7d631 to
7b72608
Compare
kacper-serewis
left a comment
There was a problem hiding this comment.
Independent AI-assisted CPU review at 0f7d631 found two synthetic false passes in tools/ms_pass.py. At line 299, distance to the extended edge line admits an extra pixel about 9.88 pixels from the nearest finite segment. On a 64×64 mask with triangle (4,4),(20,4),(60,60), adding pixel (32,4) yielded extra=1 and off_edge=0. Clamp the projection to the segment. At line 318 an otherwise exact single-pixel frame accepted NaN and the next float32 above 1.0 for the expected red component. Check exact finite component equality for the documented exact-color contract. Please add regressions for both. Existing suite: 21 passed, one skipped. No GPU or retail input used.
|
@PingasMech thanks, both were real faults. Fixed in
AI-assisted (Claude Code). |
whattheflop
left a comment
There was a problem hiding this comment.
Independent Windows CPU follow-up, AI-assisted. I exercised 16 synthetic mode cases at 0f7d6310 with uv CPython 3.12.13 and mocked processes (14 expected draw calls, two expected refusals). The mode-selection code is unchanged at 7b72608d.
There is one remaining forced-native case. If 64 is in range and subgroup size control is enabled, but requiredSubgroupSizeStages excludes mesh, the harness omits the request without printing the diagnostic ms_pass.py checks. A source-derived mock of that branch lets forced-off mode complete and record “native wave64 (required subgroup 64)” without guaranteeing the requested size. Report the stage-mask rejection through the same diagnostic, or require a positive confirmation before recording a forced size. This is separate from the out-of-range 32..32 case already verified on the RTX 3080 Ti.
With no harness capability report and a vulkaninfo subgroup size of 64, make_game.py falls back to native and ms_pass.py conservatively emulates. It would help to document that difference if intentional. No GPU or game inputs were used here.
kacper-serewis
left a comment
There was a problem hiding this comment.
Rechecked 7b72608 on CPU. NaN now correctly increments wrong_colour. Adjacent float32 values pass as documented by the revised 1e-6 tolerance; that is consistent with the current contract. One geometric false pass remains: triangle (2,2),(22,2),(60,60) plus extra pixel (39,2) yields extra=1, off_edge=0, IoU 0.99836. The center is 17.5 pixels past the horizontal segment endpoint. Please measure finite-segment distance. Focused suites: 28 passed, one optional draw skipped. AI-assisted.
… line kacper-serewis found (ItsNotRexed#4816) that the band let an extra pixel 9.88 pixels from the nearest edge segment pass: it measured the distance to the edge's infinite line and bounded the other side with a ratio, not a distance, so pixels near the line's extension past a vertex were excused. The band is now every pixel whose centre is within one pixel of a silhouette edge segment (point to segment distance), and triangles with no area add nothing to it. New tests: an extra pixel about 10 px beyond a sliver's tip on its edge's line fails, and segment_distance on and off the segment and for a zero-length edge. The NaN/inexact colour half of the same finding was fixed in 7b72608 (math.isclose on every stencil- covered pixel). On the Radeon 760M the real draw is unchanged: exact in both poses, controls failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzPoR7BgcXfXLLrqxDrn7Y
|
@kacper-serewis thanks for the review (#4816). Both halves are addressed:
AI-assisted (Claude Code). |
kacper-serewis
left a comment
There was a problem hiding this comment.
Confirmed the finite-segment fix at c6e8be7. Our extra pixel now counts as one off-edge error and fails at IoU 0.998358. Across 608 covered pixels a +0.9e-6 color difference passes; +1.1e-6 and NaN both fail. CPU suite: 25 passed, one optional draw skipped. No RTX dispatch was made because the matching translated index was absent from the cache. AI-assisted.
kacper-serewis
left a comment
There was a problem hiding this comment.
TEST-1084 / TEST-362 RTX check at c6e8be7, Windows driver 616.56. Rebuilt the private index and validated its module. With wave64 emulation, GPU and CPU coverage matched exactly at both poses (1,457 and 1,131 pixels), IoU 1, zero wrong-color pixels. All three negative controls failed at both poses. One retail drawable, one meshlet, constant-color fixture pixel shader. AI-assisted.
kacper-serewis
left a comment
There was a problem hiding this comment.
TEST-362: independently verified the finite-segment and colour tolerance fixes on this head. Native Windows RTX 5070 (616.56) matched all 1,457 and 1,131 covered pixels at the two poses, with zero wrong colours. All camera, axis, and meshlet descriptor controls failed as expected. Scope is one drawable and meshlet with a fixture pixel shader. AI-assisted.
|
FAIL, reproduced against main 3faac55: the tree merges cleanly and test_ms_pass.py (26, 1 env skip) and test_mesh_pass_coverage.py (5) pass, but python -I tests/test_run_gpu_tests.py fails with 1 error where main is green — the tuple-valued DRAWN_WITH["ms_coverage"] entry (in the stacked base commit d0b5d21, which is still-open #4809's head) reaches the splitext consumer at scripts/run_gpu_tests.py:1485, which only with_draw_shaders was adapted for. Same TypeError here and at #4809 head; fixing it in one branch and rebasing the other is the cheap path, since #4815 contains #4809's commits. Minor: the ms_coverage.triangles.json write at run_gpu_tests.py:118 should pin newline="\n" like its neighbour at :156. No CI checks on the branch, which is why the red is invisible. GPU-side pieces not runnable here; fixtures are hand-written listings. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
…s DRAWN_WITH has one (stacked fix) ItsNotRexed#4809 made DRAWN_WITH["ms_coverage"] a tuple; with_draw_shaders handles that, but the partners set of an inputs-only --filter (scripts/run_gpu_tests.py) and test_every_shader_named_exists (tests/test_run_gpu_tests_paths.py) still take one file name, so tests/test_run_gpu_tests.py and tests/test_run_gpu_tests_paths.py each fail with a TypeError (found by memorypressure on ItsNotRexed#4815). Both now iterate a tuple. The same diff is offered on ItsNotRexed#4809; this commit goes away when that branch has it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzPoR7BgcXfXLLrqxDrn7Y
|
@memorypressure thanks, confirmed. The error comes from #4809's tuple-valued Fixed on top here in Results now:
I've left the AI-assisted (Claude Code). |
Item: TEST-362, the game-drawable slice (claim: #4683 (comment); status with the first numbers: #4683 (comment)).
Depends on: #4809. This branch is stacked on #4809 (its two commits are the first two here), and coverage comes from it: the GPU side is the
VKH_COVERAGE_MASKstencil readback, and the CPU side ismesh_pass_coverage.rasterizewith vertices snapped to the subpixel grid. This PR adds the real drawable, the tables, the colour and silhouette checks and the controls. Review only thems_passcommits; they rebase off once #4809 lands.What and why
#1889 suggested checking a translated shader on real data before the runtime can draw: run one pass alone with hand-built descriptor tables and compare its coverage with the same mesh projected on the CPU. First Light already does this for a VS/PS pair. Nothing did it for a mesh shader, and 9,282 of the corpus's shaders are mesh shaders.
tools/ms_pass.pydraws one real static drawable from the user's owndata.rpfwith its own translated game mesh shader onvk_harness, usingVKH_MESH. The steps:meshlet_page.drawable_geometries/draw_bindingas the existing tools. The42 40vertex block and the meshlet group go into the heap unchanged.SHADERS), and no other shader is accepted.meshlet_page.group_triangles,positions_4240), projected in double precision and rasterised by TEST-362: mesh pass coverage comparator fixes + synthetic MS/PS acceptance slice #4809 with an 8-bit subpixel snap. Every covered pixel must hold the fixture colour (math.isclose; a NaN is wrong). The pass rule: IoU ≥ 0.99, every covered pixel the exact colour, and no mismatch more than about a pixel from a silhouette edge.--controlsadds three negative controls that must fail.Measured
AMD Radeon 760M (RDNA3 iGPU, gfx1103), RADV Mesa 26.3.1, CachyOS Linux. Test programs built from
maind0835dd9; the shader is translated by this branch's translator at98fa503f. The drawable is a 24-vertex, 12-triangle, 1-meshletstandardprop from my own 1.0.2.1data.rpf, identified by counts and its export's SHA-256 indocs/ms_pass.md.Tested
Comparator (since
7b72608d, after PingasMech's review): stacked on TEST-362: mesh pass coverage comparator fixes + synthetic MS/PS acceptance slice #4809. The real draw is still exact in both poses, natively and emulated, and the controls still fail. Tests: 24 OK (1 skipped without a draw); the real-draw re-check passes;tests/test_mesh_pass_coverage.py: OK.Subgroup mode (since
0f7d6310, after Kev-Ball's RTX 3080 Ti run):--wave64-emulate autotranslates natively only where the GPU can require 64-wide mesh subgroups (vk_subgroup_info.pynative64, asmake_game.pydoes). The mode is printed with the result and kept inmanifest.json. On the 760M, native and emulated frames are byte-identical in both poses.python -I tests/test_ms_pass.py: 20 tests OK, 1 skipped without a draw. WithLEONIDA_MS_PASS_DIRon either real draw: OK, 0 skipped.VKH_HEAPround trip and size bound, the SGPRs, the camera (framing, up = up, clipped poses refused), the view-projection order, the rasteriser (both windings, shared vs silhouette edges, degenerate and off-screen triangles), the comparison (exact, edge-only and interior mismatches, shifted, empty, full, wrong colour, wrong raw size) and the zlib chain reader (16-byte boundaries, output cap).python -m compileall -q make_game.py tools tests: clean.tests/test_docs_*.py,test_tool_stdout_encoding.py,test_tool_startup.py,test_runner_calls_all_tests.py: OK.git diff --check: clean.Limits (also in
docs/ms_pass.md§6)vk_harnessdraws one mesh workgroup, so aVKH_MESH_GROUPSknob is the next step. With it, the 3-meshlet drawables with axis word 1 settle the channel order.vk_harnesspushes one block to both stages.VKH_HEAPwords.No game data in the PR: hand-written test inputs, counts and hashes only, and the outputs stay in the work folder.
AI-assisted (Claude Code).
🤖 Generated with Claude Code