Commit Graph

4696 Commits

Author SHA1 Message Date
210d559fdc Runtime: don't pick up an SDL3 package through PATH
CMake turns every PATH entry <prefix>/bin into a find_package prefix, so
with MSYS2's ucrt64/bin on PATH (a common way to get an AMDGPU llvm-mc on
Windows) configure found MinGW's SDL3 for the GameInput shim and MSVC then
failed on the mingw headers. NO_SYSTEM_ENVIRONMENT_PATH drops only those
PATH prefixes; SDL3_DIR, CMAKE_PREFIX_PATH and the system prefixes still
work, as docs/gameinput.md describes.

Found, and the fix proposed, by @Proudnoob4 in #634.

(cherry picked from commit 19a424233ba34e6f7714e892b442690c939b39fb)
2026-11-22 00:33:50 -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
3fc0b2107e Tests: leave d3d12_clear out of ctest until #521 lands
It fails on NVIDIA on the tie rounding #521 fixes (kapitche's RTX 4080 SUPER
run and mine), which would turn ctest red there in the meantime. The test
still exits 77 without a GPU, ready to register.

(cherry picked from commit f2e3bfea672331b9bf5c192f398b6dfe3f1c92b9)
2026-11-22 00:33:45 -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
6ff6067fc8 Merge pull request #953 from bobcatchris 2026-11-22 00:33:15 -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
263284f125 Merge pull request #898 from Felix Croasdale 2026-11-22 00:33:04 -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
033192d050 vk_command_replay_test: cover a subresource copied twice in one list
copy_layout has to order a transfer write that finds its range already in
the transfer layout, because a texture can stay in COPY_DEST and be copied
into again; D3D12 orders copies on the queue and needs no barrier from the
application. That ordering landed in 5ec780c without a test, and the BC7
copy case in d3d12_vulkan_device_test reaches it: on a tree without it the
case reports ten WRITE_AFTER_WRITE hazards under synchronization
validation.

Part G records two buffer-to-image copies into the same subresource with no
transition between them and reads the texture back, so the missing
dependency shows up as a validation error and as the wrong texels.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 23:26:54 -06:00
5826a60187 fix: apply sampler LOD bounds to emulated gathers
Explicit-LOD gathers use four texel fetches that bypass the Vulkan sampler. Decode its 4.8 LOD bounds before selecting the mip so clamped gathers agree with a sampler-backed draw.
2026-11-22 06:25:26 +01:00
1293cc2656 Translator: hardware NaN rules for float min/max/med3, v_fract below 1.0
Measured on an AMD Radeon RX 6800 (gfx1030) with the hw-oracle tool from the
AnyPS5 project, all four IEEE/DX10_CLAMP combinations, wave32 and wave64:

- v_min/v_max f32/f16, each half of v_pk_min/max_f16, and v_min3/v_max3 now
  emit NMin/NMax (one NaN operand gives the other) instead of FMin/FMax.
- v_med3_f32/_f16: FClamp(z, NMin(x,y), NMax(x,y)), and with OpIsNan of each
  operand that can be a NaN, select NMin(NMin(x,y), z) (hardware: min3 when
  any operand is NaN). Non-NaN constants get no check; no select when none.
- v_fract_f32: Fract, then 1.0 -> 0x3f7fffff by compare and select (the NaN
  of fract(+-inf) is kept). v_fract_f16: the same, then a packed 0x3c00 ->
  0x3bff (not after an output multiplier).

Other FMin/FMax/FClamp uses (clamp bit, LOD and conversion clamps) are
unchanged. GPU fixtures ps_fnan_med3 and ps_fnan_fract read their inputs
from memory; on the RX 6800 the two med3 words differed before this change.
tests/semantic/test_float_nan_fract.py runs the measured rows; both
interpreters gain NMin/NMax, and spirv_mini_interp OpIsNan and exact Fract.

