diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 06:08:10 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 06:08:10 -0500 |
| commit | 5e9a2dc58dec4f91ff3fa507e26f0fb8150e4e4b (patch) | |
| tree | 7b3889dce845dfa020ad819406cbe99c89b24b28 | |
| parent | 481a5ee6ce615ae3f0a400a04529fb9c20ac5a42 (diff) | |
| parent | da3ebde8ca14a2c5a768221fa898af7c712255ae (diff) | |
Merge pull request #1393 from DomasUrbonas
| -rw-r--r-- | runtime/test/shaders/check.py | 7 | ||||
| -rw-r--r-- | runtime/test/shaders/ps_clip_color.asm | 12 | ||||
| -rw-r--r-- | scripts/run_gpu_tests.py | 3 | ||||
| -rw-r--r-- | tests/test_run_gpu_tests_paths.py | 4 |
4 files changed, 20 insertions, 6 deletions
diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py index eb8b031e8..734b9d667 100644 --- a/runtime/test/shaders/check.py +++ b/runtime/test/shaders/check.py | |||
| @@ -205,7 +205,8 @@ W64X_DUMPS = [("cs_dpp_w64", [1, 0, 3, 2, 5, 4, 7, 6]), | |||
| 205 | # A 40-thread group (one partial wave) cannot use --require-wave64 (full subgroups), so it asks for subgroup size 64. | 205 | # A 40-thread group (one partial wave) cannot use --require-wave64 (full subgroups), so it asks for subgroup size 64. |
| 206 | W64X_PARTIAL = [("cs_w64x_partial", [40, 40, 528, 0, 0, 532, 539, 524820]), | 206 | W64X_PARTIAL = [("cs_w64x_partial", [40, 40, 528, 0, 0, 532, 539, 524820]), |
| 207 | ("cs_w64x_partial_scmp", [0, 1, 0, 1, 1, 1, 1, 0])] | 207 | ("cs_w64x_partial_scmp", [0, 1, 0, 1, 1, 1, 1, 0])] |
| 208 | PIXEL_BITS = {"ps_legacy_mul": (0, 0, 0, 0x40c00000), | 208 | PIXEL_BITS = {"ps_clip_color": (0x3e800000, 0x3f000000, 0x3f400000, 0x3f800000), |
| 209 | "ps_legacy_mul": (0, 0, 0, 0x40c00000), | ||
| 209 | "ps_ops": (0x48804300, 5, 7, 0xfffffffc), "ps_ops2": (0xabcd4400, 0x46001234, 0xfffffffa, 7), | 210 | "ps_ops": (0x48804300, 5, 7, 0xfffffffc), "ps_ops2": (0xabcd4400, 0x46001234, 0xfffffffa, 7), |
| 210 | "ps_ops3": (0xfffffffa, 0x44660066, 0x44aabbcc, 16), "ps_ops4": (0x34000010, 0x00120800, 0xbeef0000, 0x12343c00), | 211 | "ps_ops3": (0xfffffffa, 0x44660066, 0x44aabbcc, 16), "ps_ops4": (0x34000010, 0x00120800, 0xbeef0000, 0x12343c00), |
| 211 | "ps_ops5": (0x12340010, 0xbeef0800, 0xaaaaffff, 0xdeadbc00), | 212 | "ps_ops5": (0x12340010, 0xbeef0800, 0xaaaaffff, 0xdeadbc00), |
| @@ -880,7 +881,7 @@ def clip_test(tools, spirv, name): | |||
| 880 | raw = Path(tmp) / "pixels.raw" | 881 | raw = Path(tmp) / "pixels.raw" |
| 881 | for clip_x, clip_y in ((False, False), (True, False), (False, True), (True, True)): | 882 | for clip_x, clip_y in ((False, False), (True, False), (False, True), (True, True)): |
| 882 | code, output = run(os.path.join(tools, "vk_harness" + EXE), os.path.join(spirv, name + ".spv"), | 883 | code, output = run(os.path.join(tools, "vk_harness" + EXE), os.path.join(spirv, name + ".spv"), |
| 883 | os.path.join(spirv, "ps_ops.spv"), raw, "64", "64", | 884 | os.path.join(spirv, "ps_clip_color.spv"), raw, "64", "64", |
| 884 | "0" if clip_x else "4", "0" if clip_y else "4") | 885 | "0" if clip_x else "4", "0" if clip_y else "4") |
| 885 | if code == UNSUPPORTED: | 886 | if code == UNSUPPORTED: |
| 886 | return Skip("SKIP (shaderClipDistance unavailable)") | 887 | return Skip("SKIP (shaderClipDistance unavailable)") |
| @@ -897,7 +898,7 @@ def clip_test(tools, spirv, name): | |||
| 897 | for i, pixel in enumerate(struct.iter_unpack("<4I", data)): | 898 | for i, pixel in enumerate(struct.iter_unpack("<4I", data)): |
| 898 | inside = (not clip_x or i % 64 < 32) and (not clip_y or i // 64 < 16) | 899 | inside = (not clip_x or i % 64 < 32) and (not clip_y or i // 64 < 16) |
| 899 | drawn = inside or name == "vs_clip_undeclared" | 900 | drawn = inside or name == "vs_clip_undeclared" |
| 900 | wrong += pixel != (PIXEL_BITS["ps_ops"] if drawn else clear) | 901 | wrong += pixel != (PIXEL_BITS["ps_clip_color"] if drawn else clear) |
| 901 | if wrong: | 902 | if wrong: |
| 902 | return f"x={clip_x} y={clip_y}: {wrong} of 4096 pixels differ" | 903 | return f"x={clip_x} y={clip_y}: {wrong} of 4096 pixels differ" |
| 903 | return "" | 904 | return "" |
diff --git a/runtime/test/shaders/ps_clip_color.asm b/runtime/test/shaders/ps_clip_color.asm new file mode 100644 index 000000000..7c354cbce --- /dev/null +++ b/runtime/test/shaders/ps_clip_color.asm | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ; Dedicated fragment shader for vertex clipping tests. | ||
| 2 | ; Export finite, exactly representable RGBA32F values so | ||
| 3 | ; NaN payload canonicalization cannot affect clip validation. | ||
| 4 | ; Expected mrt0 bits: 0x3e800000, 0x3f000000, | ||
| 5 | ; 0x3f400000, 0x3f800000 | ||
| 6 | |||
| 7 | v_mov_b32 v0, 0x3e800000 | ||
| 8 | v_mov_b32 v1, 0x3f000000 | ||
| 9 | v_mov_b32 v2, 0x3f400000 | ||
| 10 | v_mov_b32 v3, 0x3f800000 | ||
| 11 | exp mrt0 v0, v1, v2, v3 done vm | ||
| 12 | s_endpgm | ||
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index cf2ebba36..dff643f51 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -507,7 +507,7 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool, | |||
| 507 | DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", | 507 | DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", |
| 508 | "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", | 508 | "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", |
| 509 | "ps_gather_wrap": "vs_ids.asm", | 509 | "ps_gather_wrap": "vs_ids.asm", |
| 510 | **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_ops.asm", | 510 | **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", |
| 511 | "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", | 511 | "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", |
| 512 | "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"} | 512 | "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"} |
| 513 | 513 | ||
| @@ -984,6 +984,7 @@ def run_suite(a, work: str) -> int: | |||
| 984 | results.append((name, False, msg)) | 984 | results.append((name, False, msg)) |
| 985 | continue | 985 | continue |
| 986 | const_wants = { | 986 | const_wants = { |
| 987 | "ps_clip_color": (0x3E800000, 0x3F000000, 0x3F400000, 0x3F800000), | ||
| 987 | "ps_ops": (0x48804300, 5, 7, 0xFFFFFFFC), | 988 | "ps_ops": (0x48804300, 5, 7, 0xFFFFFFFC), |
| 988 | "ps_ops2": (0xABCD4400, 0x46001234, 0xFFFFFFFA, 7), | 989 | "ps_ops2": (0xABCD4400, 0x46001234, 0xFFFFFFFA, 7), |
| 989 | "ps_ops3": (0xFFFFFFFA, 0x44660066, 0x44AABBCC, 16), | 990 | "ps_ops3": (0xFFFFFFFA, 0x44660066, 0x44AABBCC, 16), |
diff --git a/tests/test_run_gpu_tests_paths.py b/tests/test_run_gpu_tests_paths.py index 7332e165e..7400a7be7 100644 --- a/tests/test_run_gpu_tests_paths.py +++ b/tests/test_run_gpu_tests_paths.py | |||
| @@ -26,11 +26,11 @@ class DrawShaders(unittest.TestCase): | |||
| 26 | def test_flat_still_brings_vs_ids(self): | 26 | def test_flat_still_brings_vs_ids(self): |
| 27 | self.assertEqual(run_gpu_tests.with_draw_shaders(["ps_flat.asm"]), ["ps_flat.asm", "vs_ids.asm"]) | 27 | self.assertEqual(run_gpu_tests.with_draw_shaders(["ps_flat.asm"]), ["ps_flat.asm", "vs_ids.asm"]) |
| 28 | 28 | ||
| 29 | def test_each_filtered_clip_case_brings_ps_ops(self): | 29 | def test_each_filtered_clip_case_brings_ps_clip_color(self): |
| 30 | for name in run_gpu_tests.CLIP_CASES: | 30 | for name in run_gpu_tests.CLIP_CASES: |
| 31 | with self.subTest(name=name): | 31 | with self.subTest(name=name): |
| 32 | selected = f"{name}.asm" | 32 | selected = f"{name}.asm" |
| 33 | self.assertEqual(run_gpu_tests.with_draw_shaders([selected]), [selected, "ps_ops.asm"]) | 33 | self.assertEqual(run_gpu_tests.with_draw_shaders([selected]), [selected, "ps_clip_color.asm"]) |
| 34 | 34 | ||
| 35 | def test_vs_ids_is_not_added_twice(self): | 35 | def test_vs_ids_is_not_added_twice(self): |
| 36 | files = ["ps_flat.asm", "ps_texture_sample.asm", "vs_ids.asm"] | 36 | files = ["ps_flat.asm", "ps_texture_sample.asm", "vs_ids.asm"] |