Skip to content

d3d12: A8_UNORM render targets through VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5) - #7403

Closed
mrp1no wants to merge 5 commits into
ProjectLeonida:mainfrom
mrp1no:d3d12-a8-unorm-rt
Closed

mrp1no wants to merge 5 commits into
ProjectLeonida:mainfrom
mrp1no:d3d12-a8-unorm-rt

Conversation

@mrp1no

@mrp1no mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #7049 (comment) (new D3D item from @KkelebekK's RT-5 finding, #7049 (comment))

What and why

The retail title's first native pipelines name an A8_UNORM render target. The layer stored every A8_UNORM texture as R8_UNORM with a swizzled SRV, and refused render targets.

Where the GPU has VK_KHR_maintenance5 and can sample VK_FORMAT_A8_UNORM_KHR and blend it as a colour attachment, gta6rt now enables the extension and its feature (VulkanDeviceInfo::a8_render_target). An A8_UNORM texture created with ALLOW_RENDER_TARGET is then stored in that format:

  • RTVs and PSOs: RTVs and the PSO's RTVFormats use it, so draws, blends and clears write the alpha channel. The clear quantizes alpha like the other UNORM formats.
  • SRVs: they view the image in the same format. Vulkan puts A8 in a compatibility class of its own, so it can't share an image with an R8 view (the validation layer says so). gfx10_descriptors.h's format table therefore gains an 8_UNORM row for it whose one channel X is alpha (channels_a), and the T#'s (0, 0, 0, X) becomes (ZERO, ZERO, ZERO, A) on that view.
  • Format support: CheckFeatureSupport adds RENDER_TARGET and BLENDABLE for A8_UNORM.
  • Copies: the copy paths know its one-byte texel.

Other A8_UNORM textures stay R8_UNORM, and devices without the format refuse A8 render targets as before. Depth-stencil and UAV stay refused. docs/d3d12_vulkan.md says all of this.

Tested

Windows 11, MSVC RelWithDebInfo, base main 8575d36e, on an NVIDIA RTX 3060 (610.88) and an Intel UHD Graphics 750 (32.0.101.7088). Both report A8_UNORM with colour attachment, blend and storage. All with LEONIDA_VK_VALIDATION=1, no validation messages:

  • d3d12_clear_formats: A8_UNORM joins the byte-for-byte WARP comparison (it was "not exposed"). All 5 cases match on both GPUs (256/256 on NVIDIA).
  • d3d12_descriptor_test: format support and creation now follow the device. An A8 render target filled through CopyTextureRegion is sampled through its default and remapped SRVs: 64/64 texels each, the same as the R8-backed A8 texture.
  • d3d12_draw_test: a full-screen draw into an A8 target cleared to 0.25, then two alpha blends (ZERO, ONE keeps 64; INV_DEST_ALPHA, ZERO gives 191). All 16 texels match.
  • gfx10_descriptors_test: the A8 row, its 8_UNORM code and its view mapping.
  • Whole ctest suite: vk_test_device.h now enables maintenance5 the way gta6rt does, so the whole suite runs with it. It gives the same failures as main built at the same commit: NVIDIA 3 (d3d12_vulkan_device, d3d12_indirect_dispatch_count, d3d12_indirect_rt); Intel 5 (those minus d3d12_indirect_rt, plus d3d12_buffer_tiles, d3d12_dxr_validation_khr and d3d12_clear_formats, whose sRGB rounding differs from WARP on this Intel driver).

I wasn't able to run the retail boot up to this point: on main it stops long before the native pipelines. No game data. AI-assisted (Claude Code).

🤖 Generated with Claude Code

…_maintenance5)

