forked from 1b-agent/opencadstudio-upstream
perf: account for the device memory the renderer holds
Stage 0 of the roadmap asks for a memory baseline before any more
optimisation, and explicitly not from RSS: the allocator and the driver
both retain high-water memory that RSS cannot tell apart from live
resources.
`gpu-live` counts from the sizes this renderer allocated, in the
categories large enough to decide where the next fix goes:
slots total shadow targets text_atlas wire_arena block_geometry
It is partial by construction and says so, rather than presenting itself
as a total. Hatches, images, meshes and Face3D are not counted yet.
Three of the numbers needed a size that was not reachable before: the
block-geometry chunk records its bytes at build because in storage mode
the buffer belongs to the bind group, the arena exposes its allocation
rather than its occupied prefix — headroom is what a budget has to answer
for — and the text atlas reports its `R8` texel count.
Emitted only when a number moves. `prepare` runs thousands of times in a
session and these change a handful of times, so a per-frame line would
bury the log it is meant to explain.
This answers the question the previous fix left open: whether the arena's
52 MiB per slot, the 16 MiB shadow map every slot allocates whether or not
shadows are on, or the render targets dominate once a paper layout has
four or five viewports on screen.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a9a2c82478
commit
d81a858040
5 files changed
+142
No files matched your search
@@ -1369,6 +1369,18 @@ impl PersistentWireArena {
|
||||
}
|
||||
}
|
||||
|
||||
/// Device bytes this arena holds. The instance buffer is reserved with
|
||||
/// headroom, so this is the allocation, not the occupied prefix — which is
|
||||
/// what a memory budget has to answer for.
|
||||
pub fn gpu_bytes(&self) -> u64 {
|
||||
match &self.inner {
|
||||
PersistentWireArenaKind::Indexed(arena) => {
|
||||
arena.inst_buf.size() + arena.const_buf.size()
|
||||
}
|
||||
PersistentWireArenaKind::Packed(arena) => arena.inst_buf.size(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wire_gpus_visible(
|
||||
&self,
|
||||
view_rot: glam::Mat4,
|
||||
|
||||
Reference in new issue
Block a user