@luma.gl/engine 9.3.0-alpha.9 → 9.3.0
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/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +1 -0
- package/dist/animation-loop/make-animation-loop.js.map +1 -1
- package/dist/compute/computation.js +2 -2
- package/dist/compute/computation.js.map +1 -1
- package/dist/debug/debug-framebuffer.d.ts +9 -4
- package/dist/debug/debug-framebuffer.d.ts.map +1 -1
- package/dist/debug/debug-framebuffer.js +91 -45
- package/dist/debug/debug-framebuffer.js.map +1 -1
- package/dist/dist.dev.js +200 -126
- package/dist/dist.min.js +33 -33
- package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
- package/dist/dynamic-texture/dynamic-texture.js +3 -1
- package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
- package/dist/dynamic-texture/texture-data.js +2 -2
- package/dist/dynamic-texture/texture-data.js.map +1 -1
- package/dist/geometries/cube-geometry.js +7 -7
- package/dist/geometries/cube-geometry.js.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +3 -1
- package/dist/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +3 -0
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/index.cjs +176 -108
- package/dist/index.cjs.map +3 -3
- package/dist/material/material.js +2 -2
- package/dist/material/material.js.map +1 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +45 -34
- package/dist/model/model.js.map +1 -1
- package/dist/models/billboard-texture-model.js +4 -4
- package/dist/models/billboard-texture-module.d.ts +1 -1
- package/dist/models/billboard-texture-module.js +1 -1
- package/dist/models/light-model-utils.js +2 -2
- package/dist/modules/picking/color-picking.d.ts +2 -2
- package/dist/modules/picking/index-picking.d.ts +2 -2
- package/dist/modules/picking/legacy-color-picking.d.ts +4 -4
- package/dist/modules/picking/picking-uniforms.d.ts +1 -1
- package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
- package/dist/modules/picking/picking-uniforms.js +1 -1
- package/dist/modules/picking/picking.d.ts +2 -2
- package/dist/passes/get-fragment-shader.js +4 -4
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +20 -23
- package/dist/shader-inputs.js.map +1 -1
- package/package.json +2 -2
- package/src/animation-loop/make-animation-loop.ts +1 -0
- package/src/compute/computation.ts +2 -2
- package/src/debug/debug-framebuffer.ts +139 -61
- package/src/dynamic-texture/dynamic-texture.ts +3 -5
- package/src/dynamic-texture/texture-data.ts +2 -2
- package/src/dynamic-texture/texture-data.ts.disabled +1 -1
- package/src/geometries/cube-geometry.ts +7 -7
- package/src/geometries/ico-sphere-geometry.ts +3 -1
- package/src/geometry/gpu-geometry.ts +3 -0
- package/src/material/material.ts +2 -2
- package/src/model/model.ts +48 -36
- package/src/models/billboard-texture-model.ts +4 -4
- package/src/models/billboard-texture-module.ts +1 -1
- package/src/models/light-model-utils.ts +2 -2
- package/src/modules/picking/picking-uniforms.ts +1 -1
- package/src/passes/get-fragment-shader.ts +4 -4
- package/src/shader-inputs.ts +32 -41
package/dist/dist.dev.js
CHANGED
|
@@ -726,13 +726,13 @@ var __exports__ = (() => {
|
|
|
726
726
|
if (!this.device || !canvasContext) {
|
|
727
727
|
throw new Error("loop");
|
|
728
728
|
}
|
|
729
|
-
const
|
|
729
|
+
const canvas = canvasContext?.canvas;
|
|
730
730
|
const useDevicePixels = canvasContext.props.useDevicePixels;
|
|
731
731
|
this.animationProps = {
|
|
732
732
|
animationLoop: this,
|
|
733
733
|
device: this.device,
|
|
734
734
|
canvasContext,
|
|
735
|
-
canvas
|
|
735
|
+
canvas,
|
|
736
736
|
// @ts-expect-error Deprecated
|
|
737
737
|
useDevicePixels,
|
|
738
738
|
timeline: this.timeline,
|
|
@@ -934,6 +934,7 @@ var __exports__ = (() => {
|
|
|
934
934
|
renderLoop = new AnimationLoopTemplateCtor(animationProps);
|
|
935
935
|
return await renderLoop?.onInitialize(animationProps);
|
|
936
936
|
} catch (error) {
|
|
937
|
+
console.error(error);
|
|
937
938
|
setError(animationProps.animationLoop.device, error);
|
|
938
939
|
return null;
|
|
939
940
|
}
|
|
@@ -950,9 +951,9 @@ var __exports__ = (() => {
|
|
|
950
951
|
if (!device) {
|
|
951
952
|
return;
|
|
952
953
|
}
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
|
|
954
|
+
const canvas = device.getDefaultCanvasContext().canvas;
|
|
955
|
+
if (canvas instanceof HTMLCanvasElement) {
|
|
956
|
+
canvas.style.overflow = "visible";
|
|
956
957
|
let errorDiv = document.getElementById("animation-loop-error");
|
|
957
958
|
errorDiv?.remove();
|
|
958
959
|
errorDiv = document.createElement("h1");
|
|
@@ -963,7 +964,7 @@ var __exports__ = (() => {
|
|
|
963
964
|
errorDiv.style.left = "10px";
|
|
964
965
|
errorDiv.style.color = "black";
|
|
965
966
|
errorDiv.style.backgroundColor = "red";
|
|
966
|
-
|
|
967
|
+
canvas.parentElement?.appendChild(errorDiv);
|
|
967
968
|
}
|
|
968
969
|
}
|
|
969
970
|
function clearError(device) {
|
|
@@ -1070,6 +1071,9 @@ var __exports__ = (() => {
|
|
|
1070
1071
|
case "TEXCOORD_0":
|
|
1071
1072
|
name = "texCoords";
|
|
1072
1073
|
break;
|
|
1074
|
+
case "TEXCOORD_1":
|
|
1075
|
+
name = "texCoords1";
|
|
1076
|
+
break;
|
|
1073
1077
|
case "COLOR_0":
|
|
1074
1078
|
name = "colors";
|
|
1075
1079
|
break;
|
|
@@ -1114,47 +1118,103 @@ var __exports__ = (() => {
|
|
|
1114
1118
|
}
|
|
1115
1119
|
|
|
1116
1120
|
// src/debug/debug-framebuffer.ts
|
|
1117
|
-
var
|
|
1118
|
-
var
|
|
1119
|
-
function debugFramebuffer(
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
if (
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
for (
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1121
|
+
var DEBUG_FRAMEBUFFER_STATE_KEY = "__debugFramebufferState";
|
|
1122
|
+
var DEFAULT_MARGIN_PX = 8;
|
|
1123
|
+
function debugFramebuffer(renderPass, source3, options) {
|
|
1124
|
+
if (renderPass.device.type !== "webgl") {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
const state = getDebugFramebufferState(renderPass.device);
|
|
1128
|
+
if (state.flushing) {
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
if (isDefaultRenderPass(renderPass)) {
|
|
1132
|
+
flushDebugFramebuffers(renderPass, options, state);
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
if (source3 && isFramebuffer(source3) && source3.handle !== null) {
|
|
1136
|
+
if (!state.queuedFramebuffers.includes(source3)) {
|
|
1137
|
+
state.queuedFramebuffers.push(source3);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
function flushDebugFramebuffers(renderPass, options, state) {
|
|
1142
|
+
if (state.queuedFramebuffers.length === 0) {
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
const webglDevice = renderPass.device;
|
|
1146
|
+
const { gl } = webglDevice;
|
|
1147
|
+
const previousReadFramebuffer = gl.getParameter(gl.READ_FRAMEBUFFER_BINDING);
|
|
1148
|
+
const previousDrawFramebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);
|
|
1149
|
+
const [targetWidth, targetHeight] = renderPass.device.getDefaultCanvasContext().getDrawingBufferSize();
|
|
1150
|
+
let topPx = parseCssPixel(options.top, DEFAULT_MARGIN_PX);
|
|
1151
|
+
const leftPx = parseCssPixel(options.left, DEFAULT_MARGIN_PX);
|
|
1152
|
+
state.flushing = true;
|
|
1153
|
+
try {
|
|
1154
|
+
for (const framebuffer of state.queuedFramebuffers) {
|
|
1155
|
+
const [targetX0, targetY0, targetX1, targetY1, previewHeight] = getOverlayRect({
|
|
1156
|
+
framebuffer,
|
|
1157
|
+
targetWidth,
|
|
1158
|
+
targetHeight,
|
|
1159
|
+
topPx,
|
|
1160
|
+
leftPx,
|
|
1161
|
+
minimap: options.minimap
|
|
1162
|
+
});
|
|
1163
|
+
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, framebuffer.handle);
|
|
1164
|
+
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
|
|
1165
|
+
gl.blitFramebuffer(
|
|
1166
|
+
0,
|
|
1167
|
+
0,
|
|
1168
|
+
framebuffer.width,
|
|
1169
|
+
framebuffer.height,
|
|
1170
|
+
targetX0,
|
|
1171
|
+
targetY0,
|
|
1172
|
+
targetX1,
|
|
1173
|
+
targetY1,
|
|
1174
|
+
gl.COLOR_BUFFER_BIT,
|
|
1175
|
+
gl.NEAREST
|
|
1176
|
+
);
|
|
1177
|
+
topPx += previewHeight + DEFAULT_MARGIN_PX;
|
|
1178
|
+
}
|
|
1179
|
+
} finally {
|
|
1180
|
+
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, previousReadFramebuffer);
|
|
1181
|
+
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, previousDrawFramebuffer);
|
|
1182
|
+
state.flushing = false;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
function getOverlayRect(options) {
|
|
1186
|
+
const { framebuffer, targetWidth, targetHeight, topPx, leftPx, minimap } = options;
|
|
1187
|
+
const maxWidth = minimap ? Math.max(Math.floor(targetWidth / 4), 1) : targetWidth;
|
|
1188
|
+
const maxHeight = minimap ? Math.max(Math.floor(targetHeight / 4), 1) : targetHeight;
|
|
1189
|
+
const scale2 = Math.min(maxWidth / framebuffer.width, maxHeight / framebuffer.height);
|
|
1190
|
+
const previewWidth = Math.max(Math.floor(framebuffer.width * scale2), 1);
|
|
1191
|
+
const previewHeight = Math.max(Math.floor(framebuffer.height * scale2), 1);
|
|
1192
|
+
const targetX0 = leftPx;
|
|
1193
|
+
const targetY0 = Math.max(targetHeight - topPx - previewHeight, 0);
|
|
1194
|
+
const targetX1 = targetX0 + previewWidth;
|
|
1195
|
+
const targetY1 = targetY0 + previewHeight;
|
|
1196
|
+
return [targetX0, targetY0, targetX1, targetY1, previewHeight];
|
|
1197
|
+
}
|
|
1198
|
+
function getDebugFramebufferState(device) {
|
|
1199
|
+
device.userData[DEBUG_FRAMEBUFFER_STATE_KEY] ||= {
|
|
1200
|
+
flushing: false,
|
|
1201
|
+
queuedFramebuffers: []
|
|
1202
|
+
};
|
|
1203
|
+
return device.userData[DEBUG_FRAMEBUFFER_STATE_KEY];
|
|
1204
|
+
}
|
|
1205
|
+
function isFramebuffer(value) {
|
|
1206
|
+
return "colorAttachments" in value;
|
|
1207
|
+
}
|
|
1208
|
+
function isDefaultRenderPass(renderPass) {
|
|
1209
|
+
const framebuffer = renderPass.props.framebuffer;
|
|
1210
|
+
return !framebuffer || framebuffer.handle === null;
|
|
1211
|
+
}
|
|
1212
|
+
function parseCssPixel(value, defaultValue) {
|
|
1213
|
+
if (!value) {
|
|
1214
|
+
return defaultValue;
|
|
1157
1215
|
}
|
|
1216
|
+
const parsedValue = Number.parseInt(value, 10);
|
|
1217
|
+
return Number.isFinite(parsedValue) ? parsedValue : defaultValue;
|
|
1158
1218
|
}
|
|
1159
1219
|
|
|
1160
1220
|
// src/utils/deep-equal.ts
|
|
@@ -1371,12 +1431,11 @@ var __exports__ = (() => {
|
|
|
1371
1431
|
this.moduleUniforms = {};
|
|
1372
1432
|
this.moduleBindings = {};
|
|
1373
1433
|
for (const [name, module] of Object.entries(modules)) {
|
|
1374
|
-
if (
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
import_core5.log.warn(`Module name: ${name} vs ${module.name}`)();
|
|
1434
|
+
if (module) {
|
|
1435
|
+
this._addModule(module);
|
|
1436
|
+
if (module.name && name !== module.name && !this.options.disableWarnings) {
|
|
1437
|
+
import_core5.log.warn(`Module name: ${name} vs ${module.name}`)();
|
|
1438
|
+
}
|
|
1380
1439
|
}
|
|
1381
1440
|
}
|
|
1382
1441
|
}
|
|
@@ -1395,21 +1454,21 @@ var __exports__ = (() => {
|
|
|
1395
1454
|
if (!this.options.disableWarnings) {
|
|
1396
1455
|
import_core5.log.warn(`Module ${name} not found`)();
|
|
1397
1456
|
}
|
|
1398
|
-
|
|
1457
|
+
} else {
|
|
1458
|
+
const oldUniforms = this.moduleUniforms[moduleName];
|
|
1459
|
+
const oldBindings = this.moduleBindings[moduleName];
|
|
1460
|
+
const uniformsAndBindings = module.getUniforms?.(moduleProps, oldUniforms) || moduleProps;
|
|
1461
|
+
const { uniforms, bindings } = splitUniformsAndBindings(
|
|
1462
|
+
uniformsAndBindings,
|
|
1463
|
+
module.uniformTypes
|
|
1464
|
+
);
|
|
1465
|
+
this.moduleUniforms[moduleName] = mergeModuleUniforms(
|
|
1466
|
+
oldUniforms,
|
|
1467
|
+
uniforms,
|
|
1468
|
+
module.uniformTypes
|
|
1469
|
+
);
|
|
1470
|
+
this.moduleBindings[moduleName] = { ...oldBindings, ...bindings };
|
|
1399
1471
|
}
|
|
1400
|
-
const oldUniforms = this.moduleUniforms[moduleName];
|
|
1401
|
-
const oldBindings = this.moduleBindings[moduleName];
|
|
1402
|
-
const uniformsAndBindings = module.getUniforms?.(moduleProps, oldUniforms) || moduleProps;
|
|
1403
|
-
const { uniforms, bindings } = splitUniformsAndBindings(
|
|
1404
|
-
uniformsAndBindings,
|
|
1405
|
-
module.uniformTypes
|
|
1406
|
-
);
|
|
1407
|
-
this.moduleUniforms[moduleName] = mergeModuleUniforms(
|
|
1408
|
-
oldUniforms,
|
|
1409
|
-
uniforms,
|
|
1410
|
-
module.uniformTypes
|
|
1411
|
-
);
|
|
1412
|
-
this.moduleBindings[moduleName] = { ...oldBindings, ...bindings };
|
|
1413
1472
|
}
|
|
1414
1473
|
}
|
|
1415
1474
|
/**
|
|
@@ -1458,10 +1517,9 @@ var __exports__ = (() => {
|
|
|
1458
1517
|
function mergeModuleUniforms(currentUniforms = {}, nextUniforms = {}, uniformTypes2 = {}) {
|
|
1459
1518
|
const mergedUniforms = { ...currentUniforms };
|
|
1460
1519
|
for (const [key, value] of Object.entries(nextUniforms)) {
|
|
1461
|
-
if (value
|
|
1462
|
-
|
|
1520
|
+
if (value !== void 0) {
|
|
1521
|
+
mergedUniforms[key] = mergeModuleUniformValue(currentUniforms[key], value, uniformTypes2[key]);
|
|
1463
1522
|
}
|
|
1464
|
-
mergedUniforms[key] = mergeModuleUniformValue(currentUniforms[key], value, uniformTypes2[key]);
|
|
1465
1523
|
}
|
|
1466
1524
|
return mergedUniforms;
|
|
1467
1525
|
}
|
|
@@ -1477,14 +1535,13 @@ var __exports__ = (() => {
|
|
|
1477
1535
|
const mergedArray = currentArray.slice();
|
|
1478
1536
|
for (let index = 0; index < nextValue.length; index++) {
|
|
1479
1537
|
const elementValue = nextValue[index];
|
|
1480
|
-
if (elementValue
|
|
1481
|
-
|
|
1538
|
+
if (elementValue !== void 0) {
|
|
1539
|
+
mergedArray[index] = mergeModuleUniformValue(
|
|
1540
|
+
currentArray[index],
|
|
1541
|
+
elementValue,
|
|
1542
|
+
uniformType[0]
|
|
1543
|
+
);
|
|
1482
1544
|
}
|
|
1483
|
-
mergedArray[index] = mergeModuleUniformValue(
|
|
1484
|
-
currentArray[index],
|
|
1485
|
-
elementValue,
|
|
1486
|
-
uniformType[0]
|
|
1487
|
-
);
|
|
1488
1545
|
}
|
|
1489
1546
|
return mergedArray;
|
|
1490
1547
|
}
|
|
@@ -1495,10 +1552,9 @@ var __exports__ = (() => {
|
|
|
1495
1552
|
const currentObject = isPlainUniformObject(currentValue) ? currentValue : {};
|
|
1496
1553
|
const mergedObject = { ...currentObject };
|
|
1497
1554
|
for (const [key, value] of Object.entries(nextValue)) {
|
|
1498
|
-
if (value
|
|
1499
|
-
|
|
1555
|
+
if (value !== void 0) {
|
|
1556
|
+
mergedObject[key] = mergeModuleUniformValue(currentObject[key], value, uniformStruct[key]);
|
|
1500
1557
|
}
|
|
1501
|
-
mergedObject[key] = mergeModuleUniformValue(currentObject[key], value, uniformStruct[key]);
|
|
1502
1558
|
}
|
|
1503
1559
|
return mergedObject;
|
|
1504
1560
|
}
|
|
@@ -1741,7 +1797,9 @@ var __exports__ = (() => {
|
|
|
1741
1797
|
return "DynamicTexture";
|
|
1742
1798
|
}
|
|
1743
1799
|
toString() {
|
|
1744
|
-
|
|
1800
|
+
const width = this._texture?.width ?? this.props.width ?? "?";
|
|
1801
|
+
const height = this._texture?.height ?? this.props.height ?? "?";
|
|
1802
|
+
return `DynamicTexture:"${this.id}":${width}x${height}px:(${this.isReady ? "ready" : "loading..."})`;
|
|
1745
1803
|
}
|
|
1746
1804
|
constructor(device, props) {
|
|
1747
1805
|
this.device = device;
|
|
@@ -2185,6 +2243,7 @@ var __exports__ = (() => {
|
|
|
2185
2243
|
// src/model/model.ts
|
|
2186
2244
|
var LOG_DRAW_PRIORITY = 2;
|
|
2187
2245
|
var LOG_DRAW_TIMEOUT = 1e4;
|
|
2246
|
+
var PIPELINE_INITIALIZATION_FAILED = "render pipeline initialization failed";
|
|
2188
2247
|
var _Model = class {
|
|
2189
2248
|
/** Device that created this model */
|
|
2190
2249
|
device;
|
|
@@ -2398,35 +2457,45 @@ var __exports__ = (() => {
|
|
|
2398
2457
|
renderPass.popDebugGroup();
|
|
2399
2458
|
}
|
|
2400
2459
|
let drawSuccess;
|
|
2460
|
+
let pipelineErrored = this.pipeline.isErrored;
|
|
2401
2461
|
try {
|
|
2402
2462
|
renderPass.pushDebugGroup(`${this}.draw(${renderPass})`);
|
|
2403
2463
|
this._logDrawCallStart();
|
|
2404
2464
|
this.pipeline = this._updatePipeline();
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2465
|
+
pipelineErrored = this.pipeline.isErrored;
|
|
2466
|
+
if (pipelineErrored) {
|
|
2467
|
+
import_core8.log.info(
|
|
2468
|
+
LOG_DRAW_PRIORITY,
|
|
2469
|
+
`>>> DRAWING ABORTED ${this.id}: ${PIPELINE_INITIALIZATION_FAILED}`
|
|
2470
|
+
)();
|
|
2471
|
+
drawSuccess = false;
|
|
2472
|
+
} else {
|
|
2473
|
+
const syncBindings = this._getBindings();
|
|
2474
|
+
const syncBindGroups = this._getBindGroups();
|
|
2475
|
+
const { indexBuffer } = this.vertexArray;
|
|
2476
|
+
const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
|
|
2477
|
+
drawSuccess = this.pipeline.draw({
|
|
2478
|
+
renderPass,
|
|
2479
|
+
vertexArray: this.vertexArray,
|
|
2480
|
+
isInstanced: this.isInstanced,
|
|
2481
|
+
vertexCount: this.vertexCount,
|
|
2482
|
+
instanceCount: this.instanceCount,
|
|
2483
|
+
indexCount,
|
|
2484
|
+
transformFeedback: this.transformFeedback || void 0,
|
|
2485
|
+
// Pipelines may be shared across models when caching is enabled, so bindings
|
|
2486
|
+
// and WebGL uniforms must be supplied on every draw instead of being stored
|
|
2487
|
+
// on the pipeline instance.
|
|
2488
|
+
bindings: syncBindings,
|
|
2489
|
+
bindGroups: syncBindGroups,
|
|
2490
|
+
_bindGroupCacheKeys: this._getBindGroupCacheKeys(),
|
|
2491
|
+
uniforms: this.props.uniforms,
|
|
2492
|
+
// WebGL shares underlying cached pipelines even for models that have different parameters and topology,
|
|
2493
|
+
// so we must provide our unique parameters to each draw
|
|
2494
|
+
// (In WebGPU most parameters are encoded in the pipeline and cannot be changed per draw call)
|
|
2495
|
+
parameters: this.parameters,
|
|
2496
|
+
topology: this.topology
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2430
2499
|
} finally {
|
|
2431
2500
|
renderPass.popDebugGroup();
|
|
2432
2501
|
this._logDrawCallEnd();
|
|
@@ -2435,6 +2504,8 @@ var __exports__ = (() => {
|
|
|
2435
2504
|
if (drawSuccess) {
|
|
2436
2505
|
this._lastDrawTimestamp = this.device.timestamp;
|
|
2437
2506
|
this._needsRedraw = false;
|
|
2507
|
+
} else if (pipelineErrored) {
|
|
2508
|
+
this._needsRedraw = PIPELINE_INITIALIZATION_FAILED;
|
|
2438
2509
|
} else {
|
|
2439
2510
|
this._needsRedraw = "waiting for resource initialization";
|
|
2440
2511
|
}
|
|
@@ -2523,10 +2594,10 @@ var __exports__ = (() => {
|
|
|
2523
2594
|
/** Set the shader inputs */
|
|
2524
2595
|
setShaderInputs(shaderInputs) {
|
|
2525
2596
|
this.shaderInputs = shaderInputs;
|
|
2526
|
-
this._uniformStore = new import_core8.UniformStore(this.shaderInputs.modules);
|
|
2597
|
+
this._uniformStore = new import_core8.UniformStore(this.device, this.shaderInputs.modules);
|
|
2527
2598
|
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
|
|
2528
2599
|
if (shaderModuleHasUniforms(module) && !this.material?.ownsModule(moduleName)) {
|
|
2529
|
-
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(
|
|
2600
|
+
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
2530
2601
|
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
|
|
2531
2602
|
}
|
|
2532
2603
|
}
|
|
@@ -2803,9 +2874,10 @@ var __exports__ = (() => {
|
|
|
2803
2874
|
return;
|
|
2804
2875
|
}
|
|
2805
2876
|
const framebuffer = renderPass.props.framebuffer;
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2877
|
+
debugFramebuffer(renderPass, framebuffer, {
|
|
2878
|
+
id: framebuffer?.id || `${this.id}-framebuffer`,
|
|
2879
|
+
minimap: true
|
|
2880
|
+
});
|
|
2809
2881
|
}
|
|
2810
2882
|
_getAttributeDebugTable() {
|
|
2811
2883
|
const table = {};
|
|
@@ -2990,10 +3062,10 @@ var __exports__ = (() => {
|
|
|
2990
3062
|
])
|
|
2991
3063
|
);
|
|
2992
3064
|
this.shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap);
|
|
2993
|
-
this._uniformStore = new import_core9.UniformStore(this.shaderInputs.modules);
|
|
3065
|
+
this._uniformStore = new import_core9.UniformStore(this.device, this.shaderInputs.modules);
|
|
2994
3066
|
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
|
|
2995
3067
|
if (this.ownsModule(moduleName) && shaderModuleHasUniforms(module)) {
|
|
2996
|
-
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(
|
|
3068
|
+
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
2997
3069
|
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
|
|
2998
3070
|
}
|
|
2999
3071
|
}
|
|
@@ -3468,12 +3540,12 @@ ${props.source}` };
|
|
|
3468
3540
|
};
|
|
3469
3541
|
var BACKGROUND_FS_WGSL = (
|
|
3470
3542
|
/* wgsl */
|
|
3471
|
-
`@group(0) @binding(
|
|
3472
|
-
@group(0) @binding(
|
|
3543
|
+
`@group(0) @binding(auto) var backgroundTexture: texture_2d<f32>;
|
|
3544
|
+
@group(0) @binding(auto) var backgroundTextureSampler: sampler;
|
|
3473
3545
|
struct backgroundUniforms {
|
|
3474
3546
|
scale: vec2<f32>,
|
|
3475
3547
|
};
|
|
3476
|
-
@group(0) @binding(
|
|
3548
|
+
@group(0) @binding(auto) var<uniform> background: backgroundUniforms;
|
|
3477
3549
|
|
|
3478
3550
|
fn billboardTexture_getTextureUV(uv: vec2<f32>) -> vec2<f32> {
|
|
3479
3551
|
let scale: vec2<f32> = background.scale;
|
|
@@ -3495,7 +3567,7 @@ precision highp float;
|
|
|
3495
3567
|
|
|
3496
3568
|
uniform sampler2D backgroundTexture;
|
|
3497
3569
|
|
|
3498
|
-
uniform backgroundUniforms {
|
|
3570
|
+
layout(std140) uniform backgroundUniforms {
|
|
3499
3571
|
vec2 scale;
|
|
3500
3572
|
} background;
|
|
3501
3573
|
|
|
@@ -6016,7 +6088,7 @@ void main(void) {
|
|
|
6016
6088
|
viewProjectionMatrix: mat4x4<f32>,
|
|
6017
6089
|
};
|
|
6018
6090
|
|
|
6019
|
-
@
|
|
6091
|
+
@group(0) @binding(auto) var<uniform> lightMarker : lightMarkerUniforms;
|
|
6020
6092
|
|
|
6021
6093
|
struct VertexInputs {
|
|
6022
6094
|
@location(0) positions : vec3<f32>,
|
|
@@ -6066,7 +6138,7 @@ in vec3 instanceDirection;
|
|
|
6066
6138
|
in vec3 instanceScale;
|
|
6067
6139
|
in vec4 instanceColor;
|
|
6068
6140
|
|
|
6069
|
-
uniform lightMarkerUniforms {
|
|
6141
|
+
layout(std140) uniform lightMarkerUniforms {
|
|
6070
6142
|
mat4 viewProjectionMatrix;
|
|
6071
6143
|
} lightMarker;
|
|
6072
6144
|
|
|
@@ -7235,7 +7307,9 @@ void main(void) {
|
|
|
7235
7307
|
ym /= len;
|
|
7236
7308
|
zm /= len;
|
|
7237
7309
|
positions.push(xm, ym, zm);
|
|
7238
|
-
|
|
7310
|
+
const pointIndex = positions.length / 3 - 1;
|
|
7311
|
+
pointMemo[key] = pointIndex;
|
|
7312
|
+
return pointIndex;
|
|
7239
7313
|
};
|
|
7240
7314
|
})();
|
|
7241
7315
|
for (let i = 0; i < iterations; i++) {
|
|
@@ -7602,8 +7676,8 @@ void main(void) {
|
|
|
7602
7676
|
function getFilterShaderWGSL(func) {
|
|
7603
7677
|
return (
|
|
7604
7678
|
/* wgsl */
|
|
7605
|
-
`@group(0) @binding(
|
|
7606
|
-
@group(0) @binding(
|
|
7679
|
+
`@group(0) @binding(auto) var sourceTexture: texture_2d<f32>;
|
|
7680
|
+
@group(0) @binding(auto) var sourceTextureSampler: sampler;
|
|
7607
7681
|
|
|
7608
7682
|
@fragment
|
|
7609
7683
|
fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
|
|
@@ -7620,8 +7694,8 @@ fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
|
|
|
7620
7694
|
function getSamplerShaderWGSL(func) {
|
|
7621
7695
|
return (
|
|
7622
7696
|
/* wgsl */
|
|
7623
|
-
`@group(0) @binding(
|
|
7624
|
-
@group(0) @binding(
|
|
7697
|
+
`@group(0) @binding(auto) var sourceTexture: texture_2d<f32>;
|
|
7698
|
+
@group(0) @binding(auto) var sourceTextureSampler: sampler;
|
|
7625
7699
|
|
|
7626
7700
|
@fragment
|
|
7627
7701
|
fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
|
|
@@ -7941,10 +8015,10 @@ void main() {
|
|
|
7941
8015
|
}
|
|
7942
8016
|
setShaderInputs(shaderInputs) {
|
|
7943
8017
|
this.shaderInputs = shaderInputs;
|
|
7944
|
-
this._uniformStore = new import_core17.UniformStore(this.shaderInputs.modules);
|
|
8018
|
+
this._uniformStore = new import_core17.UniformStore(this.device, this.shaderInputs.modules);
|
|
7945
8019
|
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
|
|
7946
8020
|
if (shaderModuleHasUniforms(module)) {
|
|
7947
|
-
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(
|
|
8021
|
+
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
7948
8022
|
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
|
|
7949
8023
|
}
|
|
7950
8024
|
}
|
|
@@ -8078,7 +8152,7 @@ void main() {
|
|
|
8078
8152
|
`precision highp float;
|
|
8079
8153
|
precision highp int;
|
|
8080
8154
|
|
|
8081
|
-
uniform pickingUniforms {
|
|
8155
|
+
layout(std140) uniform pickingUniforms {
|
|
8082
8156
|
int isActive;
|
|
8083
8157
|
int indexMode;
|
|
8084
8158
|
int batchIndex;
|