gpu(native): fix depth-twin SRV formats, mips/slices, remirrors, and render sync (#436) #439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/439"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T18:31:50Z.
Summary
Fixes the four depth-twin causes behind
VICTORY_DEPTH_TWINS=1leaving the world ~95% dark (#258,#issuecomment-7225008641):21/46and console119depth-plane SRVs (descriptors::format&NativeHost::depth_twin):DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS(21, and console119 = R16_UNORM_X8_TYPELESSviapc_format) andDXGI_FORMAT_R24_UNORM_X8_TYPELESS(46) toFormat::R32Float(plus44alongside19 | 20 | 45 => Format::D32FloatS8). Previouslydescriptors::format(21)returnedNone, causing depth-plane SRVs ofD32_FLOAT_S8X24_UINT(19/20) andD16_UNORM_S8_UINT(118) to bypassdepth_twinand read the unwrittendepthtexture while UAVs (41/56) wrotetwin.texture. Also redirects whole-texture (Noneformat) and depth-typed SRVs of twinned depth textures ontotwin.texture.DepthTwin(NativeHost::depth_twin&NativeHost::twin_blits):twin.texturewithdesc.dim(TexDim::D2 | TexDim::D2Array) and all host mip levels and array slices (honouringdroppedtop levels), laying out sequential 256-byte-alignedTwinRouteregions instageso high-mip UAVs (e.g. Hierarchical-Z depth pyramids), full-chain SRVs, and array shadow maps mirror and copy every(slice, mip)subresource bit for bit.NativeHost::mirror):View::Placed(true, ..)depth UAVs to create twins (placed_info_of), and immediately re-mirrors any previously mirrored heap entries (including bindless slots outsideRoot::Tablespans and placed-view alias keys sharing the sameRc<B::Texture>) onto the new twin.TwinNewer { Depth, Twin, Both }& render-sampled sync (NativeHost::twin_copies):depth -> twin(Both) beforeGroup::Renderpasses for twins not bound astargets.depth, so pixel/vertex/mesh shaders sampling a shadow map or scene depth with no intervening compute pass read fresh depth once without forcing redundant reverse copies. Leaves stencil-only clears (z.is_none()) and read-only copies (Both) from clobbering the newer depth side.Verification
descriptors::tests::depth_stencil_shader_view_formats_decode_to_float_depth_plane.texture_tests::multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately(4-mipD32_FLOAT_S8X24_UINT, 2-slice x 3-mipD16_UNORMD2Array, bindless index 24 immediate remirror, andView::Placed(true, ..)twin creation).tests::depth_plane_srvs_and_render_sampled_twins_read_compute_and_depth_writes(compute writesR16_UNORMUAV onDXGI 118-> stencil-only clear ->tri_pssamplesDXGI 119SRV; then depth clear ->tri_pssamplesDXGI 21SRV with no compute pass in between).cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p victory-shader -p xtaskcargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warningscargo clippy --workspace --all-targets --all-features --target x86_64-pc-windows-gnullvm -- -D warningscargo xtask policyCloses #436
Refs #258
cc @Olima34
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by alexballvideos-netizen on 2026-11-27T20:37:21Z.
A/B of this PR on an M3 Max, 36 GB, macOS 27.2.1, Series X profile (the preview note says Series X wasn't run). Headless, 300 s each, warm cache,
VICTORY_TRACE_TARGETS=1 VICTORY_DUMP_TARGETS=…,110,20. "Lit" is the loggedlit=fraction of the F10 1280x720 scene colour target, taking the highest per dump. Counts only.b998bb65, twins onb998bb65,VICTORY_DEPTH_TWINS=030511a9d), twins onimage+0x2215c35: not the watchdog write atimage+0x23cf683from #404, and with nonever reported onGPU stall before it. Then came the usual secondary fault in the crash reporter at0x55e56f8. That's one run, so I can't say yet whether it's caused by twins off.I haven't checked: Series S, a windowed run, or the corpus. If a single fixed frame would help (for example, with
VICTORY_TRACE_PASSESat a set world present), say which, and I'll rerun all three on it.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by alexballvideos-netizen on 2026-11-27T21:08:18Z.
Correction to my A/B above: the twins-off crash at
image+0x2215c35is the #456 freeze (a job thread spinning in title code, no GPU stall; see #404). It's not related to depth twins, so this PR's comparison is unaffected.