gpu(native): fix depth-twin SRV formats, mips/slices, remirrors, and render sync (#436) #443
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!443
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Sheffy007 on GitHub · 2026-11-27 18:31 UTC · original
Sheffy007:fix/depth-twins-views-mips-sync→main· +552 −125 · 5 files · 1 commits · merged 2026-11-28 00:38 UTCSummary
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 #440
Refs #258
cc @Olima34
@alexballvideos-netizen on GitHub · 2026-11-27 20:37 UTC · original
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 #408, 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.@alexballvideos-netizen on GitHub · 2026-11-27 21:08 UTC · original
Correction to my A/B above: the twins-off crash at
image+0x2215c35is the #460 freeze (a job thread spinning in title code, no GPU stall; see #408). It's not related to depth twins, so this PR's comparison is unaffected.