@luma.gl/engine 10.0.0-alpha.6 → 10.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/arrow/arrow-geometry.cjs +1 -1
- package/dist/arrow/arrow-geometry.js +1 -1
- package/dist/arrow/arrow-picking.cjs +1 -1
- package/dist/arrow/arrow-picking.d.ts +1 -1
- package/dist/arrow/arrow-picking.js +1 -1
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.cjs +5 -5
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.d.ts +2 -2
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.js +5 -5
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.cjs +3 -3
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js +3 -3
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.cjs +1 -1
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.js +1 -1
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.cjs +5 -5
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.d.ts +1 -1
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.js +5 -5
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.cjs +3 -3
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.d.ts +1 -1
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js +3 -3
- package/dist/arrow/renderers/path/transforms/path-view-origins.cjs +1 -1
- package/dist/arrow/renderers/path/transforms/path-view-origins.d.ts +1 -1
- package/dist/arrow/renderers/path/transforms/path-view-origins.js +1 -1
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.cjs +1 -1
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.d.ts +1 -1
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.js +1 -1
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.cjs +4 -4
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.js +4 -4
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.cjs +1 -1
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.js +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.cjs +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.js +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.cjs +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.d.ts +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.js +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.cjs +5 -5
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.d.ts +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.js +5 -5
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.cjs +1 -1
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.js +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.cjs +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.js +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.cjs +5 -5
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js +5 -5
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.cjs +1 -1
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.js +1 -1
- package/dist/compute/computation.cjs +2 -2
- package/dist/compute/computation.d.ts +1 -1
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +2 -2
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/texture-transform.d.ts +2 -2
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/dist.dev.js +395 -322
- package/dist/dist.min.js +68 -63
- package/dist/experimental/materials/emissive-material.cjs +1 -1
- package/dist/experimental/materials/emissive-material.d.ts +1 -1
- package/dist/experimental/materials/emissive-material.d.ts.map +1 -1
- package/dist/experimental/materials/emissive-material.js +1 -1
- package/dist/experimental/materials/emissive-material.js.map +1 -1
- package/dist/experimental/materials/glass-material.cjs +1 -1
- package/dist/experimental/materials/glass-material.d.ts +1 -1
- package/dist/experimental/materials/glass-material.d.ts.map +1 -1
- package/dist/experimental/materials/glass-material.js +1 -1
- package/dist/experimental/materials/glass-material.js.map +1 -1
- package/dist/experimental/materials/glass-transmission.cjs +1 -1
- package/dist/experimental/materials/glass-transmission.d.ts +1 -1
- package/dist/experimental/materials/glass-transmission.d.ts.map +1 -1
- package/dist/experimental/materials/glass-transmission.js +1 -1
- package/dist/experimental/materials/glass-transmission.js.map +1 -1
- package/dist/experimental/materials/index.cjs.map +1 -1
- package/dist/experimental/materials/optical-caustics.cjs +1 -1
- package/dist/experimental/materials/optical-caustics.d.ts +1 -1
- package/dist/experimental/materials/optical-caustics.d.ts.map +1 -1
- package/dist/experimental/materials/optical-caustics.js +1 -1
- package/dist/experimental/materials/optical-caustics.js.map +1 -1
- package/dist/experimental/materials/optical-point-lights.cjs +1 -1
- package/dist/experimental/materials/optical-point-lights.d.ts +1 -1
- package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -1
- package/dist/experimental/materials/optical-point-lights.js +1 -1
- package/dist/experimental/materials/optical-point-lights.js.map +1 -1
- package/dist/experimental/materials/reflective-material.cjs +1 -1
- package/dist/experimental/materials/reflective-material.d.ts +1 -1
- package/dist/experimental/materials/reflective-material.d.ts.map +1 -1
- package/dist/experimental/materials/reflective-material.js +1 -1
- package/dist/experimental/materials/reflective-material.js.map +1 -1
- package/dist/geometry/gpu-geometry.cjs +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +1 -1
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/gltf/gltf/gltf-lod.cjs +21 -6
- package/dist/gltf/gltf/gltf-lod.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-lod.js +20 -4
- package/dist/gltf/gltf/gltf-lod.js.map +1 -1
- package/dist/gltf/index.cjs.map +1 -1
- package/dist/gltf/types/gltf-json-schema.d.ts +37 -37
- package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts +28 -28
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/graph/models/index.cjs.map +1 -1
- package/dist/graph/models/path/path-attribute-model.cjs +2 -2
- package/dist/graph/models/path/path-attribute-model.d.ts +2 -2
- package/dist/graph/models/path/path-attribute-model.js +2 -2
- package/dist/graph/models/path/path-storage-model.cjs +1 -1
- package/dist/graph/models/path/path-storage-model.d.ts +1 -1
- package/dist/graph/models/path/path-storage-model.js +1 -1
- package/dist/graph/models/path/path-trips-storage-model.d.ts +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.cjs +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.js +2 -2
- package/dist/graph/models/polygon/polygon-storage-model.cjs +2 -2
- package/dist/graph/models/polygon/polygon-storage-model.js +2 -2
- package/dist/graph/tables/gpu-table-model.cjs +1 -1
- package/dist/graph/tables/gpu-table-model.js +1 -1
- package/dist/graph/tables/gpu-table-transform.cjs +2 -2
- package/dist/graph/tables/gpu-table-transform.d.ts +1 -1
- package/dist/graph/tables/gpu-table-transform.js +2 -2
- package/dist/graph/tables/index.cjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/model/gpu-vector-model.cjs +104 -79
- package/dist/model/gpu-vector-model.d.ts +1 -1
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +129 -98
- package/dist/model/gpu-vector-model.js.map +1 -1
- package/dist/splats/splat-data.cjs +1 -1
- package/dist/splats/splat-data.d.ts +1 -1
- package/dist/splats/splat-data.js +1 -1
- package/dist/splats/splat-renderer.cjs +1 -1
- package/dist/splats/splat-renderer.js +1 -1
- package/dist/text/experimental.cjs +151 -3
- package/dist/text/experimental.d.ts +1 -1
- package/dist/text/experimental.d.ts.map +1 -1
- package/dist/text/experimental.js +1 -1
- package/dist/text/experimental.js.map +1 -1
- package/dist/text/index.cjs +41 -3
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +1 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/text-2d/experimental.cjs +128 -18
- package/dist/text/text-2d/experimental.d.ts +8 -8
- package/dist/text/text-2d/experimental.d.ts.map +1 -1
- package/dist/text/text-2d/experimental.js +7 -8
- package/dist/text/text-2d/experimental.js.map +1 -1
- package/dist/text/text-2d/model-utils/text-model-props.d.ts +1 -1
- package/dist/text/text-2d/models/text-attribute-model.cjs +1 -1
- package/dist/text/text-2d/models/text-attribute-model.js +1 -1
- package/dist/utils/deep-equal.cjs +3 -1
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +3 -1
- package/dist/utils/deep-equal.js.map +1 -1
- package/dist/utils/get-platform-info.cjs +9 -3
- package/dist/utils/get-platform-info.d.ts +1 -1
- package/dist/utils/get-platform-info.d.ts.map +1 -1
- package/dist/utils/get-platform-info.js +1 -1
- package/dist/utils/get-platform-info.js.map +1 -1
- package/package.json +6 -7
- package/src/arrow/arrow-geometry.ts +1 -1
- package/src/arrow/arrow-picking.ts +2 -2
- package/src/arrow/renderers/path/conversion/arrow-path-gpu-vectors.ts +9 -9
- package/src/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.ts +4 -4
- package/src/arrow/renderers/path/source/arrow-path-source-mapping.ts +1 -1
- package/src/arrow/renderers/path/transforms/close-arrow-paths.ts +5 -5
- package/src/arrow/renderers/path/transforms/gpu-path-float64-deltas.ts +3 -3
- package/src/arrow/renderers/path/transforms/path-view-origins.ts +2 -2
- package/src/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.ts +1 -1
- package/src/arrow/renderers/polygon/renderers/arrow-polygon-renderer.ts +4 -4
- package/src/arrow/renderers/polygon/source/arrow-polygon-source-mapping.ts +1 -1
- package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.ts +1 -1
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.ts +2 -2
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-storage.ts +1 -1
- package/src/arrow/renderers/text/conversion/convert-arrow-text-vectors.ts +6 -6
- package/src/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.ts +1 -1
- package/src/arrow/renderers/text/renderers/arrow-text-picking.ts +1 -1
- package/src/arrow/renderers/text/renderers/arrow-text-renderer.ts +5 -5
- package/src/arrow/renderers/text/source/arrow-text-source-mapping.ts +1 -1
- package/src/compute/computation.ts +5 -3
- package/src/compute/texture-transform.ts +2 -2
- package/src/experimental/materials/emissive-material.ts +1 -1
- package/src/experimental/materials/glass-material.ts +1 -1
- package/src/experimental/materials/glass-transmission.ts +1 -1
- package/src/experimental/materials/optical-caustics.ts +1 -1
- package/src/experimental/materials/optical-point-lights.ts +1 -1
- package/src/experimental/materials/reflective-material.ts +1 -1
- package/src/experimental/textures/rgba-decoder.ts +1 -1
- package/src/geometry/gpu-geometry.ts +1 -4
- package/src/gltf/gltf/gltf-lod.ts +22 -4
- package/src/gltf/physics/README.md +1 -1
- package/src/gltf/types/gltf-json-schema.ts +37 -37
- package/src/gltf/types/gltf-postprocessed-schema.ts +28 -28
- package/src/graph/models/path/path-attribute-model.ts +3 -3
- package/src/graph/models/path/path-storage-model.ts +2 -2
- package/src/graph/models/path/path-trips-storage-model.ts +2 -2
- package/src/graph/models/polygon/polygon-attribute-model.ts +2 -2
- package/src/graph/models/polygon/polygon-storage-model.ts +2 -2
- package/src/graph/tables/gpu-table-model.ts +1 -1
- package/src/graph/tables/gpu-table-transform.ts +3 -3
- package/src/model/gpu-vector-model.ts +147 -120
- package/src/splats/splat-data.ts +1 -1
- package/src/splats/splat-renderer.ts +1 -1
- package/src/text/README.md +1 -1
- package/src/text/experimental.ts +122 -1
- package/src/text/index.ts +40 -1
- package/src/text/text-2d/experimental.ts +104 -8
- package/src/text/text-2d/model-utils/text-model-props.ts +1 -1
- package/src/text/text-2d/models/text-attribute-model.ts +1 -1
- package/src/utils/deep-equal.ts +4 -2
- package/src/utils/get-platform-info.ts +1 -1
package/dist/dist.dev.js
CHANGED
|
@@ -6453,7 +6453,12 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
6453
6453
|
continue;
|
|
6454
6454
|
}
|
|
6455
6455
|
if (!isShaderHookRegistered(registry, hookName)) {
|
|
6456
|
-
|
|
6456
|
+
const pluginNames = [
|
|
6457
|
+
...new Set(hookInjections[hookName].map((injection) => injection.pluginName).filter(Boolean))
|
|
6458
|
+
];
|
|
6459
|
+
throw new Error(
|
|
6460
|
+
`Unknown shader hook ${hookName}${pluginNames.length ? ` (plugins: ${pluginNames.join(", ")})` : ""}`
|
|
6461
|
+
);
|
|
6457
6462
|
}
|
|
6458
6463
|
}
|
|
6459
6464
|
}
|
|
@@ -7007,11 +7012,186 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7007
7012
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7008
7013
|
}
|
|
7009
7014
|
|
|
7015
|
+
// ../shaders/src/lib/shader-assembly/wgsl-binding-scan.ts
|
|
7016
|
+
var WGSL_BINDABLE_VARIABLE_PATTERN = "(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)";
|
|
7017
|
+
var WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN = "\\s*";
|
|
7018
|
+
var MODULE_WGSL_BINDING_DECLARATION_REGEXES = [
|
|
7019
|
+
new RegExp(
|
|
7020
|
+
`@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7021
|
+
"g"
|
|
7022
|
+
),
|
|
7023
|
+
new RegExp(
|
|
7024
|
+
`@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7025
|
+
"g"
|
|
7026
|
+
)
|
|
7027
|
+
];
|
|
7028
|
+
var WGSL_BINDING_DECLARATION_REGEXES = [
|
|
7029
|
+
new RegExp(
|
|
7030
|
+
`@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7031
|
+
"g"
|
|
7032
|
+
),
|
|
7033
|
+
new RegExp(
|
|
7034
|
+
`@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7035
|
+
"g"
|
|
7036
|
+
)
|
|
7037
|
+
];
|
|
7038
|
+
var WGSL_EXPLICIT_BINDING_DECLARATION_REGEXES = [
|
|
7039
|
+
new RegExp(
|
|
7040
|
+
`@binding\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7041
|
+
"g"
|
|
7042
|
+
),
|
|
7043
|
+
new RegExp(
|
|
7044
|
+
`@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@binding\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7045
|
+
"g"
|
|
7046
|
+
)
|
|
7047
|
+
];
|
|
7048
|
+
var WGSL_AUTO_BINDING_DECLARATION_REGEXES = [
|
|
7049
|
+
new RegExp(
|
|
7050
|
+
`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7051
|
+
"g"
|
|
7052
|
+
),
|
|
7053
|
+
new RegExp(
|
|
7054
|
+
`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7055
|
+
"g"
|
|
7056
|
+
),
|
|
7057
|
+
new RegExp(
|
|
7058
|
+
`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7059
|
+
"g"
|
|
7060
|
+
),
|
|
7061
|
+
new RegExp(
|
|
7062
|
+
`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7063
|
+
"g"
|
|
7064
|
+
)
|
|
7065
|
+
];
|
|
7066
|
+
function maskWGSLComments(source4) {
|
|
7067
|
+
const maskedCharacters = source4.split("");
|
|
7068
|
+
let index = 0;
|
|
7069
|
+
let blockCommentDepth = 0;
|
|
7070
|
+
let inLineComment = false;
|
|
7071
|
+
let inString = false;
|
|
7072
|
+
let isEscaped = false;
|
|
7073
|
+
while (index < source4.length) {
|
|
7074
|
+
const character = source4[index];
|
|
7075
|
+
const nextCharacter = source4[index + 1];
|
|
7076
|
+
if (inString) {
|
|
7077
|
+
if (isEscaped) {
|
|
7078
|
+
isEscaped = false;
|
|
7079
|
+
} else if (character === "\\") {
|
|
7080
|
+
isEscaped = true;
|
|
7081
|
+
} else if (character === '"') {
|
|
7082
|
+
inString = false;
|
|
7083
|
+
}
|
|
7084
|
+
index++;
|
|
7085
|
+
continue;
|
|
7086
|
+
}
|
|
7087
|
+
if (inLineComment) {
|
|
7088
|
+
if (character === "\n" || character === "\r") {
|
|
7089
|
+
inLineComment = false;
|
|
7090
|
+
} else {
|
|
7091
|
+
maskedCharacters[index] = " ";
|
|
7092
|
+
}
|
|
7093
|
+
index++;
|
|
7094
|
+
continue;
|
|
7095
|
+
}
|
|
7096
|
+
if (blockCommentDepth > 0) {
|
|
7097
|
+
if (character === "/" && nextCharacter === "*") {
|
|
7098
|
+
maskedCharacters[index] = " ";
|
|
7099
|
+
maskedCharacters[index + 1] = " ";
|
|
7100
|
+
blockCommentDepth++;
|
|
7101
|
+
index += 2;
|
|
7102
|
+
continue;
|
|
7103
|
+
}
|
|
7104
|
+
if (character === "*" && nextCharacter === "/") {
|
|
7105
|
+
maskedCharacters[index] = " ";
|
|
7106
|
+
maskedCharacters[index + 1] = " ";
|
|
7107
|
+
blockCommentDepth--;
|
|
7108
|
+
index += 2;
|
|
7109
|
+
continue;
|
|
7110
|
+
}
|
|
7111
|
+
if (character !== "\n" && character !== "\r") {
|
|
7112
|
+
maskedCharacters[index] = " ";
|
|
7113
|
+
}
|
|
7114
|
+
index++;
|
|
7115
|
+
continue;
|
|
7116
|
+
}
|
|
7117
|
+
if (character === '"') {
|
|
7118
|
+
inString = true;
|
|
7119
|
+
index++;
|
|
7120
|
+
continue;
|
|
7121
|
+
}
|
|
7122
|
+
if (character === "/" && nextCharacter === "/") {
|
|
7123
|
+
maskedCharacters[index] = " ";
|
|
7124
|
+
maskedCharacters[index + 1] = " ";
|
|
7125
|
+
inLineComment = true;
|
|
7126
|
+
index += 2;
|
|
7127
|
+
continue;
|
|
7128
|
+
}
|
|
7129
|
+
if (character === "/" && nextCharacter === "*") {
|
|
7130
|
+
maskedCharacters[index] = " ";
|
|
7131
|
+
maskedCharacters[index + 1] = " ";
|
|
7132
|
+
blockCommentDepth = 1;
|
|
7133
|
+
index += 2;
|
|
7134
|
+
continue;
|
|
7135
|
+
}
|
|
7136
|
+
index++;
|
|
7137
|
+
}
|
|
7138
|
+
return maskedCharacters.join("");
|
|
7139
|
+
}
|
|
7140
|
+
function getWGSLBindingDeclarationMatches(source4, regexes) {
|
|
7141
|
+
const maskedSource = maskWGSLComments(source4);
|
|
7142
|
+
const matches = [];
|
|
7143
|
+
for (const regex of regexes) {
|
|
7144
|
+
regex.lastIndex = 0;
|
|
7145
|
+
let match;
|
|
7146
|
+
match = regex.exec(maskedSource);
|
|
7147
|
+
while (match) {
|
|
7148
|
+
const isBindingFirst = regex === regexes[0];
|
|
7149
|
+
const index = match.index;
|
|
7150
|
+
const length4 = match[0].length;
|
|
7151
|
+
matches.push({
|
|
7152
|
+
match: source4.slice(index, index + length4),
|
|
7153
|
+
index,
|
|
7154
|
+
length: length4,
|
|
7155
|
+
bindingToken: match[isBindingFirst ? 1 : 2],
|
|
7156
|
+
groupToken: match[isBindingFirst ? 2 : 1],
|
|
7157
|
+
accessDeclaration: match[3]?.trim(),
|
|
7158
|
+
name: match[4]
|
|
7159
|
+
});
|
|
7160
|
+
match = regex.exec(maskedSource);
|
|
7161
|
+
}
|
|
7162
|
+
}
|
|
7163
|
+
return matches.sort((left, right) => left.index - right.index);
|
|
7164
|
+
}
|
|
7165
|
+
function replaceWGSLBindingDeclarationMatches(source4, regexes, replacer) {
|
|
7166
|
+
const matches = getWGSLBindingDeclarationMatches(source4, regexes);
|
|
7167
|
+
if (!matches.length) {
|
|
7168
|
+
return source4;
|
|
7169
|
+
}
|
|
7170
|
+
let relocatedSource = "";
|
|
7171
|
+
let lastIndex = 0;
|
|
7172
|
+
for (const match of matches) {
|
|
7173
|
+
relocatedSource += source4.slice(lastIndex, match.index);
|
|
7174
|
+
relocatedSource += replacer(match);
|
|
7175
|
+
lastIndex = match.index + match.length;
|
|
7176
|
+
}
|
|
7177
|
+
relocatedSource += source4.slice(lastIndex);
|
|
7178
|
+
return relocatedSource;
|
|
7179
|
+
}
|
|
7180
|
+
function hasWGSLAutoBinding(source4) {
|
|
7181
|
+
return /@binding\(\s*auto\s*\)/.test(maskWGSLComments(source4));
|
|
7182
|
+
}
|
|
7183
|
+
function getFirstWGSLAutoBindingDeclarationMatch(source4, regexes) {
|
|
7184
|
+
const autoBindingRegexes = regexes === MODULE_WGSL_BINDING_DECLARATION_REGEXES || regexes === WGSL_BINDING_DECLARATION_REGEXES ? WGSL_AUTO_BINDING_DECLARATION_REGEXES : regexes;
|
|
7185
|
+
return getWGSLBindingDeclarationMatches(source4, autoBindingRegexes).find(
|
|
7186
|
+
(declarationMatch) => declarationMatch.bindingToken === "auto"
|
|
7187
|
+
);
|
|
7188
|
+
}
|
|
7189
|
+
|
|
7010
7190
|
// ../shaders/src/lib/shader-assembly/shader-plugin-varyings.ts
|
|
7011
|
-
function
|
|
7191
|
+
function assembleShaderPluginInterStageVariablesGLSL(source4, stage, interStageVariables) {
|
|
7012
7192
|
const declarations = [];
|
|
7013
7193
|
const initialization = [];
|
|
7014
|
-
for (const [name, varying] of Object.entries(
|
|
7194
|
+
for (const [name, varying] of Object.entries(interStageVariables)) {
|
|
7015
7195
|
assertGLSLVaryingIsNew(source4, name);
|
|
7016
7196
|
const qualifier = varying.interpolation === "flat" ? "flat " : "";
|
|
7017
7197
|
const direction = stage === "vertex" ? "out" : "in";
|
|
@@ -7022,8 +7202,8 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7022
7202
|
}
|
|
7023
7203
|
return { declarations: declarations.join("\n"), initialization: initialization.join("\n") };
|
|
7024
7204
|
}
|
|
7025
|
-
function
|
|
7026
|
-
const entries = Object.entries(
|
|
7205
|
+
function assembleShaderPluginInterStageVariablesWGSL(source4, vertexEntryPoint, fragmentEntryPoint, interStageVariables) {
|
|
7206
|
+
const entries = Object.entries(interStageVariables);
|
|
7027
7207
|
if (entries.length === 0) {
|
|
7028
7208
|
return {
|
|
7029
7209
|
source: source4,
|
|
@@ -7038,18 +7218,20 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7038
7218
|
let fragmentFunction = getWGSLFunctionRange(transformedSource, fragmentEntryPoint, "fragment");
|
|
7039
7219
|
const fragmentInput = getWGSLFragmentStructInput(transformedSource, fragmentFunction);
|
|
7040
7220
|
const vertexOutputStruct = getWGSLStructRange(transformedSource, vertexOutputType);
|
|
7041
|
-
const fragmentInputStruct = getWGSLStructRange(transformedSource, fragmentInput.type);
|
|
7221
|
+
const fragmentInputStruct = fragmentInput ? getWGSLStructRange(transformedSource, fragmentInput.type) : null;
|
|
7042
7222
|
const interfaceNames = /* @__PURE__ */ new Set([
|
|
7043
7223
|
...getWGSLDeclaredNames2(vertexFunction.parameters),
|
|
7044
7224
|
...getWGSLDeclaredNames2(vertexOutputStruct.body),
|
|
7045
7225
|
...getWGSLDeclaredNames2(fragmentFunction.parameters),
|
|
7046
|
-
...getWGSLDeclaredNames2(fragmentInputStruct
|
|
7226
|
+
...getWGSLDeclaredNames2(fragmentInputStruct?.body || "")
|
|
7047
7227
|
]);
|
|
7048
7228
|
const usedLocations = /* @__PURE__ */ new Set([
|
|
7049
7229
|
...getWGSLLocations2(vertexOutputStruct.body),
|
|
7050
|
-
...getWGSLLocations2(fragmentInputStruct
|
|
7230
|
+
...getWGSLLocations2(fragmentInputStruct?.body || ""),
|
|
7231
|
+
...getWGSLLocations2(fragmentFunction.parameters)
|
|
7051
7232
|
]);
|
|
7052
7233
|
const fields = [];
|
|
7234
|
+
const fragmentParameters = [];
|
|
7053
7235
|
const declarations = [];
|
|
7054
7236
|
const vertexInitialization = [];
|
|
7055
7237
|
const fragmentInitialization = [];
|
|
@@ -7065,7 +7247,20 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7065
7247
|
fields.push(` @location(${location})${interpolation} ${name}: ${varying.type},`);
|
|
7066
7248
|
declarations.push(`var<private> ${name}: ${varying.type};`);
|
|
7067
7249
|
vertexInitialization.push(`${name} = ${getWGSLZeroValue(varying.type)};`);
|
|
7068
|
-
|
|
7250
|
+
if (fragmentInput) {
|
|
7251
|
+
fragmentInitialization.push(`${name} = ${fragmentInput.name}.${name};`);
|
|
7252
|
+
} else {
|
|
7253
|
+
const parameterName = `_luma_${name}`;
|
|
7254
|
+
if (interfaceNames.has(parameterName)) {
|
|
7255
|
+
throw new Error(
|
|
7256
|
+
`ShaderPlugin varying "${name}" conflicts with a generated fragment parameter`
|
|
7257
|
+
);
|
|
7258
|
+
}
|
|
7259
|
+
fragmentParameters.push(
|
|
7260
|
+
`@location(${location})${interpolation} ${parameterName}: ${varying.type}`
|
|
7261
|
+
);
|
|
7262
|
+
fragmentInitialization.push(`${name} = ${parameterName};`);
|
|
7263
|
+
}
|
|
7069
7264
|
}
|
|
7070
7265
|
assertWGSLStructConstructorsAreLocal(
|
|
7071
7266
|
transformedSource,
|
|
@@ -7085,16 +7280,21 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7085
7280
|
vertexFunction,
|
|
7086
7281
|
entries.map(([name]) => name)
|
|
7087
7282
|
);
|
|
7088
|
-
const structNames = vertexOutputType === fragmentInput.type ? [vertexOutputType] : [vertexOutputType, fragmentInput.type];
|
|
7283
|
+
const structNames = !fragmentInput || vertexOutputType === fragmentInput.type ? [vertexOutputType] : [vertexOutputType, fragmentInput.type];
|
|
7089
7284
|
const structInsertions = structNames.map((structName) => getWGSLStructRange(transformedSource, structName).closeBrace).sort((left, right) => right - left);
|
|
7090
7285
|
for (const insertionIndex of structInsertions) {
|
|
7091
7286
|
transformedSource = transformedSource.slice(0, insertionIndex) + `${fields.join("\n")}
|
|
7092
7287
|
` + transformedSource.slice(insertionIndex);
|
|
7093
7288
|
}
|
|
7094
7289
|
fragmentFunction = getWGSLFunctionRange(transformedSource, fragmentEntryPoint, "fragment");
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7290
|
+
if (fragmentParameters.length) {
|
|
7291
|
+
let parameters = fragmentFunction.parameters;
|
|
7292
|
+
const parameterTokens = maskWGSLComments(parameters).trimEnd();
|
|
7293
|
+
if (parameterTokens.trim() && !parameterTokens.endsWith(",")) {
|
|
7294
|
+
const insertionIndex = parameterTokens.length;
|
|
7295
|
+
parameters = `${parameters.slice(0, insertionIndex)},${parameters.slice(insertionIndex)}`;
|
|
7296
|
+
}
|
|
7297
|
+
transformedSource = transformedSource.slice(0, fragmentFunction.openParenthesis + 1) + parameters + "\n " + fragmentParameters.join(",\n ") + "\n" + transformedSource.slice(fragmentFunction.closeParenthesis);
|
|
7098
7298
|
}
|
|
7099
7299
|
return {
|
|
7100
7300
|
source: transformedSource,
|
|
@@ -7107,7 +7307,9 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7107
7307
|
const functionPattern = new RegExp(`\\bfn\\s+${escapeRegExp3(entryPoint)}\\s*\\(`, "g");
|
|
7108
7308
|
const match = functionPattern.exec(source4);
|
|
7109
7309
|
if (!match) {
|
|
7110
|
-
throw new Error(
|
|
7310
|
+
throw new Error(
|
|
7311
|
+
`ShaderPlugin interStageVariables require WGSL ${stage} entry point "${entryPoint}"`
|
|
7312
|
+
);
|
|
7111
7313
|
}
|
|
7112
7314
|
const openParenthesis = source4.indexOf("(", match.index);
|
|
7113
7315
|
const closeParenthesis = findMatchingDelimiter2(source4, openParenthesis, "(", ")");
|
|
@@ -7129,14 +7331,14 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7129
7331
|
const match = /->\s*([A-Za-z_][\w]*)\s*$/.exec(resultSource.trim());
|
|
7130
7332
|
if (!match || getWGSLStructRangeOrNull(source4, match[1]) === null) {
|
|
7131
7333
|
throw new Error(
|
|
7132
|
-
"ShaderPlugin
|
|
7334
|
+
"ShaderPlugin interStageVariables require the WGSL vertex entry point to return a named struct"
|
|
7133
7335
|
);
|
|
7134
7336
|
}
|
|
7135
7337
|
return match[1];
|
|
7136
7338
|
}
|
|
7137
7339
|
function getWGSLFragmentStructInput(source4, functionRange) {
|
|
7138
7340
|
const candidates = [];
|
|
7139
|
-
for (const parameter of splitTopLevel(functionRange.parameters, ",")) {
|
|
7341
|
+
for (const parameter of splitTopLevel(maskWGSLComments(functionRange.parameters), ",")) {
|
|
7140
7342
|
const match = /(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:\s*([A-Za-z_][\w]*)\s*$/.exec(
|
|
7141
7343
|
parameter.trim()
|
|
7142
7344
|
);
|
|
@@ -7144,12 +7346,12 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
7144
7346
|
candidates.push({ name: match[1], type: match[2] });
|
|
7145
7347
|
}
|
|
7146
7348
|
}
|
|
7147
|
-
if (candidates.length
|
|
7349
|
+
if (candidates.length > 1) {
|
|
7148
7350
|
throw new Error(
|
|
7149
|
-
`ShaderPlugin
|
|
7351
|
+
`ShaderPlugin interStageVariables require exactly one named WGSL fragment input struct; found ${candidates.length}`
|
|
7150
7352
|
);
|
|
7151
7353
|
}
|
|
7152
|
-
return candidates[0];
|
|
7354
|
+
return candidates[0] || null;
|
|
7153
7355
|
}
|
|
7154
7356
|
function getWGSLStructRange(source4, structName) {
|
|
7155
7357
|
const range = getWGSLStructRangeOrNull(source4, structName);
|
|
@@ -7499,7 +7701,7 @@ return ${outputName};
|
|
|
7499
7701
|
inject = {},
|
|
7500
7702
|
pluginInjections = {},
|
|
7501
7703
|
pluginVertexInputs = {},
|
|
7502
|
-
|
|
7704
|
+
pluginInterStageVariables = {},
|
|
7503
7705
|
prologue = true,
|
|
7504
7706
|
log: log8
|
|
7505
7707
|
} = options;
|
|
@@ -7548,35 +7750,30 @@ ${getApplicationDefines(allDefines)}
|
|
|
7548
7750
|
const name = match[3];
|
|
7549
7751
|
if (hash) {
|
|
7550
7752
|
if (name === "decl") {
|
|
7551
|
-
declInjections[key] = [injection];
|
|
7753
|
+
declInjections[key] = [...declInjections[key] || [], injection];
|
|
7552
7754
|
} else {
|
|
7553
|
-
mainInjections[key] = [injection];
|
|
7755
|
+
mainInjections[key] = [...mainInjections[key] || [], injection];
|
|
7554
7756
|
}
|
|
7555
7757
|
} else {
|
|
7556
|
-
hookInjections[key] = [injection];
|
|
7758
|
+
hookInjections[key] = [...hookInjections[key] || [], injection];
|
|
7557
7759
|
}
|
|
7558
7760
|
} else {
|
|
7559
|
-
mainInjections[key] = [injection];
|
|
7761
|
+
mainInjections[key] = [...mainInjections[key] || [], injection];
|
|
7560
7762
|
}
|
|
7561
7763
|
}
|
|
7562
7764
|
if (stage === "vertex") {
|
|
7563
7765
|
const declarations = getShaderPluginVertexInputDeclarationsGLSL(coreSource, pluginVertexInputs);
|
|
7564
|
-
if (declarations) {
|
|
7565
|
-
|
|
7566
|
-
declInjections["vs:#decl"].push({
|
|
7567
|
-
injection: declarations,
|
|
7568
|
-
order: Number.MIN_SAFE_INTEGER
|
|
7569
|
-
});
|
|
7570
|
-
}
|
|
7766
|
+
if (declarations) assembledSource += `${declarations}
|
|
7767
|
+
`;
|
|
7571
7768
|
}
|
|
7572
|
-
const pluginVaryingAssembly =
|
|
7769
|
+
const pluginVaryingAssembly = assembleShaderPluginInterStageVariablesGLSL(
|
|
7770
|
+
coreSource,
|
|
7771
|
+
stage,
|
|
7772
|
+
pluginInterStageVariables
|
|
7773
|
+
);
|
|
7573
7774
|
if (pluginVaryingAssembly.declarations) {
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
declInjections[declarationTarget].push({
|
|
7577
|
-
injection: pluginVaryingAssembly.declarations,
|
|
7578
|
-
order: Number.MIN_SAFE_INTEGER
|
|
7579
|
-
});
|
|
7775
|
+
assembledSource += `${pluginVaryingAssembly.declarations}
|
|
7776
|
+
`;
|
|
7580
7777
|
}
|
|
7581
7778
|
if (pluginVaryingAssembly.initialization) {
|
|
7582
7779
|
mainInjections["vs:#main-start"] = mainInjections["vs:#main-start"] || [];
|
|
@@ -7642,7 +7839,7 @@ ${getApplicationDefines(allDefines)}
|
|
|
7642
7839
|
*/
|
|
7643
7840
|
assembleGLSLShaderPair(props) {
|
|
7644
7841
|
const modules = this._getModuleList(props.modules);
|
|
7645
|
-
const hookFunctions = this._hookFunctions;
|
|
7842
|
+
const hookFunctions = [...this._hookFunctions, ...props.hookFunctions || []];
|
|
7646
7843
|
const vertex = this._transpileShader(props, modules, props.vs, "vertex");
|
|
7647
7844
|
const fragment = this._transpileShader(props, modules, props.fs, "fragment");
|
|
7648
7845
|
const assembled = assembleGLSLShaderPair({
|
|
@@ -7656,181 +7853,6 @@ ${getApplicationDefines(allDefines)}
|
|
|
7656
7853
|
}
|
|
7657
7854
|
};
|
|
7658
7855
|
|
|
7659
|
-
// ../shaders/src/lib/shader-assembly/wgsl-binding-scan.ts
|
|
7660
|
-
var WGSL_BINDABLE_VARIABLE_PATTERN = "(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)";
|
|
7661
|
-
var WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN = "\\s*";
|
|
7662
|
-
var MODULE_WGSL_BINDING_DECLARATION_REGEXES = [
|
|
7663
|
-
new RegExp(
|
|
7664
|
-
`@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7665
|
-
"g"
|
|
7666
|
-
),
|
|
7667
|
-
new RegExp(
|
|
7668
|
-
`@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7669
|
-
"g"
|
|
7670
|
-
)
|
|
7671
|
-
];
|
|
7672
|
-
var WGSL_BINDING_DECLARATION_REGEXES = [
|
|
7673
|
-
new RegExp(
|
|
7674
|
-
`@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7675
|
-
"g"
|
|
7676
|
-
),
|
|
7677
|
-
new RegExp(
|
|
7678
|
-
`@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@binding\\(\\s*(auto|\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7679
|
-
"g"
|
|
7680
|
-
)
|
|
7681
|
-
];
|
|
7682
|
-
var WGSL_EXPLICIT_BINDING_DECLARATION_REGEXES = [
|
|
7683
|
-
new RegExp(
|
|
7684
|
-
`@binding\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7685
|
-
"g"
|
|
7686
|
-
),
|
|
7687
|
-
new RegExp(
|
|
7688
|
-
`@group\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}@binding\\(\\s*(\\d+)\\s*\\)${WGSL_BINDING_DECLARATION_SEPARATOR_PATTERN}${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7689
|
-
"g"
|
|
7690
|
-
)
|
|
7691
|
-
];
|
|
7692
|
-
var WGSL_AUTO_BINDING_DECLARATION_REGEXES = [
|
|
7693
|
-
new RegExp(
|
|
7694
|
-
`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7695
|
-
"g"
|
|
7696
|
-
),
|
|
7697
|
-
new RegExp(
|
|
7698
|
-
`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7699
|
-
"g"
|
|
7700
|
-
),
|
|
7701
|
-
new RegExp(
|
|
7702
|
-
`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7703
|
-
"g"
|
|
7704
|
-
),
|
|
7705
|
-
new RegExp(
|
|
7706
|
-
`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${WGSL_BINDABLE_VARIABLE_PATTERN}`,
|
|
7707
|
-
"g"
|
|
7708
|
-
)
|
|
7709
|
-
];
|
|
7710
|
-
function maskWGSLComments(source4) {
|
|
7711
|
-
const maskedCharacters = source4.split("");
|
|
7712
|
-
let index = 0;
|
|
7713
|
-
let blockCommentDepth = 0;
|
|
7714
|
-
let inLineComment = false;
|
|
7715
|
-
let inString = false;
|
|
7716
|
-
let isEscaped = false;
|
|
7717
|
-
while (index < source4.length) {
|
|
7718
|
-
const character = source4[index];
|
|
7719
|
-
const nextCharacter = source4[index + 1];
|
|
7720
|
-
if (inString) {
|
|
7721
|
-
if (isEscaped) {
|
|
7722
|
-
isEscaped = false;
|
|
7723
|
-
} else if (character === "\\") {
|
|
7724
|
-
isEscaped = true;
|
|
7725
|
-
} else if (character === '"') {
|
|
7726
|
-
inString = false;
|
|
7727
|
-
}
|
|
7728
|
-
index++;
|
|
7729
|
-
continue;
|
|
7730
|
-
}
|
|
7731
|
-
if (inLineComment) {
|
|
7732
|
-
if (character === "\n" || character === "\r") {
|
|
7733
|
-
inLineComment = false;
|
|
7734
|
-
} else {
|
|
7735
|
-
maskedCharacters[index] = " ";
|
|
7736
|
-
}
|
|
7737
|
-
index++;
|
|
7738
|
-
continue;
|
|
7739
|
-
}
|
|
7740
|
-
if (blockCommentDepth > 0) {
|
|
7741
|
-
if (character === "/" && nextCharacter === "*") {
|
|
7742
|
-
maskedCharacters[index] = " ";
|
|
7743
|
-
maskedCharacters[index + 1] = " ";
|
|
7744
|
-
blockCommentDepth++;
|
|
7745
|
-
index += 2;
|
|
7746
|
-
continue;
|
|
7747
|
-
}
|
|
7748
|
-
if (character === "*" && nextCharacter === "/") {
|
|
7749
|
-
maskedCharacters[index] = " ";
|
|
7750
|
-
maskedCharacters[index + 1] = " ";
|
|
7751
|
-
blockCommentDepth--;
|
|
7752
|
-
index += 2;
|
|
7753
|
-
continue;
|
|
7754
|
-
}
|
|
7755
|
-
if (character !== "\n" && character !== "\r") {
|
|
7756
|
-
maskedCharacters[index] = " ";
|
|
7757
|
-
}
|
|
7758
|
-
index++;
|
|
7759
|
-
continue;
|
|
7760
|
-
}
|
|
7761
|
-
if (character === '"') {
|
|
7762
|
-
inString = true;
|
|
7763
|
-
index++;
|
|
7764
|
-
continue;
|
|
7765
|
-
}
|
|
7766
|
-
if (character === "/" && nextCharacter === "/") {
|
|
7767
|
-
maskedCharacters[index] = " ";
|
|
7768
|
-
maskedCharacters[index + 1] = " ";
|
|
7769
|
-
inLineComment = true;
|
|
7770
|
-
index += 2;
|
|
7771
|
-
continue;
|
|
7772
|
-
}
|
|
7773
|
-
if (character === "/" && nextCharacter === "*") {
|
|
7774
|
-
maskedCharacters[index] = " ";
|
|
7775
|
-
maskedCharacters[index + 1] = " ";
|
|
7776
|
-
blockCommentDepth = 1;
|
|
7777
|
-
index += 2;
|
|
7778
|
-
continue;
|
|
7779
|
-
}
|
|
7780
|
-
index++;
|
|
7781
|
-
}
|
|
7782
|
-
return maskedCharacters.join("");
|
|
7783
|
-
}
|
|
7784
|
-
function getWGSLBindingDeclarationMatches(source4, regexes) {
|
|
7785
|
-
const maskedSource = maskWGSLComments(source4);
|
|
7786
|
-
const matches = [];
|
|
7787
|
-
for (const regex of regexes) {
|
|
7788
|
-
regex.lastIndex = 0;
|
|
7789
|
-
let match;
|
|
7790
|
-
match = regex.exec(maskedSource);
|
|
7791
|
-
while (match) {
|
|
7792
|
-
const isBindingFirst = regex === regexes[0];
|
|
7793
|
-
const index = match.index;
|
|
7794
|
-
const length4 = match[0].length;
|
|
7795
|
-
matches.push({
|
|
7796
|
-
match: source4.slice(index, index + length4),
|
|
7797
|
-
index,
|
|
7798
|
-
length: length4,
|
|
7799
|
-
bindingToken: match[isBindingFirst ? 1 : 2],
|
|
7800
|
-
groupToken: match[isBindingFirst ? 2 : 1],
|
|
7801
|
-
accessDeclaration: match[3]?.trim(),
|
|
7802
|
-
name: match[4]
|
|
7803
|
-
});
|
|
7804
|
-
match = regex.exec(maskedSource);
|
|
7805
|
-
}
|
|
7806
|
-
}
|
|
7807
|
-
return matches.sort((left, right) => left.index - right.index);
|
|
7808
|
-
}
|
|
7809
|
-
function replaceWGSLBindingDeclarationMatches(source4, regexes, replacer) {
|
|
7810
|
-
const matches = getWGSLBindingDeclarationMatches(source4, regexes);
|
|
7811
|
-
if (!matches.length) {
|
|
7812
|
-
return source4;
|
|
7813
|
-
}
|
|
7814
|
-
let relocatedSource = "";
|
|
7815
|
-
let lastIndex = 0;
|
|
7816
|
-
for (const match of matches) {
|
|
7817
|
-
relocatedSource += source4.slice(lastIndex, match.index);
|
|
7818
|
-
relocatedSource += replacer(match);
|
|
7819
|
-
lastIndex = match.index + match.length;
|
|
7820
|
-
}
|
|
7821
|
-
relocatedSource += source4.slice(lastIndex);
|
|
7822
|
-
return relocatedSource;
|
|
7823
|
-
}
|
|
7824
|
-
function hasWGSLAutoBinding(source4) {
|
|
7825
|
-
return /@binding\(\s*auto\s*\)/.test(maskWGSLComments(source4));
|
|
7826
|
-
}
|
|
7827
|
-
function getFirstWGSLAutoBindingDeclarationMatch(source4, regexes) {
|
|
7828
|
-
const autoBindingRegexes = regexes === MODULE_WGSL_BINDING_DECLARATION_REGEXES || regexes === WGSL_BINDING_DECLARATION_REGEXES ? WGSL_AUTO_BINDING_DECLARATION_REGEXES : regexes;
|
|
7829
|
-
return getWGSLBindingDeclarationMatches(source4, autoBindingRegexes).find(
|
|
7830
|
-
(declarationMatch) => declarationMatch.bindingToken === "auto"
|
|
7831
|
-
);
|
|
7832
|
-
}
|
|
7833
|
-
|
|
7834
7856
|
// ../shaders/src/lib/shader-assembly/wgsl-interface-scan.ts
|
|
7835
7857
|
function scanWGSLInterface(source4, options = {}) {
|
|
7836
7858
|
const tokens = tokenizeWGSL(source4);
|
|
@@ -8557,6 +8579,29 @@ ${getApplicationDefines(allDefines)}
|
|
|
8557
8579
|
if (trimmedExpression === "false") {
|
|
8558
8580
|
return false;
|
|
8559
8581
|
}
|
|
8582
|
+
const operandPattern = "(?:[A-Za-z_][A-Za-z0-9_]*|[+-]?\\d+(?:\\.\\d+)?)";
|
|
8583
|
+
const comparison = trimmedExpression.match(
|
|
8584
|
+
new RegExp(`^(${operandPattern})\\s*(==|!=|<=|>=|<|>)\\s*(${operandPattern})$`)
|
|
8585
|
+
);
|
|
8586
|
+
if (comparison) {
|
|
8587
|
+
const resolveOperand = (operand) => /^[A-Za-z_]/.test(operand) ? Number(defines[operand] ?? 0) : Number(operand);
|
|
8588
|
+
const left = resolveOperand(comparison[1]);
|
|
8589
|
+
const right = resolveOperand(comparison[3]);
|
|
8590
|
+
switch (comparison[2]) {
|
|
8591
|
+
case "==":
|
|
8592
|
+
return left === right;
|
|
8593
|
+
case "!=":
|
|
8594
|
+
return left !== right;
|
|
8595
|
+
case "<=":
|
|
8596
|
+
return left <= right;
|
|
8597
|
+
case ">=":
|
|
8598
|
+
return left >= right;
|
|
8599
|
+
case "<":
|
|
8600
|
+
return left < right;
|
|
8601
|
+
case ">":
|
|
8602
|
+
return left > right;
|
|
8603
|
+
}
|
|
8604
|
+
}
|
|
8560
8605
|
const negatedDefineMatch = trimmedExpression.match(new RegExp(`^!\\s*${DEFINE_NAME_PATTERN}$`));
|
|
8561
8606
|
if (negatedDefineMatch) {
|
|
8562
8607
|
return !Boolean(defines[negatedDefineMatch[1]]);
|
|
@@ -8608,7 +8653,7 @@ ${getApplicationDefines(allDefines)}
|
|
|
8608
8653
|
inject = {},
|
|
8609
8654
|
pluginInjections = {},
|
|
8610
8655
|
pluginVertexInputs = {},
|
|
8611
|
-
|
|
8656
|
+
pluginInterStageVariables = {},
|
|
8612
8657
|
vertexEntryPoint = "vertexMain",
|
|
8613
8658
|
fragmentEntryPoint = "fragmentMain",
|
|
8614
8659
|
log: log8
|
|
@@ -8620,11 +8665,11 @@ ${getApplicationDefines(allDefines)}
|
|
|
8620
8665
|
vertexEntryPoint,
|
|
8621
8666
|
pluginVertexInputs
|
|
8622
8667
|
);
|
|
8623
|
-
const pluginVaryingAssembly =
|
|
8668
|
+
const pluginVaryingAssembly = assembleShaderPluginInterStageVariablesWGSL(
|
|
8624
8669
|
pluginVertexInputAssembly.source,
|
|
8625
8670
|
vertexEntryPoint,
|
|
8626
8671
|
fragmentEntryPoint,
|
|
8627
|
-
|
|
8672
|
+
pluginInterStageVariables
|
|
8628
8673
|
);
|
|
8629
8674
|
const coreSource = pluginVaryingAssembly.source;
|
|
8630
8675
|
let assembledSource = "";
|
|
@@ -8641,15 +8686,15 @@ ${getApplicationDefines(allDefines)}
|
|
|
8641
8686
|
const name = match[3];
|
|
8642
8687
|
if (hash) {
|
|
8643
8688
|
if (name === "decl") {
|
|
8644
|
-
declInjections[key] = [injection];
|
|
8689
|
+
declInjections[key] = [...declInjections[key] || [], injection];
|
|
8645
8690
|
} else {
|
|
8646
|
-
mainInjections[key] = [injection];
|
|
8691
|
+
mainInjections[key] = [...mainInjections[key] || [], injection];
|
|
8647
8692
|
}
|
|
8648
8693
|
} else {
|
|
8649
|
-
hookInjections[key] = [injection];
|
|
8694
|
+
hookInjections[key] = [...hookInjections[key] || [], injection];
|
|
8650
8695
|
}
|
|
8651
8696
|
} else {
|
|
8652
|
-
mainInjections[key] = [injection];
|
|
8697
|
+
mainInjections[key] = [...mainInjections[key] || [], injection];
|
|
8653
8698
|
}
|
|
8654
8699
|
}
|
|
8655
8700
|
appendGeneratedVertexInputInjections(
|
|
@@ -9096,7 +9141,7 @@ ${getApplicationDefines(allDefines)}
|
|
|
9096
9141
|
*/
|
|
9097
9142
|
assembleWGSLShader(props) {
|
|
9098
9143
|
const modules = this._getModuleList(props.modules);
|
|
9099
|
-
const hookFunctions = this._hookFunctions;
|
|
9144
|
+
const hookFunctions = [...this._hookFunctions, ...props.hookFunctions || []];
|
|
9100
9145
|
const translated = this._transpileShader(
|
|
9101
9146
|
props,
|
|
9102
9147
|
modules,
|
|
@@ -9305,6 +9350,8 @@ ${getApplicationDefines(allDefines)}
|
|
|
9305
9350
|
return false;
|
|
9306
9351
|
}
|
|
9307
9352
|
if (typeof a === "object" && typeof b === "object") {
|
|
9353
|
+
const aObject = a;
|
|
9354
|
+
const bObject = b;
|
|
9308
9355
|
const aKeys = Object.keys(a);
|
|
9309
9356
|
const bKeys = Object.keys(b);
|
|
9310
9357
|
if (aKeys.length !== bKeys.length) {
|
|
@@ -9314,7 +9361,7 @@ ${getApplicationDefines(allDefines)}
|
|
|
9314
9361
|
if (!b.hasOwnProperty(key)) {
|
|
9315
9362
|
return false;
|
|
9316
9363
|
}
|
|
9317
|
-
if (!deepEqual(
|
|
9364
|
+
if (!deepEqual(aObject[key], bObject[key], depth - 1)) {
|
|
9318
9365
|
return false;
|
|
9319
9366
|
}
|
|
9320
9367
|
}
|
|
@@ -9502,7 +9549,7 @@ ${getApplicationDefines(allDefines)}
|
|
|
9502
9549
|
return mergedAttributes;
|
|
9503
9550
|
}
|
|
9504
9551
|
|
|
9505
|
-
// ../
|
|
9552
|
+
// ../graph/src/execution/utils/get-platform-info.ts
|
|
9506
9553
|
function getPlatformInfo(device) {
|
|
9507
9554
|
return {
|
|
9508
9555
|
type: device.type,
|
|
@@ -13427,88 +13474,96 @@ ${getApplicationDefines(allDefines)}
|
|
|
13427
13474
|
this.explicitBufferLayout = this.bufferLayout;
|
|
13428
13475
|
this.geometryVectorBindings = new GPUVectorBindings(device, `${this.id}-geometry`);
|
|
13429
13476
|
this.attributeVectorBindings = new GPUVectorBindings(device, `${this.id}-attributes`);
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
const moduleMap = Object.fromEntries(shaderInputModules.map((module) => [module.name, module]));
|
|
13438
|
-
const shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
|
|
13439
|
-
if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
|
|
13440
|
-
shaderInputs.addModules(resolvedPlugins.modules);
|
|
13441
|
-
}
|
|
13442
|
-
this.setShaderInputs(shaderInputs);
|
|
13443
|
-
const modules = mergeShaderModules(this.props.modules, shaderInputs.getModules());
|
|
13444
|
-
const defines = { ...resolvedPlugins.defines, ...this.props.defines };
|
|
13445
|
-
if (this.device.type === "webgl") {
|
|
13446
|
-
this.props._uniformBlockLayouts = getShaderModuleUniformBlockLayouts(modules);
|
|
13447
|
-
}
|
|
13448
|
-
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
|
|
13449
|
-
const isWebGPU = this.device.type === "webgpu";
|
|
13450
|
-
if (isWebGPU && this.props.source) {
|
|
13451
|
-
const shaderAssembler = this.props.shaderAssembler;
|
|
13452
|
-
(0, import_core13.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
|
|
13453
|
-
const {
|
|
13454
|
-
source: source4,
|
|
13455
|
-
getUniforms: getUniforms2,
|
|
13456
|
-
bindingTable,
|
|
13457
|
-
entryPoints = {},
|
|
13458
|
-
shaderLayout: assembledShaderLayout
|
|
13459
|
-
} = shaderAssembler.assembleWGSLShader({
|
|
13460
|
-
platformInfo,
|
|
13461
|
-
...this.props,
|
|
13462
|
-
modules,
|
|
13463
|
-
defines,
|
|
13464
|
-
pluginInjections: resolvedPlugins.injections,
|
|
13465
|
-
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
13466
|
-
pluginVaryings: resolvedPlugins.varyings
|
|
13467
|
-
});
|
|
13468
|
-
this.source = source4;
|
|
13469
|
-
this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
|
|
13470
|
-
this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
|
|
13471
|
-
this._getModuleUniforms = getUniforms2;
|
|
13472
|
-
this._bindingTable = bindingTable;
|
|
13473
|
-
const scannedOrReflectedShaderLayout = assembledShaderLayout ?? device.getShaderLayout?.(
|
|
13474
|
-
this.source
|
|
13475
|
-
);
|
|
13476
|
-
const inferredShaderLayout = normalizeShaderPluginAttributeNames(
|
|
13477
|
-
scannedOrReflectedShaderLayout,
|
|
13478
|
-
resolvedPlugins.vertexInputs
|
|
13479
|
-
);
|
|
13480
|
-
const shaderLayout = mergeInferredShaderLayout(
|
|
13481
|
-
this.props.shaderLayout,
|
|
13482
|
-
inferredShaderLayout,
|
|
13483
|
-
Object.keys(resolvedPlugins.vertexInputs)
|
|
13477
|
+
try {
|
|
13478
|
+
this._initializeProps(props);
|
|
13479
|
+
const platformInfo = getPlatformInfo(device);
|
|
13480
|
+
const resolvedPlugins = (0, import_shaders3.resolveShaderPlugins)(this.props.plugins, platformInfo.shaderLanguage);
|
|
13481
|
+
const shaderInputModules = (0, import_shaders3.mergeShaderPluginModules)(
|
|
13482
|
+
this.props.modules,
|
|
13483
|
+
resolvedPlugins.modules
|
|
13484
13484
|
);
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
this.
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13485
|
+
const moduleMap = Object.fromEntries(shaderInputModules.map((module) => [module.name, module]));
|
|
13486
|
+
const shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
|
|
13487
|
+
if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
|
|
13488
|
+
shaderInputs.addModules(resolvedPlugins.modules);
|
|
13489
|
+
}
|
|
13490
|
+
this.setShaderInputs(shaderInputs);
|
|
13491
|
+
const modules = mergeShaderModules(this.props.modules, shaderInputs.getModules());
|
|
13492
|
+
const defines = { ...resolvedPlugins.defines, ...this.props.defines };
|
|
13493
|
+
if (this.device.type === "webgl") {
|
|
13494
|
+
this.props._uniformBlockLayouts = getShaderModuleUniformBlockLayouts(modules);
|
|
13495
|
+
}
|
|
13496
|
+
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
|
|
13497
|
+
const isWebGPU = this.device.type === "webgpu";
|
|
13498
|
+
if (isWebGPU && this.props.source) {
|
|
13499
|
+
const shaderAssembler = this.props.shaderAssembler;
|
|
13500
|
+
(0, import_core13.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
|
|
13501
|
+
const {
|
|
13502
|
+
source: source4,
|
|
13503
|
+
getUniforms: getUniforms2,
|
|
13504
|
+
bindingTable,
|
|
13505
|
+
entryPoints = {},
|
|
13506
|
+
shaderLayout: assembledShaderLayout
|
|
13507
|
+
} = shaderAssembler.assembleWGSLShader({
|
|
13508
|
+
platformInfo,
|
|
13509
|
+
...this.props,
|
|
13510
|
+
modules,
|
|
13511
|
+
defines,
|
|
13512
|
+
pluginInjections: resolvedPlugins.injections,
|
|
13513
|
+
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
13514
|
+
pluginInterStageVariables: resolvedPlugins.interStageVariables
|
|
13515
|
+
});
|
|
13516
|
+
this.source = source4;
|
|
13517
|
+
this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
|
|
13518
|
+
this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
|
|
13519
|
+
this._getModuleUniforms = getUniforms2;
|
|
13520
|
+
this._bindingTable = bindingTable;
|
|
13521
|
+
const scannedOrReflectedShaderLayout = assembledShaderLayout ?? device.getShaderLayout?.(
|
|
13522
|
+
this.source
|
|
13523
|
+
);
|
|
13524
|
+
const inferredShaderLayout = normalizeShaderPluginAttributeNames(
|
|
13525
|
+
scannedOrReflectedShaderLayout,
|
|
13526
|
+
resolvedPlugins.vertexInputs
|
|
13527
|
+
);
|
|
13528
|
+
const shaderLayout = mergeInferredShaderLayout(
|
|
13529
|
+
this.props.shaderLayout,
|
|
13530
|
+
inferredShaderLayout,
|
|
13531
|
+
Object.keys(resolvedPlugins.vertexInputs)
|
|
13532
|
+
);
|
|
13533
|
+
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(shaderLayout || null, modules) || null;
|
|
13534
|
+
} else {
|
|
13535
|
+
const shaderAssembler = this.props.shaderAssembler;
|
|
13536
|
+
(0, import_core13.assert)(isShaderAssemblerForLanguage(shaderAssembler, "glsl"));
|
|
13537
|
+
const { vs: vs4, fs: fs4, getUniforms: getUniforms2 } = shaderAssembler.assembleGLSLShaderPair({
|
|
13538
|
+
platformInfo,
|
|
13539
|
+
...this.props,
|
|
13540
|
+
modules,
|
|
13541
|
+
defines,
|
|
13542
|
+
pluginInjections: resolvedPlugins.injections,
|
|
13543
|
+
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
13544
|
+
pluginInterStageVariables: resolvedPlugins.interStageVariables
|
|
13545
|
+
});
|
|
13546
|
+
this.vs = vs4;
|
|
13547
|
+
this.fs = fs4;
|
|
13548
|
+
this._getModuleUniforms = getUniforms2;
|
|
13549
|
+
this._bindingTable = [];
|
|
13550
|
+
}
|
|
13551
|
+
this.pipelineFactory = props.pipelineFactory || import_core13.PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
13552
|
+
this.shaderFactory = props.shaderFactory || import_core13.ShaderFactory.getDefaultShaderFactory(this.device);
|
|
13553
|
+
const asyncCompilation = import_core13.PipelineFactory.getAsyncCompilation(this.device);
|
|
13554
|
+
if (asyncCompilation) {
|
|
13555
|
+
this._pipelineInitialization = this._initializePipelineAsync(props);
|
|
13556
|
+
asyncCompilation.push(this._pipelineInitialization);
|
|
13557
|
+
} else {
|
|
13558
|
+
this.pipeline = this._updatePipeline();
|
|
13559
|
+
this._initializePipelineResources(props);
|
|
13560
|
+
}
|
|
13561
|
+
} catch (error) {
|
|
13562
|
+
try {
|
|
13563
|
+
_GPUVectorModel.prototype.destroy.call(this);
|
|
13564
|
+
} finally {
|
|
13565
|
+
throw error;
|
|
13566
|
+
}
|
|
13512
13567
|
}
|
|
13513
13568
|
}
|
|
13514
13569
|
/** Initializes subclass input policies before shader and pipeline creation. */
|
|
@@ -13561,9 +13616,10 @@ ${getApplicationDefines(allDefines)}
|
|
|
13561
13616
|
this.shaderFactory.release(this.pipeline.fs);
|
|
13562
13617
|
}
|
|
13563
13618
|
}
|
|
13619
|
+
this.vertexArray?.destroy();
|
|
13564
13620
|
this.geometryVectorBindings.destroy();
|
|
13565
13621
|
this.attributeVectorBindings.destroy();
|
|
13566
|
-
this._uniformStore
|
|
13622
|
+
this._uniformStore?.destroy();
|
|
13567
13623
|
this._destroyed = true;
|
|
13568
13624
|
}
|
|
13569
13625
|
}
|
|
@@ -13984,10 +14040,12 @@ ${getApplicationDefines(allDefines)}
|
|
|
13984
14040
|
this.bufferLayout = nextBufferLayout;
|
|
13985
14041
|
this._setPipelineNeedsUpdate("bufferLayout");
|
|
13986
14042
|
this.pipeline = this._updatePipeline();
|
|
14043
|
+
const previousVertexArray = this.vertexArray;
|
|
13987
14044
|
this.vertexArray = this.device.createVertexArray({
|
|
13988
14045
|
shaderLayout: this.pipeline.shaderLayout,
|
|
13989
14046
|
bufferLayout: this.pipeline.bufferLayout
|
|
13990
14047
|
});
|
|
14048
|
+
previousVertexArray.destroy();
|
|
13991
14049
|
this._dynamicAttributeBufferSources = {};
|
|
13992
14050
|
this.applyVectorAttributes();
|
|
13993
14051
|
if (this.indexBuffer) this.vertexArray.setIndexBuffer(this.indexBuffer);
|
|
@@ -14264,7 +14322,13 @@ ${getApplicationDefines(allDefines)}
|
|
|
14264
14322
|
_updatePipeline() {
|
|
14265
14323
|
const update = this._preparePipelineUpdate();
|
|
14266
14324
|
if (update) {
|
|
14267
|
-
|
|
14325
|
+
try {
|
|
14326
|
+
this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
|
|
14327
|
+
} catch (error) {
|
|
14328
|
+
this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
|
|
14329
|
+
this._pipelineNeedsUpdate = "pipeline creation failed";
|
|
14330
|
+
throw error;
|
|
14331
|
+
}
|
|
14268
14332
|
this._finishPipelineUpdate(update);
|
|
14269
14333
|
}
|
|
14270
14334
|
return this.pipeline;
|
|
@@ -14295,22 +14359,29 @@ ${getApplicationDefines(allDefines)}
|
|
|
14295
14359
|
)();
|
|
14296
14360
|
}
|
|
14297
14361
|
this._pipelineNeedsUpdate = false;
|
|
14298
|
-
|
|
14299
|
-
id: `${this.id}-vertex`,
|
|
14300
|
-
stage: "vertex",
|
|
14301
|
-
source: this.source || this.vs,
|
|
14302
|
-
debugShaders: this.props.debugShaders
|
|
14303
|
-
});
|
|
14362
|
+
let vertexShader = null;
|
|
14304
14363
|
let fragmentShader = null;
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
stage: "fragment",
|
|
14311
|
-
source: this.fs,
|
|
14364
|
+
try {
|
|
14365
|
+
vertexShader = this.shaderFactory.createShader({
|
|
14366
|
+
id: `${this.id}-vertex`,
|
|
14367
|
+
stage: "vertex",
|
|
14368
|
+
source: this.source || this.vs,
|
|
14312
14369
|
debugShaders: this.props.debugShaders
|
|
14313
14370
|
});
|
|
14371
|
+
if (this.source) {
|
|
14372
|
+
fragmentShader = vertexShader;
|
|
14373
|
+
} else if (this.fs) {
|
|
14374
|
+
fragmentShader = this.shaderFactory.createShader({
|
|
14375
|
+
id: `${this.id}-fragment`,
|
|
14376
|
+
stage: "fragment",
|
|
14377
|
+
source: this.fs,
|
|
14378
|
+
debugShaders: this.props.debugShaders
|
|
14379
|
+
});
|
|
14380
|
+
}
|
|
14381
|
+
} catch (error) {
|
|
14382
|
+
this._releasePipelineShaders(vertexShader, fragmentShader);
|
|
14383
|
+
this._pipelineNeedsUpdate = "shader creation failed";
|
|
14384
|
+
throw error;
|
|
14314
14385
|
}
|
|
14315
14386
|
return {
|
|
14316
14387
|
props: {
|
|
@@ -17634,8 +17705,10 @@ void main(void) {
|
|
|
17634
17705
|
Object.assign(this.userData, props.userData);
|
|
17635
17706
|
const platformInfo = getPlatformInfo(device);
|
|
17636
17707
|
const resolvedPlugins = (0, import_shaders6.resolveShaderPlugins)(this.props.plugins, platformInfo.shaderLanguage);
|
|
17637
|
-
if (Object.keys(resolvedPlugins.vertexInputs).length > 0 || Object.keys(resolvedPlugins.
|
|
17638
|
-
throw new Error(
|
|
17708
|
+
if (Object.keys(resolvedPlugins.vertexInputs).length > 0 || Object.keys(resolvedPlugins.interStageVariables).length > 0) {
|
|
17709
|
+
throw new Error(
|
|
17710
|
+
"Computation does not support ShaderPlugin vertex inputs or interStageVariables"
|
|
17711
|
+
);
|
|
17639
17712
|
}
|
|
17640
17713
|
const shaderInputModules = (0, import_shaders6.mergeShaderPluginModules)(
|
|
17641
17714
|
this.props.modules,
|