@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.
Files changed (208) hide show
  1. package/README.md +2 -2
  2. package/dist/arrow/arrow-geometry.cjs +1 -1
  3. package/dist/arrow/arrow-geometry.js +1 -1
  4. package/dist/arrow/arrow-picking.cjs +1 -1
  5. package/dist/arrow/arrow-picking.d.ts +1 -1
  6. package/dist/arrow/arrow-picking.js +1 -1
  7. package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.cjs +5 -5
  8. package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.d.ts +2 -2
  9. package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.js +5 -5
  10. package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.cjs +3 -3
  11. package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js +3 -3
  12. package/dist/arrow/renderers/path/source/arrow-path-source-mapping.cjs +1 -1
  13. package/dist/arrow/renderers/path/source/arrow-path-source-mapping.js +1 -1
  14. package/dist/arrow/renderers/path/transforms/close-arrow-paths.cjs +5 -5
  15. package/dist/arrow/renderers/path/transforms/close-arrow-paths.d.ts +1 -1
  16. package/dist/arrow/renderers/path/transforms/close-arrow-paths.js +5 -5
  17. package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.cjs +3 -3
  18. package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.d.ts +1 -1
  19. package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js +3 -3
  20. package/dist/arrow/renderers/path/transforms/path-view-origins.cjs +1 -1
  21. package/dist/arrow/renderers/path/transforms/path-view-origins.d.ts +1 -1
  22. package/dist/arrow/renderers/path/transforms/path-view-origins.js +1 -1
  23. package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.cjs +1 -1
  24. package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.d.ts +1 -1
  25. package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.js +1 -1
  26. package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.cjs +4 -4
  27. package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.js +4 -4
  28. package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.cjs +1 -1
  29. package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.js +1 -1
  30. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.cjs +1 -1
  31. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.js +1 -1
  32. package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.cjs +1 -1
  33. package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.d.ts +1 -1
  34. package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.js +1 -1
  35. package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.cjs +5 -5
  36. package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.d.ts +1 -1
  37. package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.js +5 -5
  38. package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.cjs +1 -1
  39. package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.js +1 -1
  40. package/dist/arrow/renderers/text/renderers/arrow-text-picking.cjs +1 -1
  41. package/dist/arrow/renderers/text/renderers/arrow-text-picking.js +1 -1
  42. package/dist/arrow/renderers/text/renderers/arrow-text-renderer.cjs +5 -5
  43. package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js +5 -5
  44. package/dist/arrow/renderers/text/source/arrow-text-source-mapping.cjs +1 -1
  45. package/dist/arrow/renderers/text/source/arrow-text-source-mapping.js +1 -1
  46. package/dist/compute/computation.cjs +2 -2
  47. package/dist/compute/computation.d.ts +1 -1
  48. package/dist/compute/computation.d.ts.map +1 -1
  49. package/dist/compute/computation.js +2 -2
  50. package/dist/compute/computation.js.map +1 -1
  51. package/dist/compute/texture-transform.d.ts +2 -2
  52. package/dist/compute/texture-transform.d.ts.map +1 -1
  53. package/dist/compute/texture-transform.js.map +1 -1
  54. package/dist/dist.dev.js +395 -322
  55. package/dist/dist.min.js +68 -63
  56. package/dist/experimental/materials/emissive-material.cjs +1 -1
  57. package/dist/experimental/materials/emissive-material.d.ts +1 -1
  58. package/dist/experimental/materials/emissive-material.d.ts.map +1 -1
  59. package/dist/experimental/materials/emissive-material.js +1 -1
  60. package/dist/experimental/materials/emissive-material.js.map +1 -1
  61. package/dist/experimental/materials/glass-material.cjs +1 -1
  62. package/dist/experimental/materials/glass-material.d.ts +1 -1
  63. package/dist/experimental/materials/glass-material.d.ts.map +1 -1
  64. package/dist/experimental/materials/glass-material.js +1 -1
  65. package/dist/experimental/materials/glass-material.js.map +1 -1
  66. package/dist/experimental/materials/glass-transmission.cjs +1 -1
  67. package/dist/experimental/materials/glass-transmission.d.ts +1 -1
  68. package/dist/experimental/materials/glass-transmission.d.ts.map +1 -1
  69. package/dist/experimental/materials/glass-transmission.js +1 -1
  70. package/dist/experimental/materials/glass-transmission.js.map +1 -1
  71. package/dist/experimental/materials/index.cjs.map +1 -1
  72. package/dist/experimental/materials/optical-caustics.cjs +1 -1
  73. package/dist/experimental/materials/optical-caustics.d.ts +1 -1
  74. package/dist/experimental/materials/optical-caustics.d.ts.map +1 -1
  75. package/dist/experimental/materials/optical-caustics.js +1 -1
  76. package/dist/experimental/materials/optical-caustics.js.map +1 -1
  77. package/dist/experimental/materials/optical-point-lights.cjs +1 -1
  78. package/dist/experimental/materials/optical-point-lights.d.ts +1 -1
  79. package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -1
  80. package/dist/experimental/materials/optical-point-lights.js +1 -1
  81. package/dist/experimental/materials/optical-point-lights.js.map +1 -1
  82. package/dist/experimental/materials/reflective-material.cjs +1 -1
  83. package/dist/experimental/materials/reflective-material.d.ts +1 -1
  84. package/dist/experimental/materials/reflective-material.d.ts.map +1 -1
  85. package/dist/experimental/materials/reflective-material.js +1 -1
  86. package/dist/experimental/materials/reflective-material.js.map +1 -1
  87. package/dist/geometry/gpu-geometry.cjs +1 -1
  88. package/dist/geometry/gpu-geometry.d.ts.map +1 -1
  89. package/dist/geometry/gpu-geometry.js +1 -1
  90. package/dist/geometry/gpu-geometry.js.map +1 -1
  91. package/dist/gltf/gltf/gltf-lod.cjs +21 -6
  92. package/dist/gltf/gltf/gltf-lod.d.ts.map +1 -1
  93. package/dist/gltf/gltf/gltf-lod.js +20 -4
  94. package/dist/gltf/gltf/gltf-lod.js.map +1 -1
  95. package/dist/gltf/index.cjs.map +1 -1
  96. package/dist/gltf/types/gltf-json-schema.d.ts +37 -37
  97. package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
  98. package/dist/gltf/types/gltf-postprocessed-schema.d.ts +28 -28
  99. package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
  100. package/dist/graph/models/index.cjs.map +1 -1
  101. package/dist/graph/models/path/path-attribute-model.cjs +2 -2
  102. package/dist/graph/models/path/path-attribute-model.d.ts +2 -2
  103. package/dist/graph/models/path/path-attribute-model.js +2 -2
  104. package/dist/graph/models/path/path-storage-model.cjs +1 -1
  105. package/dist/graph/models/path/path-storage-model.d.ts +1 -1
  106. package/dist/graph/models/path/path-storage-model.js +1 -1
  107. package/dist/graph/models/path/path-trips-storage-model.d.ts +2 -2
  108. package/dist/graph/models/polygon/polygon-attribute-model.cjs +2 -2
  109. package/dist/graph/models/polygon/polygon-attribute-model.js +2 -2
  110. package/dist/graph/models/polygon/polygon-storage-model.cjs +2 -2
  111. package/dist/graph/models/polygon/polygon-storage-model.js +2 -2
  112. package/dist/graph/tables/gpu-table-model.cjs +1 -1
  113. package/dist/graph/tables/gpu-table-model.js +1 -1
  114. package/dist/graph/tables/gpu-table-transform.cjs +2 -2
  115. package/dist/graph/tables/gpu-table-transform.d.ts +1 -1
  116. package/dist/graph/tables/gpu-table-transform.js +2 -2
  117. package/dist/graph/tables/index.cjs.map +1 -1
  118. package/dist/index.cjs.map +1 -1
  119. package/dist/model/gpu-vector-model.cjs +104 -79
  120. package/dist/model/gpu-vector-model.d.ts +1 -1
  121. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  122. package/dist/model/gpu-vector-model.js +129 -98
  123. package/dist/model/gpu-vector-model.js.map +1 -1
  124. package/dist/splats/splat-data.cjs +1 -1
  125. package/dist/splats/splat-data.d.ts +1 -1
  126. package/dist/splats/splat-data.js +1 -1
  127. package/dist/splats/splat-renderer.cjs +1 -1
  128. package/dist/splats/splat-renderer.js +1 -1
  129. package/dist/text/experimental.cjs +151 -3
  130. package/dist/text/experimental.d.ts +1 -1
  131. package/dist/text/experimental.d.ts.map +1 -1
  132. package/dist/text/experimental.js +1 -1
  133. package/dist/text/experimental.js.map +1 -1
  134. package/dist/text/index.cjs +41 -3
  135. package/dist/text/index.d.ts +1 -1
  136. package/dist/text/index.d.ts.map +1 -1
  137. package/dist/text/index.js +1 -1
  138. package/dist/text/index.js.map +1 -1
  139. package/dist/text/text-2d/experimental.cjs +128 -18
  140. package/dist/text/text-2d/experimental.d.ts +8 -8
  141. package/dist/text/text-2d/experimental.d.ts.map +1 -1
  142. package/dist/text/text-2d/experimental.js +7 -8
  143. package/dist/text/text-2d/experimental.js.map +1 -1
  144. package/dist/text/text-2d/model-utils/text-model-props.d.ts +1 -1
  145. package/dist/text/text-2d/models/text-attribute-model.cjs +1 -1
  146. package/dist/text/text-2d/models/text-attribute-model.js +1 -1
  147. package/dist/utils/deep-equal.cjs +3 -1
  148. package/dist/utils/deep-equal.d.ts +1 -1
  149. package/dist/utils/deep-equal.d.ts.map +1 -1
  150. package/dist/utils/deep-equal.js +3 -1
  151. package/dist/utils/deep-equal.js.map +1 -1
  152. package/dist/utils/get-platform-info.cjs +9 -3
  153. package/dist/utils/get-platform-info.d.ts +1 -1
  154. package/dist/utils/get-platform-info.d.ts.map +1 -1
  155. package/dist/utils/get-platform-info.js +1 -1
  156. package/dist/utils/get-platform-info.js.map +1 -1
  157. package/package.json +6 -7
  158. package/src/arrow/arrow-geometry.ts +1 -1
  159. package/src/arrow/arrow-picking.ts +2 -2
  160. package/src/arrow/renderers/path/conversion/arrow-path-gpu-vectors.ts +9 -9
  161. package/src/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.ts +4 -4
  162. package/src/arrow/renderers/path/source/arrow-path-source-mapping.ts +1 -1
  163. package/src/arrow/renderers/path/transforms/close-arrow-paths.ts +5 -5
  164. package/src/arrow/renderers/path/transforms/gpu-path-float64-deltas.ts +3 -3
  165. package/src/arrow/renderers/path/transforms/path-view-origins.ts +2 -2
  166. package/src/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.ts +1 -1
  167. package/src/arrow/renderers/polygon/renderers/arrow-polygon-renderer.ts +4 -4
  168. package/src/arrow/renderers/polygon/source/arrow-polygon-source-mapping.ts +1 -1
  169. package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.ts +1 -1
  170. package/src/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.ts +2 -2
  171. package/src/arrow/renderers/text/conversion/convert-arrow-text-to-storage.ts +1 -1
  172. package/src/arrow/renderers/text/conversion/convert-arrow-text-vectors.ts +6 -6
  173. package/src/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.ts +1 -1
  174. package/src/arrow/renderers/text/renderers/arrow-text-picking.ts +1 -1
  175. package/src/arrow/renderers/text/renderers/arrow-text-renderer.ts +5 -5
  176. package/src/arrow/renderers/text/source/arrow-text-source-mapping.ts +1 -1
  177. package/src/compute/computation.ts +5 -3
  178. package/src/compute/texture-transform.ts +2 -2
  179. package/src/experimental/materials/emissive-material.ts +1 -1
  180. package/src/experimental/materials/glass-material.ts +1 -1
  181. package/src/experimental/materials/glass-transmission.ts +1 -1
  182. package/src/experimental/materials/optical-caustics.ts +1 -1
  183. package/src/experimental/materials/optical-point-lights.ts +1 -1
  184. package/src/experimental/materials/reflective-material.ts +1 -1
  185. package/src/experimental/textures/rgba-decoder.ts +1 -1
  186. package/src/geometry/gpu-geometry.ts +1 -4
  187. package/src/gltf/gltf/gltf-lod.ts +22 -4
  188. package/src/gltf/physics/README.md +1 -1
  189. package/src/gltf/types/gltf-json-schema.ts +37 -37
  190. package/src/gltf/types/gltf-postprocessed-schema.ts +28 -28
  191. package/src/graph/models/path/path-attribute-model.ts +3 -3
  192. package/src/graph/models/path/path-storage-model.ts +2 -2
  193. package/src/graph/models/path/path-trips-storage-model.ts +2 -2
  194. package/src/graph/models/polygon/polygon-attribute-model.ts +2 -2
  195. package/src/graph/models/polygon/polygon-storage-model.ts +2 -2
  196. package/src/graph/tables/gpu-table-model.ts +1 -1
  197. package/src/graph/tables/gpu-table-transform.ts +3 -3
  198. package/src/model/gpu-vector-model.ts +147 -120
  199. package/src/splats/splat-data.ts +1 -1
  200. package/src/splats/splat-renderer.ts +1 -1
  201. package/src/text/README.md +1 -1
  202. package/src/text/experimental.ts +122 -1
  203. package/src/text/index.ts +40 -1
  204. package/src/text/text-2d/experimental.ts +104 -8
  205. package/src/text/text-2d/model-utils/text-model-props.ts +1 -1
  206. package/src/text/text-2d/models/text-attribute-model.ts +1 -1
  207. package/src/utils/deep-equal.ts +4 -2
  208. package/src/utils/get-platform-info.ts +1 -1
