A queue that detected the newer console layout now records it on the
device, so a queue created later inherits it immediately instead of
answering its shifted Signal/Wait or PresentX slots through the
undetected path first.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
SOSetTargets (console 49) carries BufferLocation and
BufferFilledSizeLocation, both GPU VAs; both now translate through the
upload arena in the proxy's scratch copy.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
IASetIndexBuffer (console 47) and IASetVertexBuffers (console 48) carry
GPU VAs inside their view structs rather than in an argument word. The
list proxy now rewrites BufferLocation through upload_translate on a
copy — a stack copy for the index view, a scratch array on the proxy
for the vertex views — so a pointer AllocateUploadMemory handed out is
usable for index and vertex data the same way a root descriptor is.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Console list slot 148 carves from a bump arena of persistently-mapped
UPLOAD-heap buffers, so the pointer a title writes is the same memory
the GPU samples. The six root descriptor setters (console 41-46)
translate an arena address to the chunk's buffer device address before
forwarding; other VAs pass through. A device that cannot hand out a
mapped buffer falls back to private memory so the call still returns
something writable.
The mock test now models command lists end to end: creation unwraps
the allocator proxy, the console body exposes the pinned cursor,
console-only slots are recorded without forwarding, slot 148 hands out
aligned arena pointers and slot 43/146 reach the real list.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
--headless counted decode calls and printed RESULT PASS without looking at the frame, so a decode that wrote
nothing still passed: the buffer starts zeroed and otherwise keeps the previous frame. Headless decode() now
fills the frame with 0xA5 first and fails if the decode and copy leave every byte of it. Windowed playback is
unchanged.
Follow-up to #4049.
Review on #3955 (@pedro470): a delete one folder down leaves a marker
folder without kRemovedDirMarker, and is_regular_file() on the missing
sentinel returned false with an error code set. collect() took that for
an unreadable marker and asked deleted() about every package entry:
16,000 files after GAME:\d\nested\gone.txt was deleted listed in 1,391 ms
instead of 27 ms.
The sentinel is now checked with status(): regular means the folder was
removed, not_found is the ordinary "holds nested markers" answer, and
only another error falls back to deleted(). Same entries either way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Queue slots 30 (older layout) and 32 (newer) are the measured PresentX
entry points, with SignalX at 23/25. The queue proxy now detects which
of the two documented console layouts a title uses — a fence reaching
slot 16/17 marks the newer layout — forwards SignalX as PC Signal, and
lazily builds the windowed presentation core for PresentX under
LEONIDA_VULKAN_DEVICE.
Unmodelled console-only queue methods answer S_OK instead of E_NOTIMPL
because frame pacing flows through them; they are still never forwarded.
The mock test now asserts that contract.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
global_atomic_*, global_atomic_*_x2, buffer_atomic_*_x2 and the 8/16-bit
global stores and d16 loads were merged with semantic tests only.
cs_global_mem_ext.asm, laid out like cs_global_neg_offset (40 groups, one
thread, heap offsets as addresses), seeds a heap and stores eight words;
check.py (GLOBAL_OFFSET) and run_gpu_tests.py expect them.
tests/semantic/test_global_mem_ext_fixture.py runs the fixture on the
CPU against values computed in the test and checks both runners expect
the same words. test_shader_checks.py's fake harness answers every
GLOBAL_OFFSET entry.
- replay_cpu_bench: #3693 moved a draw's render targets and vertex buffers into Draw::views (D3D-391); the bench
builds a DrawViews block instead of writing the old inline arrays.
- xgameruntime_user_test links file_system.cpp, which now defines rt::fs::game_dir that xgameruntime.cpp calls.
- check_sparse_queue_family: a vkCreateInstance refused because the api_dump/validation layer is not installed is
the documented "layer absent" skip (77), not a failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tupacfan04's review: --warp-msaa4 exists to reproduce WARP's known 4x
coverage discrepancy, and with the previous commit that run turned into
"host not comparable" and exit 0, so the flag no longer asserted anything.
Under --warp-msaa4 a host that fails the oracle now prints "host fails the
oracle" and exits 1, as on main.
LEONIDA_HOST_ADAPTER=warp on the RTX 3060 machine: default run 48 + 24
pairs, exit 0; --warp-msaa4 "coverage (3,4): required=0 allowed=0
actual=1", "scene 0 samples 4 ...: host fails the oracle", exit 1. Native
RTX 3060 host: unchanged, 48 + 48, exit 0 in both modes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signalling NaNs and a denormal through -v, |v| and -|v| on src0 and src1.
On an RTX 5060 Ti (driver 621.14) the old FAbs path gave 0x7fffffff for
|0xff800001| (the driver's canonical NaN); with the sign-bit moves all
4096 pixels are exact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Flyander's review: the highest changed byte bounds the extent, not the
bytes written or the structure's size. With two sentinels a written byte
always differs from one of them, so the test now records every byte that
kept the sentinel in both calls and checks that none below the extent did:
on all 515 streams BinkGetSummary writes every byte of +0x00..+0x8F and
none after. docs/movies.md and the test notes say that, and that the
declared structure may have padding past +0x8F; the source link in the
ABI subsection now points at the .cpp, with the notes linked beside it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateCommandList now hands the title the console object: a 160-slot
vtable in the measured console order — PC order through slot 26, four
console-only extras at 27-30, the PC chain shifted +4 through console
59 (anchored by the measured 32->28 SetDescriptorHeaps, 33->29, 41->37,
43->39, 45->41, 48->44, 51->47, 53->49), EndEvent at 60 (the console has
no PIX markers), ExecuteIndirect at 61 and the enhanced Barrier at 146 —
plus the fields the SDK's inline writers touch, with the write cursor
pinned at the record limits so every command takes the vtable path.
Unmodelled console slots are recorded with their first argument words
and refused without a PC call.
Objects unwrap at every boundary: queue ExecuteCommandLists unwraps the
list array, the list's Reset and ExecuteBundle unwrap allocator and
bundle proxies, and its SetDescriptorHeaps unwraps heap proxies, all
through proxy_real_object. AllocateUploadMemory (148) answers null until
the unified-memory allocator is wired.
Tested: clang-cl 20 + xwin cross-build clean; loader_test 69 checks,
unimplemented_policy_test 96 checks, 0 failed under Wine. AI-assisted.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The sibling-layer queue measurements (docs/d3d12_xs_console_abi.md §4)
give slot 30 PresentX on the older runtime and 32 on the newer, with
the fence-detection rule between them; the proxy comment now says so
instead of "not known". Slots stay refused until wired to the
presenter.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pe_loader: resolve() and resolve_forwarder() key the DLL name with
dll_key() — lower-case, trailing '.' dropped, ".dll" added when there
is no extension — the file-name rule LoadLibrary applies. Without it an
import naming "GameInput" or "gameinput.dll." missed the shim and
owns_dll lookups while LoadLibraryExA still bound a host namesake.
registry: xaudio2_9.dll ordinals 8-10 classify as hresult (host table
measured: XAudio2CreateV2_9 / WithVersionInfo / WithSharedContexts);
the redist's ordinal table is unconfirmed and stays other.
import_inventory: classify parity for the #1 ordinals; the delay-import
directory (entry 13) is read with the loader's checks; the descriptor
table stops at Name == 0 and unreadable names fail like read_string;
host-bound imports report as host instead of unimplemented thunk
(owns_dll ported); thunk tables deduplicate by RVA under a global cap.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
STENCIL on a D32_FLOAT view used to make prepare return invalid_clear, so
the whole command list was dropped. Like the PC runtime (WARP), the absent
plane is now ignored: STENCIL alone clears nothing, DEPTH | STENCIL clears
the depth plane. d3d12_clear_test compares three such cases with WARP.
AI-assisted.
SetSourceSize answered S_OK and ignored its arguments, and GetSourceSize always
reported the back-buffer size, so a game that scales its source region could not
read back what it set.
Host-measured on Windows 11 with the system DXGI (RX 7900 XTX): a fresh
swapchain reports the back-buffer extent; SetSourceSize(64,32) round-trips while
GetDesc1 keeps the buffer size; a region larger than either buffer dimension is
DXGI_ERROR_INVALID_CALL and keeps the stored value; zero is accepted and stored;
GetSourceSize needs both pointers; and ResizeBuffers resets the source size to
the new back-buffer extent.
Present still does not scale by the source region; that stays a documented
difference and is not part of this change.
The geometric oracle judges the layer. On one host (RTX 5060 Ti, NVIDIA
621.14, Windows 10) the native D3D12 render itself misses pixel (4,4) of
scene 4, and the test failed although the layer was right, so it could not
serve as a gate there.
The layer's conservative mask still has to pass the oracle (exit 1
otherwise). A host mask that fails it is now printed as "host not
comparable" with the host's normal and conservative pixel counts, how many
normal pixels the conservative render lost, and the layer's count; that
scenario's host-side checks are skipped and the summary counts it.
RTX 3060 (NVIDIA 610.88, Windows 11): 48 + 48 pairs, unchanged. With the
host forced to miss scene 4: 8 scenarios reported, exit 0. With the layer
forced to miss it: exit 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review on #3955 (@pedro470), both reproduced here:
- A marker folder that cannot be listed (FILE_LIST_DIRECTORY denied, the
markers still reachable by path) read as "no markers", so a deleted
package file came back in the listing. Only ERROR_FILE_NOT_FOUND or
ERROR_PATH_NOT_FOUND now means nothing is deleted; any other failure,
an incomplete FindNextFileW scan or a marker that cannot be checked
sends each entry through deleted().
- A _wcslwr_s key is not _wcsicmp in every locale: under .UTF-8 it folds
U+00C9 and U+00E9, which _wcsicmp keeps apart, so a package entry was
dropped. The names seen are now a std::set ordered by _wcsicmp, so two
names are one entry exactly when same_name says so. Same timing.
Tests: the listing-denied marker folder (through the ACL API, restored
after), and a .UTF-8 merged listing checked against _wcsicmp itself. The
previous head fails both; each single fix removed fails its own check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hooked PSO gets its own vtable back as soon as its name is logged (the
rest after the constructor returns), so the destructor never sees the
9-slot copy. find_pso searches newest first and skips restored entries,
the named count is of distinct creations, g_in_set_name is thread_local,
and the doc says what was measured about PostBuildInfoQuery.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ForceFeedbackEffect::Release() drops the count to 0 and deletes the
effect; its destructor then waits for g().mu to unlink it from the
device. In that window apply_effects (holding g().mu) could AddRef the
dying effect from 0 to 1, sync it after it was freed, and delete it a
second time with its own Release (@AAyberkU's finding).
apply_effects now takes a reference only on a live effect
(add_ref_if_live: a compare-exchange that never moves a count up from 0),
so an effect whose last Release ran is skipped.
gameinput_test: add_ref_if_live itself, and 20,000 effects created and
released while a second thread runs the poll step. With the old AddRef
that run ends in STATUS_HEAP_CORRUPTION (0xC0000374) every time here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GetCopyableFootprints sized a mip with desc->Height >> mip and
depth >> mip on 32-bit values, and desc->Width >> mip on 64 bits. D3D12
accepts any MipLevels, so a shift count of 32 (64 for the width) or more
is reachable, and C++ leaves it undefined. Measured on an RTX 5060 Ti,
the PC runtime's own shift wraps: a 16x16 texture with 40 mips reports
subresource 32 as 1x16 and 33 as 1x8, a 40-mip volume 16 slices at mip
32. The layer matched only because MSVC's x64 shift masks the count the
same way; the counts are now masked explicitly (& 31, & 63), which gives
the same answers by definition.
compare_footprints: a 40-mip 2D texture, a 70-mip 1D texture and a
40-mip volume, every subresource compared with the host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GPU builder grouped four consecutive Morton-sorted elements per node,
level by level. Those groups ignore where the Morton prefix changes, so
sibling boxes overlapped and a ray took about twice the traversal steps.
It now builds a binary radix tree over the same sorted keys (Karras 2012,
ties broken by sorted position) and keeps the inner nodes at an even depth
as the BOX32/BOX16 nodes, each taking its children's children (2 to 4),
numbered in sorted order by a scan (root = node 0). Boxes are filled by one
bottom-up pass: each element writes its slot box and merges it into its
parent's accumulator with atomics; the last child to arrive carries on.
The arrival counter's atomicAdd has acquire-release semantics instead of a
memoryBarrierBuffer, since the pass is divergent and SPIRV-Cross before
MSL 3.2 lowers memory barriers to threadgroup_barrier. Refit reuses the pass
through the parent table.
TRI1 pairing (#3315) pairs triangle children of one node; the build records
each element's tree pointer so a paired sibling finds its TRI1 slot. The
node count depends on the keys: the layout reserves (3N - 2) / 4 nodes, the
header counts the nodes written (plus the BOX16 spare unit after the last
one), so compaction gives the rest back. Refit copies a source by its
header size. check-build reports traversal steps per ray.
Steps per ray: 5,000 random triangles 42.0 -> 23.0, BOX16 43.9 -> 23.7,
paired 7,200-triangle grid 37.6 -> 19.5. Build 1M triangles: RTX 5090
5.50 -> 5.99 ms, Radeon gfx1036 iGPU 133 -> 180 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LEONIDA_BVH_RECORD62=1 now prints the unwound call site (offsets from the
DLL base, with function starts from the unwind tables) and the name the
builder gives the returned PSO through SetName/SetPrivateData. Measured:
#47 and #53 are both "XDXR GetBVHCompactedSize", one PSO created twice from
FUN_18001d400; no creation is named PostBuildInfoQuery.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_purge_ownership_scoping spawned cmd.exe with CREATE_NO_WINDOW for its
dead and live owner PIDs. Under Wine each console child starts a headless
conhost.exe, which inherits the runner's output pipe and can outlive a
terminated child, so ctest waits on the pipe after the test printed OK.
The children are now copies of the test executable started with
CREATE_SUSPENDED | DETACHED_PROCESS: they never run, have no console, and
still give one dead PID (terminated and waited) and one live PID.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ID3D12Heap::GetDesc returned the creation description unchanged. The
host runtime reports the alignment the heap was placed with (64 KiB for
an Alignment of 0) and the one node for a node mask of 0, as the layer
already does for resources, descriptor heaps and queues: measured on an
RTX 5060 Ti, 19 of 20 heaps (default, default with 4 MiB alignment,
upload, readback, custom; each node-mask pair) read back differently.
d3d12_vulkan_device_test: compare_heap_descs creates each heap on the
layer's arena device and on the host and compares the whole GetDesc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prefer_host_copy() listed the release names of the MSVC runtime DLLs
only. A Debug build of a stand-in image imports VCRUNTIME140D.dll,
VCRUNTIME140_1D.dll and MSVCP140D.dll, so the loader did not redirect
their RtlPcToFileHeader import, _CxxThrowException could not find the
throwing image, and a C++ exception thrown and caught inside the image
ended the run with 0xE06D7363 (run_tiny_game_eh in a Debug build).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A Debug build stopped at shims/d3d12_vulkan_device.cpp with fatal error
C1128: the object has more sections than a COFF object holds by default,
because without optimisation every inline function keeps its own COMDAT.
CI builds RelWithDebInfo only, so nothing showed it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review on #3955 (@Parakeet-Wheat, @shdann): the fast path only held while
the folder had no marker folder. One DeleteFileW creates it, and every
package entry was probed with deleted() again: 1,073 ms for 16,000 files
after two deletes, against 27 ms now.
collect() lists the marker folder once and keeps the deleted names in a
set, with deleted()'s rule: a marker file, or a marker folder holding
kRemovedDirMarker. The lookup folds ASCII letters only, which is exactly
the file system's case-insensitive compare when both names are ASCII. A
non-ASCII entry, or a marker that is not plain ASCII or is a reparse
point, still goes through deleted(), so the file system's Unicode case
rule decides (deleting éclair.txt hides the package's Éclair.txt, as on
main).
Tests: a delete under another ASCII case in a 300-file folder hides only
that file; the Éclair case above.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vs_ids.spv reads BaseVertex / BaseInstance for the zero-based v0 / v3 and so
declares the DrawParameters capability. vk_harness and vk_texture_test enable
VkPhysicalDeviceVulkan11Features::shaderDrawParameters for it; vk_sampler_test
did not, so every ps_ssharp case created a module that breaks
VUID-VkShaderModuleCreateInfo-pCode-08740 (reported by VK_LAYER_KHRONOS_validation).
Query the feature with the Vulkan 1.2 ones and enable it when the device has it,
as vk_harness does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>