Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$BindGroupSystem.js
2026-07-01 22:38:29 -06:00

39 lines
2.2 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$BindGroupSystem = function(global, require, module, exports) {
global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
"use strict";
class BindGroupSystem {
constructor(renderer) {
this._hash = Object.create(null);
this._renderer = renderer;
}
contextChange(gpu) {
this._gpu = gpu;
}
getBindGroup(bindGroup, program, groupIndex) {
bindGroup._updateKey();
return this._hash[bindGroup._key] || this._createBindGroup(bindGroup, program, groupIndex);
}
_createBindGroup(group, program, groupIndex) {
var device = this._gpu.device;
const groupLayout = program.layout[groupIndex], entries = [], renderer = this._renderer;
for (const j in groupLayout) {
var resource = group.resources[j] ?? group.resources[groupLayout[j]];
let gpuResource;
"uniformGroup" === resource._resourceType ? (renderer.ubo.updateUniformGroup(resource), resource = resource.buffer, gpuResource = {buffer:renderer.buffer.getGPUBuffer(resource), offset:0, size:resource.descriptor.size}) : "buffer" === resource._resourceType ? gpuResource = {buffer:renderer.buffer.getGPUBuffer(resource), offset:0, size:resource.descriptor.size} : "bufferResource" === resource._resourceType ? gpuResource = {buffer:renderer.buffer.getGPUBuffer(resource.buffer), offset:resource.offset,
size:resource.size} : "textureSampler" === resource._resourceType ? gpuResource = renderer.texture.getGpuSampler(resource) : "textureSource" === resource._resourceType && (gpuResource = renderer.texture.getTextureView(resource));
entries.push({binding:groupLayout[j], resource:gpuResource});
}
program = renderer.shader.getProgramData(program).bindGroups[groupIndex];
device = device.createBindGroup({layout:program, entries});
return this._hash[group._key] = device;
}
destroy() {
this._renderer = this._hash = null;
}
}
BindGroupSystem.extension = {type:[global.ExtensionType.WebGPUSystem], name:"bindGroup"};
exports.BindGroupSystem = BindGroupSystem;
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$BindGroupSystem.js.map