1 |
- {"ast":null,"code":"import { getDimensionsFromTextureSize, textureSizeIsObject } from \"../Materials/Textures/textureCreationOptions.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"./frameGraphTypes.js\";\nimport { GetTypeForDepthTexture, IsDepthTexture, HasStencilAspect } from \"../Materials/Textures/internalTexture.js\";\nimport { FrameGraphRenderTarget } from \"./frameGraphRenderTarget.js\";\nvar FrameGraphTextureNamespace;\n(function (FrameGraphTextureNamespace) {\n FrameGraphTextureNamespace[FrameGraphTextureNamespace[\"Task\"] = 0] = \"Task\";\n FrameGraphTextureNamespace[FrameGraphTextureNamespace[\"Graph\"] = 1] = \"Graph\";\n FrameGraphTextureNamespace[FrameGraphTextureNamespace[\"External\"] = 2] = \"External\";\n})(FrameGraphTextureNamespace || (FrameGraphTextureNamespace = {}));\n/**\n * Manages the textures used by a frame graph\n * @experimental\n */\nexport class FrameGraphTextureManager {\n /**\n * Constructs a new instance of the texture manager\n * @param engine The engine to use\n * @param _debugTextures If true, debug textures will be created so that they are visible in the inspector\n * @param _scene The scene the manager belongs to\n */\n constructor(engine, _debugTextures = false, _scene) {\n this.engine = engine;\n this._debugTextures = _debugTextures;\n this._scene = _scene;\n /** @internal */\n this._textures = new Map();\n /** @internal */\n this._historyTextures = new Map();\n /** @internal */\n this._isRecordingTask = false;\n this._addSystemTextures();\n }\n /**\n * Checks if a handle is a backbuffer handle (color or depth/stencil)\n * @param handle The handle to check\n * @returns True if the handle is a backbuffer handle\n */\n isBackbuffer(handle) {\n if (handle === backbufferColorTextureHandle || handle === backbufferDepthStencilTextureHandle) {\n return true;\n }\n const textureEntry = this._textures.get(handle);\n if (!textureEntry) {\n return false;\n }\n return textureEntry.refHandle === backbufferColorTextureHandle || textureEntry.refHandle === backbufferDepthStencilTextureHandle;\n }\n /**\n * Checks if a handle is a backbuffer color handle\n * @param handle The handle to check\n * @returns True if the handle is a backbuffer color handle\n */\n isBackbufferColor(handle) {\n if (handle === backbufferColorTextureHandle) {\n return true;\n }\n const textureEntry = this._textures.get(handle);\n if (!textureEntry) {\n return false;\n }\n return textureEntry.refHandle === backbufferColorTextureHandle;\n }\n /**\n * Checks if a handle is a backbuffer depth/stencil handle\n * @param handle The handle to check\n * @returns True if the handle is a backbuffer depth/stencil handle\n */\n isBackbufferDepthStencil(handle) {\n if (handle === backbufferDepthStencilTextureHandle) {\n return true;\n }\n const textureEntry = this._textures.get(handle);\n if (!textureEntry) {\n return false;\n }\n return textureEntry.refHandle === backbufferDepthStencilTextureHandle;\n }\n /**\n * Checks if a handle is a history texture (or points to a history texture, for a dangling handle)\n * @param handle The handle to check\n * @returns True if the handle is a history texture, otherwise false\n */\n isHistoryTexture(handle) {\n var _entry$refHandle;\n const entry = this._textures.get(handle);\n if (!entry) {\n return false;\n }\n handle = (_entry$refHandle = entry.refHandle) !== null && _entry$refHandle !== void 0 ? _entry$refHandle : handle;\n return this._historyTextures.has(handle);\n }\n /**\n * Gets the creation options of a texture\n * @param handle Handle of the texture\n * @returns The creation options of the texture\n */\n getTextureCreationOptions(handle) {\n const entry = this._textures.get(handle);\n const creationOptions = entry.creationOptions;\n return {\n size: textureSizeIsObject(creationOptions.size) ? {\n ...creationOptions.size\n } : creationOptions.size,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n options: this._cloneTextureOptions(creationOptions.options, entry.textureIndex),\n isHistoryTexture: creationOptions.isHistoryTexture\n };\n }\n /**\n * Gets the description of a texture\n * @param handle Handle of the texture\n * @returns The description of the texture\n */\n getTextureDescription(handle) {\n const creationOptions = this.getTextureCreationOptions(handle);\n const size = !creationOptions.sizeIsPercentage ? textureSizeIsObject(creationOptions.size) ? creationOptions.size : {\n width: creationOptions.size,\n height: creationOptions.size\n } : this.getAbsoluteDimensions(creationOptions.size);\n return {\n size,\n options: creationOptions.options\n };\n }\n /**\n * Gets a texture handle or creates a new texture if the handle is not provided.\n * If handle is not provided, newTextureName and creationOptions must be provided.\n * @param handle If provided, will simply return the handle\n * @param newTextureName Name of the new texture to create\n * @param creationOptions Options to use when creating the new texture\n * @returns The handle to the texture.\n */\n getTextureHandleOrCreateTexture(handle, newTextureName, creationOptions) {\n if (handle === undefined) {\n if (newTextureName === undefined || creationOptions === undefined) {\n throw new Error(\"getTextureHandleOrCreateTexture: Either handle or newTextureName and creationOptions must be provided.\");\n }\n return this.createRenderTargetTexture(newTextureName, creationOptions);\n }\n return handle;\n }\n /**\n * Gets a texture from a handle.\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\n * @param handle The handle of the texture\n * @returns The texture or null if not found\n */\n getTextureFromHandle(handle) {\n const historyEntry = this._historyTextures.get(handle);\n if (historyEntry) {\n return historyEntry.textures[historyEntry.index ^ 1]; // gets the read texture\n }\n return this._textures.get(handle).texture;\n }\n /**\n * Imports a texture into the texture manager\n * @param name Name of the texture\n * @param texture Texture to import\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\n * @returns The handle to the texture\n */\n importTexture(name, texture, handle) {\n if (handle !== undefined) {\n this._freeEntry(handle);\n }\n const creationOptions = {\n size: {\n width: texture.width,\n height: texture.height\n },\n sizeIsPercentage: false,\n isHistoryTexture: false,\n options: {\n createMipMaps: texture.generateMipMaps,\n samples: texture.samples,\n types: [texture.type],\n formats: [texture.format],\n useSRGBBuffers: [texture._useSRGBBuffer],\n creationFlags: [texture._creationFlags],\n labels: texture.label ? [texture.label] : [\"imported\"]\n }\n };\n return this._createHandleForTexture(name, texture, creationOptions, FrameGraphTextureNamespace.External, handle);\n }\n /**\n * Creates a new render target texture\n * If multiple textures are described in FrameGraphTextureCreationOptions, the handle of the first texture is returned, handle+1 is the handle of the second texture, etc.\n * @param name Name of the texture\n * @param creationOptions Options to use when creating the texture\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\n * @returns The handle to the texture\n */\n createRenderTargetTexture(name, creationOptions, handle) {\n return this._createHandleForTexture(name, null, {\n size: textureSizeIsObject(creationOptions.size) ? {\n ...creationOptions.size\n } : creationOptions.size,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n isHistoryTexture: creationOptions.isHistoryTexture,\n options: this._cloneTextureOptions(creationOptions.options)\n }, this._isRecordingTask ? FrameGraphTextureNamespace.Task : FrameGraphTextureNamespace.Graph, handle);\n }\n /**\n * Creates a (frame graph) render target wrapper\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\n * @param name Name of the render target wrapper\n * @param renderTargets Render target handles (textures) to use\n * @param renderTargetDepth Render target depth handle (texture) to use\n * @returns The created render target wrapper\n */\n createRenderTarget(name, renderTargets, renderTargetDepth) {\n const renderTarget = new FrameGraphRenderTarget(name, this, renderTargets, renderTargetDepth);\n const rtw = renderTarget.renderTargetWrapper;\n if (rtw !== undefined && renderTargets) {\n const handles = Array.isArray(renderTargets) ? renderTargets : [renderTargets];\n for (let i = 0; i < handles.length; i++) {\n var _this$_textures$get$r, _this$_textures$get;\n let handle = handles[i];\n handle = (_this$_textures$get$r = (_this$_textures$get = this._textures.get(handle)) === null || _this$_textures$get === void 0 ? void 0 : _this$_textures$get.refHandle) !== null && _this$_textures$get$r !== void 0 ? _this$_textures$get$r : handle;\n const historyEntry = this._historyTextures.get(handle);\n if (historyEntry) {\n historyEntry.references.push({\n renderTargetWrapper: rtw,\n textureIndex: i\n });\n rtw.setTexture(historyEntry.textures[historyEntry.index], i, false);\n }\n }\n }\n return renderTarget;\n }\n /**\n * Creates a handle which is not associated with any texture.\n * Call resolveDanglingHandle to associate the handle with a valid texture handle.\n * @returns The dangling handle\n */\n createDanglingHandle() {\n return FrameGraphTextureManager._Counter++;\n }\n /**\n * Associates a texture with a dangling handle\n * @param danglingHandle The dangling handle\n * @param handle The handle to associate with the dangling handle (if not provided, a new texture handle will be created, using the newTextureName and creationOptions parameters)\n * @param newTextureName The name of the new texture to create (if handle is not provided)\n * @param creationOptions The options to use when creating the new texture (if handle is not provided)\n */\n resolveDanglingHandle(danglingHandle, handle, newTextureName, creationOptions) {\n if (handle === undefined) {\n if (newTextureName === undefined || creationOptions === undefined) {\n throw new Error(\"resolveDanglingHandle: Either handle or newTextureName and creationOptions must be provided.\");\n }\n this.createRenderTargetTexture(newTextureName, creationOptions, danglingHandle);\n return;\n }\n const textureEntry = this._textures.get(handle);\n if (textureEntry === undefined) {\n throw new Error(`resolveDanglingHandle: Handle ${handle} does not exist!`);\n }\n this._textures.set(danglingHandle, {\n texture: textureEntry.texture,\n refHandle: handle,\n name: textureEntry.name,\n creationOptions: {\n size: {\n ...textureEntry.creationOptions.size\n },\n options: this._cloneTextureOptions(textureEntry.creationOptions.options),\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\n isHistoryTexture: false\n },\n namespace: textureEntry.namespace,\n textureIndex: textureEntry.textureIndex\n });\n }\n /**\n * Gets the absolute dimensions of a texture.\n * @param size The size of the texture. Width and height must be expressed as a percentage of the screen size (100=100%)!\n * @param screenWidth The width of the screen (default: the width of the rendering canvas)\n * @param screenHeight The height of the screen (default: the height of the rendering canvas)\n * @returns The absolute dimensions of the texture\n */\n getAbsoluteDimensions(size, screenWidth = this.engine.getRenderWidth(true), screenHeight = this.engine.getRenderHeight(true)) {\n const {\n width,\n height\n } = getDimensionsFromTextureSize(size);\n return {\n width: Math.floor(width * screenWidth / 100),\n height: Math.floor(height * screenHeight / 100)\n };\n }\n /** @internal */\n _dispose() {\n this._releaseTextures();\n }\n /** @internal */\n _allocateTextures() {\n this._textures.forEach(entry => {\n if (!entry.texture) {\n if (entry.refHandle !== undefined) {\n // entry is a dangling handle which has been resolved to point to refHandle\n // We simply update the texture to point to the refHandle texture\n const refEntry = this._textures.get(entry.refHandle);\n entry.texture = refEntry.texture;\n if (refEntry.refHandle === backbufferColorTextureHandle) {\n entry.refHandle = backbufferColorTextureHandle;\n }\n if (refEntry.refHandle === backbufferDepthStencilTextureHandle) {\n entry.refHandle = backbufferDepthStencilTextureHandle;\n }\n } else if (entry.namespace !== FrameGraphTextureNamespace.External) {\n var _creationOptions$opti, _creationOptions$opti2, _creationOptions$opti3, _creationOptions$opti4, _creationOptions$opti5, _creationOptions$opti6;\n const creationOptions = entry.creationOptions;\n const size = creationOptions.sizeIsPercentage ? this.getAbsoluteDimensions(creationOptions.size) : creationOptions.size;\n const textureIndex = entry.textureIndex || 0;\n const internalTextureCreationOptions = {\n createMipMaps: creationOptions.options.createMipMaps,\n samples: creationOptions.options.samples,\n type: (_creationOptions$opti = creationOptions.options.types) === null || _creationOptions$opti === void 0 ? void 0 : _creationOptions$opti[textureIndex],\n format: (_creationOptions$opti2 = creationOptions.options.formats) === null || _creationOptions$opti2 === void 0 ? void 0 : _creationOptions$opti2[textureIndex],\n useSRGBBuffer: (_creationOptions$opti3 = creationOptions.options.useSRGBBuffers) === null || _creationOptions$opti3 === void 0 ? void 0 : _creationOptions$opti3[textureIndex],\n creationFlags: (_creationOptions$opti4 = creationOptions.options.creationFlags) === null || _creationOptions$opti4 === void 0 ? void 0 : _creationOptions$opti4[textureIndex],\n label: (_creationOptions$opti5 = (_creationOptions$opti6 = creationOptions.options.labels) === null || _creationOptions$opti6 === void 0 ? void 0 : _creationOptions$opti6[textureIndex]) !== null && _creationOptions$opti5 !== void 0 ? _creationOptions$opti5 : `${entry.name}${textureIndex > 0 ? \"#\" + textureIndex : \"\"}`,\n samplingMode: 1,\n createMSAATexture: creationOptions.options.samples > 1\n };\n const isDepthTexture = IsDepthTexture(internalTextureCreationOptions.format);\n const hasStencil = HasStencilAspect(internalTextureCreationOptions.format);\n const source = isDepthTexture && hasStencil ? 12 /* InternalTextureSource.DepthStencil */ : isDepthTexture || hasStencil ? 14 /* InternalTextureSource.Depth */ : 5 /* InternalTextureSource.RenderTarget */;\n const internalTexture = this.engine._createInternalTexture(size, internalTextureCreationOptions, false, source);\n if (isDepthTexture) {\n internalTexture.type = GetTypeForDepthTexture(internalTexture.format);\n }\n entry.texture = internalTexture;\n }\n }\n if (entry.texture && entry.refHandle === undefined) {\n var _entry$debug;\n (_entry$debug = entry.debug) === null || _entry$debug === void 0 || _entry$debug.dispose();\n entry.debug = this._createDebugTexture(entry.name, entry.texture);\n }\n });\n this._historyTextures.forEach(entry => {\n for (let i = 0; i < entry.handles.length; i++) {\n entry.textures[i] = this._textures.get(entry.handles[i]).texture;\n }\n });\n }\n /** @internal */\n _releaseTextures(releaseAll = true) {\n this._textures.forEach((entry, handle) => {\n var _entry$texture;\n if (releaseAll || entry.namespace !== FrameGraphTextureNamespace.External) {\n var _entry$debug2;\n (_entry$debug2 = entry.debug) === null || _entry$debug2 === void 0 || _entry$debug2.dispose();\n entry.debug = undefined;\n }\n if (entry.namespace === FrameGraphTextureNamespace.External) {\n return;\n }\n (_entry$texture = entry.texture) === null || _entry$texture === void 0 || _entry$texture.dispose();\n entry.texture = null;\n if (releaseAll || entry.namespace === FrameGraphTextureNamespace.Task) {\n this._textures.delete(handle);\n }\n });\n this._historyTextures.forEach(entry => {\n for (let i = 0; i < entry.handles.length; i++) {\n entry.textures[i] = null;\n }\n });\n if (releaseAll) {\n this._textures.clear();\n this._historyTextures.clear();\n this._addSystemTextures();\n }\n }\n /** @internal */\n _updateHistoryTextures() {\n this._historyTextures.forEach(entry => {\n entry.index = entry.index ^ 1;\n const currentTexture = entry.textures[entry.index];\n if (currentTexture) {\n for (const {\n renderTargetWrapper,\n textureIndex\n } of entry.references) {\n renderTargetWrapper.setTexture(currentTexture, textureIndex, false);\n }\n }\n });\n }\n _addSystemTextures() {\n const size = {\n width: this.engine.getRenderWidth(true),\n height: this.engine.getRenderHeight(true)\n };\n this._textures.set(backbufferColorTextureHandle, {\n name: \"backbuffer color\",\n texture: null,\n creationOptions: {\n size,\n options: {\n createMipMaps: false,\n samples: this.engine.getCreationOptions().antialias ? 4 : 1,\n types: [0],\n // todo? get from engine\n formats: [5],\n // todo? get from engine\n useSRGBBuffers: [false],\n creationFlags: [0],\n labels: [\"backbuffer color\"]\n },\n sizeIsPercentage: false\n },\n namespace: FrameGraphTextureNamespace.External\n });\n this._textures.set(backbufferDepthStencilTextureHandle, {\n name: \"backbuffer depth/stencil\",\n texture: null,\n creationOptions: {\n size,\n options: {\n createMipMaps: false,\n samples: this.engine.getCreationOptions().antialias ? 4 : 1,\n types: [0],\n // todo? get from engine\n formats: [16],\n // todo? get from engine\n useSRGBBuffers: [false],\n creationFlags: [0],\n labels: [\"backbuffer depth/stencil\"]\n },\n sizeIsPercentage: false\n },\n namespace: FrameGraphTextureNamespace.External\n });\n }\n _createDebugTexture(name, texture) {\n if (!this._debugTextures) {\n return;\n }\n const textureDebug = new Texture(null, this._scene);\n textureDebug.name = name;\n textureDebug._texture = texture;\n textureDebug._texture.incrementReferences();\n return textureDebug;\n }\n _freeEntry(handle) {\n const entry = this._textures.get(handle);\n if (entry) {\n var _entry$debug3;\n (_entry$debug3 = entry.debug) === null || _entry$debug3 === void 0 || _entry$debug3.dispose();\n this._textures.delete(handle);\n }\n }\n _createHandleForTexture(name, texture, creationOptions, namespace, handle, textureIndex) {\n var _handle, _creationOptions$opti7, _creationOptions$opti8;\n handle = (_handle = handle) !== null && _handle !== void 0 ? _handle : FrameGraphTextureManager._Counter++;\n textureIndex = textureIndex || 0;\n const textureName = creationOptions.isHistoryTexture ? `${name} ping` : name;\n const label = (_creationOptions$opti7 = (_creationOptions$opti8 = creationOptions.options.labels) === null || _creationOptions$opti8 === void 0 ? void 0 : _creationOptions$opti8[textureIndex]) !== null && _creationOptions$opti7 !== void 0 ? _creationOptions$opti7 : \"\";\n const textureEntry = {\n texture,\n name: `${textureName}${label ? \" \" + label : \"\"}`,\n creationOptions: {\n size: textureSizeIsObject(creationOptions.size) ? creationOptions.size : {\n width: creationOptions.size,\n height: creationOptions.size\n },\n options: creationOptions.options,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n isHistoryTexture: creationOptions.isHistoryTexture\n },\n namespace,\n textureIndex\n };\n this._textures.set(handle, textureEntry);\n if (namespace === FrameGraphTextureNamespace.External) {\n return handle;\n }\n if (creationOptions.isHistoryTexture) {\n const pongCreationOptions = {\n size: {\n ...textureEntry.creationOptions.size\n },\n options: {\n ...textureEntry.creationOptions.options\n },\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\n isHistoryTexture: false\n };\n const pongTexture = this._createHandleForTexture(`${name} pong`, null, pongCreationOptions, namespace);\n this._historyTextures.set(handle, {\n textures: [null, null],\n handles: [handle, pongTexture],\n index: 0,\n references: []\n });\n return handle;\n }\n if (creationOptions.options.types && creationOptions.options.types.length > 1 && textureIndex === 0) {\n const textureCount = creationOptions.options.types.length;\n const creationOptionsForTexture = {\n size: textureSizeIsObject(creationOptions.size) ? creationOptions.size : {\n width: creationOptions.size,\n height: creationOptions.size\n },\n options: creationOptions.options,\n sizeIsPercentage: creationOptions.sizeIsPercentage\n };\n for (let i = 1; i < textureCount; i++) {\n this._createHandleForTexture(textureName, null, creationOptionsForTexture, namespace, handle + i, i);\n }\n FrameGraphTextureManager._Counter += textureCount - 1;\n }\n return handle;\n }\n _cloneTextureOptions(options, textureIndex) {\n return textureIndex !== undefined ? {\n createMipMaps: options.createMipMaps,\n samples: options.samples,\n types: options.types ? [options.types[textureIndex]] : undefined,\n formats: options.formats ? [options.formats[textureIndex]] : undefined,\n useSRGBBuffers: options.useSRGBBuffers ? [options.useSRGBBuffers[textureIndex]] : undefined,\n creationFlags: options.creationFlags ? [options.creationFlags[textureIndex]] : undefined,\n labels: options.labels ? [options.labels[textureIndex]] : undefined\n } : {\n createMipMaps: options.createMipMaps,\n samples: options.samples,\n types: options.types ? [...options.types] : undefined,\n formats: options.formats ? [...options.formats] : undefined,\n useSRGBBuffers: options.useSRGBBuffers ? [...options.useSRGBBuffers] : undefined,\n creationFlags: options.creationFlags ? [...options.creationFlags] : undefined,\n labels: options.labels ? [...options.labels] : undefined\n };\n }\n}\nFrameGraphTextureManager._Counter = 2; // 0 and 1 are reserved for backbuffer textures","map":{"version":3,"names":["getDimensionsFromTextureSize","textureSizeIsObject","Texture","backbufferColorTextureHandle","backbufferDepthStencilTextureHandle","GetTypeForDepthTexture","IsDepthTexture","HasStencilAspect","FrameGraphRenderTarget","FrameGraphTextureNamespace","FrameGraphTextureManager","constructor","engine","_debugTextures","_scene","_textures","Map","_historyTextures","_isRecordingTask","_addSystemTextures","isBackbuffer","handle","textureEntry","get","refHandle","isBackbufferColor","isBackbufferDepthStencil","isHistoryTexture","_entry$refHandle","entry","has","getTextureCreationOptions","creationOptions","size","sizeIsPercentage","options","_cloneTextureOptions","textureIndex","getTextureDescription","width","height","getAbsoluteDimensions","getTextureHandleOrCreateTexture","newTextureName","undefined","Error","createRenderTargetTexture","getTextureFromHandle","historyEntry","textures","index","texture","importTexture","name","_freeEntry","createMipMaps","generateMipMaps","samples","types","type","formats","format","useSRGBBuffers","_useSRGBBuffer","creationFlags","_creationFlags","labels","label","_createHandleForTexture","External","Task","Graph","createRenderTarget","renderTargets","renderTargetDepth","renderTarget","rtw","renderTargetWrapper","handles","Array","isArray","i","length","_this$_textures$get$r","_this$_textures$get","references","push","setTexture","createDanglingHandle","_Counter","resolveDanglingHandle","danglingHandle","set","namespace","screenWidth","getRenderWidth","screenHeight","getRenderHeight","Math","floor","_dispose","_releaseTextures","_allocateTextures","forEach","refEntry","_creationOptions$opti","_creationOptions$opti2","_creationOptions$opti3","_creationOptions$opti4","_creationOptions$opti5","_creationOptions$opti6","internalTextureCreationOptions","useSRGBBuffer","samplingMode","createMSAATexture","isDepthTexture","hasStencil","source","internalTexture","_createInternalTexture","_entry$debug","debug","dispose","_createDebugTexture","releaseAll","_entry$texture","_entry$debug2","delete","clear","_updateHistoryTextures","currentTexture","getCreationOptions","antialias","textureDebug","_texture","incrementReferences","_entry$debug3","_handle","_creationOptions$opti7","_creationOptions$opti8","textureName","pongCreationOptions","pongTexture","textureCount","creationOptionsForTexture"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FrameGraph/frameGraphTextureManager.js"],"sourcesContent":["import { getDimensionsFromTextureSize, textureSizeIsObject } from \"../Materials/Textures/textureCreationOptions.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"./frameGraphTypes.js\";\n\nimport { GetTypeForDepthTexture, IsDepthTexture, HasStencilAspect } from \"../Materials/Textures/internalTexture.js\";\nimport { FrameGraphRenderTarget } from \"./frameGraphRenderTarget.js\";\nvar FrameGraphTextureNamespace;\n(function (FrameGraphTextureNamespace) {\n FrameGraphTextureNamespace[FrameGraphTextureNamespace[\"Task\"] = 0] = \"Task\";\n FrameGraphTextureNamespace[FrameGraphTextureNamespace[\"Graph\"] = 1] = \"Graph\";\n FrameGraphTextureNamespace[FrameGraphTextureNamespace[\"External\"] = 2] = \"External\";\n})(FrameGraphTextureNamespace || (FrameGraphTextureNamespace = {}));\n/**\n * Manages the textures used by a frame graph\n * @experimental\n */\nexport class FrameGraphTextureManager {\n /**\n * Constructs a new instance of the texture manager\n * @param engine The engine to use\n * @param _debugTextures If true, debug textures will be created so that they are visible in the inspector\n * @param _scene The scene the manager belongs to\n */\n constructor(engine, _debugTextures = false, _scene) {\n this.engine = engine;\n this._debugTextures = _debugTextures;\n this._scene = _scene;\n /** @internal */\n this._textures = new Map();\n /** @internal */\n this._historyTextures = new Map();\n /** @internal */\n this._isRecordingTask = false;\n this._addSystemTextures();\n }\n /**\n * Checks if a handle is a backbuffer handle (color or depth/stencil)\n * @param handle The handle to check\n * @returns True if the handle is a backbuffer handle\n */\n isBackbuffer(handle) {\n if (handle === backbufferColorTextureHandle || handle === backbufferDepthStencilTextureHandle) {\n return true;\n }\n const textureEntry = this._textures.get(handle);\n if (!textureEntry) {\n return false;\n }\n return textureEntry.refHandle === backbufferColorTextureHandle || textureEntry.refHandle === backbufferDepthStencilTextureHandle;\n }\n /**\n * Checks if a handle is a backbuffer color handle\n * @param handle The handle to check\n * @returns True if the handle is a backbuffer color handle\n */\n isBackbufferColor(handle) {\n if (handle === backbufferColorTextureHandle) {\n return true;\n }\n const textureEntry = this._textures.get(handle);\n if (!textureEntry) {\n return false;\n }\n return textureEntry.refHandle === backbufferColorTextureHandle;\n }\n /**\n * Checks if a handle is a backbuffer depth/stencil handle\n * @param handle The handle to check\n * @returns True if the handle is a backbuffer depth/stencil handle\n */\n isBackbufferDepthStencil(handle) {\n if (handle === backbufferDepthStencilTextureHandle) {\n return true;\n }\n const textureEntry = this._textures.get(handle);\n if (!textureEntry) {\n return false;\n }\n return textureEntry.refHandle === backbufferDepthStencilTextureHandle;\n }\n /**\n * Checks if a handle is a history texture (or points to a history texture, for a dangling handle)\n * @param handle The handle to check\n * @returns True if the handle is a history texture, otherwise false\n */\n isHistoryTexture(handle) {\n const entry = this._textures.get(handle);\n if (!entry) {\n return false;\n }\n handle = entry.refHandle ?? handle;\n return this._historyTextures.has(handle);\n }\n /**\n * Gets the creation options of a texture\n * @param handle Handle of the texture\n * @returns The creation options of the texture\n */\n getTextureCreationOptions(handle) {\n const entry = this._textures.get(handle);\n const creationOptions = entry.creationOptions;\n return {\n size: textureSizeIsObject(creationOptions.size) ? { ...creationOptions.size } : creationOptions.size,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n options: this._cloneTextureOptions(creationOptions.options, entry.textureIndex),\n isHistoryTexture: creationOptions.isHistoryTexture,\n };\n }\n /**\n * Gets the description of a texture\n * @param handle Handle of the texture\n * @returns The description of the texture\n */\n getTextureDescription(handle) {\n const creationOptions = this.getTextureCreationOptions(handle);\n const size = !creationOptions.sizeIsPercentage\n ? textureSizeIsObject(creationOptions.size)\n ? creationOptions.size\n : { width: creationOptions.size, height: creationOptions.size }\n : this.getAbsoluteDimensions(creationOptions.size);\n return {\n size,\n options: creationOptions.options,\n };\n }\n /**\n * Gets a texture handle or creates a new texture if the handle is not provided.\n * If handle is not provided, newTextureName and creationOptions must be provided.\n * @param handle If provided, will simply return the handle\n * @param newTextureName Name of the new texture to create\n * @param creationOptions Options to use when creating the new texture\n * @returns The handle to the texture.\n */\n getTextureHandleOrCreateTexture(handle, newTextureName, creationOptions) {\n if (handle === undefined) {\n if (newTextureName === undefined || creationOptions === undefined) {\n throw new Error(\"getTextureHandleOrCreateTexture: Either handle or newTextureName and creationOptions must be provided.\");\n }\n return this.createRenderTargetTexture(newTextureName, creationOptions);\n }\n return handle;\n }\n /**\n * Gets a texture from a handle.\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\n * @param handle The handle of the texture\n * @returns The texture or null if not found\n */\n getTextureFromHandle(handle) {\n const historyEntry = this._historyTextures.get(handle);\n if (historyEntry) {\n return historyEntry.textures[historyEntry.index ^ 1]; // gets the read texture\n }\n return this._textures.get(handle).texture;\n }\n /**\n * Imports a texture into the texture manager\n * @param name Name of the texture\n * @param texture Texture to import\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\n * @returns The handle to the texture\n */\n importTexture(name, texture, handle) {\n if (handle !== undefined) {\n this._freeEntry(handle);\n }\n const creationOptions = {\n size: { width: texture.width, height: texture.height },\n sizeIsPercentage: false,\n isHistoryTexture: false,\n options: {\n createMipMaps: texture.generateMipMaps,\n samples: texture.samples,\n types: [texture.type],\n formats: [texture.format],\n useSRGBBuffers: [texture._useSRGBBuffer],\n creationFlags: [texture._creationFlags],\n labels: texture.label ? [texture.label] : [\"imported\"],\n },\n };\n return this._createHandleForTexture(name, texture, creationOptions, FrameGraphTextureNamespace.External, handle);\n }\n /**\n * Creates a new render target texture\n * If multiple textures are described in FrameGraphTextureCreationOptions, the handle of the first texture is returned, handle+1 is the handle of the second texture, etc.\n * @param name Name of the texture\n * @param creationOptions Options to use when creating the texture\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\n * @returns The handle to the texture\n */\n createRenderTargetTexture(name, creationOptions, handle) {\n return this._createHandleForTexture(name, null, {\n size: textureSizeIsObject(creationOptions.size) ? { ...creationOptions.size } : creationOptions.size,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n isHistoryTexture: creationOptions.isHistoryTexture,\n options: this._cloneTextureOptions(creationOptions.options),\n }, this._isRecordingTask ? FrameGraphTextureNamespace.Task : FrameGraphTextureNamespace.Graph, handle);\n }\n /**\n * Creates a (frame graph) render target wrapper\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\n * @param name Name of the render target wrapper\n * @param renderTargets Render target handles (textures) to use\n * @param renderTargetDepth Render target depth handle (texture) to use\n * @returns The created render target wrapper\n */\n createRenderTarget(name, renderTargets, renderTargetDepth) {\n const renderTarget = new FrameGraphRenderTarget(name, this, renderTargets, renderTargetDepth);\n const rtw = renderTarget.renderTargetWrapper;\n if (rtw !== undefined && renderTargets) {\n const handles = Array.isArray(renderTargets) ? renderTargets : [renderTargets];\n for (let i = 0; i < handles.length; i++) {\n let handle = handles[i];\n handle = this._textures.get(handle)?.refHandle ?? handle;\n const historyEntry = this._historyTextures.get(handle);\n if (historyEntry) {\n historyEntry.references.push({ renderTargetWrapper: rtw, textureIndex: i });\n rtw.setTexture(historyEntry.textures[historyEntry.index], i, false);\n }\n }\n }\n return renderTarget;\n }\n /**\n * Creates a handle which is not associated with any texture.\n * Call resolveDanglingHandle to associate the handle with a valid texture handle.\n * @returns The dangling handle\n */\n createDanglingHandle() {\n return FrameGraphTextureManager._Counter++;\n }\n /**\n * Associates a texture with a dangling handle\n * @param danglingHandle The dangling handle\n * @param handle The handle to associate with the dangling handle (if not provided, a new texture handle will be created, using the newTextureName and creationOptions parameters)\n * @param newTextureName The name of the new texture to create (if handle is not provided)\n * @param creationOptions The options to use when creating the new texture (if handle is not provided)\n */\n resolveDanglingHandle(danglingHandle, handle, newTextureName, creationOptions) {\n if (handle === undefined) {\n if (newTextureName === undefined || creationOptions === undefined) {\n throw new Error(\"resolveDanglingHandle: Either handle or newTextureName and creationOptions must be provided.\");\n }\n this.createRenderTargetTexture(newTextureName, creationOptions, danglingHandle);\n return;\n }\n const textureEntry = this._textures.get(handle);\n if (textureEntry === undefined) {\n throw new Error(`resolveDanglingHandle: Handle ${handle} does not exist!`);\n }\n this._textures.set(danglingHandle, {\n texture: textureEntry.texture,\n refHandle: handle,\n name: textureEntry.name,\n creationOptions: {\n size: { ...textureEntry.creationOptions.size },\n options: this._cloneTextureOptions(textureEntry.creationOptions.options),\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\n isHistoryTexture: false,\n },\n namespace: textureEntry.namespace,\n textureIndex: textureEntry.textureIndex,\n });\n }\n /**\n * Gets the absolute dimensions of a texture.\n * @param size The size of the texture. Width and height must be expressed as a percentage of the screen size (100=100%)!\n * @param screenWidth The width of the screen (default: the width of the rendering canvas)\n * @param screenHeight The height of the screen (default: the height of the rendering canvas)\n * @returns The absolute dimensions of the texture\n */\n getAbsoluteDimensions(size, screenWidth = this.engine.getRenderWidth(true), screenHeight = this.engine.getRenderHeight(true)) {\n const { width, height } = getDimensionsFromTextureSize(size);\n return {\n width: Math.floor((width * screenWidth) / 100),\n height: Math.floor((height * screenHeight) / 100),\n };\n }\n /** @internal */\n _dispose() {\n this._releaseTextures();\n }\n /** @internal */\n _allocateTextures() {\n this._textures.forEach((entry) => {\n if (!entry.texture) {\n if (entry.refHandle !== undefined) {\n // entry is a dangling handle which has been resolved to point to refHandle\n // We simply update the texture to point to the refHandle texture\n const refEntry = this._textures.get(entry.refHandle);\n entry.texture = refEntry.texture;\n if (refEntry.refHandle === backbufferColorTextureHandle) {\n entry.refHandle = backbufferColorTextureHandle;\n }\n if (refEntry.refHandle === backbufferDepthStencilTextureHandle) {\n entry.refHandle = backbufferDepthStencilTextureHandle;\n }\n }\n else if (entry.namespace !== FrameGraphTextureNamespace.External) {\n const creationOptions = entry.creationOptions;\n const size = creationOptions.sizeIsPercentage ? this.getAbsoluteDimensions(creationOptions.size) : creationOptions.size;\n const textureIndex = entry.textureIndex || 0;\n const internalTextureCreationOptions = {\n createMipMaps: creationOptions.options.createMipMaps,\n samples: creationOptions.options.samples,\n type: creationOptions.options.types?.[textureIndex],\n format: creationOptions.options.formats?.[textureIndex],\n useSRGBBuffer: creationOptions.options.useSRGBBuffers?.[textureIndex],\n creationFlags: creationOptions.options.creationFlags?.[textureIndex],\n label: creationOptions.options.labels?.[textureIndex] ?? `${entry.name}${textureIndex > 0 ? \"#\" + textureIndex : \"\"}`,\n samplingMode: 1,\n createMSAATexture: creationOptions.options.samples > 1,\n };\n const isDepthTexture = IsDepthTexture(internalTextureCreationOptions.format);\n const hasStencil = HasStencilAspect(internalTextureCreationOptions.format);\n const source = isDepthTexture && hasStencil\n ? 12 /* InternalTextureSource.DepthStencil */\n : isDepthTexture || hasStencil\n ? 14 /* InternalTextureSource.Depth */\n : 5 /* InternalTextureSource.RenderTarget */;\n const internalTexture = this.engine._createInternalTexture(size, internalTextureCreationOptions, false, source);\n if (isDepthTexture) {\n internalTexture.type = GetTypeForDepthTexture(internalTexture.format);\n }\n entry.texture = internalTexture;\n }\n }\n if (entry.texture && entry.refHandle === undefined) {\n entry.debug?.dispose();\n entry.debug = this._createDebugTexture(entry.name, entry.texture);\n }\n });\n this._historyTextures.forEach((entry) => {\n for (let i = 0; i < entry.handles.length; i++) {\n entry.textures[i] = this._textures.get(entry.handles[i]).texture;\n }\n });\n }\n /** @internal */\n _releaseTextures(releaseAll = true) {\n this._textures.forEach((entry, handle) => {\n if (releaseAll || entry.namespace !== FrameGraphTextureNamespace.External) {\n entry.debug?.dispose();\n entry.debug = undefined;\n }\n if (entry.namespace === FrameGraphTextureNamespace.External) {\n return;\n }\n entry.texture?.dispose();\n entry.texture = null;\n if (releaseAll || entry.namespace === FrameGraphTextureNamespace.Task) {\n this._textures.delete(handle);\n }\n });\n this._historyTextures.forEach((entry) => {\n for (let i = 0; i < entry.handles.length; i++) {\n entry.textures[i] = null;\n }\n });\n if (releaseAll) {\n this._textures.clear();\n this._historyTextures.clear();\n this._addSystemTextures();\n }\n }\n /** @internal */\n _updateHistoryTextures() {\n this._historyTextures.forEach((entry) => {\n entry.index = entry.index ^ 1;\n const currentTexture = entry.textures[entry.index];\n if (currentTexture) {\n for (const { renderTargetWrapper, textureIndex } of entry.references) {\n renderTargetWrapper.setTexture(currentTexture, textureIndex, false);\n }\n }\n });\n }\n _addSystemTextures() {\n const size = { width: this.engine.getRenderWidth(true), height: this.engine.getRenderHeight(true) };\n this._textures.set(backbufferColorTextureHandle, {\n name: \"backbuffer color\",\n texture: null,\n creationOptions: {\n size,\n options: {\n createMipMaps: false,\n samples: this.engine.getCreationOptions().antialias ? 4 : 1,\n types: [0], // todo? get from engine\n formats: [5], // todo? get from engine\n useSRGBBuffers: [false],\n creationFlags: [0],\n labels: [\"backbuffer color\"],\n },\n sizeIsPercentage: false,\n },\n namespace: FrameGraphTextureNamespace.External,\n });\n this._textures.set(backbufferDepthStencilTextureHandle, {\n name: \"backbuffer depth/stencil\",\n texture: null,\n creationOptions: {\n size,\n options: {\n createMipMaps: false,\n samples: this.engine.getCreationOptions().antialias ? 4 : 1,\n types: [0], // todo? get from engine\n formats: [16], // todo? get from engine\n useSRGBBuffers: [false],\n creationFlags: [0],\n labels: [\"backbuffer depth/stencil\"],\n },\n sizeIsPercentage: false,\n },\n namespace: FrameGraphTextureNamespace.External,\n });\n }\n _createDebugTexture(name, texture) {\n if (!this._debugTextures) {\n return;\n }\n const textureDebug = new Texture(null, this._scene);\n textureDebug.name = name;\n textureDebug._texture = texture;\n textureDebug._texture.incrementReferences();\n return textureDebug;\n }\n _freeEntry(handle) {\n const entry = this._textures.get(handle);\n if (entry) {\n entry.debug?.dispose();\n this._textures.delete(handle);\n }\n }\n _createHandleForTexture(name, texture, creationOptions, namespace, handle, textureIndex) {\n handle = handle ?? FrameGraphTextureManager._Counter++;\n textureIndex = textureIndex || 0;\n const textureName = creationOptions.isHistoryTexture ? `${name} ping` : name;\n const label = creationOptions.options.labels?.[textureIndex] ?? \"\";\n const textureEntry = {\n texture,\n name: `${textureName}${label ? \" \" + label : \"\"}`,\n creationOptions: {\n size: textureSizeIsObject(creationOptions.size) ? creationOptions.size : { width: creationOptions.size, height: creationOptions.size },\n options: creationOptions.options,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n isHistoryTexture: creationOptions.isHistoryTexture,\n },\n namespace,\n textureIndex,\n };\n this._textures.set(handle, textureEntry);\n if (namespace === FrameGraphTextureNamespace.External) {\n return handle;\n }\n if (creationOptions.isHistoryTexture) {\n const pongCreationOptions = {\n size: { ...textureEntry.creationOptions.size },\n options: { ...textureEntry.creationOptions.options },\n sizeIsPercentage: textureEntry.creationOptions.sizeIsPercentage,\n isHistoryTexture: false,\n };\n const pongTexture = this._createHandleForTexture(`${name} pong`, null, pongCreationOptions, namespace);\n this._historyTextures.set(handle, { textures: [null, null], handles: [handle, pongTexture], index: 0, references: [] });\n return handle;\n }\n if (creationOptions.options.types && creationOptions.options.types.length > 1 && textureIndex === 0) {\n const textureCount = creationOptions.options.types.length;\n const creationOptionsForTexture = {\n size: textureSizeIsObject(creationOptions.size) ? creationOptions.size : { width: creationOptions.size, height: creationOptions.size },\n options: creationOptions.options,\n sizeIsPercentage: creationOptions.sizeIsPercentage,\n };\n for (let i = 1; i < textureCount; i++) {\n this._createHandleForTexture(textureName, null, creationOptionsForTexture, namespace, handle + i, i);\n }\n FrameGraphTextureManager._Counter += textureCount - 1;\n }\n return handle;\n }\n _cloneTextureOptions(options, textureIndex) {\n return textureIndex !== undefined\n ? {\n createMipMaps: options.createMipMaps,\n samples: options.samples,\n types: options.types ? [options.types[textureIndex]] : undefined,\n formats: options.formats ? [options.formats[textureIndex]] : undefined,\n useSRGBBuffers: options.useSRGBBuffers ? [options.useSRGBBuffers[textureIndex]] : undefined,\n creationFlags: options.creationFlags ? [options.creationFlags[textureIndex]] : undefined,\n labels: options.labels ? [options.labels[textureIndex]] : undefined,\n }\n : {\n createMipMaps: options.createMipMaps,\n samples: options.samples,\n types: options.types ? [...options.types] : undefined,\n formats: options.formats ? [...options.formats] : undefined,\n useSRGBBuffers: options.useSRGBBuffers ? [...options.useSRGBBuffers] : undefined,\n creationFlags: options.creationFlags ? [...options.creationFlags] : undefined,\n labels: options.labels ? [...options.labels] : undefined,\n };\n }\n}\nFrameGraphTextureManager._Counter = 2; // 0 and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