Skip to content

Runtime: support typed render-target views on typeless 3D textures - #4878

Open
gabrielsteglich wants to merge 2 commits into
ItsNotRexed:mainfrom
gabrielsteglich:feat/typeless-volume-rtv
Open

gabrielsteglich wants to merge 2 commits into
ItsNotRexed:mainfrom
gabrielsteglich:feat/typeless-volume-rtv

Conversation

@gabrielsteglich

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: typeless 3D RTVs and W-slice draws

Depends on: #4745 (shared documentation line only; both changes build independently)

What and why

  • Accept explicit typed color RTVs for typeless 3D resources when the selected format is renderable, compatible with the resource family, and present in its Vulkan view-format list when one was supplied.
  • Use the RTV's mip and W-slice range to build the draw attachment. Attachment clears use the same view range, and layout transitions still cover the entire mip. Reject attachment rendering beyond the device's maxFramebufferLayers.
  • Check selected and untouched texels across both mips for typed UNORM and typeless sRGB draws. Cover clear readback with UNORM, sRGB, UINT, SINT, and SNORM views.

Tested

Commit db9caf6d on Windows 11 Pro build 26300, MSVC 19.44.35229, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0, x64 RelWithDebInfo. NVIDIA GeForce RTX 3090, driver 621.01, with Vulkan validation enabled and implicit layers disabled.

  • Full runtime CTest: 158 passed, 8 skipped, 1 disabled. Focused d3d12_typeless_rtv, d3d12_draw, and typeless_rtv: 3/3 passed. The CPU test checked 95 scenarios. The volume clear fixture matched 10 WARP comparisons and verified the untouched W slices and mips.
  • Standalone native D3D12 controls: 10/10 clear cases and 6/6 draw cases across the RTX 3090 and WARP.
  • With the new GPU fixtures on base de671352, both regression tests failed as expected: the typeless 3D RTV was rejected, and the typed draw wrote mip 1 W0 instead of the selected slice.

AI-assisted: yes (Codex).

  • All cases use synthetic data.

@tupacfan04

Copy link
Copy Markdown
Contributor

Tested db9caf6d on Windows 11 x64 (MSVC 19.51.36260.0, NVIDIA RTX 5070, driver 621.24, Vulkan SDK 1.4.363.0): pass.

Built with -DBUILD_TESTING=ON and ran the three focused targets directly:

  • typeless_rtv_test: exit 0 — 95 format, snapshot, whole/rectangle and rejection scenarios passed.
  • d3d12_typeless_rtv_test: exit 0 on the RTX 5070 — the volume RTV cleared and read back 10 WARP comparisons with every untouched W slice and mip matching; 1584 mixed-format/automatic-mip/predicate regressions, 1740 WARP readbacks and 34 rejected invalid views all behaved as expected. No validation errors printed.
  • d3d12_draw_test: exit 0 — the new 3D RTV draw matched across both mips and every W slice for typed UNORM and typeless sRGB; the rest of the draw suite still passed (strip cut, 4x MSAA, step rate, root constants/CBV/input layout).

No Intel or AMD GPU available, so only the NVIDIA path was exercised. No game data used; synthetic fixtures only. AI-assisted verification.

@jeremygold02 jeremygold02 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed the W-slice fix with two simultaneous color attachments followed immediately by a transition of the volume mip to pixel-shader read. On parent de671352 and upstream main d974c88a, the draw requested W slices 2–3 but replay created the volume attachment at slice 0 with one layer. The dynamic-rendering layer count also fell to one for the whole draw. At db9caf6d, both attachment views and the rendering layer count are correct in all four cases.

To reproduce with the no-driver Scene callbacks in runtime/test/replay_cpu_bench.cpp, record a draw with two 8×8 RGBA8 typeless resources, each with two mips. Bind mip 1 of a four-layer 2D array as UNORM (first layer 1, count 2), and mip 1 of a depth-eight volume as sRGB (first W slice 2, count 2). Give the PSO the matching formats. Swap slots and formats together, and repeat both orders with sampled_in_general off and on. Call prepare then emit. Head requests (UNORM, mip 1, layer 1, count 2) and (sRGB, mip 1, W 2, count 2), binds those views in the requested slots, and emits VkRenderingInfo::layerCount = 2.

The subsequent RENDER_TARGET → PIXEL_SHADER_RESOURCE transition covered volume mip 1 from array layer 0 through VK_REMAINING_ARRAY_LAYERS on all three revisions. The captured barrier carried color-attachment writes to fragment-shader reads, with destination layout SHADER_READ_ONLY_OPTIMAL or GENERAL according to sampled_in_general.

