The test was built but only run by hand, so GPU-specific failures (for
example the AMD GetResourceTiling one) never showed up in ctest. Return
77 when no Vulkan device can be created and register the test with
SKIP_RETURN_CODE 77 so CI reports it as skipped rather than failed.
The tiling comparison required the same standard/packed mip split as the host. D3D11.3 functional spec 5.9.2.8.5
(D3D12_PACKED_MIP_INFO) only requires that a mip filling a tile in every dimension stays standard; a smaller mip
"may or may not be packed, depending on the IHV". Measured on one laptop: an RTX 5070 packs from the first mip
below the tile (as the layer does), a Radeon 880M keeps one or two more standard, WARP packs nothing. The test
failed with 24 mismatches on an AMD or WARP host. It now checks the tile shape, that no mip filling a tile is
packed (layer and host), and the tile counts of the mips both sides keep standard; the split itself is printed.
With that fixed, the same test failed further down on those hosts for host-specific answers:
- depth/colour sample counts a software host (WARP, 16x) offers but the Vulkan GPU's limits lack are skipped;
- a null source rectangle in ResolveSubresourceRegion is the whole source; the Radeon 880M and WARP do not resolve
it that way, so where a host disagrees with its own whole-source rectangle the layer is held to that result.
The host is picked with LEONIDA_HOST_ADAPTER through d3d12_copy_compare.h (D3D-46).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A volume mip has a single tracked layout, but its color attachment may cover only part of its depth. Use the view to select W slices and keep barriers on the whole mip so clears preserve neighboring slices.
main added SetPredication (D3D-18) and reserved resources; both sides are
kept. The predication replay test took part E, so the D3D-26 test is now
part F. An atomic copy recorded under a predicate is counted with the
other copies that Vulkan's conditional rendering cannot skip, and
SetPredication, DiscardResource and the atomic copies are all refused in
a bundle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts, both sides kept: predication (D3D-18) next to the UAV clear in
command_list.h, vulkan_backend.h and vulkan_replay.h; the D3D-28 tests next to
the UAV clear test; texture_create_info's attachment argument with main's
mutable host-transfer usage.
UAV clears under a predicate: a whole-view texture clear takes the attachment
path, as render-target clears do, so conditional rendering applies; buffer
clears and non-attachment texture clears are transfers and are counted in
unpredicated_copies with the copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Work around an amdvlk64 pipeline-creation crash (0xC0000005 on RX 9070 XT)
triggered when GLSL.std.450 PackHalf2x16 on an OpImageSampleExplicitLod d16
result feeds a structured loop (OpLoopMerge inside OpSelectionMerge) using
OpGroupNonUniformAny.
Replace PackHalf2x16 at the two d16 image_gather4*/image_sample* sites in
tools/rdna2spirv.py with a branchless pure-integer IEEE-754 binary16 RTE
packer (Gen.f32_to_f16_int / Gen.pack_f16_pair_int). Leave all other
PackHalf2x16 call sites unchanged.
Add unit tests covering edge cases and a 58,368-value sweep across all 256
exponents (tests/test_d16_pack.py), SPIR-V translation/validation tests for
d16 image_sample and image_gather4 (tests/test_translate.py), and a synthetic
GPU sample shader (runtime/test/shaders/ps_texture_sample_d16.asm).
#600 mapped R8G8, R16G16 and R32G32 UINT/SINT, R16G16B16A16 UINT/SINT
and R10G10B10A2_UINT, but render_target_clear_color still treats them
as float formats: a ClearRenderTargetView writes the float's bits
(255.0 becomes 0x437f0000). They now clamp to the component range and
truncate toward zero like WARP, with per-channel limits for
R10G10B10A2_UINT (10, 10, 10 and 2 bits). R8_TYPELESS, the last
two-channel/one-channel TYPELESS form still refused, is mapped as
R8_UNORM with the mutable-format flag.
d3d12_clear_formats_test goes from 178 to 251 cases against WARP, all
matching on an RTX 3060 Ti; without this change 54 differ and R8_TYPELESS
is not exposed. clear_color_test checks the integer conversions on the CPU.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each source lane on in EXEC sends its data to lane ((addr + offset) >> 2) mod 32
of its own half (like ds_bpermute_b32); a destination nobody targets gets 0, an
off destination keeps its VDST. Highest-numbered source wins a collision.
Native: per-source shuffles with a ballot guard for missing lanes; wave64
emulation: two buffer rounds and a %x_perm variable.
Tests: tests/semantic/test_ds_permute.py, GPU tests cs_w32_permute and
cs_w64x_permute. Contract row in docs/design.md.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cs_cvt_f32_sat (#300) takes its binary32 input in s4, so neither runner
ran it. Now both do: one dispatch per input of
tests/semantic/test_float_to_int.py (check.CVT_F32_SAT_CASES), each
judged on both words (v_cvt_u32_f32 in out[0], v_cvt_i32_f32 in out[1]).
- check.cvt_f32_sat_test() and the run_gpu_tests.py branch report
"16/16 inputs exact", or how many were wrong and the first one.
- tests/test_shader_checks.py: the fake device answers from the word in
VKC_SGPRS; every input must be sent, one wrong input must fail and be
named, and the table must equal the interpreter test's CASES.
On NVIDIA this checks the fixed translation, but it cannot catch the old
bug: with the translator from before #300 (273e53c^1) the RTX 4060 Ti
also gives 16/16, since SPIR-V leaves an out-of-range conversion
undefined and this hardware saturates anyway. A driver that does not
(@EchoTD's RADV case on #300, constant inputs) is where it can fail;
tests/semantic/test_float_to_int.py pins the rule itself.
AI-assisted (Claude Code). Tested on NVIDIA GeForce RTX 4060 Ti (Ada,
subgroup 32), driver 32.0.16.2124, Windows 11, on main d937b7f:
run_gpu_tests.py cs_cvt_f32_sat "16/16 inputs exact" natively and with
LEONIDA_W64_EMULATE=1; check.py cs_cvt_f32_sat ok;
tests/test_shader_checks.py 18/18.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_compute_test always put the output V# in s[0:3] and zero in every
other user SGPR, so a compute test shader could not be given an input
word: #300's cs_cvt_f32_sat reads its float from s4 and could only be
checked on a GPU by building one shader variant per input by hand.
- VKC_SGPRS=w4,w5,... sets s4, s5, ... up to s31 (s[0:3] stay the output
V#), with the same syntax and checks as vk_harness's VKH_SGPRS: decimal
or 0x hex, no sign, nothing above 32 bits, no trailing comma, at most
28 words; anything else exits 2 with a message.
- cs_user_sgprs.asm declares eight user SGPRs (RSRC2 0x8090) and stores
s4..s7 back. Both runners seed it with 0x4f000000,0xdeadbeef,7,
0xffffffff (check.USER_SGPRS) and expect those words, then the
0xEEEEEEEE fill.
- check.compute_test() takes an env for vk_compute_test.
- tests/test_shader_checks.py: the fake harness only answers
cs_user_sgprs with the seeded words when VKC_SGPRS was passed, and no
other test may get VKC_SGPRS.
AI-assisted (Claude Code). Tested on NVIDIA GeForce RTX 4060 Ti (Ada,
subgroup 32), driver 32.0.16.2124, Windows 11, on main d937b7f:
- run_gpu_tests.py cs_user_sgprs PASS natively and with
LEONIDA_W64_EMULATE=1; check.py cs_user_sgprs ok
- vk_compute_test directly: unset -> s4..s7 read 0; "5" sets s4 only;
28 words accepted; "1,2,", "-1", "0x1ffffffff", "abc" and 29 words
exit 2
- test_shader_checks.py fails (7) if check.py stops passing VKC_SGPRS
- full suite: see the PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spirv_mini_interp.py: keep main's _F32 (sNaN bits, #533) and its vector-aware
RoundEven/Floor/Ceil/Trunc; keep this branch's fma_f32, OpFDiv and
Exp2/Log2/Sqrt/InverseSqrt. regen_fixtures.py: both sides' shaders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebased onto main after #525, which added SNORM/SINT render targets for four formats.
This keeps #525's formats and adds what it leaves out:
- Normalised clears round to nearest even like D3D, so 0.5 on an 8-bit channel is 128
(NVIDIA's clears write 127). The layer hands Vulkan the exact fraction; NaN is 0 and
out-of-range values clamp. Covers UNORM, SNORM (scale 127 or 32767, -1.0 is -127), the
alpha of the sRGB formats, R10G10B10A2_UNORM and D16_UNORM depth.
- More formats: R8/R8G8/R16/R16G16/R16G16B16A16 SNORM, R8/R16 SINT, R8/R16 UINT,
R16_UNORM and R16G16_UNORM, with their copy sizes; SINT and UINT of every width clamp to
the component range and truncate toward zero.
- d3d12_clear_formats_test: 178 cases against WARP over UNORM, SNORM, sRGB, FLOAT, UINT,
SINT and the four depth formats. typeless_rtv_test now expects the rounded UNORM value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check.py assigned PIXEL_TESTS four times while the merge round landed;
the last assignment lost ps_texoff, so a standalone run could be green
without exercising texel offsets. Replace the chain with one tuple that
keeps every pixel fixture (ps_texoff, ps_wqm, ps_scc_mask32) and drop the
duplicate pixels() call that ran the harness twice and could hide a
first-call failure behind the second.
Adds CPU registry and single-invocation regression tests.
Block-compressed texture-to-texture copies: the box is rounded to whole blocks, must fit the destination's padded mip
(a 16-wide box into a 4-wide mip is invalid_copy again), and the extent is cut only where it reaches an edge and
must satisfy both images (block multiple or at that image's edge), else invalid_copy.
Test: copies between different mips (RGBA8, BC1, BC7) and boxes that do not fit, with the host's refusal compared;
a LEONIDA_HOST_ADAPTER that matches nothing fails the run; D24 without a native format still checks the
bit-preserving copies; the partial copies are ordered after the uploads by a COPY_SOURCE round trip; <cctype>.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cs_wqm_w32 (SHADER-34) and cs_w32_lane_wrap (SHADER-52) check 32-lane
EXEC/VCC masks and lane selects. On Mesa llvmpipe, whose compute
subgroups are 8 wide, they can't produce their words, and the
"GPU tests on llvmpipe" step in runtime.yml has failed on main since
91b36cf. Skip them where vk_compute_test reports a widest subgroup
below 32 lanes, the rule ps_bitmask_perm already uses, in check.py and
run_gpu_tests.py (which reuses check.py's helper). Devices with 32 or
more lanes still run and judge them.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7JEiKsTUaHQbCTdc4Eghy
(cherry picked from commit be466779a2a1e988f58803ab1eedca6cc6a07375)
Add DXGI-to-Vulkan mappings and block sizes for missing integer and typeless formats in the Vulkan D3D12 device (D3D-60):
- R32G32 (_TYPELESS, _UINT, _SINT)
- R16G16B16A16 (_UINT, _SINT)
- R10G10B10A2_UINT
- R16G16 (_TYPELESS, _UINT, _SINT)
- R8G8 (_TYPELESS, _UINT, _SINT)
Exclude these integer formats from color resolve matching in color_resolve_format_matches (integer resolves are disallowed in Vulkan and D3D12).
Add footprint and allocation tests comparing against host D3D12 WARP, as well as CheckFeatureSupport and committed resource creation checks.
Tested on AMD Radeon RX 9070 (driver 26.10.1, Windows 11) and host D3D12 WARP.
AI-assisted.