Commit Graph

48 Commits

Author SHA1 Message Date
62593f47ca Runtime: Xbox-ABI proxies for the command queue and the fence (BUILD-231)
Device slots 8 (CreateCommandQueue), 75 (CreateCommandQueue1), 36
(CreateFence) and 32 (OpenSharedHandle of a fence) now return queue and
fence proxies. They forward the public chain in PC order (19 queue slots,
11 or 12 fence slots), refuse and log a slot past it up to the end of the
proxy's table, and name a read past the table through a guard region and
a vectored handler.

Heap, queue and fence proxies are unwrapped wherever a device or queue
method hands them to the real runtime: queue Signal/Wait, device slots
31/34/35/45/46/50. Arrays are copied without exceptions. QueryInterface
answers only the modelled interfaces, and logs one the real object has
but the proxy does not model. Outputs are cleared on failure as for
slots 14/62/76. --trace-d3d12 records proxy calls in the README grammar.
Every function a thunk hands its words to keeps them in the same
positions, because a title passes only as many as the method takes.

Tests: queue_proxy_test (host WARP, host hardware, Vulkan device;
differential per-process error cases, guard faults, identity, threads,
raw-slot client, child-runner self-test), xs_proxy_mock_test (older
devices, fences without Fence1, OpenSharedHandle branches, allocation
failures; three guard-setup fault modes), and device_proxy_test through
the D3D12XboxCreateDevice shim. No game files.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:08:53 +01:00
158e3e9455 Validate Vulkan clock calibration against Win32 QPC 2026-11-22 17:30:42 +08:00
432520f71c Merge pull request #1225 from quackottu 2026-11-22 03:37:56 -05:00
a3ac0c8ea8 Merge pull request #1212 from quackottu 2026-11-22 03:37:51 -05:00
eb21bee162 Runtime: a released fence sets the events still waiting on it, and SetEventOnMultipleFenceCompletion with no fences is E_INVALIDARG 2026-11-22 14:06:06 +05:30
be0e227dbd D3D12: refuse query calls the list type can't hold, and CreateQueryHeap node masks above 1 2026-11-22 13:54:34 +05:30
2a333b5c69 Merge pull request #1155 from quackottu 2026-11-22 03:14:16 -05:00
bb36812235 perf(vulkan): conditional Sync2 readback flush, O(1) deferred deletion, lock split, TDR safety, and centralized FenceWaitDispatcher 2026-11-22 05:05:36 -03:00
73dd6d7dce Runtime: depth and stencil resolves in ResolveSubresourceRegion
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.
2026-11-22 13:14:43 +05:30
e857798e4c Merge pull request #992 from sanuk369 2026-11-22 01:08:13 -05:00
998924fea8 feat(d3d12): add ExecuteIndirect CountBuffer and optional BLAS/TLAS/RayQueryKHR support 2026-11-22 03:04:35 -03:00
4f9e5a605a ID3D12CommandQueue::GetDesc: node mask 0 reads back as 1
The host D3D12 runtime reports NodeMask 1 for a direct, compute or copy
queue created with 0 on a single adapter, as #838 made descriptor heaps and
resources do. d3d12_node_mask_test now compares the six queue cases with
the default adapter and WARP.
2026-11-22 11:02:21 +05:30
69fe9d3752 Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_com.h
2026-11-22 05:01:46 +00:00
16e6c330cd Runtime: trace debug markers by name; trace test uses a method still unsupported
SetMarker/BeginEvent/EndEvent on lists and queues are implemented now, so
they record a 'called' trace entry (the name only, never the label), and
the d3d12_trace check takes SetProtectedResourceSession as its example of
an unsupported call. The synthetic label still must not reach the trace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:05:36 +00:00
4fc1301a11 Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/shims/d3d12_com.h
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/command_list.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_test_device.h
2026-11-22 04:05:35 +00:00
eb2928a8b4 Merge remote-tracking branch 'origin/main' into claude/d3d-30-fences-timing-7ce86f
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-22 04:03:01 +00:00
7079108182 Runtime: query heaps on Vulkan (D3D-15)
CreateQueryHeap makes one VkQueryPool per heap: occlusion (OCCLUSION and
BINARY_OCCLUSION queries), timestamp and copy-queue timestamp, and pipeline
statistics (all eleven Vulkan counters, whose order is the field order of
D3D12_QUERY_DATA_PIPELINE_STATISTICS). Other heap types are logged and
refused with E_NOTIMPL.

