UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

1 lines 2.55 kB
{"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,CAAA;AAGJ,eAAsB,oCACtB,GAAA;AACI,EAAA,IAAI,iCAAsC,KAAA,KAAA,CAAA;AAAW,IAAO,OAAA,iCAAA,CAAA;AAE5D,EAAA,iCAAA,GAAoC,OAAO,YAC3C;AAEI,IAAM,MAAA,kBAAA,GAAqB,MAAM,iBAAkB,EAAA,CAAA;AACnD,IAAA,MAAM,oBAAoB,gBAAiB,EAAA,CAAA;AAE3C,IAAA,IAAI,sBAAsB,iBAC1B,EAAA;AACI,MAAM,MAAA,iBAAA,GAAoB,MAAM,uCAAwC,EAAA,CAAA;AACxE,MAAA,MAAM,mBAAmB,sCAAuC,EAAA,CAAA;AAEhE,MAAA,OAAO,kBAAkB,MAAO,CAAA,CAAC,WAAW,gBAAiB,CAAA,QAAA,CAAS,MAAM,CAAC,CAAA,CAAA;AAAA,eAExE,kBACT,EAAA;AACI,MAAA,OAAO,MAAM,uCAAwC,EAAA,CAAA;AAAA,eAEhD,iBACT,EAAA;AACI,MAAA,OAAO,sCAAuC,EAAA,CAAA;AAAA,KAClD;AAEA,IAAA,OAAO,EAAC,CAAA;AAAA,GACT,GAAA,CAAA;AAEH,EAAO,OAAA,iCAAA,CAAA;AACX;;;;"}