@babylonjs/core 7.35.2 → 7.37.0

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 (272) hide show
  1. package/Collisions/gpuPicker.js.map +1 -1
  2. package/Engines/Extensions/engine.multiRender.d.ts +11 -0
  3. package/Engines/Extensions/engine.multiRender.js +71 -32
  4. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  5. package/Engines/Extensions/engine.rawTexture.d.ts +8 -8
  6. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  7. package/Engines/Extensions/engine.renderTarget.js +1 -13
  8. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  9. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  10. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +2 -0
  11. package/Engines/WebGL/webGLRenderTargetWrapper.js +37 -7
  12. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  13. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +11 -0
  14. package/Engines/WebGPU/Extensions/engine.multiRender.js +30 -11
  15. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  16. package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +9 -9
  17. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  18. package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -5
  19. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  21. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
  22. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  23. package/Engines/WebGPU/webgpuConstants.d.ts +6 -0
  24. package/Engines/WebGPU/webgpuConstants.js +6 -0
  25. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  26. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
  27. package/Engines/WebGPU/webgpuHardwareTexture.js +5 -4
  28. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  29. package/Engines/WebGPU/webgpuTextureHelper.js +18 -0
  30. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  31. package/Engines/WebGPU/webgpuTextureManager.js +8 -2
  32. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  33. package/Engines/abstractEngine.d.ts +12 -1
  34. package/Engines/abstractEngine.js +4 -4
  35. package/Engines/abstractEngine.js.map +1 -1
  36. package/Engines/constants.d.ts +17 -1
  37. package/Engines/constants.js +17 -1
  38. package/Engines/constants.js.map +1 -1
  39. package/Engines/engine.d.ts +31 -1
  40. package/Engines/engine.js +17 -1
  41. package/Engines/engine.js.map +1 -1
  42. package/Engines/engineCapabilities.d.ts +2 -0
  43. package/Engines/engineCapabilities.js.map +1 -1
  44. package/Engines/nativeEngine.js +1 -0
  45. package/Engines/nativeEngine.js.map +1 -1
  46. package/Engines/nullEngine.d.ts +2 -2
  47. package/Engines/nullEngine.js +3 -2
  48. package/Engines/nullEngine.js.map +1 -1
  49. package/Engines/renderTargetWrapper.d.ts +33 -1
  50. package/Engines/renderTargetWrapper.js +64 -4
  51. package/Engines/renderTargetWrapper.js.map +1 -1
  52. package/Engines/thinEngine.d.ts +13 -1
  53. package/Engines/thinEngine.functions.d.ts +4 -0
  54. package/Engines/thinEngine.functions.js +17 -0
  55. package/Engines/thinEngine.functions.js.map +1 -1
  56. package/Engines/thinEngine.js +151 -32
  57. package/Engines/thinEngine.js.map +1 -1
  58. package/Engines/thinWebGPUEngine.d.ts +2 -0
  59. package/Engines/thinWebGPUEngine.js +7 -0
  60. package/Engines/thinWebGPUEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.d.ts +12 -3
  62. package/Engines/webgpuEngine.js +40 -9
  63. package/Engines/webgpuEngine.js.map +1 -1
  64. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +8 -0
  65. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +22 -1
  66. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  67. package/FrameGraph/Node/Blocks/inputBlock.d.ts +4 -9
  68. package/FrameGraph/Node/Blocks/inputBlock.js +15 -25
  69. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  70. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -2
  71. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
  72. package/FrameGraph/Passes/renderPass.d.ts +10 -10
  73. package/FrameGraph/Passes/renderPass.js +10 -10
  74. package/FrameGraph/Passes/renderPass.js.map +1 -1
  75. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +10 -5
  76. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +29 -14
  77. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  78. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -0
  79. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
  80. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +11 -6
  81. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +30 -13
  82. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
  83. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -6
  84. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  85. package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +1 -1
  86. package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -1
  87. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +3 -3
  88. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +33 -32
  89. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  90. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -2
  91. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +8 -12
  92. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  93. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +13 -18
  94. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  95. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +15 -2
  96. package/FrameGraph/Tasks/Texture/clearTextureTask.js +17 -4
  97. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  98. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +2 -2
  99. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  100. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -3
  101. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
  102. package/FrameGraph/frameGraph.d.ts +11 -74
  103. package/FrameGraph/frameGraph.js +12 -126
  104. package/FrameGraph/frameGraph.js.map +1 -1
  105. package/FrameGraph/frameGraphRenderContext.d.ts +17 -8
  106. package/FrameGraph/frameGraphRenderContext.js +55 -43
  107. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  108. package/FrameGraph/frameGraphRenderTarget.d.ts +16 -0
  109. package/FrameGraph/frameGraphRenderTarget.js +67 -0
  110. package/FrameGraph/frameGraphRenderTarget.js.map +1 -0
  111. package/FrameGraph/frameGraphTask.d.ts +4 -3
  112. package/FrameGraph/frameGraphTask.js +41 -8
  113. package/FrameGraph/frameGraphTask.js.map +1 -1
  114. package/FrameGraph/frameGraphTextureManager.d.ts +130 -22
  115. package/FrameGraph/frameGraphTextureManager.js +312 -130
  116. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  117. package/FrameGraph/frameGraphTypes.d.ts +28 -13
  118. package/FrameGraph/frameGraphTypes.js.map +1 -1
  119. package/FrameGraph/index.d.ts +1 -0
  120. package/FrameGraph/index.js +1 -0
  121. package/FrameGraph/index.js.map +1 -1
  122. package/Helpers/environmentHelper.js.map +1 -1
  123. package/Layers/effectLayer.d.ts +1 -1
  124. package/Layers/effectLayer.js.map +1 -1
  125. package/Layers/glowLayer.d.ts +1 -1
  126. package/Layers/glowLayer.js.map +1 -1
  127. package/Layers/highlightLayer.d.ts +1 -1
  128. package/Layers/highlightLayer.js.map +1 -1
  129. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  130. package/Materials/Node/Blocks/conditionalBlock.d.ts +2 -0
  131. package/Materials/Node/Blocks/conditionalBlock.js +13 -0
  132. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  133. package/Materials/Node/nodeMaterial.js.map +1 -1
  134. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
  135. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  136. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  137. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  138. package/Materials/Textures/baseTexture.js.map +1 -1
  139. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  140. package/Materials/Textures/internalTexture.d.ts +20 -0
  141. package/Materials/Textures/internalTexture.js +48 -0
  142. package/Materials/Textures/internalTexture.js.map +1 -1
  143. package/Materials/Textures/mirrorTexture.js.map +1 -1
  144. package/Materials/Textures/multiRenderTarget.d.ts +5 -0
  145. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  146. package/Materials/Textures/rawCubeTexture.d.ts +2 -2
  147. package/Materials/Textures/rawCubeTexture.js +2 -2
  148. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  149. package/Materials/Textures/rawTexture.js.map +1 -1
  150. package/Materials/Textures/rawTexture2DArray.d.ts +1 -1
  151. package/Materials/Textures/rawTexture2DArray.js +1 -1
  152. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  153. package/Materials/Textures/rawTexture3D.d.ts +1 -1
  154. package/Materials/Textures/rawTexture3D.js +1 -1
  155. package/Materials/Textures/rawTexture3D.js.map +1 -1
  156. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  157. package/Materials/Textures/textureCreationOptions.d.ts +6 -6
  158. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  159. package/Materials/drawWrapper.d.ts +6 -1
  160. package/Materials/drawWrapper.js +18 -2
  161. package/Materials/drawWrapper.js.map +1 -1
  162. package/Materials/effect.d.ts +6 -1
  163. package/Materials/effect.functions.d.ts +5 -0
  164. package/Materials/effect.functions.js +19 -0
  165. package/Materials/effect.functions.js.map +1 -1
  166. package/Materials/effect.js +22 -20
  167. package/Materials/effect.js.map +1 -1
  168. package/Materials/effect.webgl.functions.js +12 -4
  169. package/Materials/effect.webgl.functions.js.map +1 -1
  170. package/Maths/math.color.d.ts +16 -0
  171. package/Maths/math.color.js +16 -0
  172. package/Maths/math.color.js.map +1 -1
  173. package/Maths/math.vector.d.ts +32 -0
  174. package/Maths/math.vector.js +32 -0
  175. package/Maths/math.vector.js.map +1 -1
  176. package/Meshes/Compression/dracoCompression.d.ts +3 -1
  177. package/Meshes/Compression/dracoCompression.js +5 -2
  178. package/Meshes/Compression/dracoCompression.js.map +1 -1
  179. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -1
  180. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -0
  181. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  182. package/Meshes/Node/Blocks/Matrices/rotationXBlock.d.ts +0 -1
  183. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js +1 -9
  184. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
  185. package/Meshes/Node/Blocks/Matrices/rotationYBlock.d.ts +0 -1
  186. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js +1 -9
  187. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
  188. package/Meshes/Node/Blocks/Matrices/rotationZBlock.d.ts +0 -1
  189. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js +1 -9
  190. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
  191. package/Meshes/Node/Blocks/Set/latticeBlock.js +3 -1
  192. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  193. package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
  194. package/Meshes/Node/Blocks/conditionBlock.js +15 -0
  195. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  196. package/Meshes/Node/Blocks/geometryClampBlock.d.ts +4 -4
  197. package/Meshes/Node/Blocks/geometryClampBlock.js +16 -25
  198. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  199. package/Meshes/Node/Blocks/geometryLerpBlock.js +2 -2
  200. package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
  201. package/Meshes/Node/Blocks/geometryNLerpBlock.js +2 -2
  202. package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
  203. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +2 -2
  204. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
  205. package/Meshes/Node/Blocks/geometryRotate2dBlock.js +2 -2
  206. package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
  207. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +3 -3
  208. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
  209. package/Meshes/Node/Blocks/geometryStepBlock.js +2 -2
  210. package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
  211. package/Meshes/Node/nodeGeometry.js +1 -1
  212. package/Meshes/Node/nodeGeometry.js.map +1 -1
  213. package/Meshes/Node/nodeGeometryBlock.d.ts +3 -1
  214. package/Meshes/Node/nodeGeometryBlock.js +2 -1
  215. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  216. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +10 -2
  217. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  218. package/Meshes/abstractMesh.d.ts +5 -3
  219. package/Meshes/abstractMesh.js +9 -7
  220. package/Meshes/abstractMesh.js.map +1 -1
  221. package/Meshes/subMesh.d.ts +5 -3
  222. package/Meshes/subMesh.js +9 -7
  223. package/Meshes/subMesh.js.map +1 -1
  224. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  225. package/Misc/dds.d.ts +1 -1
  226. package/Misc/dds.js.map +1 -1
  227. package/Misc/environmentTextureTools.js.map +1 -1
  228. package/Misc/observable.d.ts +1 -3
  229. package/Misc/observable.js +9 -7
  230. package/Misc/observable.js.map +1 -1
  231. package/Misc/screenshotTools.js.map +1 -1
  232. package/Misc/snapshotRenderingHelper.js +3 -0
  233. package/Misc/snapshotRenderingHelper.js.map +1 -1
  234. package/Misc/textureTools.js.map +1 -1
  235. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  236. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
  237. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  238. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  239. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  240. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  241. package/PostProcesses/blurPostProcess.js.map +1 -1
  242. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  243. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  244. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  245. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  246. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  247. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  248. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  249. package/PostProcesses/grainPostProcess.js.map +1 -1
  250. package/PostProcesses/highlightsPostProcess.d.ts +1 -1
  251. package/PostProcesses/highlightsPostProcess.js +1 -1
  252. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  253. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  254. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  255. package/PostProcesses/passPostProcess.js.map +1 -1
  256. package/PostProcesses/postProcess.d.ts +1 -1
  257. package/PostProcesses/postProcess.js.map +1 -1
  258. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  259. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  260. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  261. package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
  262. package/PostProcesses/tonemapPostProcess.d.ts +1 -1
  263. package/PostProcesses/tonemapPostProcess.js +1 -1
  264. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  265. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  266. package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +1 -1
  267. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  268. package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
  269. package/Rendering/prePassRenderer.js.map +1 -1
  270. package/ShadersWGSL/pbr.fragment.js +4 -3
  271. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  272. package/package.json +1 -1
