/
githubmirror
/
pixijs
Обзор
Документация
Войти
/
githubmirror
/
pixijs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
src/rendering/batcher/shared/DefaultShader.ts
53 строки
2 KB
Zyie
fix: graphics memory leak and cleanup (#11753)
13 ноя 2025, 16:01
Не верифицирован
13 ноя 2025, 16:01
a3b5cf1
Код
Авторство
О чём код?
import { compileHighShaderGlProgram, compileHighShaderGpuProgram } from '../../high-shader/compileHighShaderToProgram'; import { colorBit, colorBitGl } from '../../high-shader/shader-bits/colorBit'; import { generateTextureBatchBit, generateTextureBatchBitGl } from '../../high-shader/shader-bits/generateTextureBatchBit'; import { roundPixelsBit, roundPixelsBitGl } from '../../high-shader/shader-bits/roundPixelsBit'; import { getBatchSamplersUniformGroup } from '../../renderers/gl/shader/getBatchSamplersUniformGroup'; import { Shader } from '../../renderers/shared/shader/Shader'; /** * DefaultShader is a specialized shader class designed for batch rendering. * It extends the base Shader class and provides functionality for handling * color, texture batching, and pixel rounding in both WebGL and WebGPU contexts. * * It is used by the default batcher * @extends Shader * @category rendering * @advanced */ export class DefaultShader extends Shader { /** @internal */ public maxTextures?: number; constructor(maxTextures: number) { const glProgram = compileHighShaderGlProgram({ name: 'batch', bits: [ colorBitGl, generateTextureBatchBitGl(maxTextures), roundPixelsBitGl, ] }); const gpuProgram = compileHighShaderGpuProgram({ name: 'batch', bits: [ colorBit, generateTextureBatchBit(maxTextures), roundPixelsBit, ] }); super({ glProgram, gpuProgram, resources: { batchSamplers: getBatchSamplersUniformGroup(maxTextures), } }); this.maxTextures = maxTextures; } }