@babylonjs/core 7.5.0 → 7.6.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 (230) hide show
  1. package/Audio/sound.js +3 -0
  2. package/Audio/sound.js.map +1 -1
  3. package/Bones/bone.js +1 -1
  4. package/Bones/bone.js.map +1 -1
  5. package/Buffers/storageBuffer.d.ts +2 -2
  6. package/Buffers/storageBuffer.js.map +1 -1
  7. package/Cameras/arcRotateCamera.js +3 -0
  8. package/Cameras/arcRotateCamera.js.map +1 -1
  9. package/Cameras/camera.js +1 -1
  10. package/Cameras/camera.js.map +1 -1
  11. package/Cameras/flyCamera.js +3 -0
  12. package/Cameras/flyCamera.js.map +1 -1
  13. package/Cameras/followCamera.js +4 -0
  14. package/Cameras/followCamera.js.map +1 -1
  15. package/Cameras/freeCamera.js +3 -0
  16. package/Cameras/freeCamera.js.map +1 -1
  17. package/Engines/Extensions/index.d.ts +0 -3
  18. package/Engines/Extensions/index.js +0 -3
  19. package/Engines/Extensions/index.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/index.d.ts +0 -3
  21. package/Engines/WebGPU/Extensions/index.js +0 -3
  22. package/Engines/WebGPU/Extensions/index.js.map +1 -1
  23. package/Engines/abstractEngine.d.ts +0 -51
  24. package/Engines/abstractEngine.js +7 -3
  25. package/Engines/abstractEngine.js.map +1 -1
  26. package/Engines/engine.js +5 -2
  27. package/Engines/engine.js.map +1 -1
  28. package/Engines/nativeEngine.js +2 -2
  29. package/Engines/nativeEngine.js.map +1 -1
  30. package/Engines/thinEngine.functions.d.ts +0 -10
  31. package/Engines/thinEngine.functions.js +0 -19
  32. package/Engines/thinEngine.functions.js.map +1 -1
  33. package/Engines/thinEngine.js +18 -1
  34. package/Engines/thinEngine.js.map +1 -1
  35. package/Engines/webgpuEngine.d.ts +54 -2
  36. package/Engines/webgpuEngine.js +147 -0
  37. package/Engines/webgpuEngine.js.map +1 -1
  38. package/Inputs/scene.inputManager.d.ts +1 -0
  39. package/Inputs/scene.inputManager.js +1 -0
  40. package/Inputs/scene.inputManager.js.map +1 -1
  41. package/Lights/directionalLight.js +3 -0
  42. package/Lights/directionalLight.js.map +1 -1
  43. package/Lights/hemisphericLight.js +3 -0
  44. package/Lights/hemisphericLight.js.map +1 -1
  45. package/Lights/light.js +1 -1
  46. package/Lights/light.js.map +1 -1
  47. package/Lights/pointLight.js +3 -0
  48. package/Lights/pointLight.js.map +1 -1
  49. package/Lights/spotLight.js +3 -0
  50. package/Lights/spotLight.js.map +1 -1
  51. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
  52. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  53. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +1 -1
  54. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
  56. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +1 -1
  58. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +9 -3
  59. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  60. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -1
  61. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  62. package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +1 -1
  63. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  64. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -2
  65. package/Materials/Node/Blocks/Dual/textureBlock.js +13 -3
  66. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  67. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -1
  68. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
  70. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  71. package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +1 -1
  72. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  73. package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +1 -1
  74. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  75. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.d.ts +2 -1
  76. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js +1 -0
  77. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js.map +1 -1
  78. package/Materials/Node/Blocks/Input/inputBlock.d.ts +1 -1
  79. package/Materials/Node/Blocks/Input/inputBlock.js +16 -0
  80. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -1
  82. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  83. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -1
  84. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  85. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
  86. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -1
  88. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -1
  90. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  91. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -1
  92. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  93. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.d.ts +1 -1
  94. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/baseMathBlock.js +2 -4
  96. package/Materials/Node/Blocks/baseMathBlock.js.map +1 -1
  97. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -1
  98. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  99. package/Materials/Node/Blocks/trigonometryBlock.d.ts +3 -1
  100. package/Materials/Node/Blocks/trigonometryBlock.js +6 -0
  101. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  102. package/Materials/Node/nodeMaterial.d.ts +6 -3
  103. package/Materials/Node/nodeMaterial.js +9 -6
  104. package/Materials/Node/nodeMaterial.js.map +1 -1
  105. package/Materials/Node/nodeMaterialBlock.d.ts +1 -1
  106. package/Materials/Node/nodeMaterialBlock.js +1 -1
  107. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  108. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +34 -14
  109. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +87 -9
  110. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  111. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  112. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  113. package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -1
  114. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  115. package/Materials/Textures/htmlElementTexture.d.ts +0 -1
  116. package/Materials/Textures/htmlElementTexture.js +7 -2
  117. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  118. package/Materials/Textures/videoTexture.js +4 -2
  119. package/Materials/Textures/videoTexture.js.map +1 -1
  120. package/Materials/effect.functions.d.ts +1 -1
  121. package/Materials/effect.functions.js +4 -4
  122. package/Materials/effect.functions.js.map +1 -1
  123. package/Materials/effect.js +1 -1
  124. package/Materials/effect.js.map +1 -1
  125. package/Materials/effect.webgl.functions.js +2 -2
  126. package/Materials/effect.webgl.functions.js.map +1 -1
  127. package/Materials/imageProcessingConfiguration.js +3 -0
  128. package/Materials/imageProcessingConfiguration.js.map +1 -1
  129. package/Materials/materialPluginBase.js +3 -0
  130. package/Materials/materialPluginBase.js.map +1 -1
  131. package/Materials/shaderMaterial.js +18 -8
  132. package/Materials/shaderMaterial.js.map +1 -1
  133. package/Maths/math.color.d.ts +85 -82
  134. package/Maths/math.color.js +34 -27
  135. package/Maths/math.color.js.map +1 -1
  136. package/Maths/math.vector.d.ts +202 -202
  137. package/Maths/math.vector.js +133 -130
  138. package/Maths/math.vector.js.map +1 -1
  139. package/Maths/tensor.d.ts +44 -42
  140. package/Maths/tensor.js.map +1 -1
  141. package/Meshes/Compression/dracoCompression.d.ts +7 -0
  142. package/Meshes/Compression/dracoCompression.js +14 -0
  143. package/Meshes/Compression/dracoCompression.js.map +1 -1
  144. package/Meshes/instancedMesh.js +3 -0
  145. package/Meshes/instancedMesh.js.map +1 -1
  146. package/Meshes/transformNode.js +1 -1
  147. package/Meshes/transformNode.js.map +1 -1
  148. package/Misc/dumpTools.js +11 -0
  149. package/Misc/dumpTools.js.map +1 -1
  150. package/Misc/fileTools.d.ts +9 -9
  151. package/Misc/fileTools.js +17 -15
  152. package/Misc/fileTools.js.map +1 -1
  153. package/Misc/tools.d.ts +5 -0
  154. package/Misc/tools.js +9 -0
  155. package/Misc/tools.js.map +1 -1
  156. package/Misc/typeStore.d.ts +4 -0
  157. package/Misc/typeStore.js +11 -0
  158. package/Misc/typeStore.js.map +1 -1
  159. package/NOTICE.md +8 -0
  160. package/Particles/baseParticleSystem.js +3 -0
  161. package/Particles/baseParticleSystem.js.map +1 -1
  162. package/Particles/computeShaderParticleSystem.d.ts +2 -2
  163. package/Particles/computeShaderParticleSystem.js.map +1 -1
  164. package/Physics/v1/Plugins/ammoJSPlugin.js +39 -10
  165. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  166. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +3 -0
  167. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  168. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +4 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  170. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +7 -0
  171. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +40 -20
  172. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  173. package/Rendering/prePassRenderer.js +3 -0
  174. package/Rendering/prePassRenderer.js.map +1 -1
  175. package/Shaders/ShadersInclude/screenSpaceRayTrace.js +8 -0
  176. package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
  177. package/Shaders/fluidRenderingRender.fragment.js +11 -2
  178. package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
  179. package/Shaders/screenSpaceReflection2.fragment.js +7 -1
  180. package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
  181. package/Shaders/sprites.fragment.d.ts +2 -0
  182. package/Shaders/sprites.fragment.js +8 -1
  183. package/Shaders/sprites.fragment.js.map +1 -1
  184. package/Shaders/sprites.vertex.d.ts +2 -0
  185. package/Shaders/sprites.vertex.js +4 -0
  186. package/Shaders/sprites.vertex.js.map +1 -1
  187. package/Shaders/ssao2.fragment.js +1 -1
  188. package/Shaders/ssao2.fragment.js.map +1 -1
  189. package/Sprites/spriteManager.d.ts +3 -0
  190. package/Sprites/spriteManager.js +11 -0
  191. package/Sprites/spriteManager.js.map +1 -1
  192. package/Sprites/spriteRenderer.d.ts +11 -3
  193. package/Sprites/spriteRenderer.js +49 -32
  194. package/Sprites/spriteRenderer.js.map +1 -1
  195. package/XR/features/WebXRNearInteraction.d.ts +6 -0
  196. package/XR/features/WebXRNearInteraction.js +14 -2
  197. package/XR/features/WebXRNearInteraction.js.map +1 -1
  198. package/XR/webXRManagedOutputCanvas.d.ts +2 -0
  199. package/XR/webXRManagedOutputCanvas.js +14 -6
  200. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  201. package/abstractScene.js +3 -0
  202. package/abstractScene.js.map +1 -1
  203. package/assets/glslang/glslang.js +113 -0
  204. package/assets/glslang/glslang.wasm +0 -0
  205. package/assets/twgsl/twgsl.js +53 -0
  206. package/assets/twgsl/twgsl.wasm +0 -0
  207. package/node.d.ts +2 -1
  208. package/node.js +5 -1
  209. package/node.js.map +1 -1
  210. package/package.json +1 -1
  211. package/scene.js +3 -0
  212. package/scene.js.map +1 -1
  213. package/Engines/Extensions/engine.externalTexture.d.ts +0 -18
  214. package/Engines/Extensions/engine.externalTexture.js +0 -10
  215. package/Engines/Extensions/engine.externalTexture.js.map +0 -1
  216. package/Engines/Extensions/engine.storageBuffer.d.ts +0 -39
  217. package/Engines/Extensions/engine.storageBuffer.js +0 -16
  218. package/Engines/Extensions/engine.storageBuffer.js.map +0 -1
  219. package/Engines/Extensions/engine.textureSampler.d.ts +0 -12
  220. package/Engines/Extensions/engine.textureSampler.js +0 -6
  221. package/Engines/Extensions/engine.textureSampler.js.map +0 -1
  222. package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +0 -28
  223. package/Engines/WebGPU/Extensions/engine.externalTexture.js +0 -18
  224. package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +0 -1
  225. package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +0 -50
  226. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +0 -88
  227. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +0 -1
  228. package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +0 -22
  229. package/Engines/WebGPU/Extensions/engine.textureSampler.js +0 -9
  230. package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +0 -1
