Repository navigation
Integer RTV clears: convert every exposed UINT/SINT format (D3D-60 follow-up) - #823
Closed
JavierBlanco23 wants to merge 1 commit into
Closed
JavierBlanco23 wants to merge 1 commit into
JavierBlanco23 wants to merge 1 commit into
Conversation
R8G8, R16G16, R16G16B16A16, R32G32 (UINT/SINT), R32G32B32A32_SINT and R10G10B10A2_UINT fell into the float path and stored raw float bits. Clamp/truncate numerically like WARP; A2B10G10R10 alpha clamps to 3. Tests cover 19 formats on CPU and 15 against WARP.
Contributor
Author
ItsNotRexed
added a commit
that referenced
this pull request
Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item: follow-up to D3D-60 (claimed in #634)
render_target_clear_color()only convertedR8G8B8A8,R32,R32G32B32A32UINT andR8G8B8A8/R32SINT. The integer RTV formats D3D-60 exposed (R8G8,R16G16,R16G16B16A16,R32G32UINT/SINT,R32G32B32A32_SINT,R10G10B10A2_UINT) fell intodefault:and copied IEEE-754 bits intoVkClearColorValue, so a clear of1.0stored0x3f800000(truncated to the format), with no validation error.Change
R8/R16UINT/SINT defensively): NaN → 0, clamp to the component range, truncate toward zero.A2B10G10R10_UINTclamps RGB to 1023 and alpha to 3.clear_color_test: 19 integer formats × 11 vectors (incl. 8/16/10/2-bit and int32 boundaries) × full/rect, plus float passthrough.d3d12_clear_test: all 15 exposed UINT/SINT RTVs vs WARP with the same vectors; color and depth mismatches are now reported per format at the end, so depth/stencil and the validation counter always run.docs/d3d12_vulkan.md: Typed RTV clears note updated.Negative control (same new tests,
vulkan_replay.hfrommain8df277f)clear_color_test: 13 formats fail (got 0x3f800000, expected 0x00000001).d3d12_clear_test: the 9 D3D-60 integer formats differ from WARP.With this change
clear_color_test: 462 checks passed.d3d12_clear_test(withLEONIDA_VK_VALIDATION=1): all 15 integer formats match WARP, 0 new validation errors, 3D RTVs match.ctest: 31/31.Pre-existing, not addressed here (identical on
main8df277f; previously hidden because the test stopped at the first mismatch): exact.5-step UNORM/SNORM clears round down on NVIDIA where WARP rounds up:R8G8B8A8_UNORM0.5 →7fvs80,R8G8B8A8_SNORM0.5 →3fvs40,D16_UNORM0.5 depth low byteffvs00. Sod3d12_clear_teststill exits 1 on this GPU for those 3 formats. Documented as open.AI-assisted. Tested on Windows 11, NVIDIA GeForce RTX 5080, driver 616.56, MSVC 19.44 + Ninja.