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>
Since #1489 the layer binds the device's bindless set at every dispatch as well as at every draw, but only the
draw has a test (d3d12_m2_textured_test): d3d12_compute_test takes the binding-free index entry on purpose, and
d3d12_descriptor_test samples through set 0 with a Vulkan pipeline of its own.
This test covers the compute bind point through D3D12 alone: a compute PSO whose index entry lists set-0
bindings, two SRVs, bytes no view was made for, and a wrapping and a clamping sampler. Four dispatches of
test/glsl/cs_set0_sample.comp (GLSL written to the translator's contract) load the T# and the S# from the
descriptor tables, find them in the hash table and sample: the two textures texel for texel, the fallback image
for the unknown bytes, and the right edge with the clamping sampler. A device without the bindless set refuses
the PSO. Registered with ctest like its neighbours (exit 77 is a skip).
With the vkCmdBindDescriptorSets call of the compute bind point removed from replay, this test fails
(VUID-vkCmdDispatch-None-08600, on llvmpipe).
Checked with a mingw-w64 build under Wine on llvmpipe, an RDNA2 integrated GPU and an RX 7900 XTX (RADV), with
the validation layer: exact, no validation errors. Not built with MSVC.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two i18n PRs merged as "both" left docs/README.md with two quickstart lines (test_i18n_index); #1551's link in
runtime/README.md pointed at runtime/runtime_imports.md instead of docs/ (test_docs_links).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A mapped title names its files on the console's drives, but nothing mapped them: the file calls went
straight to the host and --game-dir was only used to find modules, so the first file a title opens at boot
would fail. New shims for CreateFile*, FindFirstFile*/FindNextFile*/FindClose, GetFileAttributes*/
GetFileAttributesEx* and DeleteFile* (kernel32, kernelbase and the api-ms-win-core-file sets) map a GAME:
path under --game-dir, and send every open that can write and every delete to --overlay (default
<game-dir>\overlay), which reads and listings prefer. A write-open copies the package file into the overlay
first, so OPEN_EXISTING keeps its bytes, and a delete of a package file leaves a marker instead of removing
it, so the package is never modified. A path that climbs above GAME: with ".." or names another drive is
refused with ERROR_INVALID_NAME. A path without the prefix is still a host path.
The prefixes and the overlay come from ivall/xcl (GPL-2.0-only), as facts only, no code.
file_system ctest: 43 checks over folders in %TEMP%, covering mapping and case, copy-up and read
preference, a new file in folders the package lacks, delete and re-create, the merged listing, host-path
passthrough, the escape refusal and the narrow variants.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
~Loader (#1172) clears initialised before delivering DLL_PROCESS_DETACH; with
the thread events that write goes through the TLS lock, so a thread that ends
during or after the detach no longer runs the module's callbacks.
runtime/README.md: the RtlPcToFileHeader redirect, and the thread events in
place of "the loader does not deliver thread attach/detach events"; mapped
DLLs' DllMain still gets no thread events. design.md: the CPU-code row.
Second merge round: main added rgb96 views, the device filter, the
present source-rect path and its own ctest registration of
d3d12_present_test. bind_image keeps both defaulted parameters and the
rgb96 view fallback; image_descriptor runs main's 96-bit family check
before the castable-list check; Resource keeps main's rgb96_ member;
register_samplers and the presentation plumbing follow main's positions,
and the duplicated d3d12_present_test block and stale 'surfaces' local
are dropped in favour of main's.
main gained 117 commits since f85582e, among them #119 itself (through #908,
which is built on its head and adds PresentX on top), so both sides now
carry the presentation path: this branch as #119's own commits merged with
main at 426023a, main as #908's integration of them. Eleven hunks in six
files conflicted.
runtime/src/vulkan_present.h (2 hunks):
- present's blit: main's structure (a blank present, the source rectangle)
with both locks of the branch. record() reads and updates the context's
layout tracker, which ExecuteCommandLists guards with tracker_mutex_ (it
copies the tracker, emits, and commits the copy after the submit); under
the resource lock alone a present between that copy and that commit would
lose its update. Order as in the context: resource -> tracker -> submit.
- presentable(): identical code, main's comment.
runtime/shims/d3d12_vulkan_device.cpp (3 hunks):
- includes: shader_library.h stays (pipelines read the translator's index);
- Resource's fields: the branch's arena fields and main's rgb96_ (D3D-62);
- standalone device: info.presentation is set once, where the swapchain
extension is pushed (the branch's order); main set the same value later.
runtime/shims/d3d12_com.h (2 hunks): the union of the includes; the
branch's VulkanDeviceInfo::features and shader_dir stay.
runtime/CMakeLists.txt: main now builds and registers d3d12_present_test
next to xbox_present_test, so the branch's copy of that block goes; the
compute and draw tests keep theirs. d3d12_present_test keeps returning 77
without a Vulkan device, which main's registration (c2967a5) relies on but
main's test does not do yet.
README.md, docs/d3d12_vulkan.md (3 hunks): the branch's text. main's side
is what the branch had already merged at f85582e, unchanged since.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Both sides extended the same spots: the PR's castable-format flag and main's
R9G9B9E5-as-R32_UINT view emulation meet in bind_image (two extra defaulted
parameters), image_descriptor's view format (resource_format + castable list),
create_texture (TextureCreateInfo carries the VkImageFormatListCreateInfo the
castable list fills) and the device init (arena creation plus main's predication
configuration). Main's hardened CopyBuffer preparation and predicate capture
keep the PR's arena-buffer offsets; the PR's old emit-side offset math is
superseded by main's prepare-side buffer_offset handling.
On top of the merge candidate 70178d3 (Ryx69/Leonida#6, which merged main at
426023a): the 219 commits main gained since. Three hunks conflicted, in two
files; both follow the notes on #291 (ItsNotRexed 08:27 UTC, Vonsek 09:58 UTC
on 2026-11-22).
runtime/shims/d3d12_vulkan_device.cpp, device setup after the VulkanContext:
- the branch's GPU address arena is created first, as before;
- main's block that configures predication and the predicated byte copy
(#1277) follows it;
- one load_host_image_copy call and main's lazy D24 converter (enabled only
where D24_UNORM_S8_UINT is not usable) replace the branch's unconditional
enable_depth24, which was the same code before main changed it.
runtime/src/vulkan_replay.h:
- CopyBuffer: main's version. It already adds ResourceBinding::buffer_offset
to both offsets, as the branch did, and adds the overflow and overlap
checks and the predicated copy. With the arena, source and destination are
often the same VkBuffer; the overlap check compares the adjusted ranges.
- Predication: main's version. prepare() passes buffer_offset + the command's
offset to prepare_predicate, so a default-heap buffer inside the arena is
read at its own range; emit() captures the word and tests the capture's
scratch slot, not the application's buffer.
Everything else merged without conflicts. Nothing in main's 219 commits adds
a caller that takes a buffer's Vulkan device address for its GPU VA.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
R32G32B32_FLOAT/UINT/SINT/TYPELESS textures were refused ("texture format not
supported yet"). They are now R32G32B32A32 images on every GPU: most have no
optimal-tiling RGB32 image, and one that has would not avoid the repack, since
D3D12 places subresources at multiples of 512 bytes and Vulkan wants a copy's
buffer offset to be a multiple of the texel size
(VUID-vkCmdCopyBufferToImage-dstImage-07975).
- Footprints keep D3D12's 12-byte texels (compared with WARP).
- CopyTextureRegion between a texture and a buffer is repacked by the D24
compute pass (depth24_convert.comp modes 2 and 3, Depth24Job::rgb96): the
same scratch, parts and lifetime, texels of three words in the footprint and
four in the scratch, copied uninterpreted. depth24_convert.inc is
regenerated with the documented glslc command; the same glslc reproduces the
previous blob byte for byte from the previous source.
- WriteToSubresource/ReadFromSubresource take the staged copy, as D24-as-D32.
- A view's T# names GFX10_FORMAT_32_32_32_*, so alpha reads as one.
- Refused: unordered access and depth (as WARP), render targets (WARP has
them; not done, and FORMAT_SUPPORT and GetResourceAllocationInfo agree),
copies between a 96-bit and a four-channel texture, views of another
format family.
Tested on an RX 9070 XT (AMD 26.11.2), Windows 11: d3d12_rgb96_test matches
WARP and the expected texels bit for bit for 4 formats as 2D arrays with mips
and as volumes; d3d12_descriptor_test samples FLOAT, UINT and TYPELESS views.
Clean under the validation layer with sync validation; depth24_convert_test
and ctest (62) pass.
AI-assisted (Claude Code).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Conflicts (both sides kept): runtime/CMakeLists.txt (stub list), d3d12_com.h, d3d12_vulkan_device.cpp (arena buffers
with main's ray-tracing buffers and deferred destruction, calibrated timestamps, instance extensions, sampler
registration next to the window presenter), command_list.h, vulkan_backend.h, vulkan_replay.h, vk_test_device.h,
d3d12_state_map_test.cpp, docs and README. vulkan_present.h takes main's resource and tracker locks.
CI (linux-gpu-tests): ps_m15 and vs_m15 belong to d3d12_translated_draw_test. run_gpu_tests.py still assembles and
translates them but reports them as skipped (OTHER_HARNESS) instead of "no checker defined".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- register_samplers (main) and create_window_presenter (stack) both kept.
- Resource dtor: stack arena release + main deferred destroys.
- AS binding: main size/host_readable + stack console va.
- VulkanContext: main's lock split kept; stack arena/pipeline accessors
moved to resource_mutex_ (execute copies replay_ under its shared lock),
presenter lookups take it shared.
- README takes main wholesale; D3D-90 code and tests untouched.
Resolved along the lines in #291 (comment by ItsNotRexed, 2026-11-22 08:27):
- Default-heap buffers stay in the GPU address arena: a VA is an arena offset,
and every buffer's device address is heap_base + VA (upload and readback
buffers: device address minus heap_base, as before).
- Acceleration structures: a buffer created in RAYTRACING_ACCELERATION_STRUCTURE
state on a ray-tracing device stays out of the arena and keeps main's model,
its VA being the VkAccelerationStructureKHR's device address, so BLAS
addresses in TLAS instance descriptions are what Vulkan reads. It is
registered by that VA. BuildRaytracingAccelerationStructure turns build
inputs and scratch into heap_base + VA, and the arena gets the build-input
usage on ray-tracing devices. Resource keeps one va_ (gpu_va_/buffer_va_
removed).
- buffer_at keeps the size& signature; main's only caller (WriteBufferImmediate)
is the branch's version, and ExecuteIndirect resolves its buffers by id.
- ~Resource keeps arena_release and main's defer_destroy.
- Main's split context locks: pipeline registration and heap_base/zero page
take resource_mutex_ (prepare looks pipelines up under its shared lock);
VulkanPresenter takes resource_mutex_ shared, plus tracker_mutex_ while it
records the back buffer's transition.
- Standalone device: main's single instance-extension list and DXGI swapchain
enable; info.presentation follows the same swapchain/surface condition, so
create_window_presenter keeps working. Main's DeferredDeletionQueue,
calibrated timestamps and ray-tracing extensions are kept next to the
branch's presentation and feature enables.
- Command IR: Dispatch and Draw follow main's DebugMarker, ExecuteIndirect and
BuildAccelerationStructure in the variant.
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.
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.
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).
--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>
vs_m15.asm and ps_m15.asm are hand-written RDNA2 (gfx1013), built by
test/shaders/build.py through llvm-mc and tools/rdna2spirv.py. build.py now also
writes the synthetic FSSM program a shader's header asks for (fssm-at, fssm-data)
to fssm/, so the translator records its fssm_sha256 in index.json.
d3d12_translated_draw_test creates a graphics PSO from containers carrying those
programs; the layer finds both stages by hash in the translator's own index. It
covers a descriptor-table root argument and root constants (s0..s5), vertex fetch
through a V# the application wrote into a descriptor slot (s_load, then
buffer_load_dwordx4 idxen), the PS reading constants through the code base
(s_getpc_b64), and compares a float render target bit for bit. All draws use
StartVertexLocation 0, so the result is the same with and without PR 436's
zero-based ids; verified both ways. docs/d3d12_vulkan.md records the milestone and
the measurement that a V# cannot point at an upload buffer (48-bit base, negative
console VA).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the reviews and test runs on #291:
- A pipeline without vertex bindings (a full-screen pass from SV_VertexID) no longer declares the vertex-stride
dynamic state, which nothing would set (VUID-vkCmdDraw-pStrides-04913; aslan2142, AlxcBTW, ezwinxdlmao).
- Logic ops are applied from RenderTarget[0] instead of being logged and ignored (Vonsek's XOR case), and
DepthClipEnable = FALSE is depth clamping (AlxcBTW). Both need their feature (logicOp, depthClamp), or the
PSO is refused.
- The standalone device also enables shaderInt64, shaderFloat64, shaderInt16, shaderClipDistance and
shaderCullDistance where the GPU has them (AlxcBTW, whattheflop: VUID-...-pCode-08740), plus logicOp and
depthClamp.
- Among index entries for one program, a PSO takes the first that fits and declares no set-0 bindings, as
pipelines do not bind set 0 yet. This covers the compute group in poke900310's corpus count, where an entry
with 10 bindings shadowed a binding-free one.
- The command list holds a reference to every root signature and pipeline state it is given until Reset or
its release, so releasing them right after Set* (as D3D12 allows) no longer leaves dangling layouts or drops
the submission (AlxcBTW).
After the rebase onto main: main's SetPredication reads the predicate through the resource's VkBuffer, so a
default-heap buffer (a range of the GPU address arena) adds its offset in the arena, and the arena gets the
conditional-rendering usage when the extension is on (lahlousaad4's integration note).
Tests: d3d12_draw_test has a second pass with a full-screen triangle first in its submission and an XOR quad,
and a depth-clamp refusal. d3d12_compute_test releases its root signature and PSO right after setting them,
sets the signature again after the arguments, and has a bound entry ahead of the binding-free one in its
index. Each new fix, undone on its own, fails a test: pStrides-04913, wrong XOR pixels, a heap-corruption
crash without the hold, a refused PSO without the binding-free choice.
Documented as known gaps, not fixed here: wave64 subgroup size (AlxcBTW's follow-up in #313), cross-queue
waits on one VkQueue and CPU fence signals below a pending GPU signal (woreksami), and the linear buffer_at.
Shader library
- fssm_program takes the last XDAT 0x0D payload, as tools/fssm_unpack.py does by default (195 of 26,503
containers have two different ones, and fssm_sha256 is computed from the last).
- The JSON reader parses numbers with from_chars and \u escapes as exactly four hex digits, so a malformed
index is refused instead of throwing into the shim. Integer fields outside 0..2^32-1 read as 0.
- Index entries that share a program are all kept; CreateGraphicsPipelineState takes the VS whose input
signature the input layout feeds.
Command list
- Setting the root signature that is already bound keeps the root arguments, as D3D12 does.
- A draw with no viewport (never set, or RSSetViewports(0, ...)) or an empty one is not recorded: D3D12
rasterizes nothing and Vulkan forbids a 0x0 viewport.
- More than eight render targets is an invalid call, in OMSetRenderTargets and in a PSO.
Device
- Buffers of 0 bytes, or with a size that wraps when aligned, are E_INVALIDARG. The arena refuses zero-size
ranges, and its fit test cannot wrap.
- A shader-visible descriptor heap the arena cannot hold is E_OUTOFMEMORY instead of a host heap with GPU
handle 0.
- A failed arena releases its buffer and memory, so other buffers do not get raw device addresses as VAs.
- Graphics PSOs that need independentBlend, fillModeNonSolid, depthBiasClamp or dualSrcBlend are refused
unless VulkanDeviceInfo::features has them. The standalone device enables those the GPU supports.
- A draw that leaves a slot unbound where the PSO names a format uses a pipeline variant with that format
undefined (built on first use, kept with the PSO), instead of breaking
dynamicRenderingUnusedAttachments-08912.
- Instance step rate 0 reads element 0 for every instance (stride 0 at draw time).
- The Vulkan 1.0 graphics entry points are required; the 1.3 ones are checked before a graphics PSO is made.
Replay
- An unbound vertex slot, or an indexed draw with no index buffer, reads the arena's reserved first 64 KiB,
which is kept zero, as D3D12 reads zeros. A view that runs past its buffer is cut at the buffer's end
instead of failing the whole ExecuteCommandLists.
- The rendering layer count is the smallest layer count of the bound views.
Tests: shader_library_test covers two payloads, malformed JSON and duplicate programs. d3d12_draw_test
covers an unbound RT and DSV, a rebound root signature, step rate 0, an unbound vertex slot, a draw with no
viewport, the feature and count refusals, and bad buffer and heap sizes. Each of the rebind, step-rate and
variant fixes, undone on its own, makes the test fail.
Still open, documented: instance step rates above 1, read-only DSV layouts, and the index buffer's view size.
- CreateGraphicsPipelineState (PC slot 10): VS and PS found by the SHA-256
of their FSSM programs in the translator's index. Input-layout elements are
matched to the VS input signature by semantic name and index; location =
the element's register (the translator's vertex-fetch rule); a layout that
leaves an input unfed is refused, as D3D12 does. Rasterizer, blend and
depth-stencil state map one to one; viewport, scissor, topology, vertex
strides, stencil references and blend factor are dynamic; dynamic
rendering takes the RTV/DSV formats. Hull/domain/geometry, stream output,
MSAA, set-0 bindings and two code-base stages (question 14) are refused
with a log.
- Command list: IASetPrimitiveTopology / VertexBuffers / IndexBuffer,
RSSetViewports / ScissorRects (first of each), OMSetRenderTargets (views
read at the call, single-range handles too), OMSetBlendFactor,
OMSetStencilRef and CommandList8's front/back references (now applied),
DrawInstanced / DrawIndexedInstanced recording a copy of that state.
CreateCommandList's initial pipeline state is applied. Reset and
ClearState share one state reset.
- Replay: vertex/index views resolve to buffers by VA (arena or upload),
attachments move to attachment layouts through the tracker (first use
zero-fills), the draw runs in a dynamic-rendering scope with a flipped
viewport (translated VS write D3D clip coordinates), stencil references
per face, then vkCmdDraw / vkCmdDrawIndexed. Render-target views take the
pipeline's formats (the view cache keys on format).
- shader_library.h reads the index's input_signature and PS outputs.
Test: d3d12_draw_test (through the proxy) builds a VS+PS PSO whose input
layout order differs from the VS registers, uploads a vertex buffer into the
arena, reads indices from an upload heap, and draws two indexed quads with
different root constants and root CBVs plus a back-facing triangle: all 4096
read-back pixels match (which also checks the viewport flip and winding).
Shaders are GLSL written to the translator's contract. d3d12_com_test now
uses SetMarker as its unimplemented-method example, since DrawInstanced is
implemented. 13/13 ctest; all six GPU tests clean under the Khronos
validation layer.
- GPU address arena (docs 3.3), when the device has bufferDeviceAddress: one
host-visible, device-addressable buffer (LEONIDA_ARENA_MB, default 256,
max 4095 so VAs fit 32-bit table pointers). Default-heap buffers are
64 KiB-aligned ranges with VA = offset, zeroed through the mapping;
shader-visible descriptor heaps live there (CPU handle = mapping, GPU
handle = VA); upload/readback buffers get VA = device address - heap
base; GetGPUVirtualAddress returns these.
- CreateRootSignature on main's model (rt::rootsig): parse_rts0, then
pack() for each parameter's place in the 32 user-data dwords; what pack()
refuses is refused with its reason. CreateComputePipelineState (PC slot
11, Xbox slot 62 via the proxy) finds the shader by the SHA-256 of its
FSSM program in the translator's index (VulkanDeviceInfo::shader_dir or
LEONIDA_SHADERS); its FSSM blob is copied into the arena as the code base.
Shaders that declare set-0 bindings are refused with a log until the
bindless set exists (M2).
- Command list: root signatures (arguments cleared on change), pipeline
state, constant / root view / descriptor-table setters for compute and
graphics, SetDescriptorHeaps, Dispatch recording the user data as it is,
ClearState (which also resets #164's stencil references); misuse makes
Close return E_INVALIDARG.
- Test helper and standalone device enable bufferDeviceAddress.
Test: d3d12_compute_test (through the proxy) creates the root signature
from the PC serializer's blob and the PSO through slot 62 in the measured
(desc, 0, 0, riid, out) shape (28cf235) from a container shaped like the
game's, sets root constants, a root UAV and a table whose
application-written entry points at an upload buffer, runs two dispatches
that each keep their own arguments, and reads the results back: 64/64
twice. Its shader is GLSL written to the translator's push-constant and
address contract, compiled with glslangValidator. Clean under the Khronos
validation layer, as are the other GPU tests; 13/13 ctest.
amd_fidelityfx_upscaler_xbox.dll, measured with Ghidra 12.2 (through REA)
and run by fsr_dispatch_test on PC devices (RTX 2000 Ada and WARP) behind
the Xbox-ABI proxy.
Backend descriptor: the provider's create walks the chain for type
0x01000002, {header, device} with the device at +0x10, and ends in
FFX_API_RETURN_ERROR without it (what RT-3 got with 0x0200000x). With it
the DLL creates its backend through the proxy: device slots 14, 15, 18, 19,
27, 38 and 76 and heap slot 9, at the shapes the PC order and the measured
overrides predict; slot 76 takes the seven CreateCommittedResource
arguments. No earlier test here reached slot 76 or heap slot 9.
Two runtime bugs it found:
- XMemGetWorkingSetStatistics takes (kind, stats*): all seven call sites
pass kind 0x20000001 in ECX and a stack buffer in RDX. The one-argument
shim wrote to address 0x20000001.
- Device slot 67 is a console-only compute-pipeline call (a code blob in its
desc), not the PC CreateProtectedResourceSession1 the proxy forwarded it
to. The proxy now refuses it (E_NOTIMPL).
The context: on the RTX 2000 Ada the create stops at the DLL's HRESULT
check, because the driver refuses its R9G9B9E5_SHAREDEXP texture with
ALLOW_UNORDERED_ACCESS (WARP takes it). The test reports that stop and
retries with one PC stand-in (that texture as R32_UINT). On the context it
records one ffxDispatch into a logging command list that is never executed.
The console command list, from that run and the DLL's recorder (RVA
0x59a0), the same 13 calls on both devices: slots 14, 15, 25 and 26 at
their PC positions, then SetDescriptorHeaps at 32 (PC 28, seen in the run),
SetComputeRootDescriptorTable at 35 (PC 31), ClearUnorderedAccessViewUint
at 53 (PC 49, seen in the run), ExecuteIndirect at 61 (PC 59), and
console-only methods at 85 and 141. 33 and 41 fit SetComputeRootSignature
and SetComputeRootConstantBufferView by shape; the docs mark them inferred.
The logging list forwards only measured slots. The list object also carries
a write cursor and limits (+0x18, +0x28, +0x30) the DLL writes root
arguments and dispatches through while there is room; with the cursor at
the limit every command takes the vtable. These are the fields docs section
3.4 measured in the BVH builder without a meaning.
The dispatch stops at the DLL's compute pipeline: its 29 shaders are DXBC
with an ACCC part (payload tag FSPX) and no DXIL, and the PC runtime
refuses them at slot 62; the dispatch goes on with the null pipeline and
faults, which the test reports as the documented PC limit. Its C++ `throw`
also shows the loader gap: _CxxThrowException finds no image base for a
manually mapped image.
The test's fault report gives the faulting module and RVA, the access, the
C++ throw's ThrowInfo, image base and unwound stack, and the HRESULT the
DLL formatted with the DLL frames that made the failing call.
Docs: d3d12_vulkan.md Appendix A.3 and open question 2,
d3d12_command_objects.md 3.4 and 3.5a, design.md and runtime/README.md.
From VictorJulianiR's review of the presenter, with Vonsek's measurements:
- A failed blit submission left the frame's fence reset with nothing to signal it, so the next present waited
forever (Vonsek: the retry reached vkWaitForFences with UINT64_MAX). An empty batch now takes the acquire
semaphore and signals the fence, and the swapchain is recreated next time to give back the image that was
never presented. If that batch fails too, or a fence wait or reset fails, the presenter stops (ok() is
false). A back buffer the device does not know is refused before an image is acquired for it.
- A swapchain recreation published the new swapchain before its per-image semaphores existed, so a failed
semaphore left a presenter that could submit with a null one. The images and semaphores are now built in
local storage and published only when all exist; on a failure the partial objects are released and the next
present tries again.
- An out-of-date present was counted as presented (Vonsek: 69 VK_SUCCESS and one VK_ERROR_OUT_OF_DATE_KHR
reached 70). presented() now counts VK_SUCCESS and VK_SUBOPTIMAL_KHR only; the caller still gets VK_SUCCESS.
d3d12_present_test gives the device and presenter their functions through a driver double that forwards to the
real driver. It counts real out-of-date presents (the frame counts allow for them) and live binary semaphores.
It reports one present as out of date and one as suboptimal, fails the second semaphore of a recreation, and
fails one blit submission. Against the old presenter the test fails at the frame count after the resize, where
this RTX 5060 Ti reported a real out-of-date present.
Docs: the presenter is named as leonida::VulkanPresenter, made by rt::d3d12::create_window_presenter, and the
test is described as 60 frames then 10 after a resize (AlxcBTW).
The debug messenger in test/vk_test_device.h counted every error-severity
message, so a broken third-party implicit layer (ReShade's, reported on an
RTX 5090) failed every GPU test. Only VALIDATION-type errors are counted now;
general loader and layer messages are still printed, marked "not counted".
A real validation error still fails the test (checked by replaying part B of
vk_command_replay_test without the layout tracker). runtime/README.md says
so and mentions VK_LOADER_LAYERS_DISABLE.
- vulkan_present.h: VulkanPresenter blits a back buffer (an ordinary texture
in D3D12's PRESENT state, layout tracked like any other) to an acquired
swapchain image and presents it on the same VkQueue, after the
application's work. Two frames in flight, a present semaphore per image,
FIFO for vsync else MAILBOX/IMMEDIATE, swapchain recreated on resize or
out-of-date/suboptimal, minimised windows skip presents.
- rt::d3d12::create_window_presenter / WindowPresenter: Win32 surface for a
Vulkan device created with presentation; holds the device. This is the back
end a DXGI shim or PresentX would call; the game's own front end is still
open (docs question 6), so neither is invented here.
- Standalone device enables VK_KHR_surface/win32_surface and VK_KHR_swapchain
when present; the test helper can too.
Test: d3d12_present_test opens a window and presents 60 frames through the
Xbox-ABI proxy (reset, PRESENT->RENDER_TARGET, clear, ->PRESENT, execute,
present, fence), resizes the window (swapchain recreated, scaled blit),
switches to unsynchronised presents, and reads the screen with GDI:
51,153,229 for a 51,153,230 clear. Clean under the Khronos validation layer,
as are the other GPU tests; 6/6 ctest.
The shim is built with an installed SDL3 (find_package) or with
-DLEONIDA_SDL3_FETCH=ON / FETCHCONTENT_SOURCE_DIR_SDL3; otherwise configure
prints a message, gta6rt builds without it, and CTest lists gameinput as
disabled. build_runtime.ps1 gains -FetchSdl3 and warns that its cl.exe
fallback never builds the shim. Review nits: delivering_thread is atomic,
and SDL's own GameInput joystick driver is pinned off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A resource created with Alignment 0 read back Alignment 0 from the Vulkan-backed
device. The PC runtime and WARP report the placement alignment instead: 64 KiB,
or 4 MiB for a multisampled texture, and keep one the description asked for.
d3d12_resource_desc_test compares every GetDesc field of 26 committed and
reserved descriptions with the default adapter and WARP.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
GameInputCreate and the v0 IGameInput/IGameInputDevice/IGameInputReading/IGameInputDispatcher surface a title uses
for gamepads, served from SDL3 gamepads so DualSense, DualShock 4, Switch Pro and Xbox pads all work. Rumble goes to
SDL_RumbleGamepad, impulse-trigger rumble to SDL_RumbleGamepadTriggers, and on a DualSense to adaptive-trigger effects
through SDL_SendGamepadEffect (LEONIDA_DS_TRIGGERS=off|rumble|resistance). Lightbar via LEONIDA_DS_LIGHTBAR.
SDL3 (zlib) comes from an installed package or a pinned, hash-checked release tarball via FetchContent;
-DLEONIDA_SDL3=OFF skips the shim. gameinput_test covers the shim on SDL virtual joysticks; gameinput_probe is the
manual check on a real pad. docs/gameinput.md has the mapping, settings and VERIFY list.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- make_common_stub checks RtlAddFunctionTable and reports a failure once;
the stub keeps working, only stack walks through it stop.
- rt_unimplemented keys per-import state by the thunk's `what` pointer, so a
repeat call does one map lookup and builds no strings.
- A test hook (set_unimplemented_test_hook) lets unimplemented_policy_test
check, from inside the call, that rsp is aligned and that
RtlLookupFunctionEntry/RtlVirtualUnwind walk through rt_unimplemented and
the stub back to the caller.
- abi_probe.asm (MASM) calls a thunk with rbx/rbp/rdi/rsi/r12-r15 and
xmm6-xmm15 set to patterns and compares them afterwards, with a control
callee that clobbers rbx and xmm6.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>