/
githubmirror
/
pixijs
Обзор
Документация
Войти
/
githubmirror
/
pixijs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
src/rendering/renderers/shared/texture/utils/getSupportedCompressedTextureFormats.ts
41 строка
2 KB
Zyie
chore: documentation overhaul with typedoc (#11423)
19 май 2025, 11:44
Не верифицирован
19 май 2025, 11:44
34926f0
Код
Авторство
О чём код?
import { isWebGLSupported } from '../../../../../utils/browser/isWebGLSupported'; import { isWebGPUSupported } from '../../../../../utils/browser/isWebGPUSupported'; import { getSupportedGlCompressedTextureFormats } from '../../../gl/texture/utils/getSupportedGlCompressedTextureFormats'; import { getSupportedGPUCompressedTextureFormats } from '../../../gpu/texture/utils/getSupportedGPUCompressedTextureFormats'; import type { TEXTURE_FORMATS } from '../const'; let supportedCompressedTextureFormats: TEXTURE_FORMATS[]; /** @internal */ export async function getSupportedCompressedTextureFormats(): Promise<TEXTURE_FORMATS[]> { if (supportedCompressedTextureFormats !== undefined) return supportedCompressedTextureFormats; supportedCompressedTextureFormats = await (async (): Promise<TEXTURE_FORMATS[]> => { // find only overlapping ones.. const _isWebGPUSupported = await isWebGPUSupported(); const _isWebGLSupported = isWebGLSupported(); if (_isWebGPUSupported && _isWebGLSupported) { const gpuTextureFormats = await getSupportedGPUCompressedTextureFormats(); const glTextureFormats = getSupportedGlCompressedTextureFormats(); return gpuTextureFormats.filter((format) => glTextureFormats.includes(format)); } else if (_isWebGPUSupported) { return await getSupportedGPUCompressedTextureFormats(); } else if (_isWebGLSupported) { return getSupportedGlCompressedTextureFormats(); } return []; })(); return supportedCompressedTextureFormats; }