GPU tests: ms_v5_workgroup expects #209's v5 (group * NumThreads + lane); run_gpu_tests runs #167's ps_texture_sample

#219's checker was written for the older workgroup-index model; on an RTX 4060 Ti lanes 0/1/31 of every
group read 32g, 32g+1, 32g+31, which is #209's model (the game's mesh entry shifts v5 right by 7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ItsNotRexed
2026-11-21 16:51:24 -05:00
parent 7b82460339
commit 3fae38a7a1
4 changed files with 16 additions and 4 deletions

View File

@ -92,8 +92,9 @@ def check_mesh_v5(data):
for y in range(3):
for x in range(2):
pixel = next(pixels)
expected = x + 2*y + 6*z
want = (expected, expected, expected, 1)
# v5 = linear group index * NumThreads + lane (#209); the shader records lanes 0, 1 and 31 of 32
g = x + 2*y + 6*z
want = (32 * g, 32 * g + 1, 32 * g + 31, 1)
if pixel != want:
errors.append(f"({x},{y},{z}): got {pixel}, expected {want}")
return f"{len(errors)}/24 mismatches; first {errors[0]}" if errors else ""

View File

@ -1,5 +1,6 @@
; One full-screen triangle per mesh workgroup. RGB records incoming v5 from local lanes 0, 1 and 31.
; With --mesh-group-readback 2 3 4, pixel g = x + 2*y + 6*z must be (g, g, g, 1) under the workgroup-index model.
; With --mesh-group-readback 2 3 4, pixel g = x + 2*y + 6*z must be (32g, 32g+1, 32g+31, 1): v5 = group index *
; NumThreads + lane (#209; the game's mesh entry shifts v5 right by 7 on lane 0 with 128 threads).
; Stencil selects the workgroup independently of its color. PSV0: 32 threads, 128 bytes LDS, 3 vertices, 1 triangle.
v_mbcnt_lo_u32_b32 v0, -1, 0
; Exchange through group memory so the probe also works when a host subgroup has fewer than 32 lanes.

View File

@ -551,6 +551,16 @@ def run_suite(a, work: str) -> int:
elif name == "cs_imgload":
rc, msg = run_cmd([vk_store, spv, "load"])
results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
elif name == "ps_texture_sample":
# #167's bindless texture test: vk_texture_test finds vs_ids.spv and this shader in its working directory.
tool = os.path.join(a.build, "vk_texture_test" + ext)
raw = os.path.join(raw_dir, f"{name}.raw")
try:
p = subprocess.run([tool, raw], capture_output=True, text=True, cwd=spirv_dir)
rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
except FileNotFoundError:
rc, msg = 1, f"missing {tool}"
results.append((name, rc == 0 and "PASSED" in msg, msg.splitlines()[-1] if msg else ""))
elif name.startswith("ps_"):
raw = os.path.join(raw_dir, f"{name}.raw")
vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids

View File

@ -134,7 +134,7 @@ class Wave64Checks(unittest.TestCase):
class MeshWorkgroupChecks(unittest.TestCase):
def test_every_group_has_its_own_pixel(self):
pixels = [struct.pack("<4f", value, value, value, 1) for value in range(24)]
pixels = [struct.pack("<4f", 32 * g, 32 * g + 1, 32 * g + 31, 1) for g in range(24)] # #209's v5
self.assertEqual(check.check_mesh_v5(b"".join(pixels)), "")
pixels[6], pixels[2] = pixels[2], pixels[6]
self.assertIn("2/24 mismatches; first (0,1,0)", check.check_mesh_v5(b"".join(pixels)))