Commit Graph

4696 Commits

Author SHA1 Message Date
1eaca53672 Merge main into D3D-26: bundles and samplers on main; D3D-26 calls follow the bundle rules
main added ExecuteBundle (command_list.h, d3d12_com.cpp) and samplers
(vulkan_backend.h); both sides are kept. DiscardResource and the atomic
copies are now refused in a bundle, as D3D12 documents, and
WriteBufferImmediate is allowed there (d3d12_com_test covers all four).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:13:23 +00:00
707b194707 Merge main (4abd545) into d3d-25-uav-clears
Conflicts, both sides kept: command_list.h (clear_unordered_access next to
ExecuteBundle's execute_bundle), vulkan_backend.h (fill/update buffer next to
the sampler functions), CMakeLists.txt (the UAV clear test next to the new
descriptor test) and the known-gaps paragraph in docs/d3d12_vulkan.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:11:50 +00:00
f054ef9e43 vk_harness: fix the Float64 unsupported message (a raw newline had split the string literal)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:10:59 +01:00
1b3ddd4cf3 runtime: shim the Debug UCRT (ucrtbased.dll) for the game's argv and exit
A Debug build of the stand-in game links ucrtbased.dll rather than
ucrtbase.dll. The process shim only covered api-ms-win-crt-runtime and
ucrtbase, so __p___argc/__p___argv went to the host CRT. The game then got
gta6rt's own arguments (argc=6) and run_tiny_game failed in the Debug
configuration, which is the Visual Studio generator's default.
2026-11-22 01:10:57 +01:00
25b8b0f3d6 runtime: fences and timing on the Vulkan device (D3D-30)
- SetEventOnMultipleFenceCompletion, ALL and ANY: a null event is one
  vkWaitSemaphores (WAIT_ANY_BIT for ANY); with an event, each fence's
  existing wait thread counts down one shared waiter, so no new threads.
- Queue GetClockCalibration: vkGetCalibratedTimestampsKHR (or the EXT
  alias) over the DEVICE and QueryPerformanceCounter domains when the
  device has the extension (the standalone device now enables it);
  otherwise a submitted vkCmdWriteTimestamp bracketed by QPC reads.
- GetAdapterLuid from VkPhysicalDeviceIDProperties::deviceLUID.
- GetCustomHeapProperties per the D3D12 docs' NUMA table, matching the
  UMA = FALSE the device reports.

d3d12_fence_timing_test covers both calibration paths, the LUID against
DXGI's adapter list and the heap answers against the host runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:10:33 +00:00
d7a08ad45c Runtime: debug markers on VK_EXT_debug_utils and private data on every object (D3D-24)
SetMarker/BeginEvent/EndEvent on command lists are recorded in the IR
(DebugMarker) and replayed as vkCmd*DebugUtilsLabelEXT; on queues they
call vkQueue*DebugUtilsLabelEXT under the submit lock. Labels are used
only when the instance enabled VK_EXT_debug_utils
(VulkanDeviceInfo::debug_utils; the standalone device enables it when
the loader lists it); otherwise the calls are no-ops. Events may span
the lists of one ExecuteCommandLists; an unmatched end is dropped and
labels left open are ended before the command buffer ends, so Vulkan's
begin/end rule always holds. Metadata 0/1 strings become UTF-8 labels;
a PIX3 blob (2) gets a fixed label (open question 21).

SetPrivateDataInterface holds a reference until replaced, removed or
the object dies, and GetPrivateData hands it back AddRef'd. SetName
stores WKPDID_D3DDebugObjectNameW. Both live in the shared Object base,
so every object of the Vulkan device has them.

d3d12_debug_markers_test checks the exact label calls through a
recording vkGetInstanceProcAddr, the no-extension path, and private
data on the device, queue, allocator, list, heap, resource and fence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:10:17 +00:00
06bd42a20e Translator: apply clamp and omod to v_add_f64
v_add_f64 is VOP3Inst<"v_add_f64", VOP3_Profile<VOP_F64_F64_F64>> in LLVM
AMDGPU; VOPProfile gives it HasClamp (f64 is a modifier type) and HasOMod
(floating-point destination). The translator dropped both. The double sum
is now scaled by mul:2/mul:4/div:2, then clamped to [0, 1] (FClamp, as the
f32 clamp_mods does), before it is split into the register pair.

- tests/test_f64_output_modifiers.py: SPIR-V data-flow check per modifier
  combination, plus NoContraction on the f64 add/scale.
