Native host drops texture copies (CopyResource / CopyTextureRegion) #178

Closed
opened 2026-11-27 00:53:15 +00:00 by github-bot · 2 comments
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 23:14 UTC · original

The native host records buffer copies but drops texture copies (CopyResource / CopyTextureRegion between textures). In a world frame the title copies three G-buffer targets (one fmt 29, two fmt 28, 1280x720), and those copies are dropped, so any pass that reads them reads nothing.

Plan: record texture copies as Metal blits in command order (whole resource, subresource/region, mips and slices, depth/stencil with Metal's depth-from-depth-stencil option), and mark the destination as GPU-written so the CPU texture sync doesn't overwrite it from title memory. With a Metal test that copies a known pattern through the native list path.

Part of the world-picture work (#182). Being worked on now.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 23:14 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/178) The native host records buffer copies but drops texture copies (`CopyResource` / `CopyTextureRegion` between textures). In a world frame the title copies three G-buffer targets (one fmt 29, two fmt 28, 1280x720), and those copies are dropped, so any pass that reads them reads nothing. Plan: record texture copies as Metal blits in command order (whole resource, subresource/region, mips and slices, depth/stencil with Metal's depth-from-depth-stencil option), and mark the destination as GPU-written so the CPU texture sync doesn't overwrite it from title memory. With a Metal test that copies a known pattern through the native list path. Part of the world-picture work (#182). Being worked on now.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:53:15 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-27 00:39 UTC · original

On main ccfd8c4e, on top of @⁠Sheffy007's texture copies from #183. Added:

  • copies between formats no view joins (plain texels into compressed blocks, a depth plane into a 4-byte float), through a scratch buffer; the world uses RGBA32_UINT → BC3_SRGB and RG32_UINT → BC1;
  • depth planes to and from buffer rows (DepthFromDepthStencil for D32FloatS8);
  • ResolveSubresource as a clipped copy;
  • a copy's destination is marked GPU-written, so the CPU texture sync no longer overwrites it from title memory at a later submission;
  • copies the host can't do are refused at record time and logged once per kind; copies_recorded is counted.

A warm world run recorded 728 copies with 0 dropped and no GPU errors (an older main dropped 726 by frame 2816). The copies were not what kept the lighting dark (#182); that is the refused shaders. Stencil-only copies are still refused. Leaving this open for you to close.

**@⁠LakshanSivakumar** on GitHub · 2026-11-27 00:39 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/178#issuecomment-7206639107) On main ccfd8c4e, on top of @⁠Sheffy007's texture copies from #183. Added: - copies between formats no view joins (plain texels into compressed blocks, a depth plane into a 4-byte float), through a scratch buffer; the world uses RGBA32_UINT → BC3_SRGB and RG32_UINT → BC1; - depth planes to and from buffer rows (`DepthFromDepthStencil` for D32FloatS8); - `ResolveSubresource` as a clipped copy; - a copy's destination is marked GPU-written, so the CPU texture sync no longer overwrites it from title memory at a later submission; - copies the host can't do are refused at record time and logged once per kind; `copies_recorded` is counted. A warm world run recorded 728 copies with 0 dropped and no GPU errors (an older main dropped 726 by frame 2816). The copies were not what kept the lighting dark (#182); that is the refused shaders. Stencil-only copies are still refused. Leaving this open for you to close.
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-27 05:38 UTC · original

Texture copies are now recorded as Metal blits (ccfd8c4e). A warm world run recorded 728 copies with none dropped. Only stencil-only copies are still refused. Closing; the black-world work continues in #258.

**@⁠LakshanSivakumar** on GitHub · 2026-11-27 05:38 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/178#issuecomment-7210816868) Texture copies are now recorded as Metal blits (ccfd8c4e). A warm world run recorded 728 copies with none dropped. Only stencil-only copies are still refused. Closing; the black-world work continues in #258.
This discussion has been locked. Commenting is limited to contributors.
No description provided.