upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/shaders/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/test/shaders/check.py')
-rw-r--r--runtime/test/shaders/check.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py
index 0d748c2e3..e5d46e9fb 100644
--- a/runtime/test/shaders/check.py
+++ b/runtime/test/shaders/check.py
@@ -504,12 +504,13 @@ TEXTURE_CONSTANTS = {
504 "ps_array_resinfo": (8.0, 8.0, 12.0, 1.0), # binding 3, index 1: two 6-face cubes, one mip 504 "ps_array_resinfo": (8.0, 8.0, 12.0, 1.0), # binding 3, index 1: two 6-face cubes, one mip
505} 505}
506CLIP_TESTS = ("vs_clip", "vs_clip_param4", "vs_clip_undeclared") 506CLIP_TESTS = ("vs_clip", "vs_clip_param4", "vs_clip_undeclared")
507NAN_PAYLOAD_TEST = "ps_nan_payload"
507# One definition: a later assignment used to drop ps_texoff (and any entry added by an earlier assignment) from 508# One definition: a later assignment used to drop ps_texoff (and any entry added by an earlier assignment) from
508# the standalone run. Keep every pixel fixture in this tuple. 509# the standalone run. Keep every pixel fixture in this tuple.
509PIXEL_TESTS = sorted((*PIXEL_BITS, "ps_bary", "ps_persp_bary", "ps_flat", "ps_bitmask_perm", "ps_texoff", 510PIXEL_TESTS = sorted((*PIXEL_BITS, "ps_bary", "ps_persp_bary", "ps_flat", "ps_bitmask_perm", "ps_texoff",
510 "ps_texoff_implicit", "ps_texoff_forms", 511 "ps_texoff_implicit", "ps_texoff_forms",
511 "ps_uniform_branch", "ps_wqm", "ps_scc_mask32", "ps_interp_f16_high", "ps_ij_computed", 512 "ps_uniform_branch", "ps_wqm", "ps_scc_mask32", "ps_interp_f16_high", "ps_ij_computed",
512 "ps_mandelbrot")) 513 "ps_mandelbrot", NAN_PAYLOAD_TEST))
513# Pixel fixtures drawn with another vertex shader than vs_ids. 514# Pixel fixtures drawn with another vertex shader than vs_ids.
514PIXEL_VERTEX = {"ps_interp_f16_high": "vs_f16_pack", "ps_persp_bary": "vs_persp", 515PIXEL_VERTEX = {"ps_interp_f16_high": "vs_f16_pack", "ps_persp_bary": "vs_persp",
515 "ps_interp_f32_mods": "vs_interp_consts", "ps_interp_mov_mods": "vs_interp_consts"} 516 "ps_interp_f32_mods": "vs_interp_consts", "ps_interp_mov_mods": "vs_interp_consts"}
@@ -1559,6 +1560,19 @@ def barycentric_problem(px: list[tuple[float, float, float, float]], abs_tol: fl
1559 return "" 1560 return ""
1560 1561
1561 1562
1563def nan_payload_problem(px, out):
1564 """Check the exact words, except for the measured KosmicKrisp RGBA32F canonicalization (#3125)."""
1565 if len(px) != 64 * 64:
1566 return f"expected 4096 pixels, got {len(px)}"
1567 want = (0x7fc12345, 0xffc54321, 0x3f800000, 0x3f000000)
1568 canonicalizes = "driver: KosmicKrisp" in out.splitlines()
1569 for i, p in enumerate(px):
1570 if any(actual != expected and not (canonicalizes and c < 2 and actual == 0x7fc00000)
1571 for c, (actual, expected) in enumerate(zip(p, want))):
1572 return f"pixel ({i % 64},{i // 64}) has unexpected words: {[hex(x) for x in p]}"
1573 return ""
1574
1575
1562def pixel_test(tools, spirv, name): 1576def pixel_test(tools, spirv, name):
1563 path = os.path.join(spirv, name + ".spv") 1577 path = os.path.join(spirv, name + ".spv")
1564 if name == "ps_ij_computed" and (BARY_FALLBACK or F16_HALVES): 1578 if name == "ps_ij_computed" and (BARY_FALLBACK or F16_HALVES):
@@ -1591,6 +1605,8 @@ def pixel_test(tools, spirv, name):
1591 if not px: 1605 if not px:
1592 return out if out.startswith("could not start") else "vk_harness failed or returned no pixels" 1606 return out if out.startswith("could not start") else "vk_harness failed or returned no pixels"
1593 n = len(px) 1607 n = len(px)
1608 if name == NAN_PAYLOAD_TEST:
1609 return nan_payload_problem(px, out)
1594 if name in PIXEL_BITS: 1610 if name in PIXEL_BITS:
1595 wrong = sum(p != PIXEL_BITS[name] for p in px) 1611 wrong = sum(p != PIXEL_BITS[name] for p in px)
1596 return "" if not wrong else f"{wrong} of {n} pixels differ, e.g. {[hex(x) for x in next(p for p in px if p != PIXEL_BITS[name])]}" 1612 return "" if not wrong else f"{wrong} of {n} pixels differ, e.g. {[hex(x) for x in next(p for p in px if p != PIXEL_BITS[name])]}"