Skip to content

d3d12: A8_UNORM textures in 1D and 3D, as the host makes them - #7755

Open
NiiRoZz wants to merge 1 commit into
ItsNotRexed:mainfrom
NiiRoZz:d3d12/a8-unorm-1d-3d
Open

NiiRoZz wants to merge 1 commit into
ItsNotRexed:mainfrom
NiiRoZz:d3d12/a8-unorm-1d-3d

Conversation

@NiiRoZz

@NiiRoZz NiiRoZz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What was wrong

texture_format (runtime/shims/d3d12_vulkan_device.cpp) refused every A8_UNORM texture that was not 2D. So GetResourceAllocationInfo answered UINT64_MAX for a 1D or 3D one, and creation failed. The host makes all three: #4533's host sweep lists "A8_UNORM as 1D/3D" among the gaps it leaves alone.

Measured locally at a title's call sites: its boot sizes a 128-texel 1D A8_UNORM texture with no flags, then asserts that the size's upper 32 bits are zero. UINT64_MAX stopped it there.

The change

Test

New GPU test d3d12_a8_dimensions_test, for a 1D (128) and a 3D (8x8x4) texture:

  • format support names TEXTURE1D, TEXTURE2D and TEXTURE3D;
  • GetResourceAllocationInfo gives a size and CreateCommittedResource makes the texture;
  • bytes uploaded with CopyTextureRegion come back unchanged (128 and 256 texels);
  • the default SRV is a T# of the right image type (1D / 3D, extents included), in R8_UNORM's GFX10 format, with swizzle (0, 0, 0, X);
  • negative controls: ALLOW_UNORDERED_ACCESS and ALLOW_DEPTH_STENCIL are still refused in both dimensions.

Results on an RTX 5090:

  • With LEONIDA_VK_VALIDATION=1: passes, with no validation messages.
  • With the layer change taken out, the test fails (the format support check comes first).
  • d3d12_descriptor_test (covers the 2D A8 textures) still passes.

On a local integration branch (main plus open boot-path PRs), this was the next stop of the retail boot after about 78,000 D3D12 calls.

Not tested on the AMD iGPU.

🤖 Generated with Claude Code

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 ItsNotRexed#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>
@emirduran707

Copy link
Copy Markdown
Contributor

AMD data point for 952be9b04. Windows 11, AMD Radeon RX 9060 XT (RDNA4), AMD driver 26.10.44, MSVC 2022 RelWithDebInfo, LEONIDA_VK_VALIDATION=1, LEONIDA_VK_DEVICE=9060. Each test ran 3 times. Synthetic only, no game files: pass.

  • d3d12_a8_dimensions_test: exit 0 in 3/3, no validation messages.
    • A8_UNORM 1D: sized 65536 B, 128 texels round-trip, SRV reads (0, 0, 0, A)
    • A8_UNORM 3D: sized 65536 B, 256 texels round-trip, SRV reads (0, 0, 0, A)
  • d3d12_descriptor_test (2D A8 and the other descriptor cases): exit 0 in 3/3, with validation errors: 0 on its depth-SRV line.

AI-assisted (Claude Code).

@ECHOZwei

Copy link
Copy Markdown

Tested 952be9b046189b2c365a5be7dcece2d8c09471e4 on Windows (MSVC 14.51 / Visual Studio Community 2026, RelWithDebInfo, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION=1) on two GPUs (adding an AMD iGPU + RTX 4080 SUPER data point): pass

  • NVIDIA GeForce RTX 4080 SUPER (driver 621.01):
    • ctest --test-dir runtime/build -C RelWithDebInfo -R ^(d3d12_a8_dimensions|d3d12_descriptor)$ --output-on-failure: 2/2 passed (1.03s), 0 validation errors (A8_UNORM 1D & 3D round-trip + SRV (0, 0, 0, A) confirmed).
  • AMD Radeon(TM) Graphics iGPU (driver 25.10, LEONIDA_VK_DEVICE=AMD):
    • Same 2 tests with LEONIDA_VK_VALIDATION=1: 2/2 passed (0.93s, confirmed device: AMD Radeon(TM) Graphics (validation on)), 0 validation errors.
  • Built both targets cleanly (0 new warnings); git diff --check and python -I scripts/check_no_game_data.py pass cleanly.
  • Code audit: A8_UNORM -> R8_UNORM backing, dimension-agnostic (0, 0, 0, X) SRV swizzle, RTV/DSV/UAV/MSAA refusals, and CheckFeatureSupport(FORMAT_SUPPORT) TEXTURE1D/TEXTURE3D flags are all consistent.

AI-assisted.

@jlric

jlric commented Nov 23, 2026

Copy link
Copy Markdown

