@luma.gl/core 9.0.20 → 9.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var J=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Me=(r,t,e)=>t in r?J(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Ne=(r,t)=>{for(var e in t)J(r,e,{get:t[e],enumerable:!0})},Fe=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $e(t))!Ie.call(r,n)&&n!==e&&J(r,n,{get:()=>t[n],enumerable:!(o=Re(t,n))||o.enumerable});return r};var De=r=>Fe(J({},"__esModule",{value:!0}),r);var c=(r,t,e)=>(Me(r,typeof t!="symbol"?t+"":t,e),e);var _r={};Ne(_r,{Buffer:()=>m,CanvasContext:()=>F,CommandBuffer:()=>Y,CommandEncoder:()=>j,ComputePass:()=>W,ComputePipeline:()=>O,Device:()=>b,DeviceFeatures:()=>at,DeviceLimits:()=>it,ExternalTexture:()=>U,Framebuffer:()=>k,QuerySet:()=>Q,RenderPass:()=>V,RenderPipeline:()=>z,Resource:()=>u,Sampler:()=>H,Shader:()=>G,StatsManager:()=>I,Texture:()=>d,TextureView:()=>D,TransformFeedback:()=>K,UniformBlock:()=>L,UniformBufferLayout:()=>B,UniformStore:()=>dt,VERSION:()=>nt,VertexArray:()=>q,assert:()=>C,cancelAnimationFrame:()=>Le,cast:()=>xe,checkProps:()=>Te,decodeShaderAttributeType:()=>ft,decodeShaderUniformType:()=>lt,decodeTextureFormat:()=>oe,decodeVertexFormat:()=>X,deepEqual:()=>pt,fillArray:()=>de,formatCompilerLog:()=>ut,formatValue:()=>Ht,getAttributeInfosFromLayouts:()=>Mt,getDataTypeFromTypedArray:()=>Ut,getScratchArray:()=>me,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>ye,getVertexFormatFromAttribute:()=>be,glsl:()=>vr,isNumberArray:()=>g,isObjectEmpty:()=>te,isTypedArray:()=>yt,isUniformValue:()=>Gt,loadFile:()=>Ee,loadImage:()=>_e,loadImageBitmap:()=>ve,loadScript:()=>Pe,log:()=>l,luma:()=>A,makeRandomNumberGenerator:()=>kt,mergeShaderLayout:()=>fe,random:()=>Ce,requestAnimationFrame:()=>Be,setPathPrefix:()=>Ae,splitUniformsAndBindings:()=>we,stubRemovedMethods:()=>Se,uid:()=>w});var tt=globalThis,Ue=globalThis.document||{},et=globalThis.process||{},Ge=globalThis.console,Cr=globalThis.navigator||{};function Ot(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,e=r||t;return Boolean(e&&e.indexOf("Electron")>=0)}function h(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ot()}var gt="4.0.7";function ke(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var rt=class{constructor(t,e,o="sessionStorage"){this.storage=ke(o),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function Wt(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function jt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var ot;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ot||(ot={}));var ze=10;function Yt(r){return typeof r!="string"?r:(r=r.toUpperCase(),ot[r]||ot.WHITE)}function Xt(r,t,e){return!h&&typeof r=="string"&&(t&&(r=`\x1B[${Yt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Yt(e)+ze}m${r}\x1B[49m`)),r}function qt(r,t=["constructor"]){let e=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(e),n=r;for(let s of o){let i=n[s];typeof i=="function"&&(t.find(a=>s===a)||(n[s]=i.bind(r)))}}function R(r,t){if(!r)throw new Error(t||"Assertion failed")}function S(){let r;if(h()&&tt.performance)r=tt?.performance?.now?.();else if("hrtime"in et){let t=et?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var E={debug:h()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ve={enabled:!0,level:0};function v(){}var Kt={},Qt={once:!0},x=class{constructor({id:t}={id:""}){this.VERSION=gt,this._startTs=S(),this._deltaTs=S(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new rt(`__probe-${this.id}__`,Ve),this.timeStamp(`${this.id} started`),qt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((S()-this._startTs).toPrecision(10))}getDelta(){return Number((S()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){if(!t)throw new Error(e||"Assertion failed")}warn(t){return this._getLogFunction(0,t,E.warn,arguments,Qt)}error(t){return this._getLogFunction(0,t,E.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,E.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,E.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,E.debug||E.info,arguments,Qt)}table(t,e,o){return e?this._getLogFunction(t,e,console.table||v,o&&[o],{tag:We(e)}):v}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||v)}group(t,e,o={collapsed:!1}){let n=Zt({logLevel:t,message:e,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e,o={}){return this.group(t,e,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||v)}withGroup(t,e,o){this.group(t,e)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Jt(t)}_getLogFunction(t,e,o,n,s){if(this._shouldLog(t)){s=Zt({logLevel:t,message:e,args:n,opts:s}),o=o||s.method,R(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=S();let i=s.tag||s.message;if(s.once&&i)if(!Kt[i])Kt[i]=S();else return v;return e=Oe(this.id,s.message,s),o.bind(console,e,...s.args)}return v}};x.VERSION=gt;function Jt(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return R(Number.isFinite(t)&&t>=0),t}function Zt(r){let{logLevel:t,message:e}=r;r.logLevel=Jt(t);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&o.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return R(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Oe(r,t,e){if(typeof t=="string"){let o=e.time?jt(Wt(e.total)):"";t=e.time?`${r}: ${o} ${t}`:`${r}: ${t}`,t=Xt(t,e.color,e.background)}return t}function We(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var Jr=new x({id:"@probe.gl/log"});var l=new x({id:"luma.gl"});function $(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var T=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=$(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime($()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var _=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:o}=t,n=this.stats[e];return n||(t instanceof T?n=t:n=new T(e,o),this.stats[e]=n),n}};var I=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new _({id:t})),this.stats.get(t)}},P=new I;function je(){let r="9.0.20",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==r)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${r}`);return globalThis.luma||(h()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:P}),r}var nt=je();function yt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function g(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:yt(r)}var bt={};function w(r="id"){bt[r]=bt[r]||1;let t=bt[r]++;return`${r}-${t}`}function te(r){let t=!0;for(let e in r){t=!1;break}return t}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,o){if(!t)throw new Error("no device");this._device=t,this.props=Ye(e,o);let n=this.props.id!=="undefined"?this.props.id:w(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(t),o.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};c(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ye(r,t){let e={...t};for(let o in r)r[o]!==void 0&&(e[o]=r[o]);return e}var M=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let o={...e};(e.usage||0)&M.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?o.indexType="uint32":e.data instanceof Uint16Array&&(o.indexType="uint16")),super(t,o,M.defaultProps),this.usage=e.usage||0,this.indexType=o.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,o){let n=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:o,M.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&o===t.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(e,e+s)}},m=M;c(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),c(m,"MAP_READ",1),c(m,"MAP_WRITE",2),c(m,"COPY_SRC",4),c(m,"COPY_DST",8),c(m,"INDEX",16),c(m,"VERTEX",32),c(m,"UNIFORM",64),c(m,"STORAGE",128),c(m,"INDIRECT",256),c(m,"QUERY_RESOLVE",512),c(m,"DEBUG_DATA_MAX_LENGTH",32);function st(r){let t=ee[r],e=Xe(t),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:ee[r],byteLength:e,integer:n,signed:s,normalized:o}}function Xe(r){return qe[r]}var ee={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},qe={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Ke=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Qe=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function re(r){return Ke.some(t=>r.startsWith(t))}function oe(r){let t=Qe.exec(r);if(t){let[,e,o,n,s,i]=t;if(e){let a=`${n}${o}`,f=st(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return Je(r)}var Ze={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Je(r){let t=Ze[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var it=class{},at=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},xt=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...xt.defaultProps,...t},this.id=this.props.id||w(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=P;_lumaData={};isTextureFormatCompressed(t){return re(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},b=xt;c(b,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")||l.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),c(b,"VERSION",nt);function C(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var N=new Map,wt=class{static registerDevices(t){for(let e of t)C(e.type&&e.isSupported&&e.create),N.set(e.type,e)}static getAvailableDevices(){return Array.from(N).map(t=>t.type)}static getSupportedDevices(){return Array.from(N).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(b.defaultProps,t)}static async attachDevice(t){let e=ne(t.devices)||N;if(t.handle instanceof WebGL2RenderingContext){let o=e.get("webgl");if(o)return await o.attach(t.handle)}if(t.handle===null){let o=e.get("unknown");if(o)return await o.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(t={}){t={...wt.defaultProps,...t},t.gl&&(t.type="webgl");let e=ne(t.devices)||N;switch(t.type){case"webgpu":let o=e.get("webgpu");if(o)return await o.create(t);break;case"webgl":let n=e.get("webgl");if(n)return await n.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(o=e.get("webgpu"),o?.isSupported?.())return await o.create(t);if(n=e.get("webgl"),n?.isSupported?.())return await n.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(o,n){return o==="webgl"||o==="experimental-webgl"?this.originalGetContext("webgl2",n):this.originalGetContext(o,n)}}},A=wt;c(A,"defaultProps",{...b.defaultProps,type:"best-available",devices:void 0}),c(A,"stats",P),c(A,"log",l);function ne(r){if(!r||r?.length===0)return null;let t=new Map;for(let e of r)t.set(e.type,e);return t}var tr=h()&&typeof document<"u",ct=()=>tr&&document.readyState==="complete",er={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},F=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ct()}constructor(t){if(this.props={...er,...t},t=this.props,!h()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=nr(t.canvas):this.canvas=t.canvas;else{let e=sr(t),o=or(t?.container||null);o.insertBefore(e,o.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let o of e)o.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ir(t,o,n,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let o="width"in e?e.width:this.htmlCanvas.clientWidth,n="height"in e?e.height:this.htmlCanvas.clientHeight;(!o||!n)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==t){let i=t,a=Math.floor(o*i),f=Math.floor(n*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[p,y]=this.getDrawingBufferSize();(p!==a||y!==f)&&(i=Math.min(p/o,y/n),this.htmlCanvas.width=Math.floor(o*i),this.htmlCanvas.height=Math.floor(n*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};c(F,"pageLoaded",rr());function rr(){return ct()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function or(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function nr(r){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function sr(r){let{width:t,height:e}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=t||1,o.height=e||1,o.style.width=Number.isFinite(t)?`${t}px`:"100%",o.style.height=Number.isFinite(e)?`${e}px`:"100%",o}function ir(r,t,e,o,n){let s=r,i=se(s[0],t,e),a=ie(s[1],t,o,n),f=se(s[0]+1,t,e),p=f===e-1?f:f-1;f=ie(s[1]+1,t,o,n);let y;return n?(f=f===0?f:f+1,y=a,a=f):y=f===o-1?f:f-1,{x:i,y:a,width:Math.max(p-i+1,1),height:Math.max(y-a+1,1)}}function se(r,t,e){return Math.min(Math.round(r*t),e-1)}function ie(r,t,e,o){return o?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var St=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,o=St.defaultProps){super(t,e,o),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=t.incrementTimestamp()}},d=St;c(d,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),c(d,"COPY_SRC",1),c(d,"COPY_DST",2),c(d,"TEXTURE_BINDING",4),c(d,"STORAGE_BINDING",8),c(d,"RENDER_ATTACHMENT",16);var Tt=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,Tt.defaultProps)}},D=Tt;c(D,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var At=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,At.defaultProps)}},U=At;c(U,"defaultProps",{...u.defaultProps,source:null,colorSpace:"srgb"});function ut(r,t,e){let o="",n=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=n.length;a++)for(o+=ce(n[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];o+=ae(f,n,f.lineNum,{...e,inlineSource:!1})}return o;case"issues":case"no":for(let a of r)o+=ae(a,n,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return o}}function ae(r,t,e,o){if(o?.inlineSource){let n=ar(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
7
+ "use strict";var __exports__=(()=>{var J=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Me=(r,t,e)=>t in r?J(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Ne=(r,t)=>{for(var e in t)J(r,e,{get:t[e],enumerable:!0})},Fe=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $e(t))!Ie.call(r,n)&&n!==e&&J(r,n,{get:()=>t[n],enumerable:!(o=Re(t,n))||o.enumerable});return r};var De=r=>Fe(J({},"__esModule",{value:!0}),r);var c=(r,t,e)=>(Me(r,typeof t!="symbol"?t+"":t,e),e);var _r={};Ne(_r,{Buffer:()=>m,CanvasContext:()=>F,CommandBuffer:()=>Y,CommandEncoder:()=>j,ComputePass:()=>W,ComputePipeline:()=>O,Device:()=>b,DeviceFeatures:()=>at,DeviceLimits:()=>it,ExternalTexture:()=>U,Framebuffer:()=>k,QuerySet:()=>Q,RenderPass:()=>V,RenderPipeline:()=>z,Resource:()=>u,Sampler:()=>H,Shader:()=>G,StatsManager:()=>I,Texture:()=>d,TextureView:()=>D,TransformFeedback:()=>K,UniformBlock:()=>L,UniformBufferLayout:()=>B,UniformStore:()=>dt,VERSION:()=>nt,VertexArray:()=>q,assert:()=>C,cancelAnimationFrame:()=>Le,cast:()=>xe,checkProps:()=>Te,decodeShaderAttributeType:()=>ft,decodeShaderUniformType:()=>lt,decodeTextureFormat:()=>oe,decodeVertexFormat:()=>X,deepEqual:()=>pt,fillArray:()=>de,formatCompilerLog:()=>ut,formatValue:()=>Ht,getAttributeInfosFromLayouts:()=>Mt,getDataTypeFromTypedArray:()=>Ut,getScratchArray:()=>me,getScratchArrayBuffer:()=>Z,getTypedArrayFromDataType:()=>ye,getVertexFormatFromAttribute:()=>be,glsl:()=>vr,isNumberArray:()=>g,isObjectEmpty:()=>te,isTypedArray:()=>yt,isUniformValue:()=>Gt,loadFile:()=>Ee,loadImage:()=>_e,loadImageBitmap:()=>ve,loadScript:()=>Pe,log:()=>l,luma:()=>A,makeRandomNumberGenerator:()=>kt,mergeShaderLayout:()=>fe,random:()=>Ce,requestAnimationFrame:()=>Be,setPathPrefix:()=>Ae,splitUniformsAndBindings:()=>we,stubRemovedMethods:()=>Se,uid:()=>w});var tt=globalThis,Ue=globalThis.document||{},et=globalThis.process||{},Ge=globalThis.console,Cr=globalThis.navigator||{};function Ot(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,e=r||t;return Boolean(e&&e.indexOf("Electron")>=0)}function h(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ot()}var gt="4.0.7";function ke(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var rt=class{constructor(t,e,o="sessionStorage"){this.storage=ke(o),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function Wt(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function jt(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var ot;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ot||(ot={}));var ze=10;function Yt(r){return typeof r!="string"?r:(r=r.toUpperCase(),ot[r]||ot.WHITE)}function Xt(r,t,e){return!h&&typeof r=="string"&&(t&&(r=`\x1B[${Yt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Yt(e)+ze}m${r}\x1B[49m`)),r}function qt(r,t=["constructor"]){let e=Object.getPrototypeOf(r),o=Object.getOwnPropertyNames(e),n=r;for(let s of o){let i=n[s];typeof i=="function"&&(t.find(a=>s===a)||(n[s]=i.bind(r)))}}function R(r,t){if(!r)throw new Error(t||"Assertion failed")}function S(){let r;if(h()&&tt.performance)r=tt?.performance?.now?.();else if("hrtime"in et){let t=et?.hrtime?.();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var E={debug:h()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ve={enabled:!0,level:0};function v(){}var Kt={},Qt={once:!0},x=class{constructor({id:t}={id:""}){this.VERSION=gt,this._startTs=S(),this._deltaTs=S(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new rt(`__probe-${this.id}__`,Ve),this.timeStamp(`${this.id} started`),qt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((S()-this._startTs).toPrecision(10))}getDelta(){return Number((S()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){if(!t)throw new Error(e||"Assertion failed")}warn(t){return this._getLogFunction(0,t,E.warn,arguments,Qt)}error(t){return this._getLogFunction(0,t,E.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,E.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,E.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,E.debug||E.info,arguments,Qt)}table(t,e,o){return e?this._getLogFunction(t,e,console.table||v,o&&[o],{tag:We(e)}):v}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||v)}group(t,e,o={collapsed:!1}){let n=Zt({logLevel:t,message:e,opts:o}),{collapsed:s}=o;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e,o={}){return this.group(t,e,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||v)}withGroup(t,e,o){this.group(t,e)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Jt(t)}_getLogFunction(t,e,o,n,s){if(this._shouldLog(t)){s=Zt({logLevel:t,message:e,args:n,opts:s}),o=o||s.method,R(o),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=S();let i=s.tag||s.message;if(s.once&&i)if(!Kt[i])Kt[i]=S();else return v;return e=Oe(this.id,s.message,s),o.bind(console,e,...s.args)}return v}};x.VERSION=gt;function Jt(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return R(Number.isFinite(t)&&t>=0),t}function Zt(r){let{logLevel:t,message:e}=r;r.logLevel=Jt(t);let o=r.args?Array.from(r.args):[];for(;o.length&&o.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&o.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return R(n==="string"||n==="object"),Object.assign(r,{args:o},r.opts)}function Oe(r,t,e){if(typeof t=="string"){let o=e.time?jt(Wt(e.total)):"";t=e.time?`${r}: ${o} ${t}`:`${r}: ${t}`,t=Xt(t,e.color,e.background)}return t}function We(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}globalThis.probe={};var Jr=new x({id:"@probe.gl/log"});var l=new x({id:"luma.gl"});function $(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var T=class{constructor(t,e){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=$(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime($()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var _=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:o}=t,n=this.stats[e];return n||(t instanceof T?n=t:n=new T(e,o),this.stats[e]=n),n}};var I=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new _({id:t})),this.stats.get(t)}},P=new I;function je(){let r="9.0.21",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==r)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${r}`);return globalThis.luma||(h()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:P}),r}var nt=je();function yt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function g(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:yt(r)}var bt={};function w(r="id"){bt[r]=bt[r]||1;let t=bt[r]++;return`${r}-${t}`}function te(r){let t=!0;for(let e in r){t=!1;break}return t}var u=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,o){if(!t)throw new Error("no device");this._device=t,this.props=Ye(e,o);let n=this.props.id!=="undefined"?this.props.id:w(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(t),o.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};c(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ye(r,t){let e={...t};for(let o in r)r[o]!==void 0&&(e[o]=r[o]);return e}var M=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let o={...e};(e.usage||0)&M.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?o.indexType="uint32":e.data instanceof Uint16Array&&(o.indexType="uint16")),super(t,o,M.defaultProps),this.usage=e.usage||0,this.indexType=o.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,o){let n=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:o,M.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&o===t.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(e,e+s)}},m=M;c(m,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),c(m,"MAP_READ",1),c(m,"MAP_WRITE",2),c(m,"COPY_SRC",4),c(m,"COPY_DST",8),c(m,"INDEX",16),c(m,"VERTEX",32),c(m,"UNIFORM",64),c(m,"STORAGE",128),c(m,"INDIRECT",256),c(m,"QUERY_RESOLVE",512),c(m,"DEBUG_DATA_MAX_LENGTH",32);function st(r){let t=ee[r],e=Xe(t),o=r.includes("norm"),n=!o&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:ee[r],byteLength:e,integer:n,signed:s,normalized:o}}function Xe(r){return qe[r]}var ee={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},qe={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Ke=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Qe=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function re(r){return Ke.some(t=>r.startsWith(t))}function oe(r){let t=Qe.exec(r);if(t){let[,e,o,n,s,i]=t;if(e){let a=`${n}${o}`,f=st(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return Je(r)}var Ze={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Je(r){let t=Ze[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var it=class{},at=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},xt=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...xt.defaultProps,...t},this.id=this.props.id||w(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=P;_lumaData={};isTextureFormatCompressed(t){return re(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},b=xt;c(b,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")||l.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),c(b,"VERSION",nt);function C(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var N=new Map,wt=class{static registerDevices(t){for(let e of t)C(e.type&&e.isSupported&&e.create),N.set(e.type,e)}static getAvailableDevices(){return Array.from(N).map(t=>t.type)}static getSupportedDevices(){return Array.from(N).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(b.defaultProps,t)}static async attachDevice(t){let e=ne(t.devices)||N;if(t.handle instanceof WebGL2RenderingContext){let o=e.get("webgl");if(o)return await o.attach(t.handle)}if(t.handle===null){let o=e.get("unknown");if(o)return await o.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(t={}){t={...wt.defaultProps,...t},t.gl&&(t.type="webgl");let e=ne(t.devices)||N;switch(t.type){case"webgpu":let o=e.get("webgpu");if(o)return await o.create(t);break;case"webgl":let n=e.get("webgl");if(n)return await n.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(o=e.get("webgpu"),o?.isSupported?.())return await o.create(t);if(n=e.get("webgl"),n?.isSupported?.())return await n.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(o,n){return o==="webgl"||o==="experimental-webgl"?this.originalGetContext("webgl2",n):this.originalGetContext(o,n)}}},A=wt;c(A,"defaultProps",{...b.defaultProps,type:"best-available",devices:void 0}),c(A,"stats",P),c(A,"log",l);function ne(r){if(!r||r?.length===0)return null;let t=new Map;for(let e of r)t.set(e.type,e);return t}var tr=h()&&typeof document<"u",ct=()=>tr&&document.readyState==="complete",er={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},F=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ct()}constructor(t){if(this.props={...er,...t},t=this.props,!h()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=nr(t.canvas):this.canvas=t.canvas;else{let e=sr(t),o=or(t?.container||null);o.insertBefore(e,o.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let o of e)o.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let o=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return ir(t,o,n,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let o="width"in e?e.width:this.htmlCanvas.clientWidth,n="height"in e?e.height:this.htmlCanvas.clientHeight;(!o||!n)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,o=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==o||s.clientHeight!==n||s.devicePixelRatio!==t){let i=t,a=Math.floor(o*i),f=Math.floor(n*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[p,y]=this.getDrawingBufferSize();(p!==a||y!==f)&&(i=Math.min(p/o,y/n),this.htmlCanvas.width=Math.floor(o*i),this.htmlCanvas.height=Math.floor(n*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};c(F,"pageLoaded",rr());function rr(){return ct()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function or(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function nr(r){let t=document.getElementById(r);if(!t&&!ct())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function sr(r){let{width:t,height:e}=r,o=document.createElement("canvas");return o.id="lumagl-auto-created-canvas",o.width=t||1,o.height=e||1,o.style.width=Number.isFinite(t)?`${t}px`:"100%",o.style.height=Number.isFinite(e)?`${e}px`:"100%",o}function ir(r,t,e,o,n){let s=r,i=se(s[0],t,e),a=ie(s[1],t,o,n),f=se(s[0]+1,t,e),p=f===e-1?f:f-1;f=ie(s[1]+1,t,o,n);let y;return n?(f=f===0?f:f+1,y=a,a=f):y=f===o-1?f:f-1,{x:i,y:a,width:Math.max(p-i+1,1),height:Math.max(y-a+1,1)}}function se(r,t,e){return Math.min(Math.round(r*t),e-1)}function ie(r,t,e,o){return o?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var St=class extends u{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,o=St.defaultProps){super(t,e,o),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=t.incrementTimestamp()}},d=St;c(d,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),c(d,"COPY_SRC",1),c(d,"COPY_DST",2),c(d,"TEXTURE_BINDING",4),c(d,"STORAGE_BINDING",8),c(d,"RENDER_ATTACHMENT",16);var Tt=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,Tt.defaultProps)}},D=Tt;c(D,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var At=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,At.defaultProps)}},U=At;c(U,"defaultProps",{...u.defaultProps,source:null,colorSpace:"srgb"});function ut(r,t,e){let o="",n=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=n.length;a++)for(o+=ce(n[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];o+=ae(f,n,f.lineNum,{...e,inlineSource:!1})}return o;case"issues":case"no":for(let a of r)o+=ae(a,n,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return o}}function ae(r,t,e,o){if(o?.inlineSource){let n=ar(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
8
8
  `:"";return`
9
9
  ${n}${s}${r.type.toUpperCase()}: ${r.message}
10
10
 
package/dist/index.cjs CHANGED
@@ -116,7 +116,7 @@ var lumaStats = new StatsManager();
116
116
 
117
117
  // dist/init.js
118
118
  function initializeLuma() {
119
- const VERSION2 = true ? "9.0.20" : "running from source";
119
+ const VERSION2 = true ? "9.0.21" : "running from source";
120
120
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
121
121
  if (globalThis.luma && globalThis.luma.VERSION !== VERSION2) {
122
122
  throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION2}`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.js", "init.js", "utils/log.js", "utils/stats-manager.js", "utils/is-array.js", "utils/utils.js", "adapter/resources/resource.js", "adapter/resources/buffer.js", "adapter/type-utils/decode-data-type.js", "adapter/type-utils/decode-texture-format.js", "adapter/device.js", "utils/assert.js", "lib/luma.js", "adapter/canvas-context.js", "adapter/resources/texture.js", "adapter/resources/texture-view.js", "adapter/resources/external-texture.js", "lib/compiler-log/format-compiler-log.js", "lib/compiler-log/get-shader-info.js", "adapter/resources/shader.js", "adapter/resources/sampler.js", "adapter/resources/framebuffer.js", "adapter/resources/render-pipeline.js", "adapter/resources/render-pass.js", "adapter/resources/compute-pipeline.js", "adapter/resources/compute-pass.js", "adapter/resources/command-encoder.js", "adapter/resources/command-buffer.js", "adapter/type-utils/decode-attribute-type.js", "adapter/type-utils/decode-vertex-format.js", "adapter/attribute-utils/get-attribute-from-layouts.js", "adapter/resources/vertex-array.js", "adapter/resources/transform-feedback.js", "adapter/resources/query-set.js", "adapter/type-utils/decode-shader-types.js", "utils/array-utils-flat.js", "lib/uniforms/uniform-buffer-layout.js", "utils/array-equal.js", "lib/uniforms/uniform-block.js", "lib/uniforms/uniform-store.js", "adapter/type-utils/vertex-format-from-attribute.js", "utils/cast.js", "lib/uniforms/uniform.js", "utils/format-value.js", "utils/stub-methods.js", "utils/check-props.js", "utils/load-file.js", "utils/random.js", "utils/deep-equal.js", "utils/request-animation-frame.js"],
4
- "sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { VERSION } from \"./init.js\";\nexport { isTypedArray, isNumberArray } from \"./utils/is-array.js\";\n// MAIN API ACCESS POINTS\nexport { luma } from \"./lib/luma.js\";\nexport { Device, DeviceFeatures, DeviceLimits } from \"./adapter/device.js\";\nexport { CanvasContext } from \"./adapter/canvas-context.js\";\nexport { Resource } from \"./adapter/resources/resource.js\";\nexport { Buffer } from \"./adapter/resources/buffer.js\";\nexport { Texture } from \"./adapter/resources/texture.js\";\nexport { TextureView } from \"./adapter/resources/texture-view.js\";\nexport { ExternalTexture } from \"./adapter/resources/external-texture.js\";\nexport { Shader } from \"./adapter/resources/shader.js\";\nexport { Sampler } from \"./adapter/resources/sampler.js\";\nexport { Framebuffer } from \"./adapter/resources/framebuffer.js\";\nexport { RenderPipeline } from \"./adapter/resources/render-pipeline.js\";\nexport { RenderPass } from \"./adapter/resources/render-pass.js\";\nexport { ComputePipeline } from \"./adapter/resources/compute-pipeline.js\";\nexport { ComputePass } from \"./adapter/resources/compute-pass.js\";\nexport { CommandEncoder } from \"./adapter/resources/command-encoder.js\";\nexport { CommandBuffer } from \"./adapter/resources/command-buffer.js\";\nexport { VertexArray } from \"./adapter/resources/vertex-array.js\";\nexport { TransformFeedback } from \"./adapter/resources/transform-feedback.js\";\nexport { QuerySet } from \"./adapter/resources/query-set.js\";\nexport { UniformBufferLayout } from \"./lib/uniforms/uniform-buffer-layout.js\";\nexport { UniformBlock } from \"./lib/uniforms/uniform-block.js\";\nexport { UniformStore } from \"./lib/uniforms/uniform-store.js\";\n// TYPE UTILS\nexport { decodeVertexFormat } from \"./adapter/type-utils/decode-vertex-format.js\";\nexport { decodeTextureFormat } from \"./adapter/type-utils/decode-texture-format.js\";\nexport { getDataTypeFromTypedArray, getTypedArrayFromDataType, getVertexFormatFromAttribute } from \"./adapter/type-utils/vertex-format-from-attribute.js\";\n// SHADER TYPE UTILS\nexport { decodeShaderUniformType } from \"./adapter/type-utils/decode-shader-types.js\";\nexport { decodeShaderAttributeType } from \"./adapter/type-utils/decode-attribute-type.js\";\nexport { formatCompilerLog } from \"./lib/compiler-log/format-compiler-log.js\";\nexport { getAttributeInfosFromLayouts, mergeShaderLayout } from \"./adapter/attribute-utils/get-attribute-from-layouts.js\";\n// GENERAL UTILS\nexport { StatsManager } from \"./utils/stats-manager.js\";\nexport { assert } from \"./utils/assert.js\";\nexport { cast } from \"./utils/cast.js\";\nexport { log } from \"./utils/log.js\";\nexport { uid, isObjectEmpty } from \"./utils/utils.js\";\nexport { isUniformValue, splitUniformsAndBindings } from \"./lib/uniforms/uniform.js\";\nexport { formatValue } from \"./utils/format-value.js\";\nexport { stubRemovedMethods } from \"./utils/stub-methods.js\";\nexport { checkProps } from \"./utils/check-props.js\";\nexport { setPathPrefix, loadFile, loadImage, loadImageBitmap, loadScript } from \"./utils/load-file.js\";\nexport { getScratchArrayBuffer, getScratchArray, fillArray } from \"./utils/array-utils-flat.js\";\nexport { makeRandomNumberGenerator, random } from \"./utils/random.js\";\nexport { deepEqual } from \"./utils/deep-equal.js\";\n// ENGINE - TODO/move to @luma.gl/engine once that module is webgl-independent?\nexport { requestAnimationFrame, cancelAnimationFrame } from \"./utils/request-animation-frame.js\";\n// SHADER HELPERS\n/**\n * Marks GLSL shaders for syntax highlighting: glsl`...`\n * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal\n */\nexport const glsl = (x) => `${x}`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isBrowser } from '@probe.gl/env';\nimport { log } from \"./utils/log.js\";\nimport { lumaStats } from \"./utils/stats-manager.js\";\n/**\n * By adding the result of init() to Device.VERSION we guarantee it will be called\n * @returns version\n */\nfunction initializeLuma() {\n // Version detection using babel plugin\n // @ts-expect-error\n const VERSION = typeof \"9.0.20\" !== 'undefined' ? \"9.0.20\" : 'running from source';\n const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';\n // Assign luma.log.level in console to control logging: \\\n // 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs\n // luma.log.break[], set to gl funcs, luma.log.profile[] set to model names`;\n if (globalThis.luma && globalThis.luma.VERSION !== VERSION) {\n throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION}`);\n }\n if (!globalThis.luma) {\n if (isBrowser()) {\n log.log(1, `${VERSION} - ${STARTUP_MESSAGE}`)();\n }\n globalThis.luma = globalThis.luma || {\n VERSION,\n version: VERSION,\n log,\n // A global stats object that various components can add information to\n // E.g. see webgl/resource.js\n stats: lumaStats\n };\n }\n return VERSION;\n}\nexport const VERSION = initializeLuma();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Log } from '@probe.gl/log';\n/** Global log instance */\nexport const log = new Log({ id: 'luma.gl' });\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Stats } from '@probe.gl/stats';\n/**\n * Helper class managing a collection of probe.gl stats objects\n */\nexport class StatsManager {\n stats = new Map();\n getStats(name) {\n return this.get(name);\n }\n get(name) {\n if (!this.stats.has(name)) {\n this.stats.set(name, new Stats({ id: name }));\n }\n return this.stats.get(name);\n }\n}\n/** Global stats for all luma.gl devices */\nexport const lumaStats = new StatsManager();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Check is an array is a typed array\n * @param value value to be tested\n * @returns input as TypedArray, or null\n * @todo this should be provided by @math.gl/types\n */\nexport function isTypedArray(value) {\n return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;\n}\n/**\n * Check is an array is a numeric array (typed array or array of numbers)\n * @param value value to be tested\n * @returns input as NumberArray, or null\n * @todo this should be provided by @math.gl/types\n */\nexport function isNumberArray(value) {\n if (Array.isArray(value)) {\n return value.length === 0 || typeof value[0] === 'number' ? value : null;\n }\n return isTypedArray(value);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst uidCounters = {};\n/**\n * Returns a UID.\n * @param id= - Identifier base name\n * @return uid\n **/\nexport function uid(id = 'id') {\n uidCounters[id] = uidCounters[id] || 1;\n const count = uidCounters[id]++;\n return `${id}-${count}`;\n}\n/** Returns true if given object is empty, false otherwise. */\nexport function isObjectEmpty(obj) {\n let isEmpty = true;\n // @ts-ignore key is unused\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const key in obj) {\n isEmpty = false;\n break;\n }\n return isEmpty;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { uid } from \"../../utils/utils.js\";\n/**\n * Base class for GPU (WebGPU/WebGL) Resources\n */\nexport class Resource {\n /** Default properties for resource */\n static defaultProps = {\n id: 'undefined',\n handle: undefined,\n userData: undefined\n };\n /** props.id, for debugging. */\n id;\n props;\n userData = {};\n _device;\n /** Whether this resource has been destroyed */\n destroyed = false;\n /** For resources that allocate GPU memory */\n allocatedBytes = 0;\n /** Attached resources will be destroyed when this resource is destroyed. Tracks auto-created \"sub\" resources. */\n _attachedResources = new Set();\n /**\n * Create a new Resource. Called from Subclass\n */\n constructor(device, props, defaultProps) {\n if (!device) {\n throw new Error('no device');\n }\n this._device = device;\n this.props = selectivelyMerge(props, defaultProps);\n const id = this.props.id !== 'undefined' ? this.props.id : uid(this[Symbol.toStringTag]);\n this.props.id = id;\n this.id = id;\n this.userData = this.props.userData || {};\n this.addStats();\n }\n /**\n * destroy can be called on any resource to release it before it is garbage collected.\n */\n destroy() {\n this.destroyResource();\n }\n /** @deprecated Use destroy() */\n delete() {\n this.destroy();\n return this;\n }\n toString() {\n return `${this[Symbol.toStringTag] || this.constructor.name}(${this.id})`;\n }\n /**\n * Combines a map of user props and default props, only including props from defaultProps\n * @returns returns a map of overridden default props\n */\n getProps() {\n return this.props;\n }\n // ATTACHED RESOURCES\n /**\n * Attaches a resource. Attached resources are auto destroyed when this resource is destroyed\n * Called automatically when sub resources are auto created but can be called by application\n */\n attachResource(resource) {\n this._attachedResources.add(resource);\n }\n /**\n * Detach an attached resource. The resource will no longer be auto-destroyed when this resource is destroyed.\n */\n detachResource(resource) {\n this._attachedResources.delete(resource);\n }\n /**\n * Destroys a resource (only if owned), and removes from the owned (auto-destroy) list for this resource.\n */\n destroyAttachedResource(resource) {\n if (this._attachedResources.delete(resource)) {\n resource.destroy();\n }\n }\n /** Destroy all owned resources. Make sure the resources are no longer needed before calling. */\n destroyAttachedResources() {\n for (const resource of Object.values(this._attachedResources)) {\n resource.destroy();\n }\n // don't remove while we are iterating\n this._attachedResources = new Set();\n }\n // PROTECTED METHODS\n /** Perform all destroy steps. Can be called by derived resources when overriding destroy() */\n destroyResource() {\n this.destroyAttachedResources();\n this.removeStats();\n this.destroyed = true;\n }\n /** Called by .destroy() to track object destruction. Subclass must call if overriding destroy() */\n removeStats() {\n const stats = this._device.statsManager.getStats('Resource Counts');\n const name = this[Symbol.toStringTag];\n stats.get(`${name}s Active`).decrementCount();\n }\n /** Called by subclass to track memory allocations */\n trackAllocatedMemory(bytes, name = this[Symbol.toStringTag]) {\n const stats = this._device.statsManager.getStats('Resource Counts');\n stats.get('GPU Memory').addCount(bytes);\n stats.get(`${name} Memory`).addCount(bytes);\n this.allocatedBytes = bytes;\n }\n /** Called by subclass to track memory deallocations */\n trackDeallocatedMemory(name = this[Symbol.toStringTag]) {\n const stats = this._device.statsManager.getStats('Resource Counts');\n stats.get('GPU Memory').subtractCount(this.allocatedBytes);\n stats.get(`${name} Memory`).subtractCount(this.allocatedBytes);\n this.allocatedBytes = 0;\n }\n /** Called by resource constructor to track object creation */\n addStats() {\n const stats = this._device.statsManager.getStats('Resource Counts');\n const name = this[Symbol.toStringTag];\n stats.get('Resources Created').incrementCount();\n stats.get(`${name}s Created`).incrementCount();\n stats.get(`${name}s Active`).incrementCount();\n }\n}\n/**\n * Combines a map of user props and default props, only including props from defaultProps\n * @param props\n * @param defaultProps\n * @returns returns a map of overridden default props\n */\nfunction selectivelyMerge(props, defaultProps) {\n const mergedProps = { ...defaultProps };\n for (const key in props) {\n if (props[key] !== undefined) {\n mergedProps[key] = props[key];\n }\n }\n return mergedProps;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Abstract GPU buffer */\nexport class Buffer extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n usage: 0, // Buffer.COPY_DST | Buffer.COPY_SRC\n byteLength: 0,\n byteOffset: 0,\n data: null,\n indexType: 'uint16',\n mappedAtCreation: false\n };\n // Usage Flags\n static MAP_READ = 0x01;\n static MAP_WRITE = 0x02;\n static COPY_SRC = 0x0004;\n static COPY_DST = 0x0008;\n /** Index buffer */\n static INDEX = 0x0010;\n /** Vertex buffer */\n static VERTEX = 0x0020;\n /** Uniform buffer */\n static UNIFORM = 0x0040;\n /** Storage buffer */\n static STORAGE = 0x0080;\n static INDIRECT = 0x0100;\n static QUERY_RESOLVE = 0x0200;\n get [Symbol.toStringTag]() {\n return 'Buffer';\n }\n /** The usage with which this buffer was created */\n usage;\n /** For index buffers, whether indices are 16 or 32 bit */\n indexType;\n /** \"Time\" of last update */\n updateTimestamp;\n constructor(device, props) {\n const deducedProps = { ...props };\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n deducedProps.indexType = 'uint32';\n }\n else if (props.data instanceof Uint16Array) {\n deducedProps.indexType = 'uint16';\n }\n }\n super(device, deducedProps, Buffer.defaultProps);\n this.usage = props.usage || 0;\n this.indexType = deducedProps.indexType;\n // TODO - perhaps this should be set on async write completion?\n this.updateTimestamp = device.incrementTimestamp();\n }\n /** Read data synchronously. @note WebGL2 only */\n readSyncWebGL(byteOffset, byteLength) {\n throw new Error('not implemented');\n }\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n /** Max amount of debug data saved. Two vec4's */\n static DEBUG_DATA_MAX_LENGTH = 32;\n /** A partial CPU-side copy of the data in this buffer, for debugging purposes */\n debugData = new ArrayBuffer(0);\n /** This doesn't handle partial non-zero offset updates correctly */\n _setDebugData(data, byteOffset, byteLength) {\n const buffer = ArrayBuffer.isView(data) ? data.buffer : data;\n const debugDataLength = Math.min(data ? data.byteLength : byteLength, Buffer.DEBUG_DATA_MAX_LENGTH);\n if (data === null) {\n this.debugData = new ArrayBuffer(debugDataLength);\n }\n else if (byteOffset === 0 && byteLength === data.byteLength) {\n this.debugData = buffer.slice(0, debugDataLength);\n }\n else {\n this.debugData = buffer.slice(byteOffset, byteOffset + debugDataLength);\n }\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */\nexport function decodeVertexType(type) {\n const dataType = TYPE_MAP[type];\n const bytes = getDataTypeBytes(dataType);\n const normalized = type.includes('norm');\n const integer = !normalized && !type.startsWith('float');\n const signed = type.startsWith('s');\n return {\n dataType: TYPE_MAP[type],\n byteLength: bytes,\n integer,\n signed,\n normalized\n };\n}\nfunction getDataTypeBytes(type) {\n const bytes = TYPE_SIZES[type];\n // assert(bytes);\n return bytes;\n}\nconst TYPE_MAP = {\n uint8: 'uint8',\n sint8: 'sint8',\n unorm8: 'uint8',\n snorm8: 'sint8',\n uint16: 'uint16',\n sint16: 'sint16',\n unorm16: 'uint16',\n snorm16: 'sint16',\n float16: 'float16',\n float32: 'float32',\n uint32: 'uint32',\n sint32: 'sint32'\n};\nconst TYPE_SIZES = {\n uint8: 1,\n sint8: 1,\n uint16: 2,\n sint16: 2,\n float16: 2,\n float32: 4,\n uint32: 4,\n sint32: 4\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { decodeVertexType } from \"./decode-data-type.js\";\n// prettier-ignore\nconst COMPRESSED_TEXTURE_FORMAT_PREFIXES = [\n 'bc1', 'bc2', 'bc3', 'bc4', 'bc5', 'bc6', 'bc7', 'etc1', 'etc2', 'eac', 'atc', 'astc', 'pvrtc'\n];\nconst REGEX = /^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;\n/**\n * Returns true if a texture format is GPU compressed\n */\nexport function isTextureFormatCompressed(textureFormat) {\n return COMPRESSED_TEXTURE_FORMAT_PREFIXES.some(prefix => textureFormat.startsWith(prefix));\n}\n/**\n * Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)\n */\nexport function decodeTextureFormat(format) {\n const matches = REGEX.exec(format);\n if (matches) {\n const [, format, length, type, srgb, suffix] = matches;\n if (format) {\n const dataType = `${type}${length}`;\n const decodedType = decodeVertexType(dataType);\n return {\n format: format,\n components: format.length,\n // dataType - overwritten by decodedType\n srgb: srgb === '-srgb',\n unsized: suffix === '-unsized',\n webgl: suffix === '-webgl',\n ...decodedType\n };\n }\n }\n return decodeNonStandardFormat(format);\n}\n// https://www.w3.org/TR/webgpu/#texture-format-caps\nconst EXCEPTIONS = {\n // Packed 16 bit formats\n 'rgba4unorm-webgl': { format: 'rgba', bpp: 2 },\n 'rgb565unorm-webgl': { format: 'rgb', bpp: 2 },\n 'rgb5a1unorm-webgl': { format: 'rgba', bbp: 2 },\n // Packed 32 bit formats\n rgb9e5ufloat: { format: 'rgb', bbp: 4 },\n rg11b10ufloat: { format: 'rgb', bbp: 4 },\n rgb10a2unorm: { format: 'rgba', bbp: 4 },\n 'rgb10a2uint-webgl': { format: 'rgba', bbp: 4 },\n // Depth/stencil\n stencil8: { components: 1, bpp: 1, a: 'stencil' },\n depth16unorm: { components: 1, bpp: 2, a: 'depth' },\n depth24plus: { components: 1, bpp: 3, a: 'depth' },\n depth32float: { components: 1, bpp: 4, a: 'depth' },\n 'depth24plus-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' },\n // \"depth24unorm-stencil8\" feature\n 'depth24unorm-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' },\n // \"depth32float-stencil8\" feature\n 'depth32float-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' }\n};\nfunction decodeNonStandardFormat(format) {\n const data = EXCEPTIONS[format];\n if (!data) {\n throw new Error(`Unknown format ${format}`);\n }\n return {\n format: data.format || '',\n components: data.components || data.format?.length || 1,\n byteLength: data.bpp || 1,\n srgb: false,\n unsized: false\n };\n}\n/*\n'r8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'r8snorm':\t{s: \"float\"}, // \t\t\u2713\t\t},\n'r8uint':\t{s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'r8sint':\t{s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'rg8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rg8snorm':\t{s: \"float\"}, // \t\t\u2713\t\t},\n'rg8uint':\t{s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'rg8sint':\t{s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'rgba8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t\u2713},\n'rgba8unorm-srgb': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rgba8snorm':\t{s: \"float\"}, // \t\t\u2713\t\t\u2713},\n'rgba8uint':\t{s: \"uint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'rgba8sint':\t{s: \"sint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'bgra8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'bgra8unorm-srgb': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n// 16-bit per component\n'r16uint': {s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'r16sint': {s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'r16float': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rg16uint': {s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'rg16sint': {s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'rg16float': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rgba16uint': {s: \"uint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'rgba16sint': {s: \"sint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'rgba16float': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t\u2713},\n// 32-bit per component\n'r32uint': {s: \"uint\"}, // \t\u2713\t\t\t\u2713},\n'r32sint': {s: \"sint\"}, // \t\u2713\t\t\t\u2713},\n'r32float': {\"unfilterable-float\"\t\u2713\t\u2713\t\t\u2713},\n'rg32uint': {s: \"uint\"}, // \t\u2713\t\t\t\u2713},\n'rg32sint': {s: \"sint\"}, // \t\u2713\t\t\t\u2713},\n'rg32float': {\"unfilterable-float\"\t\u2713\t\t\t\u2713},\n'rgba32uint': {s: \"uint\"}, // \t\u2713\t\t\t\u2713},\n'rgba32sint': {s: \"sint\"}, // \t\u2713\t\t\t\u2713},\n'rgba32float': {\"unfilterable-float\"\t\u2713\t\t\t\u2713},\n// mixed component width\n'rgb10a2unorm': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t}\n'rg11b10ufloat': {s: \"float\"}, // \t\t\u2713\t\t}\n// Format\tBytes per texel\tAspect\tGPUTextureSampleType\tValid image copy source\tValid image copy destination\n'stencil8': {1 \u2212 4\tstencil\t\"uint\"\t\u2713}\n'depth16unorm': {2\tdepth\t\"depth\"\t\u2713}\n'depth24plus': {4\tdepth\t\"depth\"\t\u2717}\n'depth24plus': {stencil8\t4 \u2212 8\tdepth\t\"depth\"\t\u2717}\n'stencil': {s: \"uint\"}, // \t\u2713}\n'depth32float': {4\tdepth\t\"depth\"\t\u2713\t\u2717}\n'depth24unorm': {stencil8\t4\tdepth\t\"depth\"\t\u2717}\n'stencil': {s: \"uint\"}, // \t\u2713}\n'depth32float': {stencil8}\n\n// Format\tBytes per block\tGPUTextureSampleType\tBlock Size\tFeature\n'rgb9e5ufloat': {c: 4, s: \"float\",\tbpp: 4/(1*1)},\n\n'bc1-rgba-unorm': {c: 4. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc1-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc2-rgba-unorm': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc2-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc3-rgba-unorm': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc3-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc4-r-unorm': {c: 1. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc4-r-snorm': {c: 1. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc5-rg-unorm': {c: 2. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc5-rg-snorm': { },\n'bc6h-rgb-ufloat': {\t16 },\n'bc6h-rgb-float': { },\n'bc7-rgba-unorm': {\t16 },\n'bc7-rgba-unorm-srgb': { },\n\n'etc2-rgb8unorm': {\t8\t\"float\"\t4 \u00D7 4\ttexture-compression-etc2 },\n'etc2-rgb8unorm-srgb': { },\n'etc2-rgb8a1unorm': {\t8 },\n'etc2-rgb8a1unorm-srgb': { },\n'etc2-rgba8unorm': {\t16 },\n'etc2-rgba8unorm-srgb': { },\n\n'eac-r11unorm': {\t8 },\n'eac-r11snorm': { },\n'eac-rg11unorm': {\t16 },\n'eac-rg11snorm': { },\n\n'astc-4x4-unorm': {\t16\t\"float\"\t4 \u00D7 4\ttexture-compression-astc },\n'astc-4x4-unorm-srgb': { },\n'astc-5x4-unorm': {\t16\t5 \u00D7 4 },\n'astc-5x4-unorm-srgb': { },\n'astc-5x5-unorm': {\t16\t5 \u00D7 5 },\n'astc-5x5-unorm-srgb': { },\n'astc-6x5-unorm': {\t16\t6 \u00D7 5 },\n'astc-6x5-unorm-srgb': { },\n'astc-6x6-unorm': {\t16\t6 \u00D7 6 },\n'astc-6x6-unorm-srgb': { },\n'astc-8x5-unorm': {\t16\t8 \u00D7 5 },\n'astc-8x5-unorm-srgb': { },\n'astc-8x6-unorm': {\t16\t8 \u00D7 6 },\n'astc-8x6-unorm-srgb': { },\n'astc-8x8-unorm': {\t16\t8 \u00D7 8 },\n'astc-8x8-unorm-srgb': { },\n'astc-10x5-unorm': {\t16\t10 \u00D7 5 },\n'astc-10x5-unorm-srgb': { },\n'astc-10x6-unorm': {\t16\t10 \u00D7 6 },\n'astc-10x6-unorm-srgb': { },\n'astc-10x8-unorm': {\t16\t10 \u00D7 8 },\n'astc-10x8-unorm-srgb': { },\n'astc-10x10-unorm': {\t16\t10 \u00D7 10 },\n'astc-10x10-unorm-srgb': { },\n'astc-12x10-unorm': {\t16\t12 \u00D7 10 },\n'astc-12x10-unorm-srgb': { },\n'astc-12x12-unorm': {\t16 },\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { VERSION } from \"../init.js\";\nimport { lumaStats } from \"../utils/stats-manager.js\";\nimport { log } from \"../utils/log.js\";\nimport { uid } from \"../utils/utils.js\";\nimport { Buffer } from \"./resources/buffer.js\";\nimport { isTextureFormatCompressed } from \"./type-utils/decode-texture-format.js\";\n/** Limits for a device (max supported sizes of resources, max number of bindings etc) */\nexport class DeviceLimits {\n}\n/** Set-like class for features (lets apps check for WebGL / WebGPU extensions) */\nexport class DeviceFeatures {\n features;\n disabledFeatures;\n constructor(features = [], disabledFeatures) {\n this.features = new Set(features);\n this.disabledFeatures = disabledFeatures || {};\n }\n *[Symbol.iterator]() {\n yield* this.features;\n }\n has(feature) {\n return !this.disabledFeatures[feature] && this.features.has(feature);\n }\n}\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport class Device {\n static defaultProps = {\n id: null,\n canvas: null,\n container: null,\n manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n requestMaxLimits: true,\n debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)\n spector: Boolean(log.get('spector') || log.get('spectorjs')), // Initialize the SpectorJS WebGL debugger\n break: [],\n // TODO - Change these after confirming things work as expected\n initalizeFeatures: true,\n disabledFeatures: {\n 'compilation-status-async-webgl': true\n },\n // alpha: undefined,\n // depth: undefined,\n // stencil: undefined,\n // antialias: undefined,\n // premultipliedAlpha: undefined,\n // preserveDrawingBuffer: undefined,\n // failIfMajorPerformanceCaveat: undefined\n gl: null,\n // Callbacks\n onError: (error) => log.error(error.message)\n };\n get [Symbol.toStringTag]() {\n return 'Device';\n }\n static VERSION = VERSION;\n constructor(props) {\n this.props = { ...Device.defaultProps, ...props };\n this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());\n }\n /** id of this device, primarily for debugging */\n id;\n /** A copy of the device props */\n props;\n /** Available for the application to store data on the device */\n userData = {};\n /** stats */\n statsManager = lumaStats;\n /** Used by other luma.gl modules to store data on the device */\n _lumaData = {};\n /** Check if a specific texture format is GPU compressed */\n isTextureFormatCompressed(format) {\n return isTextureFormatCompressed(format);\n }\n /**\n * Trigger device loss.\n * @returns `true` if context loss could actually be triggered.\n * @note primarily intended for testing how application reacts to device loss\n */\n loseDevice() {\n return false;\n }\n /** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */\n getCanvasContext() {\n if (!this.canvasContext) {\n throw new Error('Device has no CanvasContext');\n }\n return this.canvasContext;\n }\n createTexture(props) {\n // Signature: new Texture2D(gl, url | Promise)\n if (props instanceof Promise || typeof props === 'string') {\n props = { data: props };\n }\n return this._createTexture(props);\n }\n createCommandEncoder(props = {}) {\n throw new Error('not implemented');\n }\n // WebGL specific HACKS - enables app to remove webgl import\n // Use until we have a better way to handle these\n /** @deprecated - will be removed - should use command encoder */\n readPixelsToArrayWebGL(source, options) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use command encoder */\n readPixelsToBufferWebGL(source, options) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n setParametersWebGL(parameters) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n getParametersWebGL(parameters) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n withParametersWebGL(parameters, func) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use clear arguments in RenderPass */\n clearWebGL(options) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use for debugging only */\n resetWebGL() {\n throw new Error('not implemented');\n }\n timestamp = 0;\n /** A monotonic counter for tracking buffer and texture updates */\n incrementTimestamp() {\n return this.timestamp++;\n }\n // Error Handling\n /** Report unhandled device errors */\n onError(error) {\n this.props.onError(error);\n }\n // IMPLEMENTATION\n _getBufferProps(props) {\n if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {\n props = { data: props };\n }\n // TODO - fragile, as this is done before we merge with default options\n // inside the Buffer constructor\n const newProps = { ...props };\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n newProps.indexType = 'uint32';\n }\n else if (props.data instanceof Uint16Array) {\n newProps.indexType = 'uint16';\n }\n else {\n log.warn('indices buffer content must be of integer type')();\n }\n }\n return newProps;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Recommendation is to ignore message but current test suite checks agains the\n// message so keep it for now.\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'luma.gl: assertion failed.');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Device } from \"../adapter/device.js\";\nimport { lumaStats } from \"../utils/stats-manager.js\";\nimport { log } from \"../utils/log.js\";\nimport { assert } from \"../utils/assert.js\";\nconst deviceMap = new Map();\n/**\n * Entry point to the luma.gl GPU abstraction\n * Register WebGPU and/or WebGL devices (controls application bundle size)\n * Run-time selection of the first available Device\n */\nexport class luma {\n static defaultProps = {\n ...Device.defaultProps,\n type: 'best-available',\n devices: undefined\n };\n /** Global stats for all devices */\n static stats = lumaStats;\n /** Global log */\n static log = log;\n static registerDevices(deviceClasses /* : typeof Device */) {\n for (const deviceClass of deviceClasses) {\n assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);\n deviceMap.set(deviceClass.type, deviceClass);\n }\n }\n static getAvailableDevices() {\n // @ts-expect-error\n return Array.from(deviceMap).map(Device => Device.type);\n }\n static getSupportedDevices() {\n return (Array.from(deviceMap)\n // @ts-expect-error\n .filter(Device => Device.isSupported())\n // @ts-expect-error\n .map(Device => Device.type));\n }\n static setDefaultDeviceProps(props) {\n Object.assign(Device.defaultProps, props);\n }\n /** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */\n static async attachDevice(props) {\n const devices = getDeviceMap(props.devices) || deviceMap;\n // WebGL\n if (props.handle instanceof WebGL2RenderingContext) {\n const WebGLDevice = devices.get('webgl');\n if (WebGLDevice) {\n return (await WebGLDevice.attach(props.handle));\n }\n }\n // TODO - WebGPU does not yet have a stable API\n // if (props.handle instanceof GPUDevice) {\n // const WebGPUDevice = devices.get('webgpu') as any;\n // if (WebGPUDevice) {\n // return (await WebGPUDevice.attach(props.handle)) as Device;\n // }\n // }\n // null\n if (props.handle === null) {\n const UnknownDevice = devices.get('unknown');\n if (UnknownDevice) {\n return (await UnknownDevice.attach(null));\n }\n }\n throw new Error('Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');\n }\n /** Creates a device. Asynchronously. */\n static async createDevice(props = {}) {\n props = { ...luma.defaultProps, ...props };\n if (props.gl) {\n props.type = 'webgl';\n }\n const devices = getDeviceMap(props.devices) || deviceMap;\n switch (props.type) {\n case 'webgpu':\n let WebGPUDevice = devices.get('webgpu');\n if (WebGPUDevice) {\n return await WebGPUDevice.create(props);\n }\n break;\n case 'webgl':\n let WebGLDevice = devices.get('webgl');\n if (WebGLDevice) {\n return await WebGLDevice.create(props);\n }\n break;\n case 'unknown':\n const UnknownDevice = devices.get('unknown');\n if (UnknownDevice) {\n return await UnknownDevice.create(props);\n }\n break;\n case 'best-available':\n WebGPUDevice = devices.get('webgpu');\n if (WebGPUDevice?.isSupported?.()) {\n return await WebGPUDevice.create(props);\n }\n WebGLDevice = devices.get('webgl');\n if (WebGLDevice?.isSupported?.()) {\n return await WebGLDevice.create(props);\n }\n break;\n }\n throw new Error('No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');\n }\n static enforceWebGL2(enforce = true) {\n const prototype = HTMLCanvasElement.prototype;\n if (!enforce && prototype.originalGetContext) {\n // Reset the original getContext function\n prototype.getContext = prototype.originalGetContext;\n prototype.originalGetContext = undefined;\n return;\n }\n // Store the original getContext function\n prototype.originalGetContext = prototype.getContext;\n // Override the getContext function\n prototype.getContext = function (contextId, options) {\n // Attempt to force WebGL2 for all WebGL1 contexts\n if (contextId === 'webgl' || contextId === 'experimental-webgl') {\n return this.originalGetContext('webgl2', options);\n }\n // For any other type, return the original context\n return this.originalGetContext(contextId, options);\n };\n }\n}\n/** Convert a list of devices to a map */\nfunction getDeviceMap(deviceClasses /* : typeof Device */) {\n if (!deviceClasses || deviceClasses?.length === 0) {\n return null;\n }\n const map = new Map();\n for (const deviceClass of deviceClasses) {\n // assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);\n map.set(deviceClass.type, deviceClass);\n }\n return map;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isBrowser } from '@probe.gl/env';\nimport { log } from \"../utils/log.js\";\nconst isPage = isBrowser() && typeof document !== 'undefined';\nconst isPageLoaded = () => isPage && document.readyState === 'complete';\nconst DEFAULT_CANVAS_CONTEXT_PROPS = {\n canvas: null,\n width: 800, // width are height are only used by headless gl\n height: 600,\n useDevicePixels: true,\n autoResize: true,\n container: null,\n visible: true,\n colorSpace: 'srgb',\n alphaMode: 'opaque'\n};\n/**\n * Manages a canvas. Supports both HTML or offscreen canvas\n * - Creates a new canvas or looks up a canvas from the DOM\n * - Provides check for DOM loaded\n * @todo commit(): https://github.com/w3ctag/design-reviews/issues/288\n * @todo transferControlToOffscreen: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen\n */\nexport class CanvasContext {\n id;\n props;\n canvas;\n htmlCanvas;\n offscreenCanvas;\n type;\n width = 1;\n height = 1;\n resizeObserver;\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n _canvasSizeInfo = { clientWidth: 0, clientHeight: 0, devicePixelRatio: 1 };\n /** Check if the DOM is loaded */\n static get isPageLoaded() {\n return isPageLoaded();\n }\n /**\n * Get a 'lazy' promise that resolves when the DOM is loaded.\n * @note Since there may be limitations on number of `load` event listeners,\n * it is recommended avoid calling this function until actually needed.\n * I.e. don't call it until you know that you will be looking up a string in the DOM.\n */\n static pageLoaded = getPageLoadPromise();\n constructor(props) {\n this.props = { ...DEFAULT_CANVAS_CONTEXT_PROPS, ...props };\n props = this.props;\n if (!isBrowser()) {\n this.id = 'node-canvas-context';\n this.type = 'node';\n this.width = this.props.width;\n this.height = this.props.height;\n // TODO - does this prevent app from using jsdom style polyfills?\n this.canvas = null;\n return;\n }\n if (!props.canvas) {\n const canvas = createCanvas(props);\n const container = getContainer(props?.container || null);\n container.insertBefore(canvas, container.firstChild);\n this.canvas = canvas;\n if (!props?.visible) {\n this.canvas.style.visibility = 'hidden';\n }\n }\n else if (typeof props.canvas === 'string') {\n this.canvas = getCanvasFromDOM(props.canvas);\n }\n else {\n this.canvas = props.canvas;\n }\n if (this.canvas instanceof HTMLCanvasElement) {\n this.id = this.canvas.id;\n this.type = 'html-canvas';\n this.htmlCanvas = this.canvas;\n }\n else {\n this.id = 'offscreen-canvas';\n this.type = 'offscreen-canvas';\n this.offscreenCanvas = this.canvas;\n }\n // React to size changes\n if (this.canvas instanceof HTMLCanvasElement && props.autoResize) {\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target === this.canvas) {\n this.update();\n }\n }\n });\n this.resizeObserver.observe(this.canvas);\n }\n }\n /**\n * Returns the current DPR, if props.useDevicePixels is true\n * Device refers to physical\n */\n getDevicePixelRatio(useDevicePixels) {\n if (typeof OffscreenCanvas !== 'undefined' && this.canvas instanceof OffscreenCanvas) {\n return 1;\n }\n useDevicePixels = useDevicePixels === undefined ? this.props.useDevicePixels : useDevicePixels;\n if (!useDevicePixels || useDevicePixels <= 0) {\n return 1;\n }\n // The param was mainly provide to support the test cases, could be removed\n if (useDevicePixels === true) {\n const dpr = typeof window !== 'undefined' && window.devicePixelRatio;\n return dpr || 1;\n }\n return useDevicePixels;\n }\n /**\n * Returns the size of drawing buffer in device pixels.\n * @note This can be different from the 'CSS' size of a canvas, and also from the\n * canvas' internal drawing buffer size (.width, .height).\n * This is the size required to cover the canvas, adjusted for DPR\n */\n getPixelSize() {\n switch (this.type) {\n case 'node':\n return [this.width, this.height];\n case 'offscreen-canvas':\n return [this.canvas.width, this.canvas.height];\n case 'html-canvas':\n const dpr = this.getDevicePixelRatio();\n const canvas = this.canvas;\n // If not attached to DOM client size can be 0\n return canvas.parentElement\n ? [canvas.clientWidth * dpr, canvas.clientHeight * dpr]\n : [this.canvas.width, this.canvas.height];\n default:\n throw new Error(this.type);\n }\n }\n getAspect() {\n const [width, height] = this.getPixelSize();\n return width / height;\n }\n /**\n * Returns multiplier need to convert CSS size to Device size\n */\n cssToDeviceRatio() {\n try {\n // For headless gl we might have used custom width and height\n // hence use cached clientWidth\n const [drawingBufferWidth] = this.getDrawingBufferSize();\n const { clientWidth } = this._canvasSizeInfo;\n return clientWidth ? drawingBufferWidth / clientWidth : 1;\n }\n catch {\n return 1;\n }\n }\n /**\n * Maps CSS pixel position to device pixel position\n */\n cssToDevicePixels(cssPixel, yInvert = true) {\n const ratio = this.cssToDeviceRatio();\n const [width, height] = this.getDrawingBufferSize();\n return scalePixels(cssPixel, ratio, width, height, yInvert);\n }\n /**\n * Use devicePixelRatio to set canvas width and height\n * @note this is a raw port of luma.gl v8 code. Might be worth a review\n */\n setDevicePixelRatio(devicePixelRatio, options = {}) {\n if (!this.htmlCanvas) {\n return;\n }\n // NOTE: if options.width and options.height not used remove in v8\n let clientWidth = 'width' in options ? options.width : this.htmlCanvas.clientWidth;\n let clientHeight = 'height' in options ? options.height : this.htmlCanvas.clientHeight;\n if (!clientWidth || !clientHeight) {\n log.log(1, 'Canvas clientWidth/clientHeight is 0')();\n // by forcing devicePixel ratio to 1, we do not scale canvas.width and height in each frame.\n devicePixelRatio = 1;\n clientWidth = this.htmlCanvas.width || 1;\n clientHeight = this.htmlCanvas.height || 1;\n }\n const cachedSize = this._canvasSizeInfo;\n // Check if canvas needs to be resized\n if (cachedSize.clientWidth !== clientWidth ||\n cachedSize.clientHeight !== clientHeight ||\n cachedSize.devicePixelRatio !== devicePixelRatio) {\n let clampedPixelRatio = devicePixelRatio;\n const canvasWidth = Math.floor(clientWidth * clampedPixelRatio);\n const canvasHeight = Math.floor(clientHeight * clampedPixelRatio);\n this.htmlCanvas.width = canvasWidth;\n this.htmlCanvas.height = canvasHeight;\n // Note: when devicePixelRatio is too high, it is possible we might hit system limit for\n // drawing buffer width and hight, in those cases they get clamped and resulting aspect ration may not be maintained\n // for those cases, reduce devicePixelRatio.\n const [drawingBufferWidth, drawingBufferHeight] = this.getDrawingBufferSize();\n if (drawingBufferWidth !== canvasWidth || drawingBufferHeight !== canvasHeight) {\n clampedPixelRatio = Math.min(drawingBufferWidth / clientWidth, drawingBufferHeight / clientHeight);\n this.htmlCanvas.width = Math.floor(clientWidth * clampedPixelRatio);\n this.htmlCanvas.height = Math.floor(clientHeight * clampedPixelRatio);\n log.warn('Device pixel ratio clamped')();\n }\n this._canvasSizeInfo.clientWidth = clientWidth;\n this._canvasSizeInfo.clientHeight = clientHeight;\n this._canvasSizeInfo.devicePixelRatio = devicePixelRatio;\n }\n }\n // PRIVATE\n /** @todo Major hack done to port the CSS methods above, base canvas context should not depend on WebGL */\n getDrawingBufferSize() {\n // @ts-expect-error This only works for WebGL\n const gl = this.device.gl;\n if (!gl) {\n // use default device pixel ratio\n throw new Error('canvas size');\n }\n return [gl.drawingBufferWidth, gl.drawingBufferHeight];\n }\n /**\n * Allows subclass constructor to override the canvas id for auto created canvases.\n * This can really help when debugging DOM in apps that create multiple devices\n */\n _setAutoCreatedCanvasId(id) {\n if (this.htmlCanvas?.id === 'lumagl-auto-created-canvas') {\n this.htmlCanvas.id = id;\n }\n }\n}\n// HELPER FUNCTIONS\n/** Returns a promise that resolves when the page is loaded */\nfunction getPageLoadPromise() {\n if (isPageLoaded() || typeof window === 'undefined') {\n return Promise.resolve();\n }\n return new Promise(resolve => {\n window.addEventListener('load', () => resolve());\n });\n}\nfunction getContainer(container) {\n if (typeof container === 'string') {\n const element = document.getElementById(container);\n if (!element && !isPageLoaded()) {\n throw new Error(`Accessing '${container}' before page was loaded`);\n }\n if (!element) {\n throw new Error(`${container} is not an HTML element`);\n }\n return element;\n }\n else if (container) {\n return container;\n }\n return document.body;\n}\n/** Get a Canvas element from DOM id */\nfunction getCanvasFromDOM(canvasId) {\n const canvas = document.getElementById(canvasId);\n if (!canvas && !isPageLoaded()) {\n throw new Error(`Accessing '${canvasId}' before page was loaded`);\n }\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw new Error('Object is not a canvas element');\n }\n return canvas;\n}\n/** Create a new canvas */\nfunction createCanvas(props) {\n const { width, height } = props;\n const targetCanvas = document.createElement('canvas');\n targetCanvas.id = 'lumagl-auto-created-canvas';\n targetCanvas.width = width || 1;\n targetCanvas.height = height || 1;\n targetCanvas.style.width = Number.isFinite(width) ? `${width}px` : '100%';\n targetCanvas.style.height = Number.isFinite(height) ? `${height}px` : '100%';\n return targetCanvas;\n}\n/**\n *\n * @param pixel\n * @param ratio\n * @param width\n * @param height\n * @param yInvert\n * @returns\n */\nfunction scalePixels(pixel, ratio, width, height, yInvert) {\n const point = pixel;\n const x = scaleX(point[0], ratio, width);\n let y = scaleY(point[1], ratio, height, yInvert);\n // Find boundaries of next pixel to provide valid range of device pixel locations\n let t = scaleX(point[0] + 1, ratio, width);\n // If next pixel's position is clamped to boundary, use it as is, otherwise subtract 1 for current pixel boundary\n const xHigh = t === width - 1 ? t : t - 1;\n t = scaleY(point[1] + 1, ratio, height, yInvert);\n let yHigh;\n if (yInvert) {\n // If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range\n t = t === 0 ? t : t + 1;\n // swap y and yHigh\n yHigh = y;\n y = t;\n }\n else {\n // If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range\n yHigh = t === height - 1 ? t : t - 1;\n // y remains same\n }\n return {\n x,\n y,\n // when ratio < 1, current css pixel and next css pixel may point to same device pixel, set width/height to 1 in those cases.\n width: Math.max(xHigh - x + 1, 1),\n height: Math.max(yHigh - y + 1, 1)\n };\n}\nfunction scaleX(x, ratio, width) {\n // since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit\n const r = Math.min(Math.round(x * ratio), width - 1);\n return r;\n}\nfunction scaleY(y, ratio, height, yInvert) {\n // since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit\n return yInvert\n ? Math.max(0, height - 1 - Math.round(y * ratio))\n : Math.min(Math.round(y * ratio), height - 1);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * Abstract Texture interface\n * Texture Object\n * https://gpuweb.github.io/gpuweb/#gputexture\n */\nexport class Texture extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n data: null,\n dimension: '2d',\n format: 'rgba8unorm',\n width: undefined,\n height: undefined,\n depth: 1,\n mipmaps: true,\n // type: undefined,\n compressed: false,\n // mipLevels: 1,\n usage: 0,\n // usage: GPUTextureUsage.COPY_DST\n mipLevels: undefined,\n samples: undefined,\n type: undefined,\n sampler: {},\n view: undefined\n };\n static COPY_SRC = 0x01;\n static COPY_DST = 0x02;\n static TEXTURE_BINDING = 0x04;\n static STORAGE_BINDING = 0x08;\n static RENDER_ATTACHMENT = 0x10;\n get [Symbol.toStringTag]() {\n return 'Texture';\n }\n /** dimension of this texture */\n dimension;\n /** format of this texture */\n format;\n /** width in pixels of this texture */\n width;\n /** height in pixels of this texture */\n height;\n /** depth of this texture */\n depth;\n /** \"Time\" of last update. Monotonically increasing timestamp */\n updateTimestamp;\n /** Do not use directly. Create with device.createTexture() */\n constructor(device, props, defaultProps = Texture.defaultProps) {\n super(device, props, defaultProps);\n this.dimension = this.props.dimension;\n this.format = this.props.format;\n this.width = this.props.width;\n this.height = this.props.height;\n this.depth = this.props.depth;\n // TODO - perhaps this should be set on async write completion?\n this.updateTimestamp = device.incrementTimestamp();\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Immutable TextureView object */\nexport class TextureView extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n format: undefined,\n dimension: undefined,\n aspect: 'all',\n baseMipLevel: 0,\n mipLevelCount: undefined,\n baseArrayLayer: 0,\n arrayLayerCount: undefined\n };\n get [Symbol.toStringTag]() {\n return 'TextureView';\n }\n /** Should not be constructed directly. Use `texture.createView(props)` */\n constructor(device, props) {\n super(device, props, TextureView.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\nexport class ExternalTexture extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n source: null,\n colorSpace: 'srgb'\n };\n get [Symbol.toStringTag]() {\n return 'ExternalTexture';\n }\n constructor(device, props) {\n super(device, props, ExternalTexture.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** @returns annotated errors or warnings */\nexport function formatCompilerLog(shaderLog, source, options) {\n let formattedLog = '';\n const lines = source.split(/\\r?\\n/);\n const log = shaderLog.slice().sort((a, b) => a.lineNum - b.lineNum);\n switch (options?.showSourceCode || 'no') {\n case 'all':\n // Parse the error - note: browser and driver dependent\n let currentMessage = 0;\n for (let lineNum = 1; lineNum <= lines.length; lineNum++) {\n formattedLog += getNumberedLine(lines[lineNum - 1], lineNum, options);\n while (log.length > currentMessage && log[currentMessage].lineNum === lineNum) {\n const message = log[currentMessage++];\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n ...options,\n inlineSource: false\n });\n }\n }\n return formattedLog;\n case 'issues':\n case 'no':\n // Parse the error - note: browser and driver dependent\n for (const message of shaderLog) {\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n inlineSource: options?.showSourceCode !== 'no'\n });\n }\n return formattedLog;\n }\n}\n// Helpers\n/** Format one message */\nfunction formatCompilerMessage(message, lines, lineNum, options) {\n if (options?.inlineSource) {\n const numberedLines = getNumberedLines(lines, lineNum);\n // If we got error position on line add a `^^^` indicator on next line\n const positionIndicator = message.linePos > 0 ? `${' '.repeat(message.linePos + 5)}^^^\\n` : '';\n return `\n${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.message}\n\n`;\n }\n return options?.html\n ? `<div class='luma-compiler-log-error' style=\"color:red;\"><b> ${message.type.toUpperCase()}: ${message.message}</b></div>`\n : `${message.type.toUpperCase()}: ${message.message}`;\n}\nfunction getNumberedLines(lines, lineNum, options) {\n let numberedLines = '';\n for (let lineIndex = lineNum - 2; lineIndex <= lineNum; lineIndex++) {\n const sourceLine = lines[lineIndex - 1];\n if (sourceLine !== undefined) {\n numberedLines += getNumberedLine(sourceLine, lineNum, options);\n }\n }\n return numberedLines;\n}\nfunction getNumberedLine(line, lineNum, options) {\n const escapedLine = options?.html ? escapeHTML(line) : line;\n return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options?.html ? '<br/>' : '\\n'}`;\n}\n/**\n * Pads a string with a number of spaces (space characters) to the left\n * @param {String} string - string to pad\n * @param {Number} digits - number of spaces to add\n * @return {String} string - The padded string\n */\nfunction padLeft(string, paddedLength) {\n let result = '';\n for (let i = string.length; i < paddedLength; ++i) {\n result += ' ';\n }\n return result + string;\n}\nfunction escapeHTML(unsafe) {\n return unsafe\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replaceAll('\"', '&quot;')\n .replaceAll(\"'\", '&#039;');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Extracts information from shader source code */\nexport function getShaderInfo(source, defaultName) {\n return {\n name: getShaderName(source, defaultName),\n language: 'glsl',\n version: getShaderVersion(source)\n };\n}\n/** Extracts GLSLIFY style naming of shaders: `#define SHADER_NAME ...` */\nfunction getShaderName(shader, defaultName = 'unnamed') {\n const SHADER_NAME_REGEXP = /#define[\\s*]SHADER_NAME[\\s*]([A-Za-z0-9_-]+)[\\s*]/;\n const match = SHADER_NAME_REGEXP.exec(shader);\n return match ? match[1] : defaultName;\n}\n/** returns GLSL shader version of given shader string */\nfunction getShaderVersion(source) {\n let version = 100;\n const words = source.match(/[^\\s]+/g);\n if (words && words.length >= 2 && words[0] === '#version') {\n const v = parseInt(words[1], 10);\n if (Number.isFinite(v)) {\n version = v;\n }\n }\n return version;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n// import { log } from '../../utils/log';\nimport { uid } from \"../../utils/utils.js\";\nimport { formatCompilerLog } from \"../../lib/compiler-log/format-compiler-log.js\";\nimport { getShaderInfo } from \"../../lib/compiler-log/get-shader-info.js\";\n/**\n * Immutable Shader object\n * In WebGPU the handle can be copied between threads\n */\nexport class Shader extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n language: 'auto',\n stage: undefined,\n source: '',\n sourceMap: null,\n entryPoint: 'main',\n debug: 'errors'\n };\n get [Symbol.toStringTag]() {\n return 'Shader';\n }\n /** The stage of this shader */\n stage;\n /** The source code of this shader */\n source;\n /** The compilation status of the shader. 'pending' if compilation is asynchronous, and on production */\n compilationStatus = 'pending';\n /** Create a new Shader instance */\n constructor(device, props) {\n super(device, { id: getShaderIdFromProps(props), ...props }, Shader.defaultProps);\n this.stage = this.props.stage;\n this.source = this.props.source;\n }\n /** Get compiler log synchronously (WebGL only) */\n getCompilationInfoSync() {\n return null;\n }\n /** Get translated shader source in host platform's native language (HLSL, GLSL, and even GLSL ES), if available */\n getTranslatedSource() {\n return null;\n }\n // PORTABLE HELPERS\n /** In browser logging of errors */\n async debugShader(trigger = this.props.debug) {\n switch (trigger) {\n case 'never':\n return;\n case 'errors':\n // On WebGL - Don't extract the log unless errors\n if (this.compilationStatus === 'success') {\n return;\n }\n break;\n case 'warnings':\n case 'always':\n break;\n }\n const messages = await this.getCompilationInfo();\n if (this.props.debug === 'warnings' && messages?.length === 0) {\n return;\n }\n this._displayShaderLog(messages);\n }\n // PRIVATE\n /** In-browser UI logging of errors */\n _displayShaderLog(messages) {\n // Return if under Node.js / incomplete `document` polyfills\n if (typeof document === 'undefined' || !document?.createElement) {\n return;\n }\n const shaderName = getShaderInfo(this.source).name;\n const shaderTitle = `${this.stage} ${shaderName}`;\n let htmlLog = formatCompilerLog(messages, this.source, { showSourceCode: 'all', html: true });\n // Show translated source if available\n const translatedSource = this.getTranslatedSource();\n if (translatedSource) {\n htmlLog += `<br /><br /><h1>Translated Source</h1><br /><br /><code style=\"user-select:text;\"><pre>${translatedSource}</pre></code>`;\n }\n // Make it clickable so we can copy to clipboard\n const button = document.createElement('Button');\n button.innerHTML = `\n<h1>Shader Compilation Error in ${shaderTitle}</h1><br /><br />\n<code style=\"user-select:text;\"><pre>\n${htmlLog}\n</pre></code>`;\n button.style.top = '10px';\n button.style.left = '10px';\n button.style.position = 'absolute';\n button.style.zIndex = '9999';\n button.style.width = '100%';\n button.style.textAlign = 'left';\n document.body.appendChild(button);\n const errors = document.getElementsByClassName('luma-compiler-log-error');\n if (errors[0]?.scrollIntoView) {\n errors[0].scrollIntoView();\n }\n // TODO - add a small embedded copy button (instead of main button)\n button.onclick = () => {\n // const source = this.source.replaceAll('\\n', '<br />');\n const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;\n navigator.clipboard.writeText(dataURI);\n };\n // TODO - add a small embedded close button\n }\n}\n// HELPERS\n/** Deduce an id, from shader source, or supplied id, or shader type */\nfunction getShaderIdFromProps(props) {\n return getShaderInfo(props.source).name || props.id || uid(`unnamed ${props.stage}-shader`);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Immutable Sampler object */\nexport class Sampler extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n type: 'color-sampler',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge',\n addressModeW: 'clamp-to-edge',\n magFilter: 'nearest',\n minFilter: 'nearest',\n mipmapFilter: 'nearest',\n lodMinClamp: 0,\n lodMaxClamp: 32, // Per WebGPU spec\n compare: 'less-equal',\n maxAnisotropy: 1\n };\n get [Symbol.toStringTag]() {\n return 'Sampler';\n }\n constructor(device, props) {\n super(device, props, Sampler.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\nimport { Texture } from \"./texture.js\";\nimport { log } from \"../../utils/log.js\";\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class Framebuffer extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n width: 1,\n height: 1,\n colorAttachments: [], // ['rgba8unorm'],\n depthStencilAttachment: null // 'depth24plus-stencil8'\n };\n get [Symbol.toStringTag]() {\n return 'Framebuffer';\n }\n /** Width of all attachments in this framebuffer */\n width;\n /** Height of all attachments in this framebuffer */\n height;\n /** Color attachments */\n colorAttachments = [];\n /** Depth-stencil attachment, if provided */\n depthStencilAttachment = null;\n constructor(device, props = {}) {\n super(device, props, Framebuffer.defaultProps);\n this.width = this.props.width;\n this.height = this.props.height;\n // NOTE: call from subclass constructor as we cannot call overridden methods here (subclass not yet constructed)\n // this.autoCreateAttachmentTextures();\n }\n resize(size) {\n let updateSize = !size;\n if (size) {\n const [width, height] = Array.isArray(size) ? size : [size.width, size.height];\n updateSize = updateSize || height !== this.height || width !== this.width;\n this.width = width;\n this.height = height;\n }\n if (updateSize) {\n log.log(2, `Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)();\n this.resizeAttachments(this.width, this.height);\n }\n }\n /** Auto creates any textures */\n autoCreateAttachmentTextures() {\n if (this.props.colorAttachments.length === 0 && !this.props.depthStencilAttachment) {\n throw new Error('Framebuffer has noattachments');\n }\n this.colorAttachments = this.props.colorAttachments.map(attachment => {\n if (typeof attachment === 'string') {\n const texture = this.createColorTexture(attachment);\n this.attachResource(texture);\n return texture.view;\n }\n if (attachment instanceof Texture) {\n return attachment.view;\n }\n return attachment;\n });\n const attachment = this.props.depthStencilAttachment;\n if (attachment) {\n if (typeof attachment === 'string') {\n const texture = this.createDepthStencilTexture(attachment);\n this.attachResource(texture);\n this.depthStencilAttachment = texture.view;\n }\n else if (attachment instanceof Texture) {\n this.depthStencilAttachment = attachment.view;\n }\n else {\n this.depthStencilAttachment = attachment;\n }\n }\n }\n /** Create a color texture */\n createColorTexture(format) {\n return this.device.createTexture({\n id: 'color-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n /** Create depth stencil texture */\n createDepthStencilTexture(format) {\n return this.device.createTexture({\n id: 'depth-stencil-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n /**\n * Default implementation of resize\n * Creates new textures with correct size for all attachments.\n * and destroys existing textures if owned\n */\n resizeAttachments(width, height) {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({\n ...this.colorAttachments[i].props,\n width,\n height\n });\n this.destroyAttachedResource(this.colorAttachments[i]);\n this.colorAttachments[i] = resizedTexture.view;\n this.attachResource(resizedTexture.view);\n }\n }\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({\n ...this.depthStencilAttachment.props,\n width,\n height\n });\n this.destroyAttachedResource(this.depthStencilAttachment);\n this.depthStencilAttachment = resizedTexture.view;\n this.attachResource(resizedTexture);\n }\n }\n}\n// TODO - remove if not needed\n// Create a color attachment for WebGL *\n// protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {\n// return this.device._createTexture({\n// id: `${this.id}-color`,\n// data: null, // reserves texture memory, but texels are undefined\n// format,\n// // type: GL.UNSIGNED_BYTE,\n// width: this.width,\n// height: this.height,\n// // Note: Mipmapping can be disabled by texture resource when we resize the texture\n// // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n// // behavior we always disable mipmaps.\n// mipmaps: false,\n// // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n// // Use LINEAR so subpixel algos like fxaa work.\n// // Set WRAP modes that support NPOT textures too.\n// sampler: {\n// minFilter: 'linear',\n// magFilter: 'linear',\n// addressModeU: 'clamp-to-edge',\n// addressModeV: 'clamp-to-edge'\n// }\n// // parameters: {\n// // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n// // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n// // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n// // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n// // }\n// });\n// }\n// /** Returns fully populated attachment object. */\n// protected normalizeColorAttachment(\n// attachment: Texture | ColorTextureFormat\n// ): Required<ColorAttachment> {\n// const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {\n// texture: undefined!,\n// format: undefined!,\n// clearValue: [0.0, 0.0, 0.0, 0.0],\n// loadOp: 'clear',\n// storeOp: 'store'\n// };\n// if (attachment instanceof Texture) {\n// return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};\n// }\n// if (typeof attachment === 'string') {\n// return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};\n// }\n// return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};\n// }\n// /** Wraps texture inside fully populated attachment object. */\n// protected normalizeDepthStencilAttachment(\n// attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat\n// ): Required<DepthStencilAttachment> {\n// const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {\n// texture: undefined!,\n// format: undefined!,\n// depthClearValue: 1.0,\n// depthLoadOp: 'clear',\n// depthStoreOp: 'store',\n// depthReadOnly: false,\n// stencilClearValue: 0,\n// stencilLoadOp: 'clear',\n// stencilStoreOp: 'store',\n// stencilReadOnly: false\n// };\n// if (typeof attachment === 'string') {\n// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};\n// }\n// // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer\n// if (attachment.handle || attachment instanceof Texture) {\n// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};\n// }\n// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};\n// }\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// import {normalizeAttributeMap} from '../helpers/attribute-bindings';\nimport { Resource } from \"./resource.js\";\n/**\n * A compiled and linked shader program\n */\nexport class RenderPipeline extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n vs: null,\n vertexEntryPoint: 'vertexMain',\n vsConstants: {},\n fs: null,\n fragmentEntryPoint: 'fragmentMain',\n fsConstants: {},\n shaderLayout: null,\n bufferLayout: [],\n topology: 'triangle-list',\n parameters: {},\n // isInstanced: false,\n // instanceCount: 0,\n // vertexCount: 0,\n bindings: {},\n uniforms: {}\n };\n get [Symbol.toStringTag]() {\n return 'RenderPipeline';\n }\n /** The merged layout */\n shaderLayout;\n /** Buffer map describing buffer interleaving etc */\n bufferLayout;\n /** The linking status of the pipeline. 'pending' if linking is asynchronous, and on production */\n linkStatus = 'pending';\n /** The hash of the pipeline */\n hash = '';\n constructor(device, props) {\n super(device, props, RenderPipeline.defaultProps);\n this.shaderLayout = this.props.shaderLayout;\n this.bufferLayout = this.props.bufferLayout || [];\n }\n // DEPRECATED METHODS\n /**\n * Uniforms\n * @deprecated Use uniforms buffers\n * @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.\n * @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.\n */\n setUniformsWebGL(uniforms) {\n throw new Error('Use uniform blocks');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// import {Binding} from '../types/shader-layout';\nimport { Resource } from \"./resource.js\";\n/**\n * A RenderPass instance is a required parameter to all draw calls.\n *\n * It holds a combination of\n * - render targets (specified via a framebuffer)\n * - clear colors, read/write, discard information for the framebuffer attachments\n * - a couple of mutable parameters ()\n */\nexport class RenderPass extends Resource {\n /** Default properties for RenderPass */\n static defaultProps = {\n ...Resource.defaultProps,\n framebuffer: null,\n parameters: undefined,\n clearColor: [0, 0, 0, 0],\n clearDepth: 1,\n clearStencil: 0,\n depthReadOnly: false,\n stencilReadOnly: false,\n discard: false,\n occlusionQuerySet: undefined,\n timestampQuerySet: undefined,\n beginTimestampIndex: undefined,\n endTimestampIndex: undefined\n };\n get [Symbol.toStringTag]() {\n return 'RenderPass';\n }\n constructor(device, props) {\n super(device, props, RenderPass.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * A compiled and linked shader program for compute\n */\nexport class ComputePipeline extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n shader: undefined,\n entryPoint: undefined,\n constants: {},\n shaderLayout: undefined\n };\n get [Symbol.toStringTag]() {\n return 'ComputePipeline';\n }\n hash = '';\n constructor(device, props) {\n super(device, props, ComputePipeline.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\nexport class ComputePass extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n timestampQuerySet: undefined,\n beginTimestampIndex: undefined,\n endTimestampIndex: undefined\n };\n get [Symbol.toStringTag]() {\n return 'ComputePass';\n }\n constructor(device, props) {\n super(device, props, ComputePass.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * Encodes commands to queue that can be executed later\n */\nexport class CommandEncoder extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n measureExecutionTime: undefined\n };\n get [Symbol.toStringTag]() {\n return 'CommandEncoder';\n }\n constructor(device, props) {\n super(device, props, CommandEncoder.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * Encodes commands to queue that can be executed later\n */\nexport class CommandBuffer extends Resource {\n static defaultProps = {\n ...Resource.defaultProps\n };\n get [Symbol.toStringTag]() {\n return 'CommandBuffer';\n }\n constructor(device, props) {\n super(device, props, CommandBuffer.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */\nexport function decodeShaderAttributeType(attributeType) {\n const [dataType, components] = TYPE_INFO[attributeType];\n const integer = dataType === 'i32' || dataType === 'u32';\n const signed = dataType !== 'u32';\n const byteLength = TYPE_SIZES[dataType] * components;\n const defaultVertexFormat = getCompatibleVertexFormat(dataType, components);\n return {\n dataType,\n components,\n defaultVertexFormat,\n byteLength,\n integer,\n signed\n };\n}\n/** Get the \"default\" vertex format for a certain shader data type */\nfunction getCompatibleVertexFormat(dataType, components) {\n let vertexType;\n switch (dataType) {\n case 'f32':\n vertexType = 'float32';\n break;\n case 'i32':\n vertexType = 'sint32';\n break;\n case 'u32':\n vertexType = 'uint32';\n break;\n case 'f16':\n return components <= 2 ? 'float16x2' : 'float16x4';\n }\n // TODO logic does not work for float16\n if (components === 1) {\n return vertexType;\n }\n return `${vertexType}x${components}`;\n}\n/** All valid shader attribute types. A table guarantees exhaustive list and fast execution */\nconst TYPE_INFO = {\n f32: ['f32', 1],\n 'vec2<f32>': ['f32', 2],\n 'vec3<f32>': ['f32', 3],\n 'vec4<f32>': ['f32', 4],\n f16: ['f16', 1],\n 'vec2<f16>': ['f16', 2],\n 'vec3<f16>': ['f16', 3],\n 'vec4<f16>': ['f16', 4],\n i32: ['i32', 1],\n 'vec2<i32>': ['i32', 2],\n 'vec3<i32>': ['i32', 3],\n 'vec4<i32>': ['i32', 4],\n u32: ['u32', 1],\n 'vec2<u32>': ['u32', 2],\n 'vec3<u32>': ['u32', 3],\n 'vec4<u32>': ['u32', 4]\n};\nconst TYPE_SIZES = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4\n // 'bool-webgl': 4,\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { decodeVertexType } from \"./decode-data-type.js\";\n/**\n * Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)\n */\nexport function decodeVertexFormat(format) {\n // Strip the -webgl ending if present\n let webglOnly;\n if (format.endsWith('-webgl')) {\n format.replace('-webgl', '');\n webglOnly = true;\n }\n // split components from type\n const [type_, count] = format.split('x');\n const type = type_;\n const components = (count ? parseInt(count) : 1);\n // decode the type\n const decodedType = decodeVertexType(type);\n const result = {\n type,\n components,\n byteLength: decodedType.byteLength * components,\n integer: decodedType.integer,\n signed: decodedType.signed,\n normalized: decodedType.normalized\n };\n if (webglOnly) {\n result.webglOnly = true;\n }\n return result;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"../../utils/log.js\";\nimport { decodeShaderAttributeType } from \"../type-utils/decode-attribute-type.js\";\nimport { decodeVertexFormat } from \"../type-utils/decode-vertex-format.js\";\n/**\n * Map from \"attribute names\" to \"resolved attribute infos\"\n * containing information about both buffer layouts and shader attribute declarations\n */\nexport function getAttributeInfosFromLayouts(shaderLayout, bufferLayout) {\n const attributeInfos = {};\n for (const attribute of shaderLayout.attributes) {\n attributeInfos[attribute.name] = getAttributeInfoFromLayouts(shaderLayout, bufferLayout, attribute.name);\n }\n return attributeInfos;\n}\n/**\n * Array indexed by \"location\" holding \"resolved attribute infos\"\n */\nexport function getAttributeInfosByLocation(shaderLayout, bufferLayout, maxVertexAttributes = 16) {\n const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);\n const locationInfos = new Array(maxVertexAttributes).fill(null);\n for (const attributeInfo of Object.values(attributeInfos)) {\n locationInfos[attributeInfo.location] = attributeInfo;\n }\n return locationInfos;\n}\n/**\n * Get the combined information from a shader layout and a buffer layout for a specific attribute\n */\nfunction getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name) {\n const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name);\n const bufferMapping = getAttributeFromBufferLayout(bufferLayout, name);\n // TODO should no longer happen\n if (!shaderDeclaration) {\n // || !bufferMapping\n return null;\n }\n const attributeTypeInfo = decodeShaderAttributeType(shaderDeclaration.type);\n const vertexFormat = bufferMapping?.vertexFormat || attributeTypeInfo.defaultVertexFormat;\n const vertexFormatInfo = decodeVertexFormat(vertexFormat);\n return {\n attributeName: bufferMapping?.attributeName || shaderDeclaration.name,\n bufferName: bufferMapping?.bufferName || shaderDeclaration.name,\n location: shaderDeclaration.location,\n shaderType: shaderDeclaration.type,\n shaderDataType: attributeTypeInfo.dataType,\n shaderComponents: attributeTypeInfo.components,\n vertexFormat,\n bufferDataType: vertexFormatInfo.type,\n bufferComponents: vertexFormatInfo.components,\n // normalized is a property of the buffer's vertex format\n normalized: vertexFormatInfo.normalized,\n // integer is a property of the shader declaration\n integer: attributeTypeInfo.integer,\n stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode,\n byteOffset: bufferMapping?.byteOffset || 0,\n byteStride: bufferMapping?.byteStride || 0\n };\n}\nfunction getAttributeFromShaderLayout(shaderLayout, name) {\n const attribute = shaderLayout.attributes.find(attr => attr.name === name);\n if (!attribute) {\n log.warn(`shader layout attribute \"${name}\" not present in shader`);\n }\n return attribute || null;\n}\nfunction getAttributeFromBufferLayout(bufferLayouts, name) {\n // Check that bufferLayouts are valid (each either has format or attribute)\n checkBufferLayouts(bufferLayouts);\n let bufferLayoutInfo = getAttributeFromShortHand(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n bufferLayoutInfo = getAttributeFromAttributesList(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n // Didn't find...\n log.warn(`layout for attribute \"${name}\" not present in buffer layout`);\n return null;\n}\n/** Check that bufferLayouts are valid (each either has format or attribute) */\nfunction checkBufferLayouts(bufferLayouts) {\n for (const bufferLayout of bufferLayouts) {\n if ((bufferLayout.attributes && bufferLayout.format) ||\n (!bufferLayout.attributes && !bufferLayout.format)) {\n log.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`);\n }\n }\n}\n/** Get attribute from format shorthand if specified */\nfunction getAttributeFromShortHand(bufferLayouts, name) {\n for (const bufferLayout of bufferLayouts) {\n if (bufferLayout.format && bufferLayout.name === name) {\n return {\n attributeName: bufferLayout.name,\n bufferName: name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: bufferLayout.format,\n // If offset is needed, use `attributes` field.\n byteOffset: 0,\n byteStride: bufferLayout.byteStride || 0\n };\n }\n }\n return null;\n}\n/**\n * Search attribute mappings (e.g. interleaved attributes) for buffer mapping.\n * Not the name of the buffer might be the same as one of the interleaved attributes.\n */\nfunction getAttributeFromAttributesList(bufferLayouts, name) {\n for (const bufferLayout of bufferLayouts) {\n let byteStride = bufferLayout.byteStride;\n // Calculate a default byte stride if not provided\n if (typeof bufferLayout.byteStride !== 'number') {\n for (const attributeMapping of bufferLayout.attributes || []) {\n const info = decodeVertexFormat(attributeMapping.format);\n byteStride += info.byteLength;\n }\n }\n const attributeMapping = bufferLayout.attributes?.find(mapping => mapping.attribute === name);\n if (attributeMapping) {\n return {\n attributeName: attributeMapping.attribute,\n bufferName: bufferLayout.name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: attributeMapping.format,\n byteOffset: attributeMapping.byteOffset,\n byteStride\n };\n }\n }\n return null;\n}\n/**\n * Merges an provided shader layout into a base shader layout\n * In WebGL, this allows the auto generated shader layout to be overridden by the application\n * Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).\n * @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?\n */\nexport function mergeShaderLayout(baseLayout, overrideLayout) {\n // Deep clone the base layout\n const mergedLayout = {\n ...baseLayout,\n attributes: baseLayout.attributes.map(attribute => ({ ...attribute }))\n };\n // Merge the attributes\n for (const attribute of overrideLayout?.attributes || []) {\n const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);\n if (!baseAttribute) {\n log.warn(`shader layout attribute ${attribute.name} not present in shader`);\n }\n else {\n baseAttribute.type = attribute.type || baseAttribute.type;\n baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;\n }\n }\n return mergedLayout;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getAttributeInfosByLocation } from \"../attribute-utils/get-attribute-from-layouts.js\";\nimport { Resource } from \"./resource.js\";\n/**\n * Stores attribute bindings.\n * Makes it easy to share a render pipeline and use separate vertex arrays.\n * @note On WebGL, VertexArray allows non-constant bindings to be performed in advance\n * reducing the number of WebGL calls per draw call.\n * @note On WebGPU this is just a convenience class that collects the bindings.\n */\nexport class VertexArray extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n renderPipeline: null\n };\n get [Symbol.toStringTag]() {\n return 'VertexArray';\n }\n /** Max number of vertex attributes */\n maxVertexAttributes;\n /** Attribute infos indexed by location - TODO only needed by webgl module? */\n attributeInfos;\n /** Index buffer */\n indexBuffer = null;\n /** Attributes indexed by buffer slot */\n attributes;\n constructor(device, props) {\n super(device, props, VertexArray.defaultProps);\n this.maxVertexAttributes = device.limits.maxVertexAttributes;\n this.attributes = new Array(this.maxVertexAttributes).fill(null);\n this.attributeInfos = getAttributeInfosByLocation(props.renderPipeline.shaderLayout, props.renderPipeline.bufferLayout, this.maxVertexAttributes);\n }\n // DEPRECATED METHODS\n /** @deprecated Set constant attributes (WebGL only) */\n setConstantWebGL(location, value) {\n throw new Error('constant attributes not supported');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Holds a set of output buffers for pipeline (WebGL only) */\nexport class TransformFeedback extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n layout: undefined,\n buffers: {}\n };\n get [Symbol.toStringTag]() {\n return 'TransformFeedback';\n }\n constructor(device, props) {\n super(device, props, TransformFeedback.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Immutable QuerySet object */\nexport class QuerySet extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n type: undefined,\n count: undefined\n };\n get [Symbol.toStringTag]() {\n return 'QuerySet';\n }\n constructor(device, props) {\n super(device, props, QuerySet.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { assert } from \"../../utils/assert.js\";\nconst UNIFORM_FORMATS = {\n f32: { type: 'f32', components: 1 },\n i32: { type: 'i32', components: 1 },\n u32: { type: 'u32', components: 1 },\n // 'bool-webgl': {type: 'bool-webgl', components: 1},\n 'vec2<f32>': { type: 'f32', components: 2 },\n 'vec3<f32>': { type: 'f32', components: 3 },\n 'vec4<f32>': { type: 'f32', components: 4 },\n 'vec2<i32>': { type: 'i32', components: 2 },\n 'vec3<i32>': { type: 'i32', components: 3 },\n 'vec4<i32>': { type: 'i32', components: 4 },\n 'vec2<u32>': { type: 'u32', components: 2 },\n 'vec3<u32>': { type: 'u32', components: 3 },\n 'vec4<u32>': { type: 'u32', components: 4 },\n 'mat2x2<f32>': { type: 'f32', components: 4 },\n 'mat2x3<f32>': { type: 'f32', components: 6 },\n 'mat2x4<f32>': { type: 'f32', components: 8 },\n 'mat3x2<f32>': { type: 'f32', components: 6 },\n 'mat3x3<f32>': { type: 'f32', components: 9 },\n 'mat3x4<f32>': { type: 'f32', components: 12 },\n 'mat4x2<f32>': { type: 'f32', components: 8 },\n 'mat4x3<f32>': { type: 'f32', components: 12 },\n 'mat4x4<f32>': { type: 'f32', components: 16 }\n};\n/** Split a uniform type string into type and components */\nexport function decodeShaderUniformType(format) {\n const decoded = UNIFORM_FORMATS[format];\n assert(format);\n return decoded;\n}\n/** Align offset to 1, 2 or 4 elements (4, 8 or 16 bytes) */\nexport function alignTo(size, count) {\n // prettier-ignore\n switch (count) {\n case 1: return size; // Pad upwards to even multiple of 2\n case 2: return size + (size % 2); // Pad upwards to even multiple of 2\n default: return size + ((4 - (size % 4)) % 4); // Pad upwards to even multiple of 4\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nlet arrayBuffer;\nexport function getScratchArrayBuffer(byteLength) {\n if (!arrayBuffer || arrayBuffer.byteLength < byteLength) {\n arrayBuffer = new ArrayBuffer(byteLength);\n }\n return arrayBuffer;\n}\nexport function getScratchArray(Type, length) {\n const scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);\n return new Type(scratchArrayBuffer, 0, length); // arrayBuffer, byteOffset, length (in elements)\n}\n// Uses copyWithin to significantly speed up typed array value filling\nexport function fillArray(options) {\n const { target, source, start = 0, count = 1 } = options;\n const length = source.length;\n const total = count * length;\n let copied = 0;\n for (let i = start; copied < length; copied++) {\n target[i++] = source[copied];\n }\n while (copied < total) {\n // If we have copied less than half, copy everything we got\n // else copy remaining in one operation\n if (copied < total - copied) {\n target.copyWithin(start + copied, start, start + copied);\n copied *= 2;\n }\n else {\n target.copyWithin(start + copied, start, start + total - copied);\n copied = total;\n }\n }\n return options.target;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { decodeShaderUniformType, alignTo } from \"../../adapter/type-utils/decode-shader-types.js\";\nimport { getScratchArrayBuffer } from \"../../utils/array-utils-flat.js\";\nimport { isNumberArray } from \"../../utils/is-array.js\";\nimport { log } from \"../../utils/log.js\";\n/**\n * Smallest buffer size that can be used for uniform buffers.\n * TODO - does this depend on device?\n */\nconst minBufferSize = 1024;\n/**\n * Std140 layout for uniform buffers\n * Supports manual listing of uniforms\n */\nexport class UniformBufferLayout {\n layout = {};\n /** number of bytes needed for buffer allocation */\n byteLength;\n /** Create a new UniformBufferLayout given a map of attributes. */\n constructor(uniformTypes) {\n /** number of 4 byte slots taken */\n let size = 0;\n // Add layout (type, size and offset) definitions for each uniform in the layout\n for (const [key, uniformType] of Object.entries(uniformTypes)) {\n const typeAndComponents = decodeShaderUniformType(uniformType);\n const { type, components: count } = typeAndComponents;\n // First, align (bump) current offset to an even multiple of current object (1, 2, 4)\n size = alignTo(size, count);\n // Use the aligned size as the offset of the current uniform.\n const offset = size;\n // Then, add our object's padded size ((1, 2, multiple of 4) to the current offset\n size += count;\n this.layout[key] = { type, size: count, offset };\n }\n size += (4 - (size % 4)) % 4;\n const actualByteLength = size * 4;\n this.byteLength = Math.max(actualByteLength, minBufferSize);\n }\n /** Get the data for the complete buffer */\n getData(uniformValues) {\n const bufferSize = Math.max(this.byteLength, minBufferSize);\n // Allocate three typed arrays pointing at same memory\n const arrayBuffer = getScratchArrayBuffer(bufferSize);\n const typedArrays = {\n i32: new Int32Array(arrayBuffer),\n u32: new Uint32Array(arrayBuffer),\n f32: new Float32Array(arrayBuffer),\n // TODO not implemented\n f16: new Uint16Array(arrayBuffer)\n };\n // TODO is this needed?\n // typedArrays.i32.fill(0);\n for (const [name, value] of Object.entries(uniformValues)) {\n const uniformLayout = this.layout[name];\n if (!uniformLayout) {\n log.warn(`Supplied uniform value ${name} not present in uniform block layout`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n const { type, size, offset } = uniformLayout;\n const typedArray = typedArrays[type];\n if (size === 1) {\n if (typeof value !== 'number' && typeof value !== 'boolean') {\n log.warn(`Supplied value for single component uniform ${name} is not a number: ${value}`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n // single value -> just set it\n typedArray[offset] = Number(value);\n }\n else {\n const numericArray = isNumberArray(value);\n if (!numericArray) {\n log.warn(`Supplied value for multi component / array uniform ${name} is not a numeric array: ${value}`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n // vector/matrix -> copy the supplied (typed) array, starting from offset\n // TODO: we should limit or check size in case the supplied data overflows\n typedArray.set(numericArray, offset);\n }\n }\n return new Uint8Array(arrayBuffer);\n }\n /** Does this layout have a field with specified name */\n has(name) {\n return Boolean(this.layout[name]);\n }\n /** Get offset and size for a field with specified name */\n get(name) {\n const layout = this.layout[name];\n return layout;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isNumberArray } from \"./is-array.js\";\n/** Test if two arrays are deep equal, with a length limit that defaults to 16 */\nexport function arrayEqual(a, b, limit = 16) {\n if (a !== b) {\n return false;\n }\n const arrayA = isNumberArray(a);\n if (!arrayA) {\n return false;\n }\n const arrayB = isNumberArray(b);\n if (arrayB && arrayA.length === arrayB.length) {\n for (let i = 0; i < arrayA.length; ++i) {\n if (arrayB[i] !== arrayA[i]) {\n return false;\n }\n }\n }\n return true;\n}\n/** Copy a value */\nexport function arrayCopy(a) {\n const numberArray = isNumberArray(a);\n if (numberArray) {\n return numberArray.slice();\n }\n return a;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { arrayEqual, arrayCopy } from \"../../utils/array-equal.js\";\n/**\n * A uniform block holds values of the of uniform values for one uniform block / buffer.\n * It also does some book keeping on what has changed, to minimize unnecessary writes to uniform buffers.\n */\nexport class UniformBlock {\n name;\n uniforms = {};\n modifiedUniforms = {};\n modified = true;\n bindingLayout = {};\n needsRedraw = 'initialized';\n constructor(props) {\n this.name = props?.name;\n // TODO - Extract uniform layout from the shaderLayout object\n if (props?.name && props?.shaderLayout) {\n const binding = props?.shaderLayout.bindings?.find(binding => binding.type === 'uniform' && binding.name === props?.name);\n if (!binding) {\n throw new Error(props?.name);\n }\n const uniformBlock = binding;\n for (const uniform of uniformBlock.uniforms || []) {\n this.bindingLayout[uniform.name] = uniform;\n }\n }\n }\n /** Set a map of uniforms */\n setUniforms(uniforms) {\n for (const [key, value] of Object.entries(uniforms)) {\n this._setUniform(key, value);\n if (!this.needsRedraw) {\n this.setNeedsRedraw(`${this.name}.${key}=${value}`);\n }\n }\n }\n setNeedsRedraw(reason) {\n this.needsRedraw = this.needsRedraw || reason;\n }\n /** Returns all uniforms */\n getAllUniforms() {\n // @ts-expect-error\n this.modifiedUniforms = {};\n this.needsRedraw = false;\n return (this.uniforms || {});\n }\n /** Set a single uniform */\n _setUniform(key, value) {\n if (arrayEqual(this.uniforms[key], value)) {\n return;\n }\n this.uniforms[key] = arrayCopy(value);\n this.modifiedUniforms[key] = true;\n this.modified = true;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Buffer } from \"../../adapter/resources/buffer.js\";\nimport { UniformBlock } from \"./uniform-block.js\";\nimport { UniformBufferLayout } from \"./uniform-buffer-layout.js\";\nimport { log } from \"../../utils/log.js\";\n/**\n * A uniform store holds a uniform values for one or more uniform blocks,\n * - It can generate binary data for any uniform buffer\n * - It can manage a uniform buffer for each block\n * - It can update managed uniform buffers with a single call\n * - It performs some book keeping on what has changed to minimize unnecessary writes to uniform buffers.\n */\nexport class UniformStore {\n /** Stores the uniform values for each uniform block */\n uniformBlocks = new Map();\n /** Can generate data for a uniform buffer for each block from data */\n uniformBufferLayouts = new Map();\n /** Actual buffer for the blocks */\n uniformBuffers = new Map();\n /**\n * Create a new UniformStore instance\n * @param blocks\n */\n constructor(blocks) {\n for (const [bufferName, block] of Object.entries(blocks)) {\n const uniformBufferName = bufferName;\n // Create a layout object to help us generate correctly formatted binary uniform buffers\n const uniformBufferLayout = new UniformBufferLayout(block.uniformTypes || {});\n this.uniformBufferLayouts.set(uniformBufferName, uniformBufferLayout);\n // Create a Uniform block to store the uniforms for each buffer.\n const uniformBlock = new UniformBlock({ name: bufferName });\n uniformBlock.setUniforms(block.defaultUniforms || {});\n this.uniformBlocks.set(uniformBufferName, uniformBlock);\n }\n }\n /** Destroy any managed uniform buffers */\n destroy() {\n for (const uniformBuffer of this.uniformBuffers.values()) {\n uniformBuffer.destroy();\n }\n }\n /**\n * Set uniforms\n * Makes all properties partial\n */\n setUniforms(uniforms) {\n for (const [blockName, uniformValues] of Object.entries(uniforms)) {\n this.uniformBlocks.get(blockName).setUniforms(uniformValues);\n // We leverage logging in updateUniformBuffers(), even though slightly less efficient\n // this.updateUniformBuffer(blockName);\n }\n this.updateUniformBuffers();\n }\n /** Get the required minimum length of the uniform buffer */\n getUniformBufferByteLength(uniformBufferName) {\n return this.uniformBufferLayouts.get(uniformBufferName).byteLength;\n }\n /** Get formatted binary memory that can be uploaded to a buffer */\n getUniformBufferData(uniformBufferName) {\n const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();\n return this.uniformBufferLayouts.get(uniformBufferName).getData(uniformValues);\n }\n /**\n * Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)\n * The new buffer is initialized with current / supplied values\n */\n createUniformBuffer(device, uniformBufferName, uniforms) {\n if (uniforms) {\n this.setUniforms(uniforms);\n }\n const byteLength = this.getUniformBufferByteLength(uniformBufferName);\n const uniformBuffer = device.createBuffer({\n usage: Buffer.UNIFORM | Buffer.COPY_DST,\n byteLength\n });\n // Note that this clears the needs redraw flag\n const uniformBufferData = this.getUniformBufferData(uniformBufferName);\n uniformBuffer.write(uniformBufferData);\n return uniformBuffer;\n }\n /** Get the managed uniform buffer. \"managed\" resources are destroyed when the uniformStore is destroyed. */\n getManagedUniformBuffer(device, uniformBufferName) {\n if (!this.uniformBuffers.get(uniformBufferName)) {\n const byteLength = this.getUniformBufferByteLength(uniformBufferName);\n const uniformBuffer = device.createBuffer({\n usage: Buffer.UNIFORM | Buffer.COPY_DST,\n byteLength\n });\n this.uniformBuffers.set(uniformBufferName, uniformBuffer);\n }\n // this.updateUniformBuffers();\n return this.uniformBuffers.get(uniformBufferName);\n }\n /** Updates all uniform buffers where values have changed */\n updateUniformBuffers() {\n let reason = false;\n for (const uniformBufferName of this.uniformBlocks.keys()) {\n const bufferReason = this.updateUniformBuffer(uniformBufferName);\n reason ||= bufferReason;\n }\n if (reason) {\n log.log(3, `UniformStore.updateUniformBuffers(): ${reason}`)();\n }\n return reason;\n }\n /** Update one uniform buffer. Only updates if values have changed */\n updateUniformBuffer(uniformBufferName) {\n const uniformBlock = this.uniformBlocks.get(uniformBufferName);\n const uniformBuffer = this.uniformBuffers.get(uniformBufferName);\n let reason = false;\n if (uniformBuffer && uniformBlock.needsRedraw) {\n reason ||= uniformBlock.needsRedraw;\n // This clears the needs redraw flag\n const uniformBufferData = this.getUniformBufferData(uniformBufferName);\n const uniformBuffer = this.uniformBuffers.get(uniformBufferName);\n uniformBuffer.write(uniformBufferData);\n // logging - TODO - don't query the values unnecessarily\n const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();\n log.log(4, `Writing to uniform buffer ${String(uniformBufferName)}`, uniformBufferData, uniformValues)();\n }\n return reason;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function getDataTypeFromTypedArray(arrayOrType) {\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return 'float32';\n case Uint16Array:\n return 'uint16';\n case Uint32Array:\n return 'uint32';\n case Uint8Array:\n case Uint8ClampedArray:\n return 'uint8';\n case Int8Array:\n return 'sint8';\n case Int16Array:\n return 'sint16';\n case Int32Array:\n return 'sint32';\n default:\n // Failed to deduce data type from typed array\n throw new Error(type.constructor.name);\n }\n}\nexport function getTypedArrayFromDataType(dataType) {\n switch (dataType) {\n case 'float32':\n return Float32Array;\n case 'uint32':\n return Uint32Array;\n case 'sint32':\n return Int32Array;\n case 'uint16':\n case 'unorm16':\n return Uint16Array;\n case 'sint16':\n case 'snorm16':\n return Int16Array;\n case 'uint8':\n case 'unorm8':\n return Uint8Array;\n case 'sint8':\n case 'snorm8':\n return Int8Array;\n default:\n // Failed to deduce typed array from data type\n throw new Error(dataType);\n }\n}\n/** Get the vertex format for an attribute with TypedArray and size */\nexport function getVertexFormatFromAttribute(typedArray, size, normalized) {\n if (!size || size > 4) {\n throw new Error(`size ${size}`);\n }\n const components = size;\n let dataType = getDataTypeFromTypedArray(typedArray);\n if (dataType === 'uint8' || dataType === 'sint8') {\n if (components === 1 || components === 3) {\n // WebGPU 8 bit formats must be aligned to 16 bit boundaries');\n throw new Error(`size: ${size}`);\n }\n if (normalized) {\n dataType = dataType.replace('int', 'norm');\n }\n return `${dataType}x${components}`;\n }\n if (dataType === 'uint16' || dataType === 'sint16') {\n if (components === 1 || components === 3) {\n // WebGPU 16 bit formats must be aligned to 32 bit boundaries\n throw new Error(`size: ${size}`);\n }\n if (normalized) {\n dataType = dataType.replace('int', 'norm');\n }\n return `${dataType}x${components}`;\n }\n if (components === 1) {\n return dataType;\n }\n return `${dataType}x${components}`;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Helper for type downcasts, e.g. Buffer -> WebGPUBuffer */\nexport function cast(value) {\n return value;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isNumberArray } from \"../../utils/is-array.js\";\nexport function isUniformValue(value) {\n return isNumberArray(value) !== null || typeof value === 'number' || typeof value === 'boolean';\n}\nexport function splitUniformsAndBindings(uniforms) {\n const result = { bindings: {}, uniforms: {} };\n Object.keys(uniforms).forEach(name => {\n const uniform = uniforms[name];\n if (isUniformValue(uniform)) {\n result.uniforms[name] = uniform;\n }\n else {\n result.bindings[name] = uniform;\n }\n });\n return result;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** TODO @deprecated - delete when confident that probe.gl logging implements all opts */\nfunction formatArrayValue(v, opts = {}) {\n const { maxElts = 16, size = 1 } = opts;\n let string = '[';\n for (let i = 0; i < v.length && i < maxElts; ++i) {\n if (i > 0) {\n string += `,${i % size === 0 ? ' ' : ''}`;\n }\n string += formatValue(v[i], opts);\n }\n const terminator = v.length > maxElts ? '...' : ']';\n return `${string}${terminator}`;\n}\n/** TODO @deprecated - delete when confident that probe.gl logging implements all opts */\nexport function formatValue(v, opts = {}) {\n const EPSILON = 1e-16;\n const { isInteger = false } = opts;\n if (Array.isArray(v) || ArrayBuffer.isView(v)) {\n return formatArrayValue(v, opts);\n }\n if (typeof v !== 'number') {\n return String(v);\n }\n if (Math.abs(v) < EPSILON) {\n return isInteger ? '0' : '0.';\n }\n if (isInteger) {\n return v.toFixed(0);\n }\n if (Math.abs(v) > 100 && Math.abs(v) < 10000) {\n return v.toFixed(0);\n }\n const string = v.toPrecision(2);\n const decimal = string.indexOf('.0');\n return decimal === string.length - 2 ? string.slice(0, -1) : string;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"./log.js\";\n// Install stubs for removed methods\nexport function stubRemovedMethods(instance, className, version, methodNames) {\n const upgradeMessage = `See luma.gl ${version} Upgrade Guide at \\\nhttps://luma.gl/docs/upgrade-guide`;\n const prototype = Object.getPrototypeOf(instance);\n methodNames.forEach((methodName) => {\n if (prototype.methodName) {\n return;\n }\n prototype[methodName] = () => {\n log.removed(`Calling removed method ${className}.${methodName}: `, upgradeMessage)();\n throw new Error(methodName);\n };\n });\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"./log.js\";\nexport function checkProps(className, props, propChecks) {\n const { removedProps = {}, deprecatedProps = {}, replacedProps = {} } = propChecks;\n // removedProps: Removed props no longer supported\n // print error and link to upgrade guide\n for (const propName in removedProps) {\n if (propName in props) {\n const replacementProp = removedProps[propName];\n const replacement = replacementProp ? `${className}.${removedProps[propName]}` : 'N/A';\n log.removed(`${className}.${propName}`, replacement)();\n }\n }\n // deprecatedProps: Deprecated props that can not be autosubstituted\n // print warning and rely on caller to substitute\n for (const propName in deprecatedProps) {\n if (propName in props) {\n const replacementProp = deprecatedProps[propName];\n log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();\n }\n }\n // replacedProps: Deprecated props that can be autosubstituted\n // print warning and return updated props object\n let newProps = null;\n for (const [propName, replacementProp] of Object.entries(replacedProps)) {\n if (propName in props) {\n log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();\n newProps = newProps || Object.assign({}, props);\n newProps[replacementProp] = props[propName];\n delete newProps[propName];\n }\n }\n return newProps || props;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nlet pathPrefix = '';\n/**\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix) {\n pathPrefix = prefix;\n}\n/**\n * Reads raw file data. Respects setPathPrefix.\n */\nexport async function loadFile(url, options) {\n url = url.startsWith('http') ? url : pathPrefix + url;\n const dataType = options?.dataType || 'text';\n const response = await fetch(url, options);\n return await response[dataType]();\n}\n/**\n * Loads ImageBitmap asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n */\nexport async function loadImageBitmap(url, opts) {\n const image = new Image();\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n await image.decode();\n return await createImageBitmap(image);\n}\n/**\n * Loads image asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.\n */\nexport async function loadImage(url, opts) {\n return await new Promise((resolve, reject) => {\n try {\n const image = new Image();\n image.onload = () => resolve(image);\n image.onerror = () => reject(new Error(`Could not load image ${url}.`));\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n }\n catch (error) {\n reject(error);\n }\n });\n}\n/**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param scriptId defines the id of the script element\n */\nexport async function loadScript(scriptUrl, scriptId) {\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n throw new Error('loadScript');\n }\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', scriptUrl);\n if (scriptId) {\n script.id = scriptId;\n }\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = error => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));\n head.appendChild(script);\n });\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Creates a deterministic pseudorandom number generator */\nexport function makeRandomNumberGenerator() {\n let s = 1;\n let c = 1;\n return () => {\n s = Math.sin(c * 17.23);\n c = Math.cos(s * 27.92);\n return fract(Math.abs(s * c) * 1432.71);\n };\n}\nfunction fract(n) {\n return n - Math.floor(n);\n}\n/** Generates a deterministic pseudorandom number */\nexport const random = makeRandomNumberGenerator();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Fast partial deep equal for prop.\n *\n * @param a Prop\n * @param b Prop to compare against `a`\n * @param depth Depth to which to recurse in nested Objects/Arrays. Use 0 (default) for shallow comparison, -1 for infinite depth\n */\n/* eslint-disable complexity */\nexport function deepEqual(a, b, depth) {\n if (a === b) {\n return true;\n }\n if (!depth || !a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === 'object' && typeof b === 'object') {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!b.hasOwnProperty(key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Node.js polyfills for requestAnimationFrame and cancelAnimationFrame\n/* global window, setTimeout, clearTimeout */\n// / <reference types=\"@types/node\" />\nexport function requestAnimationFrame(callback) {\n return typeof window !== 'undefined' && window.requestAnimationFrame\n ? window.requestAnimationFrame(callback)\n : setTimeout(callback, 1000 / 60);\n}\nexport function cancelAnimationFrame(timerId) {\n return typeof window !== 'undefined' && window.cancelAnimationFrame\n ? window.cancelAnimationFrame(timerId)\n : clearTimeout(timerId);\n}\n"],
4
+ "sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { VERSION } from \"./init.js\";\nexport { isTypedArray, isNumberArray } from \"./utils/is-array.js\";\n// MAIN API ACCESS POINTS\nexport { luma } from \"./lib/luma.js\";\nexport { Device, DeviceFeatures, DeviceLimits } from \"./adapter/device.js\";\nexport { CanvasContext } from \"./adapter/canvas-context.js\";\nexport { Resource } from \"./adapter/resources/resource.js\";\nexport { Buffer } from \"./adapter/resources/buffer.js\";\nexport { Texture } from \"./adapter/resources/texture.js\";\nexport { TextureView } from \"./adapter/resources/texture-view.js\";\nexport { ExternalTexture } from \"./adapter/resources/external-texture.js\";\nexport { Shader } from \"./adapter/resources/shader.js\";\nexport { Sampler } from \"./adapter/resources/sampler.js\";\nexport { Framebuffer } from \"./adapter/resources/framebuffer.js\";\nexport { RenderPipeline } from \"./adapter/resources/render-pipeline.js\";\nexport { RenderPass } from \"./adapter/resources/render-pass.js\";\nexport { ComputePipeline } from \"./adapter/resources/compute-pipeline.js\";\nexport { ComputePass } from \"./adapter/resources/compute-pass.js\";\nexport { CommandEncoder } from \"./adapter/resources/command-encoder.js\";\nexport { CommandBuffer } from \"./adapter/resources/command-buffer.js\";\nexport { VertexArray } from \"./adapter/resources/vertex-array.js\";\nexport { TransformFeedback } from \"./adapter/resources/transform-feedback.js\";\nexport { QuerySet } from \"./adapter/resources/query-set.js\";\nexport { UniformBufferLayout } from \"./lib/uniforms/uniform-buffer-layout.js\";\nexport { UniformBlock } from \"./lib/uniforms/uniform-block.js\";\nexport { UniformStore } from \"./lib/uniforms/uniform-store.js\";\n// TYPE UTILS\nexport { decodeVertexFormat } from \"./adapter/type-utils/decode-vertex-format.js\";\nexport { decodeTextureFormat } from \"./adapter/type-utils/decode-texture-format.js\";\nexport { getDataTypeFromTypedArray, getTypedArrayFromDataType, getVertexFormatFromAttribute } from \"./adapter/type-utils/vertex-format-from-attribute.js\";\n// SHADER TYPE UTILS\nexport { decodeShaderUniformType } from \"./adapter/type-utils/decode-shader-types.js\";\nexport { decodeShaderAttributeType } from \"./adapter/type-utils/decode-attribute-type.js\";\nexport { formatCompilerLog } from \"./lib/compiler-log/format-compiler-log.js\";\nexport { getAttributeInfosFromLayouts, mergeShaderLayout } from \"./adapter/attribute-utils/get-attribute-from-layouts.js\";\n// GENERAL UTILS\nexport { StatsManager } from \"./utils/stats-manager.js\";\nexport { assert } from \"./utils/assert.js\";\nexport { cast } from \"./utils/cast.js\";\nexport { log } from \"./utils/log.js\";\nexport { uid, isObjectEmpty } from \"./utils/utils.js\";\nexport { isUniformValue, splitUniformsAndBindings } from \"./lib/uniforms/uniform.js\";\nexport { formatValue } from \"./utils/format-value.js\";\nexport { stubRemovedMethods } from \"./utils/stub-methods.js\";\nexport { checkProps } from \"./utils/check-props.js\";\nexport { setPathPrefix, loadFile, loadImage, loadImageBitmap, loadScript } from \"./utils/load-file.js\";\nexport { getScratchArrayBuffer, getScratchArray, fillArray } from \"./utils/array-utils-flat.js\";\nexport { makeRandomNumberGenerator, random } from \"./utils/random.js\";\nexport { deepEqual } from \"./utils/deep-equal.js\";\n// ENGINE - TODO/move to @luma.gl/engine once that module is webgl-independent?\nexport { requestAnimationFrame, cancelAnimationFrame } from \"./utils/request-animation-frame.js\";\n// SHADER HELPERS\n/**\n * Marks GLSL shaders for syntax highlighting: glsl`...`\n * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal\n */\nexport const glsl = (x) => `${x}`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isBrowser } from '@probe.gl/env';\nimport { log } from \"./utils/log.js\";\nimport { lumaStats } from \"./utils/stats-manager.js\";\n/**\n * By adding the result of init() to Device.VERSION we guarantee it will be called\n * @returns version\n */\nfunction initializeLuma() {\n // Version detection using babel plugin\n // @ts-expect-error\n const VERSION = typeof \"9.0.21\" !== 'undefined' ? \"9.0.21\" : 'running from source';\n const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';\n // Assign luma.log.level in console to control logging: \\\n // 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs\n // luma.log.break[], set to gl funcs, luma.log.profile[] set to model names`;\n if (globalThis.luma && globalThis.luma.VERSION !== VERSION) {\n throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION}`);\n }\n if (!globalThis.luma) {\n if (isBrowser()) {\n log.log(1, `${VERSION} - ${STARTUP_MESSAGE}`)();\n }\n globalThis.luma = globalThis.luma || {\n VERSION,\n version: VERSION,\n log,\n // A global stats object that various components can add information to\n // E.g. see webgl/resource.js\n stats: lumaStats\n };\n }\n return VERSION;\n}\nexport const VERSION = initializeLuma();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Log } from '@probe.gl/log';\n/** Global log instance */\nexport const log = new Log({ id: 'luma.gl' });\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Stats } from '@probe.gl/stats';\n/**\n * Helper class managing a collection of probe.gl stats objects\n */\nexport class StatsManager {\n stats = new Map();\n getStats(name) {\n return this.get(name);\n }\n get(name) {\n if (!this.stats.has(name)) {\n this.stats.set(name, new Stats({ id: name }));\n }\n return this.stats.get(name);\n }\n}\n/** Global stats for all luma.gl devices */\nexport const lumaStats = new StatsManager();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Check is an array is a typed array\n * @param value value to be tested\n * @returns input as TypedArray, or null\n * @todo this should be provided by @math.gl/types\n */\nexport function isTypedArray(value) {\n return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;\n}\n/**\n * Check is an array is a numeric array (typed array or array of numbers)\n * @param value value to be tested\n * @returns input as NumberArray, or null\n * @todo this should be provided by @math.gl/types\n */\nexport function isNumberArray(value) {\n if (Array.isArray(value)) {\n return value.length === 0 || typeof value[0] === 'number' ? value : null;\n }\n return isTypedArray(value);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst uidCounters = {};\n/**\n * Returns a UID.\n * @param id= - Identifier base name\n * @return uid\n **/\nexport function uid(id = 'id') {\n uidCounters[id] = uidCounters[id] || 1;\n const count = uidCounters[id]++;\n return `${id}-${count}`;\n}\n/** Returns true if given object is empty, false otherwise. */\nexport function isObjectEmpty(obj) {\n let isEmpty = true;\n // @ts-ignore key is unused\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const key in obj) {\n isEmpty = false;\n break;\n }\n return isEmpty;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { uid } from \"../../utils/utils.js\";\n/**\n * Base class for GPU (WebGPU/WebGL) Resources\n */\nexport class Resource {\n /** Default properties for resource */\n static defaultProps = {\n id: 'undefined',\n handle: undefined,\n userData: undefined\n };\n /** props.id, for debugging. */\n id;\n props;\n userData = {};\n _device;\n /** Whether this resource has been destroyed */\n destroyed = false;\n /** For resources that allocate GPU memory */\n allocatedBytes = 0;\n /** Attached resources will be destroyed when this resource is destroyed. Tracks auto-created \"sub\" resources. */\n _attachedResources = new Set();\n /**\n * Create a new Resource. Called from Subclass\n */\n constructor(device, props, defaultProps) {\n if (!device) {\n throw new Error('no device');\n }\n this._device = device;\n this.props = selectivelyMerge(props, defaultProps);\n const id = this.props.id !== 'undefined' ? this.props.id : uid(this[Symbol.toStringTag]);\n this.props.id = id;\n this.id = id;\n this.userData = this.props.userData || {};\n this.addStats();\n }\n /**\n * destroy can be called on any resource to release it before it is garbage collected.\n */\n destroy() {\n this.destroyResource();\n }\n /** @deprecated Use destroy() */\n delete() {\n this.destroy();\n return this;\n }\n toString() {\n return `${this[Symbol.toStringTag] || this.constructor.name}(${this.id})`;\n }\n /**\n * Combines a map of user props and default props, only including props from defaultProps\n * @returns returns a map of overridden default props\n */\n getProps() {\n return this.props;\n }\n // ATTACHED RESOURCES\n /**\n * Attaches a resource. Attached resources are auto destroyed when this resource is destroyed\n * Called automatically when sub resources are auto created but can be called by application\n */\n attachResource(resource) {\n this._attachedResources.add(resource);\n }\n /**\n * Detach an attached resource. The resource will no longer be auto-destroyed when this resource is destroyed.\n */\n detachResource(resource) {\n this._attachedResources.delete(resource);\n }\n /**\n * Destroys a resource (only if owned), and removes from the owned (auto-destroy) list for this resource.\n */\n destroyAttachedResource(resource) {\n if (this._attachedResources.delete(resource)) {\n resource.destroy();\n }\n }\n /** Destroy all owned resources. Make sure the resources are no longer needed before calling. */\n destroyAttachedResources() {\n for (const resource of Object.values(this._attachedResources)) {\n resource.destroy();\n }\n // don't remove while we are iterating\n this._attachedResources = new Set();\n }\n // PROTECTED METHODS\n /** Perform all destroy steps. Can be called by derived resources when overriding destroy() */\n destroyResource() {\n this.destroyAttachedResources();\n this.removeStats();\n this.destroyed = true;\n }\n /** Called by .destroy() to track object destruction. Subclass must call if overriding destroy() */\n removeStats() {\n const stats = this._device.statsManager.getStats('Resource Counts');\n const name = this[Symbol.toStringTag];\n stats.get(`${name}s Active`).decrementCount();\n }\n /** Called by subclass to track memory allocations */\n trackAllocatedMemory(bytes, name = this[Symbol.toStringTag]) {\n const stats = this._device.statsManager.getStats('Resource Counts');\n stats.get('GPU Memory').addCount(bytes);\n stats.get(`${name} Memory`).addCount(bytes);\n this.allocatedBytes = bytes;\n }\n /** Called by subclass to track memory deallocations */\n trackDeallocatedMemory(name = this[Symbol.toStringTag]) {\n const stats = this._device.statsManager.getStats('Resource Counts');\n stats.get('GPU Memory').subtractCount(this.allocatedBytes);\n stats.get(`${name} Memory`).subtractCount(this.allocatedBytes);\n this.allocatedBytes = 0;\n }\n /** Called by resource constructor to track object creation */\n addStats() {\n const stats = this._device.statsManager.getStats('Resource Counts');\n const name = this[Symbol.toStringTag];\n stats.get('Resources Created').incrementCount();\n stats.get(`${name}s Created`).incrementCount();\n stats.get(`${name}s Active`).incrementCount();\n }\n}\n/**\n * Combines a map of user props and default props, only including props from defaultProps\n * @param props\n * @param defaultProps\n * @returns returns a map of overridden default props\n */\nfunction selectivelyMerge(props, defaultProps) {\n const mergedProps = { ...defaultProps };\n for (const key in props) {\n if (props[key] !== undefined) {\n mergedProps[key] = props[key];\n }\n }\n return mergedProps;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Abstract GPU buffer */\nexport class Buffer extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n usage: 0, // Buffer.COPY_DST | Buffer.COPY_SRC\n byteLength: 0,\n byteOffset: 0,\n data: null,\n indexType: 'uint16',\n mappedAtCreation: false\n };\n // Usage Flags\n static MAP_READ = 0x01;\n static MAP_WRITE = 0x02;\n static COPY_SRC = 0x0004;\n static COPY_DST = 0x0008;\n /** Index buffer */\n static INDEX = 0x0010;\n /** Vertex buffer */\n static VERTEX = 0x0020;\n /** Uniform buffer */\n static UNIFORM = 0x0040;\n /** Storage buffer */\n static STORAGE = 0x0080;\n static INDIRECT = 0x0100;\n static QUERY_RESOLVE = 0x0200;\n get [Symbol.toStringTag]() {\n return 'Buffer';\n }\n /** The usage with which this buffer was created */\n usage;\n /** For index buffers, whether indices are 16 or 32 bit */\n indexType;\n /** \"Time\" of last update */\n updateTimestamp;\n constructor(device, props) {\n const deducedProps = { ...props };\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n deducedProps.indexType = 'uint32';\n }\n else if (props.data instanceof Uint16Array) {\n deducedProps.indexType = 'uint16';\n }\n }\n super(device, deducedProps, Buffer.defaultProps);\n this.usage = props.usage || 0;\n this.indexType = deducedProps.indexType;\n // TODO - perhaps this should be set on async write completion?\n this.updateTimestamp = device.incrementTimestamp();\n }\n /** Read data synchronously. @note WebGL2 only */\n readSyncWebGL(byteOffset, byteLength) {\n throw new Error('not implemented');\n }\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n /** Max amount of debug data saved. Two vec4's */\n static DEBUG_DATA_MAX_LENGTH = 32;\n /** A partial CPU-side copy of the data in this buffer, for debugging purposes */\n debugData = new ArrayBuffer(0);\n /** This doesn't handle partial non-zero offset updates correctly */\n _setDebugData(data, byteOffset, byteLength) {\n const buffer = ArrayBuffer.isView(data) ? data.buffer : data;\n const debugDataLength = Math.min(data ? data.byteLength : byteLength, Buffer.DEBUG_DATA_MAX_LENGTH);\n if (data === null) {\n this.debugData = new ArrayBuffer(debugDataLength);\n }\n else if (byteOffset === 0 && byteLength === data.byteLength) {\n this.debugData = buffer.slice(0, debugDataLength);\n }\n else {\n this.debugData = buffer.slice(byteOffset, byteOffset + debugDataLength);\n }\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */\nexport function decodeVertexType(type) {\n const dataType = TYPE_MAP[type];\n const bytes = getDataTypeBytes(dataType);\n const normalized = type.includes('norm');\n const integer = !normalized && !type.startsWith('float');\n const signed = type.startsWith('s');\n return {\n dataType: TYPE_MAP[type],\n byteLength: bytes,\n integer,\n signed,\n normalized\n };\n}\nfunction getDataTypeBytes(type) {\n const bytes = TYPE_SIZES[type];\n // assert(bytes);\n return bytes;\n}\nconst TYPE_MAP = {\n uint8: 'uint8',\n sint8: 'sint8',\n unorm8: 'uint8',\n snorm8: 'sint8',\n uint16: 'uint16',\n sint16: 'sint16',\n unorm16: 'uint16',\n snorm16: 'sint16',\n float16: 'float16',\n float32: 'float32',\n uint32: 'uint32',\n sint32: 'sint32'\n};\nconst TYPE_SIZES = {\n uint8: 1,\n sint8: 1,\n uint16: 2,\n sint16: 2,\n float16: 2,\n float32: 4,\n uint32: 4,\n sint32: 4\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { decodeVertexType } from \"./decode-data-type.js\";\n// prettier-ignore\nconst COMPRESSED_TEXTURE_FORMAT_PREFIXES = [\n 'bc1', 'bc2', 'bc3', 'bc4', 'bc5', 'bc6', 'bc7', 'etc1', 'etc2', 'eac', 'atc', 'astc', 'pvrtc'\n];\nconst REGEX = /^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;\n/**\n * Returns true if a texture format is GPU compressed\n */\nexport function isTextureFormatCompressed(textureFormat) {\n return COMPRESSED_TEXTURE_FORMAT_PREFIXES.some(prefix => textureFormat.startsWith(prefix));\n}\n/**\n * Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)\n */\nexport function decodeTextureFormat(format) {\n const matches = REGEX.exec(format);\n if (matches) {\n const [, format, length, type, srgb, suffix] = matches;\n if (format) {\n const dataType = `${type}${length}`;\n const decodedType = decodeVertexType(dataType);\n return {\n format: format,\n components: format.length,\n // dataType - overwritten by decodedType\n srgb: srgb === '-srgb',\n unsized: suffix === '-unsized',\n webgl: suffix === '-webgl',\n ...decodedType\n };\n }\n }\n return decodeNonStandardFormat(format);\n}\n// https://www.w3.org/TR/webgpu/#texture-format-caps\nconst EXCEPTIONS = {\n // Packed 16 bit formats\n 'rgba4unorm-webgl': { format: 'rgba', bpp: 2 },\n 'rgb565unorm-webgl': { format: 'rgb', bpp: 2 },\n 'rgb5a1unorm-webgl': { format: 'rgba', bbp: 2 },\n // Packed 32 bit formats\n rgb9e5ufloat: { format: 'rgb', bbp: 4 },\n rg11b10ufloat: { format: 'rgb', bbp: 4 },\n rgb10a2unorm: { format: 'rgba', bbp: 4 },\n 'rgb10a2uint-webgl': { format: 'rgba', bbp: 4 },\n // Depth/stencil\n stencil8: { components: 1, bpp: 1, a: 'stencil' },\n depth16unorm: { components: 1, bpp: 2, a: 'depth' },\n depth24plus: { components: 1, bpp: 3, a: 'depth' },\n depth32float: { components: 1, bpp: 4, a: 'depth' },\n 'depth24plus-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' },\n // \"depth24unorm-stencil8\" feature\n 'depth24unorm-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' },\n // \"depth32float-stencil8\" feature\n 'depth32float-stencil8': { components: 2, bpp: 4, a: 'depth-stencil' }\n};\nfunction decodeNonStandardFormat(format) {\n const data = EXCEPTIONS[format];\n if (!data) {\n throw new Error(`Unknown format ${format}`);\n }\n return {\n format: data.format || '',\n components: data.components || data.format?.length || 1,\n byteLength: data.bpp || 1,\n srgb: false,\n unsized: false\n };\n}\n/*\n'r8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'r8snorm':\t{s: \"float\"}, // \t\t\u2713\t\t},\n'r8uint':\t{s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'r8sint':\t{s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'rg8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rg8snorm':\t{s: \"float\"}, // \t\t\u2713\t\t},\n'rg8uint':\t{s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'rg8sint':\t{s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'rgba8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t\u2713},\n'rgba8unorm-srgb': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rgba8snorm':\t{s: \"float\"}, // \t\t\u2713\t\t\u2713},\n'rgba8uint':\t{s: \"uint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'rgba8sint':\t{s: \"sint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'bgra8unorm':\t{s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'bgra8unorm-srgb': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n// 16-bit per component\n'r16uint': {s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'r16sint': {s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'r16float': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rg16uint': {s: \"uint\"}, // \t\u2713\t\u2713\t\t},\n'rg16sint': {s: \"sint\"}, // \t\u2713\t\u2713\t\t},\n'rg16float': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t},\n'rgba16uint': {s: \"uint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'rgba16sint': {s: \"sint\"}, // \t\u2713\t\u2713\t\t\u2713},\n'rgba16float': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t\u2713},\n// 32-bit per component\n'r32uint': {s: \"uint\"}, // \t\u2713\t\t\t\u2713},\n'r32sint': {s: \"sint\"}, // \t\u2713\t\t\t\u2713},\n'r32float': {\"unfilterable-float\"\t\u2713\t\u2713\t\t\u2713},\n'rg32uint': {s: \"uint\"}, // \t\u2713\t\t\t\u2713},\n'rg32sint': {s: \"sint\"}, // \t\u2713\t\t\t\u2713},\n'rg32float': {\"unfilterable-float\"\t\u2713\t\t\t\u2713},\n'rgba32uint': {s: \"uint\"}, // \t\u2713\t\t\t\u2713},\n'rgba32sint': {s: \"sint\"}, // \t\u2713\t\t\t\u2713},\n'rgba32float': {\"unfilterable-float\"\t\u2713\t\t\t\u2713},\n// mixed component width\n'rgb10a2unorm': {s: \"float\"}, // \t\u2713\t\u2713\t\u2713\t}\n'rg11b10ufloat': {s: \"float\"}, // \t\t\u2713\t\t}\n// Format\tBytes per texel\tAspect\tGPUTextureSampleType\tValid image copy source\tValid image copy destination\n'stencil8': {1 \u2212 4\tstencil\t\"uint\"\t\u2713}\n'depth16unorm': {2\tdepth\t\"depth\"\t\u2713}\n'depth24plus': {4\tdepth\t\"depth\"\t\u2717}\n'depth24plus': {stencil8\t4 \u2212 8\tdepth\t\"depth\"\t\u2717}\n'stencil': {s: \"uint\"}, // \t\u2713}\n'depth32float': {4\tdepth\t\"depth\"\t\u2713\t\u2717}\n'depth24unorm': {stencil8\t4\tdepth\t\"depth\"\t\u2717}\n'stencil': {s: \"uint\"}, // \t\u2713}\n'depth32float': {stencil8}\n\n// Format\tBytes per block\tGPUTextureSampleType\tBlock Size\tFeature\n'rgb9e5ufloat': {c: 4, s: \"float\",\tbpp: 4/(1*1)},\n\n'bc1-rgba-unorm': {c: 4. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc1-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc2-rgba-unorm': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc2-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc3-rgba-unorm': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc3-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc4-r-unorm': {c: 1. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc4-r-snorm': {c: 1. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc5-rg-unorm': {c: 2. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc5-rg-snorm': { },\n'bc6h-rgb-ufloat': {\t16 },\n'bc6h-rgb-float': { },\n'bc7-rgba-unorm': {\t16 },\n'bc7-rgba-unorm-srgb': { },\n\n'etc2-rgb8unorm': {\t8\t\"float\"\t4 \u00D7 4\ttexture-compression-etc2 },\n'etc2-rgb8unorm-srgb': { },\n'etc2-rgb8a1unorm': {\t8 },\n'etc2-rgb8a1unorm-srgb': { },\n'etc2-rgba8unorm': {\t16 },\n'etc2-rgba8unorm-srgb': { },\n\n'eac-r11unorm': {\t8 },\n'eac-r11snorm': { },\n'eac-rg11unorm': {\t16 },\n'eac-rg11snorm': { },\n\n'astc-4x4-unorm': {\t16\t\"float\"\t4 \u00D7 4\ttexture-compression-astc },\n'astc-4x4-unorm-srgb': { },\n'astc-5x4-unorm': {\t16\t5 \u00D7 4 },\n'astc-5x4-unorm-srgb': { },\n'astc-5x5-unorm': {\t16\t5 \u00D7 5 },\n'astc-5x5-unorm-srgb': { },\n'astc-6x5-unorm': {\t16\t6 \u00D7 5 },\n'astc-6x5-unorm-srgb': { },\n'astc-6x6-unorm': {\t16\t6 \u00D7 6 },\n'astc-6x6-unorm-srgb': { },\n'astc-8x5-unorm': {\t16\t8 \u00D7 5 },\n'astc-8x5-unorm-srgb': { },\n'astc-8x6-unorm': {\t16\t8 \u00D7 6 },\n'astc-8x6-unorm-srgb': { },\n'astc-8x8-unorm': {\t16\t8 \u00D7 8 },\n'astc-8x8-unorm-srgb': { },\n'astc-10x5-unorm': {\t16\t10 \u00D7 5 },\n'astc-10x5-unorm-srgb': { },\n'astc-10x6-unorm': {\t16\t10 \u00D7 6 },\n'astc-10x6-unorm-srgb': { },\n'astc-10x8-unorm': {\t16\t10 \u00D7 8 },\n'astc-10x8-unorm-srgb': { },\n'astc-10x10-unorm': {\t16\t10 \u00D7 10 },\n'astc-10x10-unorm-srgb': { },\n'astc-12x10-unorm': {\t16\t12 \u00D7 10 },\n'astc-12x10-unorm-srgb': { },\n'astc-12x12-unorm': {\t16 },\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { VERSION } from \"../init.js\";\nimport { lumaStats } from \"../utils/stats-manager.js\";\nimport { log } from \"../utils/log.js\";\nimport { uid } from \"../utils/utils.js\";\nimport { Buffer } from \"./resources/buffer.js\";\nimport { isTextureFormatCompressed } from \"./type-utils/decode-texture-format.js\";\n/** Limits for a device (max supported sizes of resources, max number of bindings etc) */\nexport class DeviceLimits {\n}\n/** Set-like class for features (lets apps check for WebGL / WebGPU extensions) */\nexport class DeviceFeatures {\n features;\n disabledFeatures;\n constructor(features = [], disabledFeatures) {\n this.features = new Set(features);\n this.disabledFeatures = disabledFeatures || {};\n }\n *[Symbol.iterator]() {\n yield* this.features;\n }\n has(feature) {\n return !this.disabledFeatures[feature] && this.features.has(feature);\n }\n}\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport class Device {\n static defaultProps = {\n id: null,\n canvas: null,\n container: null,\n manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n requestMaxLimits: true,\n debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)\n spector: Boolean(log.get('spector') || log.get('spectorjs')), // Initialize the SpectorJS WebGL debugger\n break: [],\n // TODO - Change these after confirming things work as expected\n initalizeFeatures: true,\n disabledFeatures: {\n 'compilation-status-async-webgl': true\n },\n // alpha: undefined,\n // depth: undefined,\n // stencil: undefined,\n // antialias: undefined,\n // premultipliedAlpha: undefined,\n // preserveDrawingBuffer: undefined,\n // failIfMajorPerformanceCaveat: undefined\n gl: null,\n // Callbacks\n onError: (error) => log.error(error.message)\n };\n get [Symbol.toStringTag]() {\n return 'Device';\n }\n static VERSION = VERSION;\n constructor(props) {\n this.props = { ...Device.defaultProps, ...props };\n this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());\n }\n /** id of this device, primarily for debugging */\n id;\n /** A copy of the device props */\n props;\n /** Available for the application to store data on the device */\n userData = {};\n /** stats */\n statsManager = lumaStats;\n /** Used by other luma.gl modules to store data on the device */\n _lumaData = {};\n /** Check if a specific texture format is GPU compressed */\n isTextureFormatCompressed(format) {\n return isTextureFormatCompressed(format);\n }\n /**\n * Trigger device loss.\n * @returns `true` if context loss could actually be triggered.\n * @note primarily intended for testing how application reacts to device loss\n */\n loseDevice() {\n return false;\n }\n /** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */\n getCanvasContext() {\n if (!this.canvasContext) {\n throw new Error('Device has no CanvasContext');\n }\n return this.canvasContext;\n }\n createTexture(props) {\n // Signature: new Texture2D(gl, url | Promise)\n if (props instanceof Promise || typeof props === 'string') {\n props = { data: props };\n }\n return this._createTexture(props);\n }\n createCommandEncoder(props = {}) {\n throw new Error('not implemented');\n }\n // WebGL specific HACKS - enables app to remove webgl import\n // Use until we have a better way to handle these\n /** @deprecated - will be removed - should use command encoder */\n readPixelsToArrayWebGL(source, options) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use command encoder */\n readPixelsToBufferWebGL(source, options) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n setParametersWebGL(parameters) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n getParametersWebGL(parameters) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n withParametersWebGL(parameters, func) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use clear arguments in RenderPass */\n clearWebGL(options) {\n throw new Error('not implemented');\n }\n /** @deprecated - will be removed - should use for debugging only */\n resetWebGL() {\n throw new Error('not implemented');\n }\n timestamp = 0;\n /** A monotonic counter for tracking buffer and texture updates */\n incrementTimestamp() {\n return this.timestamp++;\n }\n // Error Handling\n /** Report unhandled device errors */\n onError(error) {\n this.props.onError(error);\n }\n // IMPLEMENTATION\n _getBufferProps(props) {\n if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {\n props = { data: props };\n }\n // TODO - fragile, as this is done before we merge with default options\n // inside the Buffer constructor\n const newProps = { ...props };\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n newProps.indexType = 'uint32';\n }\n else if (props.data instanceof Uint16Array) {\n newProps.indexType = 'uint16';\n }\n else {\n log.warn('indices buffer content must be of integer type')();\n }\n }\n return newProps;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Recommendation is to ignore message but current test suite checks agains the\n// message so keep it for now.\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'luma.gl: assertion failed.');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Device } from \"../adapter/device.js\";\nimport { lumaStats } from \"../utils/stats-manager.js\";\nimport { log } from \"../utils/log.js\";\nimport { assert } from \"../utils/assert.js\";\nconst deviceMap = new Map();\n/**\n * Entry point to the luma.gl GPU abstraction\n * Register WebGPU and/or WebGL devices (controls application bundle size)\n * Run-time selection of the first available Device\n */\nexport class luma {\n static defaultProps = {\n ...Device.defaultProps,\n type: 'best-available',\n devices: undefined\n };\n /** Global stats for all devices */\n static stats = lumaStats;\n /** Global log */\n static log = log;\n static registerDevices(deviceClasses /* : typeof Device */) {\n for (const deviceClass of deviceClasses) {\n assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);\n deviceMap.set(deviceClass.type, deviceClass);\n }\n }\n static getAvailableDevices() {\n // @ts-expect-error\n return Array.from(deviceMap).map(Device => Device.type);\n }\n static getSupportedDevices() {\n return (Array.from(deviceMap)\n // @ts-expect-error\n .filter(Device => Device.isSupported())\n // @ts-expect-error\n .map(Device => Device.type));\n }\n static setDefaultDeviceProps(props) {\n Object.assign(Device.defaultProps, props);\n }\n /** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */\n static async attachDevice(props) {\n const devices = getDeviceMap(props.devices) || deviceMap;\n // WebGL\n if (props.handle instanceof WebGL2RenderingContext) {\n const WebGLDevice = devices.get('webgl');\n if (WebGLDevice) {\n return (await WebGLDevice.attach(props.handle));\n }\n }\n // TODO - WebGPU does not yet have a stable API\n // if (props.handle instanceof GPUDevice) {\n // const WebGPUDevice = devices.get('webgpu') as any;\n // if (WebGPUDevice) {\n // return (await WebGPUDevice.attach(props.handle)) as Device;\n // }\n // }\n // null\n if (props.handle === null) {\n const UnknownDevice = devices.get('unknown');\n if (UnknownDevice) {\n return (await UnknownDevice.attach(null));\n }\n }\n throw new Error('Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');\n }\n /** Creates a device. Asynchronously. */\n static async createDevice(props = {}) {\n props = { ...luma.defaultProps, ...props };\n if (props.gl) {\n props.type = 'webgl';\n }\n const devices = getDeviceMap(props.devices) || deviceMap;\n switch (props.type) {\n case 'webgpu':\n let WebGPUDevice = devices.get('webgpu');\n if (WebGPUDevice) {\n return await WebGPUDevice.create(props);\n }\n break;\n case 'webgl':\n let WebGLDevice = devices.get('webgl');\n if (WebGLDevice) {\n return await WebGLDevice.create(props);\n }\n break;\n case 'unknown':\n const UnknownDevice = devices.get('unknown');\n if (UnknownDevice) {\n return await UnknownDevice.create(props);\n }\n break;\n case 'best-available':\n WebGPUDevice = devices.get('webgpu');\n if (WebGPUDevice?.isSupported?.()) {\n return await WebGPUDevice.create(props);\n }\n WebGLDevice = devices.get('webgl');\n if (WebGLDevice?.isSupported?.()) {\n return await WebGLDevice.create(props);\n }\n break;\n }\n throw new Error('No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');\n }\n static enforceWebGL2(enforce = true) {\n const prototype = HTMLCanvasElement.prototype;\n if (!enforce && prototype.originalGetContext) {\n // Reset the original getContext function\n prototype.getContext = prototype.originalGetContext;\n prototype.originalGetContext = undefined;\n return;\n }\n // Store the original getContext function\n prototype.originalGetContext = prototype.getContext;\n // Override the getContext function\n prototype.getContext = function (contextId, options) {\n // Attempt to force WebGL2 for all WebGL1 contexts\n if (contextId === 'webgl' || contextId === 'experimental-webgl') {\n return this.originalGetContext('webgl2', options);\n }\n // For any other type, return the original context\n return this.originalGetContext(contextId, options);\n };\n }\n}\n/** Convert a list of devices to a map */\nfunction getDeviceMap(deviceClasses /* : typeof Device */) {\n if (!deviceClasses || deviceClasses?.length === 0) {\n return null;\n }\n const map = new Map();\n for (const deviceClass of deviceClasses) {\n // assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);\n map.set(deviceClass.type, deviceClass);\n }\n return map;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isBrowser } from '@probe.gl/env';\nimport { log } from \"../utils/log.js\";\nconst isPage = isBrowser() && typeof document !== 'undefined';\nconst isPageLoaded = () => isPage && document.readyState === 'complete';\nconst DEFAULT_CANVAS_CONTEXT_PROPS = {\n canvas: null,\n width: 800, // width are height are only used by headless gl\n height: 600,\n useDevicePixels: true,\n autoResize: true,\n container: null,\n visible: true,\n colorSpace: 'srgb',\n alphaMode: 'opaque'\n};\n/**\n * Manages a canvas. Supports both HTML or offscreen canvas\n * - Creates a new canvas or looks up a canvas from the DOM\n * - Provides check for DOM loaded\n * @todo commit(): https://github.com/w3ctag/design-reviews/issues/288\n * @todo transferControlToOffscreen: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen\n */\nexport class CanvasContext {\n id;\n props;\n canvas;\n htmlCanvas;\n offscreenCanvas;\n type;\n width = 1;\n height = 1;\n resizeObserver;\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n _canvasSizeInfo = { clientWidth: 0, clientHeight: 0, devicePixelRatio: 1 };\n /** Check if the DOM is loaded */\n static get isPageLoaded() {\n return isPageLoaded();\n }\n /**\n * Get a 'lazy' promise that resolves when the DOM is loaded.\n * @note Since there may be limitations on number of `load` event listeners,\n * it is recommended avoid calling this function until actually needed.\n * I.e. don't call it until you know that you will be looking up a string in the DOM.\n */\n static pageLoaded = getPageLoadPromise();\n constructor(props) {\n this.props = { ...DEFAULT_CANVAS_CONTEXT_PROPS, ...props };\n props = this.props;\n if (!isBrowser()) {\n this.id = 'node-canvas-context';\n this.type = 'node';\n this.width = this.props.width;\n this.height = this.props.height;\n // TODO - does this prevent app from using jsdom style polyfills?\n this.canvas = null;\n return;\n }\n if (!props.canvas) {\n const canvas = createCanvas(props);\n const container = getContainer(props?.container || null);\n container.insertBefore(canvas, container.firstChild);\n this.canvas = canvas;\n if (!props?.visible) {\n this.canvas.style.visibility = 'hidden';\n }\n }\n else if (typeof props.canvas === 'string') {\n this.canvas = getCanvasFromDOM(props.canvas);\n }\n else {\n this.canvas = props.canvas;\n }\n if (this.canvas instanceof HTMLCanvasElement) {\n this.id = this.canvas.id;\n this.type = 'html-canvas';\n this.htmlCanvas = this.canvas;\n }\n else {\n this.id = 'offscreen-canvas';\n this.type = 'offscreen-canvas';\n this.offscreenCanvas = this.canvas;\n }\n // React to size changes\n if (this.canvas instanceof HTMLCanvasElement && props.autoResize) {\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target === this.canvas) {\n this.update();\n }\n }\n });\n this.resizeObserver.observe(this.canvas);\n }\n }\n /**\n * Returns the current DPR, if props.useDevicePixels is true\n * Device refers to physical\n */\n getDevicePixelRatio(useDevicePixels) {\n if (typeof OffscreenCanvas !== 'undefined' && this.canvas instanceof OffscreenCanvas) {\n return 1;\n }\n useDevicePixels = useDevicePixels === undefined ? this.props.useDevicePixels : useDevicePixels;\n if (!useDevicePixels || useDevicePixels <= 0) {\n return 1;\n }\n // The param was mainly provide to support the test cases, could be removed\n if (useDevicePixels === true) {\n const dpr = typeof window !== 'undefined' && window.devicePixelRatio;\n return dpr || 1;\n }\n return useDevicePixels;\n }\n /**\n * Returns the size of drawing buffer in device pixels.\n * @note This can be different from the 'CSS' size of a canvas, and also from the\n * canvas' internal drawing buffer size (.width, .height).\n * This is the size required to cover the canvas, adjusted for DPR\n */\n getPixelSize() {\n switch (this.type) {\n case 'node':\n return [this.width, this.height];\n case 'offscreen-canvas':\n return [this.canvas.width, this.canvas.height];\n case 'html-canvas':\n const dpr = this.getDevicePixelRatio();\n const canvas = this.canvas;\n // If not attached to DOM client size can be 0\n return canvas.parentElement\n ? [canvas.clientWidth * dpr, canvas.clientHeight * dpr]\n : [this.canvas.width, this.canvas.height];\n default:\n throw new Error(this.type);\n }\n }\n getAspect() {\n const [width, height] = this.getPixelSize();\n return width / height;\n }\n /**\n * Returns multiplier need to convert CSS size to Device size\n */\n cssToDeviceRatio() {\n try {\n // For headless gl we might have used custom width and height\n // hence use cached clientWidth\n const [drawingBufferWidth] = this.getDrawingBufferSize();\n const { clientWidth } = this._canvasSizeInfo;\n return clientWidth ? drawingBufferWidth / clientWidth : 1;\n }\n catch {\n return 1;\n }\n }\n /**\n * Maps CSS pixel position to device pixel position\n */\n cssToDevicePixels(cssPixel, yInvert = true) {\n const ratio = this.cssToDeviceRatio();\n const [width, height] = this.getDrawingBufferSize();\n return scalePixels(cssPixel, ratio, width, height, yInvert);\n }\n /**\n * Use devicePixelRatio to set canvas width and height\n * @note this is a raw port of luma.gl v8 code. Might be worth a review\n */\n setDevicePixelRatio(devicePixelRatio, options = {}) {\n if (!this.htmlCanvas) {\n return;\n }\n // NOTE: if options.width and options.height not used remove in v8\n let clientWidth = 'width' in options ? options.width : this.htmlCanvas.clientWidth;\n let clientHeight = 'height' in options ? options.height : this.htmlCanvas.clientHeight;\n if (!clientWidth || !clientHeight) {\n log.log(1, 'Canvas clientWidth/clientHeight is 0')();\n // by forcing devicePixel ratio to 1, we do not scale canvas.width and height in each frame.\n devicePixelRatio = 1;\n clientWidth = this.htmlCanvas.width || 1;\n clientHeight = this.htmlCanvas.height || 1;\n }\n const cachedSize = this._canvasSizeInfo;\n // Check if canvas needs to be resized\n if (cachedSize.clientWidth !== clientWidth ||\n cachedSize.clientHeight !== clientHeight ||\n cachedSize.devicePixelRatio !== devicePixelRatio) {\n let clampedPixelRatio = devicePixelRatio;\n const canvasWidth = Math.floor(clientWidth * clampedPixelRatio);\n const canvasHeight = Math.floor(clientHeight * clampedPixelRatio);\n this.htmlCanvas.width = canvasWidth;\n this.htmlCanvas.height = canvasHeight;\n // Note: when devicePixelRatio is too high, it is possible we might hit system limit for\n // drawing buffer width and hight, in those cases they get clamped and resulting aspect ration may not be maintained\n // for those cases, reduce devicePixelRatio.\n const [drawingBufferWidth, drawingBufferHeight] = this.getDrawingBufferSize();\n if (drawingBufferWidth !== canvasWidth || drawingBufferHeight !== canvasHeight) {\n clampedPixelRatio = Math.min(drawingBufferWidth / clientWidth, drawingBufferHeight / clientHeight);\n this.htmlCanvas.width = Math.floor(clientWidth * clampedPixelRatio);\n this.htmlCanvas.height = Math.floor(clientHeight * clampedPixelRatio);\n log.warn('Device pixel ratio clamped')();\n }\n this._canvasSizeInfo.clientWidth = clientWidth;\n this._canvasSizeInfo.clientHeight = clientHeight;\n this._canvasSizeInfo.devicePixelRatio = devicePixelRatio;\n }\n }\n // PRIVATE\n /** @todo Major hack done to port the CSS methods above, base canvas context should not depend on WebGL */\n getDrawingBufferSize() {\n // @ts-expect-error This only works for WebGL\n const gl = this.device.gl;\n if (!gl) {\n // use default device pixel ratio\n throw new Error('canvas size');\n }\n return [gl.drawingBufferWidth, gl.drawingBufferHeight];\n }\n /**\n * Allows subclass constructor to override the canvas id for auto created canvases.\n * This can really help when debugging DOM in apps that create multiple devices\n */\n _setAutoCreatedCanvasId(id) {\n if (this.htmlCanvas?.id === 'lumagl-auto-created-canvas') {\n this.htmlCanvas.id = id;\n }\n }\n}\n// HELPER FUNCTIONS\n/** Returns a promise that resolves when the page is loaded */\nfunction getPageLoadPromise() {\n if (isPageLoaded() || typeof window === 'undefined') {\n return Promise.resolve();\n }\n return new Promise(resolve => {\n window.addEventListener('load', () => resolve());\n });\n}\nfunction getContainer(container) {\n if (typeof container === 'string') {\n const element = document.getElementById(container);\n if (!element && !isPageLoaded()) {\n throw new Error(`Accessing '${container}' before page was loaded`);\n }\n if (!element) {\n throw new Error(`${container} is not an HTML element`);\n }\n return element;\n }\n else if (container) {\n return container;\n }\n return document.body;\n}\n/** Get a Canvas element from DOM id */\nfunction getCanvasFromDOM(canvasId) {\n const canvas = document.getElementById(canvasId);\n if (!canvas && !isPageLoaded()) {\n throw new Error(`Accessing '${canvasId}' before page was loaded`);\n }\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw new Error('Object is not a canvas element');\n }\n return canvas;\n}\n/** Create a new canvas */\nfunction createCanvas(props) {\n const { width, height } = props;\n const targetCanvas = document.createElement('canvas');\n targetCanvas.id = 'lumagl-auto-created-canvas';\n targetCanvas.width = width || 1;\n targetCanvas.height = height || 1;\n targetCanvas.style.width = Number.isFinite(width) ? `${width}px` : '100%';\n targetCanvas.style.height = Number.isFinite(height) ? `${height}px` : '100%';\n return targetCanvas;\n}\n/**\n *\n * @param pixel\n * @param ratio\n * @param width\n * @param height\n * @param yInvert\n * @returns\n */\nfunction scalePixels(pixel, ratio, width, height, yInvert) {\n const point = pixel;\n const x = scaleX(point[0], ratio, width);\n let y = scaleY(point[1], ratio, height, yInvert);\n // Find boundaries of next pixel to provide valid range of device pixel locations\n let t = scaleX(point[0] + 1, ratio, width);\n // If next pixel's position is clamped to boundary, use it as is, otherwise subtract 1 for current pixel boundary\n const xHigh = t === width - 1 ? t : t - 1;\n t = scaleY(point[1] + 1, ratio, height, yInvert);\n let yHigh;\n if (yInvert) {\n // If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range\n t = t === 0 ? t : t + 1;\n // swap y and yHigh\n yHigh = y;\n y = t;\n }\n else {\n // If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range\n yHigh = t === height - 1 ? t : t - 1;\n // y remains same\n }\n return {\n x,\n y,\n // when ratio < 1, current css pixel and next css pixel may point to same device pixel, set width/height to 1 in those cases.\n width: Math.max(xHigh - x + 1, 1),\n height: Math.max(yHigh - y + 1, 1)\n };\n}\nfunction scaleX(x, ratio, width) {\n // since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit\n const r = Math.min(Math.round(x * ratio), width - 1);\n return r;\n}\nfunction scaleY(y, ratio, height, yInvert) {\n // since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit\n return yInvert\n ? Math.max(0, height - 1 - Math.round(y * ratio))\n : Math.min(Math.round(y * ratio), height - 1);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * Abstract Texture interface\n * Texture Object\n * https://gpuweb.github.io/gpuweb/#gputexture\n */\nexport class Texture extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n data: null,\n dimension: '2d',\n format: 'rgba8unorm',\n width: undefined,\n height: undefined,\n depth: 1,\n mipmaps: true,\n // type: undefined,\n compressed: false,\n // mipLevels: 1,\n usage: 0,\n // usage: GPUTextureUsage.COPY_DST\n mipLevels: undefined,\n samples: undefined,\n type: undefined,\n sampler: {},\n view: undefined\n };\n static COPY_SRC = 0x01;\n static COPY_DST = 0x02;\n static TEXTURE_BINDING = 0x04;\n static STORAGE_BINDING = 0x08;\n static RENDER_ATTACHMENT = 0x10;\n get [Symbol.toStringTag]() {\n return 'Texture';\n }\n /** dimension of this texture */\n dimension;\n /** format of this texture */\n format;\n /** width in pixels of this texture */\n width;\n /** height in pixels of this texture */\n height;\n /** depth of this texture */\n depth;\n /** \"Time\" of last update. Monotonically increasing timestamp */\n updateTimestamp;\n /** Do not use directly. Create with device.createTexture() */\n constructor(device, props, defaultProps = Texture.defaultProps) {\n super(device, props, defaultProps);\n this.dimension = this.props.dimension;\n this.format = this.props.format;\n this.width = this.props.width;\n this.height = this.props.height;\n this.depth = this.props.depth;\n // TODO - perhaps this should be set on async write completion?\n this.updateTimestamp = device.incrementTimestamp();\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Immutable TextureView object */\nexport class TextureView extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n format: undefined,\n dimension: undefined,\n aspect: 'all',\n baseMipLevel: 0,\n mipLevelCount: undefined,\n baseArrayLayer: 0,\n arrayLayerCount: undefined\n };\n get [Symbol.toStringTag]() {\n return 'TextureView';\n }\n /** Should not be constructed directly. Use `texture.createView(props)` */\n constructor(device, props) {\n super(device, props, TextureView.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\nexport class ExternalTexture extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n source: null,\n colorSpace: 'srgb'\n };\n get [Symbol.toStringTag]() {\n return 'ExternalTexture';\n }\n constructor(device, props) {\n super(device, props, ExternalTexture.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** @returns annotated errors or warnings */\nexport function formatCompilerLog(shaderLog, source, options) {\n let formattedLog = '';\n const lines = source.split(/\\r?\\n/);\n const log = shaderLog.slice().sort((a, b) => a.lineNum - b.lineNum);\n switch (options?.showSourceCode || 'no') {\n case 'all':\n // Parse the error - note: browser and driver dependent\n let currentMessage = 0;\n for (let lineNum = 1; lineNum <= lines.length; lineNum++) {\n formattedLog += getNumberedLine(lines[lineNum - 1], lineNum, options);\n while (log.length > currentMessage && log[currentMessage].lineNum === lineNum) {\n const message = log[currentMessage++];\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n ...options,\n inlineSource: false\n });\n }\n }\n return formattedLog;\n case 'issues':\n case 'no':\n // Parse the error - note: browser and driver dependent\n for (const message of shaderLog) {\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n inlineSource: options?.showSourceCode !== 'no'\n });\n }\n return formattedLog;\n }\n}\n// Helpers\n/** Format one message */\nfunction formatCompilerMessage(message, lines, lineNum, options) {\n if (options?.inlineSource) {\n const numberedLines = getNumberedLines(lines, lineNum);\n // If we got error position on line add a `^^^` indicator on next line\n const positionIndicator = message.linePos > 0 ? `${' '.repeat(message.linePos + 5)}^^^\\n` : '';\n return `\n${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.message}\n\n`;\n }\n return options?.html\n ? `<div class='luma-compiler-log-error' style=\"color:red;\"><b> ${message.type.toUpperCase()}: ${message.message}</b></div>`\n : `${message.type.toUpperCase()}: ${message.message}`;\n}\nfunction getNumberedLines(lines, lineNum, options) {\n let numberedLines = '';\n for (let lineIndex = lineNum - 2; lineIndex <= lineNum; lineIndex++) {\n const sourceLine = lines[lineIndex - 1];\n if (sourceLine !== undefined) {\n numberedLines += getNumberedLine(sourceLine, lineNum, options);\n }\n }\n return numberedLines;\n}\nfunction getNumberedLine(line, lineNum, options) {\n const escapedLine = options?.html ? escapeHTML(line) : line;\n return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options?.html ? '<br/>' : '\\n'}`;\n}\n/**\n * Pads a string with a number of spaces (space characters) to the left\n * @param {String} string - string to pad\n * @param {Number} digits - number of spaces to add\n * @return {String} string - The padded string\n */\nfunction padLeft(string, paddedLength) {\n let result = '';\n for (let i = string.length; i < paddedLength; ++i) {\n result += ' ';\n }\n return result + string;\n}\nfunction escapeHTML(unsafe) {\n return unsafe\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replaceAll('\"', '&quot;')\n .replaceAll(\"'\", '&#039;');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Extracts information from shader source code */\nexport function getShaderInfo(source, defaultName) {\n return {\n name: getShaderName(source, defaultName),\n language: 'glsl',\n version: getShaderVersion(source)\n };\n}\n/** Extracts GLSLIFY style naming of shaders: `#define SHADER_NAME ...` */\nfunction getShaderName(shader, defaultName = 'unnamed') {\n const SHADER_NAME_REGEXP = /#define[\\s*]SHADER_NAME[\\s*]([A-Za-z0-9_-]+)[\\s*]/;\n const match = SHADER_NAME_REGEXP.exec(shader);\n return match ? match[1] : defaultName;\n}\n/** returns GLSL shader version of given shader string */\nfunction getShaderVersion(source) {\n let version = 100;\n const words = source.match(/[^\\s]+/g);\n if (words && words.length >= 2 && words[0] === '#version') {\n const v = parseInt(words[1], 10);\n if (Number.isFinite(v)) {\n version = v;\n }\n }\n return version;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n// import { log } from '../../utils/log';\nimport { uid } from \"../../utils/utils.js\";\nimport { formatCompilerLog } from \"../../lib/compiler-log/format-compiler-log.js\";\nimport { getShaderInfo } from \"../../lib/compiler-log/get-shader-info.js\";\n/**\n * Immutable Shader object\n * In WebGPU the handle can be copied between threads\n */\nexport class Shader extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n language: 'auto',\n stage: undefined,\n source: '',\n sourceMap: null,\n entryPoint: 'main',\n debug: 'errors'\n };\n get [Symbol.toStringTag]() {\n return 'Shader';\n }\n /** The stage of this shader */\n stage;\n /** The source code of this shader */\n source;\n /** The compilation status of the shader. 'pending' if compilation is asynchronous, and on production */\n compilationStatus = 'pending';\n /** Create a new Shader instance */\n constructor(device, props) {\n super(device, { id: getShaderIdFromProps(props), ...props }, Shader.defaultProps);\n this.stage = this.props.stage;\n this.source = this.props.source;\n }\n /** Get compiler log synchronously (WebGL only) */\n getCompilationInfoSync() {\n return null;\n }\n /** Get translated shader source in host platform's native language (HLSL, GLSL, and even GLSL ES), if available */\n getTranslatedSource() {\n return null;\n }\n // PORTABLE HELPERS\n /** In browser logging of errors */\n async debugShader(trigger = this.props.debug) {\n switch (trigger) {\n case 'never':\n return;\n case 'errors':\n // On WebGL - Don't extract the log unless errors\n if (this.compilationStatus === 'success') {\n return;\n }\n break;\n case 'warnings':\n case 'always':\n break;\n }\n const messages = await this.getCompilationInfo();\n if (this.props.debug === 'warnings' && messages?.length === 0) {\n return;\n }\n this._displayShaderLog(messages);\n }\n // PRIVATE\n /** In-browser UI logging of errors */\n _displayShaderLog(messages) {\n // Return if under Node.js / incomplete `document` polyfills\n if (typeof document === 'undefined' || !document?.createElement) {\n return;\n }\n const shaderName = getShaderInfo(this.source).name;\n const shaderTitle = `${this.stage} ${shaderName}`;\n let htmlLog = formatCompilerLog(messages, this.source, { showSourceCode: 'all', html: true });\n // Show translated source if available\n const translatedSource = this.getTranslatedSource();\n if (translatedSource) {\n htmlLog += `<br /><br /><h1>Translated Source</h1><br /><br /><code style=\"user-select:text;\"><pre>${translatedSource}</pre></code>`;\n }\n // Make it clickable so we can copy to clipboard\n const button = document.createElement('Button');\n button.innerHTML = `\n<h1>Shader Compilation Error in ${shaderTitle}</h1><br /><br />\n<code style=\"user-select:text;\"><pre>\n${htmlLog}\n</pre></code>`;\n button.style.top = '10px';\n button.style.left = '10px';\n button.style.position = 'absolute';\n button.style.zIndex = '9999';\n button.style.width = '100%';\n button.style.textAlign = 'left';\n document.body.appendChild(button);\n const errors = document.getElementsByClassName('luma-compiler-log-error');\n if (errors[0]?.scrollIntoView) {\n errors[0].scrollIntoView();\n }\n // TODO - add a small embedded copy button (instead of main button)\n button.onclick = () => {\n // const source = this.source.replaceAll('\\n', '<br />');\n const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;\n navigator.clipboard.writeText(dataURI);\n };\n // TODO - add a small embedded close button\n }\n}\n// HELPERS\n/** Deduce an id, from shader source, or supplied id, or shader type */\nfunction getShaderIdFromProps(props) {\n return getShaderInfo(props.source).name || props.id || uid(`unnamed ${props.stage}-shader`);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Immutable Sampler object */\nexport class Sampler extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n type: 'color-sampler',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge',\n addressModeW: 'clamp-to-edge',\n magFilter: 'nearest',\n minFilter: 'nearest',\n mipmapFilter: 'nearest',\n lodMinClamp: 0,\n lodMaxClamp: 32, // Per WebGPU spec\n compare: 'less-equal',\n maxAnisotropy: 1\n };\n get [Symbol.toStringTag]() {\n return 'Sampler';\n }\n constructor(device, props) {\n super(device, props, Sampler.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\nimport { Texture } from \"./texture.js\";\nimport { log } from \"../../utils/log.js\";\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class Framebuffer extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n width: 1,\n height: 1,\n colorAttachments: [], // ['rgba8unorm'],\n depthStencilAttachment: null // 'depth24plus-stencil8'\n };\n get [Symbol.toStringTag]() {\n return 'Framebuffer';\n }\n /** Width of all attachments in this framebuffer */\n width;\n /** Height of all attachments in this framebuffer */\n height;\n /** Color attachments */\n colorAttachments = [];\n /** Depth-stencil attachment, if provided */\n depthStencilAttachment = null;\n constructor(device, props = {}) {\n super(device, props, Framebuffer.defaultProps);\n this.width = this.props.width;\n this.height = this.props.height;\n // NOTE: call from subclass constructor as we cannot call overridden methods here (subclass not yet constructed)\n // this.autoCreateAttachmentTextures();\n }\n resize(size) {\n let updateSize = !size;\n if (size) {\n const [width, height] = Array.isArray(size) ? size : [size.width, size.height];\n updateSize = updateSize || height !== this.height || width !== this.width;\n this.width = width;\n this.height = height;\n }\n if (updateSize) {\n log.log(2, `Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)();\n this.resizeAttachments(this.width, this.height);\n }\n }\n /** Auto creates any textures */\n autoCreateAttachmentTextures() {\n if (this.props.colorAttachments.length === 0 && !this.props.depthStencilAttachment) {\n throw new Error('Framebuffer has noattachments');\n }\n this.colorAttachments = this.props.colorAttachments.map(attachment => {\n if (typeof attachment === 'string') {\n const texture = this.createColorTexture(attachment);\n this.attachResource(texture);\n return texture.view;\n }\n if (attachment instanceof Texture) {\n return attachment.view;\n }\n return attachment;\n });\n const attachment = this.props.depthStencilAttachment;\n if (attachment) {\n if (typeof attachment === 'string') {\n const texture = this.createDepthStencilTexture(attachment);\n this.attachResource(texture);\n this.depthStencilAttachment = texture.view;\n }\n else if (attachment instanceof Texture) {\n this.depthStencilAttachment = attachment.view;\n }\n else {\n this.depthStencilAttachment = attachment;\n }\n }\n }\n /** Create a color texture */\n createColorTexture(format) {\n return this.device.createTexture({\n id: 'color-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n /** Create depth stencil texture */\n createDepthStencilTexture(format) {\n return this.device.createTexture({\n id: 'depth-stencil-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n /**\n * Default implementation of resize\n * Creates new textures with correct size for all attachments.\n * and destroys existing textures if owned\n */\n resizeAttachments(width, height) {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({\n ...this.colorAttachments[i].props,\n width,\n height\n });\n this.destroyAttachedResource(this.colorAttachments[i]);\n this.colorAttachments[i] = resizedTexture.view;\n this.attachResource(resizedTexture.view);\n }\n }\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({\n ...this.depthStencilAttachment.props,\n width,\n height\n });\n this.destroyAttachedResource(this.depthStencilAttachment);\n this.depthStencilAttachment = resizedTexture.view;\n this.attachResource(resizedTexture);\n }\n }\n}\n// TODO - remove if not needed\n// Create a color attachment for WebGL *\n// protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {\n// return this.device._createTexture({\n// id: `${this.id}-color`,\n// data: null, // reserves texture memory, but texels are undefined\n// format,\n// // type: GL.UNSIGNED_BYTE,\n// width: this.width,\n// height: this.height,\n// // Note: Mipmapping can be disabled by texture resource when we resize the texture\n// // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n// // behavior we always disable mipmaps.\n// mipmaps: false,\n// // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n// // Use LINEAR so subpixel algos like fxaa work.\n// // Set WRAP modes that support NPOT textures too.\n// sampler: {\n// minFilter: 'linear',\n// magFilter: 'linear',\n// addressModeU: 'clamp-to-edge',\n// addressModeV: 'clamp-to-edge'\n// }\n// // parameters: {\n// // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n// // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n// // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n// // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n// // }\n// });\n// }\n// /** Returns fully populated attachment object. */\n// protected normalizeColorAttachment(\n// attachment: Texture | ColorTextureFormat\n// ): Required<ColorAttachment> {\n// const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {\n// texture: undefined!,\n// format: undefined!,\n// clearValue: [0.0, 0.0, 0.0, 0.0],\n// loadOp: 'clear',\n// storeOp: 'store'\n// };\n// if (attachment instanceof Texture) {\n// return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};\n// }\n// if (typeof attachment === 'string') {\n// return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};\n// }\n// return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};\n// }\n// /** Wraps texture inside fully populated attachment object. */\n// protected normalizeDepthStencilAttachment(\n// attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat\n// ): Required<DepthStencilAttachment> {\n// const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {\n// texture: undefined!,\n// format: undefined!,\n// depthClearValue: 1.0,\n// depthLoadOp: 'clear',\n// depthStoreOp: 'store',\n// depthReadOnly: false,\n// stencilClearValue: 0,\n// stencilLoadOp: 'clear',\n// stencilStoreOp: 'store',\n// stencilReadOnly: false\n// };\n// if (typeof attachment === 'string') {\n// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};\n// }\n// // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer\n// if (attachment.handle || attachment instanceof Texture) {\n// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};\n// }\n// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};\n// }\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// import {normalizeAttributeMap} from '../helpers/attribute-bindings';\nimport { Resource } from \"./resource.js\";\n/**\n * A compiled and linked shader program\n */\nexport class RenderPipeline extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n vs: null,\n vertexEntryPoint: 'vertexMain',\n vsConstants: {},\n fs: null,\n fragmentEntryPoint: 'fragmentMain',\n fsConstants: {},\n shaderLayout: null,\n bufferLayout: [],\n topology: 'triangle-list',\n parameters: {},\n // isInstanced: false,\n // instanceCount: 0,\n // vertexCount: 0,\n bindings: {},\n uniforms: {}\n };\n get [Symbol.toStringTag]() {\n return 'RenderPipeline';\n }\n /** The merged layout */\n shaderLayout;\n /** Buffer map describing buffer interleaving etc */\n bufferLayout;\n /** The linking status of the pipeline. 'pending' if linking is asynchronous, and on production */\n linkStatus = 'pending';\n /** The hash of the pipeline */\n hash = '';\n constructor(device, props) {\n super(device, props, RenderPipeline.defaultProps);\n this.shaderLayout = this.props.shaderLayout;\n this.bufferLayout = this.props.bufferLayout || [];\n }\n // DEPRECATED METHODS\n /**\n * Uniforms\n * @deprecated Use uniforms buffers\n * @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.\n * @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.\n */\n setUniformsWebGL(uniforms) {\n throw new Error('Use uniform blocks');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// import {Binding} from '../types/shader-layout';\nimport { Resource } from \"./resource.js\";\n/**\n * A RenderPass instance is a required parameter to all draw calls.\n *\n * It holds a combination of\n * - render targets (specified via a framebuffer)\n * - clear colors, read/write, discard information for the framebuffer attachments\n * - a couple of mutable parameters ()\n */\nexport class RenderPass extends Resource {\n /** Default properties for RenderPass */\n static defaultProps = {\n ...Resource.defaultProps,\n framebuffer: null,\n parameters: undefined,\n clearColor: [0, 0, 0, 0],\n clearDepth: 1,\n clearStencil: 0,\n depthReadOnly: false,\n stencilReadOnly: false,\n discard: false,\n occlusionQuerySet: undefined,\n timestampQuerySet: undefined,\n beginTimestampIndex: undefined,\n endTimestampIndex: undefined\n };\n get [Symbol.toStringTag]() {\n return 'RenderPass';\n }\n constructor(device, props) {\n super(device, props, RenderPass.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * A compiled and linked shader program for compute\n */\nexport class ComputePipeline extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n shader: undefined,\n entryPoint: undefined,\n constants: {},\n shaderLayout: undefined\n };\n get [Symbol.toStringTag]() {\n return 'ComputePipeline';\n }\n hash = '';\n constructor(device, props) {\n super(device, props, ComputePipeline.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\nexport class ComputePass extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n timestampQuerySet: undefined,\n beginTimestampIndex: undefined,\n endTimestampIndex: undefined\n };\n get [Symbol.toStringTag]() {\n return 'ComputePass';\n }\n constructor(device, props) {\n super(device, props, ComputePass.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * Encodes commands to queue that can be executed later\n */\nexport class CommandEncoder extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n measureExecutionTime: undefined\n };\n get [Symbol.toStringTag]() {\n return 'CommandEncoder';\n }\n constructor(device, props) {\n super(device, props, CommandEncoder.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/**\n * Encodes commands to queue that can be executed later\n */\nexport class CommandBuffer extends Resource {\n static defaultProps = {\n ...Resource.defaultProps\n };\n get [Symbol.toStringTag]() {\n return 'CommandBuffer';\n }\n constructor(device, props) {\n super(device, props, CommandBuffer.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */\nexport function decodeShaderAttributeType(attributeType) {\n const [dataType, components] = TYPE_INFO[attributeType];\n const integer = dataType === 'i32' || dataType === 'u32';\n const signed = dataType !== 'u32';\n const byteLength = TYPE_SIZES[dataType] * components;\n const defaultVertexFormat = getCompatibleVertexFormat(dataType, components);\n return {\n dataType,\n components,\n defaultVertexFormat,\n byteLength,\n integer,\n signed\n };\n}\n/** Get the \"default\" vertex format for a certain shader data type */\nfunction getCompatibleVertexFormat(dataType, components) {\n let vertexType;\n switch (dataType) {\n case 'f32':\n vertexType = 'float32';\n break;\n case 'i32':\n vertexType = 'sint32';\n break;\n case 'u32':\n vertexType = 'uint32';\n break;\n case 'f16':\n return components <= 2 ? 'float16x2' : 'float16x4';\n }\n // TODO logic does not work for float16\n if (components === 1) {\n return vertexType;\n }\n return `${vertexType}x${components}`;\n}\n/** All valid shader attribute types. A table guarantees exhaustive list and fast execution */\nconst TYPE_INFO = {\n f32: ['f32', 1],\n 'vec2<f32>': ['f32', 2],\n 'vec3<f32>': ['f32', 3],\n 'vec4<f32>': ['f32', 4],\n f16: ['f16', 1],\n 'vec2<f16>': ['f16', 2],\n 'vec3<f16>': ['f16', 3],\n 'vec4<f16>': ['f16', 4],\n i32: ['i32', 1],\n 'vec2<i32>': ['i32', 2],\n 'vec3<i32>': ['i32', 3],\n 'vec4<i32>': ['i32', 4],\n u32: ['u32', 1],\n 'vec2<u32>': ['u32', 2],\n 'vec3<u32>': ['u32', 3],\n 'vec4<u32>': ['u32', 4]\n};\nconst TYPE_SIZES = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4\n // 'bool-webgl': 4,\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { decodeVertexType } from \"./decode-data-type.js\";\n/**\n * Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)\n */\nexport function decodeVertexFormat(format) {\n // Strip the -webgl ending if present\n let webglOnly;\n if (format.endsWith('-webgl')) {\n format.replace('-webgl', '');\n webglOnly = true;\n }\n // split components from type\n const [type_, count] = format.split('x');\n const type = type_;\n const components = (count ? parseInt(count) : 1);\n // decode the type\n const decodedType = decodeVertexType(type);\n const result = {\n type,\n components,\n byteLength: decodedType.byteLength * components,\n integer: decodedType.integer,\n signed: decodedType.signed,\n normalized: decodedType.normalized\n };\n if (webglOnly) {\n result.webglOnly = true;\n }\n return result;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"../../utils/log.js\";\nimport { decodeShaderAttributeType } from \"../type-utils/decode-attribute-type.js\";\nimport { decodeVertexFormat } from \"../type-utils/decode-vertex-format.js\";\n/**\n * Map from \"attribute names\" to \"resolved attribute infos\"\n * containing information about both buffer layouts and shader attribute declarations\n */\nexport function getAttributeInfosFromLayouts(shaderLayout, bufferLayout) {\n const attributeInfos = {};\n for (const attribute of shaderLayout.attributes) {\n attributeInfos[attribute.name] = getAttributeInfoFromLayouts(shaderLayout, bufferLayout, attribute.name);\n }\n return attributeInfos;\n}\n/**\n * Array indexed by \"location\" holding \"resolved attribute infos\"\n */\nexport function getAttributeInfosByLocation(shaderLayout, bufferLayout, maxVertexAttributes = 16) {\n const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);\n const locationInfos = new Array(maxVertexAttributes).fill(null);\n for (const attributeInfo of Object.values(attributeInfos)) {\n locationInfos[attributeInfo.location] = attributeInfo;\n }\n return locationInfos;\n}\n/**\n * Get the combined information from a shader layout and a buffer layout for a specific attribute\n */\nfunction getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name) {\n const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name);\n const bufferMapping = getAttributeFromBufferLayout(bufferLayout, name);\n // TODO should no longer happen\n if (!shaderDeclaration) {\n // || !bufferMapping\n return null;\n }\n const attributeTypeInfo = decodeShaderAttributeType(shaderDeclaration.type);\n const vertexFormat = bufferMapping?.vertexFormat || attributeTypeInfo.defaultVertexFormat;\n const vertexFormatInfo = decodeVertexFormat(vertexFormat);\n return {\n attributeName: bufferMapping?.attributeName || shaderDeclaration.name,\n bufferName: bufferMapping?.bufferName || shaderDeclaration.name,\n location: shaderDeclaration.location,\n shaderType: shaderDeclaration.type,\n shaderDataType: attributeTypeInfo.dataType,\n shaderComponents: attributeTypeInfo.components,\n vertexFormat,\n bufferDataType: vertexFormatInfo.type,\n bufferComponents: vertexFormatInfo.components,\n // normalized is a property of the buffer's vertex format\n normalized: vertexFormatInfo.normalized,\n // integer is a property of the shader declaration\n integer: attributeTypeInfo.integer,\n stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode,\n byteOffset: bufferMapping?.byteOffset || 0,\n byteStride: bufferMapping?.byteStride || 0\n };\n}\nfunction getAttributeFromShaderLayout(shaderLayout, name) {\n const attribute = shaderLayout.attributes.find(attr => attr.name === name);\n if (!attribute) {\n log.warn(`shader layout attribute \"${name}\" not present in shader`);\n }\n return attribute || null;\n}\nfunction getAttributeFromBufferLayout(bufferLayouts, name) {\n // Check that bufferLayouts are valid (each either has format or attribute)\n checkBufferLayouts(bufferLayouts);\n let bufferLayoutInfo = getAttributeFromShortHand(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n bufferLayoutInfo = getAttributeFromAttributesList(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n // Didn't find...\n log.warn(`layout for attribute \"${name}\" not present in buffer layout`);\n return null;\n}\n/** Check that bufferLayouts are valid (each either has format or attribute) */\nfunction checkBufferLayouts(bufferLayouts) {\n for (const bufferLayout of bufferLayouts) {\n if ((bufferLayout.attributes && bufferLayout.format) ||\n (!bufferLayout.attributes && !bufferLayout.format)) {\n log.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`);\n }\n }\n}\n/** Get attribute from format shorthand if specified */\nfunction getAttributeFromShortHand(bufferLayouts, name) {\n for (const bufferLayout of bufferLayouts) {\n if (bufferLayout.format && bufferLayout.name === name) {\n return {\n attributeName: bufferLayout.name,\n bufferName: name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: bufferLayout.format,\n // If offset is needed, use `attributes` field.\n byteOffset: 0,\n byteStride: bufferLayout.byteStride || 0\n };\n }\n }\n return null;\n}\n/**\n * Search attribute mappings (e.g. interleaved attributes) for buffer mapping.\n * Not the name of the buffer might be the same as one of the interleaved attributes.\n */\nfunction getAttributeFromAttributesList(bufferLayouts, name) {\n for (const bufferLayout of bufferLayouts) {\n let byteStride = bufferLayout.byteStride;\n // Calculate a default byte stride if not provided\n if (typeof bufferLayout.byteStride !== 'number') {\n for (const attributeMapping of bufferLayout.attributes || []) {\n const info = decodeVertexFormat(attributeMapping.format);\n byteStride += info.byteLength;\n }\n }\n const attributeMapping = bufferLayout.attributes?.find(mapping => mapping.attribute === name);\n if (attributeMapping) {\n return {\n attributeName: attributeMapping.attribute,\n bufferName: bufferLayout.name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: attributeMapping.format,\n byteOffset: attributeMapping.byteOffset,\n byteStride\n };\n }\n }\n return null;\n}\n/**\n * Merges an provided shader layout into a base shader layout\n * In WebGL, this allows the auto generated shader layout to be overridden by the application\n * Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).\n * @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?\n */\nexport function mergeShaderLayout(baseLayout, overrideLayout) {\n // Deep clone the base layout\n const mergedLayout = {\n ...baseLayout,\n attributes: baseLayout.attributes.map(attribute => ({ ...attribute }))\n };\n // Merge the attributes\n for (const attribute of overrideLayout?.attributes || []) {\n const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);\n if (!baseAttribute) {\n log.warn(`shader layout attribute ${attribute.name} not present in shader`);\n }\n else {\n baseAttribute.type = attribute.type || baseAttribute.type;\n baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;\n }\n }\n return mergedLayout;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getAttributeInfosByLocation } from \"../attribute-utils/get-attribute-from-layouts.js\";\nimport { Resource } from \"./resource.js\";\n/**\n * Stores attribute bindings.\n * Makes it easy to share a render pipeline and use separate vertex arrays.\n * @note On WebGL, VertexArray allows non-constant bindings to be performed in advance\n * reducing the number of WebGL calls per draw call.\n * @note On WebGPU this is just a convenience class that collects the bindings.\n */\nexport class VertexArray extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n renderPipeline: null\n };\n get [Symbol.toStringTag]() {\n return 'VertexArray';\n }\n /** Max number of vertex attributes */\n maxVertexAttributes;\n /** Attribute infos indexed by location - TODO only needed by webgl module? */\n attributeInfos;\n /** Index buffer */\n indexBuffer = null;\n /** Attributes indexed by buffer slot */\n attributes;\n constructor(device, props) {\n super(device, props, VertexArray.defaultProps);\n this.maxVertexAttributes = device.limits.maxVertexAttributes;\n this.attributes = new Array(this.maxVertexAttributes).fill(null);\n this.attributeInfos = getAttributeInfosByLocation(props.renderPipeline.shaderLayout, props.renderPipeline.bufferLayout, this.maxVertexAttributes);\n }\n // DEPRECATED METHODS\n /** @deprecated Set constant attributes (WebGL only) */\n setConstantWebGL(location, value) {\n throw new Error('constant attributes not supported');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Holds a set of output buffers for pipeline (WebGL only) */\nexport class TransformFeedback extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n layout: undefined,\n buffers: {}\n };\n get [Symbol.toStringTag]() {\n return 'TransformFeedback';\n }\n constructor(device, props) {\n super(device, props, TransformFeedback.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Resource } from \"./resource.js\";\n/** Immutable QuerySet object */\nexport class QuerySet extends Resource {\n static defaultProps = {\n ...Resource.defaultProps,\n type: undefined,\n count: undefined\n };\n get [Symbol.toStringTag]() {\n return 'QuerySet';\n }\n constructor(device, props) {\n super(device, props, QuerySet.defaultProps);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { assert } from \"../../utils/assert.js\";\nconst UNIFORM_FORMATS = {\n f32: { type: 'f32', components: 1 },\n i32: { type: 'i32', components: 1 },\n u32: { type: 'u32', components: 1 },\n // 'bool-webgl': {type: 'bool-webgl', components: 1},\n 'vec2<f32>': { type: 'f32', components: 2 },\n 'vec3<f32>': { type: 'f32', components: 3 },\n 'vec4<f32>': { type: 'f32', components: 4 },\n 'vec2<i32>': { type: 'i32', components: 2 },\n 'vec3<i32>': { type: 'i32', components: 3 },\n 'vec4<i32>': { type: 'i32', components: 4 },\n 'vec2<u32>': { type: 'u32', components: 2 },\n 'vec3<u32>': { type: 'u32', components: 3 },\n 'vec4<u32>': { type: 'u32', components: 4 },\n 'mat2x2<f32>': { type: 'f32', components: 4 },\n 'mat2x3<f32>': { type: 'f32', components: 6 },\n 'mat2x4<f32>': { type: 'f32', components: 8 },\n 'mat3x2<f32>': { type: 'f32', components: 6 },\n 'mat3x3<f32>': { type: 'f32', components: 9 },\n 'mat3x4<f32>': { type: 'f32', components: 12 },\n 'mat4x2<f32>': { type: 'f32', components: 8 },\n 'mat4x3<f32>': { type: 'f32', components: 12 },\n 'mat4x4<f32>': { type: 'f32', components: 16 }\n};\n/** Split a uniform type string into type and components */\nexport function decodeShaderUniformType(format) {\n const decoded = UNIFORM_FORMATS[format];\n assert(format);\n return decoded;\n}\n/** Align offset to 1, 2 or 4 elements (4, 8 or 16 bytes) */\nexport function alignTo(size, count) {\n // prettier-ignore\n switch (count) {\n case 1: return size; // Pad upwards to even multiple of 2\n case 2: return size + (size % 2); // Pad upwards to even multiple of 2\n default: return size + ((4 - (size % 4)) % 4); // Pad upwards to even multiple of 4\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nlet arrayBuffer;\nexport function getScratchArrayBuffer(byteLength) {\n if (!arrayBuffer || arrayBuffer.byteLength < byteLength) {\n arrayBuffer = new ArrayBuffer(byteLength);\n }\n return arrayBuffer;\n}\nexport function getScratchArray(Type, length) {\n const scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);\n return new Type(scratchArrayBuffer, 0, length); // arrayBuffer, byteOffset, length (in elements)\n}\n// Uses copyWithin to significantly speed up typed array value filling\nexport function fillArray(options) {\n const { target, source, start = 0, count = 1 } = options;\n const length = source.length;\n const total = count * length;\n let copied = 0;\n for (let i = start; copied < length; copied++) {\n target[i++] = source[copied];\n }\n while (copied < total) {\n // If we have copied less than half, copy everything we got\n // else copy remaining in one operation\n if (copied < total - copied) {\n target.copyWithin(start + copied, start, start + copied);\n copied *= 2;\n }\n else {\n target.copyWithin(start + copied, start, start + total - copied);\n copied = total;\n }\n }\n return options.target;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { decodeShaderUniformType, alignTo } from \"../../adapter/type-utils/decode-shader-types.js\";\nimport { getScratchArrayBuffer } from \"../../utils/array-utils-flat.js\";\nimport { isNumberArray } from \"../../utils/is-array.js\";\nimport { log } from \"../../utils/log.js\";\n/**\n * Smallest buffer size that can be used for uniform buffers.\n * TODO - does this depend on device?\n */\nconst minBufferSize = 1024;\n/**\n * Std140 layout for uniform buffers\n * Supports manual listing of uniforms\n */\nexport class UniformBufferLayout {\n layout = {};\n /** number of bytes needed for buffer allocation */\n byteLength;\n /** Create a new UniformBufferLayout given a map of attributes. */\n constructor(uniformTypes) {\n /** number of 4 byte slots taken */\n let size = 0;\n // Add layout (type, size and offset) definitions for each uniform in the layout\n for (const [key, uniformType] of Object.entries(uniformTypes)) {\n const typeAndComponents = decodeShaderUniformType(uniformType);\n const { type, components: count } = typeAndComponents;\n // First, align (bump) current offset to an even multiple of current object (1, 2, 4)\n size = alignTo(size, count);\n // Use the aligned size as the offset of the current uniform.\n const offset = size;\n // Then, add our object's padded size ((1, 2, multiple of 4) to the current offset\n size += count;\n this.layout[key] = { type, size: count, offset };\n }\n size += (4 - (size % 4)) % 4;\n const actualByteLength = size * 4;\n this.byteLength = Math.max(actualByteLength, minBufferSize);\n }\n /** Get the data for the complete buffer */\n getData(uniformValues) {\n const bufferSize = Math.max(this.byteLength, minBufferSize);\n // Allocate three typed arrays pointing at same memory\n const arrayBuffer = getScratchArrayBuffer(bufferSize);\n const typedArrays = {\n i32: new Int32Array(arrayBuffer),\n u32: new Uint32Array(arrayBuffer),\n f32: new Float32Array(arrayBuffer),\n // TODO not implemented\n f16: new Uint16Array(arrayBuffer)\n };\n // TODO is this needed?\n // typedArrays.i32.fill(0);\n for (const [name, value] of Object.entries(uniformValues)) {\n const uniformLayout = this.layout[name];\n if (!uniformLayout) {\n log.warn(`Supplied uniform value ${name} not present in uniform block layout`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n const { type, size, offset } = uniformLayout;\n const typedArray = typedArrays[type];\n if (size === 1) {\n if (typeof value !== 'number' && typeof value !== 'boolean') {\n log.warn(`Supplied value for single component uniform ${name} is not a number: ${value}`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n // single value -> just set it\n typedArray[offset] = Number(value);\n }\n else {\n const numericArray = isNumberArray(value);\n if (!numericArray) {\n log.warn(`Supplied value for multi component / array uniform ${name} is not a numeric array: ${value}`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n // vector/matrix -> copy the supplied (typed) array, starting from offset\n // TODO: we should limit or check size in case the supplied data overflows\n typedArray.set(numericArray, offset);\n }\n }\n return new Uint8Array(arrayBuffer);\n }\n /** Does this layout have a field with specified name */\n has(name) {\n return Boolean(this.layout[name]);\n }\n /** Get offset and size for a field with specified name */\n get(name) {\n const layout = this.layout[name];\n return layout;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isNumberArray } from \"./is-array.js\";\n/** Test if two arrays are deep equal, with a length limit that defaults to 16 */\nexport function arrayEqual(a, b, limit = 16) {\n if (a !== b) {\n return false;\n }\n const arrayA = isNumberArray(a);\n if (!arrayA) {\n return false;\n }\n const arrayB = isNumberArray(b);\n if (arrayB && arrayA.length === arrayB.length) {\n for (let i = 0; i < arrayA.length; ++i) {\n if (arrayB[i] !== arrayA[i]) {\n return false;\n }\n }\n }\n return true;\n}\n/** Copy a value */\nexport function arrayCopy(a) {\n const numberArray = isNumberArray(a);\n if (numberArray) {\n return numberArray.slice();\n }\n return a;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { arrayEqual, arrayCopy } from \"../../utils/array-equal.js\";\n/**\n * A uniform block holds values of the of uniform values for one uniform block / buffer.\n * It also does some book keeping on what has changed, to minimize unnecessary writes to uniform buffers.\n */\nexport class UniformBlock {\n name;\n uniforms = {};\n modifiedUniforms = {};\n modified = true;\n bindingLayout = {};\n needsRedraw = 'initialized';\n constructor(props) {\n this.name = props?.name;\n // TODO - Extract uniform layout from the shaderLayout object\n if (props?.name && props?.shaderLayout) {\n const binding = props?.shaderLayout.bindings?.find(binding => binding.type === 'uniform' && binding.name === props?.name);\n if (!binding) {\n throw new Error(props?.name);\n }\n const uniformBlock = binding;\n for (const uniform of uniformBlock.uniforms || []) {\n this.bindingLayout[uniform.name] = uniform;\n }\n }\n }\n /** Set a map of uniforms */\n setUniforms(uniforms) {\n for (const [key, value] of Object.entries(uniforms)) {\n this._setUniform(key, value);\n if (!this.needsRedraw) {\n this.setNeedsRedraw(`${this.name}.${key}=${value}`);\n }\n }\n }\n setNeedsRedraw(reason) {\n this.needsRedraw = this.needsRedraw || reason;\n }\n /** Returns all uniforms */\n getAllUniforms() {\n // @ts-expect-error\n this.modifiedUniforms = {};\n this.needsRedraw = false;\n return (this.uniforms || {});\n }\n /** Set a single uniform */\n _setUniform(key, value) {\n if (arrayEqual(this.uniforms[key], value)) {\n return;\n }\n this.uniforms[key] = arrayCopy(value);\n this.modifiedUniforms[key] = true;\n this.modified = true;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Buffer } from \"../../adapter/resources/buffer.js\";\nimport { UniformBlock } from \"./uniform-block.js\";\nimport { UniformBufferLayout } from \"./uniform-buffer-layout.js\";\nimport { log } from \"../../utils/log.js\";\n/**\n * A uniform store holds a uniform values for one or more uniform blocks,\n * - It can generate binary data for any uniform buffer\n * - It can manage a uniform buffer for each block\n * - It can update managed uniform buffers with a single call\n * - It performs some book keeping on what has changed to minimize unnecessary writes to uniform buffers.\n */\nexport class UniformStore {\n /** Stores the uniform values for each uniform block */\n uniformBlocks = new Map();\n /** Can generate data for a uniform buffer for each block from data */\n uniformBufferLayouts = new Map();\n /** Actual buffer for the blocks */\n uniformBuffers = new Map();\n /**\n * Create a new UniformStore instance\n * @param blocks\n */\n constructor(blocks) {\n for (const [bufferName, block] of Object.entries(blocks)) {\n const uniformBufferName = bufferName;\n // Create a layout object to help us generate correctly formatted binary uniform buffers\n const uniformBufferLayout = new UniformBufferLayout(block.uniformTypes || {});\n this.uniformBufferLayouts.set(uniformBufferName, uniformBufferLayout);\n // Create a Uniform block to store the uniforms for each buffer.\n const uniformBlock = new UniformBlock({ name: bufferName });\n uniformBlock.setUniforms(block.defaultUniforms || {});\n this.uniformBlocks.set(uniformBufferName, uniformBlock);\n }\n }\n /** Destroy any managed uniform buffers */\n destroy() {\n for (const uniformBuffer of this.uniformBuffers.values()) {\n uniformBuffer.destroy();\n }\n }\n /**\n * Set uniforms\n * Makes all properties partial\n */\n setUniforms(uniforms) {\n for (const [blockName, uniformValues] of Object.entries(uniforms)) {\n this.uniformBlocks.get(blockName).setUniforms(uniformValues);\n // We leverage logging in updateUniformBuffers(), even though slightly less efficient\n // this.updateUniformBuffer(blockName);\n }\n this.updateUniformBuffers();\n }\n /** Get the required minimum length of the uniform buffer */\n getUniformBufferByteLength(uniformBufferName) {\n return this.uniformBufferLayouts.get(uniformBufferName).byteLength;\n }\n /** Get formatted binary memory that can be uploaded to a buffer */\n getUniformBufferData(uniformBufferName) {\n const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();\n return this.uniformBufferLayouts.get(uniformBufferName).getData(uniformValues);\n }\n /**\n * Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)\n * The new buffer is initialized with current / supplied values\n */\n createUniformBuffer(device, uniformBufferName, uniforms) {\n if (uniforms) {\n this.setUniforms(uniforms);\n }\n const byteLength = this.getUniformBufferByteLength(uniformBufferName);\n const uniformBuffer = device.createBuffer({\n usage: Buffer.UNIFORM | Buffer.COPY_DST,\n byteLength\n });\n // Note that this clears the needs redraw flag\n const uniformBufferData = this.getUniformBufferData(uniformBufferName);\n uniformBuffer.write(uniformBufferData);\n return uniformBuffer;\n }\n /** Get the managed uniform buffer. \"managed\" resources are destroyed when the uniformStore is destroyed. */\n getManagedUniformBuffer(device, uniformBufferName) {\n if (!this.uniformBuffers.get(uniformBufferName)) {\n const byteLength = this.getUniformBufferByteLength(uniformBufferName);\n const uniformBuffer = device.createBuffer({\n usage: Buffer.UNIFORM | Buffer.COPY_DST,\n byteLength\n });\n this.uniformBuffers.set(uniformBufferName, uniformBuffer);\n }\n // this.updateUniformBuffers();\n return this.uniformBuffers.get(uniformBufferName);\n }\n /** Updates all uniform buffers where values have changed */\n updateUniformBuffers() {\n let reason = false;\n for (const uniformBufferName of this.uniformBlocks.keys()) {\n const bufferReason = this.updateUniformBuffer(uniformBufferName);\n reason ||= bufferReason;\n }\n if (reason) {\n log.log(3, `UniformStore.updateUniformBuffers(): ${reason}`)();\n }\n return reason;\n }\n /** Update one uniform buffer. Only updates if values have changed */\n updateUniformBuffer(uniformBufferName) {\n const uniformBlock = this.uniformBlocks.get(uniformBufferName);\n const uniformBuffer = this.uniformBuffers.get(uniformBufferName);\n let reason = false;\n if (uniformBuffer && uniformBlock.needsRedraw) {\n reason ||= uniformBlock.needsRedraw;\n // This clears the needs redraw flag\n const uniformBufferData = this.getUniformBufferData(uniformBufferName);\n const uniformBuffer = this.uniformBuffers.get(uniformBufferName);\n uniformBuffer.write(uniformBufferData);\n // logging - TODO - don't query the values unnecessarily\n const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();\n log.log(4, `Writing to uniform buffer ${String(uniformBufferName)}`, uniformBufferData, uniformValues)();\n }\n return reason;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function getDataTypeFromTypedArray(arrayOrType) {\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return 'float32';\n case Uint16Array:\n return 'uint16';\n case Uint32Array:\n return 'uint32';\n case Uint8Array:\n case Uint8ClampedArray:\n return 'uint8';\n case Int8Array:\n return 'sint8';\n case Int16Array:\n return 'sint16';\n case Int32Array:\n return 'sint32';\n default:\n // Failed to deduce data type from typed array\n throw new Error(type.constructor.name);\n }\n}\nexport function getTypedArrayFromDataType(dataType) {\n switch (dataType) {\n case 'float32':\n return Float32Array;\n case 'uint32':\n return Uint32Array;\n case 'sint32':\n return Int32Array;\n case 'uint16':\n case 'unorm16':\n return Uint16Array;\n case 'sint16':\n case 'snorm16':\n return Int16Array;\n case 'uint8':\n case 'unorm8':\n return Uint8Array;\n case 'sint8':\n case 'snorm8':\n return Int8Array;\n default:\n // Failed to deduce typed array from data type\n throw new Error(dataType);\n }\n}\n/** Get the vertex format for an attribute with TypedArray and size */\nexport function getVertexFormatFromAttribute(typedArray, size, normalized) {\n if (!size || size > 4) {\n throw new Error(`size ${size}`);\n }\n const components = size;\n let dataType = getDataTypeFromTypedArray(typedArray);\n if (dataType === 'uint8' || dataType === 'sint8') {\n if (components === 1 || components === 3) {\n // WebGPU 8 bit formats must be aligned to 16 bit boundaries');\n throw new Error(`size: ${size}`);\n }\n if (normalized) {\n dataType = dataType.replace('int', 'norm');\n }\n return `${dataType}x${components}`;\n }\n if (dataType === 'uint16' || dataType === 'sint16') {\n if (components === 1 || components === 3) {\n // WebGPU 16 bit formats must be aligned to 32 bit boundaries\n throw new Error(`size: ${size}`);\n }\n if (normalized) {\n dataType = dataType.replace('int', 'norm');\n }\n return `${dataType}x${components}`;\n }\n if (components === 1) {\n return dataType;\n }\n return `${dataType}x${components}`;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Helper for type downcasts, e.g. Buffer -> WebGPUBuffer */\nexport function cast(value) {\n return value;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { isNumberArray } from \"../../utils/is-array.js\";\nexport function isUniformValue(value) {\n return isNumberArray(value) !== null || typeof value === 'number' || typeof value === 'boolean';\n}\nexport function splitUniformsAndBindings(uniforms) {\n const result = { bindings: {}, uniforms: {} };\n Object.keys(uniforms).forEach(name => {\n const uniform = uniforms[name];\n if (isUniformValue(uniform)) {\n result.uniforms[name] = uniform;\n }\n else {\n result.bindings[name] = uniform;\n }\n });\n return result;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** TODO @deprecated - delete when confident that probe.gl logging implements all opts */\nfunction formatArrayValue(v, opts = {}) {\n const { maxElts = 16, size = 1 } = opts;\n let string = '[';\n for (let i = 0; i < v.length && i < maxElts; ++i) {\n if (i > 0) {\n string += `,${i % size === 0 ? ' ' : ''}`;\n }\n string += formatValue(v[i], opts);\n }\n const terminator = v.length > maxElts ? '...' : ']';\n return `${string}${terminator}`;\n}\n/** TODO @deprecated - delete when confident that probe.gl logging implements all opts */\nexport function formatValue(v, opts = {}) {\n const EPSILON = 1e-16;\n const { isInteger = false } = opts;\n if (Array.isArray(v) || ArrayBuffer.isView(v)) {\n return formatArrayValue(v, opts);\n }\n if (typeof v !== 'number') {\n return String(v);\n }\n if (Math.abs(v) < EPSILON) {\n return isInteger ? '0' : '0.';\n }\n if (isInteger) {\n return v.toFixed(0);\n }\n if (Math.abs(v) > 100 && Math.abs(v) < 10000) {\n return v.toFixed(0);\n }\n const string = v.toPrecision(2);\n const decimal = string.indexOf('.0');\n return decimal === string.length - 2 ? string.slice(0, -1) : string;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"./log.js\";\n// Install stubs for removed methods\nexport function stubRemovedMethods(instance, className, version, methodNames) {\n const upgradeMessage = `See luma.gl ${version} Upgrade Guide at \\\nhttps://luma.gl/docs/upgrade-guide`;\n const prototype = Object.getPrototypeOf(instance);\n methodNames.forEach((methodName) => {\n if (prototype.methodName) {\n return;\n }\n prototype[methodName] = () => {\n log.removed(`Calling removed method ${className}.${methodName}: `, upgradeMessage)();\n throw new Error(methodName);\n };\n });\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from \"./log.js\";\nexport function checkProps(className, props, propChecks) {\n const { removedProps = {}, deprecatedProps = {}, replacedProps = {} } = propChecks;\n // removedProps: Removed props no longer supported\n // print error and link to upgrade guide\n for (const propName in removedProps) {\n if (propName in props) {\n const replacementProp = removedProps[propName];\n const replacement = replacementProp ? `${className}.${removedProps[propName]}` : 'N/A';\n log.removed(`${className}.${propName}`, replacement)();\n }\n }\n // deprecatedProps: Deprecated props that can not be autosubstituted\n // print warning and rely on caller to substitute\n for (const propName in deprecatedProps) {\n if (propName in props) {\n const replacementProp = deprecatedProps[propName];\n log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();\n }\n }\n // replacedProps: Deprecated props that can be autosubstituted\n // print warning and return updated props object\n let newProps = null;\n for (const [propName, replacementProp] of Object.entries(replacedProps)) {\n if (propName in props) {\n log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();\n newProps = newProps || Object.assign({}, props);\n newProps[replacementProp] = props[propName];\n delete newProps[propName];\n }\n }\n return newProps || props;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nlet pathPrefix = '';\n/**\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix) {\n pathPrefix = prefix;\n}\n/**\n * Reads raw file data. Respects setPathPrefix.\n */\nexport async function loadFile(url, options) {\n url = url.startsWith('http') ? url : pathPrefix + url;\n const dataType = options?.dataType || 'text';\n const response = await fetch(url, options);\n return await response[dataType]();\n}\n/**\n * Loads ImageBitmap asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n */\nexport async function loadImageBitmap(url, opts) {\n const image = new Image();\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n await image.decode();\n return await createImageBitmap(image);\n}\n/**\n * Loads image asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.\n */\nexport async function loadImage(url, opts) {\n return await new Promise((resolve, reject) => {\n try {\n const image = new Image();\n image.onload = () => resolve(image);\n image.onerror = () => reject(new Error(`Could not load image ${url}.`));\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n }\n catch (error) {\n reject(error);\n }\n });\n}\n/**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param scriptId defines the id of the script element\n */\nexport async function loadScript(scriptUrl, scriptId) {\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n throw new Error('loadScript');\n }\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', scriptUrl);\n if (scriptId) {\n script.id = scriptId;\n }\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = error => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));\n head.appendChild(script);\n });\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Creates a deterministic pseudorandom number generator */\nexport function makeRandomNumberGenerator() {\n let s = 1;\n let c = 1;\n return () => {\n s = Math.sin(c * 17.23);\n c = Math.cos(s * 27.92);\n return fract(Math.abs(s * c) * 1432.71);\n };\n}\nfunction fract(n) {\n return n - Math.floor(n);\n}\n/** Generates a deterministic pseudorandom number */\nexport const random = makeRandomNumberGenerator();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Fast partial deep equal for prop.\n *\n * @param a Prop\n * @param b Prop to compare against `a`\n * @param depth Depth to which to recurse in nested Objects/Arrays. Use 0 (default) for shallow comparison, -1 for infinite depth\n */\n/* eslint-disable complexity */\nexport function deepEqual(a, b, depth) {\n if (a === b) {\n return true;\n }\n if (!depth || !a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === 'object' && typeof b === 'object') {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!b.hasOwnProperty(key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Node.js polyfills for requestAnimationFrame and cancelAnimationFrame\n/* global window, setTimeout, clearTimeout */\n// / <reference types=\"@types/node\" />\nexport function requestAnimationFrame(callback) {\n return typeof window !== 'undefined' && window.requestAnimationFrame\n ? window.requestAnimationFrame(callback)\n : setTimeout(callback, 1000 / 60);\n}\nexport function cancelAnimationFrame(timerId) {\n return typeof window !== 'undefined' && window.cancelAnimationFrame\n ? window.cancelAnimationFrame(timerId)\n : clearTimeout(timerId);\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,iBAA0B;;;ACA1B,iBAAoB;AAEb,IAAM,MAAM,IAAI,eAAI,EAAE,IAAI,UAAU,CAAC;;;ACF5C,mBAAsB;AAIf,IAAM,eAAN,MAAmB;AAAA,EACtB,QAAQ,oBAAI,IAAI;AAAA,EAChB,SAASC,OAAM;AACX,WAAO,KAAK,IAAIA,KAAI;AAAA,EACxB;AAAA,EACA,IAAIA,OAAM;AACN,QAAI,CAAC,KAAK,MAAM,IAAIA,KAAI,GAAG;AACvB,WAAK,MAAM,IAAIA,OAAM,IAAI,mBAAM,EAAE,IAAIA,MAAK,CAAC,C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AAE,CAAC,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG;AACnC,eAAO;AAAA,MACX;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACA,MAAI,MAAM,QAAQ,CAAC,GAAG;AAClB,WAAO;AAAA,EACX;AACA,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,UAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,UAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,QAAI,MAAM,WAAW,MAAM,QAAQ;AAC/B,aAAO;AAAA,IACX;AACA,eAAW,OAAO,OAAO;AACrB,UAAI,CAAC,EAAE,eAAe,GAAG,GAAG;AACxB,eAAO;AAAA,MACX;AACA,UAAI,CAAC,UAAU,EAAE,GAAG,GAAG,EAAE,GAAG,GAAG,QAAQ,CAAC,GAAG;AACvC,eAAO;AAAA,MACX;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACA,SAAO;AACX;;;AC3CO,SAAS,sBAAsB,UAAU;AAC5C,SAAO,OAAO,WAAW,eAAe,OAAO,wBACzC,OAAO,sBAAsB,QAAQ,IACrC,WAAW,UAAU,MAAO,EAAE;AACxC;AACO,SAAS,qBAAqB,SAAS;AAC1C,SAAO,OAAO,WAAW,eAAe,OAAO,uBACzC,OAAO,qBAAqB,OAAO,IACnC,aAAa,OAAO;AAC9B;;;AjD4CO,IAAM,OAAO,CAAC,MAAM,GAAG;",
6
6
  "names": ["Buffer", "name", "VERSION", "name", "Buffer", "format", "Buffer", "Device", "import_env", "log", "attachment", "TYPE_SIZES", "name", "attributeMapping", "arrayBuffer", "name", "binding", "Buffer", "uniformBuffer", "name"]
7
7
  }
package/dist/init.js CHANGED
@@ -11,7 +11,7 @@ import { lumaStats } from "./utils/stats-manager.js";
11
11
  function initializeLuma() {
12
12
  // Version detection using babel plugin
13
13
  // @ts-expect-error
14
- const VERSION = typeof "9.0.20" !== 'undefined' ? "9.0.20" : 'running from source';
14
+ const VERSION = typeof "9.0.21" !== 'undefined' ? "9.0.21" : 'running from source';
15
15
  const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';
16
16
  // Assign luma.log.level in console to control logging: \
17
17
  // 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/core",
3
- "version": "9.0.20",
3
+ "version": "9.0.21",
4
4
  "description": "The luma.gl core Device API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,5 +46,5 @@
46
46
  "@probe.gl/stats": "^4.0.2",
47
47
  "@types/offscreencanvas": "^2019.6.4"
48
48
  },
49
- "gitHead": "fa850b5d4b398f7168529543a24662bf9df4c68e"
49
+ "gitHead": "9d7d29778581c2408fc3f37723f6868983d0dab2"
50
50
  }