Commit Graph

4696 Commits

Author SHA1 Message Date
68ade67da9 Merge pull request #324 from Luis Baker 2026-11-21 18:07:59 -05:00
abefe80779 Merge origin/main into shader-34-wqm; WQM review fixes
- vs/gs/ms: no OpGroupNonUniformQuadSwap (only guaranteed in fragment and
  compute); shuffle from the quad's four lanes there.
- 32-bit forms in wave64 write only their own half of EXEC/VCC and vote SCC
  over that half; mask_src accepts exec_hi. New GPU test cs_wqm_w64_half.
- cs_wqm_w32: read SCC right after s_wqm.
- test_wqm_on_data checks the real constants and shifts; new vs and half tests.
- docs: narrowed claims (SCC vote needs 64-wide or emulation, lane
  assumptions, partial quads, helper invocations untested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:06:34 +01:00
489258fda5 Resolve colour MSAA regions into destination offsets 2026-11-22 00:05:17 +01:00
1718e02155 Merge origin/main into shader-36-gather-wrap
Keep both sides: main's ps_vcc_x2 / ps_tex / bindless and irreducible-CFG tests
next to ps_gather_wrap, main's buffer-format-store row next to the updated
gather row, and both the literal-SGPR table and #298's mask tokens in store_reg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:01:57 +01:00
1186f99340 Merge updated Leonida GPU runner into class compare fix 2026-11-21 23:57:44 +01:00
437081fdb6 Runtime: parse version 1.2 root signatures, and read RTS0 table ranges from their offset
parse_rts0 refused D3D_ROOT_SIGNATURE_VERSION_1_2 blobs. 1.2 is 1.1 plus
D3D12_STATIC_SAMPLER_DESC1::Flags: the PC serializer writes RTS0 version 3 with
14-dword static samplers (13 before). The model gains Version::V1_2 and
StaticSampler::flags. The canonical codec writes the flags only for 1.2, so 1.0/1.1
encodings are byte-for-byte unchanged.

Checking it against the real serializer found an older bug: a descriptor table's
payload is {num_ranges, ranges_offset} with the ranges at that offset, but the
parser read them inline after the count. Every table came back with a wrong range
type and count. The oracle test only covered constants and a CBV, so it never saw it.

root_signature_oracle_test now serializes 1.0, 1.1 and 1.2 signatures with a
two-range table, a root SRV and two static samplers (1.2 with a UINT border colour,
then non-normalized coordinates). Every sampler field, the ranges and the canonical
round trip must match. root_signature_test adds hand-built 1.2 and table payloads
and their truncation controls.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:57:07 +01:00
5560ac86ce Merge origin/main into bpermute-wave32
Resolve the conflicts with the GPU test lists and counts (#203, #212, #218,
#222, #235, #246, #219, #298, #230), and keep main's partial-wave rule for
ds_bpermute_b32 in wave64. The wave32 path gets the same ballot, so a
source lane that isn't running reads 0 there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:56:56 +01:00
257e3856cc Runtime: GetResourceAllocationInfo on the Vulkan device (D3D-23)
GetResourceAllocationInfo, GetResourceAllocationInfo1 and
GetResourceAllocationInfo2 were generated stubs. Buffers take their width
rounded up to 64 KiB. A texture's size is what its VkImage needs
(vkGetDeviceImageMemoryRequirements, or a throwaway image without it),
rounded up to its D3D12 alignment: 64 KiB, 4 MiB with MSAA, or the small
alignment the description asks for. A 4 KiB request that doesn't qualify
is invalid, as on the PC runtime; the MSAA 64 KiB one has no size limit
there. Texture creation and these queries share one VkImageCreateInfo.

d3d12_vulkan_device_test compares buffer sizes, alignments and invalid
descriptions with the host PC runtime, and checks the per-resource layout
of the Device4/Device8 variants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:55:11 +11:00
adbe6fd42e Tests: ps_scc_minmax checks SCC of s_min and s_max on a tie 2026-11-21 18:54:42 -04:00
ff45269e68 tiny_game: _CRT_SECURE_NO_WARNINGS for its plain fopen (MSVC C4996) 2026-11-21 23:54:13 +01:00
e444c83335 GPU test for the S# and T# mip fields through gfx10_descriptors.h
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>
2026-11-21 23:53:51 +01:00
75e666e615 Runtime: convert UINT render-target clear values numerically 2026-11-21 18:53:21 -04:00
7fefe7f425 Merge upstream cube sampling with the two-mip Vulkan fixture
Keep the cube array at its original extent and allocate a separate upload range for the two-dimensional mip chain. Both shader registrations now run through the updated upstream runner.
2026-11-21 23:51:27 +01:00
4d18ef9d62 Merge branch 'main' into fix/rdna2-float-to-int-saturation 2026-11-21 23:51:23 +01:00
0b2ca369c2 Gather address modes: emit only the needed code, document FORCE_UNNORMALIZED, discriminating tests
A literal S# mode emits only its own wrap/mirror/mirror-once code (no dead
chains); a run-time S# still selects among all four. The S# value mapping now
cites Mesa gfx6.json and RADV radv_tex_wrap. FORCE_UNNORMALIZED on a run-time
S# is not applied (not confirmed on hardware, so not guessed): documented as
the second remaining approximation. Tests cover all 16 literal x/y mode pairs
with per-axis op counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:50:47 +01:00
0ca9bb8bc0 Runtime: gta6rt --run, and a stand-in game executable run through the loader
gta6rt --run <exe> [-- args] maps and binds the executable, initialises its
modules and calls its entry point on a game thread. shims/process.cpp answers
the process-level imports through the game's own import table: argv/argc and
GetCommandLine are the game's (UCRT api-set/ucrtbase and msvcrt forms), and
exit/_exit/quick_exit/ExitProcess/abort end the run with that exit code
instead of the host. gta6rt then exits with the game's code directly, so the
game's atexit handlers don't run during host shutdown.

tiny_game.exe (CTest run_tiny_game, run_tiny_game_exit_code) does what a title
does in its first second: arguments, a static initializer, a 4 MiB allocation,
a file round trip, a thread, and xgameruntime.dll imports, which the shim
registry answers instead of the link-time stub. thread_local and a C++
exception are opt-in (LEONIDA_RUN_TLS / LEONIDA_RUN_EH) until #93 and #176.
2026-11-21 23:50:31 +01:00
3dd8007237 translator: whole-quad mode (s_wqm_b32/b64) on lane masks and data (SHADER-34)
s_wqm on EXEC/VCC/an SGPR mask is no longer the identity: the lane ORs its
bit with its quad's (two OpGroupNonUniformQuadSwap, or four x_buf reads under
--wave64-emulate), SCC is the wave-wide any. Data operands compute the quad
bits directly. GPU tests cs_wqm_w64, cs_wqm_w32, ps_wqm; design.md row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:45:36 +01:00
ce1eb6ae85 Merge latest Leonida main into class compare fix 2026-11-21 23:42:07 +01:00
44a94f35ca Runtime: widen enhanced-barrier stages so every access has a stage that can perform it
D3D12 lets an access be named with a sync scope whose Vulkan stages cannot perform it:
SYNC_ALL_SHADING with ACCESS_VERTEX_BUFFER is valid D3D12, but VERTEX_ATTRIBUTE_READ needs
VERTEX_ATTRIBUTE_INPUT. Vulkan rejects such barriers (docs/d3d12_vulkan.md listed it as a known gap).