@@ -237,70 +237,78 @@ class GPUVectorModel {
237
237
  this.explicitBufferLayout = this.bufferLayout;
238
238
  this.geometryVectorBindings = new import_gpu_vector_bindings.GPUVectorBindings(device, `${this.id}-geometry`);
239
239
  this.attributeVectorBindings = new import_gpu_vector_bindings.GPUVectorBindings(device, `${this.id}-attributes`);
240
- this._initializeProps(props);
241
- const platformInfo = (0, import_get_platform_info.getPlatformInfo)(device);
242
- const resolvedPlugins = (0, import_shaders.resolveShaderPlugins)(this.props.plugins, platformInfo.shaderLanguage);
243
- const shaderInputModules = (0, import_shaders.mergeShaderPluginModules)(this.props.modules, resolvedPlugins.modules);
244
- const moduleMap = Object.fromEntries(shaderInputModules.map((module2) => [module2.name, module2]));
245
- const shaderInputs = props.shaderInputs || new import_shader_inputs.ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
246
- if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
247
- shaderInputs.addModules(resolvedPlugins.modules);
248
- }
249
- this.setShaderInputs(shaderInputs);
250
- const modules = (0, import_shader_module_utils.mergeShaderModules)(this.props.modules, shaderInputs.getModules());
251
- const defines = { ...resolvedPlugins.defines, ...this.props.defines };
252
- if (this.device.type === "webgl") {
253
- this.props._uniformBlockLayouts = (0, import_shader_module_utils.getShaderModuleUniformBlockLayouts)(modules);
254
- }
255
- this.props.shaderLayout = (0, import_shader_module_utils.mergeShaderModuleBindingsIntoLayout)(this.props.shaderLayout, modules) || null;
256
- const isWebGPU = this.device.type === "webgpu";
257
- if (isWebGPU && this.props.source) {
258
- const shaderAssembler = this.props.shaderAssembler;
259
- (0, import_core.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
260
- const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
261
- platformInfo,
262
- ...this.props,
263
- modules,
264
- defines,
265
- pluginInjections: resolvedPlugins.injections,
266
- pluginVertexInputs: resolvedPlugins.vertexInputs,
267
- pluginVaryings: resolvedPlugins.varyings
268
- });
269
- this.source = source;
270
- this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
271
- this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
272
- this._getModuleUniforms = getUniforms;
273
- this._bindingTable = bindingTable;
274
- const scannedOrReflectedShaderLayout = assembledShaderLayout ?? ((_a = device.getShaderLayout) == null ? void 0 : _a.call(device, this.source));
275
- const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
276
- const shaderLayout = (0, import_shader_module_utils.mergeInferredShaderLayout)(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
277
- this.props.shaderLayout = (0, import_shader_module_utils.mergeShaderModuleBindingsIntoLayout)(shaderLayout || null, modules) || null;
278
- } else {
279
- const shaderAssembler = this.props.shaderAssembler;
280
- (0, import_core.assert)(isShaderAssemblerForLanguage(shaderAssembler, "glsl"));
281
- const { vs, fs, getUniforms } = shaderAssembler.assembleGLSLShaderPair({
282
- platformInfo,
283
- ...this.props,
284
- modules,
285
- defines,
286
- pluginInjections: resolvedPlugins.injections,
287
- pluginVertexInputs: resolvedPlugins.vertexInputs,
288
- pluginVaryings: resolvedPlugins.varyings
289
- });
290
- this.vs = vs;
291
- this.fs = fs;
292
- this._getModuleUniforms = getUniforms;
293
- this._bindingTable = [];
294
- }
295
- this.pipelineFactory = props.pipelineFactory || import_core.PipelineFactory.getDefaultPipelineFactory(this.device);
296
- this.shaderFactory = props.shaderFactory || import_core.ShaderFactory.getDefaultShaderFactory(this.device);
297
- const asyncCompilation = import_core.PipelineFactory.getAsyncCompilation(this.device);
298
- if (asyncCompilation) {
299
- this._pipelineInitialization = this._initializePipelineAsync(props);
300
- asyncCompilation.push(this._pipelineInitialization);
301
- } else {
302
- this.pipeline = this._updatePipeline();
303
- this._initializePipelineResources(props);
240
+ try {
241
+ this._initializeProps(props);
242
+ const platformInfo = (0, import_get_platform_info.getPlatformInfo)(device);
243
+ const resolvedPlugins = (0, import_shaders.resolveShaderPlugins)(this.props.plugins, platformInfo.shaderLanguage);
244
+ const shaderInputModules = (0, import_shaders.mergeShaderPluginModules)(this.props.modules, resolvedPlugins.modules);
245
+ const moduleMap = Object.fromEntries(shaderInputModules.map((module2) => [module2.name, module2]));
246
+ const shaderInputs = props.shaderInputs || new import_shader_inputs.ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
247
+ if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
248
+ shaderInputs.addModules(resolvedPlugins.modules);
249
+ }
250
+ this.setShaderInputs(shaderInputs);
251
+ const modules = (0, import_shader_module_utils.mergeShaderModules)(this.props.modules, shaderInputs.getModules());
252
+ const defines = { ...resolvedPlugins.defines, ...this.props.defines };
253
+ if (this.device.type === "webgl") {
254
+ this.props._uniformBlockLayouts = (0, import_shader_module_utils.getShaderModuleUniformBlockLayouts)(modules);
255
+ }
256
+ this.props.shaderLayout = (0, import_shader_module_utils.mergeShaderModuleBindingsIntoLayout)(this.props.shaderLayout, modules) || null;
257
+ const isWebGPU = this.device.type === "webgpu";
258
+ if (isWebGPU && this.props.source) {
259
+ const shaderAssembler = this.props.shaderAssembler;
260
+ (0, import_core.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
261
+ const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
262
+ platformInfo,
263
+ ...this.props,
264
+ modules,
265
+ defines,
266
+ pluginInjections: resolvedPlugins.injections,
267
+ pluginVertexInputs: resolvedPlugins.vertexInputs,
268
+ pluginInterStageVariables: resolvedPlugins.interStageVariables
269
+ });
270
+ this.source = source;
271
+ this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
272
+ this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
273
+ this._getModuleUniforms = getUniforms;
274
+ this._bindingTable = bindingTable;
275
+ const scannedOrReflectedShaderLayout = assembledShaderLayout ?? ((_a = device.getShaderLayout) == null ? void 0 : _a.call(device, this.source));
276
+ const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
277
+ const shaderLayout = (0, import_shader_module_utils.mergeInferredShaderLayout)(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
278
+ this.props.shaderLayout = (0, import_shader_module_utils.mergeShaderModuleBindingsIntoLayout)(shaderLayout || null, modules) || null;
279
+ } else {
280
+ const shaderAssembler = this.props.shaderAssembler;
281
+ (0, import_core.assert)(isShaderAssemblerForLanguage(shaderAssembler, "glsl"));
282
+ const { vs, fs, getUniforms } = shaderAssembler.assembleGLSLShaderPair({
283
+ platformInfo,
284
+ ...this.props,
285
+ modules,
286
+ defines,
287
+ pluginInjections: resolvedPlugins.injections,
288
+ pluginVertexInputs: resolvedPlugins.vertexInputs,
289
+ pluginInterStageVariables: resolvedPlugins.interStageVariables
290
+ });
291
+ this.vs = vs;
292
+ this.fs = fs;
293
+ this._getModuleUniforms = getUniforms;
294
+ this._bindingTable = [];
295
+ }
296
+ this.pipelineFactory = props.pipelineFactory || import_core.PipelineFactory.getDefaultPipelineFactory(this.device);
297
+ this.shaderFactory = props.shaderFactory || import_core.ShaderFactory.getDefaultShaderFactory(this.device);
298
+ const asyncCompilation = import_core.PipelineFactory.getAsyncCompilation(this.device);
299
+ if (asyncCompilation) {
300
+ this._pipelineInitialization = this._initializePipelineAsync(props);
301
+ asyncCompilation.push(this._pipelineInitialization);
302
+ } else {
303
+ this.pipeline = this._updatePipeline();
304
+ this._initializePipelineResources(props);
305
+ }
306
+ } catch (error) {
307
+ try {
308
+ GPUVectorModel.prototype.destroy.call(this);
309
+ } finally {
310
+ throw error;
311
+ }
304
312
  }
