{"version":3,"file":"RenderTarget.js","sources":["../../../../../src/rendering/renderers/shared/renderTarget/RenderTarget.ts"],"sourcesContent":["// what we are building is a platform and a framework.\n// import { Matrix } from '../../shared/maths/Matrix';\nimport EventEmitter from 'eventemitter3';\nimport { uid } from '../../../../utils/data/uid';\nimport { TextureSource } from '../texture/sources/TextureSource';\nimport { Texture } from '../texture/Texture';\n\nimport type { BindableTexture } from '../texture/Texture';\n\n/**\n * Options for creating a render target.\n * @category rendering\n * @advanced\n */\nexport interface RenderTargetOptions\n{\n    /** the width of the RenderTarget */\n    width?: number;\n    /** the height of the RenderTarget */\n    height?: number;\n    /** the resolution of the RenderTarget */\n    resolution?: number;\n    /** an array of textures, or a number indicating how many color textures there should be */\n    colorTextures?: BindableTexture[] | number;\n    /** should this render target have a stencil buffer? */\n    stencil?: boolean;\n    /** should this render target have a depth buffer? */\n    depth?: boolean;\n    /** a depth stencil texture that the depth and stencil outputs will be written to */\n    depthStencilTexture?: BindableTexture | boolean;\n    /** a label for debugging — shows up on the render pass in GPU debuggers (WebGPU) */\n    label?: string;\n    /** should this render target be antialiased? */\n    antialias?: boolean;\n    /** is this a root element, true if this is gl context owners render target */\n    isRoot?: boolean;\n}\n\n/**\n * Descriptor for creating a RenderTarget from a WebGPU-flavored descriptor.\n * @category rendering\n * @advanced\n */\nexport interface RenderTargetDescriptor\n{\n    /** The color attachments to use */\n    colorAttachments: PixiColorAttachment[];\n    /** The depth/stencil attachment to use */\n    depthStencilAttachment?: PixiDepthStencilAttachment;\n    /** Is this a root element, true if this is gl context owners render target */\n    isRoot?: boolean;\n    /** a label for debugging — shows up on the render pass in GPU debuggers (WebGPU) */\n    label?: string;\n}\n\n/**\n * A Pixi-flavored Color Attachment that mirrors the WebGPU spec but replaces low-level JIT requirements\n * with high-level Pixi objects (like `texture`).\n * @example\n * ```typescript\n * import { RenderTarget, TextureSource } from 'pixi.js';\n *\n * const renderTarget = new RenderTarget({\n *     colorAttachments: [{\n *         texture: new TextureSource({ width: 100, height: 100 }),\n *         loadOp: 'clear', // Clears the texture before rendering\n *         clearValue: [1, 0, 0, 1], // Clears to red\n *     }]\n * });\n * ```\n * @category rendering\n * @advanced\n */\nexport interface PixiColorAttachment extends Omit<GPURenderPassColorAttachment, 'view' | 'resolveTarget'>\n{\n    /** The Pixi texture to render to. */\n    texture: TextureSource;\n    /**\n     * Optional overrides for how the GPU views the texture (e.g., viewing a specific aspect or dimension).\n     * Rarely needed for 2D, but incredibly powerful for 3D and advanced compute pipelines.\n     */\n    viewDescriptor?: GPUTextureViewDescriptor;\n}\n\n/**\n * A Pixi-flavored Depth/Stencil Attachment that mirrors the WebGPU spec but replaces low-level JIT requirements\n * with high-level Pixi objects (like `texture`).\n * @example\n * ```typescript\n * import { RenderTarget, TextureSource } from 'pixi.js';\n *\n * const renderTarget = new RenderTarget({\n *     depthStencilAttachment: {\n *         texture: new TextureSource({ format: 'depth24plus-stencil8', width: 100, height: 100 }),\n *         depthLoadOp: 'clear',\n *         depthClearValue: 1.0,\n *         depthReadOnly: true, // Only test depth, don't write to it (advanced 3D trick)\n *     }\n * });\n * ```\n * @category rendering\n * @advanced\n */\nexport interface PixiDepthStencilAttachment extends Omit<GPURenderPassDepthStencilAttachment, 'view'>\n{\n    /** The Pixi depth/stencil texture to use for testing/writing. */\n    texture: TextureSource;\n    /**\n     * Optional overrides. For example, if you want to perform depth testing while simultaneously\n     * sampling the stencil data in a shader, you can pass `{ aspect: 'depth-only' }`.\n     */\n    viewDescriptor?: GPUTextureViewDescriptor;\n}\n\n/**\n * A class that describes what the renderers are rendering to.\n * This can be as simple as a Texture, or as complex as a multi-texture, multi-sampled render target.\n * Support for stencil and depth buffers is also included.\n *\n * If you need something more complex than a Texture to render to, you should use this class.\n * Under the hood, all textures you render to have a RenderTarget created on their behalf.\n * @category rendering\n * @advanced\n */\nexport class RenderTarget extends EventEmitter<{\n    destroy: RenderTarget,\n}>\n{\n    /**\n     * emits when the render target is destroyed, before its attachments are released.\n     * letting the renderer know that it needs to free the framebuffers and MSAA buffers it built for it\n     * @event destroy\n     */\n\n    /** The default options for a render target */\n    public static defaultOptions: RenderTargetOptions = {\n        /** the width of the RenderTarget */\n        width: 0,\n        /** the height of the RenderTarget */\n        height: 0,\n        /** the resolution of the RenderTarget */\n        resolution: 1,\n        /** an array of textures, or a number indicating how many color textures there should be */\n        colorTextures: 1,\n        /** should this render target have a stencil buffer? */\n        stencil: false,\n        /** should this render target have a depth buffer? */\n        depth: false,\n        /** should this render target be antialiased? */\n        antialias: false, // save on perf by default!\n        /** is this a root element, true if this is gl context owners render target */\n        isRoot: false\n    };\n\n    /** unique id for this render target */\n    public readonly uid: number = uid('renderTarget');\n\n    /**\n     * An array of attachments that define exactly how the GPU should render to the color textures.\n     * This includes the texture itself, as well as load/store operations and clear values.\n     */\n    public colorAttachments: PixiColorAttachment[] = [];\n    /**\n     * An attachment that defines exactly how the GPU should render to the depth/stencil texture.\n     * Includes the texture, load/store operations, and depth/stencil specific clear values.\n     */\n    public depthStencilAttachment?: PixiDepthStencilAttachment;\n\n    public dirtyId = 0;\n    public isRoot = false;\n    /**\n     * Opt-in toggle that inverts this target's Y orientation, resolved at `bind` time.\n     *\n     * Defaults to `undefined`/`false` — a no-op, so rendering is exactly what it has always been\n     * (texture targets flip so they sample upright in the 2D pipeline; the screen does not). Set `true`\n     * to invert that automatic orientation — e.g. to store a capture in screen orientation for 3D, where\n     * geometry UVs expect the un-flipped result.\n     *\n     * When `true`, the projection Y-flip and the winding/cull inversion flip together, so a front-facing\n     * triangle stays front-facing — back-face culling of content rendered into the target stays correct.\n     * @advanced\n     */\n    public flipY?: boolean;\n    /** a label for debugging — shows up on the render pass in GPU debuggers (WebGPU) */\n    public label?: string;\n\n    private readonly _size = new Float32Array(2);\n    /** if true, then when the render target is destroyed, it will destroy all the textures that were created for it. */\n    private _managedColorTextures: boolean = false;\n\n    /** depth capability requested for this target — via options, attachment format, or the mask system @internal */\n    public _depth = false;\n    /** stencil capability requested for this target — via options, attachment format, or the mask system @internal */\n    public _stencil = false;\n\n    /**\n     * @param options - Options for creating a render target, or a WebGPU-flavored descriptor.\n     */\n    constructor(options: RenderTargetOptions | RenderTargetDescriptor = {})\n    {\n        super();\n\n        const descriptor = 'colorAttachments' in options ? options : this._normalizeOptions(options);\n\n        this.isRoot = descriptor.isRoot ?? false;\n        this.label = descriptor.label;\n        this.colorAttachments = descriptor.colorAttachments;\n        this.depthStencilAttachment = descriptor.depthStencilAttachment;\n\n        // an attachment implies the capabilities its format actually has — a depth-only\n        // format (e.g. 'depth24plus') must not report stencil support\n        if (this.depthStencilAttachment)\n        {\n            const format = this.depthStencilAttachment.texture.format;\n\n            this._depth ||= format.includes('depth');\n            this._stencil ||= format.includes('stencil');\n        }\n\n        if (this.colorAttachments.length === 0 && !this.depthStencilAttachment)\n        {\n            throw new Error('[RenderTarget] no color textures or depth textures were provided. '\n                + 'Provide a depthStencilTexture or set depth/stencil to true when using colorTextures: 0.');\n        }\n\n        if (this.colorAttachments.length > 0)\n        {\n            const colorSource = this.colorTexture;\n\n            this.resize(colorSource.width, colorSource.height, colorSource._resolution);\n        }\n\n        if (this.sizeSource)\n        {\n            this.sizeSource.on('resize', this.onSourceResize, this);\n        }\n    }\n\n    private _normalizeOptions(options: RenderTargetOptions): RenderTargetDescriptor\n    {\n        const opts = { ...RenderTarget.defaultOptions, ...options };\n        const colorAttachments: PixiColorAttachment[] = [];\n        let depthStencilAttachment: PixiDepthStencilAttachment | undefined;\n\n        if (typeof opts.colorTextures === 'number')\n        {\n            if (opts.colorTextures > 0)\n            {\n                this._managedColorTextures = true;\n\n                for (let i = 0; i < opts.colorTextures; i++)\n                {\n                    colorAttachments.push({\n                        texture: new TextureSource({\n                            width: opts.width,\n                            height: opts.height,\n                            resolution: opts.resolution,\n                            antialias: opts.antialias,\n                        }),\n                        loadOp: 'clear',\n                        storeOp: 'store',\n                    });\n                }\n            }\n        }\n        else\n        {\n            opts.colorTextures.forEach((texture) =>\n            {\n                colorAttachments.push({\n                    texture: texture.source,\n                    loadOp: 'clear',\n                    storeOp: 'store',\n                });\n            });\n        }\n\n        const wantsDepthStencilTexture = opts.depthStencilTexture === true;\n\n        this._depth = !!(opts.depth || wantsDepthStencilTexture);\n        this._stencil = !!(opts.stencil || wantsDepthStencilTexture);\n\n        if (opts.depthStencilTexture instanceof Texture\n            || opts.depthStencilTexture instanceof TextureSource)\n        {\n            if (opts.isRoot)\n            {\n                throw new Error('[RenderTarget] cannot attach a depth-stencil texture to the screen — '\n                    + 'the canvas owns its own depth/stencil buffers. Render to a texture target instead.');\n            }\n\n            depthStencilAttachment = {\n                texture: opts.depthStencilTexture.source,\n            };\n        }\n        else if ((wantsDepthStencilTexture && !opts.isRoot)\n            || ((opts.stencil || opts.depth) && colorAttachments.length === 0))\n        {\n            // an explicit texture request (depthStencilTexture: true) or a depth-only target.\n            // Plain depth/stencil flags create no texture — each backend picks the cheapest\n            // resource (renderbuffer on WebGL, internal texture on WebGPU, context buffers\n            // for the screen)\n            depthStencilAttachment = this._createDepthStencilTexture(opts.width, opts.height, opts.resolution);\n        }\n\n        return {\n            colorAttachments,\n            depthStencilAttachment,\n            isRoot: opts.isRoot,\n            label: opts.label,\n        };\n    }\n\n    get size(): [number, number]\n    {\n        const _size = this._size;\n\n        _size[0] = this.pixelWidth;\n        _size[1] = this.pixelHeight;\n\n        return _size as any as [number, number];\n    }\n\n    get width(): number\n    {\n        return this.sizeSource.width;\n    }\n\n    get height(): number\n    {\n        return this.sizeSource.height;\n    }\n    get pixelWidth(): number\n    {\n        return this.sizeSource.pixelWidth;\n    }\n\n    get pixelHeight(): number\n    {\n        return this.sizeSource.pixelHeight;\n    }\n\n    get resolution(): number\n    {\n        return this.sizeSource._resolution;\n    }\n\n    private _colorTextures: TextureSource[] | null = null;\n    /**\n     * An array of textures that can be written to by the GPU - mostly this has one texture in Pixi, but you could\n     * write to multiple if required! (eg deferred lighting).\n     * This is a backwards-compatible getter that extracts the textures from `colorAttachments`.\n     */\n    get colorTextures(): TextureSource[]\n    {\n        this._colorTextures ||= this.colorAttachments.map((a) => a.texture);\n\n        return this._colorTextures;\n    }\n\n    /** The stencil and depth buffer will write to this texture in WebGPU. */\n    get depthStencilTexture(): TextureSource | null\n    {\n        return this.depthStencilAttachment?.texture ?? null;\n    }\n\n    /** Whether this target provides a depth buffer — requested via options or implied by its attachment's format. */\n    get depth(): boolean\n    {\n        return this._depth;\n    }\n\n    /** Whether this target provides a stencil buffer — requested via options or implied by its attachment's format. */\n    get stencil(): boolean\n    {\n        return this._stencil;\n    }\n\n    get colorTexture(): TextureSource\n    {\n        return this.colorAttachments[0]?.texture;\n    }\n\n    /**\n     * The texture that drives size, resolution, and resize events.\n     * For standard targets this is `colorAttachments[0].texture`;\n     * for depth-only targets it is `depthStencilAttachment.texture`.\n     */\n    get sizeSource(): TextureSource\n    {\n        return this.colorAttachments[0]?.texture ?? this.depthStencilAttachment?.texture;\n    }\n\n    protected onSourceResize(source: TextureSource)\n    {\n        this.resize(source.width, source.height, source._resolution, true);\n    }\n\n    /**\n     * This will ensure a depthStencil texture is created for this render target.\n     * Most likely called by the mask system to make sure we have stencil buffer added.\n     * @internal\n     */\n    public ensureDepthStencilTexture()\n    {\n        this._createDepthStencilTexture(this.sizeSource.width, this.sizeSource.height, this.sizeSource._resolution);\n\n        this._depth = true;\n        this._stencil = true;\n    }\n\n    public resize(width: number, height: number, resolution = this.resolution, skipColorTexture = false)\n    {\n        this.dirtyId++;\n\n        this.colorAttachments.forEach((colorAttachment, i) =>\n        {\n            if (skipColorTexture && i === 0) return;\n\n            colorAttachment.texture.resize(width, height, resolution);\n        });\n\n        if (this.depthStencilAttachment)\n        {\n            // For depth-only targets the depth texture IS the size source, so skip\n            // when this resize was triggered by the size source's own resize event.\n            if (skipColorTexture && this.colorAttachments.length === 0) return;\n\n            this.depthStencilAttachment.texture.resize(width, height, resolution);\n        }\n    }\n\n    public destroy()\n    {\n        // return if already destroyed\n        if (!this.colorAttachments && !this.depthStencilAttachment) return;\n\n        // announced before the attachments go, so listeners can still reach them\n        this.emit('destroy', this);\n        this.sizeSource.off('resize', this.onSourceResize, this);\n\n        if (this._managedColorTextures)\n        {\n            this.colorAttachments.forEach((attachment) =>\n            {\n                attachment.texture.destroy();\n            });\n        }\n\n        if (this.depthStencilAttachment)\n        {\n            this.depthStencilAttachment.texture.destroy();\n            delete this.depthStencilAttachment;\n        }\n\n        this.colorAttachments = null;\n        this._colorTextures = null;\n        this.removeAllListeners();\n    }\n\n    /**\n     * The single recipe for internally-created depth-stencil textures.\n     * @param width\n     * @param height\n     * @param resolution\n     */\n    private _createDepthStencilTexture(width: number, height: number, resolution: number): PixiDepthStencilAttachment\n    {\n        this.depthStencilAttachment ??= {\n            texture: new TextureSource({\n                width,\n                height,\n                resolution,\n                format: 'depth24plus-stencil8',\n                autoGenerateMipmaps: false,\n                antialias: false,\n                mipLevelCount: 1,\n                // sampleCount: handled by the render target system..\n            }),\n        };\n\n        return this.depthStencilAttachment;\n    }\n}\n"],"names":["uid","TextureSource","Texture"],"mappings":";;;;;;;;AA4HO,MAAM,aAAA,GAAN,MAAM,aAAA,SAAqB,YAAA,CAGlC;AAAA;AAAA;AAAA;AAAA,EAuEI,WAAA,CAAY,OAAA,GAAwD,EAAC,EACrE;AACI,IAAA,KAAA,EAAM;AA7CV;AAAA,IAAA,IAAA,CAAgB,GAAA,GAAcA,QAAI,cAAc,CAAA;AAMhD;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAO,mBAA0C,EAAC;AAOlD,IAAA,IAAA,CAAO,OAAA,GAAU,CAAA;AACjB,IAAA,IAAA,CAAO,MAAA,GAAS,KAAA;AAiBhB,IAAA,IAAA,CAAiB,KAAA,GAAQ,IAAI,YAAA,CAAa,CAAC,CAAA;AAE3C;AAAA,IAAA,IAAA,CAAQ,qBAAA,GAAiC,KAAA;AAGzC;AAAA,IAAA,IAAA,CAAO,MAAA,GAAS,KAAA;AAEhB;AAAA,IAAA,IAAA,CAAO,QAAA,GAAW,KAAA;AA0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