vulkan_barrier_scope maps each side of a global, buffer or texture barrier and adds the narrowest
stage that supports any access left without one (the synchronization2 "supported access types"
table). The access is never dropped, so the dependency still covers everything the application
named. CLEAR only writes, and ALL_GRAPHICS holds no transfer stage, so transfer reads get ALL_TRANSFER.

vk_command_replay_test part D records all 360 D3D12 sync/access pairs as global, buffer and texture
barriers: 462 validation errors before, 0 after, on Intel(R) Graphics. d3d12_state_map_test checks
that stages only grow, accesses never change, and pairs Vulkan already accepts are left alone.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:42:05 +01:00
0bcf104719 Merge upstream/main and retain both Vulkan texture checks 2026-11-21 23:41:25 +01:00
4d010bf4bd Merge pull request #176 from Spaghetih 2026-11-21 17:38:46 -05:00
e28fe7281b Merge pull request #191 from Dea7hsmiles 2026-11-21 17:38:46 -05:00
cd4fc9a606 Merge pull request #247 from crastinator 2026-11-21 17:38:38 -05:00
30ad4802c4 Merge pull request #298 from AlxcBTW
# Conflicts:
#	docs/design.md
#	tests/test_translate.py
2026-11-21 17:38:35 -05:00
b779cc17e1 Merge pull request #301 from Shuvam Pandey 2026-11-21 17:38:32 -05:00
5e0400fe52 Merge pull request #203 from Ayinaki 2026-11-21 17:38:29 -05:00
8e2bc63836 Merge pull request #287 from troythedecoyx 2026-11-21 17:38:29 -05:00
5d04f78a1c Merge pull request #275 from S1m0ne1997 2026-11-21 17:38:23 -05:00
263fcbdba8 Merge pull request #270 from nicolas 2026-11-21 17:38:23 -05:00
aa0d8a8ba7 fix: report unsupported two-mip Vulkan devices
Return the established skip code for unavailable graphics capabilities so unsupported hardware yields a distinct test result. Preserve failures for Vulkan allocation and enumeration errors.
2026-11-21 23:38:08 +01:00
eef019d7ba Keep clip regressions alongside the merged bindless texture check 2026-11-21 14:37:58 -08:00
83d0637267 runtime: the D3D12 COM library links d3d12_xs_device.cpp (#224 needs the device behind the proxy); xgameruntime reads LEONIDA_DEVICE_TYPE with GetEnvironmentVariableA (C4996)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:36:45 -05:00
f2df1ed542 Translator: image_gather4_l applies the S# address mode at the border (SHADER-36)
The four-fetch emulation of image_gather4_l(_o) clamped every texel to the
edge. Each coordinate now goes through the S#'s CLAMP_X/CLAMP_Y (wrap, mirror,
clamp to last texel, mirror once), read at translation time from a literal S#
and from the SGPR at run time otherwise. A literal S# with a border mode or
FORCE_UNNORMALIZED is Unsupported.

