RT-STATE-AUDIT-FORMATS: accept R16_UNORM in D16_UNORM depth ResolveSubresourceRegion #2482
Closed
leonida/mandy
lixonik wants to merge 0 commits from
rt-state-audit-formats-d16-resolve into main
pull from: rt-state-audit-formats-d16-resolve
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!2482
Loading…
Reference in a new issue
No description provided.
Delete branch "rt-state-audit-formats-d16-resolve"
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.
Part of
RT-STATE-AUDIT-FORMATS(#2464; based on the format-state audit notes in #1608 by@kevincommitsand@Tauwni).Summary
DXGI_FORMAT_R16_UNORM->{DXGI_FORMAT_D16_UNORM, plane 0}todepth_stencil_resolve_supportedinruntime/shims/d3d12_vulkan_device.cpp, matching the existing depth-plane shader-resource format mappings (R32_FLOAT,R24_UNORM_X8_TYPELESS,R32_FLOAT_X8X24_TYPELESS) soResolveSubresourceRegionacceptsDXGI_FORMAT_R16_UNORM(MIN,MAX, andAVERAGE) onD16_UNORMandR16_TYPELESSdepth buffers.Tests
runtime/test/d3d12_depth_resolve_test.cpp: addedD16_UNORM(MIN/MAX),D16_UNORMasR16_UNORM(MIN/MAX/AVERAGE, clear + diagonal edge draw, full + rectangle),R16_TYPELESSasD16_UNORMandR16_UNORM, and refusedD16_UNORMAVERAGE(matching hostE_INVALIDARG). Mixed-sampleD16AVERAGEedge draws allow 1 LSB (1/65535) rounding tolerance between Vulkan and D3D12 hardware resolves; all clear cases and allMIN/MAXcases require exact byte equality.Negative control & verification
main(ec91d695c),d3d12_depth_resolve_testfailed allD16 depth as R16_UNORM(MIN,MAX,AVERAGE, full & rectangle, clear & edge) andR16_TYPELESS depth as R16_UNORMcases withClose 0x80070057(E_INVALIDARG).ctest -R "^d3d12_depth_resolve$": Passed (119/119 match on NVIDIA GeForce RTX 5070 D3D12, 85/93 match on WARP, 204 host comparisons matched, 8 refusals alike, 24 edge MIN/MAX pairs differ).python scripts/check_no_game_data.py: clean.python -m unittest tests/test_ctest_registration.py: 6/6 OK.git diff --check: clean.GPUs tested: NVIDIA GeForce RTX 5070 (Windows 11, native Vulkan + native D3D12 + WARP;
VK_LAYER_KHRONOS_validationnot installed locally).AI-assisted (Antigravity, Gemini).
Independent gfx906 RADV / Wine A/B: all 13 R16_UNORM cases changed from E_INVALIDARG on main to fenced readbacks with the PR. The three rejection controls stayed rejected, and the four one-unit AVERAGE differences were all exact half-word ties. Test report.
Independent Linux/Wine + NVIDIA RTX 3070 Ti review/test at
913152909(merged cleanly onorigin/mainc0201a806,wine-11.22, NVIDIA620.73.04). AI-assisted.depth_stencil_resolve_supportedmapsDXGI_FORMAT_R16_UNORMtoDXGI_FORMAT_D16_UNORMplane 0 alongside the other depth plane formats, andd3d12_depth_resolve_testcovers 16-bit UNORM readback,R16_TYPELESS, andD16AVERAGE refusal.d3d12_depth_resolve(Wine/Vulkan RTX 3070 Ti): PASSED (Vulkan resolve modes: depth 0x2f, stencil 0x2d;13 refusals kept the destination, 0 modes the device lacks were refused; 24 edge MIN/MAX pairs differ; host D3D12 comparison skipped under Wine as expected).Merge test for the #2464 campaign on an 8 GB laptop (profile M), taken over from MoonEyes' card. Main ec91d695c was merged without conflict, in one tree together with #2482 and #2483. The numbers were recomputed from the raw logs. AI-assisted (Claude Code, Claude Opus 5.5).
d3d12_depth_resolve_testfrom this head: exit 0. Built against main ec91d695c it fails:D16 depth as R16_UNORM AVERAGE rect 1: Close 0x80070057, destination differs from the clears(the same for R16_TYPELESS), exit 1. The fix is shown.Tested on a Mac under Wine (Apple M3, macOS 26.5.1, Wine 11.0 with its MoltenVK 1.4.1), merged onto
main43a9d562d. Profile S, no game files.d3d12_depth_resolvefails here, but on the test's exact-bit comparison, not on the change. (MEASURED)D16 depth,D16 depth as R16_UNORMandR16_TYPELESS depth as D16 MIN, whole subresource and rect. With the test file alone onmainthe same cases fail, plus the R16_UNORM refusals this PR fixes.got 16383 expected 16384in all 9.round(0.25 * 65535)is 16384, so the Apple GPU stores 0.25 rounded down.same_planesaccepting 1 LSB for every D16 case (today it does only for AVERAGE edges), the test passes here.So for Macs, either the 1-LSB tolerance for all D16 comparisons, or a clear value D16 holds exactly (e.g.
16384 / 65535.0finstead of0.25f), would keep this test meaningful. The D32 and D24 cases pass unchanged.AI-assisted (Claude Code). I'm at the PR limit, so this is a report only.
@Tauwni Thanks for testing on Apple M3 and isolating the D16 clear rounding!
Updated d3d12_depth_resolve_test.cpp in $sha to apply same_planes's existing 1-LSB (1/65535) tolerance to all D16_UNORM comparisons (while keeping D24 and D32 bit-exact). Re-verified on NVIDIA GeForce RTX 5070 (Windows 11, driver 610.88, Vulkan 1.4.341, MSVC 19.44; VK_LAYER_KHRONOS_validation not installed locally): d3d12_depth_resolve passes (5.56 s; 119/119 vs RTX 5070, 93/93 vs WARP, 212 host comparisons matched, 13 refusals kept the destination, 24 edge MIN/MAX pairs differ).
AI-assisted (Antigravity, Gemini).
Reviewed at head
fd07437bdon Windows 11 (MSVC 202219.44) with dual-GPU Vulkan validation (LEONIDA_VK_VALIDATION=1, Vulkan SDK1.4.363.0).Verification
d3d12_depth_resolve_test.d3d12_depth_resolve_test(LEONIDA_VK_VALIDATION=1): passed with 0 validation errors on both NVIDIA GeForce RTX 5080 (616.64) and AMD Radeon(TM) Graphics (25.10.30.02).Notes
DXGI_FORMAT_R16_UNORMforD16_UNORMdepth plane 0 inResolveSubresourceRegionwhile preserving colorR16_UNORMresolves, keepingAVERAGEwithD16_UNORMrefused, and enforcing matching formats/planes/sample counts (d3d12_vulkan_device.cpp:21471-21528) is clean and well-tested.Approve.
AI-assisted review + local MSVC/dual-GPU verification.
Verified
fd07437bdmerged with1bc055e6cunder Linux Wine 11.0 on physical gfx906, RADV Mesa 26.0.8, with synchronization validation. All 13R16_UNORMcases went fromE_INVALIDARGatClose()on main (no resolve submitted) toS_OKand fenced readback on the merge: 12 typed D16 cases covering MIN/MAX/AVERAGE, full/rectangle, clear/diagonal edge, plus the typeless rectangular AVERAGE case.In the matched 25-case D16 fixture, successful resolves went from 9 to 22. The three rejection controls stayed rejected and left the destination unchanged, including AVERAGE named as
D16_UNORMrather thanR16_UNORM. Clear, MIN and MAX words were exact. Of the edge AVERAGE results, four words differed by one from ties-to-even, all at exact half-word ties: for example, 40959 for a mean of 40959.5. No non-tie word or guard differed.The edge shader was active. These are shader-layer readbacks through Wine, not a native D3D12 or WARP comparison. The full PR test source compiled; the run used its D16-only instrumented fixture on both trees. No shader-run validation errors or synchronization hazards.
AI-assisted.
Independent verification on this machine (Windows 11, MSVC 19.44.35226, RTX 4090), and the negative control reproduces the exact error the commit removes.
1. It applies.
merge-treeclean; both commits cherry-pick ontomain0ae217cebwithout a conflict. Two files:d3d12_vulkan_device.cppand the depth-resolve test.2. It builds and passes, three times:
d3d12_depth_resolve_test.exe-> exit 0, 0, 0.3. With
main's shim (test from the PR kept, binary confirmed rebuilt at 07:07:53):0x80070057isE_INVALIDARG, and it is raised on the very format pairing the commit accepts - a D16_UNORM depth target resolved through an R16_UNORM view. So this is a red->green with the failing error named, not a test agreeing with itself.What the second commit does and I did check: it relaxes the test to allow 1 LSB of D16 rounding on the destination, which is a tolerance rather than an assertion about behaviour. It is worth a reviewer's eye: the accept path is proven by the first commit, and the tolerance only affects how exact the comparison is after the resolve.
What I did not test: a resolve on a real D16 target with content, which needs the title's depth traffic; the test stages the formats and reads back the result.
Written with an AI assistant.
RTX 3090 / 621.40, validation on, fd07437bd merged onto main 20fe0c754: d3d12_depth_resolve 96 of 119 match (main 74 of 97), the 22 new cases all match; WARP 93/93 (main 71/71). No validation errors.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.