pixi.js
    Preparing search index...

    Class TexturePoolClassAdvanced

    Texture pool, used by FilterSystem and plugins.

    Stores collection of temporary pow2 or screen-sized renderTextures. Textures are bucketed by size, flags, format and scale mode, so one pool can serve colour, float and depth targets side by side.

    Index
    • Parameters

      • OptionaltextureOptions: TextureSourceOptions

        options that will be passed to BaseRenderTexture constructor

        options for creating a new TextureSource

        • Optional_resourceId?: number
        • OptionaladdressMode?: WRAP_MODE

          setting this will set wrapModeU,wrapModeV and wrapModeW all at once!

        • OptionaladdressModeU?: WRAP_MODE

          specifies the {{GPUAddressMode|address modes}} for the texture width, height, and depth coordinates, respectively.

        • OptionaladdressModeV?: WRAP_MODE

          specifies the {{GPUAddressMode|address modes}} for the texture width, height, and depth coordinates, respectively.

        • OptionaladdressModeW?: WRAP_MODE

          Specifies the {{GPUAddressMode|address modes}} for the texture width, height, and depth coordinates, respectively.

        • OptionalalphaMode?: ALPHA_MODES

          the alpha mode of the texture

        • Optionalantialias?: boolean

          Only really affects RenderTextures. Should we use antialiasing for this texture. It will look better, but may impact performance as a Blit operation will be required to resolve the texture.

        • Optional AdvancedarrayLayerCount?: number

          The number of array layers for this texture source.

          This maps to WebGPU's GPUTextureDescriptor.size.depthOrArrayLayers and is used for array-backed textures such as cube maps (6 layers).

          1
          @advanced
        • OptionalautoGarbageCollect?: boolean

          If true, the Garbage Collector will unload this texture if it is not used after a period of time

        • OptionalautoGenerateMipmaps?: boolean

          Should we auto generate mipmaps for this texture? This will automatically generate mipmaps for this texture when uploading to the GPU. Mipmapped textures take up more memory, but can look better when scaled down.

          For performance reasons, it is recommended to NOT use this with RenderTextures, as they are often updated every frame. If you do, make sure to call updateMipmaps after you update the texture.

        • Optionalcompare?: COMPARE_FUNCTION

          When provided the sampler will be a comparison sampler with the specified COMPARE_FUNCTION. Note: Comparison samplers may use filtering, but the sampling results will be implementation-dependent and may differ from the normal filtering rules.

        • Optional Readonlydestroyed?: boolean

          Has the style been destroyed?

        • Optionaldimensions?: TEXTURE_DIMENSIONS

          how many dimensions does this texture have? currently v8 only supports 2d

        • Optionaldynamic?: boolean

          Used by RenderTexture.create to allow resizing. Not used by TextureSource itself.

        • Optionalformat?: TEXTURE_FORMATS

          the format that the texture data has

        • Optionalheight?: number

          the pixel height of this texture source. This is the REAL pure number, not accounting resolution

        • Optionallabel?: string

          optional label, can be used for debugging

        • OptionallodMaxClamp?: number

          Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.

        • OptionallodMinClamp?: number

          specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.

        • OptionalmagFilter?: SCALE_MODE

          specifies the sampling behavior when the sample footprint is smaller than or equal to one texel.

        • OptionalmaxAnisotropy?: number

          Specifies the maximum anisotropy value clamp used by the sampler. Note: Most implementations support TextureStyle#maxAnisotropy values in range between 1 and 16, inclusive. The used value of TextureStyle#maxAnisotropy will be clamped to the maximum value that the platform supports.

          setting this to anything higher than 1 will set scale modes to 'linear'

        • OptionalminFilter?: SCALE_MODE

          specifies the sampling behavior when the sample footprint is larger than one texel.

        • OptionalmipLevelCount?: number

          The number of mip levels to generate for this texture. this is overridden if autoGenerateMipmaps is true

        • OptionalmipmapFilter?: SCALE_MODE

          specifies behavior for sampling between mipmap levels.

        • Optionalresolution?: number

          the resolution of the texture.

        • Optionalresource?: T

          the resource that will be uploaded to the GPU. This is where we get our pixels from eg an ImageBimt / Canvas / Video etc

        • OptionalscaleMode?: SCALE_MODE

          setting this will set magFilter,minFilter and mipmapFilter all at once!

        • Optionaltransient?: boolean

          Mark this texture as transient — its contents are scratch and do not need to persist beyond a single render pass. When the WebGPU backend sees this:

          • It uses storeOp: 'discard' on the attachment at end-of-pass, skipping the writeback to DRAM.
          • When the browser exposes GPUTextureUsage.TRANSIENT_ATTACHMENT, it adds that bit so the driver can keep contents in tile memory on TBDR mobile GPUs and never allocate DRAM at all.

          Only safe when no later render pass needs to load the prior contents back (loadOp: 'load' on a transient attachment is a spec violation, and discarding makes loaded contents undefined even without the bit set). Pixi sets this internally for the MSAA buffer attached to the canvas root, which is rendered as a single pass per frame. Set it yourself only on textures you know follow the same single-pass-then-discard pattern.

          false
          
        • OptionalviewDimension?: TEXTURE_VIEW_DIMENSIONS

          How this texture is viewed/sampled by shaders.

          This aligns with WebGPU's GPUTextureViewDescriptor.dimension. For example, cube maps are typically stored as a 2D texture with 6 array layers (dimensions: '2d') but viewed as viewDimension: 'cube'.

        • Optionalwidth?: number

          the pixel width of this texture source. This is the REAL pure number, not accounting resolution

        • OptionalwrapMode?: WRAP_MODE
        • destroy?: function
        • update?: function

      Returns TexturePoolClass

    textureOptions: TextureSourceOptions

    The default options for texture pool

    • get enableFullScreen(): boolean

      Has no effect. The pool sizes textures to the screens registered with setScreenSize.

      Returns boolean

      since 8.21.0

    • set enableFullScreen(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get textureStyle(): TextureStyle

      A style built from the pool options. The pool no longer applies it to anything.

      Returns TextureStyle

      since 8.21.0, pooled textures carry their own style; pass scaleMode in the request instead.

    • set textureStyle(value: TextureStyle): void

      Parameters

      Returns void

    • Clears the pool.

      Parameters

      • OptionaldestroyTextures: boolean

        Destroy all stored textures.

      Returns void

    • Creates a texture from a request, using the pool constructor options for anything unset.

      Parameters

      • options: TexturePoolRequest

        Width and height are in physical pixels. Format and scale mode fall back to the pool's own.

      Returns Texture

    • Parameters

      • pixelWidth: number
      • pixelHeight: number
      • Optionalantialias: boolean
      • OptionalautoGenerateMipmaps: boolean

      Returns Texture

      since 8.21.0

    • The backing size, in physical pixels, that getOptimalTexture would allocate for a request, without taking a texture from the pool.

      Each axis is the next power of two, or the smallest registered screen the request fits inside (see setScreenSize). Use it when a consumer needs to know where a request's content will sit inside its pooled texture before it has one, such as a uniform that maps content space onto texture space.

      Parameters

      • frameWidth: number

        The minimum width of the texture.

      • frameHeight: number

        The minimum height of the texture.

      • resolution: number = 1

        The resolution of the texture.

      Returns Size

      The width and height the pooled texture would have, in physical pixels.

    • Gets a Power-of-Two render texture or screen sized texture.

      Width and height are the minimum frame size. Resolution, antialias, mipmaps, format and scale mode fall back to 1 / false / the pool's own options. Each format and scale mode keeps its own buckets.

      Parameters

      Returns Texture

      The new render texture.

    • Parameters

      • frameWidth: number
      • frameHeight: number
      • Optionalresolution: number
      • Optionalantialias: boolean
      • OptionalautoGenerateMipmaps: boolean

      Returns Texture

      since 8.21.0

    • Gets a pooled texture matching the dimensions and resolution of the given texture.

      This is a convenience wrapper around getOptimalTexture that copies width, height, and resolution from an existing texture. Useful when a filter needs a temporary texture the same size as its input (e.g., for multi-pass blur).

      Parameters

      • texture: Texture

        The texture whose dimensions to match.

      • antialias: boolean = false

        Whether to use antialias on the pooled texture. Defaults to false.

      Returns Texture<TextureSource<any>>

      A pooled texture with power-of-two or screen sized backing dimensions at the source resolution.

    • Removes a screen previously registered with setScreenSize, destroying any idle textures that were only being kept for it.

      Parameters

      • rendererUid: number

        The uid the screen was registered with.

      Returns void

    • Returns a texture to the pool so it can be reused by future getOptimalTexture or getSameSizeTexture calls.

      If you gave the texture a style of your own after obtaining it (a different address mode, anisotropy or similar), pass resetStyle = true so the pool puts its own style back. Otherwise your style stays on the texture and the next consumer inherits it.

      Parameters

      • renderTexture: Texture

        The texture to return to the pool.

      • resetStyle: boolean = false

        When true, restores the style the pool created for this texture. Defaults to false.

      Returns void

    • Registers the screen size of a renderer with the pool, in physical pixels.

      While a screen is registered, a request that fits inside it on an axis is given that screen's size on that axis instead of the next power of two, which stops a full screen filter from allocating a texture far larger than the screen. Requests larger than every registered screen on an axis keep the power of two size - the pool never rounds a request up to a screen it does not fit in.

      Parameters

      • rendererUid: number

        The uid of the renderer, used to update or remove this screen later.

      • pixelWidth: number

        The width of the screen in physical pixels.

      • pixelHeight: number

        The height of the screen in physical pixels.

      Returns void