Commit Graph

4696 Commits

Author SHA1 Message Date
0b880fb79a Merge pull request #927 from totonii 2026-11-22 03:14:10 -05:00
ea512f284c Runtime: size the bindless set's arrays from the device's descriptor limits
Set 0's 2D, sampler and storage arrays were constexpr (4096 2D images, 1024
samplers, 256 per storage array): one full D3D12 sampler heap (2048) did
not fit and bind_image/bind_sampler fell back. They are now sized once, when
the device creates the set, from the update-after-bind or plain limits:
today's sizes as the floor, then samplers up to min(4096,
maxSamplerAllocationCount - 64), 2D images up to 65536, storage up to 4096.
Sizing at creation keeps the set layout fixed for the pipelines built on it.
2026-11-22 13:41:58 +05:30
7afab7fa00 Merge origin/main into d3d90-castable-placed (standalone surface fix ff697417; keep draw/dispatch replay fields) 2026-11-22 00:10:14 -08:00
bb36812235 perf(vulkan): conditional Sync2 readback flush, O(1) deferred deletion, lock split, TDR safety, and centralized FenceWaitDispatcher 2026-11-22 05:05:36 -03:00
d833221c42 d3d12_indirect_rt_test: keep the device functions, mark them [[maybe_unused]]
The previous commit removed 32 functions that the draw and RayQuery blocks
call. Those blocks are only compiled when glslangValidator generates the test
shaders, so without it they looked unused. Restore them and declare them
[[maybe_unused]] instead: C4189 goes away when the blocks are compiled out,
and nothing changes when they are compiled in.
2026-11-22 05:02:09 -03:00
0544ba9a21 d3d12_xs: rehash the RTS0 blob after clearing the Xbox flag byte
The host root-signature deserializer checks the DXBC container hash, not
the 0x03000000 flag byte: it accepts a flagged blob with a valid hash and
rejects one with a stale hash. The shim cleared the byte in a copy and kept
the old hash, so it turned blobs the host accepts into E_INVALIDARG. It now
recomputes the hash (DXBC's MD5 variant, as vkd3d and Wine) after clearing.
2026-11-22 13:30:09 +05:30
81fc5425bd test(d3d12): add post-vkDestroyDevice leak check, cross-queue shared-texture handoff, and TIMEOUT 120 to d3d12_multithread 2026-11-22 05:00:06 -03:00
cc76514229 fix(runtime): detach initialised PE modules before unmapping them
Deliver TLS and DllMain process-detach notifications in reverse dependency order while every mapped image and TLS block is still live. This lets mapped DLLs unregister FLS callbacks before their code is freed. Cover failed attach, map-only loads, partial initialisation, teardown ordering and malformed TLS tables with synthetic PE tests.
2026-11-22 14:56:50 +07:00
71eea4a73e GPU tests: vk_bindless_test and vk_image_fuzz skip below 144 push constant bytes (TEST-149)
Both harnesses create a pipeline layout with the 144-byte translated
user-data block and never checked maxPushConstantsSize, so on a
128-byte device (Intel Arc, some AMD drivers) they failed validation
instead of skipping, although every pixel was exact. Each now prints
"unsupported: need 144 push constant bytes, device has N" and exits
77 before creating anything, as vk_texture_test does since 0c84bff;
the range uses the same constant.

run_gpu_tests.py already reported ps_tex's 77 as SKIP; image_fuzz.py
skipped it with a fixed message and now quotes the harness's
unsupported line. CPU tests cover both runners' 77 path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:52:32 -06:00
fd94dba66a d3d12: register shaders' literal S#s without a heap slot (rt::d3d12::register_samplers)
Shaders that build an S# from immediates look it up through the descriptor
hash probe like any other S#, but nothing registered those keys, so they
sampled through the fallback nearest-clamp sampler. register_samplers runs
CreateSampler's path (decode, VkSampler, key in set 0) for each S# without
a heap slot; the call at pipeline creation comes with #291's shader index.
2026-11-22 13:21:06 +05:30
fcdf2b391d Merge pull request #1136 from quackottu 2026-11-22 02:47:52 -05:00
004aedde5e Merge pull request #1134 from quackottu 2026-11-22 02:47:52 -05:00
d6ff3e6609 Merge pull request #1130 from quackottu 2026-11-22 02:47:50 -05:00
8fe22c7431 Merge pull request #1128 from quackottu 2026-11-22 02:47:49 -05:00
b4db783bb7 Merge pull request #1127 from Jess-Doit 2026-11-22 02:47:49 -05:00
943182b776 Merge pull request #1126 from quackottu 2026-11-22 02:47:49 -05:00
f7679b4909 Merge pull request #1104 from AlxcBTW 2026-11-22 02:47:41 -05:00
1bc8459361 Merge pull request #930 from BACONMANXDGOD 2026-11-22 02:47:39 -05:00
bc59ef4646 d3d12_xs proxy: slots 14/62/76 and heap GetDevice clear the output before failing
d3d12.h declares these outputs _COM_Outptr_ (NULL on failure), and the
inner Vulkan device clears it, but the Xbox-ABI proxy returned an error
with the caller's pointer untouched: slot 14 created into a local, and
slots 62/76 and heap slot 7 checked riid/desc before touching out.
2026-11-22 13:15:37 +05:30
73dd6d7dce Runtime: depth and stencil resolves in ResolveSubresourceRegion
MIN and MAX of either plane, and AVERAGE of the depth plane when Format is
the plane's own format, as the PC runtime accepts them (RTX 5070 and WARP).
Each resolve is a vkCmdBeginRendering scope with no draws: the MSAA plane
is the depth or stencil attachment and the destination plane its resolve
target, checked at record time against D3D12's rules and the device's
supported resolve modes. Colour resolves are unchanged.
2026-11-22 13:14:43 +05:30
2133c0d8c8 d3d12_indirect_rt_test: drop the 32 device functions it loads and never calls
The DF block loaded 35 Vulkan device functions and the test calls three
(vkGetDeviceQueue, vkDeviceWaitIdle, vkDestroyDevice). MSVC 14.52 reports each
unused one as C4189 under /W4.
2026-11-22 04:41:47 -03:00
1979b944f5 rdna2spirv: d16 image_load reads integer images through their uint/sint views
A d16 image_load skipped the T# FORMAT branch the 32-bit load uses and
always read the float sampled view, which integer images are never bound
to, so a min16uint/min16int Load returned garbage (sint texel 14774 for
129 on an RTX 5070). d16 loads now go through image_load_typed and pack the
dmask components two per VGPR: f16 from the float view, the 16-bit integer
(truncated) from the uint/sint views.
2026-11-22 12:57:13 +05:30
36d073f79d Merge remote-tracking branch 'origin/main' into pr1083-merge-main
# Conflicts:
#	runtime/src/vulkan_backend.h
#	runtime/src/vulkan_replay.h
2026-11-21 23:26:25 -08:00
61a2680ad9 Replay: copies between a BC format and its same-width uncompressed format
D3D12 allows CopyTextureRegion/CopyResource between a BC format and an
uncompressed one of the same bit width, one texel standing for one 4x4
block (Format Conversion using Direct3D 10.1); WARP and the RTX 5070 copy
them byte for byte. The replay compared the box with the destination in
texels and the resource shapes texel for texel, so every such copy was
refused, and one invalid uint->BC box reached vkCmdCopyImage out of bounds.
Bounds are now checked in blocks of each side, the extent is in source
texels, and partial BC edge blocks are still refused.
2026-11-22 12:55:40 +05:30
2933767eac Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
Keep-both resolutions per #313's conflict analysis: main's ExecuteIndirect /
acceleration-structure / debug-marker / depth24 / node-mask features alongside
the stack's arena, compute and draw paths. Main's indirect and AS offsets gain
the arena's buffer_offset / heap_base compensation; AS resources on default
heaps get their GENERIC structure over the arena range. Reset clears
stencil_ref_set_ next to reset_state, and OMSetStencilRef sets it. README takes
main's (the crypto-token lines stay deleted).
2026-11-21 23:23:18 -08:00
851eb563b6 gameinput: keyboard pad moves and aims: WASD left stick, mouse right stick, mouse buttons LT/RT
The keyboard pad only pressed buttons, enough for menus. WASD now drives
the left stick (opposite keys cancel, diagonals on the round gate), cursor
movement the right stick (decaying back to center), and the right/left
mouse buttons the left/right triggers. Everything is released on focus
loss. A set_cursor_source seam sits beside set_keyboard_source for tests.
2026-11-22 12:49:29 +05:30
a8b83d8565 DXGI swapchain: Present checks its arguments, ResizeBuffers refuses held buffers, 0 means the client area
Measured on the host DXGI (RTX 5070 and WARP): Present(n > 4) is
DXGI_ERROR_INVALID_CALL and DXGI_PRESENT_TEST doesn't present;
ResizeBuffers while the app holds a back buffer is DXGI_ERROR_INVALID_CALL
and keeps the size; a zero width or height at creation or in ResizeBuffers
takes the window's client area. The shim presented on TEST, destroyed held
buffers, and used 256x256 / the old size.
2026-11-22 12:49:02 +05:30
a0a6d2f07c Translator: --texel-offset-fallback for image_sample*_o without VK_KHR_maintenance8
A run-time texel Offset outside gather needs VK_KHR_maintenance8, which NVIDIA
Pascal lacks, so ps_texoff skips there and 4 PS (31 image_sample_o) can't run.
With --texel-offset-fallback the offset is folded into the coordinate:
coordinate + offset / size of the sampled level (0 for _lz/_c_lz, the LOD for
_l, OpImageQueryLod's for implicit samples, plus the bias for _b; floored and
clamped). An integer offset commutes with wrapping and clamping, so this is
exact at that level for every address mode; only a trilinear blend differs
(the coarser level moves by offset / 2). Implicit samples become Grad samples
with the unshifted coordinate's derivatives, so the LOD doesn't change with a
per-pixel offset. Gathers keep their Offset (shaderImageGatherExtended).

- LEONIDA_TEXOFF_FALLBACK=1 for build.py, check.py and run_gpu_tests.py;
  vk_texture_test then isn't asked for maintenance8, and texoff_problem also
  judges the +16/-32 sample.
- runtime/test/shaders/ps_texoff_implicit.asm: ps_texoff's per-pixel sample
  as image_sample_o, the corpus form.
- tests/test_texel_offsets.py: the fallback for every sample form, including
  spirv-val without --allow-offset-texture-operand.
- docs/design.md "Texel offsets", docs/testing.md.

GTX 1060: ps_texoff and ps_texoff_implicit 4096/4096 exact (SKIP before).
Corpus: the 4 PS translate and validate; needs_maintenance8 4 -> 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 23:18:38 -08:00
236b0acec3 pe_loader: honour NumberOfRvaAndSizes, and refuse a forwarder ordinal past 65535
Data directories past NumberOfRvaAndSizes were read anyway (only the
exception directory checked the count), so stale bytes there were parsed
as import, delay-import, export or relocation tables. And resolve_forwarder
range-checked the ordinal before adding each digit, so '#65537' passed and
was cast to ordinal 1. The hand-built test images now declare their 16
directories.
2026-11-22 12:48:35 +05:30
d3841c0c0e d3d12_fence_timing_test: bound the calibration check by the calls' own durations
The two GetClockCalibration results had to agree within 2 ms. The fallback (a submitted timestamp query) is off by
up to a submission round trip, and with the GPU busy (a pipeline-cache build) that round trip passed 2 ms, so the
test failed about one run in ten. Each calibration is now allowed the time its call took, with 2 ms as the floor;
calibrated timestamps still have to agree within 2 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:15:07 -05:00
2b7621997a Merge remote-tracking branch 'origin/main' into oob-select-v2
# Conflicts:
#	tests/semantic/regen_fixtures.py
2026-11-22 08:11:31 +01:00
c774f25f09 rdna2spirv: barrier rounds for wave32 compute shaders whose s_barrier isn't in uniform control flow (SHADER-91)
On RDNA every s_barrier counts against the same workgroup barrier and a wave that has ended no longer counts;
SPIR-V needs every OpControlBarrier reached by the whole workgroup in uniform control flow. A native wave32
compute shader whose s_barrier sits anywhere but a top-level block of the structured tree now runs in rounds,
the emulated wave64 loop without its cross-lane part: s_barrier ends a segment, each invocation runs until its
next s_barrier or the end, and the workgroup meets at one OpControlBarrier at the end of the round. A per-round
count of the invocations not done (three Workgroup words) ends the loop. Native wave64 cs and ms are unchanged.

Intel Arrow Lake Xe-LPG iGPU (32.0.101.8132): cs_barrier_divergent and the new cs_barrier_early_end and
cs_barrier_loop lose the device with the plain translation and pass with barrier rounds; all three pass on an
RTX 5070 Ti (617.42) either way. docs/design.md's Workgroup barriers row describes it.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:09:17 -06:00
6fc7d49294 Merge pull request #1089 from kotorvr 2026-11-22 02:09:03 -05:00
c22afe3a63 Merge pull request #1087 from caua-an 2026-11-22 02:09:02 -05:00
7b5a092aec Merge pull request #1081 from totonii 2026-11-22 02:09:00 -05:00
16608f2a53 Merge pull request #1064 from SHAURYASANYAL3 2026-11-22 02:08:57 -05:00
77f18926ae Merge pull request #1027 from sanuk369 2026-11-22 02:08:55 -05:00
2a0de113b3 Merge pull request #988 from jdotcollins 2026-11-22 02:08:53 -05:00
21bf8c3d79 Merge binary occlusion and share queue resolve resources 2026-11-22 04:05:44 -03:00
00aff0976c test(d3d12): add multi-threaded dual-queue submission, resource churn, and multi-fence GPU test 2026-11-22 04:03:24 -03:00
d1a7bb96d2 check.py: request 32 lanes for the wave32 lane-mask dumps, as run_gpu_tests.py does (#774)
check.py ran cs_wqm_w32, cs_w32_lane_wrap, cs_w32_permute and cs_bpermute32
without VKC_SUBGROUP_SIZE, so on a device whose range is 8..32 (Intel ANV) the
driver could pick a narrower size and the two runners judged different words.
check.py now requests 32 for them; run_gpu_tests.py requests it even without
index.json.

vk_compute_test prints whether a VKC_SUBGROUP_SIZE request is honoured
("compute subgroup size: N" or "... N not available"), and both runners skip
these dumps when 32 can't be pinned instead of reporting wrong words. Output
from an older vk_compute_test is judged as before.
2026-11-21 23:53:02 -07:00
16e7591419 runtime: thunk deduplication, XGameRuntime shims, PE loader long paths, and drive-root packaging 2026-11-22 12:19:06 +05:30
39d5d0e60d RT-54: bvh_builder_test uses WARP on NVIDIA; record the builder's shader shapes
The package's 53 compute shaders are Xbox DXIL (target triple dxil-ms-xb2,
xbox.compiler.options metadata; dxil.dll rejects all 53). NVIDIA's DXIL reader
rejects the 49th, the only one with a resource in a function signature, and
either returns E_OUTOFMEMORY or aborts the process inside nvwgf2umx.dll.
The proxy forwards the bytecode unchanged, so the fix is in the test: an NVIDIA
adapter switches to WARP unless LEONIDA_BVH_HARDWARE=1. LEONIDA_BVH_RECORD62
now prints each container's shape before the call, and LEONIDA_BVH_DXIL=1 adds
dx.op counts and masked validator error kinds (names and counts only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:48:55 +00:00
dd380ef2fb Tests: fuzz integer image loads 2026-11-22 03:46:54 -03:00
ff697417c1 Runtime: the standalone Vulkan instance keeps its surface extensions next to debug utils
create_vulkan_device_standalone builds inst_exts with VK_KHR_surface and
VK_KHR_win32_surface for DXGI presentation (D3D-2), then the D3D-24 block
replaced the instance's extension list with VK_EXT_debug_utils alone
whenever the loader has it, which it does wherever the Vulkan SDK is
installed. The device still enabled VK_KHR_swapchain, so validation
reported VUID-vkCreateDevice-ppEnabledExtensionNames-01387, and the
instance had no surface extension for the DXGI swapchain.

Both now go in one list, and VK_KHR_swapchain is enabled only when the
surface extensions are on the instance.
2026-11-22 12:12:38 +05:30
14887e6828 Translator: honour V# OOB_SELECT in MUBUF/MTBUF bounds checks
buffer_address() picked the bounds check from the stride alone and never read
word3. It now reads OOB_SELECT (bits 29:28) and applies the rule measured
natively on RDNA2 (gfx1036, docs/buffer_bounds.md; Mesa's GFX11 column): a
dword is out of range in mode 0 at idx >= NR or off + 4 > stride, mode 1 at
idx >= NR, mode 2 at NR == 0, mode 3 (RAW) at offs + 4 > NR, where off is
inst_offset + vaddr and offs adds soffset. A literal word3 folds the mode, a
run-time one selects with OpSelect.

Builds on the raw tail rule of #443 (per-dword loads): x2..x4 loads AND stores
are per dword in modes 0 and 3 (a store that straddled the edge used to write
past it), modes 1 and 2 take the whole access, a typed element
(buffer_load/store_format) is all or nothing at its format's size, an atomic
checks its dword's end. Measured on a Radeon 880M (gfx1150), a valid proxy for
RDNA2: 504 buffer_load_dword cases over idxen/offen/inst_offset/soffset at the
stride and record edges agree with the rules, plus the x2/x4, typed and atomic
edges.

Swizzle (V# word1 bit 31 SWIZZLE_ENABLE, word3 bit 23 ADD_TID_ENABLE; Mesa
gfx10-rsrc.json lines 326 and 337): a literal V# with either is Unsupported in
every mode; a run-time one is translated unswizzled (documented known gap).

A V# with word3 = 0 is mode 0 / stride 0 and so always out of range, as on
hardware: the harness output V# (vk_compute_test, interpreter push constants),
cs_bounds, cs_fmt_1010102, cs_store, mem_diff and the format tests now say
OOB_SELECT 3 (or 1 with a stride) explicitly.

Tests: tests/semantic/test_buffer_oob_select.py (33 hand-tabulated cases plus
multi-dword stores, typed elements and the swizzle gate, literal and run-time
V#), GPU tests cs_oob_select.asm and cs_oob_tail.asm (the second tells the end
check from Mesa's GFX10 start check). docs/design.md, Buffer bounds checking,
has the per-mode rule; docs/buffer_bounds.md notes the translator reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 07:40:20 +01:00
9c7e223a3c D3D-90: castable formats on placed resources (CreatePlacedResource2)
The placed half of D3D-85: CreatePlacedResource1/2 wrap the placed path, and 2 carries NumCastableFormats/pCastableFormats exactly as CreateCommittedResource3 does. The castable list is mapped by a shared helper (also used by the committed path) that refuses unmapped formats and casts whose texel size differs from the resource's, matching the host's E_INVALIDARG and avoiding a size-mismatched VkImageFormatListCreateInfo. A typed UNORM texture with a castable list also accepts an RTV in a listed RGBA8 family format, cleared through the same reinterpretation a typeless RTV uses.
2026-11-21 22:40:16 -08:00
86ef2454a8 Merge pull request #1069 from undeadhuman37 2026-11-22 01:38:14 -05:00
7ff3d3ae0f Merge pull request #1061 from sanuk369 2026-11-22 01:38:10 -05:00
78f80b74e9 Merge pull request #1054 from nicolas 2026-11-22 01:38:07 -05:00