Commit Graph

311 Commits

Author SHA1 Message Date
69cb90ca32 Merge pull request #683 from Rafael 2026-11-21 21:08:40 -05:00
d8b3fd73ec Merge pull request #657 from dcastell1 2026-11-21 21:08:35 -05:00
460d23c335 Merge pull request #654 from AlxcBTW 2026-11-21 21:08:34 -05:00
36da56b1d9 Merge pull request #610 from AlxcBTW 2026-11-21 21:08:32 -05:00
6e1e5c5ce0 Refresh B5G5R5A1 sampling coverage after RGB9E5 support merged 2026-11-21 23:07:59 -03:00
527e41c2d3 Runtime: report DXGI format plane counts through CheckFeatureSupport 2026-11-22 02:06:26 +00:00
33059d6b63 D24_UNORM_S8_UINT byte-exact on GPUs without D24
The layer stores D24 as D32_SFLOAT_S8_UINT where the GPU has no D24 (the
Radeon 880M, AMD generally). Footprint copies of the depth plane now convert
through a compute pass: an upload turns the 24-bit words into the nearest
floats of d / 16777215, a readback quantises floats back (float multiply by
16777215, round to nearest even, as WARP and AMD's D3D12 driver do) and writes
0 in the unspecified top byte. Clears store the float of the quantised value,
so a texture reads back as D3D's quantisation of the clear value.

- src/depth24.h, vulkan_depth24.h, depth24_convert.comp (+ compiled SPIR-V):
  reference conversion, the converter (pipeline, scratch, descriptors freed
  once the submission completes) and the shader.
- vulkan_replay.h: depth24_as_float binding flag, convert jobs prepared with the
  list and run around the copy, depth clear value.
- depth24_convert_test: all 16777216 words to float and back, 16777216 float
  patterns against the reference, a pitched copy; d3d12_depth24_compare.h:
  5215 clear values (whole-view and rectangle) against the host.
- d3d12_copy_compare.h: the D24 case now compares upload and readback with the
  host instead of only the bit-preserving copies.

Depends on #610.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:53:51 +01:00
12f1dc5a48 runtime: depth-stencil views of a multisample texture array's slice range (D3D-79 part 1)
CreateDepthStencilView refused D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY, so the descriptor held an
empty TargetView and any clear through it failed when the list was recorded. Multisample textures
have one mip, so the view is {resource, mip 0, FirstArraySlice, ArraySize}; the replay already
checks the range against the image and clears through a view of those layers.

d3d12_vulkan_device_test: a 4-layer 4x multisampled D32 texture, a view of slices 1-2 captures
that range and its clear replays; a view of slices 3-4 is refused at execute
(invalid_subresource). D3D12 can't copy a multisampled texture to a buffer, so the cleared
values are not read back. Without the change the test fails at the captured-range check.

docs/d3d12_vulkan.md: drop the duplicated RTV/DSV bullet and list the new dimension. The 1D and
1D-array DSVs need 1D textures first (D3D-63, #561).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:51:42 -03:00
ed7e1ead05 D3D-61: keep alpha-only texture sampling distinct from R8 2026-11-21 22:44:35 -03:00
99f6f0b40a test(runtime): register d3d12_vulkan_device_test with CTest
The test was built but only run by hand, so GPU-specific failures (for
example the AMD GetResourceTiling one) never showed up in ctest. Return
77 when no Vulkan device can be created and register the test with
SKIP_RETURN_CODE 77 so CI reports it as skipped rather than failed.
2026-11-22 02:38:54 +01:00
fa7f38b45f Merge pull request #587 from Vonsek 2026-11-21 20:38:54 -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
ad1150a4be Test: d3d12_vulkan_device_test compares only what D3D12 fixes about GetResourceTiling, sample counts and null-rect resolves
The tiling comparison required the same standard/packed mip split as the host. D3D11.3 functional spec 5.9.2.8.5
(D3D12_PACKED_MIP_INFO) only requires that a mip filling a tile in every dimension stays standard; a smaller mip
"may or may not be packed, depending on the IHV". Measured on one laptop: an RTX 5070 packs from the first mip
below the tile (as the layer does), a Radeon 880M keeps one or two more standard, WARP packs nothing. The test
failed with 24 mismatches on an AMD or WARP host. It now checks the tile shape, that no mip filling a tile is
packed (layer and host), and the tile counts of the mips both sides keep standard; the split itself is printed.

With that fixed, the same test failed further down on those hosts for host-specific answers:
- depth/colour sample counts a software host (WARP, 16x) offers but the Vulkan GPU's limits lack are skipped;
- a null source rectangle in ResolveSubresourceRegion is the whole source; the Radeon 880M and WARP do not resolve
  it that way, so where a host disagrees with its own whole-source rectangle the layer is held to that result.

The host is picked with LEONIDA_HOST_ADAPTER through d3d12_copy_compare.h (D3D-46).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:37:32 +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
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
0175e92e61 Merge the rebased RGB9E5 dependency and preserve border sampler checks 2026-11-21 22:23:59 -03: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
008560e49d Support B5G5R5A1 sampled textures and two-byte footprints 2026-11-21 22:11:47 -03: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
8493b28604 Merge pull request #493 from Andrea 2026-11-21 20:09:14 -05: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
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
66a5fc90f8 Query multisample quality for depth-stencil formats 2026-11-22 01:53:53 +01:00
302b4f2770 Merge pull request #516 from ezwinxdlmao 2026-11-21 19:53:07 -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
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
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
0b7233e567 Tests: the D3D-14 push-constant check accepts GPUs with 128 bytes
d3d12_vulkan_device_test asserted that the real test device never needs
the push-constant fallback. On a GPU whose maxPushConstantsSize is 128 (the
Vulkan minimum), the device is right to flag it, so the test stopped there.
That happens on Intel Arc, and on a Radeon 680M on the Windows driver
22.40.84.06. The check now asserts that the flag matches
maxPushConstantsSize < 144, which holds on either kind of GPU. The
simulated 128-byte device below it still covers the flagged path.

docs/d3d12_vulkan.md: the 680M joins Intel Arc as a measured 128-byte GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:18:39 +02:00
a3e8a7f9e0 Merge pull request #420 from kotorvr 2026-11-21 19:14:02 -05:00
63f05456f0 Runtime: command-list and allocator rules like the PC runtime (D3D-51)
d3d12_vulkan_device_test now runs the same 25 command-list, allocator, queue
and fence calls on the host D3D12 runtime and on the Vulkan layer, and
compares every HRESULT.

One list at a time records into an allocator, as on the PC runtime. Three
differences are fixed:
- allocator Reset while a list records into it: E_FAIL (was S_OK)
- CreateCommandList on an allocator a list records into: E_INVALIDARG (was S_OK)
- list Reset onto an allocator another list records into: E_INVALIDARG (was S_OK)

An open list now holds a reference to its allocator and marks it busy until
Close or destruction.

Two differences remain, and docs/d3d12_vulkan.md records both:
- Reset with a null allocator crashes the PC runtime (ours returns
  E_INVALIDARG), so that call is not compared.
- Executing an open list removes the PC device (DXGI_ERROR_INVALID_CALL). This
  layer submits nothing and keeps the device, since it has no device-removed
  state yet. The test prints it as a known difference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:06:27 +01:00
82e9d2e06d test(runtime): include 16x MSAA in resolve comparisons 2026-11-22 01:05:56 +01:00
d546ab799e test(runtime): report resolve comparison and match counts accurately 2026-11-22 01:05:21 +01:00
fb5524f8ac test(runtime): clear multisampled resolve inputs as attachments 2026-11-22 01:03:51 +01:00
bdb57efee8 test(runtime): tidy resolve comparison support checks 2026-11-22 01:03:05 +01:00
a818069fbd test(runtime): fix readback descriptor construction in resolve cases 2026-11-22 01:02:44 +01:00
5eda82746f test(runtime): compare resolve results with the host D3D12 runtime 2026-11-22 01:02:26 +01:00
b4e31e3d3a d3d12_vulkan_device_test: the reserved-resource copies wait on fence value 9
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>
2026-11-21 17:57:57 -06:00
a7ce844d2a d3d12_vulkan_device_test: skip tiling layouts the host runtime refuses
@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>
2026-11-21 17:57:06 -06: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
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
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