GPU test ps_gather_wrap (vk_texture_test) with hand-derived expected values;
wired into check.py, scripts/run_gpu_tests.py and tests/test_shader_checks.py;
pytest cases in tests/test_translate.py; docs/design.md row updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:36:09 +01:00
fa8beb755a Translate v_cmpx_class_f32 as an EXEC-only compare 2026-11-21 23:35:42 +01:00
ce41eba4f7 Merge current main and preserve distinct mesh and clip harness modes 2026-11-21 14:33:12 -08:00
89b74d8e40 Add the hand-written RDNA2 conversion shader 2026-11-21 23:32:57 +01:00
d798c76853 test: distinguish explicit mip zero from implicit minification on Vulkan
A single-level view produces the same image for both sampling operations. Exercise both against the same minified view so the readback detects a wrong LOD or swapped texture coordinates.
2026-11-21 23:31:25 +01:00
b9552cd924 Translator: convert cube sample coordinates for the 2D-array view
The hardware takes a cube sample's s and t in [1, 2] and its third
coordinate as 8 * slice + face (Mesa ac_nir_lower_tex_coords.c, LLPC
ImageBuilder.cpp). Samples and gathers passed them unchanged to the
6-layer 2D-array view; they now use s - 1, t - 1 and layer
6 * slice + face.

