@sqaitech/ios 0.30.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +336 -0
  2. package/bin/sqai-ios-playground +3 -0
  3. package/dist/es/bin.mjs +12872 -0
  4. package/dist/es/bin.mjs.LICENSE.txt +256 -0
  5. package/dist/es/index.mjs +923 -0
  6. package/dist/lib/bin.js +13017 -0
  7. package/dist/lib/bin.js.LICENSE.txt +256 -0
  8. package/dist/lib/index.js +982 -0
  9. package/dist/types/bin.d.ts +1 -0
  10. package/dist/types/index.d.ts +132 -0
  11. package/package.json +65 -0
  12. package/static/favicon.ico +0 -0
  13. package/static/index.html +1 -0
  14. package/static/static/css/index.60c69390.css +2 -0
  15. package/static/static/css/index.60c69390.css.map +1 -0
  16. package/static/static/js/931.dc961e99.js +620 -0
  17. package/static/static/js/931.dc961e99.js.LICENSE.txt +146 -0
  18. package/static/static/js/931.dc961e99.js.map +1 -0
  19. package/static/static/js/async/173.9cf6b074.js +3 -0
  20. package/static/static/js/async/173.9cf6b074.js.map +1 -0
  21. package/static/static/js/async/212.e243c338.js +158 -0
  22. package/static/static/js/async/212.e243c338.js.map +1 -0
  23. package/static/static/js/async/329.f888b505.js +26 -0
  24. package/static/static/js/async/329.f888b505.js.map +1 -0
  25. package/static/static/js/async/364.1821e74b.js +30 -0
  26. package/static/static/js/async/364.1821e74b.js.map +1 -0
  27. package/static/static/js/async/544.b73fa603.js +2 -0
  28. package/static/static/js/async/544.b73fa603.js.map +1 -0
  29. package/static/static/js/async/582.5dccae2d.js +21 -0
  30. package/static/static/js/async/582.5dccae2d.js.map +1 -0
  31. package/static/static/js/async/624.45ee2b2c.js +3 -0
  32. package/static/static/js/async/624.45ee2b2c.js.map +1 -0
  33. package/static/static/js/async/644.6bdc4065.js +1 -0
  34. package/static/static/js/async/659.9afd03db.js +21 -0
  35. package/static/static/js/async/659.9afd03db.js.map +1 -0
  36. package/static/static/js/async/702.60261735.js +231 -0
  37. package/static/static/js/async/702.60261735.js.map +1 -0
  38. package/static/static/js/async/920.7d9a9aa8.js +2 -0
  39. package/static/static/js/async/920.7d9a9aa8.js.map +1 -0
  40. package/static/static/js/async/983.8b91303f.js +1 -0
  41. package/static/static/js/index.5cccbdaf.js +10 -0
  42. package/static/static/js/index.5cccbdaf.js.LICENSE.txt +7 -0
  43. package/static/static/js/index.5cccbdaf.js.map +1 -0
  44. package/static/static/js/index.8a10896b.js +10 -0
  45. package/static/static/js/index.8a10896b.js.LICENSE.txt +7 -0
  46. package/static/static/js/index.8a10896b.js.map +1 -0
  47. package/static/static/js/index.f21bb1df.js +10 -0
  48. package/static/static/js/index.f21bb1df.js.LICENSE.txt +7 -0
  49. package/static/static/js/index.f21bb1df.js.map +1 -0
  50. package/static/static/js/lib-react.f566a9ed.js +3 -0
  51. package/static/static/js/lib-react.f566a9ed.js.LICENSE.txt +39 -0
  52. package/static/static/js/lib-react.f566a9ed.js.map +1 -0
  53. package/static/static/svg/server-offline-foreground.3113df3c.svg +36 -0
  54. package/static/static/wasm/9e906fbf55e08f98.module.wasm +0 -0
