Commit Graph

186 Commits

Author SHA1 Message Date
eda43133f8 Merge pull request #1172 from farhat 2026-11-22 03:14:21 -05:00
2a333b5c69 Merge pull request #1155 from quackottu 2026-11-22 03:14:16 -05:00
0b880fb79a Merge pull request #927 from totonii 2026-11-22 03:14:10 -05: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
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
004aedde5e Merge pull request #1134 from quackottu 2026-11-22 02:47:52 -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
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
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
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
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
16608f2a53 Merge pull request #1064 from SHAURYASANYAL3 2026-11-22 02:08:57 -05:00
21bf8c3d79 Merge binary occlusion and share queue resolve resources 2026-11-22 04:05:44 -03:00
16e7591419 runtime: thunk deduplication, XGameRuntime shims, PE loader long paths, and drive-root packaging 2026-11-22 12:19:06 +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
7ff3d3ae0f Merge pull request #1061 from sanuk369 2026-11-22 01:38:10 -05:00
8e6afb23fd Merge runtime indirect and ray-tracing changes into the occlusion branch 2026-11-22 03:32:16 -03:00
532f854184 Merge main indirect and ray tracing changes into binary occlusion fix 2026-11-22 03:31:47 -03:00
7d764b9e0d uav_clear: float clears to 16-bit and 11/10-bit floats round toward zero and saturate, as D3D does
small_float rounded to nearest even and turned any too-large value into
infinity. D3D11.3 3.2.2 says float-to-float conversion rounds toward zero
and a finite value too large becomes the largest finite (only infinity
stays infinity); ClearUnorderedAccessViewFloat on WARP and on NVIDIA
gives exactly that: R16 70000 or 65520 -> 0x7bff, 1e-7 -> 0x0001,
R11G11B10 (1e6, 1e6, 1e6) -> 0xf7fdffbf, B = 1/3 -> 0x1aa. The layer wrote
infinity (which a shader then turns into NaN) and rounded up.