@@ -1,7 +1,9 @@
1
1
  import type { HardwareTextureWrapper } from "../../Materials/Textures/hardwareTextureWrapper";
2
2
  import type { Nullable } from "../../types";
3
+ import type { WebGPUEngine } from "../webgpuEngine";
3
4
  /** @internal */
4
5
  export declare class WebGPUHardwareTexture implements HardwareTextureWrapper {
6
+ private _engine;
5
7
  /**
6
8
  * Cache of RenderPassDescriptor and BindGroup used when generating mipmaps (see WebGPUTextureHelper.generateMipmaps)
7
9
  * @internal
@@ -33,7 +35,7 @@ export declare class WebGPUHardwareTexture implements HardwareTextureWrapper {
33
35
  format: GPUTextureFormat;
34
36
  textureUsages: number;
35
37
  textureAdditionalUsages: number;
36
- constructor(existingTexture?: Nullable<GPUTexture>);
38
+ constructor(_engine: WebGPUEngine, existingTexture?: Nullable<GPUTexture>);
37
39
  set(hardwareTexture: GPUTexture): void;
38
40
  setUsage(_textureSource: number, generateMipMaps: boolean, is2DArray: boolean, isCube: boolean, is3D: boolean, width: number, height: number, depth: number): void;
39
41
  createView(descriptor?: GPUTextureViewDescriptor, createViewForWriting?: boolean): void;
@@ -16,19 +16,20 @@ export class WebGPUHardwareTexture {
16
16
  }
17
17
  releaseMSAATexture(index) {
18
18
  if (this._webgpuMSAATexture) {
19
- if (index) {
20
- this._webgpuMSAATexture[index]?.destroy();
19
+ if (index !== undefined) {
20
+ this._engine._textureHelper.releaseTexture(this._webgpuMSAATexture[index]);
21
21
  delete this._webgpuMSAATexture[index];
22
22
  }
23
23
  else {
24
24
  for (const texture of this._webgpuMSAATexture) {
25
- texture?.destroy();
25
+ this._engine._textureHelper.releaseTexture(texture);
26
26
  }
27
27
  this._webgpuMSAATexture = null;
28
28
  }
29
29
  }
30
30
  }
31
- constructor(existingTexture = null) {
31
+ constructor(_engine, existingTexture = null) {
32
+ this._engine = _engine;
32
33
  /** @internal */
33
34
  this._originalFormatIsRGB = false;
34
35
  this.format = "rgba8unorm" /* WebGPUConstants.TextureFormat.RGBA8Unorm */;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpuHardwareTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuHardwareTexture.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,gBAAgB;AAChB,MAAM,OAAO,qBAAqB;IA6B9B,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAEM,cAAc,CAAC,KAAa;QAC/B,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACpD,CAAC;IAEM,cAAc,CAAC,OAAmB,EAAE,KAAa;QACpD,IAAI,CAAC,IAAI,CAAC,kBAAkB,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ACjF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,cAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,oBAAoB,IAAI,UAAU,EAAE,CAAC;YACrC,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;YAChD,UAAU,CAAC,aAAa,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YAClE,UAAU,CAAC,aAAa,GAAG,cAAc,CAAC;QAC9C,CAAC;IACL,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,uBAAuB,EAAE,OAAO,EAAE,CAAC;QACxC,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\r\n/* eslint-disable babylonjs/available */\r\nimport type { HardwareTextureWrapper } from \"../../Materials/Textures/hardwareTextureWrapper\";\r\nimport { ILog2 } from \"../../Maths/math.scalar.functions\";\r\nimport type { Nullable } from \"../../types\";\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nimport * as WebGPUConstants from \"./webgpuConstants\";\r\nimport { WebGPUTextureHelper } from \"./webgpuTextureHelper\";\r\n\r\n/** @internal */\r\nexport class WebGPUHardwareTexture implements HardwareTextureWrapper {\r\n /**\r\n * Cache of RenderPassDescriptor and BindGroup used when generating mipmaps (see WebGPUTextureHelper.generateMipmaps)\r\n * @internal\r\n */\r\n public _mipmapGenRenderPassDescr: GPURenderPassDescriptor[][];\r\n /** @internal */\r\n public _mipmapGenBindGroup: GPUBindGroup[][];\r\n\r\n /**\r\n * Cache for the invertYPreMultiplyAlpha function (see WebGPUTextureHelper)\r\n * @internal\r\n */\r\n public _copyInvertYTempTexture?: GPUTexture;\r\n /** @internal */\r\n public _copyInvertYRenderPassDescr: GPURenderPassDescriptor;\r\n /** @internal */\r\n public _copyInvertYBindGroup: GPUBindGroup;\r\n /** @internal */\r\n public _copyInvertYBindGroupWithOfst: GPUBindGroup;\r\n\r\n /** @internal */\r\n public _originalFormatIsRGB = false;\r\n\r\n private _webgpuTexture: Nullable<GPUTexture>;\r\n // There can be multiple MSAA textures for a single WebGPU texture because different layers of a 2DArrayTexture / 3DTexture\r\n // or different faces of a cube texture can be bound to different render targets at the same time (in a multi RenderTargetWrapper)\r\n private _webgpuMSAATexture: Nullable<GPUTexture[]>;\r\n\r\n public get underlyingResource(): Nullable<GPUTexture> {\r\n return this._webgpuTexture;\r\n }\r\n\r\n public getMSAATexture(index: number): Nullable<GPUTexture> {\r\n return this._webgpuMSAATexture?.[index] ?? null;\r\n }\r\n\r\n public setMSAATexture(texture: GPUTexture, index: number) {\r\n if (!this._webgpuMSAATexture) {\r\n this._webgpuMSAATexture = [];\r\n }\r\n\r\n this._webgpuMSAATexture![index] = texture;\r\n }\r\n\r\n public releaseMSAATexture(index?: number): void {\r\n if (this._webgpuMSAATexture) {\r\n if (index) {\r\n this._webgpuMSAATexture[index]?.destroy();\r\n delete this._webgpuMSAATexture[index];\r\n } else {\r\n for (const texture of this._webgpuMSAATexture) {\r\n texture?.destroy();\r\n }\r\n this._webgpuMSAATexture = null;\r\n }\r\n }\r\n }\r\n\r\n public view: Nullable<GPUTextureView>;\r\n public viewForWriting: Nullable<GPUTextureView>;\r\n public format: GPUTextureFormat = WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n public textureUsages = 0;\r\n public textureAdditionalUsages = 0;\r\n\r\n constructor(existingTexture: Nullable<GPUTexture> = null) {\r\n this._webgpuTexture = existingTexture;\r\n this._webgpuMSAATexture = null;\r\n this.view = null;\r\n this.viewForWriting = null;\r\n }\r\n\r\n public set(hardwareTexture: GPUTexture): void {\r\n this._webgpuTexture = hardwareTexture;\r\n }\r\n\r\n public setUsage(_textureSource: number, generateMipMaps: boolean, is2DArray: boolean, isCube: boolean, is3D: boolean, width: number, height: number, depth: number): void {\r\n let viewDimension: GPUTextureViewDimension = WebGPUConstants.TextureViewDimension.E2d;\r\n let arrayLayerCount = 1;\r\n if (isCube) {\r\n viewDimension = is2DArray ? WebGPUConstants.TextureViewDimension.CubeArray : WebGPUConstants.TextureViewDimension.Cube;\r\n arrayLayerCount = 6 * (depth || 1);\r\n } else if (is3D) {\r\n viewDimension = WebGPUConstants.TextureViewDimension.E3d;\r\n arrayLayerCount = 1;\r\n } else if (is2DArray) {\r\n viewDimension = WebGPUConstants.TextureViewDimension.E2dArray;\r\n arrayLayerCount = depth;\r\n }\r\n\r\n const format = WebGPUTextureHelper.GetDepthFormatOnly(this.format);\r\n const aspect = WebGPUTextureHelper.HasDepthAndStencilAspects(this.format) ? WebGPUConstants.TextureAspect.DepthOnly : WebGPUConstants.TextureAspect.All;\r\n\r\n this.createView({\r\n label: `TextureView${is3D ? \"3D\" : isCube ? \"Cube\" : \"2D\"}${is2DArray ? \"_Array\" + arrayLayerCount : \"\"}_${width}x${height}_${generateMipMaps ? \"wmips\" : \"womips\"}_${\r\n this.format\r\n }_${viewDimension}`,\r\n format,\r\n dimension: viewDimension,\r\n mipLevelCount: generateMipMaps ? ILog2(Math.max(width, height)) + 1 : 1,\r\n baseArrayLayer: 0,\r\n baseMipLevel: 0,\r\n arrayLayerCount,\r\n aspect,\r\n });\r\n }\r\n\r\n public createView(descriptor?: GPUTextureViewDescriptor, createViewForWriting = false): void {\r\n this.view = this._webgpuTexture!.createView(descriptor);\r\n if (createViewForWriting && descriptor) {\r\n const saveNumMipMaps = descriptor.mipLevelCount;\r\n descriptor.mipLevelCount = 1;\r\n this.viewForWriting = this._webgpuTexture!.createView(descriptor);\r\n descriptor.mipLevelCount = saveNumMipMaps;\r\n }\r\n }\r\n\r\n public reset(): void {\r\n this._webgpuTexture = null;\r\n this._webgpuMSAATexture = null;\r\n this.view = null;\r\n this.viewForWriting = null;\r\n }\r\n\r\n public release(): void {\r\n this._webgpuTexture?.destroy();\r\n this.releaseMSAATexture();\r\n this._copyInvertYTempTexture?.destroy();\r\n this.reset();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webgpuHardwareTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuHardwareTexture.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,gBAAgB;AAChB,MAAM,OAAO,qBAAqB;IA6B9B,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAEM,cAAc,CAAC,KAAa;QAC/B,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACpD,CAAC;IAEM,cAAc,CAAC,OAAmB,EAAE,KAAa;QACpD,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC3B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QACjC,CAAC;QAED,IAAI,CAAC,kBAAmB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;IAC9C,CAAC;IAEM,kBAAkB,CAAC,KAAc;QACpC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3E,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CA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CAAC,CAAC;YAClE,UAAU,CAAC,aAAa,GAAG,cAAc,CAAC;QAC9C,CAAC;IACL,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,uBAAuB,EAAE,OAAO,EAAE,CAAC;QACxC,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\r\n/* eslint-disable babylonjs/available */\r\nimport type { HardwareTextureWrapper } from \"../../Materials/Textures/hardwareTextureWrapper\";\r\nimport { ILog2 } from \"../../Maths/math.scalar.functions\";\r\nimport type { Nullable } from \"../../types\";\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nimport * as WebGPUConstants from \"./webgpuConstants\";\r\nimport { WebGPUTextureHelper } from \"./webgpuTextureHelper\";\r\nimport type { WebGPUEngine } from \"../webgpuEngine\";\r\n\r\n/** @internal */\r\nexport class WebGPUHardwareTexture implements HardwareTextureWrapper {\r\n /**\r\n * Cache of RenderPassDescriptor and BindGroup used when generating mipmaps (see WebGPUTextureHelper.generateMipmaps)\r\n * @internal\r\n */\r\n public _mipmapGenRenderPassDescr: GPURenderPassDescriptor[][];\r\n /** @internal */\r\n public _mipmapGenBindGroup: GPUBindGroup[][];\r\n\r\n /**\r\n * Cache for the invertYPreMultiplyAlpha function (see WebGPUTextureHelper)\r\n * @internal\r\n */\r\n public _copyInvertYTempTexture?: GPUTexture;\r\n /** @internal */\r\n public _copyInvertYRenderPassDescr: GPURenderPassDescriptor;\r\n /** @internal */\r\n public _copyInvertYBindGroup: GPUBindGroup;\r\n /** @internal */\r\n public _copyInvertYBindGroupWithOfst: GPUBindGroup;\r\n\r\n /** @internal */\r\n public _originalFormatIsRGB = false;\r\n\r\n private _webgpuTexture: Nullable<GPUTexture>;\r\n // There can be multiple MSAA textures for a single WebGPU texture because different layers of a 2DArrayTexture / 3DTexture\r\n // or different faces of a cube texture can be bound to different render targets at the same time (in a multi RenderTargetWrapper)\r\n private _webgpuMSAATexture: Nullable<GPUTexture[]>;\r\n\r\n public get underlyingResource(): Nullable<GPUTexture> {\r\n return this._webgpuTexture;\r\n }\r\n\r\n public getMSAATexture(index: number): Nullable<GPUTexture> {\r\n return this._webgpuMSAATexture?.[index] ?? null;\r\n }\r\n\r\n public setMSAATexture(texture: GPUTexture, index: number) {\r\n if (!this._webgpuMSAATexture) {\r\n this._webgpuMSAATexture = [];\r\n }\r\n\r\n this._webgpuMSAATexture![index] = texture;\r\n }\r\n\r\n public releaseMSAATexture(index?: number): void {\r\n if (this._webgpuMSAATexture) {\r\n if (index !== undefined) {\r\n this._engine._textureHelper.releaseTexture(this._webgpuMSAATexture[index]);\r\n delete this._webgpuMSAATexture[index];\r\n } else {\r\n for (const texture of this._webgpuMSAATexture) {\r\n this._engine._textureHelper.releaseTexture(texture);\r\n }\r\n this._webgpuMSAATexture = null;\r\n }\r\n }\r\n }\r\n\r\n public view: Nullable<GPUTextureView>;\r\n public viewForWriting: Nullable<GPUTextureView>;\r\n public format: GPUTextureFormat = WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n public textureUsages = 0;\r\n public textureAdditionalUsages = 0;\r\n\r\n constructor(\r\n private _engine: WebGPUEngine,\r\n existingTexture: Nullable<GPUTexture> = null\r\n ) {\r\n this._webgpuTexture = existingTexture;\r\n this._webgpuMSAATexture = null;\r\n this.view = null;\r\n this.viewForWriting = null;\r\n }\r\n\r\n public set(hardwareTexture: GPUTexture): void {\r\n this._webgpuTexture = hardwareTexture;\r\n }\r\n\r\n public setUsage(_textureSource: number, generateMipMaps: boolean, is2DArray: boolean, isCube: boolean, is3D: boolean, width: number, height: number, depth: number): void {\r\n let viewDimension: GPUTextureViewDimension = WebGPUConstants.TextureViewDimension.E2d;\r\n let arrayLayerCount = 1;\r\n if (isCube) {\r\n viewDimension = is2DArray ? WebGPUConstants.TextureViewDimension.CubeArray : WebGPUConstants.TextureViewDimension.Cube;\r\n arrayLayerCount = 6 * (depth || 1);\r\n } else if (is3D) {\r\n viewDimension = WebGPUConstants.TextureViewDimension.E3d;\r\n arrayLayerCount = 1;\r\n } else if (is2DArray) {\r\n viewDimension = WebGPUConstants.TextureViewDimension.E2dArray;\r\n arrayLayerCount = depth;\r\n }\r\n\r\n const format = WebGPUTextureHelper.GetDepthFormatOnly(this.format);\r\n const aspect = WebGPUTextureHelper.HasDepthAndStencilAspects(this.format) ? WebGPUConstants.TextureAspect.DepthOnly : WebGPUConstants.TextureAspect.All;\r\n\r\n this.createView({\r\n label: `TextureView${is3D ? \"3D\" : isCube ? \"Cube\" : \"2D\"}${is2DArray ? \"_Array\" + arrayLayerCount : \"\"}_${width}x${height}_${generateMipMaps ? \"wmips\" : \"womips\"}_${\r\n this.format\r\n }_${viewDimension}`,\r\n format,\r\n dimension: viewDimension,\r\n mipLevelCount: generateMipMaps ? ILog2(Math.max(width, height)) + 1 : 1,\r\n baseArrayLayer: 0,\r\n baseMipLevel: 0,\r\n arrayLayerCount,\r\n aspect,\r\n });\r\n }\r\n\r\n public createView(descriptor?: GPUTextureViewDescriptor, createViewForWriting = false): void {\r\n this.view = this._webgpuTexture!.createView(descriptor);\r\n if (createViewForWriting && descriptor) {\r\n const saveNumMipMaps = descriptor.mipLevelCount;\r\n descriptor.mipLevelCount = 1;\r\n this.viewForWriting = this._webgpuTexture!.createView(descriptor);\r\n descriptor.mipLevelCount = saveNumMipMaps;\r\n }\r\n }\r\n\r\n public reset(): void {\r\n this._webgpuTexture = null;\r\n this._webgpuMSAATexture = null;\r\n this.view = null;\r\n this.viewForWriting = null;\r\n }\r\n\r\n public release(): void {\r\n this._webgpuTexture?.destroy();\r\n this.releaseMSAATexture();\r\n this._copyInvertYTempTexture?.destroy();\r\n this.reset();\r\n }\r\n}\r\n"]}