- runtime/test/shaders/ps_f64_mods.asm: GPU test (registered in check.py,
  run_gpu_tests.py and regen_fixtures.py). vk_harness enables shaderFloat64
  when the fragment shader declares Float64, else exits 77 (SKIP).
- docs/design.md: contract row with the LLVM profile names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:09:07 +01:00
5290f93523 Merge pull request #361 from Luis Baker 2026-11-21 19:08:38 -05:00
0425c07649 Merge pull request #302 from S1m0ne1997 2026-11-21 19:08:31 -05:00
3a928c5151 Merge pull request #295 from traeb0n 2026-11-21 19:08:30 -05:00
2da77d56e6 Merge pull request #269 from shelbykb2 2026-11-21 19:08:26 -05:00
8050194cef Merge pull request #258 from Parakeet-Wheat 2026-11-21 19:08:24 -05:00
2c6f763e5f Merge pull request #240 from eIBart0 2026-11-21 19:08:23 -05:00
e66e969597 Merge pull request #193 from AREA52 Agent 2026-11-21 19:08:21 -05:00
63f05456f0 Runtime: command-list and allocator rules like the PC runtime (D3D-51)
d3d12_vulkan_device_test now runs the same 25 command-list, allocator, queue
and fence calls on the host D3D12 runtime and on the Vulkan layer, and
compares every HRESULT.

One list at a time records into an allocator, as on the PC runtime. Three
differences are fixed:
- allocator Reset while a list records into it: E_FAIL (was S_OK)
- CreateCommandList on an allocator a list records into: E_INVALIDARG (was S_OK)
- list Reset onto an allocator another list records into: E_INVALIDARG (was S_OK)

An open list now holds a reference to its allocator and marks it busy until
Close or destruction.

Two differences remain, and docs/d3d12_vulkan.md records both:
- Reset with a null allocator crashes the PC runtime (ours returns
  E_INVALIDARG), so that call is not compared.
- Executing an open list removes the PC device (DXGI_ERROR_INVALID_CALL). This
  layer submits nothing and keeps the device, since it has no device-removed
  state yet. The test prints it as a known difference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:06:27 +01:00
