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

Closed
opened 2026-11-26 23:14:53 +00:00 by LakshanSivakumar · 2 comments
LakshanSivakumar commented 2026-11-26 23:14:53 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T23:14:53Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6636632507 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/178). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T23:14:53Z. --- 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 commented 2026-11-27 00:39:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T00:39:14Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7206639107 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/178#issuecomment-7206639107). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T00:39:14Z. --- 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 commented 2026-11-27 05:38:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T05:38:58Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7210816868 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/178#issuecomment-7210816868). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T05:38:58Z. --- 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.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#178
No description provided.