tests/semantic/test_alu_med3.py (merged after this branch was cut): its float
reference used Python min/max, which return the first argument for equal
zeros. Hardware orders -0 below +0 (RX 6800: med3(-0, +0, 1.0) = +0,
med3(+0, -0, -1.0) = -0 in every operand order), so the reference now sorts
with that order, and spirv_mini_interp's FMin/FMax/FClamp order zeros the same
way as its NMin/NMax.

Rebased onto 8df277f. Two upstream tests were written against the old
behaviour and are updated: tests/semantic/test_valu_f32_min3_max3_mad.py
(its min3/max3 reference used first-operand order for mixed zeros, and its
negative control replaced FMin/FMax; now -0 < +0, as measured on the RX 6800,
and the control swaps NMin/NMax) and tests/semantic/test_valu_f16_round.py
(it asserted that the interpreter rejects Fract; it now asserts the value).
Upstream had added an OpIsNan/OpIsInf branch to spirv_mini_interp, so this
commit's own OpIsNan branch is dropped (it shadowed upstream's). docs/design.md
notes that an output modifier on v_fract_f16 is applied before narrowing to
f16, an order not measured on hardware.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:25:05 -07:00
b61f68ed2b d3d12_vulkan_device_test: compare OPTIONS1 with the same GPU's host device, not the default adapter
compare_options1 created the host D3D12 device on the default adapter. On a PC with an AMD
iGPU and an NVIDIA card, a run on the AMD (VK_LOADER_DRIVERS_SELECT=*amd*) compared its 32..64
lanes with the NVIDIA's 32..32 and failed (WaveLaneCountMax: ours 64, host 32). It now uses
create_host_device_for_physical, like compare_feature_options: LUID, then PCI ids, then the
default adapter as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:09:59 -05:00
bc3aac59d1 Tests: build and register the runtime ABI test
runtime/test/test_runtime_types.cpp held 595 lines of D3D12/XMem size,
alignment and member-offset checks against the Windows SDK, but no CMake
target referenced it, so none of its static_asserts or 53 runtime checks
ever compiled or ran. Add runtime_types_test with the src/shims include
directories and a ctest entry. The test passes as committed.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 23:09:45 -06:00
ca776a4f5a compute_fixture: say that a Debug build isn't searched 2026-11-22 10:39:23 +05:30
e875297227 d3d12_vulkan_device_test: the predication block's query heap desc no longer hides heap_desc (C4456)
The occlusion-query block from #858 declared a D3D12_QUERY_HEAP_DESC
named heap_desc inside the function that already has a
D3D12_DESCRIPTOR_HEAP_DESC heap_desc (line 2107), and MSVC /W4 warned
C4456. Rename it to query_heap_desc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:08:17 -06:00
9363490570 feat(dxgi): add Vulkan-backed IDXGIFactory4 and IDXGISwapChain3 COM shim with HWND GPU test 2026-11-22 02:06:28 -03:00
dfde5f58e9 fix: allow packed A16 coordinates on texel-offset samples
The address decoder already preserves the full offset VGPR before reading the packed coordinates. Let the existing offset path use those operands, and compare asymmetric packed UVs to the full-precision texel on the GPU.
2026-11-22 06:05:34 +01:00
f61720d877 Translator: s_cmp of a lane mask with -1 compares the real mask word
In a partial wave, lanes that were never launched don't vote but their
bits are 0 in the mask, so the vote called vcc_hi = 0xff "all ones".
Keep the vote for 0 only; -1 goes through wave_mask(). GPU tests for a
40-thread wave64 and a 20-thread wave32.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:04:46 -03:00
69fe9d3752 Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_com.h
2026-11-22 05:01:46 +00:00
08b8dc793f gta6rt: refuse more than one of --dry-run, --init and --run (#886)
--dry-run --run set both flags, so the dry run initialised the modules
and called the entry point. gta6rt now takes exactly one mode and prints
the usage (exit 2) otherwise. Three ctest cases run the stand-in game
with two modes and fail if it is mapped or run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:01:31 -06:00
747d1c34c0 Support overlapping ordinary occlusion in Vulkan replay 2026-11-22 01:59:55 -03:00
9806be2999 Tests: prefer the native Vulkan ICD over Mesa's Dozen on Windows
With the Compatibility Pack installed, Windows enumerates Mesa's D3D12
translation layer next to the real GPU, and Dozen reports DISCRETE_GPU. Every
harness used "the last discrete device wins", so it selected the wrapper and
the resulting failures looked like translator bugs (#915). One shared rank now
treats Microsoft's vendor as a translation layer, then prefers discrete over
integrated over virtual over CPU, keeping the first device on a tie. A CPU-only
test covers the reported enumeration without needing the Compatibility Pack.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 22:58:59 -06:00
5190d597c8 Merge keyboard-pad coverage with controller reading history 2026-11-21 21:58:55 -07:00
dbc428d83c vk_image_fuzz: name the missing device feature, one per line
The skip message said 'lacks ... or the without-format reads/writes', which cost kapitche a vulkaninfo round trip on an Intel UHD 770. It now prints the exact features that are missing, plus the reason when the without-format ones are involved: the translated image_load declares those capabilities for every shader, because its uint/sint path is chosen from the T# FORMAT at run time.
2026-11-22 01:56:25 -03:00
e6c767bdd3 Tools: image_load differential fuzzer with a GPU harness
AI-assisted. docs/shader_validation.md said "Not covered yet: images", and
FUZZ-1..13 touch VALU, memory, LDS, crosslane and control flow but not a single
image instruction. This is the first slice of that gap:

- runtime/test/vk_image_fuzz.cpp: headless harness that binds one 2D sampled
  image from a key=value spec (format, size, texels, T# key) through the
  bindless set and the descriptor table, draws a 64x64 full-screen triangle with
  a caller-supplied VS/PS, and dumps RGBA32F. It enables the without-format
  storage-image reads/writes and fragment atomics the translated image path
  declares, and fails on validation errors with LEONIDA_VK_VALIDATION=1.
- tools/image_fuzz.py: assembles a pixel shader that reads one texel with
  image_load (dmask 0xf, T# in s[8:15]), translates it with rdna2spirv.py, runs
  the harness, and compares every pixel with an independent CPU oracle for the
  T# format. A fetch is a memory read, so the oracle is exact.
- tests/test_image_fuzz.py: the oracle, the texel mapping, the T# word and the
  generated shader, without a GPU.

Covered: R8G8B8A8_UNORM, R16G16B16A16_SFLOAT, R32G32B32A32_SFLOAT and
R32_SFLOAT, at 8/16/32/64 square sizes that divide the draw; a fifth of the
values are NaN, +-inf, +-0 or denormals.
Not covered yet: dmask variants, UINT/SINT formats (they read through the
storage views), mips, 1D/2D-array/3D/cube, image_sample/gather with filters and
borders, and texel offsets with VK_KHR_maintenance8.

Verified on an NVIDIA RTX 2060 SUPER (Linux, 620.73.04, Vulkan 1.4.357):
40/40 programs match under LEONIDA_VK_VALIDATION=1; ctest 11/11; the GPU suite
is unchanged with a clean build. Synthetic fixtures only, no game data.
2026-11-22 01:56:25 -03:00
072620be0c d3d12_vulkan_device_test: the last two waits on fence use submit_and_wait
#850 moved the waits to a counter, but the 1D-texture block still signalled 8 and #858's predication block
12/13. Once the counter had passed those values, SetEventOnCompletion returned at once and the blocks read results
the GPU had not written yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:51:42 -05:00
b72fc5a4fe Keep gamepad readings in order between title polls 2026-11-21 21:46:14 -07:00
482aa3c33f test: isolate typeless volume descriptors from multisample views
The pending multisample fixture already owns the next slots on the common heap. Give the two typeless views their own CPU descriptors so both sampling regressions can run in the same command list.
2026-11-22 05:33:07 +01:00