Commit Graph

4163 Commits

Author SHA1 Message Date
3d15db456b Merge pull request #1017 from Vonsek 2026-11-22 01:08:23 -05:00
075b0a312a Merge pull request #1015 from Vonsek 2026-11-22 01:08:22 -05:00
b9012bc77c Merge pull request #1008 from sanuk369 2026-11-22 01:08:19 -05:00
e857798e4c Merge pull request #992 from sanuk369 2026-11-22 01:08:13 -05:00
294deab8c3 Merge pull request #991 from sanuk369 2026-11-22 01:08:12 -05:00
beef4652c5 Merge pull request #990 from sanuk369 2026-11-22 01:08:12 -05:00
63bb76f079 Merge pull request #820 from kapitche 2026-11-22 01:08:06 -05:00
126de88e22 Merge pull request #743 from totonii 2026-11-22 01:08:06 -05:00
03a14bac7c Merge pull request #742 from totonii 2026-11-22 01:08:06 -05:00
232dd31ceb process: the command line parses back to __wargv (backslash rules, ANSI code page)
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.
2026-11-22 11:36:11 +05:30
998924fea8 feat(d3d12): add ExecuteIndirect CountBuffer and optional BLAS/TLAS/RayQueryKHR support 2026-11-22 03:04:35 -03:00
22465fa6b6 rootsig::pack: 64-bit sums, so a huge constant count can't wrap past the limits
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.
2026-11-22 11:33:49 +05:30
6d7bb1755a Tests: shader tools honor LEONIDA_VK_DEVICE
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>
2026-11-22 00:02:29 -06:00
e99514591a fix(dxgi): preserve R10G10B10A2_UNORM logical backbuffers and reject unsupported formats in ResizeBuffers 2026-11-22 03:00:13 -03:00
9eaf37e96f Distinguish identical connected gamepads in device-ID lookup 2026-11-21 22:59:21 -07:00
f53fc3fa48 Merge upstream large-module scheduling with cache feedback 2026-11-21 22:56:39 -07:00
01c0a56485 d3d12: accept castable formats on committed textures
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.
2026-11-21 21:56:17 -08:00
4407fcdac5 Tests: cover LEONIDA_VK_DEVICE name matching
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>
2026-11-21 23:50:11 -06:00
87d7bf7c43 Translator: SMEM alignment, s_buffer_load NUM_RECORDS bound, signed s_load imm, raw MUBUF per-dword tail
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>
2026-11-21 22:49:26 -07:00
773891bdff fix: pack D16 explicit-LOD gather results
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.
2026-11-22 06:48:05 +01:00
a69977e76f fix(runtime): honor minimum LOD on sampled 2D array views
A Texture2DArray SRV encodes the clamp in its image descriptor. Forward it to Vulkan so sampling keeps the requested mip and array layer.
2026-11-22 06:47:50 +01:00
502462e1c7 rdna2spirv: set constant EXEC lane bits with shift and mask, not OpBitFieldUExtract
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.
2026-11-22 00:46:32 -05:00
da3461826a test_pe_loader_bounds: a temp folder per process
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.
2026-11-22 11:12:36 +05:30
7a6b97c946 Revert "Merge pull request #895 from cobalt-pebble-804"
#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>
2026-11-22 00:39:08 -05:00
830fec3bc1 Replay: refuse lists whose clears need an unset vkCmdClear*Image
prepare() gates every optional ReplayFunctions entry except the two image
clears, so a whole-view render-target, depth-stencil or texture UAV clear,
or the zero-clear detail::initialize runs on an image the tracker holds in
UNDEFINED, called a null pointer when the caller left them unset. The
whole-view clears are now checked in prepare(); the zero-clear, which depends
on the tracker, in replay() before emit. Both return unsupported.

(cherry picked from commit 86e6ca72d9748206476c31cb61f9d1e3f43952bd)
2026-11-22 00:33:47 -05:00
817a5e9f5e Tests: run the eight unregistered D3D12 GPU tests under ctest
d3d12_clear, d3d12_com, d3d12_descriptor, d3d12_method_variants,
d3d12_resource_desc, d3d12_sampler2, d3d12_typeless_rtv and d3d12_uav_clear were
built but never added with add_test, so ctest and CI never ran them. Each now
exits 77 when there is no Vulkan GPU (DeviceStatus::unavailable), as
d3d12_vulkan_device_test does, and is registered with SKIP_RETURN_CODE 77.

