@onerjs/core 8.31.8 → 8.32.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.
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +4 -0
- package/Behaviors/Cameras/autoRotationBehavior.js +7 -0
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Cameras/bouncingBehavior.d.ts +5 -0
- package/Behaviors/Cameras/bouncingBehavior.js +8 -0
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +4 -0
- package/Behaviors/Cameras/framingBehavior.js +7 -0
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +7 -2
- package/Behaviors/Cameras/interpolatingBehavior.js +12 -4
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
- package/Behaviors/Meshes/attachToBoxBehavior.d.ts +5 -0
- package/Behaviors/Meshes/attachToBoxBehavior.js +8 -1
- package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +5 -2
- package/Behaviors/Meshes/baseSixDofDragBehavior.js +8 -0
- package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.d.ts +5 -0
- package/Behaviors/Meshes/fadeInOutBehavior.js +6 -0
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.d.ts +5 -0
- package/Behaviors/Meshes/handConstraintBehavior.js +8 -0
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Behaviors/Meshes/multiPointerScaleBehavior.d.ts +5 -0
- package/Behaviors/Meshes/multiPointerScaleBehavior.js +8 -0
- package/Behaviors/Meshes/multiPointerScaleBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.d.ts +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/surfaceMagnetismBehavior.d.ts +5 -0
- package/Behaviors/Meshes/surfaceMagnetismBehavior.js +7 -0
- package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
- package/Behaviors/behavior.d.ts +4 -0
- package/Behaviors/behavior.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +4 -5
- package/Cameras/geospatialCamera.js +42 -29
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.js +1 -1
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +2 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -2
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -0
- package/Engines/WebGPU/webgpuTextureHelper.js +11 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -0
- package/Engines/WebGPU/webgpuTextureManager.js +100 -9
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +6 -1
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +7 -4
- package/Engines/webgpuEngine.js +45 -16
- package/Engines/webgpuEngine.js.map +1 -1
- package/Helpers/sceneHelpers.js +1 -1
- package/Helpers/sceneHelpers.js.map +1 -1
- package/Lights/index.d.ts +1 -0
- package/Lights/index.js +1 -0
- package/Lights/index.js.map +1 -1
- package/Lights/lightingVolume.d.ts +89 -0
- package/Lights/lightingVolume.js +426 -0
- package/Lights/lightingVolume.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +7 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +19 -5
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +8 -5
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/floatingOriginMatrixOverrides.js +6 -5
- package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +1 -0
- package/Materials/uniformBuffer.js +8 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +5 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +138 -45
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Particles/solidParticle.d.ts +9 -0
- package/Particles/solidParticle.js +11 -0
- package/Particles/solidParticle.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +28 -0
- package/Particles/solidParticleSystem.js +75 -0
- package/Particles/solidParticleSystem.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.fragment.d.ts +0 -1
- package/ShadersWGSL/gaussianSplattingDepth.fragment.js +0 -2
- package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.d.ts +5 -0
- package/ShadersWGSL/lightingVolume.compute.js +27 -0
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -0
- package/package.json +1 -1
- package/scene.js +6 -4
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.multiRender.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.multiRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAErG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,E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C;AAEF,YAAY,CAAC,SAAS,CAAC,uBAAuB,GAAG;IAC7C,mKAAmK;AACvK,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,sCAAsC,GAAG;IAC5D,oJAAoJ;AACxJ,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IMultiRenderTargetOptions } from \"../../../Materials/Textures/multiRenderTarget\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { TextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport type { RenderTargetWrapper } from \"../../renderTargetWrapper\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPURenderTargetWrapper } from \"../webgpuRenderTargetWrapper\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\ndeclare module \"../../abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /**\r\n * Unbind a list of render target textures from the webGL context\r\n * This is used only when drawBuffer extension or webGL2 are active\r\n * @param rtWrapper defines the render target wrapper to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void;\r\n\r\n /**\r\n * Create a multi render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multiple-render-target\r\n * @param size defines the size of the texture\r\n * @param options defines the creation options\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns a new render target wrapper ready to render textures\r\n */\r\n createMultipleRenderTarget(size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper;\r\n\r\n /**\r\n * Update the sample count for a given multiple render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;\r\n\r\n /**\r\n * Generates mipmaps for the texture of the (multi) render target\r\n * @param texture The render target containing the textures to generate the mipmaps for\r\n */\r\n generateMipMapsMultiFramebuffer(texture: RenderTargetWrapper): void;\r\n\r\n /**\r\n * Resolves the MSAA textures of the (multi) render target into their non-MSAA version.\r\n * Note that if \"texture\" is not a MSAA render target, no resolve is performed.\r\n * @param texture The render target texture containing the MSAA textures to resolve\r\n */\r\n resolveMultiFramebuffer(texture: RenderTargetWrapper): void;\r\n\r\n /**\r\n * Select a subsets of attachments to draw to.\r\n * @param attachments gl attachments\r\n */\r\n bindAttachments(attachments: number[]): void;\r\n\r\n /**\r\n * Creates a layout object to draw/clear on specific textures in a MRT\r\n * @param textureStatus textureStatus[i] indicates if the i-th is active\r\n * @param backBufferLayout if true, the layout will be built to account for the back buffer only, and textureStatus won't be used\r\n * @returns A layout to be fed to the engine, calling `bindAttachments`.\r\n */\r\n buildTextureLayout(textureStatus: boolean[], backBufferLayout?: boolean): number[];\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is the canvas frame buffer\r\n */\r\n restoreSingleAttachment(): void;\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is not the canvas frame buffer\r\n */\r\n restoreSingleAttachmentForRenderTarget(): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (\r\n rtWrapper: RenderTargetWrapper,\r\n disableGenerateMipMaps: boolean = false,\r\n onBeforeUnbind?: () => void\r\n): void {\r\n if (onBeforeUnbind) {\r\n onBeforeUnbind();\r\n }\r\n\r\n this._endCurrentRenderPass();\r\n\r\n if (!disableGenerateMipMaps) {\r\n this.generateMipMapsMultiFramebuffer(rtWrapper);\r\n }\r\n\r\n this._currentRenderTarget = null;\r\n\r\n this._mrtAttachments = [];\r\n this._cacheRenderPipeline.setMRT([]);\r\n this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);\r\n};\r\n\r\nWebGPUEngine.prototype.createMultipleRenderTarget = function (size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper {\r\n let generateMipMaps = false;\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let generateDepthTexture = false;\r\n let depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH16;\r\n let textureCount = 1;\r\n let samples = 1;\r\n\r\n const defaultType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n const defaultSamplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n const defaultUseSRGBBuffer = false;\r\n const defaultFormat = Constants.TEXTUREFORMAT_RGBA;\r\n const defaultTarget = Constants.TEXTURE_2D;\r\n\r\n let types: number[] = [];\r\n let samplingModes: number[] = [];\r\n let useSRGBBuffers: boolean[] = [];\r\n let formats: number[] = [];\r\n let targets: number[] = [];\r\n let faceIndex: number[] = [];\r\n let layerIndex: number[] = [];\r\n let layers: number[] = [];\r\n let labels: string[] = [];\r\n let creationFlags: number[] = [];\r\n let dontCreateTextures = false;\r\n\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size) as WebGPURenderTargetWrapper;\r\n\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps ?? false;\r\n generateDepthBuffer = options.generateDepthBuffer ?? true;\r\n generateStencilBuffer = options.generateStencilBuffer ?? false;\r\n generateDepthTexture = options.generateDepthTexture ?? false;\r\n textureCount = options.textureCount ?? 1;\r\n depthTextureFormat = options.depthTextureFormat ?? Constants.TEXTUREFORMAT_DEPTH16;\r\n types = options.types || types;\r\n samplingModes = options.samplingModes || samplingModes;\r\n useSRGBBuffers = options.useSRGBBuffers || useSRGBBuffers;\r\n formats = options.formats || formats;\r\n targets = options.targetTypes || targets;\r\n faceIndex = options.faceIndex || faceIndex;\r\n layerIndex = options.layerIndex || layerIndex;\r\n layers = options.layerCounts || layers;\r\n labels = options.labels || labels;\r\n creationFlags = options.creationFlags || creationFlags;\r\n samples = options.samples ?? samples;\r\n dontCreateTextures = options.dontCreateTextures ?? false;\r\n }\r\n\r\n const width = (<{ width: number; height: number }>size).width ?? <number>size;\r\n const height = (<{ width: number; height: number }>size).height ?? <number>size;\r\n\r\n const textures: InternalTexture[] = [];\r\n const attachments: number[] = [];\r\n const defaultAttachments: number[] = [];\r\n\r\n rtWrapper.label = options?.label ?? \"MultiRenderTargetWrapper\";\r\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\r\n rtWrapper._attachments = attachments;\r\n rtWrapper._defaultAttachments = defaultAttachments;\r\n\r\n let depthStencilTexture: Nullable<InternalTexture> = null;\r\n if ((generateDepthBuffer || generateStencilBuffer || generateDepthTexture) && !dontCreateTextures) {\r\n if (!generateDepthTexture) {\r\n // The caller doesn't want a depth texture, so we are free to use the depth texture format we want.\r\n // So, we will align with what the WebGL engine does\r\n if (generateDepthBuffer && generateStencilBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH24_STENCIL8;\r\n } else if (generateDepthBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n } else {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_STENCIL8;\r\n }\r\n }\r\n depthStencilTexture = rtWrapper.createDepthStencilTexture(0, false, generateStencilBuffer, 1, depthTextureFormat, rtWrapper.label + \"-DepthStencil\");\r\n }\r\n\r\n const mipmapsCreationOnly = options !== undefined && typeof options === \"object\" && options.createMipMaps && !generateMipMaps;\r\n\r\n for (let i = 0; i < textureCount; i++) {\r\n let samplingMode = samplingModes[i] || defaultSamplingMode;\r\n let type = types[i] || defaultType;\r\n\r\n const format = formats[i] || defaultFormat;\r\n const useSRGBBuffer = (useSRGBBuffers[i] || defaultUseSRGBBuffer) && this._caps.supportSRGBBuffers;\r\n\r\n const target = targets[i] || defaultTarget;\r\n const layerCount = layers[i] ?? 1;\r\n const creationFlag = creationFlags[i];\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n\r\n attachments.push(i + 1);\r\n defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);\r\n\r\n if (target === -1 || dontCreateTextures) {\r\n continue;\r\n }\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\r\n textures[i] = texture;\r\n\r\n switch (target) {\r\n case Constants.TEXTURE_CUBE_MAP:\r\n texture.isCube = true;\r\n break;\r\n case Constants.TEXTURE_3D:\r\n texture.is3D = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n case Constants.TEXTURE_2D_ARRAY:\r\n texture.is2DArray = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n }\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n texture.format = format;\r\n texture.label = labels[i] ?? rtWrapper.label + \"-Texture\" + i;\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n if (mipmapsCreationOnly) {\r\n // createGPUTextureForInternalTexture will only create a texture with mipmaps if generateMipMaps is true, as InternalTexture has no createMipMaps property, separate from generateMipMaps.\r\n texture.generateMipMaps = true;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, undefined, undefined, undefined, creationFlag, true);\r\n\r\n if (mipmapsCreationOnly) {\r\n texture.generateMipMaps = false;\r\n }\r\n }\r\n\r\n if (depthStencilTexture) {\r\n depthStencilTexture.incrementReferences();\r\n textures[textureCount] = depthStencilTexture;\r\n this._internalTexturesCache.push(depthStencilTexture);\r\n }\r\n\r\n rtWrapper.setTextures(textures);\r\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\r\n\r\n if (!dontCreateTextures) {\r\n this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);\r\n } else {\r\n rtWrapper._samples = samples;\r\n }\r\n\r\n return rtWrapper;\r\n};\r\n\r\nWebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number {\r\n if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures.length === 0 || rtWrapper.textures[0].samples === samples) {\r\n return samples;\r\n }\r\n\r\n const count = rtWrapper.textures.length;\r\n\r\n if (count === 0) {\r\n return 1;\r\n }\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n const gpuTextureWrapper = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n gpuTextureWrapper?.releaseMSAATexture(rtWrapper.getBaseArrayLayer(i));\r\n }\r\n\r\n // Note that rtWrapper.textures can't have null textures, lastTextureIsDepthTexture can't be true if rtWrapper._depthStencilTexture is null\r\n const lastTextureIsDepthTexture = rtWrapper._depthStencilTexture === rtWrapper.textures[count - 1];\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n this._textureHelper.createMSAATexture(texture, samples, false, rtWrapper.getBaseArrayLayer(i));\r\n texture.samples = samples;\r\n }\r\n\r\n // Note that the last texture of textures is the depth texture if the depth texture has been generated by the MRT class and so the MSAA texture\r\n // will be recreated for this texture by the loop above: in that case, there's no need to create the MSAA texture for rtWrapper._depthStencilTexture\r\n // because rtWrapper._depthStencilTexture is the same texture than the depth texture\r\n if (rtWrapper._depthStencilTexture && !lastTextureIsDepthTexture) {\r\n this._textureHelper.createMSAATexture(rtWrapper._depthStencilTexture, samples);\r\n rtWrapper._depthStencilTexture.samples = samples;\r\n }\r\n\r\n rtWrapper._samples = samples;\r\n\r\n return samples;\r\n};\r\n\r\nWebGPUEngine.prototype.generateMipMapsMultiFramebuffer = function (texture: RenderTargetWrapper): void {\r\n const rtWrapper = texture as WebGPURenderTargetWrapper;\r\n\r\n if (!rtWrapper.isMulti) {\r\n return;\r\n }\r\n\r\n const attachments = rtWrapper._attachments!;\r\n const count = attachments.length;\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n if (texture.generateMipMaps && !texture.isCube && !texture.is3D) {\r\n this._generateMipmaps(texture);\r\n }\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.resolveMultiFramebuffer = function (_texture: RenderTargetWrapper): void {\r\n throw new Error(\"resolveMultiFramebuffer is not yet implemented in WebGPU!\");\r\n};\r\n\r\nWebGPUEngine.prototype.bindAttachments = function (attachments: number[]): void {\r\n if (attachments.length === 0 || !this._currentRenderTarget) {\r\n return;\r\n }\r\n\r\n this._mrtAttachments = attachments;\r\n if (this._currentRenderPass) {\r\n // the render pass has already been created, we need to call setMRTAttachments to update the state of the attachments\r\n this._cacheRenderPipeline.setMRTAttachments(attachments);\r\n } else {\r\n // the render pass is not created yet so we don't need to call setMRTAttachments: it will be called as part of the render pass creation (see WebGPUEngine._startRenderTargetRenderPass)\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.buildTextureLayout = function (textureStatus: boolean[], backBufferLayout = false): number[] {\r\n const result = [];\r\n\r\n if (backBufferLayout) {\r\n result.push(1);\r\n } else {\r\n for (let i = 0; i < textureStatus.length; i++) {\r\n if (textureStatus[i]) {\r\n result.push(i + 1);\r\n } else {\r\n result.push(0);\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachment = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachmentForRenderTarget are not called in Babylon.js so it's hard to know the use case\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachmentForRenderTarget = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachment are not called in Babylon.js so it's hard to know the use case\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"engine.multiRender.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.multiRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAErG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA6ElD,YAAY,CAAC,SAAS,CAAC,qCAAqC,GAAG,UAC3D,SAA8B,EAC9B,yBAAkC,KAAK,EACvC,cAA2B;IAE3B,IAAI,cAAc,EAAE,CAAC;QACjB,cAAc,EAAE,CAAC;IACrB,CAAC;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G;IAC7C,mKAAmK;AACvK,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,sCAAsC,GAAG;IAC5D,oJAAoJ;AACxJ,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IMultiRenderTargetOptions } from \"../../../Materials/Textures/multiRenderTarget\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { TextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport type { RenderTargetWrapper } from \"../../renderTargetWrapper\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPURenderTargetWrapper } from \"../webgpuRenderTargetWrapper\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\ndeclare module \"../../abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /**\r\n * Unbind a list of render target textures from the webGL context\r\n * This is used only when drawBuffer extension or webGL2 are active\r\n * @param rtWrapper defines the render target wrapper to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void;\r\n\r\n /**\r\n * Create a multi render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multiple-render-target\r\n * @param size defines the size of the texture\r\n * @param options defines the creation options\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns a new render target wrapper ready to render textures\r\n */\r\n createMultipleRenderTarget(size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper;\r\n\r\n /**\r\n * Update the sample count for a given multiple render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;\r\n\r\n /**\r\n * Generates mipmaps for the texture of the (multi) render target\r\n * @param texture The render target containing the textures to generate the mipmaps for\r\n */\r\n generateMipMapsMultiFramebuffer(texture: RenderTargetWrapper): void;\r\n\r\n /**\r\n * Resolves the MSAA textures of the (multi) render target into their non-MSAA version.\r\n * Note that if \"texture\" is not a MSAA render target, no resolve is performed.\r\n * @param texture The render target texture containing the MSAA textures to resolve\r\n * @param resolveColors If true, resolve the color textures (default: true) - still subject to texture.resolveMSAAColors\r\n */\r\n resolveMultiFramebuffer(texture: RenderTargetWrapper, resolveColors?: boolean): void;\r\n\r\n /**\r\n * Select a subsets of attachments to draw to.\r\n * @param attachments gl attachments\r\n */\r\n bindAttachments(attachments: number[]): void;\r\n\r\n /**\r\n * Creates a layout object to draw/clear on specific textures in a MRT\r\n * @param textureStatus textureStatus[i] indicates if the i-th is active\r\n * @param backBufferLayout if true, the layout will be built to account for the back buffer only, and textureStatus won't be used\r\n * @returns A layout to be fed to the engine, calling `bindAttachments`.\r\n */\r\n buildTextureLayout(textureStatus: boolean[], backBufferLayout?: boolean): number[];\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is the canvas frame buffer\r\n */\r\n restoreSingleAttachment(): void;\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is not the canvas frame buffer\r\n */\r\n restoreSingleAttachmentForRenderTarget(): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (\r\n rtWrapper: RenderTargetWrapper,\r\n disableGenerateMipMaps: boolean = false,\r\n onBeforeUnbind?: () => void\r\n): void {\r\n if (onBeforeUnbind) {\r\n onBeforeUnbind();\r\n }\r\n\r\n this._endCurrentRenderPass();\r\n\r\n if (!rtWrapper.disableAutomaticMSAAResolve) {\r\n this.resolveMultiFramebuffer(rtWrapper, false);\r\n }\r\n\r\n if (!disableGenerateMipMaps) {\r\n this.generateMipMapsMultiFramebuffer(rtWrapper);\r\n }\r\n\r\n this._currentRenderTarget = null;\r\n\r\n this._mrtAttachments = [];\r\n this._cacheRenderPipeline.setMRT([]);\r\n this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);\r\n};\r\n\r\nWebGPUEngine.prototype.createMultipleRenderTarget = function (size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper {\r\n let generateMipMaps = false;\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let generateDepthTexture = false;\r\n let depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH16;\r\n let textureCount = 1;\r\n let samples = 1;\r\n\r\n const defaultType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n const defaultSamplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n const defaultUseSRGBBuffer = false;\r\n const defaultFormat = Constants.TEXTUREFORMAT_RGBA;\r\n const defaultTarget = Constants.TEXTURE_2D;\r\n\r\n let types: number[] = [];\r\n let samplingModes: number[] = [];\r\n let useSRGBBuffers: boolean[] = [];\r\n let formats: number[] = [];\r\n let targets: number[] = [];\r\n let faceIndex: number[] = [];\r\n let layerIndex: number[] = [];\r\n let layers: number[] = [];\r\n let labels: string[] = [];\r\n let creationFlags: number[] = [];\r\n let dontCreateTextures = false;\r\n\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size) as WebGPURenderTargetWrapper;\r\n\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps ?? false;\r\n generateDepthBuffer = options.generateDepthBuffer ?? true;\r\n generateStencilBuffer = options.generateStencilBuffer ?? false;\r\n generateDepthTexture = options.generateDepthTexture ?? false;\r\n textureCount = options.textureCount ?? 1;\r\n depthTextureFormat = options.depthTextureFormat ?? Constants.TEXTUREFORMAT_DEPTH16;\r\n types = options.types || types;\r\n samplingModes = options.samplingModes || samplingModes;\r\n useSRGBBuffers = options.useSRGBBuffers || useSRGBBuffers;\r\n formats = options.formats || formats;\r\n targets = options.targetTypes || targets;\r\n faceIndex = options.faceIndex || faceIndex;\r\n layerIndex = options.layerIndex || layerIndex;\r\n layers = options.layerCounts || layers;\r\n labels = options.labels || labels;\r\n creationFlags = options.creationFlags || creationFlags;\r\n samples = options.samples ?? samples;\r\n dontCreateTextures = options.dontCreateTextures ?? false;\r\n }\r\n\r\n const width = (<{ width: number; height: number }>size).width ?? <number>size;\r\n const height = (<{ width: number; height: number }>size).height ?? <number>size;\r\n\r\n const textures: InternalTexture[] = [];\r\n const attachments: number[] = [];\r\n const defaultAttachments: number[] = [];\r\n\r\n rtWrapper.label = options?.label ?? \"MultiRenderTargetWrapper\";\r\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\r\n rtWrapper._attachments = attachments;\r\n rtWrapper._defaultAttachments = defaultAttachments;\r\n\r\n let depthStencilTexture: Nullable<InternalTexture> = null;\r\n if ((generateDepthBuffer || generateStencilBuffer || generateDepthTexture) && !dontCreateTextures) {\r\n if (!generateDepthTexture) {\r\n // The caller doesn't want a depth texture, so we are free to use the depth texture format we want.\r\n // So, we will align with what the WebGL engine does\r\n if (generateDepthBuffer && generateStencilBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH24_STENCIL8;\r\n } else if (generateDepthBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n } else {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_STENCIL8;\r\n }\r\n }\r\n depthStencilTexture = rtWrapper.createDepthStencilTexture(0, false, generateStencilBuffer, 1, depthTextureFormat, rtWrapper.label + \"-DepthStencil\");\r\n }\r\n\r\n const mipmapsCreationOnly = options !== undefined && typeof options === \"object\" && options.createMipMaps && !generateMipMaps;\r\n\r\n for (let i = 0; i < textureCount; i++) {\r\n let samplingMode = samplingModes[i] || defaultSamplingMode;\r\n let type = types[i] || defaultType;\r\n\r\n const format = formats[i] || defaultFormat;\r\n const useSRGBBuffer = (useSRGBBuffers[i] || defaultUseSRGBBuffer) && this._caps.supportSRGBBuffers;\r\n\r\n const target = targets[i] || defaultTarget;\r\n const layerCount = layers[i] ?? 1;\r\n const creationFlag = creationFlags[i];\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n\r\n attachments.push(i + 1);\r\n defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);\r\n\r\n if (target === -1 || dontCreateTextures) {\r\n continue;\r\n }\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\r\n textures[i] = texture;\r\n\r\n switch (target) {\r\n case Constants.TEXTURE_CUBE_MAP:\r\n texture.isCube = true;\r\n break;\r\n case Constants.TEXTURE_3D:\r\n texture.is3D = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n case Constants.TEXTURE_2D_ARRAY:\r\n texture.is2DArray = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n }\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n texture.format = format;\r\n texture.label = labels[i] ?? rtWrapper.label + \"-Texture\" + i;\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n if (mipmapsCreationOnly) {\r\n // createGPUTextureForInternalTexture will only create a texture with mipmaps if generateMipMaps is true, as InternalTexture has no createMipMaps property, separate from generateMipMaps.\r\n texture.generateMipMaps = true;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, undefined, undefined, undefined, creationFlag, true);\r\n\r\n if (mipmapsCreationOnly) {\r\n texture.generateMipMaps = false;\r\n }\r\n }\r\n\r\n if (depthStencilTexture) {\r\n depthStencilTexture.incrementReferences();\r\n textures[textureCount] = depthStencilTexture;\r\n this._internalTexturesCache.push(depthStencilTexture);\r\n }\r\n\r\n rtWrapper.setTextures(textures);\r\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\r\n\r\n if (!dontCreateTextures) {\r\n this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);\r\n } else {\r\n rtWrapper._samples = samples;\r\n }\r\n\r\n return rtWrapper;\r\n};\r\n\r\nWebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number {\r\n if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures.length === 0 || rtWrapper.textures[0].samples === samples) {\r\n return samples;\r\n }\r\n\r\n const count = rtWrapper.textures.length;\r\n\r\n if (count === 0) {\r\n return 1;\r\n }\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n const gpuTextureWrapper = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n gpuTextureWrapper?.releaseMSAATexture(rtWrapper.getBaseArrayLayer(i));\r\n }\r\n\r\n // Note that rtWrapper.textures can't have null textures, lastTextureIsDepthTexture can't be true if rtWrapper._depthStencilTexture is null\r\n const lastTextureIsDepthTexture = rtWrapper._depthStencilTexture === rtWrapper.textures[count - 1];\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n this._textureHelper.createMSAATexture(texture, samples, false, rtWrapper.getBaseArrayLayer(i));\r\n texture.samples = samples;\r\n }\r\n\r\n // Note that the last texture of textures is the depth texture if the depth texture has been generated by the MRT class and so the MSAA texture\r\n // will be recreated for this texture by the loop above: in that case, there's no need to create the MSAA texture for rtWrapper._depthStencilTexture\r\n // because rtWrapper._depthStencilTexture is the same texture than the depth texture\r\n if (rtWrapper._depthStencilTexture && !lastTextureIsDepthTexture) {\r\n this._textureHelper.createMSAATexture(rtWrapper._depthStencilTexture, samples);\r\n rtWrapper._depthStencilTexture.samples = samples;\r\n }\r\n\r\n rtWrapper._samples = samples;\r\n\r\n return samples;\r\n};\r\n\r\nWebGPUEngine.prototype.generateMipMapsMultiFramebuffer = function (texture: RenderTargetWrapper): void {\r\n const rtWrapper = texture as WebGPURenderTargetWrapper;\r\n\r\n if (!rtWrapper.isMulti) {\r\n return;\r\n }\r\n\r\n const attachments = rtWrapper._attachments!;\r\n const count = attachments.length;\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n if (texture.generateMipMaps && !texture.isCube && !texture.is3D) {\r\n this._generateMipmaps(texture);\r\n }\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.resolveMultiFramebuffer = function (texture: RenderTargetWrapper, resolveColors: boolean = true): void {\r\n this.resolveFramebuffer(texture, resolveColors);\r\n};\r\n\r\nWebGPUEngine.prototype.bindAttachments = function (attachments: number[]): void {\r\n if (attachments.length === 0 || !this._currentRenderTarget) {\r\n return;\r\n }\r\n\r\n this._mrtAttachments = attachments;\r\n if (this._currentRenderPass) {\r\n // the render pass has already been created, we need to call setMRTAttachments to update the state of the attachments\r\n this._cacheRenderPipeline.setMRTAttachments(attachments);\r\n } else {\r\n // the render pass is not created yet so we don't need to call setMRTAttachments: it will be called as part of the render pass creation (see WebGPUEngine._startRenderTargetRenderPass)\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.buildTextureLayout = function (textureStatus: boolean[], backBufferLayout = false): number[] {\r\n const result = [];\r\n\r\n if (backBufferLayout) {\r\n result.push(1);\r\n } else {\r\n for (let i = 0; i < textureStatus.length; i++) {\r\n if (textureStatus[i]) {\r\n result.push(i + 1);\r\n } else {\r\n result.push(0);\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachment = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachmentForRenderTarget are not called in Babylon.js so it's hard to know the use case\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachmentForRenderTarget = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachment are not called in Babylon.js so it's hard to know the use case\r\n};\r\n"]}
|
|
@@ -23,6 +23,7 @@ export declare class WebGPUTextureHelper {
|
|
|
23
23
|
static GetWebGPUTextureFormat(type: number, format: number, useSRGBBuffer?: boolean): GPUTextureFormat;
|
|
24
24
|
static GetNumChannelsFromWebGPUTextureFormat(format: GPUTextureFormat): number;
|
|
25
25
|
static HasStencilAspect(format: GPUTextureFormat): boolean;
|
|
26
|
+
static HasDepthAspect(format: GPUTextureFormat): boolean;
|
|
26
27
|
static HasDepthAndStencilAspects(format: GPUTextureFormat): boolean;
|
|
27
28
|
static GetDepthFormatOnly(format: GPUTextureFormat): GPUTextureFormat;
|
|
28
29
|
static GetSample(sampleCount: number): 1 | 4;
|
|
@@ -681,6 +681,17 @@ export class WebGPUTextureHelper {
|
|
|
681
681
|
}
|
|
682
682
|
return false;
|
|
683
683
|
}
|
|
684
|
+
static HasDepthAspect(format) {
|
|
685
|
+
switch (format) {
|
|
686
|
+
case "depth16unorm" /* WebGPUConstants.TextureFormat.Depth16Unorm */:
|
|
687
|
+
case "depth24plus" /* WebGPUConstants.TextureFormat.Depth24Plus */:
|
|
688
|
+
case "depth24plus-stencil8" /* WebGPUConstants.TextureFormat.Depth24PlusStencil8 */:
|
|
689
|
+
case "depth32float" /* WebGPUConstants.TextureFormat.Depth32Float */:
|
|
690
|
+
case "depth32float-stencil8" /* WebGPUConstants.TextureFormat.Depth32FloatStencil8 */:
|
|
691
|
+
return true;
|
|
692
|
+
}
|
|
693
|
+
return false;
|
|
694
|
+
}
|
|
684
695
|
static HasDepthAndStencilAspects(format) {
|
|
685
696
|
switch (format) {
|
|
686
697
|
case "depth32float-stencil8" /* WebGPUConstants.TextureFormat.Depth32FloatStencil8 */:
|
|
@@ -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;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D,oFAAsD;YACtD,2EAAkD;YAClD,oFAAsD;YACtD,2EAAkD;YAClD;gBACI,OAAO,CAAC,CAAC;QACjB,CAAC;QAED,4CAA4C;QAC5C,MAAM,kBAAkB,MAAM,GAAG,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,MAAwB;QACnD,QAAQ,MAAM,EAAE,CAAC;YACb,6DAA4C;YAC5C,sFAAwD;YACxD;gBACI,OAAO,IAAI,CAAC;QACpB,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,yBAAyB,CAAC,MAAwB;QAC5D,QAAQ,MAAM,EAAE,CAAC;YACb,sFAAwD;YACxD;gBACI,OAAO,IAAI,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 { IHardwareTextureWrapper } 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.R16Snorm:\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.RG16Unorm:\r\n case WebGPUConstants.TextureFormat.RG16Snorm:\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 case WebGPUConstants.TextureFormat.RGBA16Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Snorm:\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: IHardwareTextureWrapper | GPUTexture): texture is IHardwareTextureWrapper {\r\n return !!(texture as IHardwareTextureWrapper).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"]}
|
|
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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M,EAAE,CAAC;YACb,qEAAgD;YAChD,mEAA+C;YAC/C,oFAAuD;YACvD,qEAAgD;YAChD;gBACI,OAAO,IAAI,CAAC;QACpB,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,yBAAyB,CAAC,MAAwB;QAC5D,QAAQ,MAAM,EAAE,CAAC;YACb,sFAAwD;YACxD;gBACI,OAAO,IAAI,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 { IHardwareTextureWrapper } 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.R16Snorm:\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.RG16Unorm:\r\n case WebGPUConstants.TextureFormat.RG16Snorm:\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 case WebGPUConstants.TextureFormat.RGBA16Unorm:\r\n case WebGPUConstants.TextureFormat.RGBA16Snorm:\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: IHardwareTextureWrapper | GPUTexture): texture is IHardwareTextureWrapper {\r\n return !!(texture as IHardwareTextureWrapper).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 HasDepthAspect(format: GPUTextureFormat): boolean {\r\n switch (format) {\r\n case WebGPUConstants.TextureFormat.Depth16Unorm:\r\n case WebGPUConstants.TextureFormat.Depth24Plus:\r\n case WebGPUConstants.TextureFormat.Depth24PlusStencil8:\r\n case WebGPUConstants.TextureFormat.Depth32Float:\r\n case WebGPUConstants.TextureFormat.Depth32FloatStencil8:\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"]}
|
|
@@ -44,6 +44,7 @@ export declare class WebGPUTextureManager {
|
|
|
44
44
|
generateMipmaps(gpuOrHdwTexture: GPUTexture | WebGPUHardwareTexture, format: GPUTextureFormat, mipLevelCount: number, faceIndex?: number, is3D?: boolean, commandEncoder?: GPUCommandEncoder): void;
|
|
45
45
|
createGPUTextureForInternalTexture(texture: InternalTexture, width?: number, height?: number, depth?: number, creationFlags?: number, dontCreateMSAATexture?: boolean): WebGPUHardwareTexture;
|
|
46
46
|
createMSAATexture(texture: InternalTexture, samples: number, releaseExisting?: boolean, index?: number): void;
|
|
47
|
+
resolveMSAADepthTexture(msaaTexture: GPUTexture, outputTexture: GPUTexture, commandEncoder?: GPUCommandEncoder): void;
|
|
47
48
|
updateCubeTextures(imageBitmaps: ImageBitmap[] | Uint8Array[], gpuTexture: GPUTexture, width: number, height: number, format: GPUTextureFormat, invertY?: boolean, premultiplyAlpha?: boolean, offsetX?: number, offsetY?: number): void;
|
|
48
49
|
updateTexture(imageBitmap: ImageBitmap | Uint8Array | ImageData | HTMLImageElement | HTMLVideoElement | VideoFrame | HTMLCanvasElement | OffscreenCanvas, texture: GPUTexture | InternalTexture, width: number, height: number, layers: number, format: GPUTextureFormat, faceIndex?: number, mipLevel?: number, invertY?: boolean, premultiplyAlpha?: boolean, offsetX?: number, offsetY?: number, allowGPUOptimization?: boolean): void;
|
|
49
50
|
readPixels(texture: GPUTexture, x: number, y: number, width: number, height: number, format: GPUTextureFormat, faceIndex?: number, mipLevel?: number, buffer?: Nullable<ArrayBufferView>, noDataConversion?: boolean): Promise<ArrayBufferView>;
|