Commit Graph

1118 Commits

Author SHA1 Message Date
dd201e794e Runtime: shader-resource views of the stencil plane (D3D-75)
PlaneSlice 1 of a depth-stencil texture, viewed as X24_TYPELESS_G8_UINT
or X32_TYPELESS_G8X24_UINT, now writes an 8_UINT T# (the format of the
console's separate stencil surface) at the texture's address, with the
eight bits in G and R, B, A as 0, 0, 1, as D3D12 returns them. set 0
views it in the image's own format with the stencil aspect.

A plane past 1, plane 1 of a texture without stencil, or another view
format stays a null descriptor with a log. d3d12_descriptor_test decodes
both stencil formats and checks the refusals.
2026-11-22 01:44:24 +00:00
d7bceb8b9c Merge pull request #643 from Vonsek
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 20:39:05 -05:00
13d68c1358 Merge pull request #630 from 73N1X 2026-11-21 20:39:02 -05:00
fa7f38b45f Merge pull request #587 from Vonsek 2026-11-21 20:38:54 -05:00
ef3e7747f4 Merge pull request #562 from Vonsek 2026-11-21 20:38:52 -05:00
a3c633c8b4 Merge origin/main into d3d-46-copy-compare base for D24 work
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:38:22 +01:00
4c5ce1a945 Merge remote-tracking branch 'origin/main' into tiling-host-split
# Conflicts:
#	docs/d3d12_vulkan.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/vulkan_replay.h
2026-11-22 02:35:17 +01:00
2cb28a4239 feat(runtime): clear selected slices of 3D render targets
A volume mip has a single tracked layout, but its color attachment may cover only part of its depth. Use the view to select W slices and keep barriers on the whole mip so clears preserve neighboring slices.
2026-11-22 02:29:34 +01: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
4250c7728f Runtime: support RGBA8 typeless RTV mip and array ranges (D3D-70) 2026-11-21 21:22:33 -04:00
fc7e0a11ec Merge remote-tracking branch 'upstream/main' into codex/bgr565-readback
# Conflicts:
#	runtime/test/d3d12_vulkan_device_test.cpp
2026-11-22 02:20:43 +01:00
f5f4cb03f7 Merge remote-tracking branch 'upstream/main' into codex/rgb9e5-texture
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/vulkan_replay.h
#	runtime/test/d3d12_descriptor_test.cpp
2026-11-22 02:20:43 +01:00
df0cc483c2 Merge remote-tracking branch 'origin/main' into d3d-46-copy-compare
# Conflicts:
#	runtime/test/d3d12_vulkan_device_test.cpp
2026-11-22 02:11:00 +01:00
2f230bec47 Merge pull request #600 from adriaespii 2026-11-21 20:09:30 -05:00
536ba3a2cb Merge pull request #538 from kotorvr 2026-11-21 20:09:18 -05:00
8493b28604 Merge pull request #493 from Andrea 2026-11-21 20:09:14 -05:00
d00864da1e fix(vulkan): enable Synchronization Validation and filter validation-only debug messages 2026-11-21 22:06:53 -03:00
d32e73eea7 Runtime: add missing integer and typeless texture formats (D3D-60)
Add DXGI-to-Vulkan mappings and block sizes for missing integer and typeless formats in the Vulkan D3D12 device (D3D-60):
- R32G32 (_TYPELESS, _UINT, _SINT)
- R16G16B16A16 (_UINT, _SINT)
- R10G10B10A2_UINT
- R16G16 (_TYPELESS, _UINT, _SINT)
- R8G8 (_TYPELESS, _UINT, _SINT)

Exclude these integer formats from color resolve matching in color_resolve_format_matches (integer resolves are disallowed in Vulkan and D3D12).

Add footprint and allocation tests comparing against host D3D12 WARP, as well as CheckFeatureSupport and committed resource creation checks.