@@ -0,0 +1,26 @@
1
+ "use strict";(self.webpackChunkplayground=self.webpackChunkplayground||[]).push([["329"],{67187:function(e,t,r){r.d(t,{WebGPURenderer:()=>em});var s=r(91957),i=r(30044),n=r(50473),o=r(29465),a=r(43200),u=r(23149),d=r(39193),h=r(78300),l=r(71067),c=r(8482),p=r(73109);class f{init(){let e=new p.o({uTransformMatrix:{value:new i.y,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),t=(0,a.d)({name:"graphics",bits:[u.M,(0,d.m)(o.A),h.Kt,l.j]});this.shader=new c.e({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let r=t.context,s=r.customShader||this.shader,i=e.renderer,{geometry:o,instructions:a}=i.graphicsContext.getContextRenderData(r),u=i.encoder;u.setPipelineFromGeometryProgramAndState(o,s.gpuProgram,e.state),u.setGeometry(o);let d=i.globalUniforms.bindGroup;u.setBindGroup(0,d,s.gpuProgram);let h=i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);u.setBindGroup(2,h,s.gpuProgram);let l=a.instructions;for(let e=0;e<a.instructionSize;e++){let t=l[e];if(s.groups[1]=t.bindGroup,!t.gpuBindGroup){let e=t.textures;t.bindGroup=(0,n.Q)(e.textures,e.count),t.gpuBindGroup=i.bindGroup.getBindGroup(t.bindGroup,s.gpuProgram,1)}u.setBindGroup(1,t.bindGroup,s.gpuProgram),u.renderPassEncoder.drawIndexed(t.size,1,t.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}f.extension={type:[s.nw.WebGPUPipesAdaptor],name:"graphics"};var g=r(17893),_=r(41277),m=r(92245);class b{init(){let e=(0,a.d)({name:"mesh",bits:[h.XH,g.r,l.j]});this._shader=new c.e({gpuProgram:e,resources:{uTexture:_.x.EMPTY._source,uSampler:_.x.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new i.y}}}})}execute(e,t){let r=e.renderer,s=t._shader;if(s){if(!s.gpuProgram)return void(0,m.Z)("Mesh shader has no gpuProgram",t.shader)}else(s=this._shader).resources.uTexture=t.texture.source,s.resources.uSampler=t.texture.source.style,s.resources.textureUniforms.uniforms.uTextureMatrix=t.texture.textureMatrix.mapCoord;let i=s.gpuProgram;if(i.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){let t=e.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(t,!0)}r.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}b.extension={type:[s.nw.WebGPUPipesAdaptor],name:"mesh"};var x=r(29492);let y=x.Z.for2d();class G{init(){let e=(0,a.d)({name:"batch",bits:[u.M,(0,d.m)(o.A),l.j]});this._shader=new c.e({gpuProgram:e,groups:{}})}start(e,t){let r=e.renderer,s=r.encoder,i=this._shader.gpuProgram;this._geometry=t,s.setGeometry(t),y.blendMode="normal",r.pipeline.getPipeline(t,i,y);let n=r.globalUniforms.bindGroup;s.resetBindGroup(1),s.setBindGroup(0,n,i)}execute(e,t){let r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){let e=t.textures;t.bindGroup=(0,n.Q)(e.textures,e.count)}y.blendMode=t.blendMode;let o=s.bindGroup.getBindGroup(t.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,y);t.bindGroup._touch(s.textureGC.count),i.setPipeline(a),i.renderPassEncoder.setBindGroup(1,o),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}destroy(){this._shader.destroy(!0),this._shader=null}}G.extension={type:[s.nw.WebGPUPipesAdaptor],name:"batch"};var P=r(17638),B=r(8826),S=r(71423);class T{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){let s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(let t in i){let r,s=e.resources[t]??e.resources[i[t]];if("uniformGroup"===s._resourceType){o.ubo.updateUniformGroup(s);let e=s.buffer;r={buffer:o.buffer.getGPUBuffer(e),offset:0,size:e.descriptor.size}}else"buffer"===s._resourceType?r={buffer:o.buffer.getGPUBuffer(s),offset:0,size:s.descriptor.size}:"bufferResource"===s._resourceType?r={buffer:o.buffer.getGPUBuffer(s.buffer),offset:s.offset,size:s.size}:"textureSampler"===s._resourceType?r=o.texture.getGpuSampler(s):"textureSource"===s._resourceType&&(r=o.texture.getGpuSource(s).createView({}));n.push({binding:i[t],resource:r})}let a=o.shader.getProgramData(t).bindGroups[r],u=s.createBindGroup({layout:a,entries:n});return this._hash[e._key]=u,u}destroy(){for(let e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}}T.extension={type:[s.nw.WebGPUSystem],name:"bindGroup"};var C=r(74039);class v{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){let t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){for(let e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&((0,C.T)(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,this._managedBuffers.push(e),t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}}v.extension={type:[s.nw.WebGPUSystem],name:"buffer"};class w{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}w.extension={type:[s.nw.WebGPUSystem],name:"colorMask"};class M{constructor(e){this._renderer=e}async init(e){return this._initPromise||(this._initPromise=this._createDeviceAndAdaptor(e).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)})),this._initPromise}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){let t=await navigator.gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(e=>t.features.has(e)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}M.extension={type:[s.nw.WebGPUSystem],name:"device"},M.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class U{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){let i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;let t=2===e.data.BYTES_PER_ELEMENT?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e){for(let t in e.attributes){let r=e.attributes[t];this._setVertexBuffer(r.location,r.buffer)}e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let r in e.groups){let s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(let t in e.resources){let r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){let{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:a,skipSync:u}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t),this._setShaderBindGroups(r,u),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,a||t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),a||t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);let t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;for(let e in this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t),r)this._setVertexBuffer(e,r[e]);for(let e in i)this.setBindGroup(e,i[e],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}U.extension={type:[s.nw.WebGPUSystem],name:"encoder",priority:1};var E=r(22246);class R{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:E.D.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;let s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}R.extension={type:[s.nw.WebGPUSystem],name:"stencil"};var k=r(1839),A=r(36697),H=r(95753),F=r(74821);class O{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw Error(`UniformBufferBatch: array is too large: ${4*e}`);let t=this.byteIndex,r=t+4*e;if((r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment)>4*this.data.length)throw Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}var D=r(49458);class L{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new O({minUniformOffsetAlignment:128});for(let e=0;e<2;e++){let t=F.F.UNIFORM|F.F.COPY_DST;0===e&&(t|=F.F.COPY_SRC),this._buffers.push(new A.l({data:this._batchBuffer.data,usage:t}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let e in this._bindGroupHash)this._bindGroupHash[e]=null;this._batchBuffer.clear()}getUniformBindGroup(e,t){if(!t&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);let r=e.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,s/4),this._bindGroupHash[e.uid]=this._getBindGroup(s/128),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);let t=e.buffer.data,r=this._batchBuffer.addGroup(t);return this._getBufferResource(r/128)}getArrayBindGroup(e){let t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/128)}getArrayBufferResource(e){let t=this._batchBuffer.addGroup(e);return this._getBufferResource(t/128)}_getBufferResource(e){if(!this._bufferResources[e]){let t=this._buffers[e%2];this._bufferResources[e]=new H.q({buffer:t,offset:(e/2|0)*256,size:128})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let t=new D.v({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){let e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let i=this._buffers[s];r.copyBufferToBuffer(e.getGPUBuffer(t),128,e.getGPUBuffer(i),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let e=0;e<this._bindGroups.length;e++)this._bindGroups[e].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers=null;for(let e=0;e<this._bufferResources.length;e++)this._bufferResources[e].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}}L.extension={type:[s.nw.WebGPUPipes],name:"uniformBatch"};var I=r(532),W=r(12568),V=r(18228);let z={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};class N{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(E.D.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=+!!e.descriptor.depthStencilAttachment,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=V.L[e],this._updatePipeHash())}setPipeline(e,t,r,s){let i=this.getPipeline(e,t,r);s.setPipeline(i)}getPipeline(e,t,r,s){var i,n,o;e._layoutKey||((0,I.B)(e,t.attributeData),this._generateBufferKey(e)),s=s||e.topology;let a=(i=e._layoutKey,n=t._layoutKey,o=r.data,i<<24|n<<16|o<<10|r._blendModeId<<5|z[s]);return this._pipeCache[a]||(this._pipeCache[a]=this._createPipeline(e,t,r,s)),this._pipeCache[a]}_createPipeline(e,t,r,s){let i=this._gpu.device,n=this._createVertexBufferLayouts(e),o=this._renderer.state.getColorTargets(r);o[0].writeMask=this._stencilMode===E.D.RENDERING_MASK_ADD?0:this._colorMask;let a=this._renderer.shader.getProgramData(t).pipeline,u={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:o},primitive:{topology:s,cullMode:r.cullMode},layout:a,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(u.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),i.createRenderPipeline(u)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],r=0,s=Object.keys(e.attributes).sort();for(let i=0;i<s.length;i++){let n=e.attributes[s[i]];t[r++]=n.location,t[r++]=n.offset,t[r++]=n.format,t[r++]=n.stride}let i=t.join("");return e._layoutKey=(0,W.Z)(i,"geometry"),e._layoutKey}_createVertexBufferLayouts(e){if(this._bufferLayoutsCache[e._layoutKey])return this._bufferLayoutsCache[e._layoutKey];let t=[];return e.buffers.forEach(r=>{let s={arrayStride:0,stepMode:"vertex",attributes:[]},i=s.attributes;for(let t in e.attributes){let n=e.attributes[t];n.buffer===r&&(s.arrayStride=n.stride,s.stepMode=n.instance?"instance":"vertex",i.push({shaderLocation:n.location,offset:n.offset,format:n.format}))}i.length&&t.push(s)}),this._bufferLayoutsCache[e._layoutKey]=t,t}_updatePipeHash(){var e,t;let r=(e=this._stencilMode,t=this._multisampleCount,this._colorMask<<6|e<<3|this._depthStencilAttachment<<1|t);this._pipeStateCaches[r]||(this._pipeStateCaches[r]=Object.create(null)),this._pipeCache=this._pipeStateCaches[r]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}N.extension={type:[s.nw.WebGPUSystem],name:"pipeline"};var j=r(72310),K=r(81599),q=r(11300),Y=r(62815);class X{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class Z{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,s,i){let n=this._renderer,o=this._getGpuColorTexture(e),a=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:r},{texture:a,origin:i},s),t}startRenderPass(e,t=!0,r,s){let i=this._renderTargetSystem.getGpuRenderTarget(e);i.descriptor=this.getDescriptor(e,t,r),this._renderer.pipeline.setRenderTarget(i),this._renderer.encoder.beginRenderPass(i),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,r){let s;"boolean"==typeof t&&(t=t?K.E.ALL:K.E.NONE);let i=this._renderTargetSystem,n=i.getGpuRenderTarget(e),o=e.colorTextures.map((e,s)=>{let o,a,u=n.contexts[s];o=u?u.getCurrentTexture().createView():this._renderer.texture.getGpuSource(e).createView({mipLevelCount:1}),n.msaaTextures[s]&&(a=o,o=this._renderer.texture.getTextureView(n.msaaTextures[s]));let d=t&K.E.COLOR?"clear":"load";return r??(r=i.defaultClearColor),{view:o,resolveTarget:a,clearValue:r,storeOp:"store",loadOp:d}});if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=n.msaa?4:1),e.depthStencilTexture){let r=t&K.E.STENCIL?"clear":"load",i=t&K.E.DEPTH?"clear":"load";s={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:r,depthClearValue:1,depthLoadOp:i,depthStoreOp:"store"}}return{colorAttachments:o,depthStencilAttachment:s}}clear(e,t=!0,r,s){if(!t)return;let{gpu:i,encoder:n}=this._renderer,o=i.device;if(null===n.commandEncoder){let i=o.createCommandEncoder(),n=this.getDescriptor(e,t,r),a=i.beginRenderPass(n);a.setViewport(s.x,s.y,s.width,s.height,0,1),a.end();let u=i.finish();o.queue.submit([u])}else this.startRenderPass(e,t,r,s)}initGpuRenderTarget(e){e.isRoot=!0;let t=new X;return e.colorTextures.forEach((e,r)=>{if(q.D.test(e.resource)){let s=e.resource.getContext("webgpu"),i=e.transparent?"premultiplied":"opaque";try{s.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:i})}catch(e){console.error(e)}t.contexts[r]=s}if(t.msaa=e.source.antialias,e.source.antialias){let e=new Y.p({width:0,height:0,sampleCount:4});t.msaaTextures[r]=e}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(e=>{e.unconfigure()}),e.msaaTextures.forEach(e=>{e.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((e,r)=>{let s=t.msaaTextures[r];s?.resize(e.source.width,e.source.height,e.source._resolution)})}}class Q extends j.l{constructor(e){super(e),this.adaptor=new Z,this.adaptor.init(e,this)}}Q.extension={type:[s.nw.WebGPUSystem],name:"renderTarget"};class ${constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let t=this._gpu.device,r=e.gpuLayout.map(e=>t.createBindGroupLayout({entries:e}));return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout({bindGroupLayouts:r})},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}$.extension={type:[s.nw.WebGPUSystem],name:"shader"};let J={};J.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},J.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},J.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},J.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},J.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},J.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},J["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},J["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},J["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},J.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};class ee{constructor(){this.defaultState=new x.Z,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:J[e.blendMode]||J.normal}]}destroy(){this.gpu=null}}ee.extension={type:[s.nw.WebGPUSystem],name:"state"};var et=r(767),er=r(51982);let es={type:"image",upload(e,t,r){let s=e.resource,i=(0|e.pixelWidth)*(0|e.pixelHeight),n=s.byteLength/i;r.device.queue.writeTexture({texture:t},s,{offset:0,rowsPerImage:e.pixelHeight,bytesPerRow:e.pixelHeight*n},{width:e.pixelWidth,height:e.pixelHeight,depthOrArrayLayers:1})}},ei={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},en={blockBytes:4,blockWidth:1,blockHeight:1},eo={type:"compressed",upload(e,t,r){let s=e.pixelWidth,i=e.pixelHeight,n=ei[e.format]||en;for(let o=0;o<e.resource.length;o++){let a=e.resource[o],u=Math.ceil(s/n.blockWidth)*n.blockBytes;r.device.queue.writeTexture({texture:t,mipLevel:o},a,{offset:0,bytesPerRow:u},{width:Math.ceil(s/n.blockWidth)*n.blockWidth,height:Math.ceil(i/n.blockHeight)*n.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},ea={type:"image",upload(e,t,r){let s=e.resource;if(!s)return;let i=Math.min(t.width,e.resourceWidth||e.pixelWidth),n=Math.min(t.height,e.resourceHeight||e.pixelHeight),o="premultiply-alpha-on-upload"===e.alphaMode;r.device.queue.copyExternalImageToTexture({source:s},{texture:t,premultipliedAlpha:o},{width:i,height:n})}},eu={type:"video",upload(e,t,r){ea.upload(e,t,r)}};class ed{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
2
+ var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
3
+ vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
4
+
5
+ struct VertexOutput {
6
+ @builtin(position) position : vec4<f32>,
7
+ @location(0) texCoord : vec2<f32>,
8
+ };
9
+
10
+ @vertex
11
+ fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
12
+ var output : VertexOutput;
13
+ output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
14
+ output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
15
+ return output;
16
+ }
17
+
18
+ @group(0) @binding(0) var imgSampler : sampler;
19
+ @group(0) @binding(1) var img : texture_2d<f32>;
20
+
21
+ @fragment
22
+ fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
23
+ return textureSample(img, imgSampler, texCoord);
24
+ }
25
+ `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if("3d"===e.dimension||"1d"===e.dimension)throw Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e,s=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){let t={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(t)}let n=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let a=0;a<s;++a){let s=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:a,arrayLayerCount:1}),u=+!!i;for(let i=1;i<e.mipLevelCount;++i){let e=r.createView({baseMipLevel:u++,mipLevelCount:1,dimension:"2d",baseArrayLayer:a,arrayLayerCount:1}),i=n.beginRenderPass({colorAttachments:[{view:e,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),d=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:s}]});i.setPipeline(t),i.setBindGroup(0,d),i.draw(3,1,0,0),i.end(),s=e}}if(!i){let t={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s};for(let s=1;s<e.mipLevelCount;++s)n.copyTextureToTexture({texture:r,mipLevel:s-1},{texture:e,mipLevel:s},t),t.width=Math.ceil(t.width/2),t.height=Math.ceil(t.height/2)}return this.device.queue.submit([n.finish()]),i||r.destroy(),e}}class eh{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:ea,buffer:es,video:eu,compressed:eo},this._renderer=e}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let t=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(t))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;"compressed"!==e.uploadMethodId&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let r=ei[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,i=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,n={label:e.label,size:{width:s,height:i},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},o=this._gpu.device.createTexture(n);return this._gpuSources[e.uid]=o,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),o}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new ed(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source,r=t.uid;return this._bindGroupHash[r]=new D.v({0:t,1:t.style}),this._bindGroupHash[r]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,r=t.gpu.device.createCommandEncoder(),s=et.z.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;let i=s.getContext("webgpu");return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([r.finish()]),s}getPixels(e){let t=this.generateCanvas(e),r=er.h.getOptimalCanvasAndContext(t.width,t.height),s=r.context;s.drawImage(t,0,0);let{width:i,height:n}=t,o=new Uint8ClampedArray(s.getImageData(0,0,i,n).data.buffer);return er.h.returnCanvasAndContext(r),{pixels:o,width:i,height:n}}destroy(){for(let e of(this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,Object.keys(this._bindGroupHash))){let t=Number(e),r=this._bindGroupHash[t];r?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}eh.extension={type:[s.nw.WebGPUSystem],name:"texture"};let el=[...B.N,k.Y,U,M,v,eh,Q,$,ee,N,w,R,T],ec=[...B.U,L],ep=[G,b,f],ef=[],eg=[],e_=[];s.Rw.handleByNamedList(s.nw.WebGPUSystem,ef),s.Rw.handleByNamedList(s.nw.WebGPUPipes,eg),s.Rw.handleByNamedList(s.nw.WebGPUPipesAdaptor,e_),s.Rw.add(...el,...ec,...ep);class em extends P.I{constructor(){super({name:"webgpu",type:S.g.WEBGPU,systems:ef,renderPipes:eg,renderPipeAdaptors:e_})}}},51982:function(e,t,r){r.d(t,{h:()=>n});var s=r(767),i=r(45854);let n=new class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let r=s.z.get().createCanvas();r.width=e,r.height=t;let i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(e,t,r=1){e=Math.ceil(e*r-1e-6),t=Math.ceil(t*r-1e-6),e=(0,i.a9)(e),t=(0,i.a9)(t);let s=(e<<17)+(t<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let n=this._canvasPool[s].pop();return n||(n=this._createCanvasAndContext(e,t)),n}returnCanvasAndContext(e){let{width:t,height:r}=e.canvas;this._canvasPool[(t<<17)+(r<<1)].push(e)}clear(){this._canvasPool={}}}}}]);
26
+ //# sourceMappingURL=329.f888b505.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static/js/async/329.f888b505.js","sources":["webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/scene/graphics/gpu/GpuGraphicsAdaptor.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/scene/mesh/gpu/GpuMeshAdapter.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/batcher/gpu/GpuBatchAdaptor.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/BindGroupSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/buffer/GpuBufferSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuColorMaskSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuDeviceSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuEncoderSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuStencilSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/buffer/UboBatch.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuUniformBatchPipe.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/pipeline/PipelineSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/GpuRenderTarget.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/GpuRenderTargetAdaptor.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/GpuRenderTargetSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/GpuShaderSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/state/GpuBlendModesToPixi.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/state/GpuStateSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/gpu/WebGPURenderer.mjs","webpack://playground/../../node_modules/.pnpm/pixi.js@8.1.1/node_modules/pixi.js/lib/rendering/renderers/shared/texture/CanvasPool.mjs"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { getTextureBatchBindGroup } from '../../../rendering/batcher/gpu/getTextureBatchBindGroup.mjs';\nimport { MAX_TEXTURES } from '../../../rendering/batcher/shared/const.mjs';\nimport { compileHighShaderGpuProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { colorBit } from '../../../rendering/high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBit } from '../../../rendering/high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { localUniformBitGroup2 } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBit } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';\n\n\"use strict\";\nclass GpuGraphicsAdaptor {\n init() {\n const localUniforms = new UniformGroup({\n uTransformMatrix: { value: new Matrix(), type: \"mat3x3<f32>\" },\n uColor: { value: new Float32Array([1, 1, 1, 1]), type: \"vec4<f32>\" },\n uRound: { value: 0, type: \"f32\" }\n });\n const gpuProgram = compileHighShaderGpuProgram({\n name: \"graphics\",\n bits: [\n colorBit,\n generateTextureBatchBit(MAX_TEXTURES),\n localUniformBitGroup2,\n roundPixelsBit\n ]\n });\n this.shader = new Shader({\n gpuProgram,\n resources: {\n // added on the fly!\n localUniforms\n }\n });\n }\n execute(graphicsPipe, renderable) {\n const context = renderable.context;\n const shader = context.customShader || this.shader;\n const renderer = graphicsPipe.renderer;\n const contextSystem = renderer.graphicsContext;\n const {\n geometry,\n instructions\n } = contextSystem.getContextRenderData(context);\n const encoder = renderer.encoder;\n encoder.setPipelineFromGeometryProgramAndState(\n geometry,\n shader.gpuProgram,\n graphicsPipe.state\n );\n encoder.setGeometry(geometry);\n const globalUniformsBindGroup = renderer.globalUniforms.bindGroup;\n encoder.setBindGroup(0, globalUniformsBindGroup, shader.gpuProgram);\n const localBindGroup = renderer.renderPipes.uniformBatch.getUniformBindGroup(shader.resources.localUniforms, true);\n encoder.setBindGroup(2, localBindGroup, shader.gpuProgram);\n const batches = instructions.instructions;\n for (let i = 0; i < instructions.instructionSize; i++) {\n const batch = batches[i];\n shader.groups[1] = batch.bindGroup;\n if (!batch.gpuBindGroup) {\n const textureBatch = batch.textures;\n batch.bindGroup = getTextureBatchBindGroup(textureBatch.textures, textureBatch.count);\n batch.gpuBindGroup = renderer.bindGroup.getBindGroup(\n batch.bindGroup,\n shader.gpuProgram,\n 1\n );\n }\n encoder.setBindGroup(1, batch.bindGroup, shader.gpuProgram);\n encoder.renderPassEncoder.drawIndexed(batch.size, 1, batch.start);\n }\n }\n destroy() {\n this.shader.destroy(true);\n this.shader = null;\n }\n}\n/** @ignore */\nGpuGraphicsAdaptor.extension = {\n type: [\n ExtensionType.WebGPUPipesAdaptor\n ],\n name: \"graphics\"\n};\n\nexport { GpuGraphicsAdaptor };\n//# sourceMappingURL=GpuGraphicsAdaptor.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { compileHighShaderGpuProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { localUniformBit } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBit } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { textureBit } from '../../../rendering/high-shader/shader-bits/textureBit.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\n\n\"use strict\";\nclass GpuMeshAdapter {\n init() {\n const gpuProgram = compileHighShaderGpuProgram({\n name: \"mesh\",\n bits: [\n localUniformBit,\n textureBit,\n roundPixelsBit\n ]\n });\n this._shader = new Shader({\n gpuProgram,\n resources: {\n uTexture: Texture.EMPTY._source,\n uSampler: Texture.EMPTY._source.style,\n textureUniforms: {\n uTextureMatrix: { type: \"mat3x3<f32>\", value: new Matrix() }\n }\n }\n });\n }\n execute(meshPipe, mesh) {\n const renderer = meshPipe.renderer;\n let shader = mesh._shader;\n if (!shader) {\n shader = this._shader;\n shader.resources.uTexture = mesh.texture.source;\n shader.resources.uSampler = mesh.texture.source.style;\n shader.resources.textureUniforms.uniforms.uTextureMatrix = mesh.texture.textureMatrix.mapCoord;\n } else if (!shader.gpuProgram) {\n warn(\"Mesh shader has no gpuProgram\", mesh.shader);\n return;\n }\n const gpuProgram = shader.gpuProgram;\n if (gpuProgram.autoAssignGlobalUniforms) {\n shader.groups[0] = renderer.globalUniforms.bindGroup;\n }\n if (gpuProgram.autoAssignLocalUniforms) {\n const localUniforms = meshPipe.localUniforms;\n shader.groups[1] = renderer.renderPipes.uniformBatch.getUniformBindGroup(localUniforms, true);\n }\n renderer.encoder.draw({\n geometry: mesh._geometry,\n shader,\n state: mesh.state\n });\n }\n destroy() {\n this._shader.destroy(true);\n this._shader = null;\n }\n}\n/** @ignore */\nGpuMeshAdapter.extension = {\n type: [\n ExtensionType.WebGPUPipesAdaptor\n ],\n name: \"mesh\"\n};\n\nexport { GpuMeshAdapter };\n//# sourceMappingURL=GpuMeshAdapter.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { compileHighShaderGpuProgram } from '../../high-shader/compileHighShaderToProgram.mjs';\nimport { colorBit } from '../../high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBit } from '../../high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { roundPixelsBit } from '../../high-shader/shader-bits/roundPixelsBit.mjs';\nimport { Shader } from '../../renderers/shared/shader/Shader.mjs';\nimport { State } from '../../renderers/shared/state/State.mjs';\nimport { MAX_TEXTURES } from '../shared/const.mjs';\nimport { getTextureBatchBindGroup } from './getTextureBatchBindGroup.mjs';\n\n\"use strict\";\nconst tempState = State.for2d();\nclass GpuBatchAdaptor {\n init() {\n const gpuProgram = compileHighShaderGpuProgram({\n name: \"batch\",\n bits: [\n colorBit,\n generateTextureBatchBit(MAX_TEXTURES),\n roundPixelsBit\n ]\n });\n this._shader = new Shader({\n gpuProgram,\n groups: {\n // these will be dynamically allocated\n }\n });\n }\n start(batchPipe, geometry) {\n const renderer = batchPipe.renderer;\n const encoder = renderer.encoder;\n const program = this._shader.gpuProgram;\n this._geometry = geometry;\n encoder.setGeometry(geometry);\n tempState.blendMode = \"normal\";\n renderer.pipeline.getPipeline(\n geometry,\n program,\n tempState\n );\n const globalUniformsBindGroup = renderer.globalUniforms.bindGroup;\n encoder.resetBindGroup(1);\n encoder.setBindGroup(0, globalUniformsBindGroup, program);\n }\n execute(batchPipe, batch) {\n const program = this._shader.gpuProgram;\n const renderer = batchPipe.renderer;\n const encoder = renderer.encoder;\n if (!batch.bindGroup) {\n const textureBatch = batch.textures;\n batch.bindGroup = getTextureBatchBindGroup(textureBatch.textures, textureBatch.count);\n }\n tempState.blendMode = batch.blendMode;\n const gpuBindGroup = renderer.bindGroup.getBindGroup(\n batch.bindGroup,\n program,\n 1\n );\n const pipeline = renderer.pipeline.getPipeline(\n this._geometry,\n program,\n tempState\n );\n batch.bindGroup._touch(renderer.textureGC.count);\n encoder.setPipeline(pipeline);\n encoder.renderPassEncoder.setBindGroup(1, gpuBindGroup);\n encoder.renderPassEncoder.drawIndexed(batch.size, 1, batch.start);\n }\n destroy() {\n this._shader.destroy(true);\n this._shader = null;\n }\n}\n/** @ignore */\nGpuBatchAdaptor.extension = {\n type: [\n ExtensionType.WebGPUPipesAdaptor\n ],\n name: \"batch\"\n};\n\nexport { GpuBatchAdaptor };\n//# sourceMappingURL=GpuBatchAdaptor.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass BindGroupSystem {\n constructor(renderer) {\n this._hash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n getBindGroup(bindGroup, program, groupIndex) {\n bindGroup._updateKey();\n const gpuBindGroup = this._hash[bindGroup._key] || this._createBindGroup(bindGroup, program, groupIndex);\n return gpuBindGroup;\n }\n _createBindGroup(group, program, groupIndex) {\n const device = this._gpu.device;\n const groupLayout = program.layout[groupIndex];\n const entries = [];\n const renderer = this._renderer;\n for (const j in groupLayout) {\n const resource = group.resources[j] ?? group.resources[groupLayout[j]];\n let gpuResource;\n if (resource._resourceType === \"uniformGroup\") {\n const uniformGroup = resource;\n renderer.ubo.updateUniformGroup(uniformGroup);\n const buffer = uniformGroup.buffer;\n gpuResource = {\n buffer: renderer.buffer.getGPUBuffer(buffer),\n offset: 0,\n size: buffer.descriptor.size\n };\n } else if (resource._resourceType === \"buffer\") {\n const buffer = resource;\n gpuResource = {\n buffer: renderer.buffer.getGPUBuffer(buffer),\n offset: 0,\n size: buffer.descriptor.size\n };\n } else if (resource._resourceType === \"bufferResource\") {\n const bufferResource = resource;\n gpuResource = {\n buffer: renderer.buffer.getGPUBuffer(bufferResource.buffer),\n offset: bufferResource.offset,\n size: bufferResource.size\n };\n } else if (resource._resourceType === \"textureSampler\") {\n const sampler = resource;\n gpuResource = renderer.texture.getGpuSampler(sampler);\n } else if (resource._resourceType === \"textureSource\") {\n const texture = resource;\n gpuResource = renderer.texture.getGpuSource(texture).createView({});\n }\n entries.push({\n binding: groupLayout[j],\n resource: gpuResource\n });\n }\n const layout = renderer.shader.getProgramData(program).bindGroups[groupIndex];\n const gpuBindGroup = device.createBindGroup({\n layout,\n entries\n });\n this._hash[group._key] = gpuBindGroup;\n return gpuBindGroup;\n }\n destroy() {\n for (const key of Object.keys(this._hash)) {\n this._hash[key] = null;\n }\n this._hash = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nBindGroupSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"bindGroup\"\n};\n\nexport { BindGroupSystem };\n//# sourceMappingURL=BindGroupSystem.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { fastCopy } from '../../shared/buffer/utils/fastCopy.mjs';\n\n\"use strict\";\nclass GpuBufferSystem {\n constructor() {\n this._gpuBuffers = /* @__PURE__ */ Object.create(null);\n this._managedBuffers = [];\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n getGPUBuffer(buffer) {\n return this._gpuBuffers[buffer.uid] || this.createGPUBuffer(buffer);\n }\n updateBuffer(buffer) {\n const gpuBuffer = this._gpuBuffers[buffer.uid] || this.createGPUBuffer(buffer);\n const data = buffer.data;\n if (buffer._updateID && data) {\n buffer._updateID = 0;\n this._gpu.device.queue.writeBuffer(\n gpuBuffer,\n 0,\n data.buffer,\n 0,\n // round to the nearest 4 bytes\n (buffer._updateSize || data.byteLength) + 3 & ~3\n );\n }\n return gpuBuffer;\n }\n /** dispose all WebGL resources of all managed buffers */\n destroyAll() {\n for (const id in this._gpuBuffers) {\n this._gpuBuffers[id].destroy();\n }\n this._gpuBuffers = {};\n }\n createGPUBuffer(buffer) {\n if (!this._gpuBuffers[buffer.uid]) {\n buffer.on(\"update\", this.updateBuffer, this);\n buffer.on(\"change\", this.onBufferChange, this);\n buffer.on(\"destroy\", this.onBufferDestroy, this);\n }\n const gpuBuffer = this._gpu.device.createBuffer(buffer.descriptor);\n buffer._updateID = 0;\n if (buffer.data) {\n fastCopy(buffer.data.buffer, gpuBuffer.getMappedRange());\n gpuBuffer.unmap();\n }\n this._gpuBuffers[buffer.uid] = gpuBuffer;\n this._managedBuffers.push(buffer);\n return gpuBuffer;\n }\n onBufferChange(buffer) {\n const gpuBuffer = this._gpuBuffers[buffer.uid];\n gpuBuffer.destroy();\n buffer._updateID = 0;\n this._gpuBuffers[buffer.uid] = this.createGPUBuffer(buffer);\n }\n /**\n * Disposes buffer\n * @param buffer - buffer with data\n */\n onBufferDestroy(buffer) {\n this._managedBuffers.splice(this._managedBuffers.indexOf(buffer), 1);\n this._destroyBuffer(buffer);\n }\n destroy() {\n this._managedBuffers.forEach((buffer) => this._destroyBuffer(buffer));\n this._managedBuffers = null;\n this._gpuBuffers = null;\n }\n _destroyBuffer(buffer) {\n const gpuBuffer = this._gpuBuffers[buffer.uid];\n gpuBuffer.destroy();\n buffer.off(\"update\", this.updateBuffer, this);\n buffer.off(\"change\", this.onBufferChange, this);\n buffer.off(\"destroy\", this.onBufferDestroy, this);\n this._gpuBuffers[buffer.uid] = null;\n }\n}\n/** @ignore */\nGpuBufferSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"buffer\"\n};\n\nexport { GpuBufferSystem };\n//# sourceMappingURL=GpuBufferSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuColorMaskSystem {\n constructor(renderer) {\n this._colorMaskCache = 15;\n this._renderer = renderer;\n }\n setMask(colorMask) {\n if (this._colorMaskCache === colorMask)\n return;\n this._colorMaskCache = colorMask;\n this._renderer.pipeline.setColorMask(colorMask);\n }\n destroy() {\n this._renderer = null;\n this._colorMaskCache = null;\n }\n}\n/** @ignore */\nGpuColorMaskSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"colorMask\"\n};\n\nexport { GpuColorMaskSystem };\n//# sourceMappingURL=GpuColorMaskSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuDeviceSystem {\n /**\n * @param {WebGPURenderer} renderer - The renderer this System works for.\n */\n constructor(renderer) {\n this._renderer = renderer;\n }\n async init(options) {\n if (this._initPromise)\n return this._initPromise;\n this._initPromise = this._createDeviceAndAdaptor(options).then((gpu) => {\n this.gpu = gpu;\n this._renderer.runners.contextChange.emit(this.gpu);\n });\n return this._initPromise;\n }\n /**\n * Handle the context change event\n * @param gpu\n */\n contextChange(gpu) {\n this._renderer.gpu = gpu;\n }\n /**\n * Helper class to create a WebGL Context\n * @param {object} options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n async _createDeviceAndAdaptor(options) {\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: options.powerPreference,\n forceFallbackAdapter: options.forceFallbackAdapter\n });\n const requiredFeatures = [\n \"texture-compression-bc\",\n \"texture-compression-astc\",\n \"texture-compression-etc2\"\n ].filter((feature) => adapter.features.has(feature));\n const device = await adapter.requestDevice({\n requiredFeatures\n });\n return { adapter, device };\n }\n destroy() {\n this.gpu = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nGpuDeviceSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"device\"\n};\n/** The default options for the GpuDeviceSystem. */\nGpuDeviceSystem.defaultOptions = {\n /**\n * {@link WebGPUOptions.powerPreference}\n * @default default\n */\n powerPreference: void 0,\n /**\n * Force the use of the fallback adapter\n * @default false\n */\n forceFallbackAdapter: false\n};\n\nexport { GpuDeviceSystem };\n//# sourceMappingURL=GpuDeviceSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuEncoderSystem {\n constructor(renderer) {\n this._boundBindGroup = /* @__PURE__ */ Object.create(null);\n this._boundVertexBuffer = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n renderStart() {\n this.commandFinished = new Promise((resolve) => {\n this._resolveCommandFinished = resolve;\n });\n this.commandEncoder = this._renderer.gpu.device.createCommandEncoder();\n }\n beginRenderPass(gpuRenderTarget) {\n this.endRenderPass();\n this._clearCache();\n this.renderPassEncoder = this.commandEncoder.beginRenderPass(gpuRenderTarget.descriptor);\n }\n endRenderPass() {\n if (this.renderPassEncoder) {\n this.renderPassEncoder.end();\n }\n this.renderPassEncoder = null;\n }\n setViewport(viewport) {\n this.renderPassEncoder.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, 0, 1);\n }\n setPipelineFromGeometryProgramAndState(geometry, program, state, topology) {\n const pipeline = this._renderer.pipeline.getPipeline(geometry, program, state, topology);\n this.setPipeline(pipeline);\n }\n setPipeline(pipeline) {\n if (this._boundPipeline === pipeline)\n return;\n this._boundPipeline = pipeline;\n this.renderPassEncoder.setPipeline(pipeline);\n }\n _setVertexBuffer(index, buffer) {\n if (this._boundVertexBuffer[index] === buffer)\n return;\n this._boundVertexBuffer[index] = buffer;\n this.renderPassEncoder.setVertexBuffer(index, this._renderer.buffer.updateBuffer(buffer));\n }\n _setIndexBuffer(buffer) {\n if (this._boundIndexBuffer === buffer)\n return;\n this._boundIndexBuffer = buffer;\n const indexFormat = buffer.data.BYTES_PER_ELEMENT === 2 ? \"uint16\" : \"uint32\";\n this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(buffer), indexFormat);\n }\n resetBindGroup(index) {\n this._boundBindGroup[index] = null;\n }\n setBindGroup(index, bindGroup, program) {\n if (this._boundBindGroup[index] === bindGroup)\n return;\n this._boundBindGroup[index] = bindGroup;\n bindGroup._touch(this._renderer.textureGC.count);\n const gpuBindGroup = this._renderer.bindGroup.getBindGroup(bindGroup, program, index);\n this.renderPassEncoder.setBindGroup(index, gpuBindGroup);\n }\n setGeometry(geometry) {\n for (const i in geometry.attributes) {\n const attribute = geometry.attributes[i];\n this._setVertexBuffer(attribute.location, attribute.buffer);\n }\n if (geometry.indexBuffer) {\n this._setIndexBuffer(geometry.indexBuffer);\n }\n }\n _setShaderBindGroups(shader, skipSync) {\n for (const i in shader.groups) {\n const bindGroup = shader.groups[i];\n if (!skipSync) {\n this._syncBindGroup(bindGroup);\n }\n this.setBindGroup(i, bindGroup, shader.gpuProgram);\n }\n }\n _syncBindGroup(bindGroup) {\n for (const j in bindGroup.resources) {\n const resource = bindGroup.resources[j];\n if (resource.isUniformGroup) {\n this._renderer.ubo.updateUniformGroup(resource);\n }\n }\n }\n draw(options) {\n const { geometry, shader, state, topology, size, start, instanceCount, skipSync } = options;\n this.setPipelineFromGeometryProgramAndState(geometry, shader.gpuProgram, state, topology);\n this.setGeometry(geometry);\n this._setShaderBindGroups(shader, skipSync);\n if (geometry.indexBuffer) {\n this.renderPassEncoder.drawIndexed(\n size || geometry.indexBuffer.data.length,\n instanceCount || geometry.instanceCount,\n start || 0\n );\n } else {\n this.renderPassEncoder.draw(size || geometry.getSize(), instanceCount || geometry.instanceCount, start || 0);\n }\n }\n finishRenderPass() {\n if (this.renderPassEncoder) {\n this.renderPassEncoder.end();\n this.renderPassEncoder = null;\n }\n }\n postrender() {\n this.finishRenderPass();\n this._gpu.device.queue.submit([this.commandEncoder.finish()]);\n this._resolveCommandFinished();\n this.commandEncoder = null;\n }\n // restores a render pass if finishRenderPass was called\n // not optimised as really used for debugging!\n // used when we want to stop drawing and log a texture..\n restoreRenderPass() {\n const descriptor = this._renderer.renderTarget.adaptor.getDescriptor(\n this._renderer.renderTarget.renderTarget,\n false,\n [0, 0, 0, 1]\n );\n this.renderPassEncoder = this.commandEncoder.beginRenderPass(descriptor);\n const boundPipeline = this._boundPipeline;\n const boundVertexBuffer = { ...this._boundVertexBuffer };\n const boundIndexBuffer = this._boundIndexBuffer;\n const boundBindGroup = { ...this._boundBindGroup };\n this._clearCache();\n const viewport = this._renderer.renderTarget.viewport;\n this.renderPassEncoder.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, 0, 1);\n this.setPipeline(boundPipeline);\n for (const i in boundVertexBuffer) {\n this._setVertexBuffer(i, boundVertexBuffer[i]);\n }\n for (const i in boundBindGroup) {\n this.setBindGroup(i, boundBindGroup[i], null);\n }\n this._setIndexBuffer(boundIndexBuffer);\n }\n _clearCache() {\n for (let i = 0; i < 16; i++) {\n this._boundBindGroup[i] = null;\n this._boundVertexBuffer[i] = null;\n }\n this._boundIndexBuffer = null;\n this._boundPipeline = null;\n }\n destroy() {\n this._renderer = null;\n this._gpu = null;\n this._boundBindGroup = null;\n this._boundVertexBuffer = null;\n this._boundIndexBuffer = null;\n this._boundPipeline = null;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n}\n/** @ignore */\nGpuEncoderSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"encoder\",\n priority: 1\n};\n\nexport { GpuEncoderSystem };\n//# sourceMappingURL=GpuEncoderSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { STENCIL_MODES } from '../shared/state/const.mjs';\n\n\"use strict\";\nclass GpuStencilSystem {\n constructor(renderer) {\n this._renderTargetStencilState = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n renderer.renderTarget.onRenderTargetChange.add(this);\n }\n onRenderTargetChange(renderTarget) {\n let stencilState = this._renderTargetStencilState[renderTarget.uid];\n if (!stencilState) {\n stencilState = this._renderTargetStencilState[renderTarget.uid] = {\n stencilMode: STENCIL_MODES.DISABLED,\n stencilReference: 0\n };\n }\n this._activeRenderTarget = renderTarget;\n this.setStencilMode(stencilState.stencilMode, stencilState.stencilReference);\n }\n setStencilMode(stencilMode, stencilReference) {\n const stencilState = this._renderTargetStencilState[this._activeRenderTarget.uid];\n stencilState.stencilMode = stencilMode;\n stencilState.stencilReference = stencilReference;\n const renderer = this._renderer;\n renderer.pipeline.setStencilMode(stencilMode);\n renderer.encoder.renderPassEncoder.setStencilReference(stencilReference);\n }\n destroy() {\n this._renderer.renderTarget.onRenderTargetChange.remove(this);\n this._renderer = null;\n this._activeRenderTarget = null;\n this._renderTargetStencilState = null;\n }\n}\n/** @ignore */\nGpuStencilSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"stencil\"\n};\n\nexport { GpuStencilSystem };\n//# sourceMappingURL=GpuStencilSystem.mjs.map\n","\"use strict\";\nclass UboBatch {\n constructor({ minUniformOffsetAlignment }) {\n this._minUniformOffsetAlignment = 256;\n this.byteIndex = 0;\n this._minUniformOffsetAlignment = minUniformOffsetAlignment;\n this.data = new Float32Array(65535);\n }\n clear() {\n this.byteIndex = 0;\n }\n addEmptyGroup(size) {\n if (size > this._minUniformOffsetAlignment / 4) {\n throw new Error(`UniformBufferBatch: array is too large: ${size * 4}`);\n }\n const start = this.byteIndex;\n let newSize = start + size * 4;\n newSize = Math.ceil(newSize / this._minUniformOffsetAlignment) * this._minUniformOffsetAlignment;\n if (newSize > this.data.length * 4) {\n throw new Error(\"UniformBufferBatch: ubo batch got too big\");\n }\n this.byteIndex = newSize;\n return start;\n }\n addGroup(array) {\n const offset = this.addEmptyGroup(array.length);\n for (let i = 0; i < array.length; i++) {\n this.data[offset / 4 + i] = array[i];\n }\n return offset;\n }\n destroy() {\n this._buffer.destroy();\n this._buffer = null;\n this.data = null;\n }\n}\n\nexport { UboBatch };\n//# sourceMappingURL=UboBatch.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Buffer } from '../shared/buffer/Buffer.mjs';\nimport { BufferResource } from '../shared/buffer/BufferResource.mjs';\nimport { BufferUsage } from '../shared/buffer/const.mjs';\nimport { UboBatch } from './buffer/UboBatch.mjs';\nimport { BindGroup } from './shader/BindGroup.mjs';\n\n\"use strict\";\nconst minUniformOffsetAlignment = 128;\nclass GpuUniformBatchPipe {\n constructor(renderer) {\n this._bindGroupHash = /* @__PURE__ */ Object.create(null);\n // number of buffers..\n this._buffers = [];\n this._bindGroups = [];\n this._bufferResources = [];\n this._renderer = renderer;\n this._batchBuffer = new UboBatch({ minUniformOffsetAlignment });\n const totalBuffers = 256 / minUniformOffsetAlignment;\n for (let i = 0; i < totalBuffers; i++) {\n let usage = BufferUsage.UNIFORM | BufferUsage.COPY_DST;\n if (i === 0)\n usage |= BufferUsage.COPY_SRC;\n this._buffers.push(new Buffer({\n data: this._batchBuffer.data,\n usage\n }));\n }\n }\n renderEnd() {\n this._uploadBindGroups();\n this._resetBindGroups();\n }\n _resetBindGroups() {\n for (const i in this._bindGroupHash) {\n this._bindGroupHash[i] = null;\n }\n this._batchBuffer.clear();\n }\n // just works for single bind groups for now\n getUniformBindGroup(group, duplicate) {\n if (!duplicate && this._bindGroupHash[group.uid]) {\n return this._bindGroupHash[group.uid];\n }\n this._renderer.ubo.ensureUniformGroup(group);\n const data = group.buffer.data;\n const offset = this._batchBuffer.addEmptyGroup(data.length);\n this._renderer.ubo.syncUniformGroup(group, this._batchBuffer.data, offset / 4);\n this._bindGroupHash[group.uid] = this._getBindGroup(offset / minUniformOffsetAlignment);\n return this._bindGroupHash[group.uid];\n }\n getUboResource(group) {\n this._renderer.ubo.updateUniformGroup(group);\n const data = group.buffer.data;\n const offset = this._batchBuffer.addGroup(data);\n return this._getBufferResource(offset / minUniformOffsetAlignment);\n }\n getArrayBindGroup(data) {\n const offset = this._batchBuffer.addGroup(data);\n return this._getBindGroup(offset / minUniformOffsetAlignment);\n }\n getArrayBufferResource(data) {\n const offset = this._batchBuffer.addGroup(data);\n const index = offset / minUniformOffsetAlignment;\n return this._getBufferResource(index);\n }\n _getBufferResource(index) {\n if (!this._bufferResources[index]) {\n const buffer = this._buffers[index % 2];\n this._bufferResources[index] = new BufferResource({\n buffer,\n offset: (index / 2 | 0) * 256,\n size: minUniformOffsetAlignment\n });\n }\n return this._bufferResources[index];\n }\n _getBindGroup(index) {\n if (!this._bindGroups[index]) {\n const bindGroup = new BindGroup({\n 0: this._getBufferResource(index)\n });\n this._bindGroups[index] = bindGroup;\n }\n return this._bindGroups[index];\n }\n _uploadBindGroups() {\n const bufferSystem = this._renderer.buffer;\n const firstBuffer = this._buffers[0];\n firstBuffer.update(this._batchBuffer.byteIndex);\n bufferSystem.updateBuffer(firstBuffer);\n const commandEncoder = this._renderer.gpu.device.createCommandEncoder();\n for (let i = 1; i < this._buffers.length; i++) {\n const buffer = this._buffers[i];\n commandEncoder.copyBufferToBuffer(\n bufferSystem.getGPUBuffer(firstBuffer),\n minUniformOffsetAlignment,\n bufferSystem.getGPUBuffer(buffer),\n 0,\n this._batchBuffer.byteIndex\n );\n }\n this._renderer.gpu.device.queue.submit([commandEncoder.finish()]);\n }\n destroy() {\n for (let i = 0; i < this._bindGroups.length; i++) {\n this._bindGroups[i].destroy();\n }\n this._bindGroups = null;\n this._bindGroupHash = null;\n for (let i = 0; i < this._buffers.length; i++) {\n this._buffers[i].destroy();\n }\n this._buffers = null;\n for (let i = 0; i < this._bufferResources.length; i++) {\n this._bufferResources[i].destroy();\n }\n this._bufferResources = null;\n this._batchBuffer.destroy();\n this._bindGroupHash = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nGpuUniformBatchPipe.extension = {\n type: [\n ExtensionType.WebGPUPipes\n ],\n name: \"uniformBatch\"\n};\n\nexport { GpuUniformBatchPipe };\n//# sourceMappingURL=GpuUniformBatchPipe.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { ensureAttributes } from '../../gl/shader/program/ensureAttributes.mjs';\nimport { STENCIL_MODES } from '../../shared/state/const.mjs';\nimport { createIdFromString } from '../../shared/utils/createIdFromString.mjs';\nimport { GpuStencilModesToPixi } from '../state/GpuStencilModesToPixi.mjs';\n\n\"use strict\";\nconst topologyStringToId = {\n \"point-list\": 0,\n \"line-list\": 1,\n \"line-strip\": 2,\n \"triangle-list\": 3,\n \"triangle-strip\": 4\n};\nfunction getGraphicsStateKey(geometryLayout, shaderKey, state, blendMode, topology) {\n return geometryLayout << 24 | shaderKey << 16 | state << 10 | blendMode << 5 | topology;\n}\nfunction getGlobalStateKey(stencilStateId, multiSampleCount, colorMask, renderTarget) {\n return colorMask << 6 | stencilStateId << 3 | renderTarget << 1 | multiSampleCount;\n}\nclass PipelineSystem {\n constructor(renderer) {\n this._moduleCache = /* @__PURE__ */ Object.create(null);\n this._bufferLayoutsCache = /* @__PURE__ */ Object.create(null);\n this._pipeCache = /* @__PURE__ */ Object.create(null);\n this._pipeStateCaches = /* @__PURE__ */ Object.create(null);\n this._colorMask = 15;\n this._multisampleCount = 1;\n this._renderer = renderer;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n this.setStencilMode(STENCIL_MODES.DISABLED);\n this._updatePipeHash();\n }\n setMultisampleCount(multisampleCount) {\n if (this._multisampleCount === multisampleCount)\n return;\n this._multisampleCount = multisampleCount;\n this._updatePipeHash();\n }\n setRenderTarget(renderTarget) {\n this._multisampleCount = renderTarget.msaaSamples;\n this._depthStencilAttachment = renderTarget.descriptor.depthStencilAttachment ? 1 : 0;\n this._updatePipeHash();\n }\n setColorMask(colorMask) {\n if (this._colorMask === colorMask)\n return;\n this._colorMask = colorMask;\n this._updatePipeHash();\n }\n setStencilMode(stencilMode) {\n if (this._stencilMode === stencilMode)\n return;\n this._stencilMode = stencilMode;\n this._stencilState = GpuStencilModesToPixi[stencilMode];\n this._updatePipeHash();\n }\n setPipeline(geometry, program, state, passEncoder) {\n const pipeline = this.getPipeline(geometry, program, state);\n passEncoder.setPipeline(pipeline);\n }\n getPipeline(geometry, program, state, topology) {\n if (!geometry._layoutKey) {\n ensureAttributes(geometry, program.attributeData);\n this._generateBufferKey(geometry);\n }\n topology = topology || geometry.topology;\n const key = getGraphicsStateKey(\n geometry._layoutKey,\n program._layoutKey,\n state.data,\n state._blendModeId,\n topologyStringToId[topology]\n );\n if (this._pipeCache[key])\n return this._pipeCache[key];\n this._pipeCache[key] = this._createPipeline(geometry, program, state, topology);\n return this._pipeCache[key];\n }\n _createPipeline(geometry, program, state, topology) {\n const device = this._gpu.device;\n const buffers = this._createVertexBufferLayouts(geometry);\n const blendModes = this._renderer.state.getColorTargets(state);\n blendModes[0].writeMask = this._stencilMode === STENCIL_MODES.RENDERING_MASK_ADD ? 0 : this._colorMask;\n const layout = this._renderer.shader.getProgramData(program).pipeline;\n const descriptor = {\n // TODO later check if its helpful to create..\n // layout,\n vertex: {\n module: this._getModule(program.vertex.source),\n entryPoint: program.vertex.entryPoint,\n // geometry..\n buffers\n },\n fragment: {\n module: this._getModule(program.fragment.source),\n entryPoint: program.fragment.entryPoint,\n targets: blendModes\n },\n primitive: {\n topology,\n cullMode: state.cullMode\n },\n layout,\n multisample: {\n count: this._multisampleCount\n },\n // depthStencil,\n label: `PIXI Pipeline`\n };\n if (this._depthStencilAttachment) {\n descriptor.depthStencil = {\n ...this._stencilState,\n format: \"depth24plus-stencil8\",\n depthWriteEnabled: state.depthTest,\n depthCompare: state.depthTest ? \"less\" : \"always\"\n };\n }\n const pipeline = device.createRenderPipeline(descriptor);\n return pipeline;\n }\n _getModule(code) {\n return this._moduleCache[code] || this._createModule(code);\n }\n _createModule(code) {\n const device = this._gpu.device;\n this._moduleCache[code] = device.createShaderModule({\n code\n });\n return this._moduleCache[code];\n }\n _generateBufferKey(geometry) {\n const keyGen = [];\n let index = 0;\n const attributeKeys = Object.keys(geometry.attributes).sort();\n for (let i = 0; i < attributeKeys.length; i++) {\n const attribute = geometry.attributes[attributeKeys[i]];\n keyGen[index++] = attribute.location;\n keyGen[index++] = attribute.offset;\n keyGen[index++] = attribute.format;\n keyGen[index++] = attribute.stride;\n }\n const stringKey = keyGen.join(\"\");\n geometry._layoutKey = createIdFromString(stringKey, \"geometry\");\n return geometry._layoutKey;\n }\n _createVertexBufferLayouts(geometry) {\n if (this._bufferLayoutsCache[geometry._layoutKey]) {\n return this._bufferLayoutsCache[geometry._layoutKey];\n }\n const vertexBuffersLayout = [];\n geometry.buffers.forEach((buffer) => {\n const bufferEntry = {\n arrayStride: 0,\n stepMode: \"vertex\",\n attributes: []\n };\n const bufferEntryAttributes = bufferEntry.attributes;\n for (const i in geometry.attributes) {\n const attribute = geometry.attributes[i];\n if (attribute.buffer === buffer) {\n bufferEntry.arrayStride = attribute.stride;\n bufferEntry.stepMode = attribute.instance ? \"instance\" : \"vertex\";\n bufferEntryAttributes.push({\n shaderLocation: attribute.location,\n offset: attribute.offset,\n format: attribute.format\n });\n }\n }\n if (bufferEntryAttributes.length) {\n vertexBuffersLayout.push(bufferEntry);\n }\n });\n this._bufferLayoutsCache[geometry._layoutKey] = vertexBuffersLayout;\n return vertexBuffersLayout;\n }\n _updatePipeHash() {\n const key = getGlobalStateKey(\n this._stencilMode,\n this._multisampleCount,\n this._colorMask,\n this._depthStencilAttachment\n );\n if (!this._pipeStateCaches[key]) {\n this._pipeStateCaches[key] = /* @__PURE__ */ Object.create(null);\n }\n this._pipeCache = this._pipeStateCaches[key];\n }\n destroy() {\n this._renderer = null;\n this._bufferLayoutsCache = null;\n }\n}\n/** @ignore */\nPipelineSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"pipeline\"\n};\n\nexport { PipelineSystem };\n//# sourceMappingURL=PipelineSystem.mjs.map\n","\"use strict\";\nclass GpuRenderTarget {\n constructor() {\n this.contexts = [];\n this.msaaTextures = [];\n this.msaaSamples = 1;\n }\n}\n\nexport { GpuRenderTarget };\n//# sourceMappingURL=GpuRenderTarget.mjs.map\n","import { CLEAR } from '../../gl/const.mjs';\nimport { CanvasSource } from '../../shared/texture/sources/CanvasSource.mjs';\nimport { TextureSource } from '../../shared/texture/sources/TextureSource.mjs';\nimport { GpuRenderTarget } from './GpuRenderTarget.mjs';\n\n\"use strict\";\nclass GpuRenderTargetAdaptor {\n init(renderer, renderTargetSystem) {\n this._renderer = renderer;\n this._renderTargetSystem = renderTargetSystem;\n }\n copyToTexture(sourceRenderSurfaceTexture, destinationTexture, originSrc, size, originDest) {\n const renderer = this._renderer;\n const baseGpuTexture = this._getGpuColorTexture(\n sourceRenderSurfaceTexture\n );\n const backGpuTexture = renderer.texture.getGpuSource(\n destinationTexture.source\n );\n renderer.encoder.commandEncoder.copyTextureToTexture(\n {\n texture: baseGpuTexture,\n origin: originSrc\n },\n {\n texture: backGpuTexture,\n origin: originDest\n },\n size\n );\n return destinationTexture;\n }\n startRenderPass(renderTarget, clear = true, clearColor, viewport) {\n const renderTargetSystem = this._renderTargetSystem;\n const gpuRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n const descriptor = this.getDescriptor(renderTarget, clear, clearColor);\n gpuRenderTarget.descriptor = descriptor;\n this._renderer.pipeline.setRenderTarget(gpuRenderTarget);\n this._renderer.encoder.beginRenderPass(gpuRenderTarget);\n this._renderer.encoder.setViewport(viewport);\n }\n finishRenderPass() {\n this._renderer.encoder.endRenderPass();\n }\n /**\n * returns the gpu texture for the first color texture in the render target\n * mainly used by the filter manager to get copy the texture for blending\n * @param renderTarget\n * @returns a gpu texture\n */\n _getGpuColorTexture(renderTarget) {\n const gpuRenderTarget = this._renderTargetSystem.getGpuRenderTarget(renderTarget);\n if (gpuRenderTarget.contexts[0]) {\n return gpuRenderTarget.contexts[0].getCurrentTexture();\n }\n return this._renderer.texture.getGpuSource(\n renderTarget.colorTextures[0].source\n );\n }\n getDescriptor(renderTarget, clear, clearValue) {\n if (typeof clear === \"boolean\") {\n clear = clear ? CLEAR.ALL : CLEAR.NONE;\n }\n const renderTargetSystem = this._renderTargetSystem;\n const gpuRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n const colorAttachments = renderTarget.colorTextures.map(\n (texture, i) => {\n const context = gpuRenderTarget.contexts[i];\n let view;\n let resolveTarget;\n if (context) {\n const currentTexture = context.getCurrentTexture();\n const canvasTextureView = currentTexture.createView();\n view = canvasTextureView;\n } else {\n view = this._renderer.texture.getGpuSource(texture).createView({\n mipLevelCount: 1\n });\n }\n if (gpuRenderTarget.msaaTextures[i]) {\n resolveTarget = view;\n view = this._renderer.texture.getTextureView(\n gpuRenderTarget.msaaTextures[i]\n );\n }\n const loadOp = clear & CLEAR.COLOR ? \"clear\" : \"load\";\n clearValue ?? (clearValue = renderTargetSystem.defaultClearColor);\n return {\n view,\n resolveTarget,\n clearValue,\n storeOp: \"store\",\n loadOp\n };\n }\n );\n let depthStencilAttachment;\n if ((renderTarget.stencil || renderTarget.depth) && !renderTarget.depthStencilTexture) {\n renderTarget.ensureDepthStencilTexture();\n renderTarget.depthStencilTexture.source.sampleCount = gpuRenderTarget.msaa ? 4 : 1;\n }\n if (renderTarget.depthStencilTexture) {\n const stencilLoadOp = clear & CLEAR.STENCIL ? \"clear\" : \"load\";\n const depthLoadOp = clear & CLEAR.DEPTH ? \"clear\" : \"load\";\n depthStencilAttachment = {\n view: this._renderer.texture.getGpuSource(renderTarget.depthStencilTexture.source).createView(),\n stencilStoreOp: \"store\",\n stencilLoadOp,\n depthClearValue: 1,\n depthLoadOp,\n depthStoreOp: \"store\"\n };\n }\n const descriptor = {\n colorAttachments,\n depthStencilAttachment\n };\n return descriptor;\n }\n clear(renderTarget, clear = true, clearColor, viewport) {\n if (!clear)\n return;\n const { gpu, encoder } = this._renderer;\n const device = gpu.device;\n const standAlone = encoder.commandEncoder === null;\n if (standAlone) {\n const commandEncoder = device.createCommandEncoder();\n const renderPassDescriptor = this.getDescriptor(renderTarget, clear, clearColor);\n const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);\n passEncoder.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, 0, 1);\n passEncoder.end();\n const gpuCommands = commandEncoder.finish();\n device.queue.submit([gpuCommands]);\n } else {\n this.startRenderPass(renderTarget, clear, clearColor, viewport);\n }\n }\n initGpuRenderTarget(renderTarget) {\n renderTarget.isRoot = true;\n const gpuRenderTarget = new GpuRenderTarget();\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n if (CanvasSource.test(colorTexture.resource)) {\n const context = colorTexture.resource.getContext(\n \"webgpu\"\n );\n const alphaMode = colorTexture.transparent ? \"premultiplied\" : \"opaque\";\n try {\n context.configure({\n device: this._renderer.gpu.device,\n // eslint-disable-next-line max-len\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,\n format: \"bgra8unorm\",\n alphaMode\n });\n } catch (e) {\n console.error(e);\n }\n gpuRenderTarget.contexts[i] = context;\n }\n gpuRenderTarget.msaa = colorTexture.source.antialias;\n if (colorTexture.source.antialias) {\n const msaaTexture = new TextureSource({\n width: 0,\n height: 0,\n sampleCount: 4\n });\n gpuRenderTarget.msaaTextures[i] = msaaTexture;\n }\n });\n if (gpuRenderTarget.msaa) {\n gpuRenderTarget.msaaSamples = 4;\n if (renderTarget.depthStencilTexture) {\n renderTarget.depthStencilTexture.source.sampleCount = 4;\n }\n }\n return gpuRenderTarget;\n }\n destroyGpuRenderTarget(gpuRenderTarget) {\n gpuRenderTarget.contexts.forEach((context) => {\n context.unconfigure();\n });\n gpuRenderTarget.msaaTextures.forEach((texture) => {\n texture.destroy();\n });\n gpuRenderTarget.msaaTextures.length = 0;\n gpuRenderTarget.contexts.length = 0;\n }\n ensureDepthStencilTexture(renderTarget) {\n const gpuRenderTarget = this._renderTargetSystem.getGpuRenderTarget(renderTarget);\n if (renderTarget.depthStencilTexture && gpuRenderTarget.msaa) {\n renderTarget.depthStencilTexture.source.sampleCount = 4;\n }\n }\n resizeGpuRenderTarget(renderTarget) {\n const gpuRenderTarget = this._renderTargetSystem.getGpuRenderTarget(renderTarget);\n gpuRenderTarget.width = renderTarget.width;\n gpuRenderTarget.height = renderTarget.height;\n if (gpuRenderTarget.msaa) {\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n const msaaTexture = gpuRenderTarget.msaaTextures[i];\n msaaTexture?.resize(\n colorTexture.source.width,\n colorTexture.source.height,\n colorTexture.source._resolution\n );\n });\n }\n }\n}\n\nexport { GpuRenderTargetAdaptor };\n//# sourceMappingURL=GpuRenderTargetAdaptor.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { RenderTargetSystem } from '../../shared/renderTarget/RenderTargetSystem.mjs';\nimport { GpuRenderTargetAdaptor } from './GpuRenderTargetAdaptor.mjs';\n\n\"use strict\";\nclass GpuRenderTargetSystem extends RenderTargetSystem {\n constructor(renderer) {\n super(renderer);\n this.adaptor = new GpuRenderTargetAdaptor();\n this.adaptor.init(renderer, this);\n }\n}\n/** @ignore */\nGpuRenderTargetSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"renderTarget\"\n};\n\nexport { GpuRenderTargetSystem };\n//# sourceMappingURL=GpuRenderTargetSystem.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuShaderSystem {\n constructor() {\n this._gpuProgramData = /* @__PURE__ */ Object.create(null);\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n getProgramData(program) {\n return this._gpuProgramData[program._layoutKey] || this._createGPUProgramData(program);\n }\n _createGPUProgramData(program) {\n const device = this._gpu.device;\n const bindGroups = program.gpuLayout.map((group) => device.createBindGroupLayout({ entries: group }));\n const pipelineLayoutDesc = { bindGroupLayouts: bindGroups };\n this._gpuProgramData[program._layoutKey] = {\n bindGroups,\n pipeline: device.createPipelineLayout(pipelineLayoutDesc)\n };\n return this._gpuProgramData[program._layoutKey];\n }\n destroy() {\n this._gpu = null;\n this._gpuProgramData = null;\n }\n}\n/** @ignore */\nGpuShaderSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"shader\"\n};\n\nexport { GpuShaderSystem };\n//# sourceMappingURL=GpuShaderSystem.mjs.map\n","\"use strict\";\nconst GpuBlendModesToPixi = {};\nGpuBlendModesToPixi.normal = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.add = {\n alpha: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.multiply = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"dst\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.screen = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.overlay = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.none = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"zero\",\n dstFactor: \"zero\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi[\"normal-npm\"] = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi[\"add-npm\"] = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi[\"screen-npm\"] = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.erase = {\n alpha: {\n srcFactor: \"zero\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"zero\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\n\nexport { GpuBlendModesToPixi };\n//# sourceMappingURL=GpuBlendModesToPixi.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { State } from '../../shared/state/State.mjs';\nimport { GpuBlendModesToPixi } from './GpuBlendModesToPixi.mjs';\n\n\"use strict\";\nclass GpuStateSystem {\n constructor() {\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n contextChange(gpu) {\n this.gpu = gpu;\n }\n /**\n * Gets the blend mode data for the current state\n * @param state - The state to get the blend mode from\n */\n getColorTargets(state) {\n const blend = GpuBlendModesToPixi[state.blendMode] || GpuBlendModesToPixi.normal;\n return [\n {\n format: \"bgra8unorm\",\n writeMask: 0,\n blend\n }\n ];\n }\n destroy() {\n this.gpu = null;\n }\n}\n/** @ignore */\nGpuStateSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"state\"\n};\n\nexport { GpuStateSystem };\n//# sourceMappingURL=GpuStateSystem.mjs.map\n","\"use strict\";\nconst gpuUploadBufferImageResource = {\n type: \"image\",\n upload(source, gpuTexture, gpu) {\n const resource = source.resource;\n const total = (source.pixelWidth | 0) * (source.pixelHeight | 0);\n const bytesPerPixel = resource.byteLength / total;\n gpu.device.queue.writeTexture(\n { texture: gpuTexture },\n resource,\n {\n offset: 0,\n rowsPerImage: source.pixelHeight,\n bytesPerRow: source.pixelHeight * bytesPerPixel\n },\n {\n width: source.pixelWidth,\n height: source.pixelHeight,\n depthOrArrayLayers: 1\n }\n );\n }\n};\n\nexport { gpuUploadBufferImageResource };\n//# sourceMappingURL=gpuUploadBufferImageResource.mjs.map\n","\"use strict\";\nconst blockDataMap = {\n \"bc1-rgba-unorm\": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n \"bc2-rgba-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"bc3-rgba-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"bc7-rgba-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"etc1-rgb-unorm\": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n \"etc2-rgba8unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"astc-4x4-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 }\n};\nconst defaultBlockData = { blockBytes: 4, blockWidth: 1, blockHeight: 1 };\nconst gpuUploadCompressedTextureResource = {\n type: \"compressed\",\n upload(source, gpuTexture, gpu) {\n let mipWidth = source.pixelWidth;\n let mipHeight = source.pixelHeight;\n const blockData = blockDataMap[source.format] || defaultBlockData;\n for (let i = 0; i < source.resource.length; i++) {\n const levelBuffer = source.resource[i];\n const bytesPerRow = Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockBytes;\n gpu.device.queue.writeTexture(\n {\n texture: gpuTexture,\n mipLevel: i\n },\n levelBuffer,\n {\n offset: 0,\n bytesPerRow\n },\n {\n width: Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockWidth,\n height: Math.ceil(mipHeight / blockData.blockHeight) * blockData.blockHeight,\n depthOrArrayLayers: 1\n }\n );\n mipWidth = Math.max(mipWidth >> 1, 1);\n mipHeight = Math.max(mipHeight >> 1, 1);\n }\n }\n};\n\nexport { blockDataMap, gpuUploadCompressedTextureResource };\n//# sourceMappingURL=gpuUploadCompressedTextureResource.mjs.map\n","\"use strict\";\nconst gpuUploadImageResource = {\n type: \"image\",\n upload(source, gpuTexture, gpu) {\n const resource = source.resource;\n if (!resource)\n return;\n const width = Math.min(gpuTexture.width, source.resourceWidth || source.pixelWidth);\n const height = Math.min(gpuTexture.height, source.resourceHeight || source.pixelHeight);\n const premultipliedAlpha = source.alphaMode === \"premultiply-alpha-on-upload\";\n gpu.device.queue.copyExternalImageToTexture(\n { source: resource },\n { texture: gpuTexture, premultipliedAlpha },\n {\n width,\n height\n }\n );\n }\n};\n\nexport { gpuUploadImageResource };\n//# sourceMappingURL=gpuUploadImageSource.mjs.map\n","import { gpuUploadImageResource } from './gpuUploadImageSource.mjs';\n\n\"use strict\";\nconst gpuUploadVideoResource = {\n type: \"video\",\n upload(source, gpuTexture, gpu) {\n gpuUploadImageResource.upload(source, gpuTexture, gpu);\n }\n};\n\nexport { gpuUploadVideoResource };\n//# sourceMappingURL=gpuUploadVideoSource.mjs.map\n","\"use strict\";\nclass GpuMipmapGenerator {\n constructor(device) {\n this.device = device;\n this.sampler = device.createSampler({ minFilter: \"linear\" });\n this.pipelines = {};\n }\n _getMipmapPipeline(format) {\n let pipeline = this.pipelines[format];\n if (!pipeline) {\n if (!this.mipmapShaderModule) {\n this.mipmapShaderModule = this.device.createShaderModule({\n code: (\n /* wgsl */\n `\n var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));\n\n struct VertexOutput {\n @builtin(position) position : vec4<f32>,\n @location(0) texCoord : vec2<f32>,\n };\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {\n var output : VertexOutput;\n output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);\n return output;\n }\n\n @group(0) @binding(0) var imgSampler : sampler;\n @group(0) @binding(1) var img : texture_2d<f32>;\n\n @fragment\n fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {\n return textureSample(img, imgSampler, texCoord);\n }\n `\n )\n });\n }\n pipeline = this.device.createRenderPipeline({\n layout: \"auto\",\n vertex: {\n module: this.mipmapShaderModule,\n entryPoint: \"vertexMain\"\n },\n fragment: {\n module: this.mipmapShaderModule,\n entryPoint: \"fragmentMain\",\n targets: [{ format }]\n }\n });\n this.pipelines[format] = pipeline;\n }\n return pipeline;\n }\n /**\n * Generates mipmaps for the given GPUTexture from the data in level 0.\n * @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.\n * @returns {module:External.GPUTexture} - The originally passed texture\n */\n generateMipmap(texture) {\n const pipeline = this._getMipmapPipeline(texture.format);\n if (texture.dimension === \"3d\" || texture.dimension === \"1d\") {\n throw new Error(\"Generating mipmaps for non-2d textures is currently unsupported!\");\n }\n let mipTexture = texture;\n const arrayLayerCount = texture.depthOrArrayLayers || 1;\n const renderToSource = texture.usage & GPUTextureUsage.RENDER_ATTACHMENT;\n if (!renderToSource) {\n const mipTextureDescriptor = {\n size: {\n width: Math.ceil(texture.width / 2),\n height: Math.ceil(texture.height / 2),\n depthOrArrayLayers: arrayLayerCount\n },\n format: texture.format,\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,\n mipLevelCount: texture.mipLevelCount - 1\n };\n mipTexture = this.device.createTexture(mipTextureDescriptor);\n }\n const commandEncoder = this.device.createCommandEncoder({});\n const bindGroupLayout = pipeline.getBindGroupLayout(0);\n for (let arrayLayer = 0; arrayLayer < arrayLayerCount; ++arrayLayer) {\n let srcView = texture.createView({\n baseMipLevel: 0,\n mipLevelCount: 1,\n dimension: \"2d\",\n baseArrayLayer: arrayLayer,\n arrayLayerCount: 1\n });\n let dstMipLevel = renderToSource ? 1 : 0;\n for (let i = 1; i < texture.mipLevelCount; ++i) {\n const dstView = mipTexture.createView({\n baseMipLevel: dstMipLevel++,\n mipLevelCount: 1,\n dimension: \"2d\",\n baseArrayLayer: arrayLayer,\n arrayLayerCount: 1\n });\n const passEncoder = commandEncoder.beginRenderPass({\n colorAttachments: [{\n view: dstView,\n storeOp: \"store\",\n loadOp: \"clear\",\n clearValue: { r: 0, g: 0, b: 0, a: 0 }\n }]\n });\n const bindGroup = this.device.createBindGroup({\n layout: bindGroupLayout,\n entries: [{\n binding: 0,\n resource: this.sampler\n }, {\n binding: 1,\n resource: srcView\n }]\n });\n passEncoder.setPipeline(pipeline);\n passEncoder.setBindGroup(0, bindGroup);\n passEncoder.draw(3, 1, 0, 0);\n passEncoder.end();\n srcView = dstView;\n }\n }\n if (!renderToSource) {\n const mipLevelSize = {\n width: Math.ceil(texture.width / 2),\n height: Math.ceil(texture.height / 2),\n depthOrArrayLayers: arrayLayerCount\n };\n for (let i = 1; i < texture.mipLevelCount; ++i) {\n commandEncoder.copyTextureToTexture({\n texture: mipTexture,\n mipLevel: i - 1\n }, {\n texture,\n mipLevel: i\n }, mipLevelSize);\n mipLevelSize.width = Math.ceil(mipLevelSize.width / 2);\n mipLevelSize.height = Math.ceil(mipLevelSize.height / 2);\n }\n }\n this.device.queue.submit([commandEncoder.finish()]);\n if (!renderToSource) {\n mipTexture.destroy();\n }\n return texture;\n }\n}\n\nexport { GpuMipmapGenerator };\n//# sourceMappingURL=GpuMipmapGenerator.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { CanvasPool } from '../../shared/texture/CanvasPool.mjs';\nimport { BindGroup } from '../shader/BindGroup.mjs';\nimport { gpuUploadBufferImageResource } from './uploaders/gpuUploadBufferImageResource.mjs';\nimport { gpuUploadCompressedTextureResource, blockDataMap } from './uploaders/gpuUploadCompressedTextureResource.mjs';\nimport { gpuUploadImageResource } from './uploaders/gpuUploadImageSource.mjs';\nimport { gpuUploadVideoResource } from './uploaders/gpuUploadVideoSource.mjs';\nimport { GpuMipmapGenerator } from './utils/GpuMipmapGenerator.mjs';\n\n\"use strict\";\nclass GpuTextureSystem {\n constructor(renderer) {\n this.managedTextures = [];\n this._gpuSources = /* @__PURE__ */ Object.create(null);\n this._gpuSamplers = /* @__PURE__ */ Object.create(null);\n this._bindGroupHash = /* @__PURE__ */ Object.create(null);\n this._textureViewHash = /* @__PURE__ */ Object.create(null);\n this._uploads = {\n image: gpuUploadImageResource,\n buffer: gpuUploadBufferImageResource,\n video: gpuUploadVideoResource,\n compressed: gpuUploadCompressedTextureResource\n };\n this._renderer = renderer;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n initSource(source) {\n if (source.autoGenerateMipmaps) {\n const biggestDimension = Math.max(source.pixelWidth, source.pixelHeight);\n source.mipLevelCount = Math.floor(Math.log2(biggestDimension)) + 1;\n }\n let usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;\n if (source.uploadMethodId !== \"compressed\") {\n usage |= GPUTextureUsage.RENDER_ATTACHMENT;\n usage |= GPUTextureUsage.COPY_SRC;\n }\n const blockData = blockDataMap[source.format] || { blockBytes: 4, blockWidth: 1, blockHeight: 1 };\n const width = Math.ceil(source.pixelWidth / blockData.blockWidth) * blockData.blockWidth;\n const height = Math.ceil(source.pixelHeight / blockData.blockHeight) * blockData.blockHeight;\n const textureDescriptor = {\n label: source.label,\n size: { width, height },\n format: source.format,\n sampleCount: source.sampleCount,\n mipLevelCount: source.mipLevelCount,\n dimension: source.dimension,\n usage\n };\n const gpuTexture = this._gpu.device.createTexture(textureDescriptor);\n this._gpuSources[source.uid] = gpuTexture;\n if (!this.managedTextures.includes(source)) {\n source.on(\"update\", this.onSourceUpdate, this);\n source.on(\"resize\", this.onSourceResize, this);\n source.on(\"destroy\", this.onSourceDestroy, this);\n source.on(\"unload\", this.onSourceUnload, this);\n source.on(\"updateMipmaps\", this.onUpdateMipmaps, this);\n this.managedTextures.push(source);\n }\n this.onSourceUpdate(source);\n return gpuTexture;\n }\n onSourceUpdate(source) {\n const gpuTexture = this.getGpuSource(source);\n if (!gpuTexture)\n return;\n if (this._uploads[source.uploadMethodId]) {\n this._uploads[source.uploadMethodId].upload(source, gpuTexture, this._gpu);\n }\n if (source.autoGenerateMipmaps && source.mipLevelCount > 1) {\n this.onUpdateMipmaps(source);\n }\n }\n onSourceUnload(source) {\n const gpuTexture = this._gpuSources[source.uid];\n if (gpuTexture) {\n this._gpuSources[source.uid] = null;\n gpuTexture.destroy();\n }\n }\n onUpdateMipmaps(source) {\n if (!this._mipmapGenerator) {\n this._mipmapGenerator = new GpuMipmapGenerator(this._gpu.device);\n }\n const gpuTexture = this.getGpuSource(source);\n this._mipmapGenerator.generateMipmap(gpuTexture);\n }\n onSourceDestroy(source) {\n source.off(\"update\", this.onSourceUpdate, this);\n source.off(\"unload\", this.onSourceUnload, this);\n source.off(\"destroy\", this.onSourceDestroy, this);\n source.off(\"resize\", this.onSourceResize, this);\n source.off(\"updateMipmaps\", this.onUpdateMipmaps, this);\n this.managedTextures.splice(this.managedTextures.indexOf(source), 1);\n this.onSourceUnload(source);\n }\n onSourceResize(source) {\n const gpuTexture = this._gpuSources[source.uid];\n if (!gpuTexture) {\n this.initSource(source);\n } else if (gpuTexture.width !== source.pixelWidth || gpuTexture.height !== source.pixelHeight) {\n this._textureViewHash[source.uid] = null;\n this._bindGroupHash[source.uid] = null;\n this.onSourceUnload(source);\n this.initSource(source);\n }\n }\n _initSampler(sampler) {\n this._gpuSamplers[sampler._resourceId] = this._gpu.device.createSampler(sampler);\n return this._gpuSamplers[sampler._resourceId];\n }\n getGpuSampler(sampler) {\n return this._gpuSamplers[sampler._resourceId] || this._initSampler(sampler);\n }\n getGpuSource(source) {\n return this._gpuSources[source.uid] || this.initSource(source);\n }\n getTextureBindGroup(texture) {\n return this._bindGroupHash[texture.uid] ?? this._createTextureBindGroup(texture);\n }\n _createTextureBindGroup(texture) {\n const source = texture.source;\n const bindGroupId = source.uid;\n this._bindGroupHash[bindGroupId] = new BindGroup({\n 0: source,\n 1: source.style\n });\n return this._bindGroupHash[bindGroupId];\n }\n getTextureView(texture) {\n const source = texture.source;\n return this._textureViewHash[source.uid] ?? this._createTextureView(source);\n }\n _createTextureView(texture) {\n this._textureViewHash[texture.uid] = this.getGpuSource(texture).createView();\n return this._textureViewHash[texture.uid];\n }\n generateCanvas(texture) {\n const renderer = this._renderer;\n const commandEncoder = renderer.gpu.device.createCommandEncoder();\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = texture.source.pixelWidth;\n canvas.height = texture.source.pixelHeight;\n const context = canvas.getContext(\"webgpu\");\n context.configure({\n device: renderer.gpu.device,\n // eslint-disable-next-line max-len\n usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,\n format: navigator.gpu.getPreferredCanvasFormat(),\n alphaMode: \"premultiplied\"\n });\n commandEncoder.copyTextureToTexture({\n texture: renderer.texture.getGpuSource(texture.source),\n origin: {\n x: 0,\n y: 0\n }\n }, {\n texture: context.getCurrentTexture()\n }, {\n width: canvas.width,\n height: canvas.height\n });\n renderer.gpu.device.queue.submit([commandEncoder.finish()]);\n return canvas;\n }\n getPixels(texture) {\n const webGPUCanvas = this.generateCanvas(texture);\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(webGPUCanvas.width, webGPUCanvas.height);\n const context = canvasAndContext.context;\n context.drawImage(webGPUCanvas, 0, 0);\n const { width, height } = webGPUCanvas;\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = new Uint8ClampedArray(imageData.data.buffer);\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n return { pixels, width, height };\n }\n destroy() {\n this.managedTextures.slice().forEach((source) => this.onSourceDestroy(source));\n this.managedTextures = null;\n for (const k of Object.keys(this._bindGroupHash)) {\n const key = Number(k);\n const bindGroup = this._bindGroupHash[key];\n bindGroup?.destroy();\n this._bindGroupHash[key] = null;\n }\n this._gpu = null;\n this._mipmapGenerator = null;\n this._gpuSources = null;\n this._bindGroupHash = null;\n this._textureViewHash = null;\n this._gpuSamplers = null;\n }\n}\n/** @ignore */\nGpuTextureSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"texture\"\n};\n\nexport { GpuTextureSystem };\n//# sourceMappingURL=GpuTextureSystem.mjs.map\n","import { extensions, ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { GpuGraphicsAdaptor } from '../../../scene/graphics/gpu/GpuGraphicsAdaptor.mjs';\nimport { GpuMeshAdapter } from '../../../scene/mesh/gpu/GpuMeshAdapter.mjs';\nimport { GpuBatchAdaptor } from '../../batcher/gpu/GpuBatchAdaptor.mjs';\nimport { AbstractRenderer } from '../shared/system/AbstractRenderer.mjs';\nimport { SharedSystems, SharedRenderPipes } from '../shared/system/SharedSystems.mjs';\nimport { RendererType } from '../types.mjs';\nimport { BindGroupSystem } from './BindGroupSystem.mjs';\nimport { GpuBufferSystem } from './buffer/GpuBufferSystem.mjs';\nimport { GpuColorMaskSystem } from './GpuColorMaskSystem.mjs';\nimport { GpuDeviceSystem } from './GpuDeviceSystem.mjs';\nimport { GpuEncoderSystem } from './GpuEncoderSystem.mjs';\nimport { GpuStencilSystem } from './GpuStencilSystem.mjs';\nimport { GpuUboSystem } from './GpuUboSystem.mjs';\nimport { GpuUniformBatchPipe } from './GpuUniformBatchPipe.mjs';\nimport { PipelineSystem } from './pipeline/PipelineSystem.mjs';\nimport { GpuRenderTargetSystem } from './renderTarget/GpuRenderTargetSystem.mjs';\nimport { GpuShaderSystem } from './shader/GpuShaderSystem.mjs';\nimport { GpuStateSystem } from './state/GpuStateSystem.mjs';\nimport { GpuTextureSystem } from './texture/GpuTextureSystem.mjs';\n\n\"use strict\";\nconst DefaultWebGPUSystems = [\n ...SharedSystems,\n GpuUboSystem,\n GpuEncoderSystem,\n GpuDeviceSystem,\n GpuBufferSystem,\n GpuTextureSystem,\n GpuRenderTargetSystem,\n GpuShaderSystem,\n GpuStateSystem,\n PipelineSystem,\n GpuColorMaskSystem,\n GpuStencilSystem,\n BindGroupSystem\n];\nconst DefaultWebGPUPipes = [...SharedRenderPipes, GpuUniformBatchPipe];\nconst DefaultWebGPUAdapters = [GpuBatchAdaptor, GpuMeshAdapter, GpuGraphicsAdaptor];\nconst systems = [];\nconst renderPipes = [];\nconst renderPipeAdaptors = [];\nextensions.handleByNamedList(ExtensionType.WebGPUSystem, systems);\nextensions.handleByNamedList(ExtensionType.WebGPUPipes, renderPipes);\nextensions.handleByNamedList(ExtensionType.WebGPUPipesAdaptor, renderPipeAdaptors);\nextensions.add(...DefaultWebGPUSystems, ...DefaultWebGPUPipes, ...DefaultWebGPUAdapters);\nclass WebGPURenderer extends AbstractRenderer {\n constructor() {\n const systemConfig = {\n name: \"webgpu\",\n type: RendererType.WEBGPU,\n systems,\n renderPipes,\n renderPipeAdaptors\n };\n super(systemConfig);\n }\n}\n\nexport { WebGPURenderer };\n//# sourceMappingURL=WebGPURenderer.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { nextPow2 } from '../../../../maths/misc/pow2.mjs';\n\n\"use strict\";\nclass CanvasPoolClass {\n constructor(canvasOptions) {\n this._canvasPool = /* @__PURE__ */ Object.create(null);\n this.canvasOptions = canvasOptions || {};\n this.enableFullScreen = false;\n }\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param pixelWidth - Width of texture in pixels.\n * @param pixelHeight - Height of texture in pixels.\n */\n _createCanvasAndContext(pixelWidth, pixelHeight) {\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = pixelWidth;\n canvas.height = pixelHeight;\n const context = canvas.getContext(\"2d\");\n return { canvas, context };\n }\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @returns The new render texture.\n */\n getOptimalCanvasAndContext(minWidth, minHeight, resolution = 1) {\n minWidth = Math.ceil(minWidth * resolution - 1e-6);\n minHeight = Math.ceil(minHeight * resolution - 1e-6);\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n const key = (minWidth << 17) + (minHeight << 1);\n if (!this._canvasPool[key]) {\n this._canvasPool[key] = [];\n }\n let canvasAndContext = this._canvasPool[key].pop();\n if (!canvasAndContext) {\n canvasAndContext = this._createCanvasAndContext(minWidth, minHeight);\n }\n return canvasAndContext;\n }\n /**\n * Place a render texture back into the pool.\n * @param canvasAndContext\n */\n returnCanvasAndContext(canvasAndContext) {\n const { width, height } = canvasAndContext.canvas;\n const key = (width << 17) + (height << 1);\n this._canvasPool[key].push(canvasAndContext);\n }\n clear() {\n this._canvasPool = {};\n }\n}\nconst CanvasPool = new CanvasPoolClass();\n\nexport { CanvasPool, CanvasPoolClass };\n//# sourceMappingURL=CanvasPool.mjs.map\n"],"names":["Float32Array","s","r","G","Object","navigator","Promise","Error","Math","i","GPUTextureUsage","e","console","a","Uint8ClampedArray","Number"],"mappings":"0QAaA,OAAM,EACJ,MAAO,CACL,IAAM,EAAgB,IAAI,GAAY,CAAC,CACrC,iBAAkB,CAAE,MAAO,IAAI,GAAM,CAAI,KAAM,aAAc,EAC7D,OAAQ,CAAE,MAAO,IAAIA,aAAa,CAAC,EAAG,EAAG,EAAG,EAAE,EAAG,KAAM,WAAY,EACnE,OAAQ,CAAE,MAAO,EAAG,KAAM,KAAM,CAClC,GACM,EAAa,QAA4B,CAC7C,KAAM,WACN,KAAM,CACJ,GAAQ,CACR,QAAwB,GAAY,EACpC,IAAqB,CACrB,GAAc,CACf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AC,CAAE,CAC9D,EAAWM,KAAK,IAAI,CAAC,EAAWN,EAAa,MAC7C,EAAYM,KAAK,IAAI,CAAC,EAAYN,EAAa,MAC/C,EAAW,SAAS,GACpB,EAAY,SAAS,GACrB,IAAM,EAAM,AAAC,IAAY,EAAC,EAAM,IAAa,EACzC,AAAC,KAAI,CAAC,WAAW,CAAC,EAAI,EACxB,KAAI,CAAC,WAAW,CAAC,EAAI,CAAG,EAAE,AAAD,EAE3B,IAAI,EAAmB,IAAI,CAAC,WAAW,CAAC,EAAI,CAAC,GAAG,GAIhD,OAHI,AAAC,GACH,GAAmB,IAAI,CAAC,uBAAuB,CAAC,EAAU,EAAS,EAE9D,CACT,CAKA,uBAAuB,CAAgB,CAAE,CACvC,GAAM,CAAE,OAAK,CAAE,QAAM,CAAE,CAAG,EAAiB,MAAM,CAEjD,IAAI,CAAC,WAAW,CADJ,AAAC,IAAS,EAAC,EAAM,IAAU,GAClB,CAAC,IAAI,CAAC,EAC7B,CACA,OAAQ,CACN,IAAI,CAAC,WAAW,CAAG,CAAC,CACtB,CACF,C"}
@@ -0,0 +1,30 @@
1
+ "use strict";(self.webpackChunkplayground=self.webpackChunkplayground||[]).push([["364"],{17893:function(e,t,r){r.d(t,{e:()=>i,r:()=>n});let n={name:"texture-bit",vertex:{header:`
2
+
3
+ struct TextureUniforms {
4
+ uTextureMatrix:mat3x3<f32>,
5
+ }
6
+
7
+ @group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
8
+ `,main:`
9
+ uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
10
+ `},fragment:{header:`
11
+ @group(2) @binding(0) var uTexture: texture_2d<f32>;
12
+ @group(2) @binding(1) var uSampler: sampler;
13
+
14
+
15
+ `,main:`
16
+ outColor = textureSample(uTexture, uSampler, vUV);
17
+ `}},i={name:"texture-bit",vertex:{header:`
18
+ uniform mat3 uTextureMatrix;
19
+ `,main:`
20
+ uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
21
+ `},fragment:{header:`
22
+ uniform sampler2D uTexture;
23
+
24
+
25
+ `,main:`
26
+ outColor = texture(uTexture, vUV);
27
+ `}}},532:function(e,t,r){r.d(t,{B:()=>a});var n=r(92245),i=r(12713);function a(e,t){for(let r in e.attributes){let i=e.attributes[r],a=t[r];a?(i.location??(i.location=a.location),i.format??(i.format=a.format),i.offset??(i.offset=a.offset),i.instance??(i.instance=a.instance)):(0,n.Z)(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}!function(e){let{buffers:t,attributes:r}=e,n={},a={};for(let e in t){let r=t[e];n[r.uid]=0,a[r.uid]=0}for(let e in r){let t=r[e];n[t.buffer.uid]+=(0,i.v)(t.format).stride}for(let e in r){let t=r[e];t.stride??(t.stride=n[t.buffer.uid]),t.start??(t.start=a[t.buffer.uid]),a[t.buffer.uid]+=(0,i.v)(t.format).stride}}(e)}},18228:function(e,t,r){r.d(t,{L:()=>i});var n=r(22246);let i=[];i[n.D.NONE]=void 0,i[n.D.DISABLED]={stencilWriteMask:0,stencilReadMask:0},i[n.D.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},i[n.D.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},i[n.D.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}}},72310:function(e,t,r){r.d(t,{l:()=>h});var n=r(30044),i=r(45266),a=r(81599),o=r(90851),s=r(11300),l=r(62815),d=r(41277),u=r(72787),c=r(71783);class h{constructor(e){this.rootViewPort=new i.A,this.viewport=new i.A,this.onRenderTargetChange=new o.P("onRenderTargetChange"),this.projectionMatrix=new n.y,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:n}){this._renderTargetStack.length=0,this.push(e,t,r,n),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=function(e){let t=e.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}(this.rootRenderTarget)}bind(e,t=!0,r,n){let i=this.getRenderTarget(e),a=this.renderTarget!==i;this.renderTarget=i,this.renderSurface=e;let o=this.getGpuRenderTarget(i);(i.pixelWidth!==o.width||i.pixelHeight!==o.height)&&(this.adaptor.resizeGpuRenderTarget(i),o.width=i.pixelWidth,o.height=i.pixelHeight);let s=i.colorTexture,l=this.viewport,u=s.pixelWidth,c=s.pixelHeight;if(!n&&e instanceof d.x&&(n=e.frame),n){let e=s._resolution;l.x=n.x*e+.5|0,l.y=n.y*e+.5|0,l.width=n.width*e+.5|0,l.height=n.height*e+.5|0}else l.x=0,l.y=0,l.width=u,l.height=c;return!function(e,t,r,n,i,a){let o=a?1:-1;e.identity(),e.a=1/n*2,e.d=1/i*2*o,e.tx=-1-0*e.a,e.ty=-o-0*e.d}(this.projectionMatrix,0,0,l.width/s.resolution,l.height/s.resolution,!i.isRoot),this.adaptor.startRenderPass(i,t,r,l),a&&this.onRenderTargetChange.emit(i),i}clear(e,t=a.E.ALL,r){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=a.E.ALL,r,n){let i=this.bind(e,t,r,n);return this._renderTargetStack.push({renderTarget:i,frame:n}),i}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,n,i){r.x<0&&(n.width+=r.x,i.x-=r.x,r.x=0),r.y<0&&(n.height+=r.y,i.y-=r.y,r.y=0);let{pixelWidth:a,pixelHeight:o}=e;return n.width=Math.min(n.width,a-r.x),n.height=Math.min(n.height,o-r.y),this.adaptor.copyToTexture(e,t,r,n,i)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return s.D.test(e)&&(e=(0,u.t)(e)),e instanceof c.A?t=e:e instanceof l.p&&(t=new c.A({colorTextures:[e]}),s.D.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy();let e=this._gpuRenderTargetHash[t.uid];e&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(e))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}}},8826:function(e,t,r){r.d(t,{N:()=>ef,U:()=>em});var n=r(91957);class i{constructor(e){this._renderer=e}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}function a(e,t){let r=e.instructionSet,n=r.instructions;for(let e=0;e<r.instructionSize;e++){let r=n[e];t[r.renderPipeId].execute(r)}}i.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"customRender"};class o{constructor(e){this._renderer=e}addRenderGroup(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:e.worldTransform,worldColor:e.worldColorAlpha}),a(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}o.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"renderGroup"};var s=r(30044);function l(e,t,r){!(e.globalDisplayStatus<7)&&e.includeInBuild&&(e.sortableChildren&&e.sortChildren(),e.isSimple?function(e,t,r){if(e.renderPipeId&&(r.blendMode.setBlendMode(e,e.groupBlendMode,t),e.didViewUpdate=!1,r[e.renderPipeId].addRenderable(e,t)),!e.isRenderGroupRoot){let n=e.children,i=n.length;for(let e=0;e<i;e++)l(n[e],t,r)}}(e,t,r):d(e,t,r,!1))}function d(e,t,r,n){if(!n&&e.isRenderGroupRoot)r.renderGroup.addRenderGroup(e.renderGroup,t);else{for(let n=0;n<e.effects.length;n++){let i=e.effects[n];r[i.pipe].push(i,e,t)}let n=e.renderPipeId;n&&(r.blendMode.setBlendMode(e,e.groupBlendMode,t),e.didViewUpdate=!1,r[n].addRenderable(e,t));let i=e.children;if(i.length)for(let e=0;e<i.length;e++)l(i[e],t,r);for(let n=e.effects.length-1;n>=0;n--){let i=e.effects[n];r[i.pipe].pop(i,e,t)}}}var u=r(82930);function c(e,t){if(0xffffff===e||0xffffff===t)return e+t-0xffffff;let r=e>>16&255,n=e>>8&255,i=255&e;return(r+((t>>16&255)-r)*.5<<16)+(n+((t>>8&255)-n)*.5<<8)+(i+((255&t)-i)*.5)}let h=new u.W2;function p(e,t,r){if(r&u.wO){e.groupColor=c(e.localColor,t.groupColor);let r=e.localAlpha*t.groupAlpha;e.groupAlpha=r=r<0?0:r>1?1:r,e.groupColorAlpha=e.groupColor+((255*r|0)<<24)}r&u.pA&&(e.groupBlendMode="inherit"===e.localBlendMode?t.groupBlendMode:e.localBlendMode),r&u.Jm&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}let f=new s.y;class m{constructor(e){this._renderer=e}render({container:e,transform:t}){e.isRenderGroup=!0;let r=e.parent,n=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let i=this._renderer,o=function e(t,r=[]){r.push(t);for(let n=0;n<t.renderGroupChildren.length;n++)e(t.renderGroupChildren[n],r);return r}(e.renderGroup,[]),s=f;t&&(s=s.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let l=i.renderPipes;for(let e=0;e<o.length;e++){let t=o[e];if(t.runOnRender(),t.instructionSet.renderPipes=l,t.structureDidChange||function(e,t){let{list:r,index:n}=e.childrenRenderablesToUpdate,i=!1;for(let e=0;e<n;e++){let n=r[e];if(i=t[n.renderPipeId].validateRenderable(n))break}e.structureDidChange=i}(t,l),!function e(t,r=!1){!function(e){let t,r=e.root;if(e.renderGroupParent){let n=e.renderGroupParent;e.worldTransform.appendFrom(r.relativeGroupTransform,n.worldTransform),e.worldColor=c(r.groupColor,n.worldColor),t=r.groupAlpha*n.worldAlpha}else e.worldTransform.copyFrom(r.localTransform),e.worldColor=r.localColor,t=r.localAlpha;e.worldAlpha=t=t<0?0:t>1?1:t,e.worldColorAlpha=e.worldColor+((255*t|0)<<24)}(t);let n=t.childrenToUpdate,i=t.updateTick;for(let e in t.updateTick++,n){let t=n[e],r=t.list,a=t.index;for(let e=0;e<a;e++)!function e(t,r,n){if(r===t.updateTick)return;t.updateTick=r,t.didChange=!1;let i=t.localTransform;t.updateLocalTransform();let a=t.parent;if(a&&!a.isRenderGroupRoot?(n|=t._updateFlags,t.relativeGroupTransform.appendFrom(i,a.relativeGroupTransform),n&&p(t,a,n)):(n=t._updateFlags,t.relativeGroupTransform.copyFrom(i),n&&p(t,h,n)),!t.isRenderGroupRoot){let i=t.children,a=i.length;for(let t=0;t<a;t++)e(i[t],r,n);let o=t.renderGroup;t.renderPipeId&&!o.structureDidChange&&o.updateRenderable(t)}}(r[e],i,0);t.index=0}if(r)for(let n=0;n<t.renderGroupChildren.length;n++)e(t.renderGroupChildren[n],r)}(t),t.structureDidChange){t.structureDidChange=!1;let e=t.root,r=t.instructionSet;r.reset(),l.batch.buildStart(r),l.blendMode.buildStart(),l.colorMask.buildStart(),e.sortableChildren&&e.sortChildren(),d(e,r,l,!0),l.batch.buildEnd(r),l.blendMode.buildEnd(r)}else{var u=t;let{list:e,index:r}=u.childrenRenderablesToUpdate;for(let t=0;t<r;t++){let r=e[t];r.didViewUpdate&&u.updateRenderable(r)}}t.childrenRenderablesToUpdate.index=0,i.renderPipes.batch.upload(t.instructionSet)}i.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),a(e.renderGroup,l),l.uniformBatch&&l.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(s),e.parent=r,e.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}}m.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem,n.nw.CanvasSystem],name:"renderGroup"};var g=r(24951),x=r(88556);class _{constructor(e){this._gpuSpriteHash=Object.create(null),this._renderer=e}addRenderable(e,t){let r=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t.batcher.updateElement(t)}validateRenderable(e){let t=e._texture,r=this._getGpuSprite(e);return r.texture._source!==t._source&&!r.batcher.checkAndUpdateTexture(r,t)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];g.u.return(t),this._gpuSpriteHash[e.uid]=null}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.bounds=e.bounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=g.u.get(x.c);return t.renderable=e,t.texture=e._texture,t.bounds=e.bounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e._didSpriteUpdate=!1,e.on("destroyed",()=>{this.destroyRenderable(e)}),t}destroy(){for(let e in this._gpuSpriteHash)g.u.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}}_.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"sprite"};var b=r(29492),v=r(54809),k=r(84376);class T{constructor(e,t){this.state=b.Z.for2d(),this._batches=Object.create(null),this._geometries=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init(this)}buildStart(e){if(!this._batches[e.uid]){let t=new k.m;this._batches[e.uid]=t,this._geometries[t.uid]=new v.J}this._activeBatch=this._batches[e.uid],this._activeGeometry=this._geometries[this._activeBatch.uid],this._activeBatch.begin()}addToBatch(e){this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){let t=this._activeBatch,r=this._activeGeometry;t.finish(e),r.indexBuffer.setDataWithSize(t.indexBuffer,t.indexSize,!0),r.buffers[0].setDataWithSize(t.attributeBuffer.float32View,t.attributeSize,!1)}upload(e){let t=this._batches[e.uid],r=this._geometries[t.uid];t.dirty&&(t.dirty=!1,r.buffers[0].update(4*t.attributeSize))}execute(e){if("startBatch"===e.action){let t=e.batcher,r=this._geometries[t.uid];this._adaptor.start(this,r)}this._adaptor.execute(this,e)}destroy(){for(let e in this.state=null,this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this._batches)this._batches[e].destroy();for(let e in this._batches=null,this._geometries)this._geometries[e].destroy();this._geometries=null}}T.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"batch"};var w=r(25521),M=r(95098),y=r(45025),C=r(73109),S=r(34855),P=r(83782),G="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>, \n};\n\nstruct MaskUniforms {\n uFilterMatrix:mat3x3<f32>,\n uMaskClamp:vec4<f32>,\n uAlpha:f32,\n};\n\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;\n@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) filterUv : vec2<f32>,\n };\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n{\n return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n}\n\nfn getSize() -> vec2<f32>\n{\n\n \n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition),\n getFilterCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @location(1) filterUv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n var maskClamp = filterUniforms.uMaskClamp;\n\n var clip = step(3.5,\n step(maskClamp.x, filterUv.x) +\n step(maskClamp.y, filterUv.y) +\n step(filterUv.x, maskClamp.z) +\n step(filterUv.y, maskClamp.w));\n\n var mask = textureSample(uMaskTexture, uSampler, filterUv);\n var source = textureSample(uTexture, uSampler, uv);\n \n var npmAlpha = 0.0;\n\n var alphaMul = 1.0 - npmAlpha * (1.0 - mask.a);\n\n var a = (alphaMul * mask.r) * clip;\n\n return vec4(source.rgb, source.a) * a;\n}";class R extends P.w{constructor(e){let{sprite:t,...r}=e,n=new S.U(t.texture),i=new C.o({uFilterMatrix:{value:new s.y,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"}});super({...r,gpuProgram:y.O.from({vertex:{source:G,entryPoint:"mainVertex"},fragment:{source:G,entryPoint:"mainFragment"}}),glProgram:M.J.from({vertex:"in vec2 aPosition;\n\nout vec2 vTextureCoord;\nout vec2 vMaskCoord;\n\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\nuniform mat3 uFilterMatrix;\n\nvec4 filterVertexPosition( vec2 aPosition )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( vec2 aPosition )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvec2 getFilterCoord( vec2 aPosition )\n{\n return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n} \n\nvoid main(void)\n{\n gl_Position = filterVertexPosition(aPosition);\n vTextureCoord = filterTextureCoord(aPosition);\n vMaskCoord = getFilterCoord(aPosition);\n}\n",fragment:"in vec2 vMaskCoord;\nin vec2 vTextureCoord;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMaskTexture;\n\nuniform float uAlpha;\nuniform vec4 uMaskClamp;\n\nout vec4 finalColor;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(uMaskClamp.x, vMaskCoord.x) +\n step(uMaskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, uMaskClamp.z) +\n step(vMaskCoord.y, uMaskClamp.w));\n\n // TODO look into why this is needed\n float npmAlpha = uAlpha; \n vec4 original = texture(uTexture, vTextureCoord);\n vec4 masky = texture(uMaskTexture, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * uAlpha * clip);\n\n finalColor = original;\n}\n",name:"mask-filter"}),resources:{filterUniforms:i,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=n}apply(e,t,r,n){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,n)}}var B=r(39622),U=r(71829),A=r(66388),I=r(41277),F=r(50900);let D=new B.Y;class O extends w.U{constructor(){super({filters:[new R({sprite:new A.j(I.x.EMPTY)})]})}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}}class E{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){let n=this._renderer;if(n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,canBundle:!1,maskedContainer:t}),e.renderMaskToTexture){let t=e.mask;t.includeInBuild=!0,l(t,r,n.renderPipes),t.includeInBuild=!1}n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,canBundle:!1})}execute(e){let t=this._renderer,r=e.mask.renderMaskToTexture;if("pushMaskBegin"===e.action){let n=g.u.get(O);if(r){e.mask.mask.measurable=!0;let r=(0,U.qW)(e.mask.mask,!0,D);e.mask.mask.measurable=!1,r.ceil();let i=F.z.getOptimalTexture(r.width,r.height,1,!1);t.renderTarget.push(i,!0),t.globalUniforms.push({offset:r,worldColor:0xffffffff});let a=n.sprite;a.texture=i,a.worldTransform.tx=r.minX,a.worldTransform.ty=r.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer,filterTexture:i})}else n.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer})}else if("pushMaskEnd"===e.action){let e=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:e.maskedContainer,filterEffect:e.filterEffect,canBundle:!1})}else if("popMaskEnd"===e.action){t.filter.pop();let e=this._activeMaskStage.pop();r&&F.z.returnTexture(e.filterTexture),g.u.return(e.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}E.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"alphaMask"};class W{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);let n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;let i=this._colorStack[this._colorStackIndex];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);let n=this._colorStack;this._colorStackIndex--;let i=n[this._colorStackIndex-1];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}}W.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"colorMask"};var z=r(81599),L=r(22246);class H{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var n;let i=this._renderer;i.renderPipes.batch.break(r),i.renderPipes.blendMode.setBlendMode(e.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,canBundle:!1});let a=e.mask;a.includeInBuild=!0,this._maskHash.has(e)||this._maskHash.set(e,{instructionsStart:0,instructionsLength:0});let o=this._maskHash.get(e);o.instructionsStart=r.instructionSize,l(a,r,i.renderPipes),a.includeInBuild=!1,i.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,canBundle:!1});let s=r.instructionSize-o.instructionsStart-1;o.instructionsLength=s;let d=i.renderTarget.renderTarget.uid;(n=this._maskStackHash)[d]??(n[d]=0)}pop(e,t,r){let n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(e.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",canBundle:!1});let i=this._maskHash.get(e);for(let e=0;e<i.instructionsLength;e++)r.instructions[r.instructionSize++]=r.instructions[i.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;let r=this._renderer,n=r.renderTarget.renderTarget.uid,i=(t=this._maskStackHash)[n]??(t[n]=0);"pushMaskBegin"===e.action?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(L.D.RENDERING_MASK_ADD,i),i++,r.colorMask.setMask(0)):"pushMaskEnd"===e.action?(r.stencil.setStencilMode(L.D.MASK_ACTIVE,i),r.colorMask.setMask(15)):"popMaskBegin"===e.action?(r.colorMask.setMask(0),0!==i?r.stencil.setStencilMode(L.D.RENDERING_MASK_REMOVE,i):(r.renderTarget.clear(null,z.E.STENCIL),r.stencil.setStencilMode(L.D.DISABLED,i)),i--):"popMaskEnd"===e.action&&(r.stencil.setStencilMode(L.D.MASK_ACTIVE,i),r.colorMask.setMask(15)),this._maskStackHash[n]=i}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}H.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"stencilMask"};var V=r(32036);let j=class e{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V.I(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...e.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};j.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem,n.nw.CanvasSystem],name:"background",priority:0},j.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};var N=r(92245);let $={};n.Rw.handle(n.nw.BlendMode,e=>{if(!e.name)throw Error("BlendMode extension must have a name property");$[e.name]=e.ref},e=>{delete $[e.name]});class q{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e}setBlendMode(e,t,r){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!$[t],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!$[t])return void(0,N.Z)(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);this._filterHash[t]||(this._filterHash[t]=new w.U({filters:[new $[t]]}));let r={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:this._filterHash[t],canBundle:!1};this._renderableList=r.renderables,e.add(r)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){for(let e in this._renderer=null,this._renderableList=null,this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}q.extension={type:[n.nw.WebGLPipes,n.nw.WebGPUPipes,n.nw.CanvasPipes],name:"blendMode"};let K={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},J=class e{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof u.W2||e instanceof I.x?{target:e,...t}:{...t,...e}}async image(e){let t=new Image;return t.src=await this.base64(e),t}async base64(t){let{format:r,quality:n}=t=this._normalizeOptions(t,e.defaultImageOptions),i=this.canvas(t);if(void 0!==i.toBlob)return new Promise((e,t)=>{i.toBlob(r=>{if(!r)return void t(Error("ICanvas.toBlob failed!"));let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)},K[r],n)});if(void 0!==i.toDataURL)return i.toDataURL(K[r],n);if(void 0!==i.convertToBlob){let e=await i.convertToBlob({type:K[r],quality:n});return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)})}throw Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){let t=(e=this._normalizeOptions(e)).target,r=this._renderer;if(t instanceof I.x)return r.texture.generateCanvas(t);let n=r.textureGenerator.generateTexture(e),i=r.texture.generateCanvas(n);return n.destroy(),i}pixels(e){let t=(e=this._normalizeOptions(e)).target,r=this._renderer,n=t instanceof I.x?t:r.textureGenerator.generateTexture(e),i=r.texture.getPixels(n);return t instanceof u.W2&&n.destroy(),i}texture(e){return(e=this._normalizeOptions(e)).target instanceof I.x?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){let t=e.width??200;e=this._normalizeOptions(e);let r=this.canvas(e),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`),console.log("%c ",`font-size: 1px; padding: ${t}px 300px; background: url(${n}) no-repeat; background-size: contain;`)}destroy(){this._renderer=null}};J.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem],name:"extract"},J.defaultImageOptions={format:"png",quality:1};var Y=r(45266),Z=r(30858),X=r(62815);class Q extends I.x{static create(e){return new I.x({source:new X.p(e)})}resize(e,t,r){return this.source.resize(e,t,r),this}}let ee=new Y.A,et=new B.Y,er=[0,0,0,0];class en{constructor(e){this._renderer=e}generateTexture(e){e instanceof u.W2&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,n=e.target,i=e.clearColor;i=i?Array.isArray(i)&&4===i.length?i:V.I.shared.setValue(i).toArray():er;let a=e.frame?.copyTo(ee)||(0,Z.a)(n,et).rectangle;a.width=0|Math.max(a.width,1/t),a.height=0|Math.max(a.height,1/t);let o=Q.create({...e.textureSourceOptions,width:a.width,height:a.height,resolution:t,antialias:r}),l=s.y.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:l,target:o,clearColor:i}),o}destroy(){this._renderer=null}}en.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem],name:"textureGenerator"};var ei=r(87246),ea=r(23947),eo=r(49458),es=r(71423);class el{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:n,offset:i}){let a,o=this._renderer.renderTarget.renderTarget,l=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new s.y,worldColor:0xffffffff,offset:new ei.E},d={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||o.size,worldTransformMatrix:r||l.worldTransformMatrix,worldColor:n||l.worldColor,offset:i||l.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);let c=u.uniforms;c.uProjectionMatrix=d.projectionMatrix,c.uResolution=d.resolution,c.uWorldTransformMatrix.copyFrom(d.worldTransformMatrix),c.uWorldTransformMatrix.tx-=d.offset.x,c.uWorldTransformMatrix.ty-=d.offset.y,(0,ea.V)(d.worldColor,c.uWorldColorAlpha,0),u.update(),this._renderer.renderPipes.uniformBatch?a=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(a=this._bindGroupPool.pop()||new eo.v,this._activeBindGroups.push(a),a.setResource(u,0)),d.bindGroup=a,this._currentGlobalUniformData=d}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===es.g.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new C.o({uProjectionMatrix:{value:new s.y,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new s.y,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}el.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem,n.nw.CanvasSystem],name:"globalUniforms"};var ed=r(767);let eu=!1,ec="8.1.1";class eh{constructor(e){this._renderer=e}init(e){if(e.hello){let e=this._renderer.name;this._renderer.type===es.g.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`);var t=e;if(!eu){if(ed.z.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${ec} (${t}) http://www.pixijs.com/
28
+
29
+ `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${ec} - ${t} - http://www.pixijs.com/`);eu=!0}}}}eh.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem,n.nw.CanvasSystem],name:"hello",priority:-2},eh.defaultOptions={hello:!1};let ep=class e{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(t){t={...e.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let t=0;t<e.length;t++){let r=e[t];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};ep.extension={type:[n.nw.WebGLSystem,n.nw.WebGPUSystem],name:"textureGC"},ep.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:3600,textureGCCheckCountMax:600},n.Rw.add(ep);let ef=[j,el,eh,r(36966).l,m,ep,en,J],em=[q,T,_,o,E,H,W,i]}}]);
30
+ //# sourceMappingURL=364.1821e74b.js.map