AI-assisted test on Wine 11.22, RTX 4070/NVIDIA 620.73.04. Adapted the source change onto a local stack with #7403. The synthetic A8 dimensions test passed. In boot, the previously refused 1D A8 allocations succeeded and the swapchain present count rose from two to ten. No visible image or movie decode confirmed.

@ebnimaa

ebnimaa commented Nov 23, 2026

Copy link
Copy Markdown

Independent Radeon RX 6700 XT verification for Leonida PR #7755
#7755

Tested on an AMD Radeon RX 6700 XT (RDNA2) running Windows 11 25H2
(26220.9836), AMD Adrenalin 26.10.1 (32.0.21045.16010), and Vulkan 1.4.315.
Both builds used MSVC 19.44.35227, Windows SDK 10.0.26100.0, and Release.
Both test executables reported the RX 6700 XT as the Vulkan device.

Baseline: dde82f2, the PR's parent.
Patch: 952be9b.
The baseline build included the PR's test source and CMake registration
so both revisions ran the same test against their respective runtime code.

  • d3d12_a8_dimensions failed on the baseline at the format-support assertion
    requiring 1D, 2D, and 3D flags. It passed on the PR, including five consecutive
    reruns.
  • On the PR, both textures reported a 65,536-byte allocation. All 128 texels
    in the 1D texture and all 256 in the 8 x 8 x 4 texture survived upload and
    readback byte-for-byte. Both default shader-resource view descriptors had
    the expected image type, dimensions, and alpha-only mapping (0, 0, 0, A).
    Both dimensions still rejected unordered-access and depth-stencil flags.
  • d3d12_descriptor passed on both revisions. Its optional sampling-shader
    checks were omitted because glslangValidator was unavailable.

CTest filter: ^(d3d12_a8_dimensions|d3d12_descriptor)$
All inputs were synthetic. Vulkan validation layers were unavailable for
this run. AI-assisted with Codex.

@lunarminus

Copy link
Copy Markdown

Retail boot result: Wine 11.22 on a Radeon 760M (RADV Mesa 26.3.1), my own 1.0.2.1 executable, gta6rt cross-built with clang-cl 23.1.5 + xwin. This PR clears the last slot 25 A8_UNORM size assert on my stack, in two runs out of two.

AI-assisted (Claude Code).

zneel added a commit to zneel/Leonida that referenced this pull request Nov 23, 2026
…does, on top of ItsNotRexed#7593

With ItsNotRexed#7593 merged the retail boot gets past the 2D A8_UNORM render target, then device slot 25 sizes a
128-texel 1D A8_UNORM texture with no flags and the layer answers UINT64_MAX (texture_format refused every
non-2D A8). The title asserts on the size's upper 32 bits. ItsNotRexed#7755 makes 1D and 3D A8 textures R8 images as
the host does; its change conflicts only textually with ItsNotRexed#7593's A8 block, so it is applied by hand: a
non-2D A8 render target stays refused, FORMAT_SUPPORT names TEXTURE1D and TEXTURE3D.

d3d12_descriptor_test: 1D (128) and 3D (128x8x4) A8 textures without flags are sized and created, with the
render-target flag refused (passes with LEONIDA_VK_VALIDATION=1 on an RX 9070 XT).

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

Copy link
Copy Markdown

Independent native Windows/Vulkan composition check: #7755 952be9b + #7403 18b0bfb + #7110 b8cbab6 on main a910490. The figure below is from the pinned combination, built with MSVC in a Racurs156 Runtime run. Windows 11 build 26200, RTX 4060 Ti, NVIDIA 621.01, Vulkan Validation Layers 1.4.369.

  • Through the console device's slot 25 (return storage first), the 128-wide 1D texture, an 8×8×4 3D texture and a 63×37 2D render target all sized to 65,536 B aligned to 65,536 B. Slot 25 returned its caller-owned storage, preserved its canaries and left the console layout/flags intact.
  • With the render-target capability disabled on the same Vulkan device, 1D and 3D still sized successfully, 2D render-target allocation returned the expected invalid size, and 1D render targets were refused in both modes.
  • 128/128 1D and 256/256 3D texels round-tripped; both default SRVs mapped to alpha. The separate draw, format clear, descriptor, GFX10 and proxy tests also passed. Vulkan validation reported zero diagnostics in the four GPU tests. The hosted job emitted the Windows artifact and has a separate sparse-queue test failure at vkCreateInstance.

The branch has synthetic inputs only. AI-assisted.

@Yoshi-OOF

Copy link
Copy Markdown

