Repository navigation
d3d12: realize console streams with their depth-bounds flag and back-face stencil masks (RT-DEPTHBOUNDS-STREAM-EXTRAS) - #1695
Conversation
kawaii-shakal
left a comment
There was a problem hiding this comment.
Review (read-only, not run). The pipeline-cache key now including the back-face masks and the depth-bounds flag is an important catch, and the plumbing through OMSetDepthBounds, bundles and Draw looks complete. Three points:
- Nothing has been compiled or run (per the description). This touches
vulkan_replay.h,d3d12_com.cppand the device; please get at least a build andd3d12_mesh_testfrom someone with a depthBounds-capable GPU before merge. I can run it on an RTX 5070 Ti if it helps. - Feature enable on the non-standalone device.
enable.depthBounds = chosen_features.depthBoundsis added increate_vulkan_device_standalone.DepthBoundsTestSupportedand the PSO check readstate_.info.features.depthBounds. When the device comes from the runtime's own creation path (not standalone), isinfo.featuresthe enabled set or the supported set? If it is the supported set, a PSO could enabledepthBoundsTestEnableon a device that never enabled the feature (a VUID). dyn_list[9]: with #778 (addsVK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXTto the same list) the maximum becomes 7 + 1 + 1 = 9, so 9 is exactly enough. Astatic_assertor a comment counting the entries would keep the next addition from overflowing it.
AI-assisted review (Claude Code, Claude Opus 5.5).
|
Tested
AI-assisted testing (non-developer tester). |
|
Tested Tests:
Three things in the code: 1. 2. The extra cache-key mix is dropped. 3. The new I tried it with |
…ilder) and map NaN depth bounds to 0 Review findings on ProjectLeonida#1695 (adrianmjim, RX 7900 XT): - The extras hash was appended to the 64-char pipeline key, but cached_pso resizes the key to 64 bytes, so the second hash never reached the cached blob. pipeline_key now takes an optional KeyBuilder hashed with the graphics fields into one key; other call sites are unchanged. - OMSetDepthBounds: NaN converts to 0 per the D3D12 spec; map NaN to 0 first, then apply the existing clamp/empty rules.
|
@adrianmjim — thank you for the 7900 XT run and the three review points. Both code findings are fixed in 1. Cache-key mix truncated away — fixed. 2. NaN depth bounds — fixed on this branch, with a note for @kotekompotek. Replay now maps NaN to 0 first ( 3. Test covers only the eager slot-86 path — acknowledged. Under plain ctest New commit is again not compiled and not GPU-confirmed on the author host (no Vulkan SDK / MSVC here); it needs one more hardware look like yours when convenient. |
|
Rechecked
The 14 related tests pass with |
|
@adrianmjim — thank you for the recheck on Open item unchanged: @kotekompotek, whether the NaN hunk stays here or you carry it in #815 — the default assumed here is that it stays unless you'd rather have it; a maintainer can also drop it at merge. Everything else on this PR is reviewer-verified. AI-assisted. |
…face stencil masks PipelineState::resolve_type built a lazily realized console stream with create_graphics(graphics, ms, as) only, dropping stream.extras (DepthBoundsTestEnable) and stream.back_stencil (DEPTH_STENCIL2 back-face masks) that the eager CreatePipelineState branch passes. Pass both. Adds a mesh-test case that draws through a console stream with DepthBoundsTestEnable and checks OMSetDepthBounds discards the draw. Not compiled or run on this host (no GPU, no Vulkan SDK, MSVC-only build). The new test's per-frame barrier array builds the depth transition unconditionally but submits only one barrier after the first frame, so the COMMON before-state never fires on later frames; state it conditionally on first_frame anyway so the array matches what the debug layer sees. prepare_console_stream's cache key now folds in stream.back_masks/back_stencil and stream.extras.depth_bounds_test (post-mixed with the same KeyBuilder/sha256_hex idiom shared_native_graphics uses), so console PSOs differing only in these stop colliding.
…ilder) and map NaN depth bounds to 0 Review findings on ProjectLeonida#1695 (adrianmjim, RX 7900 XT): - The extras hash was appended to the 64-char pipeline key, but cached_pso resizes the key to 64 bytes, so the second hash never reached the cached blob. pipeline_key now takes an optional KeyBuilder hashed with the graphics fields into one key; other call sites are unchanged. - OMSetDepthBounds: NaN converts to 0 per the D3D12 spec; map NaN to 0 first, then apply the existing clamp/empty rules.
6f710e5 to
bb8e113
Compare
|
Rebased onto #815's new head The NaN hunk stays in this branch as agreed default unless @kotekompotek moves it into #815 — say the word and I'll drop it here. AI-assisted (orchestrator). |
|
Ran #1695 at head Config: Windows 11 (26300), RTX 4060 desktop, NVIDIA 610.88 (
So: it compiles and nothing regresses in these 5 tests, but the lazy-path fix itself is not exercised by any test I ran. Not covered: full runtime build, full ctest, AMD/Intel. AI-assisted: yes (Claude Code ran the tests) |
|
@thiefyzheng heads-up from RT-STATE-AUDIT-PIPELINE (issue #2464, part B): this PR is listed there for depth bounds and back-face stencil, but it carries needs rebase and conflicts with AI-assisted (Claude Code, Claude Opus 5.5). |
|
Status for @Tauwni and whoever tests this next: #1695 is stacked on #815 (our two commits sit on #815 head AI-assisted (Claude Code). |
RT-DEPTHBOUNDS-STREAM-EXTRAS — Depends on: #815
Claimed on #1608 (#1608 (comment)). This fixes @djrolfes' integration finding on #815 (#815 (comment)). @kotekompotek: happy to have this folded into #815 instead of a stacked PR — say so and I'll drop it.
Note: the diff includes #815's commit until it merges, since this branches from its head
efea97331.What
PipelineState::resolve_type'sstd::call_onceblock (runtime/shims/d3d12_vulkan_device.cpp:7059) realized a console stream withcreate_graphics(stream.graphics, &stream.ms, &stream.as), silently droppingstream.extras(the depth-bounds flag, d3d12: support hardware depth-bounds testing and OMSetDepthBounds #815'sGraphicsStreamExtras) andstream.back_stencil(DEPTH_STENCIL2 back-face masks, whichparse_pipeline_streamfills right next to the front ones). The eagerCreatePipelineStatebranch passes both. It now passesstream.back_masks?&stream.back_stencil:nullptrand&stream.extras— argument-for-argument identical to the eager call at ~12104.prepare_console_stream(~10367) set the pipeline cache key frompipeline_key(stream.graphics)alone; the plainD3D12_DEPTH_STENCIL_DESCthe key hashes cannot see the depth-bounds flag or back-face masks, so two console PSOs differing only in those would collide. The key now post-mixesback_masks,back_stencil.read/.writeandextras.depth_bounds_testwith the samecached_pso::KeyBuilder/sha256_hexidiompipeline_keyitself uses.runtime/test/d3d12_mesh_test.cpp: a console stream (device slot 86, mesh-shader subobject 24) carrying DEPTH_STENCIL1 withDepthBoundsTestEnableand a D32_FLOAT DSV, drawn once insideOMSetDepthBounds(0, 1)(red — depth 0 is inside) and once insideOMSetDepthBounds(0.5, 1)(blue — the discard only happens if the flag reached the pipeline). Without the source fix both draws come out red.What was run
create_graphicssignature match (7119–7123), thePipelineStreamfields and their parse fill, every identifier the test uses in scope with types lined up, fence values (the newbounds_fencepre-increments from 3, first Signal is 4 — no collision with the earlier Signals 1–3), the readback footprint/offset parity with the file's existing usage, slot 86 = consoleCreatePipelineState, and subobject 24 = the console mesh shader (consistent with the existing stream test at line 341 and the console→PC remap ind3d12_xs_pso_stream.h:31). That review caught two real defects, both fixed here: the test's second-frame depth barrier indicated a COMMON→DEPTH_WRITE transition from a buffer already in DEPTH_WRITE (now conditional onfirst_frame), and the cache-key collision above.d3d12_mesh_testwith the one-line source change reverted and show the bounds case fails) needs a depth-bounds-capable Vulkan device, which the author host does not have. The test skips cleanly whenDepthBoundsTestSupportedis FALSE or inpc_onlybuilds.Attribution
AI-assisted: implementation (Claude Sonnet 5.5 worker), independent review and follow-up fixes (GLM 5.3 Flash worker), orchestration and verification by the contributor. No game files were used or are needed; no game data in this PR.