References for Texture Memory Usage Estimation Code?

Hello! I was looking around online to for how texture sizes can be estimated for various texture types and saw that CesiumJS includes some code to compute the size of textures with various compression. However I don’t see any references on where these calculations for each compression type have come from. Does anyone know? Is the documented anywhere? Thanks!

The sources are a bit scattered. For example, the part for RGB_ETC2 that says

    case PixelFormat.RGB_ETC2:
      return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8;

can be tracked down to WebGL WEBGL_compressed_texture_etc Extension Specification , which says


COMPRESSED_SRGB8_ETC2

validatedSize is computed in the following way:
floor((width + 3) / 4) * floor((height + 3) / 4) * 8

The other size definitions can (likely all?) be found in the Khronos registry as well, e.g. WebGL WEBGL_compressed_texture_pvrtc Extension Specification (I don’t have something like a complete list/table at hand right now, but maybe the pointer already helps…)

Great thanks - I’ll take a look around some of the other spec documents, then.