ps_cube_sample checks every pixel on a GPU (vk_texture_test cube), and
test_cube_sample checks the coordinates without one.
2026-11-22 04:15:43 +05:45
a2e41646c8 GPU tests: report a test program Windows refuses to start, not a traceback
On Windows 11, Smart App Control blocks freshly built unsigned programs it
has no reputation for (WinError 4551, "An Application Control policy has
blocked this file"), and which ones it blocks changes with each rebuild.
run_gpu_tests.py then stopped the whole run with an OSError traceback, and
check.py did the same from mesh_w64x_test.

- check.start_failure() turns the OSError into one result line naming the
  program and, for the Windows refusals (4551 Application Control, 1260
  software restriction policy, 225 Defender), who refused it and how to
  allow it.
- check.run(), mesh_w64x_test(), run_gpu_tests.run_cmd() and the
  ps_texture_sample launch report it as a FAIL of that test and go on with
  the rest. It is a failure, not a SKIP: a blocked run must not look green.
  pixel_test() passes the reason on instead of "vk_harness failed".
- A missing program still stops check.py with the build instructions.

tests/test_gpu_blocked_program.py fakes the error, so it runs on any OS.

AI-assisted (Claude Code). Tested on Windows 11 Home, NVIDIA GeForce RTX
4060 Ti (driver 32.0.16.2124), on main 36ace71:
- the new tests: 7/7 on Windows and on Linux (WSL Ubuntu 26.04); 5 of
  them fail without the fix
- end to end, with test programs Windows really refuses (WinError 216):
  run_gpu_tests.py and check.py print one FAIL line per test and exit 1,
  no traceback
- run_gpu_tests.py: every PASS/SKIP identical to main, natively (29/49,
  20 skipped) and with LEONIDA_W64_EMULATE=1 (47/49, 2 skipped); ctest
  12/12; tests/test_*.py all pass; tests/semantic 388 OK

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:26:33 -06:00
94ff4c9da9 Merge remote-tracking branch 'origin/main' into test19-vcc-x2-gpu
# Conflicts:
#	runtime/test/shaders/check.py
#	runtime/test/vk_harness.cpp
#	scripts/run_gpu_tests.py
#	tests/test_shader_checks.py
2026-11-22 00:24:49 +02:00
27d1b11b64 Runtime: register each mapped image's x64 unwind table (.pdata) with RtlAddFunctionTable
Images the loader maps by hand are unknown to the system unwinder, so an exception raised in or passing through one couldn't be dispatched and killed the process. load() now validates the exception directory (entries in bounds, sorted, non-overlapping; zero-length entries allowed, as in System32's symcryptk.dll) and registers it; the loader removes it before freeing the image. Rules measured over 3,780 x64 System32 images (5,023,071 entries) and the 16 package DLLs.

Tests: loader_test covers registration, removal and six corrupt tables on hand-built images; pe_loader_test checks a fixture SEH fault is caught by the image's own handler (fails without registration) and, with LEONIDA_GAME_DIR, every package DLL's table.

AI-assisted.
2026-11-21 23:18:59 +01:00
bafda15ae0 runtime/CMakeLists: register root_sig_test with CTest
Since #106, root_sig_test is built from a plain shell too, but it had no add_test, so ctest never
ran it (noted by @TricksterG on #106). Register it next to device_proxy, under the same
if(TARGET) guard, so builds without d3d12.lib are unchanged.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:13:41 +01:00
6d3f80a0ff GPU tests: skip bitmask_perm on unknown width, carry the harness skip reason
Decide ps_bitmask_perm from the reported subgroup width before the
pixel count, skip when the width line is missing, and include the
harness's unsupported reason in the GPU runner skip.
2026-11-21 22:10:27 +00:00
cc1f4d3597 Merge pull request #230 from Jan Trencansky
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 17:09:46 -05:00
78bac0ead5 Merge pull request #235 from shuv-amp
# Conflicts:
#	tests/semantic/regen_fixtures.py
#	tests/semantic/spirv_mini_interp.py
2026-11-21 17:08:27 -05:00
345465a2d6 Merge pull request #257 from IAmNotSiob 2026-11-21 17:07:42 -05:00
5773165b67 Merge pull request #241 from 0xTehuti 2026-11-21 17:07:42 -05:00
b80e3baddf Merge pull request #228 from Jan Trencansky 2026-11-21 17:07:41 -05:00
77c466c5b5 Merge pull request #224 from 0xTehuti 2026-11-21 17:07:41 -05:00
fdaf5e402e Merge pull request #246 from LuanFreitas 2026-11-21 17:07:40 -05:00