@@ -1,18 +0,0 @@
1
- import type { ExternalTexture } from "../../Materials/Textures/externalTexture";
2
- import type { Nullable } from "../../types";
3
- declare module "../../Engines/thinEngine" {
4
- interface ThinEngine {
5
- /**
6
- * Creates an external texture
7
- * @param video video element
8
- * @returns the external texture, or null if external textures are not supported by the engine
9
- */
10
- createExternalTexture(video: HTMLVideoElement): Nullable<ExternalTexture>;
11
- /**
12
- * Sets an internal texture to the according uniform.
13
- * @param name The name of the uniform in the effect
14
- * @param texture The texture to apply
15
- */
16
- setExternalTexture(name: string, texture: Nullable<ExternalTexture>): void;
17
- }
18
- }
@@ -1,10 +0,0 @@
1
- import { ThinEngine } from "../../Engines/thinEngine.js";
2
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
- ThinEngine.prototype.createExternalTexture = function (video) {
4
- return null;
5
- };
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- ThinEngine.prototype.setExternalTexture = function (name, texture) {
8
- throw new Error("setExternalTexture: This engine does not support external textures!");
9
- };
10
- //# sourceMappingURL=engine.externalTexture.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.externalTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.externalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAsBtD,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,KAAuB;IAC1E,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,IAAY,EAAE,OAAkC;IAChG,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;AAC3F,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport type { ExternalTexture } from \"../../Materials/Textures/externalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates an external texture\r\n * @param video video element\r\n * @returns the external texture, or null if external textures are not supported by the engine\r\n */\r\n createExternalTexture(video: HTMLVideoElement): Nullable<ExternalTexture>;\r\n\r\n /**\r\n * Sets an internal texture to the according uniform.\r\n * @param name The name of the uniform in the effect\r\n * @param texture The texture to apply\r\n */\r\n setExternalTexture(name: string, texture: Nullable<ExternalTexture>): void;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.createExternalTexture = function (video: HTMLVideoElement): Nullable<ExternalTexture> {\r\n return null;\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.setExternalTexture = function (name: string, texture: Nullable<ExternalTexture>): void {\r\n throw new Error(\"setExternalTexture: This engine does not support external textures!\");\r\n};\r\n"]}
@@ -1,39 +0,0 @@
1
- import type { DataBuffer } from "../../Buffers/dataBuffer";
2
- import type { DataArray, Nullable } from "../../types";
3
- import type { StorageBuffer } from "../../Buffers/storageBuffer";
4
- declare module "../../Engines/thinEngine" {
5
- interface ThinEngine {
6
- /**
7
- * Creates a storage buffer
8
- * @param data the data for the storage buffer or the size of the buffer
9
- * @param creationFlags flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added
10
- * @param label defines the label of the buffer (for debug purpose)
11
- * @returns the new buffer
12
- */
13
- createStorageBuffer(data: DataArray | number, creationFlags: number, label?: string): DataBuffer;
14
- /**
15
- * Updates a storage buffer
16
- * @param buffer the storage buffer to update
17
- * @param data the data used to update the storage buffer
18
- * @param byteOffset the byte offset of the data
19
- * @param byteLength the byte length of the data
20
- */
21
- updateStorageBuffer(buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
22
- /**
23
- * Read data from a storage buffer
24
- * @param storageBuffer The storage buffer to read from
25
- * @param offset The offset in the storage buffer to start reading from (default: 0)
26
- * @param size The number of bytes to read from the storage buffer (default: capacity of the buffer)
27
- * @param buffer The buffer to write the data we have read from the storage buffer to (optional)
28
- * @param noDelay If true, a call to flushFramebuffer will be issued so that the data can be read back immediately and not in engine.onEndFrameObservable. This can speed up data retrieval, at the cost of a small perf penalty (default: false).
29
- * @returns If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer
30
- */
31
- readFromStorageBuffer(storageBuffer: DataBuffer, offset?: number, size?: number, buffer?: ArrayBufferView, noDelay?: boolean): Promise<ArrayBufferView>;
32
- /**
33
- * Sets a storage buffer in the shader
34
- * @param name Defines the name of the storage buffer as defined in the shader
35
- * @param buffer Defines the value to give to the uniform
36
- */
37
- setStorageBuffer(name: string, buffer: Nullable<StorageBuffer>): void;
38
- }
39
- }
@@ -1,16 +0,0 @@
1
- import { ThinEngine } from "../../Engines/thinEngine.js";
2
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
- ThinEngine.prototype.createStorageBuffer = function (data, creationFlags) {
4
- throw new Error("createStorageBuffer: Unsupported method in this engine!");
5
- };
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- ThinEngine.prototype.updateStorageBuffer = function (buffer, data, byteOffset, byteLength) { };
8
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
- ThinEngine.prototype.readFromStorageBuffer = function (storageBuffer, offset, size, buffer) {
10
- throw new Error("readFromStorageBuffer: Unsupported method in this engine!");
11
- };
12
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
- ThinEngine.prototype.setStorageBuffer = function (name, buffer) {
14
- throw new Error("setStorageBuffer: Unsupported method in this engine!");
15
- };
16
- //# sourceMappingURL=engine.storageBuffer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.storageBuffer.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.storageBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AA8CtD,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,mBAAmB,GAAG,UAAU,IAAwB,EAAE,aAAqB;IAChG,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,mBAAmB,GAAG,UAAU,MAAkB,EAAE,IAAe,EAAE,UAAmB,EAAE,UAAmB,IAAS,CAAC,CAAC;AAE7I,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,aAAyB,EAAE,MAAe,EAAE,IAAa,EAAE,MAAwB;IACtI,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;AACjF,CAAC,CAAC;AAEF,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG,UAAU,IAAY,EAAE,MAA+B;IAC3F,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC5E,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport type { DataBuffer } from \"../../Buffers/dataBuffer\";\r\nimport type { DataArray, Nullable } from \"../../types\";\r\n\r\nimport type { StorageBuffer } from \"../../Buffers/storageBuffer\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a storage buffer\r\n * @param data the data for the storage buffer or the size of the buffer\r\n * @param creationFlags flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added\r\n * @param label defines the label of the buffer (for debug purpose)\r\n * @returns the new buffer\r\n */\r\n createStorageBuffer(data: DataArray | number, creationFlags: number, label?: string): DataBuffer;\r\n\r\n /**\r\n * Updates a storage buffer\r\n * @param buffer the storage buffer to update\r\n * @param data the data used to update the storage buffer\r\n * @param byteOffset the byte offset of the data\r\n * @param byteLength the byte length of the data\r\n */\r\n updateStorageBuffer(buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;\r\n\r\n /**\r\n * Read data from a storage buffer\r\n * @param storageBuffer The storage buffer to read from\r\n * @param offset The offset in the storage buffer to start reading from (default: 0)\r\n * @param size The number of bytes to read from the storage buffer (default: capacity of the buffer)\r\n * @param buffer The buffer to write the data we have read from the storage buffer to (optional)\r\n * @param noDelay If true, a call to flushFramebuffer will be issued so that the data can be read back immediately and not in engine.onEndFrameObservable. This can speed up data retrieval, at the cost of a small perf penalty (default: false).\r\n * @returns If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer\r\n */\r\n readFromStorageBuffer(storageBuffer: DataBuffer, offset?: number, size?: number, buffer?: ArrayBufferView, noDelay?: boolean): Promise<ArrayBufferView>;\r\n\r\n /**\r\n * Sets a storage buffer in the shader\r\n * @param name Defines the name of the storage buffer as defined in the shader\r\n * @param buffer Defines the value to give to the uniform\r\n */\r\n setStorageBuffer(name: string, buffer: Nullable<StorageBuffer>): void;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.createStorageBuffer = function (data: DataArray | number, creationFlags: number): DataBuffer {\r\n throw new Error(\"createStorageBuffer: Unsupported method in this engine!\");\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.updateStorageBuffer = function (buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void {};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.readFromStorageBuffer = function (storageBuffer: DataBuffer, offset?: number, size?: number, buffer?: ArrayBufferView): Promise<ArrayBufferView> {\r\n throw new Error(\"readFromStorageBuffer: Unsupported method in this engine!\");\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.setStorageBuffer = function (name: string, buffer: Nullable<StorageBuffer>): void {\r\n throw new Error(\"setStorageBuffer: Unsupported method in this engine!\");\r\n};\r\n"]}
@@ -1,12 +0,0 @@
1
- import type { Nullable } from "../../types";
2
- import type { TextureSampler } from "../../Materials/Textures/textureSampler";
3
- declare module "../../Engines/thinEngine" {
4
- interface ThinEngine {
5
- /**
6
- * Sets a texture sampler to the according uniform.
7
- * @param name The name of the uniform in the effect
8
- * @param sampler The sampler to apply
9
- */
10
- setTextureSampler(name: string, sampler: Nullable<TextureSampler>): void;
11
- }
12
- }
@@ -1,6 +0,0 @@
1
- import { ThinEngine } from "../../Engines/thinEngine.js";
2
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
- ThinEngine.prototype.setTextureSampler = function (name, sampler) {
4
- throw new Error("setTextureSampler: This engine does not support separate texture sampler objects!");
5
- };
6
- //# sourceMappingURL=engine.textureSampler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.textureSampler.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.textureSampler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAgBtD,6DAA6D;AAC7D,UAAU,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,IAAY,EAAE,OAAiC;IAC9F,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;AACzG,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\nimport type { TextureSampler } from \"../../Materials/Textures/textureSampler\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Sets a texture sampler to the according uniform.\r\n * @param name The name of the uniform in the effect\r\n * @param sampler The sampler to apply\r\n */\r\n setTextureSampler(name: string, sampler: Nullable<TextureSampler>): void;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nThinEngine.prototype.setTextureSampler = function (name: string, sampler: Nullable<TextureSampler>): void {\r\n throw new Error(\"setTextureSampler: This engine does not support separate texture sampler objects!\");\r\n};\r\n"]}
@@ -1,28 +0,0 @@
1
- import type { ExternalTexture } from "../../../Materials/Textures/externalTexture";
2
- import type { Nullable } from "../../../types";
3
- declare module "../../../Materials/effect" {
4
- interface Effect {
5
- /**
6
- * Sets an external texture on the engine to be used in the shader.
7
- * @param name Name of the external texture variable.
8
- * @param texture Texture to set.
9
- */
10
- setExternalTexture(name: string, texture: Nullable<ExternalTexture>): void;
11
- }
12
- }
13
- declare module "../../webgpuEngine" {
14
- interface WebGPUEngine {
15
- /**
16
- * Creates an external texture
17
- * @param video video element
18
- * @returns the external texture, or null if external textures are not supported by the engine
19
- */
20
- createExternalTexture(video: HTMLVideoElement): Nullable<ExternalTexture>;
21
- /**
22
- * Sets an internal texture to the according uniform.
23
- * @param name The name of the uniform in the effect
24
- * @param texture The texture to apply
25
- */
26
- setExternalTexture(name: string, texture: Nullable<ExternalTexture>): void;
27
- }
28
- }
@@ -1,18 +0,0 @@
1
- import { WebGPUEngine } from "../../webgpuEngine.js";
2
- import { WebGPUExternalTexture } from "../webgpuExternalTexture.js";
3
- import { Effect } from "../../../Materials/effect.js";
4
- Effect.prototype.setExternalTexture = function (name, texture) {
5
- this._engine.setExternalTexture(name, texture);
6
- };
7
- WebGPUEngine.prototype.createExternalTexture = function (video) {
8
- const texture = new WebGPUExternalTexture(video);
9
- return texture;
10
- };
11
- WebGPUEngine.prototype.setExternalTexture = function (name, texture) {
12
- if (!texture) {
13
- this._currentMaterialContext.setTexture(name, null);
14
- return;
15
- }
16
- this._setInternalTexture(name, texture);
17
- };
18
- //# sourceMappingURL=engine.externalTexture.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.externalTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.externalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAanD,MAAM,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,IAAY,EAAE,OAAkC;IAC5F,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC;AAoBF,YAAY,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,KAAuB;IAC5E,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,IAAY,EAAE,OAAkC;IAClG,IAAI,CAAC,OAAO,EAAE;QACV,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpD,OAAO;KACV;IACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { ExternalTexture } from \"../../../Materials/Textures/externalTexture\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { WebGPUExternalTexture } from \"../webgpuExternalTexture\";\r\nimport { Effect } from \"../../../Materials/effect\";\r\n\r\ndeclare module \"../../../Materials/effect\" {\r\n export interface Effect {\r\n /**\r\n * Sets an external texture on the engine to be used in the shader.\r\n * @param name Name of the external texture variable.\r\n * @param texture Texture to set.\r\n */\r\n setExternalTexture(name: string, texture: Nullable<ExternalTexture>): void;\r\n }\r\n}\r\n\r\nEffect.prototype.setExternalTexture = function (name: string, texture: Nullable<ExternalTexture>): void {\r\n this._engine.setExternalTexture(name, texture);\r\n};\r\n\r\ndeclare module \"../../webgpuEngine\" {\r\n export interface WebGPUEngine {\r\n /**\r\n * Creates an external texture\r\n * @param video video element\r\n * @returns the external texture, or null if external textures are not supported by the engine\r\n */\r\n createExternalTexture(video: HTMLVideoElement): Nullable<ExternalTexture>;\r\n\r\n /**\r\n * Sets an internal texture to the according uniform.\r\n * @param name The name of the uniform in the effect\r\n * @param texture The texture to apply\r\n */\r\n setExternalTexture(name: string, texture: Nullable<ExternalTexture>): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.createExternalTexture = function (video: HTMLVideoElement): Nullable<ExternalTexture> {\r\n const texture = new WebGPUExternalTexture(video);\r\n return texture;\r\n};\r\n\r\nWebGPUEngine.prototype.setExternalTexture = function (name: string, texture: Nullable<ExternalTexture>): void {\r\n if (!texture) {\r\n this._currentMaterialContext.setTexture(name, null);\r\n return;\r\n }\r\n this._setInternalTexture(name, texture);\r\n};\r\n"]}
@@ -1,50 +0,0 @@
1
- import type { DataBuffer } from "../../../Buffers/dataBuffer";
2
- import type { DataArray, Nullable } from "../../../types";
3
- import type { StorageBuffer } from "../../../Buffers/storageBuffer";
4
- declare module "../../../Materials/effect" {
5
- interface Effect {
6
- /**
7
- * Sets a storage buffer on the engine to be used in the shader.
8
- * @param name Name of the storage buffer variable.
9
- * @param buffer Storage buffer to set.
10
- * @param label defines the label of the buffer (for debug purpose)
11
- */
12
- setStorageBuffer(name: string, buffer: Nullable<StorageBuffer>, label?: string): void;
13
- }
14
- }
15
- declare module "../../webgpuEngine" {
16
- interface WebGPUEngine {
17
- /**
18
- * Creates a storage buffer
19
- * @param data the data for the storage buffer or the size of the buffer
20
- * @param creationFlags flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added
21
- * @param label defines the label of the buffer (for debug purpose)
22
- * @returns the new buffer
23
- */
24
- createStorageBuffer(data: DataArray | number, creationFlags: number, label?: string): DataBuffer;
25
- /**
26
- * Updates a storage buffer
27
- * @param buffer the storage buffer to update
28
- * @param data the data used to update the storage buffer
29
- * @param byteOffset the byte offset of the data
30
- * @param byteLength the byte length of the data
31
- */
32
- updateStorageBuffer(buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
33
- /**
34
- * Read data from a storage buffer
35
- * @param storageBuffer The storage buffer to read from
36
- * @param offset The offset in the storage buffer to start reading from (default: 0)
37
- * @param size The number of bytes to read from the storage buffer (default: capacity of the buffer)
38
- * @param buffer The buffer to write the data we have read from the storage buffer to (optional)
39
- * @param noDelay If true, a call to flushFramebuffer will be issued so that the data can be read back immediately and not in engine.onEndFrameObservable. This can speed up data retrieval, at the cost of a small perf penalty (default: false).
40
- * @returns If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer
41
- */
42
- readFromStorageBuffer(storageBuffer: DataBuffer, offset?: number, size?: number, buffer?: ArrayBufferView, noDelay?: boolean): Promise<ArrayBufferView>;
43
- /**
44
- * Sets a storage buffer in the shader
45
- * @param name Defines the name of the storage buffer as defined in the shader
46
- * @param buffer Defines the value to give to the uniform
47
- */
48
- setStorageBuffer(name: string, buffer: Nullable<StorageBuffer>): void;
49
- }
50
- }
@@ -1,88 +0,0 @@
1
-
2
- import { WebGPUEngine } from "../../webgpuEngine.js";
3
- import * as WebGPUConstants from "../webgpuConstants.js";
4
- import { Effect } from "../../../Materials/effect.js";
5
- Effect.prototype.setStorageBuffer = function (name, buffer) {
6
- this._engine.setStorageBuffer(name, buffer);
7
- };
8
- WebGPUEngine.prototype.createStorageBuffer = function (data, creationFlags, label) {
9
- return this._createBuffer(data, creationFlags | 32, label);
10
- };
11
- WebGPUEngine.prototype.updateStorageBuffer = function (buffer, data, byteOffset, byteLength) {
12
- const dataBuffer = buffer;
13
- if (byteOffset === undefined) {
14
- byteOffset = 0;
15
- }
16
- let view;
17
- if (byteLength === undefined) {
18
- if (data instanceof Array) {
19
- view = new Float32Array(data);
20
- }
21
- else if (data instanceof ArrayBuffer) {
22
- view = new Uint8Array(data);
23
- }
24
- else {
25
- view = data;
26
- }
27
- byteLength = view.byteLength;
28
- }
29
- else {
30
- if (data instanceof Array) {
31
- view = new Float32Array(data);
32
- }
33
- else if (data instanceof ArrayBuffer) {
34
- view = new Uint8Array(data);
35
- }
36
- else {
37
- view = data;
38
- }
39
- }
40
- this._bufferManager.setSubData(dataBuffer, byteOffset, view, 0, byteLength);
41
- };
42
- WebGPUEngine.prototype.readFromStorageBuffer = function (storageBuffer, offset, size, buffer, noDelay) {
43
- size = size || storageBuffer.capacity;
44
- const gpuBuffer = this._bufferManager.createRawBuffer(size, WebGPUConstants.BufferUsage.MapRead | WebGPUConstants.BufferUsage.CopyDst, undefined, "TempReadFromStorageBuffer");
45
- this._renderEncoder.copyBufferToBuffer(storageBuffer.underlyingResource, offset ?? 0, gpuBuffer, 0, size);
46
- return new Promise((resolve, reject) => {
47
- const readFromBuffer = () => {
48
- gpuBuffer.mapAsync(WebGPUConstants.MapMode.Read, 0, size).then(() => {
49
- const copyArrayBuffer = gpuBuffer.getMappedRange(0, size);
50
- let data = buffer;
51
- if (data === undefined) {
52
- data = new Uint8Array(size);
53
- data.set(new Uint8Array(copyArrayBuffer));
54
- }
55
- else {
56
- const ctor = data.constructor; // we want to create result data with the same type as buffer (Uint8Array, Float32Array, ...)
57
- data = new ctor(data.buffer);
58
- data.set(new ctor(copyArrayBuffer));
59
- }
60
- gpuBuffer.unmap();
61
- this._bufferManager.releaseBuffer(gpuBuffer);
62
- resolve(data);
63
- }, (reason) => {
64
- if (this.isDisposed) {
65
- resolve(new Uint8Array());
66
- }
67
- else {
68
- reject(reason);
69
- }
70
- });
71
- };
72
- if (noDelay) {
73
- this.flushFramebuffer();
74
- readFromBuffer();
75
- }
76
- else {
77
- // we are using onEndFrameObservable because we need to map the gpuBuffer AFTER the command buffers
78
- // have been submitted, else we get the error: "Buffer used in a submit while mapped"
79
- this.onEndFrameObservable.addOnce(() => {
80
- readFromBuffer();
81
- });
82
- }
83
- });
84
- };
85
- WebGPUEngine.prototype.setStorageBuffer = function (name, buffer) {
86
- this._currentDrawContext?.setBuffer(name, buffer?.getBuffer() ?? null);
87
- };
88
- //# sourceMappingURL=engine.storageBuffer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.storageBuffer.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.storageBuffer.ts"],"names":[],"mappings":"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","sourcesContent":["import type { DataBuffer } from \"../../../Buffers/dataBuffer\";\r\nimport type { WebGPUDataBuffer } from \"../../../Meshes/WebGPU/webgpuDataBuffer\";\r\nimport type { DataArray, Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport * as WebGPUConstants from \"../webgpuConstants\";\r\nimport { Effect } from \"../../../Materials/effect\";\r\n\r\nimport type { StorageBuffer } from \"../../../Buffers/storageBuffer\";\r\n\r\ndeclare module \"../../../Materials/effect\" {\r\n export interface Effect {\r\n /**\r\n * Sets a storage buffer on the engine to be used in the shader.\r\n * @param name Name of the storage buffer variable.\r\n * @param buffer Storage buffer to set.\r\n * @param label defines the label of the buffer (for debug purpose)\r\n */\r\n setStorageBuffer(name: string, buffer: Nullable<StorageBuffer>, label?: string): void;\r\n }\r\n}\r\n\r\ndeclare module \"../../webgpuEngine\" {\r\n export interface WebGPUEngine {\r\n /**\r\n * Creates a storage buffer\r\n * @param data the data for the storage buffer or the size of the buffer\r\n * @param creationFlags flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added\r\n * @param label defines the label of the buffer (for debug purpose)\r\n * @returns the new buffer\r\n */\r\n createStorageBuffer(data: DataArray | number, creationFlags: number, label?: string): DataBuffer;\r\n\r\n /**\r\n * Updates a storage buffer\r\n * @param buffer the storage buffer to update\r\n * @param data the data used to update the storage buffer\r\n * @param byteOffset the byte offset of the data\r\n * @param byteLength the byte length of the data\r\n */\r\n updateStorageBuffer(buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;\r\n\r\n /**\r\n * Read data from a storage buffer\r\n * @param storageBuffer The storage buffer to read from\r\n * @param offset The offset in the storage buffer to start reading from (default: 0)\r\n * @param size The number of bytes to read from the storage buffer (default: capacity of the buffer)\r\n * @param buffer The buffer to write the data we have read from the storage buffer to (optional)\r\n * @param noDelay If true, a call to flushFramebuffer will be issued so that the data can be read back immediately and not in engine.onEndFrameObservable. This can speed up data retrieval, at the cost of a small perf penalty (default: false).\r\n * @returns If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer\r\n */\r\n readFromStorageBuffer(storageBuffer: DataBuffer, offset?: number, size?: number, buffer?: ArrayBufferView, noDelay?: boolean): Promise<ArrayBufferView>;\r\n\r\n /**\r\n * Sets a storage buffer in the shader\r\n * @param name Defines the name of the storage buffer as defined in the shader\r\n * @param buffer Defines the value to give to the uniform\r\n */\r\n setStorageBuffer(name: string, buffer: Nullable<StorageBuffer>): void;\r\n }\r\n}\r\n\r\nEffect.prototype.setStorageBuffer = function (name: string, buffer: Nullable<StorageBuffer>): void {\r\n this._engine.setStorageBuffer(name, buffer);\r\n};\r\n\r\nWebGPUEngine.prototype.createStorageBuffer = function (data: DataArray | number, creationFlags: number, label?: string): DataBuffer {\r\n return this._createBuffer(data, creationFlags | Constants.BUFFER_CREATIONFLAG_STORAGE, label);\r\n};\r\n\r\nWebGPUEngine.prototype.updateStorageBuffer = function (buffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void {\r\n const dataBuffer = buffer as WebGPUDataBuffer;\r\n if (byteOffset === undefined) {\r\n byteOffset = 0;\r\n }\r\n\r\n let view: ArrayBufferView;\r\n if (byteLength === undefined) {\r\n if (data instanceof Array) {\r\n view = new Float32Array(data);\r\n } else if (data instanceof ArrayBuffer) {\r\n view = new Uint8Array(data);\r\n } else {\r\n view = data;\r\n }\r\n byteLength = view.byteLength;\r\n } else {\r\n if (data instanceof Array) {\r\n view = new Float32Array(data);\r\n } else if (data instanceof ArrayBuffer) {\r\n view = new Uint8Array(data);\r\n } else {\r\n view = data;\r\n }\r\n }\r\n\r\n this._bufferManager.setSubData(dataBuffer, byteOffset, view, 0, byteLength);\r\n};\r\n\r\nWebGPUEngine.prototype.readFromStorageBuffer = function (\r\n storageBuffer: DataBuffer,\r\n offset?: number,\r\n size?: number,\r\n buffer?: ArrayBufferView,\r\n noDelay?: boolean\r\n): Promise<ArrayBufferView> {\r\n size = size || storageBuffer.capacity;\r\n\r\n const gpuBuffer = this._bufferManager.createRawBuffer(size, WebGPUConstants.BufferUsage.MapRead | WebGPUConstants.BufferUsage.CopyDst, undefined, \"TempReadFromStorageBuffer\");\r\n\r\n this._renderEncoder.copyBufferToBuffer(storageBuffer.underlyingResource, offset ?? 0, gpuBuffer, 0, size);\r\n\r\n return new Promise((resolve, reject) => {\r\n const readFromBuffer = () => {\r\n gpuBuffer.mapAsync(WebGPUConstants.MapMode.Read, 0, size).then(\r\n () => {\r\n const copyArrayBuffer = gpuBuffer.getMappedRange(0, size);\r\n let data: ArrayBufferView | undefined = buffer;\r\n if (data === undefined) {\r\n data = new Uint8Array(size!);\r\n (data as Uint8Array).set(new Uint8Array(copyArrayBuffer));\r\n } else {\r\n const ctor = data.constructor as any; // we want to create result data with the same type as buffer (Uint8Array, Float32Array, ...)\r\n data = new ctor(data.buffer);\r\n (data as any).set(new ctor(copyArrayBuffer));\r\n }\r\n gpuBuffer.unmap();\r\n this._bufferManager.releaseBuffer(gpuBuffer);\r\n resolve(data!);\r\n },\r\n (reason) => {\r\n if (this.isDisposed) {\r\n resolve(new Uint8Array());\r\n } else {\r\n reject(reason);\r\n }\r\n }\r\n );\r\n };\r\n\r\n if (noDelay) {\r\n this.flushFramebuffer();\r\n readFromBuffer();\r\n } else {\r\n // we are using onEndFrameObservable because we need to map the gpuBuffer AFTER the command buffers\r\n // have been submitted, else we get the error: \"Buffer used in a submit while mapped\"\r\n this.onEndFrameObservable.addOnce(() => {\r\n readFromBuffer();\r\n });\r\n }\r\n });\r\n};\r\n\r\nWebGPUEngine.prototype.setStorageBuffer = function (name: string, buffer: Nullable<StorageBuffer>): void {\r\n this._currentDrawContext?.setBuffer(name, (buffer?.getBuffer() as WebGPUDataBuffer) ?? null);\r\n};\r\n"]}
@@ -1,22 +0,0 @@
1
- import type { Nullable } from "../../../types";
2
- import type { TextureSampler } from "../../../Materials/Textures/textureSampler";
3
- declare module "../../../Materials/effect" {
4
- interface Effect {
5
- /**
6
- * Sets a sampler on the engine to be used in the shader.
7
- * @param name Name of the sampler variable.
8
- * @param sampler Sampler to set.
9
- */
10
- setTextureSampler(name: string, sampler: Nullable<TextureSampler>): void;
11
- }
12
- }
13
- declare module "../../webgpuEngine" {
14
- interface WebGPUEngine {
15
- /**
16
- * Sets a texture sampler to the according uniform.
17
- * @param name The name of the uniform in the effect
18
- * @param sampler The sampler to apply
19
- */
20
- setTextureSampler(name: string, sampler: Nullable<TextureSampler>): void;
21
- }
22
- }
@@ -1,9 +0,0 @@
1
- import { WebGPUEngine } from "../../webgpuEngine.js";
2
- import { Effect } from "../../../Materials/effect.js";
3
- Effect.prototype.setTextureSampler = function (name, sampler) {
4
- this._engine.setTextureSampler(name, sampler);
5
- };
6
- WebGPUEngine.prototype.setTextureSampler = function (name, sampler) {
7
- this._currentMaterialContext?.setSampler(name, sampler);
8
- };
9
- //# sourceMappingURL=engine.textureSampler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.textureSampler.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.textureSampler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AA0BnD,MAAM,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,IAAY,EAAE,OAAiC;IAC1F,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,IAAY,EAAE,OAAiC;IAChG,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC,CAAC","sourcesContent":["import { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Effect } from \"../../../Materials/effect\";\r\n\r\nimport type { TextureSampler } from \"../../../Materials/Textures/textureSampler\";\r\n\r\ndeclare module \"../../../Materials/effect\" {\r\n export interface Effect {\r\n /**\r\n * Sets a sampler on the engine to be used in the shader.\r\n * @param name Name of the sampler variable.\r\n * @param sampler Sampler to set.\r\n */\r\n setTextureSampler(name: string, sampler: Nullable<TextureSampler>): void;\r\n }\r\n}\r\n\r\ndeclare module \"../../webgpuEngine\" {\r\n export interface WebGPUEngine {\r\n /**\r\n * Sets a texture sampler to the according uniform.\r\n * @param name The name of the uniform in the effect\r\n * @param sampler The sampler to apply\r\n */\r\n setTextureSampler(name: string, sampler: Nullable<TextureSampler>): void;\r\n }\r\n}\r\n\r\nEffect.prototype.setTextureSampler = function (name: string, sampler: Nullable<TextureSampler>): void {\r\n this._engine.setTextureSampler(name, sampler);\r\n};\r\n\r\nWebGPUEngine.prototype.setTextureSampler = function (name: string, sampler: Nullable<TextureSampler>): void {\r\n this._currentMaterialContext?.setSampler(name, sampler);\r\n};\r\n"]}