d3d12: A8_UNORM render targets through VK_FORMAT_A8_UNORM_KHR, again (RT-A8-TARGET) #428
Closed
leonida/mandy
Mumogg wants to merge 0 commits from
a8-render-target into main
pull from: a8-render-target
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!428
Loading…
Reference in a new issue
No description provided.
Delete branch "a8-render-target"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
Claimed in #14 as
RT-A8-TARGET. Independent of my other open pull requests: it is based onmainalone and touches the Vulkan layer, not the proxy.What and why
The retail title's first native pipelines name an A8_UNORM render target, and it sizes one at 3840 x 2160 through device slot 25.
mainstores every A8_UNORM texture as R8_UNORM and refuses it as a render target: the log saysGetResourceAllocationInfo format not supported yet: 65, slot 25 answersUINT64_MAX, and a worker thread of the title stops on its ownint3.Two commits by mrp1no (
-x, authorship kept; ancestors ofmainwhose content is not in the tree):67950a8d5: where the GPU hasVK_KHR_maintenance5and can sampleVK_FORMAT_A8_UNORM_KHRand blend it as a colour attachment, an A8_UNORM texture created withALLOW_RENDER_TARGETis stored in that format; its views, the format support answers and the copy paths follow. Other A8_UNORM textures stay R8_UNORM, and a device without the format refuses A8 render targets as before.18b0bfbaf: an A8 render target's castable list takes its own format and refuses the others.The first commit conflicted in two places. In
d3d12_vulkan_device.cppit was written against the olderr9g9b9e5_as_r32_uintmember thatmainhas since replaced withuint_backed: I keptmain's member and added only the commit'sa8_as_alphanext to it, and in the render-target-view code the A8 case goes beforemain'suint_backedcases. Invk_test_device.hboth extensions are enabled.Measured
Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08, has
VK_KHR_maintenance5), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off. The boot runs are onmainece4ba5b3with my stacked pull requests and #142, #219, #328 and #387, because the stop is only reached that far in.--runCreatePipelineState okint3on the refused sizeSo this is what lets the title go on to create its pipelines on this path. The null call that ends the run is a queue method forwarded to the wrong PC method; that is my pull request for
RT-QUEUE-SIGNAL.Tests under Wine, the four the first commit touches:
d3d12_descriptord3d12_drawgfx10_descriptorsd3d12_clear_formatsmainunder this WineNot built with MSVC and not run on Windows, and not run on a GPU without
VK_KHR_maintenance5.AI-assisted (Claude Code); built and run on the machine above.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Reviewed 49b750a9 and tested under Wine on Linux with an RTX 3060. I found two Vulkan validation issues:
Eight of nine focused tests passed on both the PR and baseline. d3d12_clear_formats failed on both: the PR also had five A8 differences against Wine's hardware reference. An independent readback showed Leonida writing alpha and the Wine reference writing red, so I can't treat those differences as a confirmed Leonida defect.
A red-for-alpha mutation failed the checked-in draw test. I did not test the stacked retail boot path.
AI-assisted review and validation.
A 1D A8_UNORM texture is refused. On native Windows, with this PR stacked on
mainand the other carved pieces (details in #321), the title'sGetResourceAllocationInfogets aTEXTURE1DA8_UNORM, 128x1, 1 mip, 1 sample, flags 0.texture_format()returns{}for any A8 that isn'tTEXTURE2D(GetResourceAllocationInfo format not supported yet: 65). The title then stops on anint3.Only the alpha render target needs single-sampled 2D. A sampled-only A8 texture already falls through to
texture_storage_format()as R8_UNORM, and its views select X into alpha whatever the dimension. With this change the run got past that stop and was still in its frame loop at 300 s:This is checked only by the title getting past that stop. There's no unit test for 1D A8 sampling yet, and I haven't checked the sampled values. AI-assisted (Claude Code).
A small addition for this PR, found booting the retail executable on top of it: the title also asks for a sampled-only A8_UNORM
TEXTURE1D(128x1), andtexture_formatrefuses every A8 that is not single-sampled 2D, so itsGetResourceAllocationInfofails. Only the render-target case needs that limit; a sampled A8 is an R8 image of any dimension whose views swizzle X into alpha:With it the allocation succeeds and boot goes on (Windows 11, RTX 4070 SUPER). Feel free to fold it in; I can open a separate PR instead if you prefer.
AI-assisted (Claude Code).
Confirmed the mixed-backing copy issue from the earlier review on native Windows 10 22H2 (19045), RTX 5070 / NVIDIA 610.88, and MSVC 19.51.36256. Tested #428 head
49b750a95with Khronos validation layer 1.4.369 enabled.The synthetic probe uses two 4x4 D3D12
DXGI_FORMAT_A8_UNORMtextures. The render target is backed byVK_FORMAT_A8_UNORM_KHR; the ordinary texture is backed byVK_FORMAT_R8_UNORM. It uploads a known pattern, copies either the whole texture or a 3x3 region with a nonzero source offset, then reads the destination back.CopyResourceVUID-vkCmdCopyImage-srcImage-01548per runCopyTextureRegionThe checked-in
d3d12_descriptor,d3d12_drawandd3d12_clear_formatstests also passed with validation enabled. This check covers mixed-format copying. The separate maintenance5 extension-enable finding was outside this run.Synthetic data only; no game files or retail boot. AI-assisted (Codex).
Follow-up to my Windows validation report above: I tested a local proof of concept on
49b750a95that routes the two mixed A8/R8 backing directions through the existing image → transfer scratch buffer → image path inruntime/src/vulkan_replay.h. Same-format copies still take the existing path.On Windows 10 22H2, RTX 5070 / NVIDIA 610.88 and Khronos validation 1.4.369, the four previously failing synthetic copy runs now produce zero validation errors and all texels match (16/16 for
CopyResource, 9/9 for the offsetCopyTextureRegion, in both directions). All four same-backing controls are still clean.Five checked-in tests passed with validation enabled:
d3d12_descriptor,d3d12_draw,d3d12_clear_formats,d3d12_copy_xfmtandd3d12_subresource_copy. The proof of concept covers single-sampled textures and the copy finding. The separate maintenance5 enablement finding was outside the experiment.Synthetic results only. AI-assisted (Codex).
Measured a case this PR refuses that it should accept, on the retail 1.0.2.1 title (native Windows, RTX 3070, driver 32.0.16.1692, with the #432 stack this PR is part of).
DeviceState::texture_formatapplies the render-target limits (single-sampleTEXTURE2D, no depth-stencil, no UAV) to everyA8_UNORMtexture before it checksALLOW_RENDER_TARGET. The title creates a plain 128×1TEXTURE1DA8_UNORMwith no flags, which this returns{}for. Slot 25 then answersUINT64_MAX(GetResourceAllocationInfo format not supported yet: 65), and the title stops on anint3atgame_scarlett_master.exe+0x344196. It looks like the same assert RT-A8-TARGET describes, but for a texture that isn't a render target. The struct comment andtexture_storage_formatalready say non-render-target A8 textures are R8_UNORM images; this early return just keeps them from getting there.Moving the limits into the render-target branch fixes it:
With that change, plus the runtime-device pipeline cache from #1308, the boot runs its frame loop for the whole 10-minute window I gave it: 13,838
PresentX ok, 55,353ExecuteCommandLists, no exception. One thing I haven't checked: whether a non-render-target A8 texture withALLOW_UNORDERED_ACCESSshould also go to R8 (this patch lets it, since R8_UNORM has storage support). Happy for you to take it into this PR, or I can open a follow-up once this lands. AI-assisted (Claude Code).This conflicts with
main, and it's on the path to the frame loop, so here's a rebase to save a step:rebased/pr428(f02056610). It has the same 2 commits and authors onmain4a50cafc7.git range-diffagainst this branch shows no commit's own change was altered.Both conflicts were add/add. I kept both sides:
runtime/shims/d3d12_vulkan_device.cpp, render-target loop: this PR's A8 choice (VK_FORMAT_A8_UNORM_KHRwhena8_render_target), thenmain's B4G4R4A4 → RGBA8 fallback, then the existingVK_FORMAT_UNDEFINEDrefusal, unchanged.runtime/test/vk_test_device.h:main'srequest_depth_range_unrestricted/depth_range_unrestricted, then this PR'sa8_render_target.Not compiled or run here: I have no Windows SDK on this machine, so CI is the first build.
To take it (maintainer edits are on):
AI-assisted.
Closing as carried:
mainhas A8_UNORM render targets since #984's integration, so there is nothing left to merge.VK_FORMAT_A8_UNORM_KHRimage underVK_KHR_maintenance5(runtime/shims/d3d12_vulkan_device.cpp), with the castable-list rule, and the GFX108_UNORMdescriptor row for it is inruntime/src/gfx10_descriptors.h.d3d12_a8_copy_test), and maintenance5 is enabled under its own guard.mainfinds 287 of the 293 lines this adds; the rest are comment wording.Thanks to mrp1no, and to moffington and Dezmonius for the reviews.
AI-assisted (Claude Code, Claude Opus 5.5).