@@ -85,12 +85,18 @@ export class WebGPUTextureHelper {
85
85
  return 3;
86
86
  // One component = 16 bits unsigned
87
87
  case "r16uint" /* WebGPUConstants.TextureFormat.R16Uint */:
88
+ case "r16unorm" /* WebGPUConstants.TextureFormat.R16Unorm */:
89
+ case "rg16unorm" /* WebGPUConstants.TextureFormat.RG16Unorm */:
90
+ case "rgba16unorm" /* WebGPUConstants.TextureFormat.RGBA16Unorm */:
88
91
  case "rg16uint" /* WebGPUConstants.TextureFormat.RG16Uint */:
89
92
  case "rgba16uint" /* WebGPUConstants.TextureFormat.RGBA16Uint */:
90
93
  case "depth16unorm" /* WebGPUConstants.TextureFormat.Depth16Unorm */:
91
94
  return 5;
92
95
  // One component = 16 bits signed
93
96
  case "r16sint" /* WebGPUConstants.TextureFormat.R16Sint */:
97
+ case "r16snorm" /* WebGPUConstants.TextureFormat.R16Snorm */:
98
+ case "rg16snorm" /* WebGPUConstants.TextureFormat.RG16Snorm */:
99
+ case "rgba16snorm" /* WebGPUConstants.TextureFormat.RGBA16Snorm */:
94
100
  case "rg16sint" /* WebGPUConstants.TextureFormat.RG16Sint */:
95
101
  case "rgba16sint" /* WebGPUConstants.TextureFormat.RGBA16Sint */:
96
102
  return 4;
@@ -130,6 +136,12 @@ export class WebGPUTextureHelper {
130
136
  // 16 bits formats
131
137
  case "r16uint" /* WebGPUConstants.TextureFormat.R16Uint */:
132
138
  case "r16sint" /* WebGPUConstants.TextureFormat.R16Sint */:
139
+ case "r16unorm" /* WebGPUConstants.TextureFormat.R16Unorm */:
140
+ case "rg16unorm" /* WebGPUConstants.TextureFormat.RG16Unorm */:
141
+ case "rgba16unorm" /* WebGPUConstants.TextureFormat.RGBA16Unorm */:
142
+ case "r16snorm" /* WebGPUConstants.TextureFormat.R16Snorm */:
143
+ case "rg16snorm" /* WebGPUConstants.TextureFormat.RG16Snorm */:
144
+ case "rgba16snorm" /* WebGPUConstants.TextureFormat.RGBA16Snorm */:
133
145
  case "r16float" /* WebGPUConstants.TextureFormat.R16Float */:
134
146
  case "rg8unorm" /* WebGPUConstants.TextureFormat.RG8Unorm */:
135
147
  case "rg8snorm" /* WebGPUConstants.TextureFormat.RG8Snorm */:
@@ -561,6 +573,8 @@ export class WebGPUTextureHelper {
561
573
  case "r16sint" /* WebGPUConstants.TextureFormat.R16Sint */:
562
574
  case "depth16unorm" /* WebGPUConstants.TextureFormat.Depth16Unorm */:
563
575
  case "r16float" /* WebGPUConstants.TextureFormat.R16Float */:
576
+ case "r16unorm" /* WebGPUConstants.TextureFormat.R16Unorm */:
577
+ case "r16snorm" /* WebGPUConstants.TextureFormat.R16Snorm */:
564
578
  case "r32uint" /* WebGPUConstants.TextureFormat.R32Uint */:
565
579
  case "r32sint" /* WebGPUConstants.TextureFormat.R32Sint */:
566
580
  case "r32float" /* WebGPUConstants.TextureFormat.R32Float */:
@@ -580,6 +594,8 @@ export class WebGPUTextureHelper {
580
594
  case "rg16uint" /* WebGPUConstants.TextureFormat.RG16Uint */:
581
595
  case "rg16sint" /* WebGPUConstants.TextureFormat.RG16Sint */:
582
596
  case "rg16float" /* WebGPUConstants.TextureFormat.RG16Float */:
597
+ case "rg16unorm" /* WebGPUConstants.TextureFormat.RG16Unorm */:
598
+ case "rg16snorm" /* WebGPUConstants.TextureFormat.RG16Snorm */:
583
599
  case "rg32uint" /* WebGPUConstants.TextureFormat.RG32Uint */:
584
600
  case "rg32sint" /* WebGPUConstants.TextureFormat.RG32Sint */:
585
601
  case "rg32float" /* WebGPUConstants.TextureFormat.RG32Float */:
@@ -601,6 +617,8 @@ export class WebGPUTextureHelper {
601
617
  case "rgba8sint" /* WebGPUConstants.TextureFormat.RGBA8Sint */:
602
618
  case "bgra8unorm" /* WebGPUConstants.TextureFormat.BGRA8Unorm */:
603
619
  case "bgra8unorm-srgb" /* WebGPUConstants.TextureFormat.BGRA8UnormSRGB */:
620
+ case "rgba16unorm" /* WebGPUConstants.TextureFormat.RGBA16Unorm */:
621
+ case "rgba16snorm" /* WebGPUConstants.TextureFormat.RGBA16Snorm */:
604
622
  case "rgb10a2uint" /* WebGPUConstants.TextureFormat.RGB10A2UINT */:
605
623
  case "rgb10a2unorm" /* WebGPUConstants.TextureFormat.RGB10A2Unorm */:
606
624
  case "bc7-rgba-unorm" /* WebGPUConstants.TextureFormat.BC7RGBAUnorm */:
@@ -1 +1 @@
1
- {"version":3,"file":"webgpuTextureHelper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuTextureHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,gBAAgB;AAChB,MAAM,OAAO,mBAAmB;IACrB,MAAM,CAAC,sBAAsB,CAAC,KAAa,EAAE,MAAc;QAC9D,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAEM,MAAM,CAAC,wBAAwB,CAAC,MAAwB;QAC3D,QAAQ,MAAM,EAAE,CAAC;YACb,kCAAkC;YAClC,2DAA2C;YAC3C,yDAA0C;YAC1C,6DAA4C;YAC5C,2DAA2C;YAC3C,iEAA8C;YAC9C,0EAAkD;YAClD,+DAA6C;YAC7C,iEAA8C;YAC9C,0EAAkD;YAClD,mEAA+C,CAAC,4CAA4C;YAC5F,qEAAgD,CAAC,4CAA4C;YAC7F,qEAAgD,CAAC,4CAA4C;YAC7F,uEAAiD,CAAC,4CAA4C;YAC9F,uEAAgD;YAChD,gFAAoD;YACpD,yEAAiD;YACjD,mEAA8C;YAC9C,uEAAgD;YAChD,gFAAoD;YACpD,uEAAgD;YAChD,gFAAoD;YACpD,iEAA6C;YAC7C,uEAAgD;YAChD,gFAAo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BACI,uEAAkD;YACtD;gBACI,uEAAkD;QAC1D,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,WAAmB;QACvC,8BAA8B;QAC9B,OAAO,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;CACJ","sourcesContent":["/* eslint-disable babylonjs/available */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nimport * as WebGPUConstants from \"./webgpuConstants\";\r\nimport { ILog2 } from \"../../Maths/math.scalar.functions\";\r\nimport { Constants } from \"../constants\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { HardwareTextureWrapper } from \"../../Materials/Textures/hardwareTextureWrapper\";\r\n\r\n/** @internal */\r\nexport class WebGPUTextureHelper {\r\n public static ComputeNumMipmapLevels(width: number, height: number) {\r\n return ILog2(Math.max(width, height)) + 1;\r\n }\r\n\r\n public static GetTextureTypeFromFormat(format: GPUTextureFormat): number {\r\n switch (format) {\r\n // One Component = 8 bits unsigned\r\n case WebGPUConstants.TextureFormat.R8Unorm:\r\n case WebGPUConstants.TextureFormat.R8Uint:\r\n case WebGPUConstants.TextureFormat.RG8Unorm:\r\n case WebGPUConstants.TextureFormat.RG8Uint:\r\n case WebGPUConstants.TextureFormat.RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA8Uint:\r\n case WebGPUConstants.TextureFormat.BGRA8Unorm:\r\n case WebGPUConstants.TextureFormat.BGRA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGB10A2UINT: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.RGB10A2Unorm: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.RGB9E5UFloat: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.RG11B10UFloat: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n return Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n\r\n // One Component = 8 bits signed\r\n case WebGPUConstants.TextureFormat.R8Snorm:\r\n case WebGPUConstants.TextureFormat.R8Sint:\r\n case WebGPUConstants.TextureFormat.RG8Snorm:\r\n case WebGPUConstants.TextureFormat.RG8Sint:\r\n case WebGPUConstants.TextureFormat.RGBA8Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA8Sint:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n return Constants.TEXTURETYPE_BYTE;\r\n\r\n // One component = 16 bits unsigned\r\n case WebGPUConstants.TextureFormat.R16Uint:\r\n case WebGPUConstants.TextureFormat.RG16Uint:\r\n case WebGPUConstants.TextureFormat.RGBA16Uint:\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n return Constants.TEXTURETYPE_UNSIGNED_SHORT;\r\n\r\n // One component = 16 bits signed\r\n case WebGPUConstants.TextureFormat.R16Sint:\r\n case WebGPUConstants.TextureFormat.RG16Sint:\r\n case WebGPUConstants.TextureFormat.RGBA16Sint:\r\n return Constants.TEXTURETYPE_SHORT;\r\n\r\n case WebGPUConstants.TextureFormat.R16Float:\r\n case WebGPUConstants.TextureFormat.RG16Float:\r\n case WebGPUConstants.TextureFormat.RGBA16Float:\r\n return Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n // One component = 32 bits unsigned\r\n case WebGPUConstants.TextureFormat.R32Uint:\r\n case WebGPUConstants.TextureFormat.RG32Uint:\r\n case WebGPUConstants.TextureFormat.RGBA32Uint:\r\n return Constants.TEXTURETYPE_UNSIGNED_INTEGER;\r\n\r\n // One component = 32 bits signed\r\n case WebGPUConstants.TextureFormat.R32Sint:\r\n case WebGPUConstants.TextureFormat.RG32Sint:\r\n case WebGPUConstants.TextureFormat.RGBA32Sint:\r\n return Constants.TEXTURETYPE_UNSIGNED_INTEGER;\r\n\r\n case WebGPUConstants.TextureFormat.R32Float:\r\n case WebGPUConstants.TextureFormat.RG32Float:\r\n case WebGPUConstants.TextureFormat.RGBA32Float:\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n return Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n public static GetBlockInformationFromFormat(format: GPUTextureFormat): { width: number; height: number; length: number } {\r\n switch (format) {\r\n // 8 bits formats\r\n case WebGPUConstants.TextureFormat.R8Unorm:\r\n case WebGPUConstants.TextureFormat.R8Snorm:\r\n case WebGPUConstants.TextureFormat.R8Uint:\r\n case WebGPUConstants.TextureFormat.R8Sint:\r\n return { width: 1, height: 1, length: 1 };\r\n\r\n // 16 bits formats\r\n case WebGPUConstants.TextureFormat.R16Uint:\r\n case WebGPUConstants.TextureFormat.R16Sint:\r\n case WebGPUConstants.TextureFormat.R16Float:\r\n case WebGPUConstants.TextureFormat.RG8Unorm:\r\n case WebGPUConstants.TextureFormat.RG8Snorm:\r\n case WebGPUConstants.TextureFormat.RG8Uint:\r\n case WebGPUConstants.TextureFormat.RG8Sint:\r\n return { width: 1, height: 1, length: 2 };\r\n\r\n // 32 bits formats\r\n case WebGPUConstants.TextureFormat.R32Uint:\r\n case WebGPUConstants.TextureFormat.R32Sint:\r\n case WebGPUConstants.TextureFormat.R32Float:\r\n case WebGPUConstants.TextureFormat.RG16Uint:\r\n case WebGPUConstants.TextureFormat.RG16Sint:\r\n case WebGPUConstants.TextureFormat.RG16Float:\r\n case WebGPUConstants.TextureFormat.RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA8Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA8Uint:\r\n case WebGPUConstants.TextureFormat.RGBA8Sint:\r\n case WebGPUConstants.TextureFormat.BGRA8Unorm:\r\n case WebGPUConstants.TextureFormat.BGRA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGB9E5UFloat:\r\n case WebGPUConstants.TextureFormat.RGB10A2UINT:\r\n case WebGPUConstants.TextureFormat.RGB10A2Unorm:\r\n case WebGPUConstants.TextureFormat.RG11B10UFloat:\r\n return { width: 1, height: 1, length: 4 };\r\n\r\n // 64 bits formats\r\n case WebGPUConstants.TextureFormat.RG32Uint:\r\n case WebGPUConstants.TextureFormat.RG32Sint:\r\n case WebGPUConstants.TextureFormat.RG32Float:\r\n case WebGPUConstants.TextureFormat.RGBA16Uint:\r\n case WebGPUConstants.TextureFormat.RGBA16Sint:\r\n case WebGPUConstants.TextureFormat.RGBA16Float:\r\n return { width: 1, height: 1, length: 8 };\r\n\r\n // 128 bits formats\r\n case WebGPUConstants.TextureFormat.RGBA32Uint:\r\n case WebGPUConstants.TextureFormat.RGBA32Sint:\r\n case WebGPUConstants.TextureFormat.RGBA32Float:\r\n return { width: 1, height: 1, length: 16 };\r\n\r\n // Depth and stencil formats\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No fixed size for Stencil8 format!\";\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n return { width: 1, height: 1, length: 2 };\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No fixed size for Depth24Plus format!\";\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No fixed size for Depth24PlusStencil8 format!\";\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n return { width: 1, height: 1, length: 4 };\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n return { width: 1, height: 1, length: 5 };\r\n\r\n // BC compressed formats usable if \"texture-compression-bc\" is both\r\n // supported by the device/user agent and enabled in requestDevice.\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n return { width: 4, height: 4, length: 16 };\r\n\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n return { width: 4, height: 4, length: 8 };\r\n\r\n // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\r\n // supported by the device/user agent and enabled in requestDevice.\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n return { width: 4, height: 4, length: 8 };\r\n\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n return { width: 4, height: 4, length: 16 };\r\n\r\n // ASTC compressed formats usable if \"texture-compression-astc\" is both\r\n // supported by the device/user agent and enabled in requestDevice.\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n return { width: 4, height: 4, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n return { width: 5, height: 4, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n return { width: 5, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n return { width: 6, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n return { width: 6, height: 6, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n return { width: 8, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n return { width: 8, height: 6, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n return { width: 8, height: 8, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n return { width: 10, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n return { width: 10, height: 6, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n return { width: 10, height: 8, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n return { width: 10, height: 10, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n return { width: 12, height: 10, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n return { width: 12, height: 12, length: 16 };\r\n }\r\n\r\n return { width: 1, height: 1, length: 4 };\r\n }\r\n\r\n public static IsHardwareTexture(texture: HardwareTextureWrapper | GPUTexture): texture is HardwareTextureWrapper {\r\n return !!(texture as HardwareTextureWrapper).release;\r\n }\r\n\r\n public static IsInternalTexture(texture: InternalTexture | GPUTexture): texture is InternalTexture {\r\n return !!(texture as InternalTexture).dispose;\r\n }\r\n\r\n public static IsImageBitmap(imageBitmap: ImageBitmap | { width: number; height: number }): imageBitmap is ImageBitmap {\r\n return (imageBitmap as ImageBitmap).close !== undefined;\r\n }\r\n\r\n public static IsImageBitmapArray(imageBitmap: ImageBitmap[] | { width: number; height: number }): imageBitmap is ImageBitmap[] {\r\n return Array.isArray(imageBitmap as ImageBitmap[]) && (imageBitmap as ImageBitmap[])[0].close !== undefined;\r\n }\r\n\r\n public static IsCompressedFormat(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static GetWebGPUTextureFormat(type: number, format: number, useSRGBBuffer = false): GPUTextureFormat {\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_DEPTH16:\r\n return WebGPUConstants.TextureFormat.Depth16Unorm;\r\n case Constants.TEXTUREFORMAT_DEPTH24:\r\n return WebGPUConstants.TextureFormat.Depth24Plus;\r\n case Constants.TEXTUREFORMAT_DEPTH24_STENCIL8:\r\n return WebGPUConstants.TextureFormat.Depth24PlusStencil8;\r\n case Constants.TEXTUREFORMAT_DEPTH32_FLOAT:\r\n return WebGPUConstants.TextureFormat.Depth32Float;\r\n case Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8:\r\n return WebGPUConstants.TextureFormat.Depth32FloatStencil8;\r\n case Constants.TEXTUREFORMAT_STENCIL8:\r\n return WebGPUConstants.TextureFormat.Stencil8;\r\n\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC7RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:\r\n return WebGPUConstants.TextureFormat.BC6HRGBUFloat;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:\r\n return WebGPUConstants.TextureFormat.BC6HRGBFloat;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC3RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC2RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC1RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB : WebGPUConstants.TextureFormat.ASTC4x4Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB : WebGPUConstants.TextureFormat.ETC2RGB8Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB : WebGPUConstants.TextureFormat.ETC2RGBA8Unorm;\r\n }\r\n\r\n switch (type) {\r\n case Constants.TEXTURETYPE_BYTE:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R8Snorm;\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG8Snorm;\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R8Sint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG8Sint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA8Sint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA8Snorm;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R8Unorm;\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG8Unorm;\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.RGBA8UnormSRGB : WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n case Constants.TEXTUREFORMAT_BGRA:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BGRA8UnormSRGB : WebGPUConstants.TextureFormat.BGRA8Unorm;\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R8Uint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG8Uint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA8Uint;\r\n case Constants.TEXTUREFORMAT_ALPHA:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_ALPHA format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_LUMINANCE:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU\";\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n }\r\n case Constants.TEXTURETYPE_SHORT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R16Sint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG16Sint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA16Sint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA16Sint;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R16Uint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG16Uint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA16Uint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA16Uint;\r\n }\r\n case Constants.TEXTURETYPE_INT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R32Sint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG32Sint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA32Sint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA32Sint;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R32Uint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG32Uint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA32Uint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA32Uint;\r\n }\r\n case Constants.TEXTURETYPE_FLOAT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R32Float; // By default. Other possibility is R16Float.\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG32Float; // By default. Other possibility is RG16Float.\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGBA32Float; // By default. Other possibility is RGBA16Float.\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA32Float;\r\n }\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R16Float;\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG16Float;\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGBA16Float;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA16Float;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU\";\r\n case Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RG11B10UFloat;\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV\";\r\n default:\r\n return WebGPUConstants.TextureFormat.RG11B10UFloat;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGB9E5UFloat;\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV\";\r\n default:\r\n return WebGPUConstants.TextureFormat.RGB9E5UFloat;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU\";\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU\";\r\n case Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGB10A2Unorm;\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGB10A2UINT;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGB10A2Unorm;\r\n }\r\n }\r\n\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.RGBA8UnormSRGB : WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n }\r\n\r\n public static GetNumChannelsFromWebGPUTextureFormat(format: GPUTextureFormat): number {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.R8Unorm:\r\n case WebGPUConstants.TextureFormat.R8Snorm:\r\n case WebGPUConstants.TextureFormat.R8Uint:\r\n case WebGPUConstants.TextureFormat.R8Sint:\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.R16Uint:\r\n case WebGPUConstants.TextureFormat.R16Sint:\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n case WebGPUConstants.TextureFormat.R16Float:\r\n case WebGPUConstants.TextureFormat.R32Uint:\r\n case WebGPUConstants.TextureFormat.R32Sint:\r\n case WebGPUConstants.TextureFormat.R32Float:\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n return 1;\r\n\r\n case WebGPUConstants.TextureFormat.RG8Unorm:\r\n case WebGPUConstants.TextureFormat.RG8Snorm:\r\n case WebGPUConstants.TextureFormat.RG8Uint:\r\n case WebGPUConstants.TextureFormat.RG8Sint:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.RG16Uint:\r\n case WebGPUConstants.TextureFormat.RG16Sint:\r\n case WebGPUConstants.TextureFormat.RG16Float:\r\n case WebGPUConstants.TextureFormat.RG32Uint:\r\n case WebGPUConstants.TextureFormat.RG32Sint:\r\n case WebGPUConstants.TextureFormat.RG32Float:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n return 2;\r\n\r\n case WebGPUConstants.TextureFormat.RGB9E5UFloat:\r\n case WebGPUConstants.TextureFormat.RG11B10UFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n return 3;\r\n\r\n case WebGPUConstants.TextureFormat.RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA8Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA8Uint:\r\n case WebGPUConstants.TextureFormat.RGBA8Sint:\r\n case WebGPUConstants.TextureFormat.BGRA8Unorm:\r\n case WebGPUConstants.TextureFormat.BGRA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGB10A2UINT:\r\n case WebGPUConstants.TextureFormat.RGB10A2Unorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA16Uint:\r\n case WebGPUConstants.TextureFormat.RGBA16Sint:\r\n case WebGPUConstants.TextureFormat.RGBA16Float:\r\n case WebGPUConstants.TextureFormat.RGBA32Uint:\r\n case WebGPUConstants.TextureFormat.RGBA32Sint:\r\n case WebGPUConstants.TextureFormat.RGBA32Float:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n return 4;\r\n }\r\n\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unknown format ${format}!`;\r\n }\r\n\r\n public static HasStencilAspect(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static HasDepthAndStencilAspects(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static GetDepthFormatOnly(format: GPUTextureFormat): GPUTextureFormat {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n return WebGPUConstants.TextureFormat.Depth16Unorm;\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n return WebGPUConstants.TextureFormat.Depth24Plus;\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return WebGPUConstants.TextureFormat.Depth24Plus;\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n return WebGPUConstants.TextureFormat.Depth32Float;\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n return WebGPUConstants.TextureFormat.Depth32Float;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n public static GetSample(sampleCount: number) {\r\n // WebGPU only supports 1 or 4\r\n return sampleCount > 1 ? 4 : 1;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webgpuTextureHelper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuTextureHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,gBAAgB;AAChB,MAAM,OAAO,mBAAmB;IACrB,MAAM,CAAC,sBAAsB,CAAC,KAAa,EAAE,MAAc;QAC9D,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAEM,MAAM,CAAC,wBAAwB,CAAC,MAAwB;QAC3D,QAAQ,MAAM,EAAE,CAAC;YACb,kCAAkC;YAClC,2DAA2C;YAC3C,yDAA0C;YAC1C,6DAA4C;YAC5C,2DAA2C;YAC3C,iEAA8C;YAC9C,0EAAkD;YAClD,+DAA6C;YAC7C,iEAA8C;YAC9C,0EAAkD;YAClD,mEAA+C,CAAC,4CAA4C;YAC5F,qEAAgD,CAAC,4CAA4C;YAC7F,qEAAgD,CAAC,4CAA4C;YAC7F,uEAAiD,CAAC,4CAA4C;YAC9F,uEAAgD;YAChD,gFAAoD;YACpD,yEAAiD;YACjD,mEAA8C;YAC9C,uEAAgD;YAChD,gFAAoD;YACpD,uEAAgD;YAChD,gFAAoD;YACpD,iEAA6C;YAC7C,uEAAgD;YAChD,gFAAoD;YACpD,wEAAiD;YACjD,iFAAqD;YACrD,4EAAmD;YACnD,qFAAuD;YACvD,0EAAkD;YAClD,mFAAsD;Y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CAAC;QACpB,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,kBAAkB,CAAC,MAAwB;QACrD,QAAQ,MAAM,EAAE,CAAC;YACb;gBACI,uEAAkD;YACtD;gBACI,qEAAiD;YACrD;gBACI,qEAAiD;YACrD;gBACI,uEAAkD;YACtD;gBACI,uEAAkD;QAC1D,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,WAAmB;QACvC,8BAA8B;QAC9B,OAAO,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;CACJ","sourcesContent":["/* eslint-disable babylonjs/available */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nimport * as WebGPUConstants from \"./webgpuConstants\";\r\nimport { ILog2 } from \"../../Maths/math.scalar.functions\";\r\nimport { Constants } from \"../constants\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { HardwareTextureWrapper } from \"../../Materials/Textures/hardwareTextureWrapper\";\r\n\r\n/** @internal */\r\nexport class WebGPUTextureHelper {\r\n public static ComputeNumMipmapLevels(width: number, height: number) {\r\n return ILog2(Math.max(width, height)) + 1;\r\n }\r\n\r\n public static GetTextureTypeFromFormat(format: GPUTextureFormat): number {\r\n switch (format) {\r\n // One Component = 8 bits unsigned\r\n case WebGPUConstants.TextureFormat.R8Unorm:\r\n case WebGPUConstants.TextureFormat.R8Uint:\r\n case WebGPUConstants.TextureFormat.RG8Unorm:\r\n case WebGPUConstants.TextureFormat.RG8Uint:\r\n case WebGPUConstants.TextureFormat.RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA8Uint:\r\n case WebGPUConstants.TextureFormat.BGRA8Unorm:\r\n case WebGPUConstants.TextureFormat.BGRA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGB10A2UINT: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.RGB10A2Unorm: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.RGB9E5UFloat: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.RG11B10UFloat: // composite format - let's say it's byte...\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n return Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n\r\n // One Component = 8 bits signed\r\n case WebGPUConstants.TextureFormat.R8Snorm:\r\n case WebGPUConstants.TextureFormat.R8Sint:\r\n case WebGPUConstants.TextureFormat.RG8Snorm:\r\n case WebGPUConstants.TextureFormat.RG8Sint:\r\n case WebGPUConstants.TextureFormat.RGBA8Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA8Sint:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n return Constants.TEXTURETYPE_BYTE;\r\n\r\n // One component = 16 bits unsigned\r\n case WebGPUConstants.TextureFormat.R16Uint:\r\n case WebGPUConstants.TextureFormat.R16Unorm:\r\n case WebGPUConstants.TextureFormat.RG16Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Unorm:\r\n case WebGPUConstants.TextureFormat.RG16Uint:\r\n case WebGPUConstants.TextureFormat.RGBA16Uint:\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n return Constants.TEXTURETYPE_UNSIGNED_SHORT;\r\n\r\n // One component = 16 bits signed\r\n case WebGPUConstants.TextureFormat.R16Sint:\r\n case WebGPUConstants.TextureFormat.R16Snorm:\r\n case WebGPUConstants.TextureFormat.RG16Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Snorm:\r\n case WebGPUConstants.TextureFormat.RG16Sint:\r\n case WebGPUConstants.TextureFormat.RGBA16Sint:\r\n return Constants.TEXTURETYPE_SHORT;\r\n\r\n case WebGPUConstants.TextureFormat.R16Float:\r\n case WebGPUConstants.TextureFormat.RG16Float:\r\n case WebGPUConstants.TextureFormat.RGBA16Float:\r\n return Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n // One component = 32 bits unsigned\r\n case WebGPUConstants.TextureFormat.R32Uint:\r\n case WebGPUConstants.TextureFormat.RG32Uint:\r\n case WebGPUConstants.TextureFormat.RGBA32Uint:\r\n return Constants.TEXTURETYPE_UNSIGNED_INTEGER;\r\n\r\n // One component = 32 bits signed\r\n case WebGPUConstants.TextureFormat.R32Sint:\r\n case WebGPUConstants.TextureFormat.RG32Sint:\r\n case WebGPUConstants.TextureFormat.RGBA32Sint:\r\n return Constants.TEXTURETYPE_UNSIGNED_INTEGER;\r\n\r\n case WebGPUConstants.TextureFormat.R32Float:\r\n case WebGPUConstants.TextureFormat.RG32Float:\r\n case WebGPUConstants.TextureFormat.RGBA32Float:\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n return Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n public static GetBlockInformationFromFormat(format: GPUTextureFormat): { width: number; height: number; length: number } {\r\n switch (format) {\r\n // 8 bits formats\r\n case WebGPUConstants.TextureFormat.R8Unorm:\r\n case WebGPUConstants.TextureFormat.R8Snorm:\r\n case WebGPUConstants.TextureFormat.R8Uint:\r\n case WebGPUConstants.TextureFormat.R8Sint:\r\n return { width: 1, height: 1, length: 1 };\r\n\r\n // 16 bits formats\r\n case WebGPUConstants.TextureFormat.R16Uint:\r\n case WebGPUConstants.TextureFormat.R16Sint:\r\n case WebGPUConstants.TextureFormat.R16Unorm:\r\n case WebGPUConstants.TextureFormat.RG16Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Unorm:\r\n case WebGPUConstants.TextureFormat.R16Snorm:\r\n case WebGPUConstants.TextureFormat.RG16Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Snorm:\r\n case WebGPUConstants.TextureFormat.R16Float:\r\n case WebGPUConstants.TextureFormat.RG8Unorm:\r\n case WebGPUConstants.TextureFormat.RG8Snorm:\r\n case WebGPUConstants.TextureFormat.RG8Uint:\r\n case WebGPUConstants.TextureFormat.RG8Sint:\r\n return { width: 1, height: 1, length: 2 };\r\n\r\n // 32 bits formats\r\n case WebGPUConstants.TextureFormat.R32Uint:\r\n case WebGPUConstants.TextureFormat.R32Sint:\r\n case WebGPUConstants.TextureFormat.R32Float:\r\n case WebGPUConstants.TextureFormat.RG16Uint:\r\n case WebGPUConstants.TextureFormat.RG16Sint:\r\n case WebGPUConstants.TextureFormat.RG16Float:\r\n case WebGPUConstants.TextureFormat.RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA8Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA8Uint:\r\n case WebGPUConstants.TextureFormat.RGBA8Sint:\r\n case WebGPUConstants.TextureFormat.BGRA8Unorm:\r\n case WebGPUConstants.TextureFormat.BGRA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGB9E5UFloat:\r\n case WebGPUConstants.TextureFormat.RGB10A2UINT:\r\n case WebGPUConstants.TextureFormat.RGB10A2Unorm:\r\n case WebGPUConstants.TextureFormat.RG11B10UFloat:\r\n return { width: 1, height: 1, length: 4 };\r\n\r\n // 64 bits formats\r\n case WebGPUConstants.TextureFormat.RG32Uint:\r\n case WebGPUConstants.TextureFormat.RG32Sint:\r\n case WebGPUConstants.TextureFormat.RG32Float:\r\n case WebGPUConstants.TextureFormat.RGBA16Uint:\r\n case WebGPUConstants.TextureFormat.RGBA16Sint:\r\n case WebGPUConstants.TextureFormat.RGBA16Float:\r\n return { width: 1, height: 1, length: 8 };\r\n\r\n // 128 bits formats\r\n case WebGPUConstants.TextureFormat.RGBA32Uint:\r\n case WebGPUConstants.TextureFormat.RGBA32Sint:\r\n case WebGPUConstants.TextureFormat.RGBA32Float:\r\n return { width: 1, height: 1, length: 16 };\r\n\r\n // Depth and stencil formats\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No fixed size for Stencil8 format!\";\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n return { width: 1, height: 1, length: 2 };\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No fixed size for Depth24Plus format!\";\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No fixed size for Depth24PlusStencil8 format!\";\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n return { width: 1, height: 1, length: 4 };\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n return { width: 1, height: 1, length: 5 };\r\n\r\n // BC compressed formats usable if \"texture-compression-bc\" is both\r\n // supported by the device/user agent and enabled in requestDevice.\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n return { width: 4, height: 4, length: 16 };\r\n\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n return { width: 4, height: 4, length: 8 };\r\n\r\n // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\r\n // supported by the device/user agent and enabled in requestDevice.\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n return { width: 4, height: 4, length: 8 };\r\n\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n return { width: 4, height: 4, length: 16 };\r\n\r\n // ASTC compressed formats usable if \"texture-compression-astc\" is both\r\n // supported by the device/user agent and enabled in requestDevice.\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n return { width: 4, height: 4, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n return { width: 5, height: 4, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n return { width: 5, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n return { width: 6, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n return { width: 6, height: 6, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n return { width: 8, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n return { width: 8, height: 6, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n return { width: 8, height: 8, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n return { width: 10, height: 5, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n return { width: 10, height: 6, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n return { width: 10, height: 8, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n return { width: 10, height: 10, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n return { width: 12, height: 10, length: 16 };\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n return { width: 12, height: 12, length: 16 };\r\n }\r\n\r\n return { width: 1, height: 1, length: 4 };\r\n }\r\n\r\n public static IsHardwareTexture(texture: HardwareTextureWrapper | GPUTexture): texture is HardwareTextureWrapper {\r\n return !!(texture as HardwareTextureWrapper).release;\r\n }\r\n\r\n public static IsInternalTexture(texture: InternalTexture | GPUTexture): texture is InternalTexture {\r\n return !!(texture as InternalTexture).dispose;\r\n }\r\n\r\n public static IsImageBitmap(imageBitmap: ImageBitmap | { width: number; height: number }): imageBitmap is ImageBitmap {\r\n return (imageBitmap as ImageBitmap).close !== undefined;\r\n }\r\n\r\n public static IsImageBitmapArray(imageBitmap: ImageBitmap[] | { width: number; height: number }): imageBitmap is ImageBitmap[] {\r\n return Array.isArray(imageBitmap as ImageBitmap[]) && (imageBitmap as ImageBitmap[])[0].close !== undefined;\r\n }\r\n\r\n public static IsCompressedFormat(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static GetWebGPUTextureFormat(type: number, format: number, useSRGBBuffer = false): GPUTextureFormat {\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_DEPTH16:\r\n return WebGPUConstants.TextureFormat.Depth16Unorm;\r\n case Constants.TEXTUREFORMAT_DEPTH24:\r\n return WebGPUConstants.TextureFormat.Depth24Plus;\r\n case Constants.TEXTUREFORMAT_DEPTH24_STENCIL8:\r\n return WebGPUConstants.TextureFormat.Depth24PlusStencil8;\r\n case Constants.TEXTUREFORMAT_DEPTH32_FLOAT:\r\n return WebGPUConstants.TextureFormat.Depth32Float;\r\n case Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8:\r\n return WebGPUConstants.TextureFormat.Depth32FloatStencil8;\r\n case Constants.TEXTUREFORMAT_STENCIL8:\r\n return WebGPUConstants.TextureFormat.Stencil8;\r\n\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC7RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:\r\n return WebGPUConstants.TextureFormat.BC6HRGBUFloat;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:\r\n return WebGPUConstants.TextureFormat.BC6HRGBFloat;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC3RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC2RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB : WebGPUConstants.TextureFormat.BC1RGBAUnorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB : WebGPUConstants.TextureFormat.ASTC4x4Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB : WebGPUConstants.TextureFormat.ETC2RGB8Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB : WebGPUConstants.TextureFormat.ETC2RGBA8Unorm;\r\n }\r\n\r\n switch (type) {\r\n case Constants.TEXTURETYPE_BYTE:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R8Snorm;\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG8Snorm;\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R8Sint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG8Sint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA8Sint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA8Snorm;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R8Unorm;\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG8Unorm;\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.RGBA8UnormSRGB : WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n case Constants.TEXTUREFORMAT_BGRA:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.BGRA8UnormSRGB : WebGPUConstants.TextureFormat.BGRA8Unorm;\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R8Uint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG8Uint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA8Uint;\r\n case Constants.TEXTUREFORMAT_ALPHA:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_ALPHA format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_LUMINANCE:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU\";\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n }\r\n case Constants.TEXTURETYPE_SHORT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R16Sint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG16Sint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA16Sint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA16Sint;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R16Uint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG16Uint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA16Uint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA16Uint;\r\n }\r\n case Constants.TEXTURETYPE_INT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R32Sint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG32Sint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA32Sint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA32Sint;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED_INTEGER:\r\n return WebGPUConstants.TextureFormat.R32Uint;\r\n case Constants.TEXTUREFORMAT_RG_INTEGER:\r\n return WebGPUConstants.TextureFormat.RG32Uint;\r\n case Constants.TEXTUREFORMAT_RGB_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGBA32Uint;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA32Uint;\r\n }\r\n case Constants.TEXTURETYPE_FLOAT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R32Float; // By default. Other possibility is R16Float.\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG32Float; // By default. Other possibility is RG16Float.\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGBA32Float; // By default. Other possibility is RGBA16Float.\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA32Float;\r\n }\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RED:\r\n return WebGPUConstants.TextureFormat.R16Float;\r\n case Constants.TEXTUREFORMAT_RG:\r\n return WebGPUConstants.TextureFormat.RG16Float;\r\n case Constants.TEXTUREFORMAT_RGB:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGB format not supported in WebGPU\";\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGBA16Float;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGBA16Float;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU\";\r\n case Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RG11B10UFloat;\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV\";\r\n default:\r\n return WebGPUConstants.TextureFormat.RG11B10UFloat;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGB9E5UFloat;\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV\";\r\n default:\r\n return WebGPUConstants.TextureFormat.RGB9E5UFloat;\r\n }\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU\";\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU\";\r\n case Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:\r\n switch (format) {\r\n case Constants.TEXTUREFORMAT_RGBA:\r\n return WebGPUConstants.TextureFormat.RGB10A2Unorm;\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER:\r\n return WebGPUConstants.TextureFormat.RGB10A2UINT;\r\n default:\r\n return WebGPUConstants.TextureFormat.RGB10A2Unorm;\r\n }\r\n }\r\n\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.RGBA8UnormSRGB : WebGPUConstants.TextureFormat.RGBA8Unorm;\r\n }\r\n\r\n public static GetNumChannelsFromWebGPUTextureFormat(format: GPUTextureFormat): number {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.R8Unorm:\r\n case WebGPUConstants.TextureFormat.R8Snorm:\r\n case WebGPUConstants.TextureFormat.R8Uint:\r\n case WebGPUConstants.TextureFormat.R8Sint:\r\n case WebGPUConstants.TextureFormat.BC4RUnorm:\r\n case WebGPUConstants.TextureFormat.BC4RSnorm:\r\n case WebGPUConstants.TextureFormat.R16Uint:\r\n case WebGPUConstants.TextureFormat.R16Sint:\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n case WebGPUConstants.TextureFormat.R16Float:\r\n case WebGPUConstants.TextureFormat.R16Unorm:\r\n case WebGPUConstants.TextureFormat.R16Snorm:\r\n case WebGPUConstants.TextureFormat.R32Uint:\r\n case WebGPUConstants.TextureFormat.R32Sint:\r\n case WebGPUConstants.TextureFormat.R32Float:\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n case WebGPUConstants.TextureFormat.EACR11Unorm:\r\n case WebGPUConstants.TextureFormat.EACR11Snorm:\r\n return 1;\r\n\r\n case WebGPUConstants.TextureFormat.RG8Unorm:\r\n case WebGPUConstants.TextureFormat.RG8Snorm:\r\n case WebGPUConstants.TextureFormat.RG8Uint:\r\n case WebGPUConstants.TextureFormat.RG8Sint:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.BC5RGUnorm:\r\n case WebGPUConstants.TextureFormat.BC5RGSnorm:\r\n case WebGPUConstants.TextureFormat.RG16Uint:\r\n case WebGPUConstants.TextureFormat.RG16Sint:\r\n case WebGPUConstants.TextureFormat.RG16Float:\r\n case WebGPUConstants.TextureFormat.RG16Unorm:\r\n case WebGPUConstants.TextureFormat.RG16Snorm:\r\n case WebGPUConstants.TextureFormat.RG32Uint:\r\n case WebGPUConstants.TextureFormat.RG32Sint:\r\n case WebGPUConstants.TextureFormat.RG32Float:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n case WebGPUConstants.TextureFormat.EACRG11Unorm:\r\n case WebGPUConstants.TextureFormat.EACRG11Snorm:\r\n return 2;\r\n\r\n case WebGPUConstants.TextureFormat.RGB9E5UFloat:\r\n case WebGPUConstants.TextureFormat.RG11B10UFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBUFloat:\r\n case WebGPUConstants.TextureFormat.BC6HRGBFloat:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB:\r\n return 3;\r\n\r\n case WebGPUConstants.TextureFormat.RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA8Snorm:\r\n case WebGPUConstants.TextureFormat.RGBA8Uint:\r\n case WebGPUConstants.TextureFormat.RGBA8Sint:\r\n case WebGPUConstants.TextureFormat.BGRA8Unorm:\r\n case WebGPUConstants.TextureFormat.BGRA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA16Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Snorm:\r\n case WebGPUConstants.TextureFormat.RGB10A2UINT:\r\n case WebGPUConstants.TextureFormat.RGB10A2Unorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC7RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC3RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC2RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnorm:\r\n case WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB:\r\n case WebGPUConstants.TextureFormat.RGBA16Uint:\r\n case WebGPUConstants.TextureFormat.RGBA16Sint:\r\n case WebGPUConstants.TextureFormat.RGBA16Float:\r\n case WebGPUConstants.TextureFormat.RGBA32Uint:\r\n case WebGPUConstants.TextureFormat.RGBA32Sint:\r\n case WebGPUConstants.TextureFormat.RGBA32Float:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGB8A1UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8Unorm:\r\n case WebGPUConstants.TextureFormat.ETC2RGBA8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC4x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x4Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC5x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC6x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC8x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x5Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x6Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x8Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC10x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x10Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB:\r\n case WebGPUConstants.TextureFormat.ASTC12x12Unorm:\r\n case WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB:\r\n return 4;\r\n }\r\n\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unknown format ${format}!`;\r\n }\r\n\r\n public static HasStencilAspect(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Stencil8:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static HasDepthAndStencilAspects(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public static GetDepthFormatOnly(format: GPUTextureFormat): GPUTextureFormat {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n return WebGPUConstants.TextureFormat.Depth16Unorm;\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n return WebGPUConstants.TextureFormat.Depth24Plus;\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n return WebGPUConstants.TextureFormat.Depth24Plus;\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n return WebGPUConstants.TextureFormat.Depth32Float;\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\r\n return WebGPUConstants.TextureFormat.Depth32Float;\r\n }\r\n\r\n return format;\r\n }\r\n\r\n public static GetSample(sampleCount: number) {\r\n // WebGPU only supports 1 or 4\r\n return sampleCount > 1 ? 4 : 1;\r\n }\r\n}\r\n"]}
@@ -251,6 +251,12 @@ export const renderableTextureFormatToIndex = {
251
251
  "depth24plus-stencil8": 36,
252
252
  depth32float: 37,
253
253
  "depth32float-stencil8": 38,
254
+ r16unorm: 39,
255
+ rg16unorm: 40,
256
+ rgba16unorm: 41,
257
+ r16snorm: 42,
258
+ rg16snorm: 43,
259
+ rgba16snorm: 44,
254
260
  };
255
261
  /** @internal */
256
262
  export class WebGPUTextureManager {
@@ -777,7 +783,7 @@ export class WebGPUTextureManager {
777
783
  }
778
784
  createGPUTextureForInternalTexture(texture, width, height, depth, creationFlags, dontCreateMSAATexture) {
779
785
  if (!texture._hardwareTexture) {
780
- texture._hardwareTexture = new WebGPUHardwareTexture();
786
+ texture._hardwareTexture = new WebGPUHardwareTexture(this._engine);
781
787
  }
782
788
  if (width === undefined) {
783
789
  width = texture.width;
@@ -865,7 +871,7 @@ export class WebGPUTextureManager {
865
871
  }
866
872
  const width = texture.width;
867
873
  const height = texture.height;
868
- const gpuMSAATexture = this.createTexture({ width, height, layers: 1 }, false, false, false, false, false, gpuTextureWrapper.format, samples, this._commandEncoderForCreation, 16 /* WebGPUConstants.TextureUsage.RenderAttachment */, 0, texture.label ? "MSAA" + texture.label : undefined);
874
+ const gpuMSAATexture = this.createTexture({ width, height, layers: 1 }, false, false, false, false, false, gpuTextureWrapper.format, samples, this._commandEncoderForCreation, 16 /* WebGPUConstants.TextureUsage.RenderAttachment */, 0, texture.label ? "MSAA_" + texture.label : "MSAA");
869
875
  gpuTextureWrapper.setMSAATexture(gpuMSAATexture, index);
870
876
  }
871
877
  //------------------------------------------------------------------------------