Repository navigation
Runtime: preserve explicit RGBA8 typeless RTV formats for clears (D3D-41) - #388
Conversation
evilclanker9000
left a comment
There was a problem hiding this comment.
Tested fbffbce383586e49d2c4906d288a8cc30809b283 on RTX 5080, driver 32.0.16.1692, Windows build 26200.9974. The detached build passed the typeless_rtv CPU CTest. With Vulkan validation enabled, d3d12_typeless_rtv_test passed all 13 WARP readbacks and 12 descriptor rejections, and d3d12_uint_clear_test passed all 21 WARP readbacks for the existing UINT clear path. No Vulkan validation errors were reported.
An additional synthetic check used one 5×3 R8G8B8A8_TYPELESS image with RTV and UAV flags per run. I rewrote the same RTV slot between three separately fenced submissions, going sRGB → UINT → sRGB and then UINT → sRGB → UINT on a fresh image. Each run cleared the whole image, a 3×2 rectangle, and a 1×2 strip inside that rectangle. Both native WARP and the Vulkan shim read back all 90 RGBA texels per backend byte-for-byte against literal predictions, including exterior texels preserved across each clear. The same input (0.125, 0.25, 2.75, 1.75) gave [99,137,255,255] through the sRGB view and [0,0,2,1] through the UINT view.
For the negative control I kept the sRGB view for Vulkan's second clear in the sRGB-first run. The first affected texel at (1,1) returned [99,137,255,255] on Vulkan while the unchanged WARP run returned the expected [0,0,2,1]. The additional check covers these two explicit view formats on a single-sample, single-layer, single-mip image.
0xTehuti
left a comment
There was a problem hiding this comment.
Independent Windows Hardware Test & Review (D3D-41: Preserve explicit RGBA8 typeless RTV formats for clears)
Tested and verified on Windows 11 with an NVIDIA GeForce RTX 2070 SUPER (Driver 595.79, Vulkan 1.4.321) in isolated worktree D:\Workspaces\Leonida-pr388 (fbffbce), providing native NVIDIA Windows MSVC hardware test coverage for PR #388 (author tested on AMD Radeon RX 5700 XT).
Hardware & Toolchain Environment
- OS: Windows 11 Pro 24H2 (x64)
- GPU: NVIDIA GeForce RTX 2070 SUPER (8203 MB dedicated VRAM)
- Driver: NVIDIA 595.79 (Vulkan 1.4.321, WDDM 3.2)
- Compiler: MSVC 2022 v14.44 (19.44.35225) + Ninja 1.13 + CMake 3.31 (
RelWithDebInfo) - Flags:
/std:c++20 /W4 /permissive- /utf-8 - Vulkan Headers: 1.4.321 (
C:\Users\Geko\AppData\Local\VulkanSDK\include)
Compilation Results
- 113 / 113 targets compiled cleanly under MSVC.
- Diagnostics: 0 errors, 0 warnings under
/W4 /permissive- /utf-8.
Test Execution Summary
| Test Target / Suite | Status | Execution Summary |
|---|---|---|
d3d12_typeless_rtv_test.exe |
PASSED | 13 WARP readbacks matched (exact UINT, normalized channels within 1 byte tolerance); descriptor snapshot isolation and format-cache ordering verified; 12 unsupported/invalid views cleanly rejected. |
typeless_rtv_test.exe |
PASSED | 19 CPU format capture, snapshot, whole/rectangle and rejection scenarios passed. |
d3d12_uint_clear_test.exe |
PASSED | 21 full/rectangle readbacks matched WARP on three formats. |
clear_color_test.exe |
PASSED | 70 full and rectangle UINT and float replay checks passed. |
| CTest Suite (19 / 19) | PASSED | 100% pass rate (loader, pe_loader, device_proxy, root_sig, command_list, descriptor_table, bink_decode, bink_audio, xmem, xgameruntime, run_tiny_game, run_tiny_game_exit_code, root_signature, root_signature_oracle, d3d12_gcl8, typeless_rtv, clear_color, d3d12_state_map, gfx10_descriptors). |
d3d12_vulkan_device_test.exe |
PASSED | Clears, zero-fills, uploads, texture/buffer/BC copies, footprint queries behind Xbox-ABI proxy all matched. |
d3d12_com_test.exe |
PASSED | 16 colour, depth, and stencil texels matched; queue wait held the GPU. |
d3d12_descriptor_test.exe |
PASSED | Slot copies matched. |
vk_command_replay_test.exe |
PASSED | Passed suites A, B, C, and D (360 sync/access barrier pairs). |
| Python Unit Tests | PASSED | 38/38 unit tests passed; compileall clean. |
Execution Log Excerpt:
device: NVIDIA GeForce RTX 2070 SUPER
typeless RTV: 13 WARP readbacks matched, descriptor snapshots and format-cache order checked; 12 unsupported/invalid views rejected
device: NVIDIA GeForce RTX 2070 SUPER
UINT RTV clears: 21 full/rectangle readbacks matched WARP on three formats
Cross-vendor hardware validation (NVIDIA Turing) confirms full correctness alongside AMD RDNA1 results. Approved.
AI-assisted hardware review and verification (synthetic fixtures only, zero game data).
|
Updated the branch with main at 4abd545. Resolved the vulkan_backend.h conflict by retaining both the format-aware image-view cache key from this PR and the bindless_prepare_ callback and submission path from main. Revalidated on RX 5700 XT, driver 32.0.21045.5002: full RelWithDebInfo build, CTest 20/20, 13 typeless WARP readbacks plus 12 descriptor rejections, 21 UINT WARP readbacks, and d3d12_com_test / vk_command_replay_test / d3d12_vulkan_device_test / d3d12_descriptor_test all passed with Khronos and synchronization validation. The descriptor test passed view/sampler checks but skipped its sampling shader because glslangValidator is not installed. Synthetic fixtures only. Hosted CI for this updated head is separate from these local results. |
|
Tested 500255d on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
That includes the new No game files used. AI-assisted run (Claude Code). |
|
Merged main at 91b36cf and resolved the vulkan_replay.h conflict. The clear preparation keeps both the explicit RTV format interpretation and main's clear_rects handling: predicated whole-view clears continue through attachments, including same-format UNORM. Added three CPU preparation regressions for predicated UNORM/SRGB/UINT clears; typeless_rtv_test now covers 22 scenarios. Revalidated on RX 5700 XT, driver 32.0.21045.5002, with Khronos and synchronization validation:
One broader regression executable is NOT green on this machine: d3d12_vulkan_device_test fails the new GetResourceTiling host comparison at line 531, for cases 2/8/9/11. I built and ran a separate clean worktree of main at 91b36cf without this PR and reproduced the exact same tiling mismatches and exit 1 there. No tiling change is included in this PR. Also, main at 91b36cf already contains conflict-marker text in tests/semantic/README.md (lines 24/29/33). That file is unchanged relative to main here. The diff of this PR against main passes git diff --check. No unresolved index entries remain. All fixtures are synthetic. Hosted CI for this updated commit remains separate from these local results. |
|
CI comparison for updated head 58019e8: the failures below also occur on the unmodified base main at 91b36cf, with the same inputs/results.
These translator, shader fixtures and runner files are unchanged by the typeless RTV diff. The Windows runtime job passed. This does not make the full CI green; it identifies existing base failures separately from the local clear validation reported above. No checks have been disabled or expected results changed in this PR. The cross-lane test runs on an 8-lane llvmpipe subgroup here; whether its runner needs a subgroup requirement or the translator needs another change should be investigated in the translator workstream. |
|
Follow-up integration validation with #521, now that this PR is merged: #521 (comment) On RX 5700 XT (driver 32.0.21045.5002), the isolated combination of this head #521 deliberately clamps/quantizes normalized clear inputs before Vulkan, so our CPU typeless callback test needs updated literal expectations when those changes land. I documented the precise assertions on #521; changing only those expectations locally gives CTest 24/24. No change to this merged branch was made. The separate D24 readback mismatch on AMD reproduces against #521's base and is not introduced by either clear PR. |
Claimed in #156 / #313 as: D3D-41, explicit RGBA8 typeless RTV clears (phase 1).
Original claim · D3D coordination and compatibility note.
What and why
The resource's base Vulkan format currently determines render-target clears even when an explicit RTV selects another format on an RGBA8 typeless texture. For example, an SRGB clear stores linear UNORM bytes, and a UINT RTV gets normalized conversion instead of numeric integer values.
Preserve the explicit RTV format in the recorded
TargetView, resolve it during replay preparation, and use it both for attachment views and the numeric UINT conversion already merged in #318. Reinterpreted whole-view clears use dynamic rendering becausevkCmdClearColorImagecannot select a view format; same-format full clears keep their image-clear path. Cache keys include the format. Typeless attachment views restrict their usage to COLOR_ATTACHMENT so an SRGB view does not inherit the resource's unrelated UAV/storage requirement.Phase 1 supports explicit UNORM/SRGB/UINT RTVs on one-mip, one-layer, single-sample 2D
R8G8B8A8_TYPELESSresources. Unsupported combinations invalidate the descriptor and fail command-listCloserather than keeping a previous valid descriptor. Recorded views remain snapshots if their CPU descriptor is rewritten. Legacy ownerless float-only replay callers retain their behavior.This is based directly on main at
d7cbc3e, with #318 already integrated. It does not implement render-pass API methods (D3D-27), mesh shaders, bindless views, mip/array expansion, MSAA/3D typeless RTVs, SINT/SNORM or other typeless families. Mip/array support is a separate later phase. Current #333 remains pending; its 32-byte RTV/DSV slots can hold this payload, and this PR does not change strides, heap registration or descriptor-copy logic.Tested
Windows x64, MSVC 19.44; AMD Radeon RX 5700 XT, driver 32.0.21045.5002. Synthetic fixtures only, no shaders or game data.
ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure: 19/19 passed. Package-dependent tests skip their game-data portions when inputs are absent.typeless_rtv_test: 19 CPU scenarios, including format capture, image/attachment paths, unsupported views, absent rendering functions, clipped rectangles, invalid batches and compatibility with legacy float callers.d3d12_typeless_rtv_test: 13 WARP readbacks matched (UINT exact, normalized channels within one byte), including full/rectangular clears, descriptor rewrites, alternating view formats and SRGB with resource UAV usage. 12 unsupported/invalid frontend descriptors rejected without GPU submission.d3d12_uint_clear_test: all 21 WARP comparisons passed.d3d12_com_test,vk_command_replay_test,d3d12_vulkan_device_test,d3d12_descriptor_test: passed. GPU runs used Khronos and synchronization validation; the unrelated Bandicam implicit layer was disabled.git diff --check origin/main...HEAD: passed.GPU comparisons are explicit Windows/WARP tests, separate from CPU-only CTest and hosted CI. Other vendors and actual game assets were not tested for this typeless phase.
Checklist