Repository navigation
d3d12: reject integer formats in plain resolves (D3D-274) - #2112
ItsNotRexed merged 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Independent Radeon check of
Synthetic inputs only. AI-assisted verification. |
0xTehuti
left a comment
There was a problem hiding this comment.
Code & Hardware Verification Review (D3D-274 / PR #2112)
Verdict: Approve ✅
Environment & Toolchain
- AI-Assisted: Yes
- OS: Windows 11 Pro x64 (Build 26100)
- Compiler: MSVC 2022 Community (cl.exe v19.44.35225.0, vcvars64)
- Build System: CMake 4.4 + Ninja 1.13 (
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_VULKAN_HEADERS_FETCH=ON) - GPU: NVIDIA GeForce RTX 2070 SUPER (8192 MB VRAM, Vulkan 1.4, Driver 595.79)
- Clean-Room Policy: Verified without game files or private dumps.
Verification Results
-
Python Syntax Check:
python -m compileall -q make_game.py tools tests-> PASS (exit code 0)
-
Compilation & Linkage:
cmake --build runtime/build --target d3d12_vulkan_device_test d3d12_depth_resolve_test d3d12_com_test d3d12_typeless_rtv_test-> PASS (17/17 targets built and linked cleanly)
-
CTest Suite (GPU / Vulkan Targets):
- Command:
ctest --test-dir runtime/build --output-on-failure -R "^d3d12_(vulkan_device|depth_resolve|com|typeless_rtv)$" - Result: 4/4 passed (100% pass rate, 13.85s real time)
d3d12_com: Passed (0.25s) — 16 colour, depth, and stencil texels matched; queue wait held the GPU.d3d12_vulkan_device: Passed (7.95s) — 9 plain resolve format cases tested (0 unsupported skipped, 0 mismatches); 60 resolve comparisons matched; logged expected note:ResolveSubresource refused: integer colour formats cannot be resolved.d3d12_typeless_rtv: Passed (3.80s) — 1730 WARP readbacks matched, 27 unsupported/invalid views rejected.d3d12_depth_resolve: Passed (1.33s) — 45 host comparisons matched, 9 refusals kept the destination.
- Note on
LEONIDA_VK_VALIDATION=1: On this runnerVK_LAYER_KHRONOS_validationexplicit layer manifest is not installed in the system registry, so the runtime fails fast as designed when the layer is requested. Tests ran and passed directly on the physical NVIDIA driver runtime.
- Command:
Code Analysis & Contract Conformance
- Vulkan / D3D12 Contract Alignment: Vulkan
vkCmdResolveImageforbids integer format images (Neither srcImage nor dstImage can have an integer format). In D3D12,ResolveSubresourcerejects typed integer formats. Refusing integer resolves at command list recording time and causingClose()to returnE_INVALIDARGcomplies with the D3D12 contract and prevents invalid Vulkan API usage. - DRY Implementation: Reusing
DeviceState::numeric_class(vulkan_format(format, false).format) != 0via helpercolor_resolve_format_is_integerdirectly aligns the recording check withCheckFeatureSupport, which already strippedD3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVEfor integer formats. - Resource & Format Guarding: Inspecting
integer_color(dst)andinteger_color(src)alongside the requestedformatcloses potential bypasses where resources are integer-typed but requested as non-integer/typeless. - Depth/Stencil Isolation: The check explicitly guards against false positives on depth/stencil targets (
!(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)), ensuring existing depth resolves are unaffected. - Documentation:
docs/d3d12_vulkan.mdis updated accurately to state that integer colour formats in the requested format or either resource are refused at recording and failClose().
LGTM! All contracts pass cleanly.
|
Tested AI-assisted (Claude Code). |
|
Tested 849f4b7 on NVIDIA GeForce RTX 3060 (driver 617.14), Windows 11 26200.9457, MSVC 14.44 RelWithDebInfo: pass. The full d3d12_vulkan_device ctest entry passed (10.5 s), including the new integer-resolve refusals and the successful float resolves beside them. |
0xTehuti
left a comment
There was a problem hiding this comment.
GPU Verification & Code Audit: PR #2112 (D3D-274)
Tested and verified on Windows 11 with MSVC 2022, Ninja, CMake, and Vulkan SDK 1.4:
- GPU: NVIDIA GeForce RTX 2070 SUPER (8192 MB VRAM, Turing TU104, Compute Capability 7.5)
- Driver: NVIDIA Game Ready / Studio 595.79 (Vulkan 1.4.304 / 1.4.363)
- Validation Layers: Khronos Validation Layer active (
LEONIDA_VK_VALIDATION=1) - Environment: Clean-room with synthetic test harnesses (zero game assets)
Test Execution & Results
Both runtime targets compiled and passed 100%:
| Test Target | Duration | Status | Vulkan Validation Errors |
|---|---|---|---|
d3d12_vulkan_device |
41.25s | PASSED | 0 errors |
d3d12_depth_resolve |
1.64s | PASSED | 0 errors |
Verified Behavior
- Plain Resolve Rejection: Verified that integer color formats (
R8G8B8A8_UINT,R8G8B8A8_SINT,R32_UINT,R32_SINT,R32G32B32A32_SINT) are refused during command list recording (ResolveSubresource refused: integer colour formats cannot be resolved), correctly causingClose()to returnE_INVALIDARG. - Typeless / Alias Protection: Combinations of integer resources requested as UNORM are properly rejected.
- Host Parity: 60/60 resolve comparisons matched byte-for-byte with the native host D3D12 on the RTX 2070 SUPER.
- Depth/Stencil Parity: 45 host comparisons in
d3d12_depth_resolve_testmatched with 0 regressions.
LGTM. Complies with both D3D12 resolve semantics and Vulkan vkCmdResolveImage constraints. Ready to merge.
AI-assisted verification (Orca / Antigravity). No game data used.
|
Tested 849f4b7, merged onto
AI-assisted (Claude Code). |
Claimed in the coordination issue as: D3D-274 (claim)
What and why
Plain
ResolveSubresourceignored its format argument and could send an integer colour image tovkCmdResolveImage. Reject an integer requested format or integer colour source/destination at recording, soClosefails. Reuse the existing Vulkan numeric-class classification, including SINT formats; keep non-integer and depth recording behavior unchanged.Synthetic regression cases cover UINT, SINT, an integer resource requested as UNORM, UNORM/FLOAT controls, and depth recording. The existing GPU resolve comparison covers actual non-integer output. This is limited to plain resolves: #1914 separately changes the regional resolve helper and format mappings. The two heads merge cleanly; this PR does not depend on #1914.
AI-assisted (GitHub Copilot).
Tested
Windows, NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088; MSVC 14.44 and Ninja. No game files.
cmake --build runtime\build --target d3d12_vulkan_device_test d3d12_draw_test d3d12_depth_resolve_test d3d12_com_test d3d12_typeless_rtv_test— passed.ctest --test-dir runtime\build --output-on-failure -R "^d3d12_(vulkan_device|draw|depth_resolve|com|typeless_rtv)$"— 4 passed;d3d12_drawfailed on the bundle blend pixel (127,0,127,255, expected red 64), identically on baseline4eb6155d.ctest --test-dir runtime\build -V -R "^d3d12_vulkan_device$"— passed; 9 new format cases, none skipped, and 60 existing resolve comparisons matched.4eb6155dwith the initial regression cases and without the fix: all five tested integer cases incorrectly returnedS_OKinstead ofE_INVALIDARG; the UNORM and FLOAT controls passed.Checklist
docs/design.md, with how it was confirmed.No translator rule is introduced.