@loaders.gl/textures 4.4.0-alpha.16 → 4.4.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/basis-loader.d.ts +15 -10
- package/dist/basis-loader.d.ts.map +1 -1
- package/dist/basis-loader.js +0 -1
- package/dist/basis-loader.js.map +1 -1
- package/dist/basis-worker-node.js +333 -193
- package/dist/basis-worker.js +267 -128
- package/dist/compressed-texture-loader.d.ts +0 -4
- package/dist/compressed-texture-loader.d.ts.map +1 -1
- package/dist/compressed-texture-loader.js +0 -1
- package/dist/compressed-texture-loader.js.map +1 -1
- package/dist/compressed-texture-worker.js +1050 -331
- package/dist/crunch-loader.d.ts +1 -5
- package/dist/crunch-loader.d.ts.map +1 -1
- package/dist/crunch-loader.js +1 -3
- package/dist/crunch-loader.js.map +1 -1
- package/dist/crunch-worker.js +153 -86
- package/dist/dist.dev.js +1281 -388
- package/dist/dist.min.js +1 -2
- package/dist/index.cjs +671 -330
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/ktx2-basis-writer-worker-node.js +14 -3
- package/dist/ktx2-basis-writer-worker.js +13 -3
- package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts.map +1 -1
- package/dist/lib/encoders/encode-ktx2-basis-texture.js +2 -1
- package/dist/lib/encoders/encode-ktx2-basis-texture.js.map +1 -1
- package/dist/lib/gl-extensions.d.ts +164 -58
- package/dist/lib/gl-extensions.d.ts.map +1 -1
- package/dist/lib/gl-extensions.js +175 -66
- package/dist/lib/gl-extensions.js.map +1 -1
- package/dist/lib/parsers/crunch-module-loader.d.ts +2 -2
- package/dist/lib/parsers/crunch-module-loader.d.ts.map +1 -1
- package/dist/lib/parsers/crunch-module-loader.js.map +1 -1
- package/dist/lib/parsers/parse-basis.d.ts +16 -2
- package/dist/lib/parsers/parse-basis.d.ts.map +1 -1
- package/dist/lib/parsers/parse-basis.js +222 -47
- package/dist/lib/parsers/parse-basis.js.map +1 -1
- package/dist/lib/parsers/parse-crunch.d.ts.map +1 -1
- package/dist/lib/parsers/parse-crunch.js +6 -5
- package/dist/lib/parsers/parse-crunch.js.map +1 -1
- package/dist/lib/parsers/parse-dds.d.ts.map +1 -1
- package/dist/lib/parsers/parse-dds.js +7 -7
- package/dist/lib/parsers/parse-dds.js.map +1 -1
- package/dist/lib/parsers/parse-ktx.d.ts.map +1 -1
- package/dist/lib/parsers/parse-ktx.js +7 -0
- package/dist/lib/parsers/parse-ktx.js.map +1 -1
- package/dist/lib/parsers/parse-pvr.d.ts.map +1 -1
- package/dist/lib/parsers/parse-pvr.js +28 -70
- package/dist/lib/parsers/parse-pvr.js.map +1 -1
- package/dist/lib/utils/detect-supported-texture-formats.d.ts +14 -0
- package/dist/lib/utils/detect-supported-texture-formats.d.ts.map +1 -0
- package/dist/lib/utils/detect-supported-texture-formats.js +197 -0
- package/dist/lib/utils/detect-supported-texture-formats.js.map +1 -0
- package/dist/lib/utils/extract-mipmap-images.d.ts +2 -2
- package/dist/lib/utils/extract-mipmap-images.d.ts.map +1 -1
- package/dist/lib/utils/extract-mipmap-images.js +12 -2
- package/dist/lib/utils/extract-mipmap-images.js.map +1 -1
- package/dist/lib/utils/ktx-format-helper.d.ts +2 -1
- package/dist/lib/utils/ktx-format-helper.d.ts.map +1 -1
- package/dist/lib/utils/ktx-format-helper.js +67 -109
- package/dist/lib/utils/ktx-format-helper.js.map +1 -1
- package/dist/lib/utils/texture-format-map.d.ts +3 -0
- package/dist/lib/utils/texture-format-map.d.ts.map +1 -0
- package/dist/lib/utils/texture-format-map.js +71 -0
- package/dist/lib/utils/texture-format-map.js.map +1 -0
- package/dist/lib/utils/version.js +1 -1
- package/dist/npy-worker.js +1 -1
- package/dist/workers/crunch-worker.d.ts +1 -3
- package/dist/workers/crunch-worker.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/basis-loader.ts +19 -9
- package/src/compressed-texture-loader.ts +0 -3
- package/src/crunch-loader.ts +1 -5
- package/src/index.ts +2 -4
- package/src/lib/encoders/encode-ktx2-basis-texture.ts +2 -1
- package/src/lib/gl-extensions.ts +186 -81
- package/src/lib/parsers/crunch-module-loader.ts +4 -4
- package/src/lib/parsers/parse-basis.ts +281 -45
- package/src/lib/parsers/parse-crunch.ts +15 -7
- package/src/lib/parsers/parse-dds.ts +16 -9
- package/src/lib/parsers/parse-ktx.ts +12 -2
- package/src/lib/parsers/parse-pvr.ts +72 -72
- package/src/lib/utils/detect-supported-texture-formats.ts +210 -0
- package/src/lib/utils/extract-mipmap-images.ts +15 -4
- package/src/lib/utils/ktx-format-helper.ts +124 -111
- package/src/lib/utils/texture-format-map.ts +135 -0
- package/dist/lib/utils/texture-formats.d.ts +0 -8
- package/dist/lib/utils/texture-formats.d.ts.map +0 -1
- package/dist/lib/utils/texture-formats.js +0 -51
- package/dist/lib/utils/texture-formats.js.map +0 -1
- package/src/lib/utils/texture-formats.ts +0 -59
|
@@ -6,8 +6,50 @@
|
|
|
6
6
|
// Forked from PicoGL: https://github.com/tsherif/picogl.js/blob/master/examples/utils/utils.js
|
|
7
7
|
// Copyright (c) 2017 Tarek Sherif, The MIT License (MIT)
|
|
8
8
|
|
|
9
|
-
import type {TextureLevel} from '@loaders.gl/schema';
|
|
10
|
-
import {
|
|
9
|
+
import type {GLTextureFormat, TextureLevel} from '@loaders.gl/schema';
|
|
10
|
+
import {
|
|
11
|
+
GL_COMPRESSED_R11_EAC,
|
|
12
|
+
GL_COMPRESSED_RG11_EAC,
|
|
13
|
+
GL_COMPRESSED_RGB8_ETC2,
|
|
14
|
+
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
15
|
+
GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
16
|
+
GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
|
|
17
|
+
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
18
|
+
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
19
|
+
GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
20
|
+
GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
21
|
+
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
22
|
+
GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
23
|
+
GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
24
|
+
GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
25
|
+
GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
26
|
+
GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
27
|
+
GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
28
|
+
GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
29
|
+
GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
30
|
+
GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
31
|
+
GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
32
|
+
GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
33
|
+
GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
34
|
+
GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
35
|
+
GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
36
|
+
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
37
|
+
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
38
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
39
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
40
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
41
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
42
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
43
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
44
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
45
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
46
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
47
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
48
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
49
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
50
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
51
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
|
|
52
|
+
} from '../gl-extensions';
|
|
11
53
|
import {extractMipmapImages} from '../utils/extract-mipmap-images';
|
|
12
54
|
|
|
13
55
|
const PVR_CONSTANTS: Record<string, number> = {
|
|
@@ -24,76 +66,34 @@ const PVR_CONSTANTS: Record<string, number> = {
|
|
|
24
66
|
METADATA_SIZE_INDEX: 12
|
|
25
67
|
};
|
|
26
68
|
|
|
27
|
-
const PVR_PIXEL_FORMATS: Record<number,
|
|
28
|
-
0: [
|
|
29
|
-
1: [
|
|
30
|
-
2: [
|
|
31
|
-
3: [
|
|
32
|
-
6: [
|
|
33
|
-
7: [
|
|
34
|
-
9: [
|
|
35
|
-
11: [
|
|
36
|
-
22: [
|
|
37
|
-
23: [
|
|
38
|
-
24: [
|
|
39
|
-
25: [
|
|
40
|
-
26: [
|
|
41
|
-
27: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
],
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR
|
|
56
|
-
],
|
|
57
|
-
31: [
|
|
58
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X6_KHR,
|
|
59
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR
|
|
60
|
-
],
|
|
61
|
-
32: [
|
|
62
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X5_KHR,
|
|
63
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR
|
|
64
|
-
],
|
|
65
|
-
33: [
|
|
66
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X6_KHR,
|
|
67
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR
|
|
68
|
-
],
|
|
69
|
-
34: [
|
|
70
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X8_KHR,
|
|
71
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR
|
|
72
|
-
],
|
|
73
|
-
35: [
|
|
74
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X5_KHR,
|
|
75
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR
|
|
76
|
-
],
|
|
77
|
-
36: [
|
|
78
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X6_KHR,
|
|
79
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR
|
|
80
|
-
],
|
|
81
|
-
37: [
|
|
82
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X8_KHR,
|
|
83
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR
|
|
84
|
-
],
|
|
85
|
-
38: [
|
|
86
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X10_KHR,
|
|
87
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR
|
|
88
|
-
],
|
|
89
|
-
39: [
|
|
90
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X10_KHR,
|
|
91
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR
|
|
92
|
-
],
|
|
93
|
-
40: [
|
|
94
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X12_KHR,
|
|
95
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR
|
|
96
|
-
]
|
|
69
|
+
const PVR_PIXEL_FORMATS: Record<number, GLTextureFormat[]> = {
|
|
70
|
+
0: [GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG],
|
|
71
|
+
1: [GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],
|
|
72
|
+
2: [GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG],
|
|
73
|
+
3: [GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],
|
|
74
|
+
6: [GL_COMPRESSED_RGB_ETC1_WEBGL],
|
|
75
|
+
7: [GL_COMPRESSED_RGB_S3TC_DXT1_EXT],
|
|
76
|
+
9: [GL_COMPRESSED_RGBA_S3TC_DXT3_EXT],
|
|
77
|
+
11: [GL_COMPRESSED_RGBA_S3TC_DXT5_EXT],
|
|
78
|
+
22: [GL_COMPRESSED_RGB8_ETC2],
|
|
79
|
+
23: [GL_COMPRESSED_RGBA8_ETC2_EAC],
|
|
80
|
+
24: [GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],
|
|
81
|
+
25: [GL_COMPRESSED_R11_EAC],
|
|
82
|
+
26: [GL_COMPRESSED_RG11_EAC],
|
|
83
|
+
27: [GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR],
|
|
84
|
+
28: [GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR],
|
|
85
|
+
29: [GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR],
|
|
86
|
+
30: [GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR],
|
|
87
|
+
31: [GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR],
|
|
88
|
+
32: [GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR],
|
|
89
|
+
33: [GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR],
|
|
90
|
+
34: [GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR],
|
|
91
|
+
35: [GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR],
|
|
92
|
+
36: [GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR],
|
|
93
|
+
37: [GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR],
|
|
94
|
+
38: [GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR],
|
|
95
|
+
39: [GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR],
|
|
96
|
+
40: [GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR]
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const PVR_SIZE_FUNCTIONS: Record<number, (width: number, height: number) => number> = {
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {GPUTextureFormat, TextureFormat} from '@loaders.gl/schema';
|
|
6
|
+
|
|
7
|
+
const BROWSER_PREFIXES = ['', 'WEBKIT_', 'MOZ_'];
|
|
8
|
+
|
|
9
|
+
const WEBGL_TEXTURE_FORMATS: {[key: string]: TextureFormat[]} = {
|
|
10
|
+
/* eslint-disable camelcase */
|
|
11
|
+
WEBGL_compressed_texture_s3tc: [
|
|
12
|
+
'bc1-rgb-unorm-webgl',
|
|
13
|
+
'bc1-rgba-unorm',
|
|
14
|
+
'bc2-rgba-unorm',
|
|
15
|
+
'bc3-rgba-unorm'
|
|
16
|
+
],
|
|
17
|
+
WEBGL_compressed_texture_s3tc_srgb: [
|
|
18
|
+
'bc1-rgb-unorm-srgb-webgl',
|
|
19
|
+
'bc1-rgba-unorm-srgb',
|
|
20
|
+
'bc2-rgba-unorm-srgb',
|
|
21
|
+
'bc3-rgba-unorm-srgb'
|
|
22
|
+
],
|
|
23
|
+
EXT_texture_compression_rgtc: ['bc4-r-unorm', 'bc4-r-snorm', 'bc5-rg-unorm', 'bc5-rg-snorm'],
|
|
24
|
+
EXT_texture_compression_bptc: [
|
|
25
|
+
'bc6h-rgb-ufloat',
|
|
26
|
+
'bc6h-rgb-float',
|
|
27
|
+
'bc7-rgba-unorm',
|
|
28
|
+
'bc7-rgba-unorm-srgb'
|
|
29
|
+
],
|
|
30
|
+
WEBGL_compressed_texture_etc1: ['etc1-rbg-unorm-webgl'],
|
|
31
|
+
WEBGL_compressed_texture_etc: [
|
|
32
|
+
'etc2-rgb8unorm',
|
|
33
|
+
'etc2-rgb8unorm-srgb',
|
|
34
|
+
'etc2-rgb8a1unorm',
|
|
35
|
+
'etc2-rgb8a1unorm-srgb',
|
|
36
|
+
'etc2-rgba8unorm',
|
|
37
|
+
'etc2-rgba8unorm-srgb',
|
|
38
|
+
'eac-r11unorm',
|
|
39
|
+
'eac-r11snorm',
|
|
40
|
+
'eac-rg11unorm',
|
|
41
|
+
'eac-rg11snorm'
|
|
42
|
+
],
|
|
43
|
+
WEBGL_compressed_texture_pvrtc: [
|
|
44
|
+
'pvrtc-rgb4unorm-webgl',
|
|
45
|
+
'pvrtc-rgba4unorm-webgl',
|
|
46
|
+
'pvrtc-rbg2unorm-webgl',
|
|
47
|
+
'pvrtc-rgba2unorm-webgl'
|
|
48
|
+
],
|
|
49
|
+
WEBGL_compressed_texture_atc: [
|
|
50
|
+
'atc-rgb-unorm-webgl',
|
|
51
|
+
'atc-rgba-unorm-webgl',
|
|
52
|
+
'atc-rgbai-unorm-webgl'
|
|
53
|
+
],
|
|
54
|
+
WEBGL_compressed_texture_astc: [
|
|
55
|
+
'astc-4x4-unorm',
|
|
56
|
+
'astc-4x4-unorm-srgb',
|
|
57
|
+
'astc-5x4-unorm',
|
|
58
|
+
'astc-5x4-unorm-srgb',
|
|
59
|
+
'astc-5x5-unorm',
|
|
60
|
+
'astc-5x5-unorm-srgb',
|
|
61
|
+
'astc-6x5-unorm',
|
|
62
|
+
'astc-6x5-unorm-srgb',
|
|
63
|
+
'astc-6x6-unorm',
|
|
64
|
+
'astc-6x6-unorm-srgb',
|
|
65
|
+
'astc-8x5-unorm',
|
|
66
|
+
'astc-8x5-unorm-srgb',
|
|
67
|
+
'astc-8x6-unorm',
|
|
68
|
+
'astc-8x6-unorm-srgb',
|
|
69
|
+
'astc-8x8-unorm',
|
|
70
|
+
'astc-8x8-unorm-srgb',
|
|
71
|
+
'astc-10x5-unorm',
|
|
72
|
+
'astc-10x5-unorm-srgb',
|
|
73
|
+
'astc-10x6-unorm',
|
|
74
|
+
'astc-10x6-unorm-srgb',
|
|
75
|
+
'astc-10x8-unorm',
|
|
76
|
+
'astc-10x8-unorm-srgb',
|
|
77
|
+
'astc-10x10-unorm',
|
|
78
|
+
'astc-10x10-unorm-srgb',
|
|
79
|
+
'astc-12x10-unorm',
|
|
80
|
+
'astc-12x10-unorm-srgb',
|
|
81
|
+
'astc-12x12-unorm',
|
|
82
|
+
'astc-12x12-unorm-srgb'
|
|
83
|
+
]
|
|
84
|
+
/* eslint-enable camelcase */
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const GPU_TEXTURE_FORMATS: {[key in GPUTextureFormat]: TextureFormat[]} = {
|
|
88
|
+
dxt: ['bc1-rgb-unorm-webgl', 'bc1-rgba-unorm', 'bc2-rgba-unorm', 'bc3-rgba-unorm'],
|
|
89
|
+
'dxt-srgb': [
|
|
90
|
+
'bc1-rgb-unorm-srgb-webgl',
|
|
91
|
+
'bc1-rgba-unorm-srgb',
|
|
92
|
+
'bc2-rgba-unorm-srgb',
|
|
93
|
+
'bc3-rgba-unorm-srgb'
|
|
94
|
+
],
|
|
95
|
+
etc1: ['etc1-rbg-unorm-webgl'],
|
|
96
|
+
etc2: [
|
|
97
|
+
'etc2-rgb8unorm',
|
|
98
|
+
'etc2-rgb8unorm-srgb',
|
|
99
|
+
'etc2-rgb8a1unorm',
|
|
100
|
+
'etc2-rgb8a1unorm-srgb',
|
|
101
|
+
'etc2-rgba8unorm',
|
|
102
|
+
'etc2-rgba8unorm-srgb',
|
|
103
|
+
'eac-r11unorm',
|
|
104
|
+
'eac-r11snorm',
|
|
105
|
+
'eac-rg11unorm',
|
|
106
|
+
'eac-rg11snorm'
|
|
107
|
+
],
|
|
108
|
+
pvrtc: [
|
|
109
|
+
'pvrtc-rgb4unorm-webgl',
|
|
110
|
+
'pvrtc-rgba4unorm-webgl',
|
|
111
|
+
'pvrtc-rbg2unorm-webgl',
|
|
112
|
+
'pvrtc-rgba2unorm-webgl'
|
|
113
|
+
],
|
|
114
|
+
atc: ['atc-rgb-unorm-webgl', 'atc-rgba-unorm-webgl', 'atc-rgbai-unorm-webgl'],
|
|
115
|
+
astc: [
|
|
116
|
+
'astc-4x4-unorm',
|
|
117
|
+
'astc-4x4-unorm-srgb',
|
|
118
|
+
'astc-5x4-unorm',
|
|
119
|
+
'astc-5x4-unorm-srgb',
|
|
120
|
+
'astc-5x5-unorm',
|
|
121
|
+
'astc-5x5-unorm-srgb',
|
|
122
|
+
'astc-6x5-unorm',
|
|
123
|
+
'astc-6x5-unorm-srgb',
|
|
124
|
+
'astc-6x6-unorm',
|
|
125
|
+
'astc-6x6-unorm-srgb',
|
|
126
|
+
'astc-8x5-unorm',
|
|
127
|
+
'astc-8x5-unorm-srgb',
|
|
128
|
+
'astc-8x6-unorm',
|
|
129
|
+
'astc-8x6-unorm-srgb',
|
|
130
|
+
'astc-8x8-unorm',
|
|
131
|
+
'astc-8x8-unorm-srgb',
|
|
132
|
+
'astc-10x5-unorm',
|
|
133
|
+
'astc-10x5-unorm-srgb',
|
|
134
|
+
'astc-10x6-unorm',
|
|
135
|
+
'astc-10x6-unorm-srgb',
|
|
136
|
+
'astc-10x8-unorm',
|
|
137
|
+
'astc-10x8-unorm-srgb',
|
|
138
|
+
'astc-10x10-unorm',
|
|
139
|
+
'astc-10x10-unorm-srgb',
|
|
140
|
+
'astc-12x10-unorm',
|
|
141
|
+
'astc-12x10-unorm-srgb',
|
|
142
|
+
'astc-12x12-unorm',
|
|
143
|
+
'astc-12x12-unorm-srgb'
|
|
144
|
+
],
|
|
145
|
+
rgtc: ['bc4-r-unorm', 'bc4-r-snorm', 'bc5-rg-unorm', 'bc5-rg-snorm']
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
let formats: Set<GPUTextureFormat> | null = null;
|
|
149
|
+
let textureFormats: Set<TextureFormat> | null = null;
|
|
150
|
+
|
|
151
|
+
// DEPRECATED
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated Pass `basis.supportedTextureFormats` to Basis loaders instead of relying on global detection.
|
|
154
|
+
*/
|
|
155
|
+
export function detectSupportedTextureFormats(gl?: WebGLRenderingContext): Set<TextureFormat> {
|
|
156
|
+
if (!textureFormats) {
|
|
157
|
+
gl = gl || getWebGLContext() || undefined;
|
|
158
|
+
textureFormats = new Set<TextureFormat>();
|
|
159
|
+
|
|
160
|
+
for (const prefix of BROWSER_PREFIXES) {
|
|
161
|
+
for (const extension in WEBGL_TEXTURE_FORMATS) {
|
|
162
|
+
if (gl && gl.getExtension(`${prefix}${extension}`)) {
|
|
163
|
+
for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
|
|
164
|
+
textureFormats.add(textureFormat);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return textureFormats;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// DEPRECATED
|
|
175
|
+
/**
|
|
176
|
+
* Returns a list of formats.
|
|
177
|
+
* Creates a temporary WebGLRenderingContext if none is provided.
|
|
178
|
+
*
|
|
179
|
+
* @deprecated Pass `basis.supportedTextureFormats` to Basis loaders instead of relying on global detection.
|
|
180
|
+
* @param gl - Optional context.
|
|
181
|
+
*/
|
|
182
|
+
export function detectSupportedGPUTextureFormats(gl?: WebGLRenderingContext): Set<string> {
|
|
183
|
+
if (!formats) {
|
|
184
|
+
formats = new Set<GPUTextureFormat>();
|
|
185
|
+
const supportedTextureFormats = detectSupportedTextureFormats(gl);
|
|
186
|
+
|
|
187
|
+
for (const gpuTextureFormat in GPU_TEXTURE_FORMATS) {
|
|
188
|
+
const textureFormatsForGroup = GPU_TEXTURE_FORMATS[gpuTextureFormat as GPUTextureFormat];
|
|
189
|
+
if (
|
|
190
|
+
textureFormatsForGroup.some((textureFormat) => supportedTextureFormats.has(textureFormat))
|
|
191
|
+
) {
|
|
192
|
+
formats.add(gpuTextureFormat as GPUTextureFormat);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return formats;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @returns {WebGLRenderingContext?}
|
|
202
|
+
*/
|
|
203
|
+
function getWebGLContext() {
|
|
204
|
+
try {
|
|
205
|
+
const canvas = document.createElement('canvas');
|
|
206
|
+
return canvas.getContext('webgl');
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {TextureLevel} from '@loaders.gl/schema';
|
|
5
|
+
import type {GLTextureFormat, TextureLevel} from '@loaders.gl/schema';
|
|
6
|
+
import {getTextureFormatFromWebGLFormat} from './texture-format-map';
|
|
6
7
|
|
|
7
8
|
export type CompressedTextureExtractOptions = {
|
|
8
9
|
mipMapLevels: number;
|
|
9
10
|
width: number;
|
|
10
11
|
height: number;
|
|
11
12
|
sizeFunction: Function;
|
|
12
|
-
internalFormat
|
|
13
|
+
internalFormat?: GLTextureFormat;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -27,6 +28,8 @@ export function extractMipmapImages(
|
|
|
27
28
|
options: CompressedTextureExtractOptions
|
|
28
29
|
): TextureLevel[] {
|
|
29
30
|
const images = new Array(options.mipMapLevels);
|
|
31
|
+
const format = options.internalFormat;
|
|
32
|
+
const textureFormat = format === undefined ? undefined : getTextureFormatFromWebGLFormat(format);
|
|
30
33
|
|
|
31
34
|
let levelWidth = options.width;
|
|
32
35
|
let levelHeight = options.height;
|
|
@@ -38,15 +41,23 @@ export function extractMipmapImages(
|
|
|
38
41
|
// @ts-expect-error
|
|
39
42
|
const levelData = getLevelData(data, i, offset, levelSize);
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
const image: TextureLevel = {
|
|
45
|
+
shape: 'texture-level',
|
|
42
46
|
compressed: true,
|
|
43
|
-
format: options.internalFormat,
|
|
44
47
|
data: levelData,
|
|
45
48
|
width: levelWidth,
|
|
46
49
|
height: levelHeight,
|
|
47
50
|
levelSize
|
|
48
51
|
};
|
|
49
52
|
|
|
53
|
+
if (format !== undefined) {
|
|
54
|
+
image.format = format;
|
|
55
|
+
}
|
|
56
|
+
if (textureFormat) {
|
|
57
|
+
image.textureFormat = textureFormat;
|
|
58
|
+
}
|
|
59
|
+
images[i] = image;
|
|
60
|
+
|
|
50
61
|
levelWidth = Math.max(1, levelWidth >> 1);
|
|
51
62
|
levelHeight = Math.max(1, levelHeight >> 1);
|
|
52
63
|
|
|
@@ -2,117 +2,130 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
import type {GLTextureFormat} from '@loaders.gl/schema';
|
|
7
|
+
import {
|
|
8
|
+
GL_COMPRESSED_R11_EAC,
|
|
9
|
+
GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
10
|
+
GL_COMPRESSED_RED_RGTC1_EXT,
|
|
11
|
+
GL_COMPRESSED_RG11_EAC,
|
|
12
|
+
GL_COMPRESSED_RGB8_ETC2,
|
|
13
|
+
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
14
|
+
GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
15
|
+
GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
16
|
+
GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
17
|
+
GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
18
|
+
GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
19
|
+
GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
20
|
+
GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
21
|
+
GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
22
|
+
GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
23
|
+
GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
24
|
+
GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
25
|
+
GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
26
|
+
GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
27
|
+
GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
28
|
+
GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
29
|
+
GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
30
|
+
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
31
|
+
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
32
|
+
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
33
|
+
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
34
|
+
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
35
|
+
GL_COMPRESSED_SIGNED_R11_EAC,
|
|
36
|
+
GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
37
|
+
GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
38
|
+
GL_COMPRESSED_SIGNED_RG11_EAC,
|
|
39
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
40
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
41
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
42
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
43
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
44
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
45
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
46
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
47
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
48
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
49
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
50
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
51
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
52
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
53
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
54
|
+
GL_COMPRESSED_SRGB8_ETC2,
|
|
55
|
+
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
56
|
+
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
57
|
+
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
58
|
+
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
59
|
+
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
|
|
60
|
+
} from '../gl-extensions';
|
|
6
61
|
|
|
7
|
-
const VULKAN_TO_WEBGL_FORMAT_MAP: Record<number,
|
|
8
|
-
131:
|
|
9
|
-
132:
|
|
10
|
-
133:
|
|
11
|
-
134:
|
|
12
|
-
135:
|
|
13
|
-
136:
|
|
14
|
-
137:
|
|
15
|
-
138:
|
|
16
|
-
139:
|
|
17
|
-
140:
|
|
18
|
-
141:
|
|
19
|
-
142:
|
|
20
|
-
147:
|
|
21
|
-
148:
|
|
22
|
-
149:
|
|
23
|
-
150:
|
|
24
|
-
151:
|
|
25
|
-
152:
|
|
26
|
-
153:
|
|
27
|
-
154:
|
|
28
|
-
155:
|
|
29
|
-
156:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
78
|
-
// @ts-ignore
|
|
79
|
-
181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
86
|
-
1000054000: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
87
|
-
1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
1000066000: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
92
|
-
// @ts-ignore
|
|
93
|
-
1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
102
|
-
// @ts-ignore
|
|
103
|
-
1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
|
|
62
|
+
const VULKAN_TO_WEBGL_FORMAT_MAP: Record<number, GLTextureFormat> = {
|
|
63
|
+
131: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
64
|
+
132: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
65
|
+
133: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
66
|
+
134: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
67
|
+
135: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
68
|
+
136: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
69
|
+
137: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
70
|
+
138: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
71
|
+
139: GL_COMPRESSED_RED_RGTC1_EXT,
|
|
72
|
+
140: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
73
|
+
141: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
74
|
+
142: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
75
|
+
147: GL_COMPRESSED_RGB8_ETC2,
|
|
76
|
+
148: GL_COMPRESSED_SRGB8_ETC2,
|
|
77
|
+
149: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
78
|
+
150: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
79
|
+
151: GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
80
|
+
152: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
81
|
+
153: GL_COMPRESSED_R11_EAC,
|
|
82
|
+
154: GL_COMPRESSED_SIGNED_R11_EAC,
|
|
83
|
+
155: GL_COMPRESSED_RG11_EAC,
|
|
84
|
+
156: GL_COMPRESSED_SIGNED_RG11_EAC,
|
|
85
|
+
157: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
86
|
+
158: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
87
|
+
159: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
88
|
+
160: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
89
|
+
161: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
90
|
+
162: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
91
|
+
163: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
92
|
+
164: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
93
|
+
165: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
94
|
+
166: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
95
|
+
167: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
96
|
+
168: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
97
|
+
169: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
98
|
+
170: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
99
|
+
171: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
100
|
+
172: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
101
|
+
173: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
102
|
+
174: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
103
|
+
175: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
104
|
+
176: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
105
|
+
177: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
106
|
+
178: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
107
|
+
179: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
108
|
+
180: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
109
|
+
181: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
110
|
+
182: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
111
|
+
183: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
112
|
+
184: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
113
|
+
1000054000: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
114
|
+
1000054001: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
115
|
+
1000066000: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
116
|
+
1000066001: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
117
|
+
1000066002: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
118
|
+
1000066003: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
119
|
+
1000066004: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
120
|
+
1000066005: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
121
|
+
1000066006: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
122
|
+
1000066007: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
123
|
+
1000066008: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
124
|
+
1000066009: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
125
|
+
1000066010: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
126
|
+
1000066011: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
127
|
+
1000066012: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
128
|
+
1000066013: GL_COMPRESSED_RGBA_ASTC_12x12_KHR
|
|
116
129
|
};
|
|
117
130
|
|
|
118
131
|
/**
|
|
@@ -122,6 +135,6 @@ const VULKAN_TO_WEBGL_FORMAT_MAP: Record<number, number> = {
|
|
|
122
135
|
* @param vkFormat
|
|
123
136
|
* @returns WebGL / OpenGL constant
|
|
124
137
|
*/
|
|
125
|
-
export function mapVkFormatToWebGL(vkFormat: number):
|
|
138
|
+
export function mapVkFormatToWebGL(vkFormat: number): GLTextureFormat | undefined {
|
|
126
139
|
return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
|
|
127
140
|
}
|