Commit Graph

4696 Commits

Author SHA1 Message Date
835b43fe9b d3d12_xs: name slot 67 descriptor fields as FSPX kinds 0, 1, 6, 7
Name all four pointer and size pairs in the XboxNativeComputePipelineStateDesc
struct as kinds 0, 1, 6, 7 per docs/fspx.md and name the slot
DeserializeComputePipelineStateX in slot_name, matching the DLL's messages.
This prepares the description struct for the runtime FSPX resolver follow-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:50:13 +05:30
3d533d6c3f d3d12_xs: route slot 67 compute pipeline from native code to CreateComputePipelineState (RT-99)
Xbox device slot 67 takes (desc, riid, out) with IID_ID3D12PipelineState and a console-only
descriptor with the root signature at +0x00 and code blob pointer/size at +0x28/+0x30.
Previously it logged and returned E_NOTIMPL.

Route it to CreateComputePipelineState on the PC device (slot 11) like slot 62, mapping the
console descriptor to D3D12_COMPUTE_PIPELINE_STATE_DESC. On the Vulkan device this resolves
through the translator via fssm_program and ShaderLibrary.

- Implement proxy_create_compute_pipeline_from_native_code in d3d12_xs_device.cpp
- Update device_proxy_test to verify slot 67 thunk, compute PSO creation over WARP, and argument checks
- Update d3d12_compute_test to verify slot 67 compute PSO creation on the Vulkan device
- Update documentation in d3d12_command_objects.md and d3d12_vulkan.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:50:12 +05:30
1df4c3b0f1 runtime: erasing a bindless descriptor key no longer idles the GPU
DescriptorTable::erase backward-shifted the key's probe cluster, which moved
other live entries, so BindlessSet::erase_key flagged the next flush as
needing idle and every texture release ended in vkDeviceWaitIdle on the next
submit.

The shift is not needed: every lookup, on the CPU and in the translated
shaders (rdna2spirv.py desc_probe), compares all eight probe slots and never
stops at an empty one. Erase now empties only the key's own slot, and inserts
reuse the hole. An erase uploads like an add (one slot, no idle). Replacing a
live key's index, a relocating insert and table growth still require idle.

