@babylonjs/core 7.7.0 → 7.7.2

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 (86) hide show
  1. package/Animations/animatable.js +1 -1
  2. package/Animations/animatable.js.map +1 -1
  3. package/Animations/runtimeAnimation.d.ts +2 -1
  4. package/Animations/runtimeAnimation.js +3 -2
  5. package/Animations/runtimeAnimation.js.map +1 -1
  6. package/Buffers/buffer.nonFloatVertexBuffers.d.ts +12 -0
  7. package/Buffers/buffer.nonFloatVertexBuffers.js +81 -0
  8. package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -0
  9. package/Culling/boundingBox.d.ts +2 -2
  10. package/Culling/boundingBox.js +2 -2
  11. package/Culling/boundingBox.js.map +1 -1
  12. package/DeviceInput/webDeviceInputSystem.js +8 -2
  13. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  14. package/Engines/IPipelineContext.d.ts +12 -5
  15. package/Engines/IPipelineContext.js.map +1 -1
  16. package/Engines/Native/nativeInterfaces.d.ts +6 -1
  17. package/Engines/Native/nativeInterfaces.js.map +1 -1
  18. package/Engines/Native/nativePipelineContext.d.ts +6 -1
  19. package/Engines/Native/nativePipelineContext.js +3 -1
  20. package/Engines/Native/nativePipelineContext.js.map +1 -1
  21. package/Engines/Native/nativeShaderProcessingContext.d.ts +13 -0
  22. package/Engines/Native/nativeShaderProcessingContext.js +11 -0
  23. package/Engines/Native/nativeShaderProcessingContext.js.map +1 -0
  24. package/Engines/Native/nativeShaderProcessors.d.ts +15 -0
  25. package/Engines/Native/nativeShaderProcessors.js +75 -0
  26. package/Engines/Native/nativeShaderProcessors.js.map +1 -0
  27. package/Engines/Processors/shaderProcessingOptions.d.ts +3 -0
  28. package/Engines/Processors/shaderProcessingOptions.js.map +1 -1
  29. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +0 -2
  30. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -59
  31. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  32. package/Engines/WebGPU/webgpuShaderProcessingContext.d.ts +3 -0
  33. package/Engines/WebGPU/webgpuShaderProcessingContext.js +1 -0
  34. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  35. package/Engines/WebGPU/webgpuShaderProcessor.d.ts +0 -4
  36. package/Engines/WebGPU/webgpuShaderProcessor.js +0 -26
  37. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  38. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +4 -3
  39. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  40. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -1
  41. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +7 -7
  42. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  43. package/Engines/abstractEngine.js +2 -2
  44. package/Engines/abstractEngine.js.map +1 -1
  45. package/Engines/engine.d.ts +1 -1
  46. package/Engines/engineFeatures.d.ts +2 -0
  47. package/Engines/engineFeatures.js.map +1 -1
  48. package/Engines/nativeEngine.d.ts +7 -1
  49. package/Engines/nativeEngine.js +30 -9
  50. package/Engines/nativeEngine.js.map +1 -1
  51. package/Engines/nullEngine.d.ts +4 -0
  52. package/Engines/nullEngine.js +4 -0
  53. package/Engines/nullEngine.js.map +1 -1
  54. package/Engines/thinEngine.d.ts +4 -4
  55. package/Engines/thinEngine.js +1 -0
  56. package/Engines/thinEngine.js.map +1 -1
  57. package/Engines/webgpuEngine.js +1 -0
  58. package/Engines/webgpuEngine.js.map +1 -1
  59. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +4 -2
  60. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  61. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +8 -6
  62. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  63. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +15 -12
  64. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  65. package/Materials/Node/Blocks/voronoiNoiseBlock.js +17 -21
  66. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  67. package/Materials/effect.d.ts +2 -2
  68. package/Materials/effect.js +2 -2
  69. package/Materials/effect.js.map +1 -1
  70. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  71. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  72. package/Meshes/mesh.js +6 -1
  73. package/Meshes/mesh.js.map +1 -1
  74. package/Misc/codeStringParsingTools.d.ts +11 -0
  75. package/Misc/codeStringParsingTools.js +31 -0
  76. package/Misc/codeStringParsingTools.js.map +1 -1
  77. package/Misc/pressureObserverWrapper.js +1 -1
  78. package/Misc/pressureObserverWrapper.js.map +1 -1
  79. package/Particles/solidParticleSystem.d.ts +5 -5
  80. package/Particles/solidParticleSystem.js.map +1 -1
  81. package/Shaders/gaussianSplatting.vertex.js +3 -3
  82. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  83. package/assets/Draco/draco_decoder.js +2 -0
  84. package/assets/Draco/draco_wasm_wrapper.js +1 -1
  85. package/assets/Draco/draco_wasm_wrapper_gltf.js +1 -1
  86. package/package.json +1 -1
