Skip to content

Runtime: clear selected slices of 3D color targets (D3D-64) - #643

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/volume-rtv-slices
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/volume-rtv-slices

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as D3D-64, committed 3D color targets. Current tracker is #634.

What and why

The Vulkan device refused any 3D texture with ALLOW_RENDER_TARGET. A typed color target can now expose the entire base mip through its default RTV, or the W slices selected by an explicit TEXTURE3D RTV. A full clear of a subset of slices uses a 2D-array attachment view. The image layout is tracked and transitioned once for the entire 3D mip. The change covers clears on committed textures. Typeless volume RTVs and depth-stencil resources are outside this change.

Tested

Windows 11, NVIDIA RTX 5080 driver 616.92, Vulkan SDK 1.4.350.0, Windows D3D12 WARP as the second rendering backend.

  • Before, on c432cdc with the synthetic fixture, WARP produced the expected colors. The Vulkan layer rejected CreateCommittedResource before it could create a view.
  • After, d3d12_clear_test --volume matched all 648 RGBA texels against an independent expected array on each backend with Khronos validation enabled. The 8×6×12 base mip stayed red; the 4×3×6 mip exercised a two-slice full clear and a rectangular clear from slice 2 through the end. Both the RGB and alpha channels vary.
  • Negative control: locally routing the two-slice full clear to vkCmdClearColorImage changed exactly 30 of 648 texels on Vulkan, the predicted number of neighboring texels outside the rectangle. Restoring the attachment path returned the mismatch count to zero.
  • Windows CTest passed 27/27. The GPU replay, Vulkan device and typed RGBA8 RTV regression executables passed. The unfiltered d3d12_clear_test still reports the same existing 2D UNORM rounding difference on both an unmodified build of the parent and this change (format 28, case 0, byte 2, Vulkan 0x7f and WARP 0x80). Runtime: clears match WARP on every format class: tie rounding, and the SNORM/SINT/R8/R16 formats (D3D-45) #521 addresses that comparison separately.

Checklist

  • Synthetic textures only. No game data, keys or decryption.
  • Runtime-only change. The device behavior and test command are documented in docs/d3d12_vulkan.md.

AI-assisted with Codex.

A volume mip has a single tracked layout, but its color attachment may cover only part of its depth. Use the view to select W slices and keep barriers on the whole mip so clears preserve neighboring slices.
@troythedecoyx

Copy link
Copy Markdown
Contributor

Tested 2cb28a4 merged onto main c432cdc on NVIDIA GeForce RTX 4060 Ti (Ada), driver 32.0.16.2124 (NVIDIA 621.24), Windows 11 Home 26300, MSVC 2022 / Ninja, Vulkan SDK 1.4.363: pass for what this PR adds; one existing check fails the same way on main.

Besides ctest, I ran each test program this PR changes directly (several aren't registered with ctest):

  • d3d12_clear_test: exit 1 (format 28 case 0 byte 2: Vulkan 7f, WARP 80)
  • d3d12_state_map_test: exit 0 (state map, enhanced barriers, subresource decoding and layout tracking OK)

ctest: 100% tests passed, 0 tests failed out of 27.

The one failure, d3d12_clear_test exit 1 at format 28 case 0 byte 2: Vulkan 7f, WARP 80, is the last check in the program, after this PR's 3D RTVs: 648 RGBA texels match WARP and expected slice colours. It fails identically on main c432cdc without this PR (same format, case and byte), so it isn't from here: it's the exact-tie rounding of float clear values that #521 fixes.

AI-assisted.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 2cb28a4 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass

No game files used. AI-assisted run (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit d7bceb8 into ItsNotRexed:main Nov 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants