@babylonjs/core 7.6.2 → 7.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/Buffers/buffer.nonFloatVertexBuffers.d.ts +12 -0
  2. package/Buffers/buffer.nonFloatVertexBuffers.js +81 -0
  3. package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -0
  4. package/Culling/boundingBox.d.ts +2 -2
  5. package/Culling/boundingBox.js +2 -2
  6. package/Culling/boundingBox.js.map +1 -1
  7. package/DeviceInput/webDeviceInputSystem.js +8 -2
  8. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  9. package/Engines/IPipelineContext.d.ts +7 -0
  10. package/Engines/IPipelineContext.js.map +1 -1
  11. package/Engines/Native/nativePipelineContext.d.ts +6 -1
  12. package/Engines/Native/nativePipelineContext.js +3 -1
  13. package/Engines/Native/nativePipelineContext.js.map +1 -1
  14. package/Engines/Native/nativeShaderProcessingContext.d.ts +13 -0
  15. package/Engines/Native/nativeShaderProcessingContext.js +11 -0
  16. package/Engines/Native/nativeShaderProcessingContext.js.map +1 -0
  17. package/Engines/Native/nativeShaderProcessors.d.ts +15 -0
  18. package/Engines/Native/nativeShaderProcessors.js +75 -0
  19. package/Engines/Native/nativeShaderProcessors.js.map +1 -0
  20. package/Engines/Processors/shaderProcessingOptions.d.ts +3 -0
  21. package/Engines/Processors/shaderProcessingOptions.js.map +1 -1
  22. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +0 -2
  23. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -59
  24. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  25. package/Engines/WebGPU/webgpuShaderProcessingContext.d.ts +3 -0
  26. package/Engines/WebGPU/webgpuShaderProcessingContext.js +1 -0
  27. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  28. package/Engines/WebGPU/webgpuShaderProcessor.d.ts +0 -4
  29. package/Engines/WebGPU/webgpuShaderProcessor.js +0 -26
  30. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  31. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +4 -3
  32. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  33. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -1
  34. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +7 -7
  35. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  36. package/Engines/abstractEngine.js +2 -2
  37. package/Engines/abstractEngine.js.map +1 -1
  38. package/Engines/engine.d.ts +1 -1
  39. package/Engines/engineFeatures.d.ts +2 -0
  40. package/Engines/engineFeatures.js.map +1 -1
  41. package/Engines/nativeEngine.d.ts +7 -1
  42. package/Engines/nativeEngine.js +26 -8
  43. package/Engines/nativeEngine.js.map +1 -1
  44. package/Engines/nullEngine.d.ts +4 -0
  45. package/Engines/nullEngine.js +4 -0
  46. package/Engines/nullEngine.js.map +1 -1
  47. package/Engines/thinEngine.js +1 -0
  48. package/Engines/thinEngine.js.map +1 -1
  49. package/Engines/webgpuEngine.js +1 -0
  50. package/Engines/webgpuEngine.js.map +1 -1
  51. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +4 -2
  52. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  53. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +8 -6
  54. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +15 -12
  56. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/voronoiNoiseBlock.js +17 -21
  58. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  59. package/Materials/effect.d.ts +2 -2
  60. package/Materials/effect.js +2 -2
  61. package/Materials/effect.js.map +1 -1
  62. package/Meshes/mesh.js +6 -1
  63. package/Meshes/mesh.js.map +1 -1
  64. package/Misc/codeStringParsingTools.d.ts +11 -0
  65. package/Misc/codeStringParsingTools.js +31 -0
  66. package/Misc/codeStringParsingTools.js.map +1 -1
  67. package/Misc/pressureObserverWrapper.js +1 -1
  68. package/Misc/pressureObserverWrapper.js.map +1 -1
  69. package/Shaders/gaussianSplatting.vertex.js +3 -3
  70. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  71. 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) {
@@ -226,7 +229,8 @@ export class NativeEngine extends Engine {
226
229
  needToAlwaysBindUniformBuffers: false,
227
230
  supportRenderPasses: true,
228
231
  supportSpriteInstancing: false,
229
- forceVertexBufferStrideAndOffsetMultiple4Bytes: false,
232
+ forceVertexBufferStrideAndOffsetMultiple4Bytes: true,
233
+ _checkNonFloatVertexBuffersDontRecreatePipelineContext: false,
230
234
  _collectUbosUpdatedInFrame: false,
231
235
  };
232
236
  Tools.Log("Babylon Native (v" + Engine.Version + ") launched");
@@ -287,7 +291,7 @@ export class NativeEngine extends Engine {
287
291
  this.setDepthFunction(currentDepthFunction);
288
292
  }
289
293
  // Shader processor
290
- this._shaderProcessor = new WebGL2ShaderProcessor();
294
+ this._shaderProcessor = new NativeShaderProcessor();
291
295
  this.onNewSceneAddedObservable.add((scene) => {
292
296
  const originalRender = scene.render;
293
297
  scene.render = (...args) => {
@@ -397,6 +401,7 @@ export class NativeEngine extends Engine {
397
401
  return buffer;
398
402
  }
399
403
  _recordVertexArrayObject(vertexArray, vertexBuffers, indexBuffer, effect, overrideVertexBuffers) {
404
+ checkNonFloatVertexBuffers(vertexBuffers, effect);
400
405
  if (indexBuffer) {
401
406
  this._engine.recordIndexBuffer(vertexArray, indexBuffer.nativeIndexBuffer);
402
407
  }
@@ -413,9 +418,9 @@ export class NativeEngine extends Engine {
413
418
  vertexBuffer = vertexBuffers[kind];
414
419
  }
415
420
  if (vertexBuffer) {
416
- const buffer = vertexBuffer.getBuffer();
421
+ const buffer = vertexBuffer.effectiveBuffer;
417
422
  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());
423
+ this._engine.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location, vertexBuffer.effectiveByteOffset, vertexBuffer.effectiveByteStride, vertexBuffer.getSize(), getNativeAttribType(vertexBuffer.type), vertexBuffer.normalized, vertexBuffer.getInstanceDivisor());
419
424
  }
420
425
  }
421
426
  }
@@ -449,7 +454,14 @@ export class NativeEngine extends Engine {
449
454
  }
450
455
  getAttributes(pipelineContext, attributesNames) {
451
456
  const nativePipelineContext = pipelineContext;
452
- return this._engine.getAttributes(nativePipelineContext.program, attributesNames);
457
+ const nativeShaderProcessingContext = nativePipelineContext.shaderProcessingContext;
458
+ remappedAttributesNames.length = 0;
459
+ for (let index = 0; index < attributesNames.length; index++) {
460
+ const origAttributeName = attributesNames[index];
461
+ const attributeName = nativeShaderProcessingContext.remappedAttributeNames[origAttributeName] ?? origAttributeName;
462
+ remappedAttributesNames[index] = attributeName;
463
+ }
464
+ return this._engine.getAttributes(nativePipelineContext.program, remappedAttributesNames);
453
465
  }
454
466
  /**
455
467
  * Draw a list of indexed primitives
@@ -503,9 +515,9 @@ export class NativeEngine extends Engine {
503
515
  this._commandBufferEncoder.finishEncodingCommand();
504
516
  // }
505
517
  }
506
- createPipelineContext() {
518
+ createPipelineContext(shaderProcessingContext) {
507
519
  const isAsync = !!(this._caps.parallelShaderCompile && this._engine.createProgramAsync);
508
- return new NativePipelineContext(this, isAsync);
520
+ return new NativePipelineContext(this, isAsync, shaderProcessingContext);
509
521
  }
510
522
  createMaterialContext() {
511
523
  return undefined;
@@ -524,6 +536,12 @@ export class NativeEngine extends Engine {
524
536
  this.createShaderProgram(pipelineContext, vertexSourceCode, fragmentSourceCode, defines);
525
537
  }
526
538
  }
539
+ /**
540
+ * @internal
541
+ */
542
+ _getShaderProcessingContext(_shaderLanguage) {
543
+ return new NativeShaderProcessingContext();
544
+ }
527
545
  /**
528
546
  * @internal
529
547
  */