@@ -611,7 +611,7 @@ const PressureObserver: {
611
611
  prototype: PressureObserver;
612
612
  new (callback: PressureUpdateCallback, options?: PressureObserverOptions): PressureObserver;
613
613
 
614
- supportedSources: ReadonlyArray<PressureSource>;
614
+ knownSources: ReadonlyArray<PressureSource>;
615
615
  };
616
616
 
617
617
  /**
@@ -49,5 +49,7 @@ export interface EngineFeatures {
49
49
  /** Indicates that the stride and (byte) offset of a vertex buffer must always be a multiple of 4 bytes */
50
50
  forceVertexBufferStrideAndOffsetMultiple4Bytes: boolean;
51
51
  /** @internal */
52
+ _checkNonFloatVertexBuffersDontRecreatePipelineContext: boolean;
53
+ /** @internal */
52
54
  _collectUbosUpdatedInFrame: boolean;
53
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"engineFeatures.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/engineFeatures.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal */\r\nexport interface EngineFeatures {\r\n /** Force using Bitmap when Bitmap or HTMLImageElement can be used */\r\n forceBitmapOverHTMLImageElement: boolean;\r\n\r\n /** Indicates that the engine support rendering to as well as copying to lod float textures */\r\n supportRenderAndCopyToLodForFloatTextures: boolean;\r\n\r\n /** Indicates that the engine support handling depth/stencil textures */\r\n supportDepthStencilTexture: boolean;\r\n\r\n /** Indicates that the engine support shadow samplers */\r\n supportShadowSamplers: boolean;\r\n\r\n /** Indicates to check the matrix bytes per bytes to know if it has changed or not. If false, only the updateFlag of the matrix is checked */\r\n uniformBufferHardCheckMatrix: boolean;\r\n\r\n /** Indicates that prefiltered mipmaps can be generated in some processes (for eg when loading an HDR cube texture) */\r\n allowTexturePrefiltering: boolean;\r\n\r\n /** Indicates to track the usage of ubos and to create new ones as necessary during a frame duration */\r\n trackUbosInFrame: boolean;\r\n\r\n /** Indicates that the current content of a ubo should be compared to the content of the corresponding GPU buffer and the GPU buffer updated only if different. Requires trackUbosInFrame to be true */\r\n checkUbosContentBeforeUpload: boolean;\r\n\r\n /** Indicates that the Cascaded Shadow Map technic is supported */\r\n supportCSM: boolean;\r\n\r\n /** Indicates that the textures transcoded by the basis transcoder must have power of 2 width and height */\r\n basisNeedsPOT: boolean;\r\n\r\n /** Indicates that the engine supports 3D textures */\r\n support3DTextures: boolean;\r\n\r\n /** Indicates that constants need a type suffix in shaders (used by realtime filtering...) */\r\n needTypeSuffixInShaderConstants: boolean;\r\n\r\n /** Indicates that MSAA is supported */\r\n supportMSAA: boolean;\r\n\r\n /** Indicates that SSAO2 is supported */\r\n supportSSAO2: boolean;\r\n\r\n /** Indicates that some additional texture formats are supported (like TEXTUREFORMAT_R for eg) */\r\n supportExtendedTextureFormats: boolean;\r\n\r\n /** Indicates that the switch/case construct is supported in shaders */\r\n supportSwitchCaseInShader: boolean;\r\n\r\n /** Indicates that synchronous texture reading is supported */\r\n supportSyncTextureRead: boolean;\r\n\r\n /** Indicates that y should be inverted when dealing with bitmaps (notably in environment tools) */\r\n needsInvertingBitmap: boolean;\r\n\r\n /** Indicates that the engine should cache the bound UBO */\r\n useUBOBindingCache: boolean;\r\n\r\n /** Indicates that the inliner should be run over every shader code */\r\n needShaderCodeInlining: boolean;\r\n\r\n /** Indicates that even if we don't have to update the properties of a uniform buffer (because of some optimzations in the material) we still need to bind the uniform buffer themselves */\r\n needToAlwaysBindUniformBuffers: boolean;\r\n\r\n /** Indicates that the engine supports render passes */\r\n supportRenderPasses: boolean;\r\n\r\n /** Indicates that the engine supports sprite instancing */\r\n supportSpriteInstancing: boolean;\r\n\r\n /** Indicates that the stride and (byte) offset of a vertex buffer must always be a multiple of 4 bytes */\r\n forceVertexBufferStrideAndOffsetMultiple4Bytes: boolean;\r\n\r\n /** @internal */\r\n _collectUbosUpdatedInFrame: boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"engineFeatures.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/engineFeatures.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal */\r\nexport interface EngineFeatures {\r\n /** Force using Bitmap when Bitmap or HTMLImageElement can be used */\r\n forceBitmapOverHTMLImageElement: boolean;\r\n\r\n /** Indicates that the engine support rendering to as well as copying to lod float textures */\r\n supportRenderAndCopyToLodForFloatTextures: boolean;\r\n\r\n /** Indicates that the engine support handling depth/stencil textures */\r\n supportDepthStencilTexture: boolean;\r\n\r\n /** Indicates that the engine support shadow samplers */\r\n supportShadowSamplers: boolean;\r\n\r\n /** Indicates to check the matrix bytes per bytes to know if it has changed or not. If false, only the updateFlag of the matrix is checked */\r\n uniformBufferHardCheckMatrix: boolean;\r\n\r\n /** Indicates that prefiltered mipmaps can be generated in some processes (for eg when loading an HDR cube texture) */\r\n allowTexturePrefiltering: boolean;\r\n\r\n /** Indicates to track the usage of ubos and to create new ones as necessary during a frame duration */\r\n trackUbosInFrame: boolean;\r\n\r\n /** Indicates that the current content of a ubo should be compared to the content of the corresponding GPU buffer and the GPU buffer updated only if different. Requires trackUbosInFrame to be true */\r\n checkUbosContentBeforeUpload: boolean;\r\n\r\n /** Indicates that the Cascaded Shadow Map technic is supported */\r\n supportCSM: boolean;\r\n\r\n /** Indicates that the textures transcoded by the basis transcoder must have power of 2 width and height */\r\n basisNeedsPOT: boolean;\r\n\r\n /** Indicates that the engine supports 3D textures */\r\n support3DTextures: boolean;\r\n\r\n /** Indicates that constants need a type suffix in shaders (used by realtime filtering...) */\r\n needTypeSuffixInShaderConstants: boolean;\r\n\r\n /** Indicates that MSAA is supported */\r\n supportMSAA: boolean;\r\n\r\n /** Indicates that SSAO2 is supported */\r\n supportSSAO2: boolean;\r\n\r\n /** Indicates that some additional texture formats are supported (like TEXTUREFORMAT_R for eg) */\r\n supportExtendedTextureFormats: boolean;\r\n\r\n /** Indicates that the switch/case construct is supported in shaders */\r\n supportSwitchCaseInShader: boolean;\r\n\r\n /** Indicates that synchronous texture reading is supported */\r\n supportSyncTextureRead: boolean;\r\n\r\n /** Indicates that y should be inverted when dealing with bitmaps (notably in environment tools) */\r\n needsInvertingBitmap: boolean;\r\n\r\n /** Indicates that the engine should cache the bound UBO */\r\n useUBOBindingCache: boolean;\r\n\r\n /** Indicates that the inliner should be run over every shader code */\r\n needShaderCodeInlining: boolean;\r\n\r\n /** Indicates that even if we don't have to update the properties of a uniform buffer (because of some optimzations in the material) we still need to bind the uniform buffer themselves */\r\n needToAlwaysBindUniformBuffers: boolean;\r\n\r\n /** Indicates that the engine supports render passes */\r\n supportRenderPasses: boolean;\r\n\r\n /** Indicates that the engine supports sprite instancing */\r\n supportSpriteInstancing: boolean;\r\n\r\n /** Indicates that the stride and (byte) offset of a vertex buffer must always be a multiple of 4 bytes */\r\n forceVertexBufferStrideAndOffsetMultiple4Bytes: boolean;\r\n\r\n /** @internal */\r\n _checkNonFloatVertexBuffersDontRecreatePipelineContext: boolean;\r\n\r\n /** @internal */\r\n _collectUbosUpdatedInFrame: boolean;\r\n}\r\n"]}
@@ -19,6 +19,8 @@ import type { NativeData } from "./Native/nativeDataStream";
19
19
  import { NativeDataStream } from "./Native/nativeDataStream";
