Commit Graph

4696 Commits

Author SHA1 Message Date
24418795b8 test: judge the swizzle sources that run in a narrow pixel shader (#618)
ps_bitmask_perm is skipped when a driver runs the wave32 pixel shader narrower
than 32 lanes (#1318), because the "pippi" pattern reads lanes 16-31, which
then do not run and have no defined value. The skip excused the whole test,
including the sources that do run: at 16 lanes wide every lane reads lane ^ 9,
which is inside the running lanes for lanes 0-7, so a wrong word there went
unnoticed on Intel.

The skip now excuses only the sources that are not there. Where the source
lane runs, its word has to be right, so a narrow run is judged instead of
skipped. At 8 lanes wide every "pippi" source is lane 8 or above, nothing can
be judged, and the test still skips.

The translator change this depends on is #2780: a source lane that is not
running reads 0 instead of an undefined value, which is what makes the narrow
run judgeable at all. Until it lands the note in docs/testing.md describes a
behaviour that main does not have yet.

Tested: python -I tests/test_shader_checks.py (70 tests, OK, on main
16282101). No GPU, no game files.

AI-assisted.
2026-11-22 22:28:37 +03:00
3eb80d77e3 Merge main into cov-d16fmt (#2039)
Conflicts:
	scripts/run_gpu_tests.py
	tests/semantic/regen_fixtures.py
	tests/test_shader_checks.py

AI-assisted.
2026-11-22 20:27:12 +01:00
cc4799abdd runtime tests: synthetic fixed-base images take a base that is free under arm64 Wine
loader_test, test_pe_loader_bounds and unimplemented_policy_test build relocation-less images fixed at
0x140000000..0x1a0000000. Under arm64 Wine (CrossOver on Apple Silicon) the process's own allocations sit at
0x100000000 and up and macOS maps its shared region at 0x180000000 (RT-22), so the loader rejected those images
with "preferred base is taken" before the checks ran: loader stopped after 31 checks with 3 failures,
pe_loader_bounds failed 13 checks and unimplemented_policy failed.

New test/free_image_base.h: on Windows it returns the constants unchanged. Under Wine (ntdll exports
wine_get_version) it moves the whole 0x140000000..0x200000000 span to a free window picked top-down, away from
the heap, so each constant keeps its offset and images loaded together still get different bases. The init
image reads its TLS callback addresses from its own ImageBase instead of a constant.

AI-assisted. No game files.
2026-11-22 19:26:59 +00:00
57f5aec0a1 Tests: keep UNORM midpoint clears in WARP-only controls 2026-11-22 15:26:28 -04:00
f5a4b1fbac test: cover the separate FSPX entry count (TEST-625)
The main index keeps its FSPX-keyed entry, but only entries loaded from fspx/index.json are reported as FSPX; a broken or missing sub-index resets the count.
2026-11-22 20:24:41 +01:00
9e931a1f93 test: exclude FSPX entries from the corpus orphan check (TEST-625)
The 24 translated FidelityFX programs are in <shaders>/fspx/index.json, not in the RPF containers this test walks. Compare reached entries against the RPF total and report the FSPX count separately.
2026-11-22 20:24:28 +01:00
849b4ba4c0 runtime: count FSPX index entries separately (TEST-625)
ShaderLibrary::size() includes entries loaded from <dir>/fspx/index.json, which a corpus of RPF containers never reaches. Expose fspx_size() so callers can compare reached entries with the right total.
2026-11-22 20:24:14 +01:00
82cb279597 rdna2spirv: fix TwoSum overflow in Gen.f64_add_mode via FastTwoSum 2026-11-22 21:17:31 +02:00
a922e9edd4 tests: CPU value tests for 8/16-bit and 64/96/128-bit LDS accesses
Two wave32 GPU tests, cs_w32_lds_subdword (ds_write_b8/_b16 and their
_d16_hi forms, ds_read_u8/_i8/_u16/_i16) and cs_w32_lds_wide
(ds_write/ds_read _b64/_b96/_b128, ds_read2st64_b32), and a semantic
test that runs them in the SPIR-V interpreter against a byte-level LDS
model of the ISA rules, with three SPIR-V sabotages as negative
controls. These ops were checked only by lds_fuzz.py, which needs a GPU.

No translator change. RTX 4070 SUPER, driver 610.88: both dumps match.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:17:14 -06:00
fc1e0058e0 file_system: copy-up through a staging name, one at a time
A write-open of a package file copied it straight to its overlay name with
no lock. A process killed mid-copy left a truncated file there that every
later read preferred over the package; two threads write-opening the same
package file both copied, and the second copy_file failed on the taken name,
so that open failed.

write_target now copies into <overlay>\.gta6rt-copy under a private name and
renames it into place, under a mutex that only copy-ups take. Listings hide
the staging folder like .gta6rt-deleted. Without the mutex, copy-then-rename
alone still failed about 2 in 100 runs: a losing rename onto the existing
name briefly holds it, and the winner's open got ERROR_SHARING_VIOLATION.

file_system_test: two threads write-open one 256 KiB package file, 50 rounds;
both opens succeed and the overlay copy matches (fails 3 of 3 runs on the
old code, passes 200 of 200 with this); no staging file is left; a crash
leftover is hidden from a GAME: listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:15:36 -05:00
4c414d1216 tools: ps_oracle.py runs hand-written RDNA2 pixel-shader ISA on AMD GPUs
hw_oracle launches compute kernels only. vk_harness can now write a
pipeline's VK_KHR_pipeline_binary data and build a pipeline from it
(VKH_BINARY_OUT / VKH_BINARY_IN). ps_oracle.py puts assembled ISA in
place of _amdgpu_ps_main in the driver's PAL ELF, raises the pixel
stage's register counts in the msgpack metadata, optionally changes
other metadata entries, and draws with it, reading every pixel's mrt0
words back.

Checked on gfx1036 (driver 26.10.1): v_interp of a varying and the
parameter words P0 / P10 come back as expected. Tests in
tests/test_ps_oracle.py, docs in docs/shader_validation.md.

AI-assisted.
2026-11-22 20:15:34 +01:00
600037cd45 rdna2spirv: image_sample_cl, _b_cl, _c_cl, _c_b_cl: min-LOD clamp forms (EGEN-MIMG-SAMPLE-CL)
The clamp, the component after the coordinates, becomes MinLod on the
implicit-LOD sample (after Bias and Offset in mask order); outside the pixel
stage the LOD is max(0, clamp). a16 and --texel-offset-fallback (Grad|MinLod)
included. GPU tests ps_texture_cl and ps_texture_b_cl on the two-mip texture,
semantic tests, design.md row. Stacked on the image_sample_c change.

AI-assisted.
2026-11-22 20:14:03 +01:00
a094bd2d53 rdna2spirv: declare DenormPreserve 16 so a driver keeps f16 denormals (SHADER-526)
ps_sdwa_f16_const read mrt0 lane y as 0x0000 instead of 0x1c00 on NVIDIA: the
_sdwa src0_sel:BYTE_1 selects the f16 denormal 0x0040 (2^-18), and the driver
flushed it on the way into f32 because the module declared no 16-bit denormal
mode. The translator models f16 arithmetic in f32 with integer narrowing, so no
f32 denormal is involved and that conversion is what the 16-bit mode governs.

Every module now also emits OpExecutionMode %main DenormPreserve 16 with the
matching capability (core since SPIR-V 1.4, so no extension), and the index
lists shaderDenormPreserveFloat16, which vk_pipeline_check requires and
--no-float-controls still drops along with the 32-bit mode.

Tested on an RTX 4070 SUPER (driver 610.88, validation layers on): the GPU test
goes from 4096/4096 mismatches to 4096/4096 pixels exact, and the full GPU suite
from 142/189 to 143/189 passed with 0 failures and the same 46 skips.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-11-22 21:10:20 +02:00
111b634c21 runtime: BufferVaIndex's longest-range bound follows the live ranges
The bound that stops a lookup's walk only grew: once a large buffer was
freed, every later miss still walked back as far as that buffer had
reached. With 20 000 buffers of 256 bytes, a 1 GiB range added then
removed left a miss past the last buffer at 250-600 us instead of ~50 ns
(found by @padhossein in review of #2823).

A multiset of the indexed sizes keeps the bound at the longest range
indexed now; insert and erase stay O(log n), find is unchanged. Inserting
the same (va, id) again replaces its size instead of leaving the old one
in the bound.

buffer_va_index_test checks the bound after erases (same sizes and a
smaller re-registration included), against the longest live range in all
200 random tables, and times the review's miss-after-free case.
2026-11-22 20:09:00 +01:00
fdffac4983 Declare dynamic sampled descriptor indexing in translated SPIR-V 2026-11-23 05:08:57 +10:00
0d5c799b77 Tests: separate WARP-only out-of-row UAV clear controls 2026-11-22 15:08:06 -04:00
36343d86b1 test: prevent present and swapchain tests from stealing focus (SW_SHOWNOACTIVATE) 2026-11-22 20:07:03 +01:00
b34368e7a2 d3d12: exclude 8-bit sRGB formats from typed buffer support 2026-11-22 20:05:06 +01:00
0f414f4838 tiny_game: the header names GAME:\tiny_game_probe.txt, not a tab
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:34:18 +05:30
4b71b65588 fix(test): check stable wave64 reference words
Across-device Tier C checks could pass while a partition-invariant export was wrong. Require the stable words to match the saved wave64 run.
2026-11-22 20:02:54 +01:00
10b88e8580 TEST-433: the skip message states the measured cause (16 live lanes behind a reported 32)
Measured by kapitche: Intel UHD 770 reports gl_SubgroupSize 32 in the fragment stage but runs 16 live invocations, so tiers A and B (32 or 64 live lanes) cannot hold. The skip keeps its condition (minimum subgroup below 32); deriving it from a measured live width is a follow-up.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:01:33 -05:00
654c5360af Revert "TEST-433: skip only devices whose subgroups are all narrower than 32 (the Intel 16-wide premise was wrong)"
This reverts commit e215380e1e.
2026-11-22 14:01:12 -05:00
e215380e1e TEST-433: skip only devices whose subgroups are all narrower than 32 (the Intel 16-wide premise was wrong)
The reporter corrected the probe: Intel UHD 770 reports a subgroup size of 32, so its tier A failures have an unknown cause and must not be skipped; only a device whose largest subgroup is below 32 (llvmpipe) is.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:00:50 -05:00
ed8528885b Validate DXGI ResizeBuffers1 node masks and presentation queues 2026-11-22 22:59:57 +04:00
e620b92644 vk_texture_test: device selection spelled as in #2225
The same pick_device block as #2225, so whichever merges first leaves the other
a trivial merge there.

AI-assisted.
2026-11-22 19:59:18 +01:00
093b6c622a TEST-433: skip the tier A/B pixel fixtures where the fragment subgroup is narrower than 32 and cannot be required
Intel UHD 770 reports fragment subgroup 8..32 but runs pixel shaders 16 wide and cannot be held to 32, so reads
across 16 lanes (permlane, swizzle, bpermute) fail there. Tiers A and B mean exact on 32- or 64-lane subgroups.

The SHADER-10 row also loses the stale text the merge of #2260 left in it: the pre-TEST-319 A list (bpermute and
permlane "not GPU-tested here"), "Corpus coverage is not measured here", "the corpus ones are wave32", "geometry
shaders are not tested" and a repeated sentence, which the census and the GS fixtures (TEST-251) now contradict.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:59:11 -05:00
59bb784066 d3d12_shader_cache_test: avoid passing nullptr to SAL _In_ params on host D3D12 runtime
Windows 11 23H2 in-box d3d12.dll (10.0.22621.5415) AVs with 0xC0000005 when passed nullptr for SAL _In_/_Inout_ parameters (pDesc, pKey, pValue, pValueSize) without the debug layer (reported by @CharlyRien on #2167). Keep all null-pointer checks on the Vulkan layer, skip only raw nullptr _In_/_Inout_ calls on the host comparison, and disable stdout buffering so progress lines flush immediately.
2026-11-22 19:57:44 +01:00
23b458b5f8 rdna2spirv: image_sample_c and image_sample_c_b, depth compares with implicit LOD (EGEN-MIMG-SAMPLE-C)
image_sample_c / image_sample_c_b (and their _o forms) were Unsupported. In a
pixel shader they are OpImageSampleDrefImplicitLod (Bias for _c_b); LOD 0 for
_c elsewhere. The _c_b address order is bias then z-compare (the parser read
the compare first). vk_texture_test now honours LEONIDA_VK_DEVICE. GPU tests
ps_sample_c and ps_sample_c_b, semantic tests, design.md row.

AI-assisted.
2026-11-22 19:57:23 +01:00
91d26fba6d Tests: copycmp::try_create_host takes LEONIDA_HOST_ADAPTER and the name match from host_adapter.h
Review of #2910: host_adapter.h said it follows the same rule as
d3d12_copy_compare.h, with the variable read and the adapter name matched in
both. hostadapter::wanted() and hostadapter::named() now do that once, and
copycmp::try_create_host calls them, so the two cannot come to read the
variable differently.

No change in behaviour: d3d12_vulkan_device, d3d12_buffer_uav, d3d12_shader_cache
and d3d12_stencil_copy give the same exit codes as main with the variable unset,
naming either GPU in any case, "warp" and a name that matches nothing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:56:12 +02:00
22ed0b5179 Runtime: support short typed buffer UAV clears 2026-11-22 14:55:06 -04:00
a14ddbc63c gta6rt: GAME: and the overlay are absolute, so a bare image name has a game folder
`gta6rt --run game.exe`, started from the game folder, set the game folder to the image's parent path, which is
empty for a bare name: the run printed `console paths: GAME: -> , writes -> overlay` and every GAME: open failed
with ERROR_PATH_NOT_FOUND. A relative --game-dir or --overlay worked only until the title changed its current
directory. main.cpp now makes both absolute at startup (keeping the path as given if absolute() fails).

New CTest run_tiny_game_dir: tiny_game's opt-in `game-file` check moves its current directory, then reads
GAME:\tiny_game_probe.txt; check_game_dir.cmake runs it by bare name and with `--game-dir .`. Without the fix both
fail (open errors 3 and 2); with it both pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:24:49 +05:30
9fe7fee5e1 Merge main into gpu-vopc-int (#2220)
tests/semantic/regen_fixtures.py

AI-assisted.
2026-11-22 19:53:43 +01:00
5e3ec685a3 pe_loader: a failed load, dependencies included, is not left findable by name
map_image records a module in by_name_ before mapping, binding and section
protection can throw. The run-time load path erased only the DLL it was
asked for, so a bundled dependency that failed while being bound stayed
registered with unbound imports, and a later LoadLibrary or GetModuleHandle
of it returned that half-loaded image. load() now erases its own key on any
failure; ~Loader still frees the mapping through order_.

loader_test: a parent imports fail_dep.dll, whose import table names a DLL
outside the image. After the failed load neither name is found and a second
load of either fails again (on the old code the dependency was still found).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:53:36 -05:00
161fdf545a fix(test): verify the barycentric fixture gradient
Collapsed interpolation could satisfy the comparison between the raw and interpolated results. Use the known full-screen triangle gradient to verify their agreement is meaningful.
2026-11-22 19:53:30 +01:00
16a98e4bb7 Merge main into valu-int-misc (#1492)
tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 19:52:33 +01:00
676c6abae3 Merge main into coverage-gaps (#1299)
runtime/test/shaders/check.py
scripts/run_gpu_tests.py
tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 19:52:12 +01:00
159d9abcdf d3d12_m4_compute_test: submit the readback batch before the compute batch it waits for
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:51:46 +01:00
4896856544 tests: d3d12_descriptor accepts a floored fractional image-view minimum LOD, which Vulkan permits 2026-11-22 13:51:04 -05:00
dbeb71220c tests: the d3d12_subgroup pixel probe keeps its 0x40000000 tag on Intel (highp copies of the subgroup built-ins) 2026-11-22 13:48:57 -05:00
9c5ec38122 bink_play: play by name, and the stinger when started with no movie
A NAME (a game path or a unique part of it) is looked up in the table
tools/bink_play.py keeps, which bink_play builds once if it is missing; the
table also gives the game folder. A windowed run with no movie plays
Stinger/RSG_STINGER.bk2, so double-clicking the executable plays it. A headless
run with no movie still skips (CTest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:48:54 +00:00
469f1acca0 bink_play: say why in a message box when a windowed run can't start
Started by double-click, the console closes with the process, so a missing
movie or game folder looked like the player not opening at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:48:53 +00:00
fb6f143da9 bink_play: play a game movie in a window, straight from its archive
runtime/test/bink_play.cpp maps the package's Bink2Scarlett.dll with rt::Loader
and plays a .bk2 at its frame rate (GDI window; pause, seek, loop). A movie
inside an archive plays where it is: archive.rpf@OFFSET goes to BinkOpen with
BinkSetFileOffset and the BINKFILEOFFSET flag, so nothing is extracted.
tools/bink_play.py finds the offset from the movie's name (bink_names.py).
CTest runs the headless smoke, which skips without a package and movie.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:48:52 +00:00
a8fae90809 Order the bindless table upload across queues, bound retired generations, keep the in-use set on failure (review of #2740)
Other queues' next submission waits on the timeline value of the submission that carries a new generation's table upload; the submit result is committed under tracker_mutex_; at most 8 retired generations are kept before the flush waits for the oldest one's ticket (queue timelines, not the device); a failed new generation leaves the in-use set and the pending writes alone. The churn test gains an async-compute case (no D3D12 fence from compute to the direct queue), a check that a retired generation is pending right after its submit, and a --validated ctest. Docs: only public sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:46:53 +01:00
51f59d711d Merge buffer-formats-all-v2 (with main) into buffer-stores-rdna2
#2022 now carries main's SHADER-358 / SHADER-364, which did what the stores commit did for the three
older stores: f16 format stores toward zero (Gen.mem_f16), exact NORM rounding (Gen.encode_norm_bits)
and the DST_SEL-dependent routing of a two-component V# store (identity selectors: x, w; the runtime's
X,Y,0,1: x, y; tbuffer: x, y). This merge keeps their translator code, drops the duplicate encoders
(norm_encode_exact, the y-route flag) and what is left of this branch is: the 12 non-FLOAT
10_11_11 / 11_11_10 codes (Gen.FORMATS now holds all 77, gfx1036 validated them: @AwkGrep256, #2022),
the oracle (one store model per path, XY01 store runs, all 77 codes by default on a GFX10 device),
the larger cs_fmt_all fixture, and the docs.

Co-Authored-By: AwkGrep256 <AwkGrep256@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 19:45:42 +01:00
d3b774eed5 PresentX planes: tone map shoulder, SDR white query off the present path, review fixes
- Tone map: identity up to 0.8 of SDR white, extended Reinhard shoulder above it, continuous in value and slope, content
  peak maps to 1.0 (SDR-range content is no longer darkened).
- The Windows SDR white level is read by a background thread (about once a second, only while HDR10 is in use);
  PresentX reads an atomic. A failed query keeps the last good value; QueryDisplayConfig retries on
  ERROR_INSUFFICIENT_BUFFER.
- LEONIDA_SDR_EOTF is case-insensitive, unknown or too long values are logged; setters are atomics; <cwchar> for wcscmp.
- Tests: eight-step HDR10 ramp with hand-calculated bytes, curve properties (monotonic, identity below the knee, peak 1,
  slope continuity), HDR10 plane 1 over SDR plane 0 on HDR10 and SDR outputs, hand-calculated 50% overlay bytes, query cost.
- Docs 4.5: shoulder description, query cost, sources marked (KWin claim unverified, vkd3d-proton file partly read, the
  measured 80 nits only covers the SDR fallback path).
- present_compose.inc rebuilt with glslc 2026.4 (reproducible, spirv-val clean).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:45:00 +01:00
fc5b0c27b6 Register three self-checking Vulkan tests with CTest (TEST-514)
vk_command_replay_test, vk_predicated_copy_test and vk_predicate_capture_test
were built but never registered, so no ctest run executed them. Register them
next to depth24_convert, and have each exit 77 (CTest skip) when the test
device reports no Vulkan device, as depth24_convert_test does, so a machine
without a GPU skips them instead of failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:44:57 -05:00
00b3081534 runtime tests: d3d12_bundle_test and d3d12_first_light_test define _CRT_SECURE_NO_WARNINGS (C4996)
d3d12_bundle_test calls std::fopen (line 518) and d3d12_first_light_test
calls std::getenv (line 68), so MSVC prints C4996 for each. The other
test targets that use them (bink_decode_test, fsr_dispatch_test,
bvh_builder_test, startup_trace_test, ...) define _CRT_SECURE_NO_WARNINGS;
these two now do as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:40:45 -06:00
e67b252dc0 TEST: synchronize texture readback with host reads 2026-11-23 04:37:32 +10:00
839e14dc1e Tests: seven host comparisons take their hardware reference on the layer's own adapter
d3d12_copy_xfmt, d3d12_depth_resolve, d3d12_fence_events, d3d12_indirect_zero,
d3d12_node_mask, d3d12_query_rules and d3d12_resource_desc created their hardware
reference with D3D12CreateDevice(nullptr), the default adapter, and did not read
LEONIDA_HOST_ADAPTER. On a PC with two GPUs the layer then ran on one GPU and the
host driver on the other.

runtime/test/host_adapter.h picks the adapter by the rule d3d12_copy_compare.h
already follows for d3d12_vulkan_device: the adapter LEONIDA_HOST_ADAPTER names
(a name that matches none fails the run; "warp" leaves the hardware pass out),
else the adapter behind the Vulkan device (deviceLUID), else the default adapter.
The tests print the adapter's name instead of "the default adapter".

Measured on a Ryzen 7 9700X iGPU (AMD 32.0.21042.62) next to an RTX 3070
(NVIDIA 610.74, the default adapter): d3d12_depth_resolve with the layer on the
Radeon set aside nine resolves as host quirks before and after, but four of them
were NVIDIA's ("D24S8 stencil as X24_G8"); against the Radeon's own driver the
four are D24S8 depth MIN/MAX. The other six tests print the same results against
either adapter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:35:52 +02:00
bd2194f65d Wait 30 s for the depth resolve fence, not 5 s, so parallel GPU tests stop tripping it (TEST-514) 2026-11-22 10:35:00 -08:00