(cherry picked from commit 2af37e5da368dd130ba23db385e812635cb1a768)
2026-11-22 00:33:45 -05:00
07402f3828 Merge pull request #973 from Vonsek 2026-11-22 00:33:21 -05:00
1056982e74 Merge pull request #962 from UlteriorMotive00 2026-11-22 00:33:18 -05:00
13ad2f2fe4 Merge pull request #952 from Felix Croasdale 2026-11-22 00:33:14 -05:00
81647000cc Merge pull request #950 from Bushyon 2026-11-22 00:33:14 -05:00
96b9913afe Merge pull request #946 from Vonsek 2026-11-22 00:33:13 -05:00
67cb3cd6ea Merge pull request #931 from nicolas 2026-11-22 00:33:11 -05:00
6d6301c1b5 Merge pull request #919 from bobcatchris 2026-11-22 00:33:09 -05:00
6845ddab45 Merge pull request #909 from Dea7hsmiles 2026-11-22 00:33:08 -05:00
0aab7326d3 Merge pull request #903 from gabrielsteglich 2026-11-22 00:33:06 -05:00
ac93feef4e Merge pull request #897 from Vonsek
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 00:33:04 -05:00
6ac93b21f0 Merge pull request #895 from cobalt-pebble-804 2026-11-22 00:33:02 -05:00
3194d622d7 Merge pull request #891 from bobcatchris 2026-11-22 00:33:01 -05:00
7b51dbd9d8 Merge pull request #888 from enx 2026-11-22 00:33:00 -05:00
7449c0e732 Merge pull request #878 from traeb0n 2026-11-22 00:32:58 -05:00
ed25bce34f Merge pull request #876 from sanuk369 2026-11-22 00:32:58 -05:00
d2a3949e75 Merge pull request #863 from SuarezPM 2026-11-22 00:32:56 -05:00
944d75bf5a Merge pull request #775 from JavierBlanco23
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 00:32:53 -05:00
7a406ccfc0 Merge pull request #763 from cemalyakla 2026-11-22 00:32:51 -05:00
3400c5659d Merge pull request #742 from totonii 2026-11-22 00:32:51 -05:00
fb06ce420e Merge pull request #494 from shelbykb2 2026-11-22 00:32:50 -05:00
4f9e5a605a ID3D12CommandQueue::GetDesc: node mask 0 reads back as 1
The host D3D12 runtime reports NodeMask 1 for a direct, compute or copy
queue created with 0 on a single adapter, as #838 made descriptor heaps and
resources do. d3d12_node_mask_test now compares the six queue cases with
the default adapter and WARP.
2026-11-22 11:02:21 +05:30
61bcc969c4 D3D-86: answer CheckFeatureSupport OPTIONS2-5, 7, 9, 11, 13-16, 18-21 2026-11-22 06:29:05 +01:00
7b11673e33 CheckFeatureSupport(FEATURE_LEVELS): an empty or missing list is E_INVALIDARG
NumFeatureLevels 0 returned DXGI_ERROR_UNSUPPORTED, and a null
pFeatureLevelsRequested with a count was read. The host D3D12 runtime
(NVIDIA and WARP) returns E_INVALIDARG for both. When no requested level
is supported the host also writes MaxSupportedFeatureLevel 0 next to
DXGI_ERROR_UNSUPPORTED; the layer left the field as it was.
2026-11-22 10:58:38 +05:30
2c17fac1d8 Replay: a buffer UAV clear writes its resource's range of a shared VkBuffer
prepare_buffer_uav_clear gave vkCmdFillBuffer/UpdateBuffer/CopyBuffer the
view's offset, which is relative to the resource, without the binding's
buffer_offset. ResourceBinding documents that a buffer may be a range of a
larger VkBuffer (the GPU address arena holds many), and copies, atomic
copies and buffer_at already add it; a clear of such a resource wrote from
the start of the VkBuffer, over whatever lives there. Latent on main (the
device binds buffer_offset 0), live once buffers sit in the arena.

The offset is added after the D3D12 alignment check (relative to the view)
and before the transfer alignment, which needs the absolute offset.
replay_uav_clear_offset_test checks raw, R8, RGBA32 and rectangle clears
with fake transfer functions; no GPU.
2026-11-22 10:58:38 +05:30