d3d12: an integer render target bypasses its blender (D3D-INTEGER-TARGET-BLEND-BYPASS) #2023
Closed
leonida/mandy
BubsMcgee wants to merge 0 commits from
fix/integer-target-blend-bypass into main
pull from: fix/integer-target-blend-bypass
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!2023
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/integer-target-blend-bypass"
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.
Ports the first concrete gap from DexNom/VIctory (source-only Rust runtime,
GPL-3.0-or-later), commit
ddb7332, reimplemented for this Vulkan layer.What
blendEnable = VK_TRUE. The layer clears the enable forthat target only, keeps its
colorWriteMask(and every other target's state), and no longer counts it as adual-source consumer.
CB_BLENDnregardless of the format, and D3D12Xbox bypasses the blender oninteger surfaces. PC D3D12 rejects that state at pipeline creation, and Vulkan requires
blendEnable = VK_FALSE(VUID-VkPipelineColorBlendAttachmentState-blendEnable-04727), so forwarding it couldonly fail the pipeline — the failed-
CreatePipelineStateclass reported on RADV in #1915.Test
d3d12_pso_validation_test§3b creates a layer-only pipeline with anR8G8B8A8_UINTtarget, blending enabledand a red write mask. PC D3D12 rejects the same state, so it is deliberately not in the parity set.
PASS (61 layer checks, 100 host comparisons), with the plain run andwith
LEONIDA_VK_VALIDATION=1.Attribution
Adapted from DexNom/VIctory
ddb7332(GPL-3.0-or-later), "Restore 40 shader variants and repair integer-targetblending"; noted in the code comment. AI-assisted.
Claimed as
D3D-INTEGER-TARGET-BLEND-BYPASSin the coordination issue.Ready for review: integer-target blending bypass (no blend state on integer RTVs, dual-source excluded for integer targets), from DexNom/VIctory ddb7332. New layer-only PSO test added; d3d12_pso_validation_test is 61/61 layer checks and 100/100 host comparisons plain and with LEONIDA_VK_VALIDATION=1 on an RTX 3080 Ti (616.64). Mergeable; the red status is the repo-wide checks backlog.
Tested for RT-STATE-AUDIT-PIPELINE on a Mac: Apple M3, macOS 26.5.1, Wine 11.0 (WineHQ macOS build, its MoltenVK 1.4.1), clang-cl/lld-link 23.1.6 cross build. Merged onto
main2859d0c9b, no game files.d3d12_pso_validation,d3d12_draw,d3d12_depth24_draw,d3d12_bundleandgfx10_descriptorspass. Same asmain, no regression.d3d12_pso_validation_test.cppalone onmain, without the fix: the test fails. So it is a test that fails onmainand passes with the change (MEASURED, 1 run each).GPUs tested: Apple M3 (profile S), MoltenVK 1.4.1 under Wine.
AI-assisted (Claude Code, Claude Opus 5.5).
CORRECTION to my comment above (https://github.com/ubiquitarianism/leonida/pull/2023#issuecomment-7217902801).
Wrong line: "This PR's
d3d12_pso_validation_test.cppalone onmain, without the fix: the test fails. So it is a test that fails onmainand passes with the change."What I measured since (2 runs each, Apple M3, Wine 11.0 with its MoltenVK 1.4.1,
main2859d0c9b):main, the test printsPASS (60 layer checks, 0 host comparisons), so its §3b check passes there. On this driver, creating the pipeline with blending on anR8G8B8A8_UINTtarget succeeds, so §3b doesn't catch the bug on MoltenVK. Only the validation layer would. (60, not 61: theLogicOp XORcase skips because this MoltenVK has nologicOp.)So on a Mac under Wine, this test neither fails on
mainnor shows the fix. Your RTX 3080 Ti run and RADV remain the evidence for it. What still holds: no regression with the PR in the other four tests.AI-assisted (Claude Code, Claude Opus 5.5).
Reviewed and tested merged onto
main(493867366) on Windows 11 + NVIDIA GeForce RTX 5070 12 GB (MSVC 19.44, Ninja Release).integer_color_format()covers all 21 D3D12 integer render-target formats (includingR10G10B10A2_UINT), and both thedual_sourcecheck andblends[i].blendEnableclear blending for integer targets while preservingcolorWriteMask, satisfyingVUID-VkPipelineColorBlendAttachmentState-blendEnable-04727.d3d12_pso_validation_test: the new case3b(gfx: integer target bypasses blending) passed on RTX 5070. (Note: the later pre-existing parity check at line 460gfx: Flags=DYNAMIC_DEPTH_BIASfails on this host because Windows 11 inbox D3D12 without the Agility SDK returnsE_INVALIDARGforDYNAMIC_DEPTH_BIAS, unrelated to this PR.)GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341;
VK_LAYER_KHRONOS_validationnot installed locally).AI-assisted (Antigravity, Gemini).
Verified the integer-target bypass on physical gfx906 (RADV Mesa 26.0.8, Linux Wine 11.0), main
aa918e5d9versus8536bcb4emerged into it. The stock red-only UINT case can returnS_OKbefore a Vulkan pipeline exists in lazy mode. At actual pipeline creation, main emittedblendEnable=1for a non-blendable integer attachment; the merge emitted0and kept the red-only write mask. The test intercepted and corrected main’s invalid enable before forwarding. Its pixels are therefore a control, not evidence that unmodified main draws correctly.On the merge, both fenced 4 × 3 draws changed only the six covered red channels and preserved the other channels and pixels. Normalized blending and a mixed integer/UNORM render-target pair also produced the expected output. No validation errors or synchronization hazards in the submitted runs. The SRC1 control did log warnings: output type mismatch on main, unused fragment output on the merge.
Remaining feature-off case: with
dualSrcBlendexplicitly disabled, main refused the integer SRC1 case before Vulkan. The merge disabled blending but still suppliedSRC1_COLORandSRC1_ALPHAin the pipeline description. The test withheld that creation before the driver: the feature-off restrictions on those factors (VUIDs 00608–00611) still apply. Use non-SRC1 factors for the bypassed attachment and keep this as a distinct control.AI-assisted.
TAKEN by OreoFR (Windows, RTX 4070 8 GB)
Verified by OreoFR — NO RED (the new check passes on main too)
d3d12_pso_validationpasses on main, also withLEONIDA_VK_VALIDATION=1(PASS (61 layer checks ...), no VUID-04727 reported): on this driver main's layer already returns S_OK for an R8G8B8A8_UINT target with blending on, and the check only reads the HRESULT.d3d12_pso_validationpasses; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p4 = main + #2023 + #2090 (no shared files): 505 tests, new failures vs main: none from this PR (vk_presenter_sparse_capturefails in this package because of #2090, see there;xmem_no_write_watch,xmem_write_watch,d3d12_multithreadandd3d12_queue_wait_timeoutpass when re-run alone; main alone: 505 tests, 6 failures: big_compile_gate and api_ref_state and d3d12_queue_wait_timeout timeouts, xs_proxy_mock, vk_compile_gate_calibration, xbox_present)LEONIDA_CARGO=OFF,LEONIDA_XMA2_DECODER_LIBempty) in package p4; imports unchanged vs main (25 DLLs, 755 functions, no WS2_32)integer_color_formatlists the DXGI UINT/SINT colour formats, the blend enable is cleared for them (the write mask is kept), and they no longer turn on dual-source blending. The GPL-3.0-or-later attribution to DexNom/VIctory matches this repository's GPL-3.0 licence. The test would show the fix if it also checked the created pipeline'sblendEnableor counted validation errors.AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
Heads-up from a negative control: the new case 3b in this branch passes with
main's shim too, so it does not detect the change it accompanies.1. It applies and builds.
merge-treeclean ontomain012b79a67;d3d12_pso_validation_testbuilds.2. With the branch its test passes:
3. The control - revert only
runtime/shims/d3d12_vulkan_device.cpp, keep the test:4. Why, and it is visible in the new case itself. Case 3b builds a graphics pipeline with
RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UINT, blending enabled and a RED write mask, then asserts:The only thing it asserts is that creation succeeds. The change in the shim is about what state the layer emits - forcing
blendEnable = VK_FALSEfor integer colour targets becauseVUID-VkPipelineColorBlendAttachmentState-blendEnable-04727requires it. Creation succeeds onmaintoo, so the case cannot fail in the way it exists to catch.What would detect it: inspect the created pipeline's blend state (or the Vulkan side of it) and assert
blendEnable == VK_FALSEand thatRenderTargetWriteMasksurvived as RED. The comment above the case already says "the target's write mask must survive" - the assertion just is not there.What I am not saying: that the change is wrong. The shim's rule is the correct one for Vulkan; what is missing is a test that fails when the rule is not applied. I did not edit the test - that is the author's call, and a stranger rewriting an assertion would be guessing at what they meant to check.
Why I am commenting: I verify open pull requests that replay onto current
main, then revert only the source change and re-run. 19 controls so far: 13 bite, 4 do not, 2 are compile-level only. This is the fourth that does not bite, and the first where the new case exists but asserts the wrong thing rather than nothing.Written with an AI assistant.
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.