Hold up to 176 icon images in the shared atlas, addressed by the context's uniform room

The GPU icon shader sizes its slot array to what the context can address:
the vertex uniform vectors it has, less 80 kept for the shader's other
uniforms, between 64 and 176. A WebGL 2 context addresses all 176; a context
with little room keeps the old 64, refuses sets that would need more, and
warns once if the atlas outgrows it. Slots past the array are never read.
This commit is contained in:
Sameh Khamis committed 2026-11-07 02:36:39 -08:00
1 parent ef61be2b3b
commit 7a9c7b4d96
4 files changed
+119 -8

No files matched your search

+8 -3
View File
@@ -50,7 +50,10 @@ import {
writeHoldSegment,
writeLerpSegment,
} from '../../data/iconSegment.js';
import { IconSetPrimitive } from '../../data/iconSetPrimitive.js';
import {
contextIconSlots,
IconSetPrimitive,
} from '../../data/iconSetPrimitive.js';
import { iconAtlas, MAX_ICON_SLOTS } from '../../data/iconAtlas.js';
import {
glideOffset,
@@ -244,9 +247,11 @@ export function createGpuIcons({
if (url !== null && !iconAtlas.has(url, px)) fresh.add(`${px}|${url}`);
}
}
if (iconAtlas.size + fresh.size > MAX_ICON_SLOTS)
// As many as this scene's context addresses (all of them on WebGL 2).
const room = Math.min(MAX_ICON_SLOTS, contextIconSlots(scene.context));
if (iconAtlas.size + fresh.size > room)
throw new Error(
`the Cesium renderer's GPU icons have no room for ${fresh.size} more images (at most ${MAX_ICON_SLOTS} in all)`,
`the Cesium renderer's GPU icons have no room for ${fresh.size} more images (at most ${room} in all)`,
);
}