UNPKG

@kibeo/loaders.gl-textures

Version:

Framework-independent loaders for compressed and super compressed (basis) textures

124 lines (121 loc) 4.12 kB
import {GL} from '../gl-constants'; const VULKAN_TO_WEBGL_FORMAT_MAP = { 131: GL.COMPRESSED_RGB_S3TC_DXT1_EXT, 132: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, 133: GL.COMPRESSED_RGBA_S3TC_DXT1_EXT, 134: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 135: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT, 136: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 137: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT, 138: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 139: GL.COMPRESSED_RED_RGTC1_EXT, 140: GL.COMPRESSED_SIGNED_RED_RGTC1_EXT, 141: GL.COMPRESSED_RED_GREEN_RGTC2_EXT, 142: GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, 147: GL.COMPRESSED_RGB8_ETC2, 148: GL.COMPRESSED_SRGB8_ETC2, 149: GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 150: GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 151: GL.COMPRESSED_RGBA8_ETC2_EAC, 152: GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 153: GL.COMPRESSED_R11_EAC, 154: GL.COMPRESSED_SIGNED_R11_EAC, 155: GL.COMPRESSED_RG11_EAC, 156: GL.COMPRESSED_SIGNED_RG11_EAC, // @ts-ignore 157: GL.COMPRESSED_RGBA_ASTC_4x4_KHR, // @ts-ignore 158: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, // @ts-ignore 159: GL.COMPRESSED_RGBA_ASTC_5x4_KHR, // @ts-ignore 160: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR, // @ts-ignore 161: GL.COMPRESSED_RGBA_ASTC_5x5_KHR, // @ts-ignore 162: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, // @ts-ignore 163: GL.COMPRESSED_RGBA_ASTC_6x5_KHR, // @ts-ignore 164: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, // @ts-ignore 165: GL.COMPRESSED_RGBA_ASTC_6x6_KHR, // @ts-ignore 166: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, // @ts-ignore 167: GL.COMPRESSED_RGBA_ASTC_8x5_KHR, // @ts-ignore 168: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, // @ts-ignore 169: GL.COMPRESSED_RGBA_ASTC_8x6_KHR, // @ts-ignore 170: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, // @ts-ignore 171: GL.COMPRESSED_RGBA_ASTC_8x8_KHR, // @ts-ignore 172: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, // @ts-ignore 173: GL.COMPRESSED_RGBA_ASTC_10x5_KHR, // @ts-ignore 174: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, // @ts-ignore 175: GL.COMPRESSED_RGBA_ASTC_10x6_KHR, // @ts-ignore 176: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, // @ts-ignore 177: GL.COMPRESSED_RGBA_ASTC_10x8_KHR, // @ts-ignore 178: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, // @ts-ignore 179: GL.COMPRESSED_RGBA_ASTC_10x10_KHR, // @ts-ignore 180: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, // @ts-ignore 181: GL.COMPRESSED_RGBA_ASTC_12x10_KHR, // @ts-ignore 182: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, // @ts-ignore 183: GL.COMPRESSED_RGBA_ASTC_12x12_KHR, // @ts-ignore 184: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 1000054000: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 1000054001: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, // @ts-ignore 1000066000: GL.COMPRESSED_RGBA_ASTC_4x4_KHR, // @ts-ignore 1000066001: GL.COMPRESSED_RGBA_ASTC_5x4_KHR, // @ts-ignore 1000066002: GL.COMPRESSED_RGBA_ASTC_5x5_KHR, // @ts-ignore 1000066003: GL.COMPRESSED_RGBA_ASTC_6x5_KHR, // @ts-ignore 1000066004: GL.COMPRESSED_RGBA_ASTC_6x6_KHR, // @ts-ignore 1000066005: GL.COMPRESSED_RGBA_ASTC_8x5_KHR, // @ts-ignore 1000066006: GL.COMPRESSED_RGBA_ASTC_8x6_KHR, // @ts-ignore 1000066007: GL.COMPRESSED_RGBA_ASTC_8x8_KHR, // @ts-ignore 1000066008: GL.COMPRESSED_RGBA_ASTC_10x5_KHR, // @ts-ignore 1000066009: GL.COMPRESSED_RGBA_ASTC_10x6_KHR, // @ts-ignore 1000066010: GL.COMPRESSED_RGBA_ASTC_10x8_KHR, // @ts-ignore 1000066011: GL.COMPRESSED_RGBA_ASTC_10x10_KHR, // @ts-ignore 1000066012: GL.COMPRESSED_RGBA_ASTC_12x10_KHR, // @ts-ignore 1000066013: GL.COMPRESSED_RGBA_ASTC_12x12_KHR }; /** * Returns WebGl format based on Vulkan format * Vulkan to WebGl format mapping provided here http://github.khronos.org/KTX-Specification/#formatMapping * Vulkan name to format number mapping provided here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFormat.html * @param {Number} vkFormat * @returns {Number} */ export function mapVkFormatToWebGL(vkFormat) { return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat]; }