@predy-js/render-interface 0.0.6
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/dist/index.js +5545 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5524 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/common/console.d.ts +3 -0
- package/dist/src/common/env.d.ts +1 -0
- package/dist/src/common/raf.d.ts +2 -0
- package/dist/src/common/request.d.ts +10 -0
- package/dist/src/common/utils.d.ts +14 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/render/MarsExtWrap.d.ts +15 -0
- package/dist/src/render/MarsGPUCapability.d.ts +2 -0
- package/dist/src/render/MarsGeometry.d.ts +64 -0
- package/dist/src/render/MarsMaterial.d.ts +29 -0
- package/dist/src/render/MarsMaterialDataBlock.d.ts +37 -0
- package/dist/src/render/MarsMesh.d.ts +24 -0
- package/dist/src/render/MarsRenderFrame.d.ts +22 -0
- package/dist/src/render/MarsRenderPass.d.ts +51 -0
- package/dist/src/render/MarsRenderPassColorAttachment.d.ts +27 -0
- package/dist/src/render/MarsRenderer.d.ts +20 -0
- package/dist/src/render/MarsSemanticMap.d.ts +10 -0
- package/dist/src/render/MarsSharedGeometry.d.ts +13 -0
- package/dist/src/render/MarsTexture.d.ts +29 -0
- package/dist/src/render/MarsTextureFactory.d.ts +20 -0
- package/dist/src/render/RenderFrameInternal.d.ts +8 -0
- package/dist/src/statistic/index.d.ts +20 -0
- package/dist/src/webgl/GLFrameBuffer.d.ts +45 -0
- package/dist/src/webgl/GLGPUBuffer.d.ts +27 -0
- package/dist/src/webgl/GLGPUCapability.d.ts +32 -0
- package/dist/src/webgl/GLGPURenderer.d.ts +57 -0
- package/dist/src/webgl/GLGeometry.d.ts +52 -0
- package/dist/src/webgl/GLMaterial.d.ts +15 -0
- package/dist/src/webgl/GLProgram.d.ts +42 -0
- package/dist/src/webgl/GLRenderBuffer.d.ts +22 -0
- package/dist/src/webgl/GLShaderLibrary.d.ts +33 -0
- package/dist/src/webgl/GLTexture.d.ts +35 -0
- package/dist/src/webgl/GLUniformUtils.d.ts +42 -0
- package/dist/src/webgl/GLVertexArrayObject.d.ts +11 -0
- package/dist/src/webgl/KhronosTextureContainer.d.ts +25 -0
- package/dist/src/webgl/WebGLState.d.ts +285 -0
- package/dist/src/webgl/constants.d.ts +4 -0
- package/dist/src/webgl/glType.d.ts +8 -0
- package/dist/statistic.js +406 -0
- package/dist/statistic.js.map +1 -0
- package/dist/types/Camera.d.ts +12 -0
- package/dist/types/Canvas.d.ts +12 -0
- package/dist/types/GPUBuffer.d.ts +54 -0
- package/dist/types/GPUCapability.d.ts +50 -0
- package/dist/types/Geometry.d.ts +142 -0
- package/dist/types/IGPURenderer.d.ts +14 -0
- package/dist/types/Material.d.ts +156 -0
- package/dist/types/Mesh.d.ts +50 -0
- package/dist/types/RenderFrame.d.ts +50 -0
- package/dist/types/RenderPass.d.ts +156 -0
- package/dist/types/Renderer.d.ts +52 -0
- package/dist/types/Scene.d.ts +48 -0
- package/dist/types/ShaderLibrary.d.ts +78 -0
- package/dist/types/Texture.d.ts +212 -0
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/type.d.ts +37 -0
- package/package.json +54 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Name: @predy-js/render-interface
|
|
3
|
+
* Description: undefined
|
|
4
|
+
* Author: undefined
|
|
5
|
+
* Version: v0.0.6
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
|
|
9
|
+
/* PixelFormat */
|
|
10
|
+
const ALPHA = 0x1906;
|
|
11
|
+
const RGB = 0x1907;
|
|
12
|
+
const RGBA = 0x1908;
|
|
13
|
+
const LUMINANCE = 0x1909;
|
|
14
|
+
const LUMINANCE_ALPHA = 0x190A;
|
|
15
|
+
const DEPTH_COMPONENT = 0x1902;
|
|
16
|
+
const DEPTH_STENCIL = 0x84F9;
|
|
17
|
+
|
|
18
|
+
const R8 = 0x8229;
|
|
19
|
+
const R8_SNORM = 0x8F94;
|
|
20
|
+
const R16F = 0x822D;
|
|
21
|
+
const R32F = 0x822E;
|
|
22
|
+
const R8UI = 0x8232;
|
|
23
|
+
const R8I = 0x8231;
|
|
24
|
+
const RG16UI = 0x823A;
|
|
25
|
+
const RG16I = 0x8239;
|
|
26
|
+
const RG32UI = 0x823C;
|
|
27
|
+
const RG32I = 0x823B;
|
|
28
|
+
const RG8 = 0x822B;
|
|
29
|
+
const RG8_SNORM = 0x8F95;
|
|
30
|
+
const RG16F = 0x822F;
|
|
31
|
+
const RG32F = 0x8230;
|
|
32
|
+
const RG8UI = 0x8238;
|
|
33
|
+
const RG8I = 0x8237;
|
|
34
|
+
const R16UI = 0x8234;
|
|
35
|
+
const R16I = 0x8233;
|
|
36
|
+
const R32UI = 0x8236;
|
|
37
|
+
const R32I = 0x8235;
|
|
38
|
+
const RGB8 = 0x8051;
|
|
39
|
+
const SRGB8 = 0x8C41;
|
|
40
|
+
const RGB565 = 0x8D62;
|
|
41
|
+
const RGB8_SNORM = 0x8F96;
|
|
42
|
+
const R11F_G11F_B10F = 0x8C3A;
|
|
43
|
+
const RGB9_E5 = 0x8C3D;
|
|
44
|
+
const RGB16F = 0x881B;
|
|
45
|
+
const RGB32F = 0x8815;
|
|
46
|
+
const RGB8UI = 0x8D7D;
|
|
47
|
+
const RGB8I = 0x8D8F;
|
|
48
|
+
const RGB16UI = 0x8D77;
|
|
49
|
+
const RGB16I = 0x8D89;
|
|
50
|
+
const RGB32UI = 0x8D71;
|
|
51
|
+
const RGB32I = 0x8D83;
|
|
52
|
+
const RGBA8 = 0x8058;
|
|
53
|
+
const SRGB8_ALPHA8 = 0x8C43;
|
|
54
|
+
const RGBA8_SNORM = 0x8F97;
|
|
55
|
+
const RGB5_A1 = 0x8057;
|
|
56
|
+
const RGBA4 = 0x8056;
|
|
57
|
+
const RGB10_A2 = 0x8059;
|
|
58
|
+
const RGBA16F = 0x881A;
|
|
59
|
+
const RGBA32F = 0x8814;
|
|
60
|
+
const RGBA8UI = 0x8D7C;
|
|
61
|
+
const RGBA8I = 0x8D8E;
|
|
62
|
+
const RGB10_A2UI = 0x906F;
|
|
63
|
+
const RGBA16UI = 0x8D76;
|
|
64
|
+
const RGBA16I = 0x8D88;
|
|
65
|
+
const RGBA32I = 0x8D82;
|
|
66
|
+
const RGBA32UI = 0x8D70;
|
|
67
|
+
|
|
68
|
+
const DEPTH_COMPONENT16 = 0x81A5;
|
|
69
|
+
const DEPTH_COMPONENT24 = 0x81A6;
|
|
70
|
+
const DEPTH_COMPONENT32F = 0x8CAC;
|
|
71
|
+
const DEPTH32F_STENCIL8 = 0x8CAD;
|
|
72
|
+
const DEPTH24_STENCIL8 = 0x88F0;
|
|
73
|
+
|
|
74
|
+
/* DataType */
|
|
75
|
+
// const BYTE = 0x1400;
|
|
76
|
+
const UNSIGNED_BYTE = 0x1401;
|
|
77
|
+
// const SHORT = 0x1402;
|
|
78
|
+
const UNSIGNED_SHORT = 0x1403;
|
|
79
|
+
// const INT = 0x1404;
|
|
80
|
+
const UNSIGNED_INT = 0x1405;
|
|
81
|
+
const FLOAT = 0x1406;
|
|
82
|
+
const UNSIGNED_SHORT_4_4_4_4 = 0x8033;
|
|
83
|
+
const UNSIGNED_SHORT_5_5_5_1 = 0x8034;
|
|
84
|
+
const UNSIGNED_SHORT_5_6_5 = 0x8363;
|
|
85
|
+
const HALF_FLOAT = 0x140B;
|
|
86
|
+
const HALF_FLOAT_OES = 0x8D61; // Thanks Khronos for making this different >:(
|
|
87
|
+
|
|
88
|
+
const SRGB_ALPHA_EXT = 0x8C42;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @typedef {Object} TextureFormatDetails
|
|
92
|
+
* @property {number} textureFormat format to pass texImage2D and similar functions.
|
|
93
|
+
* @property {boolean} colorRenderable true if you can render to this format of texture.
|
|
94
|
+
* @property {boolean} textureFilterable true if you can filter the texture, false if you can ony use `NEAREST`.
|
|
95
|
+
* @property {number[]} type Array of possible types you can pass to texImage2D and similar function
|
|
96
|
+
* @property {Object.<number,number>} bytesPerElementMap A map of types to bytes per element
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
let s_textureInternalFormatInfo;
|
|
101
|
+
function getTextureInternalFormatInfo(internalFormat) {
|
|
102
|
+
if (!s_textureInternalFormatInfo) {
|
|
103
|
+
// NOTE: these properties need unique names so we can let Uglify mangle the name.
|
|
104
|
+
const t = {};
|
|
105
|
+
// unsized formats
|
|
106
|
+
t[ALPHA] = { bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT], };
|
|
107
|
+
t[LUMINANCE] = { bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT], };
|
|
108
|
+
t[LUMINANCE_ALPHA] = { bytesPerElement: [2, 4, 4, 8], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT], };
|
|
109
|
+
t[RGB] = { bytesPerElement: [3, 6, 6, 12, 2], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT, UNSIGNED_SHORT_5_6_5], };
|
|
110
|
+
t[RGBA] = { bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1], };
|
|
111
|
+
t[SRGB_ALPHA_EXT] = { bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1], };
|
|
112
|
+
t[DEPTH_COMPONENT] = { bytesPerElement: [2, 4], type: [UNSIGNED_INT, UNSIGNED_SHORT], };
|
|
113
|
+
t[DEPTH_STENCIL] = { bytesPerElement: [4], };
|
|
114
|
+
|
|
115
|
+
// sized formats
|
|
116
|
+
t[R8] = { bytesPerElement: [1], };
|
|
117
|
+
t[R8_SNORM] = { bytesPerElement: [1], };
|
|
118
|
+
t[R16F] = { bytesPerElement: [2], };
|
|
119
|
+
t[R32F] = { bytesPerElement: [4], };
|
|
120
|
+
t[R8UI] = { bytesPerElement: [1], };
|
|
121
|
+
t[R8I] = { bytesPerElement: [1], };
|
|
122
|
+
t[R16UI] = { bytesPerElement: [2], };
|
|
123
|
+
t[R16I] = { bytesPerElement: [2], };
|
|
124
|
+
t[R32UI] = { bytesPerElement: [4], };
|
|
125
|
+
t[R32I] = { bytesPerElement: [4], };
|
|
126
|
+
t[RG8] = { bytesPerElement: [2], };
|
|
127
|
+
t[RG8_SNORM] = { bytesPerElement: [2], };
|
|
128
|
+
t[RG16F] = { bytesPerElement: [4], };
|
|
129
|
+
t[RG32F] = { bytesPerElement: [8], };
|
|
130
|
+
t[RG8UI] = { bytesPerElement: [2], };
|
|
131
|
+
t[RG8I] = { bytesPerElement: [2], };
|
|
132
|
+
t[RG16UI] = { bytesPerElement: [4], };
|
|
133
|
+
t[RG16I] = { bytesPerElement: [4], };
|
|
134
|
+
t[RG32UI] = { bytesPerElement: [8], };
|
|
135
|
+
t[RG32I] = { bytesPerElement: [8], };
|
|
136
|
+
t[RGB8] = { bytesPerElement: [3], };
|
|
137
|
+
t[SRGB8] = { bytesPerElement: [3], };
|
|
138
|
+
t[RGB565] = { bytesPerElement: [2], };
|
|
139
|
+
t[RGB8_SNORM] = { bytesPerElement: [3], };
|
|
140
|
+
t[R11F_G11F_B10F] = { bytesPerElement: [4], };
|
|
141
|
+
t[RGB9_E5] = { bytesPerElement: [4], };
|
|
142
|
+
t[RGB16F] = { bytesPerElement: [6], };
|
|
143
|
+
t[RGB32F] = { bytesPerElement: [12], };
|
|
144
|
+
t[RGB8UI] = { bytesPerElement: [3], };
|
|
145
|
+
t[RGB8I] = { bytesPerElement: [3], };
|
|
146
|
+
t[RGB16UI] = { bytesPerElement: [6], };
|
|
147
|
+
t[RGB16I] = { bytesPerElement: [6], };
|
|
148
|
+
t[RGB32UI] = { bytesPerElement: [12], };
|
|
149
|
+
t[RGB32I] = { bytesPerElement: [12], };
|
|
150
|
+
t[RGBA8] = { bytesPerElement: [4], };
|
|
151
|
+
t[SRGB8_ALPHA8] = { bytesPerElement: [4], };
|
|
152
|
+
t[RGBA8_SNORM] = { bytesPerElement: [4], };
|
|
153
|
+
t[RGB5_A1] = { bytesPerElement: [2], };
|
|
154
|
+
t[RGBA4] = { bytesPerElement: [2], };
|
|
155
|
+
t[RGB10_A2] = { bytesPerElement: [4], };
|
|
156
|
+
t[RGBA16F] = { bytesPerElement: [8], };
|
|
157
|
+
t[RGBA32F] = { bytesPerElement: [16], };
|
|
158
|
+
t[RGBA8UI] = { bytesPerElement: [4], };
|
|
159
|
+
t[RGBA8I] = { bytesPerElement: [4], };
|
|
160
|
+
t[RGB10_A2UI] = { bytesPerElement: [4], };
|
|
161
|
+
t[RGBA16UI] = { bytesPerElement: [8], };
|
|
162
|
+
t[RGBA16I] = { bytesPerElement: [8], };
|
|
163
|
+
t[RGBA32I] = { bytesPerElement: [16], };
|
|
164
|
+
t[RGBA32UI] = { bytesPerElement: [16], };
|
|
165
|
+
// Sized Internal
|
|
166
|
+
t[DEPTH_COMPONENT16] = { bytesPerElement: [2], };
|
|
167
|
+
t[DEPTH_COMPONENT24] = { bytesPerElement: [4], };
|
|
168
|
+
t[DEPTH_COMPONENT32F] = { bytesPerElement: [4], };
|
|
169
|
+
t[DEPTH24_STENCIL8] = { bytesPerElement: [4], };
|
|
170
|
+
t[DEPTH32F_STENCIL8] = { bytesPerElement: [4], };
|
|
171
|
+
|
|
172
|
+
s_textureInternalFormatInfo = t;
|
|
173
|
+
}
|
|
174
|
+
return s_textureInternalFormatInfo[internalFormat];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function makeComputeBlockRectSizeFunction(blockWidth, blockHeight, bytesPerBlock) {
|
|
178
|
+
return function(width, height, depth) {
|
|
179
|
+
const blocksAcross = (width + blockWidth - 1) / blockWidth | 0;
|
|
180
|
+
const blocksDown = (height + blockHeight - 1) / blockHeight | 0;
|
|
181
|
+
return blocksAcross * blocksDown * bytesPerBlock * depth;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function makeComputePaddedRectSizeFunction(minWidth, minHeight, divisor) {
|
|
186
|
+
return function(width, height, depth) {
|
|
187
|
+
return (Math.max(width, minWidth) * Math.max(height, minHeight) / divisor | 0) * depth;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// WEBGL_compressed_texture_s3tc
|
|
192
|
+
const COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
|
193
|
+
const COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
|
|
194
|
+
const COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
|
|
195
|
+
const COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
|
196
|
+
// WEBGL_compressed_texture_etc1
|
|
197
|
+
const COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;
|
|
198
|
+
// WEBGL_compressed_texture_pvrtc
|
|
199
|
+
const COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
|
|
200
|
+
const COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
|
|
201
|
+
const COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
|
|
202
|
+
const COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
|
|
203
|
+
// WEBGL_compressed_texture_etc
|
|
204
|
+
const COMPRESSED_R11_EAC = 0x9270;
|
|
205
|
+
const COMPRESSED_SIGNED_R11_EAC = 0x9271;
|
|
206
|
+
const COMPRESSED_RG11_EAC = 0x9272;
|
|
207
|
+
const COMPRESSED_SIGNED_RG11_EAC = 0x9273;
|
|
208
|
+
const COMPRESSED_RGB8_ETC2 = 0x9274;
|
|
209
|
+
const COMPRESSED_SRGB8_ETC2 = 0x9275;
|
|
210
|
+
const COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;
|
|
211
|
+
const COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;
|
|
212
|
+
const COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
|
|
213
|
+
const COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;
|
|
214
|
+
// WEBGL_compressed_texture_astc
|
|
215
|
+
const COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
|
|
216
|
+
const COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
|
|
217
|
+
const COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
|
|
218
|
+
const COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
|
|
219
|
+
const COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
|
|
220
|
+
const COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
|
|
221
|
+
const COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
|
|
222
|
+
const COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
|
|
223
|
+
const COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
|
|
224
|
+
const COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
|
|
225
|
+
const COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
|
|
226
|
+
const COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
|
|
227
|
+
const COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
|
|
228
|
+
const COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
|
|
229
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
|
|
230
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
|
|
231
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
|
|
232
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
|
|
233
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
|
|
234
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
|
|
235
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
|
|
236
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
|
|
237
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
|
|
238
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
|
|
239
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
|
|
240
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
|
|
241
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
|
|
242
|
+
const COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
|
|
243
|
+
// WEBGL_compressed_texture_s3tc_srgb
|
|
244
|
+
const COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;
|
|
245
|
+
const COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D;
|
|
246
|
+
const COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E;
|
|
247
|
+
const COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;
|
|
248
|
+
// EXT_texture_compression_bptc
|
|
249
|
+
const COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C;
|
|
250
|
+
const COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D;
|
|
251
|
+
const COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E;
|
|
252
|
+
const COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F;
|
|
253
|
+
// EXT_texture_compression_rgtc
|
|
254
|
+
const COMPRESSED_RED_RGTC1_EXT = 0x8DBB;
|
|
255
|
+
const COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC;
|
|
256
|
+
const COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD;
|
|
257
|
+
const COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE;
|
|
258
|
+
|
|
259
|
+
const compressedTextureFunctions = new Map([
|
|
260
|
+
[ COMPRESSED_RGB_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
261
|
+
[ COMPRESSED_RGBA_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
262
|
+
[ COMPRESSED_RGBA_S3TC_DXT3_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
263
|
+
[ COMPRESSED_RGBA_S3TC_DXT5_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
264
|
+
|
|
265
|
+
[ COMPRESSED_RGB_ETC1_WEBGL, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
266
|
+
|
|
267
|
+
[ COMPRESSED_RGB_PVRTC_4BPPV1_IMG, makeComputePaddedRectSizeFunction(8, 8, 2) ],
|
|
268
|
+
[ COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, makeComputePaddedRectSizeFunction(8, 8, 2) ],
|
|
269
|
+
[ COMPRESSED_RGB_PVRTC_2BPPV1_IMG, makeComputePaddedRectSizeFunction(16, 8, 4) ],
|
|
270
|
+
[ COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, makeComputePaddedRectSizeFunction(16, 8, 4) ],
|
|
271
|
+
|
|
272
|
+
[ COMPRESSED_R11_EAC, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
273
|
+
[ COMPRESSED_SIGNED_R11_EAC, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
274
|
+
[ COMPRESSED_RGB8_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
275
|
+
[ COMPRESSED_SRGB8_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
276
|
+
[ COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
277
|
+
[ COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
278
|
+
|
|
279
|
+
[ COMPRESSED_RG11_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
280
|
+
[ COMPRESSED_SIGNED_RG11_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
281
|
+
[ COMPRESSED_RGBA8_ETC2_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
282
|
+
[ COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
283
|
+
|
|
284
|
+
[ COMPRESSED_RGBA_ASTC_4x4_KHR, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
285
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
286
|
+
[ COMPRESSED_RGBA_ASTC_5x4_KHR, makeComputeBlockRectSizeFunction(5, 4, 16) ],
|
|
287
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, makeComputeBlockRectSizeFunction(5, 4, 16) ],
|
|
288
|
+
[ COMPRESSED_RGBA_ASTC_5x5_KHR, makeComputeBlockRectSizeFunction(5, 5, 16) ],
|
|
289
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, makeComputeBlockRectSizeFunction(5, 5, 16) ],
|
|
290
|
+
[ COMPRESSED_RGBA_ASTC_6x5_KHR, makeComputeBlockRectSizeFunction(6, 5, 16) ],
|
|
291
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, makeComputeBlockRectSizeFunction(6, 5, 16) ],
|
|
292
|
+
[ COMPRESSED_RGBA_ASTC_6x6_KHR, makeComputeBlockRectSizeFunction(6, 6, 16) ],
|
|
293
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, makeComputeBlockRectSizeFunction(6, 6, 16) ],
|
|
294
|
+
[ COMPRESSED_RGBA_ASTC_8x5_KHR, makeComputeBlockRectSizeFunction(8, 5, 16) ],
|
|
295
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, makeComputeBlockRectSizeFunction(8, 5, 16) ],
|
|
296
|
+
[ COMPRESSED_RGBA_ASTC_8x6_KHR, makeComputeBlockRectSizeFunction(8, 6, 16) ],
|
|
297
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, makeComputeBlockRectSizeFunction(8, 6, 16) ],
|
|
298
|
+
[ COMPRESSED_RGBA_ASTC_8x8_KHR, makeComputeBlockRectSizeFunction(8, 8, 16) ],
|
|
299
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, makeComputeBlockRectSizeFunction(8, 8, 16) ],
|
|
300
|
+
[ COMPRESSED_RGBA_ASTC_10x5_KHR, makeComputeBlockRectSizeFunction(10, 5, 16) ],
|
|
301
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, makeComputeBlockRectSizeFunction(10, 5, 16) ],
|
|
302
|
+
[ COMPRESSED_RGBA_ASTC_10x6_KHR, makeComputeBlockRectSizeFunction(10, 6, 16) ],
|
|
303
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, makeComputeBlockRectSizeFunction(10, 6, 16) ],
|
|
304
|
+
[ COMPRESSED_RGBA_ASTC_10x8_KHR, makeComputeBlockRectSizeFunction(10, 8, 16) ],
|
|
305
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, makeComputeBlockRectSizeFunction(10, 8, 16) ],
|
|
306
|
+
[ COMPRESSED_RGBA_ASTC_10x10_KHR, makeComputeBlockRectSizeFunction(10, 10, 16) ],
|
|
307
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, makeComputeBlockRectSizeFunction(10, 10, 16) ],
|
|
308
|
+
[ COMPRESSED_RGBA_ASTC_12x10_KHR, makeComputeBlockRectSizeFunction(12, 10, 16) ],
|
|
309
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, makeComputeBlockRectSizeFunction(12, 10, 16) ],
|
|
310
|
+
[ COMPRESSED_RGBA_ASTC_12x12_KHR, makeComputeBlockRectSizeFunction(12, 12, 16) ],
|
|
311
|
+
[ COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, makeComputeBlockRectSizeFunction(12, 12, 16) ],
|
|
312
|
+
|
|
313
|
+
[ COMPRESSED_SRGB_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
314
|
+
[ COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],
|
|
315
|
+
[ COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
316
|
+
[ COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],
|
|
317
|
+
|
|
318
|
+
[ COMPRESSED_RGBA_BPTC_UNORM_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
|
|
319
|
+
[ COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
|
|
320
|
+
[ COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
|
|
321
|
+
[ COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
|
|
322
|
+
|
|
323
|
+
[ COMPRESSED_RED_RGTC1_EXT, makeComputeBlockRectSizeFunction( 4, 4, 8 ) ],
|
|
324
|
+
[ COMPRESSED_SIGNED_RED_RGTC1_EXT, makeComputeBlockRectSizeFunction( 4, 4, 8 ) ],
|
|
325
|
+
[ COMPRESSED_RED_GREEN_RGTC2_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
|
|
326
|
+
[ COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
|
|
327
|
+
]);
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Gets the number of bytes per element for a given internalFormat / type
|
|
331
|
+
* @param {number} internalFormat The internalFormat parameter from texImage2D etc..
|
|
332
|
+
* @param {number} type The type parameter for texImage2D etc..
|
|
333
|
+
* @return {number} the number of bytes per element for the given internalFormat, type combo
|
|
334
|
+
* @memberOf module:twgl/textures
|
|
335
|
+
*/
|
|
336
|
+
function getBytesPerElementForInternalFormat(internalFormat, type) {
|
|
337
|
+
const info = getTextureInternalFormatInfo(internalFormat);
|
|
338
|
+
if (!info) {
|
|
339
|
+
throw "unknown internal format";
|
|
340
|
+
}
|
|
341
|
+
if (info.type) {
|
|
342
|
+
const ndx = info.type.indexOf(type);
|
|
343
|
+
if (ndx < 0) {
|
|
344
|
+
throw new Error(`unsupported type ${type} for internalformat ${internalFormat}`);
|
|
345
|
+
}
|
|
346
|
+
return info.bytesPerElement[ndx];
|
|
347
|
+
}
|
|
348
|
+
return info.bytesPerElement[0];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function getBytesForMipUncompressed(internalFormat, width, height, depth, type) {
|
|
352
|
+
const bytesPerElement = getBytesPerElementForInternalFormat(internalFormat, type);
|
|
353
|
+
return width * height * depth * bytesPerElement;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function getBytesForMip(internalFormat, width, height, depth, type) {
|
|
357
|
+
const fn = compressedTextureFunctions.get(internalFormat);
|
|
358
|
+
return fn ? fn(width, height, depth) : getBytesForMipUncompressed(internalFormat, width, height, depth, type);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function getRendererStatistic(renderer) {
|
|
362
|
+
var internal = renderer.internal;
|
|
363
|
+
var ret = {
|
|
364
|
+
textures: [],
|
|
365
|
+
buffers: [],
|
|
366
|
+
memory: {
|
|
367
|
+
texture: 0,
|
|
368
|
+
buffer: 0,
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
if (internal) {
|
|
372
|
+
internal._textures.forEach(function (tex) {
|
|
373
|
+
var memory = getTextureMemory(tex);
|
|
374
|
+
ret.memory.texture += memory;
|
|
375
|
+
ret.textures.push({ name: tex.options.name || '', memory: memory });
|
|
376
|
+
});
|
|
377
|
+
internal._buffers.forEach(function (buffer) {
|
|
378
|
+
var memory = buffer.byteLength;
|
|
379
|
+
ret.memory.buffer += memory;
|
|
380
|
+
ret.buffers.push({ name: buffer.name, memory: memory });
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return ret;
|
|
384
|
+
}
|
|
385
|
+
function getTextureMemory(tex) {
|
|
386
|
+
var size = 0;
|
|
387
|
+
if (tex) {
|
|
388
|
+
var info = tex.gpuInfo;
|
|
389
|
+
if (info && info[0]) {
|
|
390
|
+
var mipmapSizes = info[3];
|
|
391
|
+
var format = info[0];
|
|
392
|
+
var type = info[1];
|
|
393
|
+
var target = info[2];
|
|
394
|
+
var face = target === WebGLRenderingContext.TEXTURE_CUBE_MAP ? 6 : 1;
|
|
395
|
+
for (var i = 0; i < mipmapSizes.length; i++) {
|
|
396
|
+
var mipmapSize = mipmapSizes[i];
|
|
397
|
+
var mipmapMemory = getBytesForMip(format, mipmapSize[0], mipmapSize[1], 1, type);
|
|
398
|
+
size += mipmapMemory * face;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return size;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export { getRendererStatistic, getTextureMemory };
|
|
406
|
+
//# sourceMappingURL=statistic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistic.js","sources":["../src/statistic/texture-utils.js","../../src/statistic/index.ts"],"sourcesContent":["// https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js\n/* PixelFormat */\nconst ALPHA = 0x1906;\nconst RGB = 0x1907;\nconst RGBA = 0x1908;\nconst LUMINANCE = 0x1909;\nconst LUMINANCE_ALPHA = 0x190A;\nconst DEPTH_COMPONENT = 0x1902;\nconst DEPTH_STENCIL = 0x84F9;\n\nconst R8 = 0x8229;\nconst R8_SNORM = 0x8F94;\nconst R16F = 0x822D;\nconst R32F = 0x822E;\nconst R8UI = 0x8232;\nconst R8I = 0x8231;\nconst RG16UI = 0x823A;\nconst RG16I = 0x8239;\nconst RG32UI = 0x823C;\nconst RG32I = 0x823B;\nconst RG8 = 0x822B;\nconst RG8_SNORM = 0x8F95;\nconst RG16F = 0x822F;\nconst RG32F = 0x8230;\nconst RG8UI = 0x8238;\nconst RG8I = 0x8237;\nconst R16UI = 0x8234;\nconst R16I = 0x8233;\nconst R32UI = 0x8236;\nconst R32I = 0x8235;\nconst RGB8 = 0x8051;\nconst SRGB8 = 0x8C41;\nconst RGB565 = 0x8D62;\nconst RGB8_SNORM = 0x8F96;\nconst R11F_G11F_B10F = 0x8C3A;\nconst RGB9_E5 = 0x8C3D;\nconst RGB16F = 0x881B;\nconst RGB32F = 0x8815;\nconst RGB8UI = 0x8D7D;\nconst RGB8I = 0x8D8F;\nconst RGB16UI = 0x8D77;\nconst RGB16I = 0x8D89;\nconst RGB32UI = 0x8D71;\nconst RGB32I = 0x8D83;\nconst RGBA8 = 0x8058;\nconst SRGB8_ALPHA8 = 0x8C43;\nconst RGBA8_SNORM = 0x8F97;\nconst RGB5_A1 = 0x8057;\nconst RGBA4 = 0x8056;\nconst RGB10_A2 = 0x8059;\nconst RGBA16F = 0x881A;\nconst RGBA32F = 0x8814;\nconst RGBA8UI = 0x8D7C;\nconst RGBA8I = 0x8D8E;\nconst RGB10_A2UI = 0x906F;\nconst RGBA16UI = 0x8D76;\nconst RGBA16I = 0x8D88;\nconst RGBA32I = 0x8D82;\nconst RGBA32UI = 0x8D70;\n\nconst DEPTH_COMPONENT16 = 0x81A5;\nconst DEPTH_COMPONENT24 = 0x81A6;\nconst DEPTH_COMPONENT32F = 0x8CAC;\nconst DEPTH32F_STENCIL8 = 0x8CAD;\nconst DEPTH24_STENCIL8 = 0x88F0;\n\n/* DataType */\n// const BYTE = 0x1400;\nconst UNSIGNED_BYTE = 0x1401;\n// const SHORT = 0x1402;\nconst UNSIGNED_SHORT = 0x1403;\n// const INT = 0x1404;\nconst UNSIGNED_INT = 0x1405;\nconst FLOAT = 0x1406;\nconst UNSIGNED_SHORT_4_4_4_4 = 0x8033;\nconst UNSIGNED_SHORT_5_5_5_1 = 0x8034;\nconst UNSIGNED_SHORT_5_6_5 = 0x8363;\nconst HALF_FLOAT = 0x140B;\nconst HALF_FLOAT_OES = 0x8D61; // Thanks Khronos for making this different >:(\n// const UNSIGNED_INT_2_10_10_10_REV = 0x8368;\n// const UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;\n// const UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;\n// const FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;\n// const UNSIGNED_INT_24_8 = 0x84FA;\n\nconst RG = 0x8227;\nconst RG_INTEGER = 0x8228;\nconst RED = 0x1903;\nconst RED_INTEGER = 0x8D94;\nconst RGB_INTEGER = 0x8D98;\nconst RGBA_INTEGER = 0x8D99;\n\nconst SRGB_ALPHA_EXT = 0x8C42;\n\n\nconst formatInfo = {};\n{\n // NOTE: this is named `numColorComponents` vs `numComponents` so we can let Uglify mangle\n // the name.\n const f = formatInfo;\n f[ALPHA] = { numColorComponents: 1, };\n f[LUMINANCE] = { numColorComponents: 1, };\n f[LUMINANCE_ALPHA] = { numColorComponents: 2, };\n f[RGB] = { numColorComponents: 3, };\n f[RGBA] = { numColorComponents: 4, };\n f[RED] = { numColorComponents: 1, };\n f[RED_INTEGER] = { numColorComponents: 1, };\n f[RG] = { numColorComponents: 2, };\n f[RG_INTEGER] = { numColorComponents: 2, };\n f[RGB] = { numColorComponents: 3, };\n f[RGB_INTEGER] = { numColorComponents: 3, };\n f[RGBA] = { numColorComponents: 4, };\n f[RGBA_INTEGER] = { numColorComponents: 4, };\n f[DEPTH_COMPONENT] = { numColorComponents: 1, };\n f[DEPTH_STENCIL] = { numColorComponents: 2, };\n}\n\n/**\n * @typedef {Object} TextureFormatDetails\n * @property {number} textureFormat format to pass texImage2D and similar functions.\n * @property {boolean} colorRenderable true if you can render to this format of texture.\n * @property {boolean} textureFilterable true if you can filter the texture, false if you can ony use `NEAREST`.\n * @property {number[]} type Array of possible types you can pass to texImage2D and similar function\n * @property {Object.<number,number>} bytesPerElementMap A map of types to bytes per element\n * @private\n */\n\nlet s_textureInternalFormatInfo;\nfunction getTextureInternalFormatInfo(internalFormat) {\n if (!s_textureInternalFormatInfo) {\n // NOTE: these properties need unique names so we can let Uglify mangle the name.\n const t = {};\n // unsized formats\n t[ALPHA] = { bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT], };\n t[LUMINANCE] = { bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT], };\n t[LUMINANCE_ALPHA] = { bytesPerElement: [2, 4, 4, 8], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT], };\n t[RGB] = { bytesPerElement: [3, 6, 6, 12, 2], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT, UNSIGNED_SHORT_5_6_5], };\n t[RGBA] = { bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1], };\n t[SRGB_ALPHA_EXT] = { bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE, HALF_FLOAT, HALF_FLOAT_OES, FLOAT, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1], };\n t[DEPTH_COMPONENT] = { bytesPerElement: [2, 4], type: [UNSIGNED_INT, UNSIGNED_SHORT], };\n t[DEPTH_STENCIL] = { bytesPerElement: [4], };\n\n // sized formats\n t[R8] = { bytesPerElement: [1], };\n t[R8_SNORM] = { bytesPerElement: [1], };\n t[R16F] = { bytesPerElement: [2], };\n t[R32F] = { bytesPerElement: [4], };\n t[R8UI] = { bytesPerElement: [1], };\n t[R8I] = { bytesPerElement: [1], };\n t[R16UI] = { bytesPerElement: [2], };\n t[R16I] = { bytesPerElement: [2], };\n t[R32UI] = { bytesPerElement: [4], };\n t[R32I] = { bytesPerElement: [4], };\n t[RG8] = { bytesPerElement: [2], };\n t[RG8_SNORM] = { bytesPerElement: [2], };\n t[RG16F] = { bytesPerElement: [4], };\n t[RG32F] = { bytesPerElement: [8], };\n t[RG8UI] = { bytesPerElement: [2], };\n t[RG8I] = { bytesPerElement: [2], };\n t[RG16UI] = { bytesPerElement: [4], };\n t[RG16I] = { bytesPerElement: [4], };\n t[RG32UI] = { bytesPerElement: [8], };\n t[RG32I] = { bytesPerElement: [8], };\n t[RGB8] = { bytesPerElement: [3], };\n t[SRGB8] = { bytesPerElement: [3], };\n t[RGB565] = { bytesPerElement: [2], };\n t[RGB8_SNORM] = { bytesPerElement: [3], };\n t[R11F_G11F_B10F] = { bytesPerElement: [4], };\n t[RGB9_E5] = { bytesPerElement: [4], };\n t[RGB16F] = { bytesPerElement: [6], };\n t[RGB32F] = { bytesPerElement: [12], };\n t[RGB8UI] = { bytesPerElement: [3], };\n t[RGB8I] = { bytesPerElement: [3], };\n t[RGB16UI] = { bytesPerElement: [6], };\n t[RGB16I] = { bytesPerElement: [6], };\n t[RGB32UI] = { bytesPerElement: [12], };\n t[RGB32I] = { bytesPerElement: [12], };\n t[RGBA8] = { bytesPerElement: [4], };\n t[SRGB8_ALPHA8] = { bytesPerElement: [4], };\n t[RGBA8_SNORM] = { bytesPerElement: [4], };\n t[RGB5_A1] = { bytesPerElement: [2], };\n t[RGBA4] = { bytesPerElement: [2], };\n t[RGB10_A2] = { bytesPerElement: [4], };\n t[RGBA16F] = { bytesPerElement: [8], };\n t[RGBA32F] = { bytesPerElement: [16], };\n t[RGBA8UI] = { bytesPerElement: [4], };\n t[RGBA8I] = { bytesPerElement: [4], };\n t[RGB10_A2UI] = { bytesPerElement: [4], };\n t[RGBA16UI] = { bytesPerElement: [8], };\n t[RGBA16I] = { bytesPerElement: [8], };\n t[RGBA32I] = { bytesPerElement: [16], };\n t[RGBA32UI] = { bytesPerElement: [16], };\n // Sized Internal\n t[DEPTH_COMPONENT16] = { bytesPerElement: [2], };\n t[DEPTH_COMPONENT24] = { bytesPerElement: [4], };\n t[DEPTH_COMPONENT32F] = { bytesPerElement: [4], };\n t[DEPTH24_STENCIL8] = { bytesPerElement: [4], };\n t[DEPTH32F_STENCIL8] = { bytesPerElement: [4], };\n\n s_textureInternalFormatInfo = t;\n }\n return s_textureInternalFormatInfo[internalFormat];\n}\n\nfunction makeComputeBlockRectSizeFunction(blockWidth, blockHeight, bytesPerBlock) {\n return function(width, height, depth) {\n const blocksAcross = (width + blockWidth - 1) / blockWidth | 0;\n const blocksDown = (height + blockHeight - 1) / blockHeight | 0;\n return blocksAcross * blocksDown * bytesPerBlock * depth;\n };\n}\n\nfunction makeComputePaddedRectSizeFunction(minWidth, minHeight, divisor) {\n return function(width, height, depth) {\n return (Math.max(width, minWidth) * Math.max(height, minHeight) / divisor | 0) * depth;\n };\n}\n\n// WEBGL_compressed_texture_s3tc\nconst COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;\nconst COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;\nconst COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;\nconst COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;\n// WEBGL_compressed_texture_etc1\nconst COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;\n// WEBGL_compressed_texture_pvrtc\nconst COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;\nconst COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;\nconst COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;\nconst COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;\n// WEBGL_compressed_texture_etc\nconst COMPRESSED_R11_EAC = 0x9270;\nconst COMPRESSED_SIGNED_R11_EAC = 0x9271;\nconst COMPRESSED_RG11_EAC = 0x9272;\nconst COMPRESSED_SIGNED_RG11_EAC = 0x9273;\nconst COMPRESSED_RGB8_ETC2 = 0x9274;\nconst COMPRESSED_SRGB8_ETC2 = 0x9275;\nconst COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;\nconst COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;\nconst COMPRESSED_RGBA8_ETC2_EAC = 0x9278;\nconst COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;\n// WEBGL_compressed_texture_astc\nconst COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;\nconst COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;\nconst COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;\nconst COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;\nconst COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;\nconst COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;\nconst COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;\nconst COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;\nconst COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;\nconst COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;\nconst COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;\nconst COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;\nconst COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;\nconst COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;\nconst COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;\n// WEBGL_compressed_texture_s3tc_srgb\nconst COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;\nconst COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D;\nconst COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E;\nconst COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;\n// EXT_texture_compression_bptc\nconst COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C;\nconst COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D;\nconst COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E;\nconst COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F;\n// EXT_texture_compression_rgtc\nconst COMPRESSED_RED_RGTC1_EXT = 0x8DBB;\nconst COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC;\nconst COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD;\nconst COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE;\n\nconst compressedTextureFunctions = new Map([\n [ COMPRESSED_RGB_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_RGBA_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_RGBA_S3TC_DXT3_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_RGBA_S3TC_DXT5_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n\n [ COMPRESSED_RGB_ETC1_WEBGL, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n\n [ COMPRESSED_RGB_PVRTC_4BPPV1_IMG, makeComputePaddedRectSizeFunction(8, 8, 2) ],\n [ COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, makeComputePaddedRectSizeFunction(8, 8, 2) ],\n [ COMPRESSED_RGB_PVRTC_2BPPV1_IMG, makeComputePaddedRectSizeFunction(16, 8, 4) ],\n [ COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, makeComputePaddedRectSizeFunction(16, 8, 4) ],\n\n [ COMPRESSED_R11_EAC, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_SIGNED_R11_EAC, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_RGB8_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_SRGB8_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n\n [ COMPRESSED_RG11_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_SIGNED_RG11_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_RGBA8_ETC2_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n\n [ COMPRESSED_RGBA_ASTC_4x4_KHR, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_RGBA_ASTC_5x4_KHR, makeComputeBlockRectSizeFunction(5, 4, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, makeComputeBlockRectSizeFunction(5, 4, 16) ],\n [ COMPRESSED_RGBA_ASTC_5x5_KHR, makeComputeBlockRectSizeFunction(5, 5, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, makeComputeBlockRectSizeFunction(5, 5, 16) ],\n [ COMPRESSED_RGBA_ASTC_6x5_KHR, makeComputeBlockRectSizeFunction(6, 5, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, makeComputeBlockRectSizeFunction(6, 5, 16) ],\n [ COMPRESSED_RGBA_ASTC_6x6_KHR, makeComputeBlockRectSizeFunction(6, 6, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, makeComputeBlockRectSizeFunction(6, 6, 16) ],\n [ COMPRESSED_RGBA_ASTC_8x5_KHR, makeComputeBlockRectSizeFunction(8, 5, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, makeComputeBlockRectSizeFunction(8, 5, 16) ],\n [ COMPRESSED_RGBA_ASTC_8x6_KHR, makeComputeBlockRectSizeFunction(8, 6, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, makeComputeBlockRectSizeFunction(8, 6, 16) ],\n [ COMPRESSED_RGBA_ASTC_8x8_KHR, makeComputeBlockRectSizeFunction(8, 8, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, makeComputeBlockRectSizeFunction(8, 8, 16) ],\n [ COMPRESSED_RGBA_ASTC_10x5_KHR, makeComputeBlockRectSizeFunction(10, 5, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, makeComputeBlockRectSizeFunction(10, 5, 16) ],\n [ COMPRESSED_RGBA_ASTC_10x6_KHR, makeComputeBlockRectSizeFunction(10, 6, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, makeComputeBlockRectSizeFunction(10, 6, 16) ],\n [ COMPRESSED_RGBA_ASTC_10x8_KHR, makeComputeBlockRectSizeFunction(10, 8, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, makeComputeBlockRectSizeFunction(10, 8, 16) ],\n [ COMPRESSED_RGBA_ASTC_10x10_KHR, makeComputeBlockRectSizeFunction(10, 10, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, makeComputeBlockRectSizeFunction(10, 10, 16) ],\n [ COMPRESSED_RGBA_ASTC_12x10_KHR, makeComputeBlockRectSizeFunction(12, 10, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, makeComputeBlockRectSizeFunction(12, 10, 16) ],\n [ COMPRESSED_RGBA_ASTC_12x12_KHR, makeComputeBlockRectSizeFunction(12, 12, 16) ],\n [ COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, makeComputeBlockRectSizeFunction(12, 12, 16) ],\n\n [ COMPRESSED_SRGB_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],\n [ COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n [ COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],\n\n [ COMPRESSED_RGBA_BPTC_UNORM_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],\n [ COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],\n [ COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],\n [ COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],\n\n [ COMPRESSED_RED_RGTC1_EXT, makeComputeBlockRectSizeFunction( 4, 4, 8 ) ],\n [ COMPRESSED_SIGNED_RED_RGTC1_EXT, makeComputeBlockRectSizeFunction( 4, 4, 8 ) ],\n [ COMPRESSED_RED_GREEN_RGTC2_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],\n [ COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],\n]);\n\n/**\n * Gets the number of bytes per element for a given internalFormat / type\n * @param {number} internalFormat The internalFormat parameter from texImage2D etc..\n * @param {number} type The type parameter for texImage2D etc..\n * @return {number} the number of bytes per element for the given internalFormat, type combo\n * @memberOf module:twgl/textures\n */\nexport function getBytesPerElementForInternalFormat(internalFormat, type) {\n const info = getTextureInternalFormatInfo(internalFormat);\n if (!info) {\n throw \"unknown internal format\";\n }\n if (info.type) {\n const ndx = info.type.indexOf(type);\n if (ndx < 0) {\n throw new Error(`unsupported type ${type} for internalformat ${internalFormat}`);\n }\n return info.bytesPerElement[ndx];\n }\n return info.bytesPerElement[0];\n}\n\nfunction getBytesForMipUncompressed(internalFormat, width, height, depth, type) {\n const bytesPerElement = getBytesPerElementForInternalFormat(internalFormat, type);\n return width * height * depth * bytesPerElement;\n}\n\nexport function getBytesForMip(internalFormat, width, height, depth, type) {\n const fn = compressedTextureFunctions.get(internalFormat);\n return fn ? fn(width, height, depth) : getBytesForMipUncompressed(internalFormat, width, height, depth, type);\n}\n","import type { MarsRenderer } from '../render/MarsRenderer';\nimport { getBytesForMip } from './texture-utils';\nimport type { GLTexture } from '../webgl/GLTexture';\n\nexport interface TextureStatistic {\n name: string,\n memory: number,\n}\n\nexport interface BufferStatistic {\n name: string,\n memory: number,\n}\n\nexport interface RendererStatistic {\n textures: TextureStatistic[],\n buffers: BufferStatistic[],\n memory: {\n texture: number,\n buffer: number,\n },\n}\n\nexport function getRendererStatistic (renderer: MarsRenderer): RendererStatistic {\n const internal = renderer.internal;\n const ret: RendererStatistic = {\n textures: [],\n buffers: [],\n memory: {\n texture: 0,\n buffer: 0,\n },\n };\n\n if (internal) {\n internal._textures.forEach(tex => {\n const memory = getTextureMemory(tex);\n\n ret.memory.texture += memory;\n ret.textures.push({ name: tex.options.name || '', memory });\n });\n internal._buffers.forEach(buffer => {\n const memory = buffer.byteLength;\n\n ret.memory.buffer += memory;\n ret.buffers.push({ name: buffer.name, memory });\n });\n }\n\n return ret;\n}\n\nexport function getTextureMemory (tex: GLTexture | undefined) {\n let size = 0;\n\n if (tex) {\n const info = tex.gpuInfo;\n\n if (info && info[0]) {\n const mipmapSizes = info[3];\n const format = info[0];\n const type = info[1];\n const target = info[2];\n const face = target === WebGLRenderingContext.TEXTURE_CUBE_MAP ? 6 : 1;\n\n for (let i = 0; i < mipmapSizes.length; i++) {\n const mipmapSize = mipmapSizes[i];\n const mipmapMemory = getBytesForMip(format, mipmapSize[0], mipmapSize[1], 1, type);\n\n size += mipmapMemory * face;\n }\n }\n }\n\n return size;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA,MAAM,KAAK,4BAA4B,MAAM,CAAC;AAC9C,MAAM,GAAG,8BAA8B,MAAM,CAAC;AAC9C,MAAM,IAAI,6BAA6B,MAAM,CAAC;AAC9C,MAAM,SAAS,wBAAwB,MAAM,CAAC;AAC9C,MAAM,eAAe,kBAAkB,MAAM,CAAC;AAC9C,MAAM,eAAe,kBAAkB,MAAM,CAAC;AAC9C,MAAM,aAAa,oBAAoB,MAAM,CAAC;AAC9C;AACA,MAAM,EAAE,6BAA6B,MAAM,CAAC;AAC5C,MAAM,QAAQ,uBAAuB,MAAM,CAAC;AAC5C,MAAM,IAAI,2BAA2B,MAAM,CAAC;AAC5C,MAAM,IAAI,2BAA2B,MAAM,CAAC;AAC5C,MAAM,IAAI,2BAA2B,MAAM,CAAC;AAC5C,MAAM,GAAG,4BAA4B,MAAM,CAAC;AAC5C,MAAM,MAAM,yBAAyB,MAAM,CAAC;AAC5C,MAAM,KAAK,0BAA0B,MAAM,CAAC;AAC5C,MAAM,MAAM,yBAAyB,MAAM,CAAC;AAC5C,MAAM,KAAK,0BAA0B,MAAM,CAAC;AAC5C,MAAM,GAAG,4BAA4B,MAAM,CAAC;AAC5C,MAAM,SAAS,sBAAsB,MAAM,CAAC;AAC5C,MAAM,KAAK,0BAA0B,MAAM,CAAC;AAC5C,MAAM,KAAK,0BAA0B,MAAM,CAAC;AAC5C,MAAM,KAAK,0BAA0B,MAAM,CAAC;AAC5C,MAAM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AAC,CAAC;AAEb,IAAA,IAAI,GAAG,EAAE;AACP,QAAA,IAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;AAEzB,QAAA,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE;AACnB,YAAA,IAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5B,YAAA,IAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACvB,YAAA,IAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACrB,YAAA,IAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACvB,YAAA,IAAM,IAAI,GAAG,MAAM,KAAK,qBAAqB,CAAC,gBAAgB,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvE,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC3C,gBAAA,IAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;gBAClC,IAAM,YAAY,GAAG,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAEnF,gBAAA,IAAI,IAAI,YAAY,GAAG,IAAI,CAAC;AAC7B,aAAA;AACF,SAAA;AACF,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { mat4 } from './type';
|
|
2
|
+
export interface CameraOptions {
|
|
3
|
+
priority?: number;
|
|
4
|
+
name?: string;
|
|
5
|
+
type?: any;
|
|
6
|
+
}
|
|
7
|
+
export interface Camera {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly view?: Float32Array | mat4;
|
|
10
|
+
readonly projection?: Float32Array | mat4;
|
|
11
|
+
readonly viewProjection?: Float32Array | mat4;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Canvas {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
addEventListener(name: string, handler: Function): void;
|
|
5
|
+
removeEventListener(name: string, handler: Function): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class CanvasEmpty implements Canvas {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
addEventListener(name: string, handler: Function): void;
|
|
11
|
+
removeEventListener(name: string, handler: Function): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TypedArray } from './type';
|
|
2
|
+
import type { IGPUResource, IGPURenderer } from './IGPURenderer';
|
|
3
|
+
import type { GPURenderer } from './Renderer';
|
|
4
|
+
export type GPUBufferTarget = WebGLRenderingContext['ARRAY_BUFFER'] | WebGLRenderingContext['ELEMENT_ARRAY_BUFFER'] | WebGL2RenderingContext['COPY_READ_BUFFER'] | WebGL2RenderingContext['COPY_WRITE_BUFFER'] | WebGL2RenderingContext['TRANSFORM_FEEDBACK_BUFFER'] | WebGL2RenderingContext['UNIFORM_BUFFER'] | WebGL2RenderingContext['PIXEL_PACK_BUFFER'] | WebGL2RenderingContext['PIXEL_UNPACK_BUFFER'];
|
|
5
|
+
export interface GPUBufferOptions {
|
|
6
|
+
name?: string;
|
|
7
|
+
target?: GPUBufferTarget;
|
|
8
|
+
type?: WebGLRenderingContext['FLOAT'] | WebGLRenderingContext['INT'] | WebGLRenderingContext['SHORT'];
|
|
9
|
+
/**
|
|
10
|
+
* 数据元素的总量
|
|
11
|
+
*/
|
|
12
|
+
elementCount?: number;
|
|
13
|
+
data?: TypedArray;
|
|
14
|
+
usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* GPU的Buffer对象,通过JS ArrayBuffer,可以向其中写入数据
|
|
18
|
+
* JS调用写入数据后,会立即执行GPU写入的操作,此类型不会保存JS的ArrayBuffer对象
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare class GPUBuffer implements IGPUResource {
|
|
22
|
+
readonly renderer?: IGPURenderer;
|
|
23
|
+
readonly isDestroyed: boolean;
|
|
24
|
+
readonly level: number;
|
|
25
|
+
readonly target: GPUBufferTarget;
|
|
26
|
+
readonly type: WebGLRenderingContext['FLOAT'] | WebGLRenderingContext['INT'] | WebGLRenderingContext['SHORT'];
|
|
27
|
+
readonly byteLength: number;
|
|
28
|
+
readonly bytesPerElement: number;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
constructor(options: GPUBufferOptions, renderer?: IGPURenderer);
|
|
31
|
+
/**
|
|
32
|
+
* 数据元素的总量
|
|
33
|
+
*/
|
|
34
|
+
readonly elementCount: number;
|
|
35
|
+
/**
|
|
36
|
+
* 根据TypedArray容量,重新分配Buffer内存
|
|
37
|
+
* @param typedArray
|
|
38
|
+
*/
|
|
39
|
+
bufferData(typedArray: TypedArray): void;
|
|
40
|
+
/**
|
|
41
|
+
* 更新buffer数据,立即写入GPU中
|
|
42
|
+
* @param elementOffset 从buffer的第几个元素开始
|
|
43
|
+
* @param typedArray 要写入的数据
|
|
44
|
+
*/
|
|
45
|
+
bufferSubData(elementOffset: number, typedArray: TypedArray): void;
|
|
46
|
+
/**
|
|
47
|
+
* 将数据从GPU中读出,写入到传入的typedArray中,只有当level为2时才能成功,webgl下此函数永远不会成功
|
|
48
|
+
* @param elementOffset 从第几个元素开始拷贝,默认为 0
|
|
49
|
+
* @param typedArray 要写入的typedArray
|
|
50
|
+
* @param elementCount 要写入多少个元素,如果不传入,则为typedArray元素长度
|
|
51
|
+
*/
|
|
52
|
+
readSubData(elementOffset: number, typedArray: TypedArray, elementCount?: number): boolean;
|
|
53
|
+
assignRenderer(renderer: GPURenderer): GPUBuffer;
|
|
54
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Immutable } from './type';
|
|
2
|
+
export declare const COMPRESSED_TEXTURE_NONE = 0;
|
|
3
|
+
export declare const COMPRESSED_TEXTURE_PVRTC = 1;
|
|
4
|
+
export declare const COMPRESSED_TEXTURE_ASTC = 2;
|
|
5
|
+
export interface GPUCapabilityDetail {
|
|
6
|
+
floatTexture: number;
|
|
7
|
+
halfFloatTexture: number;
|
|
8
|
+
floatColorAttachment?: boolean;
|
|
9
|
+
halfFloatColorAttachment?: boolean;
|
|
10
|
+
maxVertexUniforms: number;
|
|
11
|
+
maxVertexTextures: number;
|
|
12
|
+
maxFragmentUniforms: number;
|
|
13
|
+
maxFragmentTextures: number;
|
|
14
|
+
maxShaderTexCount: number;
|
|
15
|
+
maxTextureSize: number;
|
|
16
|
+
maxTextureAnisotropy: number;
|
|
17
|
+
compressedTexture: number;
|
|
18
|
+
shaderTextureLod: boolean;
|
|
19
|
+
instanceDraw?: boolean;
|
|
20
|
+
drawBuffers?: boolean;
|
|
21
|
+
asyncShaderCompile?: boolean;
|
|
22
|
+
intIndexElementBuffer?: boolean;
|
|
23
|
+
readableDepthStencilTextures?: boolean;
|
|
24
|
+
writableFragDepth?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface GPUCapability {
|
|
27
|
+
type: 'webgl' | 'webgl2' | 'native-gl' | 'node-gl' | 'metal' | 'none';
|
|
28
|
+
level: number;
|
|
29
|
+
capability: Immutable<GPUCapabilityDetail>;
|
|
30
|
+
setup(gl: WebGLRenderingContext): void;
|
|
31
|
+
}
|
|
32
|
+
export declare class GPUCapabilityEmpty implements GPUCapability {
|
|
33
|
+
type: 'webgl' | 'webgl2' | 'native-gl' | 'node-gl' | 'metal' | 'none';
|
|
34
|
+
level: number;
|
|
35
|
+
capability: {
|
|
36
|
+
floatTexture: number;
|
|
37
|
+
halfFloatTexture: number;
|
|
38
|
+
maxVertexUniforms: number;
|
|
39
|
+
maxVertexTextures: number;
|
|
40
|
+
maxFragmentUniforms: number;
|
|
41
|
+
maxFragmentTextures: number;
|
|
42
|
+
maxTextureSize: number;
|
|
43
|
+
maxShaderTexCount: number;
|
|
44
|
+
maxTextureAnisotropy: number;
|
|
45
|
+
compressedTexture: number;
|
|
46
|
+
shaderTextureLod: boolean;
|
|
47
|
+
};
|
|
48
|
+
constructor();
|
|
49
|
+
setup(gl: WebGLRenderingContext): void;
|
|
50
|
+
}
|