20
20
  import type { INative, NativeFramebuffer, NativeTexture } from "./Native/nativeInterfaces";
21
21
  import type { HardwareTextureWrapper } from "../Materials/Textures/hardwareTextureWrapper";
22
+ import type { ShaderProcessingContext } from "./Processors/shaderProcessingOptions";
23
+ import type { ShaderLanguage } from "../Materials/shaderLanguage";
22
24
  /**
23
25
  * Returns _native only after it has been defined by BabylonNative.
24
26
  * @internal
@@ -127,13 +129,17 @@ export declare class NativeEngine extends Engine {
127
129
  * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
128
130
  */
129
131
  drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
130
- createPipelineContext(): IPipelineContext;
132
+ createPipelineContext(shaderProcessingContext: Nullable<ShaderProcessingContext>): IPipelineContext;
131
133
  createMaterialContext(): IMaterialContext | undefined;
132
134
  createDrawContext(): IDrawContext | undefined;
133
135
  /**
134
136
  * @internal
135
137
  */
136
138
  _preparePipelineContext(pipelineContext: IPipelineContext, vertexSourceCode: string, fragmentSourceCode: string, createAsRaw: boolean, _rawVertexSourceCode: string, _rawFragmentSourceCode: string, _rebuildRebind: any, defines: Nullable<string>): void;
