Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@luma.gl/core

Package Overview
Dependencies
Maintainers
7
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/core - npm Package Compare versions

Comparing version 9.0.0-beta.6 to 9.0.0-beta.7

4

dist.min.js

@@ -7,3 +7,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

else root['luma'] = factory();})(globalThis, function () {
"use strict";var __exports__=(()=>{var te=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Ft=Object.prototype.hasOwnProperty;var It=(r,e,t)=>e in r?te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e)=>{for(var t in e)te(r,t,{get:e[t],enumerable:!0})},Mt=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Lt(e))!Ft.call(r,n)&&n!==t&&te(r,n,{get:()=>e[n],enumerable:!(o=Dt(e,n))||o.enumerable});return r};var Ut=r=>Mt(te({},"__esModule",{value:!0}),r);var u=(r,e,t)=>(It(r,typeof e!="symbol"?e+"":e,t),t);var Br={};_t(Br,{Buffer:()=>f,CanvasContext:()=>k,CommandBuffer:()=>Y,CommandEncoder:()=>Q,ComputePass:()=>j,ComputePipeline:()=>q,Device:()=>x,DeviceFeatures:()=>me,DeviceLimits:()=>ue,ExternalTexture:()=>$,Framebuffer:()=>G,QuerySet:()=>J,RenderPass:()=>W,RenderPipeline:()=>H,Resource:()=>m,Sampler:()=>z,Shader:()=>O,StatsManager:()=>U,Texture:()=>l,TextureView:()=>N,TransformFeedback:()=>Z,UniformBlock:()=>_,UniformBufferLayout:()=>I,UniformStore:()=>ge,VERSION:()=>ae,VertexArray:()=>K,assert:()=>L,cancelAnimationFrame:()=>Et,cast:()=>yt,checkProps:()=>vt,decodeShaderAttributeType:()=>fe,decodeShaderUniformType:()=>de,decodeTextureFormat:()=>ot,decodeVertexFormat:()=>X,deepEqual:()=>be,fillArray:()=>ft,formatCompilerLog:()=>ce,formatValue:()=>Oe,getAttributeInfosFromLayouts:()=>Me,getDataTypeFromTypedArray:()=>Ne,getScratchArray:()=>ct,getScratchArrayBuffer:()=>ee,getTypedArrayFromDataType:()=>ht,getVertexFormatFromAttribute:()=>bt,glsl:()=>Rr,isNumberArray:()=>b,isObjectEmpty:()=>et,isTypedArray:()=>xe,isUniformValue:()=>$e,loadFile:()=>St,loadImage:()=>At,loadImageBitmap:()=>wt,loadScript:()=>Rt,log:()=>c,luma:()=>F,makeRandomNumberGenerator:()=>ze,mergeShaderLayout:()=>mt,random:()=>Bt,requestAnimationFrame:()=>Ct,setPathPrefix:()=>Pt,splitUniformsAndBindings:()=>xt,stubRemovedMethods:()=>Tt,uid:()=>v});function ye(r){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=r||e;return!!(t&&t.indexOf("Electron")>=0)}function d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||ye()}var Vt=globalThis.self||globalThis.window||globalThis.global,R=globalThis.window||globalThis.self||globalThis.global,kt=globalThis.document||{},P=globalThis.process||{},Nt=globalThis.console,Fr=globalThis.navigator||{};var re=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Mr=d();function $t(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var oe=class{constructor(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=$t(o),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 We(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 qe(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}function ne(r,e,t){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=r.src.replace(/\(/g,"%28").replace(/\)/g,"%29");r.width>o&&(t=Math.min(t,o/r.width));let s=r.width*t,a=r.height*t,i=["font-size:1px;",`padding:${Math.floor(a/2)}px ${Math.floor(s/2)}px;`,`line-height:${a}px;`,`background:url(${n});`,`background-size:${s}px ${a}px;`,"color:transparent;"].join("");return[`${e} %c+`,i]}var se;(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"})(se||(se={}));var Ot=10;function je(r){return typeof r!="string"?r:(r=r.toUpperCase(),se[r]||se.WHITE)}function Qe(r,e,t){return!d&&typeof r=="string"&&(e&&(r=`\x1B[${je(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${je(t)+Ot}m${r}\x1B[49m`)),r}function Ye(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],t=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(t),n=r;for(let s of o){let a=n[s];typeof a=="function"&&(e.find(i=>s===i)||(n[s]=a.bind(r)))}}function B(r,e){if(!r)throw new Error(e||"Assertion failed")}function S(){let r;if(d()&&R.performance){var e,t;r=R===null||R===void 0||(e=R.performance)===null||e===void 0||(t=e.now)===null||t===void 0?void 0:t.call(e)}else if("hrtime"in P){var o;let n=P===null||P===void 0||(o=P.hrtime)===null||o===void 0?void 0:o.call(P);r=n[0]*1e3+n[1]/1e6}else r=Date.now();return r}var C={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},zt={enabled:!0,level:0};function g(){}var Xe={},Ke={once:!0},T=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=re,this._startTs=S(),this._deltaTs=S(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new oe(`__probe-${this.id}__`,zt),this.timeStamp(`${this.id} started`),Ye(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((S()-this._startTs).toPrecision(10))}getDelta(){return Number((S()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!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){B(e,t)}warn(e){return this._getLogFunction(0,e,C.warn,arguments,Ke)}error(e){return this._getLogFunction(0,e,C.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,C.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,C.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,C.debug||C.info,arguments,Ke)}table(e,t,o){return t?this._getLogFunction(e,t,console.table||g,o&&[o],{tag:qt(t)}):g}image(e){let{logLevel:t,priority:o,image:n,message:s="",scale:a=1}=e;return this._shouldLog(t||o)?d()?Wt({image:n,message:s,scale:a}):Ht({image:n,message:s,scale:a}):g}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||g)}group(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=Ze({logLevel:e,message:t,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(e,t,Object.assign({},o,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||g)}withGroup(e,t,o){this.group(e,t)();try{o()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Je(e)}_getLogFunction(e,t,o,n,s){if(this._shouldLog(e)){s=Ze({logLevel:e,message:t,args:n,opts:s}),o=o||s.method,B(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=S();let a=s.tag||s.message;if(s.once&&a)if(!Xe[a])Xe[a]=S();else return g;return t=Gt(this.id,s.message,s),o.bind(console,t,...s.args)}return g}};T.VERSION=re;function Je(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 Ze(r){let{logLevel:e,message:t}=r;r.logLevel=Je(e);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&o.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:o},r.opts)}function Gt(r,e,t){if(typeof e=="string"){let o=t.time?qe(We(t.total)):"";e=t.time?`${r}: ${o} ${e}`:`${r}: ${e}`,e=Qe(e,t.color,t.background)}return e}function Ht(r){let{image:e,message:t="",scale:o=1}=r;return console.warn("removed"),g}function Wt(r){let{image:e,message:t="",scale:o=1}=r;if(typeof e=="string"){let s=new Image;return s.onload=()=>{let a=ne(s,t,o);console.log(...a)},s.src=e,g}let n=e.nodeName||"";if(n.toLowerCase()==="img")return console.log(...ne(e,t,o)),g;if(n.toLowerCase()==="canvas"){let s=new Image;return s.onload=()=>console.log(...ne(s,t,o)),s.src=e.toDataURL(),g}return g}function qt(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var ao=new T({id:"@probe.gl/log"});var c=new T({id:"luma.gl"});function M(){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 w=class{constructor(e,t){this.name=void 0,this.type=void 0,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=M(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(M()-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 E=class{constructor(e){this.id=void 0,this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"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(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:o}=e,n=this.stats[t];return n||(e instanceof w?n=e:n=new w(t,o),this.stats[t]=n),n}};var U=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new E({id:e})),this.stats.get(e)}},D=new U;function jt(){let r=typeof __VERSION__<"u"?__VERSION__:"running from source",e="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||(d()&&c.log(1,`${r} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:c,stats:D}),r}var ae=jt();function xe(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function b(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:xe(r)}var Te={};function v(r="id"){Te[r]=Te[r]||1;let e=Te[r]++;return`${r}-${e}`}function et(r){let e=!0;for(let t in r){e=!1;break}return e}var m=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,o){if(!e)throw new Error("no device");this._device=e,this.props=Qt(t,o);let n=this.props.id!=="undefined"?this.props.id:v(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 o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(e),o.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()}};u(m,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Qt(r,e){let t={...e};for(let o in r)r[o]!==void 0&&(t[o]=r[o]);return t}var V=class extends m{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;constructor(e,t){let o={...t};(t.usage||0)&V.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?o.indexType="uint32":t.data instanceof Uint16Array&&(o.indexType="uint16")),super(e,o,V.defaultProps),this.usage=t.usage||0,this.indexType=o.indexType}readSyncWebGL(e,t){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,t,o){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:o,V.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(s):t===0&&o===e.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},f=V;u(f,"defaultProps",{...m.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),u(f,"MAP_READ",1),u(f,"MAP_WRITE",2),u(f,"COPY_SRC",4),u(f,"COPY_DST",8),u(f,"INDEX",16),u(f,"VERTEX",32),u(f,"UNIFORM",64),u(f,"STORAGE",128),u(f,"INDIRECT",256),u(f,"QUERY_RESOLVE",512),u(f,"DEBUG_DATA_MAX_LENGTH",32);function ie(r){let e=tt[r],t=Yt(e),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:tt[r],byteLength:t,integer:n,signed:s,normalized:o}}function Yt(r){return Xt[r]}var tt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Xt={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Kt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Zt=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function rt(r){return Kt.some(e=>r.startsWith(e))}function ot(r){let e=Zt.exec(r);if(e){let[,t,o,n,s,a]=e;if(t){let i=`${n}${o}`,p=ie(i);return{format:t,components:t.length,srgb:s==="-srgb",unsized:a==="-unsized",webgl:a==="-webgl",...p}}}return er(r)}var Jt={"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 er(r){let e=Jt[r];if(!e)throw new Error(`Unknown format ${r}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var ue=class{},me=class{features;constructor(e=[]){this.features=new Set(e)}*[Symbol.iterator](){yield*this.features}has(e){return this.features.has(e)}},ve=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...ve.defaultProps,...e},this.id=this.props.id||v(this[Symbol.toStringTag].toLowerCase())}id;statsManager=D;props;userData={};_lumaData={};isTextureFormatCompressed(e){return rt(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),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")}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};return(e.usage||0)&f.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":c.warn("indices buffer content must be of integer type")()),t}},x=ve;u(x,"defaultProps",{id:null,type:"best-available",canvas:null,container:null,manageState:!0,width:800,height:600,requestMaximalLimits:!0,debug:Boolean(c.get("debug")),spector:Boolean(c.get("spector")),break:[],gl:null,onError:e=>c.error(e.message)}),u(x,"VERSION",ae);function L(r,e){if(!r)throw new Error(e||"luma.gl: assertion failed.")}var A=new Map,F=class{static registerDevices(e){for(let t of e)L(t.type&&t.isSupported&&t.create),A.set(t.type,t)}static getAvailableDevices(){return Array.from(A).map(e=>e.type)}static getSupportedDevices(){return Array.from(A).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(x.defaultProps,e)}static async createDevice(e={}){e={...x.defaultProps,...e},e.gl&&(e.type="webgl");let t;switch(e.type){case"webgpu":if(t=A.get("webgpu"),t)return await t.create(e);break;case"webgl":if(t=A.get("webgl"),t)return await t.create(e);break;case"best-available":if(t=A.get("webgpu"),t&&t.isSupported())return await t.create(e);if(t=A.get("webgl"),t&&t.isSupported())return await t.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};u(F,"stats",D),u(F,"log",c);var tr=d()&&typeof document<"u",pe=()=>tr&&document.readyState==="complete",rr={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},k=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return pe()}constructor(e){if(this.props={...rr,...e},e=this.props,!d()){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=sr(e.canvas):this.canvas=e.canvas;else{let t=ar(e),o=nr(e?.container||null);o.insertBefore(t,o.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 o of t)o.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 o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ir(e,o,n,s,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let o="width"in t?t.width:this.htmlCanvas.clientWidth,n="height"in t?t.height:this.htmlCanvas.clientHeight;(!o||!n)&&(c.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==e){let a=e,i=Math.floor(o*a),p=Math.floor(n*a);this.htmlCanvas.width=i,this.htmlCanvas.height=p;let[h,y]=this.getDrawingBufferSize();(h!==i||y!==p)&&(a=Math.min(h/o,y/n),this.htmlCanvas.width=Math.floor(o*a),this.htmlCanvas.height=Math.floor(n*a),c.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,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)}};u(k,"pageLoaded",or());function or(){return pe()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function nr(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e&&!pe())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 sr(r){let e=document.getElementById(r);if(!e&&!pe())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 ar(r){let{width:e,height:t}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=e||1,o.height=t||1,o.style.width=Number.isFinite(e)?`${e}px`:"100%",o.style.height=Number.isFinite(t)?`${t}px`:"100%",o}function ir(r,e,t,o,n){let s=r,a=nt(s[0],e,t),i=st(s[1],e,o,n),p=nt(s[0]+1,e,t),h=p===t-1?p:p-1;p=st(s[1]+1,e,o,n);let y;return n?(p=p===0?p:p+1,y=i,i=p):y=p===o-1?p:p-1,{x:a,y:i,width:Math.max(h-a+1,1),height:Math.max(y-i+1,1)}}function nt(r,e,t){return Math.min(Math.round(r*e),t-1)}function st(r,e,t,o){return o?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Pe=class extends m{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;constructor(e,t,o=Pe.defaultProps){super(e,t,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}},l=Pe;u(l,"defaultProps",{...m.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}),u(l,"COPY_SRC",1),u(l,"COPY_DST",2),u(l,"TEXTURE_BINDING",4),u(l,"STORAGE_BINDING",8),u(l,"RENDER_ATTACHMENT",16);var Se=class extends m{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,Se.defaultProps)}},N=Se;u(N,"defaultProps",{...m.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var we=class extends m{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,we.defaultProps)}},$=we;u($,"defaultProps",{...m.defaultProps,source:null,colorSpace:"srgb"});function ce(r,e,t){let o="",n=e.split(/\r?\n/),s=r.slice().sort((a,i)=>a.lineNum-i.lineNum);switch(t?.showSourceCode||"no"){case"all":let a=0;for(let i=1;i<=n.length;i++)for(o+=it(n[i-1],i,t);s.length>a&&s[a].lineNum===i;){let p=s[a++];o+=at(p,n,p.lineNum,{...t,inlineSource:!1})}return o;case"issues":case"no":for(let i of r)o+=at(i,n,i.lineNum,{inlineSource:t?.showSourceCode!=="no"});return o}}function at(r,e,t,o){if(o?.inlineSource){let n=ur(e,t),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
"use strict";var __exports__=(()=>{var J=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Ft=Object.prototype.hasOwnProperty;var It=(r,e,t)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e)=>{for(var t in e)J(r,t,{get:e[t],enumerable:!0})},Mt=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Lt(e))!Ft.call(r,n)&&n!==t&&J(r,n,{get:()=>e[n],enumerable:!(o=Dt(e,n))||o.enumerable});return r};var Ut=r=>Mt(J({},"__esModule",{value:!0}),r);var u=(r,e,t)=>(It(r,typeof e!="symbol"?e+"":e,t),t);var Br={};_t(Br,{Buffer:()=>f,CanvasContext:()=>U,CommandBuffer:()=>j,CommandEncoder:()=>q,ComputePass:()=>W,ComputePipeline:()=>H,Device:()=>x,DeviceFeatures:()=>me,DeviceLimits:()=>ue,ExternalTexture:()=>k,Framebuffer:()=>O,QuerySet:()=>K,RenderPass:()=>G,RenderPipeline:()=>z,Resource:()=>m,Sampler:()=>$,Shader:()=>N,StatsManager:()=>_,Texture:()=>l,TextureView:()=>V,TransformFeedback:()=>X,UniformBlock:()=>F,UniformBufferLayout:()=>L,UniformStore:()=>ge,VERSION:()=>ae,VertexArray:()=>Y,assert:()=>E,cancelAnimationFrame:()=>Et,cast:()=>yt,checkProps:()=>Pt,decodeShaderAttributeType:()=>fe,decodeShaderUniformType:()=>de,decodeTextureFormat:()=>ot,decodeVertexFormat:()=>Q,deepEqual:()=>he,fillArray:()=>ft,formatCompilerLog:()=>ce,formatValue:()=>Oe,getAttributeInfosFromLayouts:()=>Me,getDataTypeFromTypedArray:()=>Ne,getScratchArray:()=>ct,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>bt,getVertexFormatFromAttribute:()=>ht,glsl:()=>Rr,isNumberArray:()=>h,isObjectEmpty:()=>et,isTypedArray:()=>xe,isUniformValue:()=>$e,loadFile:()=>wt,loadImage:()=>At,loadImageBitmap:()=>St,loadScript:()=>Rt,log:()=>c,luma:()=>D,makeRandomNumberGenerator:()=>ze,mergeShaderLayout:()=>mt,random:()=>Bt,requestAnimationFrame:()=>Ct,setPathPrefix:()=>vt,splitUniformsAndBindings:()=>xt,stubRemovedMethods:()=>Tt,uid:()=>P});function ye(r){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,t=r||e;return!!(t&&t.indexOf("Electron")>=0)}function d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||ye()}var Vt=globalThis.self||globalThis.window||globalThis.global,ee=globalThis.window||globalThis.self||globalThis.global,kt=globalThis.document||{},te=globalThis.process||{},Nt=globalThis.console,Fr=globalThis.navigator||{};var re="4.0.6",Mr=d();function $t(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var oe=class{constructor(e,t,o="sessionStorage"){this.storage=$t(o),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 We(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 qe(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}function ne(r,e,t,o=600){let n=r.src.replace(/\(/g,"%28").replace(/\)/g,"%29");r.width>o&&(t=Math.min(t,o/r.width));let s=r.width*t,a=r.height*t,i=["font-size:1px;",`padding:${Math.floor(a/2)}px ${Math.floor(s/2)}px;`,`line-height:${a}px;`,`background:url(${n});`,`background-size:${s}px ${a}px;`,"color:transparent;"].join("");return[`${e} %c+`,i]}var se;(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"})(se||(se={}));var Ot=10;function je(r){return typeof r!="string"?r:(r=r.toUpperCase(),se[r]||se.WHITE)}function Qe(r,e,t){return!d&&typeof r=="string"&&(e&&(r=`\x1B[${je(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${je(t)+Ot}m${r}\x1B[49m`)),r}function Ye(r,e=["constructor"]){let t=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(t),n=r;for(let s of o){let a=n[s];typeof a=="function"&&(e.find(i=>s===i)||(n[s]=a.bind(r)))}}function A(r,e){if(!r)throw new Error(e||"Assertion failed")}function v(){let r;if(d()&&ee.performance)r=ee?.performance?.now?.();else if("hrtime"in te){let e=te?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var R={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},zt={enabled:!0,level:0};function g(){}var Xe={},Ke={once:!0},T=class{constructor({id:e}={id:""}){this.VERSION=re,this._startTs=v(),this._deltaTs=v(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new oe(`__probe-${this.id}__`,zt),this.timeStamp(`${this.id} started`),Ye(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((v()-this._startTs).toPrecision(10))}getDelta(){return Number((v()-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){A(e,t)}warn(e){return this._getLogFunction(0,e,R.warn,arguments,Ke)}error(e){return this._getLogFunction(0,e,R.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,R.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,R.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,R.debug||R.info,arguments,Ke)}table(e,t,o){return t?this._getLogFunction(e,t,console.table||g,o&&[o],{tag:qt(t)}):g}image({logLevel:e,priority:t,image:o,message:n="",scale:s=1}){return this._shouldLog(e||t)?d()?Wt({image:o,message:n,scale:s}):Ht({image:o,message:n,scale:s}):g}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||g)}group(e,t,o={collapsed:!1}){let n=Ze({logLevel:e,message:t,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,o={}){return this.group(e,t,Object.assign({},o,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||g)}withGroup(e,t,o){this.group(e,t)();try{o()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Je(e)}_getLogFunction(e,t,o,n,s){if(this._shouldLog(e)){s=Ze({logLevel:e,message:t,args:n,opts:s}),o=o||s.method,A(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=v();let a=s.tag||s.message;if(s.once&&a)if(!Xe[a])Xe[a]=v();else return g;return t=Gt(this.id,s.message,s),o.bind(console,t,...s.args)}return g}};T.VERSION=re;function Je(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 A(Number.isFinite(e)&&e>=0),e}function Ze(r){let{logLevel:e,message:t}=r;r.logLevel=Je(e);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&o.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 A(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Gt(r,e,t){if(typeof e=="string"){let o=t.time?qe(We(t.total)):"";e=t.time?`${r}: ${o} ${e}`:`${r}: ${e}`,e=Qe(e,t.color,t.background)}return e}function Ht({image:r,message:e="",scale:t=1}){return console.warn("removed"),g}function Wt({image:r,message:e="",scale:t=1}){if(typeof r=="string"){let n=new Image;return n.onload=()=>{let s=ne(n,e,t);console.log(...s)},n.src=r,g}let o=r.nodeName||"";if(o.toLowerCase()==="img")return console.log(...ne(r,e,t)),g;if(o.toLowerCase()==="canvas"){let n=new Image;return n.onload=()=>console.log(...ne(n,e,t)),n.src=r.toDataURL(),g}return g}function qt(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var ao=new T({id:"@probe.gl/log"});var c=new T({id:"luma.gl"});function I(){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 w=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=I(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(I()-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 B=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:o}=e,n=this.stats[t];return n||(e instanceof w?n=e:n=new w(t,o),this.stats[t]=n),n}};var _=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new B({id:e})),this.stats.get(e)}},C=new _;function jt(){let r=typeof __VERSION__<"u"?__VERSION__:"running from source",e="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||(d()&&c.log(1,`${r} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:c,stats:C}),r}var ae=jt();function xe(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function h(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:xe(r)}var Te={};function P(r="id"){Te[r]=Te[r]||1;let e=Te[r]++;return`${r}-${e}`}function et(r){let e=!0;for(let t in r){e=!1;break}return e}var m=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,o){if(!e)throw new Error("no device");this._device=e,this.props=Qt(t,o);let n=this.props.id!=="undefined"?this.props.id:P(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 o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(e),o.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()}};u(m,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Qt(r,e){let t={...e};for(let o in r)r[o]!==void 0&&(t[o]=r[o]);return t}var M=class extends m{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let o={...t};(t.usage||0)&M.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?o.indexType="uint32":t.data instanceof Uint16Array&&(o.indexType="uint16")),super(e,o,M.defaultProps),this.usage=t.usage||0,this.indexType=o.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,t){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,t,o){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:o,M.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(s):t===0&&o===e.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},f=M;u(f,"defaultProps",{...m.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),u(f,"MAP_READ",1),u(f,"MAP_WRITE",2),u(f,"COPY_SRC",4),u(f,"COPY_DST",8),u(f,"INDEX",16),u(f,"VERTEX",32),u(f,"UNIFORM",64),u(f,"STORAGE",128),u(f,"INDIRECT",256),u(f,"QUERY_RESOLVE",512),u(f,"DEBUG_DATA_MAX_LENGTH",32);function ie(r){let e=tt[r],t=Yt(e),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:tt[r],byteLength:t,integer:n,signed:s,normalized:o}}function Yt(r){return Xt[r]}var tt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Xt={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Kt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Zt=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function rt(r){return Kt.some(e=>r.startsWith(e))}function ot(r){let e=Zt.exec(r);if(e){let[,t,o,n,s,a]=e;if(t){let i=`${n}${o}`,p=ie(i);return{format:t,components:t.length,srgb:s==="-srgb",unsized:a==="-unsized",webgl:a==="-webgl",...p}}}return er(r)}var Jt={"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 er(r){let e=Jt[r];if(!e)throw new Error(`Unknown format ${r}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var ue=class{},me=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||P(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=C;_lumaData={};isTextureFormatCompressed(e){return rt(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),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")}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)&f.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":c.warn("indices buffer content must be of integer type")()),t}},x=Pe;u(x,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(c.get("debug")),spector:Boolean(c.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>c.error(e.message)}),u(x,"VERSION",ae);function E(r,e){if(!r)throw new Error(e||"luma.gl: assertion failed.")}var S=new Map,D=class{static registerDevices(e){for(let t of e)E(t.type&&t.isSupported&&t.create),S.set(t.type,t)}static getAvailableDevices(){return Array.from(S).map(e=>e.type)}static getSupportedDevices(){return Array.from(S).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(x.defaultProps,e)}static async createDevice(e={}){e={...x.defaultProps,...e},e.gl&&(e.type="webgl");let t;switch(e.type){case"webgpu":if(t=S.get("webgpu"),t)return await t.create(e);break;case"webgl":if(t=S.get("webgl"),t)return await t.create(e);break;case"best-available":if(t=S.get("webgpu"),t&&t.isSupported())return await t.create(e);if(t=S.get("webgl"),t&&t.isSupported())return await t.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};u(D,"stats",C),u(D,"log",c);var tr=d()&&typeof document<"u",pe=()=>tr&&document.readyState==="complete",rr={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},U=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return pe()}constructor(e){if(this.props={...rr,...e},e=this.props,!d()){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=sr(e.canvas):this.canvas=e.canvas;else{let t=ar(e),o=nr(e?.container||null);o.insertBefore(t,o.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 o of t)o.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 o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ir(e,o,n,s,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let o="width"in t?t.width:this.htmlCanvas.clientWidth,n="height"in t?t.height:this.htmlCanvas.clientHeight;(!o||!n)&&(c.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==e){let a=e,i=Math.floor(o*a),p=Math.floor(n*a);this.htmlCanvas.width=i,this.htmlCanvas.height=p;let[b,y]=this.getDrawingBufferSize();(b!==i||y!==p)&&(a=Math.min(b/o,y/n),this.htmlCanvas.width=Math.floor(o*a),this.htmlCanvas.height=Math.floor(n*a),c.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,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)}};u(U,"pageLoaded",or());function or(){return pe()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function nr(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e&&!pe())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 sr(r){let e=document.getElementById(r);if(!e&&!pe())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 ar(r){let{width:e,height:t}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=e||1,o.height=t||1,o.style.width=Number.isFinite(e)?`${e}px`:"100%",o.style.height=Number.isFinite(t)?`${t}px`:"100%",o}function ir(r,e,t,o,n){let s=r,a=nt(s[0],e,t),i=st(s[1],e,o,n),p=nt(s[0]+1,e,t),b=p===t-1?p:p-1;p=st(s[1]+1,e,o,n);let y;return n?(p=p===0?p:p+1,y=i,i=p):y=p===o-1?p:p-1,{x:a,y:i,width:Math.max(b-a+1,1),height:Math.max(y-i+1,1)}}function nt(r,e,t){return Math.min(Math.round(r*e),t-1)}function st(r,e,t,o){return o?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var ve=class extends m{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,t,o=ve.defaultProps){super(e,t,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=e.incrementTimestamp()}},l=ve;u(l,"defaultProps",{...m.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}),u(l,"COPY_SRC",1),u(l,"COPY_DST",2),u(l,"TEXTURE_BINDING",4),u(l,"STORAGE_BINDING",8),u(l,"RENDER_ATTACHMENT",16);var we=class extends m{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,we.defaultProps)}},V=we;u(V,"defaultProps",{...m.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Se=class extends m{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,Se.defaultProps)}},k=Se;u(k,"defaultProps",{...m.defaultProps,source:null,colorSpace:"srgb"});function ce(r,e,t){let o="",n=e.split(/\r?\n/),s=r.slice().sort((a,i)=>a.lineNum-i.lineNum);switch(t?.showSourceCode||"no"){case"all":let a=0;for(let i=1;i<=n.length;i++)for(o+=it(n[i-1],i,t);s.length>a&&s[a].lineNum===i;){let p=s[a++];o+=at(p,n,p.lineNum,{...t,inlineSource:!1})}return o;case"issues":case"no":for(let i of r)o+=at(i,n,i.lineNum,{inlineSource:t?.showSourceCode!=="no"});return o}}function at(r,e,t,o){if(o?.inlineSource){let n=ur(e,t),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
`:"";return`

@@ -17,4 +17,4 @@ ${n}${s}${r.type.toUpperCase()}: ${r.message}

${n}
</pre></code>`,a.style.top="10px",a.style.left="10px",a.style.position="absolute",a.style.zIndex="9999",a.style.width="100%",a.style.textAlign="left",document.body.appendChild(a);let i=document.getElementsByClassName("luma-compiler-log-error");i[0]?.scrollIntoView&&i[0].scrollIntoView(),a.onclick=()=>{let p=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(p)}}},O=Re;u(O,"defaultProps",{...m.defaultProps,language:"auto",stage:"vertex",source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function dr(r){return Ae(r.source).name||r.id||v(`unnamed ${r.stage}-shader`)}var Be=class extends m{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){super(e,t,Be.defaultProps)}},z=Be;u(z,"defaultProps",{...m.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 Ce=class extends m{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,t={}){super(e,t,Ce.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let t=!e;if(e){let[o,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||o!==this.width,this.width=o,this.height=n}t&&(c.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){this.colorAttachments=this.props.colorAttachments.map(t=>{if(typeof t=="string"){let o=this.createColorTexture(t);return this.attachResource(o),o.view}return t instanceof l?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 l?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:l.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:l.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let o=0;o<this.colorAttachments.length;++o)if(this.colorAttachments[o]){let n=this.device._createTexture({...this.colorAttachments[o].props,width:e,height:t});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:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}}},G=Ce;u(G,"defaultProps",{...m.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ee=class extends m{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Ee.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},H=Ee;u(H,"defaultProps",{...m.defaultProps,vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var De=class extends m{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){super(e,t,De.defaultProps)}},W=De;u(W,"defaultProps",{...m.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 Le=class extends m{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,t){super(e,t,Le.defaultProps)}},q=Le;u(q,"defaultProps",{...m.defaultProps,cs:void 0,csEntryPoint:void 0,csConstants:{},shaderLayout:[]});var Fe=class extends m{get[Symbol.toStringTag](){return"ComputePass"}constructor(e,t){super(e,t,Fe.defaultProps)}},j=Fe;u(j,"defaultProps",{...m.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ie=class extends m{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,Ie.defaultProps)}},Q=Ie;u(Q,"defaultProps",{...m.defaultProps,measureExecutionTime:void 0});var _e=class extends m{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,_e.defaultProps)}},Y=_e;u(Y,"defaultProps",{...m.defaultProps});function fe(r){let[e,t]=gr[r],o=e==="i32"||e==="u32",n=e!=="u32",s=hr[e]*t,a=lr(e,t);return{dataType:e,components:t,defaultVertexFormat:a,byteLength:s,integer:o,signed:n}}function lr(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 gr={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]},hr={f32:4,f16:2,i32:4,u32:4};function X(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,o]=r.split("x"),n=t,s=o?parseInt(o):1,a=ie(n),i={type:n,components:s,byteLength:a.byteLength*s,integer:a.integer,signed:a.signed,normalized:a.normalized};return e&&(i.webglOnly=!0),i}function Me(r,e){let t={};for(let o of r.attributes)t[o.name]=br(r,e,o.name);return t}function ut(r,e,t=16){let o=Me(r,e),n=new Array(t).fill(null);for(let s of Object.values(o))n[s.location]=s;return n}function br(r,e,t){let o=yr(r,t),n=xr(e,t);if(!o)return null;let s=fe(o.type),a=n?.vertexFormat||s.defaultVertexFormat,i=X(a);return{attributeName:n?.attributeName||o.name,bufferName:n?.bufferName||o.name,location:o.location,shaderType:o.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:a,bufferDataType:i.type,bufferComponents:i.components,normalized:i.normalized,integer:s.integer,stepMode:n?.stepMode||o.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function yr(r,e){let t=r.attributes.find(o=>o.name===e);return t||c.warn(`shader layout attribute "${e}" not present in shader`),t||null}function xr(r,e){Tr(r);let t=vr(r,e);return t||(t=Pr(r,e),t)?t:(c.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Tr(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&c.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function vr(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 Pr(r,e){for(let t of r){let o=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let a=X(s.format);o+=a.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:o}}return null}function mt(r,e){let t={...r,attributes:r.attributes.map(o=>({...o}))};for(let o of e?.attributes||[]){let n=t.attributes.find(s=>s.name===o.name);n?(n.type=o.type||n.type,n.stepMode=o.stepMode||n.stepMode):c.warn(`shader layout attribute ${o.name} not present in shader`)}return t}var Ue=class extends m{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Ue.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ut(t.renderPipeline.shaderLayout,t.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){throw new Error("constant attributes not supported")}},K=Ue;u(K,"defaultProps",{...m.defaultProps,renderPipeline:null});var Ve=class extends m{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ve.defaultProps)}},Z=Ve;u(Z,"defaultProps",{...m.defaultProps,layout:void 0,buffers:{}});var ke=class extends m{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,ke.defaultProps)}},J=ke;u(J,"defaultProps",{...m.defaultProps,type:void 0,count:void 0});var Sr={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 de(r){let e=Sr[r];return L(r),e}function pt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var le;function ee(r){return(!le||le.byteLength<r)&&(le=new ArrayBuffer(r)),le}function ct(r,e){let t=ee(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function ft(r){let{target:e,source:t,start:o=0,count:n=1}=r,s=t.length,a=n*s,i=0;for(let p=o;i<s;i++)e[p++]=t[i];for(;i<a;)i<a-i?(e.copyWithin(o+i,o,o+i),i*=2):(e.copyWithin(o+i,o,o+a-i),i=a);return r.target}var dt=1024,I=class{layout={};byteLength;constructor(e){let t=0;for(let[n,s]of Object.entries(e)){let a=de(s),{type:i,components:p}=a;t=pt(t,p);let h=t;t+=p,this.layout[n]={type:i,size:p,offset:h}}t+=(4-t%4)%4;let o=t*4;this.byteLength=Math.max(o,dt)}getData(e){let t=Math.max(this.byteLength,dt),o=ee(t),n={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)};for(let[s,a]of Object.entries(e)){let i=this.layout[s];if(!i){c.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:p,size:h,offset:y}=i,Ge=n[p];if(h===1){if(typeof a!="number"&&typeof a!="boolean"){c.warn(`Supplied value for single component uniform ${s} is not a number: ${a}`)();continue}Ge[y]=Number(a)}else{let He=b(a);if(!He){c.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${a}`)();continue}Ge.set(He,y)}}return new Uint8Array(o)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function lt(r,e,t=16){if(r!==e)return!1;let o=b(r);if(!o)return!1;let n=b(e);if(n&&o.length===n.length){for(let s=0;s<o.length;++s)if(n[s]!==o[s])return!1}return!0}function gt(r){let e=b(r);return e?e.slice():r}var _=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,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 o=t;for(let n of o.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,o]of Object.entries(e))this._setUniform(t,o),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${o}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){lt(this.uniforms[e],t)||(this.uniforms[e]=gt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var ge=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,o]of Object.entries(e)){let n=t,s=new I(o.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let a=new _({name:t});a.setUniforms(o.defaultUniforms||{}),this.uniformBlocks.set(n,a)}}destroy(){for(let e of Object.values(this.uniformBuffers))e.destroy()}setUniforms(e){for(let[t,o]of Object.entries(e))this.uniformBlocks.get(t).setUniforms(o);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let t=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(t)}createUniformBuffer(e,t,o){o&&this.setUniforms(o);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:f.UNIFORM|f.COPY_DST,byteLength:n}),a=this.getUniformBufferData(t);return s.write(a),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let o=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:f.UNIFORM|f.COPY_DST,byteLength:o});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let o=this.updateUniformBuffer(t);e||=o}return e&&c.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),o=this.uniformBuffers.get(e),n=!1;if(o&&t.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(s);let i=this.uniformBlocks.get(e).getAllUniforms();c.log(4,`Writing to uniform buffer ${String(e)}`,s,i)()}return n}};function Ne(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 ht(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 bt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let o=e,n=Ne(r);if(n==="uint8"||n==="sint8"){if(o===1||o===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${o}`}if(n==="uint16"||n==="sint16"){if(o===1||o===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${o}`}return o===1?n:`${n}x${o}`}function yt(r){return r}function $e(r){return b(r)!==null||typeof r=="number"||typeof r=="boolean"}function xt(r){let e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{let o=r[t];$e(o)?e.uniforms[t]=o:e.bindings[t]=o}),e}function wr(r,e={}){let{maxElts:t=16,size:o=1}=e,n="[";for(let a=0;a<r.length&&a<t;++a)a>0&&(n+=`,${a%o===0?" ":""}`),n+=Oe(r[a],e);let s=r.length>t?"...":"]";return`${n}${s}`}function Oe(r,e={}){let{isInteger:o=!1}=e;if(Array.isArray(r)||ArrayBuffer.isView(r))return wr(r,e);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 Tt(r,e,t,o){let n=`See luma.gl ${t} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);o.forEach(a=>{s.methodName||(s[a]=()=>{throw c.removed(`Calling removed method ${e}.${a}: `,n)(),new Error(a)})})}function vt(r,e,t){let{removedProps:o={},deprecatedProps:n={},replacedProps:s={}}=t;for(let i in o)if(i in e){let h=o[i]?`${r}.${o[i]}`:"N/A";c.removed(`${r}.${i}`,h)()}for(let i in n)if(i in e){let p=n[i];c.deprecated(`${r}.${i}`,`${r}.${p}`)()}let a=null;for(let[i,p]of Object.entries(s))i in e&&(c.deprecated(`${r}.${i}`,`${r}.${p}`)(),a=a||Object.assign({},e),a[p]=e[i],delete a[i]);return a||e}var he="";function Pt(r){he=r}async function St(r,e){r=r.startsWith("http")?r:he+r;let t=e?.dataType||"text";return await(await fetch(r,e))[t]()}async function wt(r,e){let t=new Image;return t.crossOrigin=e?.crossOrigin||"anonymous",t.src=r.startsWith("http")?r:he+r,await t.decode(),await createImageBitmap(t)}async function At(r,e){return await new Promise((t,o)=>{try{let n=new Image;n.onload=()=>t(n),n.onerror=()=>o(new Error(`Could not load image ${r}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=r.startsWith("http")?r:he+r}catch(n){o(n)}})}async function Rt(r,e){let t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");let o=document.createElement("script");return o.setAttribute("type","text/javascript"),o.setAttribute("src",r),e&&(o.id=e),new Promise((n,s)=>{o.onload=n,o.onerror=a=>s(new Error(`Unable to load script '${r}': ${a}`)),t.appendChild(o)})}function ze(){let r=1,e=1;return()=>(r=Math.sin(e*17.23),e=Math.cos(r*27.92),Ar(Math.abs(r*e)*1432.71))}function Ar(r){return r-Math.floor(r)}var Bt=ze();function be(r,e,t){if(r===e)return!0;if(!t||!r||!e)return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!be(r[o],e[o],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){let o=Object.keys(r),n=Object.keys(e);if(o.length!==n.length)return!1;for(let s of o)if(!e.hasOwnProperty(s)||!be(r[s],e[s],t-1))return!1;return!0}return!1}function Ct(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Et(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var Rr=r=>`${r}`;return Ut(Br);})();
</pre></code>`,a.style.top="10px",a.style.left="10px",a.style.position="absolute",a.style.zIndex="9999",a.style.width="100%",a.style.textAlign="left",document.body.appendChild(a);let i=document.getElementsByClassName("luma-compiler-log-error");i[0]?.scrollIntoView&&i[0].scrollIntoView(),a.onclick=()=>{let p=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(p)}}},N=Re;u(N,"defaultProps",{...m.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function dr(r){return Ae(r.source).name||r.id||P(`unnamed ${r.stage}-shader`)}var Be=class extends m{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){super(e,t,Be.defaultProps)}},$=Be;u($,"defaultProps",{...m.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 Ce=class extends m{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,t={}){super(e,t,Ce.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let t=!e;if(e){let[o,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||o!==this.width,this.width=o,this.height=n}t&&(c.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 o=this.createColorTexture(t);return this.attachResource(o),o.view}return t instanceof l?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 l?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:l.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:l.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let o=0;o<this.colorAttachments.length;++o)if(this.colorAttachments[o]){let n=this.device._createTexture({...this.colorAttachments[o].props,width:e,height:t});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:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}}},O=Ce;u(O,"defaultProps",{...m.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ee=class extends m{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Ee.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},z=Ee;u(z,"defaultProps",{...m.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var De=class extends m{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){super(e,t,De.defaultProps)}},G=De;u(G,"defaultProps",{...m.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 Le=class extends m{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,t){super(e,t,Le.defaultProps)}},H=Le;u(H,"defaultProps",{...m.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Fe=class extends m{get[Symbol.toStringTag](){return"ComputePass"}constructor(e,t){super(e,t,Fe.defaultProps)}},W=Fe;u(W,"defaultProps",{...m.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ie=class extends m{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,Ie.defaultProps)}},q=Ie;u(q,"defaultProps",{...m.defaultProps,measureExecutionTime:void 0});var _e=class extends m{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,_e.defaultProps)}},j=_e;u(j,"defaultProps",{...m.defaultProps});function fe(r){let[e,t]=gr[r],o=e==="i32"||e==="u32",n=e!=="u32",s=br[e]*t,a=lr(e,t);return{dataType:e,components:t,defaultVertexFormat:a,byteLength:s,integer:o,signed:n}}function lr(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 gr={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]},br={f32:4,f16:2,i32:4,u32:4};function Q(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,o]=r.split("x"),n=t,s=o?parseInt(o):1,a=ie(n),i={type:n,components:s,byteLength:a.byteLength*s,integer:a.integer,signed:a.signed,normalized:a.normalized};return e&&(i.webglOnly=!0),i}function Me(r,e){let t={};for(let o of r.attributes)t[o.name]=hr(r,e,o.name);return t}function ut(r,e,t=16){let o=Me(r,e),n=new Array(t).fill(null);for(let s of Object.values(o))n[s.location]=s;return n}function hr(r,e,t){let o=yr(r,t),n=xr(e,t);if(!o)return null;let s=fe(o.type),a=n?.vertexFormat||s.defaultVertexFormat,i=Q(a);return{attributeName:n?.attributeName||o.name,bufferName:n?.bufferName||o.name,location:o.location,shaderType:o.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:a,bufferDataType:i.type,bufferComponents:i.components,normalized:i.normalized,integer:s.integer,stepMode:n?.stepMode||o.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function yr(r,e){let t=r.attributes.find(o=>o.name===e);return t||c.warn(`shader layout attribute "${e}" not present in shader`),t||null}function xr(r,e){Tr(r);let t=Pr(r,e);return t||(t=vr(r,e),t)?t:(c.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Tr(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&c.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Pr(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 vr(r,e){for(let t of r){let o=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let a=Q(s.format);o+=a.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:o}}return null}function mt(r,e){let t={...r,attributes:r.attributes.map(o=>({...o}))};for(let o of e?.attributes||[]){let n=t.attributes.find(s=>s.name===o.name);n?(n.type=o.type||n.type,n.stepMode=o.stepMode||n.stepMode):c.warn(`shader layout attribute ${o.name} not present in shader`)}return t}var Ue=class extends m{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Ue.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ut(t.renderPipeline.shaderLayout,t.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){throw new Error("constant attributes not supported")}},Y=Ue;u(Y,"defaultProps",{...m.defaultProps,renderPipeline:null});var Ve=class extends m{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ve.defaultProps)}},X=Ve;u(X,"defaultProps",{...m.defaultProps,layout:void 0,buffers:{}});var ke=class extends m{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,ke.defaultProps)}},K=ke;u(K,"defaultProps",{...m.defaultProps,type:void 0,count:void 0});var wr={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 de(r){let e=wr[r];return E(r),e}function pt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var le;function Z(r){return(!le||le.byteLength<r)&&(le=new ArrayBuffer(r)),le}function ct(r,e){let t=Z(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function ft(r){let{target:e,source:t,start:o=0,count:n=1}=r,s=t.length,a=n*s,i=0;for(let p=o;i<s;i++)e[p++]=t[i];for(;i<a;)i<a-i?(e.copyWithin(o+i,o,o+i),i*=2):(e.copyWithin(o+i,o,o+a-i),i=a);return r.target}var dt=1024,L=class{layout={};byteLength;constructor(e){let t=0;for(let[n,s]of Object.entries(e)){let a=de(s),{type:i,components:p}=a;t=pt(t,p);let b=t;t+=p,this.layout[n]={type:i,size:p,offset:b}}t+=(4-t%4)%4;let o=t*4;this.byteLength=Math.max(o,dt)}getData(e){let t=Math.max(this.byteLength,dt),o=Z(t),n={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)};for(let[s,a]of Object.entries(e)){let i=this.layout[s];if(!i){c.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:p,size:b,offset:y}=i,Ge=n[p];if(b===1){if(typeof a!="number"&&typeof a!="boolean"){c.warn(`Supplied value for single component uniform ${s} is not a number: ${a}`)();continue}Ge[y]=Number(a)}else{let He=h(a);if(!He){c.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${a}`)();continue}Ge.set(He,y)}}return new Uint8Array(o)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function lt(r,e,t=16){if(r!==e)return!1;let o=h(r);if(!o)return!1;let n=h(e);if(n&&o.length===n.length){for(let s=0;s<o.length;++s)if(n[s]!==o[s])return!1}return!0}function gt(r){let e=h(r);return e?e.slice():r}var F=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,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 o=t;for(let n of o.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,o]of Object.entries(e))this._setUniform(t,o),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${o}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){lt(this.uniforms[e],t)||(this.uniforms[e]=gt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var ge=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,o]of Object.entries(e)){let n=t,s=new L(o.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let a=new F({name:t});a.setUniforms(o.defaultUniforms||{}),this.uniformBlocks.set(n,a)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,o]of Object.entries(e))this.uniformBlocks.get(t).setUniforms(o);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let t=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(t)}createUniformBuffer(e,t,o){o&&this.setUniforms(o);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:f.UNIFORM|f.COPY_DST,byteLength:n}),a=this.getUniformBufferData(t);return s.write(a),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let o=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:f.UNIFORM|f.COPY_DST,byteLength:o});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let o=this.updateUniformBuffer(t);e||=o}return e&&c.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),o=this.uniformBuffers.get(e),n=!1;if(o&&t.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(s);let i=this.uniformBlocks.get(e).getAllUniforms();c.log(4,`Writing to uniform buffer ${String(e)}`,s,i)()}return n}};function Ne(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 bt(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 ht(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let o=e,n=Ne(r);if(n==="uint8"||n==="sint8"){if(o===1||o===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${o}`}if(n==="uint16"||n==="sint16"){if(o===1||o===3)throw new Error(`size: ${e}`);return t&&(n=n.replace("int","norm")),`${n}x${o}`}return o===1?n:`${n}x${o}`}function yt(r){return r}function $e(r){return h(r)!==null||typeof r=="number"||typeof r=="boolean"}function xt(r){let e={bindings:{},uniforms:{}};return Object.keys(r).forEach(t=>{let o=r[t];$e(o)?e.uniforms[t]=o:e.bindings[t]=o}),e}function Sr(r,e={}){let{maxElts:t=16,size:o=1}=e,n="[";for(let a=0;a<r.length&&a<t;++a)a>0&&(n+=`,${a%o===0?" ":""}`),n+=Oe(r[a],e);let s=r.length>t?"...":"]";return`${n}${s}`}function Oe(r,e={}){let{isInteger:o=!1}=e;if(Array.isArray(r)||ArrayBuffer.isView(r))return Sr(r,e);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 Tt(r,e,t,o){let n=`See luma.gl ${t} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);o.forEach(a=>{s.methodName||(s[a]=()=>{throw c.removed(`Calling removed method ${e}.${a}: `,n)(),new Error(a)})})}function Pt(r,e,t){let{removedProps:o={},deprecatedProps:n={},replacedProps:s={}}=t;for(let i in o)if(i in e){let b=o[i]?`${r}.${o[i]}`:"N/A";c.removed(`${r}.${i}`,b)()}for(let i in n)if(i in e){let p=n[i];c.deprecated(`${r}.${i}`,`${r}.${p}`)()}let a=null;for(let[i,p]of Object.entries(s))i in e&&(c.deprecated(`${r}.${i}`,`${r}.${p}`)(),a=a||Object.assign({},e),a[p]=e[i],delete a[i]);return a||e}var be="";function vt(r){be=r}async function wt(r,e){r=r.startsWith("http")?r:be+r;let t=e?.dataType||"text";return await(await fetch(r,e))[t]()}async function St(r,e){let t=new Image;return t.crossOrigin=e?.crossOrigin||"anonymous",t.src=r.startsWith("http")?r:be+r,await t.decode(),await createImageBitmap(t)}async function At(r,e){return await new Promise((t,o)=>{try{let n=new Image;n.onload=()=>t(n),n.onerror=()=>o(new Error(`Could not load image ${r}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=r.startsWith("http")?r:be+r}catch(n){o(n)}})}async function Rt(r,e){let t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");let o=document.createElement("script");return o.setAttribute("type","text/javascript"),o.setAttribute("src",r),e&&(o.id=e),new Promise((n,s)=>{o.onload=n,o.onerror=a=>s(new Error(`Unable to load script '${r}': ${a}`)),t.appendChild(o)})}function ze(){let r=1,e=1;return()=>(r=Math.sin(e*17.23),e=Math.cos(r*27.92),Ar(Math.abs(r*e)*1432.71))}function Ar(r){return r-Math.floor(r)}var Bt=ze();function he(r,e,t){if(r===e)return!0;if(!t||!r||!e)return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!he(r[o],e[o],t-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof r=="object"&&typeof e=="object"){let o=Object.keys(r),n=Object.keys(e);if(o.length!==n.length)return!1;for(let s of o)if(!e.hasOwnProperty(s)||!he(r[s],e[s],t-1))return!1;return!0}return!1}function Ct(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Et(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var Rr=r=>`${r}`;return Ut(Br);})();
return __exports__;
});

@@ -27,3 +27,3 @@ import { StatsManager } from "../utils/stats-manager.js";

/** Type of device */
type: 'webgl' | 'webgpu';
type: 'webgl' | 'webgpu' | 'unknown';
/** Vendor (name of GPU vendor, Apple, nVidia etc */

@@ -108,3 +108,4 @@ vendor: string;

protected features: Set<DeviceFeature>;
constructor(features?: DeviceFeature[]);
protected disabledFeatures?: Partial<Record<DeviceFeature, boolean>>;
constructor(features: DeviceFeature[], disabledFeatures: Partial<Record<DeviceFeature, boolean>>);
[Symbol.iterator](): IterableIterator<DeviceFeature>;

@@ -121,3 +122,2 @@ has(feature: DeviceFeature): boolean;

id?: string;
type?: 'webgl' | 'webgpu' | 'best-available';
canvas?: HTMLCanvasElement | OffscreenCanvas | string | null;

@@ -127,11 +127,18 @@ container?: HTMLElement | string | null;

height?: number /** height is only used when creating a new canvas */;
/** Request a Device with the highest limits supported by platform. */
requestMaximalLimits?: boolean;
/** Request a Device with the highest limits supported by platform. WebGPU: devices can be created with minimal limits. */
requestMaxLimits?: boolean;
/** Error handling */
onError?: (error: Error) => unknown;
/** Instrument context (at the expense of performance) */
/** WebGL: Instrument WebGL2RenderingContext (at the expense of performance) */
debug?: boolean;
/** Initialize the SpectorJS WebGL debugger */
/** Break on WebGL functions matching these strings */
break?: string[];
/** WebGL: Initialize the SpectorJS WebGL debugger */
spector?: boolean;
/** Initialize all features on startup */
initalizeFeatures?: boolean;
/** Disable specific features */
disabledFeatures?: Partial<Record<DeviceFeature, boolean>>;
/** TODO- Unclear if still supported: Set to false to disable WebGL state management instrumentation */
manageState?: boolean;
break?: string[];
gl?: WebGL2RenderingContext | null;

@@ -149,4 +156,4 @@ };

readonly id: string;
/** stats */
readonly statsManager: StatsManager;
/** type of this device */
abstract readonly type: 'webgl' | 'webgpu' | 'unknown';
/** A copy of the device props */

@@ -158,2 +165,4 @@ readonly props: Required<DeviceProps>;

};
/** stats */
readonly statsManager: StatsManager;
/** Used by other luma.gl modules to store data on the device */

@@ -224,4 +233,2 @@ _lumaData: {

abstract beginComputePass(props?: ComputePassProps): ComputePass;
/** Get a renderpass that is set up to render to the primary CanvasContext */
abstract getDefaultRenderPass(): RenderPass;
/** Create a transform feedback (immutable set of output buffer bindings). WebGL only. */

@@ -266,2 +273,5 @@ abstract createTransformFeedback(props: TransformFeedbackProps): TransformFeedback;

}): void;
timestamp: number;
/** A monotonic counter for tracking buffer and texture updates */
incrementTimestamp(): number;
/** Report unhandled device errors */

@@ -268,0 +278,0 @@ onError(error: Error): void;

@@ -16,4 +16,6 @@ // luma.gl

features;
constructor(features = []) {
disabledFeatures;
constructor(features = [], disabledFeatures) {
this.features = new Set(features);
this.disabledFeatures = disabledFeatures || {};
}

@@ -24,3 +26,3 @@ *[Symbol.iterator]() {

has(feature) {
return this.features.has(feature);
return !this.disabledFeatures[feature] && this.features.has(feature);
}

@@ -34,3 +36,2 @@ }

id: null,
type: 'best-available',
canvas: null,

@@ -41,6 +42,11 @@ container: null,

height: 600,
requestMaximalLimits: true,
requestMaxLimits: true,
debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)
spector: Boolean(log.get('spector')), // Initialize the SpectorJS WebGL debugger
break: [],
// TODO - Change these after confirming things work as expected
initalizeFeatures: true,
disabledFeatures: {
'compilation-status-async-webgl': true
},
// alpha: undefined,

@@ -67,4 +73,2 @@ // depth: undefined,

id;
/** stats */
statsManager = lumaStats;
/** A copy of the device props */

@@ -74,2 +78,4 @@ props;

userData = {};
/** stats */
statsManager = lumaStats;
/** Used by other luma.gl modules to store data on the device */

@@ -132,3 +138,7 @@ _lumaData = {};

}
// IMPLEMENTATION
timestamp = 0;
/** A monotonic counter for tracking buffer and texture updates */
incrementTimestamp() {
return this.timestamp++;
}
// Error Handling

@@ -139,2 +149,3 @@ /** Report unhandled device errors */

}
// IMPLEMENTATION
_getBufferProps(props) {

@@ -141,0 +152,0 @@ if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {

@@ -42,6 +42,8 @@ import type { Device } from "../device.js";

abstract byteLength: number;
/** "Time" of last update */
updateTimestamp: number;
constructor(device: Device, props: BufferProps);
/** Write data to buffer */
abstract write(data: ArrayBufferView, byteOffset?: number): void;
/** Read data asynchronoursly */
/** Read data asynchronously */
abstract readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array>;

@@ -48,0 +50,0 @@ /** Read data synchronously. @note WebGL2 only */

@@ -38,2 +38,4 @@ // luma.gl

indexType;
/** "Time" of last update */
updateTimestamp;
constructor(device, props) {

@@ -53,2 +55,4 @@ const deducedProps = { ...props };

this.indexType = deducedProps.indexType;
// TODO - perhaps this should be set on async write completion?
this.updateTimestamp = device.incrementTimestamp();
}

@@ -55,0 +59,0 @@ /** Read data synchronously. @note WebGL2 only */

import { Resource, ResourceProps } from "./resource.js";
import { BindingDeclaration } from "../types/shader-layout.js";
import type { ComputeShaderLayout, Binding } from "../types/shader-layout.js";
import type { Device } from "../device.js";

@@ -10,6 +10,10 @@ import type { Shader } from "./shader.js";

handle?: unknown;
cs: Shader;
csEntryPoint?: string;
csConstants?: Record<string, number>;
shaderLayout?: BindingDeclaration[];
/** Compiled shader object */
shader: Shader;
/** The entry point, defaults to main */
entryPoint?: string;
/** These are WGSL constant values - different from GLSL defines in that shader does not need to be recompiled */
constants?: Record<string, number>;
/** Describes the attributes and bindings exposed by the pipeline shader(s). */
shaderLayout?: ComputeShaderLayout | null;
};

@@ -24,3 +28,8 @@ /**

constructor(device: Device, props: ComputePipelineProps);
/**
* @todo Use renderpass.setBindings() ?
* @todo Do we want to expose BindGroups in the API and remove this?
*/
abstract setBindings(bindings: Record<string, Binding>): void;
}
//# sourceMappingURL=compute-pipeline.d.ts.map

@@ -11,6 +11,6 @@ // luma.gl

...Resource.defaultProps,
cs: undefined,
csEntryPoint: undefined,
csConstants: {},
shaderLayout: []
shader: undefined,
entryPoint: undefined,
constants: {},
shaderLayout: undefined
};

@@ -17,0 +17,0 @@ get [Symbol.toStringTag]() {

@@ -16,3 +16,3 @@ // luma.gl

height: 1,
colorAttachments: [], // ['rgba8unorm-unsized'],
colorAttachments: [], // ['rgba8unorm'],
depthStencilAttachment: null // 'depth24plus-stencil8'

@@ -53,2 +53,5 @@ };

autoCreateAttachmentTextures() {
if (this.props.colorAttachments.length === 0 && !this.props.depthStencilAttachment) {
throw new Error('Framebuffer has noattachments');
}
this.colorAttachments = this.props.colorAttachments.map(attachment => {

@@ -55,0 +58,0 @@ if (typeof attachment === 'string') {

@@ -14,11 +14,11 @@ import type { Device } from "../device.js";

vs?: Shader | null;
/** Vertex shader entry point (defaults to 'main'). WGSL only */
vsEntryPoint?: string;
/** Constants to apply to compiled vertex shader (WGSL only) */
/** Name of vertex shader stage main function (defaults to 'main'). WGSL only */
vertexEntryPoint?: string;
/** Constant values to apply to compiled vertex shader. Do not require re-compilation. (WGSL only) */
vsConstants?: Record<string, number>;
/** Compiled fragment shader */
fs?: Shader | null;
/** Fragment shader entry point (defaults to 'main'). WGSL only */
fsEntryPoint?: string;
/** Constants to apply to compiled fragment shader (WGSL only) */
/** Name of fragment shader stage main function (defaults to 'main'). WGSL only */
fragmentEntryPoint?: string;
/** Constant values to apply to compiled fragment shader. Do not require re-compilation. (WGSL only) */
fsConstants?: Record<string, number>;

@@ -64,3 +64,3 @@ /** Describes the attributes and bindings exposed by the pipeline shader(s). */

abstract setBindings(bindings: Record<string, Binding>): void;
/** Draw call */
/** Draw call. Returns false if the draw call was aborted (due to resources still initializing) */
abstract draw(options: {

@@ -86,3 +86,3 @@ /** Render pass to draw into (targeting screen or framebuffer) */

transformFeedback?: TransformFeedback;
}): void;
}): boolean;
/**

@@ -89,0 +89,0 @@ * Uniforms

@@ -13,6 +13,6 @@ // luma.gl

vs: null,
vsEntryPoint: '', // main
vertexEntryPoint: 'vertexMain',
vsConstants: {},
fs: null,
fsEntryPoint: '', // main
fragmentEntryPoint: 'fragmentMain',
fsConstants: {},

@@ -19,0 +19,0 @@ shaderLayout: null,

@@ -10,4 +10,4 @@ import type { Device } from "../device.js";

language?: 'glsl' | 'wgsl' | 'auto';
/** Which stage are we compiling? Required by WebGL and GLSL transpiler */
stage: 'vertex' | 'fragment' | 'compute';
/** Which stage are we compiling? Required for GLSL. Ignored for WGSL. */
stage?: 'vertex' | 'fragment' | 'compute';
/** Shader source code */

@@ -44,3 +44,3 @@ source: string;

/** In browser logging of errors */
debugShader(trigger?: "never" | "errors" | "warnings" | "always"): Promise<void>;
debugShader(trigger?: "never" | "always" | "errors" | "warnings"): Promise<void>;
/** In-browser UI logging of errors */

@@ -47,0 +47,0 @@ protected _displayShaderLog(messages: readonly CompilerMessage[]): void;

@@ -17,3 +17,3 @@ // luma.gl

language: 'auto',
stage: 'vertex',
stage: undefined,
source: '',

@@ -20,0 +20,0 @@ sourceMap: null,

@@ -83,4 +83,9 @@ /// <reference types="node" />

abstract view: TextureView;
/** "Time" of last update. Monotonically increasing timestamp */
updateTimestamp: number;
/** Do not use directly. Create with device.createTexture() */
constructor(device: Device, props: Props, defaultProps?: Required<Props>);
/** Create a texture view for this texture */
abstract createView(props?: TextureViewProps): TextureView;
}
//# sourceMappingURL=texture.d.ts.map

@@ -49,2 +49,5 @@ // luma.gl

depth;
/** "Time" of last update. Monotonically increasing timestamp */
updateTimestamp;
/** Do not use directly. Create with device.createTexture() */
constructor(device, props, defaultProps = Texture.defaultProps) {

@@ -57,3 +60,5 @@ super(device, props, defaultProps);

this.depth = this.props.depth;
// TODO - perhaps this should be set on async write completion?
this.updateTimestamp = device.incrementTimestamp();
}
}

@@ -33,3 +33,3 @@ import type { TextureFormat } from "../types/texture-formats.js";

attributes: AttributeDeclaration[];
/** All bidning points (textures, samplers, uniform buffers) with their locations and type */
/** All binding points (textures, samplers, uniform buffers) with their locations and type */
bindings: BindingDeclaration[];

@@ -41,2 +41,6 @@ /** WebGL only (WebGPU use bindings and uniform buffers) */

};
export type ComputeShaderLayout = {
/** All binding points (textures, samplers, uniform buffers) with their locations and type */
bindings: BindingDeclaration[];
};
/**

@@ -56,3 +60,3 @@ * Declares one for attributes

/** ShaderLayout for bindings */
export type BindingDeclaration = UniformBufferBindingLayout | BufferBindingLayout | TextureBindingLayout | SamplerBindingLayout | StorageTextureBindingLayout;
export type BindingDeclaration = UniformBufferBindingLayout | StorageBufferBindingLayout | TextureBindingLayout | SamplerBindingLayout | StorageTextureBindingLayout;
export type UniformBufferBindingLayout = {

@@ -75,4 +79,4 @@ type: 'uniform';

};
export type BufferBindingLayout = {
type: 'uniform' | 'storage' | 'read-only-storage';
export type StorageBufferBindingLayout = {
type: 'storage' | 'read-only-storage';
name: string;

@@ -79,0 +83,0 @@ location: number;

@@ -50,3 +50,3 @@ export { VERSION } from "./init.js";

export type { ColorAttachment, DepthStencilAttachment } from "./adapter/types/types.js";
export type { ShaderLayout, AttributeDeclaration, BindingDeclaration, Binding } from "./adapter/types/shader-layout.js";
export type { ShaderLayout, ComputeShaderLayout, AttributeDeclaration, BindingDeclaration, Binding } from "./adapter/types/shader-layout.js";
export type { BufferLayout, BufferAttributeLayout } from "./adapter/types/buffer-layout.js";

@@ -53,0 +53,0 @@ export type { AttributeBinding, UniformBinding, UniformBlockBinding, VaryingBinding } from "./adapter/types/shader-layout.js";

@@ -14,3 +14,3 @@ // luma.gl

// @ts-expect-error
const VERSION = typeof "9.0.0-beta.5" !== 'undefined' ? "9.0.0-beta.5" : 'running from source';
const VERSION = typeof "9.0.0-beta.6" !== 'undefined' ? "9.0.0-beta.6" : 'running from source';
const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';

@@ -17,0 +17,0 @@ // Assign luma.log.level in console to control logging: \

@@ -5,2 +5,6 @@ import type { Log } from '@probe.gl/log';

import { StatsManager } from "../utils/stats-manager.js";
export type CreateDeviceProps = DeviceProps & {
/** Select type of device */
type?: 'webgl' | 'webgpu' | 'best-available';
};
/**

@@ -19,6 +23,6 @@ * Entry point to the luma.gl GPU abstraction

static getSupportedDevices(): string[];
static setDefaultDeviceProps(props: DeviceProps): void;
static setDefaultDeviceProps(props: CreateDeviceProps): void;
/** Creates a device. Asynchronously. */
static createDevice(props?: DeviceProps): Promise<Device>;
static createDevice(props?: CreateDeviceProps): Promise<Device>;
}
//# sourceMappingURL=luma.d.ts.map

@@ -40,3 +40,3 @@ // luma.gl

destroy() {
for (const uniformBuffer of Object.values(this.uniformBuffers)) {
for (const uniformBuffer of this.uniformBuffers.values()) {
uniformBuffer.destroy();

@@ -43,0 +43,0 @@ }

{
"name": "@luma.gl/core",
"version": "9.0.0-beta.6",
"version": "9.0.0-beta.7",
"description": "The luma.gl core Device API",

@@ -45,3 +45,3 @@ "license": "MIT",

},
"gitHead": "cb2f0938d03a65e3588622ac99650b14a10488b6"
"gitHead": "e9606a88e0aab3dc27c87020cac89040ea1a8a02"
}

@@ -37,3 +37,3 @@ // luma.gl

/** Type of device */
type: 'webgl' | 'webgpu';
type: 'webgl' | 'webgpu' | 'unknown';
/** Vendor (name of GPU vendor, Apple, nVidia etc */

@@ -120,5 +120,10 @@ vendor: string;

protected features: Set<DeviceFeature>;
protected disabledFeatures?: Partial<Record<DeviceFeature, boolean>>;
constructor(features: DeviceFeature[] = []) {
constructor(
features: DeviceFeature[] = [],
disabledFeatures: Partial<Record<DeviceFeature, boolean>>
) {
this.features = new Set<DeviceFeature>(features);
this.disabledFeatures = disabledFeatures || {};
}

@@ -131,3 +136,3 @@

has(feature: DeviceFeature): boolean {
return this.features.has(feature);
return !this.disabledFeatures[feature] && this.features.has(feature);
}

@@ -199,4 +204,2 @@ }

type?: 'webgl' | 'webgpu' | 'best-available';
// Common parameters

@@ -208,4 +211,4 @@ canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id

/** Request a Device with the highest limits supported by platform. */
requestMaximalLimits?: boolean;
/** Request a Device with the highest limits supported by platform. WebGPU: devices can be created with minimal limits. */
requestMaxLimits?: boolean;

@@ -221,13 +224,22 @@ // WebGLContext PARAMETERS - Can only be set on context creation...

/** Error handling */
onError?: (error: Error) => unknown;
/** Instrument context (at the expense of performance) */
// DEBUG SETTINGS
/** WebGL: Instrument WebGL2RenderingContext (at the expense of performance) */
debug?: boolean;
/** Initialize the SpectorJS WebGL debugger */
/** Break on WebGL functions matching these strings */
break?: string[];
/** WebGL: Initialize the SpectorJS WebGL debugger */
spector?: boolean;
/** Initialize all features on startup */
initalizeFeatures?: boolean;
/** Disable specific features */
disabledFeatures?: Partial<Record<DeviceFeature, boolean>>;
// Unclear if these are still supported
manageState?: boolean; // Set to false to disable WebGL state management instrumentation
break?: string[]; // TODO: types
/** TODO- Unclear if still supported: Set to false to disable WebGL state management instrumentation */
manageState?: boolean;
// @deprecated Attach to existing context
// @deprecated Attach to existing context. Rename to handle? Use Device.attach?
gl?: WebGL2RenderingContext | null;

@@ -242,3 +254,2 @@ };

id: null!,
type: 'best-available',
canvas: null,

@@ -250,3 +261,3 @@ container: null,

requestMaximalLimits: true,
requestMaxLimits: true,
debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)

@@ -256,2 +267,8 @@ spector: Boolean(log.get('spector')), // Initialize the SpectorJS WebGL debugger

// TODO - Change these after confirming things work as expected
initalizeFeatures: true,
disabledFeatures: {
'compilation-status-async-webgl': true
},
// alpha: undefined,

@@ -284,4 +301,4 @@ // depth: undefined,

readonly id: string;
/** stats */
readonly statsManager: StatsManager = lumaStats;
/** type of this device */
abstract readonly type: 'webgl' | 'webgpu' | 'unknown';
/** A copy of the device props */

@@ -291,2 +308,5 @@ readonly props: Required<DeviceProps>;

userData: {[key: string]: unknown} = {};
/** stats */
readonly statsManager: StatsManager = lumaStats;
/** Used by other luma.gl modules to store data on the device */

@@ -301,6 +321,4 @@ _lumaData: {[key: string]: unknown} = {};

abstract info: DeviceInfo;
/** Optional capability discovery */
abstract features: DeviceFeatures;
/** WebGPU style device limits */

@@ -405,5 +423,2 @@ abstract get limits(): DeviceLimits;

/** Get a renderpass that is set up to render to the primary CanvasContext */
abstract getDefaultRenderPass(): RenderPass;
/** Create a transform feedback (immutable set of output buffer bindings). WebGL only. */

@@ -477,4 +492,9 @@ abstract createTransformFeedback(props: TransformFeedbackProps): TransformFeedback;

// IMPLEMENTATION
timestamp: number = 0;
/** A monotonic counter for tracking buffer and texture updates */
incrementTimestamp(): number {
return this.timestamp++;
}
// Error Handling

@@ -487,2 +507,4 @@

// IMPLEMENTATION
protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps {

@@ -489,0 +511,0 @@ if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {

@@ -64,2 +64,4 @@ // luma.gl

abstract byteLength: number;
/** "Time" of last update */
updateTimestamp: number;

@@ -82,2 +84,4 @@ constructor(device: Device, props: BufferProps) {

this.indexType = deducedProps.indexType;
// TODO - perhaps this should be set on async write completion?
this.updateTimestamp = device.incrementTimestamp();
}

@@ -87,3 +91,3 @@

abstract write(data: ArrayBufferView, byteOffset?: number): void;
/** Read data asynchronoursly */
/** Read data asynchronously */
abstract readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array>;

@@ -90,0 +94,0 @@

@@ -6,3 +6,3 @@ // luma.gl

import {Resource, ResourceProps} from './resource';
import {BindingDeclaration} from '../types/shader-layout';
import type {ComputeShaderLayout, Binding} from '../types/shader-layout';
import type {Device} from '../device';

@@ -16,6 +16,10 @@ import type {Shader} from './shader';

handle?: unknown;
cs: Shader;
csEntryPoint?: string;
csConstants?: Record<string, number>; // WGSL only
shaderLayout?: BindingDeclaration[];
/** Compiled shader object */
shader: Shader;
/** The entry point, defaults to main */
entryPoint?: string;
/** These are WGSL constant values - different from GLSL defines in that shader does not need to be recompiled */
constants?: Record<string, number>;
/** Describes the attributes and bindings exposed by the pipeline shader(s). */
shaderLayout?: ComputeShaderLayout | null;
};

@@ -29,6 +33,6 @@

...Resource.defaultProps,
cs: undefined,
csEntryPoint: undefined,
csConstants: {},
shaderLayout: []
shader: undefined,
entryPoint: undefined,
constants: {},
shaderLayout: undefined
};

@@ -45,2 +49,8 @@

}
/**
* @todo Use renderpass.setBindings() ?
* @todo Do we want to expose BindGroups in the API and remove this?
*/
abstract setBindings(bindings: Record<string, Binding>): void;
}

@@ -32,3 +32,3 @@ // luma.gl

height: 1,
colorAttachments: [], // ['rgba8unorm-unsized'],
colorAttachments: [], // ['rgba8unorm'],
depthStencilAttachment: null // 'depth24plus-stencil8'

@@ -82,2 +82,6 @@ };

protected autoCreateAttachmentTextures(): void {
if (this.props.colorAttachments.length === 0 && !this.props.depthStencilAttachment) {
throw new Error('Framebuffer has noattachments');
}
this.colorAttachments = this.props.colorAttachments.map(attachment => {

@@ -84,0 +88,0 @@ if (typeof attachment === 'string') {

@@ -22,11 +22,11 @@ // luma.gl

vs?: Shader | null;
/** Vertex shader entry point (defaults to 'main'). WGSL only */
vsEntryPoint?: string; //
/** Constants to apply to compiled vertex shader (WGSL only) */
/** Name of vertex shader stage main function (defaults to 'main'). WGSL only */
vertexEntryPoint?: string; //
/** Constant values to apply to compiled vertex shader. Do not require re-compilation. (WGSL only) */
vsConstants?: Record<string, number>; // WGSL only
/** Compiled fragment shader */
fs?: Shader | null;
/** Fragment shader entry point (defaults to 'main'). WGSL only */
fsEntryPoint?: string; // WGSL only
/** Constants to apply to compiled fragment shader (WGSL only) */
/** Name of fragment shader stage main function (defaults to 'main'). WGSL only */
fragmentEntryPoint?: string; // WGSL only
/** Constant values to apply to compiled fragment shader. Do not require re-compilation. (WGSL only) */
fsConstants?: Record<string, number>;

@@ -69,7 +69,7 @@

vs: null,
vsEntryPoint: '', // main
vertexEntryPoint: 'vertexMain',
vsConstants: {},
fs: null,
fsEntryPoint: '', // main
fragmentEntryPoint: 'fragmentMain',
fsConstants: {},

@@ -114,3 +114,3 @@

/** Draw call */
/** Draw call. Returns false if the draw call was aborted (due to resources still initializing) */
abstract draw(options: {

@@ -136,3 +136,3 @@ /** Render pass to draw into (targeting screen or framebuffer) */

transformFeedback?: TransformFeedback;
}): void;
}): boolean;

@@ -139,0 +139,0 @@ // DEPRECATED METHODS

@@ -19,4 +19,4 @@ // luma.gl

language?: 'glsl' | 'wgsl' | 'auto';
/** Which stage are we compiling? Required by WebGL and GLSL transpiler */
stage: 'vertex' | 'fragment' | 'compute';
/** Which stage are we compiling? Required for GLSL. Ignored for WGSL. */
stage?: 'vertex' | 'fragment' | 'compute';
/** Shader source code */

@@ -40,3 +40,3 @@ source: string;

language: 'auto',
stage: 'vertex',
stage: undefined,
source: '',

@@ -43,0 +43,0 @@ sourceMap: null,

@@ -130,2 +130,6 @@ // luma.gl

/** "Time" of last update. Monotonically increasing timestamp */
updateTimestamp: number;
/** Do not use directly. Create with device.createTexture() */
constructor(

@@ -142,3 +146,9 @@ device: Device,

this.depth = this.props.depth;
// TODO - perhaps this should be set on async write completion?
this.updateTimestamp = device.incrementTimestamp();
}
/** Create a texture view for this texture */
abstract createView(props?: TextureViewProps): TextureView;
}

@@ -38,3 +38,3 @@ // luma.gl

attributes: AttributeDeclaration[];
/** All bidning points (textures, samplers, uniform buffers) with their locations and type */
/** All binding points (textures, samplers, uniform buffers) with their locations and type */
bindings: BindingDeclaration[];

@@ -47,2 +47,7 @@ /** WebGL only (WebGPU use bindings and uniform buffers) */

export type ComputeShaderLayout = {
/** All binding points (textures, samplers, uniform buffers) with their locations and type */
bindings: BindingDeclaration[];
};
/**

@@ -93,3 +98,3 @@ * Declares one for attributes

| UniformBufferBindingLayout
| BufferBindingLayout
| StorageBufferBindingLayout
| TextureBindingLayout

@@ -118,4 +123,4 @@ | SamplerBindingLayout

export type BufferBindingLayout = {
type: 'uniform' | 'storage' | 'read-only-storage';
export type StorageBufferBindingLayout = {
type: 'storage' | 'read-only-storage';
name: string;

@@ -122,0 +127,0 @@ location: number;

@@ -136,6 +136,5 @@ // luma.gl

/** Unsized texture formats (the only formats supported by WebGL1) */
export type UnsizedColorTextureFormat =
// 'r8unorm-unsized' |
// 'ra8unorm-unsized' |
'rgb8unorm-unsized' | 'rgba8unorm-unsized';
export type UnsizedColorTextureFormat = 'rgb8unorm-unsized' | 'rgba8unorm-unsized';
// 'r8unorm-unsized' |
// 'ra8unorm-unsized' |
// 'rgb8unorm-srgb-unsized' |

@@ -142,0 +141,0 @@ // 'rgba8unorm-srgb-unsized'

@@ -112,2 +112,3 @@ // luma.gl

ShaderLayout,
ComputeShaderLayout,
AttributeDeclaration,

@@ -114,0 +115,0 @@ BindingDeclaration,

@@ -15,2 +15,7 @@ // luma.gl

export type CreateDeviceProps = DeviceProps & {
/** Select type of device */
type?: 'webgl' | 'webgpu' | 'best-available';
};
/**

@@ -50,3 +55,3 @@ * Entry point to the luma.gl GPU abstraction

static setDefaultDeviceProps(props: DeviceProps): void {
static setDefaultDeviceProps(props: CreateDeviceProps): void {
Object.assign(Device.defaultProps, props);

@@ -56,3 +61,3 @@ }

/** Creates a device. Asynchronously. */
static async createDevice(props: DeviceProps = {}): Promise<Device> {
static async createDevice(props: CreateDeviceProps = {}): Promise<Device> {
props = {...Device.defaultProps, ...props};

@@ -59,0 +64,0 @@ if (props.gl) {

@@ -69,3 +69,3 @@ // luma.gl

destroy(): void {
for (const uniformBuffer of Object.values(this.uniformBuffers)) {
for (const uniformBuffer of this.uniformBuffers.values()) {
uniformBuffer.destroy();

@@ -72,0 +72,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc