Decoded bytes of one mesh payload — what the monitor reports as bytesLoaded
(and the resident half of memoryUsed).
Measured from the materialized arrays, matching the sibling loaders, whose
recordLoadMetrics charges output.byteLength per array: this is DECODED
size, not wire size. The two differ (chunks arrive compressed, and a
quantized u16 array widens to float32 on decode), and decoded is the honest
answer for "how much data does this layer amount to in the viewer". Wire
bytes are the Cache tab's job, which measures them at the store boundary
where every tier can be attributed.
The texture arms are branched exhaustively rather than as
raw-or-everything-else, so a fourth arm is a compile error here instead of
a silently mischarged one:
raw — the materialized surface itself.
bitmap — w * h * 4, because an ImageBitmap is always 4-channel
8-bit once decoded regardless of the source codec.
compressed — ceil(w * h * 4 / 3): a KTX2 payload stays
GPU-compressed at ~1 byte per texel and the 4/3 covers its mip chain.
Charging it w * h * 4 like a bitmap would overstate a transcoded
basemap by 3x, which is the whole point of using KTX2. Conservative on
hardware Basis transcodes to an RGB-only target at half a byte per
texel, which is deliberate: the charge stays device-independent and
agrees with the admission budget, which cannot know the GPU either.
The two encoded arms use the same figures as the decoded-surface term
preflight.ts adds for them, so the admission gate and the telemetry cannot
disagree about what a texture expands to. This is NOT an equality of totals:
preflight is a PEAK ADMISSION number (stored bytes plus what they decode to
plus the largest single chunk, all coexisting) and charges every array
including the texture handle in its own loop, while this is a RESIDENT one.
Only the surface term is shared, and it is the term worth keeping in step —
it is the one that varies by three-fold between codecs.
Textures dominate this figure when present: an 8192² basemap is 268 MB as a
bitmap (89 MB compressed) against a few MB of geometry.
Charged PER NODE, so an array two nodes share through an array_ref (the two
halves of a partitioned globe sharing one basemap) is counted once for each —
the same convention the byte budget in preflight.ts uses, which likewise
follows the ref and charges the target per node. Reporting shared payloads
once would need a store-wide ledger that neither the gate nor this telemetry
has; the alternative (charging the (0, k) stub) understates a gigabyte read
as ~48 bytes.
Decoded bytes of one mesh payload — what the monitor reports as
bytesLoaded(and the resident half ofmemoryUsed).Measured from the materialized arrays, matching the sibling loaders, whose
recordLoadMetricschargesoutput.byteLengthper array: this is DECODED size, not wire size. The two differ (chunks arrive compressed, and a quantized u16 array widens to float32 on decode), and decoded is the honest answer for "how much data does this layer amount to in the viewer". Wire bytes are the Cache tab's job, which measures them at the store boundary where every tier can be attributed.The texture arms are branched exhaustively rather than as
raw-or-everything-else, so a fourth arm is a compile error here instead of a silently mischarged one:raw— the materialized surface itself.bitmap—w * h * 4, because anImageBitmapis always 4-channel 8-bit once decoded regardless of the source codec.compressed—ceil(w * h * 4 / 3): a KTX2 payload stays GPU-compressed at ~1 byte per texel and the4/3covers its mip chain. Charging itw * h * 4like a bitmap would overstate a transcoded basemap by 3x, which is the whole point of using KTX2. Conservative on hardware Basis transcodes to an RGB-only target at half a byte per texel, which is deliberate: the charge stays device-independent and agrees with the admission budget, which cannot know the GPU either.The two encoded arms use the same figures as the decoded-surface term
preflight.tsadds for them, so the admission gate and the telemetry cannot disagree about what a texture expands to. This is NOT an equality of totals: preflight is a PEAK ADMISSION number (stored bytes plus what they decode to plus the largest single chunk, all coexisting) and charges every array including the texture handle in its own loop, while this is a RESIDENT one. Only the surface term is shared, and it is the term worth keeping in step — it is the one that varies by three-fold between codecs.Textures dominate this figure when present: an 8192² basemap is 268 MB as a bitmap (89 MB compressed) against a few MB of geometry.
Charged PER NODE, so an array two nodes share through an
array_ref(the two halves of a partitioned globe sharing one basemap) is counted once for each — the same convention the byte budget inpreflight.tsuses, which likewise follows the ref and charges the target per node. Reporting shared payloads once would need a store-wide ledger that neither the gate nor this telemetry has; the alternative (charging the(0, k)stub) understates a gigabyte read as ~48 bytes.Exported for unit test.