gpu(native): depth twins drop DXGI 21/119 depth-plane SRVs, mips > 1, bindless remirrors, and render-sampled copies #436
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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:15:32Z.
In
#258(#issuecomment-7225008641), settingVICTORY_DEPTH_TWINS=0brought the lit world scene from ~5% of pixels filled to ~99%.Tracing
NativeHost::depth_twin(crates/victory-gpu/src/native/host.rs) anddescriptors::format(crates/victory-gpu/src/native/descriptors.rs) shows four concrete causes in how depth twins interact with the title's depth-plane views and passes:21(R32_FLOAT_X8X24_TYPELESS) and console119(R16_UNORM_X8_TYPELESS, mapped to21bypc_format) returnNonefromdescriptors::format:DXGI 19/20scene depth andDXGI 118material depth) useR32_FLOAT(41) orR16_UNORM(56) for their depth-plane UAVs, which decode toSome(Format::R32Float)/Some(Format::R16Unorm)and create/writetwin.texture.21(R32_FLOAT_X8X24_TYPELESS) and119(pc_format(119) == 21, as indraw.rs:2678), plus46(R24_UNORM_X8_TYPELESS).descriptors::format(21)returnsNone, soformat.and_then(|f| self.depth_twin(...))skipsdepth_twincompletely and binds the SRV to the unwrittendepthtexture while UAVs write totwin.texture(and ignores mip/slice ranges on non-twinned depth-stencil SRVs as well).desc.mips > 1, e.g. Hierarchical-Z depth pyramids) andD2Array(desc.depth_or_layers > 1) depth textures:depth_twinhardcodesmips: 1anddepth_or_layers: 1(and rejectsTexDim::D2Array). Once a twin is created for a multi-mip depth texture, every view atmip >= 1failsMetal::create_texture_view("view (m, 1) ... is past the texture"), full-chain SRVs ((0, mips)) are truncated to mip0only, andtwin_blitsonly copies mip0, slice0.depth_twincreates a twin, it removesheap.take_entries(resource)fromheap.mirroredwithout re-mirroring them immediately (and without checking placed-view alias keys sharing the sameRc<B::Texture>).remirror_tablesonly visitsRoot::Tablespans, so bindless entries indexed viaResourceDescriptorHeapkeep pointing todepthinstead oftwin.texture. Also, placed UAVs (View::Placed(true, ..)`) do not trigger twin creation.twin_copies):Group::Rendercallstwin_copies(false, ...), so if a depth texture (shadow map or scene depth) is rendered into (Newer::Depth) and then sampled as a colour SRV by a laterGroup::Renderpass with noGroup::Computepass in between,depth -> twinis never copied and the pixel shader reads stale/zerotwin.texture. Tracking 3 states (Depth,Twin,Both, as intwin.rs) copiesdepth -> twinonce before the first samplingRenderorComputepass without redundant round-trip blits.Refs #258
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T18:15:33Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T18:16:08Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #436in its description within 24 hours, or the claim expires.