@babylonjs/core 9.4.1 → 9.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/Inputs/freeCameraTouchInput.js +5 -3
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +11 -7
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
- package/Cameras/arcRotateCamera.js +2 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +1 -0
- package/Cameras/camera.js.map +1 -1
- package/Cameras/followCamera.js +1 -1
- package/Cameras/followCamera.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +12 -0
- package/Collisions/gpuPicker.js +51 -0
- package/Collisions/gpuPicker.js.map +1 -1
- package/Compute/computeEffect.js +2 -2
- package/Compute/computeEffect.js.map +1 -1
- package/Culling/ray.core.js +46 -2
- package/Culling/ray.core.js.map +1 -1
- package/Debug/debugLayer.js +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Native/nativeHelpers.js +26 -0
- package/Engines/Native/nativeHelpers.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +26 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +52 -0
- package/Engines/constants.js +52 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +13 -0
- package/Engines/thinEngine.js +52 -0
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +10 -3
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +36 -3
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.d.ts +13 -0
- package/FlowGraph/flowGraphEventBlock.js +21 -2
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +11 -3
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.js +26 -0
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/Layers/layer.js +5 -1
- package/Layers/layer.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +1 -0
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.js +19 -1
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/light.d.ts +5 -0
- package/Lights/light.js +18 -2
- package/Lights/light.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +14 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +6 -3
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +10 -3
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +2 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +10 -4
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +10 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.d.ts +42 -0
- package/Materials/PBR/openpbrMaterial.js +108 -13
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +26 -0
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/envCubeTexture.js +33 -15
- package/Materials/Textures/envCubeTexture.js.map +1 -1
- package/Materials/effect.functions.js +4 -4
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/material.d.ts +16 -1
- package/Materials/material.js +16 -1
- package/Materials/material.js.map +1 -1
- package/Materials/standardMaterial.js +4 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +16 -18
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +24 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +93 -18
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +10 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/abstractMesh.js +1 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +3 -0
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.d.ts +6 -0
- package/Meshes/transformNode.js +6 -0
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/brdfTextureTools.d.ts +12 -0
- package/Misc/brdfTextureTools.js +22 -0
- package/Misc/brdfTextureTools.js.map +1 -1
- package/Misc/depthReducer.js +1 -1
- package/Misc/depthReducer.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +29 -2
- package/Misc/snapshotRenderingHelper.js +108 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/textureTools.js +26 -0
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.js +1 -1
- package/Misc/tools.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +17 -10
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +14 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +114 -12
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.d.ts +11 -0
- package/Particles/Node/nodeParticleBuildState.js +15 -0
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +33 -24
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/gpuParticleSystem.js +1 -0
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +13 -0
- package/Particles/thinParticleSystem.js +42 -6
- package/Particles/thinParticleSystem.js.map +1 -1
- package/PostProcesses/postProcessManager.d.ts +2 -0
- package/PostProcesses/postProcessManager.js +14 -8
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +12 -9
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/depthRendererSceneComponent.js +6 -6
- package/Rendering/depthRendererSceneComponent.js.map +1 -1
- package/Rendering/iblCdfGeneratorSceneComponent.d.ts +6 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js +16 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +4 -1
- package/Rendering/prePassRenderer.js +31 -9
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +20 -7
- package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrDirectLighting.js +20 -12
- package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +44 -16
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrFragmentDeclaration.js +4 -1
- package/Shaders/ShadersInclude/openpbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrIblFunctions.js +8 -5
- package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapFragment.js +2 -0
- package/Shaders/ShadersInclude/openpbrNormalMapFragment.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrVolumeFunctions.js +1 -1
- package/Shaders/ShadersInclude/openpbrVolumeFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +12 -7
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/openpbr.fragment.js +14 -15
- package/Shaders/openpbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +20 -7
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +21 -13
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +3 -3
- package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +44 -16
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +5 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragment.js +2 -0
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragmentMainFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragmentMainFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrVolumeFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrVolumeFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +10 -10
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js +4 -0
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
- package/ShadersWGSL/openpbr.fragment.js +16 -17
- package/ShadersWGSL/openpbr.fragment.js.map +1 -1
- package/Sprites/spriteManager.js +1 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +16 -0
- package/scene.js +13 -0
- package/scene.js.map +1 -1
package/Debug/debugLayer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Debug/debugLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAmL7D,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE;IACjD,GAAG,EAAE;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CA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,CAAC;YACpB,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC7C,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,MAA0B;QACxC,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACjC,IAAI,OAAO,IAAI,CAAC,YAAY,IAAI,WAAW,EAAE,CAAC;gBAC1C,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;gBAEnG,uCAAuC;gBACvC,KAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,GAAG,EAAE;oBACvC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,kCAAkC;gBAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;;AA7OD;;;;GAIG;AACW,uBAAY,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,wCAAwC,AAA7F,CAA8F;AAExH;;GAEG;AACW,iBAAM,GAAsB;IACtC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CACpB,AAPmB,CAOlB","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { type IInspectable } from \"../Misc/iInspectable\";\r\nimport { type Camera } from \"../Cameras/camera\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare INSPECTOR namespace for compilation issue\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let INSPECTOR: any;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let BABYLON: any;\r\n// load the inspector using require, if not present in the global namespace.\r\n\r\n/**\r\n * Interface used to define scene explorer extensibility option\r\n */\r\nexport interface IExplorerExtensibilityOption {\r\n /**\r\n * Define the option label\r\n */\r\n label: string;\r\n /**\r\n * Defines the action to execute on click\r\n */\r\n action: (entity: any) => void;\r\n /**\r\n * Keep popup open after click\r\n */\r\n keepOpenAfterClick?: boolean;\r\n}\r\n\r\n/**\r\n * Defines a group of actions associated with a predicate to use when extending the Inspector scene explorer\r\n */\r\nexport interface IExplorerExtensibilityGroup {\r\n /**\r\n * Defines a predicate to test if a given type mut be extended\r\n */\r\n predicate: (entity: any) => boolean;\r\n /**\r\n * Gets the list of options added to a type\r\n */\r\n entries: IExplorerExtensibilityOption[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalChild {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the class name of the child node\r\n */\r\n getClassName(): string;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n inspectableCustomProperties: IInspectable[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalNode {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the list of child entries\r\n */\r\n getContent(): IExplorerAdditionalChild[];\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IInspectorContextMenuType = \"pipeline\" | \"node\" | \"materials\" | \"spriteManagers\" | \"particleSystems\" | \"frameGraphs\";\r\n\r\n/**\r\n * Context menu item\r\n */\r\nexport interface IInspectorContextMenuItem {\r\n /**\r\n * Display label - menu item\r\n */\r\n label: string;\r\n /**\r\n * Callback function that will be called when the menu item is selected\r\n * @param entity the entity that is currently selected in the scene explorer\r\n */\r\n action: (entity?: unknown) => void;\r\n}\r\n\r\n/**\r\n * Interface used to define the options to use to create the Inspector\r\n */\r\nexport interface IInspectorOptions {\r\n /**\r\n * Display in overlay mode (default: false)\r\n */\r\n overlay?: boolean;\r\n /**\r\n * HTML element to use as root (the parent of the rendering canvas will be used as default value)\r\n */\r\n globalRoot?: HTMLElement;\r\n /**\r\n * Display the Scene explorer\r\n */\r\n showExplorer?: boolean;\r\n /**\r\n * Display the property inspector\r\n */\r\n showInspector?: boolean;\r\n /**\r\n * Display in embed mode (both panes on the right)\r\n */\r\n embedMode?: boolean;\r\n /**\r\n * let the Inspector handles resize of the canvas when panes are resized (default to true)\r\n */\r\n handleResize?: boolean;\r\n /**\r\n * Allow the panes to popup (default: true)\r\n */\r\n enablePopup?: boolean;\r\n /**\r\n * Allow the panes to be closed by users (default: true)\r\n */\r\n enableClose?: boolean;\r\n /**\r\n * Optional list of extensibility entries\r\n */\r\n explorerExtensibility?: IExplorerExtensibilityGroup[];\r\n /**\r\n * Optional list of additional top level nodes\r\n */\r\n additionalNodes?: IExplorerAdditionalNode[];\r\n /**\r\n * Optional URL to get the inspector script from (by default it uses the babylonjs CDN).\r\n */\r\n inspectorURL?: string;\r\n /**\r\n * Optional initial tab (default to DebugLayerTab.Properties)\r\n */\r\n initialTab?: DebugLayerTab;\r\n /**\r\n * Optional camera to use to render the gizmos from the inspector (default to the scene.activeCamera or the latest from scene.activeCameras)\r\n */\r\n gizmoCamera?: Camera;\r\n /**\r\n * Context menu for inspector tools such as \"Post Process\", \"Nodes\", \"Materials\", etc.\r\n */\r\n contextMenu?: Partial<Record<IInspectorContextMenuType, IInspectorContextMenuItem[]>>;\r\n /**\r\n * List of context menu items that should be completely overridden by custom items from the contextMenu property.\r\n */\r\n contextMenuOverride?: IInspectorContextMenuType[];\r\n\r\n /**\r\n * Should the default font loading be skipped\r\n */\r\n skipDefaultFontLoading?: boolean;\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * @internal\r\n * Backing field\r\n */\r\n _debugLayer?: DebugLayer;\r\n\r\n /**\r\n * Gets the debug layer (aka Inspector) associated with the scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\n debugLayer: DebugLayer;\r\n }\r\n}\r\nObject.defineProperty(Scene.prototype, \"debugLayer\", {\r\n get: function (this: Scene) {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Enum of inspector action tab\r\n */\r\nexport const enum DebugLayerTab {\r\n /**\r\n * Properties tag (default)\r\n */\r\n Properties = 0,\r\n /**\r\n * Debug tab\r\n */\r\n Debug = 1,\r\n /**\r\n * Statistics tab\r\n */\r\n Statistics = 2,\r\n /**\r\n * Tools tab\r\n */\r\n Tools = 3,\r\n /**\r\n * Settings tab\r\n */\r\n Settings = 4,\r\n}\r\n\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\nexport class DebugLayer {\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n public static InspectorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/inspector/babylon.inspector.bundle.js`;\r\n\r\n /**\r\n * The default configuration of the inspector\r\n */\r\n public static Config: IInspectorOptions = {\r\n overlay: false,\r\n showExplorer: true,\r\n showInspector: true,\r\n embedMode: false,\r\n handleResize: true,\r\n enablePopup: true,\r\n };\r\n\r\n private _scene: Scene;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected BJSINSPECTOR = this._getGlobalInspector();\r\n\r\n private _onPropertyChangedObservable?: Observable<{ object: any; property: string; value: any; initialValue: any }>;\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n public get onPropertyChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new Observable<{ object: any; property: string; value: any; initialValue: any }>();\r\n }\r\n\r\n return this._onPropertyChangedObservable;\r\n }\r\n\r\n private _onSelectionChangedObservable?: Observable<any>;\r\n /**\r\n * Observable triggered when the selection is changed through the inspector.\r\n */\r\n public get onSelectionChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable;\r\n }\r\n\r\n if (!this._onSelectionChangedObservable) {\r\n this._onSelectionChangedObservable = new Observable<any>();\r\n }\r\n\r\n return this._onSelectionChangedObservable;\r\n }\r\n\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n * @param scene Defines the scene to inspect\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this._scene.onDisposeObservable.add(() => {\r\n // Debug layer\r\n if (this._scene._debugLayer) {\r\n this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the inspector window.\r\n * @param config\r\n */\r\n private _createInspector(config?: Partial<IInspectorOptions>) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n\r\n if (this._onPropertyChangedObservable) {\r\n for (const observer of this._onPropertyChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n\r\n if (this._onSelectionChangedObservable) {\r\n for (const observer of this._onSelectionChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(observer);\r\n }\r\n this._onSelectionChangedObservable.clear();\r\n this._onSelectionChangedObservable = undefined;\r\n }\r\n\r\n const userOptions: IInspectorOptions = {\r\n ...DebugLayer.Config,\r\n ...config,\r\n };\r\n\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n }\r\n\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitles defines the specific blocks to highlight (could be a string or an array of strings)\r\n */\r\n public select(entity: any, lineContainerTitles?: string | string[]) {\r\n if (this.BJSINSPECTOR) {\r\n if (lineContainerTitles) {\r\n if (Object.prototype.toString.call(lineContainerTitles) == \"[object String]\") {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitles);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(lineContainerTitles);\r\n }\r\n }\r\n if (!this.BJSINSPECTOR.Inspector.IsVisible) {\r\n const waitAndCheck = () => {\r\n setTimeout(() => {\r\n if (this.BJSINSPECTOR.Inspector.IsVisible) {\r\n this.select(entity, lineContainerTitles);\r\n } else {\r\n waitAndCheck();\r\n }\r\n }, 100);\r\n };\r\n waitAndCheck();\r\n } else {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get the inspector from bundle or global\r\n * @returns the inspector instance if found otherwise, null\r\n */\r\n private _getGlobalInspector(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== \"undefined\") {\r\n return INSPECTOR;\r\n }\r\n\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.Inspector !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n public isVisible(): boolean {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n }\r\n\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n public hide() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n }\r\n\r\n /**\r\n * Get the number of opened panes in the inspector\r\n */\r\n public get openedPanes() {\r\n if (this.BJSINSPECTOR) {\r\n return this.BJSINSPECTOR.Inspector._OpenedPane;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Update the scene in the inspector\r\n */\r\n public setAsActiveScene() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);\r\n }\r\n }\r\n\r\n public popupSceneExplorer() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupSceneExplorer();\r\n }\r\n }\r\n\r\n public popupInspector() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupInspector();\r\n }\r\n }\r\n\r\n public popupEmbed() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupEmbed();\r\n }\r\n }\r\n\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @returns a promise fulfilled when the debug layer is visible\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async show(config?: IInspectorOptions): Promise<DebugLayer> {\r\n return await new Promise((resolve) => {\r\n if (typeof this.BJSINSPECTOR == \"undefined\") {\r\n const inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n\r\n // Load inspector and add it to the DOM\r\n Tools.LoadBabylonScript(inspectorUrl, () => {\r\n this._createInspector(config);\r\n resolve(this);\r\n });\r\n } else {\r\n // Otherwise creates the inspector\r\n this._createInspector(config);\r\n resolve(this);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"debugLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Debug/debugLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAmL7D,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE;IACjD,GAAG,EAAE;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAkB,aAqBjB;AArBD,WAAkB,aAAa;IAC3B;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;IACH,yDAAY,CAAA;AAChB,CAAC,EArBiB,aAAa,KAAb,aAAa,QAqB9B;AAED;;;;GAIG;AACH,MAAM,OAAO,UAAU;IA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,KAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,GAAG,EAAE;oBACvC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,kCAAkC;gBAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;;AA7OD;;;;GAIG;AACW,uBAAY,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,wCAAwC,AAA7F,CAA8F;AAExH;;GAEG;AACW,iBAAM,GAAsB;IACtC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CACpB,AAPmB,CAOlB","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { type IInspectable } from \"../Misc/iInspectable\";\r\nimport { type Camera } from \"../Cameras/camera\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare INSPECTOR namespace for compilation issue\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let INSPECTOR: any;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let BABYLON: any;\r\n// load the inspector using require, if not present in the global namespace.\r\n\r\n/**\r\n * Interface used to define scene explorer extensibility option\r\n */\r\nexport interface IExplorerExtensibilityOption {\r\n /**\r\n * Define the option label\r\n */\r\n label: string;\r\n /**\r\n * Defines the action to execute on click\r\n */\r\n action: (entity: any) => void;\r\n /**\r\n * Keep popup open after click\r\n */\r\n keepOpenAfterClick?: boolean;\r\n}\r\n\r\n/**\r\n * Defines a group of actions associated with a predicate to use when extending the Inspector scene explorer\r\n */\r\nexport interface IExplorerExtensibilityGroup {\r\n /**\r\n * Defines a predicate to test if a given type mut be extended\r\n */\r\n predicate: (entity: any) => boolean;\r\n /**\r\n * Gets the list of options added to a type\r\n */\r\n entries: IExplorerExtensibilityOption[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalChild {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the class name of the child node\r\n */\r\n getClassName(): string;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n inspectableCustomProperties: IInspectable[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalNode {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the list of child entries\r\n */\r\n getContent(): IExplorerAdditionalChild[];\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IInspectorContextMenuType = \"pipeline\" | \"node\" | \"materials\" | \"spriteManagers\" | \"particleSystems\" | \"frameGraphs\";\r\n\r\n/**\r\n * Context menu item\r\n */\r\nexport interface IInspectorContextMenuItem {\r\n /**\r\n * Display label - menu item\r\n */\r\n label: string;\r\n /**\r\n * Callback function that will be called when the menu item is selected\r\n * @param entity the entity that is currently selected in the scene explorer\r\n */\r\n action: (entity?: unknown) => void;\r\n}\r\n\r\n/**\r\n * Interface used to define the options to use to create the Inspector\r\n */\r\nexport interface IInspectorOptions {\r\n /**\r\n * Display in overlay mode (default: false)\r\n */\r\n overlay?: boolean;\r\n /**\r\n * HTML element to use as root (the parent of the rendering canvas will be used as default value)\r\n */\r\n globalRoot?: HTMLElement;\r\n /**\r\n * Display the Scene explorer\r\n */\r\n showExplorer?: boolean;\r\n /**\r\n * Display the property inspector\r\n */\r\n showInspector?: boolean;\r\n /**\r\n * Display in embed mode (both panes on the right)\r\n */\r\n embedMode?: boolean;\r\n /**\r\n * let the Inspector handles resize of the canvas when panes are resized (default to true)\r\n */\r\n handleResize?: boolean;\r\n /**\r\n * Allow the panes to popup (default: true)\r\n */\r\n enablePopup?: boolean;\r\n /**\r\n * Allow the panes to be closed by users (default: true)\r\n */\r\n enableClose?: boolean;\r\n /**\r\n * Optional list of extensibility entries\r\n */\r\n explorerExtensibility?: IExplorerExtensibilityGroup[];\r\n /**\r\n * Optional list of additional top level nodes\r\n */\r\n additionalNodes?: IExplorerAdditionalNode[];\r\n /**\r\n * Optional URL to get the inspector script from (by default it uses the babylonjs CDN).\r\n */\r\n inspectorURL?: string;\r\n /**\r\n * Optional initial tab (default to DebugLayerTab.Properties)\r\n */\r\n initialTab?: DebugLayerTab;\r\n /**\r\n * Optional camera to use to render the gizmos from the inspector (default to the scene.activeCamera or the latest from scene.activeCameras)\r\n */\r\n gizmoCamera?: Camera;\r\n /**\r\n * Context menu for inspector tools such as \"Post Process\", \"Nodes\", \"Materials\", etc.\r\n */\r\n contextMenu?: Partial<Record<IInspectorContextMenuType, IInspectorContextMenuItem[]>>;\r\n /**\r\n * List of context menu items that should be completely overridden by custom items from the contextMenu property.\r\n */\r\n contextMenuOverride?: IInspectorContextMenuType[];\r\n\r\n /**\r\n * Should the default font loading be skipped\r\n */\r\n skipDefaultFontLoading?: boolean;\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * @internal\r\n * Backing field\r\n */\r\n _debugLayer?: DebugLayer;\r\n\r\n /**\r\n * Gets the debug layer (aka Inspector) associated with the scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\n debugLayer: DebugLayer;\r\n }\r\n}\r\nObject.defineProperty(Scene.prototype, \"debugLayer\", {\r\n get: function (this: Scene) {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Enum of inspector action tab\r\n */\r\nexport const enum DebugLayerTab {\r\n /**\r\n * Properties tag (default)\r\n */\r\n Properties = 0,\r\n /**\r\n * Debug tab\r\n */\r\n Debug = 1,\r\n /**\r\n * Statistics tab\r\n */\r\n Statistics = 2,\r\n /**\r\n * Tools tab\r\n */\r\n Tools = 3,\r\n /**\r\n * Settings tab\r\n */\r\n Settings = 4,\r\n}\r\n\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\nexport class DebugLayer {\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n public static InspectorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/inspector/babylon.inspector.bundle.js`;\r\n\r\n /**\r\n * The default configuration of the inspector\r\n */\r\n public static Config: IInspectorOptions = {\r\n overlay: false,\r\n showExplorer: true,\r\n showInspector: true,\r\n embedMode: false,\r\n handleResize: true,\r\n enablePopup: true,\r\n };\r\n\r\n private _scene: Scene;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected BJSINSPECTOR = this._getGlobalInspector();\r\n\r\n private _onPropertyChangedObservable?: Observable<{ object: any; property: string; value: any; initialValue: any }>;\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n public get onPropertyChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new Observable<{ object: any; property: string; value: any; initialValue: any }>();\r\n }\r\n\r\n return this._onPropertyChangedObservable;\r\n }\r\n\r\n private _onSelectionChangedObservable?: Observable<any>;\r\n /**\r\n * Observable triggered when the selection is changed through the inspector.\r\n */\r\n public get onSelectionChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable;\r\n }\r\n\r\n if (!this._onSelectionChangedObservable) {\r\n this._onSelectionChangedObservable = new Observable<any>();\r\n }\r\n\r\n return this._onSelectionChangedObservable;\r\n }\r\n\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n * @param scene Defines the scene to inspect\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this._scene.onDisposeObservable.add(() => {\r\n // Debug layer\r\n if (this._scene._debugLayer) {\r\n this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the inspector window.\r\n * @param config\r\n */\r\n private _createInspector(config?: Partial<IInspectorOptions>) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n\r\n if (this._onPropertyChangedObservable) {\r\n for (const observer of this._onPropertyChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n\r\n if (this._onSelectionChangedObservable) {\r\n for (const observer of this._onSelectionChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(observer);\r\n }\r\n this._onSelectionChangedObservable.clear();\r\n this._onSelectionChangedObservable = undefined;\r\n }\r\n\r\n const userOptions: IInspectorOptions = {\r\n ...DebugLayer.Config,\r\n ...config,\r\n };\r\n\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n }\r\n\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitles defines the specific blocks to highlight (could be a string or an array of strings)\r\n */\r\n public select(entity: any, lineContainerTitles?: string | string[]) {\r\n if (this.BJSINSPECTOR) {\r\n if (lineContainerTitles) {\r\n if (Object.prototype.toString.call(lineContainerTitles) == \"[object String]\") {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitles);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(lineContainerTitles);\r\n }\r\n }\r\n if (!this.BJSINSPECTOR.Inspector.IsVisible) {\r\n const waitAndCheck = () => {\r\n setTimeout(() => {\r\n if (this.BJSINSPECTOR.Inspector.IsVisible) {\r\n this.select(entity, lineContainerTitles);\r\n } else {\r\n waitAndCheck();\r\n }\r\n }, 100);\r\n };\r\n waitAndCheck();\r\n } else {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get the inspector from bundle or global\r\n * @returns the inspector instance if found otherwise, null\r\n */\r\n private _getGlobalInspector(): any {\r\n // UMD global name detection from bundle metadata.\r\n if (typeof INSPECTOR !== \"undefined\") {\r\n return INSPECTOR;\r\n }\r\n\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.Inspector !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n public isVisible(): boolean {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n }\r\n\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n public hide() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n }\r\n\r\n /**\r\n * Get the number of opened panes in the inspector\r\n */\r\n public get openedPanes() {\r\n if (this.BJSINSPECTOR) {\r\n return this.BJSINSPECTOR.Inspector._OpenedPane;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Update the scene in the inspector\r\n */\r\n public setAsActiveScene() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);\r\n }\r\n }\r\n\r\n public popupSceneExplorer() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupSceneExplorer();\r\n }\r\n }\r\n\r\n public popupInspector() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupInspector();\r\n }\r\n }\r\n\r\n public popupEmbed() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupEmbed();\r\n }\r\n }\r\n\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @returns a promise fulfilled when the debug layer is visible\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async show(config?: IInspectorOptions): Promise<DebugLayer> {\r\n return await new Promise((resolve) => {\r\n if (typeof this.BJSINSPECTOR == \"undefined\") {\r\n const inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n\r\n // Load inspector and add it to the DOM\r\n Tools.LoadBabylonScript(inspectorUrl, () => {\r\n this._createInspector(config);\r\n resolve(this);\r\n });\r\n } else {\r\n // Otherwise creates the inspector\r\n this._createInspector(config);\r\n resolve(this);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -28,6 +28,32 @@ export function getNativeTextureFormat(format, type) {
|
|
|
28
28
|
return _native.Engine.TEXTURE_FORMAT_BC1;
|
|
29
29
|
case 37808:
|
|
30
30
|
return _native.Engine.TEXTURE_FORMAT_ASTC4x4;
|
|
31
|
+
case 37809:
|
|
32
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC5x4;
|
|
33
|
+
case 37810:
|
|
34
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC5x5;
|
|
35
|
+
case 37811:
|
|
36
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC6x5;
|
|
37
|
+
case 37812:
|
|
38
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC6x6;
|
|
39
|
+
case 37813:
|
|
40
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC8x5;
|
|
41
|
+
case 37814:
|
|
42
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC8x6;
|
|
43
|
+
case 37815:
|
|
44
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC8x8;
|
|
45
|
+
case 37816:
|
|
46
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC10x5;
|
|
47
|
+
case 37817:
|
|
48
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC10x6;
|
|
49
|
+
case 37818:
|
|
50
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC10x8;
|
|
51
|
+
case 37819:
|
|
52
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC10x10;
|
|
53
|
+
case 37820:
|
|
54
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC12x10;
|
|
55
|
+
case 37821:
|
|
56
|
+
return _native.Engine.TEXTURE_FORMAT_ASTC12x12;
|
|
31
57
|
case 36196:
|
|
32
58
|
return _native.Engine.TEXTURE_FORMAT_ETC1;
|
|
33
59
|
case 37492:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeHelpers.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Native/nativeHelpers.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,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CAAC,CAAC;IAChE,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { ErrorCodes, RuntimeError } from \"core/Misc/error\";\r\nimport { Constants } from \"../constants\";\r\nimport { type INative } from \"./nativeInterfaces\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\n\r\ndeclare const _native: INative;\r\n\r\nexport function getNativeTextureFormat(format: number, type: number): number {\r\n switch (format) {\r\n // Depth (type is ignored)\r\n case Constants.TEXTUREFORMAT_DEPTH16:\r\n return _native.Engine.TEXTURE_FORMAT_D16;\r\n case Constants.TEXTUREFORMAT_DEPTH24:\r\n return _native.Engine.TEXTURE_FORMAT_D24;\r\n case Constants.TEXTUREFORMAT_DEPTH24_STENCIL8:\r\n return _native.Engine.TEXTURE_FORMAT_D24S8;\r\n case Constants.TEXTUREFORMAT_DEPTH32_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_D32F;\r\n\r\n // Compressed (type is ignored)\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:\r\n return _native.Engine.TEXTURE_FORMAT_BC7;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_BC6H;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:\r\n return _native.Engine.TEXTURE_FORMAT_BC3;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:\r\n return _native.Engine.TEXTURE_FORMAT_BC2;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:\r\n return _native.Engine.TEXTURE_FORMAT_BC1;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:\r\n return _native.Engine.TEXTURE_FORMAT_BC1;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC4x4;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:\r\n return _native.Engine.TEXTURE_FORMAT_ETC1;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:\r\n return _native.Engine.TEXTURE_FORMAT_ETC2;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:\r\n return _native.Engine.TEXTURE_FORMAT_ETC2A;\r\n\r\n case Constants.TEXTUREFORMAT_RGB: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8S;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8U;\r\n }\r\n break;\r\n }\r\n\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32U;\r\n }\r\n break;\r\n }\r\n\r\n case Constants.TEXTUREFORMAT_RGBA: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA8;\r\n case Constants.TEXTURETYPE_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32F;\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA16F;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA8S;\r\n case Constants.TEXTURETYPE_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA16I;\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA16U;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32U;\r\n }\r\n break;\r\n }\r\n case Constants.TEXTUREFORMAT_R: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_R8;\r\n case Constants.TEXTURETYPE_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_R32F;\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_R16F;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_R8S;\r\n case Constants.TEXTURETYPE_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_R16S;\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_R16U;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_R32I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_R32U;\r\n }\r\n break;\r\n }\r\n case Constants.TEXTUREFORMAT_RG: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RG8;\r\n case Constants.TEXTURETYPE_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RG32F;\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RG16F;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RG8S;\r\n case Constants.TEXTURETYPE_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RG16S;\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RG16U;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_RG32I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RG32U;\r\n }\r\n break;\r\n }\r\n case Constants.TEXTUREFORMAT_BGRA: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_BGRA8;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n throw new RuntimeError(`Unsupported texture format or type: format ${format}, type ${type}.`, ErrorCodes.UnsupportedTextureError);\r\n}\r\n\r\nexport function getNativeSamplingMode(samplingMode: number): number {\r\n switch (samplingMode) {\r\n case Constants.TEXTURE_NEAREST_NEAREST:\r\n return _native.Engine.TEXTURE_NEAREST_NEAREST;\r\n case Constants.TEXTURE_LINEAR_LINEAR:\r\n return _native.Engine.TEXTURE_LINEAR_LINEAR;\r\n case Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR:\r\n return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR;\r\n case Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST:\r\n return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n case Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST:\r\n return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n case Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR:\r\n return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n case Constants.TEXTURE_NEAREST_LINEAR:\r\n return _native.Engine.TEXTURE_NEAREST_LINEAR;\r\n case Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR:\r\n return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR;\r\n case Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST:\r\n return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n case Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR:\r\n return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n case Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST:\r\n return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST;\r\n case Constants.TEXTURE_LINEAR_NEAREST:\r\n return _native.Engine.TEXTURE_LINEAR_NEAREST;\r\n default:\r\n throw new Error(`Unsupported sampling mode: ${samplingMode}.`);\r\n }\r\n}\r\n\r\nexport function getNativeAddressMode(wrapMode: number): number {\r\n switch (wrapMode) {\r\n case Constants.TEXTURE_WRAP_ADDRESSMODE:\r\n return _native.Engine.ADDRESS_MODE_WRAP;\r\n case Constants.TEXTURE_CLAMP_ADDRESSMODE:\r\n return _native.Engine.ADDRESS_MODE_CLAMP;\r\n case Constants.TEXTURE_MIRROR_ADDRESSMODE:\r\n return _native.Engine.ADDRESS_MODE_MIRROR;\r\n default:\r\n throw new Error(\"Unexpected wrap mode: \" + wrapMode + \".\");\r\n }\r\n}\r\n\r\nexport function getNativeStencilFunc(func: number): number {\r\n switch (func) {\r\n case Constants.LESS:\r\n return _native.Engine.STENCIL_TEST_LESS;\r\n case Constants.LEQUAL:\r\n return _native.Engine.STENCIL_TEST_LEQUAL;\r\n case Constants.EQUAL:\r\n return _native.Engine.STENCIL_TEST_EQUAL;\r\n case Constants.GEQUAL:\r\n return _native.Engine.STENCIL_TEST_GEQUAL;\r\n case Constants.GREATER:\r\n return _native.Engine.STENCIL_TEST_GREATER;\r\n case Constants.NOTEQUAL:\r\n return _native.Engine.STENCIL_TEST_NOTEQUAL;\r\n case Constants.NEVER:\r\n return _native.Engine.STENCIL_TEST_NEVER;\r\n case Constants.ALWAYS:\r\n return _native.Engine.STENCIL_TEST_ALWAYS;\r\n default:\r\n throw new Error(`Unsupported stencil func mode: ${func}.`);\r\n }\r\n}\r\n\r\nexport function getNativeStencilOpFail(opFail: number): number {\r\n switch (opFail) {\r\n case Constants.KEEP:\r\n return _native.Engine.STENCIL_OP_FAIL_S_KEEP;\r\n case Constants.ZERO:\r\n return _native.Engine.STENCIL_OP_FAIL_S_ZERO;\r\n case Constants.REPLACE:\r\n return _native.Engine.STENCIL_OP_FAIL_S_REPLACE;\r\n case Constants.INCR:\r\n return _native.Engine.STENCIL_OP_FAIL_S_INCR;\r\n case Constants.DECR:\r\n return _native.Engine.STENCIL_OP_FAIL_S_DECR;\r\n case Constants.INVERT:\r\n return _native.Engine.STENCIL_OP_FAIL_S_INVERT;\r\n case Constants.INCR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_S_INCRSAT;\r\n case Constants.DECR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_S_DECRSAT;\r\n default:\r\n throw new Error(`Unsupported stencil OpFail mode: ${opFail}.`);\r\n }\r\n}\r\n\r\nexport function getNativeStencilDepthFail(depthFail: number): number {\r\n switch (depthFail) {\r\n case Constants.KEEP:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_KEEP;\r\n case Constants.ZERO:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_ZERO;\r\n case Constants.REPLACE:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_REPLACE;\r\n case Constants.INCR:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_INCR;\r\n case Constants.DECR:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_DECR;\r\n case Constants.INVERT:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_INVERT;\r\n case Constants.INCR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_INCRSAT;\r\n case Constants.DECR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_DECRSAT;\r\n default:\r\n throw new Error(`Unsupported stencil depthFail mode: ${depthFail}.`);\r\n }\r\n}\r\n\r\nexport function getNativeStencilDepthPass(opPass: number): number {\r\n switch (opPass) {\r\n case Constants.KEEP:\r\n return _native.Engine.STENCIL_OP_PASS_Z_KEEP;\r\n case Constants.ZERO:\r\n return _native.Engine.STENCIL_OP_PASS_Z_ZERO;\r\n case Constants.REPLACE:\r\n return _native.Engine.STENCIL_OP_PASS_Z_REPLACE;\r\n case Constants.INCR:\r\n return _native.Engine.STENCIL_OP_PASS_Z_INCR;\r\n case Constants.DECR:\r\n return _native.Engine.STENCIL_OP_PASS_Z_DECR;\r\n case Constants.INVERT:\r\n return _native.Engine.STENCIL_OP_PASS_Z_INVERT;\r\n case Constants.INCR_WRAP:\r\n return _native.Engine.STENCIL_OP_PASS_Z_INCRSAT;\r\n case Constants.DECR_WRAP:\r\n return _native.Engine.STENCIL_OP_PASS_Z_DECRSAT;\r\n default:\r\n throw new Error(`Unsupported stencil opPass mode: ${opPass}.`);\r\n }\r\n}\r\n\r\nexport function getNativeAlphaMode(mode: number): number {\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n return _native.Engine.ALPHA_DISABLE;\r\n case Constants.ALPHA_ADD:\r\n return _native.Engine.ALPHA_ADD;\r\n case Constants.ALPHA_COMBINE:\r\n return _native.Engine.ALPHA_COMBINE;\r\n case Constants.ALPHA_SUBTRACT:\r\n return _native.Engine.ALPHA_SUBTRACT;\r\n case Constants.ALPHA_MULTIPLY:\r\n return _native.Engine.ALPHA_MULTIPLY;\r\n case Constants.ALPHA_MAXIMIZED:\r\n return _native.Engine.ALPHA_MAXIMIZED;\r\n case Constants.ALPHA_ONEONE:\r\n return _native.Engine.ALPHA_ONEONE;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n return _native.Engine.ALPHA_PREMULTIPLIED;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n return _native.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n case Constants.ALPHA_INTERPOLATE:\r\n return _native.Engine.ALPHA_INTERPOLATE;\r\n case Constants.ALPHA_SCREENMODE:\r\n return _native.Engine.ALPHA_SCREENMODE;\r\n default:\r\n throw new Error(`Unsupported alpha mode: ${mode}.`);\r\n }\r\n}\r\n\r\nexport function getNativeAttribType(type: number): number {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n return _native.Engine.ATTRIB_TYPE_INT8;\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return _native.Engine.ATTRIB_TYPE_UINT8;\r\n case VertexBuffer.SHORT:\r\n return _native.Engine.ATTRIB_TYPE_INT16;\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return _native.Engine.ATTRIB_TYPE_UINT16;\r\n case VertexBuffer.FLOAT:\r\n return _native.Engine.ATTRIB_TYPE_FLOAT;\r\n default:\r\n throw new Error(`Unsupported attribute type: ${type}.`);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nativeHelpers.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Native/nativeHelpers.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,UAAU,sBAAsB,CAAC,MAAc,EAAE,IAAY;IAC/D,QAAQ,MAAM,EAAE,CAAC;QACb,0BAA0B;QAC1B,KAAK,SAAS,CAAC,qBAAqB;YAChC,OAAO,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;QAC7C,KAAK,SAAS,CAAC,qBAAqB;YAChC,OAAO,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;QAC7C,KAAK,SAAS,CAAC,8BAA8B;YACzC,OAAO,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC;QAC/C,KAAK,SAAS,CAAC,2BAA2B;YACtC,OAAO,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC;QAE9C,+BAA+B;QAC/B,KAAK,SAAS,CAAC,wCAAwC;YACnD,OAAO,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;QAC7C,KAAK,SAAS,CAAC,8CAA8C;YACzD,O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;IAC5C,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,YAAY,CAAC,IAAI;YAClB,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAC3C,KAAK,YAAY,CAAC,aAAa;YAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;QAC5C,KAAK,YAAY,CAAC,KAAK;YACnB,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;QAC5C,KAAK,YAAY,CAAC,cAAc;YAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;QAC7C,KAAK,YAAY,CAAC,KAAK;YACnB,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;QAC5C;YACI,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,GAAG,CAAC,CAAC;IAChE,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { ErrorCodes, RuntimeError } from \"core/Misc/error\";\r\nimport { Constants } from \"../constants\";\r\nimport { type INative } from \"./nativeInterfaces\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\n\r\ndeclare const _native: INative;\r\n\r\nexport function getNativeTextureFormat(format: number, type: number): number {\r\n switch (format) {\r\n // Depth (type is ignored)\r\n case Constants.TEXTUREFORMAT_DEPTH16:\r\n return _native.Engine.TEXTURE_FORMAT_D16;\r\n case Constants.TEXTUREFORMAT_DEPTH24:\r\n return _native.Engine.TEXTURE_FORMAT_D24;\r\n case Constants.TEXTUREFORMAT_DEPTH24_STENCIL8:\r\n return _native.Engine.TEXTURE_FORMAT_D24S8;\r\n case Constants.TEXTUREFORMAT_DEPTH32_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_D32F;\r\n\r\n // Compressed (type is ignored)\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:\r\n return _native.Engine.TEXTURE_FORMAT_BC7;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_BC6H;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:\r\n return _native.Engine.TEXTURE_FORMAT_BC3;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:\r\n return _native.Engine.TEXTURE_FORMAT_BC2;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:\r\n return _native.Engine.TEXTURE_FORMAT_BC1;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:\r\n return _native.Engine.TEXTURE_FORMAT_BC1;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC4x4;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_5x4:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC5x4;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_5x5:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC5x5;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_6x5:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC6x5;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_6x6:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC6x6;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_8x5:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC8x5;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_8x6:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC8x6;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_8x8:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC8x8;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x5:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC10x5;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x6:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC10x6;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x8:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC10x8;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x10:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC10x10;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_12x10:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC12x10;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_12x12:\r\n return _native.Engine.TEXTURE_FORMAT_ASTC12x12;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:\r\n return _native.Engine.TEXTURE_FORMAT_ETC1;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:\r\n return _native.Engine.TEXTURE_FORMAT_ETC2;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:\r\n return _native.Engine.TEXTURE_FORMAT_ETC2A;\r\n\r\n case Constants.TEXTUREFORMAT_RGB: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8S;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RGB8U;\r\n }\r\n break;\r\n }\r\n\r\n case Constants.TEXTUREFORMAT_RGBA_INTEGER: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32U;\r\n }\r\n break;\r\n }\r\n\r\n case Constants.TEXTUREFORMAT_RGBA: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA8;\r\n case Constants.TEXTURETYPE_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32F;\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA16F;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA8S;\r\n case Constants.TEXTURETYPE_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA16I;\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA16U;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RGBA32U;\r\n }\r\n break;\r\n }\r\n case Constants.TEXTUREFORMAT_R: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_R8;\r\n case Constants.TEXTURETYPE_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_R32F;\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_R16F;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_R8S;\r\n case Constants.TEXTURETYPE_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_R16S;\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_R16U;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_R32I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_R32U;\r\n }\r\n break;\r\n }\r\n case Constants.TEXTUREFORMAT_RG: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RG8;\r\n case Constants.TEXTURETYPE_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RG32F;\r\n case Constants.TEXTURETYPE_HALF_FLOAT:\r\n return _native.Engine.TEXTURE_FORMAT_RG16F;\r\n case Constants.TEXTURETYPE_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_RG8S;\r\n case Constants.TEXTURETYPE_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RG16S;\r\n case Constants.TEXTURETYPE_UNSIGNED_SHORT:\r\n return _native.Engine.TEXTURE_FORMAT_RG16U;\r\n case Constants.TEXTURETYPE_INT:\r\n return _native.Engine.TEXTURE_FORMAT_RG32I;\r\n case Constants.TEXTURETYPE_UNSIGNED_INTEGER:\r\n return _native.Engine.TEXTURE_FORMAT_RG32U;\r\n }\r\n break;\r\n }\r\n case Constants.TEXTUREFORMAT_BGRA: {\r\n switch (type) {\r\n case Constants.TEXTURETYPE_UNSIGNED_BYTE:\r\n return _native.Engine.TEXTURE_FORMAT_BGRA8;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n throw new RuntimeError(`Unsupported texture format or type: format ${format}, type ${type}.`, ErrorCodes.UnsupportedTextureError);\r\n}\r\n\r\nexport function getNativeSamplingMode(samplingMode: number): number {\r\n switch (samplingMode) {\r\n case Constants.TEXTURE_NEAREST_NEAREST:\r\n return _native.Engine.TEXTURE_NEAREST_NEAREST;\r\n case Constants.TEXTURE_LINEAR_LINEAR:\r\n return _native.Engine.TEXTURE_LINEAR_LINEAR;\r\n case Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR:\r\n return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR;\r\n case Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST:\r\n return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n case Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST:\r\n return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n case Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR:\r\n return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n case Constants.TEXTURE_NEAREST_LINEAR:\r\n return _native.Engine.TEXTURE_NEAREST_LINEAR;\r\n case Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR:\r\n return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR;\r\n case Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST:\r\n return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n case Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR:\r\n return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n case Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST:\r\n return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST;\r\n case Constants.TEXTURE_LINEAR_NEAREST:\r\n return _native.Engine.TEXTURE_LINEAR_NEAREST;\r\n default:\r\n throw new Error(`Unsupported sampling mode: ${samplingMode}.`);\r\n }\r\n}\r\n\r\nexport function getNativeAddressMode(wrapMode: number): number {\r\n switch (wrapMode) {\r\n case Constants.TEXTURE_WRAP_ADDRESSMODE:\r\n return _native.Engine.ADDRESS_MODE_WRAP;\r\n case Constants.TEXTURE_CLAMP_ADDRESSMODE:\r\n return _native.Engine.ADDRESS_MODE_CLAMP;\r\n case Constants.TEXTURE_MIRROR_ADDRESSMODE:\r\n return _native.Engine.ADDRESS_MODE_MIRROR;\r\n default:\r\n throw new Error(\"Unexpected wrap mode: \" + wrapMode + \".\");\r\n }\r\n}\r\n\r\nexport function getNativeStencilFunc(func: number): number {\r\n switch (func) {\r\n case Constants.LESS:\r\n return _native.Engine.STENCIL_TEST_LESS;\r\n case Constants.LEQUAL:\r\n return _native.Engine.STENCIL_TEST_LEQUAL;\r\n case Constants.EQUAL:\r\n return _native.Engine.STENCIL_TEST_EQUAL;\r\n case Constants.GEQUAL:\r\n return _native.Engine.STENCIL_TEST_GEQUAL;\r\n case Constants.GREATER:\r\n return _native.Engine.STENCIL_TEST_GREATER;\r\n case Constants.NOTEQUAL:\r\n return _native.Engine.STENCIL_TEST_NOTEQUAL;\r\n case Constants.NEVER:\r\n return _native.Engine.STENCIL_TEST_NEVER;\r\n case Constants.ALWAYS:\r\n return _native.Engine.STENCIL_TEST_ALWAYS;\r\n default:\r\n throw new Error(`Unsupported stencil func mode: ${func}.`);\r\n }\r\n}\r\n\r\nexport function getNativeStencilOpFail(opFail: number): number {\r\n switch (opFail) {\r\n case Constants.KEEP:\r\n return _native.Engine.STENCIL_OP_FAIL_S_KEEP;\r\n case Constants.ZERO:\r\n return _native.Engine.STENCIL_OP_FAIL_S_ZERO;\r\n case Constants.REPLACE:\r\n return _native.Engine.STENCIL_OP_FAIL_S_REPLACE;\r\n case Constants.INCR:\r\n return _native.Engine.STENCIL_OP_FAIL_S_INCR;\r\n case Constants.DECR:\r\n return _native.Engine.STENCIL_OP_FAIL_S_DECR;\r\n case Constants.INVERT:\r\n return _native.Engine.STENCIL_OP_FAIL_S_INVERT;\r\n case Constants.INCR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_S_INCRSAT;\r\n case Constants.DECR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_S_DECRSAT;\r\n default:\r\n throw new Error(`Unsupported stencil OpFail mode: ${opFail}.`);\r\n }\r\n}\r\n\r\nexport function getNativeStencilDepthFail(depthFail: number): number {\r\n switch (depthFail) {\r\n case Constants.KEEP:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_KEEP;\r\n case Constants.ZERO:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_ZERO;\r\n case Constants.REPLACE:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_REPLACE;\r\n case Constants.INCR:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_INCR;\r\n case Constants.DECR:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_DECR;\r\n case Constants.INVERT:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_INVERT;\r\n case Constants.INCR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_INCRSAT;\r\n case Constants.DECR_WRAP:\r\n return _native.Engine.STENCIL_OP_FAIL_Z_DECRSAT;\r\n default:\r\n throw new Error(`Unsupported stencil depthFail mode: ${depthFail}.`);\r\n }\r\n}\r\n\r\nexport function getNativeStencilDepthPass(opPass: number): number {\r\n switch (opPass) {\r\n case Constants.KEEP:\r\n return _native.Engine.STENCIL_OP_PASS_Z_KEEP;\r\n case Constants.ZERO:\r\n return _native.Engine.STENCIL_OP_PASS_Z_ZERO;\r\n case Constants.REPLACE:\r\n return _native.Engine.STENCIL_OP_PASS_Z_REPLACE;\r\n case Constants.INCR:\r\n return _native.Engine.STENCIL_OP_PASS_Z_INCR;\r\n case Constants.DECR:\r\n return _native.Engine.STENCIL_OP_PASS_Z_DECR;\r\n case Constants.INVERT:\r\n return _native.Engine.STENCIL_OP_PASS_Z_INVERT;\r\n case Constants.INCR_WRAP:\r\n return _native.Engine.STENCIL_OP_PASS_Z_INCRSAT;\r\n case Constants.DECR_WRAP:\r\n return _native.Engine.STENCIL_OP_PASS_Z_DECRSAT;\r\n default:\r\n throw new Error(`Unsupported stencil opPass mode: ${opPass}.`);\r\n }\r\n}\r\n\r\nexport function getNativeAlphaMode(mode: number): number {\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n return _native.Engine.ALPHA_DISABLE;\r\n case Constants.ALPHA_ADD:\r\n return _native.Engine.ALPHA_ADD;\r\n case Constants.ALPHA_COMBINE:\r\n return _native.Engine.ALPHA_COMBINE;\r\n case Constants.ALPHA_SUBTRACT:\r\n return _native.Engine.ALPHA_SUBTRACT;\r\n case Constants.ALPHA_MULTIPLY:\r\n return _native.Engine.ALPHA_MULTIPLY;\r\n case Constants.ALPHA_MAXIMIZED:\r\n return _native.Engine.ALPHA_MAXIMIZED;\r\n case Constants.ALPHA_ONEONE:\r\n return _native.Engine.ALPHA_ONEONE;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n return _native.Engine.ALPHA_PREMULTIPLIED;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n return _native.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n case Constants.ALPHA_INTERPOLATE:\r\n return _native.Engine.ALPHA_INTERPOLATE;\r\n case Constants.ALPHA_SCREENMODE:\r\n return _native.Engine.ALPHA_SCREENMODE;\r\n default:\r\n throw new Error(`Unsupported alpha mode: ${mode}.`);\r\n }\r\n}\r\n\r\nexport function getNativeAttribType(type: number): number {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n return _native.Engine.ATTRIB_TYPE_INT8;\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return _native.Engine.ATTRIB_TYPE_UINT8;\r\n case VertexBuffer.SHORT:\r\n return _native.Engine.ATTRIB_TYPE_INT16;\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return _native.Engine.ATTRIB_TYPE_UINT16;\r\n case VertexBuffer.FLOAT:\r\n return _native.Engine.ATTRIB_TYPE_FLOAT;\r\n default:\r\n throw new Error(`Unsupported attribute type: ${type}.`);\r\n }\r\n}\r\n"]}
|
|
@@ -374,6 +374,32 @@ export class WebGPUTextureHelper {
|
|
|
374
374
|
return useSRGBBuffer ? "bc1-rgba-unorm-srgb" /* WebGPUConstants.TextureFormat.BC1RGBAUnormSRGB */ : "bc1-rgba-unorm" /* WebGPUConstants.TextureFormat.BC1RGBAUnorm */;
|
|
375
375
|
case 37808:
|
|
376
376
|
return useSRGBBuffer ? "astc-4x4-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC4x4UnormSRGB */ : "astc-4x4-unorm" /* WebGPUConstants.TextureFormat.ASTC4x4Unorm */;
|
|
377
|
+
case 37809:
|
|
378
|
+
return useSRGBBuffer ? "astc-5x4-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB */ : "astc-5x4-unorm" /* WebGPUConstants.TextureFormat.ASTC5x4Unorm */;
|
|
379
|
+
case 37810:
|
|
380
|
+
return useSRGBBuffer ? "astc-5x5-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB */ : "astc-5x5-unorm" /* WebGPUConstants.TextureFormat.ASTC5x5Unorm */;
|
|
381
|
+
case 37811:
|
|
382
|
+
return useSRGBBuffer ? "astc-6x5-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB */ : "astc-6x5-unorm" /* WebGPUConstants.TextureFormat.ASTC6x5Unorm */;
|
|
383
|
+
case 37812:
|
|
384
|
+
return useSRGBBuffer ? "astc-6x6-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB */ : "astc-6x6-unorm" /* WebGPUConstants.TextureFormat.ASTC6x6Unorm */;
|
|
385
|
+
case 37813:
|
|
386
|
+
return useSRGBBuffer ? "astc-8x5-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB */ : "astc-8x5-unorm" /* WebGPUConstants.TextureFormat.ASTC8x5Unorm */;
|
|
387
|
+
case 37814:
|
|
388
|
+
return useSRGBBuffer ? "astc-8x6-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB */ : "astc-8x6-unorm" /* WebGPUConstants.TextureFormat.ASTC8x6Unorm */;
|
|
389
|
+
case 37815:
|
|
390
|
+
return useSRGBBuffer ? "astc-8x8-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB */ : "astc-8x8-unorm" /* WebGPUConstants.TextureFormat.ASTC8x8Unorm */;
|
|
391
|
+
case 37816:
|
|
392
|
+
return useSRGBBuffer ? "astc-10x5-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB */ : "astc-10x5-unorm" /* WebGPUConstants.TextureFormat.ASTC10x5Unorm */;
|
|
393
|
+
case 37817:
|
|
394
|
+
return useSRGBBuffer ? "astc-10x6-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB */ : "astc-10x6-unorm" /* WebGPUConstants.TextureFormat.ASTC10x6Unorm */;
|
|
395
|
+
case 37818:
|
|
396
|
+
return useSRGBBuffer ? "astc-10x8-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB */ : "astc-10x8-unorm" /* WebGPUConstants.TextureFormat.ASTC10x8Unorm */;
|
|
397
|
+
case 37819:
|
|
398
|
+
return useSRGBBuffer ? "astc-10x10-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB */ : "astc-10x10-unorm" /* WebGPUConstants.TextureFormat.ASTC10x10Unorm */;
|
|
399
|
+
case 37820:
|
|
400
|
+
return useSRGBBuffer ? "astc-12x10-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB */ : "astc-12x10-unorm" /* WebGPUConstants.TextureFormat.ASTC12x10Unorm */;
|
|
401
|
+
case 37821:
|
|
402
|
+
return useSRGBBuffer ? "astc-12x12-unorm-srgb" /* WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB */ : "astc-12x12-unorm" /* WebGPUConstants.TextureFormat.ASTC12x12Unorm */;
|
|
377
403
|
case 36196:
|
|
378
404
|
case 37492:
|
|
379
405
|
return useSRGBBuffer ? "etc2-rgb8unorm-srgb" /* WebGPUConstants.TextureFormat.ETC2RGB8UnormSRGB */ : "etc2-rgb8unorm" /* WebGPUConstants.TextureFormat.ETC2RGB8Unorm */;
|
|
@@ -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;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O,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"]}
|
|
1
|
+
{"version":3,"file":"webgpuTextureHelper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuTextureHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MA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D;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_RGBA_ASTC_5x4:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC5x4UnormSRGB : WebGPUConstants.TextureFormat.ASTC5x4Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_5x5:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC5x5UnormSRGB : WebGPUConstants.TextureFormat.ASTC5x5Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_6x5:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC6x5UnormSRGB : WebGPUConstants.TextureFormat.ASTC6x5Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_6x6:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC6x6UnormSRGB : WebGPUConstants.TextureFormat.ASTC6x6Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_8x5:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC8x5UnormSRGB : WebGPUConstants.TextureFormat.ASTC8x5Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_8x6:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC8x6UnormSRGB : WebGPUConstants.TextureFormat.ASTC8x6Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_8x8:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC8x8UnormSRGB : WebGPUConstants.TextureFormat.ASTC8x8Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x5:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC10x5UnormSRGB : WebGPUConstants.TextureFormat.ASTC10x5Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x6:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC10x6UnormSRGB : WebGPUConstants.TextureFormat.ASTC10x6Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x8:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC10x8UnormSRGB : WebGPUConstants.TextureFormat.ASTC10x8Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_10x10:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC10x10UnormSRGB : WebGPUConstants.TextureFormat.ASTC10x10Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_12x10:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC12x10UnormSRGB : WebGPUConstants.TextureFormat.ASTC12x10Unorm;\r\n case Constants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_12x12:\r\n return useSRGBBuffer ? WebGPUConstants.TextureFormat.ASTC12x12UnormSRGB : WebGPUConstants.TextureFormat.ASTC12x12Unorm;\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"]}
|