Honour LEONIDA_PC_TAIL_UBO=1 in runtime/test/vk_image_fuzz.cpp by sizing the
push-constant range and vkCmdPushConstants to 128 bytes (s0..s31; the fuzz
shaders read neither heap base nor code base, so they declare no set-1 block).
Add --pc-tail-ubo (and LEONIDA_PC_TAIL_UBO=1 env detection) to
tools/image_fuzz.py so it forwards --pc-tail-ubo to rdna2spirv.py and sets
LEONIDA_PC_TAIL_UBO=1 for vk_image_fuzz, enabling 128-byte push-constant GPUs
to run the image fuzzer instead of skipping every case.
Co-Authored-By: Gemini 4 Neon <noreply@google.com>
The runtime's standalone device (d3d12_vulkan_device.cpp) still took
"the first usable device, replaced by every later discrete GPU". #915
fixed that rule in the test harnesses because Mesa's Dozen (Microsoft
vendor 0x1414, "Microsoft Direct3D12 (<gpu>)") reports a discrete GPU, so
on a PC with the OpenCL/OpenGL/Vulkan Compatibility Pack the runtime
could run on the Vulkan-on-D3D12 wrapper while the tests used the native
driver. Even without Dozen, on a two-dGPU PC the runtime took the last
GPU and vk_test_device.h the first.
- runtime/src/vulkan_device_filter.h: vulkan_device_rank() (native over
Microsoft's layers, then discrete > integrated > virtual > CPU), with
the device type as an int so the header stays Vulkan-free.
- d3d12_vulkan_device.cpp: the first usable device of the highest rank.
- vk_device_pick.h: device_rank forwards to it (static_assert on the
VkPhysicalDeviceType values).
- d3d12_indirect_rt_test, dxgi_swapchain_test, vk_image_fuzz,
vk_sampler_test had the old loop and ignored LEONIDA_VK_DEVICE: they
now filter and rank like the rest, and an unmatched filter fails
instead of skipping.
- vulkan_device_filter_test: the rank order; docs/testing.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UINT/SINT image_load read the uint/sint storage arrays with OpImageRead, so
every typed load declared StorageImageReadWithoutFormat (missing on Intel
Xe-LP, #619), and read-only integer textures, which the runtime binds only in
the sampled arrays, read the fallback or past the 256-entry storage arrays.
They now fetch through uint/sint aliases of the dimension's sampled array;
a lookup miss takes the float path.
vk_store_test load fills the images before the dispatch, runs without
shaderStorageImageReadWithoutFormat and fails a module that declares it.
vk_image_fuzz no longer requires the without-format features, and binds
its UINT/SINT cases (#1087) as sampled images, as the runtime binds a
read-only texture, instead of storage-only images.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both harnesses create a pipeline layout with the 144-byte translated
user-data block and never checked maxPushConstantsSize, so on a
128-byte device (Intel Arc, some AMD drivers) they failed validation
instead of skipping, although every pixel was exact. Each now prints
"unsupported: need 144 push constant bytes, device has N" and exits
77 before creating anything, as vk_texture_test does since 0c84bff;
the range uses the same constant.
run_gpu_tests.py already reported ps_tex's 77 as SKIP; image_fuzz.py
skipped it with a fixed message and now quotes the harness's
unsupported line. CPU tests cover both runners' 77 path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The skip message said 'lacks ... or the without-format reads/writes', which cost kapitche a vulkaninfo round trip on an Intel UHD 770. It now prints the exact features that are missing, plus the reason when the without-format ones are involved: the translated image_load declares those capabilities for every shader, because its uint/sint path is chosen from the T# FORMAT at run time.
AI-assisted. docs/shader_validation.md said "Not covered yet: images", and
FUZZ-1..13 touch VALU, memory, LDS, crosslane and control flow but not a single
image instruction. This is the first slice of that gap:
- runtime/test/vk_image_fuzz.cpp: headless harness that binds one 2D sampled
image from a key=value spec (format, size, texels, T# key) through the
bindless set and the descriptor table, draws a 64x64 full-screen triangle with
a caller-supplied VS/PS, and dumps RGBA32F. It enables the without-format
storage-image reads/writes and fragment atomics the translated image path
declares, and fails on validation errors with LEONIDA_VK_VALIDATION=1.
- tools/image_fuzz.py: assembles a pixel shader that reads one texel with
image_load (dmask 0xf, T# in s[8:15]), translates it with rdna2spirv.py, runs
the harness, and compares every pixel with an independent CPU oracle for the
T# format. A fetch is a memory read, so the oracle is exact.
- tests/test_image_fuzz.py: the oracle, the texel mapping, the T# word and the
generated shader, without a GPU.
Covered: R8G8B8A8_UNORM, R16G16B16A16_SFLOAT, R32G32B32A32_SFLOAT and
R32_SFLOAT, at 8/16/32/64 square sizes that divide the draw; a fifth of the
values are NaN, +-inf, +-0 or denormals.
Not covered yet: dmask variants, UINT/SINT formats (they read through the
storage views), mips, 1D/2D-array/3D/cube, image_sample/gather with filters and
borders, and texel offsets with VK_KHR_maintenance8.
Verified on an NVIDIA RTX 2060 SUPER (Linux, 620.73.04, Vulkan 1.4.357):
40/40 programs match under LEONIDA_VK_VALIDATION=1; ctest 11/11; the GPU suite
is unchanged with a clean build. Synthetic fixtures only, no game data.