{"version":3,"file":"getSupportedCompressedTextureFormats.mjs","sources":["../../../../../../src/rendering/renderers/shared/texture/utils/getSupportedCompressedTextureFormats.ts"],"sourcesContent":["import { isWebGLSupported } from '../../../../../utils/browser/isWebGLSupported';\nimport { isWebGPUSupported } from '../../../../../utils/browser/isWebGPUSupported';\nimport { getSupportedGlCompressedTextureFormats } from '../../../gl/texture/utils/getSupportedGlCompressedTextureFormats';\nimport { getSupportedGPUCompressedTextureFormats } from '../../../gpu/texture/utils/getSupportedGPUCompressedTextureFormats';\n\nimport type { TEXTURE_FORMATS } from '../const';\n\nlet supportedCompressedTextureFormats: TEXTURE_FORMATS[];\n\n/** @internal */\nexport async function getSupportedCompressedTextureFormats(): Promise<TEXTURE_FORMATS[]>\n{\n    if (supportedCompressedTextureFormats !== undefined) return supportedCompressedTextureFormats;\n\n    supportedCompressedTextureFormats = await (async (): Promise<TEXTURE_FORMATS[]> =>\n    {\n        // find only overlapping ones..\n        const _isWebGPUSupported = await isWebGPUSupported();\n        const _isWebGLSupported = isWebGLSupported();\n\n        if (_isWebGPUSupported && _isWebGLSupported)\n        {\n            const gpuTextureFormats = await getSupportedGPUCompressedTextureFormats();\n            const glTextureFormats = getSupportedGlCompressedTextureFormats();\n\n            return gpuTextureFormats.filter((format) => glTextureFormats.includes(format));\n        }\n        else if (_isWebGPUSupported)\n        {\n            return await getSupportedGPUCompressedTextureFormats();\n        }\n        else if (_isWebGLSupported)\n        {\n            return getSupportedGlCompressedTextureFormats();\n        }\n\n        return [];\n    })();\n\n    return supportedCompressedTextureFormats;\n}\n"],"names":[],"mappings":";;;;;;AAOA,IAAI,iCAAA;AAGJ,eAAsB,oCAAA,GACtB;AACI,EAAA,IAAI,iCAAA,KAAsC,QAAW,OAAO,iCAAA;AAE5D,EAAA,iCAAA,GAAoC,OAAO,YAC3C;AAEI,IAAA,MAAM,kBAAA,GAAqB,MAAM,iBAAA,EAAkB;AACnD,IAAA,MAAM,oBAAoB,gBAAA,EAAiB;AAE3C,IAAA,IAAI,sBAAsB,iBAAA,EAC1B;AACI,MAAA,MAAM,iBAAA,GAAoB,MAAM,uCAAA,EAAwC;AACxE,MAAA,MAAM,mBAAmB,sCAAA,EAAuC;AAEhE,MAAA,OAAO,kBAAkB,MAAA,CAAO,CAAC,WAAW,gBAAA,CAAiB,QAAA,CAAS,MAAM,CAAC,CAAA;AAAA,IACjF,WACS,kBAAA,EACT;AACI,MAAA,OAAO,MAAM,uCAAA,EAAwC;AAAA,IACzD,WACS,iBAAA,EACT;AACI,MAAA,OAAO,sCAAA,EAAuC;AAAA,IAClD;AAEA,IAAA,OAAO,EAAC;AAAA,EACZ,CAAA,GAAG;AAEH,EAAA,OAAO,iCAAA;AACX;;;;"}