@babylonjs/core 5.7.0 → 5.8.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 (98) hide show
  1. package/DeviceInput/InputDevices/webDeviceInputSystem.js +1 -1
  2. package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -1
  3. package/Engines/Extensions/engine.dynamicBuffer.js +7 -5
  4. package/Engines/Extensions/engine.dynamicBuffer.js.map +1 -1
  5. package/Engines/Extensions/engine.rawTexture.d.ts +4 -2
  6. package/Engines/Extensions/engine.rawTexture.js +9 -4
  7. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  8. package/Engines/WebGPU/Extensions/engine.computeShader.js +3 -1
  9. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.dynamicBuffer.js +3 -21
  11. package/Engines/WebGPU/Extensions/engine.dynamicBuffer.js.map +1 -1
  12. package/Engines/WebGPU/Extensions/engine.rawTexture.js +7 -3
  13. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  14. package/Engines/WebGPU/webgpuConstants.d.ts +8 -2
  15. package/Engines/WebGPU/webgpuConstants.js +15 -8
  16. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  17. package/Engines/WebGPU/webgpuTextureHelper.js +4 -0
  18. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  19. package/Engines/engine.d.ts +56 -77
  20. package/Engines/nativeEngine.d.ts +4 -4
  21. package/Engines/nativeEngine.js +9 -5
  22. package/Engines/nativeEngine.js.map +1 -1
  23. package/Engines/nullEngine.d.ts +4 -2
  24. package/Engines/nullEngine.js +11 -3
  25. package/Engines/nullEngine.js.map +1 -1
  26. package/Engines/thinEngine.js +30 -4
  27. package/Engines/thinEngine.js.map +1 -1
  28. package/Engines/webgpuEngine.js +2 -8
  29. package/Engines/webgpuEngine.js.map +1 -1
  30. package/Gizmos/boundingBoxGizmo.js +5 -0
  31. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  32. package/Gizmos/gizmo.js +8 -2
  33. package/Gizmos/gizmo.js.map +1 -1
  34. package/Inputs/scene.inputManager.js +5 -2
  35. package/Inputs/scene.inputManager.js.map +1 -1
  36. package/Loading/Plugins/babylonFileLoader.js +1 -0
  37. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  38. package/Materials/Node/Blocks/Input/inputBlock.js +7 -0
  39. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  40. package/Materials/Node/nodeMaterial.d.ts +4 -2
  41. package/Materials/Node/nodeMaterial.js +13 -4
  42. package/Materials/Node/nodeMaterial.js.map +1 -1
  43. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  44. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  45. package/Materials/Textures/internalTexture.js +1 -1
  46. package/Materials/Textures/internalTexture.js.map +1 -1
  47. package/Materials/Textures/rawTexture.d.ts +10 -4
  48. package/Materials/Textures/rawTexture.js +20 -9
  49. package/Materials/Textures/rawTexture.js.map +1 -1
  50. package/Materials/effect.d.ts +1 -0
  51. package/Materials/effect.js +5 -0
  52. package/Materials/effect.js.map +1 -1
  53. package/Materials/standardMaterial.js +5 -1
  54. package/Materials/standardMaterial.js.map +1 -1
  55. package/Maths/math.vector.js +5 -5
  56. package/Maths/math.vector.js.map +1 -1
  57. package/Meshes/Builders/groundBuilder.d.ts +1 -1
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/abstractMesh.d.ts +0 -5
  60. package/Meshes/abstractMesh.js +1 -13
  61. package/Meshes/abstractMesh.js.map +1 -1
  62. package/Meshes/instancedMesh.js +2 -0
  63. package/Meshes/instancedMesh.js.map +1 -1
  64. package/Meshes/mesh.d.ts +1 -1
  65. package/Meshes/mesh.js +60 -32
  66. package/Meshes/mesh.js.map +1 -1
  67. package/Navigation/Plugins/recastJSPlugin.js +1 -1
  68. package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
  69. package/Particles/pointsCloudSystem.d.ts +12 -0
  70. package/Particles/pointsCloudSystem.js +30 -0
  71. package/Particles/pointsCloudSystem.js.map +1 -1
  72. package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +1 -1
  73. package/PostProcesses/depthOfFieldBlurPostProcess.js +2 -4
  74. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  75. package/Rendering/geometryBufferRenderer.d.ts +6 -2
  76. package/Rendering/geometryBufferRenderer.js +209 -18
  77. package/Rendering/geometryBufferRenderer.js.map +1 -1
  78. package/Shaders/ShadersInclude/defaultFragmentDeclaration.js +1 -1
  79. package/Shaders/ShadersInclude/defaultFragmentDeclaration.js.map +1 -1
  80. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +1 -1
  81. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  82. package/Shaders/ShadersInclude/vertexColorMixing.js +1 -1
  83. package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -1
  84. package/Shaders/default.fragment.js +1 -1
  85. package/Shaders/default.fragment.js.map +1 -1
  86. package/Shaders/geometry.fragment.d.ts +1 -0
  87. package/Shaders/geometry.fragment.js +2 -1
  88. package/Shaders/geometry.fragment.js.map +1 -1
  89. package/Shaders/geometry.vertex.js +1 -1
  90. package/Shaders/geometry.vertex.js.map +1 -1
  91. package/Shaders/pbr.fragment.js +1 -1
  92. package/Shaders/pbr.fragment.js.map +1 -1
  93. package/XR/features/WebXRControllerPointerSelection.js +1 -1
  94. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  95. package/package.json +1 -1
  96. package/scene.d.ts +4 -0
  97. package/scene.js +4 -0
  98. package/scene.js.map +1 -1
