@luma.gl/core
Advanced tools
Comparing version 9.1.0-alpha.17 to 9.1.0-alpha.18
@@ -48,3 +48,3 @@ // luma.gl | ||
// @ts-expect-error no-undef | ||
typeof "9.1.0-alpha.17" !== 'undefined' ? "9.1.0-alpha.17" : 'running from source'; | ||
typeof "9.1.0-alpha.18" !== 'undefined' ? "9.1.0-alpha.18" : 'running from source'; | ||
spector; | ||
@@ -51,0 +51,0 @@ preregisteredAdapters = new Map(); |
@@ -16,9 +16,9 @@ import type { NumberArray4, TypedArray } from '@math.gl/types'; | ||
/** Clear value for color attachment, or false to preserve the previous value */ | ||
clearColor?: NumberArray4 | TypedArray | boolean; | ||
/** Experimental: Clear color values for multiple color attachments. Must specify typed arrays */ | ||
clearColor?: NumberArray4 | TypedArray | false; | ||
/** Experimental: Clear color values for multiple color attachments. Must specify typed arrays. props.clearColor will be ignored. */ | ||
clearColors?: (TypedArray | false)[]; | ||
/** Clear value for depth attachment (true === `1`), or false to preserve the previous value */ | ||
clearDepth?: number | boolean; | ||
/** Clear value for stencil attachment (true === `0`), or false to preserve the previous value */ | ||
clearStencil?: number | boolean; | ||
/** Clear value for depth attachment (true === `1`), or false to preserve the previous value. Must be between 0.0 (near) and 1.0 (far), inclusive. */ | ||
clearDepth?: number | false; | ||
/** Clear value for stencil attachment (true === `0`), or false to preserve the previous value. Converted to the type and number of LSBs as the number of bits in the stencil aspect */ | ||
clearStencil?: number | false; | ||
/** Indicates that the depth component is read only. */ | ||
@@ -48,2 +48,8 @@ depthReadOnly?: boolean; | ||
export declare abstract class RenderPass extends Resource<RenderPassProps> { | ||
/** TODO - should be [0, 0, 0, 0], update once deck.gl tests run clean */ | ||
static defaultClearColor: [number, number, number, number]; | ||
/** Depth 1.0 represents the far plance */ | ||
static defaultClearDepth: number; | ||
/** Clears all stencil bits */ | ||
static defaultClearStencil: number; | ||
/** Default properties for RenderPass */ | ||
@@ -50,0 +56,0 @@ static defaultProps: Required<RenderPassProps>; |
@@ -15,2 +15,8 @@ // luma.gl | ||
export class RenderPass extends Resource { | ||
/** TODO - should be [0, 0, 0, 0], update once deck.gl tests run clean */ | ||
static defaultClearColor = [0, 0, 0, 1]; | ||
/** Depth 1.0 represents the far plance */ | ||
static defaultClearDepth = 1; | ||
/** Clears all stencil bits */ | ||
static defaultClearStencil = 0; | ||
/** Default properties for RenderPass */ | ||
@@ -21,6 +27,6 @@ static defaultProps = { | ||
parameters: undefined, | ||
clearColor: false, | ||
clearColor: RenderPass.defaultClearColor, | ||
clearColors: undefined, | ||
clearDepth: false, | ||
clearStencil: false, | ||
clearDepth: RenderPass.defaultClearDepth, | ||
clearStencil: RenderPass.defaultClearStencil, | ||
depthReadOnly: false, | ||
@@ -43,4 +49,4 @@ stencilReadOnly: false, | ||
// Intended to override e.g. set default clear values to true | ||
const overrideProps = device.props._resourceDefaults?.renderPass; | ||
const newProps = { ...overrideProps, ...props }; | ||
const overriddenDefaultProps = device.props._resourceDefaults?.renderPass; | ||
const newProps = { ...overriddenDefaultProps, ...props }; | ||
return newProps; | ||
@@ -47,0 +53,0 @@ } |
@@ -29,6 +29,6 @@ // luma.gl | ||
static normalizeProps(device, props) { | ||
const overrideProps = device?.props?._resourceDefaults?.sampler || {}; | ||
const newProps = { ...props, ...overrideProps }; | ||
const overriddenDefaultProps = device?.props?._resourceDefaults?.sampler || {}; | ||
const newProps = { ...props, ...overriddenDefaultProps }; | ||
return newProps; | ||
} | ||
} |
@@ -215,5 +215,5 @@ // luma.gl | ||
// Allow device to override props (e.g. props.mipmaps) | ||
const overrideProps = device?.props?._resourceDefaults?.texture || {}; | ||
const overriddenDefaultProps = device?.props?._resourceDefaults?.texture || {}; | ||
// TODO - Type issue with props.data circumvented with Object.assign | ||
Object.assign(newProps, overrideProps); | ||
Object.assign(newProps, overriddenDefaultProps); | ||
// Ensure we have integer coordinates | ||
@@ -220,0 +220,0 @@ const { width, height } = newProps; |
@@ -7,13 +7,13 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
else root['luma'] = factory();})(globalThis, function () { | ||
"use strict";var __exports__=(()=>{var te=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var vt=Object.prototype.hasOwnProperty;var Et=(r,e,t)=>e in r?te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Pt=(r,e)=>{for(var t in e)te(r,t,{get:e[t],enumerable:!0})},_t=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of At(e))!vt.call(r,s)&&s!==t&&te(r,s,{get:()=>e[s],enumerable:!(n=St(e,s))||n.enumerable});return r};var Ct=r=>_t(te({},"__esModule",{value:!0}),r);var a=(r,e,t)=>(Et(r,typeof e!="symbol"?e+"":e,t),t);var gr={};Pt(gr,{Adapter:()=>me,Buffer:()=>m,CanvasContext:()=>H,CommandBuffer:()=>q,CommandEncoder:()=>Z,ComputePass:()=>X,ComputePipeline:()=>Y,Device:()=>E,DeviceFeatures:()=>de,DeviceLimits:()=>le,ExternalTexture:()=>k,Framebuffer:()=>W,QuerySet:()=>ee,RenderPass:()=>j,RenderPipeline:()=>O,Resource:()=>c,Sampler:()=>V,Shader:()=>G,Texture:()=>h,TextureView:()=>z,TransformFeedback:()=>Q,UniformBlock:()=>I,UniformBufferLayout:()=>R,UniformStore:()=>xe,VertexArray:()=>J,decodeShaderAttributeType:()=>ge,decodeShaderUniformType:()=>be,decodeTextureFormat:()=>ot,decodeVertexFormat:()=>K,getAttributeInfosFromLayouts:()=>ze,getDataTypeFromTypedArray:()=>Oe,getScratchArray:()=>gt,getTypedArrayFromDataType:()=>wt,getVertexFormatFromAttribute:()=>Tt,log:()=>f,luma:()=>at});var re=globalThis,Lt=globalThis.document||{},ne=globalThis.process||{},Mt=globalThis.console,yr=globalThis.navigator||{};function je(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function y(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||je()}var Te="4.0.7";function D(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var A=class{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=D(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(D()-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 P=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:n}=e,s=this.stats[t];return s||(e instanceof A?s=e:s=new A(t,n),this.stats[t]=s),s}};var Se=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new P({id:e})),this.stats.get(e)}},se=new Se;function Rt(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var oe=class{constructor(e,t,n="sessionStorage"){this.storage=Rt(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function Ye(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Xe(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var ie;(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"})(ie||(ie={}));var It=10;function Ze(r){return typeof r!="string"?r:(r=r.toUpperCase(),ie[r]||ie.WHITE)}function qe(r,e,t){return!y&&typeof r=="string"&&(e&&(r=`\x1B[${Ze(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${Ze(t)+It}m${r}\x1B[49m`)),r}function Ke(r,e=["constructor"]){let t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),s=r;for(let o of n){let i=s[o];typeof i=="function"&&(e.find(u=>o===u)||(s[o]=i.bind(r)))}}function $(r,e){if(!r)throw new Error(e||"Assertion failed")}function v(){let r;if(y()&&re.performance)r=re?.performance?.now?.();else if("hrtime"in ne){let e=ne?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var _={debug:y()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Dt={enabled:!0,level:0};function C(){}var Je={},Qe={once:!0},T=class{constructor({id:e}={id:""}){this.VERSION=Te,this._startTs=v(),this._deltaTs=v(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new oe(`__probe-${this.id}__`,Dt),this.timeStamp(`${this.id} started`),Ke(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((v()-this._startTs).toPrecision(10))}getDelta(){return Number((v()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,_.warn,arguments,Qe)}error(e){return this._getLogFunction(0,e,_.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,_.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,_.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,_.debug||_.info,arguments,Qe)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||C,n&&[n],{tag:Ft(t)}):C}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||C)}group(e,t,n={collapsed:!1}){let s=et({logLevel:e,message:t,opts:n}),{collapsed:o}=n;return s.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||C)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=tt(e)}_getLogFunction(e,t,n,s,o){if(this._shouldLog(e)){o=et({logLevel:e,message:t,args:s,opts:o}),n=n||o.method,$(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=v();let i=o.tag||o.message;if(o.once&&i)if(!Je[i])Je[i]=v();else return C;return t=$t(this.id,o.message,o),n.bind(console,t,...o.args)}return C}};T.VERSION=Te;function tt(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return $(Number.isFinite(e)&&e>=0),e}function et(r){let{logLevel:e,message:t}=r;r.logLevel=tt(e);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return $(s==="string"||s==="object"),Object.assign(r,{args:n},r.opts)}function $t(r,e,t){if(typeof e=="string"){let n=t.time?Xe(Ye(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=qe(e,t.color,t.background)}return e}function Ft(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var en=new T({id:"@probe.gl/log"});var f=new T({id:"luma.gl"});var Ae={};function L(r="id"){Ae[r]=Ae[r]||1;let e=Ae[r]++;return`${r}-${e}`}var c=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,n){if(!e)throw new Error("no device");this._device=e,this.props=Nt(t,n);let s=this.props.id!=="undefined"?this.props.id:L(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};a(c,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Nt(r,e){let t={...e};for(let n in r)r[n]!==void 0&&(t[n]=r[n]);return t}var F=class extends c{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let n={...t};(t.usage||0)&F.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(e,n,F.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}readSyncWebGL(e,t){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,t,n){let s=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:n,F.DEBUG_DATA_MAX_LENGTH);s===null?this.debugData=new ArrayBuffer(o):t===0&&n===s.byteLength?this.debugData=s.slice(0,o):this.debugData=s.slice(t,t+o)}},m=F;a(m,"defaultProps",{...c.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),a(m,"MAP_READ",1),a(m,"MAP_WRITE",2),a(m,"COPY_SRC",4),a(m,"COPY_DST",8),a(m,"INDEX",16),a(m,"VERTEX",32),a(m,"UNIFORM",64),a(m,"STORAGE",128),a(m,"INDIRECT",256),a(m,"QUERY_RESOLVE",512),a(m,"DEBUG_DATA_MAX_LENGTH",32);function ae(r){let e=rt[r],t=Ut(e),n=r.includes("norm"),s=!n&&!r.startsWith("float"),o=r.startsWith("s");return{dataType:rt[r],byteLength:t,integer:s,signed:o,normalized:n}}function Ut(r){return Ht[r]}var rt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ht={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var p="texture-compression-bc",d="texture-compression-astc",x="texture-compression-etc2",zt="texture-compression-etc1-webgl",ce="texture-compression-pvrtc-webgl",ve="texture-compression-atc-webgl",ue="float32-renderable-webgl",Ee="float16-renderable-webgl",kt="rgb9e5ufloat_renderable-webgl",Pe="snorm8-renderable-webgl",N="norm16-renderable-webgl",_e="snorm16-renderable-webgl",fe="float32-filterable",nt="float16-filterable-webgl",st={r8unorm:{bpp:1,c:1},r8snorm:{bpp:1,c:1,render:Pe},r8uint:{bpp:1,c:1},r8sint:{bpp:1,c:1},rg8unorm:{bpp:2,c:2},rg8snorm:{bpp:2,c:2,render:Pe},rg8uint:{bpp:2,c:2},rg8sint:{bpp:2,c:2},r16uint:{bpp:2,c:1},r16sint:{bpp:2,c:1},r16float:{bpp:2,c:1,render:Ee,filter:"float16-filterable-webgl"},"r16unorm-webgl":{b:2,c:1,f:N},"r16snorm-webgl":{b:2,c:1,f:_e},"rgba4unorm-webgl":{channels:"rgba",bpp:2,bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bpp:2,bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bpp:2,bitsPerChannel:[5,5,5,1],packed:!0},"rgb8unorm-webgl":{bpp:3,c:3,wgpu:!1},"rgb8snorm-webgl":{bpp:3,c:3,wgpu:!1},rgba8unorm:{c:2,bpp:4,bitsPerChannel:[8,8,8,8]},"rgba8unorm-srgb":{c:4,bpp:4,bitsPerChannel:[8,8,8,8]},rgba8snorm:{bpp:4,c:4,bitsPerChannel:[8,8,8,8],render:Pe},rgba8uint:{c:4,bpp:4,bitsPerChannel:[8,8,8,8]},rgba8sint:{c:4,bpp:4,bitsPerChannel:[8,8,8,8]},bgra8unorm:{bpp:4,c:4},"bgra8unorm-srgb":{bpp:4,c:4},rg16uint:{c:1,bpp:4},rg16sint:{c:2,bpp:4},rg16float:{c:2,bpp:4,render:Ee,filter:nt},"rg16unorm-webgl":{b:2,c:2,render:N},"rg16snorm-webgl":{b:2,c:2,render:_e},r32uint:{c:1,bpp:4},r32sint:{c:1,bpp:4},r32float:{c:1,bpp:4,render:ue,filter:fe},rgb9e5ufloat:{channels:"rgb",packed:!0,c:3,bpp:4,p:1,render:kt},rg11b10ufloat:{channels:"rgb",c:3,bpp:4,bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:ue},rgb10a2unorm:{channels:"rgba",c:4,bpp:4,bitsPerChannel:[10,10,10,2],packed:!0,p:1},"rgb10a2uint-webgl":{channels:"rgba",c:4,bpp:4,bitsPerChannel:[10,10,10,2],packed:!0,p:1,wgpu:!1},"rgb16unorm-webgl":{b:2,c:3,f:N},"rgb16snorm-webgl":{b:2,c:3,f:N},rg32uint:{bpp:8,c:2,bitsPerChannel:[32,32,0,0]},rg32sint:{bpp:8,c:2,bitsPerChannel:[32,32,0,0]},rg32float:{bpp:8,c:2,bitsPerChannel:[32,32,0,0],render:!1,filter:fe},rgba16uint:{bpp:8,c:4},rgba16sint:{bpp:8,c:4},rgba16float:{bpp:8,c:4,render:Ee,filter:nt},"rgba16unorm-webgl":{b:2,c:4,render:N},"rgba16snorm-webgl":{b:2,c:4,render:_e},"rgb32float-webgl":{render:ue,filter:fe},rgba32uint:{bpp:16,c:4},rgba32sint:{bpp:16,c:4},rgba32float:{bpp:16,c:4,render:ue,filter:fe},stencil8:{attachment:"stencil",c:1,bpp:1,components:1,bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",c:1,bpp:2,components:1,bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",c:1,bpp:3,components:1,bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",c:1,bpp:4,components:1,bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bpp:4,c:2,p:1,components:2,bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",components:2,c:2,bpp:5,bitsPerChannel:[32,8,0,0],packed:!0},"bc1-rgb-unorm-webgl":{f:p},"bc1-rgb-unorm-srgb-webgl":{f:p},"bc1-rgba-unorm":{f:p},"bc1-rgba-unorm-srgb":{f:p},"bc2-rgba-unorm":{f:p},"bc2-rgba-unorm-srgb":{f:p},"bc3-rgba-unorm":{f:p},"bc3-rgba-unorm-srgb":{f:p},"bc4-r-unorm":{f:p},"bc4-r-snorm":{f:p},"bc5-rg-unorm":{f:p},"bc5-rg-snorm":{f:p},"bc6h-rgb-ufloat":{f:p},"bc6h-rgb-float":{f:p},"bc7-rgba-unorm":{f:p},"bc7-rgba-unorm-srgb":{f:p},"etc2-rgb8unorm":{f:x},"etc2-rgb8unorm-srgb":{f:x},"etc2-rgb8a1unorm":{f:x},"etc2-rgb8a1unorm-srgb":{f:x},"etc2-rgba8unorm":{f:x},"etc2-rgba8unorm-srgb":{f:x},"eac-r11unorm":{f:x},"eac-r11snorm":{f:x},"eac-rg11unorm":{f:x},"eac-rg11snorm":{f:x},"astc-4x4-unorm":{f:d},"astc-4x4-unorm-srgb":{f:d},"astc-5x4-unorm":{f:d},"astc-5x4-unorm-srgb":{f:d},"astc-5x5-unorm":{f:d},"astc-5x5-unorm-srgb":{f:d},"astc-6x5-unorm":{f:d},"astc-6x5-unorm-srgb":{f:d},"astc-6x6-unorm":{f:d},"astc-6x6-unorm-srgb":{f:d},"astc-8x5-unorm":{f:d},"astc-8x5-unorm-srgb":{f:d},"astc-8x6-unorm":{f:d},"astc-8x6-unorm-srgb":{f:d},"astc-8x8-unorm":{f:d},"astc-8x8-unorm-srgb":{f:d},"astc-10x5-unorm":{f:d},"astc-10x5-unorm-srgb":{f:d},"astc-10x6-unorm":{f:d},"astc-10x6-unorm-srgb":{f:d},"astc-10x8-unorm":{f:d},"astc-10x8-unorm-srgb":{f:d},"astc-10x10-unorm":{f:d},"astc-10x10-unorm-srgb":{f:d},"astc-12x10-unorm":{f:d},"astc-12x10-unorm-srgb":{f:d},"astc-12x12-unorm":{f:d},"astc-12x12-unorm-srgb":{f:d},"pvrtc-rgb4unorm-webgl":{f:ce},"pvrtc-rgba4unorm-webgl":{f:ce},"pvrtc-rbg2unorm-webgl":{f:ce},"pvrtc-rgba2unorm-webgl":{f:ce},"etc1-rbg-unorm-webgl":{f:zt},"atc-rgb-unorm-webgl":{f:ve},"atc-rgba-unorm-webgl":{f:ve},"atc-rgbai-unorm-webgl":{f:ve}};var Gt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Vt=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function Ce(r){return Gt.some(e=>r.startsWith(e))}function ot(r){if(Ce(r))return Wt(r);let e=Vt.exec(r);if(!e)return Ot(r);let[,t,n,s,o,i]=e,u=`${s}${n}`,l=ae(u),b=l.byteLength*8,g=t.length,S=[b,g>=2?b:0,g>=3?b:0,g>=4?b:0],we={format:r,channels:t,components:g,bitsPerChannel:S,bytesPerPixel:l.byteLength*t.length,dataType:l.dataType,integer:l.integer,signed:l.signed,normalized:l.normalized};return i==="-webgl"&&(we.webgl=!0),o==="-srgb"&&(we.srgb=!0),we}function Wt(r){let e={channels:"rgb",components:3,bytesPerPixel:1,srgb:!1,compressed:!0},t=jt(r);return t&&(e.blockWidth=t.blockWidth,e.blockHeight=t.blockHeight),e}function Ot(r){let e=st[r];if(!e)throw new Error(`Unknown format ${r}`);let t={...e,channels:e.channels||"",components:e.components||e.channels?.length||1,bytesPerPixel:e.bytesPerPixel||1,srgb:!1};return e.packed&&(t.packed=e.packed),t}function jt(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,n,s]=t;return{blockWidth:Number(n),blockHeight:Number(s)}}return null}var le=class{},de=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},Le=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...Le.defaultProps,...e},this.id=this.props.id||L(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=se;timestamp=0;_lumaData={};isTextureFormatCompressed(e){return Ce(e)}loseDevice(){return!1}error(e){this.props.onError(e)}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(e={}){throw new Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};return(e.usage||0)&m.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":f.warn("indices buffer content must be of integer type")()),t}},E=Le;a(E,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:e=>f.error(e.message),_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:f.get("debug")||void 0,debugShaders:f.get("debug-shaders")||void 0,debugFramebuffers:Boolean(f.get("debug-framebuffers")),debugWebGL:Boolean(f.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0});var Yt=y()&&typeof document<"u",Xt=()=>Yt&&document.readyState==="complete",Zt="set luma.log.level=1 (or higher) to trace rendering",it="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",M=class{stats=se;log=f;VERSION="9.1.0-alpha.17";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw f.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),f.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");f.error("This version of luma.gl has already been initialized")()}f.log(1,`${this.VERSION} - ${Zt}`)(),globalThis.luma=this}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this.getAdapterMap(e);return Array.from(t).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapter(e=[]){let t=this.getAdapterMap(e);return t.get("webgpu")?.isSupported?.()?"webgpu":t.get("webgl")?.isSupported?.()?"webgl":null}setDefaultDeviceProps(e){Object.assign(M.defaultProps,e)}async createDevice(e={}){e={...M.defaultProps,...e},e.waitForPageLoad&&await M.pageLoaded;let t=this.getAdapterMap(e.adapters),n=e.type||"";n==="best-available"&&(n=this.getBestAvailableAdapter(e.adapters)||n);let i=await(this.getAdapterMap(e.adapters)||t).get(n)?.create?.(e);if(i)return i;throw new Error(it)}async attachDevice(e){let t=this.getAdapterMap(e.adapters),n="";e.handle instanceof WebGL2RenderingContext&&(n="webgl"),e.createCanvasContext&&await M.pageLoaded,e.handle===null&&(n="unknown");let o=await t.get(n)?.attach?.(null);if(o)return o;throw new Error(it)}enforceWebGL2(e=!0,t=[]){let s=this.getAdapterMap(t).get("webgl");s||f.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let n of e)t.set(n.type,n);return t}registerDevices(e){f.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(let t of e){let n=t.adapter;n&&this.preregisteredAdapters.set(n.type,n)}}},U=M;a(U,"defaultProps",{...E.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0}),a(U,"pageLoaded",qt().then(()=>{f.probe(2,"DOM is loaded")()}));var at=new U;function qt(){return Xt()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}var me=class{};var Me=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};constructor(e){if(this.props={...Me.defaultProps,...e},e=this.props,!y()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Jt(e.canvas):this.canvas=e.canvas;else{let t=Qt(e),n=Kt(e?.container||null);n.insertBefore(t,n.firstChild),this.canvas=t,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(t=>{for(let n of t)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),t=this.canvas;return t.parentElement?[t.clientWidth*e,t.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,t]=this.getPixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:t}=this._canvasSizeInfo;return t?e/t:1}catch{return 1}}cssToDevicePixels(e,t=!0){let n=this.cssToDeviceRatio(),[s,o]=this.getDrawingBufferSize();return er(e,n,s,o,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let n="width"in t?t.width:this.htmlCanvas.clientWidth,s="height"in t?t.height:this.htmlCanvas.clientHeight;(!n||!s)&&(f.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,n=this.htmlCanvas.width||1,s=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==n||o.clientHeight!==s||o.devicePixelRatio!==e){let i=e,u=Math.floor(n*i),l=Math.floor(s*i);if(this.htmlCanvas.width=u,this.htmlCanvas.height=l,this.device.gl){let[g,S]=this.getDrawingBufferSize();(g!==u||S!==l)&&(i=Math.min(g/n,S/s),this.htmlCanvas.width=Math.floor(n*i),this.htmlCanvas.height=Math.floor(s*i),f.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=s,this._canvasSizeInfo.devicePixelRatio=e}}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}},H=Me;a(H,"defaultProps",{canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"});function Kt(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}else if(r)return r;return document.body}function Jt(r){let e=document.getElementById(r);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function Qt(r){let{width:e,height:t}=r,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=e||1,n.height=t||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(t)?`${t}px`:"100%",n}function er(r,e,t,n,s){let o=r,i=ct(o[0],e,t),u=ut(o[1],e,n,s),l=ct(o[0]+1,e,t),b=l===t-1?l:l-1;l=ut(o[1]+1,e,n,s);let g;return s?(l=l===0?l:l+1,g=u,u=l):g=l===n-1?l:l-1,{x:i,y:u,width:Math.max(b-i+1,1),height:Math.max(g-u+1,1)}}function ct(r,e,t){return Math.min(Math.round(r*e),t-1)}function ut(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var w=class extends c{get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}dimension;format;width;height;depth;mipLevels;updateTimestamp;constructor(e,t){if(t=w.normalizeProps(e,t),super(e,t,w.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.props.width===void 0||this.props.height===void 0){let n=w.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?w.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}static isExternalImage(e){return typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof VideoFrame<"u"&&e instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}static getExternalImageSize(e){if(typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if(typeof VideoFrame<"u"&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(e){let t=e?.data;return ArrayBuffer.isView(t)}static getTextureDataSize(e){if(!e||ArrayBuffer.isView(e))return null;if(Array.isArray(e))return w.getTextureDataSize(e[0]);if(w.isExternalImage(e))return w.getExternalImageSize(e);if(e&&typeof e=="object"&&e.constructor===Object){let n=Object.values(e)[0];return{width:n.width,height:n.height}}throw new Error("texture size deduction failed")}static normalizeTextureData(e,t){let n;return ArrayBuffer.isView(e)?n=[{data:e,width:t.width,height:t.height}]:Array.isArray(e)?n=e:n=[e],n}static getMipLevelCount(e,t){return Math.floor(Math.log2(Math.max(e,t)))+1}static getCubeFaceDepth(e){switch(e){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(e)}}static normalizeProps(e,t){let n={...t},s=e?.props?._resourceDefaults?.texture||{};Object.assign(n,s);let{width:o,height:i}=n;return typeof o=="number"&&(n.width=Math.max(1,Math.ceil(o))),typeof i=="number"&&(n.height=Math.max(1,Math.ceil(i))),n}},h=w;a(h,"COPY_SRC",1),a(h,"COPY_DST",2),a(h,"TEXTURE",4),a(h,"STORAGE",8),a(h,"RENDER_ATTACHMENT",16),a(h,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),a(h,"defaultProps",{...c.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0}),a(h,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1});var Be=class extends c{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,Be.defaultProps)}},z=Be;a(z,"defaultProps",{...c.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Re=class extends c{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,Re.defaultProps)}},k=Re;a(k,"defaultProps",{...c.defaultProps,source:void 0,colorSpace:"srgb"});function lt(r,e,t){let n="",s=e.split(/\r?\n/),o=r.slice().sort((i,u)=>i.lineNum-u.lineNum);switch(t?.showSourceCode||"no"){case"all":let i=0;for(let u=1;u<=s.length;u++)for(n+=dt(s[u-1],u,t);o.length>i&&o[i].lineNum===u;){let l=o[i++];n+=ft(l,s,l.lineNum,{...t,inlineSource:!1})}return n;case"issues":case"no":for(let u of r)n+=ft(u,s,u.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function ft(r,e,t,n){if(n?.inlineSource){let o=tr(e,t),i=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^ | ||
"use strict";var __exports__=(()=>{var re=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var vt=Object.getOwnPropertyNames;var Et=Object.prototype.hasOwnProperty;var Ct=(r,e,t)=>e in r?re(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Pt=(r,e)=>{for(var t in e)re(r,t,{get:e[t],enumerable:!0})},_t=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of vt(e))!Et.call(r,s)&&s!==t&&re(r,s,{get:()=>e[s],enumerable:!(n=At(e,s))||n.enumerable});return r};var Lt=r=>_t(re({},"__esModule",{value:!0}),r);var a=(r,e,t)=>(Ct(r,typeof e!="symbol"?e+"":e,t),t);var br={};Pt(br,{Adapter:()=>he,Buffer:()=>m,CanvasContext:()=>k,CommandBuffer:()=>K,CommandEncoder:()=>q,ComputePass:()=>Z,ComputePipeline:()=>X,Device:()=>C,DeviceFeatures:()=>me,DeviceLimits:()=>de,ExternalTexture:()=>V,Framebuffer:()=>j,QuerySet:()=>te,RenderPass:()=>T,RenderPipeline:()=>Y,Resource:()=>c,Sampler:()=>O,Shader:()=>W,Texture:()=>h,TextureView:()=>G,TransformFeedback:()=>ee,UniformBlock:()=>$,UniformBufferLayout:()=>D,UniformStore:()=>xe,VertexArray:()=>Q,_BufferLayoutHelper:()=>we,decodeShaderAttributeType:()=>ge,decodeShaderUniformType:()=>be,decodeTextureFormat:()=>it,decodeVertexFormat:()=>J,getAttributeInfosFromLayouts:()=>ke,getDataTypeFromTypedArray:()=>je,getScratchArray:()=>bt,getTypedArrayFromDataType:()=>St,getVertexFormatFromAttribute:()=>Tt,log:()=>f,luma:()=>ct});var ne=globalThis,Bt=globalThis.document||{},se=globalThis.process||{},Mt=globalThis.console,xr=globalThis.navigator||{};function Ye(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function y(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ye()}var Te="4.0.7";function F(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var v=class{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=F(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(F()-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(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:n}=e,s=this.stats[t];return s||(e instanceof v?s=e:s=new v(t,n),this.stats[t]=s),s}};var Ae=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new _({id:e})),this.stats.get(e)}},oe=new Ae;function It(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var ie=class{constructor(e,t,n="sessionStorage"){this.storage=It(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function Xe(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Ze(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var ae;(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"})(ae||(ae={}));var Dt=10;function qe(r){return typeof r!="string"?r:(r=r.toUpperCase(),ae[r]||ae.WHITE)}function Ke(r,e,t){return!y&&typeof r=="string"&&(e&&(r=`\x1B[${qe(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${qe(t)+Dt}m${r}\x1B[49m`)),r}function Je(r,e=["constructor"]){let t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),s=r;for(let o of n){let i=s[o];typeof i=="function"&&(e.find(u=>o===u)||(s[o]=i.bind(r)))}}function N(r,e){if(!r)throw new Error(e||"Assertion failed")}function E(){let r;if(y()&&ne.performance)r=ne?.performance?.now?.();else if("hrtime"in se){let e=se?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var L={debug:y()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},$t={enabled:!0,level:0};function B(){}var Qe={},et={once:!0},S=class{constructor({id:e}={id:""}){this.VERSION=Te,this._startTs=E(),this._deltaTs=E(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new ie(`__probe-${this.id}__`,$t),this.timeStamp(`${this.id} started`),Je(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((E()-this._startTs).toPrecision(10))}getDelta(){return Number((E()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,L.warn,arguments,et)}error(e){return this._getLogFunction(0,e,L.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,L.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,L.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,L.debug||L.info,arguments,et)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||B,n&&[n],{tag:Nt(t)}):B}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||B)}group(e,t,n={collapsed:!1}){let s=tt({logLevel:e,message:t,opts:n}),{collapsed:o}=n;return s.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||B)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=rt(e)}_getLogFunction(e,t,n,s,o){if(this._shouldLog(e)){o=tt({logLevel:e,message:t,args:s,opts:o}),n=n||o.method,N(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=E();let i=o.tag||o.message;if(o.once&&i)if(!Qe[i])Qe[i]=E();else return B;return t=Ft(this.id,o.message,o),n.bind(console,t,...o.args)}return B}};S.VERSION=Te;function rt(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return N(Number.isFinite(e)&&e>=0),e}function tt(r){let{logLevel:e,message:t}=r;r.logLevel=rt(e);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return N(s==="string"||s==="object"),Object.assign(r,{args:n},r.opts)}function Ft(r,e,t){if(typeof e=="string"){let n=t.time?Ze(Xe(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=Ke(e,t.color,t.background)}return e}function Nt(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var tn=new S({id:"@probe.gl/log"});var f=new S({id:"luma.gl"});var ve={};function M(r="id"){ve[r]=ve[r]||1;let e=ve[r]++;return`${r}-${e}`}var c=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,n){if(!e)throw new Error("no device");this._device=e,this.props=Ut(t,n);let s=this.props.id!=="undefined"?this.props.id:M(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};a(c,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ut(r,e){let t={...e};for(let n in r)r[n]!==void 0&&(t[n]=r[n]);return t}var U=class extends c{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let n={...t};(t.usage||0)&U.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(e,n,U.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}readSyncWebGL(e,t){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,t,n){let s=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:n,U.DEBUG_DATA_MAX_LENGTH);s===null?this.debugData=new ArrayBuffer(o):t===0&&n===s.byteLength?this.debugData=s.slice(0,o):this.debugData=s.slice(t,t+o)}},m=U;a(m,"defaultProps",{...c.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),a(m,"MAP_READ",1),a(m,"MAP_WRITE",2),a(m,"COPY_SRC",4),a(m,"COPY_DST",8),a(m,"INDEX",16),a(m,"VERTEX",32),a(m,"UNIFORM",64),a(m,"STORAGE",128),a(m,"INDIRECT",256),a(m,"QUERY_RESOLVE",512),a(m,"DEBUG_DATA_MAX_LENGTH",32);function ce(r){let e=nt[r],t=Ht(e),n=r.includes("norm"),s=!n&&!r.startsWith("float"),o=r.startsWith("s");return{dataType:nt[r],byteLength:t,integer:s,signed:o,normalized:n}}function Ht(r){return zt[r]}var nt={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},zt={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var p="texture-compression-bc",d="texture-compression-astc",x="texture-compression-etc2",kt="texture-compression-etc1-webgl",ue="texture-compression-pvrtc-webgl",Ee="texture-compression-atc-webgl",fe="float32-renderable-webgl",Ce="float16-renderable-webgl",Gt="rgb9e5ufloat_renderable-webgl",Pe="snorm8-renderable-webgl",H="norm16-renderable-webgl",_e="snorm16-renderable-webgl",le="float32-filterable",st="float16-filterable-webgl",ot={r8unorm:{bpp:1,c:1},r8snorm:{bpp:1,c:1,render:Pe},r8uint:{bpp:1,c:1},r8sint:{bpp:1,c:1},rg8unorm:{bpp:2,c:2},rg8snorm:{bpp:2,c:2,render:Pe},rg8uint:{bpp:2,c:2},rg8sint:{bpp:2,c:2},r16uint:{bpp:2,c:1},r16sint:{bpp:2,c:1},r16float:{bpp:2,c:1,render:Ce,filter:"float16-filterable-webgl"},"r16unorm-webgl":{b:2,c:1,f:H},"r16snorm-webgl":{b:2,c:1,f:_e},"rgba4unorm-webgl":{channels:"rgba",bpp:2,bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bpp:2,bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bpp:2,bitsPerChannel:[5,5,5,1],packed:!0},"rgb8unorm-webgl":{bpp:3,c:3,wgpu:!1},"rgb8snorm-webgl":{bpp:3,c:3,wgpu:!1},rgba8unorm:{c:2,bpp:4,bitsPerChannel:[8,8,8,8]},"rgba8unorm-srgb":{c:4,bpp:4,bitsPerChannel:[8,8,8,8]},rgba8snorm:{bpp:4,c:4,bitsPerChannel:[8,8,8,8],render:Pe},rgba8uint:{c:4,bpp:4,bitsPerChannel:[8,8,8,8]},rgba8sint:{c:4,bpp:4,bitsPerChannel:[8,8,8,8]},bgra8unorm:{bpp:4,c:4},"bgra8unorm-srgb":{bpp:4,c:4},rg16uint:{c:1,bpp:4},rg16sint:{c:2,bpp:4},rg16float:{c:2,bpp:4,render:Ce,filter:st},"rg16unorm-webgl":{b:2,c:2,render:H},"rg16snorm-webgl":{b:2,c:2,render:_e},r32uint:{c:1,bpp:4},r32sint:{c:1,bpp:4},r32float:{c:1,bpp:4,render:fe,filter:le},rgb9e5ufloat:{channels:"rgb",packed:!0,c:3,bpp:4,p:1,render:Gt},rg11b10ufloat:{channels:"rgb",c:3,bpp:4,bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:fe},rgb10a2unorm:{channels:"rgba",c:4,bpp:4,bitsPerChannel:[10,10,10,2],packed:!0,p:1},"rgb10a2uint-webgl":{channels:"rgba",c:4,bpp:4,bitsPerChannel:[10,10,10,2],packed:!0,p:1,wgpu:!1},"rgb16unorm-webgl":{b:2,c:3,f:H},"rgb16snorm-webgl":{b:2,c:3,f:H},rg32uint:{bpp:8,c:2,bitsPerChannel:[32,32,0,0]},rg32sint:{bpp:8,c:2,bitsPerChannel:[32,32,0,0]},rg32float:{bpp:8,c:2,bitsPerChannel:[32,32,0,0],render:!1,filter:le},rgba16uint:{bpp:8,c:4},rgba16sint:{bpp:8,c:4},rgba16float:{bpp:8,c:4,render:Ce,filter:st},"rgba16unorm-webgl":{b:2,c:4,render:H},"rgba16snorm-webgl":{b:2,c:4,render:_e},"rgb32float-webgl":{render:fe,filter:le},rgba32uint:{bpp:16,c:4},rgba32sint:{bpp:16,c:4},rgba32float:{bpp:16,c:4,render:fe,filter:le},stencil8:{attachment:"stencil",c:1,bpp:1,components:1,bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",c:1,bpp:2,components:1,bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",c:1,bpp:3,components:1,bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",c:1,bpp:4,components:1,bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bpp:4,c:2,p:1,components:2,bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",components:2,c:2,bpp:5,bitsPerChannel:[32,8,0,0],packed:!0},"bc1-rgb-unorm-webgl":{f:p},"bc1-rgb-unorm-srgb-webgl":{f:p},"bc1-rgba-unorm":{f:p},"bc1-rgba-unorm-srgb":{f:p},"bc2-rgba-unorm":{f:p},"bc2-rgba-unorm-srgb":{f:p},"bc3-rgba-unorm":{f:p},"bc3-rgba-unorm-srgb":{f:p},"bc4-r-unorm":{f:p},"bc4-r-snorm":{f:p},"bc5-rg-unorm":{f:p},"bc5-rg-snorm":{f:p},"bc6h-rgb-ufloat":{f:p},"bc6h-rgb-float":{f:p},"bc7-rgba-unorm":{f:p},"bc7-rgba-unorm-srgb":{f:p},"etc2-rgb8unorm":{f:x},"etc2-rgb8unorm-srgb":{f:x},"etc2-rgb8a1unorm":{f:x},"etc2-rgb8a1unorm-srgb":{f:x},"etc2-rgba8unorm":{f:x},"etc2-rgba8unorm-srgb":{f:x},"eac-r11unorm":{f:x},"eac-r11snorm":{f:x},"eac-rg11unorm":{f:x},"eac-rg11snorm":{f:x},"astc-4x4-unorm":{f:d},"astc-4x4-unorm-srgb":{f:d},"astc-5x4-unorm":{f:d},"astc-5x4-unorm-srgb":{f:d},"astc-5x5-unorm":{f:d},"astc-5x5-unorm-srgb":{f:d},"astc-6x5-unorm":{f:d},"astc-6x5-unorm-srgb":{f:d},"astc-6x6-unorm":{f:d},"astc-6x6-unorm-srgb":{f:d},"astc-8x5-unorm":{f:d},"astc-8x5-unorm-srgb":{f:d},"astc-8x6-unorm":{f:d},"astc-8x6-unorm-srgb":{f:d},"astc-8x8-unorm":{f:d},"astc-8x8-unorm-srgb":{f:d},"astc-10x5-unorm":{f:d},"astc-10x5-unorm-srgb":{f:d},"astc-10x6-unorm":{f:d},"astc-10x6-unorm-srgb":{f:d},"astc-10x8-unorm":{f:d},"astc-10x8-unorm-srgb":{f:d},"astc-10x10-unorm":{f:d},"astc-10x10-unorm-srgb":{f:d},"astc-12x10-unorm":{f:d},"astc-12x10-unorm-srgb":{f:d},"astc-12x12-unorm":{f:d},"astc-12x12-unorm-srgb":{f:d},"pvrtc-rgb4unorm-webgl":{f:ue},"pvrtc-rgba4unorm-webgl":{f:ue},"pvrtc-rbg2unorm-webgl":{f:ue},"pvrtc-rgba2unorm-webgl":{f:ue},"etc1-rbg-unorm-webgl":{f:kt},"atc-rgb-unorm-webgl":{f:Ee},"atc-rgba-unorm-webgl":{f:Ee},"atc-rgbai-unorm-webgl":{f:Ee}};var Vt=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Wt=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function Le(r){return Vt.some(e=>r.startsWith(e))}function it(r){if(Le(r))return Ot(r);let e=Wt.exec(r);if(!e)return jt(r);let[,t,n,s,o,i]=e,u=`${s}${n}`,l=ce(u),b=l.byteLength*8,g=t.length,A=[b,g>=2?b:0,g>=3?b:0,g>=4?b:0],Se={format:r,channels:t,components:g,bitsPerChannel:A,bytesPerPixel:l.byteLength*t.length,dataType:l.dataType,integer:l.integer,signed:l.signed,normalized:l.normalized};return i==="-webgl"&&(Se.webgl=!0),o==="-srgb"&&(Se.srgb=!0),Se}function Ot(r){let e={channels:"rgb",components:3,bytesPerPixel:1,srgb:!1,compressed:!0},t=Yt(r);return t&&(e.blockWidth=t.blockWidth,e.blockHeight=t.blockHeight),e}function jt(r){let e=ot[r];if(!e)throw new Error(`Unknown format ${r}`);let t={...e,channels:e.channels||"",components:e.components||e.channels?.length||1,bytesPerPixel:e.bytesPerPixel||1,srgb:!1};return e.packed&&(t.packed=e.packed),t}function Yt(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,n,s]=t;return{blockWidth:Number(n),blockHeight:Number(s)}}return null}var de=class{},me=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},Be=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...Be.defaultProps,...e},this.id=this.props.id||M(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=oe;timestamp=0;_lumaData={};isTextureFormatCompressed(e){return Le(e)}loseDevice(){return!1}error(e){this.props.onError(e)}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(e={}){throw new Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};return(e.usage||0)&m.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":f.warn("indices buffer content must be of integer type")()),t}},C=Be;a(C,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:e=>f.error(e.message),_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:f.get("debug")||void 0,debugShaders:f.get("debug-shaders")||void 0,debugFramebuffers:Boolean(f.get("debug-framebuffers")),debugWebGL:Boolean(f.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0});var Xt=y()&&typeof document<"u",Zt=()=>Xt&&document.readyState==="complete",qt="set luma.log.level=1 (or higher) to trace rendering",at="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",R=class{stats=oe;log=f;VERSION="9.1.0-alpha.18";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw f.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),f.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");f.error("This version of luma.gl has already been initialized")()}f.log(1,`${this.VERSION} - ${qt}`)(),globalThis.luma=this}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this.getAdapterMap(e);return Array.from(t).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapter(e=[]){let t=this.getAdapterMap(e);return t.get("webgpu")?.isSupported?.()?"webgpu":t.get("webgl")?.isSupported?.()?"webgl":null}setDefaultDeviceProps(e){Object.assign(R.defaultProps,e)}async createDevice(e={}){e={...R.defaultProps,...e},e.waitForPageLoad&&await R.pageLoaded;let t=this.getAdapterMap(e.adapters),n=e.type||"";n==="best-available"&&(n=this.getBestAvailableAdapter(e.adapters)||n);let i=await(this.getAdapterMap(e.adapters)||t).get(n)?.create?.(e);if(i)return i;throw new Error(at)}async attachDevice(e){let t=this.getAdapterMap(e.adapters),n="";e.handle instanceof WebGL2RenderingContext&&(n="webgl"),e.createCanvasContext&&await R.pageLoaded,e.handle===null&&(n="unknown");let o=await t.get(n)?.attach?.(null);if(o)return o;throw new Error(at)}enforceWebGL2(e=!0,t=[]){let s=this.getAdapterMap(t).get("webgl");s||f.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let n of e)t.set(n.type,n);return t}registerDevices(e){f.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(let t of e){let n=t.adapter;n&&this.preregisteredAdapters.set(n.type,n)}}},z=R;a(z,"defaultProps",{...C.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0}),a(z,"pageLoaded",Kt().then(()=>{f.probe(2,"DOM is loaded")()}));var ct=new z;function Kt(){return Zt()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}var he=class{};var Me=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};constructor(e){if(this.props={...Me.defaultProps,...e},e=this.props,!y()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Qt(e.canvas):this.canvas=e.canvas;else{let t=er(e),n=Jt(e?.container||null);n.insertBefore(t,n.firstChild),this.canvas=t,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(t=>{for(let n of t)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),t=this.canvas;return t.parentElement?[t.clientWidth*e,t.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,t]=this.getPixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:t}=this._canvasSizeInfo;return t?e/t:1}catch{return 1}}cssToDevicePixels(e,t=!0){let n=this.cssToDeviceRatio(),[s,o]=this.getDrawingBufferSize();return tr(e,n,s,o,t)}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let n="width"in t?t.width:this.htmlCanvas.clientWidth,s="height"in t?t.height:this.htmlCanvas.clientHeight;(!n||!s)&&(f.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,n=this.htmlCanvas.width||1,s=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==n||o.clientHeight!==s||o.devicePixelRatio!==e){let i=e,u=Math.floor(n*i),l=Math.floor(s*i);if(this.htmlCanvas.width=u,this.htmlCanvas.height=l,this.device.gl){let[g,A]=this.getDrawingBufferSize();(g!==u||A!==l)&&(i=Math.min(g/n,A/s),this.htmlCanvas.width=Math.floor(n*i),this.htmlCanvas.height=Math.floor(s*i),f.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=s,this._canvasSizeInfo.devicePixelRatio=e}}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}},k=Me;a(k,"defaultProps",{canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"});function Jt(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}else if(r)return r;return document.body}function Qt(r){let e=document.getElementById(r);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function er(r){let{width:e,height:t}=r,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=e||1,n.height=t||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(t)?`${t}px`:"100%",n}function tr(r,e,t,n,s){let o=r,i=ut(o[0],e,t),u=ft(o[1],e,n,s),l=ut(o[0]+1,e,t),b=l===t-1?l:l-1;l=ft(o[1]+1,e,n,s);let g;return s?(l=l===0?l:l+1,g=u,u=l):g=l===n-1?l:l-1,{x:i,y:u,width:Math.max(b-i+1,1),height:Math.max(g-u+1,1)}}function ut(r,e,t){return Math.min(Math.round(r*e),t-1)}function ft(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var w=class extends c{get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}dimension;format;width;height;depth;mipLevels;updateTimestamp;constructor(e,t){if(t=w.normalizeProps(e,t),super(e,t,w.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.props.width===void 0||this.props.height===void 0){let n=w.getTextureDataSize(this.props.data);this.width=n?.width||1,this.height=n?.height||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?w.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}static isExternalImage(e){return typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof VideoFrame<"u"&&e instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}static getExternalImageSize(e){if(typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if(typeof VideoFrame<"u"&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(e){let t=e?.data;return ArrayBuffer.isView(t)}static getTextureDataSize(e){if(!e||ArrayBuffer.isView(e))return null;if(Array.isArray(e))return w.getTextureDataSize(e[0]);if(w.isExternalImage(e))return w.getExternalImageSize(e);if(e&&typeof e=="object"&&e.constructor===Object){let n=Object.values(e)[0];return{width:n.width,height:n.height}}throw new Error("texture size deduction failed")}static normalizeTextureData(e,t){let n;return ArrayBuffer.isView(e)?n=[{data:e,width:t.width,height:t.height}]:Array.isArray(e)?n=e:n=[e],n}static getMipLevelCount(e,t){return Math.floor(Math.log2(Math.max(e,t)))+1}static getCubeFaceDepth(e){switch(e){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(e)}}static normalizeProps(e,t){let n={...t},s=e?.props?._resourceDefaults?.texture||{};Object.assign(n,s);let{width:o,height:i}=n;return typeof o=="number"&&(n.width=Math.max(1,Math.ceil(o))),typeof i=="number"&&(n.height=Math.max(1,Math.ceil(i))),n}},h=w;a(h,"COPY_SRC",1),a(h,"COPY_DST",2),a(h,"TEXTURE",4),a(h,"STORAGE",8),a(h,"RENDER_ATTACHMENT",16),a(h,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),a(h,"defaultProps",{...c.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0}),a(h,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1});var Re=class extends c{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,Re.defaultProps)}},G=Re;a(G,"defaultProps",{...c.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Ie=class extends c{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,Ie.defaultProps)}},V=Ie;a(V,"defaultProps",{...c.defaultProps,source:void 0,colorSpace:"srgb"});function dt(r,e,t){let n="",s=e.split(/\r?\n/),o=r.slice().sort((i,u)=>i.lineNum-u.lineNum);switch(t?.showSourceCode||"no"){case"all":let i=0;for(let u=1;u<=s.length;u++)for(n+=mt(s[u-1],u,t);o.length>i&&o[i].lineNum===u;){let l=o[i++];n+=lt(l,s,l.lineNum,{...t,inlineSource:!1})}return n;case"issues":case"no":for(let u of r)n+=lt(u,s,u.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function lt(r,e,t,n){if(n?.inlineSource){let o=rr(e,t),i=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^ | ||
`:"";return` | ||
${o}${i}${r.type.toUpperCase()}: ${r.message} | ||
`}let s=r.type==="error"?"red":"#8B4000";return n?.html?`<div class='luma-compiler-log-error' style="color:${s};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function tr(r,e,t){let n="";for(let s=e-2;s<=e;s++){let o=r[s-1];o!==void 0&&(n+=dt(o,e,t))}return n}function dt(r,e,t){let n=t?.html?nr(r):r;return`${rr(String(e),4)}: ${n}${t?.html?"<br/>":` | ||
`}`}function rr(r,e){let t="";for(let n=r.length;n<e;++n)t+=" ";return t+r}function nr(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var Ie=class extends c{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:sr(t),...t},Ie.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let t=mt(this.source),n=`${this.stage} ${t}`,s=lt(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(s+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let i=document.createElement("Button");i.innerHTML=` | ||
`}let s=r.type==="error"?"red":"#8B4000";return n?.html?`<div class='luma-compiler-log-error' style="color:${s};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function rr(r,e,t){let n="";for(let s=e-2;s<=e;s++){let o=r[s-1];o!==void 0&&(n+=mt(o,e,t))}return n}function mt(r,e,t){let n=t?.html?sr(r):r;return`${nr(String(e),4)}: ${n}${t?.html?"<br/>":` | ||
`}`}function nr(r,e){let t="";for(let n=r.length;n<e;++n)t+=" ";return t+r}function sr(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var De=class extends c{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:or(t),...t},De.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let t=ht(this.source),n=`${this.stage} ${t}`,s=dt(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(s+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let i=document.createElement("Button");i.innerHTML=` | ||
<h1>Shader Compilation Error in ${n}</h1><br /><br /> | ||
<code style="user-select:text;"><pre> | ||
${s} | ||
</pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),i.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},G=Ie;a(G,"defaultProps",{...c.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function sr(r){return mt(r.source)||r.id||L(`unnamed ${r.stage}-shader`)}function mt(r,e="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return n?n[1]:e}var he=class extends c{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=he.normalizeProps(e,t),super(e,t,he.defaultProps)}static normalizeProps(e,t){let n=e?.props?._resourceDefaults?.sampler||{};return{...t,...n}}},V=he;a(V,"defaultProps",{...c.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var De=class extends c{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,De.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(s=>s.texture.clone(e)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:n})}resize(e){let t=!e;if(e){let[n,s]=Array.isArray(e)?e:[e.width,e.height];t=t||s!==this.height||n!==this.width,this.width=n,this.height=s}t&&(f.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((t,n)=>{if(typeof t=="string"){let s=this.createColorTexture(t,n);return this.attachResource(s),s.view}return t instanceof h?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof h?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:h.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:h.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,t){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let s=this.colorAttachments[n].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=s.view,this.attachResource(s.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},W=De;a(W,"defaultProps",{...c.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var $e=class extends c{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,$e.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},O=$e;a(O,"defaultProps",{...c.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var pe=class extends c{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=pe.normalizeProps(e,t),super(e,t,pe.defaultProps)}static normalizeProps(e,t){return{...e.props._resourceDefaults?.renderPass,...t}}},j=pe;a(j,"defaultProps",{...c.defaultProps,framebuffer:null,parameters:void 0,clearColor:!1,clearColors:void 0,clearDepth:!1,clearStencil:!1,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Fe=class extends c{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Fe.defaultProps),this.shaderLayout=t.shaderLayout}},Y=Fe;a(Y,"defaultProps",{...c.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Ne=class extends c{get[Symbol.toStringTag](){return"ComputePass"}constructor(e,t){super(e,t,Ne.defaultProps)}},X=Ne;a(X,"defaultProps",{...c.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ue=class extends c{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,Ue.defaultProps)}},Z=Ue;a(Z,"defaultProps",{...c.defaultProps,measureExecutionTime:void 0});var He=class extends c{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,He.defaultProps)}},q=He;a(q,"defaultProps",{...c.defaultProps});function ge(r){let[e,t]=ir[r],n=e==="i32"||e==="u32",s=e!=="u32",o=ar[e]*t,i=or(e,t);return{dataType:e,components:t,defaultVertexFormat:i,byteLength:o,integer:n,signed:s}}function or(r,e){let t;switch(r){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?t:`${t}x${e}`}var ir={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},ar={f32:4,f16:2,i32:4,u32:4};function K(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,n]=r.split("x"),s=t,o=n?parseInt(n):1,i=ae(s),u={type:s,components:o,byteLength:i.byteLength*o,integer:i.integer,signed:i.signed,normalized:i.normalized};return e&&(u.webglOnly=!0),u}function ze(r,e){let t={};for(let n of r.attributes){let s=cr(r,e,n.name);s&&(t[n.name]=s)}return t}function ht(r,e,t=16){let n=ze(r,e),s=new Array(t).fill(null);for(let o of Object.values(n))s[o.location]=o;return s}function cr(r,e,t){let n=ur(r,t),s=fr(e,t);if(!n)return null;let o=ge(n.type),i=s?.vertexFormat||o.defaultVertexFormat,u=K(i);return{attributeName:s?.attributeName||n.name,bufferName:s?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:i,bufferDataType:u.type,bufferComponents:u.components,normalized:u.normalized,integer:o.integer,stepMode:s?.stepMode||n.stepMode||"vertex",byteOffset:s?.byteOffset||0,byteStride:s?.byteStride||0}}function ur(r,e){let t=r.attributes.find(n=>n.name===e);return t||f.warn(`shader layout attribute "${e}" not present in shader`),t||null}function fr(r,e){lr(r);let t=dr(r,e);return t||(t=mr(r,e),t)?t:(f.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function lr(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&f.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function dr(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function mr(r,e){for(let t of r){let n=t.byteStride;if(typeof t.byteStride!="number")for(let o of t.attributes||[]){let i=K(o.format);n+=i.byteLength}let s=t.attributes?.find(o=>o.attribute===e);if(s)return{attributeName:s.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:s.format,byteOffset:s.byteOffset,byteStride:n}}return null}var ke=class extends c{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,ke.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);let{shaderLayout:n,bufferLayout:s}=t.renderPipeline||{};if(!n||!s)throw new Error("VertexArray");this.attributeInfos=ht(n,s,this.maxVertexAttributes)}setConstantWebGL(e,t){throw new Error("constant attributes not supported")}},J=ke;a(J,"defaultProps",{...c.defaultProps,renderPipeline:null});var Ge=class extends c{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ge.defaultProps)}},Q=Ge;a(Q,"defaultProps",{...c.defaultProps,layout:void 0,buffers:{}});var Ve=class extends c{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,Ve.defaultProps)}},ee=Ve;a(ee,"defaultProps",{...c.defaultProps,type:void 0,count:void 0});var hr={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function be(r){return hr[r]}function pt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var ye;function We(r){return(!ye||ye.byteLength<r)&&(ye=new ArrayBuffer(r)),ye}function gt(r,e){let t=We(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function pr(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function B(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":pr(r)}var bt=1024,R=class{layout={};byteLength;constructor(e){let t=0;for(let[s,o]of Object.entries(e)){let i=be(o),{type:u,components:l}=i;t=pt(t,l);let b=t;t+=l,this.layout[s]={type:u,size:l,offset:b}}t+=(4-t%4)%4;let n=t*4;this.byteLength=Math.max(n,bt)}getData(e){let t=Math.max(this.byteLength,bt),n=We(t),s={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(let[o,i]of Object.entries(e)){let u=this.layout[o];if(!u){f.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:l,size:b,offset:g}=u,S=s[l];if(b===1){if(typeof i!="number"&&typeof i!="boolean"){f.warn(`Supplied value for single component uniform ${o} is not a number: ${i}`)();continue}S[g]=Number(i)}else{if(!B(i)){f.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${i}`)();continue}S.set(i,g)}}return new Uint8Array(n)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function yt(r,e,t=16){if(r!==e)return!1;let n=r,s=e;if(!B(n))return!1;if(B(s)&&n.length===s.length){for(let o=0;o<n.length;++o)if(s[o]!==n[o])return!1}return!0}function xt(r){return B(r)?r.slice():r}var I=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(s=>s.type==="uniform"&&s.name===e?.name);if(!t)throw new Error(e?.name);let n=t;for(let s of n.uniforms||[])this.bindingLayout[s.name]=s}}setUniforms(e){for(let[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){yt(this.uniforms[e],t)||(this.uniforms[e]=xt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var xe=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,n]of Object.entries(e)){let s=t,o=new R(n.uniformTypes||{});this.uniformBufferLayouts.set(s,o);let i=new I({name:t});i.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,i)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,n]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);let s=this.getUniformBufferByteLength(t),o=e.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:s}),i=this.getUniformBufferData(t);return o.write(i),o}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(t);e||=n}return e&&f.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),n=this.uniformBuffers.get(e),s=!1;if(n&&t?.needsRedraw){s||=t.needsRedraw;let o=this.getUniformBufferData(e);n=this.uniformBuffers.get(e),n?.write(o);let i=this.uniformBlocks.get(e)?.getAllUniforms();f.log(4,`Writing to uniform buffer ${String(e)}`,o,i)()}return s}};function Oe(r){let e=ArrayBuffer.isView(r)?r.constructor:r;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function wt(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function Tt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let n=e,s=Oe(r);if(s==="uint8"&&t&&n===1)return"unorm8-webgl";if(s==="uint8"&&t&&n===3)return"unorm8x3-webgl";if(s==="uint8"||s==="sint8"){if(n===1||n===3)throw new Error(`size: ${e}`);return t&&(s=s.replace("int","norm")),`${s}x${n}`}if(s==="uint16"||s==="sint16"){if(n===1||n===3)throw new Error(`size: ${e}`);return t&&(s=s.replace("int","norm")),`${s}x${n}`}return n===1?s:`${s}x${n}`}return Ct(gr);})(); | ||
</pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),i.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},W=De;a(W,"defaultProps",{...c.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function or(r){return ht(r.source)||r.id||M(`unnamed ${r.stage}-shader`)}function ht(r,e="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return n?n[1]:e}var pe=class extends c{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=pe.normalizeProps(e,t),super(e,t,pe.defaultProps)}static normalizeProps(e,t){let n=e?.props?._resourceDefaults?.sampler||{};return{...t,...n}}},O=pe;a(O,"defaultProps",{...c.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var $e=class extends c{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,$e.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(s=>s.texture.clone(e)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:n})}resize(e){let t=!e;if(e){let[n,s]=Array.isArray(e)?e:[e.width,e.height];t=t||s!==this.height||n!==this.width,this.width=n,this.height=s}t&&(f.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((t,n)=>{if(typeof t=="string"){let s=this.createColorTexture(t,n);return this.attachResource(s),s.view}return t instanceof h?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof h?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:h.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:h.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,t){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let s=this.colorAttachments[n].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=s.view,this.attachResource(s.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},j=$e;a(j,"defaultProps",{...c.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Fe=class extends c{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Fe.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},Y=Fe;a(Y,"defaultProps",{...c.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var P=class extends c{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=P.normalizeProps(e,t),super(e,t,P.defaultProps)}static normalizeProps(e,t){return{...e.props._resourceDefaults?.renderPass,...t}}},T=P;a(T,"defaultClearColor",[0,0,0,1]),a(T,"defaultClearDepth",1),a(T,"defaultClearStencil",0),a(T,"defaultProps",{...c.defaultProps,framebuffer:null,parameters:void 0,clearColor:P.defaultClearColor,clearColors:void 0,clearDepth:P.defaultClearDepth,clearStencil:P.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ne=class extends c{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Ne.defaultProps),this.shaderLayout=t.shaderLayout}},X=Ne;a(X,"defaultProps",{...c.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Ue=class extends c{get[Symbol.toStringTag](){return"ComputePass"}constructor(e,t){super(e,t,Ue.defaultProps)}},Z=Ue;a(Z,"defaultProps",{...c.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var He=class extends c{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,He.defaultProps)}},q=He;a(q,"defaultProps",{...c.defaultProps,measureExecutionTime:void 0});var ze=class extends c{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,ze.defaultProps)}},K=ze;a(K,"defaultProps",{...c.defaultProps});function ge(r){let[e,t]=ar[r],n=e==="i32"||e==="u32",s=e!=="u32",o=cr[e]*t,i=ir(e,t);return{dataType:e,components:t,defaultVertexFormat:i,byteLength:o,integer:n,signed:s}}function ir(r,e){let t;switch(r){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?t:`${t}x${e}`}var ar={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},cr={f32:4,f16:2,i32:4,u32:4};function J(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,n]=r.split("x"),s=t,o=n?parseInt(n):1,i=ce(s),u={type:s,components:o,byteLength:i.byteLength*o,integer:i.integer,signed:i.signed,normalized:i.normalized};return e&&(u.webglOnly=!0),u}function ke(r,e){let t={};for(let n of r.attributes){let s=ur(r,e,n.name);s&&(t[n.name]=s)}return t}function pt(r,e,t=16){let n=ke(r,e),s=new Array(t).fill(null);for(let o of Object.values(n))s[o.location]=o;return s}function ur(r,e,t){let n=fr(r,t),s=lr(e,t);if(!n)return null;let o=ge(n.type),i=s?.vertexFormat||o.defaultVertexFormat,u=J(i);return{attributeName:s?.attributeName||n.name,bufferName:s?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:i,bufferDataType:u.type,bufferComponents:u.components,normalized:u.normalized,integer:o.integer,stepMode:s?.stepMode||n.stepMode||"vertex",byteOffset:s?.byteOffset||0,byteStride:s?.byteStride||0}}function fr(r,e){let t=r.attributes.find(n=>n.name===e);return t||f.warn(`shader layout attribute "${e}" not present in shader`),t||null}function lr(r,e){dr(r);let t=mr(r,e);return t||(t=hr(r,e),t)?t:(f.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function dr(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&f.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function mr(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function hr(r,e){for(let t of r){let n=t.byteStride;if(typeof t.byteStride!="number")for(let o of t.attributes||[]){let i=J(o.format);n+=i.byteLength}let s=t.attributes?.find(o=>o.attribute===e);if(s)return{attributeName:s.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:s.format,byteOffset:s.byteOffset,byteStride:n}}return null}var Ge=class extends c{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Ge.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);let{shaderLayout:n,bufferLayout:s}=t.renderPipeline||{};if(!n||!s)throw new Error("VertexArray");this.attributeInfos=pt(n,s,this.maxVertexAttributes)}setConstantWebGL(e,t){throw new Error("constant attributes not supported")}},Q=Ge;a(Q,"defaultProps",{...c.defaultProps,renderPipeline:null});var Ve=class extends c{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ve.defaultProps)}},ee=Ve;a(ee,"defaultProps",{...c.defaultProps,layout:void 0,buffers:{}});var We=class extends c{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,We.defaultProps)}},te=We;a(te,"defaultProps",{...c.defaultProps,type:void 0,count:void 0});var pr={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function be(r){return pr[r]}function gt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var ye;function Oe(r){return(!ye||ye.byteLength<r)&&(ye=new ArrayBuffer(r)),ye}function bt(r,e){let t=Oe(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function gr(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function I(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":gr(r)}var yt=1024,D=class{layout={};byteLength;constructor(e){let t=0;for(let[s,o]of Object.entries(e)){let i=be(o),{type:u,components:l}=i;t=gt(t,l);let b=t;t+=l,this.layout[s]={type:u,size:l,offset:b}}t+=(4-t%4)%4;let n=t*4;this.byteLength=Math.max(n,yt)}getData(e){let t=Math.max(this.byteLength,yt),n=Oe(t),s={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(let[o,i]of Object.entries(e)){let u=this.layout[o];if(!u){f.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:l,size:b,offset:g}=u,A=s[l];if(b===1){if(typeof i!="number"&&typeof i!="boolean"){f.warn(`Supplied value for single component uniform ${o} is not a number: ${i}`)();continue}A[g]=Number(i)}else{if(!I(i)){f.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${i}`)();continue}A.set(i,g)}}return new Uint8Array(n)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function xt(r,e,t=16){if(r!==e)return!1;let n=r,s=e;if(!I(n))return!1;if(I(s)&&n.length===s.length){for(let o=0;o<n.length;++o)if(s[o]!==n[o])return!1}return!0}function wt(r){return I(r)?r.slice():r}var $=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(s=>s.type==="uniform"&&s.name===e?.name);if(!t)throw new Error(e?.name);let n=t;for(let s of n.uniforms||[])this.bindingLayout[s.name]=s}}setUniforms(e){for(let[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){xt(this.uniforms[e],t)||(this.uniforms[e]=wt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var xe=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,n]of Object.entries(e)){let s=t,o=new D(n.uniformTypes||{});this.uniformBufferLayouts.set(s,o);let i=new $({name:t});i.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,i)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,n]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);let s=this.getUniformBufferByteLength(t),o=e.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:s}),i=this.getUniformBufferData(t);return o.write(i),o}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(t);e||=n}return e&&f.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),n=this.uniformBuffers.get(e),s=!1;if(n&&t?.needsRedraw){s||=t.needsRedraw;let o=this.getUniformBufferData(e);n=this.uniformBuffers.get(e),n?.write(o);let i=this.uniformBlocks.get(e)?.getAllUniforms();f.log(4,`Writing to uniform buffer ${String(e)}`,o,i)()}return s}};function je(r){let e=ArrayBuffer.isView(r)?r.constructor:r;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function St(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function Tt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let n=e,s=je(r);if(s==="uint8"&&t&&n===1)return"unorm8-webgl";if(s==="uint8"&&t&&n===3)return"unorm8x3-webgl";if(s==="uint8"||s==="sint8"){if(n===1||n===3)throw new Error(`size: ${e}`);return t&&(s=s.replace("int","norm")),`${s}x${n}`}if(s==="uint16"||s==="sint16"){if(n===1||n===3)throw new Error(`size: ${e}`);return t&&(s=s.replace("int","norm")),`${s}x${n}`}return n===1?s:`${s}x${n}`}var we=class{bufferLayouts;constructor(e){this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(t=>t.name===e)||null}getAttributeNamesForBuffer(e){return e.attributes?e.attributes?.map(t=>t.attribute):[e.name]}mergeBufferLayouts(e,t){let n=[...e];for(let s of t){let o=n.findIndex(i=>i.name===s.name);o<0?n.push(s):n[o]=s}return n}};return Lt(br);})(); | ||
return __exports__; | ||
}); |
@@ -67,6 +67,7 @@ export type { AttachDeviceProps, CreateDeviceProps } from "./adapter/luma.js"; | ||
export type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from "./adapter/resources/command-encoder.js"; | ||
export { log } from "./utils/log.js"; | ||
export { getScratchArray } from "./utils/array-utils-flat.js"; | ||
export type { AttributeInfo } from "./adapter-utils/get-attribute-from-layouts.js"; | ||
export { BufferLayoutHelper as _BufferLayoutHelper } from "./adapter-utils/buffer-layout-helper.js"; | ||
export { getAttributeInfosFromLayouts } from "./adapter-utils/get-attribute-from-layouts.js"; | ||
export { getScratchArray } from "./utils/array-utils-flat.js"; | ||
export { log } from "./utils/log.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -38,5 +38,6 @@ // luma.gl | ||
export { getVertexFormatFromAttribute } from "./gpu-type-utils/vertex-format-from-attribute.js"; | ||
export { getAttributeInfosFromLayouts } from "./adapter-utils/get-attribute-from-layouts.js"; | ||
export { getScratchArray } from "./utils/array-utils-flat.js"; | ||
// INTERNAL UTILS - for use in other luma.gl modules only | ||
export { log } from "./utils/log.js"; | ||
export { getScratchArray } from "./utils/array-utils-flat.js"; | ||
export { BufferLayoutHelper as _BufferLayoutHelper } from "./adapter-utils/buffer-layout-helper.js"; | ||
export { getAttributeInfosFromLayouts } from "./adapter-utils/get-attribute-from-layouts.js"; |
{ | ||
"name": "@luma.gl/core", | ||
"version": "9.1.0-alpha.17", | ||
"version": "9.1.0-alpha.18", | ||
"description": "The luma.gl core Device API", | ||
@@ -49,3 +49,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "a0d4d3ddc549bbfae6e43eebc8e1afdc4da1693c" | ||
"gitHead": "61c927cfdc3b96eb71aa014cbeac2bfe9375c0f6" | ||
} |
@@ -25,9 +25,9 @@ // luma.gl | ||
/** Clear value for color attachment, or false to preserve the previous value */ | ||
clearColor?: NumberArray4 | TypedArray | boolean; | ||
/** Experimental: Clear color values for multiple color attachments. Must specify typed arrays */ | ||
clearColor?: NumberArray4 | TypedArray | false; | ||
/** Experimental: Clear color values for multiple color attachments. Must specify typed arrays. props.clearColor will be ignored. */ | ||
clearColors?: (TypedArray | false)[]; | ||
/** Clear value for depth attachment (true === `1`), or false to preserve the previous value */ | ||
clearDepth?: number | boolean; | ||
/** Clear value for stencil attachment (true === `0`), or false to preserve the previous value */ | ||
clearStencil?: number | boolean; | ||
/** Clear value for depth attachment (true === `1`), or false to preserve the previous value. Must be between 0.0 (near) and 1.0 (far), inclusive. */ | ||
clearDepth?: number | false; | ||
/** Clear value for stencil attachment (true === `0`), or false to preserve the previous value. Converted to the type and number of LSBs as the number of bits in the stencil aspect */ | ||
clearStencil?: number | false; | ||
@@ -61,2 +61,9 @@ /** Indicates that the depth component is read only. */ | ||
export abstract class RenderPass extends Resource<RenderPassProps> { | ||
/** TODO - should be [0, 0, 0, 0], update once deck.gl tests run clean */ | ||
static defaultClearColor: [number, number, number, number] = [0, 0, 0, 1]; | ||
/** Depth 1.0 represents the far plance */ | ||
static defaultClearDepth = 1; | ||
/** Clears all stencil bits */ | ||
static defaultClearStencil = 0; | ||
/** Default properties for RenderPass */ | ||
@@ -67,6 +74,6 @@ static override defaultProps: Required<RenderPassProps> = { | ||
parameters: undefined!, | ||
clearColor: false, | ||
clearColor: RenderPass.defaultClearColor, | ||
clearColors: undefined!, | ||
clearDepth: false, | ||
clearStencil: false, | ||
clearDepth: RenderPass.defaultClearDepth, | ||
clearStencil: RenderPass.defaultClearStencil, | ||
depthReadOnly: false, | ||
@@ -113,4 +120,4 @@ stencilReadOnly: false, | ||
// Intended to override e.g. set default clear values to true | ||
const overrideProps = device.props._resourceDefaults?.renderPass; | ||
const newProps = {...overrideProps, ...props}; | ||
const overriddenDefaultProps = device.props._resourceDefaults?.renderPass; | ||
const newProps = {...overriddenDefaultProps, ...props}; | ||
return newProps; | ||
@@ -117,0 +124,0 @@ } |
@@ -73,6 +73,7 @@ // luma.gl | ||
protected static normalizeProps(device: Device, props: SamplerProps): SamplerProps { | ||
const overrideProps: Partial<SamplerProps> = device?.props?._resourceDefaults?.sampler || {}; | ||
const newProps = {...props, ...overrideProps}; | ||
const overriddenDefaultProps: Partial<SamplerProps> = | ||
device?.props?._resourceDefaults?.sampler || {}; | ||
const newProps = {...props, ...overriddenDefaultProps}; | ||
return newProps; | ||
} | ||
} |
@@ -417,5 +417,6 @@ // luma.gl | ||
// Allow device to override props (e.g. props.mipmaps) | ||
const overrideProps: Partial<TextureProps> = device?.props?._resourceDefaults?.texture || {}; | ||
const overriddenDefaultProps: Partial<TextureProps> = | ||
device?.props?._resourceDefaults?.texture || {}; | ||
// TODO - Type issue with props.data circumvented with Object.assign | ||
Object.assign(newProps, overrideProps); | ||
Object.assign(newProps, overriddenDefaultProps); | ||
@@ -422,0 +423,0 @@ // Ensure we have integer coordinates |
@@ -171,7 +171,7 @@ // luma.gl | ||
// INTERNAL UTILS - for use in other luma.gl modules only | ||
export {log} from './utils/log'; | ||
export {getScratchArray} from './utils/array-utils-flat'; | ||
export type {AttributeInfo} from './adapter-utils/get-attribute-from-layouts'; | ||
export {BufferLayoutHelper as _BufferLayoutHelper} from './adapter-utils/buffer-layout-helper'; | ||
export {getAttributeInfosFromLayouts} from './adapter-utils/get-attribute-from-layouts'; | ||
export {getScratchArray} from './utils/array-utils-flat'; | ||
// INTERNAL UTILS - for use in other luma.gl modules only | ||
export {log} from './utils/log'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
973529
227
17143