Estimate the GPU-resident byte footprint of a geometry by summing
the underlying typed-array byte lengths of every attribute (and
the index, if present). Mirrors what THREE.js will actually upload
— slightly overstates because we count the full backing array even
if count < array.length / itemSize, but that's the footprint that
matters for pool memory pressure.
The result is cached on geometry.userData.cachedByteSize so repeated
stats polls don't re-iterate attribute byteLengths. Grow paths
invalidate the cache via invalidateCachedByteSize().
Estimate the GPU-resident byte footprint of a geometry by summing the underlying typed-array byte lengths of every attribute (and the index, if present). Mirrors what THREE.js will actually upload — slightly overstates because we count the full backing array even if
count < array.length / itemSize, but that's the footprint that matters for pool memory pressure.The result is cached on
geometry.userData.cachedByteSizeso repeated stats polls don't re-iterate attribute byteLengths. Grow paths invalidate the cache viainvalidateCachedByteSize().