Skip to content

d3d12: A8_UNORM textures in 1D and 3D, again; the retail frame loop then runs for minutes (RT-A8-DIMENSIONS) - #602

Closed
Mumogg wants to merge 3 commits into
ProjectLeonida:mainfrom
Mumogg:a8-dimensions
Closed

Mumogg wants to merge 3 commits into
ProjectLeonida:mainfrom
Mumogg:a8-dimensions

Conversation

@Mumogg

@Mumogg Mumogg commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in #14 as RT-A8-DIMENSIONS. Depends on: #428 (its two commits come first here; this pull request is the last commit). Independent of my stacked proxy pull requests.

What and why

The third description that device slot 25 refuses on the retail boot (after #427's and #428's) is a 1D A8_UNORM texture, 128 x 1, no flags. main only accepts A8_UNORM in 2D, so the log says GetResourceAllocationInfo format not supported yet: 65, slot 25 answers UINT64_MAX, and a worker thread of the title stops on its int3; a few seconds later the title's crash reporting ends the process (the 30 s exit I corrected in #432).

Commit 952be9b04 by NiiRoZz (old PR 7755; -x, authorship kept; an ancestor of main whose content is not in the tree): an A8_UNORM texture is an R8_UNORM image in 1D and 3D too, as the host makes all three, with d3d12_a8_dimensions_test.

The one conflict is with #428, which the commit predates: resolved as the original integration merge (a5c96e0dd) did. A 2D render target stays VK_FORMAT_A8_UNORM_KHR; every other A8 texture, in any dimension, is R8_UNORM; a render target that is not 2D is refused. The commit message says so.

Measured

Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, 300 s allowed, on main ece4ba5b3 with my stacked pull requests up to #432 and #142, #219, #328, #387.

--run without this (two runs) with this
How it ends exit 3 at about 30 s: the worker thread's int3, then the title's crash reporting exit 137 at 296 s: killed by the memory cap I run it under
Title exceptions in the startup trace 2 0
Traced D3D12 calls 537,677 and 577,901 5,069,510
CreatePipelineState ok 50,466 (4 failed) 50,466 (4 failed)
ExecuteCommandLists ok 26,400 278,135, none failed
XboxPresentation::PresentX ok 13,199 and 14,316 139,067, none failed

About the end of the long run, since I got this wrong once already: I read the exit line this time. Exit 137 is a kill, and the system journal for that run says The kernel OOM killer killed some processes in this unit with a 52 GB memory peak, which is the cap I set (MemoryMax=52G). The integration branch (#321) ends the same way at about the same time; there it is the NVIDIA compiler taking the title's largest compute modules. I have not confirmed that it is the same cause here.

Still open on this path: the four rectangle-list pipelines (primitive topology type not supported: 19), queue slot 31, the memory growth, and the picture, which I have not looked at.

Tests under Wine:

Test Result
d3d12_a8_dimensions (new with the commit) passed
d3d12_descriptor passed
d3d12_draw passed

Not built with MSVC and not run on Windows.

AI-assisted (Claude Code); built and run on the machine above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt

mrp1no and others added 3 commits November 23, 2026 22:55
…_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>
(cherry picked from commit 67950a8)
…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 #7403.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 18b0bfb)
texture_format refused every A8_UNORM texture that was not 2D, so GetResourceAllocationInfo answered
UINT64_MAX for a 1D one (a title's boot sizes a 128-texel 1D A8_UNORM texture and asserts on that size).
The host accepts A8_UNORM in 1D, 2D and 3D (the gap is listed by #4533's host sweep). They are R8_UNORM
images like the 2D ones; the SRV's alpha-only swizzle does not depend on the dimension. Format support
now names TEXTURE1D and TEXTURE3D too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 952be9b)

Adapted to main by Mumogg: resolved on top of the A8 render-target commits as the original integration merge
(a5c96e0) did: a 2D render target stays VK_FORMAT_A8_UNORM_KHR, and every other A8 texture, in any dimension,
is an R8_UNORM image.
@Dezmonius

Copy link
Copy Markdown
Contributor

Independent Windows A/B check. Windows 10 22H2 (19045), RTX 5070 (NVIDIA 610.88), Vulkan, MSVC 19.51.36256, Windows SDK 10.0.26100 and Ninja/Release.

Synthetic test #428 only (49b750a95) #428 + #602 (348dff3d3)
d3d12_a8_dimensions Fails at the CheckFeatureSupport dimension-bit assertion (line 101) Pass
d3d12_descriptor Pass Pass
d3d12_draw Pass Pass
d3d12_clear_formats Pass Pass

The control uses the same new test source and CMake registration, with no runtime changes. With #602, both textures reported 65,536-byte allocations. All 128 (1D) and 256 (3D) texels round-tripped, and both SRVs decoded to (0, 0, 0, A). The 2D A8 render-target test exercised clear, draw and all three alpha blends on both builds.

Synthetic tests only. No game files, no retail boot and no online gameplay. AI-assisted (Codex).

@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Independent check. Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION=1, merged onto main 82a2aab without conflicts, test targets rebuilt; RTX 5060 Ti (621.01) and a Ryzen 7 7700 iGPU (1002:164E, AMD 31.0.22044.1). On the iGPU the pipeline tests fail on plain main too (128 push-constant bytes), so they say nothing there.

  • d3d12_a8_dimensions_test: PASS on both GPUs (1D 128 and 3D 256 texels round-trip, SRV reads (0, 0, 0, A)).
  • d3d12_clear_formats_test, d3d12_descriptor_test: exit 0 on both GPUs; d3d12_draw_test, gfx10_descriptors_test: exit 0 on the RTX 5060 Ti. 0 VUID lines.

Reading note: in create_vulkan_device_standalone the push of VK_KHR_MAINTENANCE_5_EXTENSION_NAME sits inside the #ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME block. With headers that have maintenance5 but not maintenance8, the feature struct would be chained and a8_render_target set without the extension being enabled. Closing the maintenance8 block first fixes it. I did not build with such headers.

Synthetic tests only, no game files. AI-assisted (Claude Code): I read the diff and ran the tests on that machine.

demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…n 1D and 3D, again; the retail frame loop then runs for minutes (RT-A8-DIMENSIONS)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
@aslan2142

Copy link
Copy Markdown
Collaborator

Closing as carried: main makes A8_UNORM textures in 1D, 2D and 3D as R8 images and limits only render targets to 2D, since #984's integration.

Thanks.

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142 aslan2142 closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants