{"version":3,"file":"getSupportedGlCompressedTextureFormats.mjs","sources":["../../../../../../src/rendering/renderers/gl/texture/utils/getSupportedGlCompressedTextureFormats.ts"],"sourcesContent":["import type { TEXTURE_FORMATS } from '../../../shared/texture/const';\n\nlet supportedGLCompressedTextureFormats: TEXTURE_FORMATS[];\n\nexport function getSupportedGlCompressedTextureFormats(): TEXTURE_FORMATS[]\n{\n    if (supportedGLCompressedTextureFormats) return supportedGLCompressedTextureFormats;\n\n    // TODO: can we use already created context (webgl or webgl2)?\n    const canvas = document.createElement('canvas');\n    const gl = canvas.getContext('webgl');\n\n    if (!gl)\n    {\n        return [];\n    }\n\n    supportedGLCompressedTextureFormats = [\n        // BC compressed formats usable if \"texture-compression-bc\" is both\n        // supported by the device/user agent and enabled in requestDevice.\n        // 'bc6h-rgb-ufloat'\n        // 'bc6h-rgb-float'\n        // 'bc7-rgba-unorm',\n        // 'bc7-rgba-unorm-srgb',\n        ...gl.getExtension('EXT_texture_compression_bptc') ? [\n            'bc6h-rgb-ufloat',\n            'bc6h-rgb-float',\n            'bc7-rgba-unorm',\n            'bc7-rgba-unorm-srgb',\n        ] : [],\n        // BC compressed formats usable if \"texture-compression-bc\" is both\n        // supported by the device/user agent and enabled in requestDevice.\n        // 'bc1-rgba-unorm',\n        // 'bc1-rgba-unorm-srgb',\n        // 'bc4-r-unorm'\n        // 'bc4-r-snorm'\n        // 'bc5-rg-unorm'\n        // 'bc5-rg-snorm'\n        ...gl.getExtension('WEBGL_compressed_texture_s3tc') ? [\n            'bc1-rgba-unorm',\n            'bc2-rgba-unorm',\n            'bc3-rgba-unorm',\n        ] : [],\n        ...gl.getExtension('WEBGL_compressed_texture_s3tc_srgb') ? [\n            'bc1-rgba-unorm-srgb',\n            'bc2-rgba-unorm-srgb',\n            'bc3-rgba-unorm-srgb',\n        ] : [],\n\n        ...gl.getExtension('EXT_texture_compression_rgtc') ? [\n            'bc4-r-unorm',\n            'bc4-r-snorm',\n            'bc5-rg-unorm',\n            'bc5-rg-snorm',\n        ] : [],\n\n        // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\n        // supported by the device/user agent and enabled in requestDevice.\n        ...gl.getExtension('WEBGL_compressed_texture_etc') ? [\n            'etc2-rgb8unorm',\n            'etc2-rgb8unorm-srgb',\n            'etc2-rgba8unorm',\n            'etc2-rgba8unorm-srgb',\n            'etc2-rgb8a1unorm',\n            'etc2-rgb8a1unorm-srgb',\n            'eac-r11unorm',\n            'eac-rg11unorm',\n        ] : [],\n        // 'eac-r11snorm',\n        // 'eac-rg11snorm',\n        // ASTC compressed formats usable if \"texture-compression-astc\" is both\n        // supported by the device/user agent and enabled in requestDevice.\n        ...gl.getExtension('WEBGL_compressed_texture_astc') ? [\n            'astc-4x4-unorm',\n            'astc-4x4-unorm-srgb',\n            'astc-5x4-unorm',\n            'astc-5x4-unorm-srgb',\n            'astc-5x5-unorm',\n            'astc-5x5-unorm-srgb',\n            'astc-6x5-unorm',\n            'astc-6x5-unorm-srgb',\n            'astc-6x6-unorm',\n            'astc-6x6-unorm-srgb',\n            'astc-8x5-unorm',\n            'astc-8x5-unorm-srgb',\n            'astc-8x6-unorm',\n            'astc-8x6-unorm-srgb',\n            'astc-8x8-unorm',\n            'astc-8x8-unorm-srgb',\n            'astc-10x5-unorm',\n            'astc-10x5-unorm-srgb',\n            'astc-10x6-unorm',\n            'astc-10x6-unorm-srgb',\n            'astc-10x8-unorm',\n            'astc-10x8-unorm-srgb',\n            'astc-10x10-unorm',\n            'astc-10x10-unorm-srgb',\n            'astc-12x10-unorm',\n            'astc-12x10-unorm-srgb',\n            'astc-12x12-unorm',\n            'astc-12x12-unorm-srgb'\n        ] : [],\n    ] as TEXTURE_FORMATS[];\n\n    return supportedGLCompressedTextureFormats;\n}\n"],"names":[],"mappings":";AAEA,IAAI,mCAAA,CAAA;AAEG,SAAS,sCAChB,GAAA;AACI,EAAI,IAAA,mCAAA;AAAqC,IAAO,OAAA,mCAAA,CAAA;AAGhD,EAAM,MAAA,MAAA,GA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