Commit Graph

3 Commits

Author SHA1 Message Date
428a746e58 Check 1D and 3D A8_UNORM textures next to A8 render targets
d3d12_a8_dimensions_test makes its device without the A8 render-target
path, so it covers 1D and 3D A8_UNORM textures only in the fallback.
d3d12_a8_copy_test now also checks them on a device that has the path:
a 128x1 1D and an 8x8x4 3D A8_UNORM texture are created as R8_UNORM
images (no VK_FORMAT_A8_UNORM_KHR image is made for them), so they are
never one side of a mixed-backing copy, and a 1D A8_UNORM render target is
refused rather than made in either backing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 19:54:46 -05:00
ea43b63b7a A8 render targets: guard test for device extensions, and the fallback case
From rung-428-on-main (554f0e4ec). The bug that commit fixed, VK_KHR_maintenance5 enabled inside maintenance8's #ifdef, is not in #984's copy of the A8 support: the enable already sits under its own guard here, so only the comment on it comes over. What the commit adds besides still applies:

tests/test_vulkan_extension_guards.py reads the runtime sources and fails on any device extension enabled inside another extension's #ifdef. d3d12_a8_copy_test also forces the fallback (a8_render_target false) on any device: A8_UNORM render targets are refused at creation, in GetResourceAllocationInfo and in the format support, no A8 image is created, and plain A8_UNORM textures still copy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:54:46 -05:00
869c889796 Stage copies between the two A8_UNORM backings through a buffer
An A8_UNORM render target is a VK_FORMAT_A8_UNORM_KHR image and any other
A8_UNORM texture an R8_UNORM image. CopyResource and CopyTextureRegion
between the two issued vkCmdCopyImage on that pair, which Vulkan does not
count as size-compatible: VUID-vkCmdCopyImage-srcImage-01548, although the
bytes came out right on the drivers tried. moffington reported it in the
review of #428 and Dezmonius confirmed it on native Windows with the
validation layer.

Such a copy now takes the replay's existing image -> transfer scratch ->
image route, the one depth <-> colour copies use, with one byte per texel
on both sides. Same-backing copies still copy image to image. This is the
approach of Dezmonius's proof of concept, which they described on the pull
request but did not publish; written here from that description.

d3d12_a8_copy_test copies A8 render target -> A8 texture and back, whole
(CopyResource) and a 3x3 box from a nonzero source offset to a nonzero
destination offset (CopyTextureRegion), and checks every texel read back:
the source bytes inside the box, the destination's own outside it. It wraps
vkCreateImage and vkCmdCopyImage behind the instance-proc pointer it hands
the layer and fails on any vkCmdCopyImage between VK_FORMAT_A8_UNORM_KHR and
another format, so it fails without this change even where the validation
layer is not installed; with LEONIDA_VK_VALIDATION=1 the layer's errors fail
it too. A8 -> A8 and R8 -> R8 copies are the controls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 19:54:27 -05:00