Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted;
this commit is the resolution only. Build and test repairs follow in their own commits.
Rule of resolution: where both sides added different things, both stay; where both made the same change in two
forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two
changed the same code for different purposes, both purposes are kept.
Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, registry.cpp):
- d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device
routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device
slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the
console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and
list slot 139 (#396).
- Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's
completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is
attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider
pc_resource_desc, S_OK for queue slots past the PC table.
- Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its
undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base
list proxy, its null-view slot 70 and its refusing slot 133.
Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp):
- Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra
cases added; main's --env-slots-74 and #984's --env-slots-70.
- Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy,
the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases.
D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h,
frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp,
d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp,
vk_pipeline_check.cpp, vk_test_device.h):
- Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's
ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's
origin, so both pools run on disjoint sets of textures.
- frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter.
- main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4
stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980).
- shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it.
- Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count
refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it.
Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp,
runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp):
- ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on
ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file.
- gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries.
- Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped.
Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1,
make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py,
runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md,
runtime/README.md):
- Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake.
- rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's
restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped.
- shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags.
- shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants.
One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC
compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Merging.
**Why merged:** D3D-COPY-TIMESTAMP-CAPS: timestamp bits are tracked per queue family, and transfer-only families count as 0 bits because they can't reset or resolve queries. This was the first native Windows run of the fixed head; madhyn's Wine run was on an older head, and KernelSmoker ran vk_queue on Linux. Behaviour change: OPTIONS3.CopyQueueTimestampQueriesSupported can now be TRUE, and a copy queue that gets a transfer-only family returns E_FAIL from GetTimestampFrequency and GetClockCalibration instead of borrowing the graphics family's bits.
**Why it's good:** d3d12_vulkan_device, d3d12_query_rules, vk_queue, vk_queue_query_sync and vk_queue_constructor_oom: 5/5 both plain and under validation on the 4070 SUPER.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.
AI-assisted (Claude Code, Claude Opus 5.5).
Ported from @gustavorafaelschmidt's #3077 commit 2612b150 (author credited
below). With their go-ahead on #4682, keep one fix for both the empty-mask
driver case and the allocation-failure case this PR already handled:
- VulkanDeviceInfo::force_host_transfer_retry (tests only) forces the
no-memory-type branch on any GPU, so d3d12_vulkan_device_test and
d3d12_subresource_copy_test run their CPU copies through a third path.
- create_image() is a lambda that leaves image_ null after a failed create
(the handle is undefined on failure and ~Resource destroys any non-null
one), and log_once reports when the fallback fires.
- After dropping host-transfer usage, check_image_support is re-run before
the image is made again; this PR's allocation/bind-failure retry is kept
alongside it.
- docs/d3d12_vulkan.md and docs/testing.md record the Pascal measurement and
the tier-1 host note.
The tier-1 heap/WARP comparison changes in #3077 are not part of this port:
they belong to D3D-504 (#5000). Tests on GTX 1060 / 582.78: both executables
built with MSVC 19.44; d3d12_subresource_copy_test OK with all three paths
(109 compared steps, 0 mismatches each); d3d12_vulkan_device_test's three
CPU-copy paths matched, with only the known pre-existing tier-1
heap_mismatches assert (D3D-504) still failing. No game data.
AI-assisted (OpenCode).
Original commit by Gustavo Rafael Schmidt <204491080+gustavorafaelschmidt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.
Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.
Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.
Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.
No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.
Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A DEPTH_STENCIL2 subobject whose FrontFace and BackFace masks differ was
refused with E_NOTIMPL, and OPTIONS14 reported
IndependentFrontAndBackStencilRefMaskSupported = FALSE although the
per-face references of OMSetFrontAndBackStencilRef already reach the
draw. Vulkan has a compare and a write mask per face in VkStencilOpState.
parse_pipeline_stream keeps the front face's masks in the description and
the back face's beside it (PipelineStream::back_stencil), create_graphics
takes them as an optional argument for depth.back, and OPTIONS14 now
reports the cap. The classic CreateGraphicsPipelineState path and its
cached-PSO key are unchanged: D3D12_DEPTH_STENCIL_DESC has one mask pair.
d3d12_state_sweep_test builds 16 more PSOs from a stream with
DEPTH_STENCIL2 (same, split, front-only and back-only masks; one reference
or two through OMSetFrontAndBackStencilRef; front- and back-facing) and
compares the colour and stencil readback with the host D3D12 device: 498
cases, 0 differ on an RTX 5070 Ti. Giving the back face the front face's
masks makes 6 of them differ. d3d12_vulkan_device_test expects the cap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2dbcb882c (#6935) routes the Xbox-ABI device proxy's slot 78 to the console's SetFrameIntervalX. On the PC
ABI that slot is ID3D12Device10::CreateReservedResource2, which this test called through the proxy, so the
call answered S_OK with a null resource and GetResourceTiling of it gave 0: "line 6576: tiles == 1"
("d3d12_xs: device slot 78 routed to SetFrameIntervalX" in the log).
The Device10 call now goes through the inner Vulkan device, and the test checks that both resources were
created, so a success without an object fails at the call instead of at the tile count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GetCopyableFootprints started the layout at BaseOffset and aligned every
subresource to D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT as an absolute
address. The PC runtime lays the subresources out from 0 and adds the base
afterwards: with base 513 the host returns offset 513 for subresource 0,
ours returned 1024, and the totals differed by the gap.
GetCopyableFootprints1 wraps the same function.
compare_footprints now also runs bases 513 and 2^32 + 1 (both unaligned)
next to 0 and 1024. Against the hardware host device on an AMD Radeon
RX 7600, on main 561b65a8, the old code gives 652 mismatching fields
(offsets and totals), all at the two new bases: with only 0 and 1024 it
gives none, which is why this went unnoticed. With the fix there are none
at any base. No caller in the runtime passes an unaligned base (the only
internal caller is GetCopyableFootprints1).
AI-assisted. Tested on AMD Radeon RX 7600, driver 26.11.2 (LLPC),
Windows 10 22H2 (in-box d3d12core 10.0.19041), MSVC 14.44.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With it, d3d12_xs reads list slot 48 as the console's IASetVertexBuffers, so the PC-shaped fixture list's
ClearRenderTargetView never runs and Close fails. The branch also changes runtime/src/pe_loader.cpp and carried
committed conflict markers in docs/fssm_crosscheck.md. Its docs rows go with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows 11 23H2's in-box runtime (D3D12Core 10.0.22621.5415) has
ID3D12Device10 but not ID3D12Device11, and still answers six cases as
Windows 10 does: the HARDWARE_PROTECTED heap (committed and heap), resource
flag 0x400 on a buffer and on a texture, 2049 shader-visible samplers, and a
type -1 command list. The test told Windows 10 apart by a missing
ID3D12Device10, so it failed on 23H2 at argument_mismatches and then at
heap_mismatches.
Those five comparable cases now need ID3D12Device11 on the host, and
windows10_refusal() excuses its one pair on a host without ID3D12Device11.
The other ID3D12Device10 cases agree on 23H2 and are unchanged.
Two leftovers from the console-ABI review round:
- PC GetDesc shares console slot 18 with the newer layout's
GetTimestampFrequency; the proxy deliberately serves the frequency
getter while the layout is undetected, so the GLOBAL_REALTIME
priority check reads the desc on the real queue instead of trusting
an 8-byte frequency written into a desc-shaped out-buffer.
- shaders_into() accepted any two files named vs.spv/ps.spv when
spirv-as was absent; a stray file would reach vk_harness and fail
far from the cause. The prebuilt pair is now checked against the
SPIR-V magic first.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
CreateCommittedResource refused D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS on
every resource. On an RTX 4070 Laptop (621.24) and WARP the host accepts it
on buffers and textures with ALLOW_UNORDERED_ACCESS, refuses it without,
and keeps it in GetHeapProperties. Match that.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review findings from shdann's Windows run of the new console queue/list
work:
- d3d12_debug_markers (and every GPU harness compiled against the PC
headers) drove lists through the console-shaped proxy, so PC slots past
26 — including the PIX markers at 56-58, which have no console
counterpart — reached unrelated console methods or were dropped.
create_device_proxy gains console_lists: false hands the real
(PC-shaped) list back from CreateCommandList. The GPU tests pass false;
the title path keeps the console default.
- queue_proxy asserted E_NOTIMPL for the queue's console tail, but those
slots deliberately answer S_OK now — frame pacing flows through them.
The test's contract is updated; the fence tail stays refused.
- ChildProxy::queue_layout was a plain unsigned char read and written
from many threads; it is atomic like the device-wide detection it
caches.
xs_proxy_mock_test and loader_test pass under Wine; the modified test
objects compile clean under clang-cl. The GPU harnesses need a real
adapter — covered by shdann's Windows run.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
CreateCommittedResource refused every TEXTURE1D with ALLOW_RENDER_TARGET or
ALLOW_DEPTH_STENCIL ("1D texture cannot be an attachment"), although the PC
runtime creates them: on an RX 6750 XT the AMD adapter and WARP both accept
64 color formats as 1D render targets and 20 as 1D depth-stencils. The 1D
RTV/DSV code already on main was unreachable.
Accepting them also needs a valid attachment view: VulkanBackend::view made
every attachment view VK_IMAGE_VIEW_TYPE_2D_ARRAY, which a VK_IMAGE_TYPE_1D
image can't take (VUID-VkImageViewCreateInfo-subResourceRange-01021). That
already hit rectangle clears of 1D UAV textures on main, whose UAV images
get color-attachment usage. ResourceBinding now records a 1D image, and its
attachment views are 1D arrays. A driver without the 1D attachment image
still refuses through check_image_support.
d3d12_texture1d_target_test compares creation with the host adapter and
WARP, and reads back clears through 1D and 1D-array RTVs and DSVs (whole and
rectangles, mips, slice ranges) and a 1D UAV rectangle clear against WARP.
d3d12_typeless_families_test runs its draws on a 1D target too.
d3d12_vulkan_device_test expected the old refusal.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015z45kpgzff6KvVjAnLtc4h
Add a comparison test that runs the same Signal/SetEventOnCompletion/GetCompletedValue sequence on both the shim and the host PC runtime and asserts their completed value and HRESULT agree. A signal of an already-passed (lower) value is a documented deviation (the shim stays monotonic because a Vulkan timeline cannot go back), so it is checked against the documented behaviour rather than the host. No game files; runs on WARP or any D3D12/Vulkan GPU.
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>
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>
Follow-up to #2438 from the review of pwu2775-dev. A failed host FORMAT_SUPPORT query was treated as 'no such texture' without saying so, and the summary printed '(host compared)' even when every comparison was skipped. The query's answer is now printed (E_FAIL on Windows 10 build 19045, E_INVALIDARG seen on another 19041 host, so a single code is not assumed) and the summary says how many formats were compared and how many the host lacks.