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>
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>
#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>
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>
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>
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>
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>
d3d12_descriptor failed every run on an Intel UHD 770 (101.7092) for two
reasons, both from the driver taking an option the Vulkan spec allows:
- VK_EXT_image_view_min_lod: the driver selects levels with
minLodInteger = floor(minLod), the spec's "alternative", so a 0.75 or
1.75 ResourceMinLODClamp read one mip too detailed. On Intel integrated
GPUs bind_image now passes the clamp rounded to the nearest level,
which point mip filtering selects exactly.
LEONIDA_MIN_LOD_INTEGER=1/0 forces it either way.
- The bindless set stayed at its default counts (4096 2D images, 1024
samplers) because the driver reports maxPerSetDescriptors = 6159 with
every other limit at 1048576. size_bindings now takes an optional
layout_supported callback, and past maxPerSetDescriptors the device
asks vkGetDescriptorSetLayoutSupport about the grown layout.
bindless::SetLayout describes set 0 once for create_layout and that
query.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UCRT's _get_narrow_winmain_command_line and _get_wide_winmain_command_line
were not shimmed, so a /MD WinMain executable got gta6rt's own command line as
lpCmdLine. GetCommandLineA/W and ExitProcess were shimmed under kernel32.dll
only, and the loader matches DLL names exactly. Imported from kernelbase.dll, or
from the API sets the umbrella libraries bind them to
(api-ms-win-core-processenvironment-l1-1-0, api-ms-win-core-processthreads-l1-1-0),
they went to the host. The package's vcomp140.dll imports ExitProcess from the
latter.
process_cmdline_test checks every name and the WinMain line.
docs/runtime_imports.md: the dry-run table regenerated at this commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CTest applies CMAKE_CROSSCOMPILING_EMULATOR only to tests whose command is a
target; the script test runs the host CMake, so the cross-build/Proton workflow
in docs/testing.md would execute the tool directly, without Wine. Pass the
emulator list as -DRUNNER and prepend it to both execute_process commands, the
same pattern as check_loaded_async.cmake.
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>
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>
The translator already handles s_nand/nor/xnor_b32 and _b64 (rdna2spirv.py,
tests/semantic), so no translator change. What was missing: the _b64 forms in
salu_diff's generator, a GPU test of the translated output, and a hardware
comparison. Adds the three _b64 ops to salu_diff (and LANE_MASK_OPS),
ps_scc_logic32/64.asm (values and SCC by hand) registered in check.py and
run_gpu_tests.py, and a docs/design.md row with the hardware counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements CreateSwapChainForCoreWindow on Factory for UWP / Game Core Scarlett titles by querying ICoreWindowInterop for the underlying Win32 HWND, and implements RegisterOcclusionStatusWindow / RegisterOcclusionStatusEvent returning sequential cookies.
Adds mock ICoreWindow unit tests in dxgi_swapchain_test covering argument validation, null HWND failure, functional swapchain presentation, and occlusion status registration.
shader_library_corpus_test runs src/shader_library.h over the work folder
make_game.py builds from the player's copy (LEONIDA_SHADERS=<work>/shaders/spirv,
containers from <work>/shaders/dxbc or LEONIDA_SHADER_DXBC), as the D3D12
layer does with a PSO's bytecode: inflate the FSSM program, hash it and look
it up under the stage the DXIL program header names. Every container must
find its own index.json entry and a readable .spv, every entry must be
reached, and in containers with more than one 0x0D payload no earlier
payload may be the indexed program.
Without LEONIDA_SHADERS it prints SKIP and exits 77 (SKIP_RETURN_CODE).
On the 1.0.2.1 corpus: 26,503 containers, all resolve, 195 with more than
one program. With fssm_program switched to the first payload it fails
(391 failures, 26,308 of 26,503 entries reached).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Against another adapter or WARP, a placed clear byte may differ from the
host when both sides are within 0.6 ULP of the ideal value, the
tolerance D3D11.3 spec 3.2.3.6 (FLOAT -> UNORM) and 3.2.3.8
(FLOAT -> SRGB) allow. The plain tie rule already did this for
0.5 * 255; the SRGB-cast clear's 0.5 encodes to 187.516, where Intel's
Vulkan driver (UHD 770, 101.7092) writes 187 and WARP 188. The layer's
own adapter stays exact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>