Follow-up review fixes for D24S8-made Xbox D16S8 (format 118) depth UAVs:
- Pass the console origin (recorded before pc_format()) into
castable_view_formats() instead of widening on format.d24, so a plain PC
D24_UNORM_S8_UINT texture keeps main's castable-format rules and refuses
the R16/R8/118-120 depth-UAV views.
- Set mark_console_d16s8() in create_placed() as well as
create_committed(). CreateReservedResource refuses format 118 before it
makes anything (a stencil format has no tile shape), so it needs no mark.
- Extend xbox_d16s8_d24_storage to cover slot 127, incompatible castable
views, plain PC D24S8 castable/UAV refusal, CreateCommittedResource2,
CreatePlacedResource/2, and the CreateReservedResource refusal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On GPUs with native VK_FORMAT_D24_UNORM_S8_UINT attachments (NVIDIA),
pc_format() maps Xbox format 118 (D16_UNORM_S8_UINT) to
DXGI_FORMAT_D24_UNORM_S8_UINT before Resource construction. Previously,
Resource::enable_depth_stencil_uav only accepted R16_TYPELESS, 118, and
R32G8X24_TYPELESS, returning E_INVALIDARG so slots 76 and 133 fell back
to creating the texture without unordered access (#1558).
Track console format 118 origin on Resource before pc_format(), extend
enable_depth_stencil_uav and CreateUnorderedAccessView to serve D24S8-made
118 through the existing widened R16_TYPELESS (R16_UINT/R16_UNORM views)
plus R8_UINT storage planes and R32_FLOAT conversion image, and convert
plane-0 D24 depth words in transfer scratch to/from R32_SFLOAT via the
existing Depth24Converter compute pass in copy_depth_uav. Add
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT to copy scratch, accept D16S8/D24S8
castable lists in castable_view_formats, and keep #1558's refusal fallback
in d3d12_xs_device.cpp for any other provider refusal.
Replace xbox_d16s8_refused_uav with xbox_d16s8_d24_storage covering slot 76
6-layer round-trips, slot 133 1280x720 placement, CreateCommittedResource3
castable formats, R16_UNORM/R16_UINT/R8_UINT UAV clears, and direct D24S8
parent attachment readback.
Verified on Windows 10 19045 / GeForce GTX 1050 Ti (NVIDIA 582.66):
17/17 related CTests pass plain and with LEONIDA_VK_VALIDATION=1 (0
validation errors).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every translated VS declares the SPIR-V DrawParameters capability (BaseVertex /
BaseInstance for the zero-based v0 / v3), but the harness never enabled
VkPhysicalDeviceVulkan11Features::shaderDrawParameters. Under
LEONIDA_VK_VALIDATION=1, vkCreateShaderModule fails with
VUID-VkShaderModuleCreateInfo-pCode-08740 on every case, on both AMD and
NVIDIA, silently zeroing an image_fuzz campaign; drivers tolerate it without
validation.
Query Vulkan11 features on their own vkGetPhysicalDeviceFeatures2 call and
chain enable11 under the Vulkan12 features at device creation, as
vk_sampler_test and vk_bindless_test already do for their queries.
Verified: image_fuzz seed 1 (60 programs) and seed 2 (30 programs) match on
AMD Radeon Graphics and NVIDIA RTX 4070 SUPER with LEONIDA_VK_VALIDATION=1,
0 validation errors; before the fix the first case of each GPU failed with
the VUID. vk_bindless_test and vk_sampler_test run clean under validation on
both GPUs, so their chained Vulkan11-under-Vulkan12 queries needed no change.
Co-Authored-By: Devin <noreply@cognition.ai>
A worker took the next index and only then waited in the large-module gate,
so with the memory budget full the modules behind a large one sat untaken
while spare workers blocked, and the pool ran below --jobs.
LargeModuleQueue (large_module_gate.h) now hands out the indices. A large
module the gate can't admit yet is put back and the worker takes the next
one. The oldest module put back goes first as soon as the gate admits it and
no later large module passes it; once every index is out, a worker waits for
it. Nothing is put back while the gate admits each large module as it comes,
so with one worker or room under the budget the order is unchanged, and
--large-parallel 1 and --large-module-bytes 0 never ask the queue to admit.
large_module_gate_test: the waiting module frees its worker (fails with the
old claim-then-admit order), oldest-first and no double entry, the unchanged
order, and every module once under 8 threads.
AI-assisted (Claude Code).
A GeometryViews refresh reads each written 64 KiB tile with its own
readability probe and guarded copy, even when the title wrote a run of
adjacent tiles across tile boundaries. Group the written tiles (already in
address order) into maximal runs whose addresses differ by one tile and read
each run a ready view needs as one guarded copy; the per-tile pass then reuses
those bytes through read_tile(). A run that cannot be read whole falls back to
the per-tile read, so an uncommitted page still zeroes only what it did before.
Same behaviour as DexNom/VIctory's copy_fetch_runs
(crates/victory-gpu/src/host.rs, GPL-3.0-or-later, commit 570a941),
re-implemented for this header; no identifiers or code copied.
Tested: geometry_views_test 14/14, including the new case (two adjacent written
tiles are one 128 KiB copy); gta6rt_d3d12_com builds. Synthetic only, no game
files or GPU. AI-assisted.
Add input validation guards to CacheStagingFile in runtime/shims/d3d12_pipeline_checkpoint.h for empty destination and zero bytes, and add is_direct_session_cache_enabled helper. Add a unit test suite in runtime/test/d3d12_pipeline_checkpoint_test.cpp and register it in runtime/CMakeLists.txt.
Claimed in #1608: RT-PIPELINE-CHECKPOINT-GUARDS-AND-TESTS.
AI-assisted (Claude Code)
Conflict in docs/design.md: main added the "Per-lane descriptor selection"
row right above the SHADER-10 row this PR rewords. Both are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The last --explicit-lod-bias path without GPU coverage: with
LEONIDA_TEXOFF_FALLBACK=1 the implicit offset sample is a Grad sample whose
derivatives the flag scales. A SKIP without the fallback, since vk_sampler_test
enables no VK_KHR_maintenance8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Maintainer fixes on top of the author's rehydration, carried over from the
reviewed branch onto the rewritten head:
- Scratch: each element of a batch gets a region of its own in one buffer
per call, at D3D12's acceleration-structure alignment, and the command list
holds that buffer until its next Reset (rt::d3d12::hold_until_reset). Before,
every element and every list shared one builder-wide buffer with no barrier
between the builds, and growing it released a buffer that builds already
recorded could still use.
- Fresh builds: a rehydrate always builds from geometry. PERFORM_UPDATE is
cleared together with SourceAccelerationStructureData, so the layer never
refits from the dehydrated stream's bytes.
- The leaf frame compressionParams gives is described as not applied yet,
which is what the code does.
- The test reads back rehydrated builds made without scratch
(ScratchAccelerationStructureData = 0), the shape the title uses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict in scripts/run_gpu_tests.py: the dump-test name list gained
cs_w64x_cmp_sdst on main and cs_w64x_partial_swizzle here; both are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fix log_once call signature at line 268 (passes flag, text without format args).
- Do not copy source_data into SourceAccelerationStructureData to avoid unwanted refit
on update paths (d3d12_vulkan_device.cpp:2639).
- Allocate and supply scratch buffer via builder_ensure_scratch when the title passes
ScratchAccelerationStructureData = 0 (docs/xdxr.md §6), avoiding command list poisoning.
- Retain the leaf-frame note (compressionParams, docs/bvh.md §4a) in comments and docs.
- Remove stale deserialize references in test comments and update test coverage.
AI-assisted (Claude Code, Claude Opus 5.5).
Addresses review feedback on #1759 from @aslan2142 and @Tyrannys:
- RehydrateRaytracingAccelerationStructureBatched2X now rebuilds structures
exclusively from geometry (docs/bvh.md §4a).
- Offline console dehydrated streams cannot be directly deserialized by
PC D3D12/Vulkan drivers (docs/bvh.md §4/§4a). When source_data is present
without geometry descs, the shim logs once and refuses with E_NOTIMPL.
- Documented in docs/xdxr.md that the 4th parameter (const UINT64* source_data)
is a hypothesis denoting offline console stream pointers.
- Empty structures (NumDescs == 0 without source) are logged once and skipped.
- Updated runtime/test/xbox_bvh_builder_test.cpp and tests/test_xbox_bvh_builder_rehydrate.py
to verify refusal of source-only streams (E_NOTIMPL) and handling of empty structures.
AI-assisted (Claude Code, Claude Opus 5.5).
Implements XboxBvhBuilder::RehydrateRaytracingAccelerationStructureBatched2X
in runtime/shims/xbox_bvh_builder.cpp. The shim now rebuilds or deserializes
each acceleration structure on the command list via ID3D12GraphicsCommandList4
rather than stubbing out with E_NOTIMPL, resolving the interactive boot stop
reported by timbot103 past story-load texture streaming.
Validates count == 0 (S_OK), null list / descs (E_INVALIDARG), and adds unit
coverage in tests/test_xbox_bvh_builder_rehydrate.py and runtime/test/xbox_bvh_builder_test.cpp.
AI-assisted (Claude Code)
Harden runtime/src/value_write_sink.h:
- Guard arena() against null buffer pointers and non-4/8-byte sizes by immediately returning Landing::refused, preventing null dereference and invalid writes.
- Guard title_pages() against null addresses, null bytes, and zero size by returning false immediately.
- Guard clear_arena() to reject null device pointers.
- Add clear_title_pages() and reset_for_test() to allow clean state resets across tests and teardown.
- Add portable CPU-only CTest unit test runtime/test/value_write_sink_test.cpp verifying initial state, guards, arena and title_pages dispatch, device-matched clearing, and multi-threaded concurrency.
AI-assisted (Claude Code)
The three review points on #1630:
- prepare() refuses two overlapping SO_STATISTICS queries on one stream: two
active indexed queries in one pool break
VUID-vkCmdBeginQueryIndexedEXT-queryPool-04753. Queries on different streams
are fine.
- The transform-feedback pool now also needs the transformFeedbackQueries
property, and a stream at or above maxTransformFeedbackStreams runs nothing
and resolves zero instead of issuing an invalid indexed begin.
- replay_query_predication case 18 fails without both: the overlapping-stream
list is invalid_query and a stream past the pool's stream count fills zeros.
Tested: d3d12_vulkan_device, d3d12_state_map and replay_query_predication pass
plain and with LEONIDA_VK_VALIDATION=1 (RTX 3080 Ti, driver 616.64). AI-assisted.
GPU coverage for the rest of --explicit-lod-bias's forms. vk_sampler_test gains
a mode for a 6-layer cube (images_arr), a 128x128x2 volume (images_3d) and a
D32 texture (0.25 / 0.75 per level) with the S#'s compare function; the 2D
default is unchanged. check.py's SAMPLER_FIXTURES names each shader's mode and
judges ps_ssharp_c as compare results.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Builds on #1144 (RT-XAPU-CONNECT-LAYOUTS): the queue and layouts stay there;
fill() decodes each process packet through a Rust C-ABI crate over BSD-3
opus-pure when cargo builds it, and keeps the table-of-contents silence path
otherwise. Adds xapu_opus_test (a generated 440 Hz stereo packet decoded to
960 frames) and the CMake wiring; xapu_chad_test keeps covering the layouts
and the silent path. No game data.
Both tests carried their own copy of serialize(), which calls the in-box
D3D12SerializeVersionedRootSignature directly. Windows 10's d3d12.dll
(10.0.19041) refuses CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED at root signature
1.0 and 1.1 (E_INVALIDARG, "Unsupported bit-flag set"), so the cases that
set it stopped at an empty blob before reaching the code they test.
d3d12test::serialize_root_signature (d3d12_test_shaders.h) already retries
without the flags and puts them back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A driver can stop adding to a large VkPipelineCache with no error. On NVIDIA 610.88 a 1.23 GB or 1.35 GB cache
came back the same size to the byte after a 2 s compile, so the next run compiles the same pipelines again and
nothing says why. The runtime now takes the cache's size at creation and at each session save, counts the title's
pipeline builds that took at least 200 ms, and logs once when 16 or more compiled while the cache grew less than
64 KiB. pipeline_cache_store_test covers the decision; docs/d3d12_vulkan.md records the measurements.
On a fresh macOS or Linux build tree nothing has made generated/ when this
rule runs, so glslangValidator stops with "Failed to open file" and the build
of vk_null_descriptor_test fails (and every test after it in ctest).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GPU coverage for the --explicit-lod-bias paths ps_ssharp doesn't run: the Lod
of image_sample_l, the 2^bias Grad scale of image_sample_d and the bias of
image_sample_b. check.py's SAMPLER_FIXTURES runs all three with the same cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Drain released geometry ranges only in the submit-thread before_execute callback, removing recording-thread drain calls and GeometryViews::should_reclaim().
- Filter geometry_writes::note_released() against monotonic watched_lo/watched_hi bounds and collapse the queue on 65536-entry overflow instead of dropping ranges.
- Bound GeometryViews::retire_range() walks using max_view_bytes_ and an ordered refused_ map with max_refused_bytes_.
- Keep one empty 4 MiB spare block in TitleBufferWindows (dropping it when needed under a cap), remove failed_ reset in free(), and cover all four points in geometry_views_test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>