Tests: descriptor_table_test checks that an erase in the middle of a cluster
leaves every other slot byte-identical and marks one changed slot (it fails
on the old erase); vk_bindless_test now expects no idle after an erase.
2026-11-22 15:19:11 +01:00
a24d8cc6ba runtime: fallback and clamp swapchain extent when surface reports undefined extent (D3D-165) 2026-11-22 19:48:05 +05:30
Ryx
3784aacc3a Revert the occlusion pause; add --no-draw and --no-resolve to --bisect (D3D-189)
The 8060S retest of c8ea00e4 (#1540) loses the device in every phase that runs
a hardware occlusion query, including nested and binary, which never resolve
inside an active query, and active with the pause applied. Only unwritten, with
no hardware query, passes. So the resolve-while-active rule did not fix it;
vulkan_replay.h and docs/d3d12_vulkan.md go back to main.

Every hanging phase both draws inside a query (an attachmentless rendering
scope inside a query begun outside rendering) and resolves through the copy
and compute helpers. --no-draw leaves every query empty and --no-resolve never
copies or sums results, so the four combinations tell the two apart. The
bisect run prints which switches are on.

The resolve inside one active query stays in the default run and as the
"active" phase; the crossing schedule is back to three segment ends.
2026-11-22 15:17:03 +01:00
db60a73aff fix(test): forward the texture readback emulator
The synchronization check launches the test executable itself, so pass the configured Wine or Proton command through its environment wrapper.
2026-11-22 15:16:14 +01:00
74205e9d78 d3d12: enforce DENY_* heap flags for all placed resources (D3D-222) 2026-11-22 15:16:07 +01:00
9bc4674296 Merge pull request #1796 from Vonsek 2026-11-22 09:15:24 -05:00
f61946cfe1 Merge pull request #1795 from AimLogin 2026-11-22 09:15:24 -05:00
8ba7c8d552 Merge pull request #1793 from WHOISJARDAS 2026-11-22 09:15:23 -05:00
ef15a21ba0 Merge pull request #1789 from romainveurrier 2026-11-22 09:15:22 -05:00
959505bae1 Merge pull request #1787 from CowDeV 2026-11-22 09:15:21 -05:00
625a4f72f4 Merge pull request #1786 from dracbat 2026-11-22 09:15:20 -05:00
6ea194097f Merge pull request #1785 from Vonsek 2026-11-22 09:15:20 -05:00
8d27bec8d6 Merge pull request #1780 from Ryderadzeee 2026-11-22 09:15:18 -05:00
542586de8a Merge pull request #1779 from cobalt-pebble-804 2026-11-22 09:15:17 -05:00
201af97f5d Merge pull request #1778 from Egora 2026-11-22 09:15:17 -05:00
ea2f274a27 xgameruntime: implement XPackageGetCurrentProcessPackagePath, XPackageIsPackagedProcess, XSystemGetAnalyticsInfo 2026-11-22 19:45:12 +05:30
1c80759bca Merge pull request #1768 from AlxcBTW 2026-11-22 09:15:12 -05:00
a0af2deb87 Merge pull request #1766 from Ryderadzeee 2026-11-22 09:15:11 -05:00
e66286921e Merge pull request #1765 from Emirhan Karaca 2026-11-22 09:15:11 -05:00
4d6febbde3 Merge pull request #1761 from SHAURYASANYAL3 2026-11-22 09:15:08 -05:00
a3263e79e6 Merge pull request #1757 from Vonsek 2026-11-22 09:15:07 -05:00
b78819439f Merge pull request #1753 from Serrambi 2026-11-22 09:15:05 -05:00
082190c19b Merge pull request #1752 from CowDeV 2026-11-22 09:15:05 -05:00
24abd3dde4 Merge pull request #1749 from Alex Arenas 2026-11-22 09:15:03 -05:00
3430786f75 Merge pull request #1744 from Emirhan Karaca 2026-11-22 09:15:00 -05:00
445e79b2c7 Merge pull request #1743 from romainveurrier 2026-11-22 09:15:00 -05:00
b6135472da Merge pull request #1739 from Alex Arenas 2026-11-22 09:14:59 -05:00
32e03070a3 Merge pull request #1737 from IAmNotSiob 2026-11-22 09:14:58 -05:00
44c8ccc979 Merge pull request #1735 from yoraudev 2026-11-22 09:14:57 -05:00
0535612599 Merge pull request #1730 from totonii 2026-11-22 09:14:55 -05:00
b28487c827 Merge pull request #1729 from Vonsek 2026-11-22 09:14:55 -05:00
f74e67dd01 Merge pull request #1728 from Vonsek 2026-11-22 09:14:55 -05:00
da574cb90e Merge pull request #1714 from SWAYAM 2026-11-22 09:14:53 -05:00
09854b89a5 Merge pull request #1707 from Ash Hopkins 2026-11-22 09:14:52 -05:00
22baad5ec7 Merge pull request #1702 from Sagah123 2026-11-22 09:14:51 -05:00
a14edd52a4 Merge pull request #1674 from Serrambi 2026-11-22 09:14:50 -05:00
f0cddb90f8 Merge pull request #1578 from Dominik 2026-11-22 09:14:47 -05:00
083e502e66 Validate DXGI flip-model swapchain formats 2026-11-22 18:14:25 +04:00
427532c70c base_reservation: check SetEnvironmentVariableW and ResumeThread before waiting on the child
Review on #1707: without the marker the child would not use the reservation and could relaunch again, and a
child left suspended would make the infinite wait hang. Both now end the child and return 1, as a failed
reservation already did.

AI-assisted. No game files.
2026-11-22 14:14:17 +00:00
c2f39447b6 Merge origin/main into m4-synthetic-gate 2026-11-22 15:13:40 +01:00
34d3225e26 fix(runtime): trace graphics pipeline setup
Record pipeline and root-signature bindings so the boot trace shows whether both setup calls reached the command list.
2026-11-22 15:12:57 +01:00
2123a02506 Runtime: Xbox-ABI proxy for the command allocator (device slot 9)
Device slot 9 (CreateCommandAllocator) now returns an allocator proxy,
the fourth command object after the queue and fence (BUILD-231) and the
list (D3D-136): the public chain (9 slots, Reset at 8) is forwarded, a
slot past it up to the end of a 64-slot table is logged and refused with
E_NOTIMPL, and a read past the table faults in its own guard region. The
console allocator's extra methods are not measured and not guessed.

A list takes the title's allocator in CreateCommandList and Reset, so a
proxy is only safe where the list side resolves it. Slot 9 therefore
wraps an allocator only when it answers kLeonidaCommandAllocatorTag (the
Vulkan layer's CommandAllocator, whose from() resolves the proxy for both
calls); a PC runtime allocator is handed out unchanged, logged once,
until a command-list proxy unwraps it at Reset. Allocator proxies are
unwrapped in the residency calls like heap, queue and fence proxies.
Device slot 12 is not touched.

Tests: allocator_proxy_test (WARP, a hardware adapter, the Vulkan device:
forwarding, refused tail, guard region, identity, D3D12's allocator rules,
a list created and Reset on the proxy with GPU copies through the queue
and fence proxies read back), mock cases for allocators with and without
the tag and their failure paths, and device_proxy_test's slot-9
expectations. No game files.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:53 +01:00
ceb244b124 d3d12_vulkan_device_test: pin the 0.6 ULP clear tolerance on every GPU
The accept side of the SRGB-cast rule only runs where the host rounds
differently (Intel), so a change to it would stay green on NVIDIA and
AMD. ideal_srgb and within_06_ulp move to file scope, and the test
checks the predicate directly: (187, 188) at 187.516 and (127, 128) at
127.5 are accepted; (186, 188), (126, 128), (224, 225) at 224.61,
(136, 137) at 136.97 and (254, 255) at 255 are not. Raising the
tolerance to 1.6 fails the test on an RTX 4070 SUPER. Suggested in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:35 +01:00
01a6176456 Tests: wait for the bundle blend draws in d3d12_draw (fence 21, not 4)
#1583's strip-cut passes leave the fence at 20, and #1660's bundle blend
block then signalled 4. SetEventOnCompletion(4) returns at once when the
fence has already passed 4, on native D3D12 too, so the check read the
readback buffer before the draws had run. It saw the last strip-cut
pass's red quad: "bundle blend pixel (0, 0): got 255,0,0,255, expected
red 64", on every GPU.

Signal 21 instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:11:01 +00:00
967564a20c M4 (synthetic): d3d12_m4_compute_test, UAV table, indirect dispatch, copy queues; buffer UAV views and indirect dispatch state
d3d12_m4_compute_test, through the proxy with D3D12 API only and two
translator-output compute shaders (cs_m4_fill.asm, cs_m4_indirect.asm):
a COPY queue streams an input buffer in, a COMPUTE queue waits on it and runs a
compute PSO over a UAV table (structured buffer, raw buffers, an R32_UINT
RWTexture2D), then ExecuteIndirect of a second PSO from arguments the first
wrote (with a transition to INDIRECT_ARGUMENT and UAV barriers), and a COPY
queue behind a cross-queue fence reads the results back. 1,924 words match the
CPU reference with error 0.

Layer gaps the test found, fixed:
- CreateUnorderedAccessView of a buffer was a stub: structured and raw views are
  now a V# in the slot.
- ExecuteIndirect of a dispatch ran whatever pipeline and root arguments the
  command buffer had bound; the command now carries the list's, as Dispatch does.
- An image created in UNORDERED_ACCESS and first used by a shader was
  zero-filled by the first barrier or copy that named it, losing the shader's
  writes; images with a UAV view are now moved to GENERAL (zeroed) at the next
  submission.
- COMPUTE and COPY command lists no longer log "unimplemented".

Test infrastructure: vk_test_device.h can create more than one VkQueue;
build.py gives a compute shader's FSSM program extra words (fssm-at/fssm-data
from 0x148) so two compute shaders with the same group size get distinct hashes,
and honours LEONIDA_SPIRV_TOOLS (as #1679) so the target builds under the Visual
Studio generator. docs/d3d12_vulkan.md section 6: M4 synthetic part met; M3 row
credits @whattheflop's #1584 measurement of fences in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:09:58 +01:00
f6d6121c9c XDXR builds: PERFORM_UPDATE refits instead of rebuilding
An update (same topology, new positions or instance transforms) now keeps the
source's tree and recomputes its boxes: the source is copied to the
destination unless it is the destination (MODE_COPY), the elements are
rewritten at their slots, MODE_LEVEL with arg2 = 1 recomputes each node's
boxes from the children it already points to, and the header gets the new
bounds. No Morton pass, no sort, and the parent table is kept.

RTX 2050: 1,000 triangles 0.07 ms (build 0.19), 100,000 1.02 ms (2.24),
1,000,000 9.8 ms (22.0); Iris Xe 13.1 ms for 1M (47.9).

- XdxrBuilder::record_blas / record_tlas take `update_from`; the Vulkan
  backend passes the source (or the destination, for an in-place update)
  when the D3D12 build has PERFORM_UPDATE.
- vk_xdxr_build_test: a 3,000-triangle BLAS refitted in place (radix-sort
  tree), an R32-indexed grid refitted into another buffer (its untouched
  source is checked too), and the TLAS refitted after its instances move;
  the timing mode also times refits.
- d3d12_xdxr_rt_test: the BLAS is built with ALLOW_UPDATE, its soup moves,
  and a PERFORM_UPDATE in place is checked as d3d12_blas_update.
- tools/xdxr_bvh.py check-build: the case being checked answers reads at its
  address first (an in-place update leaves two dumps at one address).

A sabotaged refit (no box pass) fails every update case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:09:14 +01:00
1f12cd9f16 Tests: compare d3d12_vulkan_device with the host on the layer's own adapter
On a PC with two GPUs, D3D12's default adapter can be a different GPU from
the one LEONIDA_VK_DEVICE gives the layer. d3d12_vulkan_device's host
comparisons (create_host_device, the D3D-46 copies) then compared one GPU's
Vulkan driver with the other GPU's D3D12 driver: with the layer on an AMD
RDNA2 iGPU and an RTX 5080 as adapter 0 it failed at argument_mismatches
(format 67 RT: the AMD layer accepts an R9G9B9E5 render target, the NVIDIA
host refuses it).

copycmp::layer_adapter() holds the Vulkan device's LUID. When
LEONIDA_HOST_ADAPTER is unset, create_host tries that adapter first and falls
back to the default one. The test sets it from VkPhysicalDeviceIDProperties
in main. LEONIDA_HOST_ADAPTER still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:08:57 +01:00
7f67a9aef0 process_cmdline_test: report a missing WinMain shim instead of calling it
Without the shim, find() returns null and the WinMain check called it, ending
the test with an access violation instead of a failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:08:55 +00:00