CPU command recording and replay on Windows, Intel Core Ultra 7 265K, MSVC x64. The probe captured Vulkan callback arguments. It issued no driver calls or texture samples. Installed physical adapters were NVIDIA GeForce RTX 5070 (621.01) and Intel Graphics (32.0.101.9150).

AI-assisted by GPT-6.2 Astra.

@tupacfan04

Copy link
Copy Markdown
Contributor

VERIFIED SOUND. d3d12_typeless_rtv passes 1,740 WARP readbacks and 10 volume comparisons, d3d12_draw covers 3D RTV draws across both mips and W slices, typeless_rtv passes 95 scenarios, and vk_command_replay passes; validation clean, compileall and merge clean, including against #4884.

Negative control on main d974c88: d3d12_typeless_rtv, d3d12_draw and typeless_rtv_test all fail, the last because it will not compile without max_framebuffer_layers.

AI-assisted review; synthetic fixtures only, no game files.

@XFlawless1

Copy link
Copy Markdown
Contributor

Tested db9caf6d merged with main 3faac557 (clean merge) on Windows 11 Pro 26300, MSVC 19.44, Vulkan SDK 1.4.363.0, RelWithDebInfo via scripts/build_runtime.ps1, LEONIDA_VK_VALIDATION=1, implicit layers off: pass on both GPUs. This adds AMD to the PR's RTX 3090 result.

RTX 5080, 621.14 Radeon iGPU of the Ryzen 7 9800X3D (RDNA2), 32.0.21042.62
d3d12_typeless_rtv pass: typeless volume RTV, 10 WARP comparisons, untouched W slices and mips matched; 1740 WARP readbacks matched, 34 views rejected pass, same counts
d3d12_draw pass: 3D RTV draws, typed UNORM and typeless sRGB, matched across both mips and every W slice pass
typeless_rtv pass, 95 scenarios pass, 95 scenarios
full ctest 170/170 169/170

No validation messages in either full run. The one Radeon failure is d3d12_sparse_queue_family_contract, which fails the same way on main. It's a validation + api_dump layer crash on the AMD driver, not this PR (finding).

AI-assisted (Claude Code).

@0klavair

Copy link
Copy Markdown
Contributor

Tested db9caf6d (merged onto main d974c88a) on RTX 5060 / 621.01, Windows 11 23H2 (in-box D3D12/WARP 10.0.22621.5415): pass, no new regression. d3d12_draw and typeless_rtv pass, and every new check of this PR passes (typeless volume RTV: 10 WARP comparisons, all untouched W slices and mips matched, typed and typeless 3D draws over 2 mips and every W slice, 95 CPU scenarios). d3d12_typeless_rtv still stops at the old CreateCommittedResource3 castable-MSAA check (line 301 → 319 here). That is the 23H2 WARP gap (no relaxed format casting) that #4658 handles, not this PR: on 24H2+ it doesn't occur. Full ctest: only the 3 failures clean main has on 23H2. Run by an agent on this machine, outputs checked by me. AI-assisted.

@chpeu

chpeu commented Nov 23, 2026

Copy link
Copy Markdown

Tested db9caf6d on Linux (Linux Mint 22), NVIDIA GeForce RTX 3080, driver 615.71.09: pass.

Their own test runs in the Linux build here. runtime/test/typeless_rtv_test.cpp is built in the plain Vulkan::Headers block of runtime/CMakeLists.txt (line 2182), so it compiles and runs under GCC on this box:

  • branch db9caf6d: typeless_rtv_test: 95 format, snapshot, whole/rectangle and rejection scenarios passed, exit 0 — the same 95 you report on MSVC.
  • main 594f3485, same machine, same build tree: 93 scenarios passed, exit 0 — so the 2 extra scenarios are new checks and they pass on Linux too.

