shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$GpuStencilSystem = function(global, require, module, exports) {
  global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
  var _const = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$state$const");
  "use strict";
  class GpuStencilSystem {
    constructor(renderer) {
      this._renderTargetStencilState = Object.create(null);
      this._renderer = renderer;
      renderer.renderTarget.onRenderTargetChange.add(this);
    }
    onRenderTargetChange(renderTarget) {
      let stencilState = this._renderTargetStencilState[renderTarget.uid];
      stencilState || (stencilState = this._renderTargetStencilState[renderTarget.uid] = {stencilMode:_const.STENCIL_MODES.DISABLED, stencilReference:0});
      this._activeRenderTarget = renderTarget;
      this.setStencilMode(stencilState.stencilMode, stencilState.stencilReference);
    }
    setStencilMode(stencilMode, stencilReference) {
      var stencilState = this._renderTargetStencilState[this._activeRenderTarget.uid];
      stencilState.stencilMode = stencilMode;
      stencilState.stencilReference = stencilReference;
      stencilState = this._renderer;
      stencilState.pipeline.setStencilMode(stencilMode);
      stencilState.encoder.renderPassEncoder.setStencilReference(stencilReference);
    }
    destroy() {
      this._renderer.renderTarget.onRenderTargetChange.remove(this);
      this._renderTargetStencilState = this._activeRenderTarget = this._renderer = null;
    }
  }
  GpuStencilSystem.extension = {type:[global.ExtensionType.WebGPUSystem], name:"stencil"};
  exports.GpuStencilSystem = GpuStencilSystem;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$GpuStencilSystem.js.map
