{"ast":null,"code":"import { InternalTexture } from \"../../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\nimport { WebGPUEngine } from \"../../webgpuEngine.js\";\nWebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (rtWrapper, disableGenerateMipMaps = false, onBeforeUnbind) {\n if (onBeforeUnbind) {\n onBeforeUnbind();\n }\n this._endCurrentRenderPass();\n if (!disableGenerateMipMaps) {\n this.generateMipMapsMultiFramebuffer(rtWrapper);\n }\n this._currentRenderTarget = null;\n this._mrtAttachments = [];\n this._cacheRenderPipeline.setMRT([]);\n this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);\n};\nWebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, initializeBuffers) {\n var _size$width, _size$height, _options$label;\n let generateMipMaps = false;\n let generateDepthBuffer = true;\n let generateStencilBuffer = false;\n let generateDepthTexture = false;\n let depthTextureFormat = 15;\n let textureCount = 1;\n let samples = 1;\n const defaultType = 0;\n const defaultSamplingMode = 3;\n const defaultUseSRGBBuffer = false;\n const defaultFormat = 5;\n const defaultTarget = 3553;\n let types = [];\n let samplingModes = [];\n let useSRGBBuffers = [];\n let formats = [];\n let targets = [];\n let faceIndex = [];\n let layerIndex = [];\n let layers = [];\n let labels = [];\n let creationFlags = [];\n let dontCreateTextures = false;\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size);\n if (options !== undefined) {\n var _options$generateMipM, _options$generateDept, _options$generateSten, _options$generateDept2, _options$textureCount, _options$depthTexture, _options$samples, _options$dontCreateTe;\n generateMipMaps = (_options$generateMipM = options.generateMipMaps) !== null && _options$generateMipM !== void 0 ? _options$generateMipM : false;\n generateDepthBuffer = (_options$generateDept = options.generateDepthBuffer) !== null && _options$generateDept !== void 0 ? _options$generateDept : true;\n generateStencilBuffer = (_options$generateSten = options.generateStencilBuffer) !== null && _options$generateSten !== void 0 ? _options$generateSten : false;\n generateDepthTexture = (_options$generateDept2 = options.generateDepthTexture) !== null && _options$generateDept2 !== void 0 ? _options$generateDept2 : false;\n textureCount = (_options$textureCount = options.textureCount) !== null && _options$textureCount !== void 0 ? _options$textureCount : 1;\n depthTextureFormat = (_options$depthTexture = options.depthTextureFormat) !== null && _options$depthTexture !== void 0 ? _options$depthTexture : 15;\n types = options.types || types;\n samplingModes = options.samplingModes || samplingModes;\n useSRGBBuffers = options.useSRGBBuffers || useSRGBBuffers;\n formats = options.formats || formats;\n targets = options.targetTypes || targets;\n faceIndex = options.faceIndex || faceIndex;\n layerIndex = options.layerIndex || layerIndex;\n layers = options.layerCounts || layers;\n labels = options.labels || labels;\n creationFlags = options.creationFlags || creationFlags;\n samples = (_options$samples = options.samples) !== null && _options$samples !== void 0 ? _options$samples : samples;\n dontCreateTextures = (_options$dontCreateTe = options.dontCreateTextures) !== null && _options$dontCreateTe !== void 0 ? _options$dontCreateTe : false;\n }\n const width = (_size$width = size.width) !== null && _size$width !== void 0 ? _size$width : size;\n const height = (_size$height = size.height) !== null && _size$height !== void 0 ? _size$height : size;\n const textures = [];\n const attachments = [];\n const defaultAttachments = [];\n rtWrapper.label = (_options$label = options === null || options === void 0 ? void 0 : options.label) !== null && _options$label !== void 0 ? _options$label : \"MultiRenderTargetWrapper\";\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\n rtWrapper._attachments = attachments;\n rtWrapper._defaultAttachments = defaultAttachments;\n let depthStencilTexture = null;\n if ((generateDepthBuffer || generateStencilBuffer || generateDepthTexture) && !dontCreateTextures) {\n if (!generateDepthTexture) {\n // The caller doesn't want a depth texture, so we are free to use the depth texture format we want.\n // So, we will align with what the WebGL engine does\n if (generateDepthBuffer && generateStencilBuffer) {\n depthTextureFormat = 13;\n } else if (generateDepthBuffer) {\n depthTextureFormat = 14;\n } else {\n depthTextureFormat = 19;\n }\n }\n depthStencilTexture = rtWrapper.createDepthStencilTexture(0, false, generateStencilBuffer, 1, depthTextureFormat, rtWrapper.label + \"-DepthStencil\");\n }\n const mipmapsCreationOnly = options !== undefined && typeof options === \"object\" && options.createMipMaps && !generateMipMaps;\n for (let i = 0; i < textureCount; i++) {\n var _layers$i, _labels$i;\n let samplingMode = samplingModes[i] || defaultSamplingMode;\n let type = types[i] || defaultType;\n const format = formats[i] || defaultFormat;\n const useSRGBBuffer = (useSRGBBuffers[i] || defaultUseSRGBBuffer) && this._caps.supportSRGBBuffers;\n const target = targets[i] || defaultTarget;\n const layerCount = (_layers$i = layers[i]) !== null && _layers$i !== void 0 ? _layers$i : 1;\n const creationFlag = creationFlags[i];\n if (type === 1 && !this._caps.textureFloatLinearFiltering) {\n // if floating point linear (FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n } else if (type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n if (type === 1 && !this._caps.textureFloat) {\n type = 0;\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\n }\n attachments.push(i + 1);\n defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);\n if (target === -1 || dontCreateTextures) {\n continue;\n }\n const texture = new InternalTexture(this, 6 /* InternalTextureSource.MultiRenderTarget */);\n textures[i] = texture;\n switch (target) {\n case 34067:\n texture.isCube = true;\n break;\n case 32879:\n texture.is3D = true;\n texture.baseDepth = texture.depth = layerCount;\n break;\n case 35866:\n texture.is2DArray = true;\n texture.baseDepth = texture.depth = layerCount;\n break;\n }\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.width = width;\n texture.height = height;\n texture.isReady = true;\n texture.samples = 1;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.type = type;\n texture._cachedWrapU = 0;\n texture._cachedWrapV = 0;\n texture._useSRGBBuffer = useSRGBBuffer;\n texture.format = format;\n texture.label = (_labels$i = labels[i]) !== null && _labels$i !== void 0 ? _labels$i : rtWrapper.label + \"-Texture\" + i;\n this._internalTexturesCache.push(texture);\n if (mipmapsCreationOnly) {\n // createGPUTextureForInternalTexture will only create a texture with mipmaps if generateMipMaps is true, as InternalTexture has no createMipMaps property, separate from generateMipMaps.\n texture.generateMipMaps = true;\n }\n this._textureHelper.createGPUTextureForInternalTexture(texture, undefined, undefined, undefined, creationFlag, true);\n if (mipmapsCreationOnly) {\n texture.generateMipMaps = false;\n }\n }\n if (depthStencilTexture) {\n depthStencilTexture.incrementReferences();\n textures[textureCount] = depthStencilTexture;\n this._internalTexturesCache.push(depthStencilTexture);\n }\n rtWrapper.setTextures(textures);\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\n if (!dontCreateTextures) {\n this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);\n } else {\n rtWrapper._samples = samples;\n }\n return rtWrapper;\n};\nWebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper, samples) {\n if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures.length === 0 || rtWrapper.textures[0].samples === samples) {\n return samples;\n }\n const count = rtWrapper.textures.length;\n if (count === 0) {\n return 1;\n }\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\n for (let i = 0; i < count; ++i) {\n const texture = rtWrapper.textures[i];\n const gpuTextureWrapper = texture._hardwareTexture;\n gpuTextureWrapper === null || gpuTextureWrapper === void 0 || gpuTextureWrapper.releaseMSAATexture(rtWrapper.getBaseArrayLayer(i));\n }\n // Note that rtWrapper.textures can't have null textures, lastTextureIsDepthTexture can't be true if rtWrapper._depthStencilTexture is null\n const lastTextureIsDepthTexture = rtWrapper._depthStencilTexture === rtWrapper.textures[count - 1];\n for (let i = 0; i < count; ++i) {\n const texture = rtWrapper.textures[i];\n this._textureHelper.createMSAATexture(texture, samples, false, rtWrapper.getBaseArrayLayer(i));\n texture.samples = samples;\n }\n // Note that the last texture of textures is the depth texture if the depth texture has been generated by the MRT class and so the MSAA texture\n // will be recreated for this texture by the loop above: in that case, there's no need to create the MSAA texture for rtWrapper._depthStencilTexture\n // because rtWrapper._depthStencilTexture is the same texture than the depth texture\n if (rtWrapper._depthStencilTexture && !lastTextureIsDepthTexture) {\n this._textureHelper.createMSAATexture(rtWrapper._depthStencilTexture, samples);\n rtWrapper._depthStencilTexture.samples = samples;\n }\n rtWrapper._samples = samples;\n return samples;\n};\nWebGPUEngine.prototype.generateMipMapsMultiFramebuffer = function (texture) {\n const rtWrapper = texture;\n if (!rtWrapper.isMulti) {\n return;\n }\n const attachments = rtWrapper._attachments;\n const count = attachments.length;\n for (let i = 0; i < count; i++) {\n const texture = rtWrapper.textures[i];\n if (texture.generateMipMaps && !texture.isCube && !texture.is3D) {\n this._generateMipmaps(texture);\n }\n }\n};\nWebGPUEngine.prototype.resolveMultiFramebuffer = function (_texture) {\n throw new Error(\"resolveMultiFramebuffer is not yet implemented in WebGPU!\");\n};\nWebGPUEngine.prototype.bindAttachments = function (attachments) {\n if (attachments.length === 0 || !this._currentRenderTarget) {\n return;\n }\n this._mrtAttachments = attachments;\n if (this._currentRenderPass) {\n // the render pass has already been created, we need to call setMRTAttachments to update the state of the attachments\n this._cacheRenderPipeline.setMRTAttachments(attachments);\n } else {\n // the render pass is not created yet so we don't need to call setMRTAttachments: it will be called as part of the render pass creation (see WebGPUEngine._startRenderTargetRenderPass)\n }\n};\nWebGPUEngine.prototype.buildTextureLayout = function (textureStatus) {\n const result = [];\n for (let i = 0; i < textureStatus.length; i++) {\n if (textureStatus[i]) {\n result.push(i + 1);\n } else {\n result.push(0);\n }\n }\n return result;\n};\nWebGPUEngine.prototype.restoreSingleAttachment = function () {\n // not sure what to do, probably nothing... This function and restoreSingleAttachmentForRenderTarget are not called in Babylon.js so it's hard to know the use case\n};\nWebGPUEngine.prototype.restoreSingleAttachmentForRenderTarget = function () {\n // not sure what to do, probably nothing... This function and restoreSingleAttachment are not called in Babylon.js so it's hard to know the use case\n};","map":{"version":3,"names":["InternalTexture","Logger","WebGPUEngine","prototype","unBindMultiColorAttachmentFramebuffer","rtWrapper","disableGenerateMipMaps","onBeforeUnbind","_endCurrentRenderPass","generateMipMapsMultiFramebuffer","_currentRenderTarget","_mrtAttachments","_cacheRenderPipeline","setMRT","setMRTAttachments","createMultipleRenderTarget","size","options","initializeBuffers","_size$width","_size$height","_options$label","generateMipMaps","generateDepthBuffer","generateStencilBuffer","generateDepthTexture","depthTextureFormat","textureCount","samples","defaultType","defaultSamplingMode","defaultUseSRGBBuffer","defaultFormat","defaultTarget","types","samplingModes","useSRGBBuffers","formats","targets","faceIndex","layerIndex","layers","labels","creationFlags","dontCreateTextures","_createHardwareRenderTargetWrapper","undefined","_options$generateMipM","_options$generateDept","_options$generateSten","_options$generateDept2","_options$textureCount","_options$depthTexture","_options$samples","_options$dontCreateTe","targetTypes","layerCounts","width","height","textures","attachments","defaultAttachments","label","_generateDepthBuffer","_generateStencilBuffer","_attachments","_defaultAttachments","depthStencilTexture","createDepthStencilTexture","mipmapsCreationOnly","createMipMaps","i","_layers$i","_labels$i","samplingMode","type","format","useSRGBBuffer","_caps","supportSRGBBuffers","target","layerCount","creationFlag","textureFloatLinearFiltering","textureHalfFloatLinearFiltering","textureFloat","Warn","push","texture","isCube","is3D","baseDepth","depth","is2DArray","baseWidth","baseHeight","isReady","_cachedWrapU","_cachedWrapV","_useSRGBBuffer","_internalTexturesCache","_textureHelper","createGPUTextureForInternalTexture","incrementReferences","setTextures","setLayerAndFaceIndices","updateMultipleRenderTargetTextureSampleCount","_samples","length","count","Math","min","getCaps","maxMSAASamples","gpuTextureWrapper","_hardwareTexture","releaseMSAATexture","getBaseArrayLayer","lastTextureIsDepthTexture","_depthStencilTexture","createMSAATexture","isMulti","_generateMipmaps","resolveMultiFramebuffer","_texture","Error","bindAttachments","_currentRenderPass","buildTextureLayout","textureStatus","result","restoreSingleAttachment","restoreSingleAttachmentForRenderTarget"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/WebGPU/Extensions/engine.multiRender.js"],"sourcesContent":["import { InternalTexture } from \"../../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\n\nimport { WebGPUEngine } from \"../../webgpuEngine.js\";\nWebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (rtWrapper, disableGenerateMipMaps = false, onBeforeUnbind) {\n if (onBeforeUnbind) {\n onBeforeUnbind();\n }\n this._endCurrentRenderPass();\n if (!disableGenerateMipMaps) {\n this.generateMipMapsMultiFramebuffer(rtWrapper);\n }\n this._currentRenderTarget = null;\n this._mrtAttachments = [];\n this._cacheRenderPipeline.setMRT([]);\n this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);\n};\nWebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, initializeBuffers) {\n let generateMipMaps = false;\n let generateDepthBuffer = true;\n let generateStencilBuffer = false;\n let generateDepthTexture = false;\n let depthTextureFormat = 15;\n let textureCount = 1;\n let samples = 1;\n const defaultType = 0;\n const defaultSamplingMode = 3;\n const defaultUseSRGBBuffer = false;\n const defaultFormat = 5;\n const defaultTarget = 3553;\n let types = [];\n let samplingModes = [];\n let useSRGBBuffers = [];\n let formats = [];\n let targets = [];\n let faceIndex = [];\n let layerIndex = [];\n let layers = [];\n let labels = [];\n let creationFlags = [];\n let dontCreateTextures = false;\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size);\n if (options !== undefined) {\n generateMipMaps = options.generateMipMaps ?? false;\n generateDepthBuffer = options.generateDepthBuffer ?? true;\n generateStencilBuffer = options.generateStencilBuffer ?? false;\n generateDepthTexture = options.generateDepthTexture ?? false;\n textureCount = options.textureCount ?? 1;\n depthTextureFormat = options.depthTextureFormat ?? 15;\n types = options.types || types;\n samplingModes = options.samplingModes || samplingModes;\n useSRGBBuffers = options.useSRGBBuffers || useSRGBBuffers;\n formats = options.formats || formats;\n targets = options.targetTypes || targets;\n faceIndex = options.faceIndex || faceIndex;\n layerIndex = options.layerIndex || layerIndex;\n layers = options.layerCounts || layers;\n labels = options.labels || labels;\n creationFlags = options.creationFlags || creationFlags;\n samples = options.samples ?? samples;\n dontCreateTextures = options.dontCreateTextures ?? false;\n }\n const width = size.width ?? size;\n const height = size.height ?? size;\n const textures = [];\n const attachments = [];\n const defaultAttachments = [];\n rtWrapper.label = options?.label ?? \"MultiRenderTargetWrapper\";\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\n rtWrapper._attachments = attachments;\n rtWrapper._defaultAttachments = defaultAttachments;\n let depthStencilTexture = null;\n if ((generateDepthBuffer || generateStencilBuffer || generateDepthTexture) && !dontCreateTextures) {\n if (!generateDepthTexture) {\n // The caller doesn't want a depth texture, so we are free to use the depth texture format we want.\n // So, we will align with what the WebGL engine does\n if (generateDepthBuffer && generateStencilBuffer) {\n depthTextureFormat = 13;\n }\n else if (generateDepthBuffer) {\n depthTextureFormat = 14;\n }\n else {\n depthTextureFormat = 19;\n }\n }\n depthStencilTexture = rtWrapper.createDepthStencilTexture(0, false, generateStencilBuffer, 1, depthTextureFormat, rtWrapper.label + \"-DepthStencil\");\n }\n const mipmapsCreationOnly = options !== undefined && typeof options === \"object\" && options.createMipMaps && !generateMipMaps;\n for (let i = 0; i < textureCount; i++) {\n let samplingMode = samplingModes[i] || defaultSamplingMode;\n let type = types[i] || defaultType;\n const format = formats[i] || defaultFormat;\n const useSRGBBuffer = (useSRGBBuffers[i] || defaultUseSRGBBuffer) && this._caps.supportSRGBBuffers;\n const target = targets[i] || defaultTarget;\n const layerCount = layers[i] ?? 1;\n const creationFlag = creationFlags[i];\n if (type === 1 && !this._caps.textureFloatLinearFiltering) {\n // if floating point linear (FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n else if (type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n if (type === 1 && !this._caps.textureFloat) {\n type = 0;\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\n }\n attachments.push(i + 1);\n defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);\n if (target === -1 || dontCreateTextures) {\n continue;\n }\n const texture = new InternalTexture(this, 6 /* InternalTextureSource.MultiRenderTarget */);\n textures[i] = texture;\n switch (target) {\n case 34067:\n texture.isCube = true;\n break;\n case 32879:\n texture.is3D = true;\n texture.baseDepth = texture.depth = layerCount;\n break;\n case 35866:\n texture.is2DArray = true;\n texture.baseDepth = texture.depth = layerCount;\n break;\n }\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.width = width;\n texture.height = height;\n texture.isReady = true;\n texture.samples = 1;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.type = type;\n texture._cachedWrapU = 0;\n texture._cachedWrapV = 0;\n texture._useSRGBBuffer = useSRGBBuffer;\n texture.format = format;\n texture.label = labels[i] ?? rtWrapper.label + \"-Texture\" + i;\n this._internalTexturesCache.push(texture);\n if (mipmapsCreationOnly) {\n // createGPUTextureForInternalTexture will only create a texture with mipmaps if generateMipMaps is true, as InternalTexture has no createMipMaps property, separate from generateMipMaps.\n texture.generateMipMaps = true;\n }\n this._textureHelper.createGPUTextureForInternalTexture(texture, undefined, undefined, undefined, creationFlag, true);\n if (mipmapsCreationOnly) {\n texture.generateMipMaps = false;\n }\n }\n if (depthStencilTexture) {\n depthStencilTexture.incrementReferences();\n textures[textureCount] = depthStencilTexture;\n this._internalTexturesCache.push(depthStencilTexture);\n }\n rtWrapper.setTextures(textures);\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\n if (!dontCreateTextures) {\n this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);\n }\n else {\n rtWrapper._samples = samples;\n }\n return rtWrapper;\n};\nWebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper, samples) {\n if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures.length === 0 || rtWrapper.textures[0].samples === samples) {\n return samples;\n }\n const count = rtWrapper.textures.length;\n if (count === 0) {\n return 1;\n }\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\n for (let i = 0; i < count; ++i) {\n const texture = rtWrapper.textures[i];\n const gpuTextureWrapper = texture._hardwareTexture;\n gpuTextureWrapper?.releaseMSAATexture(rtWrapper.getBaseArrayLayer(i));\n }\n // Note that rtWrapper.textures can't have null textures, lastTextureIsDepthTexture can't be true if rtWrapper._depthStencilTexture is null\n const lastTextureIsDepthTexture = rtWrapper._depthStencilTexture === rtWrapper.textures[count - 1];\n for (let i = 0; i < count; ++i) {\n const texture = rtWrapper.textures[i];\n this._textureHelper.createMSAATexture(texture, samples, false, rtWrapper.getBaseArrayLayer(i));\n texture.samples = samples;\n }\n // Note that the last texture of textures is the depth texture if the depth texture has been generated by the MRT class and so the MSAA texture\n // will be recreated for this texture by the loop above: in that case, there's no need to create the MSAA texture for rtWrapper._depthStencilTexture\n // because rtWrapper._depthStencilTexture is the same texture than the depth texture\n if (rtWrapper._depthStencilTexture && !lastTextureIsDepthTexture) {\n this._textureHelper.createMSAATexture(rtWrapper._depthStencilTexture, samples);\n rtWrapper._depthStencilTexture.samples = samples;\n }\n rtWrapper._samples = samples;\n return samples;\n};\nWebGPUEngine.prototype.generateMipMapsMultiFramebuffer = function (texture) {\n const rtWrapper = texture;\n if (!rtWrapper.isMulti) {\n return;\n }\n const attachments = rtWrapper._attachments;\n const count = attachments.length;\n for (let i = 0; i < count; i++) {\n const texture = rtWrapper.textures[i];\n if (texture.generateMipMaps && !texture.isCube && !texture.is3D) {\n this._generateMipmaps(texture);\n }\n }\n};\nWebGPUEngine.prototype.resolveMultiFramebuffer = function (_texture) {\n throw new Error(\"resolveMultiFramebuffer is not yet implemented in WebGPU!\");\n};\nWebGPUEngine.prototype.bindAttachments = function (attachments) {\n if (attachments.length === 0 || !this._currentRenderTarget) {\n return;\n }\n this._mrtAttachments = attachments;\n if (this._currentRenderPass) {\n // the render pass has already been created, we need to call setMRTAttachments to update the state of the attachments\n this._cacheRenderPipeline.setMRTAttachments(attachments);\n }\n else {\n // the render pass is not created yet so we don't need to call setMRTAttachments: it will be called as part of the render pass creation (see WebGPUEngine._startRenderTargetRenderPass)\n }\n};\nWebGPUEngine.prototype.buildTextureLayout = function (textureStatus) {\n const result = [];\n for (let i = 0; i < textureStatus.length; i++) {\n if (textureStatus[i]) {\n result.push(i + 1);\n }\n else {\n result.push(0);\n }\n }\n return result;\n};\nWebGPUEngine.prototype.restoreSingleAttachment = function () {\n // not sure what to do, probably nothing... This function and restoreSingleAttachmentForRenderTarget are not called in Babylon.js so it's hard to know the use case\n};\nWebGPUEngine.prototype.restoreSingleAttachmentForRenderTarget = function () {\n // not sure what to do, probably nothing... This function and restoreSingleAttachment are not called in Babylon.js so it's hard to know the use case\n};\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,gDAAgD;AAChF,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,SAASC,YAAY,QAAQ,uBAAuB;AACpDA,YAAY,CAACC,SAAS,CAACC,qCAAqC,GAAG,UAAUC,SAAS,EAAEC,sBAAsB,GAAG,KAAK,EAAEC,cAAc,EAAE;EAChI,IAAIA,cAAc,EAAE;IAChBA,cAAc,CAAC,CAAC;EACpB;EACA,IAAI,CAACC,qBAAqB,CAAC,CAAC;EAC5B,IAAI,CAACF,sBAAsB,EAAE;IACzB,IAAI,CAACG,+BAA+B,CAACJ,SAAS,CAAC;EACnD;EACA,IAAI,CAACK,oBAAoB,GAAG,IAAI;EAChC,IAAI,CAACC,eAAe,GAAG,EAAE;EACzB,IAAI,CAACC,oBAAoB,CAACC,MAAM,CAAC,EAAE,CAAC;EACpC,IAAI,CAACD,oBAAoB,CAACE,iBAAiB,CAAC,IAAI,CAACH,eAAe,CAAC;AACrE,CAAC;AACDT,YAAY,CAACC,SAAS,CAACY,0BAA0B,GAAG,UAAUC,IAAI,EAAEC,OAAO,EAAEC,iBAAiB,EAAE;EAA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