Depends on #148443.
Use case
Flutter GPU's PixelFormat exposes no compressed texture formats, and there is no API to query whether a format is supported on the current backend. 3D content needs compressed textures to keep GPU memory and bandwidth reasonable, and the supported formats vary by device, so a capability query is required.
glTF assets ship compressed textures through the KHR_texture_basisu extension, which stores KTX2 containers with Basis Universal supercompression (ETC1S or UASTC). At load time these transcode to a device-appropriate hardware format: UASTC to BC7 or ASTC, ETC1S to BC1/BC3 or ETC2. Flutter Scene needs Flutter GPU to expose those target formats and a query so the transcoder can pick the right one.
Proposal
Once Impeller lands compressed support (#148443), extend the Flutter GPU surface to match.
- Add the same three compressed families to the
PixelFormat enum: BC (BC1 to BC7), ETC2 and EAC, and ASTC LDR. Skip PVRTC, ETC1, and HDR variants initially, matching the Impeller issue.
- Add a capability query to
GpuContext.
- Treat compressed textures as upload-only and sample-only.
createTexture validates usage and block-aligned dimensions, and Texture.overwrite accepts compressed block data.
- Keep KTX2 and Basis transcoding a layer above Flutter GPU, in Flutter Scene or a companion package. Flutter GPU exposes only the hardware formats and the query. The transcoder uses the query to choose a family.
Capability query API
enum TextureCompressionType { bc, etc2, astc }
class GpuContext {
// ...existing members...
/// Whether the backend supports a whole compressed family.
bool supportsTextureCompression(TextureCompressionType type);
/// Whether [format] can be used with the given usage on this backend.
bool supportsTextureFormat(
PixelFormat format, {
bool renderTarget = false,
bool shaderRead = true,
});
}
This mirrors the Impeller capability API.
Formats supported almost universally at landing
No single compressed format is universal, which is why the query exists. The three families together cover essentially every target:
- ETC2 and EAC: mobile, OpenGL ES 3.0, WebGL2.
- BC (BC1 to BC7): desktop.
- ASTC LDR: modern mobile.
These are exactly the transcode targets for Basis Universal, so they cover KHR_texture_basisu glTF textures. One asset runs on every backend through the query plus Basis transcoding, with uncompressed RGBA as a fallback.
Depends on #148443.
Use case
Flutter GPU's
PixelFormatexposes no compressed texture formats, and there is no API to query whether a format is supported on the current backend. 3D content needs compressed textures to keep GPU memory and bandwidth reasonable, and the supported formats vary by device, so a capability query is required.glTF assets ship compressed textures through the
KHR_texture_basisuextension, which stores KTX2 containers with Basis Universal supercompression (ETC1S or UASTC). At load time these transcode to a device-appropriate hardware format: UASTC to BC7 or ASTC, ETC1S to BC1/BC3 or ETC2. Flutter Scene needs Flutter GPU to expose those target formats and a query so the transcoder can pick the right one.Proposal
Once Impeller lands compressed support (#148443), extend the Flutter GPU surface to match.
PixelFormatenum: BC (BC1 to BC7), ETC2 and EAC, and ASTC LDR. Skip PVRTC, ETC1, and HDR variants initially, matching the Impeller issue.GpuContext.createTexturevalidates usage and block-aligned dimensions, andTexture.overwriteaccepts compressed block data.Capability query API
This mirrors the Impeller capability API.
Formats supported almost universally at landing
No single compressed format is universal, which is why the query exists. The three families together cover essentially every target:
These are exactly the transcode targets for Basis Universal, so they cover
KHR_texture_basisuglTF textures. One asset runs on every backend through the query plus Basis transcoding, with uncompressed RGBA as a fallback.