A typed B8G8R8A8 or B8G8R8X8 texture with a castable-format list took
an RTV in a format the list doesn't name (its own sRGB format, say) and
silently kept the image's format, where a typed R8G8B8A8 texture with a
list refuses it. CreateRenderTargetView now refuses it for these
textures too; without a list they keep the image's format, as before.
d3d12_clear_test's negative check covers a B8G8R8A8 texture listing
R8G8B8A8 and a B8G8R8X8 one listing B8G8R8A8 next to the R8G8B8A8 one:
each takes its own and its listed format and refuses 3 formats its list
doesn't name. Without the shim change it fails on the B8G8R8A8 texture's
unlisted B8G8R8A8_UNORM_SRGB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
STENCIL on a D32_FLOAT view used to make prepare return invalid_clear, so
the whole command list was dropped. Like the PC runtime (WARP), the absent
plane is now ignored: STENCIL alone clears nothing, DEPTH | STENCIL clears
the depth plane. d3d12_clear_test compares three such cases with WARP.
AI-assisted.
The castable cases in d3d12_clear_test compared each byte with WARP
exactly. Drivers round the 0.5 tie differently (WARP stores 128, NVIDIA
127), and Intel's driver encodes sRGB 1 off WARP in places, where its
own D3D12 driver stores the same bytes as the layer (measured on a UHD
770 and an RTX 4070 SUPER in the review of this change). Compare within
1, as the castable draws in d3d12_draw_test do: a wrong channel order or
a missing sRGB encoding is many steps off, so the cases still catch what
they test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A castable-format list may name an R8G8B8A8 texture's B8G8R8A8 formats,
or the reverse, or cross B8G8R8X8 and B8G8R8A8. WARP and AMD's D3D12
driver store a clear or a draw through an RTV in a listed format in the
view's channel order and encoding: an R8G8B8A8 texture cleared to
(0.2, 0.4, 0.6, 0.25) through a B8G8R8A8 RTV holds 153, 102, 51, 64.
CreateRenderTargetView refused such an RTV on an R8G8B8A8 texture, so
the clear failed Close and draws were dropped, and a typed B8G8R8A8
texture's RTV kept the image's format whatever the view named, so its
clears came out in BGRA order and without the sRGB encoding.
An RGBA8 or BGRA8 UNORM/SRGB texture (B8G8R8X8 included) now gets an
RTV in another of these formats when its list, as the application gave
it, names that format, and color_view_format lets a castable image's
clear cross between the two channel orders. Draws already used the
PSO's format for the attachment view. A format the list doesn't name
stays refused; a typed B8G8R8A8 texture without a list keeps ignoring
the RTV's format, as before.
d3d12_clear_test compares 8 such textures with WARP in full and
rectangle clears (the X byte of an X8 view left out: WARP and AMD write
different values there) and checks that 3 unlisted formats get no RTV;
d3d12_draw_test draws through the same views; typeless_rtv_test checks
the replay's crossing and its refusals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Map B8G8R8X8_UNORM, _UNORM_SRGB and _TYPELESS to the B8G8R8A8 Vulkan formats, so
creation, copies, footprints and clears work as for BGRA8. Shader views of the family
read alpha as 1 (the T# selects one for the alpha channel), and views between the
B8G8R8X8 and B8G8R8A8 typeless families are refused, although both land on the same
VkFormat.
Compared with the host D3D12 runtime on an RX 9060 XT: it reports no typed UAV for the
family and refuses typed B8G8R8X8 textures that allow unordered access (the typeless
format is accepted). The BGRA8 image would have advertised storage, so
CheckFeatureSupport now leaves the typed UAV bits out, texture creation refuses typed
B8G8R8X8 with ALLOW_UNORDERED_ACCESS, CreateUnorderedAccessView gives a null descriptor
for the family, and its images get no storage usage. WARP writes the clear's alpha into
the X byte, as Vulkan does, so clears need no change.
Tests: d3d12_clear_test clears B8G8R8A8_UNORM and B8G8R8X8_UNORM against WARP;
d3d12_vulkan_device_test compares B8G8R8X8 footprints, the typed UAV bits and UAV/RTV
resource creation with the host runtime; d3d12_descriptor_test samples a B8G8R8X8 and a
B8G8R8A8 texture with the same bytes through the bindless set (alpha 1 against the
stored byte) and checks the refused views.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the native attachment and feature-mask changes merged, Radeon could create and clear the resource despite a negative capability query. Check the advertised bit against the physical attachment capability before a focused test can skip.
Radeon advertises a color attachment for shared-exponent textures. Allow the native path to create the resource and RTV while keeping the mutable R32 UAV backing unavailable for render targets.
d3d12_clear, d3d12_com, d3d12_descriptor, d3d12_method_variants,
d3d12_resource_desc, d3d12_sampler2, d3d12_typeless_rtv and d3d12_uav_clear were
built but never added with add_test, so ctest and CI never ran them. Each now
exits 77 when there is no Vulkan GPU (DeviceStatus::unavailable), as
d3d12_vulkan_device_test does, and is registered with SKIP_RETURN_CODE 77.
(cherry picked from commit 2af37e5da368dd130ba23db385e812635cb1a768)
R8G8, R16G16, R16G16B16A16, R32G32 (UINT/SINT), R32G32B32A32_SINT and R10G10B10A2_UINT fell into the float path and stored raw float bits. Clamp/truncate numerically like WARP; A2B10G10R10 alpha clamps to 3. Tests cover 19 formats on CPU and 15 against WARP.
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.
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).