Tested on AMD Radeon RX 9070 (driver 26.10.1, Windows 11) and host D3D12 WARP.
AI-assisted.
2026-11-22 02:05:46 +01:00
b3e71d7a4d runtime: UINT border colours use VK_BORDER_COLOR_INT_* (#538 review)
A UINT opaque-white border read back as 0 (Vonsek, on an RTX 5080). The S# has
no integer border types, since the hardware reads them by the image's format.
So bind_sampler gave Vulkan VK_BORDER_COLOR_FLOAT_*, which an integer image
reads as 0. The float and UINT samplers also shared one S# key and so one
VkSampler.

An integer border is now marked in the S#: BORDER_COLOR_PTR = 0x800
(gfx10::kIntegerBorderPtr), a field the hardware reads only for table colours.
That gives it its own key, and vulkan_sampler picks VK_BORDER_COLOR_INT_*.

d3d12_descriptor_test runs Vonsek's case: an R8G8B8A8_UINT texture sampled past
its edge through UINT black and white border samplers reads 0 and 1, and a
float white border reads 255. The case fails with the float enums on an RTX
4090. gfx10_descriptors_test and d3d12_sampler2_test check the mark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:03:36 +00:00
ffb5e34b9c runtime: CreateSampler2 on the Vulkan device (D3D-28, part 2)
CreateSampler2 wraps CreateSampler. The UINT border colour maps (0,0,0,0),
(0,0,0,1) and (1,1,1,1) to the S#'s border types, and anything else to the
table. Non-normalized coordinates set FORCE_UNNORMALIZED. A description the PC
runtime refuses (unknown flags; a non-normalized sampler with an unequal
min/mag filter, a linear mip filter, anisotropy, comparison, a U/V address mode
other than clamp/border, or a non-zero LOD or bias) leaves the slot as it was,
as the runtime does on an RTX 4090 and on WARP. The layer now answers
D3D12_OPTIONS17 with NonNormalizedCoordinateSamplersSupported, as both report.

d3d12_sampler2_test compares the S# bytes with CreateSampler's and the 22
edge cases with the host's PC runtime live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:03:36 +00:00
382daba42f runtime: the 1/2/3 method variants on the Vulkan device (D3D-28, part 1)
CreateCommittedResource1/2/3, CreateCommandQueue1 and GetCopyableFootprints1
as thin wrappers over the existing methods. D3D12_RESOURCE_DESC1 drops to
D3D12_RESOURCE_DESC; the initial state or barrier layout is unused, because new
textures start UNDEFINED and move on first use. The newer arguments are answered
as the PC runtime answers them (measured on an RTX 4090, driver 621.14):

- a protected resource session: E_INVALIDARG (no session support reported);
- a sampler-feedback mip region: E_INVALIDARG on textures, ignored on buffers;
  GetCopyableFootprints1 returns its failure answer for such a texture;
- a buffer's initial layout other than UNDEFINED: E_INVALIDARG;
- a castable count with a null list: no list;
- a castable list: E_INVALIDARG, since it needs RelaxedFormatCastingSupported,
  which the layer does not report (D3D12_OPTIONS12 is unanswered);
- CreateCommandQueue1's creator ID: ignored.

d3d12_method_variants_test compares each variant with its base method, runs the
edge cases and, when the host has a D3D12 device, compares each answer with the
PC runtime live. Thanks to ezwinxdlmao for the probe notes in #156.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:03:35 +00:00
6e0d2066ee Merge remote-tracking branch 'upstream/main' into codex/bgr565-readback
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-22 02:02:13 +01:00
b3edaf3ed4 Merge remote-tracking branch 'upstream/main' into codex/rgb9e5-texture
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 02:02:12 +01:00
037c373a24 feat(runtime): support B5G6R5 render targets and copies
D3D12 stores blue in the low five bits of B5G6R5. Use the Vulkan packed format with the same ordering and check the two-byte words returned by full-image and rectangular clears.
2026-11-22 01:56:04 +01:00
2c01fc8091 Validate sample descriptions on buffers and allocation queries 2026-11-22 01:55:55 +01:00
0cdf534413 Use the resource depth-format fallback for MSAA quality queries 2026-11-22 01:54:23 +01:00
66a5fc90f8 Query multisample quality for depth-stencil formats 2026-11-22 01:53:53 +01:00
1ce79642f6 Merge pull request #525 from Luis Baker
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 19:53:08 -05:00
824f07e9af Merge latest main and align Vulkan MSAA with D3D12 sample limits
Expose only D3D12-valid Vulkan sample counts (2..32), allow 32x allocations, and reject zero, oversized, and unsupported-quality resource descriptions. Extend resolve/allocation coverage to 32x MSAA and add boundary tests.
2026-11-22 01:51:30 +01:00
3973ce8c20 feat(runtime): support sampled RGB9E5 textures
Map the shared-exponent format through resource creation and buffer-image copies so shaders can resolve its existing GFX10 view. Check the sampled channels and compare the mip-array footprints with the host runtime.
2026-11-22 01:47:40 +01:00
c0dbd14b96 Runtime: compare copies with the host runtime (D3D-46)
CopyResource, CopyTextureRegion (texture to texture, footprint to texture and back, boxes, offsets, array slices,
mips, 3D) and CopyBufferRegion run on the layer and on a host D3D12 device (LEONIDA_HOST_ADAPTER picks it) and the
bytes read back are compared, for 39 format/shape cases including BC1-7 and depth-stencil.

Layer fixes it found: texture formats R8G8_SNORM, R16_UNORM, R32G32_UINT, R9G9B9E5, B5G6R5 and B5G5R5A1 were
refused; a block-compressed texture-to-texture box reaching the padded mip edge was refused as invalid_copy.
Known differences (TEXTURE1D, D24 on GPUs without it, D24 X8 byte) are documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:47:27 +01:00
bfc6b6ed22 Merge pull request #493 from Andrea 2026-11-21 19:43:43 -05:00
45cf469013 Merge pull request #388 from 73N1X 2026-11-21 19:43:25 -05:00
8b5d88dec9 Merge upstream main into D3D-47 resolve comparison
Preserve reserved-resource coverage alongside multisample resolve support and comparison tests. Fix the Windows SDK ResolveSubresourceRegion rectangle mutability.
2026-11-22 01:42:26 +01:00
58019e85ec Merge main and preserve predicated typeless clear handling 2026-11-21 20:26:41 -04:00
adc1549376 Runtime: WriteToSubresource and ReadFromSubresource on the Vulkan device
Both were generated stubs; WriteToSubresource is in the first-frame API set
(docs/d3d12_vulkan.md section 6.1). Textures in CPU-visible custom heaps map with a
null pointer, as on D3D12, and copy on the host with VK_EXT_host_image_copy while
they are in GENERAL (D3D12's COMMON). Every other case is a CopyTextureRegion
from or to a staging buffer, replayed on the device's queue and waited for, so the
layout tracker and first-use zero fill behave as for the application's copies.
The standalone and test devices enable the extension where the GPU has it.

d3d12_vulkan_device_test checks both paths: boxes and pitches, a mip, a volume,
BC1, rejected calls, a default-heap texture, and GPU copies in both directions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:24:38 +11:00
e816f20b29 Runtime: SNORM/SINT render targets and clear conversion (D3D-45)
Add DXGI->Vulkan mappings and footprint sizes for SNORM and SINT render-target formats, and extend render_target_clear_color to convert SINT clears numerically (NaN to zero, clamp to the signed range, truncate toward zero) instead of copying float bits. Rename d3d12_uint_clear_test to d3d12_clear_test and widen it to compare UNORM/SNORM/FLOAT/UINT/SINT render-target and depth/stencil clears against Windows WARP, full and rectangle. SRGB clears are left out of the byte-exact comparison: the linear->sRGB encoding rounds differently at the .5 boundary on WARP vs Vulkan (a 1-ulp driver difference).
2026-11-22 01:21:20 +01:00
a3e8a7f9e0 Merge pull request #420 from kotorvr 2026-11-21 19:14:02 -05: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
58c176d48f runtime: match multisample quality query structure fields 2026-11-22 01:04:54 +01:00
fc7a4394f2 runtime: report multisample resolve format support and quality levels 2026-11-22 01:01:43 +01: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
500255da2a Merge main and retain typed view cache with bindless preparation 2026-11-21 19:55:10 -04:00
43ed7531b6 runtime: residency and power methods on the Vulkan device as documented no-ops (D3D-33)
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>
2026-11-21 23:47:00 +00:00