The 321 pixel shaders that read the raw barycentric pair are translated to
BuiltIn BaryCoordKHR, so they can't run on a device without the extension
(NVIDIA Pascal, for one). With --bary-fallback the pair comes from an
ordinary vec3 input one location past the shader's attributes; the module
needs neither the capability nor the extension, and the index records the
location as bary_fallback_input. tools/bary_fallback_gs.py writes the
pass-through geometry shader that fills it: Position and the PS's inputs
copied unchanged, plus (1,0,0), (0,1,0), (0,0,1) at the three vertices,
whose perspective interpolation is the BaryCoordKHR value.
- LEONIDA_BARY_FALLBACK=1 for build.py, check.py and run_gpu_tests.py
(like LEONIDA_W64_EMULATE): translate with the flag, build
<name>.bary_gs.spv, draw those shaders through it.
- vk_harness: VKH_GS_HELPER=1 keeps VKH_SUBGROUP_SIZE on the fragment
stage when the GS only feeds the pixel shader under test.
- tests/semantic/test_bary_fallback.py and the ps_bary fixture.
- docs/design.md contract row and index key, docs/testing.md section.
GTX 1060 (Pascal): ps_bary 4096/4096 exact, ps_uniform_branch and
ps_scc_mask32 pass with the fallback (SKIP without it). Pixel-shader corpus:
12,101/12,101 translate and pass spirv-val with and without the flag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
small_float rounded to nearest even and turned any too-large value into
infinity. D3D11.3 3.2.2 says float-to-float conversion rounds toward zero
and a finite value too large becomes the largest finite (only infinity
stays infinity); ClearUnorderedAccessViewFloat on WARP and on NVIDIA
gives exactly that: R16 70000 or 65520 -> 0x7bff, 1e-7 -> 0x0001,
R11G11B10 (1e6, 1e6, 1e6) -> 0xf7fdffbf, B = 1/3 -> 0x1aa. The layer wrote
infinity (which a shader then turns into NaN) and rounded up.
d3d12_uav_clear_test's conversion checks asserted the old rule for 65520
and 1e-7; they now hold the host values, with overflow, infinity and
R11G11B10 cases added.
The buffer branch only checked first/count and the texture branch never
looked at Width, Height, DepthOrArraySize or SampleDesc, turning a zero
extent into 1. The PC runtime gives the failure answer (every output all
ones) for these; measured on WARP, and @quackottu's subset on an NVIDIA GPU.
Buffers: Width 0, or any of Height, DepthOrArraySize, MipLevels, Format,
Layout, SampleDesc or Alignment other than its one valid value. Textures:
a zero extent, Count 0, or more than one sample outside a single-mip,
non-ROW_MAJOR 2D render target or depth stencil, or a count that is not a
power of two. Left unchecked because the host accepts them or adapters
differ: Flags on buffers, extra mips, 2D ROW_MAJOR, Quality at one sample,
extent limits, texture alignment, multisample quality and format support.
d3d12_vulkan_device_test: footprint_validity_cases() is compared with the
host runtime when there is one and checked on its own otherwise.
AI-assisted
d3d12_debug_markers_test, d3d12_fence_timing_test, d3d12_node_mask_test
and dxgi_swapchain_test were built but had no add_test, so ctest (and the
wine job's test list) never ran them; all four pass on an RTX 5070. Each
now exits 77 when there is no Vulkan GPU or driver, as the other GPU tests
do (dxgi_swapchain's SKIP branches exited 0, and with no driver at all it
failed at vkCreateInstance), and is registered with SKIP_RETURN_CODE 77.
An integer image-view minimum is permitted by Vulkan and was observed on Intel. Check an effective integer minimum separately and report both view groups before returning a mismatch.
quote() escaped quotes but ignored CommandLineToArgvW's backslash rules,
so GetCommandLineA/W and __argv disagreed for an argument ending in a
backslash ("C:\My Games\" next" parsed back as 2 arguments, not 3) or
holding a backslash before a quote. A backslash run before a quote, or
before the closing quote, is now doubled.
widen() decoded the arguments as UTF-8, but main.cpp passes
std::filesystem::path::string(), which is ANSI code page text, so cafe
with an accent reached __wargv as caf\uFFFD. It widens from CP_ACP now;
under a UTF-8 activeCodePage that is the same thing.
New process_cmdline_test (ctest process_cmdline) checks that
GetCommandLineW parses back to __wargv.
cost and dword_count + dwords were 32-bit. With {Constants 1, Constants
0xFFFFFFFF} both wrap to 0, so the 64-dword cost check and the 32-SGPR
check pass and the loop writes past PackResult::dwords[32] (the test
binary dies with 0xC0000409). parse_rts0 copies Num32BitValues from a
blob unchecked, so a malformed RTS0 reaches this. Both sums are now
64-bit; root_signature_test gets the wrapping case.
The GPU tools picked a device with the shared ranker but never applied the
name filter the D3D12 tests have used since #861. Filter candidates through
vulkan_device_wanted in vk_device_pick.h, report a filter that matches nothing
instead of dereferencing a null device, and cover the filter cases in the
picker test. docs/testing.md no longer says the tools ignore it.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Keep the creation-time castable list on the resource, reject an SRV format
that is neither the resource format nor listed, and allow listed same-size
cross-family casts such as R8G8B8A8_UINT to R32_UINT.
vulkan_device_filter.h decides which Vulkan GPU the runtime and its tests
take, but nothing tested its edge cases. Add a CPU-only test for unset/empty
matching everything, case-insensitive substrings (including spaces), no-match,
and null/empty names under both settings, and restore the environment after.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
What was wrong (tools/rdna2spirv.py):
- s_load* / s_buffer_load* added base + soffset + imm unaligned; hardware truncates each of the three to a
multiple of 4 before adding them.
- s_buffer_load* had no bound at all and read past NUM_RECORDS.
- s_load* zero-extended a negative immediate from 32 bits (soffset 8 + imm -4 read ptr + 4 GiB + 4).
- raw buffer_load_dword* checked only the start (offset < num_records), so a dword at NR-1..NR-3 and the tail
of a multi-dword load returned data where hardware returns 0.
Hardware evidence: AMD Radeon RX 6800 (gfx1030, driver 32.0.21045.29003), raw compute kernels, wave32 and
wave64, 155 runs, every result 0 or the stored data, wave32 = wave64 in every dword. Decisive rows:
s_buffer_load imm 0x10 with NR 18 -> 0; imm 0x13 with NR 21 -> data@0x10; soffset 0xe + imm 2 with NR 16 ->
data@0xc; x4 at 0xc with NR 21 -> data, data, 0, 0; stride 4 with NR 5: 0x10 data, 0x14 0; stride 1 with NR 17:
0x10 -> 0; base & 3 = 1 with imm 3 -> data@0. s_load soffset 8 + imm -4 -> @4, soffset 0xb + imm -1 -> @4.
buffer_load_dword at 0xf with NR 18 -> 0; x4 at 3 with NR 18 -> d0..d2 data, d3 0.
Now: off = (soff & ~3) + (imm & ~3), dword i at (base & ~3) + off + 4i. s_buffer_load dword i is 0 and not
loaded (its own selection construct + OpPhi) when off + 4i + 4 > limit, limit = NR * stride or NR (stride 0).
s_load: imm sign-extended from 21 bits, 64-bit sum, no bound. Raw (stride 0, no idxen) buffer_load: dword i
loaded iff O + 4i + 4 <= NR. Structured, idxen, stores, atomics and format loads keep their old first-byte
check (not measured).
Inferred, not measured: s_load with soffset + imm < 0 (64-bit signed sum), s_buffer_load x16 and buffer_load
x3 (same rule), an s_buffer_load immediate with bit 20 set or negative. OOB_SELECT (V# word3[29:28]) changes
vector-load results on hardware (2 probes) and is recorded in docs/design.md, not modelled.
Tests: tests/semantic SmemHardwareRuleTests (evaluator follows branches/phis), RawBufferTailBounds and
MeasuredBoundsShaders assert values and the exact addresses read; 19 fail with main's translator. New GPU
tests cs_smem_bounds, cs_smem_stride_align, cs_smem_sload_neg, cs_buf_tail (expected words derived by hand
from the model) in check.py and scripts/run_gpu_tests.py. test_heap_base_is_added_once now gives its V# a
NUM_RECORDS (it had 0, which the measured bound turns into a load of nothing).
Tested on AMD Radeon RX 6800 / Windows / driver 26.11.2 (Vulkan), on main d937b7f: run_gpu_tests 62/62 passed;
check.py 56 of 56; unittest tests/semantic 460 OK; pytest 1796 passed, 7 skipped, 1 xfailed. The three new tests
that are safe to run with main's translator fail with it on the GPU; cs_smem_sload_neg was not run with it (it
would read 4 GiB past the heap). Indexed (idxen) buffer loads keep their single selection construct.
AI-assisted.
Rebased onto main 8df277f: since 2e8101b the semantic mini interpreter raises on a PhysicalStorageBuffer access that
is not 4-byte aligned, so RawBufferTailBounds rows that load at an unaligned O now set base_low so that base + O is
aligned (the bound sees only O, so the measured O / NR pairs are kept); the base & 3 = 3 row uses offset 5 as a
stand-in for the measured offset 3. Byte-exact data at an unaligned address is no longer asserted there.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Route both four-tap gather paths through the existing binary16 conversion so explicit LOD and offsets keep the two-word result and the following register intact.
Intel's Windows driver (UHD 770 / Xe-LP, 32.0.101.6129) evaluates OpBitFieldUExtract
of a constant that fits in 16 bits with the offset taken mod 16, so s_mov_b32
exec_lo, 0xffff ran all 32 lanes and lanes 16-31 copied the EXEC bits of lanes 0-15.
That is what broke cs_w32_permute case C and lds_fuzz w32 programs 24 and 26 there.
(K >> lane) & 1 gives the same bit on every driver. cs_exec_const.asm checks four
constant masks, three of them 16-bit, in both GPU runners.
Every image went to the fixed %TEMP%\leonida_pe_bounds_test, so two copies
running at once (two build trees, parallel CI jobs on one runner, several
ctest runs on one PC) overwrote each other's pe_bound_N.bin and deleted
the folder under each other at exit. The loser failed with "not an MZ
image", or case 4 loaded the other process's HIGHLOW image and saw a
delta that didn't fit. pe_loader_test and loader_tls_test already add the
process id; this does the same. LEONIDA_TEST_DIR still wins.
Under Wine before 11.2, gta6rt --run sometimes exited 0 although the game
ended with 1 (run_tiny_game_exit_code in CI's Wine 9.0 job: 13 of 64 runs).
end_run signalled the host and called ExitThread; the host's ExitProcess
could then send SIGQUIT to that thread while it was exiting, Wine counted
the thread out twice and the process ended with _exit(0). Upstream fixed
it by blocking SIGQUIT during thread exit (4a9bc42a, wine-11.2).
end_run now parks every caller while a run is in progress (the first one
after recording the code and signalling), so no game thread is mid-exit
when the host calls ExitProcess. This also fixes two threads calling exit
at once: the second one called ExitProcess itself, sometimes before the
first had stored its code, and ended the process with 0 on any OS.
CI requires run_tiny_game_exit_code again.
#895's CBV/SRV/UAV views write placeholder tags (1, 2, 3) into the descriptor heap, and its new check in
d3d12_vulkan_device_test expects an SRV's first dword to be 2. main's SRVs are GFX10 T# words (D3D-72 and the
descriptor table), so the device test failed at line 2211. The PR needs a rebase onto main's descriptor model.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>