Repository navigation
GPU test for the S# and T# mip fields (vulkan_sampler, T# view range) - #319
Conversation
vk_sampler_test binds a 128x128 two-level texture with the VkSampler from vulkan_sampler(decode(S#)) and the view range from decode(T#). ps_ssharp samples it with image_sample_lz and image_sample. check.py judges eight S#/T# cases per pixel against levels worked out from the S# and T# bits. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Two additional controls from a separate detached build of
The ordinary eight-case GPU run and four |
|
Tested e444c83 on AMD Radeon RX 6800 (RDNA2, RADV NAVI21, Mesa 26.2.5, Vulkan 1.4.354), Linux kernel 7.2.15: pass
AI-assisted: the test runs and this comment were done with Claude Code; I reviewed the results. |
|
Tested I ran the focused This verifies the translated Vulkan mip-selection cases in the fixture on Linux/NVIDIA. Native RDNA2 sampling, fractional LODs, and linear mip filtering were outside this run. AI-assisted verification. |
Conflicts in docs/d3d12_vulkan.md, runtime/CMakeLists.txt, check.py, run_gpu_tests.py and test_shader_checks.py: main's versions with vk_sampler_test, ps_ssharp and its checks added back (ps_ssharp is drawn with vs_ids through DRAWN_WITH now). AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged main (d937b7f..0d61c35) into this branch as 8ccf429 (no force-push). Main's versions won the conflicts in Re-run on 8ccf429, RTX 5080 / 616.92, Windows 11:
Thanks @EchoTD (RX 6800) and @tylerstraub (RTX 5090) for the runs on e444c83. AI-assisted (Claude Code). |
Conflicts were list/registration hunks in runtime/CMakeLists.txt, check.py, run_gpu_tests.py and tests/test_shader_checks.py; kept main's side and re-added vk_sampler_test, ps_ssharp and the TOTAL count. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged main as f94fc77. Conflicting files: runtime/CMakeLists.txt, runtime/test/shaders/check.py, scripts/run_gpu_tests.py, tests/test_shader_checks.py (tool list, Re-test after the merge (ps_ssharp, 8 S#/T# cases):
AI-assisted (Claude Code). |
|
Correction: |
Requested by Lucas · project thread
Claimed in #156 as: GPU test of the decoded S# and T# mip fields
What and why
#230 added
vulkan_sampler()and the T# decode, but they are only checked on the CPU.vk_texture_testandvk_bindless_testboth bind a fixed nearestVkSamplerand one-level views, so MIP_FILTER, MIN_LOD, MAX_LOD, LOD_BIAS and BASE_LEVEL never reach a GPU.runtime/test/vk_sampler_test.cpp(new): a 128x128 RGBA8 texture with two levels. Level 0 is red, green, blue and yellow quadrants; level 1 is grey (128/255). The T# isencode()d with the BASE_LEVEL/LAST_LEVEL given, and the S# words come from the command line. Both go into the heap and the hash table. The sampler isvulkan_sampler(decode(S#))and the view's levels come fromdecode(T#).runtime/test/shaders/ps_ssharp.asm(new): loads the T# and S# from the heap, then exports(lz.r, lz.g, implicit.r, implicit.g). vs_ids runs UV 0..1 over the 64x64 target, soimage_samplesees LOD 1 andimage_sample_lzLOD 0.check.py:SAMPLER_CASESlists eight S#/T# pairs, with the S# words written in Python from Mesa's field positions. Each pixel is judged against the levelsampler_level()works out from those bits, not from the C++ header. Grey differs from every level-0 colour in both channels, so a wrong level fails at every pixel.run_gpu_tests.pyruns the same check.docs/d3d12_vulkan.md: the test's paragraph, and what it does not cover.No translator or runtime change was needed: every case matched on the first run.
Tested
NVIDIA GeForce RTX 5080, driver 616.92 (device reports Vulkan 1.4.351), Windows 11 26200, MSVC 2022, Vulkan-Headers 1.4.363, SPIRV-Tools v2026.4, llvm-mc 21.1.8, on e444c83 (main 83d0637 + this commit).
scripts/run_gpu_tests.py(LEONIDA_W64_EMULATE=1)spirv-val; 51/52 passed, 1 skipped (ps_vcc_x2, as on main)runtime/test/shaders/check.pyps_ssharpctestpython -m pytest tests -q --ignore=tests/semanticpython -m unittest discover -s tests/semanticpython -I tests/test_*.py(stdlib ones, as CI runs them)Negative controls. Each was a one-line edit, rebuilt or re-translated, run on the GPU, then reverted. All nine failed at the predicted pixel:
vulkan_sampler: no [0, 0.25] LOD clamp for MIP_FILTER_NONEnone(0,0): implicit grey instead of redvulkan_sampler:minLod = 0point min_lod 1(0,0)vulkan_sampler:mipLodBias = 0point bias +1(0,0)vulkan_sampler:maxLod = VK_LOD_CLAMP_NONEpoint max_lod 0(0,0)decode(S#): MIN_LOD and MAX_LOD fields swappedpoint(0,0)decode(S#): MIP_FILTER read one bit too highpoint(0,0)decode(T#): BASE_LEVEL ignoredpoint base 1(0,0)image_sample_lzasImplicitLodpoint(0,0)point(32,0), as predictedtests/test_shader_checks.pygets four CPU tests: hand-worked levels for every case, the S# words against Mesa's positions, a wrong value in each channel of the last pixel, and a wrong level or swapped UV failing at the predicted first pixel.Not covered. On Vulkan the sampler's minLod and mipLodBias also apply to an explicit LOD. That the console's
image_sample_lzand_lbehave the same way rests on radv, which writes those Vulkan fields straight into the S#. It was not measured on RDNA2 here: I have no AMD card. The T#'s MIN_LOD (ResourceMinLODClamp) is not mapped to the view yet. Linear mip filtering, anisotropy and fractional LODs are not tested. Results are from one GPU and driver.Overlaps:
check.py,run_gpu_tests.pyandtests/test_shader_checks.pyare also touched by #269 and #296, in different hunks. I'll rebase whichever lands later.AI-assisted.
Checklist