BeginQuery, EndQuery and ResolveQueryData are recorded in the command-list
IR with D3D12's rules for the calls, and replayed as vkCmdResetQueryPool +
vkCmdBeginQuery/vkCmdEndQuery, vkCmdWriteTimestamp at BOTTOM_OF_PIPE and
vkCmdCopyQueryPoolResults (64-bit, WAIT). Heap types, index ranges and the
destination buffer are checked before anything is written. A query that was
never ended resolves to zeros instead of stalling the GPU on WAIT_BIT.
GetTimestampFrequency is 1e9 / timestampPeriod. The devices enable
occlusionQueryPrecise and pipelineStatisticsQuery where the GPU has them.

Overlapping queries of one kind (valid D3D12, one active query per type in
Vulkan) are refused as unsupported, and binary occlusion is not clamped to
0/1 yet; both are written down in docs/d3d12_vulkan.md section 4.6.

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>
2026-11-21 21:30:47 -06:00
b74c7f2946 Merge remote-tracking branch 'origin/main' into claude/d3d-30-fences-timing-7ce86f
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-22 03:24:05 +00:00
d549d2d117 Merge pull request #417 from kotorvr 2026-11-21 22:07:52 -05:00
96404ac97a Merge main into D3D-26: unordered-access clears on main
Keeps both sides; the discard emit now passes the binding to image_barrier
as main's version takes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:58:23 +00:00
deae7cc736 Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/src/command_list.h
2026-11-22 02:56:52 +00:00
0c46a83525 Merge remote-tracking branch 'origin/main' into claude/d3d-30-fences-timing-7ce86f
# Conflicts:
#	runtime/shims/d3d12_com.cpp
2026-11-22 02:55:57 +00:00
c7e450fc69 D3D-26: keep a null discard region apart from an explicit UINT_MAX count
A region with NumSubresources = UINT_MAX was recorded like a null region and
skipped the FirstSubresource check. DiscardResource now has a whole flag;
explicit ranges are checked in 64-bit at recording and replay. Tests at the
UINT_MAX boundary in command_list_test, part F and the COM device test.
Found by matheuskshn in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:44 +00:00
d8397aa3ee Runtime: keep the multiple-fence countdown unsigned (D3D-30 review)
SetEventOnMultipleFenceCompletion narrowed its UINT count to int for the
ALL countdown, so a count past INT_MAX started negative, looked done and
never set the event. The waiter now counts down a std::atomic<UINT> that
stops at zero, so later ANY hits do not wrap. It moves to
shims/d3d12_fence_waiter.h, and the new ctest d3d12_fence_waiter checks
counts past INT_MAX, ALL, and hits past zero without a GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:30 +00:00
398f5b06bd Merge current main into the D3D12 trace branch 2026-11-22 03:22:44 +01:00
4e1de429fd Runtime: add opt-in D3D12 call tracing 2026-11-22 03:07:36 +01:00
e40bd6563e Merge main into D3D-26: predication and reserved resources on main
main added SetPredication (D3D-18) and reserved resources; both sides are
kept. The predication replay test took part E, so the D3D-26 test is now
part F. An atomic copy recorded under a predicate is counted with the
other copies that Vulkan's conditional rendering cannot skip, and
SetPredication, DiscardResource and the atomic copies are all refused in
a bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:29:19 +00:00
49408da618 Merge remote-tracking branch 'origin/main' into claude/d3d-30-fences-timing-7ce86f
# Conflicts:
#	docs/d3d12_vulkan.md
#	runtime/CMakeLists.txt
#	runtime/shims/d3d12_com.h
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-22 01:28:39 +00:00
f230b0dac2 Merge main (c432cdc) into d3d-25-uav-clears
Conflicts, both sides kept: predication (D3D-18) next to the UAV clear in
command_list.h, vulkan_backend.h and vulkan_replay.h; the D3D-28 tests next to
the UAV clear test; texture_create_info's attachment argument with main's
mutable host-transfer usage.

