@luma.gl/webgl 9.0.0-beta.6 → 9.0.0-beta.8
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/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +81 -84
- package/dist/adapter/converters/sampler-parameters.js +17 -17
- package/dist/adapter/converters/shader-formats.js +12 -12
- package/dist/adapter/converters/texture-formats.d.ts +10 -8
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +175 -168
- package/dist/adapter/converters/vertex-formats.js +20 -20
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +14 -2
- package/dist/adapter/device-helpers/webgl-device-info.js +5 -5
- package/dist/adapter/device-helpers/webgl-device-limits.js +10 -10
- package/dist/adapter/helpers/decode-webgl-types.js +45 -45
- package/dist/adapter/helpers/get-shader-layout.js +29 -29
- package/dist/adapter/helpers/set-uniform.js +40 -40
- package/dist/adapter/helpers/webgl-topology-utils.js +38 -38
- package/dist/adapter/objects/webgl-renderbuffer.js +6 -6
- package/dist/adapter/objects/webgl-resource.js +1 -2
- package/dist/adapter/resources/webgl-buffer.js +14 -14
- package/dist/adapter/resources/webgl-command-buffer.js +25 -25
- package/dist/adapter/resources/webgl-external-texture.js +3 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -4
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +41 -36
- package/dist/adapter/resources/webgl-query-set.js +6 -6
- package/dist/adapter/resources/webgl-render-pass.js +5 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +19 -13
- package/dist/adapter/resources/webgl-sampler.js +2 -2
- package/dist/adapter/resources/webgl-shader.js +4 -4
- package/dist/adapter/resources/webgl-texture.d.ts +2 -1
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +29 -27
- package/dist/adapter/resources/webgl-transform-feedback.js +8 -8
- package/dist/adapter/resources/webgl-vertex-array.d.ts +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +5 -5
- package/dist/adapter/webgl-device.d.ts +6 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +22 -17
- package/dist/classic/accessor.js +4 -4
- package/dist/classic/clear.js +2 -2
- package/dist/classic/copy-and-blit.js +15 -16
- package/dist/classic/format-utils.d.ts +2 -2
- package/dist/classic/format-utils.js +14 -14
- package/dist/classic/typed-array-utils.js +18 -18
- package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +4 -9
- package/dist/context/parameters/webgl-parameter-tables.d.ts +2 -13
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +292 -298
- package/dist/context/state-tracker/with-parameters.d.ts +1 -2
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +2 -5
- package/dist/dist.dev.js +3796 -5522
- package/dist/dist.min.js +10 -0
- package/dist/index.cjs +1253 -1188
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -7
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/adapter/converters/device-parameters.ts +9 -11
- package/src/adapter/converters/texture-formats.ts +64 -61
- package/src/adapter/device-helpers/webgl-device-features.ts +22 -2
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +1 -1
- package/src/adapter/resources/webgl-external-texture.ts +3 -3
- package/src/adapter/resources/webgl-framebuffer.ts +29 -26
- package/src/adapter/resources/webgl-render-pass.ts +3 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +13 -6
- package/src/adapter/resources/webgl-texture.ts +7 -3
- package/src/adapter/webgl-device.ts +24 -19
- package/src/classic/clear.ts +2 -2
- package/src/context/.DS_Store +0 -0
- package/src/context/parameters/unified-parameter-api.ts +4 -16
- package/src/context/state-tracker/with-parameters.ts +2 -7
- package/src/index.ts +4 -4
- package/dist/adapter/device-helpers/device-features.d.ts +0 -6
- package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-features.js +0 -65
- package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
- package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js +0 -92
- package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js +0 -87
- package/dist/context/context/context-data.d.ts +0 -14
- package/dist/context/context/context-data.d.ts.map +0 -1
- package/dist/context/context/context-data.js +0 -33
- package/dist/context/context/create-browser-context.d.ts +0 -35
- package/dist/context/context/create-browser-context.d.ts.map +0 -1
- package/dist/context/context/create-browser-context.js +0 -66
- package/dist.min.js +0 -19
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,6 @@ __export(dist_exports, {
|
|
|
30
30
|
WEBGLFramebuffer: () => WEBGLFramebuffer,
|
|
31
31
|
WEBGLRenderPass: () => WEBGLRenderPass,
|
|
32
32
|
WEBGLRenderPipeline: () => WEBGLRenderPipeline,
|
|
33
|
-
WEBGLRenderbuffer: () => WEBGLRenderbuffer,
|
|
34
33
|
WEBGLResource: () => WebGLResource,
|
|
35
34
|
WEBGLSampler: () => WEBGLSampler,
|
|
36
35
|
WEBGLShader: () => WEBGLShader,
|
|
@@ -41,6 +40,7 @@ __export(dist_exports, {
|
|
|
41
40
|
WebGLDevice: () => WebGLDevice,
|
|
42
41
|
WebGLResource: () => WebGLResource,
|
|
43
42
|
_TEXTURE_FORMATS: () => TEXTURE_FORMATS,
|
|
43
|
+
_WEBGLRenderbuffer: () => WEBGLRenderbuffer,
|
|
44
44
|
convertGLToTextureFormat: () => convertGLToTextureFormat,
|
|
45
45
|
getGLParameters: () => getGLParameters,
|
|
46
46
|
getShaderLayout: () => getShaderLayout,
|
|
@@ -56,7 +56,7 @@ __export(dist_exports, {
|
|
|
56
56
|
module.exports = __toCommonJS(dist_exports);
|
|
57
57
|
|
|
58
58
|
// dist/adapter/webgl-device.js
|
|
59
|
-
var
|
|
59
|
+
var import_core27 = require("@luma.gl/core");
|
|
60
60
|
|
|
61
61
|
// dist/context/state-tracker/track-context-state.js
|
|
62
62
|
var import_core = require("@luma.gl/core");
|
|
@@ -64,99 +64,99 @@ var import_core = require("@luma.gl/core");
|
|
|
64
64
|
// dist/context/parameters/webgl-parameter-tables.js
|
|
65
65
|
var import_constants = require("@luma.gl/constants");
|
|
66
66
|
var GL_PARAMETER_DEFAULTS = {
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
67
|
+
[3042]: false,
|
|
68
|
+
[32773]: new Float32Array([0, 0, 0, 0]),
|
|
69
|
+
[32777]: 32774,
|
|
70
|
+
[34877]: 32774,
|
|
71
|
+
[32969]: 1,
|
|
72
|
+
[32968]: 0,
|
|
73
|
+
[32971]: 1,
|
|
74
|
+
[32970]: 0,
|
|
75
|
+
[3106]: new Float32Array([0, 0, 0, 0]),
|
|
76
76
|
// TBD
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
77
|
+
[3107]: [true, true, true, true],
|
|
78
|
+
[2884]: false,
|
|
79
|
+
[2885]: 1029,
|
|
80
|
+
[2929]: false,
|
|
81
|
+
[2931]: 1,
|
|
82
|
+
[2932]: 513,
|
|
83
|
+
[2928]: new Float32Array([0, 1]),
|
|
84
84
|
// TBD
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
85
|
+
[2930]: true,
|
|
86
|
+
[3024]: true,
|
|
87
|
+
[35725]: null,
|
|
88
88
|
// FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
[
|
|
94
|
-
[
|
|
95
|
-
[
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
[
|
|
101
|
-
[
|
|
102
|
-
[
|
|
103
|
-
[
|
|
89
|
+
[36006]: null,
|
|
90
|
+
[36007]: null,
|
|
91
|
+
[34229]: null,
|
|
92
|
+
[34964]: null,
|
|
93
|
+
[2886]: 2305,
|
|
94
|
+
[33170]: 4352,
|
|
95
|
+
[2849]: 1,
|
|
96
|
+
[32823]: false,
|
|
97
|
+
[32824]: 0,
|
|
98
|
+
[10752]: 0,
|
|
99
|
+
[32926]: false,
|
|
100
|
+
[32928]: false,
|
|
101
|
+
[32938]: 1,
|
|
102
|
+
[32939]: false,
|
|
103
|
+
[3089]: false,
|
|
104
104
|
// Note: Dynamic value. If scissor test enabled we expect users to set correct scissor box
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
121
|
-
[
|
|
105
|
+
[3088]: new Int32Array([0, 0, 1024, 1024]),
|
|
106
|
+
[2960]: false,
|
|
107
|
+
[2961]: 0,
|
|
108
|
+
[2968]: 4294967295,
|
|
109
|
+
[36005]: 4294967295,
|
|
110
|
+
[2962]: 519,
|
|
111
|
+
[2967]: 0,
|
|
112
|
+
[2963]: 4294967295,
|
|
113
|
+
[34816]: 519,
|
|
114
|
+
[36003]: 0,
|
|
115
|
+
[36004]: 4294967295,
|
|
116
|
+
[2964]: 7680,
|
|
117
|
+
[2965]: 7680,
|
|
118
|
+
[2966]: 7680,
|
|
119
|
+
[34817]: 7680,
|
|
120
|
+
[34818]: 7680,
|
|
121
|
+
[34819]: 7680,
|
|
122
122
|
// Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
[
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[
|
|
134
|
-
[
|
|
135
|
-
[
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
143
|
-
[
|
|
144
|
-
[
|
|
123
|
+
[2978]: [0, 0, 1024, 1024],
|
|
124
|
+
[36389]: null,
|
|
125
|
+
[36662]: null,
|
|
126
|
+
[36663]: null,
|
|
127
|
+
[35053]: null,
|
|
128
|
+
[35055]: null,
|
|
129
|
+
[35723]: 4352,
|
|
130
|
+
[36010]: null,
|
|
131
|
+
[35977]: false,
|
|
132
|
+
[3333]: 4,
|
|
133
|
+
[3317]: 4,
|
|
134
|
+
[37440]: false,
|
|
135
|
+
[37441]: false,
|
|
136
|
+
[37443]: 37444,
|
|
137
|
+
[3330]: 0,
|
|
138
|
+
[3332]: 0,
|
|
139
|
+
[3331]: 0,
|
|
140
|
+
[3314]: 0,
|
|
141
|
+
[32878]: 0,
|
|
142
|
+
[3316]: 0,
|
|
143
|
+
[3315]: 0,
|
|
144
|
+
[32877]: 0
|
|
145
145
|
};
|
|
146
146
|
var enable = (gl, value, key) => value ? gl.enable(key) : gl.disable(key);
|
|
147
147
|
var hint = (gl, value, key) => gl.hint(key, value);
|
|
148
148
|
var pixelStorei = (gl, value, key) => gl.pixelStorei(key, value);
|
|
149
149
|
var bindFramebuffer = (gl, value, key) => {
|
|
150
|
-
const target = key ===
|
|
150
|
+
const target = key === 36006 ? 36009 : 36008;
|
|
151
151
|
return gl.bindFramebuffer(target, value);
|
|
152
152
|
};
|
|
153
153
|
var bindBuffer = (gl, value, key) => {
|
|
154
154
|
const bindingMap = {
|
|
155
|
-
[
|
|
156
|
-
[
|
|
157
|
-
[
|
|
158
|
-
[
|
|
159
|
-
[
|
|
155
|
+
[34964]: 34962,
|
|
156
|
+
[36662]: 36662,
|
|
157
|
+
[36663]: 36663,
|
|
158
|
+
[35053]: 35051,
|
|
159
|
+
[35055]: 35052
|
|
160
160
|
};
|
|
161
161
|
const glTarget = bindingMap[key];
|
|
162
162
|
gl.bindBuffer(glTarget, value);
|
|
@@ -165,108 +165,108 @@ function isArray(array) {
|
|
|
165
165
|
return Array.isArray(array) || ArrayBuffer.isView(array) && !(array instanceof DataView);
|
|
166
166
|
}
|
|
167
167
|
var GL_PARAMETER_SETTERS = {
|
|
168
|
-
[
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
177
|
-
[
|
|
178
|
-
[
|
|
179
|
-
[
|
|
180
|
-
[
|
|
181
|
-
[
|
|
182
|
-
[
|
|
183
|
-
[
|
|
184
|
-
[
|
|
185
|
-
[
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
[
|
|
189
|
-
[
|
|
168
|
+
[3042]: enable,
|
|
169
|
+
[32773]: (gl, value) => gl.blendColor(...value),
|
|
170
|
+
[32777]: "blendEquation",
|
|
171
|
+
[34877]: "blendEquation",
|
|
172
|
+
[32969]: "blendFunc",
|
|
173
|
+
[32968]: "blendFunc",
|
|
174
|
+
[32971]: "blendFunc",
|
|
175
|
+
[32970]: "blendFunc",
|
|
176
|
+
[3106]: (gl, value) => gl.clearColor(...value),
|
|
177
|
+
[3107]: (gl, value) => gl.colorMask(...value),
|
|
178
|
+
[2884]: enable,
|
|
179
|
+
[2885]: (gl, value) => gl.cullFace(value),
|
|
180
|
+
[2929]: enable,
|
|
181
|
+
[2931]: (gl, value) => gl.clearDepth(value),
|
|
182
|
+
[2932]: (gl, value) => gl.depthFunc(value),
|
|
183
|
+
[2928]: (gl, value) => gl.depthRange(...value),
|
|
184
|
+
[2930]: (gl, value) => gl.depthMask(value),
|
|
185
|
+
[3024]: enable,
|
|
186
|
+
[35723]: hint,
|
|
187
|
+
[35725]: (gl, value) => gl.useProgram(value),
|
|
188
|
+
[36007]: (gl, value) => gl.bindRenderbuffer(36161, value),
|
|
189
|
+
[36389]: (gl, value) => {
|
|
190
190
|
var _a;
|
|
191
|
-
return (_a = gl.bindTransformFeedback) == null ? void 0 : _a.call(gl,
|
|
191
|
+
return (_a = gl.bindTransformFeedback) == null ? void 0 : _a.call(gl, 36386, value);
|
|
192
192
|
},
|
|
193
|
-
[
|
|
193
|
+
[34229]: (gl, value) => gl.bindVertexArray(value),
|
|
194
194
|
// NOTE: FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
|
|
195
|
-
[
|
|
196
|
-
[
|
|
195
|
+
[36006]: bindFramebuffer,
|
|
196
|
+
[36010]: bindFramebuffer,
|
|
197
197
|
// Buffers
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
[
|
|
205
|
-
[
|
|
206
|
-
[
|
|
207
|
-
[
|
|
208
|
-
[
|
|
209
|
-
[
|
|
210
|
-
[
|
|
211
|
-
[
|
|
212
|
-
[
|
|
213
|
-
[
|
|
214
|
-
[
|
|
215
|
-
[
|
|
216
|
-
[
|
|
217
|
-
[
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
[
|
|
221
|
-
[
|
|
222
|
-
[
|
|
223
|
-
[
|
|
224
|
-
[
|
|
225
|
-
[
|
|
226
|
-
[
|
|
227
|
-
[
|
|
228
|
-
[
|
|
229
|
-
[
|
|
230
|
-
[
|
|
231
|
-
[
|
|
232
|
-
[
|
|
198
|
+
[34964]: bindBuffer,
|
|
199
|
+
[36662]: bindBuffer,
|
|
200
|
+
[36663]: bindBuffer,
|
|
201
|
+
[35053]: bindBuffer,
|
|
202
|
+
[35055]: bindBuffer,
|
|
203
|
+
[2886]: (gl, value) => gl.frontFace(value),
|
|
204
|
+
[33170]: hint,
|
|
205
|
+
[2849]: (gl, value) => gl.lineWidth(value),
|
|
206
|
+
[32823]: enable,
|
|
207
|
+
[32824]: "polygonOffset",
|
|
208
|
+
[10752]: "polygonOffset",
|
|
209
|
+
[35977]: enable,
|
|
210
|
+
[32926]: enable,
|
|
211
|
+
[32928]: enable,
|
|
212
|
+
[32938]: "sampleCoverage",
|
|
213
|
+
[32939]: "sampleCoverage",
|
|
214
|
+
[3089]: enable,
|
|
215
|
+
[3088]: (gl, value) => gl.scissor(...value),
|
|
216
|
+
[2960]: enable,
|
|
217
|
+
[2961]: (gl, value) => gl.clearStencil(value),
|
|
218
|
+
[2968]: (gl, value) => gl.stencilMaskSeparate(1028, value),
|
|
219
|
+
[36005]: (gl, value) => gl.stencilMaskSeparate(1029, value),
|
|
220
|
+
[2962]: "stencilFuncFront",
|
|
221
|
+
[2967]: "stencilFuncFront",
|
|
222
|
+
[2963]: "stencilFuncFront",
|
|
223
|
+
[34816]: "stencilFuncBack",
|
|
224
|
+
[36003]: "stencilFuncBack",
|
|
225
|
+
[36004]: "stencilFuncBack",
|
|
226
|
+
[2964]: "stencilOpFront",
|
|
227
|
+
[2965]: "stencilOpFront",
|
|
228
|
+
[2966]: "stencilOpFront",
|
|
229
|
+
[34817]: "stencilOpBack",
|
|
230
|
+
[34818]: "stencilOpBack",
|
|
231
|
+
[34819]: "stencilOpBack",
|
|
232
|
+
[2978]: (gl, value) => gl.viewport(...value),
|
|
233
233
|
// WEBGL2 EXTENSIONS
|
|
234
234
|
// EXT_depth_clamp https://registry.khronos.org/webgl/extensions/EXT_depth_clamp/
|
|
235
|
-
[
|
|
235
|
+
[34383]: enable,
|
|
236
236
|
// WEBGL_provoking_vertex https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/
|
|
237
237
|
// [GL.PROVOKING_VERTEX_WEBL]: TODO - extension function needed
|
|
238
238
|
// WEBGL_polygon_mode https://registry.khronos.org/webgl/extensions/WEBGL_polygon_mode/
|
|
239
239
|
// POLYGON_MODE_WEBGL TODO - extension function needed
|
|
240
|
-
[
|
|
240
|
+
[10754]: enable,
|
|
241
241
|
// WEBGL_clip_cull_distance https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/
|
|
242
|
-
[
|
|
243
|
-
[
|
|
244
|
-
[
|
|
245
|
-
[
|
|
246
|
-
[
|
|
247
|
-
[
|
|
248
|
-
[
|
|
249
|
-
[
|
|
242
|
+
[12288]: enable,
|
|
243
|
+
[12289]: enable,
|
|
244
|
+
[12290]: enable,
|
|
245
|
+
[12291]: enable,
|
|
246
|
+
[12292]: enable,
|
|
247
|
+
[12293]: enable,
|
|
248
|
+
[12294]: enable,
|
|
249
|
+
[12295]: enable,
|
|
250
250
|
// PIXEL PACK/UNPACK MODES
|
|
251
|
-
[
|
|
252
|
-
[
|
|
253
|
-
[
|
|
254
|
-
[
|
|
255
|
-
[
|
|
256
|
-
[
|
|
257
|
-
[
|
|
258
|
-
[
|
|
259
|
-
[
|
|
260
|
-
[
|
|
261
|
-
[
|
|
262
|
-
[
|
|
263
|
-
[
|
|
251
|
+
[3333]: pixelStorei,
|
|
252
|
+
[3317]: pixelStorei,
|
|
253
|
+
[37440]: pixelStorei,
|
|
254
|
+
[37441]: pixelStorei,
|
|
255
|
+
[37443]: pixelStorei,
|
|
256
|
+
[3330]: pixelStorei,
|
|
257
|
+
[3332]: pixelStorei,
|
|
258
|
+
[3331]: pixelStorei,
|
|
259
|
+
[3314]: pixelStorei,
|
|
260
|
+
[32878]: pixelStorei,
|
|
261
|
+
[3316]: pixelStorei,
|
|
262
|
+
[3315]: pixelStorei,
|
|
263
|
+
[32877]: pixelStorei,
|
|
264
264
|
// Function-style setters
|
|
265
265
|
framebuffer: (gl, framebuffer) => {
|
|
266
266
|
const handle = framebuffer && "handle" in framebuffer ? framebuffer.handle : framebuffer;
|
|
267
|
-
return gl.bindFramebuffer(
|
|
267
|
+
return gl.bindFramebuffer(36160, handle);
|
|
268
268
|
},
|
|
269
|
-
blend: (gl, value) => value ? gl.enable(
|
|
269
|
+
blend: (gl, value) => value ? gl.enable(3042) : gl.disable(3042),
|
|
270
270
|
blendColor: (gl, value) => gl.blendColor(...value),
|
|
271
271
|
blendEquation: (gl, args) => {
|
|
272
272
|
const separateModes = typeof args === "number" ? [args, args] : args;
|
|
@@ -280,42 +280,42 @@ var GL_PARAMETER_SETTERS = {
|
|
|
280
280
|
clearDepth: (gl, value) => gl.clearDepth(value),
|
|
281
281
|
clearStencil: (gl, value) => gl.clearStencil(value),
|
|
282
282
|
colorMask: (gl, value) => gl.colorMask(...value),
|
|
283
|
-
cull: (gl, value) => value ? gl.enable(
|
|
283
|
+
cull: (gl, value) => value ? gl.enable(2884) : gl.disable(2884),
|
|
284
284
|
cullFace: (gl, value) => gl.cullFace(value),
|
|
285
|
-
depthTest: (gl, value) => value ? gl.enable(
|
|
285
|
+
depthTest: (gl, value) => value ? gl.enable(2929) : gl.disable(2929),
|
|
286
286
|
depthFunc: (gl, value) => gl.depthFunc(value),
|
|
287
287
|
depthMask: (gl, value) => gl.depthMask(value),
|
|
288
288
|
depthRange: (gl, value) => gl.depthRange(...value),
|
|
289
|
-
dither: (gl, value) => value ? gl.enable(
|
|
289
|
+
dither: (gl, value) => value ? gl.enable(3024) : gl.disable(3024),
|
|
290
290
|
derivativeHint: (gl, value) => {
|
|
291
|
-
gl.hint(
|
|
291
|
+
gl.hint(35723, value);
|
|
292
292
|
},
|
|
293
293
|
frontFace: (gl, value) => gl.frontFace(value),
|
|
294
|
-
mipmapHint: (gl, value) => gl.hint(
|
|
294
|
+
mipmapHint: (gl, value) => gl.hint(33170, value),
|
|
295
295
|
lineWidth: (gl, value) => gl.lineWidth(value),
|
|
296
|
-
polygonOffsetFill: (gl, value) => value ? gl.enable(
|
|
296
|
+
polygonOffsetFill: (gl, value) => value ? gl.enable(32823) : gl.disable(32823),
|
|
297
297
|
polygonOffset: (gl, value) => gl.polygonOffset(...value),
|
|
298
298
|
sampleCoverage: (gl, value) => gl.sampleCoverage(...value),
|
|
299
|
-
scissorTest: (gl, value) => value ? gl.enable(
|
|
299
|
+
scissorTest: (gl, value) => value ? gl.enable(3089) : gl.disable(3089),
|
|
300
300
|
scissor: (gl, value) => gl.scissor(...value),
|
|
301
|
-
stencilTest: (gl, value) => value ? gl.enable(
|
|
301
|
+
stencilTest: (gl, value) => value ? gl.enable(2960) : gl.disable(2960),
|
|
302
302
|
stencilMask: (gl, value) => {
|
|
303
303
|
value = isArray(value) ? value : [value, value];
|
|
304
304
|
const [mask, backMask] = value;
|
|
305
|
-
gl.stencilMaskSeparate(
|
|
306
|
-
gl.stencilMaskSeparate(
|
|
305
|
+
gl.stencilMaskSeparate(1028, mask);
|
|
306
|
+
gl.stencilMaskSeparate(1029, backMask);
|
|
307
307
|
},
|
|
308
308
|
stencilFunc: (gl, args) => {
|
|
309
309
|
args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
|
|
310
310
|
const [func, ref, mask, backFunc, backRef, backMask] = args;
|
|
311
|
-
gl.stencilFuncSeparate(
|
|
312
|
-
gl.stencilFuncSeparate(
|
|
311
|
+
gl.stencilFuncSeparate(1028, func, ref, mask);
|
|
312
|
+
gl.stencilFuncSeparate(1029, backFunc, backRef, backMask);
|
|
313
313
|
},
|
|
314
314
|
stencilOp: (gl, args) => {
|
|
315
315
|
args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
|
|
316
316
|
const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = args;
|
|
317
|
-
gl.stencilOpSeparate(
|
|
318
|
-
gl.stencilOpSeparate(
|
|
317
|
+
gl.stencilOpSeparate(1028, sfail, dpfail, dppass);
|
|
318
|
+
gl.stencilOpSeparate(1029, backSfail, backDpfail, backDppass);
|
|
319
319
|
},
|
|
320
320
|
viewport: (gl, value) => gl.viewport(...value)
|
|
321
321
|
};
|
|
@@ -323,14 +323,14 @@ function getValue(glEnum, values, cache) {
|
|
|
323
323
|
return values[glEnum] !== void 0 ? values[glEnum] : cache[glEnum];
|
|
324
324
|
}
|
|
325
325
|
var GL_COMPOSITE_PARAMETER_SETTERS = {
|
|
326
|
-
blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(
|
|
327
|
-
blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(
|
|
328
|
-
polygonOffset: (gl, values, cache) => gl.polygonOffset(getValue(
|
|
329
|
-
sampleCoverage: (gl, values, cache) => gl.sampleCoverage(getValue(
|
|
330
|
-
stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(
|
|
331
|
-
stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(
|
|
332
|
-
stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(
|
|
333
|
-
stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(
|
|
326
|
+
blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(32777, values, cache), getValue(34877, values, cache)),
|
|
327
|
+
blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(32969, values, cache), getValue(32968, values, cache), getValue(32971, values, cache), getValue(32970, values, cache)),
|
|
328
|
+
polygonOffset: (gl, values, cache) => gl.polygonOffset(getValue(32824, values, cache), getValue(10752, values, cache)),
|
|
329
|
+
sampleCoverage: (gl, values, cache) => gl.sampleCoverage(getValue(32938, values, cache), getValue(32939, values, cache)),
|
|
330
|
+
stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(1028, getValue(2962, values, cache), getValue(2967, values, cache), getValue(2963, values, cache)),
|
|
331
|
+
stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(1029, getValue(34816, values, cache), getValue(36003, values, cache), getValue(36004, values, cache)),
|
|
332
|
+
stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(1028, getValue(2964, values, cache), getValue(2965, values, cache), getValue(2966, values, cache)),
|
|
333
|
+
stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(1029, getValue(34817, values, cache), getValue(34818, values, cache), getValue(34819, values, cache))
|
|
334
334
|
};
|
|
335
335
|
var GL_HOOKED_SETTERS = {
|
|
336
336
|
// GENERIC SETTERS
|
|
@@ -348,39 +348,39 @@ var GL_HOOKED_SETTERS = {
|
|
|
348
348
|
}),
|
|
349
349
|
// SPECIFIC SETTERS
|
|
350
350
|
useProgram: (update, value) => update({
|
|
351
|
-
[
|
|
351
|
+
[35725]: value
|
|
352
352
|
}),
|
|
353
353
|
bindRenderbuffer: (update, target, value) => update({
|
|
354
|
-
[
|
|
354
|
+
[36007]: value
|
|
355
355
|
}),
|
|
356
356
|
bindTransformFeedback: (update, target, value) => update({
|
|
357
|
-
[
|
|
357
|
+
[36389]: value
|
|
358
358
|
}),
|
|
359
359
|
bindVertexArray: (update, value) => update({
|
|
360
|
-
[
|
|
360
|
+
[34229]: value
|
|
361
361
|
}),
|
|
362
362
|
bindFramebuffer: (update, target, framebuffer) => {
|
|
363
363
|
switch (target) {
|
|
364
|
-
case
|
|
364
|
+
case 36160:
|
|
365
365
|
return update({
|
|
366
|
-
[
|
|
367
|
-
[
|
|
366
|
+
[36006]: framebuffer,
|
|
367
|
+
[36010]: framebuffer
|
|
368
368
|
});
|
|
369
|
-
case
|
|
370
|
-
return update({ [
|
|
371
|
-
case
|
|
372
|
-
return update({ [
|
|
369
|
+
case 36009:
|
|
370
|
+
return update({ [36006]: framebuffer });
|
|
371
|
+
case 36008:
|
|
372
|
+
return update({ [36010]: framebuffer });
|
|
373
373
|
default:
|
|
374
374
|
return null;
|
|
375
375
|
}
|
|
376
376
|
},
|
|
377
377
|
bindBuffer: (update, target, buffer) => {
|
|
378
378
|
const pname = {
|
|
379
|
-
[
|
|
380
|
-
[
|
|
381
|
-
[
|
|
382
|
-
[
|
|
383
|
-
[
|
|
379
|
+
[34962]: [34964],
|
|
380
|
+
[36662]: [36662],
|
|
381
|
+
[36663]: [36663],
|
|
382
|
+
[35051]: [35053],
|
|
383
|
+
[35052]: [35055]
|
|
384
384
|
}[target];
|
|
385
385
|
if (pname) {
|
|
386
386
|
return update({ [pname]: buffer });
|
|
@@ -388,162 +388,154 @@ var GL_HOOKED_SETTERS = {
|
|
|
388
388
|
return { valueChanged: true };
|
|
389
389
|
},
|
|
390
390
|
blendColor: (update, r, g, b, a) => update({
|
|
391
|
-
[
|
|
391
|
+
[32773]: new Float32Array([r, g, b, a])
|
|
392
392
|
}),
|
|
393
393
|
blendEquation: (update, mode) => update({
|
|
394
|
-
[
|
|
395
|
-
[
|
|
394
|
+
[32777]: mode,
|
|
395
|
+
[34877]: mode
|
|
396
396
|
}),
|
|
397
397
|
blendEquationSeparate: (update, modeRGB, modeAlpha) => update({
|
|
398
|
-
[
|
|
399
|
-
[
|
|
398
|
+
[32777]: modeRGB,
|
|
399
|
+
[34877]: modeAlpha
|
|
400
400
|
}),
|
|
401
401
|
blendFunc: (update, src, dst) => update({
|
|
402
|
-
[
|
|
403
|
-
[
|
|
404
|
-
[
|
|
405
|
-
[
|
|
402
|
+
[32969]: src,
|
|
403
|
+
[32968]: dst,
|
|
404
|
+
[32971]: src,
|
|
405
|
+
[32970]: dst
|
|
406
406
|
}),
|
|
407
407
|
blendFuncSeparate: (update, srcRGB, dstRGB, srcAlpha, dstAlpha) => update({
|
|
408
|
-
[
|
|
409
|
-
[
|
|
410
|
-
[
|
|
411
|
-
[
|
|
408
|
+
[32969]: srcRGB,
|
|
409
|
+
[32968]: dstRGB,
|
|
410
|
+
[32971]: srcAlpha,
|
|
411
|
+
[32970]: dstAlpha
|
|
412
412
|
}),
|
|
413
413
|
clearColor: (update, r, g, b, a) => update({
|
|
414
|
-
[
|
|
414
|
+
[3106]: new Float32Array([r, g, b, a])
|
|
415
415
|
}),
|
|
416
416
|
clearDepth: (update, depth) => update({
|
|
417
|
-
[
|
|
417
|
+
[2931]: depth
|
|
418
418
|
}),
|
|
419
419
|
clearStencil: (update, s) => update({
|
|
420
|
-
[
|
|
420
|
+
[2961]: s
|
|
421
421
|
}),
|
|
422
422
|
colorMask: (update, r, g, b, a) => update({
|
|
423
|
-
[
|
|
423
|
+
[3107]: [r, g, b, a]
|
|
424
424
|
}),
|
|
425
425
|
cullFace: (update, mode) => update({
|
|
426
|
-
[
|
|
426
|
+
[2885]: mode
|
|
427
427
|
}),
|
|
428
428
|
depthFunc: (update, func) => update({
|
|
429
|
-
[
|
|
429
|
+
[2932]: func
|
|
430
430
|
}),
|
|
431
431
|
depthRange: (update, zNear, zFar) => update({
|
|
432
|
-
[
|
|
432
|
+
[2928]: new Float32Array([zNear, zFar])
|
|
433
433
|
}),
|
|
434
434
|
depthMask: (update, mask) => update({
|
|
435
|
-
[
|
|
435
|
+
[2930]: mask
|
|
436
436
|
}),
|
|
437
437
|
frontFace: (update, face) => update({
|
|
438
|
-
[
|
|
438
|
+
[2886]: face
|
|
439
439
|
}),
|
|
440
440
|
lineWidth: (update, width) => update({
|
|
441
|
-
[
|
|
441
|
+
[2849]: width
|
|
442
442
|
}),
|
|
443
443
|
polygonOffset: (update, factor, units) => update({
|
|
444
|
-
[
|
|
445
|
-
[
|
|
444
|
+
[32824]: factor,
|
|
445
|
+
[10752]: units
|
|
446
446
|
}),
|
|
447
447
|
sampleCoverage: (update, value, invert) => update({
|
|
448
|
-
[
|
|
449
|
-
[
|
|
448
|
+
[32938]: value,
|
|
449
|
+
[32939]: invert
|
|
450
450
|
}),
|
|
451
451
|
scissor: (update, x, y, width, height) => update({
|
|
452
|
-
[
|
|
452
|
+
[3088]: new Int32Array([x, y, width, height])
|
|
453
453
|
}),
|
|
454
454
|
stencilMask: (update, mask) => update({
|
|
455
|
-
[
|
|
456
|
-
[
|
|
455
|
+
[2968]: mask,
|
|
456
|
+
[36005]: mask
|
|
457
457
|
}),
|
|
458
458
|
stencilMaskSeparate: (update, face, mask) => update({
|
|
459
|
-
[face ===
|
|
459
|
+
[face === 1028 ? 2968 : 36005]: mask
|
|
460
460
|
}),
|
|
461
461
|
stencilFunc: (update, func, ref, mask) => update({
|
|
462
|
-
[
|
|
463
|
-
[
|
|
464
|
-
[
|
|
465
|
-
[
|
|
466
|
-
[
|
|
467
|
-
[
|
|
462
|
+
[2962]: func,
|
|
463
|
+
[2967]: ref,
|
|
464
|
+
[2963]: mask,
|
|
465
|
+
[34816]: func,
|
|
466
|
+
[36003]: ref,
|
|
467
|
+
[36004]: mask
|
|
468
468
|
}),
|
|
469
469
|
stencilFuncSeparate: (update, face, func, ref, mask) => update({
|
|
470
|
-
[face ===
|
|
471
|
-
[face ===
|
|
472
|
-
[face ===
|
|
470
|
+
[face === 1028 ? 2962 : 34816]: func,
|
|
471
|
+
[face === 1028 ? 2967 : 36003]: ref,
|
|
472
|
+
[face === 1028 ? 2963 : 36004]: mask
|
|
473
473
|
}),
|
|
474
474
|
stencilOp: (update, fail, zfail, zpass) => update({
|
|
475
|
-
[
|
|
476
|
-
[
|
|
477
|
-
[
|
|
478
|
-
[
|
|
479
|
-
[
|
|
480
|
-
[
|
|
475
|
+
[2964]: fail,
|
|
476
|
+
[2965]: zfail,
|
|
477
|
+
[2966]: zpass,
|
|
478
|
+
[34817]: fail,
|
|
479
|
+
[34818]: zfail,
|
|
480
|
+
[34819]: zpass
|
|
481
481
|
}),
|
|
482
482
|
stencilOpSeparate: (update, face, fail, zfail, zpass) => update({
|
|
483
|
-
[face ===
|
|
484
|
-
[face ===
|
|
485
|
-
[face ===
|
|
483
|
+
[face === 1028 ? 2964 : 34817]: fail,
|
|
484
|
+
[face === 1028 ? 2965 : 34818]: zfail,
|
|
485
|
+
[face === 1028 ? 2966 : 34819]: zpass
|
|
486
486
|
}),
|
|
487
487
|
viewport: (update, x, y, width, height) => update({
|
|
488
|
-
[
|
|
488
|
+
[2978]: [x, y, width, height]
|
|
489
489
|
})
|
|
490
490
|
};
|
|
491
491
|
var isEnabled = (gl, key) => gl.isEnabled(key);
|
|
492
492
|
var GL_PARAMETER_GETTERS = {
|
|
493
|
-
[
|
|
494
|
-
[
|
|
495
|
-
[
|
|
496
|
-
[
|
|
497
|
-
[
|
|
498
|
-
[
|
|
499
|
-
[
|
|
500
|
-
[
|
|
501
|
-
[
|
|
502
|
-
[
|
|
493
|
+
[3042]: isEnabled,
|
|
494
|
+
[2884]: isEnabled,
|
|
495
|
+
[2929]: isEnabled,
|
|
496
|
+
[3024]: isEnabled,
|
|
497
|
+
[32823]: isEnabled,
|
|
498
|
+
[32926]: isEnabled,
|
|
499
|
+
[32928]: isEnabled,
|
|
500
|
+
[3089]: isEnabled,
|
|
501
|
+
[2960]: isEnabled,
|
|
502
|
+
[35977]: isEnabled
|
|
503
503
|
};
|
|
504
504
|
var NON_CACHE_PARAMETERS = /* @__PURE__ */ new Set([
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
// states depending on ACTIVE_TEXTURE
|
|
536
|
-
import_constants.GL.SAMPLER_BINDING,
|
|
537
|
-
import_constants.GL.TEXTURE_BINDING_2D,
|
|
538
|
-
import_constants.GL.TEXTURE_BINDING_2D_ARRAY,
|
|
539
|
-
import_constants.GL.TEXTURE_BINDING_3D,
|
|
540
|
-
import_constants.GL.TEXTURE_BINDING_CUBE_MAP
|
|
505
|
+
34016,
|
|
506
|
+
36388,
|
|
507
|
+
36387,
|
|
508
|
+
35983,
|
|
509
|
+
35368,
|
|
510
|
+
34965,
|
|
511
|
+
35739,
|
|
512
|
+
35738,
|
|
513
|
+
3074,
|
|
514
|
+
34853,
|
|
515
|
+
34854,
|
|
516
|
+
34855,
|
|
517
|
+
34856,
|
|
518
|
+
34857,
|
|
519
|
+
34858,
|
|
520
|
+
34859,
|
|
521
|
+
34860,
|
|
522
|
+
34861,
|
|
523
|
+
34862,
|
|
524
|
+
34863,
|
|
525
|
+
34864,
|
|
526
|
+
34865,
|
|
527
|
+
34866,
|
|
528
|
+
34867,
|
|
529
|
+
34868,
|
|
530
|
+
35097,
|
|
531
|
+
32873,
|
|
532
|
+
35869,
|
|
533
|
+
32874,
|
|
534
|
+
34068
|
|
541
535
|
]);
|
|
542
536
|
|
|
543
537
|
// dist/context/parameters/unified-parameter-api.js
|
|
544
|
-
function setGLParameters(
|
|
545
|
-
const webglDevice = WebGLDevice.attach(device);
|
|
546
|
-
const gl = webglDevice.gl;
|
|
538
|
+
function setGLParameters(gl, parameters) {
|
|
547
539
|
if (isObjectEmpty(parameters)) {
|
|
548
540
|
return;
|
|
549
541
|
}
|
|
@@ -567,9 +559,7 @@ function setGLParameters(device, parameters) {
|
|
|
567
559
|
}
|
|
568
560
|
}
|
|
569
561
|
}
|
|
570
|
-
function getGLParameters(
|
|
571
|
-
const webglDevice = WebGLDevice.attach(device);
|
|
572
|
-
const gl = webglDevice.gl;
|
|
562
|
+
function getGLParameters(gl, parameters = GL_PARAMETER_DEFAULTS) {
|
|
573
563
|
if (typeof parameters === "number") {
|
|
574
564
|
const key = parameters;
|
|
575
565
|
const getter = GL_PARAMETER_GETTERS[key];
|
|
@@ -583,8 +573,8 @@ function getGLParameters(device, parameters = GL_PARAMETER_DEFAULTS) {
|
|
|
583
573
|
}
|
|
584
574
|
return state;
|
|
585
575
|
}
|
|
586
|
-
function resetGLParameters(
|
|
587
|
-
setGLParameters(
|
|
576
|
+
function resetGLParameters(gl) {
|
|
577
|
+
setGLParameters(gl, GL_PARAMETER_DEFAULTS);
|
|
588
578
|
}
|
|
589
579
|
function isObjectEmpty(object) {
|
|
590
580
|
for (const key in object) {
|
|
@@ -796,15 +786,15 @@ function getWebGLExtension(gl, name, extensions) {
|
|
|
796
786
|
|
|
797
787
|
// dist/adapter/device-helpers/webgl-device-info.js
|
|
798
788
|
function getDeviceInfo(gl, extensions) {
|
|
799
|
-
const vendorMasked = gl.getParameter(
|
|
800
|
-
const rendererMasked = gl.getParameter(
|
|
789
|
+
const vendorMasked = gl.getParameter(7936);
|
|
790
|
+
const rendererMasked = gl.getParameter(7937);
|
|
801
791
|
getWebGLExtension(gl, "WEBGL_debug_renderer_info", extensions);
|
|
802
792
|
const ext = extensions.WEBGL_debug_renderer_info;
|
|
803
|
-
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL :
|
|
804
|
-
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL :
|
|
793
|
+
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : 7936);
|
|
794
|
+
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : 7937);
|
|
805
795
|
const vendor = vendorUnmasked || vendorMasked;
|
|
806
796
|
const renderer = rendererUnmasked || rendererMasked;
|
|
807
|
-
const version = gl.getParameter(
|
|
797
|
+
const version = gl.getParameter(7938);
|
|
808
798
|
const gpu = identifyGPUVendor(vendor, renderer);
|
|
809
799
|
const gpuBackend = identifyGPUBackend(vendor, renderer);
|
|
810
800
|
const gpuType = identifyGPUType(vendor, renderer);
|
|
@@ -878,29 +868,29 @@ var import_constants3 = require("@luma.gl/constants");
|
|
|
878
868
|
function getGLFromVertexType(dataType) {
|
|
879
869
|
switch (dataType) {
|
|
880
870
|
case "uint8":
|
|
881
|
-
return
|
|
871
|
+
return 5121;
|
|
882
872
|
case "sint8":
|
|
883
|
-
return
|
|
873
|
+
return 5120;
|
|
884
874
|
case "unorm8":
|
|
885
|
-
return
|
|
875
|
+
return 5121;
|
|
886
876
|
case "snorm8":
|
|
887
|
-
return
|
|
877
|
+
return 5120;
|
|
888
878
|
case "uint16":
|
|
889
|
-
return
|
|
879
|
+
return 5123;
|
|
890
880
|
case "sint16":
|
|
891
|
-
return
|
|
881
|
+
return 5122;
|
|
892
882
|
case "unorm16":
|
|
893
|
-
return
|
|
883
|
+
return 5123;
|
|
894
884
|
case "snorm16":
|
|
895
|
-
return
|
|
885
|
+
return 5122;
|
|
896
886
|
case "uint32":
|
|
897
|
-
return
|
|
887
|
+
return 5125;
|
|
898
888
|
case "sint32":
|
|
899
|
-
return
|
|
889
|
+
return 5124;
|
|
900
890
|
case "float16":
|
|
901
|
-
return
|
|
891
|
+
return 5131;
|
|
902
892
|
case "float32":
|
|
903
|
-
return
|
|
893
|
+
return 5126;
|
|
904
894
|
}
|
|
905
895
|
throw new Error(String(dataType));
|
|
906
896
|
}
|
|
@@ -962,210 +952,259 @@ function checkTextureFeature(gl, feature, extensions) {
|
|
|
962
952
|
return textureExtensions.every((extension) => getWebGLExtension(gl, extension, extensions));
|
|
963
953
|
}
|
|
964
954
|
var TEXTURE_FORMATS = {
|
|
965
|
-
// Unsized formats that leave the precision up to the driver.
|
|
966
|
-
// TODO - Fix bpp constants
|
|
967
|
-
// 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
|
|
955
|
+
// Unsized formats that leave the precision up to the driver. TODO - Fix bpp constants
|
|
968
956
|
"rgb8unorm-unsized": {
|
|
969
|
-
gl:
|
|
957
|
+
gl: 6407,
|
|
970
958
|
b: 4,
|
|
971
959
|
c: 2,
|
|
972
960
|
bpp: 4,
|
|
973
|
-
dataFormat:
|
|
974
|
-
types: [
|
|
961
|
+
dataFormat: 6407,
|
|
962
|
+
types: [5121, 33635]
|
|
975
963
|
},
|
|
976
964
|
"rgba8unorm-unsized": {
|
|
977
|
-
gl:
|
|
965
|
+
gl: 6408,
|
|
978
966
|
b: 4,
|
|
979
967
|
c: 2,
|
|
980
968
|
bpp: 4,
|
|
981
|
-
dataFormat:
|
|
982
|
-
types: [
|
|
969
|
+
dataFormat: 6408,
|
|
970
|
+
types: [5121, 32819, 32820]
|
|
983
971
|
},
|
|
972
|
+
// 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
|
|
984
973
|
// 'rgb8unorm-srgb-unsized': {gl: GL.SRGB_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
985
974
|
// 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
986
975
|
// 8-bit formats
|
|
987
|
-
"r8unorm": { gl:
|
|
988
|
-
"r8snorm": { gl:
|
|
989
|
-
"r8uint": { gl:
|
|
990
|
-
"r8sint": { gl:
|
|
976
|
+
"r8unorm": { gl: 33321, b: 1, c: 1, rb: true },
|
|
977
|
+
"r8snorm": { gl: 36756, b: 1, c: 1, render: snorm8_renderable },
|
|
978
|
+
"r8uint": { gl: 33330, b: 1, c: 1, rb: true },
|
|
979
|
+
"r8sint": { gl: 33329, b: 1, c: 1, rb: true },
|
|
991
980
|
// 16-bit formats
|
|
992
|
-
"rg8unorm": { gl:
|
|
993
|
-
"rg8snorm": { gl:
|
|
994
|
-
"rg8uint": { gl:
|
|
995
|
-
"rg8sint": { gl:
|
|
996
|
-
"r16uint": { gl:
|
|
997
|
-
"r16sint": { gl:
|
|
998
|
-
"r16float": { gl:
|
|
999
|
-
"r16unorm-webgl": { gl:
|
|
1000
|
-
"r16snorm-webgl": { gl:
|
|
981
|
+
"rg8unorm": { gl: 33323, b: 2, c: 2, rb: true },
|
|
982
|
+
"rg8snorm": { gl: 36757, b: 2, c: 2, render: snorm8_renderable },
|
|
983
|
+
"rg8uint": { gl: 33336, b: 2, c: 2, rb: true },
|
|
984
|
+
"rg8sint": { gl: 33335, b: 2, c: 2, rb: true },
|
|
985
|
+
"r16uint": { gl: 33332, b: 2, c: 1, rb: true },
|
|
986
|
+
"r16sint": { gl: 33331, b: 2, c: 1, rb: true },
|
|
987
|
+
"r16float": { gl: 33325, b: 2, c: 1, render: float16_renderable, filter: "float16-filterable-webgl", rb: true },
|
|
988
|
+
"r16unorm-webgl": { gl: 33322, b: 2, c: 1, f: norm16_renderable, rb: true },
|
|
989
|
+
"r16snorm-webgl": { gl: 36760, b: 2, c: 1, f: snorm16_renderable },
|
|
1001
990
|
// Packed 16-bit formats
|
|
1002
|
-
"rgba4unorm-webgl": { gl:
|
|
1003
|
-
"rgb565unorm-webgl": { gl:
|
|
1004
|
-
"rgb5a1unorm-webgl": { gl:
|
|
991
|
+
"rgba4unorm-webgl": { gl: 32854, b: 2, c: 4, wgpu: false, rb: true },
|
|
992
|
+
"rgb565unorm-webgl": { gl: 36194, b: 2, c: 4, wgpu: false, rb: true },
|
|
993
|
+
"rgb5a1unorm-webgl": { gl: 32855, b: 2, c: 4, wgpu: false, rb: true },
|
|
1005
994
|
// 24-bit formats
|
|
1006
|
-
"rgb8unorm-webgl": { gl:
|
|
1007
|
-
"rgb8snorm-webgl": { gl:
|
|
995
|
+
"rgb8unorm-webgl": { gl: 32849, b: 3, c: 3, wgpu: false },
|
|
996
|
+
"rgb8snorm-webgl": { gl: 36758, b: 3, c: 3, wgpu: false },
|
|
1008
997
|
// 32-bit formats
|
|
1009
|
-
"rgba8unorm": { gl:
|
|
1010
|
-
"rgba8unorm-srgb": { gl:
|
|
1011
|
-
"rgba8snorm": { gl:
|
|
1012
|
-
"rgba8uint": { gl:
|
|
1013
|
-
"rgba8sint": { gl:
|
|
998
|
+
"rgba8unorm": { gl: 32856, b: 4, c: 2, bpp: 4 },
|
|
999
|
+
"rgba8unorm-srgb": { gl: 35907, b: 4, c: 4, bpp: 4 },
|
|
1000
|
+
"rgba8snorm": { gl: 36759, b: 4, c: 4, render: snorm8_renderable },
|
|
1001
|
+
"rgba8uint": { gl: 36220, b: 4, c: 4, bpp: 4 },
|
|
1002
|
+
"rgba8sint": { gl: 36238, b: 4, c: 4, bpp: 4 },
|
|
1014
1003
|
// reverse colors, webgpu only
|
|
1015
1004
|
"bgra8unorm": { b: 4, c: 4 },
|
|
1016
1005
|
"bgra8unorm-srgb": { b: 4, c: 4 },
|
|
1017
|
-
"rg16uint": { gl:
|
|
1018
|
-
"rg16sint": { gl:
|
|
1006
|
+
"rg16uint": { gl: 33338, b: 4, c: 1, bpp: 4 },
|
|
1007
|
+
"rg16sint": { gl: 33337, b: 4, c: 2, bpp: 4 },
|
|
1019
1008
|
// When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
|
|
1020
|
-
"rg16float": { gl:
|
|
1021
|
-
"rg16unorm-webgl": { gl:
|
|
1022
|
-
"rg16snorm-webgl": { gl:
|
|
1023
|
-
"r32uint": { gl:
|
|
1024
|
-
"r32sint": { gl:
|
|
1025
|
-
"r32float": { gl:
|
|
1009
|
+
"rg16float": { gl: 33327, bpp: 4, b: 4, c: 2, render: float16_renderable, filter: float16_filterable, rb: true },
|
|
1010
|
+
"rg16unorm-webgl": { gl: 33324, b: 2, c: 2, render: norm16_renderable },
|
|
1011
|
+
"rg16snorm-webgl": { gl: 36761, b: 2, c: 2, render: snorm16_renderable },
|
|
1012
|
+
"r32uint": { gl: 33334, b: 4, c: 1, bpp: 4, rb: true },
|
|
1013
|
+
"r32sint": { gl: 33333, b: 4, c: 1, bpp: 4, rb: true },
|
|
1014
|
+
"r32float": { gl: 33326, bpp: 4, b: 4, c: 1, render: float32_renderable, filter: float32_filterable },
|
|
1026
1015
|
// Packed 32-bit formats
|
|
1027
|
-
"rgb9e5ufloat": { gl:
|
|
1016
|
+
"rgb9e5ufloat": { gl: 35901, b: 4, c: 3, p: 1, render: rgb9e5ufloat_renderable },
|
|
1028
1017
|
// , filter: true},
|
|
1029
|
-
"rg11b10ufloat": { gl:
|
|
1030
|
-
"rgb10a2unorm": { gl:
|
|
1031
|
-
"rgb10a2uint-webgl": { b: 4, c: 4, gl:
|
|
1018
|
+
"rg11b10ufloat": { gl: 35898, b: 4, c: 3, p: 1, render: float32_renderable, rb: true },
|
|
1019
|
+
"rgb10a2unorm": { gl: 32857, b: 4, c: 4, p: 1, rb: true },
|
|
1020
|
+
"rgb10a2uint-webgl": { b: 4, c: 4, gl: 36975, p: 1, wgpu: false, bpp: 4, rb: true },
|
|
1032
1021
|
// 48-bit formats
|
|
1033
|
-
"rgb16unorm-webgl": { gl:
|
|
1022
|
+
"rgb16unorm-webgl": { gl: 32852, b: 2, c: 3, f: norm16_renderable },
|
|
1034
1023
|
// rgb not renderable
|
|
1035
|
-
"rgb16snorm-webgl": { gl:
|
|
1024
|
+
"rgb16snorm-webgl": { gl: 36762, b: 2, c: 3, f: norm16_renderable },
|
|
1036
1025
|
// rgb not renderable
|
|
1037
1026
|
// 64-bit formats
|
|
1038
|
-
"rg32uint": { gl:
|
|
1039
|
-
"rg32sint": { gl:
|
|
1040
|
-
"rg32float": { gl:
|
|
1041
|
-
"rgba16uint": { gl:
|
|
1042
|
-
"rgba16sint": { gl:
|
|
1043
|
-
"rgba16float": { gl:
|
|
1044
|
-
"rgba16unorm-webgl": { gl:
|
|
1045
|
-
"rgba16snorm-webgl": { gl:
|
|
1027
|
+
"rg32uint": { gl: 33340, b: 8, c: 2, rb: true },
|
|
1028
|
+
"rg32sint": { gl: 33339, b: 8, c: 2, rb: true },
|
|
1029
|
+
"rg32float": { gl: 33328, b: 8, c: 2, render: float32_renderable, filter: float32_filterable, rb: true },
|
|
1030
|
+
"rgba16uint": { gl: 36214, b: 8, c: 4, rb: true },
|
|
1031
|
+
"rgba16sint": { gl: 36232, b: 8, c: 4, rb: true },
|
|
1032
|
+
"rgba16float": { gl: 34842, b: 8, c: 4, render: float16_renderable, filter: float16_filterable },
|
|
1033
|
+
"rgba16unorm-webgl": { gl: 32859, b: 2, c: 4, render: norm16_renderable, rb: true },
|
|
1034
|
+
"rgba16snorm-webgl": { gl: 36763, b: 2, c: 4, render: snorm16_renderable },
|
|
1046
1035
|
// 96-bit formats (deprecated!)
|
|
1047
1036
|
"rgb32float-webgl": {
|
|
1048
|
-
gl:
|
|
1037
|
+
gl: 34837,
|
|
1049
1038
|
render: float32_renderable,
|
|
1050
1039
|
filter: float32_filterable,
|
|
1051
1040
|
gl2ext: EXT_color_buffer_float,
|
|
1052
|
-
dataFormat:
|
|
1053
|
-
types: [
|
|
1041
|
+
dataFormat: 6407,
|
|
1042
|
+
types: [5126]
|
|
1054
1043
|
},
|
|
1055
1044
|
// 128-bit formats
|
|
1056
|
-
"rgba32uint": { gl:
|
|
1057
|
-
"rgba32sint": { gl:
|
|
1058
|
-
"rgba32float": { gl:
|
|
1045
|
+
"rgba32uint": { gl: 36208, b: 16, c: 4, rb: true },
|
|
1046
|
+
"rgba32sint": { gl: 36226, b: 16, c: 4, rb: true },
|
|
1047
|
+
"rgba32float": { gl: 34836, b: 16, c: 4, render: float32_renderable, filter: float32_filterable, rb: true },
|
|
1059
1048
|
// Depth and stencil formats
|
|
1060
|
-
"stencil8": { gl:
|
|
1049
|
+
"stencil8": { gl: 36168, b: 1, c: 1, attachment: 36128, rb: true },
|
|
1061
1050
|
// 8 stencil bits
|
|
1062
|
-
"depth16unorm": {
|
|
1051
|
+
"depth16unorm": {
|
|
1052
|
+
gl: 33189,
|
|
1053
|
+
b: 2,
|
|
1054
|
+
c: 1,
|
|
1055
|
+
attachment: 36096,
|
|
1056
|
+
dataFormat: 6402,
|
|
1057
|
+
types: [5123],
|
|
1058
|
+
rb: true
|
|
1059
|
+
},
|
|
1063
1060
|
// 16 depth bits
|
|
1064
|
-
"depth24plus": {
|
|
1065
|
-
|
|
1061
|
+
"depth24plus": {
|
|
1062
|
+
gl: 33190,
|
|
1063
|
+
b: 3,
|
|
1064
|
+
c: 1,
|
|
1065
|
+
attachment: 36096,
|
|
1066
|
+
dataFormat: 6402,
|
|
1067
|
+
types: [5125]
|
|
1068
|
+
},
|
|
1069
|
+
"depth32float": {
|
|
1070
|
+
gl: 36012,
|
|
1071
|
+
b: 4,
|
|
1072
|
+
c: 1,
|
|
1073
|
+
attachment: 36096,
|
|
1074
|
+
dataFormat: 6402,
|
|
1075
|
+
types: [5126],
|
|
1076
|
+
rb: true
|
|
1077
|
+
},
|
|
1066
1078
|
// The depth component of the "depth24plus" and "depth24plus-stencil8" formats may be implemented as either a 24-bit depth value or a "depth32float" value.
|
|
1067
|
-
"depth24plus-stencil8": {
|
|
1079
|
+
"depth24plus-stencil8": {
|
|
1080
|
+
gl: 35056,
|
|
1081
|
+
b: 4,
|
|
1082
|
+
c: 2,
|
|
1083
|
+
p: 1,
|
|
1084
|
+
attachment: 33306,
|
|
1085
|
+
rb: true,
|
|
1086
|
+
depthTexture: true,
|
|
1087
|
+
dataFormat: 34041,
|
|
1088
|
+
types: [34042]
|
|
1089
|
+
},
|
|
1068
1090
|
// "depth24unorm-stencil8" feature
|
|
1069
|
-
"depth24unorm-stencil8": {
|
|
1070
|
-
|
|
1071
|
-
|
|
1091
|
+
"depth24unorm-stencil8": {
|
|
1092
|
+
gl: 35056,
|
|
1093
|
+
b: 4,
|
|
1094
|
+
c: 2,
|
|
1095
|
+
p: 1,
|
|
1096
|
+
attachment: 33306,
|
|
1097
|
+
dataFormat: 34041,
|
|
1098
|
+
types: [34042],
|
|
1099
|
+
rb: true
|
|
1100
|
+
},
|
|
1101
|
+
// "depth32float-stencil8" feature - TODO below is render buffer only?
|
|
1102
|
+
"depth32float-stencil8": {
|
|
1103
|
+
gl: 36013,
|
|
1104
|
+
b: 5,
|
|
1105
|
+
c: 2,
|
|
1106
|
+
p: 1,
|
|
1107
|
+
attachment: 33306,
|
|
1108
|
+
dataFormat: 34041,
|
|
1109
|
+
types: [36269],
|
|
1110
|
+
rb: true
|
|
1111
|
+
},
|
|
1072
1112
|
// BC compressed formats: check device.features.has("texture-compression-bc");
|
|
1073
|
-
"bc1-rgb-unorm-webgl": { gl:
|
|
1074
|
-
"bc1-rgb-unorm-srgb-webgl": { gl:
|
|
1075
|
-
"bc1-rgba-unorm": { gl:
|
|
1076
|
-
"bc1-rgba-unorm-srgb": { gl:
|
|
1077
|
-
"bc2-rgba-unorm": { gl:
|
|
1078
|
-
"bc2-rgba-unorm-srgb": { gl:
|
|
1079
|
-
"bc3-rgba-unorm": { gl:
|
|
1080
|
-
"bc3-rgba-unorm-srgb": { gl:
|
|
1081
|
-
"bc4-r-unorm": { gl:
|
|
1082
|
-
"bc4-r-snorm": { gl:
|
|
1083
|
-
"bc5-rg-unorm": { gl:
|
|
1084
|
-
"bc5-rg-snorm": { gl:
|
|
1085
|
-
"bc6h-rgb-ufloat": { gl:
|
|
1086
|
-
"bc6h-rgb-float": { gl:
|
|
1087
|
-
"bc7-rgba-unorm": { gl:
|
|
1088
|
-
"bc7-rgba-unorm-srgb": { gl:
|
|
1113
|
+
"bc1-rgb-unorm-webgl": { gl: 33776, x: X_S3TC, f: texture_compression_bc },
|
|
1114
|
+
"bc1-rgb-unorm-srgb-webgl": { gl: 35916, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1115
|
+
"bc1-rgba-unorm": { gl: 33777, x: X_S3TC, f: texture_compression_bc },
|
|
1116
|
+
"bc1-rgba-unorm-srgb": { gl: 35916, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1117
|
+
"bc2-rgba-unorm": { gl: 33778, x: X_S3TC, f: texture_compression_bc },
|
|
1118
|
+
"bc2-rgba-unorm-srgb": { gl: 35918, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1119
|
+
"bc3-rgba-unorm": { gl: 33779, x: X_S3TC, f: texture_compression_bc },
|
|
1120
|
+
"bc3-rgba-unorm-srgb": { gl: 35919, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1121
|
+
"bc4-r-unorm": { gl: 36283, x: X_RGTC, f: texture_compression_bc },
|
|
1122
|
+
"bc4-r-snorm": { gl: 36284, x: X_RGTC, f: texture_compression_bc },
|
|
1123
|
+
"bc5-rg-unorm": { gl: 36285, x: X_RGTC, f: texture_compression_bc },
|
|
1124
|
+
"bc5-rg-snorm": { gl: 36286, x: X_RGTC, f: texture_compression_bc },
|
|
1125
|
+
"bc6h-rgb-ufloat": { gl: 36495, x: X_BPTC, f: texture_compression_bc },
|
|
1126
|
+
"bc6h-rgb-float": { gl: 36494, x: X_BPTC, f: texture_compression_bc },
|
|
1127
|
+
"bc7-rgba-unorm": { gl: 36492, x: X_BPTC, f: texture_compression_bc },
|
|
1128
|
+
"bc7-rgba-unorm-srgb": { gl: 36493, x: X_BPTC, f: texture_compression_bc },
|
|
1089
1129
|
// WEBGL_compressed_texture_etc: device.features.has("texture-compression-etc2")
|
|
1090
1130
|
// Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression
|
|
1091
|
-
"etc2-rgb8unorm": { gl:
|
|
1092
|
-
"etc2-rgb8unorm-srgb": { gl:
|
|
1093
|
-
"etc2-rgb8a1unorm": { gl:
|
|
1094
|
-
"etc2-rgb8a1unorm-srgb": { gl:
|
|
1095
|
-
"etc2-rgba8unorm": { gl:
|
|
1096
|
-
"etc2-rgba8unorm-srgb": { gl:
|
|
1097
|
-
"eac-r11unorm": { gl:
|
|
1098
|
-
"eac-r11snorm": { gl:
|
|
1099
|
-
"eac-rg11unorm": { gl:
|
|
1100
|
-
"eac-rg11snorm": { gl:
|
|
1131
|
+
"etc2-rgb8unorm": { gl: 37492, f: texture_compression_etc2 },
|
|
1132
|
+
"etc2-rgb8unorm-srgb": { gl: 37494, f: texture_compression_etc2 },
|
|
1133
|
+
"etc2-rgb8a1unorm": { gl: 37496, f: texture_compression_etc2 },
|
|
1134
|
+
"etc2-rgb8a1unorm-srgb": { gl: 37497, f: texture_compression_etc2 },
|
|
1135
|
+
"etc2-rgba8unorm": { gl: 37493, f: texture_compression_etc2 },
|
|
1136
|
+
"etc2-rgba8unorm-srgb": { gl: 37495, f: texture_compression_etc2 },
|
|
1137
|
+
"eac-r11unorm": { gl: 37488, f: texture_compression_etc2 },
|
|
1138
|
+
"eac-r11snorm": { gl: 37489, f: texture_compression_etc2 },
|
|
1139
|
+
"eac-rg11unorm": { gl: 37490, f: texture_compression_etc2 },
|
|
1140
|
+
"eac-rg11snorm": { gl: 37491, f: texture_compression_etc2 },
|
|
1101
1141
|
// X_ASTC compressed formats: device.features.has("texture-compression-astc")
|
|
1102
|
-
"astc-4x4-unorm": { gl:
|
|
1103
|
-
"astc-4x4-unorm-srgb": { gl:
|
|
1104
|
-
"astc-5x4-unorm": { gl:
|
|
1105
|
-
"astc-5x4-unorm-srgb": { gl:
|
|
1106
|
-
"astc-5x5-unorm": { gl:
|
|
1107
|
-
"astc-5x5-unorm-srgb": { gl:
|
|
1108
|
-
"astc-6x5-unorm": { gl:
|
|
1109
|
-
"astc-6x5-unorm-srgb": { gl:
|
|
1110
|
-
"astc-6x6-unorm": { gl:
|
|
1111
|
-
"astc-6x6-unorm-srgb": { gl:
|
|
1112
|
-
"astc-8x5-unorm": { gl:
|
|
1113
|
-
"astc-8x5-unorm-srgb": { gl:
|
|
1114
|
-
"astc-8x6-unorm": { gl:
|
|
1115
|
-
"astc-8x6-unorm-srgb": { gl:
|
|
1116
|
-
"astc-8x8-unorm": { gl:
|
|
1117
|
-
"astc-8x8-unorm-srgb": { gl:
|
|
1118
|
-
"astc-10x5-unorm": { gl:
|
|
1119
|
-
"astc-10x5-unorm-srgb": { gl:
|
|
1120
|
-
"astc-10x6-unorm": { gl:
|
|
1121
|
-
"astc-10x6-unorm-srgb": { gl:
|
|
1122
|
-
"astc-10x8-unorm": { gl:
|
|
1123
|
-
"astc-10x8-unorm-srgb": { gl:
|
|
1124
|
-
"astc-10x10-unorm": { gl:
|
|
1125
|
-
"astc-10x10-unorm-srgb": { gl:
|
|
1126
|
-
"astc-12x10-unorm": { gl:
|
|
1127
|
-
"astc-12x10-unorm-srgb": { gl:
|
|
1128
|
-
"astc-12x12-unorm": { gl:
|
|
1129
|
-
"astc-12x12-unorm-srgb": { gl:
|
|
1142
|
+
"astc-4x4-unorm": { gl: 37808, f: texture_compression_astc },
|
|
1143
|
+
"astc-4x4-unorm-srgb": { gl: 37840, f: texture_compression_astc },
|
|
1144
|
+
"astc-5x4-unorm": { gl: 37809, f: texture_compression_astc },
|
|
1145
|
+
"astc-5x4-unorm-srgb": { gl: 37841, f: texture_compression_astc },
|
|
1146
|
+
"astc-5x5-unorm": { gl: 37810, f: texture_compression_astc },
|
|
1147
|
+
"astc-5x5-unorm-srgb": { gl: 37842, f: texture_compression_astc },
|
|
1148
|
+
"astc-6x5-unorm": { gl: 37811, f: texture_compression_astc },
|
|
1149
|
+
"astc-6x5-unorm-srgb": { gl: 37843, f: texture_compression_astc },
|
|
1150
|
+
"astc-6x6-unorm": { gl: 37812, f: texture_compression_astc },
|
|
1151
|
+
"astc-6x6-unorm-srgb": { gl: 37844, f: texture_compression_astc },
|
|
1152
|
+
"astc-8x5-unorm": { gl: 37813, f: texture_compression_astc },
|
|
1153
|
+
"astc-8x5-unorm-srgb": { gl: 37845, f: texture_compression_astc },
|
|
1154
|
+
"astc-8x6-unorm": { gl: 37814, f: texture_compression_astc },
|
|
1155
|
+
"astc-8x6-unorm-srgb": { gl: 37846, f: texture_compression_astc },
|
|
1156
|
+
"astc-8x8-unorm": { gl: 37815, f: texture_compression_astc },
|
|
1157
|
+
"astc-8x8-unorm-srgb": { gl: 37847, f: texture_compression_astc },
|
|
1158
|
+
"astc-10x5-unorm": { gl: 37819, f: texture_compression_astc },
|
|
1159
|
+
"astc-10x5-unorm-srgb": { gl: 37851, f: texture_compression_astc },
|
|
1160
|
+
"astc-10x6-unorm": { gl: 37817, f: texture_compression_astc },
|
|
1161
|
+
"astc-10x6-unorm-srgb": { gl: 37849, f: texture_compression_astc },
|
|
1162
|
+
"astc-10x8-unorm": { gl: 37818, f: texture_compression_astc },
|
|
1163
|
+
"astc-10x8-unorm-srgb": { gl: 37850, f: texture_compression_astc },
|
|
1164
|
+
"astc-10x10-unorm": { gl: 37819, f: texture_compression_astc },
|
|
1165
|
+
"astc-10x10-unorm-srgb": { gl: 37851, f: texture_compression_astc },
|
|
1166
|
+
"astc-12x10-unorm": { gl: 37820, f: texture_compression_astc },
|
|
1167
|
+
"astc-12x10-unorm-srgb": { gl: 37852, f: texture_compression_astc },
|
|
1168
|
+
"astc-12x12-unorm": { gl: 37821, f: texture_compression_astc },
|
|
1169
|
+
"astc-12x12-unorm-srgb": { gl: 37853, f: texture_compression_astc },
|
|
1130
1170
|
// WEBGL_compressed_texture_pvrtc
|
|
1131
|
-
"pvrtc-rgb4unorm-webgl": { gl:
|
|
1132
|
-
"pvrtc-rgba4unorm-webgl": { gl:
|
|
1133
|
-
"pvrtc-rbg2unorm-webgl": { gl:
|
|
1134
|
-
"pvrtc-rgba2unorm-webgl": { gl:
|
|
1171
|
+
"pvrtc-rgb4unorm-webgl": { gl: 35840, f: texture_compression_pvrtc_webgl },
|
|
1172
|
+
"pvrtc-rgba4unorm-webgl": { gl: 35842, f: texture_compression_pvrtc_webgl },
|
|
1173
|
+
"pvrtc-rbg2unorm-webgl": { gl: 35841, f: texture_compression_pvrtc_webgl },
|
|
1174
|
+
"pvrtc-rgba2unorm-webgl": { gl: 35843, f: texture_compression_pvrtc_webgl },
|
|
1135
1175
|
// WEBGL_compressed_texture_etc1
|
|
1136
|
-
"etc1-rbg-unorm-webgl": { gl:
|
|
1176
|
+
"etc1-rbg-unorm-webgl": { gl: 36196, f: texture_compression_etc1_webgl },
|
|
1137
1177
|
// WEBGL_compressed_texture_atc
|
|
1138
|
-
"atc-rgb-unorm-webgl": { gl:
|
|
1139
|
-
"atc-rgba-unorm-webgl": { gl:
|
|
1140
|
-
"atc-rgbai-unorm-webgl": { gl:
|
|
1178
|
+
"atc-rgb-unorm-webgl": { gl: 35986, f: texture_compression_atc_webgl },
|
|
1179
|
+
"atc-rgba-unorm-webgl": { gl: 35986, f: texture_compression_atc_webgl },
|
|
1180
|
+
"atc-rgbai-unorm-webgl": { gl: 34798, f: texture_compression_atc_webgl }
|
|
1141
1181
|
};
|
|
1142
1182
|
var DATA_FORMAT_CHANNELS = {
|
|
1143
|
-
[
|
|
1144
|
-
[
|
|
1145
|
-
[
|
|
1146
|
-
[
|
|
1147
|
-
[
|
|
1148
|
-
[
|
|
1149
|
-
[
|
|
1150
|
-
[
|
|
1151
|
-
[
|
|
1152
|
-
[
|
|
1153
|
-
[
|
|
1154
|
-
[
|
|
1155
|
-
[
|
|
1183
|
+
[6403]: 1,
|
|
1184
|
+
[36244]: 1,
|
|
1185
|
+
[33319]: 2,
|
|
1186
|
+
[33320]: 2,
|
|
1187
|
+
[6407]: 3,
|
|
1188
|
+
[36248]: 3,
|
|
1189
|
+
[6408]: 4,
|
|
1190
|
+
[36249]: 4,
|
|
1191
|
+
[6402]: 1,
|
|
1192
|
+
[34041]: 1,
|
|
1193
|
+
[6406]: 1,
|
|
1194
|
+
[6409]: 1,
|
|
1195
|
+
[6410]: 2
|
|
1156
1196
|
};
|
|
1157
1197
|
var TYPE_SIZES = {
|
|
1158
|
-
[
|
|
1159
|
-
[
|
|
1160
|
-
[
|
|
1161
|
-
[
|
|
1162
|
-
[
|
|
1163
|
-
[
|
|
1164
|
-
[
|
|
1165
|
-
[
|
|
1198
|
+
[5126]: 4,
|
|
1199
|
+
[5125]: 4,
|
|
1200
|
+
[5124]: 4,
|
|
1201
|
+
[5123]: 2,
|
|
1202
|
+
[5122]: 2,
|
|
1203
|
+
[5131]: 2,
|
|
1204
|
+
[5120]: 1,
|
|
1205
|
+
[5121]: 1
|
|
1166
1206
|
};
|
|
1167
|
-
function isTextureFormatSupported(gl,
|
|
1168
|
-
const format = convertGLToTextureFormat(formatOrGL);
|
|
1207
|
+
function isTextureFormatSupported(gl, format, extensions) {
|
|
1169
1208
|
const info = TEXTURE_FORMATS[format];
|
|
1170
1209
|
if (!info) {
|
|
1171
1210
|
return false;
|
|
@@ -1181,7 +1220,7 @@ function isTextureFormatSupported(gl, formatOrGL, extensions) {
|
|
|
1181
1220
|
}
|
|
1182
1221
|
function isRenderbufferFormatSupported(gl, format, extensions) {
|
|
1183
1222
|
var _a;
|
|
1184
|
-
return isTextureFormatSupported(gl, format, extensions) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.
|
|
1223
|
+
return isTextureFormatSupported(gl, format, extensions) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.rb);
|
|
1185
1224
|
}
|
|
1186
1225
|
function convertGLToTextureFormat(format) {
|
|
1187
1226
|
if (typeof format === "string") {
|
|
@@ -1201,11 +1240,13 @@ function convertTextureFormatToGL(format) {
|
|
|
1201
1240
|
}
|
|
1202
1241
|
return webglFormat;
|
|
1203
1242
|
}
|
|
1204
|
-
function isTextureFormatFilterable(gl,
|
|
1205
|
-
const format = convertGLToTextureFormat(formatOrGL);
|
|
1243
|
+
function isTextureFormatFilterable(gl, format, extensions) {
|
|
1206
1244
|
if (!isTextureFormatSupported(gl, format, extensions)) {
|
|
1207
1245
|
return false;
|
|
1208
1246
|
}
|
|
1247
|
+
if (format.startsWith("depth") || format.startsWith("stencil")) {
|
|
1248
|
+
return false;
|
|
1249
|
+
}
|
|
1209
1250
|
try {
|
|
1210
1251
|
const decoded = (0, import_core2.decodeTextureFormat)(format);
|
|
1211
1252
|
if (decoded.signed) {
|
|
@@ -1222,8 +1263,7 @@ function isTextureFormatFilterable(gl, formatOrGL, extensions) {
|
|
|
1222
1263
|
}
|
|
1223
1264
|
return true;
|
|
1224
1265
|
}
|
|
1225
|
-
function isTextureFormatRenderable(gl,
|
|
1226
|
-
const format = convertGLToTextureFormat(formatOrGL);
|
|
1266
|
+
function isTextureFormatRenderable(gl, format, extensions) {
|
|
1227
1267
|
if (!isTextureFormatSupported(gl, format, extensions)) {
|
|
1228
1268
|
return false;
|
|
1229
1269
|
}
|
|
@@ -1232,15 +1272,16 @@ function isTextureFormatRenderable(gl, formatOrGL, extensions) {
|
|
|
1232
1272
|
}
|
|
1233
1273
|
return true;
|
|
1234
1274
|
}
|
|
1235
|
-
function getWebGLTextureParameters(
|
|
1236
|
-
|
|
1275
|
+
function getWebGLTextureParameters(format) {
|
|
1276
|
+
var _a;
|
|
1277
|
+
const formatData = TEXTURE_FORMATS[format];
|
|
1237
1278
|
const webglFormat = convertTextureFormatToGL(format);
|
|
1238
1279
|
const decoded = (0, import_core2.decodeTextureFormat)(format);
|
|
1239
1280
|
return {
|
|
1240
1281
|
format: webglFormat,
|
|
1241
|
-
dataFormat: getWebGLPixelDataFormat(decoded.format, decoded.integer, decoded.normalized, webglFormat),
|
|
1282
|
+
dataFormat: (formatData == null ? void 0 : formatData.dataFormat) || getWebGLPixelDataFormat(decoded.format, decoded.integer, decoded.normalized, webglFormat),
|
|
1242
1283
|
// depth formats don't have a type
|
|
1243
|
-
type: decoded.dataType ? getGLFromVertexType(decoded.dataType) :
|
|
1284
|
+
type: decoded.dataType ? getGLFromVertexType(decoded.dataType) : ((_a = formatData == null ? void 0 : formatData.types) == null ? void 0 : _a[0]) || 5121,
|
|
1244
1285
|
// @ts-expect-error
|
|
1245
1286
|
compressed: decoded.compressed
|
|
1246
1287
|
};
|
|
@@ -1252,28 +1293,27 @@ function getDepthStencilAttachmentWebGL(format) {
|
|
|
1252
1293
|
}
|
|
1253
1294
|
return info.attachment;
|
|
1254
1295
|
}
|
|
1255
|
-
function getTextureFormatBytesPerPixel(
|
|
1256
|
-
const format = convertGLToTextureFormat(formatOrGL);
|
|
1296
|
+
function getTextureFormatBytesPerPixel(format) {
|
|
1257
1297
|
const params = getWebGLTextureParameters(format);
|
|
1258
1298
|
const channels = DATA_FORMAT_CHANNELS[params.dataFormat] || 4;
|
|
1259
1299
|
const channelSize = TYPE_SIZES[params.type] || 1;
|
|
1260
1300
|
return channels * channelSize;
|
|
1261
1301
|
}
|
|
1262
1302
|
function getWebGLPixelDataFormat(dataFormat, integer, normalized, format) {
|
|
1263
|
-
if (format ===
|
|
1303
|
+
if (format === 6408 || format === 6407) {
|
|
1264
1304
|
return format;
|
|
1265
1305
|
}
|
|
1266
1306
|
switch (dataFormat) {
|
|
1267
1307
|
case "r":
|
|
1268
|
-
return integer && !normalized ?
|
|
1308
|
+
return integer && !normalized ? 36244 : 6403;
|
|
1269
1309
|
case "rg":
|
|
1270
|
-
return integer && !normalized ?
|
|
1310
|
+
return integer && !normalized ? 33320 : 33319;
|
|
1271
1311
|
case "rgb":
|
|
1272
|
-
return integer && !normalized ?
|
|
1312
|
+
return integer && !normalized ? 36248 : 6407;
|
|
1273
1313
|
case "rgba":
|
|
1274
|
-
return integer && !normalized ?
|
|
1314
|
+
return integer && !normalized ? 36249 : 6408;
|
|
1275
1315
|
default:
|
|
1276
|
-
return
|
|
1316
|
+
return 6408;
|
|
1277
1317
|
}
|
|
1278
1318
|
}
|
|
1279
1319
|
|
|
@@ -1301,8 +1341,8 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
|
|
|
1301
1341
|
gl;
|
|
1302
1342
|
extensions;
|
|
1303
1343
|
testedFeatures = /* @__PURE__ */ new Set();
|
|
1304
|
-
constructor(gl, extensions) {
|
|
1305
|
-
super();
|
|
1344
|
+
constructor(gl, extensions, disabledFeatures) {
|
|
1345
|
+
super([], disabledFeatures);
|
|
1306
1346
|
this.gl = gl;
|
|
1307
1347
|
this.extensions = extensions;
|
|
1308
1348
|
getWebGLExtension(gl, "EXT_color_buffer_float", extensions);
|
|
@@ -1321,6 +1361,9 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
|
|
|
1321
1361
|
return [];
|
|
1322
1362
|
}
|
|
1323
1363
|
has(feature) {
|
|
1364
|
+
if (this.disabledFeatures[feature]) {
|
|
1365
|
+
return false;
|
|
1366
|
+
}
|
|
1324
1367
|
if (!this.testedFeatures.has(feature)) {
|
|
1325
1368
|
this.testedFeatures.add(feature);
|
|
1326
1369
|
if (isTextureFeature(feature) && checkTextureFeature(this.gl, feature, this.extensions)) {
|
|
@@ -1332,6 +1375,12 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
|
|
|
1332
1375
|
}
|
|
1333
1376
|
return this.features.has(feature);
|
|
1334
1377
|
}
|
|
1378
|
+
// FOR DEVICE
|
|
1379
|
+
initializeFeatures() {
|
|
1380
|
+
for (const feature of this) {
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
// IMPLEMENTATION
|
|
1335
1384
|
/** Extract all WebGL features */
|
|
1336
1385
|
getWebGLFeature(feature) {
|
|
1337
1386
|
const featureInfo = WEBGL_FEATURES[feature];
|
|
@@ -1349,13 +1398,13 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
|
|
|
1349
1398
|
}
|
|
1350
1399
|
// WebGL does not support 1D textures
|
|
1351
1400
|
get maxTextureDimension2D() {
|
|
1352
|
-
return this.getParameter(
|
|
1401
|
+
return this.getParameter(3379);
|
|
1353
1402
|
}
|
|
1354
1403
|
get maxTextureDimension3D() {
|
|
1355
|
-
return this.getParameter(
|
|
1404
|
+
return this.getParameter(32883);
|
|
1356
1405
|
}
|
|
1357
1406
|
get maxTextureArrayLayers() {
|
|
1358
|
-
return this.getParameter(
|
|
1407
|
+
return this.getParameter(35071);
|
|
1359
1408
|
}
|
|
1360
1409
|
get maxBindGroups() {
|
|
1361
1410
|
return 0;
|
|
@@ -1369,11 +1418,11 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
|
|
|
1369
1418
|
}
|
|
1370
1419
|
// TBD
|
|
1371
1420
|
get maxSampledTexturesPerShaderStage() {
|
|
1372
|
-
return this.getParameter(
|
|
1421
|
+
return this.getParameter(35660);
|
|
1373
1422
|
}
|
|
1374
1423
|
// ) TBD
|
|
1375
1424
|
get maxSamplersPerShaderStage() {
|
|
1376
|
-
return this.getParameter(
|
|
1425
|
+
return this.getParameter(35661);
|
|
1377
1426
|
}
|
|
1378
1427
|
get maxStorageBuffersPerShaderStage() {
|
|
1379
1428
|
return 0;
|
|
@@ -1384,16 +1433,16 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
|
|
|
1384
1433
|
}
|
|
1385
1434
|
// TBD
|
|
1386
1435
|
get maxUniformBuffersPerShaderStage() {
|
|
1387
|
-
return this.getParameter(
|
|
1436
|
+
return this.getParameter(35375);
|
|
1388
1437
|
}
|
|
1389
1438
|
get maxUniformBufferBindingSize() {
|
|
1390
|
-
return this.getParameter(
|
|
1439
|
+
return this.getParameter(35376);
|
|
1391
1440
|
}
|
|
1392
1441
|
get maxStorageBufferBindingSize() {
|
|
1393
1442
|
return 0;
|
|
1394
1443
|
}
|
|
1395
1444
|
get minUniformBufferOffsetAlignment() {
|
|
1396
|
-
return this.getParameter(
|
|
1445
|
+
return this.getParameter(35380);
|
|
1397
1446
|
}
|
|
1398
1447
|
get minStorageBufferOffsetAlignment() {
|
|
1399
1448
|
return 0;
|
|
@@ -1403,14 +1452,14 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
|
|
|
1403
1452
|
}
|
|
1404
1453
|
// WebGL 2 supports 16 buffers, see https://github.com/gpuweb/gpuweb/issues/4284
|
|
1405
1454
|
get maxVertexAttributes() {
|
|
1406
|
-
return this.getParameter(
|
|
1455
|
+
return this.getParameter(34921);
|
|
1407
1456
|
}
|
|
1408
1457
|
get maxVertexBufferArrayStride() {
|
|
1409
1458
|
return 2048;
|
|
1410
1459
|
}
|
|
1411
1460
|
// TBD, this is just the default value from WebGPU
|
|
1412
1461
|
get maxInterStageShaderComponents() {
|
|
1413
|
-
return this.getParameter(
|
|
1462
|
+
return this.getParameter(35659);
|
|
1414
1463
|
}
|
|
1415
1464
|
get maxComputeWorkgroupStorageSize() {
|
|
1416
1465
|
return 0;
|
|
@@ -1452,22 +1501,20 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
|
|
|
1452
1501
|
};
|
|
1453
1502
|
|
|
1454
1503
|
// dist/adapter/webgl-canvas-context.js
|
|
1455
|
-
var
|
|
1504
|
+
var import_core11 = require("@luma.gl/core");
|
|
1456
1505
|
|
|
1457
1506
|
// dist/adapter/resources/webgl-framebuffer.js
|
|
1458
|
-
var
|
|
1459
|
-
var
|
|
1507
|
+
var import_core10 = require("@luma.gl/core");
|
|
1508
|
+
var import_constants11 = require("@luma.gl/constants");
|
|
1460
1509
|
|
|
1461
1510
|
// dist/adapter/resources/webgl-texture.js
|
|
1462
1511
|
var import_core9 = require("@luma.gl/core");
|
|
1463
1512
|
var import_constants10 = require("@luma.gl/constants");
|
|
1464
1513
|
|
|
1465
1514
|
// dist/context/state-tracker/with-parameters.js
|
|
1466
|
-
function withGLParameters(
|
|
1467
|
-
const webglDevice = WebGLDevice.attach(device);
|
|
1468
|
-
const gl = webglDevice.gl;
|
|
1515
|
+
function withGLParameters(gl, parameters, func) {
|
|
1469
1516
|
if (isObjectEmpty2(parameters)) {
|
|
1470
|
-
return func(
|
|
1517
|
+
return func(gl);
|
|
1471
1518
|
}
|
|
1472
1519
|
const { nocatch = true } = parameters;
|
|
1473
1520
|
pushContextState(gl);
|
|
@@ -1502,13 +1549,14 @@ function withDeviceAndGLParameters(device, parameters, glParameters, func) {
|
|
|
1502
1549
|
if ((0, import_core5.isObjectEmpty)(parameters)) {
|
|
1503
1550
|
return func(device);
|
|
1504
1551
|
}
|
|
1505
|
-
|
|
1552
|
+
const webglDevice = device;
|
|
1553
|
+
pushContextState(webglDevice.gl);
|
|
1506
1554
|
try {
|
|
1507
1555
|
setDeviceParameters(device, parameters);
|
|
1508
|
-
setGLParameters(
|
|
1556
|
+
setGLParameters(webglDevice.gl, glParameters);
|
|
1509
1557
|
return func(device);
|
|
1510
1558
|
} finally {
|
|
1511
|
-
popContextState(
|
|
1559
|
+
popContextState(webglDevice.gl);
|
|
1512
1560
|
}
|
|
1513
1561
|
}
|
|
1514
1562
|
function withDeviceParameters(device, parameters, func) {
|
|
@@ -1524,32 +1572,32 @@ function withDeviceParameters(device, parameters, func) {
|
|
|
1524
1572
|
}
|
|
1525
1573
|
}
|
|
1526
1574
|
function setDeviceParameters(device, parameters) {
|
|
1527
|
-
const webglDevice =
|
|
1575
|
+
const webglDevice = device;
|
|
1528
1576
|
const { gl } = webglDevice;
|
|
1529
1577
|
if (parameters.cullMode) {
|
|
1530
1578
|
switch (parameters.cullMode) {
|
|
1531
1579
|
case "none":
|
|
1532
|
-
gl.disable(
|
|
1580
|
+
gl.disable(2884);
|
|
1533
1581
|
break;
|
|
1534
1582
|
case "front":
|
|
1535
|
-
gl.enable(
|
|
1536
|
-
gl.cullFace(
|
|
1583
|
+
gl.enable(2884);
|
|
1584
|
+
gl.cullFace(1028);
|
|
1537
1585
|
break;
|
|
1538
1586
|
case "back":
|
|
1539
|
-
gl.enable(
|
|
1540
|
-
gl.cullFace(
|
|
1587
|
+
gl.enable(2884);
|
|
1588
|
+
gl.cullFace(1029);
|
|
1541
1589
|
break;
|
|
1542
1590
|
}
|
|
1543
1591
|
}
|
|
1544
1592
|
if (parameters.frontFace) {
|
|
1545
1593
|
gl.frontFace(map("frontFace", parameters.frontFace, {
|
|
1546
|
-
ccw:
|
|
1547
|
-
cw:
|
|
1594
|
+
ccw: 2305,
|
|
1595
|
+
cw: 2304
|
|
1548
1596
|
}));
|
|
1549
1597
|
}
|
|
1550
1598
|
if (parameters.unclippedDepth) {
|
|
1551
1599
|
if (device.features.has("depth-clip-control")) {
|
|
1552
|
-
gl.enable(
|
|
1600
|
+
gl.enable(34383);
|
|
1553
1601
|
}
|
|
1554
1602
|
}
|
|
1555
1603
|
if (parameters.depthBias !== void 0) {
|
|
@@ -1560,8 +1608,8 @@ function setDeviceParameters(device, parameters) {
|
|
|
1560
1608
|
const ext = extensions.WEBGL_provoking_vertex;
|
|
1561
1609
|
if (parameters.provokingVertex) {
|
|
1562
1610
|
const vertex = map("provokingVertex", parameters.provokingVertex, {
|
|
1563
|
-
first:
|
|
1564
|
-
last:
|
|
1611
|
+
first: 36429,
|
|
1612
|
+
last: 36430
|
|
1565
1613
|
});
|
|
1566
1614
|
ext == null ? void 0 : ext.provokingVertexWEBGL(vertex);
|
|
1567
1615
|
}
|
|
@@ -1571,53 +1619,53 @@ function setDeviceParameters(device, parameters) {
|
|
|
1571
1619
|
const ext = extensions.WEBGL_polygon_mode;
|
|
1572
1620
|
if (parameters.polygonMode) {
|
|
1573
1621
|
const mode = map("polygonMode", parameters.provokingVertex, {
|
|
1574
|
-
fill:
|
|
1575
|
-
lint:
|
|
1622
|
+
fill: 6914,
|
|
1623
|
+
lint: 6913
|
|
1576
1624
|
});
|
|
1577
|
-
ext == null ? void 0 : ext.polygonModeWEBGL(
|
|
1578
|
-
ext == null ? void 0 : ext.polygonModeWEBGL(
|
|
1625
|
+
ext == null ? void 0 : ext.polygonModeWEBGL(1028, mode);
|
|
1626
|
+
ext == null ? void 0 : ext.polygonModeWEBGL(1029, mode);
|
|
1579
1627
|
}
|
|
1580
1628
|
if (parameters.polygonOffsetLine) {
|
|
1581
|
-
gl.enable(
|
|
1629
|
+
gl.enable(10754);
|
|
1582
1630
|
}
|
|
1583
1631
|
}
|
|
1584
1632
|
if (device.features.has("shader-clip-cull-distance-webgl")) {
|
|
1585
1633
|
if (parameters.clipDistance0) {
|
|
1586
|
-
gl.enable(
|
|
1634
|
+
gl.enable(12288);
|
|
1587
1635
|
}
|
|
1588
1636
|
if (parameters.clipDistance1) {
|
|
1589
|
-
gl.enable(
|
|
1637
|
+
gl.enable(12289);
|
|
1590
1638
|
}
|
|
1591
1639
|
if (parameters.clipDistance2) {
|
|
1592
|
-
gl.enable(
|
|
1640
|
+
gl.enable(12290);
|
|
1593
1641
|
}
|
|
1594
1642
|
if (parameters.clipDistance3) {
|
|
1595
|
-
gl.enable(
|
|
1643
|
+
gl.enable(12291);
|
|
1596
1644
|
}
|
|
1597
1645
|
if (parameters.clipDistance4) {
|
|
1598
|
-
gl.enable(
|
|
1646
|
+
gl.enable(12292);
|
|
1599
1647
|
}
|
|
1600
1648
|
if (parameters.clipDistance5) {
|
|
1601
|
-
gl.enable(
|
|
1649
|
+
gl.enable(12293);
|
|
1602
1650
|
}
|
|
1603
1651
|
if (parameters.clipDistance6) {
|
|
1604
|
-
gl.enable(
|
|
1652
|
+
gl.enable(12294);
|
|
1605
1653
|
}
|
|
1606
1654
|
if (parameters.clipDistance7) {
|
|
1607
|
-
gl.enable(
|
|
1655
|
+
gl.enable(12295);
|
|
1608
1656
|
}
|
|
1609
1657
|
}
|
|
1610
1658
|
if (parameters.depthWriteEnabled !== void 0) {
|
|
1611
1659
|
gl.depthMask(mapBoolean("depthWriteEnabled", parameters.depthWriteEnabled));
|
|
1612
1660
|
}
|
|
1613
1661
|
if (parameters.depthCompare) {
|
|
1614
|
-
parameters.depthCompare !== "always" ? gl.enable(
|
|
1662
|
+
parameters.depthCompare !== "always" ? gl.enable(2929) : gl.disable(2929);
|
|
1615
1663
|
gl.depthFunc(convertCompareFunction("depthCompare", parameters.depthCompare));
|
|
1616
1664
|
}
|
|
1617
1665
|
if (parameters.stencilWriteMask) {
|
|
1618
1666
|
const mask = parameters.stencilWriteMask;
|
|
1619
|
-
gl.stencilMaskSeparate(
|
|
1620
|
-
gl.stencilMaskSeparate(
|
|
1667
|
+
gl.stencilMaskSeparate(1028, mask);
|
|
1668
|
+
gl.stencilMaskSeparate(1029, mask);
|
|
1621
1669
|
}
|
|
1622
1670
|
if (parameters.stencilReadMask) {
|
|
1623
1671
|
import_core5.log.warn("stencilReadMask not supported under WebGL");
|
|
@@ -1625,19 +1673,19 @@ function setDeviceParameters(device, parameters) {
|
|
|
1625
1673
|
if (parameters.stencilCompare) {
|
|
1626
1674
|
const mask = parameters.stencilReadMask || 4294967295;
|
|
1627
1675
|
const glValue = convertCompareFunction("depthCompare", parameters.stencilCompare);
|
|
1628
|
-
parameters.stencilCompare !== "always" ? gl.enable(
|
|
1629
|
-
gl.stencilFuncSeparate(
|
|
1630
|
-
gl.stencilFuncSeparate(
|
|
1676
|
+
parameters.stencilCompare !== "always" ? gl.enable(2960) : gl.disable(2960);
|
|
1677
|
+
gl.stencilFuncSeparate(1028, glValue, 0, mask);
|
|
1678
|
+
gl.stencilFuncSeparate(1029, glValue, 0, mask);
|
|
1631
1679
|
}
|
|
1632
1680
|
if (parameters.stencilPassOperation && parameters.stencilFailOperation && parameters.stencilDepthFailOperation) {
|
|
1633
1681
|
const dppass = convertStencilOperation("stencilPassOperation", parameters.stencilPassOperation);
|
|
1634
1682
|
const sfail = convertStencilOperation("stencilFailOperation", parameters.stencilFailOperation);
|
|
1635
1683
|
const dpfail = convertStencilOperation("stencilDepthFailOperation", parameters.stencilDepthFailOperation);
|
|
1636
|
-
gl.stencilOpSeparate(
|
|
1637
|
-
gl.stencilOpSeparate(
|
|
1684
|
+
gl.stencilOpSeparate(1028, sfail, dpfail, dppass);
|
|
1685
|
+
gl.stencilOpSeparate(1029, sfail, dpfail, dppass);
|
|
1638
1686
|
}
|
|
1639
1687
|
if (parameters.blendColorOperation || parameters.blendAlphaOperation) {
|
|
1640
|
-
gl.enable(
|
|
1688
|
+
gl.enable(3042);
|
|
1641
1689
|
const colorEquation = convertBlendOperationToEquation("blendColorOperation", parameters.blendColorOperation || "add");
|
|
1642
1690
|
const alphaEquation = convertBlendOperationToEquation("blendAlphaOperation", parameters.blendAlphaOperation || "add");
|
|
1643
1691
|
gl.blendEquationSeparate(colorEquation, alphaEquation);
|
|
@@ -1650,49 +1698,49 @@ function setDeviceParameters(device, parameters) {
|
|
|
1650
1698
|
}
|
|
1651
1699
|
function convertCompareFunction(parameter, value) {
|
|
1652
1700
|
return map(parameter, value, {
|
|
1653
|
-
never:
|
|
1654
|
-
less:
|
|
1655
|
-
equal:
|
|
1656
|
-
"less-equal":
|
|
1657
|
-
greater:
|
|
1658
|
-
"not-equal":
|
|
1659
|
-
"greater-equal":
|
|
1660
|
-
always:
|
|
1701
|
+
never: 512,
|
|
1702
|
+
less: 513,
|
|
1703
|
+
equal: 514,
|
|
1704
|
+
"less-equal": 515,
|
|
1705
|
+
greater: 516,
|
|
1706
|
+
"not-equal": 517,
|
|
1707
|
+
"greater-equal": 518,
|
|
1708
|
+
always: 519
|
|
1661
1709
|
});
|
|
1662
1710
|
}
|
|
1663
1711
|
function convertStencilOperation(parameter, value) {
|
|
1664
1712
|
return map(parameter, value, {
|
|
1665
|
-
keep:
|
|
1666
|
-
zero:
|
|
1667
|
-
replace:
|
|
1668
|
-
invert:
|
|
1669
|
-
"increment-clamp":
|
|
1670
|
-
"decrement-clamp":
|
|
1671
|
-
"increment-wrap":
|
|
1672
|
-
"decrement-wrap":
|
|
1713
|
+
keep: 7680,
|
|
1714
|
+
zero: 0,
|
|
1715
|
+
replace: 7681,
|
|
1716
|
+
invert: 5386,
|
|
1717
|
+
"increment-clamp": 7682,
|
|
1718
|
+
"decrement-clamp": 7683,
|
|
1719
|
+
"increment-wrap": 34055,
|
|
1720
|
+
"decrement-wrap": 34056
|
|
1673
1721
|
});
|
|
1674
1722
|
}
|
|
1675
1723
|
function convertBlendOperationToEquation(parameter, value) {
|
|
1676
1724
|
return map(parameter, value, {
|
|
1677
|
-
add:
|
|
1678
|
-
subtract:
|
|
1679
|
-
"reverse-subtract":
|
|
1680
|
-
min:
|
|
1681
|
-
max:
|
|
1725
|
+
add: 32774,
|
|
1726
|
+
subtract: 32778,
|
|
1727
|
+
"reverse-subtract": 32779,
|
|
1728
|
+
min: 32775,
|
|
1729
|
+
max: 32776
|
|
1682
1730
|
});
|
|
1683
1731
|
}
|
|
1684
1732
|
function convertBlendFactorToFunction(parameter, value) {
|
|
1685
1733
|
return map(parameter, value, {
|
|
1686
|
-
one:
|
|
1687
|
-
zero:
|
|
1688
|
-
"src-color":
|
|
1689
|
-
"one-minus-src-color":
|
|
1690
|
-
"dst-color":
|
|
1691
|
-
"one-minus-dst-color":
|
|
1692
|
-
"src-alpha":
|
|
1693
|
-
"one-minus-src-alpha":
|
|
1694
|
-
"dst-alpha":
|
|
1695
|
-
"one-minus-dst-alpha":
|
|
1734
|
+
one: 1,
|
|
1735
|
+
zero: 0,
|
|
1736
|
+
"src-color": 768,
|
|
1737
|
+
"one-minus-src-color": 769,
|
|
1738
|
+
"dst-color": 774,
|
|
1739
|
+
"one-minus-dst-color": 775,
|
|
1740
|
+
"src-alpha": 770,
|
|
1741
|
+
"one-minus-src-alpha": 771,
|
|
1742
|
+
"dst-alpha": 772,
|
|
1743
|
+
"one-minus-dst-alpha": 773
|
|
1696
1744
|
});
|
|
1697
1745
|
}
|
|
1698
1746
|
function message(parameter, value) {
|
|
@@ -1712,53 +1760,53 @@ function mapBoolean(parameter, value) {
|
|
|
1712
1760
|
function convertSamplerParametersToWebGL(props) {
|
|
1713
1761
|
const params = {};
|
|
1714
1762
|
if (props.addressModeU) {
|
|
1715
|
-
params[
|
|
1763
|
+
params[10242] = convertAddressMode(props.addressModeU);
|
|
1716
1764
|
}
|
|
1717
1765
|
if (props.addressModeV) {
|
|
1718
|
-
params[
|
|
1766
|
+
params[10243] = convertAddressMode(props.addressModeV);
|
|
1719
1767
|
}
|
|
1720
1768
|
if (props.addressModeW) {
|
|
1721
|
-
params[
|
|
1769
|
+
params[32882] = convertAddressMode(props.addressModeW);
|
|
1722
1770
|
}
|
|
1723
1771
|
if (props.magFilter) {
|
|
1724
|
-
params[
|
|
1772
|
+
params[10240] = convertMaxFilterMode(props.magFilter);
|
|
1725
1773
|
}
|
|
1726
1774
|
if (props.minFilter || props.mipmapFilter) {
|
|
1727
|
-
params[
|
|
1775
|
+
params[10241] = convertMinFilterMode(props.minFilter || "linear", props.mipmapFilter);
|
|
1728
1776
|
}
|
|
1729
1777
|
if (props.lodMinClamp !== void 0) {
|
|
1730
|
-
params[
|
|
1778
|
+
params[33082] = props.lodMinClamp;
|
|
1731
1779
|
}
|
|
1732
1780
|
if (props.lodMaxClamp !== void 0) {
|
|
1733
|
-
params[
|
|
1781
|
+
params[33083] = props.lodMaxClamp;
|
|
1734
1782
|
}
|
|
1735
1783
|
if (props.type === "comparison-sampler") {
|
|
1736
|
-
params[
|
|
1784
|
+
params[34892] = 34894;
|
|
1737
1785
|
}
|
|
1738
1786
|
if (props.compare) {
|
|
1739
|
-
params[
|
|
1787
|
+
params[34893] = convertCompareFunction("compare", props.compare);
|
|
1740
1788
|
}
|
|
1741
1789
|
if (props.maxAnisotropy) {
|
|
1742
|
-
params[
|
|
1790
|
+
params[34046] = props.maxAnisotropy;
|
|
1743
1791
|
}
|
|
1744
1792
|
return params;
|
|
1745
1793
|
}
|
|
1746
1794
|
function convertAddressMode(addressMode) {
|
|
1747
1795
|
switch (addressMode) {
|
|
1748
1796
|
case "clamp-to-edge":
|
|
1749
|
-
return
|
|
1797
|
+
return 33071;
|
|
1750
1798
|
case "repeat":
|
|
1751
|
-
return
|
|
1799
|
+
return 10497;
|
|
1752
1800
|
case "mirror-repeat":
|
|
1753
|
-
return
|
|
1801
|
+
return 33648;
|
|
1754
1802
|
}
|
|
1755
1803
|
}
|
|
1756
1804
|
function convertMaxFilterMode(maxFilter) {
|
|
1757
1805
|
switch (maxFilter) {
|
|
1758
1806
|
case "nearest":
|
|
1759
|
-
return
|
|
1807
|
+
return 9728;
|
|
1760
1808
|
case "linear":
|
|
1761
|
-
return
|
|
1809
|
+
return 9729;
|
|
1762
1810
|
}
|
|
1763
1811
|
}
|
|
1764
1812
|
function convertMinFilterMode(minFilter, mipmapFilter) {
|
|
@@ -1767,9 +1815,9 @@ function convertMinFilterMode(minFilter, mipmapFilter) {
|
|
|
1767
1815
|
}
|
|
1768
1816
|
switch (minFilter) {
|
|
1769
1817
|
case "nearest":
|
|
1770
|
-
return mipmapFilter === "nearest" ?
|
|
1818
|
+
return mipmapFilter === "nearest" ? 9984 : 9986;
|
|
1771
1819
|
case "linear":
|
|
1772
|
-
return mipmapFilter === "nearest" ?
|
|
1820
|
+
return mipmapFilter === "nearest" ? 9985 : 9987;
|
|
1773
1821
|
}
|
|
1774
1822
|
}
|
|
1775
1823
|
|
|
@@ -1785,7 +1833,7 @@ var WEBGLBuffer = class extends import_core6.Buffer {
|
|
|
1785
1833
|
/** Usage is a hint on how frequently the buffer will be updates */
|
|
1786
1834
|
glUsage;
|
|
1787
1835
|
/** Index type is needed when issuing draw calls, so we pre-compute it */
|
|
1788
|
-
glIndexType =
|
|
1836
|
+
glIndexType = 5123;
|
|
1789
1837
|
/** Number of bytes allocated on the GPU for this buffer */
|
|
1790
1838
|
byteLength;
|
|
1791
1839
|
/** Number of bytes used */
|
|
@@ -1799,7 +1847,7 @@ var WEBGLBuffer = class extends import_core6.Buffer {
|
|
|
1799
1847
|
device.setSpectorMetadata(this.handle, { ...this.props, data: typeof this.props.data });
|
|
1800
1848
|
this.glTarget = getWebGLTarget(this.props.usage);
|
|
1801
1849
|
this.glUsage = getWebGLUsage(this.props.usage);
|
|
1802
|
-
this.glIndexType = this.props.indexType === "uint32" ?
|
|
1850
|
+
this.glIndexType = this.props.indexType === "uint32" ? 5125 : 5123;
|
|
1803
1851
|
if (props.data) {
|
|
1804
1852
|
this._initWithData(props.data, props.byteOffset, props.byteLength);
|
|
1805
1853
|
} else {
|
|
@@ -1848,7 +1896,7 @@ var WEBGLBuffer = class extends import_core6.Buffer {
|
|
|
1848
1896
|
write(data, byteOffset = 0) {
|
|
1849
1897
|
const srcOffset = 0;
|
|
1850
1898
|
const byteLength = void 0;
|
|
1851
|
-
const glTarget =
|
|
1899
|
+
const glTarget = 36663;
|
|
1852
1900
|
this.gl.bindBuffer(glTarget, this.handle);
|
|
1853
1901
|
if (srcOffset !== 0 || byteLength !== void 0) {
|
|
1854
1902
|
this.gl.bufferSubData(glTarget, byteOffset, data, srcOffset, byteLength);
|
|
@@ -1867,36 +1915,36 @@ var WEBGLBuffer = class extends import_core6.Buffer {
|
|
|
1867
1915
|
byteLength = byteLength ?? this.byteLength - byteOffset;
|
|
1868
1916
|
const data = new Uint8Array(byteLength);
|
|
1869
1917
|
const dstOffset = 0;
|
|
1870
|
-
this.gl.bindBuffer(
|
|
1871
|
-
this.gl.getBufferSubData(
|
|
1872
|
-
this.gl.bindBuffer(
|
|
1918
|
+
this.gl.bindBuffer(36662, this.handle);
|
|
1919
|
+
this.gl.getBufferSubData(36662, byteOffset, data, dstOffset, byteLength);
|
|
1920
|
+
this.gl.bindBuffer(36662, null);
|
|
1873
1921
|
this._setDebugData(data, byteOffset, byteLength);
|
|
1874
1922
|
return data;
|
|
1875
1923
|
}
|
|
1876
1924
|
};
|
|
1877
1925
|
function getWebGLTarget(usage) {
|
|
1878
1926
|
if (usage & import_core6.Buffer.INDEX) {
|
|
1879
|
-
return
|
|
1927
|
+
return 34963;
|
|
1880
1928
|
}
|
|
1881
1929
|
if (usage & import_core6.Buffer.VERTEX) {
|
|
1882
|
-
return
|
|
1930
|
+
return 34962;
|
|
1883
1931
|
}
|
|
1884
1932
|
if (usage & import_core6.Buffer.UNIFORM) {
|
|
1885
|
-
return
|
|
1933
|
+
return 35345;
|
|
1886
1934
|
}
|
|
1887
|
-
return
|
|
1935
|
+
return 34962;
|
|
1888
1936
|
}
|
|
1889
1937
|
function getWebGLUsage(usage) {
|
|
1890
1938
|
if (usage & import_core6.Buffer.INDEX) {
|
|
1891
|
-
return
|
|
1939
|
+
return 35044;
|
|
1892
1940
|
}
|
|
1893
1941
|
if (usage & import_core6.Buffer.VERTEX) {
|
|
1894
|
-
return
|
|
1942
|
+
return 35044;
|
|
1895
1943
|
}
|
|
1896
1944
|
if (usage & import_core6.Buffer.UNIFORM) {
|
|
1897
|
-
return
|
|
1945
|
+
return 35048;
|
|
1898
1946
|
}
|
|
1899
|
-
return
|
|
1947
|
+
return 35044;
|
|
1900
1948
|
}
|
|
1901
1949
|
|
|
1902
1950
|
// dist/adapter/resources/webgl-sampler.js
|
|
@@ -1927,8 +1975,8 @@ var WEBGLSampler = class extends import_core7.Sampler {
|
|
|
1927
1975
|
for (const [pname, value] of Object.entries(parameters)) {
|
|
1928
1976
|
const param = Number(pname);
|
|
1929
1977
|
switch (param) {
|
|
1930
|
-
case
|
|
1931
|
-
case
|
|
1978
|
+
case 33082:
|
|
1979
|
+
case 33083:
|
|
1932
1980
|
this.device.gl.samplerParameterf(this.handle, param, value);
|
|
1933
1981
|
break;
|
|
1934
1982
|
default:
|
|
@@ -2004,7 +2052,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2004
2052
|
this.gl = this.device.gl;
|
|
2005
2053
|
this.handle = this.props.handle || this.gl.createTexture();
|
|
2006
2054
|
this.device.setSpectorMetadata(this.handle, { ...this.props, data: typeof this.props.data });
|
|
2007
|
-
this.glFormat =
|
|
2055
|
+
this.glFormat = 6408;
|
|
2008
2056
|
this.target = getWebGLTextureTarget(this.props);
|
|
2009
2057
|
this.loaded = false;
|
|
2010
2058
|
if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
|
|
@@ -2024,6 +2072,9 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2024
2072
|
toString() {
|
|
2025
2073
|
return `Texture(${this.id},${this.width}x${this.height})`;
|
|
2026
2074
|
}
|
|
2075
|
+
createView(props) {
|
|
2076
|
+
return new WEBGLTextureView(this.device, { ...props, texture: this });
|
|
2077
|
+
}
|
|
2027
2078
|
// eslint-disable-next-line max-statements
|
|
2028
2079
|
initialize(props = {}) {
|
|
2029
2080
|
if (this.props.dimension === "cube") {
|
|
@@ -2067,7 +2118,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2067
2118
|
this.dataFormat = dataFormat;
|
|
2068
2119
|
this.textureUnit = textureUnit;
|
|
2069
2120
|
if (Number.isFinite(this.textureUnit)) {
|
|
2070
|
-
this.gl.activeTexture(
|
|
2121
|
+
this.gl.activeTexture(33984 + this.textureUnit);
|
|
2071
2122
|
this.gl.bindTexture(this.target, this.handle);
|
|
2072
2123
|
}
|
|
2073
2124
|
this.mipmaps = mipmaps;
|
|
@@ -2085,8 +2136,8 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2085
2136
|
});
|
|
2086
2137
|
this.setSampler(props.sampler);
|
|
2087
2138
|
this._setSamplerParameters(parameters);
|
|
2088
|
-
this.view =
|
|
2089
|
-
if (mipmaps) {
|
|
2139
|
+
this.view = this.createView({ ...this.props, mipLevelCount: 1, arrayLayerCount: 1 });
|
|
2140
|
+
if (mipmaps && this.device.isTextureFormatFilterable(props.format)) {
|
|
2090
2141
|
this.generateMipmap();
|
|
2091
2142
|
}
|
|
2092
2143
|
if (isVideo) {
|
|
@@ -2234,9 +2285,9 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2234
2285
|
);
|
|
2235
2286
|
break;
|
|
2236
2287
|
case "buffer":
|
|
2237
|
-
this.device.gl.bindBuffer(
|
|
2288
|
+
this.device.gl.bindBuffer(35052, data.handle || data);
|
|
2238
2289
|
this.device.gl.texImage2D(target, level, glFormat, width, height, 0, dataFormat, type, offset);
|
|
2239
|
-
this.device.gl.bindBuffer(
|
|
2290
|
+
this.device.gl.bindBuffer(35052, null);
|
|
2240
2291
|
break;
|
|
2241
2292
|
case "browser-object":
|
|
2242
2293
|
gl.texImage2D(target, level, glFormat, width, height, 0, dataFormat, type, data);
|
|
@@ -2296,9 +2347,9 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2296
2347
|
} else if (ArrayBuffer.isView(data)) {
|
|
2297
2348
|
this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data, offset);
|
|
2298
2349
|
} else if (typeof WebGLBuffer !== "undefined" && data instanceof WebGLBuffer) {
|
|
2299
|
-
this.device.gl.bindBuffer(
|
|
2350
|
+
this.device.gl.bindBuffer(35052, data);
|
|
2300
2351
|
this.device.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, offset);
|
|
2301
|
-
this.device.gl.bindBuffer(
|
|
2352
|
+
this.device.gl.bindBuffer(35052, null);
|
|
2302
2353
|
} else {
|
|
2303
2354
|
this.device.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data);
|
|
2304
2355
|
}
|
|
@@ -2318,13 +2369,13 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2318
2369
|
return null;
|
|
2319
2370
|
}
|
|
2320
2371
|
getActiveUnit() {
|
|
2321
|
-
return this.gl.getParameter(
|
|
2372
|
+
return this.gl.getParameter(34016) - 33984;
|
|
2322
2373
|
}
|
|
2323
2374
|
bind(textureUnit = this.textureUnit) {
|
|
2324
2375
|
const { gl } = this;
|
|
2325
2376
|
if (textureUnit !== void 0) {
|
|
2326
2377
|
this.textureUnit = textureUnit;
|
|
2327
|
-
gl.activeTexture(
|
|
2378
|
+
gl.activeTexture(33984 + textureUnit);
|
|
2328
2379
|
}
|
|
2329
2380
|
gl.bindTexture(this.target, this.handle);
|
|
2330
2381
|
return textureUnit;
|
|
@@ -2333,7 +2384,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2333
2384
|
const { gl } = this;
|
|
2334
2385
|
if (textureUnit !== void 0) {
|
|
2335
2386
|
this.textureUnit = textureUnit;
|
|
2336
|
-
gl.activeTexture(
|
|
2387
|
+
gl.activeTexture(33984 + textureUnit);
|
|
2337
2388
|
}
|
|
2338
2389
|
gl.bindTexture(this.target, null);
|
|
2339
2390
|
return textureUnit;
|
|
@@ -2395,7 +2446,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2395
2446
|
/* eslint-disable max-statements, max-len */
|
|
2396
2447
|
async setCubeMapImageData(options) {
|
|
2397
2448
|
const { gl } = this;
|
|
2398
|
-
const { width, height, pixels, data, format =
|
|
2449
|
+
const { width, height, pixels, data, format = 6408, type = 5121 } = options;
|
|
2399
2450
|
const imageDataMap = pixels || data;
|
|
2400
2451
|
const resolvedFaces = await Promise.all(_WEBGLTexture.FACES.map((face) => {
|
|
2401
2452
|
const facePixels = imageDataMap[face];
|
|
@@ -2424,8 +2475,8 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2424
2475
|
height,
|
|
2425
2476
|
pixels,
|
|
2426
2477
|
data,
|
|
2427
|
-
format =
|
|
2428
|
-
type =
|
|
2478
|
+
format = 6408,
|
|
2479
|
+
type = 5121
|
|
2429
2480
|
// generateMipmap = false // TODO
|
|
2430
2481
|
} = options;
|
|
2431
2482
|
const { gl } = this;
|
|
@@ -2479,7 +2530,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2479
2530
|
);
|
|
2480
2531
|
}
|
|
2481
2532
|
if (data instanceof WEBGLBuffer) {
|
|
2482
|
-
this.gl.bindBuffer(
|
|
2533
|
+
this.gl.bindBuffer(35052, data.handle);
|
|
2483
2534
|
this.gl.texImage3D(this.target, level, dataFormat, width, height, depth, 0, format, type, offset);
|
|
2484
2535
|
}
|
|
2485
2536
|
});
|
|
@@ -2506,8 +2557,8 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2506
2557
|
const param = Number(pname);
|
|
2507
2558
|
const value = pvalue;
|
|
2508
2559
|
switch (param) {
|
|
2509
|
-
case
|
|
2510
|
-
case
|
|
2560
|
+
case 33082:
|
|
2561
|
+
case 33083:
|
|
2511
2562
|
this.gl.texParameterf(this.target, param, value);
|
|
2512
2563
|
break;
|
|
2513
2564
|
default:
|
|
@@ -2522,23 +2573,23 @@ var _WEBGLTexture = class extends import_core9.Texture {
|
|
|
2522
2573
|
var WEBGLTexture = _WEBGLTexture;
|
|
2523
2574
|
// TODO - remove?
|
|
2524
2575
|
__publicField(WEBGLTexture, "FACES", [
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2576
|
+
34069,
|
|
2577
|
+
34070,
|
|
2578
|
+
34071,
|
|
2579
|
+
34072,
|
|
2580
|
+
34073,
|
|
2581
|
+
34074
|
|
2531
2582
|
]);
|
|
2532
2583
|
function getWebGLTextureTarget(props) {
|
|
2533
2584
|
switch (props.dimension) {
|
|
2534
2585
|
case "2d":
|
|
2535
|
-
return
|
|
2586
|
+
return 3553;
|
|
2536
2587
|
case "cube":
|
|
2537
|
-
return
|
|
2588
|
+
return 34067;
|
|
2538
2589
|
case "2d-array":
|
|
2539
|
-
return
|
|
2590
|
+
return 35866;
|
|
2540
2591
|
case "3d":
|
|
2541
|
-
return
|
|
2592
|
+
return 32879;
|
|
2542
2593
|
case "1d":
|
|
2543
2594
|
case "cube-array":
|
|
2544
2595
|
default:
|
|
@@ -2549,180 +2600,8 @@ function logParameters(parameters) {
|
|
|
2549
2600
|
import_core9.log.log(1, "texture sampler parameters", parameters)();
|
|
2550
2601
|
}
|
|
2551
2602
|
|
|
2552
|
-
// dist/adapter/objects/webgl-renderbuffer.js
|
|
2553
|
-
var import_core11 = require("@luma.gl/core");
|
|
2554
|
-
var import_constants11 = require("@luma.gl/constants");
|
|
2555
|
-
|
|
2556
|
-
// dist/adapter/objects/webgl-resource.js
|
|
2557
|
-
var import_core10 = require("@luma.gl/core");
|
|
2558
|
-
var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
|
|
2559
|
-
var WebGLResource = class extends import_core10.Resource {
|
|
2560
|
-
device;
|
|
2561
|
-
gl;
|
|
2562
|
-
gl2;
|
|
2563
|
-
_handle;
|
|
2564
|
-
_bound = false;
|
|
2565
|
-
// Only meaningful for resources that allocate GPU memory
|
|
2566
|
-
byteLength = 0;
|
|
2567
|
-
constructor(device, props, defaultProps) {
|
|
2568
|
-
super(device, props, defaultProps);
|
|
2569
|
-
this.device = WebGLDevice.attach(device);
|
|
2570
|
-
const gl = this.device.gl;
|
|
2571
|
-
const { id } = props || {};
|
|
2572
|
-
this.gl = gl;
|
|
2573
|
-
this.gl2 = gl;
|
|
2574
|
-
this.id = id || (0, import_core10.uid)(this.constructor.name);
|
|
2575
|
-
this._handle = props == null ? void 0 : props.handle;
|
|
2576
|
-
if (this._handle === void 0) {
|
|
2577
|
-
this._handle = this._createHandle();
|
|
2578
|
-
}
|
|
2579
|
-
this.byteLength = 0;
|
|
2580
|
-
}
|
|
2581
|
-
toString() {
|
|
2582
|
-
return `${this.constructor.name}(${this.id})`;
|
|
2583
|
-
}
|
|
2584
|
-
get handle() {
|
|
2585
|
-
return this._handle;
|
|
2586
|
-
}
|
|
2587
|
-
delete({ deleteChildren = false } = {}) {
|
|
2588
|
-
const children = this._handle && this._deleteHandle(this._handle);
|
|
2589
|
-
if (this._handle) {
|
|
2590
|
-
this.removeStats();
|
|
2591
|
-
}
|
|
2592
|
-
this._handle = null;
|
|
2593
|
-
if (children && deleteChildren) {
|
|
2594
|
-
children.filter(Boolean).forEach((child) => child.destroy());
|
|
2595
|
-
}
|
|
2596
|
-
return this;
|
|
2597
|
-
}
|
|
2598
|
-
bind(funcOrHandle = this.handle) {
|
|
2599
|
-
if (typeof funcOrHandle !== "function") {
|
|
2600
|
-
this._bindHandle(funcOrHandle);
|
|
2601
|
-
return this;
|
|
2602
|
-
}
|
|
2603
|
-
let value;
|
|
2604
|
-
if (!this._bound) {
|
|
2605
|
-
this._bindHandle(this.handle);
|
|
2606
|
-
this._bound = true;
|
|
2607
|
-
value = funcOrHandle();
|
|
2608
|
-
this._bound = false;
|
|
2609
|
-
this._bindHandle(null);
|
|
2610
|
-
} else {
|
|
2611
|
-
value = funcOrHandle();
|
|
2612
|
-
}
|
|
2613
|
-
return value;
|
|
2614
|
-
}
|
|
2615
|
-
unbind() {
|
|
2616
|
-
this.bind(null);
|
|
2617
|
-
}
|
|
2618
|
-
// Install stubs for removed methods
|
|
2619
|
-
stubRemovedMethods(className, version, methodNames) {
|
|
2620
|
-
return (0, import_core10.stubRemovedMethods)(this, className, version, methodNames);
|
|
2621
|
-
}
|
|
2622
|
-
// PUBLIC VIRTUAL METHODS
|
|
2623
|
-
initialize(props) {
|
|
2624
|
-
}
|
|
2625
|
-
// PROTECTED METHODS - These must be overridden by subclass
|
|
2626
|
-
_createHandle() {
|
|
2627
|
-
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
2628
|
-
}
|
|
2629
|
-
_deleteHandle() {
|
|
2630
|
-
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
2631
|
-
}
|
|
2632
|
-
_bindHandle(handle) {
|
|
2633
|
-
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
2634
|
-
}
|
|
2635
|
-
_getOptsFromHandle() {
|
|
2636
|
-
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
2637
|
-
}
|
|
2638
|
-
_getParameter(pname, props) {
|
|
2639
|
-
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
2640
|
-
}
|
|
2641
|
-
_setParameter(pname, value) {
|
|
2642
|
-
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
2643
|
-
}
|
|
2644
|
-
};
|
|
2645
|
-
|
|
2646
|
-
// dist/adapter/objects/webgl-renderbuffer.js
|
|
2647
|
-
var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
2648
|
-
get [Symbol.toStringTag]() {
|
|
2649
|
-
return "Renderbuffer";
|
|
2650
|
-
}
|
|
2651
|
-
get width() {
|
|
2652
|
-
return this.props.width;
|
|
2653
|
-
}
|
|
2654
|
-
get height() {
|
|
2655
|
-
return this.props.height;
|
|
2656
|
-
}
|
|
2657
|
-
get format() {
|
|
2658
|
-
return this.props.format;
|
|
2659
|
-
}
|
|
2660
|
-
get samples() {
|
|
2661
|
-
return this.props.samples;
|
|
2662
|
-
}
|
|
2663
|
-
get attachment() {
|
|
2664
|
-
return;
|
|
2665
|
-
}
|
|
2666
|
-
/** WebGL format constant */
|
|
2667
|
-
glFormat;
|
|
2668
|
-
static isTextureFormatSupported(device, format) {
|
|
2669
|
-
return isRenderbufferFormatSupported(device.gl, format, device._extensions);
|
|
2670
|
-
}
|
|
2671
|
-
constructor(device, props) {
|
|
2672
|
-
if (typeof props.format === "number") {
|
|
2673
|
-
throw new Error("Renderbuffer");
|
|
2674
|
-
}
|
|
2675
|
-
super(device, props, _WEBGLRenderbuffer.defaultProps);
|
|
2676
|
-
this.glFormat = convertTextureFormatToGL(this.props.format);
|
|
2677
|
-
this._initialize(this.props);
|
|
2678
|
-
}
|
|
2679
|
-
resize(size) {
|
|
2680
|
-
if (size.width !== this.width || size.height !== this.height) {
|
|
2681
|
-
Object.assign(this.props, { ...size, format: this.format, samples: this.samples });
|
|
2682
|
-
this._initialize(this.props);
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
// PRIVATE METHODS
|
|
2686
|
-
/** Creates and initializes a renderbuffer object's data store */
|
|
2687
|
-
_initialize(props) {
|
|
2688
|
-
const { format, width, height, samples } = props;
|
|
2689
|
-
(0, import_core11.assert)(format, "Needs format");
|
|
2690
|
-
this.trackDeallocatedMemory();
|
|
2691
|
-
this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, this.handle);
|
|
2692
|
-
if (samples !== 0) {
|
|
2693
|
-
this.gl.renderbufferStorageMultisample(import_constants11.GL.RENDERBUFFER, samples, this.glFormat, width, height);
|
|
2694
|
-
} else {
|
|
2695
|
-
this.gl.renderbufferStorage(import_constants11.GL.RENDERBUFFER, this.glFormat, width, height);
|
|
2696
|
-
}
|
|
2697
|
-
this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, null);
|
|
2698
|
-
this.trackAllocatedMemory(width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat));
|
|
2699
|
-
}
|
|
2700
|
-
// RESOURCE IMPLEMENTATION
|
|
2701
|
-
_createHandle() {
|
|
2702
|
-
return this.gl.createRenderbuffer();
|
|
2703
|
-
}
|
|
2704
|
-
_deleteHandle() {
|
|
2705
|
-
this.gl.deleteRenderbuffer(this.handle);
|
|
2706
|
-
this.trackDeallocatedMemory();
|
|
2707
|
-
}
|
|
2708
|
-
_bindHandle(handle) {
|
|
2709
|
-
this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, handle);
|
|
2710
|
-
}
|
|
2711
|
-
};
|
|
2712
|
-
var WEBGLRenderbuffer = _WEBGLRenderbuffer;
|
|
2713
|
-
__publicField(WEBGLRenderbuffer, "defaultProps", {
|
|
2714
|
-
id: void 0,
|
|
2715
|
-
handle: void 0,
|
|
2716
|
-
userData: void 0,
|
|
2717
|
-
format: void 0,
|
|
2718
|
-
// 'depth16unorm'
|
|
2719
|
-
width: 1,
|
|
2720
|
-
height: 1,
|
|
2721
|
-
samples: 0
|
|
2722
|
-
});
|
|
2723
|
-
|
|
2724
2603
|
// dist/adapter/resources/webgl-framebuffer.js
|
|
2725
|
-
var WEBGLFramebuffer = class extends
|
|
2604
|
+
var WEBGLFramebuffer = class extends import_core10.Framebuffer {
|
|
2726
2605
|
device;
|
|
2727
2606
|
gl;
|
|
2728
2607
|
handle;
|
|
@@ -2738,10 +2617,10 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
|
|
|
2738
2617
|
if (!isDefaultFramebuffer) {
|
|
2739
2618
|
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
2740
2619
|
this.autoCreateAttachmentTextures();
|
|
2741
|
-
this.gl.bindFramebuffer(
|
|
2620
|
+
this.gl.bindFramebuffer(36160, this.handle);
|
|
2742
2621
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
2743
2622
|
const attachment = this.colorAttachments[i];
|
|
2744
|
-
const attachmentPoint =
|
|
2623
|
+
const attachmentPoint = 36064 + i;
|
|
2745
2624
|
if (attachment) {
|
|
2746
2625
|
this._attachOne(attachmentPoint, attachment);
|
|
2747
2626
|
}
|
|
@@ -2750,12 +2629,12 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
|
|
|
2750
2629
|
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
|
|
2751
2630
|
}
|
|
2752
2631
|
if (props.check !== false) {
|
|
2753
|
-
const status = this.gl.checkFramebufferStatus(
|
|
2754
|
-
if (status !==
|
|
2632
|
+
const status = this.gl.checkFramebufferStatus(36160);
|
|
2633
|
+
if (status !== 36053) {
|
|
2755
2634
|
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
2756
2635
|
}
|
|
2757
2636
|
}
|
|
2758
|
-
this.gl.bindFramebuffer(
|
|
2637
|
+
this.gl.bindFramebuffer(36160, null);
|
|
2759
2638
|
}
|
|
2760
2639
|
}
|
|
2761
2640
|
/** destroys any auto created resources etc. */
|
|
@@ -2768,14 +2647,12 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
|
|
|
2768
2647
|
// PRIVATE
|
|
2769
2648
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
2770
2649
|
createDepthStencilTexture(format) {
|
|
2771
|
-
return new
|
|
2650
|
+
return new WEBGLTexture(this.device, {
|
|
2772
2651
|
id: `${this.id}-depth-stencil`,
|
|
2773
|
-
// TODO misleading if not depth and stencil?
|
|
2774
2652
|
format,
|
|
2775
|
-
// dataFormat: GL.DEPTH_STENCIL,
|
|
2776
|
-
// type: GL.UNSIGNED_INT_24_8,
|
|
2777
2653
|
width: this.width,
|
|
2778
|
-
height: this.height
|
|
2654
|
+
height: this.height,
|
|
2655
|
+
mipmaps: false
|
|
2779
2656
|
});
|
|
2780
2657
|
}
|
|
2781
2658
|
/**
|
|
@@ -2803,26 +2680,31 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
|
|
|
2803
2680
|
}
|
|
2804
2681
|
/** Attach one attachment */
|
|
2805
2682
|
_attachOne(attachmentPoint, attachment) {
|
|
2806
|
-
if (attachment
|
|
2807
|
-
this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
|
|
2808
|
-
return attachment;
|
|
2809
|
-
} else if (Array.isArray(attachment)) {
|
|
2683
|
+
if (Array.isArray(attachment)) {
|
|
2810
2684
|
const [texture, layer = 0, level = 0] = attachment;
|
|
2811
2685
|
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
2812
2686
|
return texture;
|
|
2813
|
-
}
|
|
2687
|
+
}
|
|
2688
|
+
if (attachment instanceof WEBGLTexture) {
|
|
2814
2689
|
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
2815
2690
|
return attachment;
|
|
2816
|
-
}
|
|
2691
|
+
}
|
|
2692
|
+
if (attachment instanceof WEBGLTextureView) {
|
|
2817
2693
|
const textureView = attachment;
|
|
2818
2694
|
this._attachTexture(attachmentPoint, textureView.texture, textureView.props.baseMipLevel, textureView.props.baseArrayLayer);
|
|
2819
2695
|
return attachment.texture;
|
|
2820
2696
|
}
|
|
2821
2697
|
throw new Error("attach");
|
|
2822
2698
|
}
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2699
|
+
// TODO - we do not seem to need render buffers in WebGL 2
|
|
2700
|
+
// protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void {
|
|
2701
|
+
// this.gl.framebufferRenderbuffer(
|
|
2702
|
+
// GL.FRAMEBUFFER,
|
|
2703
|
+
// attachment,
|
|
2704
|
+
// GL.RENDERBUFFER,
|
|
2705
|
+
// renderbuffer.handle
|
|
2706
|
+
// );
|
|
2707
|
+
// }
|
|
2826
2708
|
/**
|
|
2827
2709
|
* @param attachment
|
|
2828
2710
|
* @param texture
|
|
@@ -2833,39 +2715,39 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
|
|
|
2833
2715
|
const { gl } = this.device;
|
|
2834
2716
|
gl.bindTexture(texture.target, texture.handle);
|
|
2835
2717
|
switch (texture.target) {
|
|
2836
|
-
case
|
|
2837
|
-
case
|
|
2838
|
-
gl.framebufferTextureLayer(
|
|
2718
|
+
case 35866:
|
|
2719
|
+
case 32879:
|
|
2720
|
+
gl.framebufferTextureLayer(36160, attachment, texture.target, level, layer);
|
|
2839
2721
|
break;
|
|
2840
|
-
case
|
|
2722
|
+
case 34067:
|
|
2841
2723
|
const face = mapIndexToCubeMapFace(layer);
|
|
2842
|
-
gl.framebufferTexture2D(
|
|
2724
|
+
gl.framebufferTexture2D(36160, attachment, face, texture.handle, level);
|
|
2843
2725
|
break;
|
|
2844
|
-
case
|
|
2845
|
-
gl.framebufferTexture2D(
|
|
2726
|
+
case 3553:
|
|
2727
|
+
gl.framebufferTexture2D(36160, attachment, 3553, texture.handle, level);
|
|
2846
2728
|
break;
|
|
2847
2729
|
default:
|
|
2848
|
-
(0,
|
|
2730
|
+
(0, import_core10.assert)(false, "Illegal texture type");
|
|
2849
2731
|
}
|
|
2850
2732
|
gl.bindTexture(texture.target, null);
|
|
2851
2733
|
}
|
|
2852
2734
|
};
|
|
2853
2735
|
function mapIndexToCubeMapFace(layer) {
|
|
2854
|
-
return layer <
|
|
2736
|
+
return layer < 34069 ? layer + 34069 : layer;
|
|
2855
2737
|
}
|
|
2856
2738
|
function _getFrameBufferStatus(status) {
|
|
2857
2739
|
switch (status) {
|
|
2858
|
-
case
|
|
2740
|
+
case 36053:
|
|
2859
2741
|
return "success";
|
|
2860
|
-
case
|
|
2742
|
+
case 36054:
|
|
2861
2743
|
return "Mismatched attachments";
|
|
2862
|
-
case
|
|
2744
|
+
case 36055:
|
|
2863
2745
|
return "No attachments";
|
|
2864
|
-
case
|
|
2746
|
+
case 36057:
|
|
2865
2747
|
return "Height/width mismatch";
|
|
2866
|
-
case
|
|
2748
|
+
case 36061:
|
|
2867
2749
|
return "Unsupported or split attachments";
|
|
2868
|
-
case
|
|
2750
|
+
case 36182:
|
|
2869
2751
|
return "Samples mismatch";
|
|
2870
2752
|
default:
|
|
2871
2753
|
return `${status}`;
|
|
@@ -2873,7 +2755,7 @@ function _getFrameBufferStatus(status) {
|
|
|
2873
2755
|
}
|
|
2874
2756
|
|
|
2875
2757
|
// dist/adapter/webgl-canvas-context.js
|
|
2876
|
-
var WebGLCanvasContext = class extends
|
|
2758
|
+
var WebGLCanvasContext = class extends import_core11.CanvasContext {
|
|
2877
2759
|
device;
|
|
2878
2760
|
presentationSize;
|
|
2879
2761
|
_framebuffer = null;
|
|
@@ -2924,9 +2806,9 @@ var WebGLCanvasContext = class extends import_core13.CanvasContext {
|
|
|
2924
2806
|
};
|
|
2925
2807
|
|
|
2926
2808
|
// dist/context/debug/spector.js
|
|
2927
|
-
var
|
|
2809
|
+
var import_core12 = require("@luma.gl/core");
|
|
2928
2810
|
var DEFAULT_SPECTOR_PROPS = {
|
|
2929
|
-
spector:
|
|
2811
|
+
spector: import_core12.log.get("spector") || import_core12.log.get("inspect")
|
|
2930
2812
|
};
|
|
2931
2813
|
var SPECTOR_CDN_URL = "https://spectorcdn.babylonjs.com/spector.bundle.js";
|
|
2932
2814
|
var LOG_LEVEL = 1;
|
|
@@ -2935,9 +2817,9 @@ var initialized = false;
|
|
|
2935
2817
|
async function loadSpectorJS(props) {
|
|
2936
2818
|
if (!globalThis.SPECTOR) {
|
|
2937
2819
|
try {
|
|
2938
|
-
await (0,
|
|
2820
|
+
await (0, import_core12.loadScript)(SPECTOR_CDN_URL);
|
|
2939
2821
|
} catch (error) {
|
|
2940
|
-
|
|
2822
|
+
import_core12.log.warn(String(error));
|
|
2941
2823
|
}
|
|
2942
2824
|
}
|
|
2943
2825
|
}
|
|
@@ -2947,7 +2829,7 @@ function initializeSpectorJS(props) {
|
|
|
2947
2829
|
return null;
|
|
2948
2830
|
}
|
|
2949
2831
|
if (!spector && globalThis.SPECTOR) {
|
|
2950
|
-
|
|
2832
|
+
import_core12.log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
|
|
2951
2833
|
spector = new globalThis.SPECTOR.Spector();
|
|
2952
2834
|
if (globalThis.luma) {
|
|
2953
2835
|
globalThis.luma.spector = spector;
|
|
@@ -2959,9 +2841,9 @@ function initializeSpectorJS(props) {
|
|
|
2959
2841
|
if (!initialized) {
|
|
2960
2842
|
initialized = true;
|
|
2961
2843
|
spector.spyCanvases();
|
|
2962
|
-
spector == null ? void 0 : spector.onCaptureStarted.add((capture) =>
|
|
2844
|
+
spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core12.log.info("Spector capture started:", capture)());
|
|
2963
2845
|
spector == null ? void 0 : spector.onCapture.add((capture) => {
|
|
2964
|
-
|
|
2846
|
+
import_core12.log.info("Spector capture complete:", capture)();
|
|
2965
2847
|
spector == null ? void 0 : spector.getResultUI();
|
|
2966
2848
|
spector == null ? void 0 : spector.resultView.display();
|
|
2967
2849
|
spector == null ? void 0 : spector.resultView.addCapture(capture);
|
|
@@ -2973,7 +2855,7 @@ function initializeSpectorJS(props) {
|
|
|
2973
2855
|
}
|
|
2974
2856
|
spector == null ? void 0 : spector.startCapture(props == null ? void 0 : props.canvas, 500);
|
|
2975
2857
|
new Promise((resolve) => setTimeout(resolve, 2e3)).then((_) => {
|
|
2976
|
-
|
|
2858
|
+
import_core12.log.info("Spector capture stopped after 2 seconds")();
|
|
2977
2859
|
spector == null ? void 0 : spector.stopCapture();
|
|
2978
2860
|
});
|
|
2979
2861
|
}
|
|
@@ -2981,8 +2863,8 @@ function initializeSpectorJS(props) {
|
|
|
2981
2863
|
}
|
|
2982
2864
|
|
|
2983
2865
|
// dist/context/debug/webgl-developer-tools.js
|
|
2984
|
-
var
|
|
2985
|
-
var
|
|
2866
|
+
var import_core13 = require("@luma.gl/core");
|
|
2867
|
+
var import_constants12 = require("@luma.gl/constants");
|
|
2986
2868
|
var import_env = require("@probe.gl/env");
|
|
2987
2869
|
var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
|
|
2988
2870
|
function getWebGLContextData(gl) {
|
|
@@ -2993,7 +2875,7 @@ async function loadWebGLDeveloperTools() {
|
|
|
2993
2875
|
if ((0, import_env.isBrowser)() && !globalThis.WebGLDebugUtils) {
|
|
2994
2876
|
globalThis.global = globalThis.global || globalThis;
|
|
2995
2877
|
globalThis.global.module = {};
|
|
2996
|
-
await (0,
|
|
2878
|
+
await (0, import_core13.loadScript)(WEBGL_DEBUG_CDN_URL);
|
|
2997
2879
|
}
|
|
2998
2880
|
}
|
|
2999
2881
|
function makeDebugContext(gl, props = {}) {
|
|
@@ -3008,18 +2890,18 @@ function getRealContext(gl) {
|
|
|
3008
2890
|
}
|
|
3009
2891
|
function getDebugContext(gl, props) {
|
|
3010
2892
|
if (!globalThis.WebGLDebugUtils) {
|
|
3011
|
-
|
|
2893
|
+
import_core13.log.warn("webgl-debug not loaded")();
|
|
3012
2894
|
return gl;
|
|
3013
2895
|
}
|
|
3014
2896
|
const data = getWebGLContextData(gl);
|
|
3015
2897
|
if (data.debugContext) {
|
|
3016
2898
|
return data.debugContext;
|
|
3017
2899
|
}
|
|
3018
|
-
globalThis.WebGLDebugUtils.init({ ...
|
|
2900
|
+
globalThis.WebGLDebugUtils.init({ ...import_constants12.GL, ...gl });
|
|
3019
2901
|
const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(gl, onGLError.bind(null, props), onValidateGLFunc.bind(null, props));
|
|
3020
|
-
for (const key in
|
|
3021
|
-
if (!(key in glDebug) && typeof
|
|
3022
|
-
glDebug[key] =
|
|
2902
|
+
for (const key in import_constants12.GL) {
|
|
2903
|
+
if (!(key in glDebug) && typeof import_constants12.GL[key] === "number") {
|
|
2904
|
+
glDebug[key] = import_constants12.GL[key];
|
|
3023
2905
|
}
|
|
3024
2906
|
}
|
|
3025
2907
|
class WebGLDebugContext {
|
|
@@ -3043,7 +2925,7 @@ function onGLError(props, err, functionName, args) {
|
|
|
3043
2925
|
const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);
|
|
3044
2926
|
const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);
|
|
3045
2927
|
const message2 = `${errorMessage} in gl.${functionName}(${functionArgs})`;
|
|
3046
|
-
|
|
2928
|
+
import_core13.log.error(message2)();
|
|
3047
2929
|
debugger;
|
|
3048
2930
|
if (props.throwOnError) {
|
|
3049
2931
|
throw new Error(message2);
|
|
@@ -3051,9 +2933,9 @@ function onGLError(props, err, functionName, args) {
|
|
|
3051
2933
|
}
|
|
3052
2934
|
function onValidateGLFunc(props, functionName, functionArgs) {
|
|
3053
2935
|
let functionString = "";
|
|
3054
|
-
if (
|
|
2936
|
+
if (import_core13.log.level >= 1) {
|
|
3055
2937
|
functionString = getFunctionString(functionName, functionArgs);
|
|
3056
|
-
|
|
2938
|
+
import_core13.log.log(1, functionString)();
|
|
3057
2939
|
}
|
|
3058
2940
|
if (props.break && props.break.length > 0) {
|
|
3059
2941
|
functionString = functionString || getFunctionString(functionName, functionArgs);
|
|
@@ -3068,7 +2950,7 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
3068
2950
|
if (props.throwOnError) {
|
|
3069
2951
|
throw new Error(`Undefined argument: ${functionString}`);
|
|
3070
2952
|
} else {
|
|
3071
|
-
|
|
2953
|
+
import_core13.log.error(`Undefined argument: ${functionString}`)();
|
|
3072
2954
|
debugger;
|
|
3073
2955
|
}
|
|
3074
2956
|
}
|
|
@@ -3076,8 +2958,8 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
3076
2958
|
}
|
|
3077
2959
|
|
|
3078
2960
|
// dist/adapter/resources/webgl-shader.js
|
|
3079
|
-
var
|
|
3080
|
-
var
|
|
2961
|
+
var import_core14 = require("@luma.gl/core");
|
|
2962
|
+
var import_constants13 = require("@luma.gl/constants");
|
|
3081
2963
|
|
|
3082
2964
|
// dist/adapter/helpers/parse-shader-compiler-log.js
|
|
3083
2965
|
function parseShaderCompilerLog(errLog) {
|
|
@@ -3124,7 +3006,7 @@ function getMessageType(messageType) {
|
|
|
3124
3006
|
}
|
|
3125
3007
|
|
|
3126
3008
|
// dist/adapter/resources/webgl-shader.js
|
|
3127
|
-
var WEBGLShader = class extends
|
|
3009
|
+
var WEBGLShader = class extends import_core14.Shader {
|
|
3128
3010
|
device;
|
|
3129
3011
|
handle;
|
|
3130
3012
|
constructor(device, props) {
|
|
@@ -3132,10 +3014,10 @@ var WEBGLShader = class extends import_core16.Shader {
|
|
|
3132
3014
|
this.device = device;
|
|
3133
3015
|
switch (this.props.stage) {
|
|
3134
3016
|
case "vertex":
|
|
3135
|
-
this.handle = this.props.handle || this.device.gl.createShader(
|
|
3017
|
+
this.handle = this.props.handle || this.device.gl.createShader(35633);
|
|
3136
3018
|
break;
|
|
3137
3019
|
case "fragment":
|
|
3138
|
-
this.handle = this.props.handle || this.device.gl.createShader(
|
|
3020
|
+
this.handle = this.props.handle || this.device.gl.createShader(35632);
|
|
3139
3021
|
break;
|
|
3140
3022
|
default:
|
|
3141
3023
|
throw new Error(this.props.stage);
|
|
@@ -3171,7 +3053,7 @@ ${source2}`;
|
|
|
3171
3053
|
const { gl } = this.device;
|
|
3172
3054
|
gl.shaderSource(this.handle, source);
|
|
3173
3055
|
gl.compileShader(this.handle);
|
|
3174
|
-
if (
|
|
3056
|
+
if (import_core14.log.level === 0) {
|
|
3175
3057
|
this.compilationStatus = "pending";
|
|
3176
3058
|
return;
|
|
3177
3059
|
}
|
|
@@ -3183,9 +3065,9 @@ ${source2}`;
|
|
|
3183
3065
|
this.debugShader();
|
|
3184
3066
|
return;
|
|
3185
3067
|
}
|
|
3186
|
-
|
|
3068
|
+
import_core14.log.once(1, "Shader compilation is asynchronous")();
|
|
3187
3069
|
await this._waitForCompilationComplete();
|
|
3188
|
-
|
|
3070
|
+
import_core14.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
|
|
3189
3071
|
this._getCompilationStatus();
|
|
3190
3072
|
this.debugShader();
|
|
3191
3073
|
}
|
|
@@ -3199,7 +3081,7 @@ ${source2}`;
|
|
|
3199
3081
|
}
|
|
3200
3082
|
const { gl } = this.device;
|
|
3201
3083
|
for (; ; ) {
|
|
3202
|
-
const complete = gl.getShaderParameter(this.handle,
|
|
3084
|
+
const complete = gl.getShaderParameter(this.handle, 37297);
|
|
3203
3085
|
if (complete) {
|
|
3204
3086
|
return;
|
|
3205
3087
|
}
|
|
@@ -3212,18 +3094,18 @@ ${source2}`;
|
|
|
3212
3094
|
* https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings
|
|
3213
3095
|
*/
|
|
3214
3096
|
_getCompilationStatus() {
|
|
3215
|
-
this.compilationStatus = this.device.gl.getShaderParameter(this.handle,
|
|
3097
|
+
this.compilationStatus = this.device.gl.getShaderParameter(this.handle, 35713) ? "success" : "error";
|
|
3216
3098
|
}
|
|
3217
3099
|
};
|
|
3218
3100
|
|
|
3219
3101
|
// dist/adapter/resources/webgl-render-pass.js
|
|
3220
|
-
var
|
|
3221
|
-
var
|
|
3102
|
+
var import_core15 = require("@luma.gl/core");
|
|
3103
|
+
var import_constants14 = require("@luma.gl/constants");
|
|
3222
3104
|
var GL_DEPTH_BUFFER_BIT = 256;
|
|
3223
3105
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
3224
3106
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
3225
3107
|
var GL_COLOR = 6144;
|
|
3226
|
-
var WEBGLRenderPass = class extends
|
|
3108
|
+
var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
3227
3109
|
device;
|
|
3228
3110
|
/** Parameters that should be applied before each draw call */
|
|
3229
3111
|
glParameters;
|
|
@@ -3237,7 +3119,7 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
|
|
|
3237
3119
|
end() {
|
|
3238
3120
|
popContextState(this.device.gl);
|
|
3239
3121
|
if (this.props.framebuffer) {
|
|
3240
|
-
setGLParameters(this.device, { framebuffer: null });
|
|
3122
|
+
setGLParameters(this.device.gl, { framebuffer: null });
|
|
3241
3123
|
}
|
|
3242
3124
|
}
|
|
3243
3125
|
pushDebugGroup(groupLabel) {
|
|
@@ -3261,7 +3143,7 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
|
|
|
3261
3143
|
glParameters.depthMask = !this.props.depthReadOnly;
|
|
3262
3144
|
}
|
|
3263
3145
|
glParameters.stencilMask = this.props.stencilReadOnly ? 0 : 1;
|
|
3264
|
-
glParameters[
|
|
3146
|
+
glParameters[35977] = this.props.discard;
|
|
3265
3147
|
if (parameters.viewport) {
|
|
3266
3148
|
if (parameters.viewport.length >= 6) {
|
|
3267
3149
|
glParameters.viewport = parameters.viewport.slice(0, 4);
|
|
@@ -3279,10 +3161,10 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
|
|
|
3279
3161
|
}
|
|
3280
3162
|
if (parameters.stencilReference) {
|
|
3281
3163
|
console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
|
|
3282
|
-
parameters[
|
|
3164
|
+
parameters[2967] = parameters.stencilReference;
|
|
3283
3165
|
}
|
|
3284
3166
|
this.glParameters = glParameters;
|
|
3285
|
-
setGLParameters(this.device, glParameters);
|
|
3167
|
+
setGLParameters(this.device.gl, glParameters);
|
|
3286
3168
|
}
|
|
3287
3169
|
beginOcclusionQuery(queryIndex) {
|
|
3288
3170
|
const webglQuerySet = this.props.occlusionQuerySet;
|
|
@@ -3312,7 +3194,7 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
|
|
|
3312
3194
|
glParameters.clearStencil = this.props.clearStencil;
|
|
3313
3195
|
}
|
|
3314
3196
|
if (clearMask !== 0) {
|
|
3315
|
-
withGLParameters(this.device, glParameters, () => {
|
|
3197
|
+
withGLParameters(this.device.gl, glParameters, () => {
|
|
3316
3198
|
this.device.gl.clear(clearMask);
|
|
3317
3199
|
});
|
|
3318
3200
|
}
|
|
@@ -3339,39 +3221,39 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
|
|
|
3339
3221
|
};
|
|
3340
3222
|
|
|
3341
3223
|
// dist/adapter/resources/webgl-render-pipeline.js
|
|
3342
|
-
var
|
|
3343
|
-
var
|
|
3344
|
-
var
|
|
3224
|
+
var import_core17 = require("@luma.gl/core");
|
|
3225
|
+
var import_core18 = require("@luma.gl/core");
|
|
3226
|
+
var import_constants21 = require("@luma.gl/constants");
|
|
3345
3227
|
|
|
3346
3228
|
// dist/adapter/helpers/get-shader-layout.js
|
|
3347
|
-
var
|
|
3229
|
+
var import_constants18 = require("@luma.gl/constants");
|
|
3348
3230
|
|
|
3349
3231
|
// dist/classic/accessor.js
|
|
3350
|
-
var
|
|
3351
|
-
var
|
|
3232
|
+
var import_core16 = require("@luma.gl/core");
|
|
3233
|
+
var import_constants16 = require("@luma.gl/constants");
|
|
3352
3234
|
|
|
3353
3235
|
// dist/classic/typed-array-utils.js
|
|
3354
|
-
var
|
|
3236
|
+
var import_constants15 = require("@luma.gl/constants");
|
|
3355
3237
|
var ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
|
|
3356
3238
|
function getGLTypeFromTypedArray(arrayOrType) {
|
|
3357
3239
|
const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
3358
3240
|
switch (type) {
|
|
3359
3241
|
case Float32Array:
|
|
3360
|
-
return
|
|
3242
|
+
return 5126;
|
|
3361
3243
|
case Uint16Array:
|
|
3362
|
-
return
|
|
3244
|
+
return 5123;
|
|
3363
3245
|
case Uint32Array:
|
|
3364
|
-
return
|
|
3246
|
+
return 5125;
|
|
3365
3247
|
case Uint8Array:
|
|
3366
|
-
return
|
|
3248
|
+
return 5121;
|
|
3367
3249
|
case Uint8ClampedArray:
|
|
3368
|
-
return
|
|
3250
|
+
return 5121;
|
|
3369
3251
|
case Int8Array:
|
|
3370
|
-
return
|
|
3252
|
+
return 5120;
|
|
3371
3253
|
case Int16Array:
|
|
3372
|
-
return
|
|
3254
|
+
return 5122;
|
|
3373
3255
|
case Int32Array:
|
|
3374
|
-
return
|
|
3256
|
+
return 5124;
|
|
3375
3257
|
default:
|
|
3376
3258
|
throw new Error(ERR_TYPE_DEDUCTION);
|
|
3377
3259
|
}
|
|
@@ -3379,22 +3261,22 @@ function getGLTypeFromTypedArray(arrayOrType) {
|
|
|
3379
3261
|
function getTypedArrayFromGLType(glType, options) {
|
|
3380
3262
|
const { clamped = true } = options || {};
|
|
3381
3263
|
switch (glType) {
|
|
3382
|
-
case
|
|
3264
|
+
case 5126:
|
|
3383
3265
|
return Float32Array;
|
|
3384
|
-
case
|
|
3385
|
-
case
|
|
3386
|
-
case
|
|
3387
|
-
case
|
|
3266
|
+
case 5123:
|
|
3267
|
+
case 33635:
|
|
3268
|
+
case 32819:
|
|
3269
|
+
case 32820:
|
|
3388
3270
|
return Uint16Array;
|
|
3389
|
-
case
|
|
3271
|
+
case 5125:
|
|
3390
3272
|
return Uint32Array;
|
|
3391
|
-
case
|
|
3273
|
+
case 5121:
|
|
3392
3274
|
return clamped ? Uint8ClampedArray : Uint8Array;
|
|
3393
|
-
case
|
|
3275
|
+
case 5120:
|
|
3394
3276
|
return Int8Array;
|
|
3395
|
-
case
|
|
3277
|
+
case 5122:
|
|
3396
3278
|
return Int16Array;
|
|
3397
|
-
case
|
|
3279
|
+
case 5124:
|
|
3398
3280
|
return Int32Array;
|
|
3399
3281
|
default:
|
|
3400
3282
|
throw new Error("Failed to deduce typed array type from GL constant");
|
|
@@ -3405,7 +3287,7 @@ function getTypedArrayFromGLType(glType, options) {
|
|
|
3405
3287
|
var DEFAULT_ACCESSOR_VALUES = {
|
|
3406
3288
|
offset: 0,
|
|
3407
3289
|
stride: 0,
|
|
3408
|
-
type:
|
|
3290
|
+
type: 5126,
|
|
3409
3291
|
size: 1,
|
|
3410
3292
|
divisor: 0,
|
|
3411
3293
|
normalized: false,
|
|
@@ -3428,12 +3310,12 @@ var Accessor = class {
|
|
|
3428
3310
|
buffer;
|
|
3429
3311
|
index;
|
|
3430
3312
|
static getBytesPerElement(accessor) {
|
|
3431
|
-
const ArrayType = getTypedArrayFromGLType(accessor.type ||
|
|
3313
|
+
const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
|
|
3432
3314
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
3433
3315
|
}
|
|
3434
3316
|
static getBytesPerVertex(accessor) {
|
|
3435
|
-
(0,
|
|
3436
|
-
const ArrayType = getTypedArrayFromGLType(accessor.type ||
|
|
3317
|
+
(0, import_core16.assert)(accessor.size);
|
|
3318
|
+
const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
|
|
3437
3319
|
return ArrayType.BYTES_PER_ELEMENT * accessor.size;
|
|
3438
3320
|
}
|
|
3439
3321
|
// Combines (merges) a list of accessors. On top of default values
|
|
@@ -3461,10 +3343,10 @@ var Accessor = class {
|
|
|
3461
3343
|
// PRIVATE
|
|
3462
3344
|
// eslint-disable-next-line complexity, max-statements
|
|
3463
3345
|
_assign(props = {}) {
|
|
3464
|
-
props = (0,
|
|
3346
|
+
props = (0, import_core16.checkProps)("Accessor", props, PROP_CHECKS);
|
|
3465
3347
|
if (props.type !== void 0) {
|
|
3466
3348
|
this.type = props.type;
|
|
3467
|
-
if (props.type ===
|
|
3349
|
+
if (props.type === 5124 || props.type === 5125) {
|
|
3468
3350
|
this.integer = true;
|
|
3469
3351
|
}
|
|
3470
3352
|
}
|
|
@@ -3528,62 +3410,62 @@ var Accessor = class {
|
|
|
3528
3410
|
};
|
|
3529
3411
|
|
|
3530
3412
|
// dist/adapter/helpers/decode-webgl-types.js
|
|
3531
|
-
var
|
|
3413
|
+
var import_constants17 = require("@luma.gl/constants");
|
|
3532
3414
|
function isSamplerUniform(type) {
|
|
3533
3415
|
return SAMPLER_TYPES.includes(type);
|
|
3534
3416
|
}
|
|
3535
3417
|
var SAMPLER_TYPES = [
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3418
|
+
35678,
|
|
3419
|
+
35680,
|
|
3420
|
+
35679,
|
|
3421
|
+
35682,
|
|
3422
|
+
36289,
|
|
3423
|
+
36292,
|
|
3424
|
+
36293,
|
|
3425
|
+
36298,
|
|
3426
|
+
36299,
|
|
3427
|
+
36300,
|
|
3428
|
+
36303,
|
|
3429
|
+
36306,
|
|
3430
|
+
36307,
|
|
3431
|
+
36308,
|
|
3432
|
+
36311
|
|
3551
3433
|
];
|
|
3552
3434
|
var COMPOSITE_GL_TYPES = {
|
|
3553
|
-
[
|
|
3554
|
-
[
|
|
3555
|
-
[
|
|
3556
|
-
[
|
|
3557
|
-
[
|
|
3558
|
-
[
|
|
3559
|
-
[
|
|
3560
|
-
[
|
|
3561
|
-
[
|
|
3562
|
-
[
|
|
3563
|
-
[
|
|
3564
|
-
[
|
|
3565
|
-
[
|
|
3566
|
-
[
|
|
3567
|
-
[
|
|
3568
|
-
[
|
|
3435
|
+
[5126]: [5126, 1, "float", "f32", "float32"],
|
|
3436
|
+
[35664]: [5126, 2, "vec2", "vec2<f32>", "float32x2"],
|
|
3437
|
+
[35665]: [5126, 3, "vec3", "vec3<f32>", "float32x3"],
|
|
3438
|
+
[35666]: [5126, 4, "vec4", "vec4<f32>", "float32x4"],
|
|
3439
|
+
[5124]: [5124, 1, "int", "i32", "sint32"],
|
|
3440
|
+
[35667]: [5124, 2, "ivec2", "vec2<i32>", "sint32x2"],
|
|
3441
|
+
[35668]: [5124, 3, "ivec3", "vec3<i32>", "sint32x3"],
|
|
3442
|
+
[35669]: [5124, 4, "ivec4", "vec4<i32>", "sint32x4"],
|
|
3443
|
+
[5125]: [5125, 1, "uint", "u32", "uint32"],
|
|
3444
|
+
[36294]: [5125, 2, "uvec2", "vec2<u32>", "uint32x2"],
|
|
3445
|
+
[36295]: [5125, 3, "uvec3", "vec3<u32>", "uint32x3"],
|
|
3446
|
+
[36296]: [5125, 4, "uvec4", "vec4<u32>", "uint32x4"],
|
|
3447
|
+
[35670]: [5126, 1, "bool", "f32", "float32"],
|
|
3448
|
+
[35671]: [5126, 2, "bvec2", "vec2<f32>", "float32x2"],
|
|
3449
|
+
[35672]: [5126, 3, "bvec3", "vec3<f32>", "float32x3"],
|
|
3450
|
+
[35673]: [5126, 4, "bvec4", "vec4<f32>", "float32x4"],
|
|
3569
3451
|
// TODO - are sizes/components below correct?
|
|
3570
|
-
[
|
|
3452
|
+
[35674]: [5126, 8, "mat2", "mat2x2<f32>"],
|
|
3571
3453
|
// 4
|
|
3572
|
-
[
|
|
3454
|
+
[35685]: [5126, 8, "mat2x3", "mat2x3<f32>"],
|
|
3573
3455
|
// 6
|
|
3574
|
-
[
|
|
3456
|
+
[35686]: [5126, 8, "mat2x4", "mat2x4<f32>"],
|
|
3575
3457
|
// 8
|
|
3576
|
-
[
|
|
3458
|
+
[35687]: [5126, 12, "mat3x2", "mat3x2<f32>"],
|
|
3577
3459
|
// 6
|
|
3578
|
-
[
|
|
3460
|
+
[35675]: [5126, 12, "mat3", "mat3x3<f32>"],
|
|
3579
3461
|
// 9
|
|
3580
|
-
[
|
|
3462
|
+
[35688]: [5126, 12, "mat3x4", "mat3x4<f32>"],
|
|
3581
3463
|
// 12
|
|
3582
|
-
[
|
|
3464
|
+
[35689]: [5126, 16, "mat4x2", "mat4x2<f32>"],
|
|
3583
3465
|
// 8
|
|
3584
|
-
[
|
|
3466
|
+
[35690]: [5126, 16, "mat4x3", "mat4x3<f32>"],
|
|
3585
3467
|
// 12
|
|
3586
|
-
[
|
|
3468
|
+
[35676]: [5126, 16, "mat4", "mat4x4<f32>"]
|
|
3587
3469
|
// 16
|
|
3588
3470
|
};
|
|
3589
3471
|
function decodeGLUniformType(glUniformType) {
|
|
@@ -3656,7 +3538,7 @@ function getShaderLayout(gl, program) {
|
|
|
3656
3538
|
}
|
|
3657
3539
|
function readAttributeDeclarations(gl, program) {
|
|
3658
3540
|
const attributes = [];
|
|
3659
|
-
const count = gl.getProgramParameter(program,
|
|
3541
|
+
const count = gl.getProgramParameter(program, 35721);
|
|
3660
3542
|
for (let index = 0; index < count; index++) {
|
|
3661
3543
|
const activeInfo = gl.getActiveAttrib(program, index);
|
|
3662
3544
|
if (!activeInfo) {
|
|
@@ -3685,7 +3567,7 @@ function readAttributeDeclarations(gl, program) {
|
|
|
3685
3567
|
}
|
|
3686
3568
|
function readVaryings(gl, program) {
|
|
3687
3569
|
const varyings = [];
|
|
3688
|
-
const count = gl.getProgramParameter(program,
|
|
3570
|
+
const count = gl.getProgramParameter(program, 35971);
|
|
3689
3571
|
for (let location = 0; location < count; location++) {
|
|
3690
3572
|
const activeInfo = gl.getTransformFeedbackVarying(program, location);
|
|
3691
3573
|
if (!activeInfo) {
|
|
@@ -3702,7 +3584,7 @@ function readVaryings(gl, program) {
|
|
|
3702
3584
|
}
|
|
3703
3585
|
function readUniformBindings(gl, program) {
|
|
3704
3586
|
const uniforms = [];
|
|
3705
|
-
const uniformCount = gl.getProgramParameter(program,
|
|
3587
|
+
const uniformCount = gl.getProgramParameter(program, 35718);
|
|
3706
3588
|
for (let i = 0; i < uniformCount; i++) {
|
|
3707
3589
|
const activeInfo = gl.getActiveUniform(program, i);
|
|
3708
3590
|
if (!activeInfo) {
|
|
@@ -3738,22 +3620,22 @@ function readUniformBindings(gl, program) {
|
|
|
3738
3620
|
function readUniformBlocks(gl, program) {
|
|
3739
3621
|
const getBlockParameter = (blockIndex, pname) => gl.getActiveUniformBlockParameter(program, blockIndex, pname);
|
|
3740
3622
|
const uniformBlocks = [];
|
|
3741
|
-
const blockCount = gl.getProgramParameter(program,
|
|
3623
|
+
const blockCount = gl.getProgramParameter(program, 35382);
|
|
3742
3624
|
for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
|
|
3743
3625
|
const blockInfo = {
|
|
3744
3626
|
name: gl.getActiveUniformBlockName(program, blockIndex) || "",
|
|
3745
|
-
location: getBlockParameter(blockIndex,
|
|
3746
|
-
byteLength: getBlockParameter(blockIndex,
|
|
3747
|
-
vertex: getBlockParameter(blockIndex,
|
|
3748
|
-
fragment: getBlockParameter(blockIndex,
|
|
3749
|
-
uniformCount: getBlockParameter(blockIndex,
|
|
3627
|
+
location: getBlockParameter(blockIndex, 35391),
|
|
3628
|
+
byteLength: getBlockParameter(blockIndex, 35392),
|
|
3629
|
+
vertex: getBlockParameter(blockIndex, 35396),
|
|
3630
|
+
fragment: getBlockParameter(blockIndex, 35398),
|
|
3631
|
+
uniformCount: getBlockParameter(blockIndex, 35394),
|
|
3750
3632
|
uniforms: []
|
|
3751
3633
|
};
|
|
3752
|
-
const uniformIndices = getBlockParameter(blockIndex,
|
|
3753
|
-
const uniformType = gl.getActiveUniforms(program, uniformIndices,
|
|
3754
|
-
const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices,
|
|
3755
|
-
const uniformOffset = gl.getActiveUniforms(program, uniformIndices,
|
|
3756
|
-
const uniformStride = gl.getActiveUniforms(program, uniformIndices,
|
|
3634
|
+
const uniformIndices = getBlockParameter(blockIndex, 35395) || [];
|
|
3635
|
+
const uniformType = gl.getActiveUniforms(program, uniformIndices, 35383);
|
|
3636
|
+
const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices, 35384);
|
|
3637
|
+
const uniformOffset = gl.getActiveUniforms(program, uniformIndices, 35387);
|
|
3638
|
+
const uniformStride = gl.getActiveUniforms(program, uniformIndices, 35388);
|
|
3757
3639
|
for (let i = 0; i < blockInfo.uniformCount; ++i) {
|
|
3758
3640
|
const activeInfo = gl.getActiveUniform(program, uniformIndices[i]);
|
|
3759
3641
|
if (!activeInfo) {
|
|
@@ -3776,21 +3658,21 @@ function readUniformBlocks(gl, program) {
|
|
|
3776
3658
|
return uniformBlocks;
|
|
3777
3659
|
}
|
|
3778
3660
|
var SAMPLER_UNIFORMS_GL_TO_GPU = {
|
|
3779
|
-
[
|
|
3780
|
-
[
|
|
3781
|
-
[
|
|
3782
|
-
[
|
|
3783
|
-
[
|
|
3784
|
-
[
|
|
3785
|
-
[
|
|
3786
|
-
[
|
|
3787
|
-
[
|
|
3788
|
-
[
|
|
3789
|
-
[
|
|
3790
|
-
[
|
|
3791
|
-
[
|
|
3792
|
-
[
|
|
3793
|
-
[
|
|
3661
|
+
[35678]: ["2d", "float"],
|
|
3662
|
+
[35680]: ["cube", "float"],
|
|
3663
|
+
[35679]: ["3d", "float"],
|
|
3664
|
+
[35682]: ["3d", "depth"],
|
|
3665
|
+
[36289]: ["2d-array", "float"],
|
|
3666
|
+
[36292]: ["2d-array", "depth"],
|
|
3667
|
+
[36293]: ["cube", "float"],
|
|
3668
|
+
[36298]: ["2d", "sint"],
|
|
3669
|
+
[36299]: ["3d", "sint"],
|
|
3670
|
+
[36300]: ["cube", "sint"],
|
|
3671
|
+
[36303]: ["2d-array", "uint"],
|
|
3672
|
+
[36306]: ["2d", "uint"],
|
|
3673
|
+
[36307]: ["3d", "uint"],
|
|
3674
|
+
[36308]: ["cube", "uint"],
|
|
3675
|
+
[36311]: ["2d-array", "uint"]
|
|
3794
3676
|
};
|
|
3795
3677
|
function getSamplerInfo(type) {
|
|
3796
3678
|
const sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
|
|
@@ -3821,7 +3703,7 @@ function parseUniformName(name) {
|
|
|
3821
3703
|
}
|
|
3822
3704
|
|
|
3823
3705
|
// dist/adapter/helpers/set-uniform.js
|
|
3824
|
-
var
|
|
3706
|
+
var import_constants19 = require("@luma.gl/constants");
|
|
3825
3707
|
function setUniform(gl, location, type, value) {
|
|
3826
3708
|
const gl2 = gl;
|
|
3827
3709
|
let uniformValue = value;
|
|
@@ -3833,97 +3715,97 @@ function setUniform(gl, location, type, value) {
|
|
|
3833
3715
|
}
|
|
3834
3716
|
const arrayValue = typeof uniformValue === "number" ? [uniformValue] : uniformValue;
|
|
3835
3717
|
switch (type) {
|
|
3836
|
-
case
|
|
3837
|
-
case
|
|
3838
|
-
case
|
|
3839
|
-
case
|
|
3840
|
-
case
|
|
3841
|
-
case
|
|
3842
|
-
case
|
|
3843
|
-
case
|
|
3844
|
-
case
|
|
3845
|
-
case
|
|
3846
|
-
case
|
|
3847
|
-
case
|
|
3848
|
-
case
|
|
3849
|
-
case
|
|
3850
|
-
case
|
|
3718
|
+
case 35678:
|
|
3719
|
+
case 35680:
|
|
3720
|
+
case 35679:
|
|
3721
|
+
case 35682:
|
|
3722
|
+
case 36289:
|
|
3723
|
+
case 36292:
|
|
3724
|
+
case 36293:
|
|
3725
|
+
case 36298:
|
|
3726
|
+
case 36299:
|
|
3727
|
+
case 36300:
|
|
3728
|
+
case 36303:
|
|
3729
|
+
case 36306:
|
|
3730
|
+
case 36307:
|
|
3731
|
+
case 36308:
|
|
3732
|
+
case 36311:
|
|
3851
3733
|
if (typeof value !== "number") {
|
|
3852
3734
|
throw new Error("samplers must be set to integers");
|
|
3853
3735
|
}
|
|
3854
3736
|
return gl.uniform1i(location, value);
|
|
3855
|
-
case
|
|
3737
|
+
case 5126:
|
|
3856
3738
|
return gl.uniform1fv(location, arrayValue);
|
|
3857
|
-
case
|
|
3739
|
+
case 35664:
|
|
3858
3740
|
return gl.uniform2fv(location, arrayValue);
|
|
3859
|
-
case
|
|
3741
|
+
case 35665:
|
|
3860
3742
|
return gl.uniform3fv(location, arrayValue);
|
|
3861
|
-
case
|
|
3743
|
+
case 35666:
|
|
3862
3744
|
return gl.uniform4fv(location, arrayValue);
|
|
3863
|
-
case
|
|
3745
|
+
case 5124:
|
|
3864
3746
|
return gl.uniform1iv(location, arrayValue);
|
|
3865
|
-
case
|
|
3747
|
+
case 35667:
|
|
3866
3748
|
return gl.uniform2iv(location, arrayValue);
|
|
3867
|
-
case
|
|
3749
|
+
case 35668:
|
|
3868
3750
|
return gl.uniform3iv(location, arrayValue);
|
|
3869
|
-
case
|
|
3751
|
+
case 35669:
|
|
3870
3752
|
return gl.uniform4iv(location, arrayValue);
|
|
3871
|
-
case
|
|
3753
|
+
case 35670:
|
|
3872
3754
|
return gl.uniform1iv(location, arrayValue);
|
|
3873
|
-
case
|
|
3755
|
+
case 35671:
|
|
3874
3756
|
return gl.uniform2iv(location, arrayValue);
|
|
3875
|
-
case
|
|
3757
|
+
case 35672:
|
|
3876
3758
|
return gl.uniform3iv(location, arrayValue);
|
|
3877
|
-
case
|
|
3759
|
+
case 35673:
|
|
3878
3760
|
return gl.uniform4iv(location, arrayValue);
|
|
3879
|
-
case
|
|
3761
|
+
case 5125:
|
|
3880
3762
|
return gl2.uniform1uiv(location, arrayValue, 1);
|
|
3881
|
-
case
|
|
3763
|
+
case 36294:
|
|
3882
3764
|
return gl2.uniform2uiv(location, arrayValue, 2);
|
|
3883
|
-
case
|
|
3765
|
+
case 36295:
|
|
3884
3766
|
return gl2.uniform3uiv(location, arrayValue, 3);
|
|
3885
|
-
case
|
|
3767
|
+
case 36296:
|
|
3886
3768
|
return gl2.uniform4uiv(location, arrayValue, 4);
|
|
3887
|
-
case
|
|
3769
|
+
case 35674:
|
|
3888
3770
|
return gl.uniformMatrix2fv(location, false, arrayValue);
|
|
3889
|
-
case
|
|
3771
|
+
case 35675:
|
|
3890
3772
|
return gl.uniformMatrix3fv(location, false, arrayValue);
|
|
3891
|
-
case
|
|
3773
|
+
case 35676:
|
|
3892
3774
|
return gl.uniformMatrix4fv(location, false, arrayValue);
|
|
3893
|
-
case
|
|
3775
|
+
case 35685:
|
|
3894
3776
|
return gl2.uniformMatrix2x3fv(location, false, arrayValue);
|
|
3895
|
-
case
|
|
3777
|
+
case 35686:
|
|
3896
3778
|
return gl2.uniformMatrix2x4fv(location, false, arrayValue);
|
|
3897
|
-
case
|
|
3779
|
+
case 35687:
|
|
3898
3780
|
return gl2.uniformMatrix3x2fv(location, false, arrayValue);
|
|
3899
|
-
case
|
|
3781
|
+
case 35688:
|
|
3900
3782
|
return gl2.uniformMatrix3x4fv(location, false, arrayValue);
|
|
3901
|
-
case
|
|
3783
|
+
case 35689:
|
|
3902
3784
|
return gl2.uniformMatrix4x2fv(location, false, arrayValue);
|
|
3903
|
-
case
|
|
3785
|
+
case 35690:
|
|
3904
3786
|
return gl2.uniformMatrix4x3fv(location, false, arrayValue);
|
|
3905
3787
|
}
|
|
3906
3788
|
throw new Error("Illegal uniform");
|
|
3907
3789
|
}
|
|
3908
3790
|
|
|
3909
3791
|
// dist/adapter/helpers/webgl-topology-utils.js
|
|
3910
|
-
var
|
|
3792
|
+
var import_constants20 = require("@luma.gl/constants");
|
|
3911
3793
|
function getGLDrawMode(topology) {
|
|
3912
3794
|
switch (topology) {
|
|
3913
3795
|
case "point-list":
|
|
3914
|
-
return
|
|
3796
|
+
return 0;
|
|
3915
3797
|
case "line-list":
|
|
3916
|
-
return
|
|
3798
|
+
return 1;
|
|
3917
3799
|
case "line-strip":
|
|
3918
|
-
return
|
|
3800
|
+
return 3;
|
|
3919
3801
|
case "line-loop-webgl":
|
|
3920
|
-
return
|
|
3802
|
+
return 2;
|
|
3921
3803
|
case "triangle-list":
|
|
3922
|
-
return
|
|
3804
|
+
return 4;
|
|
3923
3805
|
case "triangle-strip":
|
|
3924
|
-
return
|
|
3806
|
+
return 5;
|
|
3925
3807
|
case "triangle-fan-webgl":
|
|
3926
|
-
return
|
|
3808
|
+
return 6;
|
|
3927
3809
|
default:
|
|
3928
3810
|
throw new Error(topology);
|
|
3929
3811
|
}
|
|
@@ -3931,19 +3813,19 @@ function getGLDrawMode(topology) {
|
|
|
3931
3813
|
function getGLPrimitive(topology) {
|
|
3932
3814
|
switch (topology) {
|
|
3933
3815
|
case "point-list":
|
|
3934
|
-
return
|
|
3816
|
+
return 0;
|
|
3935
3817
|
case "line-list":
|
|
3936
|
-
return
|
|
3818
|
+
return 1;
|
|
3937
3819
|
case "line-strip":
|
|
3938
|
-
return
|
|
3820
|
+
return 1;
|
|
3939
3821
|
case "line-loop-webgl":
|
|
3940
|
-
return
|
|
3822
|
+
return 1;
|
|
3941
3823
|
case "triangle-list":
|
|
3942
|
-
return
|
|
3824
|
+
return 4;
|
|
3943
3825
|
case "triangle-strip":
|
|
3944
|
-
return
|
|
3826
|
+
return 4;
|
|
3945
3827
|
case "triangle-fan-webgl":
|
|
3946
|
-
return
|
|
3828
|
+
return 4;
|
|
3947
3829
|
default:
|
|
3948
3830
|
throw new Error(topology);
|
|
3949
3831
|
}
|
|
@@ -3951,7 +3833,7 @@ function getGLPrimitive(topology) {
|
|
|
3951
3833
|
|
|
3952
3834
|
// dist/adapter/resources/webgl-render-pipeline.js
|
|
3953
3835
|
var LOG_PROGRAM_PERF_PRIORITY = 4;
|
|
3954
|
-
var WEBGLRenderPipeline = class extends
|
|
3836
|
+
var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
3955
3837
|
/** The WebGL device that created this render pipeline */
|
|
3956
3838
|
device;
|
|
3957
3839
|
/** Handle to underlying WebGL program */
|
|
@@ -3976,22 +3858,22 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
3976
3858
|
this.device = device;
|
|
3977
3859
|
this.handle = this.props.handle || this.device.gl.createProgram();
|
|
3978
3860
|
this.device.setSpectorMetadata(this.handle, { id: this.props.id });
|
|
3979
|
-
this.vs = (0,
|
|
3980
|
-
this.fs = (0,
|
|
3981
|
-
const { varyings, bufferMode =
|
|
3861
|
+
this.vs = (0, import_core17.cast)(props.vs);
|
|
3862
|
+
this.fs = (0, import_core17.cast)(props.fs);
|
|
3863
|
+
const { varyings, bufferMode = 35981 } = props;
|
|
3982
3864
|
if (varyings && varyings.length > 0) {
|
|
3983
3865
|
this.varyings = varyings;
|
|
3984
3866
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
3985
3867
|
}
|
|
3986
3868
|
this._linkShaders();
|
|
3987
|
-
|
|
3869
|
+
import_core17.log.time(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3988
3870
|
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
3989
|
-
|
|
3990
|
-
this.shaderLayout = (0,
|
|
3871
|
+
import_core17.log.timeEnd(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3872
|
+
this.shaderLayout = (0, import_core18.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
|
|
3991
3873
|
switch (this.props.topology) {
|
|
3992
3874
|
case "triangle-fan-webgl":
|
|
3993
3875
|
case "line-loop-webgl":
|
|
3994
|
-
|
|
3876
|
+
import_core17.log.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);
|
|
3995
3877
|
break;
|
|
3996
3878
|
default:
|
|
3997
3879
|
}
|
|
@@ -4011,11 +3893,11 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4011
3893
|
const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
|
|
4012
3894
|
if (!binding) {
|
|
4013
3895
|
const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
|
|
4014
|
-
|
|
3896
|
+
import_core17.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
|
|
4015
3897
|
continue;
|
|
4016
3898
|
}
|
|
4017
3899
|
if (!value) {
|
|
4018
|
-
|
|
3900
|
+
import_core17.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
|
|
4019
3901
|
}
|
|
4020
3902
|
switch (binding.type) {
|
|
4021
3903
|
case "uniform":
|
|
@@ -4029,7 +3911,7 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4029
3911
|
}
|
|
4030
3912
|
break;
|
|
4031
3913
|
case "sampler":
|
|
4032
|
-
|
|
3914
|
+
import_core17.log.warn(`Ignoring sampler ${name}`)();
|
|
4033
3915
|
break;
|
|
4034
3916
|
default:
|
|
4035
3917
|
throw new Error(binding.type);
|
|
@@ -4043,9 +3925,6 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4043
3925
|
*/
|
|
4044
3926
|
draw(options) {
|
|
4045
3927
|
var _a;
|
|
4046
|
-
if (this.linkStatus !== "success") {
|
|
4047
|
-
return false;
|
|
4048
|
-
}
|
|
4049
3928
|
const {
|
|
4050
3929
|
renderPass,
|
|
4051
3930
|
vertexArray,
|
|
@@ -4062,9 +3941,18 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4062
3941
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
4063
3942
|
const glIndexType = (_a = vertexArray.indexBuffer) == null ? void 0 : _a.glIndexType;
|
|
4064
3943
|
const isInstanced = Number(instanceCount) > 0;
|
|
3944
|
+
if (this.linkStatus !== "success") {
|
|
3945
|
+
import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
|
|
3946
|
+
return false;
|
|
3947
|
+
}
|
|
4065
3948
|
if (!this._areTexturesRenderable() || vertexCount === 0) {
|
|
3949
|
+
import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
|
|
4066
3950
|
return false;
|
|
4067
3951
|
}
|
|
3952
|
+
if (vertexCount === 0) {
|
|
3953
|
+
import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)();
|
|
3954
|
+
return true;
|
|
3955
|
+
}
|
|
4068
3956
|
this.device.gl.useProgram(this.handle);
|
|
4069
3957
|
vertexArray.bindBeforeRender(renderPass);
|
|
4070
3958
|
if (transformFeedback) {
|
|
@@ -4099,9 +3987,9 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4099
3987
|
}
|
|
4100
3988
|
// DEPRECATED METHODS
|
|
4101
3989
|
setUniformsWebGL(uniforms) {
|
|
4102
|
-
const { bindings } = (0,
|
|
3990
|
+
const { bindings } = (0, import_core17.splitUniformsAndBindings)(uniforms);
|
|
4103
3991
|
Object.keys(bindings).forEach((name) => {
|
|
4104
|
-
|
|
3992
|
+
import_core17.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
|
|
4105
3993
|
});
|
|
4106
3994
|
Object.assign(this.uniforms, uniforms);
|
|
4107
3995
|
}
|
|
@@ -4112,19 +4000,19 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4112
4000
|
const { gl } = this.device;
|
|
4113
4001
|
gl.attachShader(this.handle, this.vs.handle);
|
|
4114
4002
|
gl.attachShader(this.handle, this.fs.handle);
|
|
4115
|
-
|
|
4003
|
+
import_core17.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
4116
4004
|
gl.linkProgram(this.handle);
|
|
4117
|
-
|
|
4118
|
-
if (
|
|
4005
|
+
import_core17.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
4006
|
+
if (import_core17.log.level === 0) {
|
|
4119
4007
|
}
|
|
4120
4008
|
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
4121
4009
|
const status2 = this._getLinkStatus();
|
|
4122
4010
|
this._reportLinkStatus(status2);
|
|
4123
4011
|
return;
|
|
4124
4012
|
}
|
|
4125
|
-
|
|
4013
|
+
import_core17.log.once(1, "RenderPipeline linking is asynchronous")();
|
|
4126
4014
|
await this._waitForLinkComplete();
|
|
4127
|
-
|
|
4015
|
+
import_core17.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
|
|
4128
4016
|
const status = this._getLinkStatus();
|
|
4129
4017
|
this._reportLinkStatus(status);
|
|
4130
4018
|
}
|
|
@@ -4153,13 +4041,13 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4153
4041
|
*/
|
|
4154
4042
|
_getLinkStatus() {
|
|
4155
4043
|
const { gl } = this.device;
|
|
4156
|
-
const linked = gl.getProgramParameter(this.handle,
|
|
4044
|
+
const linked = gl.getProgramParameter(this.handle, 35714);
|
|
4157
4045
|
if (!linked) {
|
|
4158
4046
|
this.linkStatus = "error";
|
|
4159
4047
|
return "linking";
|
|
4160
4048
|
}
|
|
4161
4049
|
gl.validateProgram(this.handle);
|
|
4162
|
-
const validated = gl.getProgramParameter(this.handle,
|
|
4050
|
+
const validated = gl.getProgramParameter(this.handle, 35715);
|
|
4163
4051
|
if (!validated) {
|
|
4164
4052
|
this.linkStatus = "error";
|
|
4165
4053
|
return "validation";
|
|
@@ -4177,7 +4065,7 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4177
4065
|
}
|
|
4178
4066
|
const { gl } = this.device;
|
|
4179
4067
|
for (; ; ) {
|
|
4180
|
-
const complete = gl.getProgramParameter(this.handle,
|
|
4068
|
+
const complete = gl.getProgramParameter(this.handle, 37297);
|
|
4181
4069
|
if (complete) {
|
|
4182
4070
|
return;
|
|
4183
4071
|
}
|
|
@@ -4217,15 +4105,15 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4217
4105
|
case "uniform":
|
|
4218
4106
|
const { name } = binding;
|
|
4219
4107
|
const location = gl.getUniformBlockIndex(this.handle, name);
|
|
4220
|
-
if (location ===
|
|
4108
|
+
if (location === 4294967295) {
|
|
4221
4109
|
throw new Error(`Invalid uniform block name ${name}`);
|
|
4222
4110
|
}
|
|
4223
4111
|
gl.uniformBlockBinding(this.handle, uniformBufferIndex, location);
|
|
4224
4112
|
if (value instanceof WEBGLBuffer) {
|
|
4225
|
-
gl.bindBufferBase(
|
|
4113
|
+
gl.bindBufferBase(35345, uniformBufferIndex, value.handle);
|
|
4226
4114
|
} else {
|
|
4227
4115
|
gl.bindBufferRange(
|
|
4228
|
-
|
|
4116
|
+
35345,
|
|
4229
4117
|
uniformBufferIndex,
|
|
4230
4118
|
// @ts-expect-error
|
|
4231
4119
|
value.buffer.handle,
|
|
@@ -4247,12 +4135,12 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4247
4135
|
} else if (value instanceof WEBGLTexture) {
|
|
4248
4136
|
texture = value;
|
|
4249
4137
|
} else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTexture) {
|
|
4250
|
-
|
|
4138
|
+
import_core17.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
|
|
4251
4139
|
texture = value.colorAttachments[0];
|
|
4252
4140
|
} else {
|
|
4253
4141
|
throw new Error("No texture");
|
|
4254
4142
|
}
|
|
4255
|
-
gl.activeTexture(
|
|
4143
|
+
gl.activeTexture(33984 + textureUnit);
|
|
4256
4144
|
gl.bindTexture(texture.target, texture.handle);
|
|
4257
4145
|
textureUnit += 1;
|
|
4258
4146
|
break;
|
|
@@ -4280,15 +4168,15 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
|
4280
4168
|
};
|
|
4281
4169
|
|
|
4282
4170
|
// dist/adapter/resources/webgl-command-encoder.js
|
|
4283
|
-
var
|
|
4171
|
+
var import_core20 = require("@luma.gl/core");
|
|
4284
4172
|
|
|
4285
4173
|
// dist/adapter/resources/webgl-command-buffer.js
|
|
4286
|
-
var
|
|
4287
|
-
var
|
|
4174
|
+
var import_core19 = require("@luma.gl/core");
|
|
4175
|
+
var import_constants22 = require("@luma.gl/constants");
|
|
4288
4176
|
function cast2(value) {
|
|
4289
4177
|
return value;
|
|
4290
4178
|
}
|
|
4291
|
-
var WEBGLCommandBuffer = class extends
|
|
4179
|
+
var WEBGLCommandBuffer = class extends import_core19.CommandBuffer {
|
|
4292
4180
|
device;
|
|
4293
4181
|
commands = [];
|
|
4294
4182
|
constructor(device) {
|
|
@@ -4317,11 +4205,11 @@ var WEBGLCommandBuffer = class extends import_core21.CommandBuffer {
|
|
|
4317
4205
|
function _copyBufferToBuffer(device, options) {
|
|
4318
4206
|
const source = cast2(options.source);
|
|
4319
4207
|
const destination = cast2(options.destination);
|
|
4320
|
-
device.gl.bindBuffer(
|
|
4321
|
-
device.gl.bindBuffer(
|
|
4322
|
-
device.gl.copyBufferSubData(
|
|
4323
|
-
device.gl.bindBuffer(
|
|
4324
|
-
device.gl.bindBuffer(
|
|
4208
|
+
device.gl.bindBuffer(36662, source.handle);
|
|
4209
|
+
device.gl.bindBuffer(36663, destination.handle);
|
|
4210
|
+
device.gl.copyBufferSubData(36662, 36663, options.sourceOffset ?? 0, options.destinationOffset ?? 0, options.size);
|
|
4211
|
+
device.gl.bindBuffer(36662, null);
|
|
4212
|
+
device.gl.bindBuffer(36663, null);
|
|
4325
4213
|
}
|
|
4326
4214
|
function _copyBufferToTexture(device, options) {
|
|
4327
4215
|
throw new Error("Not implemented");
|
|
@@ -4371,12 +4259,12 @@ function _copyTextureToBuffer(device, options) {
|
|
|
4371
4259
|
const sourceParams = getWebGLTextureParameters(framebuffer.texture.props.format);
|
|
4372
4260
|
const sourceFormat = sourceParams.dataFormat;
|
|
4373
4261
|
const sourceType = sourceParams.type;
|
|
4374
|
-
device.gl.bindBuffer(
|
|
4375
|
-
device.gl.bindFramebuffer(
|
|
4262
|
+
device.gl.bindBuffer(35051, webglBuffer.handle);
|
|
4263
|
+
device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
4376
4264
|
device.gl.readPixels(origin[0], origin[1], sourceWidth, sourceHeight, sourceFormat, sourceType, byteOffset);
|
|
4377
4265
|
} finally {
|
|
4378
|
-
device.gl.bindBuffer(
|
|
4379
|
-
device.gl.bindFramebuffer(
|
|
4266
|
+
device.gl.bindBuffer(35051, null);
|
|
4267
|
+
device.gl.bindFramebuffer(36160, null);
|
|
4380
4268
|
if (destroyFramebuffer) {
|
|
4381
4269
|
framebuffer.destroy();
|
|
4382
4270
|
}
|
|
@@ -4407,11 +4295,11 @@ function _copyTextureToTexture(device, options) {
|
|
|
4407
4295
|
// depthOrArrayLayers = 0
|
|
4408
4296
|
} = options;
|
|
4409
4297
|
const destinationMipmaplevel = 0;
|
|
4410
|
-
const destinationInternalFormat =
|
|
4298
|
+
const destinationInternalFormat = 6408;
|
|
4411
4299
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
4412
4300
|
const [sourceX, sourceY] = origin;
|
|
4413
4301
|
const isSubCopy = false;
|
|
4414
|
-
device.gl.bindFramebuffer(
|
|
4302
|
+
device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
4415
4303
|
let texture = null;
|
|
4416
4304
|
let textureTarget;
|
|
4417
4305
|
if (destination instanceof WEBGLTexture) {
|
|
@@ -4446,7 +4334,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
4446
4334
|
return texture;
|
|
4447
4335
|
}
|
|
4448
4336
|
function getFramebuffer(source) {
|
|
4449
|
-
if (source instanceof
|
|
4337
|
+
if (source instanceof import_core19.Texture) {
|
|
4450
4338
|
const { width, height, id } = source;
|
|
4451
4339
|
const framebuffer = source.device.createFramebuffer({
|
|
4452
4340
|
id: `framebuffer-for-${id}`,
|
|
@@ -4460,7 +4348,7 @@ function getFramebuffer(source) {
|
|
|
4460
4348
|
}
|
|
4461
4349
|
|
|
4462
4350
|
// dist/adapter/resources/webgl-command-encoder.js
|
|
4463
|
-
var WEBGLCommandEncoder = class extends
|
|
4351
|
+
var WEBGLCommandEncoder = class extends import_core20.CommandEncoder {
|
|
4464
4352
|
device;
|
|
4465
4353
|
commandBuffer;
|
|
4466
4354
|
constructor(device, props) {
|
|
@@ -4499,10 +4387,10 @@ var WEBGLCommandEncoder = class extends import_core22.CommandEncoder {
|
|
|
4499
4387
|
};
|
|
4500
4388
|
|
|
4501
4389
|
// dist/adapter/resources/webgl-vertex-array.js
|
|
4502
|
-
var
|
|
4503
|
-
var
|
|
4390
|
+
var import_core21 = require("@luma.gl/core");
|
|
4391
|
+
var import_constants23 = require("@luma.gl/constants");
|
|
4504
4392
|
var import_env2 = require("@probe.gl/env");
|
|
4505
|
-
var WEBGLVertexArray = class extends
|
|
4393
|
+
var WEBGLVertexArray = class extends import_core21.VertexArray {
|
|
4506
4394
|
get [Symbol.toStringTag]() {
|
|
4507
4395
|
return "VertexArray";
|
|
4508
4396
|
}
|
|
@@ -4540,22 +4428,22 @@ var WEBGLVertexArray = class extends import_core23.VertexArray {
|
|
|
4540
4428
|
*/
|
|
4541
4429
|
setIndexBuffer(indexBuffer) {
|
|
4542
4430
|
const buffer = indexBuffer;
|
|
4543
|
-
if (buffer && buffer.glTarget !==
|
|
4431
|
+
if (buffer && buffer.glTarget !== 34963) {
|
|
4544
4432
|
throw new Error("Use .setBuffer()");
|
|
4545
4433
|
}
|
|
4546
4434
|
this.device.gl.bindVertexArray(this.handle);
|
|
4547
|
-
this.device.gl.bindBuffer(
|
|
4435
|
+
this.device.gl.bindBuffer(34963, buffer ? buffer.handle : null);
|
|
4548
4436
|
this.indexBuffer = buffer;
|
|
4549
4437
|
}
|
|
4550
4438
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
4551
4439
|
setBuffer(location, attributeBuffer) {
|
|
4552
4440
|
const buffer = attributeBuffer;
|
|
4553
|
-
if (buffer.glTarget ===
|
|
4441
|
+
if (buffer.glTarget === 34963) {
|
|
4554
4442
|
throw new Error("Use .setIndexBuffer()");
|
|
4555
4443
|
}
|
|
4556
4444
|
const { size, type, stride, offset, normalized, integer, divisor } = this._getAccessor(location);
|
|
4557
4445
|
this.device.gl.bindVertexArray(this.handle);
|
|
4558
|
-
this.device.gl.bindBuffer(
|
|
4446
|
+
this.device.gl.bindBuffer(34962, buffer.handle);
|
|
4559
4447
|
if (integer) {
|
|
4560
4448
|
this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);
|
|
4561
4449
|
} else {
|
|
@@ -4575,7 +4463,7 @@ var WEBGLVertexArray = class extends import_core23.VertexArray {
|
|
|
4575
4463
|
this.device.gl.bindVertexArray(this.handle);
|
|
4576
4464
|
if (!this.init) {
|
|
4577
4465
|
const webglBuffer = this.indexBuffer;
|
|
4578
|
-
this.device.gl.bindBuffer(
|
|
4466
|
+
this.device.gl.bindBuffer(34963, (webglBuffer == null ? void 0 : webglBuffer.handle) || null);
|
|
4579
4467
|
this.init = true;
|
|
4580
4468
|
}
|
|
4581
4469
|
this._applyConstantAttributes();
|
|
@@ -4672,8 +4560,8 @@ var WEBGLVertexArray = class extends import_core23.VertexArray {
|
|
|
4672
4560
|
this.buffer = this.buffer || this.device.createBuffer({ byteLength });
|
|
4673
4561
|
updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
|
|
4674
4562
|
if (updateNeeded) {
|
|
4675
|
-
const typedArray = (0,
|
|
4676
|
-
(0,
|
|
4563
|
+
const typedArray = (0, import_core21.getScratchArray)(value.constructor, length);
|
|
4564
|
+
(0, import_core21.fillArray)({ target: typedArray, source: constantValue, start: 0, count: length });
|
|
4677
4565
|
this.buffer.write(typedArray);
|
|
4678
4566
|
this.bufferValue = value;
|
|
4679
4567
|
}
|
|
@@ -4699,9 +4587,9 @@ function compareConstantArrayValues(v1, v2) {
|
|
|
4699
4587
|
}
|
|
4700
4588
|
|
|
4701
4589
|
// dist/adapter/resources/webgl-transform-feedback.js
|
|
4702
|
-
var
|
|
4703
|
-
var
|
|
4704
|
-
var WEBGLTransformFeedback = class extends
|
|
4590
|
+
var import_core22 = require("@luma.gl/core");
|
|
4591
|
+
var import_constants24 = require("@luma.gl/constants");
|
|
4592
|
+
var WEBGLTransformFeedback = class extends import_core22.TransformFeedback {
|
|
4705
4593
|
device;
|
|
4706
4594
|
gl;
|
|
4707
4595
|
handle;
|
|
@@ -4736,7 +4624,7 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
|
|
|
4736
4624
|
super.destroy();
|
|
4737
4625
|
}
|
|
4738
4626
|
begin(topology = "point-list") {
|
|
4739
|
-
this.gl.bindTransformFeedback(
|
|
4627
|
+
this.gl.bindTransformFeedback(36386, this.handle);
|
|
4740
4628
|
if (this.bindOnUse) {
|
|
4741
4629
|
this._bindBuffers();
|
|
4742
4630
|
}
|
|
@@ -4747,7 +4635,7 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
|
|
|
4747
4635
|
if (!this.bindOnUse) {
|
|
4748
4636
|
this._unbindBuffers();
|
|
4749
4637
|
}
|
|
4750
|
-
this.gl.bindTransformFeedback(
|
|
4638
|
+
this.gl.bindTransformFeedback(36386, null);
|
|
4751
4639
|
}
|
|
4752
4640
|
// SUBCLASS
|
|
4753
4641
|
setBuffers(buffers) {
|
|
@@ -4764,7 +4652,7 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
|
|
|
4764
4652
|
const { buffer, byteLength, byteOffset } = this._getBufferRange(bufferOrRange);
|
|
4765
4653
|
if (location < 0) {
|
|
4766
4654
|
this.unusedBuffers[locationOrName] = buffer;
|
|
4767
|
-
|
|
4655
|
+
import_core22.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
|
|
4768
4656
|
return;
|
|
4769
4657
|
}
|
|
4770
4658
|
this.buffers[location] = { buffer, byteLength, byteOffset };
|
|
@@ -4781,16 +4669,16 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
|
|
|
4781
4669
|
}
|
|
4782
4670
|
bind(funcOrHandle = this.handle) {
|
|
4783
4671
|
if (typeof funcOrHandle !== "function") {
|
|
4784
|
-
this.gl.bindTransformFeedback(
|
|
4672
|
+
this.gl.bindTransformFeedback(36386, funcOrHandle);
|
|
4785
4673
|
return this;
|
|
4786
4674
|
}
|
|
4787
4675
|
let value;
|
|
4788
4676
|
if (!this._bound) {
|
|
4789
|
-
this.gl.bindTransformFeedback(
|
|
4677
|
+
this.gl.bindTransformFeedback(36386, this.handle);
|
|
4790
4678
|
this._bound = true;
|
|
4791
4679
|
value = funcOrHandle();
|
|
4792
4680
|
this._bound = false;
|
|
4793
|
-
this.gl.bindTransformFeedback(
|
|
4681
|
+
this.gl.bindTransformFeedback(36386, null);
|
|
4794
4682
|
} else {
|
|
4795
4683
|
value = funcOrHandle();
|
|
4796
4684
|
}
|
|
@@ -4831,15 +4719,15 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
|
|
|
4831
4719
|
}
|
|
4832
4720
|
_unbindBuffers() {
|
|
4833
4721
|
for (const bufferIndex in this.buffers) {
|
|
4834
|
-
this.gl.bindBufferBase(
|
|
4722
|
+
this.gl.bindBufferBase(35982, Number(bufferIndex), null);
|
|
4835
4723
|
}
|
|
4836
4724
|
}
|
|
4837
4725
|
_bindBuffer(index, buffer, byteOffset = 0, byteLength) {
|
|
4838
4726
|
const handle = buffer && buffer.handle;
|
|
4839
4727
|
if (!handle || byteLength === void 0) {
|
|
4840
|
-
this.gl.bindBufferBase(
|
|
4728
|
+
this.gl.bindBufferBase(35982, index, handle);
|
|
4841
4729
|
} else {
|
|
4842
|
-
this.gl.bindBufferRange(
|
|
4730
|
+
this.gl.bindBufferRange(35982, index, handle, byteOffset, byteLength);
|
|
4843
4731
|
}
|
|
4844
4732
|
}
|
|
4845
4733
|
};
|
|
@@ -4851,9 +4739,9 @@ function isIndex(value) {
|
|
|
4851
4739
|
}
|
|
4852
4740
|
|
|
4853
4741
|
// dist/adapter/resources/webgl-query-set.js
|
|
4854
|
-
var
|
|
4855
|
-
var
|
|
4856
|
-
var WEBGLQuerySet = class extends
|
|
4742
|
+
var import_core23 = require("@luma.gl/core");
|
|
4743
|
+
var import_constants25 = require("@luma.gl/constants");
|
|
4744
|
+
var WEBGLQuerySet = class extends import_core23.QuerySet {
|
|
4857
4745
|
device;
|
|
4858
4746
|
handle;
|
|
4859
4747
|
target = null;
|
|
@@ -4882,21 +4770,21 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
|
|
|
4882
4770
|
* GPU instruction stream.
|
|
4883
4771
|
*/
|
|
4884
4772
|
beginTimestampQuery() {
|
|
4885
|
-
return this._begin(
|
|
4773
|
+
return this._begin(35007);
|
|
4886
4774
|
}
|
|
4887
4775
|
endTimestampQuery() {
|
|
4888
4776
|
this._end();
|
|
4889
4777
|
}
|
|
4890
4778
|
// Shortcut for occlusion queries
|
|
4891
4779
|
beginOcclusionQuery(options) {
|
|
4892
|
-
return this._begin((options == null ? void 0 : options.conservative) ?
|
|
4780
|
+
return this._begin((options == null ? void 0 : options.conservative) ? 36202 : 35887);
|
|
4893
4781
|
}
|
|
4894
4782
|
endOcclusionQuery() {
|
|
4895
4783
|
this._end();
|
|
4896
4784
|
}
|
|
4897
4785
|
// Shortcut for transformFeedbackQuery
|
|
4898
4786
|
beginTransformFeedbackQuery() {
|
|
4899
|
-
return this._begin(
|
|
4787
|
+
return this._begin(35976);
|
|
4900
4788
|
}
|
|
4901
4789
|
endTransformFeedbackQuery() {
|
|
4902
4790
|
this._end();
|
|
@@ -4938,7 +4826,7 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
|
|
|
4938
4826
|
if (!this._queryPending) {
|
|
4939
4827
|
return false;
|
|
4940
4828
|
}
|
|
4941
|
-
const resultAvailable = this.device.gl.getQueryParameter(this.handle,
|
|
4829
|
+
const resultAvailable = this.device.gl.getQueryParameter(this.handle, 34919);
|
|
4942
4830
|
if (resultAvailable) {
|
|
4943
4831
|
this._queryPending = false;
|
|
4944
4832
|
}
|
|
@@ -4946,11 +4834,11 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
|
|
|
4946
4834
|
}
|
|
4947
4835
|
// Timing query is disjoint, i.e. results are invalid
|
|
4948
4836
|
isTimerDisjoint() {
|
|
4949
|
-
return this.device.gl.getParameter(
|
|
4837
|
+
return this.device.gl.getParameter(36795);
|
|
4950
4838
|
}
|
|
4951
4839
|
// Returns query result.
|
|
4952
4840
|
getResult() {
|
|
4953
|
-
return this.device.gl.getQueryParameter(this.handle,
|
|
4841
|
+
return this.device.gl.getQueryParameter(this.handle, 34918);
|
|
4954
4842
|
}
|
|
4955
4843
|
// Returns the query result, converted to milliseconds to match JavaScript conventions.
|
|
4956
4844
|
getTimerMilliseconds() {
|
|
@@ -4981,44 +4869,44 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
|
|
|
4981
4869
|
};
|
|
4982
4870
|
|
|
4983
4871
|
// dist/classic/copy-and-blit.js
|
|
4984
|
-
var
|
|
4985
|
-
var
|
|
4872
|
+
var import_core25 = require("@luma.gl/core");
|
|
4873
|
+
var import_constants27 = require("@luma.gl/constants");
|
|
4986
4874
|
|
|
4987
4875
|
// dist/classic/format-utils.js
|
|
4988
|
-
var
|
|
4989
|
-
var
|
|
4876
|
+
var import_core24 = require("@luma.gl/core");
|
|
4877
|
+
var import_constants26 = require("@luma.gl/constants");
|
|
4990
4878
|
function glFormatToComponents(format) {
|
|
4991
4879
|
switch (format) {
|
|
4992
|
-
case
|
|
4993
|
-
case
|
|
4994
|
-
case
|
|
4880
|
+
case 6406:
|
|
4881
|
+
case 33326:
|
|
4882
|
+
case 6403:
|
|
4995
4883
|
return 1;
|
|
4996
|
-
case
|
|
4997
|
-
case
|
|
4884
|
+
case 33328:
|
|
4885
|
+
case 33319:
|
|
4998
4886
|
return 2;
|
|
4999
|
-
case
|
|
5000
|
-
case
|
|
4887
|
+
case 6407:
|
|
4888
|
+
case 34837:
|
|
5001
4889
|
return 3;
|
|
5002
|
-
case
|
|
5003
|
-
case
|
|
4890
|
+
case 6408:
|
|
4891
|
+
case 34836:
|
|
5004
4892
|
return 4;
|
|
5005
4893
|
default:
|
|
5006
|
-
(0,
|
|
4894
|
+
(0, import_core24.assert)(false);
|
|
5007
4895
|
return 0;
|
|
5008
4896
|
}
|
|
5009
4897
|
}
|
|
5010
4898
|
function glTypeToBytes(type) {
|
|
5011
4899
|
switch (type) {
|
|
5012
|
-
case
|
|
4900
|
+
case 5121:
|
|
5013
4901
|
return 1;
|
|
5014
|
-
case
|
|
5015
|
-
case
|
|
5016
|
-
case
|
|
4902
|
+
case 33635:
|
|
4903
|
+
case 32819:
|
|
4904
|
+
case 32820:
|
|
5017
4905
|
return 2;
|
|
5018
|
-
case
|
|
4906
|
+
case 5126:
|
|
5019
4907
|
return 4;
|
|
5020
4908
|
default:
|
|
5021
|
-
(0,
|
|
4909
|
+
(0, import_core24.assert)(false);
|
|
5022
4910
|
return 0;
|
|
5023
4911
|
}
|
|
5024
4912
|
}
|
|
@@ -5029,8 +4917,8 @@ function readPixelsToArray(source, options) {
|
|
|
5029
4917
|
const {
|
|
5030
4918
|
sourceX = 0,
|
|
5031
4919
|
sourceY = 0,
|
|
5032
|
-
sourceFormat =
|
|
5033
|
-
sourceAttachment =
|
|
4920
|
+
sourceFormat = 6408,
|
|
4921
|
+
sourceAttachment = 36064
|
|
5034
4922
|
// TODO - support gl.readBuffer
|
|
5035
4923
|
} = options || {};
|
|
5036
4924
|
let {
|
|
@@ -5041,31 +4929,31 @@ function readPixelsToArray(source, options) {
|
|
|
5041
4929
|
sourceType
|
|
5042
4930
|
} = options || {};
|
|
5043
4931
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
5044
|
-
(0,
|
|
4932
|
+
(0, import_core25.assert)(framebuffer);
|
|
5045
4933
|
const { gl, handle } = framebuffer;
|
|
5046
4934
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
5047
4935
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
5048
|
-
const attachment = sourceAttachment -
|
|
5049
|
-
sourceType = sourceType || ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.type) ||
|
|
4936
|
+
const attachment = sourceAttachment - 36064;
|
|
4937
|
+
sourceType = sourceType || ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.type) || 5121;
|
|
5050
4938
|
target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);
|
|
5051
4939
|
sourceType = sourceType || getGLTypeFromTypedArray(target);
|
|
5052
|
-
const prevHandle = gl.bindFramebuffer(
|
|
4940
|
+
const prevHandle = gl.bindFramebuffer(36160, handle);
|
|
5053
4941
|
gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
|
|
5054
|
-
gl.bindFramebuffer(
|
|
4942
|
+
gl.bindFramebuffer(36160, prevHandle || null);
|
|
5055
4943
|
if (deleteFramebuffer) {
|
|
5056
4944
|
framebuffer.destroy();
|
|
5057
4945
|
}
|
|
5058
4946
|
return target;
|
|
5059
4947
|
}
|
|
5060
4948
|
function readPixelsToBuffer(source, options) {
|
|
5061
|
-
const { target, sourceX = 0, sourceY = 0, sourceFormat =
|
|
4949
|
+
const { target, sourceX = 0, sourceY = 0, sourceFormat = 6408, targetByteOffset = 0 } = options || {};
|
|
5062
4950
|
let { sourceWidth, sourceHeight, sourceType } = options || {};
|
|
5063
4951
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
5064
|
-
(0,
|
|
4952
|
+
(0, import_core25.assert)(framebuffer);
|
|
5065
4953
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
5066
4954
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
5067
4955
|
const webglFramebuffer = framebuffer;
|
|
5068
|
-
sourceType = sourceType ||
|
|
4956
|
+
sourceType = sourceType || 5121;
|
|
5069
4957
|
let webglBufferTarget = target;
|
|
5070
4958
|
if (!webglBufferTarget) {
|
|
5071
4959
|
const components = glFormatToComponents(sourceFormat);
|
|
@@ -5089,7 +4977,7 @@ function readPixelsToBuffer(source, options) {
|
|
|
5089
4977
|
return webglBufferTarget;
|
|
5090
4978
|
}
|
|
5091
4979
|
function getFramebuffer2(source) {
|
|
5092
|
-
if (!(source instanceof
|
|
4980
|
+
if (!(source instanceof import_core25.Framebuffer)) {
|
|
5093
4981
|
return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
|
|
5094
4982
|
}
|
|
5095
4983
|
return { framebuffer: source, deleteFramebuffer: false };
|
|
@@ -5109,14 +4997,14 @@ function getPixelArray(pixelArray, type, format, width, height) {
|
|
|
5109
4997
|
if (pixelArray) {
|
|
5110
4998
|
return pixelArray;
|
|
5111
4999
|
}
|
|
5112
|
-
type = type ||
|
|
5000
|
+
type = type || 5121;
|
|
5113
5001
|
const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
|
|
5114
5002
|
const components = glFormatToComponents(format);
|
|
5115
5003
|
return new ArrayType(width * height * components);
|
|
5116
5004
|
}
|
|
5117
5005
|
|
|
5118
5006
|
// dist/classic/clear.js
|
|
5119
|
-
var
|
|
5007
|
+
var import_core26 = require("@luma.gl/core");
|
|
5120
5008
|
var GL_DEPTH_BUFFER_BIT2 = 256;
|
|
5121
5009
|
var GL_STENCIL_BUFFER_BIT2 = 1024;
|
|
5122
5010
|
var GL_COLOR_BUFFER_BIT2 = 16384;
|
|
@@ -5146,19 +5034,18 @@ function clear(device, options) {
|
|
|
5146
5034
|
parameters.clearStencil = depth;
|
|
5147
5035
|
}
|
|
5148
5036
|
}
|
|
5149
|
-
(0,
|
|
5150
|
-
|
|
5151
|
-
|
|
5037
|
+
(0, import_core26.assert)(clearFlags !== 0, ERR_ARGUMENTS);
|
|
5038
|
+
const gl = device.gl;
|
|
5039
|
+
withGLParameters(gl, parameters, () => {
|
|
5152
5040
|
gl.clear(clearFlags);
|
|
5153
5041
|
});
|
|
5154
5042
|
}
|
|
5155
5043
|
|
|
5156
5044
|
// dist/adapter/webgl-device.js
|
|
5157
5045
|
var LOG_LEVEL2 = 1;
|
|
5158
|
-
var _WebGLDevice = class extends
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
}
|
|
5046
|
+
var _WebGLDevice = class extends import_core27.Device {
|
|
5047
|
+
/** type of this device */
|
|
5048
|
+
type = "webgl";
|
|
5162
5049
|
/** The underlying WebGL context */
|
|
5163
5050
|
handle;
|
|
5164
5051
|
features;
|
|
@@ -5170,6 +5057,10 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5170
5057
|
//
|
|
5171
5058
|
// Static methods, expected to be present by `luma.createDevice()`
|
|
5172
5059
|
//
|
|
5060
|
+
/** Check if WebGL 2 is available */
|
|
5061
|
+
static isSupported() {
|
|
5062
|
+
return typeof WebGL2RenderingContext !== "undefined";
|
|
5063
|
+
}
|
|
5173
5064
|
/**
|
|
5174
5065
|
* Get a device instance from a GL context
|
|
5175
5066
|
* Creates and instruments the device if not already created
|
|
@@ -5180,7 +5071,7 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5180
5071
|
if (gl instanceof _WebGLDevice) {
|
|
5181
5072
|
return gl;
|
|
5182
5073
|
}
|
|
5183
|
-
if ((gl == null ? void 0 : gl.device) instanceof
|
|
5074
|
+
if ((gl == null ? void 0 : gl.device) instanceof import_core27.Device) {
|
|
5184
5075
|
return gl.device;
|
|
5185
5076
|
}
|
|
5186
5077
|
if (!isWebGL(gl)) {
|
|
@@ -5190,7 +5081,7 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5190
5081
|
}
|
|
5191
5082
|
static async create(props = {}) {
|
|
5192
5083
|
var _a;
|
|
5193
|
-
|
|
5084
|
+
import_core27.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created")();
|
|
5194
5085
|
const promises = [];
|
|
5195
5086
|
if (props.debug) {
|
|
5196
5087
|
promises.push(loadWebGLDeveloperTools());
|
|
@@ -5199,18 +5090,24 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5199
5090
|
promises.push(loadSpectorJS());
|
|
5200
5091
|
}
|
|
5201
5092
|
if (typeof props.canvas === "string") {
|
|
5202
|
-
promises.push(
|
|
5093
|
+
promises.push(import_core27.CanvasContext.pageLoaded);
|
|
5203
5094
|
}
|
|
5204
|
-
await Promise.
|
|
5205
|
-
|
|
5095
|
+
const results = await Promise.allSettled(promises);
|
|
5096
|
+
for (const result of results) {
|
|
5097
|
+
if (result.status === "rejected") {
|
|
5098
|
+
import_core27.log.error(`Failed to initialize debug libraries ${result.reason}`)();
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
import_core27.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
|
|
5206
5102
|
if ((_a = props.gl) == null ? void 0 : _a.device) {
|
|
5103
|
+
import_core27.log.warn("reattaching existing device")();
|
|
5207
5104
|
return _WebGLDevice.attach(props.gl);
|
|
5208
5105
|
}
|
|
5209
5106
|
const device = new _WebGLDevice(props);
|
|
5210
|
-
const message2 = `Created ${device.
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5107
|
+
const message2 = `Created ${device.type}${device.debug ? " debug" : ""} context: ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
|
|
5108
|
+
import_core27.log.probe(LOG_LEVEL2, message2)();
|
|
5109
|
+
import_core27.log.table(LOG_LEVEL2, device.info)();
|
|
5110
|
+
import_core27.log.groupEnd(LOG_LEVEL2)();
|
|
5214
5111
|
return device;
|
|
5215
5112
|
}
|
|
5216
5113
|
//
|
|
@@ -5218,7 +5115,7 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5218
5115
|
//
|
|
5219
5116
|
constructor(props) {
|
|
5220
5117
|
var _a, _b;
|
|
5221
|
-
super({ ...props, id: props.id || (0,
|
|
5118
|
+
super({ ...props, id: props.id || (0, import_core27.uid)("webgl-device") });
|
|
5222
5119
|
const device = (_a = props.gl) == null ? void 0 : _a.device;
|
|
5223
5120
|
if (device) {
|
|
5224
5121
|
throw new Error(`WebGL context already attached to device ${device.id}`);
|
|
@@ -5247,20 +5144,23 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5247
5144
|
this.gl.device = this;
|
|
5248
5145
|
this.gl._version = 2;
|
|
5249
5146
|
this.info = getDeviceInfo(this.gl, this._extensions);
|
|
5250
|
-
this.features = new WebGLDeviceFeatures(this.gl, this._extensions);
|
|
5251
5147
|
this.limits = new WebGLDeviceLimits(this.gl);
|
|
5148
|
+
this.features = new WebGLDeviceFeatures(this.gl, this._extensions, this.props.disabledFeatures);
|
|
5149
|
+
if (this.props.initalizeFeatures) {
|
|
5150
|
+
this.features.initializeFeatures();
|
|
5151
|
+
}
|
|
5252
5152
|
this.canvasContext.resize();
|
|
5253
5153
|
const { enable: enable2 = true, copyState = false } = props;
|
|
5254
5154
|
trackContextState(this.gl, {
|
|
5255
5155
|
enable: enable2,
|
|
5256
5156
|
copyState,
|
|
5257
|
-
log: (...args) =>
|
|
5157
|
+
log: (...args) => import_core27.log.log(1, ...args)()
|
|
5258
5158
|
});
|
|
5259
5159
|
if (props.debug) {
|
|
5260
5160
|
this.gl = makeDebugContext(this.gl, { ...props, throwOnError: true });
|
|
5261
5161
|
this.debug = true;
|
|
5262
|
-
|
|
5263
|
-
|
|
5162
|
+
import_core27.log.level = Math.max(import_core27.log.level, 1);
|
|
5163
|
+
import_core27.log.warn("WebGL debug mode activated. Performance reduced.")();
|
|
5264
5164
|
}
|
|
5265
5165
|
if (props.spector) {
|
|
5266
5166
|
this.spectorJS = initializeSpectorJS({ ...this.props, canvas: this.handle.canvas });
|
|
@@ -5332,12 +5232,6 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5332
5232
|
throw new Error("ComputePass not supported in WebGL");
|
|
5333
5233
|
}
|
|
5334
5234
|
renderPass = null;
|
|
5335
|
-
getDefaultRenderPass() {
|
|
5336
|
-
this.renderPass = this.renderPass || this.beginRenderPass({
|
|
5337
|
-
framebuffer: this.canvasContext.getCurrentFramebuffer()
|
|
5338
|
-
});
|
|
5339
|
-
return this.renderPass;
|
|
5340
|
-
}
|
|
5341
5235
|
createCommandEncoder(props) {
|
|
5342
5236
|
return new WEBGLCommandEncoder(this, props);
|
|
5343
5237
|
}
|
|
@@ -5363,13 +5257,13 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5363
5257
|
return readPixelsToBuffer(source, options);
|
|
5364
5258
|
}
|
|
5365
5259
|
setParametersWebGL(parameters) {
|
|
5366
|
-
setGLParameters(this, parameters);
|
|
5260
|
+
setGLParameters(this.gl, parameters);
|
|
5367
5261
|
}
|
|
5368
5262
|
getParametersWebGL(parameters) {
|
|
5369
|
-
return getGLParameters(this, parameters);
|
|
5263
|
+
return getGLParameters(this.gl, parameters);
|
|
5370
5264
|
}
|
|
5371
5265
|
withParametersWebGL(parameters, func) {
|
|
5372
|
-
withGLParameters(this, parameters, func);
|
|
5266
|
+
withGLParameters(this.gl, parameters, func);
|
|
5373
5267
|
}
|
|
5374
5268
|
clearWebGL(options) {
|
|
5375
5269
|
clear(this, options);
|
|
@@ -5449,7 +5343,7 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5449
5343
|
this._constants = this._constants || new Array(maxVertexAttributes).fill(null);
|
|
5450
5344
|
const currentConstant = this._constants[location];
|
|
5451
5345
|
if (currentConstant && compareConstantArrayValues2(currentConstant, constant)) {
|
|
5452
|
-
|
|
5346
|
+
import_core27.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
|
|
5453
5347
|
}
|
|
5454
5348
|
this._constants[location] = constant;
|
|
5455
5349
|
switch (constant.constructor) {
|
|
@@ -5463,7 +5357,7 @@ var _WebGLDevice = class extends import_core29.Device {
|
|
|
5463
5357
|
setConstantUintArray(this, location, constant);
|
|
5464
5358
|
break;
|
|
5465
5359
|
default:
|
|
5466
|
-
(0,
|
|
5360
|
+
(0, import_core27.assert)(false);
|
|
5467
5361
|
}
|
|
5468
5362
|
}
|
|
5469
5363
|
/** Ensure extensions are only requested once */
|
|
@@ -5476,6 +5370,7 @@ var WebGLDevice = _WebGLDevice;
|
|
|
5476
5370
|
//
|
|
5477
5371
|
// Public `Device` API
|
|
5478
5372
|
//
|
|
5373
|
+
/** type of this device */
|
|
5479
5374
|
__publicField(WebGLDevice, "type", "webgl");
|
|
5480
5375
|
function isWebGL(gl) {
|
|
5481
5376
|
if (typeof WebGL2RenderingContext !== "undefined" && gl instanceof WebGL2RenderingContext) {
|
|
@@ -5498,7 +5393,7 @@ function setConstantFloatArray(device, location, array) {
|
|
|
5498
5393
|
device.gl.vertexAttrib4fv(location, array);
|
|
5499
5394
|
break;
|
|
5500
5395
|
default:
|
|
5501
|
-
(0,
|
|
5396
|
+
(0, import_core27.assert)(false);
|
|
5502
5397
|
}
|
|
5503
5398
|
}
|
|
5504
5399
|
function setConstantIntArray(device, location, array) {
|
|
@@ -5518,4 +5413,174 @@ function compareConstantArrayValues2(v1, v2) {
|
|
|
5518
5413
|
}
|
|
5519
5414
|
return true;
|
|
5520
5415
|
}
|
|
5416
|
+
|
|
5417
|
+
// dist/adapter/objects/webgl-resource.js
|
|
5418
|
+
var import_core28 = require("@luma.gl/core");
|
|
5419
|
+
var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
|
|
5420
|
+
var WebGLResource = class extends import_core28.Resource {
|
|
5421
|
+
device;
|
|
5422
|
+
gl;
|
|
5423
|
+
gl2;
|
|
5424
|
+
_handle;
|
|
5425
|
+
_bound = false;
|
|
5426
|
+
// Only meaningful for resources that allocate GPU memory
|
|
5427
|
+
byteLength = 0;
|
|
5428
|
+
constructor(device, props, defaultProps) {
|
|
5429
|
+
super(device, props, defaultProps);
|
|
5430
|
+
this.device = device;
|
|
5431
|
+
const gl = this.device.gl;
|
|
5432
|
+
const { id } = props || {};
|
|
5433
|
+
this.gl = gl;
|
|
5434
|
+
this.gl2 = gl;
|
|
5435
|
+
this.id = id || (0, import_core28.uid)(this.constructor.name);
|
|
5436
|
+
this._handle = props == null ? void 0 : props.handle;
|
|
5437
|
+
if (this._handle === void 0) {
|
|
5438
|
+
this._handle = this._createHandle();
|
|
5439
|
+
}
|
|
5440
|
+
this.byteLength = 0;
|
|
5441
|
+
}
|
|
5442
|
+
toString() {
|
|
5443
|
+
return `${this.constructor.name}(${this.id})`;
|
|
5444
|
+
}
|
|
5445
|
+
get handle() {
|
|
5446
|
+
return this._handle;
|
|
5447
|
+
}
|
|
5448
|
+
delete({ deleteChildren = false } = {}) {
|
|
5449
|
+
const children = this._handle && this._deleteHandle(this._handle);
|
|
5450
|
+
if (this._handle) {
|
|
5451
|
+
this.removeStats();
|
|
5452
|
+
}
|
|
5453
|
+
this._handle = null;
|
|
5454
|
+
if (children && deleteChildren) {
|
|
5455
|
+
children.filter(Boolean).forEach((child) => child.destroy());
|
|
5456
|
+
}
|
|
5457
|
+
return this;
|
|
5458
|
+
}
|
|
5459
|
+
bind(funcOrHandle = this.handle) {
|
|
5460
|
+
if (typeof funcOrHandle !== "function") {
|
|
5461
|
+
this._bindHandle(funcOrHandle);
|
|
5462
|
+
return this;
|
|
5463
|
+
}
|
|
5464
|
+
let value;
|
|
5465
|
+
if (!this._bound) {
|
|
5466
|
+
this._bindHandle(this.handle);
|
|
5467
|
+
this._bound = true;
|
|
5468
|
+
value = funcOrHandle();
|
|
5469
|
+
this._bound = false;
|
|
5470
|
+
this._bindHandle(null);
|
|
5471
|
+
} else {
|
|
5472
|
+
value = funcOrHandle();
|
|
5473
|
+
}
|
|
5474
|
+
return value;
|
|
5475
|
+
}
|
|
5476
|
+
unbind() {
|
|
5477
|
+
this.bind(null);
|
|
5478
|
+
}
|
|
5479
|
+
// Install stubs for removed methods
|
|
5480
|
+
stubRemovedMethods(className, version, methodNames) {
|
|
5481
|
+
return (0, import_core28.stubRemovedMethods)(this, className, version, methodNames);
|
|
5482
|
+
}
|
|
5483
|
+
// PUBLIC VIRTUAL METHODS
|
|
5484
|
+
initialize(props) {
|
|
5485
|
+
}
|
|
5486
|
+
// PROTECTED METHODS - These must be overridden by subclass
|
|
5487
|
+
_createHandle() {
|
|
5488
|
+
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
5489
|
+
}
|
|
5490
|
+
_deleteHandle() {
|
|
5491
|
+
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
5492
|
+
}
|
|
5493
|
+
_bindHandle(handle) {
|
|
5494
|
+
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
5495
|
+
}
|
|
5496
|
+
_getOptsFromHandle() {
|
|
5497
|
+
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
5498
|
+
}
|
|
5499
|
+
_getParameter(pname, props) {
|
|
5500
|
+
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
5501
|
+
}
|
|
5502
|
+
_setParameter(pname, value) {
|
|
5503
|
+
throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
|
|
5504
|
+
}
|
|
5505
|
+
};
|
|
5506
|
+
|
|
5507
|
+
// dist/adapter/objects/webgl-renderbuffer.js
|
|
5508
|
+
var import_core29 = require("@luma.gl/core");
|
|
5509
|
+
var import_constants28 = require("@luma.gl/constants");
|
|
5510
|
+
var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
5511
|
+
get [Symbol.toStringTag]() {
|
|
5512
|
+
return "Renderbuffer";
|
|
5513
|
+
}
|
|
5514
|
+
get width() {
|
|
5515
|
+
return this.props.width;
|
|
5516
|
+
}
|
|
5517
|
+
get height() {
|
|
5518
|
+
return this.props.height;
|
|
5519
|
+
}
|
|
5520
|
+
get format() {
|
|
5521
|
+
return this.props.format;
|
|
5522
|
+
}
|
|
5523
|
+
get samples() {
|
|
5524
|
+
return this.props.samples;
|
|
5525
|
+
}
|
|
5526
|
+
get attachment() {
|
|
5527
|
+
return;
|
|
5528
|
+
}
|
|
5529
|
+
/** WebGL format constant */
|
|
5530
|
+
glFormat;
|
|
5531
|
+
static isTextureFormatSupported(device, format) {
|
|
5532
|
+
return isRenderbufferFormatSupported(device.gl, format, device._extensions);
|
|
5533
|
+
}
|
|
5534
|
+
constructor(device, props) {
|
|
5535
|
+
if (typeof props.format === "number") {
|
|
5536
|
+
throw new Error("Renderbuffer");
|
|
5537
|
+
}
|
|
5538
|
+
super(device, props, _WEBGLRenderbuffer.defaultProps);
|
|
5539
|
+
this.glFormat = convertTextureFormatToGL(this.props.format);
|
|
5540
|
+
this._initialize(this.props);
|
|
5541
|
+
}
|
|
5542
|
+
resize(size) {
|
|
5543
|
+
if (size.width !== this.width || size.height !== this.height) {
|
|
5544
|
+
Object.assign(this.props, { ...size, format: this.format, samples: this.samples });
|
|
5545
|
+
this._initialize(this.props);
|
|
5546
|
+
}
|
|
5547
|
+
}
|
|
5548
|
+
// PRIVATE METHODS
|
|
5549
|
+
/** Creates and initializes a renderbuffer object's data store */
|
|
5550
|
+
_initialize(props) {
|
|
5551
|
+
const { format, width, height, samples } = props;
|
|
5552
|
+
(0, import_core29.assert)(format, "Needs format");
|
|
5553
|
+
this.trackDeallocatedMemory();
|
|
5554
|
+
this.gl.bindRenderbuffer(36161, this.handle);
|
|
5555
|
+
if (samples !== 0) {
|
|
5556
|
+
this.gl.renderbufferStorageMultisample(36161, samples, this.glFormat, width, height);
|
|
5557
|
+
} else {
|
|
5558
|
+
this.gl.renderbufferStorage(36161, this.glFormat, width, height);
|
|
5559
|
+
}
|
|
5560
|
+
this.gl.bindRenderbuffer(36161, null);
|
|
5561
|
+
this.trackAllocatedMemory(width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.format));
|
|
5562
|
+
}
|
|
5563
|
+
// RESOURCE IMPLEMENTATION
|
|
5564
|
+
_createHandle() {
|
|
5565
|
+
return this.gl.createRenderbuffer();
|
|
5566
|
+
}
|
|
5567
|
+
_deleteHandle() {
|
|
5568
|
+
this.gl.deleteRenderbuffer(this.handle);
|
|
5569
|
+
this.trackDeallocatedMemory();
|
|
5570
|
+
}
|
|
5571
|
+
_bindHandle(handle) {
|
|
5572
|
+
this.gl.bindRenderbuffer(36161, handle);
|
|
5573
|
+
}
|
|
5574
|
+
};
|
|
5575
|
+
var WEBGLRenderbuffer = _WEBGLRenderbuffer;
|
|
5576
|
+
__publicField(WEBGLRenderbuffer, "defaultProps", {
|
|
5577
|
+
id: void 0,
|
|
5578
|
+
handle: void 0,
|
|
5579
|
+
userData: void 0,
|
|
5580
|
+
format: void 0,
|
|
5581
|
+
// 'depth16unorm'
|
|
5582
|
+
width: 1,
|
|
5583
|
+
height: 1,
|
|
5584
|
+
samples: 0
|
|
5585
|
+
});
|
|
5521
5586
|
//# sourceMappingURL=index.cjs.map
|