The resolve-region test on main now signals 5 and 6, so a wait on 5 returned
before the copies ran.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CharlyRien found in #295 that an RTX 3090 on driver 616.56 (tiled tier 3)
refuses reserved texture arrays whose mips reach the packed tail (cases 2, 6
and 8), which an RTX 5070 on 621.01 accepts; the comparison counted that as a
mismatch. A layout the host refuses is now logged and skipped; one the host
accepts and the layer refuses is still a mismatch; with every layout skipped
the comparison reports itself skipped. The skip path was checked by making
the host refuse one case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateReservedResource (and 1 and 2) reserve the whole resource linearly, as
docs/d3d12_vulkan.md section 4.2 plans for the first boot: a committed
resource on a default heap underneath, so every tile is backed and starts
zeroed. D3D12's description rules are kept as measured on the PC runtime
(ROW_MAJOR buffers, 64KB swizzle layouts for textures, a format with a tile
shape; GetHeapProperties is E_INVALIDARG on a reserved resource). The Xbox
tiled layout word 0x101 is accepted as 64KB_UNDEFINED_SWIZZLE.
GetResourceTiling comes from src/resource_tiling.h: the standard 64 KiB tile
shapes, standard and packed mips, per-mip tile counts and the tile order. The
device test compares it with the host PC runtime for 18 buffer, 2D, array,
block-compressed and volume layouts; resource_tiling_test checks the same
arithmetic without a GPU. Packed-mip tile counts are the driver's choice and
are this layer's own rule (tight linear size in whole tiles).
UpdateTileMappings and CopyTileMappings log once and do nothing; what that
loses (aliasing, unmapped tiles keeping data) is written down in section 4.2.
Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MakeResident, Evict, SetResidencyPriority, EnqueueMakeResident, SetStablePowerState and
SetBackgroundProcessingMode. Vulkan memory stays resident until it is freed and paging is the
kernel driver's job, so there is nothing to do; each method still checks its arguments
(E_INVALIDARG) and EnqueueMakeResident signals its fence so a queue waiting on it does not hang.
SetBackgroundProcessingMode sets its completion event at once. d3d12_vulkan_device_test covers the
success paths, bad arguments, and the fence signal seen by a queue Wait.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GetResourceAllocationInfo, GetResourceAllocationInfo1 and
GetResourceAllocationInfo2 were generated stubs. Buffers take their width
rounded up to 64 KiB. A texture's size is what its VkImage needs
(vkGetDeviceImageMemoryRequirements, or a throwaway image without it),
rounded up to its D3D12 alignment: 64 KiB, 4 MiB with MSAA, or the small
alignment the description asks for. A 4 KiB request that doesn't qualify
is invalid, as on the PC runtime; the MSAA 64 KiB one has no size limit
there. Texture creation and these queries share one VkImageCreateInfo.
d3d12_vulkan_device_test compares buffer sizes, alignments and invalid
descriptions with the host PC runtime, and checks the per-resource layout
of the Device4/Device8 variants.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was no resolve, and a multisampled committed texture was refused.
- IR: ResolveSubresource (two different resources).
- Replay: ResolveSubresource is vkCmdResolveImage in the layouts copies
use: a multisampled colour subresource into a single-sampled 2D one of
the same size and format. Depth-stencil resolves and resolves between
two formats of a typeless family stay unsupported. ResourceBinding gains
samples: a multisampled texture copies only to its own sample count and
has no footprint.
- Device: committed multisampled 2D textures (single-mip render targets or
depth-stencils, when the GPU has the sample count for the format; the
other shapes are E_INVALIDARG as in D3D12), and TEXTURE2DMS
render-target and depth-stencil views.
- COM: ID3D12GraphicsCommandList::ResolveSubresource.
Tests: command_list_test (recording rules, and a copy with a z range);
vk_command_replay_test part C (a 4x resolve and the refused resolves and
multisampled copies; it also runs the volume copies that are already on
main at the Vulkan level, on Linux too: a 4x4x4 volume uploaded, copied as
a block and whole, read back, and the z ranges that must be refused);
d3d12_vulkan_device_test (a resolve through the Xbox-ABI proxy and the
refused shapes).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- IR: CopyBufferRegion, CopyTextureRegion (subresource or placed footprint,
optional box) and CopyResource, with D3D12's call rules (512-byte footprint
offsets, 256-byte pitches, non-empty boxes).
- Replay: vkCmdCopyBuffer / CopyBufferToImage / CopyImageToBuffer / CopyImage.
Footprint pitch becomes bufferRowLength; BC extents stop at the mip edge;
every range and buffer bound is checked before anything is written. Copies
run in TRANSFER_SRC/DST, or in place in GENERAL for a COMMON texture
(implicit promotion). 2D only.
- Device: buffers expose their VkBuffer; BC1-7 formats; textureCompressionBC
enabled when present; GetCopyableFootprints for buffers and 2D textures.
Compared with the PC runtime over 13 descriptions, which showed planar
depth-stencil rows are padded to 512 bytes.
- Each submission ends with a barrier to the host so readback buffers hold the
GPU's writes after the fence wait. BC textures are not zero-filled on first
use (Vulkan cannot clear them; the validation layer caught the first try).
Tests: d3d12_vulkan_device_test now reads results back through D3D12
(CopyTextureRegion into a readback heap, Map) and adds an upload list: a
pattern into a texture, CopyResource into a COMMON texture, a boxed copy, a BC1
round trip and CopyBufferRegion. command_list_test covers the copy rules. All
GPU tests are clean under the Khronos validation layer; 6/6 ctest.
- d3d12_vulkan_device.cpp: an ID3D12Device11 (PC ABI) the device proxy
forwards to. Creates queues, allocators, command lists (incl.
CreateCommandList1), fences, descriptor heaps (32-byte slots; RTV/DSV hold
TargetViews), render-target and depth-stencil views, committed buffers
(upload/readback mapped and zeroed) and 2D textures in the common formats,
and answers feature-level and architecture queries. Everything else is a
generated stub that logs once.
- First use of a new texture zero-fills it and moves it to the layout the
command expects (vulkan_replay.h initialize), as D3D12 committed resources
start zeroed; no submission at creation. CREATE_NOT_ZEROED skips the fill.
- Children hold the proxy, so GetDevice returns the Xbox-ABI object; COM base
classes moved to d3d12_com_object.h. D3D12 queues share one VkQueue behind a
submit lock.
- D3D12XboxCreateDevice: LEONIDA_D3D12=vulkan creates the Vulkan device on its
own instance and wraps it in the same proxy (gta6rt built with the Vulkan
SDK and Python 3); the host PC device stays the default.
Tests: d3d12_vulkan_device_test calls everything through the proxy (heaps via
slot 14 with RAX start handles, a render target via slot 76 with the Xbox
layout word) and reads colour, depth, stencil and a never-written texture
back; it also runs the standalone device. Clean under the Khronos validation
layer with the other GPU tests; all 6 ctest tests pass.