Merged state (this branch's base 902358c8 is older than main): git merge --no-commit --no-ff onto 594f3485 merges cleanly and builds cleanly, and the full GPU battery on the merged tree matches main measured in the same session:

Tree run_gpu_tests.py with LEONIDA_W64_EMULATE=1 failures
main 594f3485 170/217 (47 skipped) 201/217 (16 skipped) 0
main + this branch 170/217 (47 skipped) 201/217 (16 skipped) 0

So the vulkan_replay.h / vulkan_backend.h / d3d12_vulkan_device.cpp changes cost nothing on the NVIDIA layer here, in wave32 natively and wave64 emulated.

Not exercised from Linux, so no Linux verdict on those paths: d3d12_typeless_rtv_test and d3d12_draw_test are built only inside the MSVC blocks of runtime/CMakeLists.txt (their target_compile_options ... /W4 /permissive- /utf-8 at lines 1503 and 1962). The D3D12-side W-slice attachment, clear readback and layout-transition coverage can only be judged on Windows; the 95-scenario typeless_rtv control above is the part Linux can check.

Second card: the RTX 5080 in this box is holding other work right now, so it was not launched this pass — no second-card number, and that is not a failure.

@memorypressure

Copy link
Copy Markdown

Verified merge with main 3faac55 (clean): compileall passes and the docs guards (test_docs_table_ids, test_docs_list_items) pass with the d3d12_vulkan.md update, which correctly moves typeless volume RTVs out of the unsupported list. No Python tests touch this path; the C++ shim/replay change and hardware comparisons were not run here (CPU-only, no cmake build). Not superseded: main extends the typeless-RTV work (D3D-275) only to 2D views. CI was pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested db9caf6 on NVIDIA GeForce RTX 4080 (driver 617.42), Windows 11, clang-cl 23.1.5 + xwin cross-build: pass.

d3d12_typeless_rtv_test, exit 0:

  • typeless volume RTV: 10 WARP comparisons, all untouched W slices and mips matched
  • typeless subresource regressions: 1584 mixed-format/automatic-mip/predicate cases; conditional rendering enabled
  • typeless RTV: 1740 WARP readbacks matched, descriptor snapshots and format-cache order checked; 34 unsupported/invalid views rejected

d3d12_draw_test was not run here.

AI-assisted.

@thehollowedone

Copy link
Copy Markdown

Independent Windows check of aa89b9e4. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0.

The stock typeless_rtv test passed all 103 cases. I ran the 3D texture cases from d3d12_typeless_rtv and d3d12_draw with the published runtime code. All 10 volume-clear comparisons matched WARP, including the untouched depth slices and mips. The UNORM and sRGB draws matched all expected texels across both mips. Vulkan core and synchronization validation reported zero errors. The GPU runs were limited to the 3D texture cases.

AI-assisted.

@devnull34 devnull34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware verification at head �a89b9e43110f38f71bb2be86759b047a5a9c3c9 on Windows 11 with MSVC 19.44 on AMD Radeon RX 7900 GRE (RDNA3, gfx1100):

  • Build: Built targets ypeless_rtv_test and d3d12_typeless_rtv_test cleanly with 0 errors/warnings.
  • Hardware test execution (d3d12_typeless_rtv_test.exe):
    • ypeless volume RTV: 10 WARP comparisons, all untouched W slices and mips matched
      
    • ypeless subresource regressions: 1584 mixed-format/automatic-mip/predicate cases; conditional rendering enabled
      
    • ypeless RTV: 1740 WARP readbacks matched, descriptor snapshots and format-cache order checked; 34 unsupported/invalid views rejected
      
    • Exit code 0.
  • Unit test execution ( ypeless_rtv_test.exe):
    • ypeless_rtv_test: 103 format, snapshot, whole/rectangle and rejection scenarios passed
      
  • CTest:
    • d3d12_typeless_rtv and ypeless_rtv: 2/2 passed (6.57 s total).
  • Formatting: git diff --check origin/main..HEAD clean, no trailing whitespace.

No retail game files or keys used.

AI-assisted verification.

@kapitche

Copy link
Copy Markdown
Contributor

Tested aa89b9e merged with main 14b2e44 on Windows 11, MSVC 14.51, Ninja RelWithDebInfo, default GPU selection (LEONIDA_VK_DEVICE not set; the tests do not print the device name, so I am not naming it): pass
Real git merge, clean (auto-merged docs/d3d12_vulkan.md, d3d12_vulkan_device.cpp, vulkan_backend.h, vulkan_replay.h). Built d3d12_draw_test, d3d12_typeless_rtv_test, typeless_rtv_test; ctest d3d12_draw, d3d12_typeless_rtv, typeless_rtv: 3/3 passed.
Negative control: reverting runtime/shims/d3d12_vulkan_device.cpp, runtime/src/vulkan_backend.h and runtime/src/vulkan_replay.h to main: d3d12_draw and d3d12_typeless_rtv fail at run time, and typeless_rtv_test no longer compiles (ReplayFunctions has no max_framebuffer_layers). So all three tests depend on the source change.
Not run: Linux, Intel selection.

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.