@luma.gl/core 9.0.17 → 9.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/adapter.d.ts +11 -0
- package/dist/adapter/adapter.d.ts.map +1 -0
- package/dist/adapter/adapter.js +8 -0
- package/dist/adapter/canvas-context.d.ts +5 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/device.d.ts +23 -11
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +22 -20
- package/dist/adapter/luma.d.ts +70 -0
- package/dist/adapter/luma.d.ts.map +1 -0
- package/dist/adapter/luma.js +159 -0
- package/dist/adapter/resources/buffer.js +5 -5
- package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +3 -0
- package/dist/adapter/resources/external-texture.d.ts +1 -1
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +3 -3
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +2 -83
- package/dist/adapter/resources/render-pass.d.ts +2 -2
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -5
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/resource.d.ts +3 -3
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +1 -1
- package/dist/adapter/resources/shader.d.ts +5 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +15 -9
- package/dist/adapter/resources/texture-view.d.ts +1 -1
- package/dist/adapter/resources/texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/texture.d.ts +144 -47
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +120 -12
- package/dist/adapter/resources/transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +1 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +6 -2
- package/dist/adapter/types/{types.d.ts → attachments.d.ts} +7 -17
- package/dist/adapter/types/attachments.d.ts.map +1 -0
- package/dist/adapter/types/buffer-layout.d.ts +1 -1
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
- package/dist/adapter/types/compiler-message.d.ts.map +1 -0
- package/dist/adapter/types/parameters.d.ts +4 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/parameters.js +1 -0
- package/dist/adapter/types/shader-layout.d.ts +23 -3
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/uniforms.d.ts +4 -0
- package/dist/adapter/types/uniforms.d.ts.map +1 -0
- package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
- package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
- package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
- package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
- package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
- package/dist/adapter-utils/is-uniform-value.js +7 -0
- package/dist/dist.dev.js +635 -821
- package/dist/dist.min.js +6 -6
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
- package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
- package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
- package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
- package/dist/gpu-type-utils/decode-texture-format.d.ts +43 -0
- package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +67 -31
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
- package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +3 -5
- package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
- package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
- package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/index.cjs +396 -567
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -37
- package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
- package/dist/portable/uniform-block.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
- package/dist/{lib/uniforms → portable}/uniform-store.d.ts +9 -4
- package/dist/portable/uniform-store.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +6 -7
- package/dist/utils/array-utils-flat.d.ts +1 -7
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +0 -23
- package/dist/utils/is-array.d.ts +3 -3
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +2 -2
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/{utils.js → uid.js} +0 -11
- package/package.json +5 -5
- package/src/adapter/adapter.ts +16 -0
- package/src/adapter/canvas-context.ts +6 -0
- package/src/adapter/device.ts +52 -36
- package/src/adapter/luma.ts +219 -0
- package/src/adapter/resources/buffer.ts +5 -5
- package/src/adapter/resources/command-encoder.ts +1 -1
- package/src/adapter/resources/compute-pass.ts +3 -3
- package/src/adapter/resources/compute-pipeline.ts +6 -3
- package/src/adapter/resources/external-texture.ts +2 -2
- package/src/adapter/resources/framebuffer.ts +5 -92
- package/src/adapter/resources/query-set.ts +2 -2
- package/src/adapter/resources/render-pass.ts +11 -7
- package/src/adapter/resources/render-pipeline.ts +3 -6
- package/src/adapter/resources/resource.ts +7 -7
- package/src/adapter/resources/shader.ts +18 -11
- package/src/adapter/resources/texture-view.ts +5 -5
- package/src/adapter/resources/texture.ts +285 -76
- package/src/adapter/resources/transform-feedback.ts +1 -1
- package/src/adapter/resources/vertex-array.ts +7 -3
- package/src/adapter/types/{types.ts → attachments.ts} +10 -18
- package/src/adapter/types/buffer-layout.ts +1 -1
- package/src/adapter/types/parameters.ts +14 -14
- package/src/adapter/types/shader-layout.ts +31 -29
- package/src/adapter/types/uniforms.ts +10 -0
- package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
- package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
- package/src/adapter-utils/is-uniform-value.ts +10 -0
- package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +99 -39
- package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
- package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +3 -14
- package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
- package/src/index.ts +67 -83
- package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
- package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
- package/src/{lib/uniforms → portable}/uniform-store.ts +20 -12
- package/src/types.ts +0 -12
- package/src/utils/array-equal.ts +6 -7
- package/src/utils/array-utils-flat.ts +1 -31
- package/src/utils/is-array.ts +5 -5
- package/src/utils/{utils.ts → uid.ts} +0 -12
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts +0 -23
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
- package/dist/adapter/types/accessor.d.ts +0 -23
- package/dist/adapter/types/accessor.d.ts.map +0 -1
- package/dist/adapter/types/shader-types.d.ts.map +0 -1
- package/dist/adapter/types/texture-formats.d.ts.map +0 -1
- package/dist/adapter/types/types.d.ts.map +0 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
- package/dist/init.d.ts +0 -5
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -37
- package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js +0 -29
- package/dist/lib/luma.d.ts +0 -38
- package/dist/lib/luma.d.ts.map +0 -1
- package/dist/lib/luma.js +0 -141
- package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.d.ts +0 -10
- package/dist/lib/uniforms/uniform.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.js +0 -20
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -10
- package/dist/utils/cast.d.ts +0 -3
- package/dist/utils/cast.d.ts.map +0 -1
- package/dist/utils/cast.js +0 -7
- package/dist/utils/check-props.d.ts +0 -7
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -36
- package/dist/utils/deep-equal.d.ts +0 -9
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/deep-equal.js +0 -50
- package/dist/utils/format-value.d.ts +0 -7
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -39
- package/dist/utils/load-file.d.ts +0 -35
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -74
- package/dist/utils/random.d.ts +0 -5
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -18
- package/dist/utils/request-animation-frame.d.ts +0 -3
- package/dist/utils/request-animation-frame.d.ts.map +0 -1
- package/dist/utils/request-animation-frame.js +0 -16
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -19
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.d.ts.map +0 -1
- package/src/adapter/types/accessor.ts +0 -37
- package/src/init.ts +0 -53
- package/src/lib/compiler-log/get-shader-info.ts +0 -42
- package/src/lib/luma.ts +0 -190
- package/src/lib/uniforms/uniform.ts +0 -31
- package/src/utils/assert.ts +0 -11
- package/src/utils/cast.ts +0 -8
- package/src/utils/check-props.ts +0 -82
- package/src/utils/deep-equal.ts +0 -51
- package/src/utils/format-value.ts +0 -47
- package/src/utils/load-file.ts +0 -91
- package/src/utils/random.ts +0 -21
- package/src/utils/request-animation-frame.ts +0 -19
- package/src/utils/stub-methods.ts +0 -29
- /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
- /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
- /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
- /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
- /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
- /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
package/dist/dist.min.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
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
|
-
"use strict";var __exports__=(()=>{var J=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Me=(r,t,e)=>t in r?J(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Ne=(r,t)=>{for(var e in t)J(r,e,{get:t[e],enumerable:!0})},Fe=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $e(t))!Ie.call(r,n)&&n!==e&&J(r,n,{get:()=>t[n],enumerable:!(o=Re(t,n))||o.enumerable});return r};var De=r=>Fe(J({},"__esModule",{value:!0}),r);var c=(r,t,e)=>(Me(r,typeof t!="symbol"?t+"":t,e),e);var _r={};Ne(_r,{Buffer:()=>m,CanvasContext:()=>F,CommandBuffer:()=>Y,CommandEncoder:()=>j,ComputePass:()=>W,ComputePipeline:()=>O,Device:()=>b,DeviceFeatures:()=>at,DeviceLimits:()=>it,ExternalTexture:()=>U,Framebuffer:()=>k,QuerySet:()=>Q,RenderPass:()=>V,RenderPipeline:()=>z,Resource:()=>u,Sampler:()=>H,Shader:()=>G,StatsManager:()=>I,Texture:()=>d,TextureView:()=>D,TransformFeedback:()=>K,UniformBlock:()=>L,UniformBufferLayout:()=>B,UniformStore:()=>dt,VERSION:()=>nt,VertexArray:()=>q,assert:()=>C,cancelAnimationFrame:()=>Le,cast:()=>xe,checkProps:()=>Te,decodeShaderAttributeType:()=>ft,decodeShaderUniformType:()=>lt,decodeTextureFormat:()=>oe,decodeVertexFormat:()=>X,deepEqual:()=>pt,fillArray:()=>de,formatCompilerLog:()=>ut,formatValue:()=>Ht,getAttributeInfosFromLayouts:()=>Mt,getDataTypeFromTypedArray:()=>Ut,getScratchArray:()=>me,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>ye,getVertexFormatFromAttribute:()=>be,glsl:()=>vr,isNumberArray:()=>g,isObjectEmpty:()=>te,isTypedArray:()=>yt,isUniformValue:()=>Gt,loadFile:()=>Ee,loadImage:()=>_e,loadImageBitmap:()=>ve,loadScript:()=>Pe,log:()=>l,luma:()=>A,makeRandomNumberGenerator:()=>kt,mergeShaderLayout:()=>fe,random:()=>Ce,requestAnimationFrame:()=>Be,setPathPrefix:()=>Ae,splitUniformsAndBindings:()=>we,stubRemovedMethods:()=>Se,uid:()=>w});var tt=globalThis,Ue=globalThis.document||{},et=globalThis.process||{},Ge=globalThis.console,Cr=globalThis.navigator||{};function Ot(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,e=r||t;return Boolean(e&&e.indexOf("Electron")>=0)}function h(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ot()}var gt="4.0.7";function ke(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var rt=class{constructor(t,e,o="sessionStorage"){this.storage=ke(o),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function Wt(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function jt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var ot;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ot||(ot={}));var ze=10;function Yt(r){return typeof r!="string"?r:(r=r.toUpperCase(),ot[r]||ot.WHITE)}function Xt(r,t,e){return!h&&typeof r=="string"&&(t&&(r=`\x1B[${Yt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Yt(e)+ze}m${r}\x1B[49m`)),r}function qt(r,t=["constructor"]){let e=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(e),n=r;for(let s of o){let i=n[s];typeof i=="function"&&(t.find(a=>s===a)||(n[s]=i.bind(r)))}}function R(r,t){if(!r)throw new Error(t||"Assertion failed")}function S(){let r;if(h()&&tt.performance)r=tt?.performance?.now?.();else if("hrtime"in et){let t=et?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var E={debug:h()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ve={enabled:!0,level:0};function v(){}var Kt={},Qt={once:!0},x=class{constructor({id:t}={id:""}){this.VERSION=gt,this._startTs=S(),this._deltaTs=S(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new rt(`__probe-${this.id}__`,Ve),this.timeStamp(`${this.id} started`),qt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((S()-this._startTs).toPrecision(10))}getDelta(){return Number((S()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){if(!t)throw new Error(e||"Assertion failed")}warn(t){return this._getLogFunction(0,t,E.warn,arguments,Qt)}error(t){return this._getLogFunction(0,t,E.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,E.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,E.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,E.debug||E.info,arguments,Qt)}table(t,e,o){return e?this._getLogFunction(t,e,console.table||v,o&&[o],{tag:We(e)}):v}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||v)}group(t,e,o={collapsed:!1}){let n=Zt({logLevel:t,message:e,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e,o={}){return this.group(t,e,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||v)}withGroup(t,e,o){this.group(t,e)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Jt(t)}_getLogFunction(t,e,o,n,s){if(this._shouldLog(t)){s=Zt({logLevel:t,message:e,args:n,opts:s}),o=o||s.method,R(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=S();let i=s.tag||s.message;if(s.once&&i)if(!Kt[i])Kt[i]=S();else return v;return e=Oe(this.id,s.message,s),o.bind(console,e,...s.args)}return v}};x.VERSION=gt;function Jt(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return R(Number.isFinite(t)&&t>=0),t}function Zt(r){let{logLevel:t,message:e}=r;r.logLevel=Jt(t);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&o.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return R(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Oe(r,t,e){if(typeof t=="string"){let o=e.time?jt(Wt(e.total)):"";t=e.time?`${r}: ${o} ${t}`:`${r}: ${t}`,t=Xt(t,e.color,e.background)}return t}function We(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var Jr=new x({id:"@probe.gl/log"});var l=new x({id:"luma.gl"});function $(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var T=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=$(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime($()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var _=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:o}=t,n=this.stats[e];return n||(t instanceof T?n=t:n=new T(e,o),this.stats[e]=n),n}};var I=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new _({id:t})),this.stats.get(t)}},P=new I;function je(){let r="9.0.17",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==r)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${r}`);return globalThis.luma||(h()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:P}),r}var nt=je();function yt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function g(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:yt(r)}var bt={};function w(r="id"){bt[r]=bt[r]||1;let t=bt[r]++;return`${r}-${t}`}function te(r){let t=!0;for(let e in r){t=!1;break}return t}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,o){if(!t)throw new Error("no device");this._device=t,this.props=Ye(e,o);let n=this.props.id!=="undefined"?this.props.id:w(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(t),o.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};c(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ye(r,t){let e={...t};for(let o in r)r[o]!==void 0&&(e[o]=r[o]);return e}var M=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let o={...e};(e.usage||0)&M.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?o.indexType="uint32":e.data instanceof Uint16Array&&(o.indexType="uint16")),super(t,o,M.defaultProps),this.usage=e.usage||0,this.indexType=o.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,o){let n=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:o,M.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&o===t.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(e,e+s)}},m=M;c(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),c(m,"MAP_READ",1),c(m,"MAP_WRITE",2),c(m,"COPY_SRC",4),c(m,"COPY_DST",8),c(m,"INDEX",16),c(m,"VERTEX",32),c(m,"UNIFORM",64),c(m,"STORAGE",128),c(m,"INDIRECT",256),c(m,"QUERY_RESOLVE",512),c(m,"DEBUG_DATA_MAX_LENGTH",32);function st(r){let t=ee[r],e=Xe(t),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:ee[r],byteLength:e,integer:n,signed:s,normalized:o}}function Xe(r){return qe[r]}var ee={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},qe={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Ke=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Qe=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function re(r){return Ke.some(t=>r.startsWith(t))}function oe(r){let t=Qe.exec(r);if(t){let[,e,o,n,s,i]=t;if(e){let a=`${n}${o}`,f=st(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return Je(r)}var Ze={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Je(r){let t=Ze[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var it=class{},at=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},xt=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...xt.defaultProps,...t},this.id=this.props.id||w(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=P;_lumaData={};isTextureFormatCompressed(t){return re(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},b=xt;c(b,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")||l.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),c(b,"VERSION",nt);function C(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var N=new Map,wt=class{static registerDevices(t){for(let e of t)C(e.type&&e.isSupported&&e.create),N.set(e.type,e)}static getAvailableDevices(){return Array.from(N).map(t=>t.type)}static getSupportedDevices(){return Array.from(N).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(b.defaultProps,t)}static async attachDevice(t){let e=ne(t.devices)||N;if(t.handle instanceof WebGL2RenderingContext){let o=e.get("webgl");if(o)return await o.attach(t.handle)}if(t.handle===null){let o=e.get("unknown");if(o)return await o.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(t={}){t={...wt.defaultProps,...t},t.gl&&(t.type="webgl");let e=ne(t.devices)||N;switch(t.type){case"webgpu":let o=e.get("webgpu");if(o)return await o.create(t);break;case"webgl":let n=e.get("webgl");if(n)return await n.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(o=e.get("webgpu"),o?.isSupported?.())return await o.create(t);if(n=e.get("webgl"),n?.isSupported?.())return await n.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(o,n){return o==="webgl"||o==="experimental-webgl"?this.originalGetContext("webgl2",n):this.originalGetContext(o,n)}}},A=wt;c(A,"defaultProps",{...b.defaultProps,type:"best-available",devices:void 0}),c(A,"stats",P),c(A,"log",l);function ne(r){if(!r||r?.length===0)return null;let t=new Map;for(let e of r)t.set(e.type,e);return t}var tr=h()&&typeof document<"u",ct=()=>tr&&document.readyState==="complete",er={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},F=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ct()}constructor(t){if(this.props={...er,...t},t=this.props,!h()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=nr(t.canvas):this.canvas=t.canvas;else{let e=sr(t),o=or(t?.container||null);o.insertBefore(e,o.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let o of e)o.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ir(t,o,n,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let o="width"in e?e.width:this.htmlCanvas.clientWidth,n="height"in e?e.height:this.htmlCanvas.clientHeight;(!o||!n)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==t){let i=t,a=Math.floor(o*i),f=Math.floor(n*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[p,y]=this.getDrawingBufferSize();(p!==a||y!==f)&&(i=Math.min(p/o,y/n),this.htmlCanvas.width=Math.floor(o*i),this.htmlCanvas.height=Math.floor(n*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};c(F,"pageLoaded",rr());function rr(){return ct()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function or(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function nr(r){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function sr(r){let{width:t,height:e}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=t||1,o.height=e||1,o.style.width=Number.isFinite(t)?`${t}px`:"100%",o.style.height=Number.isFinite(e)?`${e}px`:"100%",o}function ir(r,t,e,o,n){let s=r,i=se(s[0],t,e),a=ie(s[1],t,o,n),f=se(s[0]+1,t,e),p=f===e-1?f:f-1;f=ie(s[1]+1,t,o,n);let y;return n?(f=f===0?f:f+1,y=a,a=f):y=f===o-1?f:f-1,{x:i,y:a,width:Math.max(p-i+1,1),height:Math.max(y-a+1,1)}}function se(r,t,e){return Math.min(Math.round(r*t),e-1)}function ie(r,t,e,o){return o?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var St=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,o=St.defaultProps){super(t,e,o),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=t.incrementTimestamp()}},d=St;c(d,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),c(d,"COPY_SRC",1),c(d,"COPY_DST",2),c(d,"TEXTURE_BINDING",4),c(d,"STORAGE_BINDING",8),c(d,"RENDER_ATTACHMENT",16);var Tt=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,Tt.defaultProps)}},D=Tt;c(D,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var At=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,At.defaultProps)}},U=At;c(U,"defaultProps",{...u.defaultProps,source:null,colorSpace:"srgb"});function ut(r,t,e){let o="",n=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=n.length;a++)for(o+=ce(n[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];o+=ae(f,n,f.lineNum,{...e,inlineSource:!1})}return o;case"issues":case"no":for(let a of r)o+=ae(a,n,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return o}}function ae(r,t,e,o){if(o?.inlineSource){let n=ar(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
|
|
7
|
+
"use strict";var __exports__=(()=>{var X=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ft=Object.prototype.hasOwnProperty;var lt=(r,e,t)=>e in r?X(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var dt=(r,e)=>{for(var t in e)X(r,t,{get:e[t],enumerable:!0})},ht=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ut(e))!ft.call(r,n)&&n!==t&&X(r,n,{get:()=>e[n],enumerable:!(s=ct(e,n))||s.enumerable});return r};var mt=r=>ht(X({},"__esModule",{value:!0}),r);var a=(r,e,t)=>(lt(r,typeof e!="symbol"?e+"":e,t),t);var er={};dt(er,{Adapter:()=>oe,Buffer:()=>d,CanvasContext:()=>R,CommandBuffer:()=>V,CommandEncoder:()=>G,ComputePass:()=>z,ComputePipeline:()=>k,Device:()=>T,DeviceFeatures:()=>re,DeviceLimits:()=>te,ExternalTexture:()=>D,Framebuffer:()=>N,QuerySet:()=>Y,RenderPass:()=>H,RenderPipeline:()=>U,Resource:()=>c,Sampler:()=>F,Shader:()=>$,Texture:()=>h,TextureView:()=>I,TransformFeedback:()=>j,UniformBlock:()=>L,UniformBufferLayout:()=>_,UniformStore:()=>fe,VertexArray:()=>O,decodeShaderAttributeType:()=>ae,decodeShaderUniformType:()=>ce,decodeTextureFormat:()=>Oe,decodeVertexFormat:()=>W,getAttributeInfosFromLayouts:()=>_e,getDataTypeFromTypedArray:()=>Re,getScratchArray:()=>rt,getTypedArrayFromDataType:()=>it,getVertexFormatFromAttribute:()=>at,log:()=>l,luma:()=>Ye});function C(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var x=class{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=C(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(C()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var S=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:s}=e,n=this.stats[t];return n||(e instanceof x?n=e:n=new x(t,s),this.stats[t]=n),n}};var le=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new S({id:e})),this.stats.get(e)}},Z=new le;var q=globalThis,pt=globalThis.document||{},K=globalThis.process||{},gt=globalThis.console,hr=globalThis.navigator||{};function De(r){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=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function p(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||De()}var de="4.0.7";function bt(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var Q=class{constructor(e,t,s="sessionStorage"){this.storage=bt(s),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function $e(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Fe(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var J;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(J||(J={}));var xt=10;function Ne(r){return typeof r!="string"?r:(r=r.toUpperCase(),J[r]||J.WHITE)}function Ue(r,e,t){return!p&&typeof r=="string"&&(e&&(r=`\x1B[${Ne(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${Ne(t)+xt}m${r}\x1B[49m`)),r}function He(r,e=["constructor"]){let t=Object.getPrototypeOf(r),s=Object.getOwnPropertyNames(t),n=r;for(let o of s){let i=n[o];typeof i=="function"&&(e.find(u=>o===u)||(n[o]=i.bind(r)))}}function B(r,e){if(!r)throw new Error(e||"Assertion failed")}function w(){let r;if(p()&&q.performance)r=q?.performance?.now?.();else if("hrtime"in K){let e=K?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var A={debug:p()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},wt={enabled:!0,level:0};function v(){}var ke={},ze={once:!0},y=class{constructor({id:e}={id:""}){this.VERSION=de,this._startTs=w(),this._deltaTs=w(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Q(`__probe-${this.id}__`,wt),this.timeStamp(`${this.id} started`),He(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((w()-this._startTs).toPrecision(10))}getDelta(){return Number((w()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,A.warn,arguments,ze)}error(e){return this._getLogFunction(0,e,A.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,A.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,A.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,A.debug||A.info,arguments,ze)}table(e,t,s){return t?this._getLogFunction(e,t,console.table||v,s&&[s],{tag:St(t)}):v}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||v)}group(e,t,s={collapsed:!1}){let n=Ge({logLevel:e,message:t,opts:s}),{collapsed:o}=s;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,s={}){return this.group(e,t,Object.assign({},s,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||v)}withGroup(e,t,s){this.group(e,t)();try{s()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Ve(e)}_getLogFunction(e,t,s,n,o){if(this._shouldLog(e)){o=Ge({logLevel:e,message:t,args:n,opts:o}),s=s||o.method,B(s),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=w();let i=o.tag||o.message;if(o.once&&i)if(!ke[i])ke[i]=w();else return v;return t=Tt(this.id,o.message,o),s.bind(console,t,...o.args)}return v}};y.VERSION=de;function Ve(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return B(Number.isFinite(e)&&e>=0),e}function Ge(r){let{logLevel:e,message:t}=r;r.logLevel=Ve(e);let s=r.args?Array.from(r.args):[];for(;s.length&&s.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&s.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return B(n==="string"||n==="object"),Object.assign(r,{args:s},r.opts)}function Tt(r,e,t){if(typeof e=="string"){let s=t.time?Fe($e(t.total)):"";e=t.time?`${r}: ${s} ${e}`:`${r}: ${e}`,e=Ue(e,t.color,t.background)}return e}function St(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var Ur=new y({id:"@probe.gl/log"});var l=new y({id:"luma.gl"});var he={};function E(r="id"){he[r]=he[r]||1;let e=he[r]++;return`${r}-${e}`}var c=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,s){if(!e)throw new Error("no device");this._device=e,this.props=At(t,s);let n=this.props.id!=="undefined"?this.props.id:E(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let s=this._device.statsManager.getStats("Resource Counts");s.get("GPU Memory").addCount(e),s.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};a(c,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function At(r,e){let t={...e};for(let s in r)r[s]!==void 0&&(t[s]=r[s]);return t}var M=class extends c{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let s={...t};(t.usage||0)&M.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?s.indexType="uint32":t.data instanceof Uint16Array&&(s.indexType="uint16")),super(e,s,M.defaultProps),this.usage=t.usage||0,this.indexType=s.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,t){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,t,s){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:s,M.DEBUG_DATA_MAX_LENGTH);n===null?this.debugData=new ArrayBuffer(o):t===0&&s===n.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(t,t+o)}},d=M;a(d,"defaultProps",{...c.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),a(d,"MAP_READ",1),a(d,"MAP_WRITE",2),a(d,"COPY_SRC",4),a(d,"COPY_DST",8),a(d,"INDEX",16),a(d,"VERTEX",32),a(d,"UNIFORM",64),a(d,"STORAGE",128),a(d,"INDIRECT",256),a(d,"QUERY_RESOLVE",512),a(d,"DEBUG_DATA_MAX_LENGTH",32);function ee(r){let e=We[r],t=vt(e),s=r.includes("norm"),n=!s&&!r.startsWith("float"),o=r.startsWith("s");return{dataType:We[r],byteLength:t,integer:n,signed:o,normalized:s}}function vt(r){return Et[r]}var We={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Et={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Pt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],_t=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function me(r){return Pt.some(e=>r.startsWith(e))}function Oe(r){let e=_t.exec(r);if(e){let[,t,s,n,o,i]=e;if(r){let u=`${n}${s}`,f=ee(u),m={channels:t,components:t.length,bitsPerChannel:f.byteLength*8,bytesPerPixel:f.byteLength*t.length,dataType:f.dataType,integer:f.integer,signed:f.signed,normalized:f.normalized};return i==="-webgl"&&(m.webgl=!0),o==="-srgb"&&(m.srgb=!0),m}}return Ct(r)}var Lt={"rgba4unorm-webgl":{channels:"rgba",bytesPerPixel:2,packed:!0},"rgb565unorm-webgl":{channels:"rgb",bytesPerPixel:2,packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bytesPerPixel:2,packed:!0},rgb9e5ufloat:{channels:"rgb",bytesPerPixel:4,packed:!0},rg11b10ufloat:{channels:"rgb",bytesPerPixel:4,packed:!0},rgb10a2unorm:{channels:"rgba",bytesPerPixel:4,packed:!0},"rgb10a2uint-webgl":{channels:"rgba",bytesPerPixel:4,packed:!0},stencil8:{components:1,bytesPerPixel:1,a:"stencil",dataType:"uint8"},depth16unorm:{components:1,bytesPerPixel:2,a:"depth",dataType:"uint16"},depth24plus:{components:1,bytesPerPixel:3,a:"depth",dataType:"uint32"},depth32float:{components:1,bytesPerPixel:4,a:"depth",dataType:"float32"},"depth24plus-stencil8":{components:2,bytesPerPixel:4,a:"depth-stencil",packed:!0},"depth32float-stencil8":{components:2,bytesPerPixel:4,a:"depth-stencil",packed:!0}};function Ct(r){if(me(r)){let s={channels:"rgb",components:3,bytesPerPixel:1,srgb:!1,compressed:!0},n=Bt(r);return n&&(s.blockWidth=n.blockWidth,s.blockHeight=n.blockHeight),s}let e=Lt[r];if(!e)throw new Error(`Unknown format ${r}`);let t={...e,channels:e.channels||"",components:e.components||e.channels?.length||1,bytesPerPixel:e.bytesPerPixel||1,srgb:!1};return e.packed&&(t.packed=e.packed),t}function Bt(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,s,n]=t;return{blockWidth:Number(s),blockHeight:Number(n)}}return null}var te=class{},re=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},pe=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...pe.defaultProps,...e},this.id=this.props.id||E(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=Z;_lumaData={};isTextureFormatCompressed(e){return me(e)}loseDevice(){return!1}error(e){this.props.onError(e)}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};return(e.usage||0)&d.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":l.warn("indices buffer content must be of integer type")()),t}},T=pe;a(T,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,onError:e=>l.error(e.message),gl:null,debug:Boolean(l.get("debug")),break:l.get("break")||[],debugWithSpectorJS:void 0,spectorUrl:void 0,initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},_factoryDestroyPolicy:"unused"});var Mt="set luma.log.level=1 (or higher) to trace rendering",je="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",ne=class{stats=Z;log=l;VERSION="9.1.0-alpha.10";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw l.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),l.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");l.error("This version of luma.gl has already been initialized")()}l.log(1,`${this.VERSION} - ${Mt}`)(),globalThis.luma=this}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this.getAdapterMap(e);return Array.from(t).map(([,s])=>s).filter(s=>s.isSupported?.()).map(s=>s.type)}getBestAvailableAdapter(e=[]){let t=this.getAdapterMap(e);return t.get("webgpu")?.isSupported?.()?"webgpu":t.get("webgl")?.isSupported?.()?"webgl":null}setDefaultDeviceProps(e){Object.assign(ne.defaultProps,e)}async createDevice(e={}){e={...ne.defaultProps,...e};let t=this.getAdapterMap(e.adapters),s=e.type||"";s==="best-available"&&(s=this.getBestAvailableAdapter(e.adapters)||s);let i=await(this.getAdapterMap(e.adapters)||t).get(s)?.create?.(e);if(i)return i;throw new Error(je)}async attachDevice(e){let t=this.getAdapterMap(e.adapters),s="";e.handle instanceof WebGL2RenderingContext&&(s="webgl"),e.handle===null&&(s="unknown");let o=await t.get(s)?.attach?.(null);if(o)return o;throw new Error(je)}enforceWebGL2(e=!0,t=[]){let n=this.getAdapterMap(t).get("webgl");n||l.warn("enforceWebGL2: webgl adapter not found")(),n?.enforceWebGL2?.(e)}getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let s of e)t.set(s.type,s);return t}registerDevices(e){l.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(let t of e){let s=t.adapter;s&&this.preregisteredAdapters.set(s.type,s)}}},se=ne;a(se,"defaultProps",{...T.defaultProps,type:"best-available",adapters:void 0});var Ye=new se;var oe=class{};var Rt=p()&&typeof document<"u",ie=()=>Rt&&document.readyState==="complete",It={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},R=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ie()}constructor(e){if(this.props={...It,...e},e=this.props,!p()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Ft(e.canvas):this.canvas=e.canvas;else{let t=Nt(e),s=$t(e?.container||null);s.insertBefore(t,s.firstChild),this.canvas=t,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(t=>{for(let s of t)s.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),t=this.canvas;return t.parentElement?[t.clientWidth*e,t.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,t]=this.getPixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:t}=this._canvasSizeInfo;return t?e/t:1}catch{return 1}}cssToDevicePixels(e,t=!0){let s=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return Ut(e,s,n,o,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let s="width"in t?t.width:this.htmlCanvas.clientWidth,n="height"in t?t.height:this.htmlCanvas.clientHeight;(!s||!n)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,s=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==s||o.clientHeight!==n||o.devicePixelRatio!==e){let i=e,u=Math.floor(s*i),f=Math.floor(n*i);this.htmlCanvas.width=u,this.htmlCanvas.height=f;let[m,g]=this.getDrawingBufferSize();(m!==u||g!==f)&&(i=Math.min(m/s,g/n),this.htmlCanvas.width=Math.floor(s*i),this.htmlCanvas.height=Math.floor(n*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=s,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};a(R,"pageLoaded",Dt());function Dt(){return ie()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function $t(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e&&!ie())throw new Error(`Accessing '${r}' before page was loaded`);if(!e)throw new Error(`${r} is not an HTML element`);return e}else if(r)return r;return document.body}function Ft(r){let e=document.getElementById(r);if(!e&&!ie())throw new Error(`Accessing '${r}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function Nt(r){let{width:e,height:t}=r,s=document.createElement("canvas");return s.id="lumagl-auto-created-canvas",s.width=e||1,s.height=t||1,s.style.width=Number.isFinite(e)?`${e}px`:"100%",s.style.height=Number.isFinite(t)?`${t}px`:"100%",s}function Ut(r,e,t,s,n){let o=r,i=Xe(o[0],e,t),u=Ze(o[1],e,s,n),f=Xe(o[0]+1,e,t),m=f===t-1?f:f-1;f=Ze(o[1]+1,e,s,n);let g;return n?(f=f===0?f:f+1,g=u,u=f):g=f===s-1?f:f-1,{x:i,y:u,width:Math.max(m-i+1,1),height:Math.max(g-u+1,1)}}function Xe(r,e,t){return Math.min(Math.round(r*e),t-1)}function Ze(r,e,t,s){return s?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var b=class extends c{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;mipLevels;updateTimestamp;static isExternalImage(e){return typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof VideoFrame<"u"&&e instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}static getExternalImageSize(e){if(typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if(typeof VideoFrame<"u"&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(e){let t=e?.data;return ArrayBuffer.isView(t)}static getTextureDataSize(e){if(!e||ArrayBuffer.isView(e))return null;if(Array.isArray(e))return b.getTextureDataSize(e[0]);if(b.isExternalImage(e))return b.getExternalImageSize(e);if(e&&typeof e=="object"&&e.constructor===Object){let s=Object.values(e)[0];return{width:s.width,height:s.height}}throw new Error("texture size deduction failed")}static getMipLevelCount(e,t){return Math.floor(Math.log2(Math.max(e,t)))+1}static getCubeFaceDepth(e){switch(e){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(e)}}constructor(e,t){if(super(e,t,b.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.props.width===void 0||this.props.height===void 0){let s=b.getTextureDataSize(this.props.data);this.width=s?.width||1,this.height=s?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?b.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=e.incrementTimestamp()}},h=b;a(h,"COPY_SRC",1),a(h,"COPY_DST",2),a(h,"TEXTURE",4),a(h,"STORAGE",8),a(h,"RENDER_ATTACHMENT",16),a(h,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),a(h,"defaultProps",{...c.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0}),a(h,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1});var ge=class extends c{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,ge.defaultProps)}},I=ge;a(I,"defaultProps",{...c.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var ye=class extends c{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,ye.defaultProps)}},D=ye;a(D,"defaultProps",{...c.defaultProps,source:void 0,colorSpace:"srgb"});function Ke(r,e,t){let s="",n=e.split(/\r?\n/),o=r.slice().sort((i,u)=>i.lineNum-u.lineNum);switch(t?.showSourceCode||"no"){case"all":let i=0;for(let u=1;u<=n.length;u++)for(s+=Qe(n[u-1],u,t);o.length>i&&o[i].lineNum===u;){let f=o[i++];s+=qe(f,n,f.lineNum,{...t,inlineSource:!1})}return s;case"issues":case"no":for(let u of r)s+=qe(u,n,u.lineNum,{inlineSource:t?.showSourceCode!=="no"});return s}}function qe(r,e,t,s){if(s?.inlineSource){let n=Ht(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
|
|
8
8
|
`:"";return`
|
|
9
|
-
${n}${
|
|
9
|
+
${n}${o}${r.type.toUpperCase()}: ${r.message}
|
|
10
10
|
|
|
11
|
-
`}return
|
|
12
|
-
`}`}function
|
|
13
|
-
<h1>Shader Compilation Error in ${
|
|
11
|
+
`}return s?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function Ht(r,e,t){let s="";for(let n=e-2;n<=e;n++){let o=r[n-1];o!==void 0&&(s+=Qe(o,e,t))}return s}function Qe(r,e,t){let s=t?.html?zt(r):r;return`${kt(String(e),4)}: ${s}${t?.html?"<br/>":`
|
|
12
|
+
`}`}function kt(r,e){let t="";for(let s=r.length;s<e;++s)t+=" ";return t+r}function zt(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var be=class extends c{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){super(e,{id:Gt(t),...t},be.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(e=this.props.debug){switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();this.props.debug==="warnings"&&t?.length===0||this._displayShaderLog(t)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let t=Je(this.source),s=`${this.stage} ${t}`,n=Ke(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(n+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let i=document.createElement("Button");i.innerHTML=`
|
|
13
|
+
<h1>Shader Compilation Error in ${s}</h1><br /><br />
|
|
14
14
|
<code style="user-select:text;"><pre>
|
|
15
15
|
${n}
|
|
16
|
-
</pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i);let a=document.getElementsByClassName("luma-compiler-log-error");a[0]?.scrollIntoView&&a[0].scrollIntoView(),i.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}},G=vt;c(G,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function mr(r){return Et(r.source).name||r.id||w(`unnamed ${r.stage}-shader`)}var _t=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(t,e){super(t,e,_t.defaultProps)}},H=_t;c(H,"defaultProps",{...u.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var Pt=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(t,e={}){super(t,e,Pt.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(t){let e=!t;if(t){let[o,n]=Array.isArray(t)?t:[t.width,t.height];e=e||n!==this.height||o!==this.width,this.width=o,this.height=n}e&&(l.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(e=>{if(typeof e=="string"){let o=this.createColorTexture(e);return this.attachResource(o),o.view}return e instanceof d?e.view:e});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let e=this.createDepthStencilTexture(t);this.attachResource(e),this.depthStencilAttachment=e.view}else t instanceof d?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t){return this.device.createTexture({id:"color-attachment",usage:d.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}createDepthStencilTexture(t){return this.device.createTexture({id:"depth-stencil-attachment",usage:d.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,e){for(let o=0;o<this.colorAttachments.length;++o)if(this.colorAttachments[o]){let n=this.device._createTexture({...this.colorAttachments[o].props,width:t,height:e});this.destroyAttachedResource(this.colorAttachments[o]),this.colorAttachments[o]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let o=this.device._createTexture({...this.depthStencilAttachment.props,width:t,height:e});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}}},k=Pt;c(k,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ct=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,e){super(t,e,Ct.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}},z=Ct;c(z,"defaultProps",{...u.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var Bt=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,e){super(t,e,Bt.defaultProps)}},V=Bt;c(V,"defaultProps",{...u.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Lt=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(t,e){super(t,e,Lt.defaultProps)}},O=Lt;c(O,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Rt=class extends u{get[Symbol.toStringTag](){return"ComputePass"}constructor(t,e){super(t,e,Rt.defaultProps)}},W=Rt;c(W,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var $t=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,e){super(t,e,$t.defaultProps)}},j=$t;c(j,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var It=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,e){super(t,e,It.defaultProps)}},Y=It;c(Y,"defaultProps",{...u.defaultProps});function ft(r){let[t,e]=hr[r],o=t==="i32"||t==="u32",n=t!=="u32",s=pr[t]*e,i=dr(t,e);return{dataType:t,components:e,defaultVertexFormat:i,byteLength:s,integer:o,signed:n}}function dr(r,t){let e;switch(r){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?e:`${e}x${t}`}var hr={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},pr={f32:4,f16:2,i32:4,u32:4};function X(r){let t;r.endsWith("-webgl")&&(r.replace("-webgl",""),t=!0);let[e,o]=r.split("x"),n=e,s=o?parseInt(o):1,i=st(n),a={type:n,components:s,byteLength:i.byteLength*s,integer:i.integer,signed:i.signed,normalized:i.normalized};return t&&(a.webglOnly=!0),a}function Mt(r,t){let e={};for(let o of r.attributes)e[o.name]=gr(r,t,o.name);return e}function ue(r,t,e=16){let o=Mt(r,t),n=new Array(e).fill(null);for(let s of Object.values(o))n[s.location]=s;return n}function gr(r,t,e){let o=yr(r,e),n=br(t,e);if(!o)return null;let s=ft(o.type),i=n?.vertexFormat||s.defaultVertexFormat,a=X(i);return{attributeName:n?.attributeName||o.name,bufferName:n?.bufferName||o.name,location:o.location,shaderType:o.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:i,bufferDataType:a.type,bufferComponents:a.components,normalized:a.normalized,integer:s.integer,stepMode:n?.stepMode||o.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function yr(r,t){let e=r.attributes.find(o=>o.name===t);return e||l.warn(`shader layout attribute "${t}" not present in shader`),e||null}function br(r,t){xr(r);let e=wr(r,t);return e||(e=Sr(r,t),e)?e:(l.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function xr(r){for(let t of r)(t.attributes&&t.format||!t.attributes&&!t.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function wr(r,t){for(let e of r)if(e.format&&e.name===t)return{attributeName:e.name,bufferName:t,stepMode:e.stepMode,vertexFormat:e.format,byteOffset:0,byteStride:e.byteStride||0};return null}function Sr(r,t){for(let e of r){let o=e.byteStride;if(typeof e.byteStride!="number")for(let s of e.attributes||[]){let i=X(s.format);o+=i.byteLength}let n=e.attributes?.find(s=>s.attribute===t);if(n)return{attributeName:n.attribute,bufferName:e.name,stepMode:e.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:o}}return null}function fe(r,t){let e={...r,attributes:r.attributes.map(o=>({...o}))};for(let o of t?.attributes||[]){let n=e.attributes.find(s=>s.name===o.name);n?(n.type=o.type||n.type,n.stepMode=o.stepMode||n.stepMode):l.warn(`shader layout attribute ${o.name} not present in shader`)}return e}var Nt=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,e){super(t,e,Nt.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ue(e.renderPipeline.shaderLayout,e.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,e){throw new Error("constant attributes not supported")}},q=Nt;c(q,"defaultProps",{...u.defaultProps,renderPipeline:null});var Ft=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,e){super(t,e,Ft.defaultProps)}},K=Ft;c(K,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var Dt=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,e){super(t,e,Dt.defaultProps)}},Q=Dt;c(Q,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var Tr={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function lt(r){let t=Tr[r];return C(r),t}function le(r,t){switch(t){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var mt;function Z(r){return(!mt||mt.byteLength<r)&&(mt=new ArrayBuffer(r)),mt}function me(r,t){let e=Z(r.BYTES_PER_ELEMENT*t);return new r(e,0,t)}function de(r){let{target:t,source:e,start:o=0,count:n=1}=r,s=e.length,i=n*s,a=0;for(let f=o;a<s;a++)t[f++]=e[a];for(;a<i;)a<i-a?(t.copyWithin(o+a,o,o+a),a*=2):(t.copyWithin(o+a,o,o+i-a),a=i);return r.target}var he=1024,B=class{layout={};byteLength;constructor(t){let e=0;for(let[n,s]of Object.entries(t)){let i=lt(s),{type:a,components:f}=i;e=le(e,f);let p=e;e+=f,this.layout[n]={type:a,size:f,offset:p}}e+=(4-e%4)%4;let o=e*4;this.byteLength=Math.max(o,he)}getData(t){let e=Math.max(this.byteLength,he),o=Z(e),n={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)};for(let[s,i]of Object.entries(t)){let a=this.layout[s];if(!a){l.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:f,size:p,offset:y}=a,zt=n[f];if(p===1){if(typeof i!="number"&&typeof i!="boolean"){l.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}zt[y]=Number(i)}else{let Vt=g(i);if(!Vt){l.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}zt.set(Vt,y)}}return new Uint8Array(o)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}};function pe(r,t,e=16){if(r!==t)return!1;let o=g(r);if(!o)return!1;let n=g(t);if(n&&o.length===n.length){for(let s=0;s<o.length;++s)if(n[s]!==o[s])return!1}return!0}function ge(r){let t=g(r);return t?t.slice():r}var L=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name,t?.name&&t?.shaderLayout){let e=t?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===t?.name);if(!e)throw new Error(t?.name);let o=e;for(let n of o.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(t){for(let[e,o]of Object.entries(t))this._setUniform(e,o),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${e}=${o}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,e){pe(this.uniforms[t],e)||(this.uniforms[t]=ge(e),this.modifiedUniforms[t]=!0,this.modified=!0)}};var dt=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[e,o]of Object.entries(t)){let n=e,s=new B(o.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let i=new L({name:e});i.setUniforms(o.defaultUniforms||{}),this.uniformBlocks.set(n,i)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[e,o]of Object.entries(t))this.uniformBlocks.get(e).setUniforms(o);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t).byteLength}getUniformBufferData(t){let e=this.uniformBlocks.get(t).getAllUniforms();return this.uniformBufferLayouts.get(t).getData(e)}createUniformBuffer(t,e,o){o&&this.setUniforms(o);let n=this.getUniformBufferByteLength(e),s=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n}),i=this.getUniformBufferData(e);return s.write(i),s}getManagedUniformBuffer(t,e){if(!this.uniformBuffers.get(e)){let o=this.getUniformBufferByteLength(e),n=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:o});this.uniformBuffers.set(e,n)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let t=!1;for(let e of this.uniformBlocks.keys()){let o=this.updateUniformBuffer(e);t||=o}return t&&l.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let e=this.uniformBlocks.get(t),o=this.uniformBuffers.get(t),n=!1;if(o&&e.needsRedraw){n||=e.needsRedraw;let s=this.getUniformBufferData(t);this.uniformBuffers.get(t).write(s);let a=this.uniformBlocks.get(t).getAllUniforms();l.log(4,`Writing to uniform buffer ${String(t)}`,s,a)()}return n}};function Ut(r){let t=ArrayBuffer.isView(r)?r.constructor:r;switch(t){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(t.constructor.name)}}function ye(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function be(r,t,e){if(!t||t>4)throw new Error(`size ${t}`);let o=t,n=Ut(r);if(n==="uint8"||n==="sint8"){if(o===1||o===3)throw new Error(`size: ${t}`);return e&&(n=n.replace("int","norm")),`${n}x${o}`}if(n==="uint16"||n==="sint16"){if(o===1||o===3)throw new Error(`size: ${t}`);return e&&(n=n.replace("int","norm")),`${n}x${o}`}return o===1?n:`${n}x${o}`}function xe(r){return r}function Gt(r){return g(r)!==null||typeof r=="number"||typeof r=="boolean"}function we(r){let t={bindings:{},uniforms:{}};return Object.keys(r).forEach(e=>{let o=r[e];Gt(o)?t.uniforms[e]=o:t.bindings[e]=o}),t}function Ar(r,t={}){let{maxElts:e=16,size:o=1}=t,n="[";for(let i=0;i<r.length&&i<e;++i)i>0&&(n+=`,${i%o===0?" ":""}`),n+=Ht(r[i],t);let s=r.length>e?"...":"]";return`${n}${s}`}function Ht(r,t={}){let{isInteger:o=!1}=t;if(Array.isArray(r)||ArrayBuffer.isView(r))return Ar(r,t);if(typeof r!="number")return String(r);if(Math.abs(r)<1e-16)return o?"0":"0.";if(o||Math.abs(r)>100&&Math.abs(r)<1e4)return r.toFixed(0);let n=r.toPrecision(2);return n.indexOf(".0")===n.length-2?n.slice(0,-1):n}function Se(r,t,e,o){let n=`See luma.gl ${e} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);o.forEach(i=>{s.methodName||(s[i]=()=>{throw l.removed(`Calling removed method ${t}.${i}: `,n)(),new Error(i)})})}function Te(r,t,e){let{removedProps:o={},deprecatedProps:n={},replacedProps:s={}}=e;for(let a in o)if(a in t){let p=o[a]?`${r}.${o[a]}`:"N/A";l.removed(`${r}.${a}`,p)()}for(let a in n)if(a in t){let f=n[a];l.deprecated(`${r}.${a}`,`${r}.${f}`)()}let i=null;for(let[a,f]of Object.entries(s))a in t&&(l.deprecated(`${r}.${a}`,`${r}.${f}`)(),i=i||Object.assign({},t),i[f]=t[a],delete i[a]);return i||t}var ht="";function Ae(r){ht=r}async function Ee(r,t){r=r.startsWith("http")?r:ht+r;let e=t?.dataType||"text";return await(await fetch(r,t))[e]()}async function ve(r,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=r.startsWith("http")?r:ht+r,await e.decode(),await createImageBitmap(e)}async function _e(r,t){return await new Promise((e,o)=>{try{let n=new Image;n.onload=()=>e(n),n.onerror=()=>o(new Error(`Could not load image ${r}.`)),n.crossOrigin=t?.crossOrigin||"anonymous",n.src=r.startsWith("http")?r:ht+r}catch(n){o(n)}})}async function Pe(r,t){let e=document.getElementsByTagName("head")[0];if(!e)throw new Error("loadScript");let o=document.createElement("script");return o.setAttribute("type","text/javascript"),o.setAttribute("src",r),t&&(o.id=t),new Promise((n,s)=>{o.onload=n,o.onerror=i=>s(new Error(`Unable to load script '${r}': ${i}`)),e.appendChild(o)})}function kt(){let r=1,t=1;return()=>(r=Math.sin(t*17.23),t=Math.cos(r*27.92),Er(Math.abs(r*t)*1432.71))}function Er(r){return r-Math.floor(r)}var Ce=kt();function pt(r,t,e){if(r===t)return!0;if(!e||!r||!t)return!1;if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let o=0;o<r.length;o++)if(!pt(r[o],t[o],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof r=="object"&&typeof t=="object"){let o=Object.keys(r),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s of o)if(!t.hasOwnProperty(s)||!pt(r[s],t[s],e-1))return!1;return!0}return!1}function Be(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Le(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var vr=r=>`${r}`;return De(_r);})();
|
|
16
|
+
</pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),i.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}},$=be;a($,"defaultProps",{...c.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Gt(r){return Je(r.source)||r.id||E(`unnamed ${r.stage}-shader`)}function Je(r,e="unnamed"){let s=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return s?s[1]:e}var xe=class extends c{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){super(e,t,xe.defaultProps)}},F=xe;a(F,"defaultProps",{...c.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var we=class extends c{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,we.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let t=!e;if(e){let[s,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||s!==this.width,this.width=s,this.height=n}t&&(l.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(t=>{if(typeof t=="string"){let s=this.createColorTexture(t);return this.attachResource(s),s.view}return t instanceof h?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof h?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:h.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:h.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let s=0;s<this.colorAttachments.length;++s)if(this.colorAttachments[s]){let n=this.device._createTexture({...this.colorAttachments[s].texture.props,width:e,height:t});this.destroyAttachedResource(this.colorAttachments[s]),this.colorAttachments[s]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let s=this.device._createTexture({...this.depthStencilAttachment.texture.props,width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=s.view,this.attachResource(s)}}},N=we;a(N,"defaultProps",{...c.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Te=class extends c{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Te.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},U=Te;a(U,"defaultProps",{...c.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var Se=class extends c{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){super(e,t,Se.defaultProps)}},H=Se;a(H,"defaultProps",{...c.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ae=class extends c{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Ae.defaultProps),this.shaderLayout=t.shaderLayout}},k=Ae;a(k,"defaultProps",{...c.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var ve=class extends c{get[Symbol.toStringTag](){return"ComputePass"}constructor(e,t){super(e,t,ve.defaultProps)}},z=ve;a(z,"defaultProps",{...c.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ee=class extends c{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,Ee.defaultProps)}},G=Ee;a(G,"defaultProps",{...c.defaultProps,measureExecutionTime:void 0});var Pe=class extends c{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,Pe.defaultProps)}},V=Pe;a(V,"defaultProps",{...c.defaultProps});function ae(r){let[e,t]=Wt[r],s=e==="i32"||e==="u32",n=e!=="u32",o=Ot[e]*t,i=Vt(e,t);return{dataType:e,components:t,defaultVertexFormat:i,byteLength:o,integer:s,signed:n}}function Vt(r,e){let t;switch(r){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?t:`${t}x${e}`}var Wt={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},Ot={f32:4,f16:2,i32:4,u32:4};function W(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,s]=r.split("x"),n=t,o=s?parseInt(s):1,i=ee(n),u={type:n,components:o,byteLength:i.byteLength*o,integer:i.integer,signed:i.signed,normalized:i.normalized};return e&&(u.webglOnly=!0),u}function _e(r,e){let t={};for(let s of r.attributes){let n=jt(r,e,s.name);n&&(t[s.name]=n)}return t}function et(r,e,t=16){let s=_e(r,e),n=new Array(t).fill(null);for(let o of Object.values(s))n[o.location]=o;return n}function jt(r,e,t){let s=Yt(r,t),n=Xt(e,t);if(!s)return null;let o=ae(s.type),i=n?.vertexFormat||o.defaultVertexFormat,u=W(i);return{attributeName:n?.attributeName||s.name,bufferName:n?.bufferName||s.name,location:s.location,shaderType:s.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:i,bufferDataType:u.type,bufferComponents:u.components,normalized:u.normalized,integer:o.integer,stepMode:n?.stepMode||s.stepMode||"vertex",byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Yt(r,e){let t=r.attributes.find(s=>s.name===e);return t||l.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Xt(r,e){Zt(r);let t=qt(r,e);return t||(t=Kt(r,e),t)?t:(l.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Zt(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function qt(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function Kt(r,e){for(let t of r){let s=t.byteStride;if(typeof t.byteStride!="number")for(let o of t.attributes||[]){let i=W(o.format);s+=i.byteLength}let n=t.attributes?.find(o=>o.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:s}}return null}var Le=class extends c{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Le.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);let{shaderLayout:s,bufferLayout:n}=t.renderPipeline||{};if(!s||!n)throw new Error("VertexArray");this.attributeInfos=et(s,n,this.maxVertexAttributes)}setConstantWebGL(e,t){throw new Error("constant attributes not supported")}},O=Le;a(O,"defaultProps",{...c.defaultProps,renderPipeline:null});var Ce=class extends c{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ce.defaultProps)}},j=Ce;a(j,"defaultProps",{...c.defaultProps,layout:void 0,buffers:{}});var Be=class extends c{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,Be.defaultProps)}},Y=Be;a(Y,"defaultProps",{...c.defaultProps,type:void 0,count:void 0});var Qt={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function ce(r){return Qt[r]}function tt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var ue;function Me(r){return(!ue||ue.byteLength<r)&&(ue=new ArrayBuffer(r)),ue}function rt(r,e){let t=Me(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function Jt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function P(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":Jt(r)}var st=1024,_=class{layout={};byteLength;constructor(e){let t=0;for(let[n,o]of Object.entries(e)){let i=ce(o),{type:u,components:f}=i;t=tt(t,f);let m=t;t+=f,this.layout[n]={type:u,size:f,offset:m}}t+=(4-t%4)%4;let s=t*4;this.byteLength=Math.max(s,st)}getData(e){let t=Math.max(this.byteLength,st),s=Me(t),n={i32:new Int32Array(s),u32:new Uint32Array(s),f32:new Float32Array(s),f16:new Uint16Array(s)};for(let[o,i]of Object.entries(e)){let u=this.layout[o];if(!u){l.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:f,size:m,offset:g}=u,Ie=n[f];if(m===1){if(typeof i!="number"&&typeof i!="boolean"){l.warn(`Supplied value for single component uniform ${o} is not a number: ${i}`)();continue}Ie[g]=Number(i)}else{if(!P(i)){l.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${i}`)();continue}Ie.set(i,g)}}return new Uint8Array(s)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function nt(r,e,t=16){if(r!==e)return!1;let s=r,n=e;if(!P(s))return!1;if(P(n)&&s.length===n.length){for(let o=0;o<s.length;++o)if(n[o]!==s[o])return!1}return!0}function ot(r){return P(r)?r.slice():r}var L=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!t)throw new Error(e?.name);let s=t;for(let n of s.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,s]of Object.entries(e))this._setUniform(t,s),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${s}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){nt(this.uniforms[e],t)||(this.uniforms[e]=ot(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var fe=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,s]of Object.entries(e)){let n=t,o=new _(s.uniformTypes||{});this.uniformBufferLayouts.set(n,o);let i=new L({name:t});i.setUniforms(s.defaultUniforms||{}),this.uniformBlocks.set(n,i)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,s]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(s);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,s){s&&this.setUniforms(s);let n=this.getUniformBufferByteLength(t),o=e.createBuffer({usage:d.UNIFORM|d.COPY_DST,byteLength:n}),i=this.getUniformBufferData(t);return o.write(i),o}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let s=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:d.UNIFORM|d.COPY_DST,byteLength:s});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let s=this.updateUniformBuffer(t);e||=s}return e&&l.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),s=this.uniformBuffers.get(e),n=!1;if(s&&t?.needsRedraw){n||=t.needsRedraw;let o=this.getUniformBufferData(e);this.uniformBuffers.get(e)?.write(o);let u=this.uniformBlocks.get(e)?.getAllUniforms();l.log(4,`Writing to uniform buffer ${String(e)}`,o,u)()}return n}};function Re(r){let e=ArrayBuffer.isView(r)?r.constructor:r;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function it(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function at(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let s=e,n=Re(r);if(n==="uint8"||n==="sint8"){if(s===1||s===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${s}`}if(n==="uint16"||n==="sint16"){if(s===1||s===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${s}`}return s===1?n:`${n}x${s}`}return mt(er);})();
|
|
17
17
|
return __exports__;
|
|
18
18
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShaderDataType, ShaderAttributeType } from "
|
|
2
|
-
import { VertexFormat } from "
|
|
1
|
+
import { ShaderDataType, ShaderAttributeType } from "./shader-types.js";
|
|
2
|
+
import { VertexFormat } from "./vertex-formats.js";
|
|
3
3
|
/** Information extracted from a ShaderAttributeInfo constant */
|
|
4
4
|
export type ShaderAttributeTypeInfo = {
|
|
5
5
|
/** WGSL-style primitive data type, f32, i32, u32 */
|
|
@@ -13,7 +13,7 @@ export type ShaderAttributeTypeInfo = {
|
|
|
13
13
|
/** Whether this data type is signed */
|
|
14
14
|
signed: boolean;
|
|
15
15
|
/** The simplest vertex format that matches the shader attribute's data type */
|
|
16
|
-
defaultVertexFormat
|
|
16
|
+
defaultVertexFormat: VertexFormat;
|
|
17
17
|
};
|
|
18
18
|
/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */
|
|
19
19
|
export declare function decodeShaderAttributeType(attributeType: ShaderAttributeType): ShaderAttributeTypeInfo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-attribute-type.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/decode-attribute-type.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,0BAAuB;AACnE,OAAO,EAAC,YAAY,EAAa,4BAAyB;AAE1D,gEAAgE;AAChE,MAAM,MAAM,uBAAuB,GAAG;IACpC,oDAAoD;IACpD,QAAQ,EAAE,cAAc,CAAC;IACzB,wEAAwE;IACxE,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,+EAA+E;IAC/E,mBAAmB,EAAE,YAAY,CAAC;CACnC,CAAC;AAEF,2FAA2F;AAC3F,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,mBAAmB,GACjC,uBAAuB,CAezB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-data-type.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/decode-data-type.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,kBAAkB,EAAC,4BAAyB;AAE9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,uBAAuB;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CAa5E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShaderUniformType, ShaderDataType } from "
|
|
1
|
+
import { ShaderUniformType, ShaderDataType } from "./shader-types.js";
|
|
2
2
|
/** Split a uniform type string into type and components */
|
|
3
3
|
export declare function decodeShaderUniformType(format: ShaderUniformType): {
|
|
4
4
|
type: ShaderDataType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-shader-types.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/decode-shader-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,0BAAuB;AA2BjE,2DAA2D;AAC3D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG;IAClE,IAAI,EAAE,cAAc,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAGA;AAED,4DAA4D;AAC5D,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3D"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { assert } from "../../utils/assert.js";
|
|
5
4
|
const UNIFORM_FORMATS = {
|
|
6
5
|
f32: { type: 'f32', components: 1 },
|
|
7
6
|
i32: { type: 'i32', components: 1 },
|
|
@@ -29,7 +28,6 @@ const UNIFORM_FORMATS = {
|
|
|
29
28
|
/** Split a uniform type string into type and components */
|
|
30
29
|
export function decodeShaderUniformType(format) {
|
|
31
30
|
const decoded = UNIFORM_FORMATS[format];
|
|
32
|
-
assert(format);
|
|
33
31
|
return decoded;
|
|
34
32
|
}
|
|
35
33
|
/** Align offset to 1, 2 or 4 elements (4, 8 or 16 bytes) */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TextureFormat } from "./texture-formats.js";
|
|
2
|
+
import { VertexType } from "./vertex-formats.js";
|
|
3
|
+
export type DecodedTextureFormat = {
|
|
4
|
+
/** String describing which channels this texture has */
|
|
5
|
+
channels: 'r' | 'rg' | 'rgb' | 'rgba' | 'bgra';
|
|
6
|
+
/** Number of components (corresponds to channels string) */
|
|
7
|
+
components: 1 | 2 | 3 | 4;
|
|
8
|
+
/** What is the data type of each component */
|
|
9
|
+
dataType?: VertexType;
|
|
10
|
+
/** If this is a packed data type */
|
|
11
|
+
packed?: boolean;
|
|
12
|
+
/** Number of bytes per pixel */
|
|
13
|
+
bytesPerPixel?: number;
|
|
14
|
+
/** Number of bits per channel (may be unreliable for packed formats) */
|
|
15
|
+
bitsPerChannel: number;
|
|
16
|
+
/** Depth stencil formats */
|
|
17
|
+
a?: 'depth' | 'stencil' | 'depth-stencil';
|
|
18
|
+
/** SRGB texture format? */
|
|
19
|
+
srgb?: boolean;
|
|
20
|
+
/** WebGL specific texture format? */
|
|
21
|
+
webgl?: boolean;
|
|
22
|
+
/** Is this an integer or floating point format? */
|
|
23
|
+
integer: boolean;
|
|
24
|
+
/** Is this a signed or unsigned format? */
|
|
25
|
+
signed: boolean;
|
|
26
|
+
/** Is this a normalized integer format? */
|
|
27
|
+
normalized: boolean;
|
|
28
|
+
/** Is this a compressed texture format */
|
|
29
|
+
compressed?: boolean;
|
|
30
|
+
/** Block size for ASTC formats (texture must be a multiple) */
|
|
31
|
+
blockWidth?: number;
|
|
32
|
+
/** Block size for ASTC formats (texture must be a multiple) */
|
|
33
|
+
blockHeight?: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if a texture format is GPU compressed
|
|
37
|
+
*/
|
|
38
|
+
export declare function isTextureFormatCompressed(textureFormat: TextureFormat): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)
|
|
41
|
+
*/
|
|
42
|
+
export declare function decodeTextureFormat(format: TextureFormat): DecodedTextureFormat;
|
|
43
|
+
//# sourceMappingURL=decode-texture-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-texture-format.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/decode-texture-format.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,6BAA0B;AAChD,OAAO,EAAC,UAAU,EAAC,4BAAyB;AAU5C,MAAM,MAAM,oBAAoB,GAAG;IACjC,wDAAwD;IACxD,QAAQ,EAAE,GAAG,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/C,4DAA4D;IAC5D,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,oCAAoC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,cAAc,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,eAAe,CAAC;IAC1C,2BAA2B;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;CAEtB,CAAC;AAEF;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAE/E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,oBAAoB,CA6B/E"}
|
|
@@ -6,7 +6,7 @@ import { decodeVertexType } from "./decode-data-type.js";
|
|
|
6
6
|
const COMPRESSED_TEXTURE_FORMAT_PREFIXES = [
|
|
7
7
|
'bc1', 'bc2', 'bc3', 'bc4', 'bc5', 'bc6', 'bc7', 'etc1', 'etc2', 'eac', 'atc', 'astc', 'pvrtc'
|
|
8
8
|
];
|
|
9
|
-
const REGEX = /^(rg
|
|
9
|
+
const REGEX = /^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;
|
|
10
10
|
/**
|
|
11
11
|
* Returns true if a texture format is GPU compressed
|
|
12
12
|
*/
|
|
@@ -19,19 +19,28 @@ export function isTextureFormatCompressed(textureFormat) {
|
|
|
19
19
|
export function decodeTextureFormat(format) {
|
|
20
20
|
const matches = REGEX.exec(format);
|
|
21
21
|
if (matches) {
|
|
22
|
-
const [,
|
|
22
|
+
const [, channels, length, type, srgb, suffix] = matches;
|
|
23
23
|
if (format) {
|
|
24
24
|
const dataType = `${type}${length}`;
|
|
25
25
|
const decodedType = decodeVertexType(dataType);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
components:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
const info = {
|
|
27
|
+
channels: channels,
|
|
28
|
+
components: channels.length,
|
|
29
|
+
bitsPerChannel: decodedType.byteLength * 8,
|
|
30
|
+
bytesPerPixel: decodedType.byteLength * channels.length,
|
|
31
|
+
dataType: decodedType.dataType,
|
|
32
|
+
integer: decodedType.integer,
|
|
33
|
+
signed: decodedType.signed,
|
|
34
|
+
normalized: decodedType.normalized
|
|
34
35
|
};
|
|
36
|
+
if (suffix === '-webgl') {
|
|
37
|
+
info.webgl = true;
|
|
38
|
+
}
|
|
39
|
+
// dataType - overwritten by decodedType
|
|
40
|
+
if (srgb === '-srgb') {
|
|
41
|
+
info.srgb = true;
|
|
42
|
+
}
|
|
43
|
+
return info;
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
46
|
return decodeNonStandardFormat(format);
|
|
@@ -39,37 +48,64 @@ export function decodeTextureFormat(format) {
|
|
|
39
48
|
// https://www.w3.org/TR/webgpu/#texture-format-caps
|
|
40
49
|
const EXCEPTIONS = {
|
|
41
50
|
// Packed 16 bit formats
|
|
42
|
-
'rgba4unorm-webgl': {
|
|
43
|
-
'rgb565unorm-webgl': {
|
|
44
|
-
'rgb5a1unorm-webgl': {
|
|
51
|
+
'rgba4unorm-webgl': { channels: 'rgba', bytesPerPixel: 2, packed: true },
|
|
52
|
+
'rgb565unorm-webgl': { channels: 'rgb', bytesPerPixel: 2, packed: true },
|
|
53
|
+
'rgb5a1unorm-webgl': { channels: 'rgba', bytesPerPixel: 2, packed: true },
|
|
45
54
|
// Packed 32 bit formats
|
|
46
|
-
rgb9e5ufloat: {
|
|
47
|
-
rg11b10ufloat: {
|
|
48
|
-
rgb10a2unorm: {
|
|
49
|
-
'rgb10a2uint-webgl': {
|
|
55
|
+
rgb9e5ufloat: { channels: 'rgb', bytesPerPixel: 4, packed: true },
|
|
56
|
+
rg11b10ufloat: { channels: 'rgb', bytesPerPixel: 4, packed: true },
|
|
57
|
+
rgb10a2unorm: { channels: 'rgba', bytesPerPixel: 4, packed: true },
|
|
58
|
+
'rgb10a2uint-webgl': { channels: 'rgba', bytesPerPixel: 4, packed: true },
|
|
50
59
|
// Depth/stencil
|
|
51
|
-
stencil8: { components: 1,
|
|
52
|
-
depth16unorm: { components: 1,
|
|
53
|
-
depth24plus: { components: 1,
|
|
54
|
-
depth32float: { components: 1,
|
|
55
|
-
'depth24plus-stencil8': { components: 2,
|
|
56
|
-
// "depth24unorm-stencil8" feature
|
|
57
|
-
'depth24unorm-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' },
|
|
60
|
+
stencil8: { components: 1, bytesPerPixel: 1, a: 'stencil', dataType: 'uint8' },
|
|
61
|
+
depth16unorm: { components: 1, bytesPerPixel: 2, a: 'depth', dataType: 'uint16' },
|
|
62
|
+
depth24plus: { components: 1, bytesPerPixel: 3, a: 'depth', dataType: 'uint32' },
|
|
63
|
+
depth32float: { components: 1, bytesPerPixel: 4, a: 'depth', dataType: 'float32' },
|
|
64
|
+
'depth24plus-stencil8': { components: 2, bytesPerPixel: 4, a: 'depth-stencil', packed: true },
|
|
58
65
|
// "depth32float-stencil8" feature
|
|
59
|
-
'depth32float-stencil8': { components: 2,
|
|
66
|
+
'depth32float-stencil8': { components: 2, bytesPerPixel: 4, a: 'depth-stencil', packed: true }
|
|
60
67
|
};
|
|
61
68
|
function decodeNonStandardFormat(format) {
|
|
69
|
+
if (isTextureFormatCompressed(format)) {
|
|
70
|
+
const info = {
|
|
71
|
+
channels: 'rgb',
|
|
72
|
+
components: 3,
|
|
73
|
+
bytesPerPixel: 1,
|
|
74
|
+
srgb: false,
|
|
75
|
+
compressed: true
|
|
76
|
+
};
|
|
77
|
+
const blockSize = getCompressedTextureBlockSize(format);
|
|
78
|
+
if (blockSize) {
|
|
79
|
+
info.blockWidth = blockSize.blockWidth;
|
|
80
|
+
info.blockHeight = blockSize.blockHeight;
|
|
81
|
+
}
|
|
82
|
+
return info;
|
|
83
|
+
}
|
|
62
84
|
const data = EXCEPTIONS[format];
|
|
63
85
|
if (!data) {
|
|
64
86
|
throw new Error(`Unknown format ${format}`);
|
|
65
87
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
88
|
+
const info = {
|
|
89
|
+
...data,
|
|
90
|
+
channels: data.channels || '',
|
|
91
|
+
components: data.components || data.channels?.length || 1,
|
|
92
|
+
bytesPerPixel: data.bytesPerPixel || 1,
|
|
93
|
+
srgb: false
|
|
72
94
|
};
|
|
95
|
+
if (data.packed) {
|
|
96
|
+
info.packed = data.packed;
|
|
97
|
+
}
|
|
98
|
+
return info;
|
|
99
|
+
}
|
|
100
|
+
/** Parses ASTC block widths from format string */
|
|
101
|
+
function getCompressedTextureBlockSize(format) {
|
|
102
|
+
const REGEX = /.*-(\d+)x(\d+)-.*/;
|
|
103
|
+
const matches = REGEX.exec(format);
|
|
104
|
+
if (matches) {
|
|
105
|
+
const [, blockWidth, blockHeight] = matches;
|
|
106
|
+
return { blockWidth: Number(blockWidth), blockHeight: Number(blockHeight) };
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
73
109
|
}
|
|
74
110
|
/*
|
|
75
111
|
'r8unorm': {s: "float"}, // ✓ ✓ ✓ },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-vertex-format.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/decode-vertex-format.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,4BAAyB;AAG1D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,4CAA4C;IAC5C,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,6EAA6E;IAC7E,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,mCAAmC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CAyBzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-types.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/shader-types.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GACX,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GACX,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GAEX,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,KAAK,GACL,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,gDAAgD;AAChD,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GAEP,OAAO,GACP,OAAO,GACP,OAAO,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/** Texture formats */
|
|
2
2
|
export type TextureFormat = ColorTextureFormat | DepthStencilTextureFormat;
|
|
3
3
|
/** Depth and stencil texture formats */
|
|
4
|
-
export type DepthStencilTextureFormat = 'stencil8' | 'depth16unorm' | 'depth24plus' | 'depth24plus-stencil8' | 'depth32float' | '
|
|
4
|
+
export type DepthStencilTextureFormat = 'stencil8' | 'depth16unorm' | 'depth24plus' | 'depth24plus-stencil8' | 'depth32float' | 'depth32float-stencil8';
|
|
5
5
|
/** Texture formats for color attachments */
|
|
6
|
-
export type ColorTextureFormat = WebGPUColorTextureFormat | WebGL2ColorTextureFormat
|
|
6
|
+
export type ColorTextureFormat = WebGPUColorTextureFormat | WebGL2ColorTextureFormat;
|
|
7
7
|
export type WebGPUColorTextureFormat = 'r8unorm' | 'r8snorm' | 'r8uint' | 'r8sint' | 'r16uint' | 'r16sint' | 'r16float' | 'rg8unorm' | 'rg8snorm' | 'rg8uint' | 'rg8sint' | 'r32uint' | 'r32sint' | 'r32float' | 'rg16uint' | 'rg16sint' | 'rg16float' | 'rgba8unorm' | 'rgba8unorm-srgb' | 'rgba8snorm' | 'rgba8uint' | 'rgba8sint' | 'bgra8unorm' | 'bgra8unorm-srgb' | 'rgb9e5ufloat' | 'rgb10a2unorm' | 'rg11b10ufloat' | 'rg32uint' | 'rg32sint' | 'rg32float' | 'rgba16uint' | 'rgba16sint' | 'rgba16float' | 'rgba32uint' | 'rgba32sint' | 'rgba32float' | 'bc1-rgba-unorm' | 'bc1-rgba-unorm-srgb' | 'bc2-rgba-unorm' | 'bc2-rgba-unorm-srgb' | 'bc3-rgba-unorm' | 'bc3-rgba-unorm-srgb' | 'bc4-r-unorm' | 'bc4-r-snorm' | 'bc5-rg-unorm' | 'bc5-rg-snorm' | 'bc6h-rgb-ufloat' | 'bc6h-rgb-float' | 'bc7-rgba-unorm' | 'bc7-rgba-unorm-srgb' | 'etc2-rgb8unorm' | 'etc2-rgb8unorm-srgb' | 'etc2-rgb8a1unorm' | 'etc2-rgb8a1unorm-srgb' | 'etc2-rgba8unorm' | 'etc2-rgba8unorm-srgb' | 'eac-r11unorm' | 'eac-r11snorm' | 'eac-rg11unorm' | 'eac-rg11snorm' | 'astc-4x4-unorm' | 'astc-4x4-unorm-srgb' | 'astc-5x4-unorm' | 'astc-5x4-unorm-srgb' | 'astc-5x5-unorm' | 'astc-5x5-unorm-srgb' | 'astc-6x5-unorm' | 'astc-6x5-unorm-srgb' | 'astc-6x6-unorm' | 'astc-6x6-unorm-srgb' | 'astc-8x5-unorm' | 'astc-8x5-unorm-srgb' | 'astc-8x6-unorm' | 'astc-8x6-unorm-srgb' | 'astc-8x8-unorm' | 'astc-8x8-unorm-srgb' | 'astc-10x5-unorm' | 'astc-10x5-unorm-srgb' | 'astc-10x6-unorm' | 'astc-10x6-unorm-srgb' | 'astc-10x8-unorm' | 'astc-10x8-unorm-srgb' | 'astc-10x10-unorm' | 'astc-10x10-unorm-srgb' | 'astc-12x10-unorm' | 'astc-12x10-unorm-srgb' | 'astc-12x12-unorm' | 'astc-12x12-unorm-srgb';
|
|
8
|
-
/**
|
|
9
|
-
export type UnsizedColorTextureFormat = 'rgb8unorm-unsized' | 'rgba8unorm-unsized';
|
|
10
|
-
/** Sized formats unique to WebGL 2. Some will perhaps be added to WebGPU standard? */
|
|
8
|
+
/** Sized formats in WebGL 2 that are not (yet?) supported by WebGPU */
|
|
11
9
|
export type WebGL2ColorTextureFormat = 'r16unorm-webgl' | 'r16snorm-webgl' | 'rgba4unorm-webgl' | 'rgb565unorm-webgl' | 'rgb5a1unorm-webgl' | 'rgb8unorm-webgl' | 'rgb8snorm-webgl' | 'rg16unorm-webgl' | 'rg16snorm-webgl' | 'rgb10a2uint-webgl' | 'rgb16unorm-webgl' | 'rgb16snorm-webgl' | 'rgba16unorm-webgl' | 'rgba16snorm-webgl' | 'rgb32float-webgl' | 'bc1-rgb-unorm-webgl' | 'bc1-rgb-unorm-srgb-webgl' | 'pvrtc-rgb4unorm-webgl' | 'pvrtc-rgba4unorm-webgl' | 'pvrtc-rbg2unorm-webgl' | 'pvrtc-rgba2unorm-webgl' | 'etc1-rbg-unorm-webgl' | 'atc-rgb-unorm-webgl' | 'atc-rgba-unorm-webgl' | 'atc-rgbai-unorm-webgl';
|
|
12
10
|
//# sourceMappingURL=texture-formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/texture-formats.ts"],"names":[],"mappings":"AAIA,sBAAsB;AACtB,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,yBAAyB,CAAC;AAE3E,wCAAwC;AACxC,MAAM,MAAM,yBAAyB,GACjC,UAAU,GACV,cAAc,GACd,aAAa,GACb,sBAAsB,GACtB,cAAc,GAEd,uBAAuB,CAAC;AAE5B,4CAA4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAErF,MAAM,MAAM,wBAAwB,GAEhC,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GAGR,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,GAGT,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,YAAY,GACZ,iBAAiB,GAEjB,cAAc,GACd,cAAc,GACd,eAAe,GAGf,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GAGb,YAAY,GACZ,YAAY,GACZ,aAAa,GAIb,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB,GAIrB,gBAAgB,GAChB,qBAAqB,GACrB,kBAAkB,GAClB,uBAAuB,GACvB,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,cAAc,GACd,eAAe,GACf,eAAe,GAKf,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,iBAAiB,GACjB,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,CAAC;AAE5B,uEAAuE;AACvE,MAAM,MAAM,wBAAwB,GAChC,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,GAClB,qBAAqB,GACrB,0BAA0B,GAC1B,uBAAuB,GACvB,wBAAwB,GACxB,uBAAuB,GACvB,wBAAwB,GACxB,sBAAsB,GACtB,qBAAqB,GACrB,sBAAsB,GACtB,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TypedArray, TypedArrayConstructor } from "
|
|
2
|
-
import { VertexFormat } from "
|
|
1
|
+
import { TypedArray, TypedArrayConstructor } from "../types.js";
|
|
2
|
+
import { VertexFormat } from "./vertex-formats.js";
|
|
3
3
|
type DataType = 'uint8' | 'sint8' | 'uint16' | 'sint16' | 'uint32' | 'sint32' | 'float32';
|
|
4
4
|
type DataTypeNorm = 'unorm8' | 'snorm8' | 'unorm16' | 'snorm16';
|
|
5
5
|
export declare function getDataTypeFromTypedArray(arrayOrType: TypedArray | TypedArrayConstructor): DataType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex-format-from-attribute.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/vertex-format-from-attribute.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAC,oBAAiB;AAC3D,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAI9C,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC1F,KAAK,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhE,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,UAAU,GAAG,qBAAqB,GAC9C,QAAQ,CAsBV;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAChC,qBAAqB,CAwBvB;AAED,sEAAsE;AACtE,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,OAAO,GACnB,YAAY,CAkCd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex-formats.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/vertex-formats.ts"],"names":[],"mappings":"AAIA,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;AAEd,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GAIR,SAAS,GACT,SAAS,CAAC;AAEd,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAEpB,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,cAAc,GACd,UAAU,GACV,gBAAgB,GAChB,UAAU,GACV,cAAc,GACd,UAAU,GACV,gBAAgB,GAChB,UAAU,GAEV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GAEX,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GAWV,WAAW,GACX,WAAW,GACX,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShaderAttributeType } from "
|
|
1
|
+
import { ShaderAttributeType } from "./shader-types.js";
|
|
2
2
|
/** Predeclared aliases @see https://www.w3.org/TR/WGSL/#vector-types */
|
|
3
3
|
export declare const WGSL_TYPE_ALIAS_MAP: Record<string, ShaderAttributeType>;
|
|
4
4
|
//# sourceMappingURL=wgsl-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgsl-utils.d.ts","sourceRoot":"","sources":["../../src/gpu-type-utils/wgsl-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,mBAAmB,EAAC,0BAAuB;AAEnD,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAcnE,CAAC"}
|