d3d12_uav_clear_test's conversion checks asserted the old rule for 65520
and 1e-7; they now hold the host values, with overflow, infinity and
R11G11B10 cases added.
2026-11-22 11:53:58 +05:30
d2b9d9da3d Merge main into binary occlusion fix 2026-11-22 03:21:07 -03:00
3ec79019ac Merge main into the overlapping occlusion branch 2026-11-22 03:20:06 -03:00
e5732ffcd3 Merge pull request #1035 from sanuk369 2026-11-22 01:08:29 -05:00
beef4652c5 Merge pull request #990 from sanuk369 2026-11-22 01:08:12 -05:00
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
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
263284f125 Merge pull request #898 from Felix Croasdale 2026-11-22 00:33:04 -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
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
9363490570 feat(dxgi): add Vulkan-backed IDXGIFactory4 and IDXGISwapChain3 COM shim with HWND GPU test 2026-11-22 02:06:28 -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
e73037732f Merge pull request #868 from Størm 2026-11-21 23:15:37 -05:00
6b8b2e5f6e Merge pull request #865 from Felix Croasdale 2026-11-21 23:15:36 -05:00
5ff488901c Merge pull request #861 from adonizm 2026-11-21 23:15:35 -05:00
9b21cde473 Merge pull request #858 from traeb0n 2026-11-21 23:15:34 -05:00
3dd8acf58c Merge pull request #834 from Vonsek 2026-11-21 23:15:31 -05:00
a03a3db26b Merge pull request #737 from AlxcBTW 2026-11-21 23:15:27 -05:00
cce77b65ef Normalize binary occlusion results in Vulkan replay 2026-11-22 01:13:30 -03:00
4fc1301a11 Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/shims/d3d12_com.h
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/command_list.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_test_device.h
2026-11-22 04:05:35 +00:00
c6b684c268 Runtime: rename the discard loop's index so it no longer hides the command loop's (C4456)
DiscardResource's per-subresource loop in vulkan_replay.h declared `i`, which
hides the command loop's `i`. MSVC /W4 reported C4456 in 15 targets. The loop
behaves the same; only the name changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:59:52 -06:00
0bad3d7aed Runtime: reserved resources follow AMD's standard/packed mip split (D3D-65)
D3D12 leaves where the packed tail starts to the driver (#654 made the test
accept any host's split). The layer used NVIDIA's: packed from the first mip
smaller than a tile on any axis. The console is RDNA2, so it now follows AMD's
PC runtime, as @traeb0n (D3D-20) recommended on #634.

AMD's rule, measured on an RX 9070 XT (RDNA4, 32.0.31041.1004) and a Ryzen 7
9800X3D iGPU (RDNA2, 32.0.21045.5002), identical on both: a mip stays standard
while it is wider than half the tile or taller than the tile; depth does not
count. It fits all 47 measured layouts: compare_tiling's 17 and 30 edge cases
(a mip exactly at or just past half a tile, thin and tall textures, non-square
2D and volume tiles). The rule first proposed on #374 ("every axis at most half
the tile's largest side") fitted the 17 but missed four tall or deep ones.

- src/resource_tiling.h: the new split; a standard mip smaller than a tile
  takes one tile on that axis.
- resource_tiling_test: the five layouts that change expect the AMD values,
  plus a table of all 47 AMD layouts checking standard and packed mips, the
  packed start and NumTilesForPackedMips (AMD's in 45; for the two deep
  volumes that pack from mip 0, AMD reserves 2 tiles and the layer's tight
  count gives 1).
- docs/d3d12_vulkan.md 4.2: the rule and the measurement.

AI-assisted (Claude Code).
2026-11-21 22:57:55 -05:00
77f42e09c0 Runtime tests: LEONIDA_VK_DEVICE picks the Vulkan GPU by name
Two GPUs of one vendor share one driver, so the loader's driver filters
cannot tell them apart, and the D3D12 tests always took the last discrete
GPU (an RTX 3060 next to an RTX 5070 Ti). LEONIDA_VK_DEVICE is part of the
device name, compared without case, read by vk_test_device.h and by the
layer's standalone device. A value that matches no device fails the run
instead of testing another GPU, as LEONIDA_HOST_ADAPTER does. The shader GPU
tools (vk_compute_test, vk_harness, ...) keep their own pickers for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:56:45 +01:00
d868cba00f Runtime: barriers into PREDICATION cover conditional rendering's read
D3D12_RESOURCE_STATE_PREDICATION is the same bit as INDIRECT_ARGUMENT
(and SYNC/ACCESS_PREDICATION the same as EXECUTE_INDIRECT /
INDIRECT_ARGUMENT), and the layer mapped that bit only to
INDIRECT_COMMAND_READ at DRAW_INDIRECT. vkCmdBeginConditionalRenderingEXT
reads the predicate with CONDITIONAL_RENDERING_READ at the
CONDITIONAL_RENDERING stage, so ResolveQueryData -> COPY_DEST to
PREDICATION barrier -> SetPredication had no dependency from the copy's
write to the predicate read (and none the other way before the next
resolve).

With the extension enabled (the only case those flags are valid),
vulkan_access and vulkan_barrier_scope now add the conditional-rendering
access and stage for that bit; GENERIC_READ, which contains it, gets
them too. The replay passes the flag from its conditional-rendering
entry points.

d3d12_vulkan_device_test now enables conditional rendering on its device
and runs an occlusion query resolved into a predicate: EQUAL_ZERO skips a
clear, NOT_EQUAL_ZERO runs one, and the predicate is resolved into again
after the read, once through legacy barriers and once through enhanced
buffer barriers. d3d12_state_map_test checks both mappings with and
without the extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:55:19 -06:00
f609f9c93e style: set sampler comparison with explicit Vulkan booleans
Use the same VkBool32 conversion for comparison and anisotropy in the sampler create info.
2026-11-22 04:52:39 +01:00
55d02a5861 Merge origin/main into d24-on-d32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:48:46 +01:00
5fd1feca84 Merge pull request #834 from Vonsek 2026-11-21 22:48:36 -05:00