UAV clears under a predicate: a whole-view texture clear takes the attachment
path, as render-target clears do, so conditional rendering applies; buffer
clears and non-attachment texture clears are transfers and are counted in
unpredicated_copies with the copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:28:38 +00:00
6d40ad39cc Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/shims/d3d12_com.h
#	runtime/src/command_list.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_test_device.h
2026-11-22 01:26:57 +00:00
1eaca53672 Merge main into D3D-26: bundles and samplers on main; D3D-26 calls follow the bundle rules
main added ExecuteBundle (command_list.h, d3d12_com.cpp) and samplers
(vulkan_backend.h); both sides are kept. DiscardResource and the atomic
copies are now refused in a bundle, as D3D12 documents, and
WriteBufferImmediate is allowed there (d3d12_com_test covers all four).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:13:23 +00:00
707b194707 Merge main (4abd545) into d3d-25-uav-clears
Conflicts, both sides kept: command_list.h (clear_unordered_access next to
ExecuteBundle's execute_bundle), vulkan_backend.h (fill/update buffer next to
the sampler functions), CMakeLists.txt (the UAV clear test next to the new
descriptor test) and the known-gaps paragraph in docs/d3d12_vulkan.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:11:50 +00:00
25b8b0f3d6 runtime: fences and timing on the Vulkan device (D3D-30)
- SetEventOnMultipleFenceCompletion, ALL and ANY: a null event is one
  vkWaitSemaphores (WAIT_ANY_BIT for ANY); with an event, each fence's
  existing wait thread counts down one shared waiter, so no new threads.
- Queue GetClockCalibration: vkGetCalibratedTimestampsKHR (or the EXT
  alias) over the DEVICE and QueryPerformanceCounter domains when the
  device has the extension (the standalone device now enables it);
  otherwise a submitted vkCmdWriteTimestamp bracketed by QPC reads.
- GetAdapterLuid from VkPhysicalDeviceIDProperties::deviceLUID.
- GetCustomHeapProperties per the D3D12 docs' NUMA table, matching the
  UMA = FALSE the device reports.

d3d12_fence_timing_test covers both calibration paths, the LUID against
DXGI's adapter list and the heap answers against the host runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:10:33 +00:00
d7a08ad45c Runtime: debug markers on VK_EXT_debug_utils and private data on every object (D3D-24)
SetMarker/BeginEvent/EndEvent on command lists are recorded in the IR
(DebugMarker) and replayed as vkCmd*DebugUtilsLabelEXT; on queues they
call vkQueue*DebugUtilsLabelEXT under the submit lock. Labels are used
only when the instance enabled VK_EXT_debug_utils
(VulkanDeviceInfo::debug_utils; the standalone device enables it when
the loader lists it); otherwise the calls are no-ops. Events may span
the lists of one ExecuteCommandLists; an unmatched end is dropped and
labels left open are ended before the command buffer ends, so Vulkan's
begin/end rule always holds. Metadata 0/1 strings become UTF-8 labels;
a PIX3 blob (2) gets a fixed label (open question 21).

SetPrivateDataInterface holds a reference until replaced, removed or
the object dies, and GetPrivateData hands it back AddRef'd. SetName
stores WKPDID_D3DDebugObjectNameW. Both live in the shared Object base,
so every object of the Vulkan device has them.