305
313
  }
306
314
  /** Initializes subclass input policies before shader and pipeline creation. */
@@ -355,6 +363,7 @@ class GPUVectorModel {
355
363
  this.transformFeedback = props.transformFeedback;
356
364
  }
357
365
  destroy() {
366
+ var _a, _b;
358
367
  if (!this._destroyed) {
359
368
  if (this.pipeline) {
360
369
  this.pipelineFactory.release(this.pipeline);
@@ -363,9 +372,10 @@ class GPUVectorModel {
363
372
  this.shaderFactory.release(this.pipeline.fs);
364
373
  }
365
374
  }
375
+ (_a = this.vertexArray) == null ? void 0 : _a.destroy();
366
376
  this.geometryVectorBindings.destroy();
367
377
  this.attributeVectorBindings.destroy();
368
- this._uniformStore.destroy();
378
+ (_b = this._uniformStore) == null ? void 0 : _b.destroy();
369
379
  this._destroyed = true;
370
380
  }
371
381
  }
@@ -767,10 +777,12 @@ class GPUVectorModel {
767
777
  this.bufferLayout = nextBufferLayout;
768
778
  this._setPipelineNeedsUpdate("bufferLayout");
769
779
  this.pipeline = this._updatePipeline();
780
+ const previousVertexArray = this.vertexArray;
770
781
  this.vertexArray = this.device.createVertexArray({
771
782
  shaderLayout: this.pipeline.shaderLayout,
772
783
  bufferLayout: this.pipeline.bufferLayout
773
784
  });
785
+ previousVertexArray.destroy();
774
786
  this._dynamicAttributeBufferSources = {};
775
787
  this.applyVectorAttributes();
776
788
  if (this.indexBuffer)
@@ -1035,7 +1047,13 @@ class GPUVectorModel {
1035
1047
  _updatePipeline() {
1036
1048
  const update = this._preparePipelineUpdate();
1037
1049
  if (update) {
1038
- this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
1050
+ try {
1051
+ this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
1052
+ } catch (error) {
1053
+ this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
1054
+ this._pipelineNeedsUpdate = "pipeline creation failed";
1055
+ throw error;
1056
+ }
1039
1057
  this._finishPipelineUpdate(update);
1040
1058
  }
1041
1059
  return this.pipeline;
@@ -1065,22 +1083,29 @@ class GPUVectorModel {
1065
1083
  import_core.log.log(1, `GPUVectorModel ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
1066
1084
  }
1067
1085
  this._pipelineNeedsUpdate = false;
1068
- const vertexShader = this.shaderFactory.createShader({
1069
- id: `${this.id}-vertex`,
1070
- stage: "vertex",
1071
- source: this.source || this.vs,
1072
- debugShaders: this.props.debugShaders
1073
- });
1086
+ let vertexShader = null;
1074
1087
  let fragmentShader = null;
1075
- if (this.source) {
1076
- fragmentShader = vertexShader;
1077
- } else if (this.fs) {
1078
- fragmentShader = this.shaderFactory.createShader({
1079
- id: `${this.id}-fragment`,
1080
- stage: "fragment",
1081
- source: this.fs,
1088
+ try {
1089
+ vertexShader = this.shaderFactory.createShader({
1090
+ id: `${this.id}-vertex`,
1091
+ stage: "vertex",
1092
+ source: this.source || this.vs,
1082
1093
  debugShaders: this.props.debugShaders
1083
1094
  });
1095
+ if (this.source) {
1096
+ fragmentShader = vertexShader;
1097
+ } else if (this.fs) {
1098
+ fragmentShader = this.shaderFactory.createShader({
1099
+ id: `${this.id}-fragment`,
1100
+ stage: "fragment",
1101
+ source: this.fs,
1102
+ debugShaders: this.props.debugShaders
1103
+ });
1104
+ }
1105
+ } catch (error) {
1106
+ this._releasePipelineShaders(vertexShader, fragmentShader);
1107
+ this._pipelineNeedsUpdate = "shader creation failed";
1108
+ throw error;
1084
1109
  }
1085
1110
  return {
1086
1111
  props: {
@@ -107,7 +107,7 @@ export declare class GPUVectorModel {
107
107
  readonly shaderFactory: ShaderFactory;
108
108
  /** User-supplied per-model data */
109
109
  userData: {
110
- [key: string]: any;
110
+ [key: string]: unknown;
111
111
  };
112
112
  /** The render pipeline GPU parameters, depth testing etc */
113
113
  parameters: RenderPipelineParameters;
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-vector-model.d.ts","sourceRoot":"","sources":["../../src/model/gpu-vector-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAIjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAEjB,MAAM,EACN,MAAM,EAIN,cAAc,EACd,UAAU,EACV,eAAe,EACf,aAAa,EACb,YAAY,EAMb,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAC,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAiD,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAkBjG,OAAO,EAGL,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,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I;IAe7C,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA4BlE,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM;IAOjF,sFAAsF;IACtF,SAAS,CAAC,uBAAuB,IAAI,eAAe;IAIpD,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,sBAAsB;CAuC/B"}
@@ -245,90 +245,103 @@ export class GPUVectorModel {
245
245
  this.explicitBufferLayout = this.bufferLayout;
246
246
  this.geometryVectorBindings = new GPUVectorBindings(device, `${this.id}-geometry`);
247
247
  this.attributeVectorBindings = new GPUVectorBindings(device, `${this.id}-attributes`);
248
- this._initializeProps(props);
249
- const platformInfo = getPlatformInfo(device);
250
- const resolvedPlugins = resolveShaderPlugins(this.props.plugins, platformInfo.shaderLanguage);
251
- // Setup shader module inputs
252
- const shaderInputModules = mergeShaderPluginModules(this.props.modules, resolvedPlugins.modules);
253
- const moduleMap = Object.fromEntries(shaderInputModules.map(module => [module.name, module]));
254
- const shaderInputs = props.shaderInputs ||
255
- new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
256
- if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
257
- shaderInputs.addModules(resolvedPlugins.modules);
258
- }
259
- // @ts-ignore
260
- this.setShaderInputs(shaderInputs);
261
- // Setup shader assembler
262
- const modules = mergeShaderModules(this.props.modules, shaderInputs.getModules());
263
- const defines = { ...resolvedPlugins.defines, ...this.props.defines };
264
- if (this.device.type === 'webgl') {
265
- this.props._uniformBlockLayouts = getShaderModuleUniformBlockLayouts(modules);
266
- }
267
- this.props.shaderLayout =
268
- mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
269
- const isWebGPU = this.device.type === 'webgpu';
270
- // WebGPU
271
- // TODO - hack to support unified WGSL shader
272
- // TODO - this is wrong, compile a single shader
273
- if (isWebGPU && this.props.source) {
274
- // WGSL
275
- const shaderAssembler = this.props.shaderAssembler;
276
- // WGSL sources require an assembler with WGSL-specific hooks and binding state.
277
- assert(isShaderAssemblerForLanguage(shaderAssembler, 'wgsl'));
278
- const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
279
- platformInfo,
280
- ...this.props,
281
- modules,
282
- defines,
283
- pluginInjections: resolvedPlugins.injections,
284
- pluginVertexInputs: resolvedPlugins.vertexInputs,
285
- pluginVaryings: resolvedPlugins.varyings
286
- });
287
- this.source = source;
288
- this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
289
- this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
290
- // @ts-expect-error
291
- this._getModuleUniforms = getUniforms;
292
- this._bindingTable = bindingTable;
293
- // Infer the layout after modules have been added so their bindings are included.
294
- const scannedOrReflectedShaderLayout = assembledShaderLayout ??
295
- device.getShaderLayout?.(this.source);
296
- const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
297
- const shaderLayout = mergeInferredShaderLayout(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
248
+ try {
249
+ this._initializeProps(props);
250
+ const platformInfo = getPlatformInfo(device);
251
+ const resolvedPlugins = resolveShaderPlugins(this.props.plugins, platformInfo.shaderLanguage);
252
+ // Setup shader module inputs
253
+ const shaderInputModules = mergeShaderPluginModules(this.props.modules, resolvedPlugins.modules);
254
+ const moduleMap = Object.fromEntries(shaderInputModules.map(module => [module.name, module]));
255
+ const shaderInputs = props.shaderInputs ||
256
+ new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
257
+ if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
258
+ shaderInputs.addModules(resolvedPlugins.modules);
259
+ }
260
+ // @ts-ignore
261
+ this.setShaderInputs(shaderInputs);
262
+ // Setup shader assembler
263
+ const modules = mergeShaderModules(this.props.modules, shaderInputs.getModules());
264
+ const defines = { ...resolvedPlugins.defines, ...this.props.defines };
265
+ if (this.device.type === 'webgl') {
266
+ this.props._uniformBlockLayouts = getShaderModuleUniformBlockLayouts(modules);
267
+ }
298
268
  this.props.shaderLayout =
299
- mergeShaderModuleBindingsIntoLayout(shaderLayout || null, modules) || null;
300
- }
301
- else {
302
- // GLSL
303
- const shaderAssembler = this.props.shaderAssembler;
304
- // GLSL shader pairs require an assembler with GLSL-specific hooks.
305
- assert(isShaderAssemblerForLanguage(shaderAssembler, 'glsl'));
306
- const { vs, fs, getUniforms } = shaderAssembler.assembleGLSLShaderPair({
307
- platformInfo,
308
- ...this.props,
309
- modules,
310
- defines,
311
- pluginInjections: resolvedPlugins.injections,
312
- pluginVertexInputs: resolvedPlugins.vertexInputs,
313
- pluginVaryings: resolvedPlugins.varyings
314
- });
315
- this.vs = vs;
316
- this.fs = fs;
317
- // @ts-expect-error
318
- this._getModuleUniforms = getUniforms;
319
- this._bindingTable = [];
320
- }
321
- this.pipelineFactory =
322
- props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);
323
- this.shaderFactory = props.shaderFactory || ShaderFactory.getDefaultShaderFactory(this.device);
324
- const asyncCompilation = PipelineFactory.getAsyncCompilation(this.device);
325
- if (asyncCompilation) {
326
- this._pipelineInitialization = this._initializePipelineAsync(props);
327
- asyncCompilation.push(this._pipelineInitialization);
269
+ mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
270
+ const isWebGPU = this.device.type === 'webgpu';
271
+ // WebGPU
272
+ // TODO - hack to support unified WGSL shader
273
+ // TODO - this is wrong, compile a single shader
274
+ if (isWebGPU && this.props.source) {
275
+ // WGSL
276
+ const shaderAssembler = this.props.shaderAssembler;
277
+ // WGSL sources require an assembler with WGSL-specific hooks and binding state.
278
+ assert(isShaderAssemblerForLanguage(shaderAssembler, 'wgsl'));
279
+ const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
280
+ platformInfo,
281
+ ...this.props,
282
+ modules,
283
+ defines,
284
+ pluginInjections: resolvedPlugins.injections,
285
+ pluginVertexInputs: resolvedPlugins.vertexInputs,
286
+ pluginInterStageVariables: resolvedPlugins.interStageVariables
287
+ });
288
+ this.source = source;
289
+ this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
290
+ this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
291
+ // @ts-expect-error
292
+ this._getModuleUniforms = getUniforms;
293
+ this._bindingTable = bindingTable;
294
+ // Infer the layout after modules have been added so their bindings are included.
295
+ const scannedOrReflectedShaderLayout = assembledShaderLayout ??
296
+ device.getShaderLayout?.(this.source);
297
+ const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
298
+ const shaderLayout = mergeInferredShaderLayout(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
299
+ this.props.shaderLayout =
300
+ mergeShaderModuleBindingsIntoLayout(shaderLayout || null, modules) || null;
301
+ }
302
+ else {
303
+ // GLSL
304
+ const shaderAssembler = this.props.shaderAssembler;
305
+ // GLSL shader pairs require an assembler with GLSL-specific hooks.
306
+ assert(isShaderAssemblerForLanguage(shaderAssembler, 'glsl'));
307
+ const { vs, fs, getUniforms } = shaderAssembler.assembleGLSLShaderPair({
308
+ platformInfo,
309
+ ...this.props,
310
+ modules,
311
+ defines,
312
+ pluginInjections: resolvedPlugins.injections,
313
+ pluginVertexInputs: resolvedPlugins.vertexInputs,
314
+ pluginInterStageVariables: resolvedPlugins.interStageVariables
315
+ });
316
+ this.vs = vs;
317
+ this.fs = fs;
318
+ // @ts-expect-error
319
+ this._getModuleUniforms = getUniforms;
320
+ this._bindingTable = [];
321
+ }
322
+ this.pipelineFactory =
323
+ props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);
324
+ this.shaderFactory =
325
+ props.shaderFactory || ShaderFactory.getDefaultShaderFactory(this.device);
326
+ const asyncCompilation = PipelineFactory.getAsyncCompilation(this.device);
327
+ if (asyncCompilation) {
328
+ this._pipelineInitialization = this._initializePipelineAsync(props);
329
+ asyncCompilation.push(this._pipelineInitialization);
330
+ }
331
+ else {
332
+ this.pipeline = this._updatePipeline();
333
+ this._initializePipelineResources(props);
334
+ }
328
335
  }
329
- else {
330
- this.pipeline = this._updatePipeline();
331
- this._initializePipelineResources(props);
336
+ catch (error) {
337
+ // Failed construction never returns a model for the caller to destroy.
338
+ // Subclass fields may not exist yet, so bypass virtual teardown.
339
+ try {
340
+ GPUVectorModel.prototype.destroy.call(this);
341
+ }
342
+ finally {
343
+ throw error;
344
+ }
332
345
  }
333
346
  }
334
347
  /** Initializes subclass input policies before shader and pipeline creation. */
@@ -393,9 +406,10 @@ export class GPUVectorModel {
393
406
  this.shaderFactory.release(this.pipeline.fs);
394
407
  }
395
408
  }
409
+ this.vertexArray?.destroy();
396
410
  this.geometryVectorBindings.destroy();
397
411
  this.attributeVectorBindings.destroy();
398
- this._uniformStore.destroy();
412
+ this._uniformStore?.destroy();
399
413
  this._destroyed = true;
400
414
  }
401
415
  }
@@ -834,10 +848,12 @@ export class GPUVectorModel {
834
848
  this.pipeline = this._updatePipeline();
835
849
  // vertex array needs to be updated if we update buffer layout,
836
850
  // but not if we update parameters
851
+ const previousVertexArray = this.vertexArray;
837
852
  this.vertexArray = this.device.createVertexArray({
838
853
  shaderLayout: this.pipeline.shaderLayout,
839
854
  bufferLayout: this.pipeline.bufferLayout
840
855
  });
856
+ previousVertexArray.destroy();
841
857
  this._dynamicAttributeBufferSources = {};
842
858
  this.applyVectorAttributes();
843
859
  if (this.indexBuffer)
@@ -1128,7 +1144,14 @@ export class GPUVectorModel {
1128
1144
  _updatePipeline() {
1129
1145
  const update = this._preparePipelineUpdate();
1130
1146
  if (update) {
1131
- this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
1147
+ try {
1148
+ this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
1149
+ }
1150
+ catch (error) {
1151
+ this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
1152
+ this._pipelineNeedsUpdate = 'pipeline creation failed';
1153
+ throw error;
1154
+ }
1132
1155
  this._finishPipelineUpdate(update);
1133
1156
  }
1134
1157
  return this.pipeline;
@@ -1158,23 +1181,31 @@ export class GPUVectorModel {
1158
1181
  log.log(1, `GPUVectorModel ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
1159
1182
  }
1160
1183
  this._pipelineNeedsUpdate = false;
1161
- const vertexShader = this.shaderFactory.createShader({
1162
- id: `${this.id}-vertex`,
1163
- stage: 'vertex',
1164
- source: this.source || this.vs,
1165
- debugShaders: this.props.debugShaders
1166
- });
1184
+ let vertexShader = null;
1167
1185
  let fragmentShader = null;
1168
- if (this.source) {
1169
- fragmentShader = vertexShader;
1170
- }
1171
- else if (this.fs) {
1172
- fragmentShader = this.shaderFactory.createShader({
1173
- id: `${this.id}-fragment`,
1174
- stage: 'fragment',
1175
- source: this.fs,
1186
+ try {
1187
+ vertexShader = this.shaderFactory.createShader({
1188
+ id: `${this.id}-vertex`,
1189
+ stage: 'vertex',
1190
+ source: this.source || this.vs,
1176
1191
  debugShaders: this.props.debugShaders
1177
1192
  });
1193
+ if (this.source) {
1194
+ fragmentShader = vertexShader;
1195
+ }
1196
+ else if (this.fs) {
1197
+ fragmentShader = this.shaderFactory.createShader({
1198
+ id: `${this.id}-fragment`,
1199
+ stage: 'fragment',
1200
+ source: this.fs,
1201
+ debugShaders: this.props.debugShaders
1202
+ });
1203
+ }
1204
+ }
1205
+ catch (error) {
1206
+ this._releasePipelineShaders(vertexShader, fragmentShader);
1207
+ this._pipelineNeedsUpdate = 'shader creation failed';
1208
+ throw error;
1178
1209
  }
1179
1210
  return {
1180
1211
  props: {