gpu(native): stage-in vertex buffers, index buffers, and blits resolve only the first pool page instead of wrapping non-linear title pages #442
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:52:57Z.
Problem
In
#258(anddocs/native-host.md, World geometry drawn as shards / Loads whose dwords cross a title page), the title allocates vertex and index buffers across 64 KiB virtual pages mapped in descending or non-contiguous pool order.While shader-fetched root views can look up each page in the page table, hardware vertex/index fetches and buffer blits on the native host still assume a single contiguous pool run from the first byte:
IASetVertexBuffers(glue::vertex_buffers) andIASetIndexBuffer(list::state::index_buffer) discardSizeInBytesand callself.resolve(addr, 1)(host.rs:2486-2492):self.resolve(addr, 1)checks only byte0and binds(pool_buffer, pool.base + m.offset + (addr - at))to Metal's[[stage_in]]vertex slots and hardware index fetcher (drawIndexedPrimitives/ indirectDrawIndexed).graphics::VERTEX_TABLE) or hardware index buffer crosses a 64 KiB title page boundary into a page mapped elsewhere in the pool (e.g. descending pool order), Metal reads linearly pastm.offset + 0x1_0000into unrelated physical pool pages:host.rs:2486-2492):p.indexis resolved even for non-indexed draws (DrawCall::Arrays,DrawCall::Rects), and bothp.vertexandp.indexare resolved onDrawCall::Mesh. If an earlier draw left an IA buffer bound whose pages were later unmapped, resolving it drops subsequent non-indexed draws or mesh dispatches withNOT_MAPPED. Also, anIASetIndexBufferview withaddress == 0 || size == 0records address0instead of clearing the binding.Cmd::Copy,Cmd::Fill,Cmd::CopyBufferToTexture,Cmd::CopyTextureToBuffer, andindirectspans drop work over non-linear title mappings (host.rs:2401, 2445, 2494-2504):self.resolve(addr, len)requires[addr, addr + len)to lie in one linear physical run of a single pool, dropping copies/fills/uploads over gapless descending or multi-pool title ranges withtitle address ... is not in a mapped poolinstead of wrapping the title's contiguous virtual pages viatitle_alias.title_aliaslookups re-walkPoolTableand cap total wraps at64:PoolTable::generation()alongsidesignatureavoids re-locking/walkingPoolTable::mapson every draw that shares a multi-page VB/IB within the same pool generation, and keeping a separate cap for small wraps (< 16 MiB) prevents churningMTLBufferno-copy wrappers across draws while keeping large wraps (>= 16 MiB) bounded at64.Refs #258
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T18:52:59Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T18:53:09Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #442in its description within 24 hours, or the claim expires.