139
+ /**
140
+ * @internal
141
+ */
142
+ _getShaderProcessingContext(_shaderLanguage: ShaderLanguage): Nullable<ShaderProcessingContext>;
137
143
  /**
138
144
  * @internal
139
145
  */
@@ -10,13 +10,15 @@ import { Logger } from "../Misc/logger.js";
10
10
  import { ThinEngine } from "./thinEngine.js";
11
11
  import { EngineStore } from "./engineStore.js";
12
12
  import { ShaderCodeInliner } from "./Processors/shaderCodeInliner.js";
13
- import { WebGL2ShaderProcessor } from "../Engines/WebGL/webGL2ShaderProcessors.js";
13
+ import { NativeShaderProcessor } from "./Native/nativeShaderProcessors.js";
14
14
  import { NativeDataStream } from "./Native/nativeDataStream.js";
15
15
  import { NativePipelineContext } from "./Native/nativePipelineContext.js";
16
16
  import { NativeRenderTargetWrapper } from "./Native/nativeRenderTargetWrapper.js";
17
17
  import { NativeHardwareTexture } from "./Native/nativeHardwareTexture.js";
18
18
  import { getNativeAlphaMode, getNativeAttribType, getNativeSamplingMode, getNativeTextureFormat, getNativeStencilDepthFail, getNativeStencilDepthPass, getNativeStencilFunc, getNativeStencilOpFail, getNativeAddressMode, } from "./Native/nativeHelpers.js";
19
19
  import { AbstractEngine } from "./abstractEngine.js";
20
+ import { checkNonFloatVertexBuffers } from "../Buffers/buffer.nonFloatVertexBuffers.js";
21
+ import { NativeShaderProcessingContext } from "./Native/nativeShaderProcessingContext.js";
20
22
  const onNativeObjectInitialized = new Observable();
21
23
  if (typeof self !== "undefined" && !Object.prototype.hasOwnProperty.call(self, "_native")) {
22
24
  let __native;
@@ -113,6 +115,7 @@ class CommandBufferEncoder {
113
115
  this._pending.length = 0;
114
116
  }
115
117
  }
118
+ const remappedAttributesNames = [];
116
119
  /** @internal */