@@ -1093,6 +1093,8 @@ interface WebGLRenderingContext {
1093
1093
  COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: number;
1094
1094
  COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: number;
1095
1095
  COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: number;
1096
+ COMPRESSED_SRGB8_ETC2: number;
1097
+ COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: number;
1096
1098
 
1097
1099
  UNSIGNED_INT_24_8: number;
1098
1100
  DEPTH24_STENCIL8: number;
@@ -1363,8 +1365,8 @@ interface WorkerNavigator {
1363
1365
  }
1364
1366
 
1365
1367
  class GPU {
1366
- private __brand: void;
1367
1368
  requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
1369
+ getPreferredCanvasFormat(): GPUTextureFormat;
1368
1370
  }
1369
1371
 
1370
1372
  interface GPURequestAdapterOptions {
@@ -1376,7 +1378,6 @@ type GPUPowerPreference = "low-power" | "high-performance";
1376
1378
 
1377
1379
  class GPUAdapter {
1378
1380
  // https://michalzalecki.com/nominal-typing-in-typescript/#approach-1-class-with-a-private-property
1379
- private __brand: void;
1380
1381
  readonly name: string;
1381
1382
  readonly features: GPUSupportedFeatures;
1382
1383
  readonly limits: GPUSupportedLimits;
@@ -1388,6 +1389,7 @@ class GPUAdapter {
1388
1389
  interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
1389
1390
  requiredFeatures?: GPUFeatureName[] /* default=[] */;
1390
1391
  requiredLimits?: { [name: string]: GPUSize64 } /* default={} */;
1392
+ defaultQueue?: GPUQueueDescriptor /* default={} */;
1391
1393
  }
1392
1394
 
1393
1395
  type GPUFeatureName =
@@ -1398,10 +1400,11 @@ type GPUFeatureName =
1398
1400
  | "texture-compression-etc2"
1399
1401
  | "texture-compression-astc"
1400
1402
  | "timestamp-query"
1401
- | "indirect-first-instance";
1403
+ | "indirect-first-instance"
1404
+ | "shader-f16"
1405
+ | "bgra8unorm-storage";
1402
1406
 
1403
1407
  class GPUDevice extends EventTarget implements GPUObjectBase {
1404
- private __brand: void;
1405
1408
  label: string | undefined;
1406
1409
 
1407
1410
  readonly features: GPUSupportedFeatures;
@@ -1439,7 +1442,6 @@ class GPUDevice extends EventTarget implements GPUObjectBase {
1439
1442
  }
1440
1443
 
1441
1444
  class GPUBuffer implements GPUObjectBase {
1442
- private __brand: void;
1443
1445
  label: string | undefined;
1444
1446
 
1445
1447
  mapAsync(mode: GPUMapModeFlags, offset?: GPUSize64 /*default=0*/, size?: GPUSize64): Promise<void>;
@@ -1460,7 +1462,6 @@ type GPUBufferUsageFlags = number;
1460
1462
  type GPUMapModeFlags = number;
1461
1463
 
1462
1464
  class GPUTexture implements GPUObjectBase {
1463
- private __brand: void;
1464
1465
  label: string | undefined;
1465
1466
 
1466
1467
  createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
@@ -1482,7 +1483,6 @@ type GPUTextureDimension = "1d" | "2d" | "3d";
1482
1483
  type GPUTextureUsageFlags = number;
1483
1484
 
1484
1485
  class GPUTextureView implements GPUObjectBase {
1485
- private __brand: void;
1486
1486
  label: string | undefined;
1487
1487
  }
1488
1488
 
@@ -1623,7 +1623,6 @@ type GPUTextureFormat =
1623
1623
  | "astc-12x12-unorm-srgb";
1624
1624
 
1625
1625
  class GPUExternalTexture implements GPUObjectBase {
1626
- private __brand: void;
1627
1626
  label: string | undefined;
1628
1627
  }
1629
1628
 
@@ -1633,7 +1632,6 @@ interface GPUExternalTextureDescriptor extends GPUObjectDescriptorBase {
1633
1632
  }
1634
1633
 
1635
1634
  class GPUSampler implements GPUObjectBase {
1636
- private __brand: void;
1637
1635
  label: string | undefined;
1638
1636
  }
1639
1637
 
@@ -1657,7 +1655,6 @@ type GPUFilterMode = "nearest" | "linear";
1657
1655
  type GPUCompareFunction = "never" | "less" | "equal" | "less-equal" | "greater" | "not-equal" | "greater-equal" | "always";
1658
1656
 
1659
1657
  class GPUBindGroupLayout implements GPUObjectBase {
1660
- private __brand: void;
1661
1658
  label: string | undefined;
1662
1659
  }
1663
1660
 
@@ -1665,8 +1662,6 @@ interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
1665
1662
  entries: GPUBindGroupLayoutEntry[];
1666
1663
  }
1667
1664
 
1668
- type GPUShaderStageFlags = number;
1669
-
1670
1665
  interface GPUBindGroupLayoutEntry {
1671
1666
  binding: GPUIndex32;
1672
1667
  visibility: GPUShaderStageFlags;
@@ -1678,6 +1673,8 @@ interface GPUBindGroupLayoutEntry {
1678
1673
  externalTexture?: GPUExternalTextureBindingLayout;
1679
1674
  }
1680
1675
 
1676
+ type GPUShaderStageFlags = number;
1677
+
1681
1678
  type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage";
1682
1679
 
1683
1680
  interface GPUBufferBindingLayout {
@@ -1711,7 +1708,6 @@ interface GPUStorageTextureBindingLayout {
1711
1708
  interface GPUExternalTextureBindingLayout {}
1712
1709
 
1713
1710
  class GPUBindGroup implements GPUObjectBase {
1714
- private __brand: void;
1715
1711
  label: string | undefined;
1716
1712
  }
1717
1713
 
@@ -1734,7 +1730,6 @@ interface GPUBufferBinding {
1734
1730
  }
1735
1731
 
1736
1732
  class GPUPipelineLayout implements GPUObjectBase {
1737
- private __brand: void;
1738
1733
  label: string | undefined;
1739
1734
  }
1740
1735
 
@@ -1743,22 +1738,21 @@ interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase {
1743
1738
  }
1744
1739
 
1745
1740
  class GPUShaderModule implements GPUObjectBase {
1746
- private __brand: void;
1747
1741
  label: string | undefined;
1748
1742
 
1749
1743
  compilationInfo(): Promise<GPUCompilationInfo>;
1750
1744
  }
1751
1745
 
1752
- interface GPUShaderModuleCompilationHint {
1753
- layout: GPUPipelineLayout;
1754
- }
1755
-
1756
1746
  interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase {
1757
1747
  code: string | Uint32Array;
1758
1748
  sourceMap?: object;
1759
1749
  hints?: { [name: string]: GPUShaderModuleCompilationHint };
1760
1750
  }
1761
1751
 
1752
+ interface GPUShaderModuleCompilationHint {
1753
+ layout: GPUPipelineLayout | GPUAutoLayoutMode;
1754
+ }
1755
+
1762
1756
  type GPUCompilationMessageType = "error" | "warning" | "info";
1763
1757
 
1764
1758
  interface GPUCompilationMessage {
@@ -1774,8 +1768,10 @@ interface GPUCompilationInfo {
1774
1768
  readonly messages: readonly GPUCompilationMessage[];
1775
1769
  }
1776
1770
 
1771
+ type GPUAutoLayoutMode = "auto";
1772
+
1777
1773
  interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
1778
- layout?: GPUPipelineLayout;
1774
+ layout?: GPUPipelineLayout | GPUAutoLayoutMode;
1779
1775
  }
1780
1776
 
1781
1777
  interface GPUPipelineBase {
@@ -1788,10 +1784,9 @@ interface GPUProgrammableStage {
1788
1784
  constants?: { [name: string]: GPUPipelineConstantValue };
1789
1785
  }
1790
1786
 
1791
- type GPUPipelineConstantValue = number; // May represent WGSL’s bool, f32, i32, u32.
1787
+ type GPUPipelineConstantValue = number; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled.
1792
1788
 
1793
1789
  class GPUComputePipeline implements GPUObjectBase, GPUPipelineBase {
1794
- private __brand: void;
1795
1790
  label: string | undefined;
1796
1791
 
1797
1792
  getBindGroupLayout(index: number): GPUBindGroupLayout;
@@ -1802,7 +1797,6 @@ interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
1802
1797
  }
1803
1798
 
1804
1799
  class GPURenderPipeline implements GPUObjectBase, GPUPipelineBase {
1805
- private __brand: void;
1806
1800
  label: string | undefined;
1807
1801
 
1808
1802
  getBindGroupLayout(index: number): GPUBindGroupLayout;
@@ -1816,8 +1810,6 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
1816
1810
  fragment?: GPUFragmentState;
1817
1811
  }
1818
1812
 
1819
- type GPUPrimitiveTopology = "point-list" | "line-list" | "line-strip" | "triangle-list" | "triangle-strip";
1820
-
1821
1813
  interface GPUPrimitiveState {
1822
1814
  topology?: GPUPrimitiveTopology /* default="triangle-list" */;
1823
1815
  stripIndexFormat?: GPUIndexFormat;
@@ -1828,6 +1820,8 @@ interface GPUPrimitiveState {
1828
1820
  unclippedDepth?: boolean /* default=false */;
1829
1821
  }
1830
1822
 
1823
+ type GPUPrimitiveTopology = "point-list" | "line-list" | "line-strip" | "triangle-list" | "triangle-strip";
1824
+
1831
1825
  type GPUFrontFace = "ccw" | "cw";
1832
1826
 
1833
1827
  type GPUCullMode = "none" | "front" | "back";
@@ -1839,7 +1833,7 @@ interface GPUMultisampleState {
1839
1833
  }
1840
1834
 
1841
1835
  interface GPUFragmentState extends GPUProgrammableStage {
1842
- targets: (GPUColorTargetState | null | undefined)[];
1836
+ targets: (GPUColorTargetState | null)[];
1843
1837
  }
1844
1838
 
1845
1839
  interface GPUColorTargetState {
@@ -1958,7 +1952,6 @@ interface GPUVertexAttribute {
1958
1952
  }
1959
1953
 
1960
1954
  class GPUCommandBuffer implements GPUObjectBase {
1961
- private __brand: void;
1962
1955
  label: string | undefined;
1963
1956
  }
1964
1957
 
@@ -1967,7 +1960,6 @@ interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {}
1967
1960
  interface GPUCommandsMixin {}
1968
1961
 
1969
1962
  class GPUCommandEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin {
1970
- private __brand: void;
1971
1963
  label: string | undefined;
1972
1964
 
1973
1965
  beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
@@ -2020,13 +2012,9 @@ interface GPUImageCopyExternalImage {
2020
2012
  flipY?: boolean /* default=false */;
2021
2013
  }
2022
2014
 
2023
- interface GPUProgrammablePassEncoder {
2015
+ interface GPUBindingCommandsMixin {
2024
2016
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup, dynamicOffsets?: GPUBufferDynamicOffset[]): void;
2025
2017
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup, dynamicOffsetData: Uint32Array, dynamicOffsetsDataStart: GPUSize64, dynamicOffsetsDataLength: GPUSize32): void;
2026
-
2027
- pushDebugGroup(groupLabel: string): void;
2028
- popDebugGroup(): void;
2029
- insertDebugMarker(markerLabel: string): void;
2030
2018
  }
2031
2019
 
2032
2020
  interface GPUDebugCommandsMixin {
@@ -2035,8 +2023,7 @@ interface GPUDebugCommandsMixin {
2035
2023
  insertDebugMarker(markerLabel: string): void;
2036
2024
  }
2037
2025
 
2038
- class GPUComputePassEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin, GPUProgrammablePassEncoder {
2039
- private __brand: void;
2026
+ class GPUComputePassEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin, GPUBindingCommandsMixin {
2040
2027
  label: string | undefined;
2041
2028
 
2042
2029
  setBindGroup(index: number, bindGroup: GPUBindGroup, dynamicOffsets?: GPUBufferDynamicOffset[]): void;
@@ -2047,8 +2034,8 @@ class GPUComputePassEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebug
2047
2034
  insertDebugMarker(markerLabel: string): void;
2048
2035
 
2049
2036
  setPipeline(pipeline: GPUComputePipeline): void;
2050
- dispatch(workgroupCountX: GPUSize32, workgroupCountY?: GPUSize32 /* default=1 */, workgroupCountZ?: GPUSize32 /* default=1 */): void;
2051
- dispatchIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void;
2037
+ dispatchWorkgroups(workgroupCountX: GPUSize32, workgroupCountY?: GPUSize32 /* default=1 */, workgroupCountZ?: GPUSize32 /* default=1 */): void;
2038
+ dispatchWorkgroupsIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void;
2052
2039
 
2053
2040
  end(): void;
2054
2041
  }
@@ -2067,27 +2054,7 @@ interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
2067
2054
  timestampWrites?: GPUComputePassTimestampWrites /* default=[] */;
2068
2055
  }
2069
2056
 
2070
- interface GPURenderEncoderBase {
2071
- setPipeline(pipeline: GPURenderPipeline): void;
2072
-
2073
- setIndexBuffer(buffer: GPUBuffer, indexFormat: GPUIndexFormat, offset?: GPUSize64 /* default=0 */, size?: GPUSize64 /* default=0 */): void;
2074
- setVertexBuffer(slot: GPUIndex32, buffer: GPUBuffer, offset?: GPUSize64 /* default=0 */, size?: GPUSize64 /* default=0 */): void;
2075
-
2076
- draw(vertexCount: GPUSize32, instanceCount?: GPUSize32 /* default=1 */, firstVertex?: GPUSize32 /* default=0 */, firstInstance?: GPUSize32 /* default=0 */): void;
2077
- drawIndexed(
2078
- indexCount: GPUSize32,
2079
- instanceCount?: GPUSize32 /* default=1 */,
2080
- firstIndex?: GPUSize32 /* default=0 */,
2081
- baseVertex?: GPUSignedOffset32 /* default=0 */,
2082
- firstInstance?: GPUSize32 /* default=0 */
2083
- ): void;
2084
-
2085
- drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void;
2086
- drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void;
2087
- }
2088
-
2089
- class GPURenderPassEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin, GPUProgrammablePassEncoder, GPURenderEncoderBase {
2090
- private __brand: void;
2057
+ class GPURenderPassEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin, GPUBindingCommandsMixin, GPURenderCommandsMixin {
2091
2058
  label: string | undefined;
2092
2059
 
2093
2060
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup, dynamicOffsets?: GPUBufferDynamicOffset[]): void;
@@ -2139,7 +2106,7 @@ interface GPURenderPassTimestampWrite {
2139
2106
  type GPURenderPassTimestampWrites = Array<GPURenderPassTimestampWrite>;
2140
2107
 
2141
2108
  interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
2142
- colorAttachments: (GPURenderPassColorAttachment | null | undefined)[];
2109
+ colorAttachments: (GPURenderPassColorAttachment | null)[];
2143
2110
  depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
2144
2111
  occlusionQuerySet?: GPUQuerySet;
2145
2112
  timestampWrites?: GPURenderPassTimestampWrites /* default=[] */;
@@ -2173,20 +2140,37 @@ type GPULoadOp = "load" | "clear";
2173
2140
  type GPUStoreOp = "store" | "discard";
2174
2141
 
2175
2142
  interface GPURenderPassLayout extends GPUObjectDescriptorBase {
2176
- colorFormats: (GPUTextureFormat | null | undefined)[];
2143
+ colorFormats: (GPUTextureFormat | null)[];
2177
2144
  depthStencilFormat?: GPUTextureFormat;
2178
2145
  sampleCount?: GPUSize32 /* default=1 */;
2179
2146
  }
2180
2147
 
2148
+ interface GPURenderCommandsMixin {
2149
+ setPipeline(pipeline: GPURenderPipeline): void;
2150
+
2151
+ setIndexBuffer(buffer: GPUBuffer, indexFormat: GPUIndexFormat, offset?: GPUSize64 /* default=0 */, size?: GPUSize64 /* default=0 */): void;
2152
+ setVertexBuffer(slot: GPUIndex32, buffer: GPUBuffer, offset?: GPUSize64 /* default=0 */, size?: GPUSize64 /* default=0 */): void;
2153
+
2154
+ draw(vertexCount: GPUSize32, instanceCount?: GPUSize32 /* default=1 */, firstVertex?: GPUSize32 /* default=0 */, firstInstance?: GPUSize32 /* default=0 */): void;
2155
+ drawIndexed(
2156
+ indexCount: GPUSize32,
2157
+ instanceCount?: GPUSize32 /* default=1 */,
2158
+ firstIndex?: GPUSize32 /* default=0 */,
2159
+ baseVertex?: GPUSignedOffset32 /* default=0 */,
2160
+ firstInstance?: GPUSize32 /* default=0 */
2161
+ ): void;
2162
+
2163
+ drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void;
2164
+ drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): void;
2165
+ }
2166
+
2181
2167
  class GPURenderBundle implements GPUObjectBase {
2182
- private __brand: void;
2183
2168
  label: string | undefined;
2184
2169
  }
2185
2170
 
2186
2171
  interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {}
2187
2172
 
2188
- class GPURenderBundleEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin, GPUProgrammablePassEncoder, GPURenderEncoderBase {
2189
- private __brand: void;
2173
+ class GPURenderBundleEncoder implements GPUObjectBase, GPUCommandsMixin, GPUDebugCommandsMixin, GPUBindingCommandsMixin, GPURenderCommandsMixin {
2190
2174
  label: string | undefined;
2191
2175
 
2192
2176
  setBindGroup(index: GPUIndex32, bindGroup: GPUBindGroup, dynamicOffsets?: GPUBufferDynamicOffset[]): void;
@@ -2221,8 +2205,9 @@ interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout {
2221
2205
  stencilReadOnly?: boolean /* default=false */;
2222
2206
  }
2223
2207
 
2208
+ interface GPUQueueDescriptor extends GPUObjectDescriptorBase {}
2209
+
2224
2210
  class GPUQueue implements GPUObjectBase {
2225
- private __brand: void;
2226
2211
  label: string | undefined;
2227
2212
 
2228
2213
  submit(commandBuffers: GPUCommandBuffer[]): void;
@@ -2237,7 +2222,6 @@ class GPUQueue implements GPUObjectBase {
2237
2222
  }
2238
2223
 
2239
2224
  class GPUQuerySet implements GPUObjectBase {
2240
- private __brand: void;
2241
2225
  label: string | undefined;
2242
2226
 
2243
2227
  destroy(): void;
@@ -2251,14 +2235,11 @@ interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
2251
2235
  type GPUQueryType = "occlusion" | "timestamp";
2252
2236
 
2253
2237
  class GPUCanvasContext {
2254
- private __brand: void;
2255
-
2256
2238
  readonly canvas: HTMLCanvasElement | OffscreenCanvas;
2257
2239
 
2258
2240
  configure(configuration?: GPUCanvasConfiguration): void;
2259
2241
  unconfigure(): void;
2260
2242
 
2261
- getPreferredFormat(adapter: GPUAdapter): GPUTextureFormat;
2262
2243
  getCurrentTexture(): GPUTexture;
2263
2244
  }
2264
2245
 
@@ -2271,34 +2252,32 @@ interface GPUCanvasConfiguration extends GPUObjectDescriptorBase {
2271
2252
  viewFormats?: GPUTextureFormat[] /* default=[] */;
2272
2253
  colorSpace?: GPUPredefinedColorSpace /* default="srgb" */;
2273
2254
  compositingAlphaMode?: GPUCanvasCompositingAlphaMode /* default="opaque" */;
2274
- size: GPUExtent3D;
2275
2255
  }
2276
2256
 
2277
2257
  type GPUDeviceLostReason = "destroyed";
2278
2258
 
2279
2259
  class GPUDeviceLostInfo {
2280
- private __brand: void;
2281
2260
  readonly reason?: GPUDeviceLostReason;
2282
2261
  readonly message: string;
2283
2262
  }
2284
2263
 
2285
2264
  type GPUErrorFilter = "out-of-memory" | "validation";
2286
2265
 
2287
- class GPUOutOfMemoryError {
2288
- private __brand: void;
2266
+ class GPUError {
2267
+ readonly message: string;
2268
+ }
2269
+
2270
+ class GPUOutOfMemoryError extends GPUError {
2289
2271
  constructor();
2272
+ readonly message: string;
2290
2273
  }
2291
2274
 
2292
- class GPUValidationError {
2293
- private __brand: void;
2275
+ class GPUValidationError extends GPUError {
2294
2276
  constructor(message: string);
2295
2277
  readonly message: string;
2296
2278
  }
2297
2279
 
2298
- type GPUError = GPUOutOfMemoryError | GPUValidationError;
2299
-
2300
2280
  class GPUUncapturedErrorEvent extends Event {
2301
- private __brand: void;
2302
2281
  constructor(type: string, gpuUncapturedErrorEventInitDict: GPUUncapturedErrorEventInit);
2303
2282
  readonly error: GPUError;
2304
2283
  }
@@ -351,9 +351,9 @@ export declare class NativeEngine extends Engine {
351
351
  createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
352
352
  createVideoElement(constraints: MediaTrackConstraints): any;
353
353
  updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;
354
- createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number): InternalTexture;
354
+ createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number, creationFlags?: number, useSRGBBuffer?: boolean): InternalTexture;
355
355
  createRawTexture2DArray(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, textureType?: number): InternalTexture;
356
- updateRawTexture(texture: Nullable<InternalTexture>, bufferView: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number): void;
356
+ updateRawTexture(texture: Nullable<InternalTexture>, bufferView: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number, useSRGBBuffer?: boolean): void;
357
357
  /**
358
358
  * Usually called from Texture.ts.
359
359
  * Passed information to create a WebGLTexture
@@ -373,8 +373,8 @@ export declare class NativeEngine extends Engine {
373
373
  * @param forcedExtension defines the extension to use to pick the right loader
374
374
  * @param mimeType defines an optional mime type
375
375
  * @param loaderOptions options to be passed to the loader
376
- * @param creationFlags
377
- * @param useSRGBBuffer
376
+ * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
377
+ * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
378
378
  * @returns a InternalTexture for assignment back into BABYLON.Texture
379
379
  */
380
380
  createTexture(url: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<ISceneLike>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>, fallback?: Nullable<InternalTexture>, format?: Nullable<number>, forcedExtension?: Nullable<string>, mimeType?: string, loaderOptions?: any, creationFlags?: number, useSRGBBuffer?: boolean): InternalTexture;
@@ -1756,9 +1756,11 @@ var NativeEngine = /** @class */ (function (_super) {
1756
1756
  this._camera.updateVideoTexture(webGLTexture, video, invertY);
1757
1757
  }
1758
1758
  };
1759
- NativeEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {
1759
+ NativeEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type, creationFlags, useSRGBBuffer) {
1760
1760
  if (compression === void 0) { compression = null; }
1761
1761
  if (type === void 0) { type = 0; }
1762
+ if (creationFlags === void 0) { creationFlags = 0; }
1763
+ if (useSRGBBuffer === void 0) { useSRGBBuffer = false; }
1762
1764
  var texture = new InternalTexture(this, InternalTextureSource.Raw);
1763
1765
  texture.format = format;
1764
1766
  texture.generateMipMaps = generateMipMaps;
@@ -1770,7 +1772,8 @@ var NativeEngine = /** @class */ (function (_super) {
1770
1772
  texture.height = texture.baseHeight;
1771
1773
  texture._compression = compression;
1772
1774
  texture.type = type;
1773
- this.updateRawTexture(texture, data, format, invertY, compression, type);
1775
+ texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);
1776
+ this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);
1774
1777
  if (texture._hardwareTexture) {
1775
1778
  var webGLTexture = texture._hardwareTexture.underlyingResource;
1776
1779
  var filter = this._getNativeSamplingMode(samplingMode);
@@ -1804,9 +1807,10 @@ var NativeEngine = /** @class */ (function (_super) {
1804
1807
  this._internalTexturesCache.push(texture);
1805
1808
  return texture;
1806
1809
  };
1807
- NativeEngine.prototype.updateRawTexture = function (texture, bufferView, format, invertY, compression, type) {
1810
+ NativeEngine.prototype.updateRawTexture = function (texture, bufferView, format, invertY, compression, type, useSRGBBuffer) {
1808
1811
  if (compression === void 0) { compression = null; }
1809
1812
  if (type === void 0) { type = 0; }
1813
+ if (useSRGBBuffer === void 0) { useSRGBBuffer = false; }
1810
1814
  if (!texture) {
1811
1815
  return;
1812
1816
  }
@@ -1836,8 +1840,8 @@ var NativeEngine = /** @class */ (function (_super) {
1836
1840
  * @param forcedExtension defines the extension to use to pick the right loader
1837
1841
  * @param mimeType defines an optional mime type
1838
1842
  * @param loaderOptions options to be passed to the loader
1839
- * @param creationFlags
1840
- * @param useSRGBBuffer
1843
+ * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)
1844
+ * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
1841
1845
  * @returns a InternalTexture for assignment back into BABYLON.Texture
1842
1846
  */
1843
1847
  NativeEngine.prototype.createTexture = function (url, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension, mimeType, loaderOptions, creationFlags, useSRGBBuffer) {