The layer gave the packed tail its tight linear size in whole tiles. AMD's PC
runtime gives it one tile per tile-depth slice it spans: ceil(depth of the
first packed mip / tile depth), so 1 for every 2D layout and a step at each
tile depth for volumes (8x8x32 R8: 1 tile, 8x8x33: 2, 8x8x256: 8), even where
the bytes would fit in fewer (16x16x128 RGBA8: 8 tiles for 3 tiles of data).
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: the rule fits all 83 layouts, the
47 from #868 (where it explains the two deep volumes AMD gave 2 tiles) and 36
new volumes whose tail is deeper than a tile, including tails that start after
standard mips. It matters once sparse textures (D3D-285) reach mip tails.
- src/resource_tiling.h: packed tiles = max(1, tight size, tail depth slices).
- resource_tiling_test: the two deep volumes expect 2, plus the 36 new volumes
with AMD's values.
- docs/d3d12_vulkan.md 4.2: the rule and the measurement.
AI-assisted (Claude Code).
Avoid per-element bit interleaving in tile/detile copies; retain element_offset as the independent reference and validate decoded output against it.
AI-assisted.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
LEONIDA_BVH_RECORD62=1 now prints the module of each CreateComputePipelineState
call (the file name in the container's ILDN part) and says when a creation passes
a container byte-identical to an earlier one. The constructor makes 53 creations
over 52 containers; the repeat is GetBVHCompactedSize (5,284 bytes = 0x14a4):
creations #47 and #53. The test prints a summary and checks that the repeated
container names the same module both times.
docs/embedded_shaders.md answers the open question and lists the creation order.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ps_far_branch runs s_getpc_b64 / s_add_u32|s_sub_u32 / s_addc_u32|s_subb_u32 /
s_setpc_b64: two forward jumps, a sub/subb loop, an add/addc -1 loop and a
conditional far jump, with K derived by hand. fold_far_branches now folds the
idiom only when its instructions have encodings, so a listing without them
gives Unsupported instead of a TypeError.
AI-assisted.
clang-cl 19 and 20 crash (exit 139, in recoverAddrOfEscapedLocal) on the
__except filters of fsr_dispatch_test.cpp and bvh_builder_test.cpp: each
guard's `Call c` is also its named return value, and the filter writes it.
That stops the cross-build of runtime/cmake/clang-cl-xwin.cmake before the
rest of the tests. Return a copy instead, so `c` stays an ordinary local.
Behaviour is unchanged; both tests still skip without a package.
D3D-316: copy the validated Python 4KB_S and 64KB_D bit patterns into a bounded, portable helper. Cover padded bijections, round trips, Python known offsets and invalid inputs without a GPU.
AI-assisted.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@aguedou-34 measured on #2462 that an integrated Radeon without DXR (OPTIONS5
reports no ray tracing) refuses a UAV buffer created in
RAYTRACING_ACCELERATION_STRUCTURE state, which an RTX accepts. The layer now
accepts that state only where it has acceleration structures (KHR builds, or
the XDXR records with the GPU address arena), for committed, placed and
reserved resources alike, and refuses it elsewhere.
d3d12_vulkan_device_test compares the existing committed case on the device
main builds (no acceleration structures) only with a host without ray
tracing, and two new cases on the standalone device (committed and placed)
only with a host that has it; otherwise they are reported as not comparable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without Vulkan headers everything under if(TARGET Vulkan::Headers) is left
out: the D3D12 COM objects, the Vulkan D3D12 device in gta6rt
(LEONIDA_D3D12=vulkan) and most of ctest. The only output was a STATUS line
naming four test tools, so a build whose VULKAN_SDK never reached CMake ran
45 of 125 tests and reported "100% tests passed".
- runtime/cmake/vulkan_headers_missing.cmake: a WARNING that names what is
left out and that CMakeCache.txt keeps the failed lookup.
- LEONIDA_REQUIRE_VULKAN=ON turns it into a configure error; both CI
configures pass it, and scripts/build_runtime.ps1 does when VULKAN_SDK is set.
- tests/test_cmake_vulkan_missing.py runs the module with cmake -P and checks
that CMakeLists.txt and CI use it; docs/testing.md gets a troubleshooting row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vulkan_topology (D3D12 primitive topology -> VkPrimitiveTopology) and
strip_topology (which Vulkan topologies a restart index cuts) had no test. A
wrong mapping draws the wrong primitive; a wrong strip classification restarts an
indexed strip that should not, or fails to restart one that should.
Pins both: every mapped D3D12 topology value to its VkPrimitiveTopology and strip
flag, the triangle-list fallback for list/undefined/unmapped values, and the
strip classification, with the D3D_PRIMITIVE_TOPOLOGY enum values SDK-asserted.
ctest -R d3d12_state_map passes (MSVC /W4 /permissive-, Windows SDK 10.0.26100,
Vulkan headers 1.4.363). Header-only, no GPU, no game files.
HapticApi carried SDL_GetNumHapticAxes and SDL_HapticEffectSupported, which
nothing calls: the motor's axes are the shim's choice and the effect kinds are
gated on SDL_GetHapticFeatures. They are gone from the table, its SDL
implementation and the test's fake, so the seam is exactly the calls a pad's
force feedback makes.
AI-assisted.
Two pixel tests, ps_vcmpx_f16 (e32) and ps_vcmpx_f16_e64 (swapped operands),
on the operand pairs of ps_vcmp_f16: the EXEC result of each predicate, VCC
kept, and EXEC only ANDed. Words derived by hand in the headers; semantic
fixture and test added.
AI-assisted.
The package's XCurl.dll and libHttpClient.GDK.dll import 16 WinHTTP functions
(no Winsock) and bound to the host's winhttp.dll, so a mapped title could reach
the network. winhttp.dll is now a module the shims own and all 16 are answered
in-process:
- sessions, connections and requests are local handles; no name lookup, no
socket;
- WinHttpSendRequest fails with ERROR_WINHTTP_CANNOT_CONNECT; on a
WINHTTP_FLAG_ASYNC session it returns TRUE and reports
WINHTTP_CALLBACK_STATUS_REQUEST_ERROR {API_SEND_REQUEST, CANNOT_CONNECT} from
a thread-pool thread with the request's context (not after the request was
closed);
- reading a response and WinHttpWriteData fail with
ERROR_WINHTTP_INCORRECT_HANDLE_STATE; options, timeouts and headers are
accepted, CONTEXT_VALUE and HANDLE_TYPE can be queried;
- callbacks are inherited by child handles (HANDLE_CREATED), and every handle
reports HANDLE_CLOSING once, last (reference-counted, so a callback that
closes its own request is safe);
- WinHttpCrackUrl stays the host's (parsing only, loaded on first use).
Each refused server is logged once. winhttp_offline: 40/40 checks, .invalid
names only, no connection opened.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Honour LEONIDA_PC_TAIL_UBO=1 in runtime/test/vk_image_fuzz.cpp by sizing the
push-constant range and vkCmdPushConstants to 128 bytes (s0..s31; the fuzz
shaders read neither heap base nor code base, so they declare no set-1 block).
Add --pc-tail-ubo (and LEONIDA_PC_TAIL_UBO=1 env detection) to
tools/image_fuzz.py so it forwards --pc-tail-ubo to rdna2spirv.py and sets
LEONIDA_PC_TAIL_UBO=1 for vk_image_fuzz, enabling 128-byte push-constant GPUs
to run the image fuzzer instead of skipping every case.
Co-Authored-By: Gemini 4 Neon <noreply@google.com>
CopyTextureRegion between two block-compressed textures copies whole blocks
on the PC runtime. When a mip edge falls inside a block on one side only (a
4x4 box into a 3x3 mip, a 6x6 mip into a 12x12 one), no single Vulkan extent
is a block multiple or reaches the edge of both images, so the layer refused
the copy with invalid_copy (docs/d3d12_vulkan.md, section 3.2 known gaps).
Such a copy now goes through the transfer scratch that depth <-> colour
copies already use (vulkan_scratch.h): vkCmdCopyImageToBuffer with the
source's own cut extent into whole blocks, then vkCmdCopyBufferToImage with
the destination's. The box fits the source's padded mip, so the scratch
holds every block the destination reads. The staged emit path calls the
destination's copy_layout after the scratch write, so every earlier transfer
write is ordered before the destination's (the write-after-write @Vonsek
found under synchronization validation in the first version of #860).
- d3d12_copy_compare: the 8 BC mixed-mip cases that were printed as known
differences must now match the host; two more shapes (a source edge inside
the block, a destination offset to the edge).
- d3d12_state_map_test checks the staged regions on the CPU.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dispatch ran the whole queue whatever quota it was given. It now runs
queued events oldest first, at least one per call (a quota of 0 runs
exactly one, as the GDK documents), takes no further event once the
quota has passed, and returns whether events remain. While events
remain the wait handle is signalled again, so a title that waits on it
before each call comes back for the rest.
The automatic path (no dispatcher, poll thread) still delivers the
whole queue. gameinput_test checks Dispatch(0), a 1 ms quota against a
5 ms callback, a large quota draining the queue, and an empty queue.
d3d12_fspx_compute, d3d12_msaa_draw, d3d12_set0_compute and
d3d12_pipeline_library build PSOs from 144-byte shaders. On a device
whose maxPushConstantsSize is 128 (AMD's Windows driver on RDNA2 iGPUs,
some Intel Arc drivers) the layer refuses those PSOs with E_NOTIMPL, as
D3D-14 intends, so the tests failed at the first CreatePipelineState and
ctest reported 4 failures on a correct runtime. They now exit 77 there
(SKIP_RETURN_CODE in CMake) with the reason; pipeline_library still runs
its library-blob checks first. Devices with 144 bytes or more are
unchanged. d3d12_compute and d3d12_draw are left to #2402, which runs
their --pc-tail-ubo path on such devices.
AI-assisted.
Measured against the host D3D12 runtime (RTX 5070, driver 621.14):
UNKNOWN is a buffer format (S_OK, Support1 = BUFFER), and a value the
runtime's format table has no entry for is E_FAIL: 116-188, which
includes the planar video formats P208/V208/V408 at 130-132, and 192 and
up. The layer answered DXGI_ERROR_UNSUPPORTED for both.
compare_invalid_arguments gets 11 "format support:" cases, comparing the
HRESULT and Support1. Support2 is not compared, because the host's
TILED is a GPU capability the layer doesn't offer. The local check that
expected UNKNOWN to fail now expects the host's answer. 115, 189 and 191,
the table's edges, must not be E_FAIL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IGameInputDevice answered the force-feedback and haptic half of the API with
nothing: no motors in GameInputDeviceInfo, E_INVALIDARG from
CreateForceFeedbackEffect, false from IsForceFeedbackMotorPoweredOn, a no-op
SetForceFeedbackMotorGain and E_INVALIDARG from SetHapticMotorState. A pad SDL
opens as a haptic device now reports one force-feedback motor with the effect
kinds SDL lists, and a pad with trigger motors reports two haptic motors.
Force feedback goes to SDL_CreateHapticEffect/RunHapticEffect on the poll
thread, so title calls still never touch SDL; the eleven GameInput effect kinds
are SDL's eleven force-feedback effects. The trigger haptic motors play their
one waveform as an intensity on the existing trigger output. A pad with neither
keeps the old answers, and LEONIDA_RUMBLE=0 silences both. gameinput_test drives
all of it through a fake haptic backend, because SDL's virtual joysticks report
no haptics.
AI-assisted.
d3d12_private_data_test runs the same 672 GetPrivateData / SetPrivateData /
SetPrivateDataInterface / SetName steps on the device, a fence, a buffer, a
command allocator and a descriptor heap of the Vulkan-backed device and of the
host runtime, and compares every HRESULT, returned size, byte and reference
count. On main 130 of them differed (RTX 3060, driver 610.88), the same four
rules on every object:
- SetPrivateData with null data removes the entry whatever the size: S_OK
when there was one, S_FALSE when there wasn't. The layer answered
E_INVALIDARG for a nonzero size and kept the entry, and S_OK for a missing
one.
- Zero bytes with data keep an empty entry (size 0); the layer removed it.
- SetPrivateDataInterface(null) releases the interface and keeps a
pointer-sized entry that reads back as null; the layer removed it.
- SetName is not readable through GetPrivateData: the host sets neither
WKPDID_D3DDebugObjectNameW nor the narrow key. The layer stored the name
there; it now keeps it apart (debug_name()).
SetName(nullptr) faults in the host runtime; the layer still clears the name,
and the test reports those 5 steps as not compared.
d3d12_debug_markers_test's private-data checks expected the old answers and
now expect the host's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two pixel tests, ps_vcmp_f16 (e32, VCC) and ps_vcmp_f16_e64 (SGPR destination,
swapped operands), with NaN, +-0, +-inf, f16 denormals and junk high halves.
Words derived by hand in the headers; semantic fixture and test added.
AI-assisted.
- the DisableThreadLibraryCalls table entry gets its own continued line (it
shared FreeLibrary's, 231 columns wide), and its comment is wrapped to 120;
- dll_thread_calls_test also calls the shim with a shim pseudo-handle (the
handle GetModuleHandleA("xmem.dll") returns), which the Windows function
would refuse: removing the pseudo(module) branch now fails the test.
xmem.cpp is linked into the test only to give the shims a module to own.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>