shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$mesh$shared$MeshPipe = function(global, require, module, exports) {
  global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
  var Matrix = require("module$node_modules$pixi_DOT_js$lib$maths$matrix$Matrix"), BindGroup = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$shader$BindGroup"), UniformGroup = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$shader$UniformGroup"), getAdjustedBlendModeBlend = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$state$getAdjustedBlendModeBlend"), colorToUniform = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$gpu$colorToUniform"), 
  BatchableMesh = require("module$node_modules$pixi_DOT_js$lib$scene$mesh$shared$BatchableMesh");
  "use strict";
  class MeshGpuData {
    destroy() {
    }
  }
  class MeshPipe {
    constructor(renderer, adaptor) {
      this.localUniforms = new UniformGroup.UniformGroup({uTransformMatrix:{value:new Matrix.Matrix(), type:"mat3x3\x3cf32\x3e"}, uColor:{value:new Float32Array([1, 1, 1, 1]), type:"vec4\x3cf32\x3e"}, uRound:{value:0, type:"f32"}});
      this.localUniformsBindGroup = new BindGroup.BindGroup({0:this.localUniforms});
      this.renderer = renderer;
      this._adaptor = adaptor;
      this._adaptor.init();
    }
    validateRenderable(mesh) {
      var meshData = this._getMeshData(mesh), wasBatched = meshData.batched;
      const isBatched = mesh.batched;
      meshData.batched = isBatched;
      if (wasBatched !== isBatched) {
        return !0;
      }
      if (isBatched) {
        wasBatched = mesh._geometry;
        if (wasBatched.indices.length !== meshData.indexSize || wasBatched.positions.length !== meshData.vertexSize) {
          return meshData.indexSize = wasBatched.indices.length, meshData.vertexSize = wasBatched.positions.length, !0;
        }
        meshData = this._getBatchableMesh(mesh);
        meshData.texture.uid !== mesh._texture.uid && (meshData._textureMatrixUpdateId = -1);
        return !meshData._batcher.checkAndUpdateTexture(meshData, mesh._texture);
      }
      return !1;
    }
    addRenderable(mesh, instructionSet) {
      const batcher = this.renderer.renderPipes.batch;
      var meshData = this._getMeshData(mesh);
      mesh.didViewUpdate && (meshData.indexSize = mesh._geometry.indices?.length, meshData.vertexSize = mesh._geometry.positions?.length);
      meshData.batched ? (meshData = this._getBatchableMesh(mesh), meshData.setTexture(mesh._texture), meshData.geometry = mesh._geometry, batcher.addToBatch(meshData, instructionSet)) : (batcher.break(instructionSet), instructionSet.add(mesh));
    }
    updateRenderable(mesh) {
      if (mesh.batched) {
        const gpuBatchableMesh = this._getBatchableMesh(mesh);
        gpuBatchableMesh.setTexture(mesh._texture);
        gpuBatchableMesh.geometry = mesh._geometry;
        gpuBatchableMesh._batcher.updateElement(gpuBatchableMesh);
      }
    }
    execute(mesh) {
      if (mesh.isRenderable) {
        mesh.state.blendMode = getAdjustedBlendModeBlend.getAdjustedBlendModeBlend(mesh.groupBlendMode, mesh.texture._source);
        var localUniforms = this.localUniforms;
        localUniforms.uniforms.uTransformMatrix = mesh.groupTransform;
        localUniforms.uniforms.uRound = this.renderer._roundPixels | mesh._roundPixels;
        localUniforms.update();
        colorToUniform.color32BitToUniform(mesh.groupColorAlpha, localUniforms.uniforms.uColor, 0);
        this._adaptor.execute(this, mesh);
      }
    }
    _getMeshData(mesh) {
      var _a, _b;
      (_a = mesh._gpuData)[_b = this.renderer.uid] || (_a[_b] = new MeshGpuData());
      return mesh._gpuData[this.renderer.uid].meshData || this._initMeshData(mesh);
    }
    _initMeshData(mesh) {
      mesh._gpuData[this.renderer.uid].meshData = {batched:mesh.batched, indexSize:0, vertexSize:0};
      return mesh._gpuData[this.renderer.uid].meshData;
    }
    _getBatchableMesh(mesh) {
      var _a, _b;
      (_a = mesh._gpuData)[_b = this.renderer.uid] || (_a[_b] = new MeshGpuData());
      return mesh._gpuData[this.renderer.uid].batchableMesh || this._initBatchableMesh(mesh);
    }
    _initBatchableMesh(mesh) {
      const gpuMesh = new BatchableMesh.BatchableMesh();
      gpuMesh.renderable = mesh;
      gpuMesh.setTexture(mesh._texture);
      gpuMesh.transform = mesh.groupTransform;
      gpuMesh.roundPixels = this.renderer._roundPixels | mesh._roundPixels;
      return mesh._gpuData[this.renderer.uid].batchableMesh = gpuMesh;
    }
    destroy() {
      this.localUniformsBindGroup = this.localUniforms = null;
      this._adaptor.destroy();
      this.renderer = this._adaptor = null;
    }
  }
  MeshPipe.extension = {type:[global.ExtensionType.WebGLPipes, global.ExtensionType.WebGPUPipes], name:"mesh"};
  exports.MeshGpuData = MeshGpuData;
  exports.MeshPipe = MeshPipe;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$mesh$shared$MeshPipe.js.map