117
120
  export class NativeEngine extends Engine {
118
121
  setHardwareScalingLevel(level) {
@@ -121,7 +124,10 @@ export class NativeEngine extends Engine {
121
124
  }
122
125
  constructor(options = {}) {
123
126
  super(null, false, undefined, options.adaptToDeviceRatio);
124
- this._engine = new _native.Engine();
127
+ this._engine = new _native.Engine({
128
+ version: Engine.Version,
129
+ nonFloatVertexBuffers: true,
130
+ });
125
131
  this._camera = _native.Camera ? new _native.Camera() : null;
126
132
  this._commandBufferEncoder = new CommandBufferEncoder(this._engine);
127
133
  this._boundBuffersVertexArray = null;
@@ -226,7 +232,8 @@ export class NativeEngine extends Engine {
226
232
  needToAlwaysBindUniformBuffers: false,
227
233
  supportRenderPasses: true,
228
234
  supportSpriteInstancing: false,
229
- forceVertexBufferStrideAndOffsetMultiple4Bytes: false,
235
+ forceVertexBufferStrideAndOffsetMultiple4Bytes: true,
236
+ _checkNonFloatVertexBuffersDontRecreatePipelineContext: false,
230
237
  _collectUbosUpdatedInFrame: false,
231
238
  };
232
239
  Tools.Log("Babylon Native (v" + Engine.Version + ") launched");
@@ -287,7 +294,7 @@ export class NativeEngine extends Engine {
287
294
  this.setDepthFunction(currentDepthFunction);
288
295
  }
289
296
  // Shader processor
290
- this._shaderProcessor = new WebGL2ShaderProcessor();
297
+ this._shaderProcessor = new NativeShaderProcessor();
291
298
  this.onNewSceneAddedObservable.add((scene) => {
292
299
  const originalRender = scene.render;
293
300
  scene.render = (...args) => {
@@ -397,6 +404,7 @@ export class NativeEngine extends Engine {
397
404
  return buffer;
398
405
  }
399
406
  _recordVertexArrayObject(vertexArray, vertexBuffers, indexBuffer, effect, overrideVertexBuffers) {
407
+ checkNonFloatVertexBuffers(vertexBuffers, effect);
400
408
  if (indexBuffer) {
401
409
  this._engine.recordIndexBuffer(vertexArray, indexBuffer.nativeIndexBuffer);
402
410
  }
@@ -413,9 +421,9 @@ export class NativeEngine extends Engine {
413
421
  vertexBuffer = vertexBuffers[kind];
414
422
  }
415
423
  if (vertexBuffer) {
416
- const buffer = vertexBuffer.getBuffer();
424
+ const buffer = vertexBuffer.effectiveBuffer;
417
425
  if (buffer && buffer.nativeVertexBuffer) {
418
- this._engine.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location, vertexBuffer.byteOffset, vertexBuffer.byteStride, vertexBuffer.getSize(), getNativeAttribType(vertexBuffer.type), vertexBuffer.normalized, vertexBuffer.getInstanceDivisor());
426
+ this._engine.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location, vertexBuffer.effectiveByteOffset, vertexBuffer.effectiveByteStride, vertexBuffer.getSize(), getNativeAttribType(vertexBuffer.type), vertexBuffer.normalized, vertexBuffer.getInstanceDivisor());
419
427
  }
420
428
  }
421
429
  }
@@ -449,7 +457,14 @@ export class NativeEngine extends Engine {
449
457
  }
450
458
  getAttributes(pipelineContext, attributesNames) {
451
459
  const nativePipelineContext = pipelineContext;
452
- return this._engine.getAttributes(nativePipelineContext.program, attributesNames);
460
+ const nativeShaderProcessingContext = nativePipelineContext.shaderProcessingContext;
461
+ remappedAttributesNames.length = 0;
462
+ for (let index = 0; index < attributesNames.length; index++) {
463
+ const origAttributeName = attributesNames[index];
464
+ const attributeName = nativeShaderProcessingContext.remappedAttributeNames[origAttributeName] ?? origAttributeName;
465
+ remappedAttributesNames[index] = attributeName;
466
+ }
467
+ return this._engine.getAttributes(nativePipelineContext.program, remappedAttributesNames);
453
468
  }
454
469
  /**
455
470
  * Draw a list of indexed primitives
@@ -503,9 +518,9 @@ export class NativeEngine extends Engine {
503
518
  this._commandBufferEncoder.finishEncodingCommand();
504
519
  // }
505
520
  }
506
- createPipelineContext() {
521
+ createPipelineContext(shaderProcessingContext) {
507
522
  const isAsync = !!(this._caps.parallelShaderCompile && this._engine.createProgramAsync);
508
- return new NativePipelineContext(this, isAsync);
523
+ return new NativePipelineContext(this, isAsync, shaderProcessingContext);
509
524
  }
510
525
  createMaterialContext() {
511
526
  return undefined;
@@ -524,6 +539,12 @@ export class NativeEngine extends Engine {
524
539
  this.createShaderProgram(pipelineContext, vertexSourceCode, fragmentSourceCode, defines);
525
540
  }
526
541
  }
542
+ /**
543
+ * @internal
544
+ */
545
+ _getShaderProcessingContext(_shaderLanguage) {
546
+ return new NativeShaderProcessingContext();
547
+ }
527
548
  /**
528
549
  * @internal
529
550
  */