{"record":{"id":"a772dbf51a2873e0","repo":"BabylonJS/Babylon.js","slug":"framegraphgeneratemipmapstask-this-name-target-a772db","errorCode":null,"errorMessage":"FrameGraphGenerateMipMapsTask ${this.name}: targetTexture must have createMipMaps set to true","messagePattern":"FrameGraphGenerateMipMapsTask (.+?): targetTexture must have createMipMaps set to true","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Texture/generateMipMapsTask.ts","lineNumber":43,"sourceCode":"\r\n        this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphGenerateMipMapsTask\";\r\n    }\r\n\r\n    public record() {\r\n        if (this.targetTexture === undefined) {\r\n            throw new Error(`FrameGraphGenerateMipMapsTask ${this.name}: targetTexture is required`);\r\n        }\r\n\r\n        this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n\r\n        const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n\r\n        if (!outputTextureDescription.options.createMipMaps) {\r\n            throw new Error(`FrameGraphGenerateMipMapsTask ${this.name}: targetTexture must have createMipMaps set to true`);\r\n        }\r\n\r\n        const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n        pass.setRenderTarget(this.outputTexture);\r\n        pass.setExecuteFunc((context) => {\r\n            context.generateMipMaps();\r\n        });\r\n\r\n        const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n        passDisabled.setRenderTarget(this.outputTexture);\r\n        passDisabled.setExecuteFunc((_context) => {});\r\n    }\r\n}\r\n","sourceCodeStart":25,"sourceCodeEnd":59,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Texture/generateMipMapsTask.ts#L25-L59","documentation":"After resolving the target texture, FrameGraphGenerateMipMapsTask.record() checks the texture description's options.createMipMaps flag. Generating mipmaps on a texture that was not allocated with mip levels is invalid, so the task throws. The texture must be created with createMipMaps: true so its mip chain exists.","triggerScenarios":"Assigning a targetTexture created via frameGraph.createTexture with options.createMipMaps false/undefined (default) and then running the mipmap generation task.","commonSituations":"Reusing an existing render-target texture (created without mipmaps) as a mipmap generation input; changing texture creation options in one place but not the pipeline that assumes mipmaps; copying texture creation code where createMipMaps was omitted.","solutions":["Recreate the target texture with options.createMipMaps: true in frameGraph.createTexture.","Point targetTexture at a texture that was allocated with mipmaps.","Remove the mipmap generation task if the texture should stay single-resolution."],"exampleFix":"// before\nconst tex = fg.createTexture({ name: 'tex', options: { size: { width: 512, height: 512 } } });\n// after\nconst tex = fg.createTexture({ name: 'tex', options: { size: { width: 512, height: 512 }, createMipMaps: true } });","handlingStrategy":"validation","validationCode":"const desc = frameGraph.textureManager.getTextureDescription(mipTask.targetTexture);\nif (!desc.options.createMipMaps) {\n  throw new Error('mipmap target must be created with createMipMaps: true');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass createMipMaps: true in createTexture options for textures destined for mipmap generation.","Pair texture creation options with the tasks that consume the texture in one config module."],"tags":["babylonjs","framegraph","mipmap","texture-creation","validation"],"backgroundTag":"texture-not-created-with-mipmaps","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}