@deck.gl/arcgis 9.2.11 → 9.3.0-alpha.1
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/dist.dev.js +403 -237
- package/dist.min.js +3 -3
- package/package.json +6 -6
package/dist/dist.dev.js
CHANGED
|
@@ -911,16 +911,15 @@ var __exports__ = (() => {
|
|
|
911
911
|
const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);
|
|
912
912
|
const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);
|
|
913
913
|
const message2 = `${errorMessage} in gl.${functionName}(${functionArgs})`;
|
|
914
|
-
import_core3.log.error(message2)();
|
|
914
|
+
import_core3.log.error("%cWebGL", "color: white; background: red; padding: 2px 6px; border-radius: 3px;", message2)();
|
|
915
915
|
debugger;
|
|
916
|
+
throw new Error(message2);
|
|
916
917
|
}
|
|
917
918
|
function onValidateGLFunc(props, functionName, functionArgs) {
|
|
918
919
|
let functionString = "";
|
|
919
|
-
if (import_core3.log.level >= 1) {
|
|
920
|
+
if (props.traceWebGL && import_core3.log.level >= 1) {
|
|
920
921
|
functionString = getFunctionString(functionName, functionArgs);
|
|
921
|
-
|
|
922
|
-
import_core3.log.log(1, functionString)();
|
|
923
|
-
}
|
|
922
|
+
import_core3.log.info(1, "%cWebGL", "color: white; background: blue; padding: 2px 6px; border-radius: 3px;", functionString)();
|
|
924
923
|
}
|
|
925
924
|
for (const arg of functionArgs) {
|
|
926
925
|
if (arg === void 0) {
|
|
@@ -1626,38 +1625,53 @@ var __exports__ = (() => {
|
|
|
1626
1625
|
// ../../node_modules/@luma.gl/webgl/dist/context/helpers/create-browser-context.js
|
|
1627
1626
|
function createBrowserContext(canvas, props, webglContextAttributes) {
|
|
1628
1627
|
let errorMessage = "";
|
|
1628
|
+
const onCreateError = (event) => {
|
|
1629
|
+
const statusMessage = event.statusMessage;
|
|
1630
|
+
if (statusMessage) {
|
|
1631
|
+
errorMessage ||= statusMessage;
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
canvas.addEventListener("webglcontextcreationerror", onCreateError, false);
|
|
1635
|
+
const allowSoftwareRenderer = webglContextAttributes.failIfMajorPerformanceCaveat !== true;
|
|
1629
1636
|
const webglProps = {
|
|
1630
1637
|
preserveDrawingBuffer: true,
|
|
1631
|
-
|
|
1632
|
-
|
|
1638
|
+
...webglContextAttributes,
|
|
1639
|
+
// Always start by requesting a high-performance context.
|
|
1640
|
+
failIfMajorPerformanceCaveat: true
|
|
1633
1641
|
};
|
|
1634
1642
|
let gl = null;
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
if (!gl && !webglContextAttributes.failIfMajorPerformanceCaveat) {
|
|
1640
|
-
webglProps.failIfMajorPerformanceCaveat = false;
|
|
1641
|
-
gl = canvas.getContext("webgl2", webglProps);
|
|
1642
|
-
gl.luma ||= {};
|
|
1643
|
-
gl.luma.softwareRenderer = true;
|
|
1644
|
-
}
|
|
1645
|
-
if (!gl) {
|
|
1646
|
-
gl = canvas.getContext("webgl", {});
|
|
1647
|
-
if (gl) {
|
|
1648
|
-
gl = null;
|
|
1649
|
-
errorMessage ||= "Your browser only supports WebGL1";
|
|
1643
|
+
try {
|
|
1644
|
+
gl ||= canvas.getContext("webgl2", webglProps);
|
|
1645
|
+
if (!gl && webglProps.failIfMajorPerformanceCaveat) {
|
|
1646
|
+
errorMessage ||= "Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow.";
|
|
1650
1647
|
}
|
|
1648
|
+
if (!gl && allowSoftwareRenderer) {
|
|
1649
|
+
webglProps.failIfMajorPerformanceCaveat = false;
|
|
1650
|
+
gl = canvas.getContext("webgl2", webglProps);
|
|
1651
|
+
if (gl) {
|
|
1652
|
+
gl.luma ||= {};
|
|
1653
|
+
gl.luma.softwareRenderer = true;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
if (!gl) {
|
|
1657
|
+
gl = canvas.getContext("webgl", {});
|
|
1658
|
+
if (gl) {
|
|
1659
|
+
gl = null;
|
|
1660
|
+
errorMessage ||= "Your browser only supports WebGL1";
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
if (!gl) {
|
|
1664
|
+
errorMessage ||= "Your browser does not support WebGL";
|
|
1665
|
+
throw new Error(`Failed to create WebGL context: ${errorMessage}`);
|
|
1666
|
+
}
|
|
1667
|
+
const { onContextLost, onContextRestored } = props;
|
|
1668
|
+
canvas.addEventListener("webglcontextlost", (event) => onContextLost(event), false);
|
|
1669
|
+
canvas.addEventListener("webglcontextrestored", (event) => onContextRestored(event), false);
|
|
1670
|
+
gl.luma ||= {};
|
|
1671
|
+
return gl;
|
|
1672
|
+
} finally {
|
|
1673
|
+
canvas.removeEventListener("webglcontextcreationerror", onCreateError, false);
|
|
1651
1674
|
}
|
|
1652
|
-
if (!gl) {
|
|
1653
|
-
errorMessage ||= "Your browser does not support WebGL";
|
|
1654
|
-
throw new Error(`Failed to create WebGL context: ${errorMessage}`);
|
|
1655
|
-
}
|
|
1656
|
-
const { onContextLost, onContextRestored } = props;
|
|
1657
|
-
canvas.addEventListener("webglcontextlost", (event) => onContextLost(event), false);
|
|
1658
|
-
canvas.addEventListener("webglcontextrestored", (event) => onContextRestored(event), false);
|
|
1659
|
-
gl.luma ||= {};
|
|
1660
|
-
return gl;
|
|
1661
1675
|
}
|
|
1662
1676
|
var init_create_browser_context = __esm({
|
|
1663
1677
|
"../../node_modules/@luma.gl/webgl/dist/context/helpers/create-browser-context.js"() {
|
|
@@ -2394,14 +2408,24 @@ var __exports__ = (() => {
|
|
|
2394
2408
|
super(props);
|
|
2395
2409
|
this.device = device;
|
|
2396
2410
|
this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
|
|
2397
|
-
this.
|
|
2398
|
-
}
|
|
2399
|
-
getCurrentFramebuffer() {
|
|
2400
|
-
this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, { handle: null });
|
|
2401
|
-
return this._framebuffer;
|
|
2411
|
+
this._configureDevice();
|
|
2402
2412
|
}
|
|
2403
2413
|
// IMPLEMENTATION OF ABSTRACT METHODS
|
|
2404
|
-
|
|
2414
|
+
_configureDevice() {
|
|
2415
|
+
const shouldResize = this.drawingBufferWidth !== this._framebuffer?.width || this.drawingBufferHeight !== this._framebuffer?.height;
|
|
2416
|
+
if (shouldResize) {
|
|
2417
|
+
this._framebuffer?.resize([this.drawingBufferWidth, this.drawingBufferHeight]);
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
_getCurrentFramebuffer() {
|
|
2421
|
+
this._framebuffer ||= new WEBGLFramebuffer(this.device, {
|
|
2422
|
+
id: "canvas-context-framebuffer",
|
|
2423
|
+
handle: null,
|
|
2424
|
+
// Setting handle to null returns a reference to the default WebGL framebuffer
|
|
2425
|
+
width: this.drawingBufferWidth,
|
|
2426
|
+
height: this.drawingBufferHeight
|
|
2427
|
+
});
|
|
2428
|
+
return this._framebuffer;
|
|
2405
2429
|
}
|
|
2406
2430
|
};
|
|
2407
2431
|
}
|
|
@@ -3134,6 +3158,115 @@ ${source}`;
|
|
|
3134
3158
|
}
|
|
3135
3159
|
});
|
|
3136
3160
|
|
|
3161
|
+
// ../../node_modules/@luma.gl/webgl/dist/adapter/converters/webgl-shadertypes.js
|
|
3162
|
+
function convertDataTypeToGLDataType(normalizedType) {
|
|
3163
|
+
return NORMALIZED_SHADER_TYPE_TO_WEBGL[normalizedType];
|
|
3164
|
+
}
|
|
3165
|
+
function convertGLUniformTypeToShaderVariableType(glUniformType) {
|
|
3166
|
+
return WEBGL_SHADER_TYPES[glUniformType];
|
|
3167
|
+
}
|
|
3168
|
+
function isGLSamplerType(type) {
|
|
3169
|
+
return Boolean(WEBGL_SAMPLER_TO_TEXTURE_BINDINGS[type]);
|
|
3170
|
+
}
|
|
3171
|
+
function getTextureBindingFromGLSamplerType(glSamplerType) {
|
|
3172
|
+
return WEBGL_SAMPLER_TO_TEXTURE_BINDINGS[glSamplerType];
|
|
3173
|
+
}
|
|
3174
|
+
var WEBGL_SHADER_TYPES, WEBGL_SAMPLER_TO_TEXTURE_BINDINGS, NORMALIZED_SHADER_TYPE_TO_WEBGL;
|
|
3175
|
+
var init_webgl_shadertypes = __esm({
|
|
3176
|
+
"../../node_modules/@luma.gl/webgl/dist/adapter/converters/webgl-shadertypes.js"() {
|
|
3177
|
+
WEBGL_SHADER_TYPES = {
|
|
3178
|
+
[5126]: "f32",
|
|
3179
|
+
[35664]: "vec2<f32>",
|
|
3180
|
+
[35665]: "vec3<f32>",
|
|
3181
|
+
[35666]: "vec4<f32>",
|
|
3182
|
+
[5124]: "i32",
|
|
3183
|
+
[35667]: "vec2<i32>",
|
|
3184
|
+
[35668]: "vec3<i32>",
|
|
3185
|
+
[35669]: "vec4<i32>",
|
|
3186
|
+
[5125]: "u32",
|
|
3187
|
+
[36294]: "vec2<u32>",
|
|
3188
|
+
[36295]: "vec3<u32>",
|
|
3189
|
+
[36296]: "vec4<u32>",
|
|
3190
|
+
[35670]: "f32",
|
|
3191
|
+
[35671]: "vec2<f32>",
|
|
3192
|
+
[35672]: "vec3<f32>",
|
|
3193
|
+
[35673]: "vec4<f32>",
|
|
3194
|
+
// TODO - are sizes/components below correct?
|
|
3195
|
+
[35674]: "mat2x2<f32>",
|
|
3196
|
+
[35685]: "mat2x3<f32>",
|
|
3197
|
+
[35686]: "mat2x4<f32>",
|
|
3198
|
+
[35687]: "mat3x2<f32>",
|
|
3199
|
+
[35675]: "mat3x3<f32>",
|
|
3200
|
+
[35688]: "mat3x4<f32>",
|
|
3201
|
+
[35689]: "mat4x2<f32>",
|
|
3202
|
+
[35690]: "mat4x3<f32>",
|
|
3203
|
+
[35676]: "mat4x4<f32>"
|
|
3204
|
+
};
|
|
3205
|
+
WEBGL_SAMPLER_TO_TEXTURE_BINDINGS = {
|
|
3206
|
+
[35678]: { viewDimension: "2d", sampleType: "float" },
|
|
3207
|
+
[35680]: { viewDimension: "cube", sampleType: "float" },
|
|
3208
|
+
[35679]: { viewDimension: "3d", sampleType: "float" },
|
|
3209
|
+
[35682]: { viewDimension: "3d", sampleType: "depth" },
|
|
3210
|
+
[36289]: { viewDimension: "2d-array", sampleType: "float" },
|
|
3211
|
+
[36292]: { viewDimension: "2d-array", sampleType: "depth" },
|
|
3212
|
+
[36293]: { viewDimension: "cube", sampleType: "float" },
|
|
3213
|
+
[36298]: { viewDimension: "2d", sampleType: "sint" },
|
|
3214
|
+
[36299]: { viewDimension: "3d", sampleType: "sint" },
|
|
3215
|
+
[36300]: { viewDimension: "cube", sampleType: "sint" },
|
|
3216
|
+
[36303]: { viewDimension: "2d-array", sampleType: "uint" },
|
|
3217
|
+
[36306]: { viewDimension: "2d", sampleType: "uint" },
|
|
3218
|
+
[36307]: { viewDimension: "3d", sampleType: "uint" },
|
|
3219
|
+
[36308]: { viewDimension: "cube", sampleType: "uint" },
|
|
3220
|
+
[36311]: { viewDimension: "2d-array", sampleType: "uint" }
|
|
3221
|
+
};
|
|
3222
|
+
NORMALIZED_SHADER_TYPE_TO_WEBGL = {
|
|
3223
|
+
uint8: 5121,
|
|
3224
|
+
sint8: 5120,
|
|
3225
|
+
unorm8: 5121,
|
|
3226
|
+
snorm8: 5120,
|
|
3227
|
+
uint16: 5123,
|
|
3228
|
+
sint16: 5122,
|
|
3229
|
+
unorm16: 5123,
|
|
3230
|
+
snorm16: 5122,
|
|
3231
|
+
uint32: 5125,
|
|
3232
|
+
sint32: 5124,
|
|
3233
|
+
// WebGPU does not support normalized 32 bit integer attributes
|
|
3234
|
+
// 'unorm32': GL.UNSIGNED_INT,
|
|
3235
|
+
// 'snorm32': GL.INT,
|
|
3236
|
+
float16: 5131,
|
|
3237
|
+
float32: 5126
|
|
3238
|
+
};
|
|
3239
|
+
}
|
|
3240
|
+
});
|
|
3241
|
+
|
|
3242
|
+
// ../../node_modules/@luma.gl/webgl/dist/adapter/converters/shader-formats.js
|
|
3243
|
+
function convertGLDataTypeToDataType(type) {
|
|
3244
|
+
return GL_DATA_TYPE_MAP[type];
|
|
3245
|
+
}
|
|
3246
|
+
var GL_DATA_TYPE_MAP;
|
|
3247
|
+
var init_shader_formats = __esm({
|
|
3248
|
+
"../../node_modules/@luma.gl/webgl/dist/adapter/converters/shader-formats.js"() {
|
|
3249
|
+
GL_DATA_TYPE_MAP = {
|
|
3250
|
+
[5124]: "sint32",
|
|
3251
|
+
[5125]: "uint32",
|
|
3252
|
+
[5122]: "sint16",
|
|
3253
|
+
[5123]: "uint16",
|
|
3254
|
+
[5120]: "sint8",
|
|
3255
|
+
[5121]: "uint8",
|
|
3256
|
+
[5126]: "float32",
|
|
3257
|
+
[5131]: "float16",
|
|
3258
|
+
[33635]: "uint16",
|
|
3259
|
+
[32819]: "uint16",
|
|
3260
|
+
[32820]: "uint16",
|
|
3261
|
+
[33640]: "uint32",
|
|
3262
|
+
[35899]: "uint32",
|
|
3263
|
+
[35902]: "uint32",
|
|
3264
|
+
[34042]: "uint32",
|
|
3265
|
+
[36269]: "uint32"
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
});
|
|
3269
|
+
|
|
3137
3270
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-texture.js
|
|
3138
3271
|
function getWebGLTextureTarget(dimension) {
|
|
3139
3272
|
switch (dimension) {
|
|
@@ -3155,7 +3288,7 @@ ${source}`;
|
|
|
3155
3288
|
function getWebGLCubeFaceTarget(glTarget, dimension, level) {
|
|
3156
3289
|
return dimension === "cube" ? 34069 + level : glTarget;
|
|
3157
3290
|
}
|
|
3158
|
-
var import_core14, WEBGLTexture;
|
|
3291
|
+
var import_core14, import_core15, WEBGLTexture;
|
|
3159
3292
|
var init_webgl_texture = __esm({
|
|
3160
3293
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-texture.js"() {
|
|
3161
3294
|
import_core14 = __toESM(require_core2(), 1);
|
|
@@ -3163,6 +3296,9 @@ ${source}`;
|
|
|
3163
3296
|
init_sampler_parameters();
|
|
3164
3297
|
init_with_parameters();
|
|
3165
3298
|
init_webgl_texture_view();
|
|
3299
|
+
init_webgl_shadertypes();
|
|
3300
|
+
init_shader_formats();
|
|
3301
|
+
import_core15 = __toESM(require_core2(), 1);
|
|
3166
3302
|
WEBGLTexture = class extends import_core14.Texture {
|
|
3167
3303
|
// readonly MAX_ATTRIBUTES: number;
|
|
3168
3304
|
device;
|
|
@@ -3192,8 +3328,10 @@ ${source}`;
|
|
|
3192
3328
|
// state
|
|
3193
3329
|
/** Texture binding slot - TODO - move to texture view? */
|
|
3194
3330
|
_textureUnit = 0;
|
|
3331
|
+
/** Chached framebuffer */
|
|
3332
|
+
_framebuffer = null;
|
|
3195
3333
|
constructor(device, props) {
|
|
3196
|
-
super(device, props);
|
|
3334
|
+
super(device, props, { byteAlignment: 1 });
|
|
3197
3335
|
this.device = device;
|
|
3198
3336
|
this.gl = this.device.gl;
|
|
3199
3337
|
const formatInfo = getTextureFormatWebGL(this.props.format);
|
|
@@ -3226,6 +3364,8 @@ ${source}`;
|
|
|
3226
3364
|
}
|
|
3227
3365
|
destroy() {
|
|
3228
3366
|
if (this.handle) {
|
|
3367
|
+
this._framebuffer?.destroy();
|
|
3368
|
+
this._framebuffer = null;
|
|
3229
3369
|
this.gl.deleteTexture(this.handle);
|
|
3230
3370
|
this.removeStats();
|
|
3231
3371
|
this.trackDeallocatedMemory("Texture");
|
|
@@ -3240,11 +3380,37 @@ ${source}`;
|
|
|
3240
3380
|
const parameters = convertSamplerParametersToWebGL(this.sampler.props);
|
|
3241
3381
|
this._setSamplerParameters(parameters);
|
|
3242
3382
|
}
|
|
3383
|
+
copyExternalImage(options_) {
|
|
3384
|
+
const options = this._normalizeCopyExternalImageOptions(options_);
|
|
3385
|
+
if (options.sourceX || options.sourceY) {
|
|
3386
|
+
throw new Error("WebGL does not support sourceX/sourceY)");
|
|
3387
|
+
}
|
|
3388
|
+
const { glFormat, glType } = this;
|
|
3389
|
+
const { image, depth, mipLevel, x, y, z, width, height } = options;
|
|
3390
|
+
const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);
|
|
3391
|
+
const glParameters = options.flipY ? { [37440]: true } : {};
|
|
3392
|
+
this.gl.bindTexture(this.glTarget, this.handle);
|
|
3393
|
+
withGLParameters(this.gl, glParameters, () => {
|
|
3394
|
+
switch (this.dimension) {
|
|
3395
|
+
case "2d":
|
|
3396
|
+
case "cube":
|
|
3397
|
+
this.gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, glType, image);
|
|
3398
|
+
break;
|
|
3399
|
+
case "2d-array":
|
|
3400
|
+
case "3d":
|
|
3401
|
+
this.gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, glType, image);
|
|
3402
|
+
break;
|
|
3403
|
+
default:
|
|
3404
|
+
}
|
|
3405
|
+
});
|
|
3406
|
+
this.gl.bindTexture(this.glTarget, null);
|
|
3407
|
+
return { width: options.width, height: options.height };
|
|
3408
|
+
}
|
|
3243
3409
|
copyImageData(options_) {
|
|
3244
3410
|
const options = this._normalizeCopyImageDataOptions(options_);
|
|
3245
3411
|
const typedArray = options.data;
|
|
3246
|
-
const { width, height, depth } =
|
|
3247
|
-
const { mipLevel = 0, byteOffset = 0, x = 0, y = 0
|
|
3412
|
+
const { width, height, depth, z = 0 } = options;
|
|
3413
|
+
const { mipLevel = 0, byteOffset = 0, x = 0, y = 0 } = options;
|
|
3248
3414
|
const { glFormat, glType, compressed } = this;
|
|
3249
3415
|
const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);
|
|
3250
3416
|
let unpackRowLength;
|
|
@@ -3258,10 +3424,11 @@ ${source}`;
|
|
|
3258
3424
|
}
|
|
3259
3425
|
}
|
|
3260
3426
|
const glParameters = !this.compressed ? {
|
|
3427
|
+
[3317]: this.byteAlignment,
|
|
3261
3428
|
...unpackRowLength !== void 0 ? { [3314]: unpackRowLength } : {},
|
|
3262
3429
|
[32878]: options.rowsPerImage
|
|
3263
3430
|
} : {};
|
|
3264
|
-
this.gl.bindTexture(glTarget, this.handle);
|
|
3431
|
+
this.gl.bindTexture(this.glTarget, this.handle);
|
|
3265
3432
|
withGLParameters(this.gl, glParameters, () => {
|
|
3266
3433
|
switch (this.dimension) {
|
|
3267
3434
|
case "2d":
|
|
@@ -3283,35 +3450,92 @@ ${source}`;
|
|
|
3283
3450
|
default:
|
|
3284
3451
|
}
|
|
3285
3452
|
});
|
|
3286
|
-
this.gl.bindTexture(glTarget, null);
|
|
3453
|
+
this.gl.bindTexture(this.glTarget, null);
|
|
3287
3454
|
}
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3455
|
+
readBuffer(options = {}, buffer) {
|
|
3456
|
+
throw new Error("readBuffer not implemented");
|
|
3457
|
+
}
|
|
3458
|
+
async readDataAsync(options = {}) {
|
|
3459
|
+
return this.readDataSyncWebGL(options);
|
|
3460
|
+
}
|
|
3461
|
+
writeBuffer(buffer, options_ = {}) {
|
|
3462
|
+
}
|
|
3463
|
+
writeData(data, options_ = {}) {
|
|
3464
|
+
const options = this._normalizeTextureWriteOptions(options_);
|
|
3465
|
+
const typedArray = ArrayBuffer.isView(data) ? data : new Uint8Array(data);
|
|
3466
|
+
const {} = this;
|
|
3467
|
+
const { width, height, mipLevel, x, y, z } = options;
|
|
3468
|
+
const { glFormat, glType, compressed } = this;
|
|
3469
|
+
const depth = 0;
|
|
3295
3470
|
const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, depth);
|
|
3296
|
-
const glParameters =
|
|
3297
|
-
|
|
3471
|
+
const glParameters = !this.compressed ? {
|
|
3472
|
+
// WebGL does not require byte alignment, but allows it to be specified
|
|
3473
|
+
[3317]: this.byteAlignment
|
|
3474
|
+
// [GL.UNPACK_ROW_LENGTH]: bytesPerRow,
|
|
3475
|
+
// [GL.UNPACK_IMAGE_HEIGHT]: rowsPerImage
|
|
3476
|
+
} : {};
|
|
3477
|
+
this.gl.bindTexture(glTarget, this.handle);
|
|
3478
|
+
this.gl.bindBuffer(35052, null);
|
|
3298
3479
|
withGLParameters(this.gl, glParameters, () => {
|
|
3299
3480
|
switch (this.dimension) {
|
|
3300
3481
|
case "2d":
|
|
3301
3482
|
case "cube":
|
|
3302
|
-
|
|
3483
|
+
if (compressed) {
|
|
3484
|
+
this.gl.compressedTexSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, typedArray);
|
|
3485
|
+
} else {
|
|
3486
|
+
this.gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, glType, typedArray);
|
|
3487
|
+
}
|
|
3303
3488
|
break;
|
|
3304
3489
|
case "2d-array":
|
|
3305
3490
|
case "3d":
|
|
3306
|
-
|
|
3491
|
+
if (compressed) {
|
|
3492
|
+
this.gl.compressedTexSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, typedArray);
|
|
3493
|
+
} else {
|
|
3494
|
+
this.gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, glType, typedArray);
|
|
3495
|
+
}
|
|
3307
3496
|
break;
|
|
3308
3497
|
default:
|
|
3309
3498
|
}
|
|
3310
3499
|
});
|
|
3311
|
-
this.gl.bindTexture(
|
|
3312
|
-
|
|
3500
|
+
this.gl.bindTexture(glTarget, null);
|
|
3501
|
+
}
|
|
3502
|
+
// IMPLEMENTATION SPECIFIC
|
|
3503
|
+
/** @todo - for now we always use 1 for maximum compatibility, we can fine tune later */
|
|
3504
|
+
_getRowByteAlignment(format, width) {
|
|
3505
|
+
return 1;
|
|
3506
|
+
}
|
|
3507
|
+
/**
|
|
3508
|
+
* Wraps a given texture into a framebuffer object, that can be further used
|
|
3509
|
+
* to read data from the texture object.
|
|
3510
|
+
*/
|
|
3511
|
+
_getFramebuffer() {
|
|
3512
|
+
this._framebuffer ||= this.device.createFramebuffer({
|
|
3513
|
+
id: `framebuffer-for-${this.id}`,
|
|
3514
|
+
width: this.width,
|
|
3515
|
+
height: this.height,
|
|
3516
|
+
colorAttachments: [this]
|
|
3517
|
+
});
|
|
3518
|
+
return this._framebuffer;
|
|
3313
3519
|
}
|
|
3314
3520
|
// WEBGL SPECIFIC
|
|
3521
|
+
readDataSyncWebGL(options_ = {}) {
|
|
3522
|
+
const options = this._normalizeTextureReadOptions(options_);
|
|
3523
|
+
const memoryLayout = this.computeMemoryLayout(options);
|
|
3524
|
+
const shaderType = convertGLDataTypeToDataType(this.glType);
|
|
3525
|
+
const ArrayType = (0, import_core15.getTypedArrayConstructor)(shaderType);
|
|
3526
|
+
const targetArray = new ArrayType(memoryLayout.byteLength);
|
|
3527
|
+
const signedType = (0, import_core15.getDataType)(targetArray);
|
|
3528
|
+
const sourceType = convertDataTypeToGLDataType(signedType);
|
|
3529
|
+
const framebuffer = this._getFramebuffer();
|
|
3530
|
+
const prevHandle = this.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
3531
|
+
this.gl.readBuffer(36064);
|
|
3532
|
+
this.gl.readPixels(options.x, options.y, options.width, options.height, this.glFormat, sourceType, targetArray);
|
|
3533
|
+
this.gl.bindFramebuffer(36160, prevHandle || null);
|
|
3534
|
+
return targetArray.buffer;
|
|
3535
|
+
}
|
|
3536
|
+
/**
|
|
3537
|
+
* @note - this is used by the DynamicTexture class to generate mipmaps on WebGL
|
|
3538
|
+
*/
|
|
3315
3539
|
generateMipmapsWebGL(options) {
|
|
3316
3540
|
const isFilterableAndRenderable = this.device.isTextureFormatRenderable(this.props.format) && this.device.isTextureFormatFilterable(this.props.format);
|
|
3317
3541
|
if (!isFilterableAndRenderable) {
|
|
@@ -3391,87 +3615,6 @@ ${source}`;
|
|
|
3391
3615
|
}
|
|
3392
3616
|
});
|
|
3393
3617
|
|
|
3394
|
-
// ../../node_modules/@luma.gl/webgl/dist/adapter/converters/webgl-shadertypes.js
|
|
3395
|
-
function convertDataTypeToGLDataType(normalizedType) {
|
|
3396
|
-
return NORMALIZED_SHADER_TYPE_TO_WEBGL[normalizedType];
|
|
3397
|
-
}
|
|
3398
|
-
function convertGLUniformTypeToShaderVariableType(glUniformType) {
|
|
3399
|
-
return WEBGL_SHADER_TYPES[glUniformType];
|
|
3400
|
-
}
|
|
3401
|
-
function isGLSamplerType(type) {
|
|
3402
|
-
return Boolean(WEBGL_SAMPLER_TO_TEXTURE_BINDINGS[type]);
|
|
3403
|
-
}
|
|
3404
|
-
function getTextureBindingFromGLSamplerType(glSamplerType) {
|
|
3405
|
-
return WEBGL_SAMPLER_TO_TEXTURE_BINDINGS[glSamplerType];
|
|
3406
|
-
}
|
|
3407
|
-
var WEBGL_SHADER_TYPES, WEBGL_SAMPLER_TO_TEXTURE_BINDINGS, NORMALIZED_SHADER_TYPE_TO_WEBGL;
|
|
3408
|
-
var init_webgl_shadertypes = __esm({
|
|
3409
|
-
"../../node_modules/@luma.gl/webgl/dist/adapter/converters/webgl-shadertypes.js"() {
|
|
3410
|
-
WEBGL_SHADER_TYPES = {
|
|
3411
|
-
[5126]: "f32",
|
|
3412
|
-
[35664]: "vec2<f32>",
|
|
3413
|
-
[35665]: "vec3<f32>",
|
|
3414
|
-
[35666]: "vec4<f32>",
|
|
3415
|
-
[5124]: "i32",
|
|
3416
|
-
[35667]: "vec2<i32>",
|
|
3417
|
-
[35668]: "vec3<i32>",
|
|
3418
|
-
[35669]: "vec4<i32>",
|
|
3419
|
-
[5125]: "u32",
|
|
3420
|
-
[36294]: "vec2<u32>",
|
|
3421
|
-
[36295]: "vec3<u32>",
|
|
3422
|
-
[36296]: "vec4<u32>",
|
|
3423
|
-
[35670]: "f32",
|
|
3424
|
-
[35671]: "vec2<f32>",
|
|
3425
|
-
[35672]: "vec3<f32>",
|
|
3426
|
-
[35673]: "vec4<f32>",
|
|
3427
|
-
// TODO - are sizes/components below correct?
|
|
3428
|
-
[35674]: "mat2x2<f32>",
|
|
3429
|
-
[35685]: "mat2x3<f32>",
|
|
3430
|
-
[35686]: "mat2x4<f32>",
|
|
3431
|
-
[35687]: "mat3x2<f32>",
|
|
3432
|
-
[35675]: "mat3x3<f32>",
|
|
3433
|
-
[35688]: "mat3x4<f32>",
|
|
3434
|
-
[35689]: "mat4x2<f32>",
|
|
3435
|
-
[35690]: "mat4x3<f32>",
|
|
3436
|
-
[35676]: "mat4x4<f32>"
|
|
3437
|
-
};
|
|
3438
|
-
WEBGL_SAMPLER_TO_TEXTURE_BINDINGS = {
|
|
3439
|
-
[35678]: { viewDimension: "2d", sampleType: "float" },
|
|
3440
|
-
[35680]: { viewDimension: "cube", sampleType: "float" },
|
|
3441
|
-
[35679]: { viewDimension: "3d", sampleType: "float" },
|
|
3442
|
-
[35682]: { viewDimension: "3d", sampleType: "depth" },
|
|
3443
|
-
[36289]: { viewDimension: "2d-array", sampleType: "float" },
|
|
3444
|
-
[36292]: { viewDimension: "2d-array", sampleType: "depth" },
|
|
3445
|
-
[36293]: { viewDimension: "cube", sampleType: "float" },
|
|
3446
|
-
[36298]: { viewDimension: "2d", sampleType: "sint" },
|
|
3447
|
-
[36299]: { viewDimension: "3d", sampleType: "sint" },
|
|
3448
|
-
[36300]: { viewDimension: "cube", sampleType: "sint" },
|
|
3449
|
-
[36303]: { viewDimension: "2d-array", sampleType: "uint" },
|
|
3450
|
-
[36306]: { viewDimension: "2d", sampleType: "uint" },
|
|
3451
|
-
[36307]: { viewDimension: "3d", sampleType: "uint" },
|
|
3452
|
-
[36308]: { viewDimension: "cube", sampleType: "uint" },
|
|
3453
|
-
[36311]: { viewDimension: "2d-array", sampleType: "uint" }
|
|
3454
|
-
};
|
|
3455
|
-
NORMALIZED_SHADER_TYPE_TO_WEBGL = {
|
|
3456
|
-
uint8: 5121,
|
|
3457
|
-
sint8: 5120,
|
|
3458
|
-
unorm8: 5121,
|
|
3459
|
-
snorm8: 5120,
|
|
3460
|
-
uint16: 5123,
|
|
3461
|
-
sint16: 5122,
|
|
3462
|
-
unorm16: 5123,
|
|
3463
|
-
snorm16: 5122,
|
|
3464
|
-
uint32: 5125,
|
|
3465
|
-
sint32: 5124,
|
|
3466
|
-
// WebGPU does not support normalized 32 bit integer attributes
|
|
3467
|
-
// 'unorm32': GL.UNSIGNED_INT,
|
|
3468
|
-
// 'snorm32': GL.INT,
|
|
3469
|
-
float16: 5131,
|
|
3470
|
-
float32: 5126
|
|
3471
|
-
};
|
|
3472
|
-
}
|
|
3473
|
-
});
|
|
3474
|
-
|
|
3475
3618
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/helpers/get-shader-layout-from-glsl.js
|
|
3476
3619
|
function getShaderLayoutFromGLSL(gl, program) {
|
|
3477
3620
|
const shaderLayout = {
|
|
@@ -3563,7 +3706,7 @@ ${source}`;
|
|
|
3563
3706
|
}
|
|
3564
3707
|
const { name, type: glUniformType, size } = activeInfo;
|
|
3565
3708
|
const uniformType = convertGLUniformTypeToShaderVariableType(glUniformType);
|
|
3566
|
-
const { type, components } = (0,
|
|
3709
|
+
const { type, components } = (0, import_core16.getVariableShaderTypeInfo)(uniformType);
|
|
3567
3710
|
varyings.push({ location, name, type, size: size * components });
|
|
3568
3711
|
}
|
|
3569
3712
|
varyings.sort((a, b) => a.location - b.location);
|
|
@@ -3664,10 +3807,10 @@ ${source}`;
|
|
|
3664
3807
|
isArray: Boolean(matches[2])
|
|
3665
3808
|
};
|
|
3666
3809
|
}
|
|
3667
|
-
var
|
|
3810
|
+
var import_core16;
|
|
3668
3811
|
var init_get_shader_layout_from_glsl = __esm({
|
|
3669
3812
|
"../../node_modules/@luma.gl/webgl/dist/adapter/helpers/get-shader-layout-from-glsl.js"() {
|
|
3670
|
-
|
|
3813
|
+
import_core16 = __toESM(require_core2(), 1);
|
|
3671
3814
|
init_webgl_shadertypes();
|
|
3672
3815
|
}
|
|
3673
3816
|
});
|
|
@@ -3808,7 +3951,7 @@ ${source}`;
|
|
|
3808
3951
|
for (const attribute of overrideLayout?.attributes || []) {
|
|
3809
3952
|
const baseAttribute = mergedLayout.attributes.find((attr) => attr.name === attribute.name);
|
|
3810
3953
|
if (!baseAttribute) {
|
|
3811
|
-
|
|
3954
|
+
import_core17.log.warn(`shader layout attribute ${attribute.name} not present in shader`);
|
|
3812
3955
|
} else {
|
|
3813
3956
|
baseAttribute.type = attribute.type || baseAttribute.type;
|
|
3814
3957
|
baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
|
|
@@ -3816,10 +3959,10 @@ ${source}`;
|
|
|
3816
3959
|
}
|
|
3817
3960
|
return mergedLayout;
|
|
3818
3961
|
}
|
|
3819
|
-
var
|
|
3962
|
+
var import_core17, LOG_PROGRAM_PERF_PRIORITY, WEBGLRenderPipeline;
|
|
3820
3963
|
var init_webgl_render_pipeline = __esm({
|
|
3821
3964
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-render-pipeline.js"() {
|
|
3822
|
-
|
|
3965
|
+
import_core17 = __toESM(require_core2(), 1);
|
|
3823
3966
|
init_get_shader_layout_from_glsl();
|
|
3824
3967
|
init_device_parameters();
|
|
3825
3968
|
init_set_uniform();
|
|
@@ -3829,7 +3972,7 @@ ${source}`;
|
|
|
3829
3972
|
init_webgl_texture_view();
|
|
3830
3973
|
init_webgl_topology_utils();
|
|
3831
3974
|
LOG_PROGRAM_PERF_PRIORITY = 4;
|
|
3832
|
-
WEBGLRenderPipeline = class extends
|
|
3975
|
+
WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
3833
3976
|
/** The WebGL device that created this render pipeline */
|
|
3834
3977
|
device;
|
|
3835
3978
|
/** Handle to underlying WebGL program */
|
|
@@ -3865,9 +4008,9 @@ ${source}`;
|
|
|
3865
4008
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
3866
4009
|
}
|
|
3867
4010
|
this._linkShaders();
|
|
3868
|
-
|
|
4011
|
+
import_core17.log.time(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3869
4012
|
this.introspectedLayout = getShaderLayoutFromGLSL(this.device.gl, this.handle);
|
|
3870
|
-
|
|
4013
|
+
import_core17.log.timeEnd(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3871
4014
|
this.shaderLayout = props.shaderLayout ? mergeShaderLayout(this.introspectedLayout, props.shaderLayout) : this.introspectedLayout;
|
|
3872
4015
|
}
|
|
3873
4016
|
destroy() {
|
|
@@ -3889,12 +4032,12 @@ ${source}`;
|
|
|
3889
4032
|
if (!binding) {
|
|
3890
4033
|
const validBindings = this.shaderLayout.bindings.map((binding_) => `"${binding_.name}"`).join(", ");
|
|
3891
4034
|
if (!options?.disableWarnings) {
|
|
3892
|
-
|
|
4035
|
+
import_core17.log.warn(`No binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`, value)();
|
|
3893
4036
|
}
|
|
3894
4037
|
continue;
|
|
3895
4038
|
}
|
|
3896
4039
|
if (!value) {
|
|
3897
|
-
|
|
4040
|
+
import_core17.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
|
|
3898
4041
|
}
|
|
3899
4042
|
switch (binding.type) {
|
|
3900
4043
|
case "uniform":
|
|
@@ -3908,7 +4051,7 @@ ${source}`;
|
|
|
3908
4051
|
}
|
|
3909
4052
|
break;
|
|
3910
4053
|
case "sampler":
|
|
3911
|
-
|
|
4054
|
+
import_core17.log.warn(`Ignoring sampler ${name}`)();
|
|
3912
4055
|
break;
|
|
3913
4056
|
default:
|
|
3914
4057
|
throw new Error(binding.type);
|
|
@@ -3940,11 +4083,11 @@ ${source}`;
|
|
|
3940
4083
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
3941
4084
|
const glIndexType = vertexArray.indexBuffer?.glIndexType;
|
|
3942
4085
|
if (this.linkStatus !== "success") {
|
|
3943
|
-
|
|
4086
|
+
import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
|
|
3944
4087
|
return false;
|
|
3945
4088
|
}
|
|
3946
4089
|
if (!this._areTexturesRenderable()) {
|
|
3947
|
-
|
|
4090
|
+
import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
|
|
3948
4091
|
return false;
|
|
3949
4092
|
}
|
|
3950
4093
|
this.device.gl.useProgram(this.handle);
|
|
@@ -3986,19 +4129,19 @@ ${source}`;
|
|
|
3986
4129
|
const { gl } = this.device;
|
|
3987
4130
|
gl.attachShader(this.handle, this.vs.handle);
|
|
3988
4131
|
gl.attachShader(this.handle, this.fs.handle);
|
|
3989
|
-
|
|
4132
|
+
import_core17.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
3990
4133
|
gl.linkProgram(this.handle);
|
|
3991
|
-
|
|
3992
|
-
if (
|
|
4134
|
+
import_core17.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
4135
|
+
if (import_core17.log.level === 0) {
|
|
3993
4136
|
}
|
|
3994
4137
|
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3995
4138
|
const status2 = this._getLinkStatus();
|
|
3996
4139
|
this._reportLinkStatus(status2);
|
|
3997
4140
|
return;
|
|
3998
4141
|
}
|
|
3999
|
-
|
|
4142
|
+
import_core17.log.once(1, "RenderPipeline linking is asynchronous")();
|
|
4000
4143
|
await this._waitForLinkComplete();
|
|
4001
|
-
|
|
4144
|
+
import_core17.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
|
|
4002
4145
|
const status = this._getLinkStatus();
|
|
4003
4146
|
this._reportLinkStatus(status);
|
|
4004
4147
|
}
|
|
@@ -4083,7 +4226,7 @@ ${source}`;
|
|
|
4083
4226
|
let texturesRenderable = true;
|
|
4084
4227
|
for (const bindingInfo of this.shaderLayout.bindings) {
|
|
4085
4228
|
if (!this.bindings[bindingInfo.name] && !this.bindings[bindingInfo.name.replace(/Uniforms$/, "")]) {
|
|
4086
|
-
|
|
4229
|
+
import_core17.log.warn(`Binding ${bindingInfo.name} not found in ${this.id}`)();
|
|
4087
4230
|
texturesRenderable = false;
|
|
4088
4231
|
}
|
|
4089
4232
|
}
|
|
@@ -4137,7 +4280,7 @@ ${source}`;
|
|
|
4137
4280
|
} else if (value instanceof WEBGLTexture) {
|
|
4138
4281
|
texture = value;
|
|
4139
4282
|
} else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTextureView) {
|
|
4140
|
-
|
|
4283
|
+
import_core17.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
|
|
4141
4284
|
texture = value.colorAttachments[0].texture;
|
|
4142
4285
|
} else {
|
|
4143
4286
|
throw new Error("No texture");
|
|
@@ -4304,7 +4447,7 @@ ${source}`;
|
|
|
4304
4447
|
}
|
|
4305
4448
|
}
|
|
4306
4449
|
function getFramebuffer(source) {
|
|
4307
|
-
if (source instanceof
|
|
4450
|
+
if (source instanceof import_core18.Texture) {
|
|
4308
4451
|
const { width, height, id } = source;
|
|
4309
4452
|
const framebuffer = source.device.createFramebuffer({
|
|
4310
4453
|
id: `framebuffer-for-${id}`,
|
|
@@ -4316,13 +4459,13 @@ ${source}`;
|
|
|
4316
4459
|
}
|
|
4317
4460
|
return { framebuffer: source, destroyFramebuffer: false };
|
|
4318
4461
|
}
|
|
4319
|
-
var
|
|
4462
|
+
var import_core18, WEBGLCommandBuffer;
|
|
4320
4463
|
var init_webgl_command_buffer = __esm({
|
|
4321
4464
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-command-buffer.js"() {
|
|
4322
|
-
|
|
4465
|
+
import_core18 = __toESM(require_core2(), 1);
|
|
4323
4466
|
init_webgl_texture();
|
|
4324
4467
|
init_webgl_texture_table();
|
|
4325
|
-
WEBGLCommandBuffer = class extends
|
|
4468
|
+
WEBGLCommandBuffer = class extends import_core18.CommandBuffer {
|
|
4326
4469
|
device;
|
|
4327
4470
|
handle = null;
|
|
4328
4471
|
commands = [];
|
|
@@ -4355,14 +4498,14 @@ ${source}`;
|
|
|
4355
4498
|
});
|
|
4356
4499
|
|
|
4357
4500
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-render-pass.js
|
|
4358
|
-
var
|
|
4501
|
+
var import_core19, COLOR_CHANNELS, WEBGLRenderPass;
|
|
4359
4502
|
var init_webgl_render_pass = __esm({
|
|
4360
4503
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-render-pass.js"() {
|
|
4361
|
-
|
|
4504
|
+
import_core19 = __toESM(require_core2(), 1);
|
|
4362
4505
|
init_with_parameters();
|
|
4363
4506
|
init_unified_parameter_api();
|
|
4364
4507
|
COLOR_CHANNELS = [1, 2, 4, 8];
|
|
4365
|
-
WEBGLRenderPass = class extends
|
|
4508
|
+
WEBGLRenderPass = class extends import_core19.RenderPass {
|
|
4366
4509
|
device;
|
|
4367
4510
|
handle = null;
|
|
4368
4511
|
/** Parameters that should be applied before each draw call */
|
|
@@ -4386,7 +4529,7 @@ ${source}`;
|
|
|
4386
4529
|
if (this.props.framebuffer && webglFramebuffer?.handle) {
|
|
4387
4530
|
const drawBuffers = this.props.framebuffer.colorAttachments.map((_, i) => 36064 + i);
|
|
4388
4531
|
this.device.gl.drawBuffers(drawBuffers);
|
|
4389
|
-
} else {
|
|
4532
|
+
} else if (!this.props.framebuffer) {
|
|
4390
4533
|
this.device.gl.drawBuffers([1029]);
|
|
4391
4534
|
}
|
|
4392
4535
|
this.clear();
|
|
@@ -4432,9 +4575,9 @@ ${source}`;
|
|
|
4432
4575
|
if (parameters.blendConstant) {
|
|
4433
4576
|
glParameters.blendColor = parameters.blendConstant;
|
|
4434
4577
|
}
|
|
4435
|
-
if (parameters.stencilReference) {
|
|
4436
|
-
console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
|
|
4578
|
+
if (parameters.stencilReference !== void 0) {
|
|
4437
4579
|
glParameters[2967] = parameters.stencilReference;
|
|
4580
|
+
glParameters[36003] = parameters.stencilReference;
|
|
4438
4581
|
}
|
|
4439
4582
|
if ("colorMask" in parameters) {
|
|
4440
4583
|
glParameters.colorMask = COLOR_CHANNELS.map((channel) => Boolean(channel & parameters.colorMask));
|
|
@@ -4512,13 +4655,13 @@ ${source}`;
|
|
|
4512
4655
|
});
|
|
4513
4656
|
|
|
4514
4657
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-command-encoder.js
|
|
4515
|
-
var
|
|
4658
|
+
var import_core20, WEBGLCommandEncoder;
|
|
4516
4659
|
var init_webgl_command_encoder = __esm({
|
|
4517
4660
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-command-encoder.js"() {
|
|
4518
|
-
|
|
4661
|
+
import_core20 = __toESM(require_core2(), 1);
|
|
4519
4662
|
init_webgl_command_buffer();
|
|
4520
4663
|
init_webgl_render_pass();
|
|
4521
|
-
WEBGLCommandEncoder = class extends
|
|
4664
|
+
WEBGLCommandEncoder = class extends import_core20.CommandEncoder {
|
|
4522
4665
|
device;
|
|
4523
4666
|
handle = null;
|
|
4524
4667
|
commandBuffer;
|
|
@@ -4608,14 +4751,14 @@ ${source}`;
|
|
|
4608
4751
|
}
|
|
4609
4752
|
return true;
|
|
4610
4753
|
}
|
|
4611
|
-
var
|
|
4754
|
+
var import_core21, WEBGLVertexArray;
|
|
4612
4755
|
var init_webgl_vertex_array = __esm({
|
|
4613
4756
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-vertex-array.js"() {
|
|
4614
|
-
|
|
4757
|
+
import_core21 = __toESM(require_core2(), 1);
|
|
4615
4758
|
init_dist2();
|
|
4616
4759
|
init_webgl_vertex_formats();
|
|
4617
4760
|
init_fill_array();
|
|
4618
|
-
WEBGLVertexArray = class extends
|
|
4761
|
+
WEBGLVertexArray = class extends import_core21.VertexArray {
|
|
4619
4762
|
get [Symbol.toStringTag]() {
|
|
4620
4763
|
return "VertexArray";
|
|
4621
4764
|
}
|
|
@@ -4781,7 +4924,7 @@ ${source}`;
|
|
|
4781
4924
|
this.buffer = this.buffer || this.device.createBuffer({ byteLength });
|
|
4782
4925
|
updateNeeded ||= !compareConstantArrayValues(constantValue, this.bufferValue);
|
|
4783
4926
|
if (updateNeeded) {
|
|
4784
|
-
const typedArray = (0,
|
|
4927
|
+
const typedArray = (0, import_core21.getScratchArray)(value.constructor, length);
|
|
4785
4928
|
fillArray({ target: typedArray, source: constantValue, start: 0, count: length });
|
|
4786
4929
|
this.buffer.write(typedArray);
|
|
4787
4930
|
this.bufferValue = value;
|
|
@@ -4799,13 +4942,13 @@ ${source}`;
|
|
|
4799
4942
|
}
|
|
4800
4943
|
return /^\d+$/.test(value);
|
|
4801
4944
|
}
|
|
4802
|
-
var
|
|
4945
|
+
var import_core22, WEBGLTransformFeedback;
|
|
4803
4946
|
var init_webgl_transform_feedback = __esm({
|
|
4804
4947
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-transform-feedback.js"() {
|
|
4805
|
-
|
|
4948
|
+
import_core22 = __toESM(require_core2(), 1);
|
|
4806
4949
|
init_dist3();
|
|
4807
4950
|
init_webgl_topology_utils();
|
|
4808
|
-
WEBGLTransformFeedback = class extends
|
|
4951
|
+
WEBGLTransformFeedback = class extends import_core22.TransformFeedback {
|
|
4809
4952
|
device;
|
|
4810
4953
|
gl;
|
|
4811
4954
|
handle;
|
|
@@ -4868,7 +5011,7 @@ ${source}`;
|
|
|
4868
5011
|
const { buffer, byteLength, byteOffset } = this._getBufferRange(bufferOrRange);
|
|
4869
5012
|
if (location < 0) {
|
|
4870
5013
|
this.unusedBuffers[locationOrName] = buffer;
|
|
4871
|
-
|
|
5014
|
+
import_core22.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
|
|
4872
5015
|
return;
|
|
4873
5016
|
}
|
|
4874
5017
|
this.buffers[location] = { buffer, byteLength, byteOffset };
|
|
@@ -4951,11 +5094,11 @@ ${source}`;
|
|
|
4951
5094
|
});
|
|
4952
5095
|
|
|
4953
5096
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-query-set.js
|
|
4954
|
-
var
|
|
5097
|
+
var import_core23, WEBGLQuerySet;
|
|
4955
5098
|
var init_webgl_query_set = __esm({
|
|
4956
5099
|
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-query-set.js"() {
|
|
4957
|
-
|
|
4958
|
-
WEBGLQuerySet = class extends
|
|
5100
|
+
import_core23 = __toESM(require_core2(), 1);
|
|
5101
|
+
WEBGLQuerySet = class extends import_core23.QuerySet {
|
|
4959
5102
|
device;
|
|
4960
5103
|
handle;
|
|
4961
5104
|
target = null;
|
|
@@ -5088,6 +5231,56 @@ ${source}`;
|
|
|
5088
5231
|
}
|
|
5089
5232
|
});
|
|
5090
5233
|
|
|
5234
|
+
// ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-fence.js
|
|
5235
|
+
var import_core24, WEBGLFence;
|
|
5236
|
+
var init_webgl_fence = __esm({
|
|
5237
|
+
"../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-fence.js"() {
|
|
5238
|
+
import_core24 = __toESM(require_core2(), 1);
|
|
5239
|
+
WEBGLFence = class extends import_core24.Fence {
|
|
5240
|
+
device;
|
|
5241
|
+
gl;
|
|
5242
|
+
handle;
|
|
5243
|
+
signaled;
|
|
5244
|
+
_signaled = false;
|
|
5245
|
+
constructor(device, props = {}) {
|
|
5246
|
+
super(device, {});
|
|
5247
|
+
this.device = device;
|
|
5248
|
+
this.gl = device.gl;
|
|
5249
|
+
const sync = this.props.handle || this.gl.fenceSync(this.gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
5250
|
+
if (!sync) {
|
|
5251
|
+
throw new Error("Failed to create WebGL fence");
|
|
5252
|
+
}
|
|
5253
|
+
this.handle = sync;
|
|
5254
|
+
this.signaled = new Promise((resolve) => {
|
|
5255
|
+
const poll = () => {
|
|
5256
|
+
const status = this.gl.clientWaitSync(this.handle, 0, 0);
|
|
5257
|
+
if (status === this.gl.ALREADY_SIGNALED || status === this.gl.CONDITION_SATISFIED) {
|
|
5258
|
+
this._signaled = true;
|
|
5259
|
+
resolve();
|
|
5260
|
+
} else {
|
|
5261
|
+
setTimeout(poll, 1);
|
|
5262
|
+
}
|
|
5263
|
+
};
|
|
5264
|
+
poll();
|
|
5265
|
+
});
|
|
5266
|
+
}
|
|
5267
|
+
isSignaled() {
|
|
5268
|
+
if (this._signaled) {
|
|
5269
|
+
return true;
|
|
5270
|
+
}
|
|
5271
|
+
const status = this.gl.getSyncParameter(this.handle, this.gl.SYNC_STATUS);
|
|
5272
|
+
this._signaled = status === this.gl.SIGNALED;
|
|
5273
|
+
return this._signaled;
|
|
5274
|
+
}
|
|
5275
|
+
destroy() {
|
|
5276
|
+
if (!this.destroyed) {
|
|
5277
|
+
this.gl.deleteSync(this.handle);
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
5280
|
+
};
|
|
5281
|
+
}
|
|
5282
|
+
});
|
|
5283
|
+
|
|
5091
5284
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/helpers/format-utils.js
|
|
5092
5285
|
function glFormatToComponents(format) {
|
|
5093
5286
|
switch (format) {
|
|
@@ -5133,34 +5326,6 @@ ${source}`;
|
|
|
5133
5326
|
}
|
|
5134
5327
|
});
|
|
5135
5328
|
|
|
5136
|
-
// ../../node_modules/@luma.gl/webgl/dist/adapter/converters/shader-formats.js
|
|
5137
|
-
function convertGLDataTypeToDataType(type) {
|
|
5138
|
-
return GL_DATA_TYPE_MAP[type];
|
|
5139
|
-
}
|
|
5140
|
-
var GL_DATA_TYPE_MAP;
|
|
5141
|
-
var init_shader_formats = __esm({
|
|
5142
|
-
"../../node_modules/@luma.gl/webgl/dist/adapter/converters/shader-formats.js"() {
|
|
5143
|
-
GL_DATA_TYPE_MAP = {
|
|
5144
|
-
[5124]: "sint32",
|
|
5145
|
-
[5125]: "uint32",
|
|
5146
|
-
[5122]: "sint16",
|
|
5147
|
-
[5123]: "uint16",
|
|
5148
|
-
[5120]: "sint8",
|
|
5149
|
-
[5121]: "uint8",
|
|
5150
|
-
[5126]: "float32",
|
|
5151
|
-
[5131]: "float16",
|
|
5152
|
-
[33635]: "uint16",
|
|
5153
|
-
[32819]: "uint16",
|
|
5154
|
-
[32820]: "uint16",
|
|
5155
|
-
[33640]: "uint32",
|
|
5156
|
-
[35899]: "uint32",
|
|
5157
|
-
[35902]: "uint32",
|
|
5158
|
-
[34042]: "uint32",
|
|
5159
|
-
[36269]: "uint32"
|
|
5160
|
-
};
|
|
5161
|
-
}
|
|
5162
|
-
});
|
|
5163
|
-
|
|
5164
5329
|
// ../../node_modules/@luma.gl/webgl/dist/adapter/helpers/webgl-texture-utils.js
|
|
5165
5330
|
function readPixelsToArray(source, options) {
|
|
5166
5331
|
const {
|
|
@@ -5190,7 +5355,7 @@ ${source}`;
|
|
|
5190
5355
|
sourceFormat ||= texture?.glFormat || 6408;
|
|
5191
5356
|
sourceType ||= texture?.glType || 5121;
|
|
5192
5357
|
target2 = getPixelArray(target2, sourceType, sourceFormat, sourceWidth, sourceHeight, sourceDepth);
|
|
5193
|
-
const signedType = (0,
|
|
5358
|
+
const signedType = (0, import_core25.getDataType)(target2);
|
|
5194
5359
|
sourceType = sourceType || convertDataTypeToGLDataType(signedType);
|
|
5195
5360
|
const prevHandle = gl.bindFramebuffer(36160, handle);
|
|
5196
5361
|
gl.readBuffer(36064 + sourceAttachment);
|
|
@@ -5233,7 +5398,7 @@ ${source}`;
|
|
|
5233
5398
|
return webglBufferTarget;
|
|
5234
5399
|
}
|
|
5235
5400
|
function getFramebuffer2(source) {
|
|
5236
|
-
if (!(source instanceof
|
|
5401
|
+
if (!(source instanceof import_core25.Framebuffer)) {
|
|
5237
5402
|
return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
|
|
5238
5403
|
}
|
|
5239
5404
|
return { framebuffer: source, deleteFramebuffer: false };
|
|
@@ -5255,14 +5420,14 @@ ${source}`;
|
|
|
5255
5420
|
}
|
|
5256
5421
|
glType ||= 5121;
|
|
5257
5422
|
const shaderType = convertGLDataTypeToDataType(glType);
|
|
5258
|
-
const ArrayType = (0,
|
|
5423
|
+
const ArrayType = (0, import_core25.getTypedArrayConstructor)(shaderType);
|
|
5259
5424
|
const components = glFormatToComponents(glFormat);
|
|
5260
5425
|
return new ArrayType(width * height * components);
|
|
5261
5426
|
}
|
|
5262
|
-
var
|
|
5427
|
+
var import_core25;
|
|
5263
5428
|
var init_webgl_texture_utils = __esm({
|
|
5264
5429
|
"../../node_modules/@luma.gl/webgl/dist/adapter/helpers/webgl-texture-utils.js"() {
|
|
5265
|
-
|
|
5430
|
+
import_core25 = __toESM(require_core2(), 1);
|
|
5266
5431
|
init_webgl_shadertypes();
|
|
5267
5432
|
init_format_utils();
|
|
5268
5433
|
init_shader_formats();
|
|
@@ -5304,10 +5469,10 @@ ${source}`;
|
|
|
5304
5469
|
}
|
|
5305
5470
|
return true;
|
|
5306
5471
|
}
|
|
5307
|
-
var
|
|
5472
|
+
var import_core26, WebGLDevice;
|
|
5308
5473
|
var init_webgl_device = __esm({
|
|
5309
5474
|
"../../node_modules/@luma.gl/webgl/dist/adapter/webgl-device.js"() {
|
|
5310
|
-
|
|
5475
|
+
import_core26 = __toESM(require_core2(), 1);
|
|
5311
5476
|
init_webgl_state_tracker();
|
|
5312
5477
|
init_create_browser_context();
|
|
5313
5478
|
init_webgl_device_info();
|
|
@@ -5328,11 +5493,12 @@ ${source}`;
|
|
|
5328
5493
|
init_webgl_vertex_array();
|
|
5329
5494
|
init_webgl_transform_feedback();
|
|
5330
5495
|
init_webgl_query_set();
|
|
5496
|
+
init_webgl_fence();
|
|
5331
5497
|
init_webgl_texture_utils();
|
|
5332
5498
|
init_unified_parameter_api();
|
|
5333
5499
|
init_with_parameters();
|
|
5334
5500
|
init_webgl_extensions();
|
|
5335
|
-
WebGLDevice = class extends
|
|
5501
|
+
WebGLDevice = class extends import_core26.Device {
|
|
5336
5502
|
// Public `Device` API
|
|
5337
5503
|
/** type of this device */
|
|
5338
5504
|
type = "webgl";
|
|
@@ -5377,7 +5543,7 @@ ${source}`;
|
|
|
5377
5543
|
}
|
|
5378
5544
|
constructor(props) {
|
|
5379
5545
|
super({ ...props, id: props.id || uid("webgl-device") });
|
|
5380
|
-
const canvasContextProps =
|
|
5546
|
+
const canvasContextProps = import_core26.Device._getCanvasContextProps(props);
|
|
5381
5547
|
if (!canvasContextProps) {
|
|
5382
5548
|
throw new Error("WebGLDevice requires props.createCanvasContext to be set");
|
|
5383
5549
|
}
|
|
@@ -5396,6 +5562,9 @@ ${source}`;
|
|
|
5396
5562
|
if (props.powerPreference !== void 0) {
|
|
5397
5563
|
webglContextAttributes.powerPreference = props.powerPreference;
|
|
5398
5564
|
}
|
|
5565
|
+
if (props.failIfMajorPerformanceCaveat !== void 0) {
|
|
5566
|
+
webglContextAttributes.failIfMajorPerformanceCaveat = props.failIfMajorPerformanceCaveat;
|
|
5567
|
+
}
|
|
5399
5568
|
const externalGLContext = this.props._handle;
|
|
5400
5569
|
const gl = externalGLContext || createBrowserContext(this.canvasContext.canvas, {
|
|
5401
5570
|
onContextLost: (event) => this._resolveContextLost?.({
|
|
@@ -5411,7 +5580,7 @@ ${source}`;
|
|
|
5411
5580
|
device = gl.device;
|
|
5412
5581
|
if (device) {
|
|
5413
5582
|
if (props._reuseDevices) {
|
|
5414
|
-
|
|
5583
|
+
import_core26.log.log(1, `Not creating a new Device, instead returning a reference to Device ${device.id} already attached to WebGL context`, device)();
|
|
5415
5584
|
device._reused = true;
|
|
5416
5585
|
return device;
|
|
5417
5586
|
}
|
|
@@ -5421,7 +5590,6 @@ ${source}`;
|
|
|
5421
5590
|
this.gl = gl;
|
|
5422
5591
|
this.spectorJS = initializeSpectorJS({ ...this.props, gl: this.handle });
|
|
5423
5592
|
this.gl.device = this;
|
|
5424
|
-
this.gl._version = 2;
|
|
5425
5593
|
this.info = getDeviceInfo(this.gl, this._extensions);
|
|
5426
5594
|
this.limits = new WebGLDeviceLimits(this.gl);
|
|
5427
5595
|
this.features = new WebGLDeviceFeatures(this.gl, this._extensions, this.props._disabledFeatures);
|
|
@@ -5429,17 +5597,15 @@ ${source}`;
|
|
|
5429
5597
|
this.features.initializeFeatures();
|
|
5430
5598
|
}
|
|
5431
5599
|
const glState = new WebGLStateTracker(this.gl, {
|
|
5432
|
-
log: (...args) =>
|
|
5600
|
+
log: (...args) => import_core26.log.log(1, ...args)()
|
|
5433
5601
|
});
|
|
5434
5602
|
glState.trackState(this.gl, { copyState: false });
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
import_core24.log.level = Math.max(import_core24.log.level, 1);
|
|
5442
|
-
}
|
|
5603
|
+
if (props.debug || props.debugWebGL) {
|
|
5604
|
+
this.gl = makeDebugContext(this.gl, { debugWebGL: true, traceWebGL: props.debugWebGL });
|
|
5605
|
+
import_core26.log.warn("WebGL debug mode activated. Performance reduced.")();
|
|
5606
|
+
}
|
|
5607
|
+
if (props.debugWebGL) {
|
|
5608
|
+
import_core26.log.level = Math.max(import_core26.log.level, 1);
|
|
5443
5609
|
}
|
|
5444
5610
|
this.commandEncoder = new WEBGLCommandEncoder(this, { id: `${this}-command-encoder` });
|
|
5445
5611
|
}
|
|
@@ -5462,9 +5628,6 @@ ${source}`;
|
|
|
5462
5628
|
return this.gl.isContextLost();
|
|
5463
5629
|
}
|
|
5464
5630
|
// IMPLEMENTATION OF ABSTRACT DEVICE
|
|
5465
|
-
getTextureByteAlignment() {
|
|
5466
|
-
return 4;
|
|
5467
|
-
}
|
|
5468
5631
|
createCanvasContext(props) {
|
|
5469
5632
|
throw new Error("WebGL only supports a single canvas");
|
|
5470
5633
|
}
|
|
@@ -5496,6 +5659,9 @@ ${source}`;
|
|
|
5496
5659
|
createQuerySet(props) {
|
|
5497
5660
|
return new WEBGLQuerySet(this, props);
|
|
5498
5661
|
}
|
|
5662
|
+
createFence() {
|
|
5663
|
+
return new WEBGLFence(this);
|
|
5664
|
+
}
|
|
5499
5665
|
createRenderPipeline(props) {
|
|
5500
5666
|
return new WEBGLRenderPipeline(this, props);
|
|
5501
5667
|
}
|
|
@@ -5539,7 +5705,7 @@ ${source}`;
|
|
|
5539
5705
|
return withGLParameters(this.gl, parameters, func);
|
|
5540
5706
|
}
|
|
5541
5707
|
resetWebGL() {
|
|
5542
|
-
|
|
5708
|
+
import_core26.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
|
|
5543
5709
|
resetGLParameters(this.gl);
|
|
5544
5710
|
}
|
|
5545
5711
|
_getDeviceSpecificTextureFormatCapabilities(capabilities) {
|
|
@@ -5611,7 +5777,7 @@ ${source}`;
|
|
|
5611
5777
|
this._constants = this._constants || new Array(maxVertexAttributes).fill(null);
|
|
5612
5778
|
const currentConstant = this._constants[location];
|
|
5613
5779
|
if (currentConstant && compareConstantArrayValues2(currentConstant, constant)) {
|
|
5614
|
-
|
|
5780
|
+
import_core26.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
|
|
5615
5781
|
}
|
|
5616
5782
|
this._constants[location] = constant;
|
|
5617
5783
|
switch (constant.constructor) {
|
|
@@ -5955,12 +6121,12 @@ ${source}`;
|
|
|
5955
6121
|
}
|
|
5956
6122
|
|
|
5957
6123
|
// dist/commons.js
|
|
5958
|
-
var
|
|
6124
|
+
var import_core27 = __toESM(require_core(), 1);
|
|
5959
6125
|
var import_engine = __toESM(require_engine(), 1);
|
|
5960
6126
|
init_dist3();
|
|
5961
6127
|
async function createDeckInstance(gl) {
|
|
5962
6128
|
return new Promise((resolve) => {
|
|
5963
|
-
const deckInstance = new
|
|
6129
|
+
const deckInstance = new import_core27.Deck({
|
|
5964
6130
|
// Input is handled by the ArcGIS API for JavaScript.
|
|
5965
6131
|
controller: false,
|
|
5966
6132
|
// We use the same WebGL context as the ArcGIS API for JavaScript.
|