Files
nothoughts/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/GpuShaderSystem.mjs
2025-08-04 18:57:35 +02:00

40 lines
1.1 KiB
JavaScript

import { ExtensionType } from '../../../../extensions/Extensions.mjs';
"use strict";
class GpuShaderSystem {
constructor() {
this._gpuProgramData = /* @__PURE__ */ Object.create(null);
}
contextChange(gpu) {
this._gpu = gpu;
this.maxTextures = gpu.device.limits.maxSampledTexturesPerShaderStage;
}
getProgramData(program) {
return this._gpuProgramData[program._layoutKey] || this._createGPUProgramData(program);
}
_createGPUProgramData(program) {
const device = this._gpu.device;
const bindGroups = program.gpuLayout.map((group) => device.createBindGroupLayout({ entries: group }));
const pipelineLayoutDesc = { bindGroupLayouts: bindGroups };
this._gpuProgramData[program._layoutKey] = {
bindGroups,
pipeline: device.createPipelineLayout(pipelineLayoutDesc)
};
return this._gpuProgramData[program._layoutKey];
}
destroy() {
this._gpu = null;
this._gpuProgramData = null;
}
}
/** @ignore */
GpuShaderSystem.extension = {
type: [
ExtensionType.WebGPUSystem
],
name: "shader"
};
export { GpuShaderSystem };
//# sourceMappingURL=GpuShaderSystem.mjs.map