upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:08:56 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:08:56 -0500
commite2ecb50cf149afb035c2d5fd2f3f2da509e8c2f9 (patch)
treef0642f5dc0223ad48771460d903237dfe82acb42 /runtime
parentf02cf94d516591b05fe4553cd10e9136599e1a48 (diff)
parentaec744e39d54e5e33701198334df5dbf7e4d754a (diff)
Merge pull request #3855 from Oleg Makarov
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/test/shaders/check.py18
-rw-r--r--runtime/test/shaders/ps_nan_payload.asm10
-rw-r--r--runtime/test/vk_harness.cpp3
3 files changed, 30 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])]}"
diff --git a/runtime/test/shaders/ps_nan_payload.asm b/runtime/test/shaders/ps_nan_payload.asm
new file mode 100644
index 000000000..67e5f6f8d
--- /dev/null
+++ b/runtime/test/shaders/ps_nan_payload.asm
@@ -0,0 +1,10 @@
1; Export two non-canonical f32 quiet NaNs and two finite controls to RGBA32F.
2; Expected mrt0 words: 0x7fc12345, 0xffc54321, 0x3f800000, 0x3f000000.
3; Only KosmicKrisp may return the canonical 0x7fc00000 for the NaNs (#3125).
4
5v_mov_b32 v0, 0x7fc12345
6v_mov_b32 v1, 0xffc54321
7v_mov_b32 v2, 0x3f800000
8v_mov_b32 v3, 0x3f000000
9exp mrt0 v0, v1, v2, v3 done vm
10s_endpgm
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp
index 7bd679f10..c9968a1c2 100644
--- a/runtime/test/vk_harness.cpp
+++ b/runtime/test/vk_harness.cpp
@@ -267,10 +267,13 @@ int main(int argc, char** argv) {
267 } 267 }
268 VkPhysicalDeviceProperties props; vkGetPhysicalDeviceProperties(pd, &props); 268 VkPhysicalDeviceProperties props; vkGetPhysicalDeviceProperties(pd, &props);
269 VkPhysicalDeviceSubgroupSizeControlProperties sgProps{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES}; 269 VkPhysicalDeviceSubgroupSizeControlProperties sgProps{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES};
270 VkPhysicalDeviceDriverProperties driver{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES};
271 if (props.apiVersion >= VK_API_VERSION_1_2) sgProps.pNext = &driver;
270 VkPhysicalDeviceProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; 272 VkPhysicalDeviceProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2};
271 props2.pNext = &sgProps; 273 props2.pNext = &sgProps;
272 vkGetPhysicalDeviceProperties2(pd, &props2); 274 vkGetPhysicalDeviceProperties2(pd, &props2);
273 std::fprintf(stderr, "device: %s (subgroup %u..%u)\n", props.deviceName, sgProps.minSubgroupSize, sgProps.maxSubgroupSize); 275 std::fprintf(stderr, "device: %s (subgroup %u..%u)\n", props.deviceName, sgProps.minSubgroupSize, sgProps.maxSubgroupSize);
276 if (driver.driverName[0]) std::fprintf(stderr, "driver: %s\n", driver.driverName);
274 uint32_t qn = 0; 277 uint32_t qn = 0;
275 vkGetPhysicalDeviceQueueFamilyProperties(pd, &qn, nullptr); 278 vkGetPhysicalDeviceQueueFamilyProperties(pd, &qn, nullptr);
276 std::vector<VkQueueFamilyProperties> qf(qn); 279 std::vector<VkQueueFamilyProperties> qf(qn);