Confirmed on Windows 11 / Vulkan / RTX 5070 Ti (621.24). On the same local stack, the prior boot rejected 1D A8_UNORM allocation at slot 25; with the 1D/3D sampling change integrated alongside #7403 the allocation assertion was gone. A focused Vulkan test verified allocation, actual resource creation, and a default 1D SRV with the alpha-only channel mapping. The next observed stop was an unhandled access violation after unresolved ACP audio imports; the captured swapchain still had only black pixels.

wcd6 added a commit to wcd6/Leonida that referenced this pull request Nov 23, 2026
wcd6 added a commit to wcd6/Leonida that referenced this pull request Nov 23, 2026
…p the boot (RT-5 stops 24+)

Three fixes found on the retail boot, past the A8_UNORM stop:

- texture_format: the ItsNotRexed#7755/ItsNotRexed#7403 merge left two contradictory A8_UNORM
  blocks (one refused render targets, the other refused 1D/3D). A8_UNORM
  is now an R8_UNORM image in 1D/2D/3D and a VK_FORMAT_A8_UNORM_KHR render
  target in 2D, single-sampled, never DS or UAV.
- A colour texture with unordered access in a format the GPU cannot store
  to (the title's 2560x1440 B5G5R5A1 render target with UAV on NVIDIA) is
  made without storage usage instead of refused (Format::no_storage); a UAV
  on it is the zeroed descriptor, so its writes are dropped (logged once).
- d3d12_xs_desc_clean.h: drop_console_only_combinations drops UAV from a
  console depth-stencil texture that also allows it (the title's
  2560x1440 R32G8X24_TYPELESS one), which the PC runtime refuses; all four
  description cleaners (slots 25, 76, 127, 133) use it.

Slot 25 also names a refused description (dimension, format, size, mips,
samples, flags, layout) a few times; that is how the two textures above
were found.

Measured with --run --trace: the boot goes from the slot 25 assert at
2,327 D3D12 calls to 53,180 calls in 200 seconds, with tens of thousands of
pipelines built from the translated shaders and the title's submission
loop running (ExecuteCommandListsX, Signal, fence slot 12).
@sennecools

Copy link
Copy Markdown

Tested 952be9b04 on Windows 11, RX 9070 XT (driver 32.0.32029.2010), own 1.0.2.1 copy: pass. A retail before/after on native Windows with the AMD driver, to go with the Wine/RADV and NVIDIA ones above.

Merged into a local integration tree: the shared rt5-integration branch plus #7516, #7330, #7323, #7201, #6891, #7403, #7286, #7949, #7880, #7514, #7555, #7679 and #7290, with the fully translated shader corpus. The A8 block conflicts with #7403; resolved as @lunarminus describes: #7403's path for 2D render targets, this PR's R8_UNORM image for every other A8 texture.

Not run here: d3d12_a8_dimensions_test alone, other GPUs. AI-assisted.

@akimfomin

Copy link
Copy Markdown

A41 native NVIDIA check of the current A8 pair | base: main@867d922f + #7403 14a459ba + #7755 952be9b0 | on: Windows 11, RTX 4070 Ti SUPER (617.14), portable LLVM/MinGW. The single source conflict is in texture_format(). I kept #7755’s 1D/2D/3D sampled R8 path and kept #7403’s 2D restriction inside the render-target branch, where A8_KHR still requires the device capability. The merged format-support bits report all three texture dimensions.

  • Stock d3d12: A8_UNORM textures in 1D and 3D, as the host makes them #7755 dimensions fixture passed on its own head and on the merged runtime. The direct d3d12: A8_UNORM textures in 1D and 3D, as the host makes them #7755 parent fails at the expected feature-bit assertion. The merged fixture round-trips 384/384 bytes and checks alpha-only SRV metadata.
  • Merged native probe: a 128×1 1D texture and an odd 7×5×3 volume both sized and allocated at 64 KiB default and 4 KiB explicit alignment with the A8 attachment capability both on and off (8/8).
  • Real maintenance5 2D A8 full and rectangular clears read back 15/15 expected alpha bytes. Disabling only the attachment capability rejected that 2D render target and left all sampled cases working. The isolated format-selection matrix also passed 72/72.

All merged objects and tests used the merged headers. Portable build used SDK COM declaration compatibility and an unused fail-fast DXGI adapter. Offscreen synthetic data only, no validation layer or retail run. AI-assisted (Codex).

@pvfreis

pvfreis commented Nov 23, 2026

Copy link
Copy Markdown

checked: #7755952be9b | with: d3d12_a8_dimensions_test d3d12_descriptor_test gta6rt, ctest -R "^(d3d12_a8_dimensions|d3d12_descriptor)$" | on: Windows 11 26H2 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo, RTX 3060 617.14 | result: pass, 2/2
negative control: runtime/shims/d3d12_vulkan_device.cpp reverted to the merge-base dde82f27e, test kept | result: d3d12_a8_dimensions fails at its TEXTURE1D/2D/3D format-support check (line 101), so the test catches the change

AI-assisted (Claude Code).

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7755 | with: clang-cl/xwin cross-build via fast_test_exe.sh (Ninja, ccache), target d3d12_a8_dimensions_test, run under Wine on the host Vulkan driver | on: Ubuntu Linux, Wine 9.0, NVIDIA GeForce RTX 4090 (Vulkan, subgroup 32), main@867d922f0 + #7755 (952be9b; merged cleanly, no conflicts) | result: d3d12_a8_dimensions: PASS (exit 0): A8_UNORM 1D sized 65536 B with 128 texels round-trip and SRV reads (0,0,0,A); A8_UNORM 3D sized 65536 B with 256 texels round-trip and SRV reads (0,0,0,A). Negative control: with runtime/shims/d3d12_vulkan_device.cpp put back to main and the PR's test kept, the test fails (exit 1) at line 101, the format-support check for TEXTURE1D, TEXTURE2D and TEXTURE3D bits. Diff matches docs/d3d12_vulkan.md (A8_UNORM 1D/2D/3D, RT/DS/UAV still unsupported); no defect found. NOT tried: CTest registration (ran the exe directly), other GPUs or a software Vulkan driver, the retail executable, mip chains on 1D/3D.
agent: yes

@7ROBE

7ROBE commented Nov 23, 2026

Copy link
Copy Markdown

checked: #7755952be9b | with: merged onto main@867d922f0 (clean, 4 files, +245/-3), cmake -DLEONIDA_VULKAN_HEADERS_FETCH=ON, ctest -R d3d12_a8_dimensions, check_no_game_data.py | on: Windows 11, MSVC 19.51.36263.0, AMD Radeon RX 9060 XT (26.11.2) | result: pass (d3d12_a8_dimensions: 1/1 passed in 0.58 s; 1D 128 texels and 3D 256 texels round-trip, SRV reads (0,0,0,A); negative control with runtime/shims/d3d12_vulkan_device.cpp reverted to main fails at line 101 exit 1; check_no_game_data.py clean)

agent: yes
AI-assisted.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7755 | with: merge of PR head onto main, then d3d12_a8_dimensions_test (new) and d3d12_descriptor_test (the closest existing A8 coverage) (cross-built, run under Wine), plus a negative control | 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). | result: pass; the new test runs the real Vulkan device and fails without the change; one merge conflict with #7403

  • PR head tested: 952be9b, merged (clean) onto origin/main 867d922.
  • d3d12_a8_dimensions_test: exit 0 on the RTX 4090 Vulkan device: "A8_UNORM 1D: sized 65536 B, 128 texels round-trip, SRV reads (0, 0, 0, A)", "A8_UNORM 3D: sized 65536 B, 256 texels round-trip, SRV reads (0, 0, 0, A)", "PASS". This is not a skip; it uploads, copies back and compares bytes, and checks the T# image type and swizzle.
  • d3d12_descriptor_test: exit 0 (existing A8 2D views, unchanged behaviour).
  • Negative control: with d3d12_vulkan_device.cpp reverted to main and the PR's test kept, the test exits 1 at line 101, the "format support names TEXTURE1D, TEXTURE2D and TEXTURE3D" check. (A first control run died from a Wine prefix error in /dev/shm, exit 53; I reran it alone.)
  • Diff review (4 files, no game files): the change drops only the "not 2D" refusal for single-sampled A8_UNORM and adds TEXTURE1D and TEXTURE3D to the reported support. Render target, depth-stencil and unordered access stay refused in both dimensions (the test checks the two refusals for each of 1D and 3D). The size comes from the same R8_UNORM image path as 2D, which the host also uses. The doc line is updated to match.
  • Concern: this PR and d3d12: A8_UNORM render targets through VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5) #7403 both rewrite the same if (desc.Format == DXGI_FORMAT_A8_UNORM ...) block in DeviceState::texture_format and both edit the A8 CheckFeatureSupport code; each merges with main alone, but merging d3d12: A8_UNORM render targets through VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5) #7403 onto this PR's merge gives a content conflict in runtime/shims/d3d12_vulkan_device.cpp. Whichever lands second has to be rebased by hand, and the merged result needs a re-run of both A8 tests.
  • Not verified: other GPUs or drivers, the 1D/3D mip and array cases (the test is single-mip, single-slice), d3d12_clear_formats_test (it needs WARP, which fails here on main too), and anything on native Windows or with the retail title.

AI-assisted.

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
d3d12: A8_UNORM textures in 1D and 3D, as the host makes them

Keep native A8 for supported 2D render targets and use R8 backing for sampled 1D, 2D, and 3D A8 textures.

Fork integration. AI-assisted (Codex).
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.