shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$sprite_tiling$TilingSpritePipe = function(global, require, module, exports) {
  global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
  var getAdjustedBlendModeBlend = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$state$getAdjustedBlendModeBlend"), State = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$state$State"), types = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$types"), GCManagedHash = require("module$node_modules$pixi_DOT_js$lib$utils$data$GCManagedHash"), 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"), MeshGeometry = require("module$node_modules$pixi_DOT_js$lib$scene$mesh$shared$MeshGeometry"), TilingSpriteShader = require("module$node_modules$pixi_DOT_js$lib$scene$sprite_tiling$shader$TilingSpriteShader");
  module = require("module$node_modules$pixi_DOT_js$lib$scene$sprite_tiling$utils$QuadGeometry");
  var setPositions = require("module$node_modules$pixi_DOT_js$lib$scene$sprite_tiling$utils$setPositions"), setUvs = require("module$node_modules$pixi_DOT_js$lib$scene$sprite_tiling$utils$setUvs");
  "use strict";
  const sharedQuad = new module.QuadGeometry();
  class TilingSpriteGpuData {
    constructor() {
      this.canBatch = !0;
      this.geometry = new MeshGeometry.MeshGeometry({indices:sharedQuad.indices.slice(), positions:sharedQuad.positions.slice(), uvs:sharedQuad.uvs.slice()});
    }
    destroy() {
      this.geometry.destroy();
      this.shader?.destroy();
    }
  }
  class TilingSpritePipe {
    constructor(renderer) {
      this._state = State.State.default2d;
      this._renderer = renderer;
      this._managedTilingSprites = new GCManagedHash.GCManagedHash({renderer, type:"renderable", name:"tilingSprite"});
    }
    validateRenderable(renderable) {
      var tilingSpriteData = this._getTilingSpriteData(renderable);
      const couldBatch = tilingSpriteData.canBatch;
      this._updateCanBatch(renderable);
      const canBatch = tilingSpriteData.canBatch;
      return canBatch && canBatch === couldBatch ? ({batchableMesh:tilingSpriteData} = tilingSpriteData, !tilingSpriteData._batcher.checkAndUpdateTexture(tilingSpriteData, renderable.texture)) : couldBatch !== canBatch;
    }
    addRenderable(tilingSprite, instructionSet) {
      const batcher = this._renderer.renderPipes.batch;
      this._updateCanBatch(tilingSprite);
      var tilingSpriteData = this._getTilingSpriteData(tilingSprite);
      const {geometry, canBatch} = tilingSpriteData;
      canBatch ? (tilingSpriteData.batchableMesh || (tilingSpriteData.batchableMesh = new BatchableMesh.BatchableMesh()), tilingSpriteData = tilingSpriteData.batchableMesh, tilingSprite.didViewUpdate && (this._updateBatchableMesh(tilingSprite), tilingSpriteData.geometry = geometry, tilingSpriteData.renderable = tilingSprite, tilingSpriteData.transform = tilingSprite.groupTransform, tilingSpriteData.setTexture(tilingSprite._texture)), tilingSpriteData.roundPixels = this._renderer._roundPixels | tilingSprite._roundPixels, 
      batcher.addToBatch(tilingSpriteData, instructionSet)) : (batcher.break(instructionSet), tilingSpriteData.shader || (tilingSpriteData.shader = new TilingSpriteShader.TilingSpriteShader()), this.updateRenderable(tilingSprite), instructionSet.add(tilingSprite));
    }
    execute(tilingSprite) {
      const renderer = this._renderer, {shader} = this._getTilingSpriteData(tilingSprite);
      shader.groups[0] = renderer.globalUniforms.bindGroup;
      const localUniforms = shader.resources.localUniforms.uniforms;
      localUniforms.uTransformMatrix = tilingSprite.groupTransform;
      localUniforms.uRound = renderer._roundPixels | tilingSprite._roundPixels;
      colorToUniform.color32BitToUniform(tilingSprite.groupColorAlpha, localUniforms.uColor, 0);
      this._state.blendMode = getAdjustedBlendModeBlend.getAdjustedBlendModeBlend(tilingSprite.groupBlendMode, tilingSprite.texture._source);
      renderer.encoder.draw({geometry:sharedQuad, shader, state:this._state});
    }
    updateRenderable(tilingSprite) {
      var tilingSpriteData = this._getTilingSpriteData(tilingSprite);
      const {canBatch} = tilingSpriteData;
      canBatch ? ({batchableMesh:tilingSpriteData} = tilingSpriteData, tilingSprite.didViewUpdate && this._updateBatchableMesh(tilingSprite), tilingSpriteData._batcher.updateElement(tilingSpriteData)) : tilingSprite.didViewUpdate && ({shader:tilingSpriteData} = tilingSpriteData, tilingSpriteData.updateUniforms(tilingSprite.width, tilingSprite.height, tilingSprite._tileTransform.matrix, tilingSprite.anchor.x, tilingSprite.anchor.y, tilingSprite.texture));
    }
    _getTilingSpriteData(renderable) {
      return renderable._gpuData[this._renderer.uid] || this._initTilingSpriteData(renderable);
    }
    _initTilingSpriteData(tilingSprite) {
      const gpuData = new TilingSpriteGpuData();
      gpuData.renderable = tilingSprite;
      tilingSprite._gpuData[this._renderer.uid] = gpuData;
      this._managedTilingSprites.add(tilingSprite);
      return gpuData;
    }
    _updateBatchableMesh(tilingSprite) {
      var renderableData = this._getTilingSpriteData(tilingSprite);
      ({geometry:renderableData} = renderableData);
      const style = tilingSprite.texture.source.style;
      "repeat" !== style.addressMode && (style.addressMode = "repeat", style.update());
      setUvs.setUvs(tilingSprite, renderableData.uvs);
      setPositions.setPositions(tilingSprite, renderableData.positions);
    }
    destroy() {
      this._managedTilingSprites.destroy();
      this._renderer = null;
    }
    _updateCanBatch(tilingSprite) {
      const renderableData = this._getTilingSpriteData(tilingSprite);
      tilingSprite = tilingSprite.texture;
      let _nonPowOf2wrapping = !0;
      this._renderer.type === types.RendererType.WEBGL && (_nonPowOf2wrapping = this._renderer.context.supports.nonPowOf2wrapping);
      renderableData.canBatch = tilingSprite.textureMatrix.isSimple && (_nonPowOf2wrapping || tilingSprite.source.isPowerOfTwo);
      return renderableData.canBatch;
    }
  }
  TilingSpritePipe.extension = {type:[global.ExtensionType.WebGLPipes, global.ExtensionType.WebGPUPipes], name:"tilingSprite"};
  exports.TilingSpriteGpuData = TilingSpriteGpuData;
  exports.TilingSpritePipe = TilingSpritePipe;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$sprite_tiling$TilingSpritePipe.js.map
