pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
1 lines • 8.38 kB
Source Map (JSON)
{"version":3,"file":"TextureGCSystem.mjs","sources":["../../../../../src/rendering/renderers/shared/texture/TextureGCSystem.ts"],"sourcesContent":["import { ExtensionType } from '../../../../extensions/Extensions';\nimport { deprecation } from '../../../../utils/logging/deprecation';\nimport { type Renderer } from '../../types';\n\nimport type { System } from '../system/System';\n\n/**\n * Options for the {@link TextureGCSystem}.\n * @category rendering\n * @advanced\n * @deprecated since 8.15.0\n * @see {@link GCSystem}\n */\nexport interface TextureGCSystemOptions\n{\n /**\n * If set to true, this will enable the garbage collector on the GPU.\n * @default true\n * @deprecated since 8.15.0\n */\n textureGCActive: boolean;\n /**\n * @deprecated since 8.3.0\n * @see {@link TextureGCSystemOptions.textureGCMaxIdle}\n */\n textureGCAMaxIdle: number;\n /**\n * The maximum idle frames before a texture is destroyed by garbage collection.\n * @default 60 * 60\n * @deprecated since 8.15.0\n */\n textureGCMaxIdle: number;\n /**\n * Frames between two garbage collections.\n * @default 600\n * @deprecated since 8.15.0\n */\n textureGCCheckCountMax: number;\n}\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @category rendering\n * @advanced\n * @deprecated since 8.15.0\n * @see {@link GCSystem}\n */\nexport class TextureGCSystem implements System<TextureGCSystemOptions>\n{\n /** @ignore */\n public static extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ],\n name: 'textureGC',\n } as const;\n\n /**\n * Default options for the TextureGCSystem\n * @deprecated since 8.15.0\n */\n public static defaultOptions: TextureGCSystemOptions = {\n /**\n * If set to true, this will enable the garbage collector on the GPU.\n * @default true\n */\n textureGCActive: true,\n /**\n * @deprecated since 8.3.0\n * @see {@link TextureGCSystemOptions.textureGCMaxIdle}\n */\n textureGCAMaxIdle: null,\n /**\n * The maximum idle frames before a texture is destroyed by garbage collection.\n * @default 60 * 60\n */\n textureGCMaxIdle: 60 * 60,\n /**\n * Frames between two garbage collections.\n * @default 600\n */\n textureGCCheckCountMax: 600,\n };\n\n /**\n * Frame count since started.\n * @readonly\n * @deprecated since 8.15.0\n */\n public get count() { return this._renderer.tick; }\n\n /**\n * Frame count since last garbage collection.\n * @readonly\n * @deprecated since 8.15.0\n */\n public get checkCount() { return this._checkCount; }\n public set checkCount(value: number)\n {\n // #if _DEBUG\n deprecation('8.15.0', 'TextureGCSystem.run is deprecated, please use the GCSystem instead.');\n // #endif\n this._checkCount = value;\n }\n private _checkCount: number;\n\n /**\n * Maximum idle frames before a texture is destroyed by garbage collection.\n * @see TextureGCSystem.defaultMaxIdle\n * @deprecated since 8.15.0\n */\n public get maxIdle() { return (this._renderer.gc.maxUnusedTime / 1000) * 60; }\n public set maxIdle(value: number)\n {\n // #if _DEBUG\n deprecation('8.15.0', 'TextureGCSystem.run is deprecated, please use the GCSystem instead.');\n // #endif\n this._renderer.gc.maxUnusedTime = (value / 60) * 1000;\n }\n\n /**\n * Frames between two garbage collections.\n * @see TextureGCSystem.defaultCheckCountMax\n * @deprecated since 8.15.0\n */\n // eslint-disable-next-line dot-notation\n public get checkCountMax() { return Math.floor(this._renderer.gc['_frequency'] / 1000); }\n public set checkCountMax(_value: number)\n {\n // #if _DEBUG\n deprecation('8.15.0', 'TextureGCSystem.run is deprecated, please use the GCSystem instead.');\n // #endif\n }\n\n /**\n * Current garbage collection mode.\n * @see TextureGCSystem.defaultMode\n * @deprecated since 8.15.0\n */\n public get active() { return this._renderer.gc.enabled; }\n public set active(value: boolean)\n {\n // #if _DEBUG\n deprecation('8.15.0', 'TextureGCSystem.run is deprecated, please use the GCSystem instead.');\n // #endif\n this._renderer.gc.enabled = value;\n }\n\n private _renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this._renderer = renderer;\n this._checkCount = 0;\n }\n\n public init(options: TextureGCSystemOptions): void\n {\n if (options.textureGCActive !== TextureGCSystem.defaultOptions.textureGCActive)\n { this.active = options.textureGCActive; }\n if (options.textureGCMaxIdle !== TextureGCSystem.defaultOptions.textureGCMaxIdle)\n { this.maxIdle = options.textureGCMaxIdle; }\n if (options.textureGCCheckCountMax !== TextureGCSystem.defaultOptions.textureGCCheckCountMax)\n { this.checkCountMax = options.textureGCCheckCountMax; }\n }\n\n /**\n * Checks to see when the last time a texture was used.\n * If the texture has not been used for a specified amount of time, it will be removed from the GPU.\n * @deprecated since 8.15.0\n */\n public run(): void\n {\n // #if _DEBUG\n deprecation('8.15.0', 'TextureGCSystem.run is deprecated, please use the GCSystem instead.');\n // #endif\n this._renderer.gc.run();\n }\n\n public destroy(): void\n {\n this._renderer = null as any as Renderer;\n }\n}\n"],"names":[],"mappings":";;;;AA+CO,MAAM,gBAAA,GAAN,MAAM,gBACb,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0CI,IAAW,KAAQ,GAAA;AAAE,IAAA,OAAO,KAAK,SAAU,CAAA,IAAA,CAAA;AAAA,GAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,IAAW,UAAa,GAAA;AAAE,IAAA,OAAO,IAAK,CAAA,WAAA,CAAA;AAAA,GAAa;AAAA,EACnD,IAAW,WAAW,KACtB,EAAA;AAEI,IAAA,WAAA,CAAY,UAAU,qEAAqE,CAAA,CAAA;AAE3F,IAAA,IAAA,CAAK,WAAc,GAAA,KAAA,CAAA;AAAA,GACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAW,OAAU,GAAA;AAAE,IAAA,OAAQ,IAAK,CAAA,SAAA,CAAU,EAAG,CAAA,aAAA,GAAgB,GAAQ,GAAA,EAAA,CAAA;AAAA,GAAI;AAAA,EAC7E,IAAW,QAAQ,KACnB,EAAA;AAEI,IAAA,WAAA,CAAY,UAA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