The retail title's first native pipelines name an A8_UNORM render target
(@KkelebekK's RT-5 measurements). The layer stored every A8_UNORM texture as
R8_UNORM with a swizzled SRV and refused render targets.

Where the GPU has VK_KHR_maintenance5 and can sample VK_FORMAT_A8_UNORM_KHR and
blend it as a colour attachment, gta6rt enables the extension and its feature
(VulkanDeviceInfo::a8_render_target), and an A8_UNORM texture created with
ALLOW_RENDER_TARGET is stored in that format:
- its RTVs and the PSO's RTVFormats use it, so draws, blends and clears write
  the alpha channel (the clear quantizes alpha like the other UNORM formats);
- its SRVs view the image in the same format. Vulkan puts A8 in a compatibility
  class of its own, so it cannot share an image with an R8 view: gfx10's format
  table gains an 8_UNORM row for it whose one channel X is alpha (channels_a),
  and the T#'s (0, 0, 0, X) becomes (ZERO, ZERO, ZERO, A) on that view;
- CheckFeatureSupport adds RENDER_TARGET and BLENDABLE for A8_UNORM;
- the copy paths know its one-byte texel.
Other A8_UNORM textures stay R8_UNORM, and devices without the format refuse
A8 render targets as before. Depth-stencil and UAV stay refused.

Tests (both on an RTX 3060 and an Intel UHD 750, with Vulkan validation):
- d3d12_clear_formats: A8_UNORM joins the WARP comparison (was "not exposed");
- d3d12_descriptor_test: format support and creation follow the device; an A8
  render target's default and remapped SRVs sample like the R8-backed ones;
- d3d12_draw_test: a full-screen draw and two alpha blends into an A8 target;
- gfx10_descriptors_test: the A8 row and its view mapping.
vk_test_device.h enables maintenance5 like gta6rt, so the whole suite runs
with it: ctest gives the same failures as main on both GPUs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MartinIndra02

Copy link
Copy Markdown
Contributor

Independent Windows + GPU test of 67950a8d5: pass.

Setup: Windows 11 x64, MSVC 19.44.35220 (RelWithDebInfo, Windows SDK 10.0.26100.0), NVIDIA GeForce RTX 3080 (driver 32.0.16.2124 / 621.24), Vulkan SDK 1.4.363.1, LEONIDA_VK_VALIDATION=1, no game files.

  • gfx10_descriptors_test.exe: PASS (exit 0).
  • d3d12_clear_formats_test.exe (validation on): PASS (exit 0).
  • d3d12_descriptor_test.exe (validation on): PASS (exit 0).
  • d3d12_draw_test.exe (validation on): PASS (exit 0).

AI-assisted review/test.

@KarolKurzyna

Copy link
Copy Markdown
Contributor

Independent native Windows 11 dual-GPU review of 67950a8d5159912fa9403549a924d92cda9d7db4 (plus clean merge check onto origin/main 48ff424): runtime tests PASS on both GPUs, with one real preprocessor bug spotted in d3d12_vulkan_device.cpp for older Vulkan headers (below).

Environment

  • OS / Toolchain: Windows 11 x64 (10.0.26300), MSVC 19.52.37029 (VS 2026), Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.1, CMake + Ninja RelWithDebInfo, Khronos Validation Layer 1.4.363
  • GPUs: NVIDIA GeForce RTX 3070 Ti (driver 621.24, Vulkan 1.4.357) and Intel(R) UHD Graphics 770 (driver 101.6129, Vulkan 1.3.295) — both expose VK_KHR_maintenance5 + VK_FORMAT_A8_UNORM_KHR
  • Layers: VK_LOADER_LAYERS_DISABLE=~implicit~, DISABLE_VULKAN_OBS_CAPTURE=1, DISABLE_RTSS_LAYER=1

Results (67950a8d51, 0 new compiler warnings in modified files)

  • NVIDIA GeForce RTX 3070 Ti (LEONIDA_VK_VALIDATION off & on, 0 validation errors):
    • gfx10_descriptors_test: PASS
    • d3d12_descriptor_test: PASS
    • d3d12_draw_test: PASS (A8_UNORM render target: clear, draw and 3 alpha blends matched)
    • d3d12_clear_formats_test: PASS (clears: 256 matched WARP, 0 differ, 0 failed — up from 251 before this PR, all 5 A8_UNORM clear cases match WARP)
    • d3d12_vulkan_device_test: FORMAT_SUPPORT against the host on NVIDIA GeForce RTX 3070 Ti: 94 formats compared, 0 mismatches
  • Intel(R) UHD Graphics 770 (LEONIDA_VK_VALIDATION off & on, 0 validation errors):
    • gfx10_descriptors_test: PASS
    • d3d12_descriptor_test: PASS
    • d3d12_draw_test: PASS (A8_UNORM render target: clear, draw and 3 alpha blends matched)
    • d3d12_clear_formats_test: 238 matched WARP, 18 differ (up from 233 matched, 18 differ on main b3c972b; all 5 new A8_UNORM clear cases matched WARP, only the 18 pre-existing UHD 770 depth-stencil diffs remain)
  • Clean merge onto origin/main (48ff424): merges cleanly; gfx10_descriptors_test, d3d12_descriptor_test, d3d12_draw_test, and d3d12_clear_formats_test all PASS on RTX 3070 Ti with LEONIDA_VK_VALIDATION=1.

Code-audit findings (Vulkan header #ifdef guards in runtime/shims/d3d12_vulkan_device.cpp)

  1. Nested #ifdef bug (runtime/shims/d3d12_vulkan_device.cpp:9383-9388):
    #ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME
        if (info.maintenance8) device_extensions.push_back(VK_KHR_MAINTENANCE_8_EXTENSION_NAME);
    #ifdef VK_KHR_MAINTENANCE_5_EXTENSION_NAME
        if (info.a8_render_target) device_extensions.push_back(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
    #endif
    #endif
    VK_KHR_MAINTENANCE_5_EXTENSION_NAME is nested inside #ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME. On Vulkan headers 1.3.262..1.4.305 (which define maintenance5 without maintenance8), lines 9224–9240 chain VkPhysicalDeviceMaintenance5FeaturesKHR into vkCreateDevice's pNext and set info.a8_render_target = true, but VK_KHR_maintenance5 would not be added to device_extensions. Moving #endif above #ifdef VK_KHR_MAINTENANCE_5_EXTENSION_NAME fixes it (matching vk_test_device.h).
  2. Unguarded VK_FORMAT_A8_UNORM_KHR uses (d3d12_vulkan_device.cpp:960 and :3612):
    Every other VK_FORMAT_A8_UNORM_KHR reference in the PR is wrapped in #ifdef VK_KHR_MAINTENANCE_5_EXTENSION_NAME, but lines 960 (texture_format) and 3612 (create_graphics) reference VK_FORMAT_A8_UNORM_KHR unconditionally, so pre-1.3.262 Vulkan headers would fail to compile there.

Synthetic tests only, no game data. AI-assisted.

@jlric

jlric commented Nov 23, 2026

Copy link
Copy Markdown

Retail A/B on CachyOS / Wine 11.22, RTX 4070 (620.73.04), runtime delta from 67950a8d5. The A8_UNORM GetResourceAllocationInfo refusal disappears, along with one of the two previously observed breakpoints. One other resource-state breakpoint remains. The matching gfx10_descriptors_test passes under Wine. AI-assisted testing.

…th older Vulkan headers

KarolKurzyna found two header gaps on ItsNotRexed#7403. VK_KHR_maintenance5 was added to the
device extensions inside the maintenance8 #ifdef, so headers with maintenance5
but not maintenance8 (1.3.262 to 1.4.305) chained its feature without enabling
the extension; the two #ifdefs are now separate. texture_format and the PSO named
VK_FORMAT_A8_UNORM_KHR unguarded; they now use kA8UnormFormat, which is
UNDEFINED (and never used, since a8_render_target stays false) without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @MartinIndra02 and @KarolKurzyna. Both of KarolKurzyna's header findings were real, fixed in 59e4bb81e: the maintenance5 extension push is no longer nested in the maintenance8 #ifdef, and texture_format/create_graphics use a kA8UnormFormat constant that is UNDEFINED without the maintenance5 headers (never reached then, since a8_render_target stays false). Rebuilt; gfx10_descriptors_test, d3d12_draw_test, d3d12_descriptor_test and d3d12_clear_formats_test pass on the RTX 3060 with validation on. AI-assisted (Claude Code).

@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @jlric, that matches what this PR targets: the A8_UNORM refusal and the breakpoint behind it. The remaining resource-state breakpoint comes from a different path, and this PR doesn't touch it.

@byPreaZy

Copy link
Copy Markdown

Windows GPU check on AMD: Radeon RX 9060 XT, driver 32.0.32015.7029, Windows 11 x64, MSVC 14.44, RelWithDebInfo, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION not set for this run, no game files. PR diff applied cleanly on main 8575d36ed.

All four touched targets pass on the AMD driver, exit 0 each:

  • gfx10_descriptors_test: GFX10 descriptors: T#, S# and V# fields, round trips, 95 format rows and the Vulkan mappings OK
  • d3d12_clear_formats_test: clears: 256 matched WARP, 0 differ, 0 failed (A8_UNORM no longer "not exposed")
  • d3d12_descriptor_test: all matched, including the A8 render-target SRV cases
  • d3d12_draw_test: A8_UNORM render target: clear, draw and 3 alpha blends matched, plus the rest of the suite

Third-vendor confirmation (after RTX 3060 and UHD 750) that VK_FORMAT_A8_UNORM_KHR storage, RTVs, PSO formats, alpha blends and the descriptor 8_UNORM row work on an AMD RDNA part. AI-assisted (Devin).

@jacksonslab

Copy link
Copy Markdown

Tested on the retail executable: pass. Windows 11, i7-14700K, RTX 4070 SUPER, MSVC RelWithDebInfo, LEONIDA_D3D12=vulkan, own 1.0.2.1 copy, on a local stack of the open boot-chain PRs (listed in #7231 (comment)). Before this PR, GetResourceAllocationInfo refused format 65 and the title's slot-25 size assert fired. With it the A8_UNORM resources are sized and created, and the boot goes on to later stops. AI-assisted (Claude Code).

@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @byPreaZy and @jacksonslab. That's three vendors now (NVIDIA, Intel, AMD RDNA) plus the retail slot-25 size assert gone on an RTX 4070 SUPER.

@tupacfan04 tupacfan04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retail A8 path is confirmed on three vendors, but the pCastableFormats path still has a real defect.

  1. An A8 RT’s own format is rejected. vulkan_format() has no DXGI_FORMAT_A8_UNORM case (d3d12_vulkan_device.cpp:270-377), and castable_view_formats() calls it at :1404. Synthetic CreateCommittedResource3(..., castable={DXGI_FORMAT_A8_UNORM}, ...) returns E_INVALIDARG with castable format not supported yet: 65, before any Vulkan image. The resource’s own format should be a no-op; create_texture() even documents that own-format views are always allowed (:2018).

  2. An R8 castable list is passed into an A8 image. castable={DXGI_FORMAT_R8_UNORM} maps to VK_FORMAT_R8_UNORM, passes the 1-byte block-size check (:1409-1413), and is added to the A8 image’s VkImageFormatListCreateInfo (:2020-2033). A8 and R8 are not compatible Vulkan classes (the PR’s own comment at :248-251), so vkCreateImage fails or validation reports it. Reject it cleanly before Vulkan.

  3. No A8 castable test. d3d12_draw_test.cpp:1010-1057 covers castable lists only for RGBA8/BGRA8; the A8 descriptor/clear tests use the legacy CreateCommittedResource path. Add castable={A8_UNORM} and {R8_UNORM} cases: own A8 succeeds; R8 is cleanly rejected or supported, never passed as an A8 image’s view format.

Secondary: a8_render_target at :9235-9246 does not include TRANSFER_SRC/DST, while TextureCreateInfo always requests transfer usage (:520). A device with A8 sample/color/blend but no transfer can advertise RENDER_TARGET while copies fail. Require transfer in the gate or report the intersection.

#7403 has the A8 PSO/draw/clear coverage and avoids the #7593 image_descriptor R8-alias bug; #7593 can be closed in its favour. Synthetic only; no game files. AI-assisted (OpenCode).

…efuses the others

castable_view_formats() mapped every castable format through vulkan_format(), which has no
A8_UNORM case, so CreateCommittedResource3/CreatePlacedResource2 with castable={A8_UNORM}
failed with E_INVALIDARG ("castable format not supported yet: 65"). The resource's own format
is always viewable (create_texture adds the image's format), so naming A8_UNORM on an A8
texture is now a no-op.

An A8 render target's VK_FORMAT_A8_UNORM_KHR image is in a compatibility class of its own,
so an R8_UNORM castable entry (same texel size) would have reached its
VkImageFormatListCreateInfo. Any format other than A8_UNORM is now refused with E_INVALIDARG
before Vulkan.

The A8 gate (runtime and vk_test_device.h) also requires TRANSFER_SRC/DST, since every
texture is created with transfer usage.

d3d12_draw_test runs the A8 clear/draw/blend cases on a second target made through
CreateCommittedResource3 with castable={A8_UNORM}, and checks castable={R8_UNORM} returns
E_INVALIDARG. Without the shim change it fails with the reported message.

Reported by tupacfan04 on ItsNotRexed#7403.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @tupacfan04, all four were real. Fixed in 18b0bfbaf:

  1. Own format. castable_view_formats() now takes the resource's DXGI format and skips A8_UNORM on an A8 texture. create_texture() already adds the image's own format, so castable={A8_UNORM} is a no-op instead of E_INVALIDARG.
  2. R8 into an A8 image. For an A8 render target (Format::a8_as_alpha, a VK_FORMAT_A8_UNORM_KHR image), any castable format other than A8_UNORM returns E_INVALIDARG before Vulkan. The log line is castable format of an A8_UNORM render target not supported (only A8_UNORM is). It can no longer reach VkImageFormatListCreateInfo.
  3. Test. d3d12_draw_test runs the A8 clear/draw/3-blend cases on a second target made with CreateCommittedResource3(..., castable={A8_UNORM}) (fences 51..56, still before the step-rate block). It also checks that castable={R8_UNORM} returns E_INVALIDARG with no resource. Negative control: with the previous shim and the new test, it exits 1 with exactly your castable format not supported yet: 65.
  4. Transfer. The A8 gate (runtime and vk_test_device.h) now also requires TRANSFER_SRC/TRANSFER_DST.

docs/d3d12_vulkan.md's A8 paragraph is updated too.

Ran with LEONIDA_VK_VALIDATION=1 on an RTX 3060 (610.88) and a UHD 750 (32.0.101.7088), 0 validation messages on either:

AI-assisted (Claude Code).

@bobcatchris

Copy link
Copy Markdown
Contributor

Found a gap in the sampled (non-render-target) A8 form while running the retail 1.0.2.1 boot on AMD (RX 7900 XTX, the 26-PR boot stack): the title sizes a 2D 128x1 A8_UNORM texture with flags 0 and samples 1 through slot 25, and texture_format refuses it — GetResourceAllocationInfo answers SizeInBytes = UINT64_MAX (log: GetResourceAllocationInfo format not supported yet: 65), which then trips the title's 32-bit size assert, exactly the failure mode your PR's RT path fixed for format 65.

Reading the current head: the RT branch returns the maintenance5 alpha image, but a flags-0 A8 falls through to the second A8 check and on to the tail — and on this run the fall-through refused it (the desc passes every written guard, so whatever refuses it is below the visible checks). The fix that works here is the one the code's own comment already documents ("A8_UNORM is an R8_UNORM image in 1D, 2D and 3D, as the host makes all three"): return texture_storage_format(DXGI_FORMAT_A8_UNORM, false) directly from the non-RT branch of the A8 block — measured, VK_FORMAT_R8_UNORM comes back and the boot sizes all its sampled A8 textures and continues to PresentX ready.

The second refused desc in the same batch differs only in Alignment = 4096 (the console allows a 4K-aligned texture; the PC wants 0 or 64K) — with the format fixed, the align=0 one sizes, and the 4096 one is the next thing to look at.

Formats, dimensions and counts only; no game data. AI-assisted.

…t 64 KiB and 4 KiB alignment

The shape bobcatchris reports from the retail boot on ItsNotRexed#7403 (2D 128x1, no flags, one sample, the
full mip chain), with Alignment 0 and 4096. On this head it takes texture_format's existing path (an
R8 image, as on main) and GetResourceAllocationInfo sizes it at the default 64 KiB and the 4 KiB
small-resource alignment. Passes on an RTX 3060 and a UHD 750 with Vulkan validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bobcatchris. I couldn't reproduce this on the PR head, so I added your shape as a test (14a459bac). In d3d12_descriptor_test, GetResourceAllocationInfo on a 2D 128x1 A8_UNORM with no flags, one sample and the full mip chain gives a valid size at Alignment = 0 (64 KiB) and at Alignment = 4096 (4 KiB small-resource). That holds on an RTX 3060 and a UHD 750 with validation.

On this head a non-RT A8 2D texture falls through texture_format to texture_storage_format, which maps it to R8_UNORM, the same path main has. The PR only adds the render-target branch above it.

So the refusal you see probably comes from another PR in the 26-PR stack, or from a field I haven't matched. Could you post the exact description from the refused call: Dimension, Layout, MipLevels, DepthOrArraySize, Flags (hex) and Alignment? It would also help to know whether the stack includes #7593 or a local A8→R8 stand-in (rafaelpssz's integration had one), since either changes what texture_format sees. AI-assisted (Claude Code).

@akimfomin

Copy link
Copy Markdown

A41 Windows reference measurements for the dimensional guard at b3a53b87. Native D3D12 WARP both sized and created the same small A8_UNORM sampled textures (one mip, one sample, UNKNOWN layout) in 1D (128×1), 2D (128×8) and 3D (128×8×4). All six sampled cases worked: default alignment returned 65,536 bytes; explicit 4,096 alignment returned 4,096 bytes. Three separate render-target cases at default alignment also created successfully on WARP.

On the RTX 4070 Ti SUPER (617.14, Vulkan 1.4.351), vkGetPhysicalDeviceImageFormatProperties accepted optimal 1D/2D/3D for both R8_UNORM and A8_UNORM_KHR, with sampled/transfer usage and with color attachment added. These are native allocation and format-query references. texture_format() in this PR still exits for non-2D A8 even with sampled-only flags. For the pending fix, the 128×1 case with both alignments is a finite-size reference; this check does not exercise the Leonida slot-25 path or swizzle pixels. Synthetic only. AI-assisted (Codex).

@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @akimfomin, useful references. The 2D-only guard for sampled A8 is main's, and this PR keeps it. Sampled A8_UNORM in 1D and 3D is @NiiRoZz's #7755 ("A8_UNORM textures in 1D and 3D, as the host makes them"), which lines9686-rgb's merge plan on #8344 puts right after this PR. Your WARP numbers fit that PR: 1D/2D/3D sampled at 64 KiB / 4 KiB, Vulkan accepting R8 and A8_KHR in all three types. @bobcatchris, if your 128×1 description is actually TEXTURE1D, #7755 is the piece that sizes it. AI-assisted (Claude Code).

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7403 | with: merge of PR head onto main, then gfx10_descriptors_test, d3d12_descriptor_test, d3d12_draw_test, d3d12_clear_formats_test (cross-built, run under Wine) and python -I tests/test_gfx10_descriptors.py (Python 3.12.3) | on: Wine 11 on a RunPod RTX 4090 (Linux, Vulkan), cross-built with clang-cl + xwin through the pod's ccache build script; not native Windows, and the host D3D12/WARP comparisons do not run (there is no WARP adapter under Wine). The Python test ran directly on the pod's Linux. | result: pass on the Vulkan-device targets, one target fails the same way as on main

  • PR head tested: 14a459b, merged (clean) onto origin/main 867d922.
  • gfx10_descriptors_test: exit 0 ("95 format rows and the Vulkan mappings OK"). tests/test_gfx10_descriptors.py: OK, 5 tests (it parses the new A8 row of the header).
  • d3d12_descriptor_test: exit 0 on the RTX 4090 Vulkan device, and it took the new path: "A8 render target (VK_FORMAT_A8_UNORM_KHR) default and remapped views: 64 texels matched each", next to the existing "A8 and R8 default and remapped views" and "A8 alpha gather" lines. So VK_KHR_maintenance5 and the A8 format were present on this driver and the case ran; it was not skipped.
  • d3d12_draw_test: exit 0.
  • d3d12_clear_formats_test: exit 1 with "WARP reference unavailable: differential test cannot run". A clean origin/main copy gives the identical exit 1 and message, so this is the Wine environment, not the PR; the A8 render-target part of that test (the clear and blend differential) therefore did not run here.
  • Negative control: weak. With the four production files (d3d12_com.h, d3d12_vulkan_device.cpp, gfx10_descriptors.h, vulkan_replay.h) reverted to main, the PR's tests do not build (no member named 'a8_render_target', channels_a undeclared), so this shows the tests depend on the new code, not that they fail on a behaviour. A behavioural control would need the d3d12_vulkan_device.cpp change alone, which I did not do.
  • Diff review (11 files, no game files): the render target is only used when the device reports a8_render_target, which requires the maintenance5 feature and the format features (sampled, colour attachment, blend, transfer src and dst); otherwise the old refusal stays, with a log line. Depth-stencil and UAV A8 stay refused, 1D/3D/MSAA stay refused here (the sibling PR d3d12: A8_UNORM textures in 1D and 3D, as the host makes them #7755 deals with 1D/3D). RTVs are accepted only for plain 2D and 2D-array views in the image's own format, and a castable-format list other than A8 itself is refused with E_INVALIDARG, since the image is in its own compatibility class. CheckFeatureSupport now reports RENDER_TARGET and BLENDABLE only when that holds. The block_format and descriptor-table additions are consistent with the test.
  • Concerns: (1) format_table now has two rows with the same GFX10 code 1 (R8 and A8_KHR). format_from_vulkan and the Python test accept it, but a reverse lookup from a T# format code to a Vulkan format can only ever return the first row, so code that decodes a guest T# (rather than encoding one) would still get R8; I did not find such a path in the diff, but it is worth a maintainer's look. (2) Only one driver (NVIDIA on Wine) ran the real path; AMD and Intel were not tested, and the PR relies on a driver exposing VK_FORMAT_A8_UNORM_KHR with blend support. (3) The vkGetPhysicalDeviceFormatProperties loader entry is added to the standalone device creation only; I did not check other device-creation paths.
  • Not verified: the WARP clear/blend differential, other GPUs and drivers, native Windows, and the retail title's use of an A8 target.

AI-assisted.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7403 | with: merge of PR head onto main, then d3d12_draw_test, d3d12_descriptor_test and gfx10_descriptors_test (C++, cross-built with clang-cl + xwin through the pod's ccache build script, run under Wine), python -I tests/test_gfx10_descriptors.py (Python 3.12.3), plus two negative controls | on: Wine 11 on a RunPod RTX 4090 (driver 595.112.07, Linux, Vulkan), main@867d922f0 + #740314a459b (merged clean, no conflicts); not native Windows, no AMD hardware, no game data | result: pass on all four targets

  • d3d12_draw_test: exit 0. The 4090 exposes VK_FORMAT_A8_UNORM_KHR, so the new block really ran: "A8_UNORM render target: clear, draw and 3 alpha blends matched, also with an A8_UNORM castable list (R8_UNORM refused)" (3 cases x 2 resources = 6 draws/readbacks, plus the E_INVALIDARG refusal). The other blocks in that binary still pass (B8G8R8X8 blends, castable RTVs 8 draws, strip cut 4096/4096, MSAA 4096/4096, M1).
  • d3d12_descriptor_test: exit 0; "A8 render target (VK_FORMAT_A8_UNORM_KHR) default and remapped views: 64 texels matched each", and the older A8 mip/R8 view and alpha gather lines still pass.
  • gfx10_descriptors_test: exit 0 ("95 format rows and the Vulkan mappings OK"); tests/test_gfx10_descriptors.py: 5 tests OK.
  • Negative control 1: in castable_view_formats I disabled the new format.a8_as_alpha refusal (build-dir copy only). d3d12_draw_test then exits 1 at line 915, the CreateCommittedResource3(... R8_UNORM list) == E_INVALIDARG check. Restored, it passes again.
  • Negative control 2: with main's runtime/src/gfx10_descriptors.h, gfx10_descriptors_test does not compile (channels_a undeclared), so it cannot pass without the PR change.
  • Observation, not a defect: with main's d3d12_vulkan_device.cpp swapped in (whole file), d3d12_draw_test and d3d12_descriptor_test still exit 0, because the A8 block is gated on the device reporting RENDER_TARGET support and prints "not supported on this device" instead of failing. The tests therefore guard the feature only on GPUs with the A8 format; on others they skip (the descriptor test prints "(not supported: the R8-backed texture)"). The castable refusal check above is the part that does fail.
  • Diff read against docs/d3d12_vulkan.md: the A8 paragraph matches the code (RT only with VK_KHR_maintenance5 A8, castable list other than A8_UNORM refused, DS/UAV still unsupported). No import or boot-chain changes in the diff, so runtime_imports.md and retail_boot_chain.md are not affected.
  • NOT tested: native Windows, AMD or Intel drivers (A8 blendability may differ), a GPU without VK_FORMAT_A8_UNORM_KHR (the fallback path only checked as the skipped branch above), Vulkan validation layers, any D3D12/WARP comparison.

agent: yes

@7ROBE

7ROBE commented Nov 23, 2026

Copy link
Copy Markdown

checked: #740314a459b | with: merged onto main@867d922f0 (clean, 11 files, +345/-23), cmake -DLEONIDA_VULKAN_HEADERS_FETCH=ON, ctest -R "^(d3d12_clear_formats|d3d12_descriptor|d3d12_draw|gfx10_descriptors)$", tests/test_gfx10_descriptors.py, check_no_game_data.py | on: Windows 11, MSVC 19.51.36263.0, AMD Radeon RX 9060 XT (26.11.2) | result: pass (4/4 ctest targets + 5/5 Python tests passed; VK_FORMAT_A8_UNORM_KHR RTV clear, draw, 3 alpha blends, and 256/256 clear format parity with WARP pass; negative control disabling a8_render_target creation in d3d12_vulkan_device.cpp fails d3d12_draw_test at line 894 exit 1; check_no_game_data.py clean)

agent: yes
AI-assisted.

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
d3d12: A8_UNORM render targets through VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5)

Fork integration. AI-assisted (Codex).
@isfcrctfs

Copy link
Copy Markdown

checked: #740314a459b | with: head-vs-forge-main comparison of the 18b0bfbaf→14a459bac delta (3 files, +22/-2; git apply --check on forge tip b516390: clean); fresh clone of origin/main (867d922f0) + git apply the PR (clean, 11 files +345/-23); python3.12 -I tests/test_gfx10_descriptors.py; cmake --build build --target gfx10_descriptors_test d3d12_descriptor_test and both run under Wine; negative control with the imported header | on: Linux, clang-cl 23.1.5 + lld-link against xwin SDK 10.0.26100, CMake 4.5.1, Wine 11.22-staging, llvmpipe (no GPU) | result: pass — an earlier revision of this PR is already in the forge main; the current head's +22/-2 delta is not, applies cleanly, and its tests pass here.

Import status:

Runs (base main@867d922f0 + 14a459bac; main has since moved to 6312c057, which touches only xgameruntime.cpp and pe_loader.*):

  • python3.12 -I tests/test_gfx10_descriptors.py: 5 tests OK.
  • gfx10_descriptors_test.exe: exit 0, "95 format rows and the Vulkan mappings OK".
  • d3d12_descriptor_test.exe: exit 0, including the new A8 sizing block. The device is llvmpipe: a8_render_target is false here ("A8_UNORM render targets need VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5); format 65"), so the A8 render-target path did not run; the sampled-A8 sizing block did. The test's shader-sampling part is not built without glslangValidator. Cross-build + Wine, not a Windows or GPU check.
  • Negative control: the head's tests/test_gfx10_descriptors.py against the imported 18b0bfbaf header gives FAILED (failures=1) — "94 != 95 : a table row does not have the form this test parses". The head's own table requires the delta's parser fix.
  • Not run: native Windows, real GPUs, WARP comparisons, the retail executable.

Audit: audit.py diff clean, diff read; no CI, build-script, network, submodule or binary changes; no game data. This comment adds the import-state comparison and a Linux/Wine run of the delta; the head itself already has native Windows checks on the thread from tedin7 and 7ROBE.

agent: yes
AI-assisted.

@byPreaZy

Copy link
Copy Markdown

checked: #7403 | with: applied the diff on main 6312c05, built d3d12_clear_formats_test, d3d12_descriptor_test, d3d12_draw_test, gfx10_descriptors_test (MSVC 14.44, Ninja RelWithDebInfo) | on: Windows 11, AMD Radeon RX 9060 XT (RDNA4) | result: PASS, first AMD check of this PR

  • gfx10_descriptors_test: T#, S# and V# fields, round trips, 95 format rows and the Vulkan mappings OK
  • d3d12_clear_formats_test: 256 matched WARP, 0 differ, A8_UNORM among the exposed formats
  • d3d12_descriptor_test: A8 mip round-trip, A8/R8 default+remapped views, A8 render target (VK_FORMAT_A8_UNORM_KHR) 64 texels matched each, A8 alpha gather 49 footprints matched
  • d3d12_draw_test: A8_UNORM render target clear, draw and 3 alpha blends matched, including with an A8_UNORM castable list (R8_UNORM refused); full suite green

The RX 9060 XT exposes VK_FORMAT_A8_UNORM_KHR with colour attachment and blend, so the maintenance5 path is confirmed on RDNA4, the GPU family this port targets.

AI-assisted check.

dadnotdaddy pushed a commit to dadnotdaddy/Leonida that referenced this pull request Nov 23, 2026
…VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5)

Squashed from ItsNotRexed#7403 by mrp1no, head 18b0bfb (security scan PASS).

Conflict in vk_test_device.h only: the test device enables both VK_EXT_external_memory_host (ItsNotRexed#7218) and VK_KHR_maintenance5 (this PR) when asked.
dadnotdaddy pushed a commit to dadnotdaddy/Leonida that referenced this pull request Nov 23, 2026
…as the host makes them

Squashed from ItsNotRexed#7755 by NiiRoZz, head 952be9b (security scan PASS).

Conflict with ItsNotRexed#7403 in texture_format: A8_UNORM takes 1D, 2D and 3D as this PR does, and a render target stays 2D only through ItsNotRexed#7403's VK_FORMAT_A8_UNORM_KHR path; depth-stencil and UAV flags and multisampling are refused as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.