43 lines
2.1 KiB
JavaScript
43 lines
2.1 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$batcher$gpu$GpuBatchAdaptor = function(global, require, module, exports) {
|
|
global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
|
|
module = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$state$State");
|
|
var getTextureBatchBindGroup = require("module$node_modules$pixi_DOT_js$lib$rendering$batcher$gpu$getTextureBatchBindGroup");
|
|
"use strict";
|
|
const tempState = module.State.for2d();
|
|
class GpuBatchAdaptor {
|
|
start(batchPipe, geometry, shader) {
|
|
const renderer = batchPipe.renderer;
|
|
batchPipe = renderer.encoder;
|
|
const program = shader.gpuProgram;
|
|
this._shader = shader;
|
|
this._geometry = geometry;
|
|
batchPipe.setGeometry(geometry, program);
|
|
tempState.blendMode = "normal";
|
|
renderer.pipeline.getPipeline(geometry, program, tempState);
|
|
geometry = renderer.globalUniforms.bindGroup;
|
|
batchPipe.resetBindGroup(1);
|
|
batchPipe.setBindGroup(0, geometry, program);
|
|
}
|
|
execute(batchPipe, batch) {
|
|
var program = this._shader.gpuProgram;
|
|
batchPipe = batchPipe.renderer;
|
|
const encoder = batchPipe.encoder;
|
|
if (!batch.bindGroup) {
|
|
var textureBatch = batch.textures;
|
|
batch.bindGroup = getTextureBatchBindGroup.getTextureBatchBindGroup(textureBatch.textures, textureBatch.count, batchPipe.limits.maxBatchableTextures);
|
|
}
|
|
tempState.blendMode = batch.blendMode;
|
|
textureBatch = batchPipe.bindGroup.getBindGroup(batch.bindGroup, program, 1);
|
|
program = batchPipe.pipeline.getPipeline(this._geometry, program, tempState, batch.topology);
|
|
batch.bindGroup._touch(batchPipe.gc.now, batchPipe.tick);
|
|
encoder.setPipeline(program);
|
|
encoder.renderPassEncoder.setBindGroup(1, textureBatch);
|
|
encoder.renderPassEncoder.drawIndexed(batch.size, 1, batch.start);
|
|
}
|
|
}
|
|
GpuBatchAdaptor.extension = {type:[global.ExtensionType.WebGPUPipesAdaptor], name:"batch"};
|
|
exports.GpuBatchAdaptor = GpuBatchAdaptor;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$batcher$gpu$GpuBatchAdaptor.js.map
|