d3d12_debug_markers_test checks the exact label calls through a
recording vkGetInstanceProcAddr, the no-extension path, and private
data on the device, queue, allocator, list, heap, resource and fence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:10:17 +00:00
3a928c5151 Merge pull request #295 from traeb0n 2026-11-21 19:08:30 -05:00
be91840c07 Runtime: SetPredication on VK_EXT_conditional_rendering (D3D-18)
- command_list.h: a Predication command (offset 8-byte aligned, EQUAL_ZERO or
  NOT_EQUAL_ZERO; a null buffer turns it off), recorded by
  GraphicsCommandList::SetPredication.
- vulkan_replay.h: begin/end conditional rendering (INVERTED for NOT_EQUAL_ZERO),
  ended before a new predicate and at the end of the list. While predicated,
  whole-view clears go through vkCmdClearAttachments, which conditional rendering
  covers. New ReplayResult::invalid_predication; PreparedList::unpredicated_copies
  counts copies Vulkan cannot predicate.
- Device: VK_EXT_conditional_rendering and its feature enabled when present, and
  buffers created with VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT; without it a
  predicated list is unsupported.
- Tests: command_list_test (recording rules), vk_command_replay_test part C (GPU).
- docs/d3d12_vulkan.md 4.7: what is done; copies and the 64-bit value are open.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:59:11 +11:00
8c8388f599 Runtime: reserved resources and GetResourceTiling on Vulkan (D3D-20)
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>
2026-11-21 17:57:06 -06:00
399b8ff839 Merge main into D3D-26: the replay test's new part D, the resolve-region section
main's vk_command_replay_test now has a part D (sync/access pairs), so the
D3D-26 test becomes part E. The device test's D3D-26 section signals fence
value 7, after main's resolve-region section took 5 and 6. The docs keep
both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:49:29 +00:00
6ae02af006 Merge main into d3d-25-uav-clears
Conflicts: main moved texture create info into texture_create_info (the UAV
attachment usage now goes there, so placed-resource sizing agrees) and edited
the same docs paragraphs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:33:19 +00:00
fe12da7edd D3D-35: implement ExecuteBundle IR inlining and validation 2026-11-22 00:32:28 +01:00
467b1d1ff9 runtime: ClearUnorderedAccessViewUint/Float on the Vulkan device (D3D-25)
The CPU handle's slot is read while recording as the GFX10 T#/V# a shader
would load (docs section 3.4), so the clear works with whichever view
creation lands (#157, #328, #334) and with game-built descriptors.

- Buffers: vkCmdFillBuffer for elements up to 4 bytes, with the unaligned
  ends copied from the filled middle; 8/16-byte elements are written with
  vkCmdUpdateBuffer and doubled with copies. Rects are element ranges.
- Textures: vkCmdClearColorImage for whole views, vkCmdClearAttachments
  for rects (UAV textures also get COLOR_ATTACHMENT usage when the format
  supports it), in place in GENERAL; mip and layer range from the T#.
- Values follow D3D's Uint (raw low bits) and Float (converting) rules,
  encoded in the view's format and cleared into the image as the value
  that decodes those bytes in the image's own format (typeless resources).
- d3d12_uav_clear_test: hand-computed conversion checks, then raw,
  structured and typed buffers and 2D, array and volume textures cleared
  and read back through D3D12; refusals at record and replay.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:29:32 +00:00
19742b531a Runtime: DiscardResource, WriteBufferImmediate and atomic copies on Vulkan (D3D-26)
Three command-list IR commands, recorded through COM and replayed by
vulkan_replay.h:

- DiscardResource: an oldLayout = UNDEFINED barrier to the layout the
  tracker already has for each subresource. Buffers, rectangle discards,
  parts never used yet, untracked replays and one plane of a combined
  depth-stencil without separate layouts are no-ops.
- WriteBufferImmediate: a 4-byte vkCmdUpdateBuffer at the address,
  resolved at execution through ResourceBinding::va / buffer_offset and
  ReplayFunctions::buffer_at (the same fields and lookup as #291).
  MARKER_OUT waits for and sees every earlier write; MARKER_IN gets an
  execution-only ALL_COMMANDS dependency (Vulkan cannot say "started");
  DEFAULT is ordered by the application's barriers.
- AtomicCopyBufferUINT/UINT64: one vkCmdCopyBuffer region after a
  barrier that covers every earlier write, the dependent resources'
  included. Recording follows the debug layer's ATOMICCOPYBUFFER_* and
  WRITEBUFFERIMMEDIATE_* rules.

Tests: command_list_test (recording rules), vk_command_replay_test part D
(GPU readback of writes in all three modes, ordered atomic copies,
discards, and the lists that must be refused), and the COM path in
d3d12_vulkan_device_test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:16:54 +00:00
489258fda5 Resolve colour MSAA regions into destination offsets 2026-11-22 00:05:17 +01:00
d27e4c5765 Runtime: ResolveSubresource and multisampled textures on Vulkan
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>
2026-11-21 16:34:22 -05:00
55af930bcc runtime: add public ID3D12GraphicsCommandList8 to the D3D12 proxy
The command list implements the SDK's GCL8 chain (IID ee936ef9-599d-4d28-938e-23c4ad05ce51), so a GCL8 QueryInterface succeeds and slot 81 (byte offset 0x288) is OMSetFrontAndBackStencilRef(UINT, UINT). The method records both values on the list and Reset clears them. Nothing applies them yet: Vulkan's dynamic stencil reference is per face, but only a pipeline that consumes it can, and the layer has no pipeline or draw path. The call is reported once rather than silently dropped.

d3d12_gcl8_test creates only an allocator and a list (no Vulkan device), checks the interface pointer, the raw slot 81 call, both recorded values and the QueryInterface reference count. It runs under CTest.
2026-11-21 20:30:33 +00:00
Ryx
99336386d1 Runtime: D3D12 copies on Vulkan (buffers, textures, uploads, BC) and GetCopyableFootprints
- 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.
2026-11-21 20:33:34 +01:00
Ryx
40f6399088 Runtime: Vulkan-backed ID3D12Device behind the Xbox-ABI proxy
- 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.
2026-11-21 20:22:20 +01:00
Ryx
6052bf0bd5 Runtime: rectangle clears, layout tracking, enhanced barriers, COM list/queue/fence
Closes the gaps left by the barrier/clear slice:

- Rectangle clears: ClearRenderTargetView/ClearDepthStencilView rects are
  recorded and replayed with vkCmdClearAttachments in a dynamic-rendering
  scope, clipped to the mip.
- LayoutTracker: the current Vulkan layout per image subresource, so barriers
  start from the real layout. This honours implicit promotion and decay
  (COMMON is GENERAL; simultaneous-access textures stay GENERAL) and, with
  separateDepthStencilLayouts, lets one depth/stencil plane be cleared or
  transitioned while the other stays in another state.
- Enhanced barriers (global, buffer, texture, split, discard) mapped to
  vkCmdPipelineBarrier2.
- vulkan_backend.h: VulkanContext, VulkanQueue (ExecuteCommandLists checks
  every list before writing any; Wait is attached to the next submission),
  VulkanFence on timeline semaphores.
- d3d12_com.cpp: ID3D12GraphicsCommandList7, ID3D12CommandQueue,
  ID3D12CommandAllocator and ID3D12Fence1. Unimplemented methods are stubs
  generated at build time from the SDK's d3d12.h (tools/gen_d3d12_stubs.py),
  so vtables follow the SDK order and nothing SDK-derived is checked in.

Tests: command_list_test and d3d12_state_map_test (every copied D3D12
constant checked against d3d12.h) in ctest; vk_command_replay_test and the new
d3d12_com_test on the GPU, clean under the Khronos validation layer.
2026-11-21 19:19:31 +01:00