PageSourceSearch

https://hellooo.cards/_next/static/chunks/558.4ad23dda44192bb2.js

js hellooo.cards collected 2026-10-02 01:19:24 UTC 36,118 bytes, 41 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[558],{4558:function(e,t,r){r.d(t,{WebGPURenderer:function(){return eS}});var i=r(7),s=r(493),a=r(9905),n=r(4375),o=r(7978),u=r(7091),d=r(4035),h=r(8978),l=r(5564),c=r(4027),p=r(7328);class f{init(){let e=new p.o({uTransformMatrix:{value:new s.y,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),t=(0,o.d)({name:"graphics",bits:[u.M,(0,d.m)((0,a.N)()),h.Kt,l.j]});this.shader=new c.e({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let r=t.context,i=r.customShader||this.shader,s=e.renderer,{batcher:a,instructions:o}=s.graphicsContext.getContextRenderData(r),u=s.encoder;u.setPipelineFromGeometryProgramAndState(a.geometry,i.gpuProgram,e.state),u.setGeometry(a.geometry,i.gpuProgram);let d=s.globalUniforms.bindGroup;u.setBindGroup(0,d,i.gpuProgram);let h=s.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);u.setBindGroup(2,h,i.gpuProgram);let l=o.instructions;for(let e=0;e<o.instructionSize;e++){let t=l[e];if(i.groups[1]=t.bindGroup,!t.gpuBindGroup){let e=t.textures;t.bindGroup=(0,n.Q)(e.textures,e.count),t.gpuBindGroup=s.bindGroup.getBindGroup(t.bindGroup,i.gpuProgram,1)}u.setBindGroup(1,t.bindGroup,i.gpuProgram),u.renderPassEncoder.drawIndexed(t.size,1,t.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}f.extension={type:[i.nw.WebGPUPipesAdaptor],name:"graphics"};var g=r(2283),m=r(8583),_=r(5788);class b{init(){let e=(0,o.d)({name:"mesh",bits:[h.XH,g.r,l.j]});this._shader=new c.e({gpuProgram:e,resources:{uTexture:m.x.EMPTY._source,uSampler:m.x.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new s.y}}}})}execute(e,t){let r=e.renderer,i=t._shader;if(i){if(!i.gpuProgram){(0,_.Z)("Mesh shader has no gpuProgram",t.shader);return}}else(i=this._shader).groups[2]=r.texture.getTextureBindGroup(t.texture);let s=i.gpuProgram;if(s.autoAssignGlobalUniforms&&(i.groups[0]=r.globalUniforms.bindGroup),s.autoAssignLocalUniforms){let t=e.localUniforms;i.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(t,!0)}r.encoder.draw({geometry:t._geometry,shader:i,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}b.extension={type:[i.nw.WebGPUPipesAdaptor],name:"mesh"};var x=r(5918);let y=x.Z.for2d();class G{start(e,t,r){let i=e.renderer,s=i.encoder,a=r.gpuProgram;this._shader=r,this._geometry=t,s.setGeometry(t,a),y.blendMode="normal",i.pipeline.getPipeline(t,a,y);let n=i.globalUniforms.bindGroup;s.resetBindGroup(1),s.setBindGroup(0,n,a)}execute(e,t){let r=this._shader.gpuProgram,i=e.renderer,s=i.encoder;if(!t.bindGroup){let e=t.textures;t.bindGroup=(0,n.Q)(e.textures,e.count)}y.blendMode=t.blendMode;let a=i.bindGroup.getBindGroup(t.bindGroup,r,1),o=i.pipeline.getPipeline(this._geometry,r,y);t.bindGroup._touch(i.textureGC.count),s.setPipeline(o),s.renderPassEncoder.setBindGroup(1,a),s.renderPassEncoder.drawIndexed(t.size,1,t.start)}}G.extension={type:[i.nw.WebGPUPipesAdaptor],name:"batch"};var P=r(4535),B=r(4162),S=r(4147);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 i=this._gpu.device,s=t.layout[r],a=[],n=this._renderer;for(let t in s){let r;let i=e.resources[t]??e.resources[s[t]];if("uniformGroup"===i._resourceType){n.ubo.updateUniformGroup(i);let e=i.buffer;r={buffer:n.buffer.getGPUBuffer(e),offset:0,size:e.descriptor.size}}else"buffer"===i._resourceType?r={buffer:n.buffer.getGPUBuffer(i),offset:0,size:i.descriptor.size}:"bufferResource"===i._resourceType?r={buffer:n.buffer.getGPUBuffer(i.buffer),offset:i.offset,size:i.size}:"textureSampler"===i._resourceType?r=n.texture.getGpuSampler(i):"textureSource"===i._resourceType&&(r=n.texture.getGpuSource(i).createView({}));a.push({binding:s[t],resource:r})}let o=n.shader.getProgramData(t).bindGroups[r],u=i.createBindGroup({layout:o,entries:a});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:[i.nw.WebGPUSystem],name:"bindGroup"};var v=r(4434);class C{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),this._managedBuffers.push(e));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&((0,v.T)(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,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)}
1destroy(){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}}C.extension={type:[i.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:[i.nw.WebGPUSystem],name:"colorMask"};var U=r(1791);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 U.z.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(e=>t.features.has(e)),i=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:i}}destroy(){this.gpu=null,this._renderer=null}}M.extension={type:[i.nw.WebGPUSystem],name:"device"},M.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class E{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,i){let s=this._renderer.pipeline.getPipeline(e,t,r,i);this.setPipeline(s)}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 i=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,i)}setGeometry(e,t){let r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(let t in r)this._setVertexBuffer(t,e.attributes[r[t]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let r in e.groups){let i=e.groups[r];t||this._syncBindGroup(i),this.setBindGroup(r,i,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:i,topology:s,size:a,start:n,instanceCount:o,skipSync:u}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,i,s),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,u),t.indexBuffer?this.renderPassEncoder.drawIndexed(a||t.indexBuffer.data.length,o||t.instanceCount,n||0):this.renderPassEncoder.draw(a||t.getSize(),o||t.instanceCount,n||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},i=this._boundIndexBuffer,s={...this._boundBindGroup};this._clearCache();let a=this._renderer.renderTarget.viewport;for(let e in this.renderPassEncoder.setViewport(a.x,a.y,a.width,a.height,0,1),this.setPipeline(t),r)this._setVertexBuffer(e,r[e]);for(let e in s)this.setBindGroup(e,s[e],null);this._setIndexBuffer(i)}_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}}E.extension={type:[i.nw.WebGPUSystem],name:"encoder",priority:1};var R=r(5416);class z{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:R.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 i=this._renderer;i.pipeline.setStencilMode(e),i.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}z.extension={type:[i.nw.WebGPUSystem],name:"stencil"};var k=r(6743);let F={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>
1":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function D(e){let t=e.map(e=>({data:e,offset:0,size:0})),r=0;for(let e=0;e<t.length;e++){let i=t[e],s=F[i.data.type].size,a=F[i.data.type].align;if(!F[i.data.type])throw Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${i.data.type}`);i.data.size>1&&(s=Math.max(s,a)*i.data.size),r=Math.ceil(r/a)*a,i.size=s,i.offset=r,r+=s}return{uboElements:t,size:r=16*Math.ceil(r/16)}}var L=r(8852),O=r(4326);function A(e,t){let{size:r,align:i}=F[e.data.type],s=(i-r)/4;return`
2         v = uv.${e.data.name};
3         ${0!==t?`offset += ${t};`:""}
4
5         arrayOffset = offset;
6
7         t = 0;
8
9         for(var i=0; i < ${e.data.size*(r/4)}; i++)
10         {
11             for(var j = 0; j < ${r/4}; j++)
12             {
13                 data[arrayOffset++] = v[t++];
14             }
15             ${0!==s?`arrayOffset += ${s};`:""}
16         }
17     `}function H(e){return(0,L.S)(e,"uboWgsl",A,O.R)}class I extends k.L{constructor(){super({createUboElements:D,generateUboSync:H})}}I.extension={type:[i.nw.WebGPUSystem],name:"ubo"};var W=r(4007),V=r(6090),N=r(6801);class j{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 K=r(3963);class q{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new j({minUniformOffsetAlignment:128});for(let e=0;e<2;e++){let t=N.F.UNIFORM|N.F.COPY_DST;0===e&&(t|=N.F.COPY_SRC),this._buffers.push(new W.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,i=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,i/4),this._bindGroupHash[e.uid]=this._getBindGroup(i/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 V.q({buffer:t,offset:(e/2|0)*256,size:128})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let t=new K.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 i=1;i<this._buffers.length;i++){let s=this._buffers[i];r.copyBufferToBuffer(e.getGPUBuffer(t),128,e.getGPUBuffer(s),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}}q.extension={type:[i.nw.WebGPUPipes],name:"uniformBatch"};var Y=r(9911),$=r(1567),Z=r(871);let X={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};
17class Q{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=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(R.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?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Z.L[e],this._updatePipeHash())}setPipeline(e,t,r,i){let s=this.getPipeline(e,t,r);i.setPipeline(s)}getPipeline(e,t,r,i){var s,a;e._layoutKey||((0,Y.B)(e,t.attributeData),this._generateBufferKey(e)),i=i||e.topology;let n=(s=e._layoutKey,a=t._layoutKey,s<<24|a<<16|r.data<<10|r._blendModeId<<5|X[i]);return this._pipeCache[n]||(this._pipeCache[n]=this._createPipeline(e,t,r,i)),this._pipeCache[n]}_createPipeline(e,t,r,i){let s=this._gpu.device,a=this._createVertexBufferLayouts(e,t),n=this._renderer.state.getColorTargets(r);n[0].writeMask=this._stencilMode===R.D.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(t).pipeline,u={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:a},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:n},primitive:{topology:i,cullMode:r.cullMode},layout:o,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"}),s.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,i=Object.keys(e.attributes).sort();for(let s=0;s<i.length;s++){let a=e.attributes[i[s]];t[r++]=a.offset,t[r++]=a.format,t[r++]=a.stride,t[r++]=a.instance}let s=t.join("|");return e._layoutKey=(0,$.Z)(s,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){let t=[],r=0,i=Object.keys(e.attributeData).sort();for(let s=0;s<i.length;s++){let a=e.attributeData[i[s]];t[r++]=a.location}let s=t.join("|");return e._attributeLocationsKey=(0,$.Z)(s,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){let r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let i=this._createVertexBufferLayouts(e,t),s=Object.create(null),a=t.attributeData;for(let e=0;e<i.length;e++)for(let t in a)if(a[t].location===e){s[e]=t;break}return this._bindingNamesCache[r]=s,s}_createVertexBufferLayouts(e,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);let r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let i=[];return e.buffers.forEach(r=>{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let i in t.attributeData){let n=e.attributes[i];(n.divisor??1)!==1&&(0,_.Z)(`Attribute ${i} has an invalid divisor value of '${n.divisor}'. WebGPU only supports a divisor value of 1`),n.buffer===r&&(s.arrayStride=n.stride,s.stepMode=n.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[i].location,offset:n.offset,format:n.format}))}a.length&&i.push(s)}),this._bufferLayoutsCache[r]=i,i}_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}}Q.extension={type:[i.nw.WebGPUSystem],name:"pipeline"};var J=r(1877),ee=r(4161),et=r(5586),er=r(8744);class ei{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class es{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,i,s){let a=this._renderer,n=this._getGpuColorTexture(e),o=a.texture.getGpuSource(t.source);return a.encoder.commandEncoder.copyTextureToTexture({texture:n,origin:r},{texture:o,origin:s},i),t}startRenderPass(e,t=!0,r,i){let s=this._renderTargetSystem.getGpuRenderTarget(e),a=this.getDescriptor(e,t,r);s.descriptor=a,this._renderer.pipeline.setRenderTarget(s),this._renderer.encoder.beginRenderPass(s),this._renderer.encoder.setViewport(i)}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)}
17getDescriptor(e,t,r){let i;"boolean"==typeof t&&(t=t?ee.E.ALL:ee.E.NONE);let s=this._renderTargetSystem,a=s.getGpuRenderTarget(e),n=e.colorTextures.map((e,i)=>{let n,o;let u=a.contexts[i];n=u?u.getCurrentTexture().createView():this._renderer.texture.getGpuSource(e).createView({mipLevelCount:1}),a.msaaTextures[i]&&(o=n,n=this._renderer.texture.getTextureView(a.msaaTextures[i]));let d=t&ee.E.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:n,resolveTarget:o,clearValue:r,storeOp:"store",loadOp:d}});if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=a.msaa?4:1),e.depthStencilTexture){let r=t&ee.E.STENCIL?"clear":"load",s=t&ee.E.DEPTH?"clear":"load";i={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:r,depthClearValue:1,depthLoadOp:s,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:i}}clear(e,t=!0,r,i){if(!t)return;let{gpu:s,encoder:a}=this._renderer,n=s.device;if(null===a.commandEncoder){let s=n.createCommandEncoder(),a=this.getDescriptor(e,t,r),o=s.beginRenderPass(a);o.setViewport(i.x,i.y,i.width,i.height,0,1),o.end();let u=s.finish();n.queue.submit([u])}else this.startRenderPass(e,t,r,i)}initGpuRenderTarget(e){e.isRoot=!0;let t=new ei;return e.colorTextures.forEach((e,r)=>{if(et.D.test(e.resource)){let i=e.resource.getContext("webgpu"),s=e.transparent?"premultiplied":"opaque";try{i.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(e){console.error(e)}t.contexts[r]=i}if(t.msaa=e.source.antialias,e.source.antialias){let e=new er.p({width:0,height:0,sampleCount:4});t.msaaTextures[r]=e}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}
17destroyGpuRenderTarget(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 i=t.msaaTextures[r];i?.resize(e.source.width,e.source.height,e.source._resolution)})}}class ea extends J.l{constructor(e){super(e),this.adaptor=new es,this.adaptor.init(e,this)}}ea.extension={type:[i.nw.WebGPUSystem],name:"renderTarget"};class en{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}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}}en.extension={type:[i.nw.WebGPUSystem],name:"shader"};let eo={};eo.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},eo.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},eo.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},eo.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},eo.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},eo.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},eo["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},eo["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},eo["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},eo.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},eo.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},eo.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class eu{constructor(){this.defaultState=new x.Z,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:eo[e.blendMode]||eo.normal}]}destroy(){this.gpu=null}}eu.extension={type:[i.nw.WebGPUSystem],name:"state"};var ed=r(5485);let eh={type:"image",upload(e,t,r){let i=e.resource,s=(0|e.pixelWidth)*(0|e.pixelHeight),a=i.byteLength/s;r.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:e.pixelHeight,bytesPerRow:e.pixelHeight*a},{width:e.pixelWidth,height:e.pixelHeight,depthOrArrayLayers:1})}},el={"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}},ec={blockBytes:4,blockWidth:1,blockHeight:1},ep={type:"compressed",upload(e,t,r){let i=e.pixelWidth,s=e.pixelHeight,a=el[e.format]||ec;for(let n=0;n<e.resource.length;n++){let o=e.resource[n],u=Math.ceil(i/a.blockWidth)*a.blockBytes;r.device.queue.writeTexture({texture:t,mipLevel:n},o,{offset:0,bytesPerRow:u},{width:Math.ceil(i/a.blockWidth)*a.blockWidth,height:Math.ceil(s/a.blockHeight)*a.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},ef={type:"image",upload(e,t,r){let i=e.resource;if(!i)return;let s=Math.min(t.width,e.resourceWidth||e.pixelWidth),a=Math.min(t.height,e.resourceHeight||e.pixelHeight),n="premultiply-alpha-on-upload"===e.alphaMode;r.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:a})}},eg={type:"video",upload(e,t,r){ef.upload(e,t,r)}};class em{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:`
18                        var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
19                        vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
20
21                        struct VertexOutput {
22                        @builtin(position) position : vec4<f32>,
23                        @location(0) texCoord : vec2<f32>,
24                        };
25
26                        @vertex
27                        fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
28                        var output : VertexOutput;
29                        output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
30                        output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
31                        return output;
32                        }
33
34                        @group(0) @binding(0) var imgSampler : sampler;
35                        @group(0) @binding(1) var img : texture_2d<f32>;
36
37                        @fragment
38                        fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
39                        return textureSample(img, imgSampler, texCoord);
40                        }
41                    `})),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,i=e.depthOrArrayLayers||1,s=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!s){let t={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:i},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(t)}let a=this.device.createCommandEncoder({}),n=t.getBindGroupLayout(0);for(let o=0;o<i;++o){let i=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),u=s?1:0;for(let s=1;s<e.mipLevelCount;++s){let e=r.createView({baseMipLevel:u++,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),s=a.beginRenderPass({colorAttachments:[{view:e,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),d=this.device.createBindGroup({layout:n,entries:[{binding:0,resource:this.sampler},{binding:1,resource:i}]});s.setPipeline(t),s.setBindGroup(0,d),s.draw(3,1,0,0),s.end(),i=e}}if(!s){let t={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:i};for(let i=1;i<e.mipLevelCount;++i)a.copyTextureToTexture({texture:r,mipLevel:i-1},{texture:e,mipLevel:i},t),t.width=Math.ceil(t.width/2),t.height=Math.ceil(t.height/2)}return this.device.queue.submit([a.finish()]),s||r.destroy(),e}}class e_{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:ef,buffer:eh,video:eg,compressed:ep},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=el[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,s=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,a={label:e.label,size:{width:i,height:s}
41,format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},n=this._gpu.device.createTexture(a);return this._gpuSources[e.uid]=n,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),n}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 em(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;return this._bindGroupHash[e.uid]=new K.v({0:t,1:t.style,2:new p.o({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}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(),i=U.z.get().createCanvas();i.width=e.source.pixelWidth,i.height=e.source.pixelHeight;let s=i.getContext("webgpu");return s.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:U.z.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:s.getCurrentTexture()},{width:i.width,height:i.height}),t.gpu.device.queue.submit([r.finish()]),i}getPixels(e){let t=this.generateCanvas(e),r=ed.h.getOptimalCanvasAndContext(t.width,t.height),i=r.context;i.drawImage(t,0,0);let{width:s,height:a}=t,n=new Uint8ClampedArray(i.getImageData(0,0,s,a).data.buffer);return ed.h.returnCanvasAndContext(r),{pixels:n,width:s,height:a}}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}}e_.extension={type:[i.nw.WebGPUSystem],name:"texture"};let eb=[...B.N,I,E,M,C,e_,ea,en,eu,Q,w,z,T],ex=[...B.U,q],ey=[G,b,f],eG=[],eP=[],eB=[];i.Rw.handleByNamedList(i.nw.WebGPUSystem,eG),i.Rw.handleByNamedList(i.nw.WebGPUPipes,eP),i.Rw.handleByNamedList(i.nw.WebGPUPipesAdaptor,eB),i.Rw.add(...eb,...ex,...ey);class eS extends P.I{constructor(){super({name:"webgpu",type:S.g.WEBGPU,systems:eG,renderPipes:eP,renderPipeAdaptors:eB})}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.