shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContextSystem = function(global, require, module, exports) {
  global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
  var getTextureBatchBindGroup = require("module$node_modules$pixi_DOT_js$lib$rendering$batcher$gpu$getTextureBatchBindGroup"), DefaultBatcher = require("module$node_modules$pixi_DOT_js$lib$rendering$batcher$shared$DefaultBatcher"), InstructionSet = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$instructions$InstructionSet"), GCManagedHash = require("module$node_modules$pixi_DOT_js$lib$utils$data$GCManagedHash"), deprecation = require("module$node_modules$pixi_DOT_js$lib$utils$logging$deprecation"), 
  PoolGroup = require("module$node_modules$pixi_DOT_js$lib$utils$pool$PoolGroup"), buildContextBatches = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$utils$buildContextBatches");
  "use strict";
  class GpuGraphicsContext {
    constructor() {
      this.batches = [];
      this.geometryData = {vertices:[], uvs:[], indices:[]};
    }
    reset() {
      this.batches && this.batches.forEach(batch => {
        PoolGroup.BigPool.return(batch);
      });
      this.graphicsData && PoolGroup.BigPool.return(this.graphicsData);
      this.isBatchable = !1;
      this.context = null;
      this.batches.length = 0;
      this.geometryData.indices.length = 0;
      this.geometryData.vertices.length = 0;
      this.geometryData.uvs.length = 0;
      this.graphicsData = null;
    }
    destroy() {
      this.reset();
      this.geometryData = this.batches = null;
    }
  }
  class GraphicsContextRenderData {
    constructor() {
      this.instructions = new InstructionSet.InstructionSet();
    }
    init(options) {
      options = options.maxTextures;
      this.batcher ? this.batcher._updateMaxTextures(options) : this.batcher = new DefaultBatcher.DefaultBatcher({maxTextures:options});
      this.instructions.reset();
    }
    get geometry() {
      deprecation.deprecation(deprecation.v8_3_4, "GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead.");
      return this.batcher.geometry;
    }
    destroy() {
      this.batcher.destroy();
      this.instructions.destroy();
      this.instructions = this.batcher = null;
    }
  }
  const node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContextSystem$classdecl$var30 = class {
    constructor(renderer) {
      this._renderer = renderer;
      this._managedContexts = new GCManagedHash.GCManagedHash({renderer, type:"resource", name:"graphicsContext"});
    }
    init(options) {
      node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContextSystem$classdecl$var30.defaultOptions.bezierSmoothness = options?.bezierSmoothness ?? node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContextSystem$classdecl$var30.defaultOptions.bezierSmoothness;
    }
    getContextRenderData(context) {
      return context._gpuData[this._renderer.uid].graphicsData || this._initContextRenderData(context);
    }
    updateGpuContext(context) {
      var hasContext = !!context._gpuData[this._renderer.uid];
      const gpuContext = context._gpuData[this._renderer.uid] || this._initContext(context);
      if (context.dirty || !hasContext) {
        hasContext && gpuContext.reset(), buildContextBatches.buildContextBatches(context, gpuContext), hasContext = context.batchMode, gpuContext.isBatchable = context.customShader || "no-batch" === hasContext ? !1 : "auto" === hasContext ? 400 > gpuContext.geometryData.vertices.length : !0, context.dirty = !1;
      }
      return gpuContext;
    }
    getGpuContext(context) {
      return context._gpuData[this._renderer.uid] || this._initContext(context);
    }
    _initContextRenderData(context) {
      const graphicsData = PoolGroup.BigPool.get(GraphicsContextRenderData, {maxTextures:this._renderer.limits.maxBatchableTextures});
      context = context._gpuData[this._renderer.uid];
      const {batches, geometryData} = context;
      context.graphicsData = graphicsData;
      var vertexSize = geometryData.vertices.length, indexSize = geometryData.indices.length;
      for (context = 0; context < batches.length; context++) {
        batches[context].applyTransform = !1;
      }
      context = graphicsData.batcher;
      context.ensureAttributeBuffer(vertexSize);
      context.ensureIndexBuffer(indexSize);
      context.begin();
      for (vertexSize = 0; vertexSize < batches.length; vertexSize++) {
        context.add(batches[vertexSize]);
      }
      context.finish(graphicsData.instructions);
      vertexSize = context.geometry;
      vertexSize.indexBuffer.setDataWithSize(context.indexBuffer, context.indexSize, !0);
      vertexSize.buffers[0].setDataWithSize(context.attributeBuffer.float32View, context.attributeSize, !0);
      context = context.batches;
      for (vertexSize = 0; vertexSize < context.length; vertexSize++) {
        indexSize = context[vertexSize], indexSize.bindGroup = getTextureBatchBindGroup.getTextureBatchBindGroup(indexSize.textures.textures, indexSize.textures.count, this._renderer.limits.maxBatchableTextures);
      }
      return graphicsData;
    }
    _initContext(context) {
      const gpuContext = new GpuGraphicsContext();
      gpuContext.context = context;
      context._gpuData[this._renderer.uid] = gpuContext;
      this._managedContexts.add(context);
      return gpuContext;
    }
    destroy() {
      this._managedContexts.destroy();
      this._renderer = null;
    }
  };
  require = node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContextSystem$classdecl$var30;
  require.extension = {type:[global.ExtensionType.WebGLSystem, global.ExtensionType.WebGPUSystem], name:"graphicsContext"};
  require.defaultOptions = {bezierSmoothness:0.5};
  exports.GpuGraphicsContext = GpuGraphicsContext;
  exports.GraphicsContextRenderData = GraphicsContextRenderData;
  exports.GraphicsContextSystem = require;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContextSystem.js.map