aa1c217a57 SHADER-52: wave32 readlane/writelane mask lane select with 31
RDNA2 uses S1[4:0] in wave32 and S1[5:0] in wave64. Always ANDing with 63
left selects 32..63 pointing past a 32-wide subgroup. Fixture cs_w32_lane_wrap
checks lane 40 wraps to 8 on an RTX 5060.
2026-11-21 21:06:06 -03:00
82e9d2e06d test(runtime): include 16x MSAA in resolve comparisons 2026-11-22 01:05:56 +01:00
f0f9ea35c6 Merge origin/main into bpermute-wave32; wave32 bpermute CPU test
Resolve the conflicts with the test lists again. cs_bpermute32 now goes
through main's WAVE32_DUMPS/CS_DUMPS instead of its own W32_DUMPS list, and
the LDS row keeps main's d16 and ds_permute wording. A new pytest asserts
the wave32 ds_bpermute sequence (EXEC select, ballot bit, shuffle, select).
It fails with main's translator, so the fix is covered without a GPU, as a
review asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:05:51 +01:00
e53b9e5450 Tests: add ms_wave_info_s3 mesh shader test for s3[27:24] wave ID 2026-11-21 21:05:43 -03:00
1284712038 Docs/Tools: record SHADER-4 corpus counts and add audit_shader4_regs.py 2026-11-21 21:05:25 -03:00
d546ab799e test(runtime): report resolve comparison and match counts accurately 2026-11-22 01:05:21 +01:00
58c176d48f runtime: match multisample quality query structure fields 2026-11-22 01:04:54 +01:00
69d8741e1a test(runtime): add unit tests for PE loader boundary validation 2026-11-22 01:04:19 +01:00
fb5524f8ac test(runtime): clear multisampled resolve inputs as attachments 2026-11-22 01:03:51 +01:00
8a6deb1ee1 Merge origin/main into fuzz-3-f32-valu
Keep both sides in docs/design.md (contract rows), regen_fixtures.py
(ps_f32_mods + ps_fma_literal), spirv_mini_interp.py (our OpFDiv,
Floor/Ceil/Trunc, Exp2/Log2/Sqrt/InverseSqrt and RoundEven sign fix;
upstream's OpIsNan/OpIsInf, OpConvertUToF/SToF and FMax/FClamp) and
rdna2spirv.py (upstream fmamk/fmaak fix; v_mac_f32 stays with v_mad_f32).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:03:21 +01:00
bdb57efee8 test(runtime): tidy resolve comparison support checks 2026-11-22 01:03:05 +01:00
a818069fbd test(runtime): fix readback descriptor construction in resolve cases 2026-11-22 01:02:44 +01:00
5eda82746f test(runtime): compare resolve results with the host D3D12 runtime 2026-11-22 01:02:26 +01:00
71a16c11cf FUZZ-8: control-flow/EXEC differential fuzzer; wave32 SCC of mask ops is wave-wide
tools/cf_diff.py generates seeded wave32/wave64 pixel shaders from the
control-flow shapes compilers emit (saveexec if/else, v_cmpx, VCC- and
SCC-voted branches, uniform and per-lane loops, two-entry cycles) and
compares every lane's export between:
  * tools/cf_ref.py: cpu_ref's Machine plus branches, compares, v_cmpx,
    saveexec and 64-bit masks (the ISA model, one wave)
  * rdna2spirv + tests/semantic/spirv_wave_interp.py: every invocation of
    one subgroup in lockstep, split at selections and rejoined at merges,
    with the subgroup operations the translator emits
in both the structured and the dispatch-loop form; --spirv-val also
validates each module, --minimize reduces a mismatch.

Finding (fixed here): in a wave32 program s_and/or/xor/andn2/orn2/nand/
nor/xnor_b32 on lane masks set SCC from the lane's own bit instead of the
whole mask, so `s_and_b32 s0, vcc_lo, exec_lo; s_cbranch_scc0` and loops
closed by `s_andn2_b32 exec_lo, ...; s_cbranch_scc1` split the wave. SCC
is now the same subgroup vote as for the _b64 forms. GPU test
ps_scc_mask32 (not run on a GPU yet).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:02:16 +00:00
fc7a4394f2 runtime: report multisample resolve format support and quality levels 2026-11-22 01:01:43 +01:00
be91840c07 Runtime: SetPredication on VK_EXT_conditional_rendering (D3D-18)
- command_list.h: a Predication command (offset 8-byte aligned, EQUAL_ZERO or
  NOT_EQUAL_ZERO; a null buffer turns it off), recorded by
  GraphicsCommandList::SetPredication.
- vulkan_replay.h: begin/end conditional rendering (INVERTED for NOT_EQUAL_ZERO),
  ended before a new predicate and at the end of the list. While predicated,
  whole-view clears go through vkCmdClearAttachments, which conditional rendering
  covers. New ReplayResult::invalid_predication; PreparedList::unpredicated_copies
  counts copies Vulkan cannot predicate.
- Device: VK_EXT_conditional_rendering and its feature enabled when present, and
  buffers created with VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT; without it a
  predicated list is unsupported.
- Tests: command_list_test (recording rules), vk_command_replay_test part C (GPU).
- docs/d3d12_vulkan.md 4.7: what is done; copies and the 64-bit value are open.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:59:11 +11:00
6416481c7b fsr/bvh tests and A.2/A.3: unwind is #176's (or the test's), #93 is TLS only; FSR host imports are 82 on current main
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
fb0d52c60c fsr/bvh tests: read the module TLS index from either loader (#95's tls_slot or #93's tls_index)
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
ba62e9ec9f bvh_builder_test: LEONIDA_BVH_DEVICE=vulkan puts the builder on the Vulkan-backed device (#119)
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
1e7a6c6846 fsr/bvh tests: run on main's loader (#95): Loader::initialise, unwind registered here until #93; FSR checks its TLS block
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
7b28e72909 bvh_builder_test: record slot 62 per call, decode thrown HRESULTs; measured results in d3d12_vulkan.md A.2
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
0feffed584 WIP: bvh_builder_test (local, measuring the constructor) 2026-11-22 00:58:24 +01:00
0729e58ac0 Runtime: optional FSR test through the real loader and the Xbox-ABI device proxy
fsr_dispatch_test maps the package's amd_fidelityfx_upscaler_xbox.dll with rt::Loader (static
TLS and unwind from #93), calls DllMain, and drives it through the public FidelityFX API
(declarations in ffx_api_min.h, from the MIT FidelityFX SDK headers) on a PC D3D12 device
behind the Xbox-ABI proxy. SKIP without LEONIDA_GAME_DIR.

Measured on 1.0.2.1 (RTX 4090) and written up in d3d12_vulkan.md A.3: 0 unimplemented
imports; the PC struct type ids work for configure and the CPU queries; one provider
"4.1.1"; the shipping build only has 1280x720 -> 1920x1080 Quality with HDR, inverted depth
and auto exposure, and wants a version descriptor <= 4.1.1. ffxCreateContext then returns
ERROR without touching the device for the PC DX12 backend descriptor, three guesses at the
Xbox one, and none at all: the Xbox backend descriptor is the missing piece.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
b4e31e3d3a d3d12_vulkan_device_test: the reserved-resource copies wait on fence value 9
The resolve-region test on main now signals 5 and 6, so a wait on 5 returned
before the copies ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:57:57 -06:00
a7ce844d2a d3d12_vulkan_device_test: skip tiling layouts the host runtime refuses
@CharlyRien found in #295 that an RTX 3090 on driver 616.56 (tiled tier 3)
refuses reserved texture arrays whose mips reach the packed tail (cases 2, 6
and 8), which an RTX 5070 on 621.01 accepts; the comparison counted that as a
mismatch. A layout the host refuses is now logged and skipped; one the host
accepts and the layer refuses is still a mismatch; with every layout skipped
the comparison reports itself skipped. The skip path was checked by making
the host refuse one case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:57:06 -06:00
8c8388f599 Runtime: reserved resources and GetResourceTiling on Vulkan (D3D-20)
CreateReservedResource (and 1 and 2) reserve the whole resource linearly, as
docs/d3d12_vulkan.md section 4.2 plans for the first boot: a committed
resource on a default heap underneath, so every tile is backed and starts
zeroed. D3D12's description rules are kept as measured on the PC runtime
(ROW_MAJOR buffers, 64KB swizzle layouts for textures, a format with a tile
shape; GetHeapProperties is E_INVALIDARG on a reserved resource). The Xbox
tiled layout word 0x101 is accepted as 64KB_UNDEFINED_SWIZZLE.

GetResourceTiling comes from src/resource_tiling.h: the standard 64 KiB tile
shapes, standard and packed mips, per-mip tile counts and the tile order. The
device test compares it with the host PC runtime for 18 buffer, 2D, array,
block-compressed and volume layouts; resource_tiling_test checks the same
arithmetic without a GPU. Packed-mip tile counts are the driver's choice and
are this layer's own rule (tight linear size in whole tiles).

UpdateTileMappings and CopyTileMappings log once and do nothing; what that
loses (aliasing, unmapped tiles keeping data) is written down in section 4.2.

Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation.
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:57:06 -06:00
add0b5cfce GPU test for texel offsets (image_sample*_o, image_gather4_lz_o)
SHADER-14. runtime/test/shaders/ps_texoff.asm samples vk_texture_test's 8x8
texture (every texel different, point sampler, clamp to edge) through the
translated shader and exports the texel coordinates it read as integers:

- image_sample_lz_o with an offset computed per pixel: all 64 pairs of x, y
  in -4..3 from the centre of texel (4, 4), each a different texel, none
  clamped;
- image_sample_l_o with (-3, +2) and image_sample_lz_o with (+16, -32), the
  offset dword loaded from an immediate. The second one tells 4-bit, 5-bit
  and 6-bit fields apart; it is outside Vulkan's guaranteed -8..7 and is
  judged only where the device's texel offset limits cover it;
- image_gather4_lz_o of red and of green with the per-pixel offset, at a
  texel corner (shaderImageGatherExtended, not maintenance8).

Expected words are derived by hand from the docs/design.md rule (signed
6-bit fields, x [5:0], y [13:8]) and the texture contents, before any run;
the derivation is in the .asm header and check.py's texoff_words().

Harness: vk_texture_test enables VK_KHR_maintenance8 and
shaderImageGatherExtended when the device has them, prints the texel offset
limits, and with VKT_NEED_MAINTENANCE8=1 exits 77 without the extension
(SKIP in check.py and scripts/run_gpu_tests.py).

vk_harness.cpp is unchanged: its maintenance8 guard (#if defined() on the
structure-type enumerator, never true) was already fixed upstream, which now
uses #ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME.

tests/conftest.py: the sample validator retries with
--allow-offset-texture-operand (what rdna2spirv.py validates with) when
spirv-val rejects a non-gather Offset, and skips on a spirv-val that does not
know the flag.

Tested on an AMD Radeon RX 6800, Windows, driver 26.11.2 (texel offset limits
-64..63, gather -32..31, maintenance8 enabled):
  run_gpu_tests.py: 49/50 passed, 1 skipped (was 48/49, 1 skipped)
    PASS  ps_texoff  4096/4096 pixels exact (offsets +16/-32 judged)
  check.py: 45 of 45 pass, 0 skipped (was 44 of 44)
No translator bug found: tools/rdna2spirv.py is unchanged.

Negative controls (translator sabotaged, test run, reverted). FAIL: sample
offset dropped, x/y swapped, y field at bit 6, 4-bit fields, 5-bit fields;
gather offset dropped, x/y swapped, y field at bit 6; three corrupted
expectations. PASS, so not detected on this GPU:
- fields read unsigned (sample and gather): Offset 60..63 sampled as -4..-1
  and +32 as -32, so the sign extension cannot be seen through Vulkan here;
- 4-bit and 5-bit gather fields: the gather offsets stay in -4..3.
Both are pinned by the new structural test tests/test_texel_offsets.py
instead (signed, bit 8k, 6 bits; it fails with OpBitFieldUExtract).

The test shows that the translated SPIR-V implements the documented rule on
Vulkan; it does not measure the field layout on the hardware. Still not
GPU-tested: sign extension, gather field width, image_sample_o, _b_o,
_c_lz_o, image_gather4_l_o, the z field (3D), 1D/2D-array/cube targets, wrap
or mirror addressing, linear filtering, mips other than 0, other vendors'
drivers, devices without maintenance8.

unittest tests/semantic: 388 OK before and after.
pytest tests (LLVM_MC set): 1467 passed, 6 skipped, 1 xfailed before;
1478 passed, 6 skipped, 1 xfailed after.

AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:55:18 -07:00
500255da2a Merge main and retain typed view cache with bindless preparation 2026-11-21 19:55:10 -04:00
b063c7a613 merge: integrate upstream shader test updates
Keep multi-config build discovery and vertex clipping fixtures while retaining the packed-coordinate sampling check in both GPU runners.
2026-11-22 00:54:32 +01:00
970b045cf8 Merge upstream vertex-clip and shader checks into the mip test
Keep the generated clip variants, whole-quad checks and multi-config tool search alongside the two-mip draws.
2026-11-22 00:53:34 +01:00
f6b3d3a24c Loader: reject a delay-import descriptor with no name table
An IAT without an INT still holds delay thunks, not name RVAs, so eager binding has no symbol to resolve. Reject the form with a clear error. A scan of the installed x64 System32 tree found 4,620 DLLs and 17,558 delay descriptors, none with a missing INT or without dlattrRva. The test now expects the rejection.
2026-11-21 15:51:43 -08:00
399b8ff839 Merge main into D3D-26: the replay test's new part D, the resolve-region section
main's vk_command_replay_test now has a part D (sync/access pairs), so the
D3D-26 test becomes part E. The device test's D3D-26 section signals fence
value 7, after main's resolve-region section took 5 and 6. The docs keep
both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:49:29 +00:00
4abd54571b runtime: rename shims/process.h to process_shim.h (it hid the CRT's <process.h> from <thread>)
With runtime/shims on the include path, <thread>'s #include <process.h> found #316's header, so
_beginthreadex was undeclared in d3d12_com.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:47:53 -05:00
76782b4b9b Runtime: skip the 1.2 path in d3d12_xs_root_signature_test on old runtimes
test_version_1_2 serialized a 1.2 signature before checking feature support,
so it would fail on an in-box runtime that lacks 1.2 (e.g. Windows 11 23H2).
Check CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE) up front and skip the
whole 1.2 path when HighestVersion < 1.2, matching the root_sig_test fix.

AI-assisted (Cline).
2026-11-22 00:47:28 +01:00
43ed7531b6 runtime: residency and power methods on the Vulkan device as documented no-ops (D3D-33)
MakeResident, Evict, SetResidencyPriority, EnqueueMakeResident, SetStablePowerState and
SetBackgroundProcessingMode. Vulkan memory stays resident until it is freed and paging is the
kernel driver's job, so there is nothing to do; each method still checks its arguments
(E_INVALIDARG) and EnqueueMakeResident signals its fence so a queue waiting on it does not hang.
SetBackgroundProcessingMode sets its completion event at once. d3d12_vulkan_device_test covers the
success paths, bad arguments, and the fence signal seen by a queue Wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:47:00 +00:00