@luma.gl/webgpu 9.1.2 → 9.1.3
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.
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +3 -2
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +7 -3
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +4 -1
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +7 -0
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/dist.dev.js +70 -55
- package/dist/dist.min.js +4 -4
- package/dist/index.cjs +68 -55
- package/dist/index.cjs.map +3 -3
- package/package.json +2 -2
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +3 -2
- package/src/adapter/helpers/webgpu-parameters.ts +7 -4
- package/src/adapter/resources/webgpu-render-pass.ts +8 -2
- package/src/adapter/resources/webgpu-render-pipeline.ts +8 -0
package/dist/dist.min.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['luma'] = factory();
|
|
6
6
|
else root['luma'] = factory();})(globalThis, function () {
|
|
7
|
-
var __exports__=(()=>{var
|
|
8
|
-
"${i.message}"`,this,this.props.source)()}),this.handle.label=this.props.id,this._checkCompilationError()}get asyncCompilationStatus(){return this.getCompilationInfo().then(()=>this.compilationStatus)}async _checkCompilationError(){let e=await this.getCompilationInfo(),t=Boolean(e.find(r=>r.type==="error"));this.compilationStatus=t?"error":"success",this.debugShader(),this.compilationStatus==="error"&&L.log.error("Shader compilation error",e)()}destroy(){this.handle=null}async getCompilationInfo(){return(await this.handle.getCompilationInfo()).messages}};var w=d(h(),1);function m(n){return n.depthStencil=n.depthStencil||{format:"depth24plus",stencilFront:{},stencilBack:{},depthWriteEnabled:!1,depthCompare:"less-equal"},n.depthStencil}function k(n){return m(n).stencilFront}function V(n){return m(n).stencilBack}var
|
|
7
|
+
var __exports__=(()=>{var Ce=Object.create;var F=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var Ge=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Te=(n,e)=>{for(var t in e)F(n,t,{get:e[t],enumerable:!0})},R=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pe(e))!Ae.call(n,i)&&i!==t&&F(n,i,{get:()=>e[i],enumerable:!(r=Ee(e,i))||r.enumerable});return n},O=(n,e,t)=>(R(n,e,"default"),t&&R(t,e,"default")),d=(n,e,t)=>(t=n!=null?Ce(Be(n)):{},R(e||!n||!n.__esModule?F(t,"default",{value:n,enumerable:!0}):t,n)),Le=n=>R(F({},"__esModule",{value:!0}),n);var h=Ge((Me,re)=>{re.exports=globalThis.luma});var W={};Te(W,{WebGPUBuffer:()=>b,WebGPUDevice:()=>S,WebGPUSampler:()=>c,WebGPUShader:()=>P,WebGPUTexture:()=>E,webgpuAdapter:()=>xe});O(W,d(h(),1));var f=d(h(),1);var I=d(h(),1);var U=d(h(),1);function _e(n){return n.byteLength||n.data?.byteLength||0}var b=class extends U.Buffer{device;handle;byteLength;constructor(e,t){super(e,t),this.device=e,this.byteLength=_e(t);let r=Boolean(t.data),i=Math.ceil(this.byteLength/4)*4;this.handle=this.props.handle||this.device.handle.createBuffer({size:i,usage:this.props.usage||GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:this.props.mappedAtCreation||r,label:this.props.id}),t.data&&this._writeMapped(t.data),r&&!t.mappedAtCreation&&this.handle.unmap()}destroy(){this.handle?.destroy(),this.handle=null}write(e,t=0){this.device.handle.queue.writeBuffer(this.handle,t,e.buffer,e.byteOffset,e.byteLength)}async readAsync(e=0,t=this.byteLength){let r=new b(this.device,{usage:U.Buffer.MAP_READ|U.Buffer.COPY_DST,byteLength:t}),i=this.device.handle.createCommandEncoder();i.copyBufferToBuffer(this.handle,e,r.handle,0,t),this.device.handle.queue.submit([i.finish()]),await r.handle.mapAsync(GPUMapMode.READ,e,t);let s=r.handle.getMappedRange().slice(0);return r.handle.unmap(),r.destroy(),new Uint8Array(s)}_writeMapped(e){let t=this.handle.getMappedRange();new e.constructor(t).set(e)}mapAsync(e,t=0,r){return this.handle.mapAsync(e,t,r)}getMappedRange(e=0,t){return this.handle.getMappedRange(e,t)}unmap(){this.handle.unmap()}};var v=d(h(),1);function C(n){if(n.includes("webgl"))throw new Error("webgl-only format");return n}var ne=d(h(),1),c=class extends ne.Sampler{device;handle;constructor(e,t){super(e,t),this.device=e;let r={...this.props,mipmapFilter:void 0};t.type!=="comparison-sampler"&&delete r.compare,t.mipmapFilter&&t.mipmapFilter!=="none"&&(r.mipmapFilter=t.mipmapFilter),this.handle=this.handle||this.device.handle.createSampler(r),this.handle.label=this.props.id}destroy(){this.handle=null}};var ie=d(h(),1),T=class extends ie.TextureView{device;handle;texture;constructor(e,t){super(e,t),this.device=e,this.texture=t.texture,this.handle=this.handle||this.texture.handle.createView({format:t.format||this.texture.format,dimension:t.dimension||this.texture.dimension,aspect:t.aspect,baseMipLevel:t.baseMipLevel,mipLevelCount:t.mipLevelCount,baseArrayLayer:t.baseArrayLayer,arrayLayerCount:t.arrayLayerCount}),this.handle.label=this.props.id}destroy(){this.handle=null}};var De={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},E=class extends v.Texture{device;handle;sampler;view;constructor(e,t){super(e,t),this.device=e;let r={...this.props};t.data&&(r.data=t.data),this.initialize(r)}destroy(){this.handle?.destroy(),this.handle=null}createView(e){return new T(this.device,{...e,texture:this})}initialize(e){this.handle=this.props.handle||this.createHandle(),this.handle.label||=this.id,this.props.data&&(v.Texture.isExternalImage(this.props.data)?this.copyExternalImage({image:this.props.data}):this.setData({data:this.props.data})),this.width=this.handle.width,this.height=this.handle.height,this.sampler=e.sampler instanceof c?e.sampler:new c(this.device,e.sampler||{}),this.view=new T(this.device,{...this.props,texture:this})}createHandle(){let e=this.props.width||this.props.data?.width||1,t=this.props.height||this.props.data?.height||1;return this.device.handle.createTexture({label:this.id,size:{width:e,height:t,depthOrArrayLayers:this.depth},usage:this.props.usage||v.Texture.TEXTURE|v.Texture.COPY_DST,dimension:De[this.dimension],format:C(this.format),mipLevelCount:this.mipLevels,sampleCount:this.props.samples})}createGPUTextureView(){return this.handle.createView({label:this.id})}setSampler(e){return this.sampler=e instanceof c?e:new c(this.device,e),this}setTexture1DData(e){throw new Error("not implemented")}setTexture2DData(e,t,r){throw new Error("not implemented")}setTexture3DData(e,t,r){throw new Error("not implemented")}setTextureCubeData(e,t){throw new Error("not implemented")}setTextureArrayData(e){throw new Error("not implemented")}setTextureCubeArrayData(e){throw new Error("not implemented")}setData(e){if(ArrayBuffer.isView(e.data)){let t=new Uint8ClampedArray(e.data.buffer),r=new ImageData(t,this.width,this.height);return this.copyExternalImage({image:r})}throw new Error("Texture.setData: Use CommandEncoder to upload data to texture in WebGPU")}copyExternalImage(e){let t=v.Texture.getExternalImageSize(e.image),r={...v.Texture.defaultCopyExternalImageOptions,...t,...e},{image:i,sourceX:s,sourceY:a,width:o,height:p,depth:l,mipLevel:g,x:u,y:G,z:J,aspect:we,colorSpace:ye,premultipliedAlpha:ve,flipY:Se}=r;return this.device.handle.queue.copyExternalImageToTexture({source:i,origin:[s,a],flipY:Se},{texture:this.handle,origin:[u,G,J],mipLevel:g,aspect:we,colorSpace:ye,premultipliedAlpha:ve},[o,p,l]),{width:o,height:p}}};var se=d(h(),1);var M=class extends se.ExternalTexture{device;handle;sampler;constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.handle.importExternalTexture({source:t.source,colorSpace:t.colorSpace}),this.sampler=null}destroy(){this.handle=null}setSampler(e){return this.sampler=e instanceof c?e:new c(this.device,e),this}};var L=d(h(),1),P=class extends L.Shader{device;handle;constructor(e,t){super(e,t),this.device=e;let r=t.source.includes("#version");if(this.props.language==="glsl"||r)throw new Error("GLSL shaders are not supported in WebGPU");this.device.handle.pushErrorScope("validation"),this.handle=this.props.handle||this.device.handle.createShaderModule({code:t.source}),this.device.handle.popErrorScope().then(i=>{i&&L.log.error(`${this} creation failed:
|
|
8
|
+
"${i.message}"`,this,this.props.source)()}),this.handle.label=this.props.id,this._checkCompilationError()}get asyncCompilationStatus(){return this.getCompilationInfo().then(()=>this.compilationStatus)}async _checkCompilationError(){let e=await this.getCompilationInfo(),t=Boolean(e.find(r=>r.type==="error"));this.compilationStatus=t?"error":"success",this.debugShader(),this.compilationStatus==="error"&&L.log.error("Shader compilation error",e)()}destroy(){this.handle=null}async getCompilationInfo(){return(await this.handle.getCompilationInfo()).messages}};var w=d(h(),1);var Z=d(h(),1);function m(n){return n.depthStencil=n.depthStencil||{format:"depth24plus",stencilFront:{},stencilBack:{},depthWriteEnabled:!1,depthCompare:"less-equal"},n.depthStencil}function k(n){return m(n).stencilFront}function V(n){return m(n).stencilBack}var Ie={cullMode:(n,e,t)=>{t.primitive=t.primitive||{},t.primitive.cullMode=e},frontFace:(n,e,t)=>{t.primitive=t.primitive||{},t.primitive.frontFace=e},depthWriteEnabled:(n,e,t)=>{let r=m(t);r.depthWriteEnabled=e},depthCompare:(n,e,t)=>{let r=m(t);r.depthCompare=e},depthFormat:(n,e,t)=>{let r=m(t);r.format=e},depthBias:(n,e,t)=>{let r=m(t);r.depthBias=e},depthBiasSlopeScale:(n,e,t)=>{let r=m(t);r.depthBiasSlopeScale=e},depthBiasClamp:(n,e,t)=>{let r=m(t);r.depthBiasClamp=e},stencilReadMask:(n,e,t)=>{let r=m(t);r.stencilReadMask=e},stencilWriteMask:(n,e,t)=>{let r=m(t);r.stencilWriteMask=e},stencilCompare:(n,e,t)=>{let r=k(t),i=V(t);r.compare=e,i.compare=e},stencilPassOperation:(n,e,t)=>{let r=k(t),i=V(t);r.passOp=e,i.passOp=e},stencilFailOperation:(n,e,t)=>{let r=k(t),i=V(t);r.failOp=e,i.failOp=e},stencilDepthFailOperation:(n,e,t)=>{let r=k(t),i=V(t);r.depthFailOp=e,i.depthFailOp=e},sampleCount:(n,e,t)=>{t.multisample=t.multisample||{},t.multisample.count=e},sampleMask:(n,e,t)=>{t.multisample=t.multisample||{},t.multisample.mask=e},sampleAlphaToCoverageEnabled:(n,e,t)=>{t.multisample=t.multisample||{},t.multisample.alphaToCoverageEnabled=e},colorMask:(n,e,t)=>{let r=ae(t);r[0].writeMask=e},blendColorOperation:(n,e,t)=>{ae(t)}},We={primitive:{cullMode:"back",topology:"triangle-list"},vertex:{module:void 0,entryPoint:"main"},fragment:{module:void 0,entryPoint:"main",targets:[]},layout:"auto"};function oe(n,e={}){Object.assign(n,{...We,...n}),Re(n,e)}function Re(n,e){for(let[t,r]of Object.entries(e)){let i=Ie[t];if(!i){Z.log.warn(`Illegal parameter ${t}`)();continue}i(t,r,n)}}function ae(n){return n.fragment.targets=n.fragment?.targets||[],Array.isArray(n.fragment?.targets)||Z.log.warn("parameters: no targets array")(),n.fragment?.targets?.length===0&&n.fragment.targets?.push({}),n.fragment?.targets}var x=d(h(),1);function $(n,e,t,r){let i=Fe(r,t);return n.createBindGroup({layout:e,entries:i})}function he(n,e){let t=n.bindings.find(r=>r.name===e||`${r.name}uniforms`===e.toLocaleLowerCase());return t||x.log.warn(`Binding ${e} not set: Not found in shader layout.`)(),t||null}function Fe(n,e){let t=[];for(let[r,i]of Object.entries(n)){let s=he(e,r);s&&t.push(de(i,s.location)),s=he(e,`${r}Sampler`),s&&t.push(de(i,s.location,{sampler:!0}))}return t}function de(n,e,t){if(n instanceof x.Buffer)return{binding:e,resource:{buffer:n.handle}};if(n instanceof x.Sampler)return{binding:e,resource:n.handle};if(n instanceof x.Texture)return t?.sampler?{binding:e,resource:n.sampler.handle}:{binding:e,resource:n.handle.createView({label:"bind-group-auto-created"})};throw new Error("invalid binding")}var B=d(h(),1);function K(n){if(n.endsWith("-webgl"))throw new Error(`WebGPU does not support vertex format ${n}`);return n}function pe(n,e){let t=[],r=new Set;for(let i of e){let s=[],a="vertex",o=0,p=i.format;if(i.attributes)for(let l of i.attributes){let g=l.attribute,u=le(n,g,r),G=u?.location;p=l.format||i.format,a=u?.stepMode||(u?.name.startsWith("instance")?"instance":"vertex"),s.push({format:K(p),offset:l.byteOffset,shaderLocation:G}),o+=(0,B.decodeVertexFormat)(p).byteLength}else{let l=le(n,i.name,r);if(!l)continue;o=(0,B.decodeVertexFormat)(p).byteLength,a=l.stepMode||(l.name.startsWith("instance")?"instance":"vertex"),s.push({format:K(p),offset:0,shaderLocation:l.location})}t.push({arrayStride:i.byteStride||o,stepMode:a,attributes:s})}for(let i of n.attributes)r.has(i.name)||t.push({arrayStride:(0,B.decodeVertexFormat)("float32x3").byteLength,stepMode:i.stepMode||(i.name.startsWith("instance")?"instance":"vertex"),attributes:[{format:K("float32x3"),offset:0,shaderLocation:i.location}]});return t}function le(n,e,t){let r=n.attributes.find(i=>i.name===e);if(!r)return B.log.warn(`Unknown attribute ${e}`)(),null;if(t.has(e))throw new Error(`Duplicate attribute ${e}`);return t.add(e),r}var q=class extends w.RenderPipeline{device;handle;vs;fs=null;_bindings;_bindGroupLayout=null;_bindGroup=null;constructor(e,t){if(super(e,t),this.device=e,this.handle=this.props.handle,!this.handle){let r=this._getRenderPipelineDescriptor();w.log.groupCollapsed(1,`new WebGPURenderPipeline(${this.id})`)(),w.log.probe(1,JSON.stringify(r,null,2))(),w.log.groupEnd(1)(),this.device.handle.pushErrorScope("validation"),this.handle=this.device.handle.createRenderPipeline(r),this.device.handle.popErrorScope().then(i=>{i&&w.log.error(`${this} creation failed:
|
|
9
9
|
"${i.message}"`,this,this.props.vs?.source)()})}this.handle.label=this.props.id,this.vs=t.vs,this.fs=t.fs,this._bindings={...this.props.bindings}}destroy(){this.handle=null}setBindings(e){Object.assign(this._bindings,e)}draw(e){let t=e.renderPass;this.device.handle.pushErrorScope("validation"),t.handle.setPipeline(this.handle),this.device.handle.popErrorScope().then(i=>{i&&w.log.error(`${this} setPipeline failed:
|
|
10
|
-
"${i.message}"`,this)()});let r=this._getBindGroup();return r&&t.handle.setBindGroup(0,r),e.vertexArray.bindBeforeRender(e.renderPass),e.indexCount?t.handle.drawIndexed(e.indexCount,e.instanceCount,e.firstIndex,e.baseVertex,e.firstInstance):t.handle.draw(e.vertexCount||0,e.instanceCount||1,e.firstInstance),e.vertexArray.unbindAfterRender(e.renderPass),!0}_getBindGroup(){return this.shaderLayout.bindings.length===0?null:(this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=this._bindGroup||$(this.device.handle,this._bindGroupLayout,this.shaderLayout,this._bindings),this._bindGroup)}_getRenderPipelineDescriptor(){let e={module:this.props.vs.handle,entryPoint:this.props.vertexEntryPoint||"main",buffers:
|
|
11
|
-
"${a.message}"`,this)()}),this.handle.label=this.props.id,y.log.groupCollapsed(3,`new WebGPURenderPass(${this.id})`)(),y.log.probe(3,JSON.stringify(i,null,2))(),y.log.groupEnd(3)()}destroy(){}end(){this.handle.end()}setPipeline(e){this.pipeline=e,this.handle.setPipeline(this.pipeline.handle)}setBindings(e){this.pipeline?.setBindings(e);let t=this.pipeline?._getBindGroup();t&&this.handle.setBindGroup(0,t)}setIndexBuffer(e,t,r=0,i){this.handle.setIndexBuffer(e.handle,t,r,i)}setVertexBuffer(e,t,r=0){this.handle.setVertexBuffer(e,t.handle,r)}draw(e){e.indexCount?this.handle.drawIndexed(e.indexCount,e.instanceCount,e.firstIndex,e.baseVertex,e.firstInstance):this.handle.draw(e.vertexCount||0,e.instanceCount||1,e.firstIndex,e.firstInstance)}drawIndirect(){}setParameters(e){let{blendConstant:t,stencilReference:r,scissorRect:i,viewport:s}=e;t&&this.handle.setBlendConstant(t),r&&this.handle.setStencilReference(r),i&&this.handle.setScissorRect(i[0],i[1],i[2],i[3]),s&&this.handle.setViewport(s[0],s[1],s[2],s[3],s[4],s[5])}pushDebugGroup(e){this.handle.pushDebugGroup(e)}popDebugGroup(){this.handle.popDebugGroup()}insertDebugMarker(e){this.handle.insertDebugMarker(e)}beginOcclusionQuery(e){this.handle.beginOcclusionQuery(e)}endOcclusionQuery(){this.handle.endOcclusionQuery()}getRenderPassDescriptor(e){let t={colorAttachments:[]};if(t.colorAttachments=e.colorAttachments.map((r,i)=>({loadOp:this.props.clearColor!==!1?"clear":"load",colorClearValue:this.props.clearColors?.[i]||this.props.clearColor||y.RenderPass.defaultClearColor,storeOp:this.props.discard?"discard":"store",view:r.handle})),e.depthStencilAttachment){t.depthStencilAttachment={view:e.depthStencilAttachment.handle};let{depthStencilAttachment:r}=t;this.props.depthReadOnly&&(r.depthReadOnly=!0),this.props.clearDepth!==!1&&(r.depthClearValue=this.props.clearDepth),!0&&(r.depthLoadOp=this.props.clearDepth!==!1?"clear":"load",r.depthStoreOp="store"),!1&&(r.stencilLoadOp=this.props.clearStencil!==!1?"clear":"load",r.stencilStoreOp="store")}return t}};var ue=d(h(),1),N=class extends ue.ComputePass{device;handle;_webgpuPipeline=null;constructor(e,t){super(e,t),this.device=e;let r;if(e.features.has("timestamp-query")){let i=t.timestampQuerySet;i&&(r={querySet:i.handle,beginningOfPassWriteIndex:t.beginTimestampIndex,endOfPassWriteIndex:t.endTimestampIndex})}this.handle=this.props.handle||e.commandEncoder?.beginComputePass({label:this.props.id,timestampWrites:r})}destroy(){}end(){this.handle.end()}setPipeline(e){let t=e;this.handle.setPipeline(t.handle),this._webgpuPipeline=t,this.setBindings([])}setBindings(e){let t=this._webgpuPipeline._getBindGroup();this.handle.setBindGroup(0,t)}dispatch(e,t,r){this.handle.dispatchWorkgroups(e,t,r)}dispatchIndirect(e,t=0){let r=e;this.handle.dispatchWorkgroupsIndirect(r.handle,t)}pushDebugGroup(e){this.handle.pushDebugGroup(e)}popDebugGroup(){this.handle.popDebugGroup()}insertDebugMarker(e){this.handle.insertDebugMarker(e)}};var _=d(h(),1);var ht=globalThis.document||{},dt=globalThis.process||{},lt=globalThis.console,me=globalThis.navigator||{};function j(n){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=n||e;return Boolean(t&&t.indexOf("Electron")>=0)}function fe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||j()}function K(n){return!n&&!fe()?"Node":j(n)?"Electron":(n||me.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var Y=class extends _.VertexArray{get[Symbol.toStringTag](){return"WebGPUVertexArray"}device;handle;constructor(e,t){super(e,t),this.device=e}destroy(){}setIndexBuffer(e){this.indexBuffer=e}setBuffer(e,t){this.attributes[e]=t}bindBeforeRender(e,t,r){let i=e,s=this.indexBuffer;s?.handle&&(_.log.info(3,"setting index buffer",s?.handle,s?.indexType)(),i.handle.setIndexBuffer(s?.handle,s?.indexType));for(let a=0;a<this.maxVertexAttributes;a++){let o=this.attributes[a];o?.handle&&(_.log.info(3,`setting vertex buffer ${a}`,o?.handle)(),i.handle.setVertexBuffer(a,o?.handle))}}unbindAfterRender(e){}static isConstantAttributeZeroSupported(e){return K()==="Chrome"}};var H=d(h(),1);var D=class extends H.CanvasContext{device;gpuCanvasContext;format=navigator.gpu.getPreferredCanvasFormat();depthStencilFormat="depth24plus";depthStencilAttachment=null;get[Symbol.toStringTag](){return"WebGPUCanvasContext"}constructor(e,t,r){super(r),this.device=e,this.width=-1,this.height=-1,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.gpuCanvasContext=this.canvas.getContext("webgpu"),this.format="bgra8unorm"}destroy(){this.gpuCanvasContext.unconfigure()}getCurrentFramebuffer(){this.update();let e=this.getCurrentTexture();return this.width=e.width,this.height=e.height,this._createDepthStencilAttachment(),new A(this.device,{colorAttachments:[e],depthStencilAttachment:this.depthStencilAttachment})}update(){let e=this.width,t=this.height,[r,i]=this.getPixelSize();(r!==e||i!==t)&&(this.width=r,this.height=i,this.depthStencilAttachment&&(this.depthStencilAttachment.destroy(),this.depthStencilAttachment=null),this.gpuCanvasContext.configure({device:this.device.handle,format:C(this.format),colorSpace:this.props.colorSpace,alphaMode:this.props.alphaMode}),H.log.log(1,`${this} Resized ${e}x${t} => ${r}x${i}px`)())}resize(e){if(this.update(),!!this.device.handle&&this.canvas){let t=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(t,e);return}}getCurrentTexture(){return this.device.createTexture({id:`${this.id}#color-texture`,handle:this.gpuCanvasContext.getCurrentTexture(),format:this.format})}_createDepthStencilAttachment(){return this.depthStencilAttachment||(this.depthStencilAttachment=this.device.createTexture({id:`${this.id}#depth-stencil-texture`,format:this.depthStencilFormat,width:this.width,height:this.height,usage:GPUTextureUsage.RENDER_ATTACHMENT})),this.depthStencilAttachment}};var ge=d(h(),1),X=class extends ge.QuerySet{device;handle;constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.handle.createQuerySet({type:this.props.type,count:this.props.count}),this.handle.label=this.props.id}destroy(){this.handle?.destroy(),this.handle=null}};var S=class extends I.Device{type="webgpu";handle;adapter;adapterInfo;features;info;limits;lost;canvasContext=null;_isLost=!1;commandEncoder=null;renderPass=null;constructor(e,t,r,i){super({...e,id:e.id||"webgpu-device"}),this.handle=t,this.adapter=r,this.adapterInfo=i,this.info=this._getInfo(),this.features=this._getFeatures(),this.limits=this.handle.limits,t.addEventListener("uncapturederror",a=>{let o=a instanceof GPUUncapturedErrorEvent?a.error.message:"Unknown WebGPU error";if(this.reportError(new Error(o)),this.props.debug)debugger;a.preventDefault()}),this.lost=new Promise(async a=>{let o=await this.handle.lost;this._isLost=!0,a({reason:"destroyed",message:o.message})});let s=I.Device._getCanvasContextProps(e);s&&(this.canvasContext=new D(this,this.adapter,s))}destroy(){this.handle.destroy()}get isLost(){return this._isLost}createBuffer(e){let t=this._normalizeBufferProps(e);return new b(this,t)}createTexture(e){return new E(this,e)}createExternalTexture(e){return new M(this,e)}createShader(e){return new P(this,e)}createSampler(e){return new p(this,e)}createRenderPipeline(e){return new q(this,e)}createFramebuffer(e){return new A(this,e)}createComputePipeline(e){return new z(this,e)}createVertexArray(e){return new Y(this,e)}beginRenderPass(e){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new Q(this,e)}beginComputePass(e){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new N(this,e)}createTransformFeedback(e){throw new Error("Transform feedback not supported in WebGPU")}createQuerySet(e){return new X(this,e)}createCanvasContext(e){return new D(this,this.adapter,e)}submit(){let e=this.commandEncoder?.finish();e&&(this.handle.pushErrorScope("validation"),this.handle.queue.submit([e]),this.handle.popErrorScope().then(t=>{t&&this.reportError(new Error(`WebGPU command submission failed: ${t.message}`))})),this.commandEncoder=null}_getInfo(){let[e,t]=(this.adapterInfo.driver||"").split(" Version "),r=this.adapterInfo.vendor||this.adapter.__brand||"unknown",i=e||"",s=t||"",a=r==="apple"?"apple":"unknown",o=this.adapterInfo.architecture||"unknown",c=this.adapterInfo.backend||"unknown",l=(this.adapterInfo.type||"").split(" ")[0].toLowerCase()||"unknown";return{type:"webgpu",vendor:r,renderer:i,version:s,gpu:a,gpuType:l,gpuBackend:c,gpuArchitecture:o,shadingLanguage:"wgsl",shadingLanguageVersion:100}}_getFeatures(){let e=new Set(this.handle.features);e.has("depth-clamping")&&(e.delete("depth-clamping"),e.add("depth-clip-control")),e.has("texture-compression-bc")&&e.add("texture-compression-bc5-webgl");let t=["timer-query-webgl","compilation-status-async-webgl","float32-renderable-webgl","float16-renderable-webgl","norm16-renderable-webgl","texture-filterable-anisotropic-webgl","shader-noperspective-interpolation-webgl"];for(let r of t)e.add(r);return new I.DeviceFeatures(Array.from(e),this.props._disabledFeatures)}_getDeviceSpecificTextureFormatCapabilities(e){let{format:t}=e;return t.includes("webgl")?{format:t,create:!1,render:!1,filter:!1,blend:!1,store:!1}:e}copyExternalImageToTexture(e){let{source:t,sourceX:r=0,sourceY:i=0,texture:s,mipLevel:a=0,aspect:o="all",colorSpace:c="display-p3",premultipliedAlpha:l=!1,width:g=s.width,height:u=s.height,depth:G=1}=e,J=s;this.handle?.queue.copyExternalImageToTexture({source:t,origin:[r,i]},{texture:J.handle,origin:[0,0,0],mipLevel:a,aspect:o,colorSpace:c,premultipliedAlpha:l},[g,u,G])}};var ee=class extends f.Adapter{type="webgpu";constructor(){super(),S.adapter=this}isSupported(){return Boolean(typeof navigator<"u"&&navigator.gpu)}async create(e){if(!navigator.gpu)throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");f.log.groupCollapsed(1,"WebGPUDevice created")();let t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});if(!t)throw new Error("Failed to request WebGPU adapter");let r=t.info||await t.requestAdapterInfo?.();f.log.probe(2,"Adapter available",r)();let i=[],s={};if(e._requestMaxLimits){i.push(...Array.from(t.features));let c=Object.keys(t.limits).filter(l=>!["minSubgroupSize","maxSubgroupSize"].includes(l));for(let l of c){let g=l,u=t.limits[g];typeof u=="number"&&(s[g]=u)}}let a=await t.requestDevice({requiredFeatures:i,requiredLimits:s});f.log.probe(1,"GPUDevice available")();let o=new S(e,a,t,r);return f.log.probe(1,"Device created. For more info, set chrome://flags/#enable-webgpu-developer-features")(),f.log.table(1,o.info)(),f.log.groupEnd(1)(),o}async attach(e){throw new Error("WebGPUAdapter.attach() not implemented")}},be=new ee;return Te(R);})();
|
|
10
|
+
"${i.message}"`,this)()});let r=this._getBindGroup();return r&&t.handle.setBindGroup(0,r),e.vertexArray.bindBeforeRender(e.renderPass),e.indexCount?t.handle.drawIndexed(e.indexCount,e.instanceCount,e.firstIndex,e.baseVertex,e.firstInstance):t.handle.draw(e.vertexCount||0,e.instanceCount||1,e.firstInstance),e.vertexArray.unbindAfterRender(e.renderPass),!0}_getBindGroup(){return this.shaderLayout.bindings.length===0?null:(this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=this._bindGroup||$(this.device.handle,this._bindGroupLayout,this.shaderLayout,this._bindings),this._bindGroup)}_getRenderPipelineDescriptor(){let e={module:this.props.vs.handle,entryPoint:this.props.vertexEntryPoint||"main",buffers:pe(this.shaderLayout,this.props.bufferLayout)},t={module:this.props.fs.handle,entryPoint:this.props.fragmentEntryPoint||"main",targets:[{format:C(this.device.getCanvasContext().format)}]},r={vertex:e,fragment:t,primitive:{topology:this.props.topology},layout:"auto"};return this.props.parameters.depthWriteEnabled&&this.props.parameters.depthCompare&&(r.depthStencil={format:"depth24plus",depthWriteEnabled:this.props.parameters.depthWriteEnabled,depthCompare:this.props.parameters.depthCompare}),oe(r,this.props.parameters),r}};var ce=d(h(),1),A=class extends ce.Framebuffer{device;colorAttachments=[];depthStencilAttachment=null;constructor(e,t){super(e,t),this.device=e,this.autoCreateAttachmentTextures()}updateAttachments(){}};var ue=d(h(),1);var z=class extends ue.ComputePipeline{device;handle;_bindGroupLayout=null;_bindGroup=null;_bindings={};constructor(e,t){super(e,t),this.device=e;let r=this.props.shader;this.handle=this.props.handle||this.device.handle.createComputePipeline({label:this.props.id,compute:{module:r.handle,entryPoint:this.props.entryPoint,constants:this.props.constants},layout:"auto"})}setBindings(e){Object.assign(this._bindings,e)}_getBindGroup(){return this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=this._bindGroup||$(this.device.handle,this._bindGroupLayout,this.shaderLayout,this._bindings),this._bindGroup}};var y=d(h(),1),Q=class extends y.RenderPass{device;handle;pipeline=null;constructor(e,t={}){super(e,t),this.device=e;let r=t.framebuffer||e.getCanvasContext().getCurrentFramebuffer(),i=this.getRenderPassDescriptor(r),s=t.timestampQuerySet;if(s&&(i.occlusionQuerySet=s.handle),e.features.has("timestamp-query")){let a=t.timestampQuerySet;i.timestampWrites=a?{querySet:a.handle,beginningOfPassWriteIndex:t.beginTimestampIndex,endOfPassWriteIndex:t.endTimestampIndex}:void 0}if(!e.commandEncoder)throw new Error("commandEncoder not available");this.device.handle.pushErrorScope("validation"),this.handle=this.props.handle||e.commandEncoder.beginRenderPass(i),this.device.handle.popErrorScope().then(a=>{a&&y.log.error(`${this} creation failed:
|
|
11
|
+
"${a.message}"`,this)()}),this.handle.label=this.props.id,y.log.groupCollapsed(3,`new WebGPURenderPass(${this.id})`)(),y.log.probe(3,JSON.stringify(i,null,2))(),y.log.groupEnd(3)()}destroy(){}end(){this.handle.end()}setPipeline(e){this.pipeline=e,this.handle.setPipeline(this.pipeline.handle)}setBindings(e){this.pipeline?.setBindings(e);let t=this.pipeline?._getBindGroup();t&&this.handle.setBindGroup(0,t)}setIndexBuffer(e,t,r=0,i){this.handle.setIndexBuffer(e.handle,t,r,i)}setVertexBuffer(e,t,r=0){this.handle.setVertexBuffer(e,t.handle,r)}draw(e){e.indexCount?this.handle.drawIndexed(e.indexCount,e.instanceCount,e.firstIndex,e.baseVertex,e.firstInstance):this.handle.draw(e.vertexCount||0,e.instanceCount||1,e.firstIndex,e.firstInstance)}drawIndirect(){}setParameters(e){let{blendConstant:t,stencilReference:r,scissorRect:i,viewport:s}=e;t&&this.handle.setBlendConstant(t),r&&this.handle.setStencilReference(r),i&&this.handle.setScissorRect(i[0],i[1],i[2],i[3]),s&&this.handle.setViewport(s[0],s[1],s[2],s[3],s[4],s[5])}pushDebugGroup(e){this.handle.pushDebugGroup(e)}popDebugGroup(){this.handle.popDebugGroup()}insertDebugMarker(e){this.handle.insertDebugMarker(e)}beginOcclusionQuery(e){this.handle.beginOcclusionQuery(e)}endOcclusionQuery(){this.handle.endOcclusionQuery()}getRenderPassDescriptor(e){let t={colorAttachments:[]};if(t.colorAttachments=e.colorAttachments.map((r,i)=>({loadOp:this.props.clearColor!==!1?"clear":"load",clearValue:Oe(this.props.clearColors?.[i]||this.props.clearColor||y.RenderPass.defaultClearColor),storeOp:this.props.discard?"discard":"store",view:r.handle})),e.depthStencilAttachment){t.depthStencilAttachment={view:e.depthStencilAttachment.handle};let{depthStencilAttachment:r}=t;this.props.depthReadOnly&&(r.depthReadOnly=!0),this.props.clearDepth!==!1&&(r.depthClearValue=this.props.clearDepth),!0&&(r.depthLoadOp=this.props.clearDepth!==!1?"clear":"load",r.depthStoreOp="store"),!1&&(r.stencilLoadOp=this.props.clearStencil!==!1?"clear":"load",r.stencilStoreOp="store")}return t}};function Oe(n){return{r:n[0],g:n[1],b:n[2],a:n[3]}}var me=d(h(),1),N=class extends me.ComputePass{device;handle;_webgpuPipeline=null;constructor(e,t){super(e,t),this.device=e;let r;if(e.features.has("timestamp-query")){let i=t.timestampQuerySet;i&&(r={querySet:i.handle,beginningOfPassWriteIndex:t.beginTimestampIndex,endOfPassWriteIndex:t.endTimestampIndex})}this.handle=this.props.handle||e.commandEncoder?.beginComputePass({label:this.props.id,timestampWrites:r})}destroy(){}end(){this.handle.end()}setPipeline(e){let t=e;this.handle.setPipeline(t.handle),this._webgpuPipeline=t,this.setBindings([])}setBindings(e){let t=this._webgpuPipeline._getBindGroup();this.handle.setBindGroup(0,t)}dispatch(e,t,r){this.handle.dispatchWorkgroups(e,t,r)}dispatchIndirect(e,t=0){let r=e;this.handle.dispatchWorkgroupsIndirect(r.handle,t)}pushDebugGroup(e){this.handle.pushDebugGroup(e)}popDebugGroup(){this.handle.popDebugGroup()}insertDebugMarker(e){this.handle.insertDebugMarker(e)}};var _=d(h(),1);var lt=globalThis.document||{},pt=globalThis.process||{},ct=globalThis.console,fe=globalThis.navigator||{};function j(n){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=n||e;return Boolean(t&&t.indexOf("Electron")>=0)}function ge(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||j()}function ee(n){return!n&&!ge()?"Node":j(n)?"Electron":(n||fe.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var Y=class extends _.VertexArray{get[Symbol.toStringTag](){return"WebGPUVertexArray"}device;handle;constructor(e,t){super(e,t),this.device=e}destroy(){}setIndexBuffer(e){this.indexBuffer=e}setBuffer(e,t){this.attributes[e]=t}bindBeforeRender(e,t,r){let i=e,s=this.indexBuffer;s?.handle&&(_.log.info(3,"setting index buffer",s?.handle,s?.indexType)(),i.handle.setIndexBuffer(s?.handle,s?.indexType));for(let a=0;a<this.maxVertexAttributes;a++){let o=this.attributes[a];o?.handle&&(_.log.info(3,`setting vertex buffer ${a}`,o?.handle)(),i.handle.setVertexBuffer(a,o?.handle))}}unbindAfterRender(e){}static isConstantAttributeZeroSupported(e){return ee()==="Chrome"}};var H=d(h(),1);var D=class extends H.CanvasContext{device;gpuCanvasContext;format=navigator.gpu.getPreferredCanvasFormat();depthStencilFormat="depth24plus";depthStencilAttachment=null;get[Symbol.toStringTag](){return"WebGPUCanvasContext"}constructor(e,t,r){super(r),this.device=e,this.width=-1,this.height=-1,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.gpuCanvasContext=this.canvas.getContext("webgpu"),this.format="bgra8unorm"}destroy(){this.gpuCanvasContext.unconfigure()}getCurrentFramebuffer(){this.update();let e=this.getCurrentTexture();return this.width=e.width,this.height=e.height,this._createDepthStencilAttachment(),new A(this.device,{colorAttachments:[e],depthStencilAttachment:this.depthStencilAttachment})}update(){let e=this.width,t=this.height,[r,i]=this.getPixelSize();(r!==e||i!==t)&&(this.width=r,this.height=i,this.depthStencilAttachment&&(this.depthStencilAttachment.destroy(),this.depthStencilAttachment=null),this.gpuCanvasContext.configure({device:this.device.handle,format:C(this.format),colorSpace:this.props.colorSpace,alphaMode:this.props.alphaMode}),H.log.log(1,`${this} Resized ${e}x${t} => ${r}x${i}px`)())}resize(e){if(this.update(),!!this.device.handle&&this.canvas){let t=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(t,e);return}}getCurrentTexture(){return this.device.createTexture({id:`${this.id}#color-texture`,handle:this.gpuCanvasContext.getCurrentTexture(),format:this.format})}_createDepthStencilAttachment(){return this.depthStencilAttachment||(this.depthStencilAttachment=this.device.createTexture({id:`${this.id}#depth-stencil-texture`,format:this.depthStencilFormat,width:this.width,height:this.height,usage:GPUTextureUsage.RENDER_ATTACHMENT})),this.depthStencilAttachment}};var be=d(h(),1),X=class extends be.QuerySet{device;handle;constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.handle.createQuerySet({type:this.props.type,count:this.props.count}),this.handle.label=this.props.id}destroy(){this.handle?.destroy(),this.handle=null}};var S=class extends I.Device{type="webgpu";handle;adapter;adapterInfo;features;info;limits;lost;canvasContext=null;_isLost=!1;commandEncoder=null;renderPass=null;constructor(e,t,r,i){super({...e,id:e.id||"webgpu-device"}),this.handle=t,this.adapter=r,this.adapterInfo=i,this.info=this._getInfo(),this.features=this._getFeatures(),this.limits=this.handle.limits,t.addEventListener("uncapturederror",a=>{let o=a instanceof GPUUncapturedErrorEvent?a.error.message:"Unknown WebGPU error";if(this.reportError(new Error(o)),this.props.debug)debugger;a.preventDefault()}),this.lost=new Promise(async a=>{let o=await this.handle.lost;this._isLost=!0,a({reason:"destroyed",message:o.message})});let s=I.Device._getCanvasContextProps(e);s&&(this.canvasContext=new D(this,this.adapter,s))}destroy(){this.handle.destroy()}get isLost(){return this._isLost}createBuffer(e){let t=this._normalizeBufferProps(e);return new b(this,t)}createTexture(e){return new E(this,e)}createExternalTexture(e){return new M(this,e)}createShader(e){return new P(this,e)}createSampler(e){return new c(this,e)}createRenderPipeline(e){return new q(this,e)}createFramebuffer(e){return new A(this,e)}createComputePipeline(e){return new z(this,e)}createVertexArray(e){return new Y(this,e)}beginRenderPass(e){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new Q(this,e)}beginComputePass(e){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new N(this,e)}createTransformFeedback(e){throw new Error("Transform feedback not supported in WebGPU")}createQuerySet(e){return new X(this,e)}createCanvasContext(e){return new D(this,this.adapter,e)}submit(){let e=this.commandEncoder?.finish();e&&(this.handle.pushErrorScope("validation"),this.handle.queue.submit([e]),this.handle.popErrorScope().then(t=>{t&&this.reportError(new Error(`WebGPU command submission failed: ${t.message}`))})),this.commandEncoder=null}_getInfo(){let[e,t]=(this.adapterInfo.driver||"").split(" Version "),r=this.adapterInfo.vendor||this.adapter.__brand||"unknown",i=e||"",s=t||"",a=r==="apple"?"apple":"unknown",o=this.adapterInfo.architecture||"unknown",p=this.adapterInfo.backend||"unknown",l=(this.adapterInfo.type||"").split(" ")[0].toLowerCase()||"unknown";return{type:"webgpu",vendor:r,renderer:i,version:s,gpu:a,gpuType:l,gpuBackend:p,gpuArchitecture:o,shadingLanguage:"wgsl",shadingLanguageVersion:100}}_getFeatures(){let e=new Set(this.handle.features);e.has("depth-clamping")&&(e.delete("depth-clamping"),e.add("depth-clip-control")),e.has("texture-compression-bc")&&e.add("texture-compression-bc5-webgl");let t=["timer-query-webgl","compilation-status-async-webgl","float32-renderable-webgl","float16-renderable-webgl","norm16-renderable-webgl","texture-filterable-anisotropic-webgl","shader-noperspective-interpolation-webgl"];for(let r of t)e.add(r);return new I.DeviceFeatures(Array.from(e),this.props._disabledFeatures)}_getDeviceSpecificTextureFormatCapabilities(e){let{format:t}=e;return t.includes("webgl")?{format:t,create:!1,render:!1,filter:!1,blend:!1,store:!1}:e}copyExternalImageToTexture(e){let{source:t,sourceX:r=0,sourceY:i=0,texture:s,mipLevel:a=0,aspect:o="all",colorSpace:p="display-p3",premultipliedAlpha:l=!1,width:g=s.width,height:u=s.height,depth:G=1}=e,J=s;this.handle?.queue.copyExternalImageToTexture({source:t,origin:[r,i]},{texture:J.handle,origin:[0,0,0],mipLevel:a,aspect:o,colorSpace:p,premultipliedAlpha:l},[g,u,G])}};var te=class extends f.Adapter{type="webgpu";constructor(){super(),S.adapter=this}isSupported(){return Boolean(typeof navigator<"u"&&navigator.gpu)}async create(e){if(!navigator.gpu)throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");f.log.groupCollapsed(1,"WebGPUDevice created")();let t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});if(!t)throw new Error("Failed to request WebGPU adapter");let r=t.info||await t.requestAdapterInfo?.();f.log.probe(2,"Adapter available",r)();let i=[],s={};if(e._requestMaxLimits){i.push(...Array.from(t.features));let p=Object.keys(t.limits).filter(l=>!["minSubgroupSize","maxSubgroupSize"].includes(l));for(let l of p){let g=l,u=t.limits[g];typeof u=="number"&&(s[g]=u)}}let a=await t.requestDevice({requiredFeatures:i,requiredLimits:s});f.log.probe(1,"GPUDevice available")();let o=new S(e,a,t,r);return f.log.probe(1,"Device created. For more info, set chrome://flags/#enable-webgpu-developer-features")(),f.log.table(1,o.info)(),f.log.groupEnd(1)(),o}async attach(e){throw new Error("WebGPUAdapter.attach() not implemented")}},xe=new te;return Le(W);})();
|
|
12
12
|
return __exports__;
|
|
13
13
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -29,10 +29,10 @@ __export(dist_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(dist_exports);
|
|
30
30
|
|
|
31
31
|
// dist/adapter/webgpu-adapter.js
|
|
32
|
-
var
|
|
32
|
+
var import_core19 = require("@luma.gl/core");
|
|
33
33
|
|
|
34
34
|
// dist/adapter/webgpu-device.js
|
|
35
|
-
var
|
|
35
|
+
var import_core18 = require("@luma.gl/core");
|
|
36
36
|
|
|
37
37
|
// dist/adapter/resources/webgpu-buffer.js
|
|
38
38
|
var import_core = require("@luma.gl/core");
|
|
@@ -369,9 +369,10 @@ var WebGPUShader = class extends import_core6.Shader {
|
|
|
369
369
|
};
|
|
370
370
|
|
|
371
371
|
// dist/adapter/resources/webgpu-render-pipeline.js
|
|
372
|
-
var
|
|
372
|
+
var import_core10 = require("@luma.gl/core");
|
|
373
373
|
|
|
374
374
|
// dist/adapter/helpers/webgpu-parameters.js
|
|
375
|
+
var import_core7 = require("@luma.gl/core");
|
|
375
376
|
function addDepthStencil(descriptor) {
|
|
376
377
|
descriptor.depthStencil = descriptor.depthStencil || {
|
|
377
378
|
// required, set something
|
|
@@ -551,7 +552,8 @@ function setParameters(pipelineDescriptor, parameters) {
|
|
|
551
552
|
for (const [key, value] of Object.entries(parameters)) {
|
|
552
553
|
const setterFunction = PARAMETER_TABLE[key];
|
|
553
554
|
if (!setterFunction) {
|
|
554
|
-
|
|
555
|
+
import_core7.log.warn(`Illegal parameter ${key}`)();
|
|
556
|
+
continue;
|
|
555
557
|
}
|
|
556
558
|
setterFunction(key, value, pipelineDescriptor);
|
|
557
559
|
}
|
|
@@ -560,7 +562,7 @@ function addColorState(descriptor) {
|
|
|
560
562
|
var _a, _b, _c, _d, _e, _f;
|
|
561
563
|
descriptor.fragment.targets = ((_a = descriptor.fragment) == null ? void 0 : _a.targets) || [];
|
|
562
564
|
if (!Array.isArray((_b = descriptor.fragment) == null ? void 0 : _b.targets)) {
|
|
563
|
-
|
|
565
|
+
import_core7.log.warn("parameters: no targets array")();
|
|
564
566
|
}
|
|
565
567
|
if (((_d = (_c = descriptor.fragment) == null ? void 0 : _c.targets) == null ? void 0 : _d.length) === 0) {
|
|
566
568
|
(_e = descriptor.fragment.targets) == null ? void 0 : _e.push({});
|
|
@@ -569,7 +571,7 @@ function addColorState(descriptor) {
|
|
|
569
571
|
}
|
|
570
572
|
|
|
571
573
|
// dist/adapter/helpers/get-bind-group.js
|
|
572
|
-
var
|
|
574
|
+
var import_core8 = require("@luma.gl/core");
|
|
573
575
|
function getBindGroup(device, bindGroupLayout, shaderLayout, bindings) {
|
|
574
576
|
const entries = getBindGroupEntries(bindings, shaderLayout);
|
|
575
577
|
return device.createBindGroup({
|
|
@@ -580,7 +582,7 @@ function getBindGroup(device, bindGroupLayout, shaderLayout, bindings) {
|
|
|
580
582
|
function getShaderLayoutBinding(shaderLayout, bindingName) {
|
|
581
583
|
const bindingLayout = shaderLayout.bindings.find((binding) => binding.name === bindingName || `${binding.name}uniforms` === bindingName.toLocaleLowerCase());
|
|
582
584
|
if (!bindingLayout) {
|
|
583
|
-
|
|
585
|
+
import_core8.log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();
|
|
584
586
|
}
|
|
585
587
|
return bindingLayout || null;
|
|
586
588
|
}
|
|
@@ -599,7 +601,7 @@ function getBindGroupEntries(bindings, shaderLayout) {
|
|
|
599
601
|
return entries;
|
|
600
602
|
}
|
|
601
603
|
function getBindGroupEntry(binding, index, options) {
|
|
602
|
-
if (binding instanceof
|
|
604
|
+
if (binding instanceof import_core8.Buffer) {
|
|
603
605
|
return {
|
|
604
606
|
binding: index,
|
|
605
607
|
resource: {
|
|
@@ -607,12 +609,12 @@ function getBindGroupEntry(binding, index, options) {
|
|
|
607
609
|
}
|
|
608
610
|
};
|
|
609
611
|
}
|
|
610
|
-
if (binding instanceof
|
|
612
|
+
if (binding instanceof import_core8.Sampler) {
|
|
611
613
|
return {
|
|
612
614
|
binding: index,
|
|
613
615
|
resource: binding.handle
|
|
614
616
|
};
|
|
615
|
-
} else if (binding instanceof
|
|
617
|
+
} else if (binding instanceof import_core8.Texture) {
|
|
616
618
|
if (options == null ? void 0 : options.sampler) {
|
|
617
619
|
return {
|
|
618
620
|
binding: index,
|
|
@@ -628,7 +630,7 @@ function getBindGroupEntry(binding, index, options) {
|
|
|
628
630
|
}
|
|
629
631
|
|
|
630
632
|
// dist/adapter/helpers/get-vertex-buffer-layout.js
|
|
631
|
-
var
|
|
633
|
+
var import_core9 = require("@luma.gl/core");
|
|
632
634
|
function getWebGPUVertexFormat(format) {
|
|
633
635
|
if (format.endsWith("-webgl")) {
|
|
634
636
|
throw new Error(`WebGPU does not support vertex format ${format}`);
|
|
@@ -642,26 +644,27 @@ function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
642
644
|
const vertexAttributes = [];
|
|
643
645
|
let stepMode = "vertex";
|
|
644
646
|
let byteStride = 0;
|
|
645
|
-
|
|
647
|
+
let format = mapping.format;
|
|
646
648
|
if (mapping.attributes) {
|
|
647
649
|
for (const attributeMapping of mapping.attributes) {
|
|
648
650
|
const attributeName = attributeMapping.attribute;
|
|
649
651
|
const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);
|
|
650
652
|
const location = attributeLayout == null ? void 0 : attributeLayout.location;
|
|
653
|
+
format = attributeMapping.format || mapping.format;
|
|
651
654
|
stepMode = (attributeLayout == null ? void 0 : attributeLayout.stepMode) || ((attributeLayout == null ? void 0 : attributeLayout.name.startsWith("instance")) ? "instance" : "vertex");
|
|
652
655
|
vertexAttributes.push({
|
|
653
|
-
format: getWebGPUVertexFormat(
|
|
656
|
+
format: getWebGPUVertexFormat(format),
|
|
654
657
|
offset: attributeMapping.byteOffset,
|
|
655
658
|
shaderLocation: location
|
|
656
659
|
});
|
|
657
|
-
byteStride += (0,
|
|
660
|
+
byteStride += (0, import_core9.decodeVertexFormat)(format).byteLength;
|
|
658
661
|
}
|
|
659
662
|
} else {
|
|
660
663
|
const attributeLayout = findAttributeLayout(shaderLayout, mapping.name, usedAttributes);
|
|
661
664
|
if (!attributeLayout) {
|
|
662
665
|
continue;
|
|
663
666
|
}
|
|
664
|
-
byteStride = (0,
|
|
667
|
+
byteStride = (0, import_core9.decodeVertexFormat)(format).byteLength;
|
|
665
668
|
stepMode = attributeLayout.stepMode || (attributeLayout.name.startsWith("instance") ? "instance" : "vertex");
|
|
666
669
|
vertexAttributes.push({
|
|
667
670
|
format: getWebGPUVertexFormat(format),
|
|
@@ -679,7 +682,7 @@ function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
679
682
|
for (const attribute of shaderLayout.attributes) {
|
|
680
683
|
if (!usedAttributes.has(attribute.name)) {
|
|
681
684
|
vertexBufferLayouts.push({
|
|
682
|
-
arrayStride: (0,
|
|
685
|
+
arrayStride: (0, import_core9.decodeVertexFormat)("float32x3").byteLength,
|
|
683
686
|
stepMode: attribute.stepMode || (attribute.name.startsWith("instance") ? "instance" : "vertex"),
|
|
684
687
|
attributes: [
|
|
685
688
|
{
|
|
@@ -696,7 +699,7 @@ function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
696
699
|
function findAttributeLayout(shaderLayout, name, attributeNames) {
|
|
697
700
|
const attribute = shaderLayout.attributes.find((attribute_) => attribute_.name === name);
|
|
698
701
|
if (!attribute) {
|
|
699
|
-
|
|
702
|
+
import_core9.log.warn(`Unknown attribute ${name}`)();
|
|
700
703
|
return null;
|
|
701
704
|
}
|
|
702
705
|
if (attributeNames.has(name)) {
|
|
@@ -707,7 +710,7 @@ function findAttributeLayout(shaderLayout, name, attributeNames) {
|
|
|
707
710
|
}
|
|
708
711
|
|
|
709
712
|
// dist/adapter/resources/webgpu-render-pipeline.js
|
|
710
|
-
var WebGPURenderPipeline = class extends
|
|
713
|
+
var WebGPURenderPipeline = class extends import_core10.RenderPipeline {
|
|
711
714
|
device;
|
|
712
715
|
handle;
|
|
713
716
|
vs;
|
|
@@ -722,15 +725,15 @@ var WebGPURenderPipeline = class extends import_core9.RenderPipeline {
|
|
|
722
725
|
this.handle = this.props.handle;
|
|
723
726
|
if (!this.handle) {
|
|
724
727
|
const descriptor = this._getRenderPipelineDescriptor();
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
+
import_core10.log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)();
|
|
729
|
+
import_core10.log.probe(1, JSON.stringify(descriptor, null, 2))();
|
|
730
|
+
import_core10.log.groupEnd(1)();
|
|
728
731
|
this.device.handle.pushErrorScope("validation");
|
|
729
732
|
this.handle = this.device.handle.createRenderPipeline(descriptor);
|
|
730
733
|
this.device.handle.popErrorScope().then((error) => {
|
|
731
734
|
var _a;
|
|
732
735
|
if (error) {
|
|
733
|
-
|
|
736
|
+
import_core10.log.error(`${this} creation failed:
|
|
734
737
|
"${error.message}"`, this, (_a = this.props.vs) == null ? void 0 : _a.source)();
|
|
735
738
|
}
|
|
736
739
|
});
|
|
@@ -757,7 +760,7 @@ var WebGPURenderPipeline = class extends import_core9.RenderPipeline {
|
|
|
757
760
|
webgpuRenderPass.handle.setPipeline(this.handle);
|
|
758
761
|
this.device.handle.popErrorScope().then((error) => {
|
|
759
762
|
if (error) {
|
|
760
|
-
|
|
763
|
+
import_core10.log.error(`${this} setPipeline failed:
|
|
761
764
|
"${error.message}"`, this)();
|
|
762
765
|
}
|
|
763
766
|
});
|
|
@@ -815,14 +818,21 @@ var WebGPURenderPipeline = class extends import_core9.RenderPipeline {
|
|
|
815
818
|
},
|
|
816
819
|
layout: "auto"
|
|
817
820
|
};
|
|
821
|
+
if (this.props.parameters.depthWriteEnabled && this.props.parameters.depthCompare) {
|
|
822
|
+
descriptor.depthStencil = {
|
|
823
|
+
format: "depth24plus",
|
|
824
|
+
depthWriteEnabled: this.props.parameters.depthWriteEnabled,
|
|
825
|
+
depthCompare: this.props.parameters.depthCompare
|
|
826
|
+
};
|
|
827
|
+
}
|
|
818
828
|
applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);
|
|
819
829
|
return descriptor;
|
|
820
830
|
}
|
|
821
831
|
};
|
|
822
832
|
|
|
823
833
|
// dist/adapter/resources/webgpu-framebuffer.js
|
|
824
|
-
var
|
|
825
|
-
var WebGPUFramebuffer = class extends
|
|
834
|
+
var import_core11 = require("@luma.gl/core");
|
|
835
|
+
var WebGPUFramebuffer = class extends import_core11.Framebuffer {
|
|
826
836
|
device;
|
|
827
837
|
colorAttachments = [];
|
|
828
838
|
depthStencilAttachment = null;
|
|
@@ -836,8 +846,8 @@ var WebGPUFramebuffer = class extends import_core10.Framebuffer {
|
|
|
836
846
|
};
|
|
837
847
|
|
|
838
848
|
// dist/adapter/resources/webgpu-compute-pipeline.js
|
|
839
|
-
var
|
|
840
|
-
var WebGPUComputePipeline = class extends
|
|
849
|
+
var import_core12 = require("@luma.gl/core");
|
|
850
|
+
var WebGPUComputePipeline = class extends import_core12.ComputePipeline {
|
|
841
851
|
device;
|
|
842
852
|
handle;
|
|
843
853
|
/** For internal use to create BindGroups */
|
|
@@ -875,8 +885,8 @@ var WebGPUComputePipeline = class extends import_core11.ComputePipeline {
|
|
|
875
885
|
};
|
|
876
886
|
|
|
877
887
|
// dist/adapter/resources/webgpu-render-pass.js
|
|
878
|
-
var
|
|
879
|
-
var WebGPURenderPass = class extends
|
|
888
|
+
var import_core13 = require("@luma.gl/core");
|
|
889
|
+
var WebGPURenderPass = class extends import_core13.RenderPass {
|
|
880
890
|
device;
|
|
881
891
|
handle;
|
|
882
892
|
/** Active pipeline */
|
|
@@ -905,14 +915,14 @@ var WebGPURenderPass = class extends import_core12.RenderPass {
|
|
|
905
915
|
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
906
916
|
this.device.handle.popErrorScope().then((error) => {
|
|
907
917
|
if (error) {
|
|
908
|
-
|
|
918
|
+
import_core13.log.error(`${this} creation failed:
|
|
909
919
|
"${error.message}"`, this)();
|
|
910
920
|
}
|
|
911
921
|
});
|
|
912
922
|
this.handle.label = this.props.id;
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
923
|
+
import_core13.log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
|
|
924
|
+
import_core13.log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();
|
|
925
|
+
import_core13.log.groupEnd(3)();
|
|
916
926
|
}
|
|
917
927
|
destroy() {
|
|
918
928
|
}
|
|
@@ -992,7 +1002,7 @@ var WebGPURenderPass = class extends import_core12.RenderPass {
|
|
|
992
1002
|
return {
|
|
993
1003
|
// clear values
|
|
994
1004
|
loadOp: this.props.clearColor !== false ? "clear" : "load",
|
|
995
|
-
|
|
1005
|
+
clearValue: convertColor(((_a = this.props.clearColors) == null ? void 0 : _a[index]) || this.props.clearColor || import_core13.RenderPass.defaultClearColor),
|
|
996
1006
|
storeOp: this.props.discard ? "discard" : "store",
|
|
997
1007
|
// ...colorAttachment,
|
|
998
1008
|
view: colorAttachment.handle
|
|
@@ -1023,10 +1033,13 @@ var WebGPURenderPass = class extends import_core12.RenderPass {
|
|
|
1023
1033
|
return renderPassDescriptor;
|
|
1024
1034
|
}
|
|
1025
1035
|
};
|
|
1036
|
+
function convertColor(color) {
|
|
1037
|
+
return { r: color[0], g: color[1], b: color[2], a: color[3] };
|
|
1038
|
+
}
|
|
1026
1039
|
|
|
1027
1040
|
// dist/adapter/resources/webgpu-compute-pass.js
|
|
1028
|
-
var
|
|
1029
|
-
var WebGPUComputePass = class extends
|
|
1041
|
+
var import_core14 = require("@luma.gl/core");
|
|
1042
|
+
var WebGPUComputePass = class extends import_core14.ComputePass {
|
|
1030
1043
|
device;
|
|
1031
1044
|
handle;
|
|
1032
1045
|
_webgpuPipeline = null;
|
|
@@ -1102,9 +1115,9 @@ var WebGPUComputePass = class extends import_core13.ComputePass {
|
|
|
1102
1115
|
};
|
|
1103
1116
|
|
|
1104
1117
|
// dist/adapter/resources/webgpu-vertex-array.js
|
|
1105
|
-
var
|
|
1118
|
+
var import_core15 = require("@luma.gl/core");
|
|
1106
1119
|
var import_env = require("@probe.gl/env");
|
|
1107
|
-
var WebGPUVertexArray = class extends
|
|
1120
|
+
var WebGPUVertexArray = class extends import_core15.VertexArray {
|
|
1108
1121
|
get [Symbol.toStringTag]() {
|
|
1109
1122
|
return "WebGPUVertexArray";
|
|
1110
1123
|
}
|
|
@@ -1133,7 +1146,7 @@ var WebGPUVertexArray = class extends import_core14.VertexArray {
|
|
|
1133
1146
|
const webgpuRenderPass = renderPass;
|
|
1134
1147
|
const webgpuIndexBuffer = this.indexBuffer;
|
|
1135
1148
|
if (webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.handle) {
|
|
1136
|
-
|
|
1149
|
+
import_core15.log.info(3, "setting index buffer", webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.handle, webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.indexType)();
|
|
1137
1150
|
webgpuRenderPass.handle.setIndexBuffer(
|
|
1138
1151
|
webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.handle,
|
|
1139
1152
|
// @ts-expect-error TODO - we must enforce type
|
|
@@ -1143,7 +1156,7 @@ var WebGPUVertexArray = class extends import_core14.VertexArray {
|
|
|
1143
1156
|
for (let location = 0; location < this.maxVertexAttributes; location++) {
|
|
1144
1157
|
const webgpuBuffer = this.attributes[location];
|
|
1145
1158
|
if (webgpuBuffer == null ? void 0 : webgpuBuffer.handle) {
|
|
1146
|
-
|
|
1159
|
+
import_core15.log.info(3, `setting vertex buffer ${location}`, webgpuBuffer == null ? void 0 : webgpuBuffer.handle)();
|
|
1147
1160
|
webgpuRenderPass.handle.setVertexBuffer(location, webgpuBuffer == null ? void 0 : webgpuBuffer.handle);
|
|
1148
1161
|
}
|
|
1149
1162
|
}
|
|
@@ -1161,8 +1174,8 @@ var WebGPUVertexArray = class extends import_core14.VertexArray {
|
|
|
1161
1174
|
};
|
|
1162
1175
|
|
|
1163
1176
|
// dist/adapter/webgpu-canvas-context.js
|
|
1164
|
-
var
|
|
1165
|
-
var WebGPUCanvasContext = class extends
|
|
1177
|
+
var import_core16 = require("@luma.gl/core");
|
|
1178
|
+
var WebGPUCanvasContext = class extends import_core16.CanvasContext {
|
|
1166
1179
|
device;
|
|
1167
1180
|
gpuCanvasContext;
|
|
1168
1181
|
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */
|
|
@@ -1219,7 +1232,7 @@ var WebGPUCanvasContext = class extends import_core15.CanvasContext {
|
|
|
1219
1232
|
colorSpace: this.props.colorSpace,
|
|
1220
1233
|
alphaMode: this.props.alphaMode
|
|
1221
1234
|
});
|
|
1222
|
-
|
|
1235
|
+
import_core16.log.log(1, `${this} Resized ${oldWidth}x${oldHeight} => ${newWidth}x${newHeight}px`)();
|
|
1223
1236
|
}
|
|
1224
1237
|
}
|
|
1225
1238
|
resize(options) {
|
|
@@ -1256,8 +1269,8 @@ var WebGPUCanvasContext = class extends import_core15.CanvasContext {
|
|
|
1256
1269
|
};
|
|
1257
1270
|
|
|
1258
1271
|
// dist/adapter/resources/webgpu-query-set.js
|
|
1259
|
-
var
|
|
1260
|
-
var WebGPUQuerySet = class extends
|
|
1272
|
+
var import_core17 = require("@luma.gl/core");
|
|
1273
|
+
var WebGPUQuerySet = class extends import_core17.QuerySet {
|
|
1261
1274
|
device;
|
|
1262
1275
|
handle;
|
|
1263
1276
|
constructor(device, props) {
|
|
@@ -1277,7 +1290,7 @@ var WebGPUQuerySet = class extends import_core16.QuerySet {
|
|
|
1277
1290
|
};
|
|
1278
1291
|
|
|
1279
1292
|
// dist/adapter/webgpu-device.js
|
|
1280
|
-
var WebGPUDevice = class extends
|
|
1293
|
+
var WebGPUDevice = class extends import_core18.Device {
|
|
1281
1294
|
/** type of this device */
|
|
1282
1295
|
type = "webgpu";
|
|
1283
1296
|
/** The underlying WebGPU device */
|
|
@@ -1315,7 +1328,7 @@ var WebGPUDevice = class extends import_core17.Device {
|
|
|
1315
1328
|
this._isLost = true;
|
|
1316
1329
|
resolve({ reason: "destroyed", message: lostInfo.message });
|
|
1317
1330
|
});
|
|
1318
|
-
const canvasContextProps =
|
|
1331
|
+
const canvasContextProps = import_core18.Device._getCanvasContextProps(props);
|
|
1319
1332
|
if (canvasContextProps) {
|
|
1320
1333
|
this.canvasContext = new WebGPUCanvasContext(this, this.adapter, canvasContextProps);
|
|
1321
1334
|
}
|
|
@@ -1441,7 +1454,7 @@ var WebGPUDevice = class extends import_core17.Device {
|
|
|
1441
1454
|
for (const feature of WEBGPU_ALWAYS_FEATURES) {
|
|
1442
1455
|
features.add(feature);
|
|
1443
1456
|
}
|
|
1444
|
-
return new
|
|
1457
|
+
return new import_core18.DeviceFeatures(Array.from(features), this.props._disabledFeatures);
|
|
1445
1458
|
}
|
|
1446
1459
|
_getDeviceSpecificTextureFormatCapabilities(capabilities) {
|
|
1447
1460
|
const { format } = capabilities;
|
|
@@ -1494,7 +1507,7 @@ var WebGPUDevice = class extends import_core17.Device {
|
|
|
1494
1507
|
};
|
|
1495
1508
|
|
|
1496
1509
|
// dist/adapter/webgpu-adapter.js
|
|
1497
|
-
var WebGPUAdapter = class extends
|
|
1510
|
+
var WebGPUAdapter = class extends import_core19.Adapter {
|
|
1498
1511
|
/** type of device's created by this adapter */
|
|
1499
1512
|
type = "webgpu";
|
|
1500
1513
|
constructor() {
|
|
@@ -1510,7 +1523,7 @@ var WebGPUAdapter = class extends import_core18.Adapter {
|
|
|
1510
1523
|
if (!navigator.gpu) {
|
|
1511
1524
|
throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");
|
|
1512
1525
|
}
|
|
1513
|
-
|
|
1526
|
+
import_core19.log.groupCollapsed(1, "WebGPUDevice created")();
|
|
1514
1527
|
const adapter = await navigator.gpu.requestAdapter({
|
|
1515
1528
|
powerPreference: "high-performance"
|
|
1516
1529
|
// forceSoftware: false
|
|
@@ -1520,7 +1533,7 @@ var WebGPUAdapter = class extends import_core18.Adapter {
|
|
|
1520
1533
|
}
|
|
1521
1534
|
const adapterInfo = adapter.info || // @ts-ignore Chrome has removed this function
|
|
1522
1535
|
await ((_a = adapter.requestAdapterInfo) == null ? void 0 : _a.call(adapter));
|
|
1523
|
-
|
|
1536
|
+
import_core19.log.probe(2, "Adapter available", adapterInfo)();
|
|
1524
1537
|
const requiredFeatures = [];
|
|
1525
1538
|
const requiredLimits = {};
|
|
1526
1539
|
if (props._requestMaxLimits) {
|
|
@@ -1538,11 +1551,11 @@ var WebGPUAdapter = class extends import_core18.Adapter {
|
|
|
1538
1551
|
requiredFeatures,
|
|
1539
1552
|
requiredLimits
|
|
1540
1553
|
});
|
|
1541
|
-
|
|
1554
|
+
import_core19.log.probe(1, "GPUDevice available")();
|
|
1542
1555
|
const device = new WebGPUDevice(props, gpuDevice, adapter, adapterInfo);
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1556
|
+
import_core19.log.probe(1, "Device created. For more info, set chrome://flags/#enable-webgpu-developer-features")();
|
|
1557
|
+
import_core19.log.table(1, device.info)();
|
|
1558
|
+
import_core19.log.groupEnd(1)();
|
|
1546
1559
|
return device;
|
|
1547
1560
|
}
|
|
1548
1561
|
async attach(handle) {
|