@luma.gl/webgpu 9.0.0-alpha.48 → 9.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/helpers/generate-mipmaps.js +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +1 -2
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/dist.dev.js +1 -2
- package/dist/index.cjs +0 -1
- package/dist.min.js +12 -12
- package/package.json +3 -3
- package/src/adapter/helpers/generate-mipmaps.ts +1 -1
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +1 -4
|
@@ -57,7 +57,7 @@ export class WebGPUMipmapGenerator {
|
|
|
57
57
|
this.device.queue.copyImageBitmapToTexture({
|
|
58
58
|
imageBitmap
|
|
59
59
|
}, {
|
|
60
|
-
texture
|
|
60
|
+
texture
|
|
61
61
|
}, textureSize);
|
|
62
62
|
const commandEncoder = this.device.createCommandEncoder({});
|
|
63
63
|
for (let i = 1; i < mipLevelCount; ++i) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-mipmaps.js","names":["VS_GEN_MIPMAP","FS_GEN_MIPMAP","WebGPUMipmapGenerator","constructor","device","glslang","mipmapSampler","mipmapPipeline","createSampler","minFilter","createRenderPipeline","vertexStage","module","createShaderModule","code","compileGLSL","entryPoint","fragmentStage","primitiveTopology","colorStates","format","generateMipmappedTexture","imageBitmap","textureSize","width","height","depth","mipLevelCount","Math","floor","log2","max","texture","createTexture","size","usage","GPUTextureUsage","COPY_DST","SAMPLED","OUTPUT_ATTACHMENT","queue","copyImageBitmapToTexture","
|
|
1
|
+
{"version":3,"file":"generate-mipmaps.js","names":["VS_GEN_MIPMAP","FS_GEN_MIPMAP","WebGPUMipmapGenerator","constructor","device","glslang","mipmapSampler","mipmapPipeline","createSampler","minFilter","createRenderPipeline","vertexStage","module","createShaderModule","code","compileGLSL","entryPoint","fragmentStage","primitiveTopology","colorStates","format","generateMipmappedTexture","imageBitmap","textureSize","width","height","depth","mipLevelCount","Math","floor","log2","max","texture","createTexture","size","usage","GPUTextureUsage","COPY_DST","SAMPLED","OUTPUT_ATTACHMENT","queue","copyImageBitmapToTexture","commandEncoder","createCommandEncoder","i","passEncoder","beginRenderPass","colorAttachments","attachment","createView","baseMipLevel","loadValue","r","g","b","a","bindGroup","createBindGroup","layout","getBindGroupLayout","bindings","binding","resource","setPipeline","setBindGroup","draw","endPass","submit","finish"],"sources":["../../../src/adapter/helpers/generate-mipmaps.ts"],"sourcesContent":["// luma.gl, MIT license\n// Forked from Kangz/mipmapper.js under MIT license Copyright 2020 Brandon Jones\n// https://gist.github.com/Kangz/782d5f1ae502daf53910a13f55db2f83\n\n// @ts-nocheck this is written against outdated WebGPU API, needs an update pass\n\nconst VS_GEN_MIPMAP = `\\#version 450\nconst vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\nlayout(location = 0) out vec2 vTex;\nvoid main() {\n gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n vTex = gl_Position / 2.0f + vec2(0.5f);\n}`;\n\nconst FS_GEN_MIPMAP = `#version 450\nlayout(set = 0, binding = 0) uniform sampler imgSampler;\nlayout(set = 0, binding = 1) uniform texture2D img;\nlayout(location = 0) in vec2 vTex;\nlayout(location = 0) out vec4 outColor;\nvoid main() {\n outColor = texture(sampler2D(img, imgSampler), vTex);\n}`;\n\n/** WebGPU does not have built-in mipmap creation */\nexport class WebGPUMipmapGenerator {\n device: GPUDevice;\n mipmapSampler: GPUSampler;\n mipmapPipeline: GPURenderPipeline;\n\n constructor(device: GPUDevice, glslang) {\n this.device = device;\n\n this.mipmapSampler = device.createSampler({ minFilter: 'linear' });\n\n this.mipmapPipeline = device.createRenderPipeline({\n vertexStage: {\n module: device.createShaderModule({\n code: glslang.compileGLSL(VS_GEN_MIPMAP, 'vertex')\n }),\n entryPoint: 'main'\n },\n fragmentStage: {\n module: device.createShaderModule({\n code: glslang.compileGLSL(FS_GEN_MIPMAP, 'fragment')\n }),\n entryPoint: 'main'\n },\n primitiveTopology: 'triangle-strip',\n colorStates: [{\n format: 'rgba8unorm',\n }]\n });\n }\n\n generateMipmappedTexture(imageBitmap: ImageBitmap) {\n const textureSize = {\n width: imageBitmap.width,\n height: imageBitmap.height,\n depth: 1,\n }\n const mipLevelCount = Math.floor(Math.log2(Math.max(imageBitmap.width, imageBitmap.height))) + 1;\n\n // Populate the top level of the srcTexture with the imageBitmap.\n const texture = this.device.createTexture({\n size: textureSize,\n format: 'rgba8unorm',\n usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.SAMPLED | GPUTextureUsage.OUTPUT_ATTACHMENT,\n mipLevelCount\n });\n this.device.queue.copyImageBitmapToTexture({ imageBitmap }, { texture }, textureSize);\n\n const commandEncoder = this.device.createCommandEncoder({});\n for (let i = 1; i < mipLevelCount; ++i) {\n const passEncoder = commandEncoder.beginRenderPass({\n colorAttachments: [{\n attachment: texture.createView({\n baseMipLevel: i,\n mipLevelCount: 1\n }),\n loadValue: { r: 1.0, g: 0.0, b: 0.0, a: 0.0 },\n }],\n });\n\n const bindGroup = this.device.createBindGroup({\n layout: this.mipmapPipeline.getBindGroupLayout(0),\n bindings: [{\n binding: 0,\n resource: this.mipmapSampler,\n }, {\n binding: 1,\n resource: texture.createView({\n baseMipLevel: i - 1,\n mipLevelCount: 1\n }),\n }],\n });\n\n passEncoder.setPipeline(this.mipmapPipeline);\n passEncoder.setBindGroup(0, bindGroup);\n passEncoder.draw(4);\n passEncoder.endPass();\n }\n\n this.device.queue.submit([commandEncoder.finish()]);\n return texture;\n }\n}\n"],"mappings":"AAMA,MAAMA,aAAa,GAAI;AACvB;AACA;AACA;AACA;AACA;AACA,EAAE;AAEF,MAAMC,aAAa,GAAI;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AAGF,OAAO,MAAMC,qBAAqB,CAAC;EAKjCC,WAAWA,CAACC,MAAiB,EAAEC,OAAO,EAAE;IAAA,KAJxCD,MAAM;IAAA,KACNE,aAAa;IAAA,KACbC,cAAc;IAGZ,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACE,aAAa,GAAGF,MAAM,CAACI,aAAa,CAAC;MAAEC,SAAS,EAAE;IAAS,CAAC,CAAC;IAElE,IAAI,CAACF,cAAc,GAAGH,MAAM,CAACM,oBAAoB,CAAC;MAChDC,WAAW,EAAE;QACXC,MAAM,EAAER,MAAM,CAACS,kBAAkB,CAAC;UAChCC,IAAI,EAAET,OAAO,CAACU,WAAW,CAACf,aAAa,EAAE,QAAQ;QACnD,CAAC,CAAC;QACFgB,UAAU,EAAE;MACd,CAAC;MACDC,aAAa,EAAE;QACbL,MAAM,EAAER,MAAM,CAACS,kBAAkB,CAAC;UAChCC,IAAI,EAAET,OAAO,CAACU,WAAW,CAACd,aAAa,EAAE,UAAU;QACrD,CAAC,CAAC;QACFe,UAAU,EAAE;MACd,CAAC;MACDE,iBAAiB,EAAE,gBAAgB;MACnCC,WAAW,EAAE,CAAC;QACZC,MAAM,EAAE;MACV,CAAC;IACH,CAAC,CAAC;EACJ;EAEAC,wBAAwBA,CAACC,WAAwB,EAAE;IACjD,MAAMC,WAAW,GAAG;MAClBC,KAAK,EAAEF,WAAW,CAACE,KAAK;MACxBC,MAAM,EAAEH,WAAW,CAACG,MAAM;MAC1BC,KAAK,EAAE;IACT,CAAC;IACD,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,IAAI,CAACF,IAAI,CAACG,GAAG,CAACT,WAAW,CAACE,KAAK,EAAEF,WAAW,CAACG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;IAGhG,MAAMO,OAAO,GAAG,IAAI,CAAC5B,MAAM,CAAC6B,aAAa,CAAC;MACxCC,IAAI,EAAEX,WAAW;MACjBH,MAAM,EAAE,YAAY;MACpBe,KAAK,EAAEC,eAAe,CAACC,QAAQ,GAAGD,eAAe,CAACE,OAAO,GAAGF,eAAe,CAACG,iBAAiB;MAC7FZ;IACF,CAAC,CAAC;IACF,IAAI,CAACvB,MAAM,CAACoC,KAAK,CAACC,wBAAwB,CAAC;MAAEnB;IAAY,CAAC,EAAE;MAAEU;IAAQ,CAAC,EAAET,WAAW,CAAC;IAErF,MAAMmB,cAAc,GAAG,IAAI,CAACtC,MAAM,CAACuC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC3D,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGjB,aAAa,EAAE,EAAEiB,CAAC,EAAE;MACtC,MAAMC,WAAW,GAAGH,cAAc,CAACI,eAAe,CAAC;QACjDC,gBAAgB,EAAE,CAAC;UACjBC,UAAU,EAAEhB,OAAO,CAACiB,UAAU,CAAC;YAC7BC,YAAY,EAAEN,CAAC;YACfjB,aAAa,EAAE;UACjB,CAAC,CAAC;UACFwB,SAAS,EAAE;YAAEC,CAAC,EAAE,GAAG;YAAEC,CAAC,EAAE,GAAG;YAAEC,CAAC,EAAE,GAAG;YAAEC,CAAC,EAAE;UAAI;QAC9C,CAAC;MACH,CAAC,CAAC;MAEF,MAAMC,SAAS,GAAG,IAAI,CAACpD,MAAM,CAACqD,eAAe,CAAC;QAC5CC,MAAM,EAAE,IAAI,CAACnD,cAAc,CAACoD,kBAAkB,CAAC,CAAC,CAAC;QACjDC,QAAQ,EAAE,CAAC;UACTC,OAAO,EAAE,CAAC;UACVC,QAAQ,EAAE,IAAI,CAACxD;QACjB,CAAC,EAAE;UACDuD,OAAO,EAAE,CAAC;UACVC,QAAQ,EAAE9B,OAAO,CAACiB,UAAU,CAAC;YAC3BC,YAAY,EAAEN,CAAC,GAAG,CAAC;YACnBjB,aAAa,EAAE;UACjB,CAAC;QACH,CAAC;MACH,CAAC,CAAC;MAEFkB,WAAW,CAACkB,WAAW,CAAC,IAAI,CAACxD,cAAc,CAAC;MAC5CsC,WAAW,CAACmB,YAAY,CAAC,CAAC,EAAER,SAAS,CAAC;MACtCX,WAAW,CAACoB,IAAI,CAAC,CAAC,CAAC;MACnBpB,WAAW,CAACqB,OAAO,CAAC,CAAC;IACvB;IAEA,IAAI,CAAC9D,MAAM,CAACoC,KAAK,CAAC2B,MAAM,CAAC,CAACzB,cAAc,CAAC0B,MAAM,CAAC,CAAC,CAAC,CAAC;IACnD,OAAOpC,OAAO;EAChB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-vertex-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-vertex-buffer-layout.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAqC,MAAM,eAAe,CAAC;AAWlG;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"get-vertex-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-vertex-buffer-layout.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAqC,MAAM,eAAe,CAAC;AAWlG;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,qBAAqB,EAAE,CAoEzB;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decodeVertexFormat } from '@luma.gl/core';
|
|
2
2
|
function getWebGPUVertexFormat(format) {
|
|
3
3
|
if (format.endsWith('-webgl')) {
|
|
4
4
|
throw new Error(`WebGPU does not support vertex format ${format}`);
|
|
@@ -6,7 +6,6 @@ function getWebGPUVertexFormat(format) {
|
|
|
6
6
|
return format;
|
|
7
7
|
}
|
|
8
8
|
export function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
9
|
-
const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);
|
|
10
9
|
const vertexBufferLayouts = [];
|
|
11
10
|
const usedAttributes = new Set();
|
|
12
11
|
for (const mapping of bufferLayout) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-vertex-buffer-layout.js","names":["
|
|
1
|
+
{"version":3,"file":"get-vertex-buffer-layout.js","names":["decodeVertexFormat","getWebGPUVertexFormat","format","endsWith","Error","getVertexBufferLayout","shaderLayout","bufferLayout","vertexBufferLayouts","usedAttributes","Set","mapping","vertexAttributes","stepMode","byteStride","attributes","attributeMapping","attributeName","attribute","attributeLayout","findAttributeLayout","push","offset","byteOffset","shaderLocation","location","byteLength","name","arrayStride","has","getBufferSlots","bufferSlot","bufferSlots","interleaved","add","attributeNames","find"],"sources":["../../../src/adapter/helpers/get-vertex-buffer-layout.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {ShaderLayout, BufferLayout, AttributeDeclaration, VertexFormat} from '@luma.gl/core';\nimport {decodeVertexFormat} from '@luma.gl/core';\n\n/** Throw error on any WebGL-only vertex formats */\nfunction getWebGPUVertexFormat(format: VertexFormat): GPUVertexFormat {\n if (format.endsWith('-webgl')) {\n throw new Error(`WebGPU does not support vertex format ${format}`);\n }\n return format as GPUVertexFormat;\n}\n\n/**\n * Build a WebGPU vertex buffer layout intended for use in a GPURenderPassDescriptor.\n * Converts luma.gl attribute definitions to a WebGPU GPUVertexBufferLayout[] array\n * @param layout\n * @param bufferLayout The buffer map is optional\n * @returns WebGPU layout intended for a GPURenderPassDescriptor.\n */\nexport function getVertexBufferLayout(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): GPUVertexBufferLayout[] {\n const vertexBufferLayouts: GPUVertexBufferLayout[] = [];\n const usedAttributes = new Set<string>();\n\n // First handle any buffers mentioned in `bufferLayout`\n for (const mapping of bufferLayout) {\n // Build vertex attributes for one buffer\n const vertexAttributes: GPUVertexAttribute[] = [];\n\n // TODO verify that all stepModes for one buffer are the same\n let stepMode: 'vertex' | 'instance' = 'vertex';\n let byteStride = 0;\n // interleaved mapping {..., attributes: [{...}, ...]}\n if (mapping.attributes) {\n // const arrayStride = mapping.byteStride; TODO\n for (const attributeMapping of mapping.attributes) {\n const attributeName = attributeMapping.attribute;\n const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);\n\n stepMode = attributeLayout.stepMode || 'vertex';\n vertexAttributes.push({\n format: getWebGPUVertexFormat(attributeMapping.format || mapping.format),\n offset: attributeMapping.byteOffset,\n shaderLocation: attributeLayout.location\n });\n\n byteStride += decodeVertexFormat(mapping.format).byteLength;\n }\n // non-interleaved mapping (just set offset and stride)\n } else {\n const attributeLayout = findAttributeLayout(shaderLayout, mapping.name, usedAttributes);\n byteStride = decodeVertexFormat(mapping.format).byteLength;\n\n stepMode = attributeLayout.stepMode || 'vertex';\n vertexAttributes.push({\n format: getWebGPUVertexFormat(mapping.format),\n // We only support 0 offset for non-interleaved buffer layouts\n offset: 0,\n shaderLocation: attributeLayout.location\n });\n }\n\n // Store all the attribute bindings for one buffer\n vertexBufferLayouts.push({\n arrayStride: mapping.byteStride || byteStride,\n stepMode: stepMode || 'vertex',\n attributes: vertexAttributes\n });\n }\n\n // Add any non-mapped attributes - TODO - avoid hardcoded types\n for (const attribute of shaderLayout.attributes) {\n if (!usedAttributes.has(attribute.name)) {\n vertexBufferLayouts.push({\n arrayStride: decodeVertexFormat('float32x3').byteLength,\n stepMode: attribute.stepMode || 'vertex',\n attributes: [\n {\n format: getWebGPUVertexFormat('float32x3'),\n offset: 0,\n shaderLocation: attribute.location\n }\n ]\n });\n }\n }\n\n return vertexBufferLayouts;\n}\n\nexport function getBufferSlots(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): Record<string, number> {\n const usedAttributes = new Set<string>();\n let bufferSlot = 0;\n const bufferSlots: Record<string, number> = {};\n\n // First handle any buffers mentioned in `bufferLayout`\n for (const mapping of bufferLayout) {\n // interleaved mapping {..., attributes: [{...}, ...]}\n if ('attributes' in mapping) {\n for (const interleaved of mapping.attributes) {\n usedAttributes.add(interleaved.attribute);\n }\n // non-interleaved mapping (just set offset and stride)\n } else {\n usedAttributes.add(mapping.name);\n }\n bufferSlots[mapping.name] = bufferSlot++;\n }\n\n // Add any non-mapped attributes\n for (const attribute of shaderLayout.attributes) {\n if (!usedAttributes.has(attribute.name)) {\n bufferSlots[attribute.name] = bufferSlot++;\n }\n }\n\n return bufferSlots;\n}\n\n/**\n * Looks up an attribute in the ShaderLayout.\n * @throws if name is not in ShaderLayout\n * @throws if name has already been referenced\n */\nfunction findAttributeLayout(\n shaderLayout: ShaderLayout,\n name: string,\n attributeNames: Set<string>\n): AttributeDeclaration {\n const attribute = shaderLayout.attributes.find(attribute => attribute.name === name);\n if (!attribute) {\n throw new Error(`Unknown attribute ${name}`);\n }\n if (attributeNames.has(name)) {\n throw new Error(`Duplicate attribute ${name}`);\n }\n attributeNames.add(name);\n return attribute;\n}\n"],"mappings":"AAEA,SAAQA,kBAAkB,QAAO,eAAe;AAGhD,SAASC,qBAAqBA,CAACC,MAAoB,EAAmB;EACpE,IAAIA,MAAM,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC7B,MAAM,IAAIC,KAAK,CAAE,yCAAwCF,MAAO,EAAC,CAAC;EACpE;EACA,OAAOA,MAAM;AACf;AASA,OAAO,SAASG,qBAAqBA,CACnCC,YAA0B,EAC1BC,YAA4B,EACH;EACzB,MAAMC,mBAA4C,GAAG,EAAE;EACvD,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAAS,CAAC;EAGxC,KAAK,MAAMC,OAAO,IAAIJ,YAAY,EAAE;IAElC,MAAMK,gBAAsC,GAAG,EAAE;IAGjD,IAAIC,QAA+B,GAAG,QAAQ;IAC9C,IAAIC,UAAU,GAAG,CAAC;IAElB,IAAIH,OAAO,CAACI,UAAU,EAAE;MAEtB,KAAK,MAAMC,gBAAgB,IAAIL,OAAO,CAACI,UAAU,EAAE;QACjD,MAAME,aAAa,GAAGD,gBAAgB,CAACE,SAAS;QAChD,MAAMC,eAAe,GAAGC,mBAAmB,CAACd,YAAY,EAAEW,aAAa,EAAER,cAAc,CAAC;QAExFI,QAAQ,GAAGM,eAAe,CAACN,QAAQ,IAAI,QAAQ;QAC/CD,gBAAgB,CAACS,IAAI,CAAC;UACpBnB,MAAM,EAAED,qBAAqB,CAACe,gBAAgB,CAACd,MAAM,IAAIS,OAAO,CAACT,MAAM,CAAC;UACxEoB,MAAM,EAAEN,gBAAgB,CAACO,UAAU;UACnCC,cAAc,EAAEL,eAAe,CAACM;QAClC,CAAC,CAAC;QAEFX,UAAU,IAAId,kBAAkB,CAACW,OAAO,CAACT,MAAM,CAAC,CAACwB,UAAU;MAC7D;IAEF,CAAC,MAAM;MACL,MAAMP,eAAe,GAAGC,mBAAmB,CAACd,YAAY,EAAEK,OAAO,CAACgB,IAAI,EAAElB,cAAc,CAAC;MACvFK,UAAU,GAAGd,kBAAkB,CAACW,OAAO,CAACT,MAAM,CAAC,CAACwB,UAAU;MAE1Db,QAAQ,GAAGM,eAAe,CAACN,QAAQ,IAAI,QAAQ;MAC/CD,gBAAgB,CAACS,IAAI,CAAC;QACpBnB,MAAM,EAAED,qBAAqB,CAACU,OAAO,CAACT,MAAM,CAAC;QAE7CoB,MAAM,EAAE,CAAC;QACTE,cAAc,EAAEL,eAAe,CAACM;MAClC,CAAC,CAAC;IACJ;IAGAjB,mBAAmB,CAACa,IAAI,CAAC;MACvBO,WAAW,EAAEjB,OAAO,CAACG,UAAU,IAAIA,UAAU;MAC7CD,QAAQ,EAAEA,QAAQ,IAAI,QAAQ;MAC9BE,UAAU,EAAEH;IACd,CAAC,CAAC;EACJ;EAGA,KAAK,MAAMM,SAAS,IAAIZ,YAAY,CAACS,UAAU,EAAE;IAC/C,IAAI,CAACN,cAAc,CAACoB,GAAG,CAACX,SAAS,CAACS,IAAI,CAAC,EAAE;MACvCnB,mBAAmB,CAACa,IAAI,CAAC;QACvBO,WAAW,EAAE5B,kBAAkB,CAAC,WAAW,CAAC,CAAC0B,UAAU;QACvDb,QAAQ,EAAEK,SAAS,CAACL,QAAQ,IAAI,QAAQ;QACxCE,UAAU,EAAE,CACV;UACEb,MAAM,EAAED,qBAAqB,CAAC,WAAW,CAAC;UAC1CqB,MAAM,EAAE,CAAC;UACTE,cAAc,EAAEN,SAAS,CAACO;QAC5B,CAAC;MAEL,CAAC,CAAC;IACJ;EACF;EAEA,OAAOjB,mBAAmB;AAC5B;AAEA,OAAO,SAASsB,cAAcA,CAC5BxB,YAA0B,EAC1BC,YAA4B,EACJ;EACxB,MAAME,cAAc,GAAG,IAAIC,GAAG,CAAS,CAAC;EACxC,IAAIqB,UAAU,GAAG,CAAC;EAClB,MAAMC,WAAmC,GAAG,CAAC,CAAC;EAG9C,KAAK,MAAMrB,OAAO,IAAIJ,YAAY,EAAE;IAElC,IAAI,YAAY,IAAII,OAAO,EAAE;MAC3B,KAAK,MAAMsB,WAAW,IAAItB,OAAO,CAACI,UAAU,EAAE;QAC5CN,cAAc,CAACyB,GAAG,CAACD,WAAW,CAACf,SAAS,CAAC;MAC3C;IAEF,CAAC,MAAM;MACLT,cAAc,CAACyB,GAAG,CAACvB,OAAO,CAACgB,IAAI,CAAC;IAClC;IACAK,WAAW,CAACrB,OAAO,CAACgB,IAAI,CAAC,GAAGI,UAAU,EAAE;EAC1C;EAGA,KAAK,MAAMb,SAAS,IAAIZ,YAAY,CAACS,UAAU,EAAE;IAC/C,IAAI,CAACN,cAAc,CAACoB,GAAG,CAACX,SAAS,CAACS,IAAI,CAAC,EAAE;MACvCK,WAAW,CAACd,SAAS,CAACS,IAAI,CAAC,GAAGI,UAAU,EAAE;IAC5C;EACF;EAEA,OAAOC,WAAW;AACpB;AAOA,SAASZ,mBAAmBA,CAC1Bd,YAA0B,EAC1BqB,IAAY,EACZQ,cAA2B,EACL;EACtB,MAAMjB,SAAS,GAAGZ,YAAY,CAACS,UAAU,CAACqB,IAAI,CAAClB,SAAS,IAAIA,SAAS,CAACS,IAAI,KAAKA,IAAI,CAAC;EACpF,IAAI,CAACT,SAAS,EAAE;IACd,MAAM,IAAId,KAAK,CAAE,qBAAoBuB,IAAK,EAAC,CAAC;EAC9C;EACA,IAAIQ,cAAc,CAACN,GAAG,CAACF,IAAI,CAAC,EAAE;IAC5B,MAAM,IAAIvB,KAAK,CAAE,uBAAsBuB,IAAK,EAAC,CAAC;EAChD;EACAQ,cAAc,CAACD,GAAG,CAACP,IAAI,CAAC;EACxB,OAAOT,SAAS;AAClB"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -1260,7 +1260,7 @@ var __exports__ = (() => {
|
|
|
1260
1260
|
throw new Error(`Accessing '${canvasId}' before page was loaded`);
|
|
1261
1261
|
}
|
|
1262
1262
|
if (!(canvas instanceof HTMLCanvasElement)) {
|
|
1263
|
-
throw new Error(
|
|
1263
|
+
throw new Error("Object is not a canvas element");
|
|
1264
1264
|
}
|
|
1265
1265
|
return canvas;
|
|
1266
1266
|
}
|
|
@@ -2287,7 +2287,6 @@ var __exports__ = (() => {
|
|
|
2287
2287
|
return format;
|
|
2288
2288
|
}
|
|
2289
2289
|
function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
2290
|
-
const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);
|
|
2291
2290
|
const vertexBufferLayouts = [];
|
|
2292
2291
|
const usedAttributes = /* @__PURE__ */ new Set();
|
|
2293
2292
|
for (const mapping of bufferLayout) {
|
package/dist/index.cjs
CHANGED
|
@@ -657,7 +657,6 @@ function getWebGPUVertexFormat(format) {
|
|
|
657
657
|
return format;
|
|
658
658
|
}
|
|
659
659
|
function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
660
|
-
const attributeInfos = (0, import_core7.getAttributeInfosFromLayouts)(shaderLayout, bufferLayout);
|
|
661
660
|
const vertexBufferLayouts = [];
|
|
662
661
|
const usedAttributes = /* @__PURE__ */ new Set();
|
|
663
662
|
for (const mapping of bufferLayout) {
|
package/dist.min.js
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['luma'] = factory();
|
|
6
6
|
else root['luma'] = factory();})(globalThis, function () {
|
|
7
|
-
var __exports__=(()=>{var Gt=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var zo=Object.prototype.hasOwnProperty;var Vo=(e,t)=>{for(var r in t)Gt(e,r,{get:t[r],enumerable:!0})},Ho=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wo(t))!zo.call(e,o)&&o!==r&&Gt(e,o,{get:()=>t[o],enumerable:!(n=Uo(t,o))||n.enumerable});return e};var Ko=e=>Ho(Gt({},"__esModule",{value:!0}),e);var Ws={};Vo(Ws,{WebGPUBuffer:()=>wt,WebGPUDevice:()=>dr,WebGPUSampler:()=>V,WebGPUShader:()=>jt,WebGPUTexture:()=>Pt});function De(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function G(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||De()}var $o=globalThis.self||globalThis.window||globalThis.global,ne=globalThis.window||globalThis.self||globalThis.global,Yo=globalThis.document||{},X=globalThis.process||{},qo=globalThis.console,yr=globalThis.navigator||{};var Ve=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",qs=G();var Ct=globalThis;function He(e){if(!e&&!G())return"Node";if(De(e))return"Electron";let t=e||yr.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Ct.chrome?"Chrome":Ct.safari?"Safari":Ct.mozInnerScreenX?"Firefox":"Unknown"}function Xo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Ke=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Xo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function mr(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function br(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function $e(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let i=e.width*r,a=e.height*r,f=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),f]}var Ye;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Ye||(Ye={}));var Jo=10;function vr(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ye[e]||Ye.WHITE)}function gr(e,t,r){if(!G&&typeof e=="string"){if(t){let n=vr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=vr(r);e="\x1B[".concat(n+Jo,"m").concat(e,"\x1B[49m")}}return e}function wr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let a=o[i];typeof a=="function"&&(t.find(f=>i===f)||(o[i]=a.bind(e)))}}function oe(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(G()&&ne.performance){var t,r;e=ne===null||ne===void 0||(t=ne.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in X){var n;let o=X===null||X===void 0||(n=X.hrtime)===null||n===void 0?void 0:n.call(X);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ie={debug:G()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Zo={enabled:!0,level:0};function z(){}var _r={},Or={once:!0},Y=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Ve,this._startTs=J(),this._deltaTs=J(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Ke("__probe-".concat(this.id,"__"),Zo),this.timeStamp("".concat(this.id," started")),wr(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){oe(t,r)}warn(t){return this._getLogFunction(0,t,ie.warn,arguments,Or)}error(t){return this._getLogFunction(0,t,ie.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,ie.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ie.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,ie.debug||ie.info,arguments,Or)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||z,n&&[n],{tag:ri(r)}):z}image(t){let{logLevel:r,priority:n,image:o,message:i="",scale:a=1}=t;return this._shouldLog(r||n)?G()?ti({image:o,message:i,scale:a}):ei({image:o,message:i,scale:a}):z}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||z)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Pr({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||z)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Sr(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=Pr({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,oe(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let a=i.tag||i.message;if(i.once&&a)if(!_r[a])_r[a]=J();else return z;return r=Qo(this.id,i.message,i),n.bind(console,r,...i.args)}return z}};Y.VERSION=Ve;function Sr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return oe(Number.isFinite(t)&&t>=0),t}function Pr(e){let{logLevel:t,message:r}=e;e.logLevel=Sr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return oe(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function Qo(e,t,r){if(typeof t=="string"){let n=r.time?br(mr(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=gr(t,r.color,r.background)}return t}function ei(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),z}function ti(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let a=$e(i,r,n);console.log(...a)},i.src=t,z}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...$e(t,r,n)),z;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...$e(i,r,n)),i.src=t.toDataURL(),z}return z}function ri(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var jl=new Y({id:"@probe.gl/log"});var S=new Y({id:"luma.gl"});function Le(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Z=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Le(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Le()-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 ae=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,o=this.stats[r];return o||(t instanceof Z?o=t:o=new Z(r,n),this.stats[r]=o),o}};function Ne(e){return Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function Tr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,oi(n.key),n)}}function ni(e,t,r){return t&&Tr(e.prototype,t),r&&Tr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function oi(e){var t=ii(e,"string");return Ne(t)==="symbol"?t:String(t)}function ii(e,t){if(Ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ai(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ui=function(){function e(){ai(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new ae({id:n})),this.stats.get(n)},ni(e)}(),qe=new ui;function fi(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(G()&&S.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:S,stats:qe}),e}var jr=fi();var kt={};function Q(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";kt[e]=kt[e]||1;var t=kt[e]++;return"".concat(e,"-").concat(t)}function Xe(e){var t=!0;for(var r in e){t=!1;break}return t}function Ge(e){return Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(e)}function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ci(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Er(Object(r),!0).forEach(function(n){si(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function si(e,t,r){return t=Rr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Rr(n.key),n)}}function li(e,t,r){return t&&xr(e.prototype,t),r&&xr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rr(e){var t=pi(e,"string");return Ge(t)==="symbol"?t:String(t)}function pi(e,t){if(Ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var T=function(){function e(r,n,o){if(hi(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=di(n,o);var i=this.props.id!=="undefined"?this.props.id:Q(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,o=Object.values(this._attachedResources);n<o.length;n++){var i=o[n];i.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),o=this[Symbol.toStringTag];n.get("".concat(o,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(n),i.get("".concat(o," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").subtractCount(this.allocatedBytes),o.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),o=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(o,"s Created")).incrementCount(),n.get("".concat(o,"s Active")).incrementCount()},li(e)}();T.defaultProps={id:"undefined",handle:void 0,userData:void 0};function di(e,t){var r=ci({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}function ue(e){return ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ue(e)}var Br;function Ar(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Mt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ar(Object(r),!0).forEach(function(n){yi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ar(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yi(e,t,r){return t=Dr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ir(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Dr(n.key),n)}}function bi(e,t,r){return t&&Ir(e.prototype,t),r&&Ir(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dr(e){var t=vi(e,"string");return ue(t)==="symbol"?t:String(t)}function vi(e,t){if(ue(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ue(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gi(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ft(e,t)}function Ft(e,t){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ft(e,t)}function wi(e){var t=Pi();return function(){var n=Je(e),o;if(t){var i=Je(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _i(this,o)}}function _i(e,t){if(t&&(ue(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oi(e)}function Oi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Je(e){return Je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Je(e)}Br=Symbol.toStringTag;var D=function(e){gi(r,e);var t=wi(r);function r(o,i){var a;mi(this,r);var f=Mt({},i);return(i.usage||0)&r.INDEX&&!i.indexType&&(i.data instanceof Uint32Array?f.indexType="uint32":i.data instanceof Uint16Array&&(f.indexType="uint16")),a=t.call(this,o,f,r.defaultProps),a.usage=void 0,a.indexType=void 0,a.byteLength=void 0,a.usage=i.usage||0,a.indexType=f.indexType,a}var n=r.prototype;return n.write=function(i,a){throw new Error("not implemented")},n.readAsync=function(i,a){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},bi(r,[{key:Br,get:function(){return"Buffer"}}]),r}(T);D.defaultProps=Mt(Mt({},T.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});D.MAP_READ=1;D.MAP_WRITE=2;D.COPY_SRC=4;D.COPY_DST=8;D.INDEX=16;D.VERTEX=32;D.UNIFORM=64;D.STORAGE=128;D.INDIRECT=256;D.QUERY_RESOLVE=512;function Ce(e){return Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ce(e)}var Gr;function Lr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lr(Object(r),!0).forEach(function(n){Si(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Si(e,t,r){return t=Cr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ti(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Cr(n.key),n)}}function ji(e,t,r){return t&&Nr(e.prototype,t),r&&Nr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cr(e){var t=Ei(e,"string");return Ce(t)==="symbol"?t:String(t)}function Ei(e,t){if(Ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}Gr=Symbol.toStringTag;var ke=function(){function e(r){Ti(this,e),this.id=void 0,this.statsManager=qe,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=Ut(Ut({},e.defaultProps),r),this.id=this.props.id||Q(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var o=Ut({},n);return(n.usage||0)&D.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?o.indexType="uint32":n.data instanceof Uint16Array?o.indexType="uint16":S.warn("indices buffer content must be of integer type")()),o},ji(e,[{key:Gr,get:function(){return"Device"}}]),e}();ke.defaultProps={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(S.get("debug")),break:[],gl:null};ke.VERSION=jr;function Me(e){return Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(e)}function Ze(e,t){return Ai(e)||Ri(e,t)||Vr(e,t)||xi()}function xi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,f;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return i=p.done,p},e:function(p){a=!0,f=p},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw f}}}}function Vr(e,t){if(e){if(typeof e=="string")return kr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kr(e,t)}}function kr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Mr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Fr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mr(Object(r),!0).forEach(function(n){Bi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bi(e,t,r){return t=Hr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Di(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ur(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hr(n.key),n)}}function Li(e,t,r){return t&&Ur(e.prototype,t),r&&Ur(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hr(e){var t=Ni(e,"string");return Me(t)==="symbol"?t:String(t)}function Ni(e,t){if(Me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gi=G()&&typeof document<"u",Qe=function(){return Gi&&document.readyState==="complete"},Ci={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},fe=function(){function e(r){var n=this;if(Di(this,e),this.device=void 0,this.id=void 0,this.props=void 0,this.canvas=void 0,this.htmlCanvas=void 0,this.offscreenCanvas=void 0,this.type=void 0,this.width=1,this.height=1,this.resizeObserver=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this.props=Fr(Fr({},Ci),r),r=this.props,!G()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(r.canvas)typeof r.canvas=="string"?this.canvas=Fi(r.canvas):this.canvas=r.canvas;else{var o,i,a=Ui(r),f=Mi(((o=r)===null||o===void 0?void 0:o.container)||null);f.insertBefore(a,f.firstChild),this.canvas=a,(i=r)!==null&&i!==void 0&&i.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&&r.autoResize&&(this.resizeObserver=new ResizeObserver(function(s){var p=Ii(s),b;try{for(p.s();!(b=p.n()).done;){var m=b.value;m.target===n.canvas&&n.update()}}catch(_){p.e(_)}finally{p.f()}}),this.resizeObserver.observe(this.canvas))}var t=e.prototype;return t.getDevicePixelRatio=function(n){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(n=n===void 0?this.props.useDevicePixels:n,!n||n<=0))return 1;if(n===!0){var o=typeof window<"u"&&window.devicePixelRatio;return o||1}return n},t.getPixelSize=function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var n=this.getDevicePixelRatio(),o=this.canvas;return o.parentElement?[o.clientWidth*n,o.clientHeight*n]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}},t.getAspect=function(){var n=this.getPixelSize(),o=Ze(n,2),i=o[0],a=o[1];return i/a},t.cssToDeviceRatio=function(){try{var n=this.getDrawingBufferSize(),o=Ze(n,1),i=o[0],a=this._canvasSizeInfo.clientWidth;return a?i/a:1}catch{return 1}},t.cssToDevicePixels=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this.cssToDeviceRatio(),a=this.getDrawingBufferSize(),f=Ze(a,2),s=f[0],p=f[1];return Wi(n,i,s,p,o)},t.setDevicePixelRatio=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var i="width"in o?o.width:this.htmlCanvas.clientWidth,a="height"in o?o.height:this.htmlCanvas.clientHeight;(!i||!a)&&(S.log(1,"Canvas clientWidth/clientHeight is 0")(),n=1,i=this.htmlCanvas.width||1,a=this.htmlCanvas.height||1);var f=this._canvasSizeInfo;if(f.clientWidth!==i||f.clientHeight!==a||f.devicePixelRatio!==n){var s=n,p=Math.floor(i*s),b=Math.floor(a*s);this.htmlCanvas.width=p,this.htmlCanvas.height=b;var m=this.getDrawingBufferSize(),_=Ze(m,2),g=_[0],O=_[1];(g!==p||O!==b)&&(s=Math.min(g/i,O/a),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(a*s),S.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=a,this._canvasSizeInfo.devicePixelRatio=n}}},t.getDrawingBufferSize=function(){var n=this.device.gl;if(!n)throw new Error("canvas size");return[n.drawingBufferWidth,n.drawingBufferHeight]},t._setAutoCreatedCanvasId=function(n){var o;((o=this.htmlCanvas)===null||o===void 0?void 0:o.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=n)},Li(e,null,[{key:"isPageLoaded",get:function(){return Qe()}}]),e}();fe.pageLoaded=ki();function ki(){return Qe()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function Mi(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!Qe())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function Fi(e){var t=document.getElementById(e);if(!t&&!Qe())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("'".concat(t,"' is not a canvas element"));return t}function Ui(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function Wi(e,t,r,n,o){var i=e,a=Wr(i[0],t,r),f=zr(i[1],t,n,o),s=Wr(i[0]+1,t,r),p=s===r-1?s:s-1;s=zr(i[1]+1,t,n,o);var b;return o?(s=s===0?s:s+1,b=f,f=s):b=s===n-1?s:s-1,{x:a,y:f,width:Math.max(p-a+1,1),height:Math.max(b-f+1,1)}}function Wr(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function zr(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}function ce(e){return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}var qr;function Kr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function $r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kr(Object(r),!0).forEach(function(n){zi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zi(e,t,r){return t=Xr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Xr(n.key),n)}}function Hi(e,t,r){return t&&Yr(e.prototype,t),r&&Yr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xr(e){var t=Ki(e,"string");return ce(t)==="symbol"?t:String(t)}function Ki(e,t){if(ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $i(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wt(e,t)}function Wt(e,t){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Wt(e,t)}function Yi(e){var t=Ji();return function(){var n=et(e),o;if(t){var i=et(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return qi(this,o)}}function qi(e,t){if(t&&(ce(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xi(e)}function Xi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ji(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function et(e){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},et(e)}qr=Symbol.toStringTag;var F=function(e){$i(r,e);var t=Yi(r);function r(n,o){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.defaultProps;return Vi(this,r),i=t.call(this,n,o,a),i.dimension=void 0,i.format=void 0,i.width=void 0,i.height=void 0,i.depth=void 0,i.sampler=void 0,i.dimension=i.props.dimension,i.format=i.props.format,i.width=i.props.width,i.height=i.props.height,i.depth=i.props.depth,i}return Hi(r,[{key:qr,get:function(){return"Texture"}}]),r}(T);F.defaultProps=$r($r({},T.defaultProps),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});F.COPY_SRC=1;F.COPY_DST=2;F.TEXTURE_BINDING=4;F.STORAGE_BINDING=8;F.RENDER_ATTACHMENT=16;function se(e){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(e)}var en;function Jr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Zr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jr(Object(r),!0).forEach(function(n){Zi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zi(e,t,r){return t=tn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tn(n.key),n)}}function ea(e,t,r){return t&&Qr(e.prototype,t),r&&Qr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function tn(e){var t=ta(e,"string");return se(t)==="symbol"?t:String(t)}function ta(e,t){if(se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ra(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zt(e,t)}function zt(e,t){return zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},zt(e,t)}function na(e){var t=aa();return function(){var n=tt(e),o;if(t){var i=tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return oa(this,o)}}function oa(e,t){if(t&&(se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ia(e)}function ia(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tt(e)}en=Symbol.toStringTag;var rt=function(e){ra(r,e);var t=na(r);function r(n,o){return Qi(this,r),t.call(this,n,o,r.defaultProps)}return ea(r,[{key:en,get:function(){return"ExternalTexture"}}]),r}(T);rt.defaultProps=Zr(Zr({},T.defaultProps),{},{source:null,colorSpace:"srgb"});function le(e){return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(e)}var an;function rn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function nn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rn(Object(r),!0).forEach(function(n){ua(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ua(e,t,r){return t=un(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function on(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,un(n.key),n)}}function ca(e,t,r){return t&&on(e.prototype,t),r&&on(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function un(e){var t=sa(e,"string");return le(t)==="symbol"?t:String(t)}function sa(e,t){if(le(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function la(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vt(e,t)}function Vt(e,t){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Vt(e,t)}function pa(e){var t=ya();return function(){var n=nt(e),o;if(t){var i=nt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return ha(this,o)}}function ha(e,t){if(t&&(le(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return da(e)}function da(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ya(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nt(e){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},nt(e)}an=Symbol.toStringTag;var ot=function(e){la(r,e);var t=pa(r);function r(n,o){var i;return fa(this,r),i=t.call(this,n,o,r.defaultProps),i.stage=void 0,i.source=void 0,i.stage=i.props.stage,i.source=i.props.source,i}return ca(r,[{key:an,get:function(){return"Shader"}}]),r}(T);ot.defaultProps=nn(nn({},T.defaultProps),{},{stage:"vertex",source:"",sourceMap:null,language:"auto",shaderType:0});function pe(e){return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(e)}var ln;function fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function cn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fn(Object(r),!0).forEach(function(n){ma(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ma(e,t,r){return t=pn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ba(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,pn(n.key),n)}}function va(e,t,r){return t&&sn(e.prototype,t),r&&sn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function pn(e){var t=ga(e,"string");return pe(t)==="symbol"?t:String(t)}function ga(e,t){if(pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ht(e,t)}function Ht(e,t){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ht(e,t)}function _a(e){var t=Sa();return function(){var n=it(e),o;if(t){var i=it(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Oa(this,o)}}function Oa(e,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pa(e)}function Pa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},it(e)}ln=Symbol.toStringTag;var he=function(e){wa(r,e);var t=_a(r);function r(n,o){return ba(this,r),t.call(this,n,o,r.defaultProps)}return va(r,[{key:ln,get:function(){return"Sampler"}}]),r}(T);he.defaultProps=cn(cn({},T.defaultProps),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});function ye(e){return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}var mn;function hn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function de(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hn(Object(r),!0).forEach(function(n){Ta(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ta(e,t,r){return t=bn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ja(e,t){return Aa(e)||Ra(e,t)||xa(e,t)||Ea()}function Ea(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xa(e,t){if(e){if(typeof e=="string")return dn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dn(e,t)}}function dn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ra(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Aa(e){if(Array.isArray(e))return e}function Ia(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,bn(n.key),n)}}function Ba(e,t,r){return t&&yn(e.prototype,t),r&&yn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function bn(e){var t=Da(e,"string");return ye(t)==="symbol"?t:String(t)}function Da(e,t){if(ye(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ye(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function La(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Kt(e,t)}function Kt(e,t){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Kt(e,t)}function Na(e){var t=ka();return function(){var n=at(e),o;if(t){var i=at(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ga(this,o)}}function Ga(e,t){if(t&&(ye(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ca(e)}function Ca(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ka(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function at(e){return at=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},at(e)}mn=Symbol.toStringTag;var ut=function(e){La(r,e);var t=Na(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ia(this,r),i=t.call(this,o,a,r.defaultProps),i.width=void 0,i.height=void 0,i.colorAttachments=[],i.depthStencilAttachment=null,i.width=i.props.width,i.height=i.props.height,i}var n=r.prototype;return n.resize=function(i){var a=!i;if(i){var f=Array.isArray(i)?i:[i.width,i.height],s=ja(f,2),p=s[0],b=s[1];a=a||b!==this.height||p!==this.width,this.width=p,this.height=b}a&&(S.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))},n.autoCreateAttachmentTextures=function(){var i=this;if(this.colorAttachments=this.props.colorAttachments.map(function(f){if(typeof f=="string"){var s=i.createColorTexture(f);return i.attachResource(s),s}return f}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var a=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(a),this.depthStencilAttachment=a}else this.depthStencilAttachment=this.props.depthStencilAttachment},n.createColorTexture=function(i){return this.device.createTexture({id:"color-attachment",usage:F.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.createDepthStencilTexture=function(i){return this.device.createTexture({id:"depth-stencil-attachment",usage:F.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.resizeAttachments=function(i,a){for(var f=0;f<this.colorAttachments.length;++f)if(this.colorAttachments[f]){var s=this.device._createTexture(de(de({},this.colorAttachments[f].props),{},{width:i,height:a}));this.destroyAttachedResource(this.colorAttachments[f]),this.colorAttachments[f]=s,this.attachResource(s)}if(this.depthStencilAttachment){var p=this.device._createTexture(de(de({},this.depthStencilAttachment.props),{},{width:i,height:a}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=p,this.attachResource(p)}},Ba(r,[{key:mn,get:function(){return"Framebuffer"}}]),r}(T);ut.defaultProps=de(de({},T.defaultProps),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});function me(e){return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}var _n;function vn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function gn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vn(Object(r),!0).forEach(function(n){Ma(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ma(e,t,r){return t=On(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,On(n.key),n)}}function Ua(e,t,r){return t&&wn(e.prototype,t),r&&wn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function On(e){var t=Wa(e,"string");return me(t)==="symbol"?t:String(t)}function Wa(e,t){if(me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function za(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$t(e,t)}function $t(e,t){return $t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$t(e,t)}function Va(e){var t=$a();return function(){var n=ft(e),o;if(t){var i=ft(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ha(this,o)}}function Ha(e,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ka(e)}function Ka(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $a(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ft(e){return ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ft(e)}_n=Symbol.toStringTag;var ct=function(e){za(r,e);var t=Va(r);function r(n,o){var i;return Fa(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i.vs=void 0,i.fs=void 0,i.shaderLayout=void 0,i.bufferLayout=void 0,i.shaderLayout=i.props.shaderLayout,i.bufferLayout=i.props.bufferLayout||[],i}return Ua(r,[{key:_n,get:function(){return"RenderPipeline"}}]),r}(T);ct.defaultProps=gn(gn({},T.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function be(e){return be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(e)}var jn;function Pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Sn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pn(Object(r),!0).forEach(function(n){Ya(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ya(e,t,r){return t=En(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,En(n.key),n)}}function Xa(e,t,r){return t&&Tn(e.prototype,t),r&&Tn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function En(e){var t=Ja(e,"string");return be(t)==="symbol"?t:String(t)}function Ja(e,t){if(be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Za(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yt(e,t)}function Yt(e,t){return Yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Yt(e,t)}function Qa(e){var t=ru();return function(){var n=st(e),o;if(t){var i=st(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return eu(this,o)}}function eu(e,t){if(t&&(be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tu(e)}function tu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ru(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},st(e)}jn=Symbol.toStringTag;var lt=function(e){Za(r,e);var t=Qa(r);function r(n,o){var i;return qa(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i}return Xa(r,[{key:jn,get:function(){return"ComputePipeline"}}]),r}(T);lt.defaultProps=Sn(Sn({},T.defaultProps),{},{cs:void 0,csEntryPoint:void 0,csConstants:{},shaderLayout:[]});function ve(e){return ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(e)}var In;function xn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Rn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xn(Object(r),!0).forEach(function(n){nu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nu(e,t,r){return t=Bn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ou(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function An(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Bn(n.key),n)}}function iu(e,t,r){return t&&An(e.prototype,t),r&&An(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bn(e){var t=au(e,"string");return ve(t)==="symbol"?t:String(t)}function au(e,t){if(ve(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ve(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uu(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qt(e,t)}function qt(e,t){return qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},qt(e,t)}function fu(e){var t=lu();return function(){var n=pt(e),o;if(t){var i=pt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return cu(this,o)}}function cu(e,t){if(t&&(ve(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return su(e)}function su(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},pt(e)}In=Symbol.toStringTag;var ht=function(e){uu(r,e);var t=fu(r);function r(n,o){return ou(this,r),t.call(this,n,o,r.defaultProps)}return iu(r,[{key:In,get:function(){return"RenderPass"}}]),r}(T);ht.defaultProps=Rn(Rn({},T.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1});function ge(e){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(e)}var Nn;function Dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dn(Object(r),!0).forEach(function(n){hu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hu(e,t,r){return t=Gn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function du(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ln(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Gn(n.key),n)}}function yu(e,t,r){return t&&Ln(e.prototype,t),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gn(e){var t=mu(e,"string");return ge(t)==="symbol"?t:String(t)}function mu(e,t){if(ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bu(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xt(e,t)}function Xt(e,t){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Xt(e,t)}function vu(e){var t=_u();return function(){var n=dt(e),o;if(t){var i=dt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return gu(this,o)}}function gu(e,t){if(t&&(ge(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wu(e)}function wu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _u(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function dt(e){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dt(e)}Nn=Symbol.toStringTag;var yt=function(e){bu(r,e);var t=vu(r);function r(n,o){return du(this,r),t.call(this,n,o,T.defaultProps)}return yu(r,[{key:Nn,get:function(){return"ComputePass"}}]),r}(T);yt.defaultProps=pu({},T.defaultProps);function Ou(e,t){return ju(e)||Tu(e,t)||Su(e,t)||Pu()}function Pu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
13
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,f;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return i=p.done,p},e:function(p){a=!0,f=p},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw f}}}}function Cu(e,t){if(e){if(typeof e=="string")return Wn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wn(e,t)}}function Wn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function mt(e,t){var r={},n=Fe(e.attributes),o;try{for(n.s();!(o=n.n()).done;){var i=o.value;r[i.name]=ku(e,t,i.name)}}catch(a){n.e(a)}finally{n.f()}return r}function zn(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16,n=mt(e,t),o=new Array(r).fill(null),i=0,a=Object.values(n);i<a.length;i++){var f=a[i];o[f.location]=f}return o}function ku(e,t,r){var n=Mu(e,r),o=Fu(t,r);if(!n)return null;var i=kn(n.type),a=o?.vertexFormat||i.defaultVertexFormat,f=q(a);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:i.dataType,shaderComponents:i.components,vertexFormat:a,bufferDataType:f.type,bufferComponents:f.components,normalized:f.normalized,integer:i.integer,stepMode:o?.stepMode||n.stepMode,byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function Mu(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||S.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function Fu(e,t){Uu(e);var r=Wu(e,t);return r||(r=zu(e,t),r)?r:(S.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Uu(e){var t=Fe(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&S.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(o){t.e(o)}finally{t.f()}}function Wu(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.format&&o.name===t)return{attributeName:o.name,bufferName:t,stepMode:o.stepMode,vertexFormat:o.format,byteOffset:0,byteStride:o.byteStride||0}}}catch(i){r.e(i)}finally{r.f()}return null}function zu(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o,i=n.value,a=i.byteStride;if(typeof i.byteStride!="number"){var f=Fe(i.attributes||[]),s;try{for(f.s();!(s=f.n()).done;){var p=s.value,b=q(p.format);a+=b.byteLength}}catch(_){f.e(_)}finally{f.f()}}var m=(o=i.attributes)===null||o===void 0?void 0:o.find(function(_){return _.attribute===t});if(m)return{attributeName:m.attribute,bufferName:i.name,stepMode:i.stepMode,vertexFormat:m.format,byteOffset:m.byteOffset,byteStride:a}}}catch(_){r.e(_)}finally{r.f()}return null}function we(e){return we=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(e)}var $n;function Vn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Hn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vn(Object(r),!0).forEach(function(n){Vu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vu(e,t,r){return t=Yn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Yn(n.key),n)}}function Ku(e,t,r){return t&&Kn(e.prototype,t),r&&Kn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yn(e){var t=$u(e,"string");return we(t)==="symbol"?t:String(t)}function $u(e,t){if(we(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(we(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yu(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jt(e,t)}function Jt(e,t){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Jt(e,t)}function qu(e){var t=Zu();return function(){var n=bt(e),o;if(t){var i=bt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Xu(this,o)}}function Xu(e,t){if(t&&(we(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ju(e)}function Ju(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function bt(e){return bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},bt(e)}$n=Symbol.toStringTag;var vt=function(e){Yu(r,e);var t=qu(r);function r(n,o){var i;return Hu(this,r),i=t.call(this,n,o,r.defaultProps),i.maxVertexAttributes=void 0,i.attributeInfos=void 0,i.indexBuffer=null,i.attributes=void 0,i.maxVertexAttributes=n.limits.maxVertexAttributes,i.attributes=new Array(i.maxVertexAttributes).fill(null),i.attributeInfos=zn(o.renderPipeline.shaderLayout,o.renderPipeline.bufferLayout,i.maxVertexAttributes),i}return Ku(r,[{key:$n,get:function(){return"VertexArray"}}]),r}(T);vt.defaultProps=Hn(Hn({},T.defaultProps),{},{renderPipeline:null});function ee(e){return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(e)}function Zt(){"use strict";Zt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,c){l[u]=c.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",f=o.toStringTag||"@@toStringTag";function s(l,u,c){return Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{s({},"")}catch{s=function(c,h,y){return c[h]=y}}function p(l,u,c,h){var y=u&&u.prototype instanceof _?u:_,d=Object.create(y.prototype),v=new C(h||[]);return n(d,"_invoke",{value:K(l,c,v)}),d}function b(l,u,c){try{return{type:"normal",arg:l.call(u,c)}}catch(h){return{type:"throw",arg:h}}}e.wrap=p;var m={};function _(){}function g(){}function O(){}var B={};s(B,i,function(){return this});var L=Object.getPrototypeOf,x=L&&L(L(M([])));x&&x!==t&&r.call(x,i)&&(B=x);var j=O.prototype=_.prototype=Object.create(B);function N(l){["next","throw","return"].forEach(function(u){s(l,u,function(c){return this._invoke(u,c)})})}function R(l,u){function c(y,d,v,w){var P=b(l[y],l,d);if(P.type!=="throw"){var A=P.arg,E=A.value;return E&&ee(E)=="object"&&r.call(E,"__await")?u.resolve(E.__await).then(function(I){c("next",I,v,w)},function(I){c("throw",I,v,w)}):u.resolve(E).then(function(I){A.value=I,v(A)},function(I){return c("throw",I,v,w)})}w(P.arg)}var h;n(this,"_invoke",{value:function(d,v){function w(){return new u(function(P,A){c(d,v,P,A)})}return h=h?h.then(w,w):w()}})}function K(l,u,c){var h="suspendedStart";return function(y,d){if(h==="executing")throw new Error("Generator is already running");if(h==="completed"){if(y==="throw")throw d;return U()}for(c.method=y,c.arg=d;;){var v=c.delegate;if(v){var w=W(v,c);if(w){if(w===m)continue;return w}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(h==="suspendedStart")throw h="completed",c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);h="executing";var P=b(l,u,c);if(P.type==="normal"){if(h=c.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:c.done}}P.type==="throw"&&(h="completed",c.method="throw",c.arg=P.arg)}}}function W(l,u){var c=u.method,h=l.iterator[c];if(h===void 0)return u.delegate=null,c==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,W(l,u),u.method==="throw")||c!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var y=b(h,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function $(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function k(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function C(l){this.tryEntries=[{tryLoc:"root"}],l.forEach($,this),this.reset(!0)}function M(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var c=-1,h=function y(){for(;++c<l.length;)if(r.call(l,c))return y.value=l[c],y.done=!1,y;return y.value=void 0,y.done=!0,y};return h.next=h}}return{next:U}}function U(){return{value:void 0,done:!0}}return g.prototype=O,n(j,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:g,configurable:!0}),g.displayName=s(O,f,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===g||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,s(l,f,"GeneratorFunction")),l.prototype=Object.create(j),l},e.awrap=function(l){return{__await:l}},N(R.prototype),s(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(l,u,c,h,y){y===void 0&&(y=Promise);var d=new R(p(l,u,c,h),y);return e.isGeneratorFunction(u)?d:d.next().then(function(v){return v.done?v.value:d.next()})},N(j),s(j,f,"Generator"),s(j,i,function(){return this}),s(j,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),c=[];for(var h in u)c.push(h);return c.reverse(),function y(){for(;c.length;){var d=c.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=M,C.prototype={constructor:C,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!u)for(var c in this)c.charAt(0)==="t"&&r.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var c=this;function h(A,E){return v.type="throw",v.arg=u,c.next=A,E&&(c.method="next",c.arg=void 0),!!E}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],v=d.completion;if(d.tryLoc==="root")return h("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return h(d.catchLoc,!0);if(this.prev<d.finallyLoc)return h(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return h(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return h(d.finallyLoc)}}}},abrupt:function(u,c){for(var h=this.tryEntries.length-1;h>=0;--h){var y=this.tryEntries[h];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=c&&c<=d.finallyLoc&&(d=null);var v=d?d.completion:{};return v.type=u,v.arg=c,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(v)},complete:function(u,c){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&c&&(this.next=c),m},finish:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.finallyLoc===u)return this.complete(h.completion,h.afterLoc),k(h),m}},catch:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.tryLoc===u){var y=h.completion;if(y.type==="throw"){var d=y.arg;k(h)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,c,h){return this.delegate={iterator:M(u),resultName:c,nextLoc:h},this.method==="next"&&(this.arg=void 0),m}},e}function qn(e,t,r,n,o,i,a){try{var f=e[i](a),s=f.value}catch(p){r(p);return}f.done?t(s):Promise.resolve(s).then(n,o)}function Qu(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(s){qn(i,n,o,a,f,"next",s)}function f(s){qn(i,n,o,a,f,"throw",s)}a(void 0)})}}function Xn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tf(n.key),n)}}function ef(e,t,r){return t&&Xn(e.prototype,t),r&&Xn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function tf(e){var t=rf(e,"string");return ee(t)==="symbol"?t:String(t)}function rf(e,t){if(ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function of(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qt(e,t)}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Qt(e,t)}function af(e){var t=cf();return function(){var n=gt(e),o;if(t){var i=gt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return uf(this,o)}}function uf(e,t){if(t&&(ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ff(e)}function ff(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gt(e){return gt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},gt(e)}function sf(e){var t;return e.byteLength||((t=e.data)===null||t===void 0?void 0:t.byteLength)||0}var wt=function(e){of(r,e);var t=af(r);function r(o,i){var a;nf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.byteLength=void 0,a.device=o,a.byteLength=sf(i);var f=Boolean(i.data),s=Math.ceil(a.byteLength/4)*4;return a.handle=a.props.handle||a.device.handle.createBuffer({size:s,usage:a.props.usage||GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:a.props.mappedAtCreation||f,label:a.props.id}),i.data&&a._writeMapped(i.data),f&&!i.mappedAtCreation&&a.handle.unmap(),a}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.write=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.device.handle.queue.writeBuffer(this.handle,a,i.buffer,i.byteOffset,i.byteLength)},n.readAsync=function(){var o=Qu(Zt().mark(function a(){var f,s,p,b,m,_=arguments;return Zt().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return f=_.length>0&&_[0]!==void 0?_[0]:0,s=_.length>1&&_[1]!==void 0?_[1]:this.byteLength,p=new r(this.device,{usage:D.MAP_READ|D.COPY_DST,byteLength:s}),b=this.device.handle.createCommandEncoder(),b.copyBufferToBuffer(this.handle,f,p.handle,0,s),this.device.handle.queue.submit([b.finish()]),O.next=8,p.handle.mapAsync(GPUMapMode.READ,f,s);case 8:return m=p.handle.getMappedRange().slice(0),p.handle.unmap(),p.destroy(),O.abrupt("return",new Uint8Array(m));case 12:case"end":return O.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n._writeMapped=function(i){var a=this.handle.getMappedRange();new i.constructor(a).set(i)},n.mapAsync=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=arguments.length>2?arguments[2]:void 0;return this.handle.mapAsync(i,a,f)},n.getMappedRange=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1?arguments[1]:void 0;return this.handle.getMappedRange(i,a)},n.unmap=function(){this.handle.unmap()},ef(r)}(D);function _e(e){if(e.includes("webgl"))throw new Error("webgl-only format");return e}function Oe(e){return Oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe(e)}function Jn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function lf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jn(Object(r),!0).forEach(function(n){pf(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pf(e,t,r){return t=Qn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Qn(n.key),n)}}function hf(e,t,r){return t&&Zn(e.prototype,t),r&&Zn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qn(e){var t=df(e,"string");return Oe(t)==="symbol"?t:String(t)}function df(e,t){if(Oe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Oe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&er(e,t)}function er(e,t){return er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},er(e,t)}function bf(e){var t=wf();return function(){var n=_t(e),o;if(t){var i=_t(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return vf(this,o)}}function vf(e,t){if(t&&(Oe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gf(e)}function gf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _t(e){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_t(e)}var V=function(e){mf(r,e);var t=bf(r);function r(o,i){var a;yf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var f=lf({},a.props);return f.type!=="comparison-sampler"&&delete f.compare,a.handle=a.handle||a.device.handle.createSampler(f),a.handle.label=a.props.id,a}var n=r.prototype;return n.destroy=function(){},hf(r)}(he);function Pe(e){return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pe(e)}function eo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Of(n.key),n)}}function _f(e,t,r){return t&&eo(e.prototype,t),r&&eo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Of(e){var t=Pf(e,"string");return Pe(t)==="symbol"?t:String(t)}function Pf(e,t){if(Pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tr(e,t)}function tr(e,t){return tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},tr(e,t)}function jf(e){var t=Rf();return function(){var n=Ot(e),o;if(t){var i=Ot(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ef(this,o)}}function Ef(e,t){if(t&&(Pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xf(e)}function xf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ot(e){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ot(e)}var Af={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},Pt=function(e){Tf(r,e);var t=jf(r);function r(o,i){var a;if(Sf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.view=void 0,a.sampler=void 0,a.height=1,a.width=1,typeof a.props.format=="number")throw new Error("number format");return a.device=o,a.handle=a.props.handle||a.createHandle(),a.props.data&&a.setData({data:a.props.data}),a.width=a.handle.width,a.height=a.handle.height,a.sampler=i.sampler instanceof V?i.sampler:new V(a.device,i.sampler),a.view=a.handle.createView({}),a}var n=r.prototype;return n.createHandle=function(){var i,a;if(typeof this.props.format=="number")throw new Error("number format");var f=this.props.width||((i=this.props.data)===null||i===void 0?void 0:i.width)||1,s=this.props.height||((a=this.props.data)===null||a===void 0?void 0:a.height)||1;return this.device.handle.createTexture({size:{width:f,height:s,depthOrArrayLayers:this.props.depth},dimension:Af[this.props.dimension],format:_e(this.props.format),usage:this.props.usage,mipLevelCount:this.props.mipLevels,sampleCount:this.props.samples})},n.destroy=function(){this.handle.destroy()},n.setSampler=function(i){return this.sampler=i instanceof V?i:new V(this.device,i),this},n.setData=function(i){return this.setImage({source:i.data})},n.setImage=function(i){var a=i.source,f=i.width,s=f===void 0?i.source.width:f,p=i.height,b=p===void 0?i.source.height:p,m=i.depth,_=m===void 0?1:m,g=i.sourceX,O=g===void 0?0:g,B=i.sourceY,L=B===void 0?0:B,x=i.mipLevel,j=x===void 0?0:x,N=i.x,R=N===void 0?0:N,K=i.y,W=K===void 0?0:K,$=i.z,k=$===void 0?0:$,C=i.aspect,M=C===void 0?"all":C,U=i.colorSpace,l=U===void 0?"srgb":U,u=i.premultipliedAlpha,c=u===void 0?!1:u;return this.device.handle.queue.copyExternalImageToTexture({source:a,origin:[O,L]},{texture:this.handle,origin:[R,W,k],mipLevel:j,aspect:M,colorSpace:l,premultipliedAlpha:c},[s,b,_]),{width:s,height:b}},_f(r)}(F);function Se(e){return Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(e)}function to(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Bf(n.key),n)}}function If(e,t,r){return t&&to(e.prototype,t),r&&to(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bf(e){var t=Df(e,"string");return Se(t)==="symbol"?t:String(t)}function Df(e,t){if(Se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rr(e,t)}function rr(e,t){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},rr(e,t)}function Gf(e){var t=Mf();return function(){var n=St(e),o;if(t){var i=St(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Cf(this,o)}}function Cf(e,t){if(t&&(Se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kf(e)}function kf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function St(e){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},St(e)}var ro=function(e){Nf(r,e);var t=Gf(r);function r(o,i){var a;return Lf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.sampler=void 0,a.device=o,a.handle=a.props.handle||a.device.handle.importExternalTexture({source:i.source,colorSpace:i.colorSpace}),a.sampler=null,a}var n=r.prototype;return n.destroy=function(){},n.setSampler=function(i){return this.sampler=i instanceof V?i:new V(this.device,i),this},If(r)}(rt);function te(e){return te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},te(e)}function Ue(){"use strict";Ue=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,c){l[u]=c.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",f=o.toStringTag||"@@toStringTag";function s(l,u,c){return Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{s({},"")}catch{s=function(c,h,y){return c[h]=y}}function p(l,u,c,h){var y=u&&u.prototype instanceof _?u:_,d=Object.create(y.prototype),v=new C(h||[]);return n(d,"_invoke",{value:K(l,c,v)}),d}function b(l,u,c){try{return{type:"normal",arg:l.call(u,c)}}catch(h){return{type:"throw",arg:h}}}e.wrap=p;var m={};function _(){}function g(){}function O(){}var B={};s(B,i,function(){return this});var L=Object.getPrototypeOf,x=L&&L(L(M([])));x&&x!==t&&r.call(x,i)&&(B=x);var j=O.prototype=_.prototype=Object.create(B);function N(l){["next","throw","return"].forEach(function(u){s(l,u,function(c){return this._invoke(u,c)})})}function R(l,u){function c(y,d,v,w){var P=b(l[y],l,d);if(P.type!=="throw"){var A=P.arg,E=A.value;return E&&te(E)=="object"&&r.call(E,"__await")?u.resolve(E.__await).then(function(I){c("next",I,v,w)},function(I){c("throw",I,v,w)}):u.resolve(E).then(function(I){A.value=I,v(A)},function(I){return c("throw",I,v,w)})}w(P.arg)}var h;n(this,"_invoke",{value:function(d,v){function w(){return new u(function(P,A){c(d,v,P,A)})}return h=h?h.then(w,w):w()}})}function K(l,u,c){var h="suspendedStart";return function(y,d){if(h==="executing")throw new Error("Generator is already running");if(h==="completed"){if(y==="throw")throw d;return U()}for(c.method=y,c.arg=d;;){var v=c.delegate;if(v){var w=W(v,c);if(w){if(w===m)continue;return w}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(h==="suspendedStart")throw h="completed",c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);h="executing";var P=b(l,u,c);if(P.type==="normal"){if(h=c.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:c.done}}P.type==="throw"&&(h="completed",c.method="throw",c.arg=P.arg)}}}function W(l,u){var c=u.method,h=l.iterator[c];if(h===void 0)return u.delegate=null,c==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,W(l,u),u.method==="throw")||c!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var y=b(h,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function $(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function k(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function C(l){this.tryEntries=[{tryLoc:"root"}],l.forEach($,this),this.reset(!0)}function M(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var c=-1,h=function y(){for(;++c<l.length;)if(r.call(l,c))return y.value=l[c],y.done=!1,y;return y.value=void 0,y.done=!0,y};return h.next=h}}return{next:U}}function U(){return{value:void 0,done:!0}}return g.prototype=O,n(j,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:g,configurable:!0}),g.displayName=s(O,f,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===g||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,s(l,f,"GeneratorFunction")),l.prototype=Object.create(j),l},e.awrap=function(l){return{__await:l}},N(R.prototype),s(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(l,u,c,h,y){y===void 0&&(y=Promise);var d=new R(p(l,u,c,h),y);return e.isGeneratorFunction(u)?d:d.next().then(function(v){return v.done?v.value:d.next()})},N(j),s(j,f,"Generator"),s(j,i,function(){return this}),s(j,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),c=[];for(var h in u)c.push(h);return c.reverse(),function y(){for(;c.length;){var d=c.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=M,C.prototype={constructor:C,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!u)for(var c in this)c.charAt(0)==="t"&&r.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var c=this;function h(A,E){return v.type="throw",v.arg=u,c.next=A,E&&(c.method="next",c.arg=void 0),!!E}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],v=d.completion;if(d.tryLoc==="root")return h("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return h(d.catchLoc,!0);if(this.prev<d.finallyLoc)return h(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return h(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return h(d.finallyLoc)}}}},abrupt:function(u,c){for(var h=this.tryEntries.length-1;h>=0;--h){var y=this.tryEntries[h];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=c&&c<=d.finallyLoc&&(d=null);var v=d?d.completion:{};return v.type=u,v.arg=c,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(v)},complete:function(u,c){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&c&&(this.next=c),m},finish:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.finallyLoc===u)return this.complete(h.completion,h.afterLoc),k(h),m}},catch:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.tryLoc===u){var y=h.completion;if(y.type==="throw"){var d=y.arg;k(h)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,c,h){return this.delegate={iterator:M(u),resultName:c,nextLoc:h},this.method==="next"&&(this.arg=void 0),m}},e}function no(e,t,r,n,o,i,a){try{var f=e[i](a),s=f.value}catch(p){r(p);return}f.done?t(s):Promise.resolve(s).then(n,o)}function oo(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(s){no(i,n,o,a,f,"next",s)}function f(s){no(i,n,o,a,f,"throw",s)}a(void 0)})}}function io(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Uf(n.key),n)}}function Ff(e,t,r){return t&&io(e.prototype,t),r&&io(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uf(e){var t=Wf(e,"string");return te(t)==="symbol"?t:String(t)}function Wf(e,t){if(te(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(te(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nr(e,t)}function nr(e,t){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},nr(e,t)}function Hf(e){var t=Yf();return function(){var n=Tt(e),o;if(t){var i=Tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Kf(this,o)}}function Kf(e,t){if(t&&(te(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $f(e)}function $f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Tt(e){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Tt(e)}var jt=function(e){Vf(r,e);var t=Hf(r);function r(o,i){var a;return zf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a.device.handle.pushErrorScope("validation"),a.handle=a.props.handle||a.createHandle(),a.handle.label=a.props.id,a._checkCompilationError(a.device.handle.popErrorScope()),a}var n=r.prototype;return n._checkCompilationError=function(){var o=oo(Ue().mark(function a(f){var s,p;return Ue().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,f;case 2:if(s=m.sent,!s){m.next=9;break}return m.next=6,this.compilationInfo();case 6:throw p=m.sent,S.error("Shader compilation error: ".concat(s.message),p)(),new Error("Shader compilation error: ".concat(s.message));case 9:case"end":return m.stop()}},a,this)}));function i(a){return o.apply(this,arguments)}return i}(),n.destroy=function(){},n.createHandle=function(){var i=this,a=this.props,f=a.source,s=a.stage,p=this.props.language;switch(p==="auto"&&(p=f.includes("->")?"wgsl":"glsl"),p){case"wgsl":return this.device.handle.createShaderModule({code:f});case"glsl":return this.device.handle.createShaderModule({code:f,transform:function(m){return i.device.glslang.compileGLSL(m,s)}});default:throw new Error(p)}},n.compilationInfo=function(){var o=oo(Ue().mark(function a(){var f;return Ue().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.handle.getCompilationInfo();case 2:return f=p.sent,p.abrupt("return",f.messages);case 4:case"end":return p.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),Ff(r)}(ot);function We(e){return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},We(e)}function qf(e,t){return Qf(e)||Zf(e,t)||Jf(e,t)||Xf()}function Xf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
14
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jf(e,t){if(e){if(typeof e=="string")return
|
|
15
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fc(e,t){if(e){if(typeof e=="string")return
|
|
16
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,f;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return i=p.done,p},e:function(p){a=!0,f=p},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw f}}}}function dc(e,t){if(e){if(typeof e=="string")return
|
|
17
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bc(e,t){if(e){if(typeof e=="string")return vo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vo(e,t)}}function vo(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function vc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function gc(e){if(Array.isArray(e))return e}function go(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_c(n.key),n)}}function wc(e,t,r){return t&&go(e.prototype,t),r&&go(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _c(e){var t=Oc(e,"string");return je(t)==="symbol"?t:String(t)}function Oc(e,t){if(je(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(je(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ir(e,t)}function ir(e,t){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ir(e,t)}function Tc(e){var t=xc();return function(){var n=xt(e),o;if(t){var i=xt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return jc(this,o)}}function jc(e,t){if(t&&(je(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ec(e)}function Ec(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xt(e)}var wo=function(e){Sc(r,e);var t=Tc(r);function r(o,i){var a;if(Pc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.vs=void 0,a.fs=null,a._bufferSlots=void 0,a._buffers=void 0,a._indexBuffer=null,a._bindGroupLayout=null,a._bindGroup=null,a.device=o,a.handle=a.props.handle,!a.handle){var f=a._getRenderPipelineDescriptor();S.groupCollapsed(1,"new WebGPURenderPipeline(".concat(a.id,")"))(),S.probe(1,JSON.stringify(f,null,2))(),S.groupEnd(1)(),a.handle=a.device.handle.createRenderPipeline(f)}return a.handle.label=a.props.id,a.vs=i.vs,a.fs=i.fs,a._bufferSlots=bo(a.props.shaderLayout,a.props.bufferLayout),a._buffers=new Array(Object.keys(a._bufferSlots).length).fill(null),a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this._indexBuffer=i},n.setAttributes=function(i){for(var a=0,f=Object.entries(i);a<f.length;a++){var s=yc(f[a],2),p=s[0],b=s[1],m=this._bufferSlots[p];if(m>=0)this._buffers[m]=b;else throw new Error("Setting attribute '".concat(p,"' not listed in shader layout for program ").concat(this.id))}},n.setConstantAttributes=function(i){throw new Error("not implemented")},n.setBindings=function(i){Xe(this.props.bindings)||(Object.assign(this.props.bindings,i),this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=po(this.device.handle,this._bindGroupLayout,this.props.shaderLayout,this.props.bindings))},n.setUniforms=function(i){if(!Xe(i))throw new Error("WebGPU does not support uniforms")},n._getBuffers=function(){return this._buffers},n._getBindGroup=function(){return this._bindGroup},n._getRenderPipelineDescriptor=function(){var i={module:this.props.vs.handle,entryPoint:this.props.vsEntryPoint||"main",buffers:mo(this.props.shaderLayout,this.props.bufferLayout)},a;if(this.props.fs){var f;a={module:this.props.fs.handle,entryPoint:this.props.fsEntryPoint||"main",targets:[{format:_e((f=this.device)===null||f===void 0||(f=f.canvasContext)===null||f===void 0?void 0:f.format)}]}}switch(this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":throw new Error("WebGPU does not support primitive topology ".concat(this.props.topology));default:}var s={vertex:i,fragment:a,primitive:{topology:this.props.topology},layout:"auto"};return so(s,this.props.parameters),s},n.draw=function(i){var a=i.renderPass||this.device.getDefaultRenderPass();a.handle.setPipeline(this.handle);var f=this._getBindGroup();f&&a.handle.setBindGroup(0,f),this._setAttributeBuffers(a),i.indexCount?a.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):a.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstInstance)},n._setAttributeBuffers=function(i){var a=this;this._indexBuffer&&i.handle.setIndexBuffer(this._indexBuffer.handle,this._indexBuffer.props.indexType);for(var f=this._getBuffers(),s=function(m){var _=f[m];if(!_){var g=a.props.shaderLayout.attributes.find(function(O){return O.location===m});throw new Error("No buffer provided for attribute '".concat(g?.name||"","' in Model '").concat(a.props.id,"'"))}i.handle.setVertexBuffer(m,_.handle)},p=0;p<f.length;++p)s(p)},wc(r)}(ct);function Ee(e){return Ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(e)}function _o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ac(n.key),n)}}function Rc(e,t,r){return t&&_o(e.prototype,t),r&&_o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ac(e){var t=Ic(e,"string");return Ee(t)==="symbol"?t:String(t)}function Ic(e,t){if(Ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ar(e,t)}function ar(e,t){return ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ar(e,t)}function Lc(e){var t=Cc();return function(){var n=Rt(e),o;if(t){var i=Rt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Nc(this,o)}}function Nc(e,t){if(t&&(Ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gc(e)}function Gc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rt(e)}var Oo=function(e){Dc(r,e);var t=Lc(r);function r(o,i){var a;Bc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var f=a.props.cs.handle;return a.handle=a.props.handle||a.device.handle.createComputePipeline({label:a.props.id,compute:{module:f,entryPoint:a.props.csEntryPoint},layout:"auto"}),a}var n=r.prototype;return n._getBindGroupLayout=function(){return this.handle.getBindGroupLayout(0)},Rc(r)}(lt);function xe(e){return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xe(e)}function Po(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Mc(n.key),n)}}function kc(e,t,r){return t&&Po(e.prototype,t),r&&Po(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mc(e){var t=Fc(e,"string");return xe(t)==="symbol"?t:String(t)}function Fc(e,t){if(xe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Uc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ur(e,t)}function ur(e,t){return ur=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ur(e,t)}function zc(e){var t=Kc();return function(){var n=At(e),o;if(t){var i=At(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Vc(this,o)}}function Vc(e,t){if(t&&(xe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hc(e)}function Hc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},At(e)}var So=function(e){Wc(r,e);var t=zc(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Uc(this,r),i=t.call(this,o,a),i.device=void 0,i.handle=void 0,i.pipeline=null,i.device=o;var f=a.framebuffer||o.canvasContext.getCurrentFramebuffer(),s=i.getRenderPassDescriptor(f);return S.groupCollapsed(1,"new WebGPURenderPass(".concat(i.id,")"))(),S.probe(1,JSON.stringify(s,null,2))(),S.groupEnd(1)(),i.handle=i.props.handle||o.commandEncoder.beginRenderPass(s),i.handle.label=i.props.id,i}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){this.pipeline=i,this.handle.setPipeline(this.pipeline.handle)},n.setBindings=function(i){var a,f;(a=this.pipeline)===null||a===void 0||a.setBindings(i);var s=(f=this.pipeline)===null||f===void 0?void 0:f._getBindGroup();s&&this.handle.setBindGroup(0,s)},n.setIndexBuffer=function(i,a){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;this.handle.setIndexBuffer(i.handle,a,f,s)},n.setVertexBuffer=function(i,a){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;this.handle.setVertexBuffer(i,a.handle,f)},n.draw=function(i){i.indexCount?this.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):this.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstIndex,i.firstInstance)},n.drawIndirect=function(){},n.setParameters=function(i){var a=i.blendConstant,f=i.stencilReference,s=i.scissorRect,p=i.viewport;a&&this.handle.setBlendConstant(a),f&&this.handle.setStencilReference(f),s&&this.handle.setScissorRect(s[0],s[1],s[2],s[3]),p&&this.handle.setViewport(p[0],p[1],p[2],p[3],p[4],p[5])},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},n.getRenderPassDescriptor=function(i){var a=this,f={colorAttachments:[]};if(f.colorAttachments=i.colorAttachments.map(function(m){return{loadOp:a.props.clearColor!==!1?"clear":"load",colorClearValue:a.props.clearColor||[0,0,0,0],storeOp:a.props.discard?"discard":"store",view:m.handle.createView()}}),i.depthStencilAttachment){f.depthStencilAttachment={view:i.depthStencilAttachment.handle.createView()};var s=f.depthStencilAttachment;this.props.depthReadOnly&&(s.depthReadOnly=!0),s.depthClearValue=this.props.clearDepth||0;var p=!0;p&&(s.depthLoadOp=this.props.clearDepth!==!1?"clear":"load",s.depthStoreOp="store");var b=!1;b&&(s.stencilLoadOp=this.props.clearStencil!==!1?"clear":"load",s.stencilStoreOp="store")}return f},kc(r)}(ht);function Re(e){return Re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Re(e)}function To(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Yc(n.key),n)}}function $c(e,t,r){return t&&To(e.prototype,t),r&&To(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yc(e){var t=qc(e,"string");return Re(t)==="symbol"?t:String(t)}function qc(e,t){if(Re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fr(e,t)}function fr(e,t){return fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},fr(e,t)}function Zc(e){var t=ts();return function(){var n=It(e),o;if(t){var i=It(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Qc(this,o)}}function Qc(e,t){if(t&&(Re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return es(e)}function es(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ts(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},It(e)}var jo=function(e){Jc(r,e);var t=Zc(r);function r(o,i){var a,f;return Xc(this,r),f=t.call(this,o,i),f.device=void 0,f.handle=void 0,f._bindGroupLayout=null,f.device=o,f.handle=f.props.handle||((a=o.commandEncoder)===null||a===void 0?void 0:a.beginComputePass({label:f.props.id})),f}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){var a=i;this.handle.setPipeline(a.handle),this._bindGroupLayout=a._getBindGroupLayout()},n.setBindings=function(i){throw new Error("fix me")},n.dispatch=function(i,a,f){this.handle.dispatchWorkgroups(i,a,f)},n.dispatchIndirect=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.handle.dispatchWorkgroupsIndirect(i.handle,a)},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},$c(r)}(yt);function Ae(e){return Ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(e)}var xo;function rs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Eo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,os(n.key),n)}}function ns(e,t,r){return t&&Eo(e.prototype,t),r&&Eo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function os(e){var t=is(e,"string");return Ae(t)==="symbol"?t:String(t)}function is(e,t){if(Ae(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ae(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function as(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cr(e,t)}function cr(e,t){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},cr(e,t)}function us(e){var t=ss();return function(){var n=Bt(e),o;if(t){var i=Bt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return fs(this,o)}}function fs(e,t){if(t&&(Ae(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cs(e)}function cs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ss(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Bt(e){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Bt(e)}xo=Symbol.toStringTag;var Ro=function(e){as(r,e);var t=us(r);r.isConstantAttributeZeroSupported=function(i){return i.info.type==="webgl2"||He()==="Chrome"};function r(o,i){var a;return rs(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this.indexBuffer=i},n.setBuffer=function(i,a){this.attributes[i]=a},n.setConstant=function(i,a){S.warn("".concat(this.id," constant attributes not supported on WebGPU"))},n.bindBeforeRender=function(i,a,f){var s=i,p=this.indexBuffer;s.handle.setIndexBuffer(p?.handle,p?.indexType);for(var b=0;b<this.maxVertexAttributes;b++){var m=this.attributes[b];s.handle.setVertexBuffer(b,m.handle)}},n.unbindAfterRender=function(i){},ns(r,[{key:xo,get:function(){return"WebGPUVertexArray"}}]),r}(vt);function Ie(e){return Ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(e)}function Ao(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ps(n.key),n)}}function ls(e,t,r){return t&&Ao(e.prototype,t),r&&Ao(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ps(e){var t=hs(e,"string");return Ie(t)==="symbol"?t:String(t)}function hs(e,t){if(Ie(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ie(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ys(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sr(e,t)}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},sr(e,t)}function ms(e){var t=gs();return function(){var n=Dt(e),o;if(t){var i=Dt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return bs(this,o)}}function bs(e,t){if(t&&(Ie(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vs(e)}function vs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Dt(e){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dt(e)}var Io=function(e){ys(r,e);var t=ms(r);function r(n,o){var i;return ds(this,r),i=t.call(this,n,o),i.device=void 0,i.device=n,i.autoCreateAttachmentTextures(),i}return ls(r)}(ut);function Be(e){return Be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Be(e)}function ws(e,t){return Ss(e)||Ps(e,t)||Os(e,t)||_s()}function _s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Os(e,t){if(e){if(typeof e=="string")return Bo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bo(e,t)}}function Bo(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ps(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Ss(e){if(Array.isArray(e))return e}function Do(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,js(n.key),n)}}function Ts(e,t,r){return t&&Do(e.prototype,t),r&&Do(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function js(e){var t=Es(e,"string");return Be(t)==="symbol"?t:String(t)}function Es(e,t){if(Be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rs(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&lr(e,t)}function lr(e,t){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},lr(e,t)}function As(e){var t=Ds();return function(){var n=Lt(e),o;if(t){var i=Lt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Is(this,o)}}function Is(e,t){if(t&&(Be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bs(e)}function Bs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ds(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Lt(e){return Lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lt(e)}var pr=function(e){Rs(r,e);var t=As(r);function r(o,i,a){var f;return xs(this,r),f=t.call(this,a),f.device=void 0,f.gpuCanvasContext=void 0,f.format=navigator.gpu.getPreferredCanvasFormat(),f.depthStencilFormat="depth24plus",f.depthStencilAttachment=null,f.device=o,f.width=-1,f.height=-1,f._setAutoCreatedCanvasId("".concat(f.device.id,"-canvas")),f.gpuCanvasContext=f.canvas.getContext("webgpu"),f.format="bgra8unorm",f}var n=r.prototype;return n.destroy=function(){this.gpuCanvasContext.unconfigure()},n.getCurrentTexture=function(){return this.device._createTexture({id:"default-render-target",handle:this.gpuCanvasContext.getCurrentTexture()})},n.getCurrentFramebuffer=function(){this.update();var i=this.getCurrentTexture();return this.width=i.width,this.height=i.height,this._createDepthStencilAttachment(),new Io(this.device,{colorAttachments:[i],depthStencilAttachment:this.depthStencilAttachment})},n.update=function(){var i=this.getPixelSize(),a=ws(i,2),f=a[0],s=a[1],p=f!==this.width||s!==this.height;p&&(this.width=f,this.height=s,this.depthStencilAttachment&&(this.depthStencilAttachment.destroy(),this.depthStencilAttachment=null),this.gpuCanvasContext.configure({device:this.device.handle,format:_e(this.format),colorSpace:this.props.colorSpace,alphaMode:this.props.alphaMode}),S.log(1,"Resized to ".concat(this.width,"x").concat(this.height,"px"))())},n.resize=function(i){this.update()},n._createDepthStencilAttachment=function(){return this.depthStencilAttachment||(this.depthStencilAttachment=this.device.createTexture({id:"depth-stencil-target",format:this.depthStencilFormat,width:this.width,height:this.height,usage:GPUTextureUsage.RENDER_ATTACHMENT})),this.depthStencilAttachment},Ts(r)}(fe);function re(e){return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(e)}function Lo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function No(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lo(Object(r),!0).forEach(function(n){Ls(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ls(e,t,r){return t=Mo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ze(){"use strict";ze=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,c){l[u]=c.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",f=o.toStringTag||"@@toStringTag";function s(l,u,c){return Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{s({},"")}catch{s=function(c,h,y){return c[h]=y}}function p(l,u,c,h){var y=u&&u.prototype instanceof _?u:_,d=Object.create(y.prototype),v=new C(h||[]);return n(d,"_invoke",{value:K(l,c,v)}),d}function b(l,u,c){try{return{type:"normal",arg:l.call(u,c)}}catch(h){return{type:"throw",arg:h}}}e.wrap=p;var m={};function _(){}function g(){}function O(){}var B={};s(B,i,function(){return this});var L=Object.getPrototypeOf,x=L&&L(L(M([])));x&&x!==t&&r.call(x,i)&&(B=x);var j=O.prototype=_.prototype=Object.create(B);function N(l){["next","throw","return"].forEach(function(u){s(l,u,function(c){return this._invoke(u,c)})})}function R(l,u){function c(y,d,v,w){var P=b(l[y],l,d);if(P.type!=="throw"){var A=P.arg,E=A.value;return E&&re(E)=="object"&&r.call(E,"__await")?u.resolve(E.__await).then(function(I){c("next",I,v,w)},function(I){c("throw",I,v,w)}):u.resolve(E).then(function(I){A.value=I,v(A)},function(I){return c("throw",I,v,w)})}w(P.arg)}var h;n(this,"_invoke",{value:function(d,v){function w(){return new u(function(P,A){c(d,v,P,A)})}return h=h?h.then(w,w):w()}})}function K(l,u,c){var h="suspendedStart";return function(y,d){if(h==="executing")throw new Error("Generator is already running");if(h==="completed"){if(y==="throw")throw d;return U()}for(c.method=y,c.arg=d;;){var v=c.delegate;if(v){var w=W(v,c);if(w){if(w===m)continue;return w}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(h==="suspendedStart")throw h="completed",c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);h="executing";var P=b(l,u,c);if(P.type==="normal"){if(h=c.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:c.done}}P.type==="throw"&&(h="completed",c.method="throw",c.arg=P.arg)}}}function W(l,u){var c=u.method,h=l.iterator[c];if(h===void 0)return u.delegate=null,c==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,W(l,u),u.method==="throw")||c!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var y=b(h,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function $(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function k(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function C(l){this.tryEntries=[{tryLoc:"root"}],l.forEach($,this),this.reset(!0)}function M(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var c=-1,h=function y(){for(;++c<l.length;)if(r.call(l,c))return y.value=l[c],y.done=!1,y;return y.value=void 0,y.done=!0,y};return h.next=h}}return{next:U}}function U(){return{value:void 0,done:!0}}return g.prototype=O,n(j,"constructor",{value:O,configurable:!0}),n(O,"constructor",{value:g,configurable:!0}),g.displayName=s(O,f,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===g||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,O):(l.__proto__=O,s(l,f,"GeneratorFunction")),l.prototype=Object.create(j),l},e.awrap=function(l){return{__await:l}},N(R.prototype),s(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(l,u,c,h,y){y===void 0&&(y=Promise);var d=new R(p(l,u,c,h),y);return e.isGeneratorFunction(u)?d:d.next().then(function(v){return v.done?v.value:d.next()})},N(j),s(j,f,"Generator"),s(j,i,function(){return this}),s(j,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),c=[];for(var h in u)c.push(h);return c.reverse(),function y(){for(;c.length;){var d=c.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=M,C.prototype={constructor:C,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!u)for(var c in this)c.charAt(0)==="t"&&r.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var c=this;function h(A,E){return v.type="throw",v.arg=u,c.next=A,E&&(c.method="next",c.arg=void 0),!!E}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],v=d.completion;if(d.tryLoc==="root")return h("end");if(d.tryLoc<=this.prev){var w=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(w&&P){if(this.prev<d.catchLoc)return h(d.catchLoc,!0);if(this.prev<d.finallyLoc)return h(d.finallyLoc)}else if(w){if(this.prev<d.catchLoc)return h(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return h(d.finallyLoc)}}}},abrupt:function(u,c){for(var h=this.tryEntries.length-1;h>=0;--h){var y=this.tryEntries[h];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=c&&c<=d.finallyLoc&&(d=null);var v=d?d.completion:{};return v.type=u,v.arg=c,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(v)},complete:function(u,c){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&c&&(this.next=c),m},finish:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.finallyLoc===u)return this.complete(h.completion,h.afterLoc),k(h),m}},catch:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.tryLoc===u){var y=h.completion;if(y.type==="throw"){var d=y.arg;k(h)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,c,h){return this.delegate={iterator:M(u),resultName:c,nextLoc:h},this.method==="next"&&(this.arg=void 0),m}},e}function Go(e,t,r,n,o,i,a){try{var f=e[i](a),s=f.value}catch(p){r(p);return}f.done?t(s):Promise.resolve(s).then(n,o)}function Co(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(s){Go(i,n,o,a,f,"next",s)}function f(s){Go(i,n,o,a,f,"throw",s)}a(void 0)})}}function Ns(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ko(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Mo(n.key),n)}}function Gs(e,t,r){return t&&ko(e.prototype,t),r&&ko(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mo(e){var t=Cs(e,"string");return re(t)==="symbol"?t:String(t)}function Cs(e,t){if(re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ks(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hr(e,t)}function hr(e,t){return hr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},hr(e,t)}function Ms(e){var t=Us();return function(){var n=Nt(e),o;if(t){var i=Nt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Fs(this,o)}}function Fs(e,t){if(t&&(re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fo(e)}function Fo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Us(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nt(e)}var dr=function(e){ks(r,e);var t=Ms(r);r.isSupported=function(){return Boolean(typeof navigator<"u"&&navigator.gpu)},r.create=function(){var o=Co(ze().mark(function a(f){var s,p,b,m;return ze().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(navigator.gpu){g.next=2;break}throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");case 2:return S.groupCollapsed(1,"WebGPUDevice created")(),g.next=5,navigator.gpu.requestAdapter({powerPreference:"high-performance"});case 5:if(s=g.sent,s){g.next=8;break}throw new Error("Failed to request WebGPU adapter");case 8:return g.next=10,s.requestAdapterInfo();case 10:return p=g.sent,S.probe(1,"Adapter available",p)(),g.next=14,s.requestDevice({requiredFeatures:s.features});case 14:if(b=g.sent,S.probe(1,"GPUDevice available")(),typeof f.canvas!="string"){g.next=20;break}return g.next=19,fe.pageLoaded;case 19:S.probe(1,"DOM is loaded")();case 20:return m=new r(b,s,f),S.probe(1,"Device created",m.info)(),S.table(1,m.info)(),S.groupEnd(1)(),g.abrupt("return",m);case 25:case"end":return g.stop()}},a)}));function i(a){return o.apply(this,arguments)}return i}();function r(o,i,a){var f;return Ns(this,r),f=t.call(this,No(No({},a),{},{id:a.id||Q("webgpu-device")})),f.handle=void 0,f.adapter=void 0,f.lost=void 0,f.canvasContext=null,f.commandEncoder=null,f.renderPass=null,f._info=void 0,f._isLost=!1,f.features=void 0,f.handle=o,f.adapter=i,f._info={type:"webgpu",vendor:f.adapter.__brand,renderer:"",version:"",gpu:"unknown",shadingLanguage:"wgsl",shadingLanguageVersion:100,vendorMasked:"",rendererMasked:""},f.lost=new Promise(function(){var s=Co(ze().mark(function p(b){var m;return ze().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,f.handle.lost;case 2:m=g.sent,f._isLost=!0,b({reason:"destroyed",message:m.message});case 5:case"end":return g.stop()}},p)}));return function(p){return s.apply(this,arguments)}}()),f.canvasContext=new pr(Fo(f),f.adapter,{canvas:a.canvas,height:a.height,width:a.width,container:a.container}),f.features=f._getFeatures(),f}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.isTextureFormatSupported=function(i){return!i.includes("webgl")},n.isTextureFormatFilterable=function(i){return this.isTextureFormatSupported(i)},n.isTextureFormatRenderable=function(i){return this.isTextureFormatSupported(i)},n.createBuffer=function(i){var a=this._getBufferProps(i);return new wt(this,a)},n._createTexture=function(i){return new Pt(this,i)},n.createExternalTexture=function(i){return new ro(this,i)},n.createShader=function(i){return new jt(this,i)},n.createSampler=function(i){return new V(this,i)},n.createRenderPipeline=function(i){return new wo(this,i)},n.createFramebuffer=function(i){throw new Error("Not implemented")},n.createComputePipeline=function(i){return new Oo(this,i)},n.createVertexArray=function(i){return new Ro(this,i)},n.beginRenderPass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new So(this,i)},n.beginComputePass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new jo(this,i)},n.createTransformFeedback=function(i){throw new Error("Transform feedback not supported in WebGPU")},n.createCanvasContext=function(i){return new pr(this,this.adapter,i)},n.getDefaultRenderPass=function(){throw new Error("a")},n.submit=function(){var i,a=(i=this.commandEncoder)===null||i===void 0?void 0:i.finish();a&&this.handle.queue.submit([a]),this.commandEncoder=null},n._getFeatures=function(){var i=new Set(this.handle.features);return i.has("depth-clamping")&&(i.delete("depth-clamping"),i.add("depth-clip-control")),i.has("texture-compression-bc")&&i.add("texture-compression-bc5-webgl"),i.add("webgpu"),i.add("timer-query-webgl"),i.add("vertex-array-object-webgl1"),i.add("instanced-rendering-webgl1"),i.add("multiple-render-targets-webgl1"),i.add("index-uint32-webgl1"),i.add("blend-minmax-webgl1"),i.add("texture-blend-float-webgl1"),i.add("texture-formats-srgb-webgl1"),i.add("texture-formats-depth-webgl1"),i.add("texture-formats-float32-webgl1"),i.add("texture-formats-float16-webgl1"),i.add("texture-filter-linear-float32-webgl"),i.add("texture-filter-linear-float16-webgl"),i.add("texture-filter-anisotropic-webgl"),i.add("texture-renderable-rgba32float-webgl"),i.add("texture-renderable-float32-webgl"),i.add("texture-renderable-float16-webgl"),i.add("glsl-frag-data"),i.add("glsl-frag-depth"),i.add("glsl-derivatives"),i.add("glsl-texture-lod"),i},n.copyExternalImageToTexture=function(i){var a,f=i.source,s=i.sourceX,p=s===void 0?0:s,b=i.sourceY,m=b===void 0?0:b,_=i.texture,g=i.mipLevel,O=g===void 0?0:g,B=i.aspect,L=B===void 0?"all":B,x=i.colorSpace,j=x===void 0?"display-p3":x,N=i.premultipliedAlpha,R=N===void 0?!1:N,K=i.width,W=K===void 0?_.width:K,$=i.height,k=$===void 0?_.height:$,C=i.depth,M=C===void 0?1:C,U=_;(a=this.handle)===null||a===void 0||a.queue.copyExternalImageToTexture({source:f,origin:[p,m]},{texture:U.handle,origin:[0,0,0],mipLevel:O,aspect:L,colorSpace:j,premultipliedAlpha:R},[W,k,M])},Gs(r,[{key:"info",get:function(){return this._info}},{key:"limits",get:function(){return this.handle.limits}},{key:"isLost",get:function(){return this._isLost}}]),r}(ke);dr.type="webgpu";return Ko(Ws);})();
|
|
7
|
+
var __exports__=(()=>{var Nt=Object.defineProperty;var Fo=Object.getOwnPropertyDescriptor;var Uo=Object.getOwnPropertyNames;var Wo=Object.prototype.hasOwnProperty;var zo=(e,t)=>{for(var r in t)Nt(e,r,{get:t[r],enumerable:!0})},Vo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Uo(t))!Wo.call(e,o)&&o!==r&&Nt(e,o,{get:()=>t[o],enumerable:!(n=Fo(t,o))||n.enumerable});return e};var Ho=e=>Vo(Nt({},"__esModule",{value:!0}),e);var Ws={};zo(Ws,{WebGPUBuffer:()=>gt,WebGPUDevice:()=>hr,WebGPUSampler:()=>V,WebGPUShader:()=>Tt,WebGPUTexture:()=>Ot});function De(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function G(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||De()}var Ko=globalThis.self||globalThis.window||globalThis.global,ne=globalThis.window||globalThis.self||globalThis.global,$o=globalThis.document||{},X=globalThis.process||{},Yo=globalThis.console,dr=globalThis.navigator||{};var Ve=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",qs=G();var Gt=globalThis;function He(e){if(!e&&!G())return"Node";if(De(e))return"Electron";let t=e||dr.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Gt.chrome?"Chrome":Gt.safari?"Safari":Gt.mozInnerScreenX?"Firefox":"Unknown"}function qo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Ke=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=qo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function yr(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function mr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function $e(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let i=e.width*r,a=e.height*r,f=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),f]}var Ye;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Ye||(Ye={}));var Xo=10;function br(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ye[e]||Ye.WHITE)}function vr(e,t,r){if(!G&&typeof e=="string"){if(t){let n=br(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=br(r);e="\x1B[".concat(n+Xo,"m").concat(e,"\x1B[49m")}}return e}function gr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let a=o[i];typeof a=="function"&&(t.find(f=>i===f)||(o[i]=a.bind(e)))}}function oe(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(G()&&ne.performance){var t,r;e=ne===null||ne===void 0||(t=ne.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in X){var n;let o=X===null||X===void 0||(n=X.hrtime)===null||n===void 0?void 0:n.call(X);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ie={debug:G()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Jo={enabled:!0,level:0};function z(){}var wr={},_r={once:!0},Y=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Ve,this._startTs=J(),this._deltaTs=J(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Ke("__probe-".concat(this.id,"__"),Jo),this.timeStamp("".concat(this.id," started")),gr(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){oe(t,r)}warn(t){return this._getLogFunction(0,t,ie.warn,arguments,_r)}error(t){return this._getLogFunction(0,t,ie.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,ie.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ie.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,ie.debug||ie.info,arguments,_r)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||z,n&&[n],{tag:ti(r)}):z}image(t){let{logLevel:r,priority:n,image:o,message:i="",scale:a=1}=t;return this._shouldLog(r||n)?G()?ei({image:o,message:i,scale:a}):Qo({image:o,message:i,scale:a}):z}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||z)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Or({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||z)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Pr(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=Or({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,oe(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let a=i.tag||i.message;if(i.once&&a)if(!wr[a])wr[a]=J();else return z;return r=Zo(this.id,i.message,i),n.bind(console,r,...i.args)}return z}};Y.VERSION=Ve;function Pr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return oe(Number.isFinite(t)&&t>=0),t}function Or(e){let{logLevel:t,message:r}=e;e.logLevel=Pr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return oe(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function Zo(e,t,r){if(typeof t=="string"){let n=r.time?mr(yr(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=vr(t,r.color,r.background)}return t}function Qo(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),z}function ei(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let a=$e(i,r,n);console.log(...a)},i.src=t,z}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...$e(t,r,n)),z;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...$e(i,r,n)),i.src=t.toDataURL(),z}return z}function ti(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var jl=new Y({id:"@probe.gl/log"});var S=new Y({id:"luma.gl"});function Le(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Z=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Le(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Le()-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 ae=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,o=this.stats[r];return o||(t instanceof Z?o=t:o=new Z(r,n),this.stats[r]=o),o}};function Ne(e){return Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function Sr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ni(n.key),n)}}function ri(e,t,r){return t&&Sr(e.prototype,t),r&&Sr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ni(e){var t=oi(e,"string");return Ne(t)==="symbol"?t:String(t)}function oi(e,t){if(Ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ii(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ai=function(){function e(){ii(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new ae({id:n})),this.stats.get(n)},ri(e)}(),qe=new ai;function ui(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(G()&&S.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:S,stats:qe}),e}var Tr=ui();var Ct={};function Q(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ct[e]=Ct[e]||1;var t=Ct[e]++;return"".concat(e,"-").concat(t)}function Xe(e){var t=!0;for(var r in e){t=!1;break}return t}function Ge(e){return Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(e)}function jr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jr(Object(r),!0).forEach(function(n){ci(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ci(e,t,r){return t=xr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xr(n.key),n)}}function si(e,t,r){return t&&Er(e.prototype,t),r&&Er(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xr(e){var t=li(e,"string");return Ge(t)==="symbol"?t:String(t)}function li(e,t){if(Ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var T=function(){function e(r,n,o){if(pi(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=hi(n,o);var i=this.props.id!=="undefined"?this.props.id:Q(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,o=Object.values(this._attachedResources);n<o.length;n++){var i=o[n];i.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),o=this[Symbol.toStringTag];n.get("".concat(o,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(n),i.get("".concat(o," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").subtractCount(this.allocatedBytes),o.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),o=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(o,"s Created")).incrementCount(),n.get("".concat(o,"s Active")).incrementCount()},si(e)}();T.defaultProps={id:"undefined",handle:void 0,userData:void 0};function hi(e,t){var r=fi({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}function ue(e){return ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ue(e)}var Ir;function Rr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function kt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rr(Object(r),!0).forEach(function(n){di(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function di(e,t,r){return t=Br(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ar(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Br(n.key),n)}}function mi(e,t,r){return t&&Ar(e.prototype,t),r&&Ar(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Br(e){var t=bi(e,"string");return ue(t)==="symbol"?t:String(t)}function bi(e,t){if(ue(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ue(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vi(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mt(e,t)}function Mt(e,t){return Mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Mt(e,t)}function gi(e){var t=Oi();return function(){var n=Je(e),o;if(t){var i=Je(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return wi(this,o)}}function wi(e,t){if(t&&(ue(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _i(e)}function _i(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Je(e){return Je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Je(e)}Ir=Symbol.toStringTag;var L=function(e){vi(r,e);var t=gi(r);function r(o,i){var a;yi(this,r);var f=kt({},i);return(i.usage||0)&r.INDEX&&!i.indexType&&(i.data instanceof Uint32Array?f.indexType="uint32":i.data instanceof Uint16Array&&(f.indexType="uint16")),a=t.call(this,o,f,r.defaultProps),a.usage=void 0,a.indexType=void 0,a.byteLength=void 0,a.usage=i.usage||0,a.indexType=f.indexType,a}var n=r.prototype;return n.write=function(i,a){throw new Error("not implemented")},n.readAsync=function(i,a){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},mi(r,[{key:Ir,get:function(){return"Buffer"}}]),r}(T);L.defaultProps=kt(kt({},T.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});L.MAP_READ=1;L.MAP_WRITE=2;L.COPY_SRC=4;L.COPY_DST=8;L.INDEX=16;L.VERTEX=32;L.UNIFORM=64;L.STORAGE=128;L.INDIRECT=256;L.QUERY_RESOLVE=512;function Ce(e){return Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ce(e)}var Nr;function Dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ft(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dr(Object(r),!0).forEach(function(n){Pi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Pi(e,t,r){return t=Gr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Si(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Gr(n.key),n)}}function Ti(e,t,r){return t&&Lr(e.prototype,t),r&&Lr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gr(e){var t=ji(e,"string");return Ce(t)==="symbol"?t:String(t)}function ji(e,t){if(Ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}Nr=Symbol.toStringTag;var ke=function(){function e(r){Si(this,e),this.id=void 0,this.statsManager=qe,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=Ft(Ft({},e.defaultProps),r),this.id=this.props.id||Q(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var o=Ft({},n);return(n.usage||0)&L.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?o.indexType="uint32":n.data instanceof Uint16Array?o.indexType="uint16":S.warn("indices buffer content must be of integer type")()),o},Ti(e,[{key:Nr,get:function(){return"Device"}}]),e}();ke.defaultProps={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(S.get("debug")),break:[],gl:null};ke.VERSION=Tr;function Me(e){return Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(e)}function Ze(e,t){return Ri(e)||xi(e,t)||zr(e,t)||Ei()}function Ei(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xi(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Ri(e){if(Array.isArray(e))return e}function Ai(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=zr(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,f;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return i=p.done,p},e:function(p){a=!0,f=p},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw f}}}}function zr(e,t){if(e){if(typeof e=="string")return Cr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cr(e,t)}}function Cr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function kr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Mr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kr(Object(r),!0).forEach(function(n){Ii(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ii(e,t,r){return t=Vr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Vr(n.key),n)}}function Di(e,t,r){return t&&Fr(e.prototype,t),r&&Fr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vr(e){var t=Li(e,"string");return Me(t)==="symbol"?t:String(t)}function Li(e,t){if(Me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ni=G()&&typeof document<"u",Qe=function(){return Ni&&document.readyState==="complete"},Gi={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},fe=function(){function e(r){var n=this;if(Bi(this,e),this.device=void 0,this.id=void 0,this.props=void 0,this.canvas=void 0,this.htmlCanvas=void 0,this.offscreenCanvas=void 0,this.type=void 0,this.width=1,this.height=1,this.resizeObserver=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this.props=Mr(Mr({},Gi),r),r=this.props,!G()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(r.canvas)typeof r.canvas=="string"?this.canvas=Mi(r.canvas):this.canvas=r.canvas;else{var o,i,a=Fi(r),f=ki(((o=r)===null||o===void 0?void 0:o.container)||null);f.insertBefore(a,f.firstChild),this.canvas=a,(i=r)!==null&&i!==void 0&&i.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&&r.autoResize&&(this.resizeObserver=new ResizeObserver(function(s){var p=Ai(s),b;try{for(p.s();!(b=p.n()).done;){var m=b.value;m.target===n.canvas&&n.update()}}catch(w){p.e(w)}finally{p.f()}}),this.resizeObserver.observe(this.canvas))}var t=e.prototype;return t.getDevicePixelRatio=function(n){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(n=n===void 0?this.props.useDevicePixels:n,!n||n<=0))return 1;if(n===!0){var o=typeof window<"u"&&window.devicePixelRatio;return o||1}return n},t.getPixelSize=function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var n=this.getDevicePixelRatio(),o=this.canvas;return o.parentElement?[o.clientWidth*n,o.clientHeight*n]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}},t.getAspect=function(){var n=this.getPixelSize(),o=Ze(n,2),i=o[0],a=o[1];return i/a},t.cssToDeviceRatio=function(){try{var n=this.getDrawingBufferSize(),o=Ze(n,1),i=o[0],a=this._canvasSizeInfo.clientWidth;return a?i/a:1}catch{return 1}},t.cssToDevicePixels=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this.cssToDeviceRatio(),a=this.getDrawingBufferSize(),f=Ze(a,2),s=f[0],p=f[1];return Ui(n,i,s,p,o)},t.setDevicePixelRatio=function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var i="width"in o?o.width:this.htmlCanvas.clientWidth,a="height"in o?o.height:this.htmlCanvas.clientHeight;(!i||!a)&&(S.log(1,"Canvas clientWidth/clientHeight is 0")(),n=1,i=this.htmlCanvas.width||1,a=this.htmlCanvas.height||1);var f=this._canvasSizeInfo;if(f.clientWidth!==i||f.clientHeight!==a||f.devicePixelRatio!==n){var s=n,p=Math.floor(i*s),b=Math.floor(a*s);this.htmlCanvas.width=p,this.htmlCanvas.height=b;var m=this.getDrawingBufferSize(),w=Ze(m,2),g=w[0],_=w[1];(g!==p||_!==b)&&(s=Math.min(g/i,_/a),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(a*s),S.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=a,this._canvasSizeInfo.devicePixelRatio=n}}},t.getDrawingBufferSize=function(){var n=this.device.gl;if(!n)throw new Error("canvas size");return[n.drawingBufferWidth,n.drawingBufferHeight]},t._setAutoCreatedCanvasId=function(n){var o;((o=this.htmlCanvas)===null||o===void 0?void 0:o.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=n)},Di(e,null,[{key:"isPageLoaded",get:function(){return Qe()}}]),e}();fe.pageLoaded=Ci();function Ci(){return Qe()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function ki(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!Qe())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function Mi(e){var t=document.getElementById(e);if(!t&&!Qe())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function Fi(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function Ui(e,t,r,n,o){var i=e,a=Ur(i[0],t,r),f=Wr(i[1],t,n,o),s=Ur(i[0]+1,t,r),p=s===r-1?s:s-1;s=Wr(i[1]+1,t,n,o);var b;return o?(s=s===0?s:s+1,b=f,f=s):b=s===n-1?s:s-1,{x:a,y:f,width:Math.max(p-a+1,1),height:Math.max(b-f+1,1)}}function Ur(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function Wr(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}function ce(e){return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}var Yr;function Hr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Kr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hr(Object(r),!0).forEach(function(n){Wi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wi(e,t,r){return t=qr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qr(n.key),n)}}function Vi(e,t,r){return t&&$r(e.prototype,t),r&&$r(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qr(e){var t=Hi(e,"string");return ce(t)==="symbol"?t:String(t)}function Hi(e,t){if(ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ki(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ut(e,t)}function Ut(e,t){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ut(e,t)}function $i(e){var t=Xi();return function(){var n=et(e),o;if(t){var i=et(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Yi(this,o)}}function Yi(e,t){if(t&&(ce(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qi(e)}function qi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function et(e){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},et(e)}Yr=Symbol.toStringTag;var F=function(e){Ki(r,e);var t=$i(r);function r(n,o){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.defaultProps;return zi(this,r),i=t.call(this,n,o,a),i.dimension=void 0,i.format=void 0,i.width=void 0,i.height=void 0,i.depth=void 0,i.sampler=void 0,i.dimension=i.props.dimension,i.format=i.props.format,i.width=i.props.width,i.height=i.props.height,i.depth=i.props.depth,i}return Vi(r,[{key:Yr,get:function(){return"Texture"}}]),r}(T);F.defaultProps=Kr(Kr({},T.defaultProps),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});F.COPY_SRC=1;F.COPY_DST=2;F.TEXTURE_BINDING=4;F.STORAGE_BINDING=8;F.RENDER_ATTACHMENT=16;function se(e){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(e)}var Qr;function Xr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xr(Object(r),!0).forEach(function(n){Ji(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ji(e,t,r){return t=en(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,en(n.key),n)}}function Qi(e,t,r){return t&&Zr(e.prototype,t),r&&Zr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function en(e){var t=ea(e,"string");return se(t)==="symbol"?t:String(t)}function ea(e,t){if(se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ta(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wt(e,t)}function Wt(e,t){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Wt(e,t)}function ra(e){var t=ia();return function(){var n=tt(e),o;if(t){var i=tt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return na(this,o)}}function na(e,t){if(t&&(se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oa(e)}function oa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ia(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tt(e)}Qr=Symbol.toStringTag;var rt=function(e){ta(r,e);var t=ra(r);function r(n,o){return Zi(this,r),t.call(this,n,o,r.defaultProps)}return Qi(r,[{key:Qr,get:function(){return"ExternalTexture"}}]),r}(T);rt.defaultProps=Jr(Jr({},T.defaultProps),{},{source:null,colorSpace:"srgb"});function le(e){return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(e)}var on;function tn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function rn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tn(Object(r),!0).forEach(function(n){aa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aa(e,t,r){return t=an(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ua(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,an(n.key),n)}}function fa(e,t,r){return t&&nn(e.prototype,t),r&&nn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function an(e){var t=ca(e,"string");return le(t)==="symbol"?t:String(t)}function ca(e,t){if(le(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zt(e,t)}function zt(e,t){return zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},zt(e,t)}function la(e){var t=da();return function(){var n=nt(e),o;if(t){var i=nt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return pa(this,o)}}function pa(e,t){if(t&&(le(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ha(e)}function ha(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function da(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nt(e){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},nt(e)}on=Symbol.toStringTag;var ot=function(e){sa(r,e);var t=la(r);function r(n,o){var i;return ua(this,r),i=t.call(this,n,o,r.defaultProps),i.stage=void 0,i.source=void 0,i.stage=i.props.stage,i.source=i.props.source,i}return fa(r,[{key:on,get:function(){return"Shader"}}]),r}(T);ot.defaultProps=rn(rn({},T.defaultProps),{},{stage:"vertex",source:"",sourceMap:null,language:"auto",shaderType:0});function pe(e){return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(e)}var sn;function un(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?un(Object(r),!0).forEach(function(n){ya(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):un(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ya(e,t,r){return t=ln(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ma(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ln(n.key),n)}}function ba(e,t,r){return t&&cn(e.prototype,t),r&&cn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ln(e){var t=va(e,"string");return pe(t)==="symbol"?t:String(t)}function va(e,t){if(pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ga(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vt(e,t)}function Vt(e,t){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Vt(e,t)}function wa(e){var t=Pa();return function(){var n=it(e),o;if(t){var i=it(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _a(this,o)}}function _a(e,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oa(e)}function Oa(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},it(e)}sn=Symbol.toStringTag;var he=function(e){ga(r,e);var t=wa(r);function r(n,o){return ma(this,r),t.call(this,n,o,r.defaultProps)}return ba(r,[{key:sn,get:function(){return"Sampler"}}]),r}(T);he.defaultProps=fn(fn({},T.defaultProps),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});function ye(e){return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}var yn;function pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function de(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pn(Object(r),!0).forEach(function(n){Sa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sa(e,t,r){return t=mn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ta(e,t){return Ra(e)||xa(e,t)||Ea(e,t)||ja()}function ja(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ea(e,t){if(e){if(typeof e=="string")return hn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hn(e,t)}}function hn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xa(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Ra(e){if(Array.isArray(e))return e}function Aa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,mn(n.key),n)}}function Ia(e,t,r){return t&&dn(e.prototype,t),r&&dn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mn(e){var t=Ba(e,"string");return ye(t)==="symbol"?t:String(t)}function Ba(e,t){if(ye(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ye(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Da(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ht(e,t)}function Ht(e,t){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ht(e,t)}function La(e){var t=Ca();return function(){var n=at(e),o;if(t){var i=at(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Na(this,o)}}function Na(e,t){if(t&&(ye(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ga(e)}function Ga(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ca(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function at(e){return at=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},at(e)}yn=Symbol.toStringTag;var ut=function(e){Da(r,e);var t=La(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Aa(this,r),i=t.call(this,o,a,r.defaultProps),i.width=void 0,i.height=void 0,i.colorAttachments=[],i.depthStencilAttachment=null,i.width=i.props.width,i.height=i.props.height,i}var n=r.prototype;return n.resize=function(i){var a=!i;if(i){var f=Array.isArray(i)?i:[i.width,i.height],s=Ta(f,2),p=s[0],b=s[1];a=a||b!==this.height||p!==this.width,this.width=p,this.height=b}a&&(S.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))},n.autoCreateAttachmentTextures=function(){var i=this;if(this.colorAttachments=this.props.colorAttachments.map(function(f){if(typeof f=="string"){var s=i.createColorTexture(f);return i.attachResource(s),s}return f}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var a=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(a),this.depthStencilAttachment=a}else this.depthStencilAttachment=this.props.depthStencilAttachment},n.createColorTexture=function(i){return this.device.createTexture({id:"color-attachment",usage:F.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.createDepthStencilTexture=function(i){return this.device.createTexture({id:"depth-stencil-attachment",usage:F.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})},n.resizeAttachments=function(i,a){for(var f=0;f<this.colorAttachments.length;++f)if(this.colorAttachments[f]){var s=this.device._createTexture(de(de({},this.colorAttachments[f].props),{},{width:i,height:a}));this.destroyAttachedResource(this.colorAttachments[f]),this.colorAttachments[f]=s,this.attachResource(s)}if(this.depthStencilAttachment){var p=this.device._createTexture(de(de({},this.depthStencilAttachment.props),{},{width:i,height:a}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=p,this.attachResource(p)}},Ia(r,[{key:yn,get:function(){return"Framebuffer"}}]),r}(T);ut.defaultProps=de(de({},T.defaultProps),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});function me(e){return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}var wn;function bn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bn(Object(r),!0).forEach(function(n){ka(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ka(e,t,r){return t=_n(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ma(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_n(n.key),n)}}function Fa(e,t,r){return t&&gn(e.prototype,t),r&&gn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _n(e){var t=Ua(e,"string");return me(t)==="symbol"?t:String(t)}function Ua(e,t){if(me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Kt(e,t)}function Kt(e,t){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Kt(e,t)}function za(e){var t=Ka();return function(){var n=ft(e),o;if(t){var i=ft(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Va(this,o)}}function Va(e,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ha(e)}function Ha(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ka(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ft(e){return ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ft(e)}wn=Symbol.toStringTag;var ct=function(e){Wa(r,e);var t=za(r);function r(n,o){var i;return Ma(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i.vs=void 0,i.fs=void 0,i.shaderLayout=void 0,i.bufferLayout=void 0,i.shaderLayout=i.props.shaderLayout,i.bufferLayout=i.props.bufferLayout||[],i}return Fa(r,[{key:wn,get:function(){return"RenderPipeline"}}]),r}(T);ct.defaultProps=vn(vn({},T.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function be(e){return be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(e)}var Tn;function On(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Pn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?On(Object(r),!0).forEach(function(n){$a(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):On(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $a(e,t,r){return t=jn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ya(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jn(n.key),n)}}function qa(e,t,r){return t&&Sn(e.prototype,t),r&&Sn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function jn(e){var t=Xa(e,"string");return be(t)==="symbol"?t:String(t)}function Xa(e,t){if(be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ja(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$t(e,t)}function $t(e,t){return $t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$t(e,t)}function Za(e){var t=tu();return function(){var n=st(e),o;if(t){var i=st(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Qa(this,o)}}function Qa(e,t){if(t&&(be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eu(e)}function eu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},st(e)}Tn=Symbol.toStringTag;var lt=function(e){Ja(r,e);var t=Za(r);function r(n,o){var i;return Ya(this,r),i=t.call(this,n,o,r.defaultProps),i.hash="",i}return qa(r,[{key:Tn,get:function(){return"ComputePipeline"}}]),r}(T);lt.defaultProps=Pn(Pn({},T.defaultProps),{},{cs:void 0,csEntryPoint:void 0,csConstants:{},shaderLayout:[]});function ve(e){return ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(e)}var An;function En(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function xn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?En(Object(r),!0).forEach(function(n){ru(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):En(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ru(e,t,r){return t=In(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,In(n.key),n)}}function ou(e,t,r){return t&&Rn(e.prototype,t),r&&Rn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function In(e){var t=iu(e,"string");return ve(t)==="symbol"?t:String(t)}function iu(e,t){if(ve(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ve(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function au(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yt(e,t)}function Yt(e,t){return Yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Yt(e,t)}function uu(e){var t=su();return function(){var n=pt(e),o;if(t){var i=pt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return fu(this,o)}}function fu(e,t){if(t&&(ve(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cu(e)}function cu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function su(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},pt(e)}An=Symbol.toStringTag;var ht=function(e){au(r,e);var t=uu(r);function r(n,o){return nu(this,r),t.call(this,n,o,r.defaultProps)}return ou(r,[{key:An,get:function(){return"RenderPass"}}]),r}(T);ht.defaultProps=xn(xn({},T.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1});function ge(e){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(e)}var Ln;function Bn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function lu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bn(Object(r),!0).forEach(function(n){pu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pu(e,t,r){return t=Nn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Nn(n.key),n)}}function du(e,t,r){return t&&Dn(e.prototype,t),r&&Dn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nn(e){var t=yu(e,"string");return ge(t)==="symbol"?t:String(t)}function yu(e,t){if(ge(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mu(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qt(e,t)}function qt(e,t){return qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},qt(e,t)}function bu(e){var t=wu();return function(){var n=dt(e),o;if(t){var i=dt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return vu(this,o)}}function vu(e,t){if(t&&(ge(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gu(e)}function gu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function dt(e){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dt(e)}Ln=Symbol.toStringTag;var yt=function(e){mu(r,e);var t=bu(r);function r(n,o){return hu(this,r),t.call(this,n,o,T.defaultProps)}return du(r,[{key:Ln,get:function(){return"ComputePass"}}]),r}(T);yt.defaultProps=lu({},T.defaultProps);function _u(e,t){return Tu(e)||Su(e,t)||Pu(e,t)||Ou()}function Ou(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pu(e,t){if(e){if(typeof e=="string")return Gn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gn(e,t)}}function Gn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Su(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Tu(e){if(Array.isArray(e))return e}function Cn(e){var t=_u(Eu[e],2),r=t[0],n=t[1],o=r==="i32"||r==="u32",i=r!=="u32",a=xu[r]*n,f=ju(r,n);return{dataType:r,components:n,defaultVertexFormat:f,byteLength:a,integer:o,signed:i}}function ju(e,t){var r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?r:"".concat(r,"x").concat(t)}var Eu={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]},xu={f32:4,f16:2,i32:4,u32:4};function Mn(e){var t=kn[e],r=Ru(t),n=e.includes("norm"),o=!n&&!e.startsWith("float"),i=e.startsWith("s");return{dataType:kn[e],byteLength:r,integer:o,signed:i,normalized:n}}function Ru(e){var t=Au[e];return t}var kn={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Au={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Iu(e,t){return Nu(e)||Lu(e,t)||Du(e,t)||Bu()}function Bu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Du(e,t){if(e){if(typeof e=="string")return Fn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fn(e,t)}}function Fn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Lu(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Nu(e){if(Array.isArray(e))return e}function q(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=Iu(r,2),o=n[0],i=n[1],a=o,f=i?parseInt(i):1,s=Mn(a),p={type:a,components:f,byteLength:s.byteLength*f,integer:s.integer,signed:s.signed,normalized:s.normalized};return t&&(p.webglOnly=!0),p}function Fe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Gu(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,f;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return i=p.done,p},e:function(p){a=!0,f=p},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw f}}}}function Gu(e,t){if(e){if(typeof e=="string")return Un(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Un(e,t)}}function Un(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Cu(e,t){var r={},n=Fe(e.attributes),o;try{for(n.s();!(o=n.n()).done;){var i=o.value;r[i.name]=ku(e,t,i.name)}}catch(a){n.e(a)}finally{n.f()}return r}function Wn(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16,n=Cu(e,t),o=new Array(r).fill(null),i=0,a=Object.values(n);i<a.length;i++){var f=a[i];o[f.location]=f}return o}function ku(e,t,r){var n=Mu(e,r),o=Fu(t,r);if(!n)return null;var i=Cn(n.type),a=o?.vertexFormat||i.defaultVertexFormat,f=q(a);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:i.dataType,shaderComponents:i.components,vertexFormat:a,bufferDataType:f.type,bufferComponents:f.components,normalized:f.normalized,integer:i.integer,stepMode:o?.stepMode||n.stepMode,byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function Mu(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||S.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function Fu(e,t){Uu(e);var r=Wu(e,t);return r||(r=zu(e,t),r)?r:(S.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Uu(e){var t=Fe(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&S.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(o){t.e(o)}finally{t.f()}}function Wu(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.format&&o.name===t)return{attributeName:o.name,bufferName:t,stepMode:o.stepMode,vertexFormat:o.format,byteOffset:0,byteStride:o.byteStride||0}}}catch(i){r.e(i)}finally{r.f()}return null}function zu(e,t){var r=Fe(e),n;try{for(r.s();!(n=r.n()).done;){var o,i=n.value,a=i.byteStride;if(typeof i.byteStride!="number"){var f=Fe(i.attributes||[]),s;try{for(f.s();!(s=f.n()).done;){var p=s.value,b=q(p.format);a+=b.byteLength}}catch(w){f.e(w)}finally{f.f()}}var m=(o=i.attributes)===null||o===void 0?void 0:o.find(function(w){return w.attribute===t});if(m)return{attributeName:m.attribute,bufferName:i.name,stepMode:i.stepMode,vertexFormat:m.format,byteOffset:m.byteOffset,byteStride:a}}}catch(w){r.e(w)}finally{r.f()}return null}function we(e){return we=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(e)}var Kn;function zn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zn(Object(r),!0).forEach(function(n){Vu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vu(e,t,r){return t=$n(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$n(n.key),n)}}function Ku(e,t,r){return t&&Hn(e.prototype,t),r&&Hn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $n(e){var t=$u(e,"string");return we(t)==="symbol"?t:String(t)}function $u(e,t){if(we(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(we(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yu(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xt(e,t)}function Xt(e,t){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Xt(e,t)}function qu(e){var t=Zu();return function(){var n=mt(e),o;if(t){var i=mt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Xu(this,o)}}function Xu(e,t){if(t&&(we(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ju(e)}function Ju(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function mt(e){return mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mt(e)}Kn=Symbol.toStringTag;var bt=function(e){Yu(r,e);var t=qu(r);function r(n,o){var i;return Hu(this,r),i=t.call(this,n,o,r.defaultProps),i.maxVertexAttributes=void 0,i.attributeInfos=void 0,i.indexBuffer=null,i.attributes=void 0,i.maxVertexAttributes=n.limits.maxVertexAttributes,i.attributes=new Array(i.maxVertexAttributes).fill(null),i.attributeInfos=Wn(o.renderPipeline.shaderLayout,o.renderPipeline.bufferLayout,i.maxVertexAttributes),i}return Ku(r,[{key:Kn,get:function(){return"VertexArray"}}]),r}(T);bt.defaultProps=Vn(Vn({},T.defaultProps),{},{renderPipeline:null});function ee(e){return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(e)}function Jt(){"use strict";Jt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,c){l[u]=c.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",f=o.toStringTag||"@@toStringTag";function s(l,u,c){return Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{s({},"")}catch{s=function(c,h,y){return c[h]=y}}function p(l,u,c,h){var y=u&&u.prototype instanceof w?u:w,d=Object.create(y.prototype),v=new C(h||[]);return n(d,"_invoke",{value:K(l,c,v)}),d}function b(l,u,c){try{return{type:"normal",arg:l.call(u,c)}}catch(h){return{type:"throw",arg:h}}}e.wrap=p;var m={};function w(){}function g(){}function _(){}var I={};s(I,i,function(){return this});var B=Object.getPrototypeOf,x=B&&B(B(M([])));x&&x!==t&&r.call(x,i)&&(I=x);var j=_.prototype=w.prototype=Object.create(I);function D(l){["next","throw","return"].forEach(function(u){s(l,u,function(c){return this._invoke(u,c)})})}function N(l,u){function c(y,d,v,O){var P=b(l[y],l,d);if(P.type!=="throw"){var R=P.arg,E=R.value;return E&&ee(E)=="object"&&r.call(E,"__await")?u.resolve(E.__await).then(function(A){c("next",A,v,O)},function(A){c("throw",A,v,O)}):u.resolve(E).then(function(A){R.value=A,v(R)},function(A){return c("throw",A,v,O)})}O(P.arg)}var h;n(this,"_invoke",{value:function(d,v){function O(){return new u(function(P,R){c(d,v,P,R)})}return h=h?h.then(O,O):O()}})}function K(l,u,c){var h="suspendedStart";return function(y,d){if(h==="executing")throw new Error("Generator is already running");if(h==="completed"){if(y==="throw")throw d;return U()}for(c.method=y,c.arg=d;;){var v=c.delegate;if(v){var O=W(v,c);if(O){if(O===m)continue;return O}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(h==="suspendedStart")throw h="completed",c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);h="executing";var P=b(l,u,c);if(P.type==="normal"){if(h=c.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:c.done}}P.type==="throw"&&(h="completed",c.method="throw",c.arg=P.arg)}}}function W(l,u){var c=u.method,h=l.iterator[c];if(h===void 0)return u.delegate=null,c==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,W(l,u),u.method==="throw")||c!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var y=b(h,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function $(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function k(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function C(l){this.tryEntries=[{tryLoc:"root"}],l.forEach($,this),this.reset(!0)}function M(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var c=-1,h=function y(){for(;++c<l.length;)if(r.call(l,c))return y.value=l[c],y.done=!1,y;return y.value=void 0,y.done=!0,y};return h.next=h}}return{next:U}}function U(){return{value:void 0,done:!0}}return g.prototype=_,n(j,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,f,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===g||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,_):(l.__proto__=_,s(l,f,"GeneratorFunction")),l.prototype=Object.create(j),l},e.awrap=function(l){return{__await:l}},D(N.prototype),s(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,c,h,y){y===void 0&&(y=Promise);var d=new N(p(l,u,c,h),y);return e.isGeneratorFunction(u)?d:d.next().then(function(v){return v.done?v.value:d.next()})},D(j),s(j,f,"Generator"),s(j,i,function(){return this}),s(j,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),c=[];for(var h in u)c.push(h);return c.reverse(),function y(){for(;c.length;){var d=c.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=M,C.prototype={constructor:C,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!u)for(var c in this)c.charAt(0)==="t"&&r.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var c=this;function h(R,E){return v.type="throw",v.arg=u,c.next=R,E&&(c.method="next",c.arg=void 0),!!E}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],v=d.completion;if(d.tryLoc==="root")return h("end");if(d.tryLoc<=this.prev){var O=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(O&&P){if(this.prev<d.catchLoc)return h(d.catchLoc,!0);if(this.prev<d.finallyLoc)return h(d.finallyLoc)}else if(O){if(this.prev<d.catchLoc)return h(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return h(d.finallyLoc)}}}},abrupt:function(u,c){for(var h=this.tryEntries.length-1;h>=0;--h){var y=this.tryEntries[h];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=c&&c<=d.finallyLoc&&(d=null);var v=d?d.completion:{};return v.type=u,v.arg=c,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(v)},complete:function(u,c){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&c&&(this.next=c),m},finish:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.finallyLoc===u)return this.complete(h.completion,h.afterLoc),k(h),m}},catch:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.tryLoc===u){var y=h.completion;if(y.type==="throw"){var d=y.arg;k(h)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,c,h){return this.delegate={iterator:M(u),resultName:c,nextLoc:h},this.method==="next"&&(this.arg=void 0),m}},e}function Yn(e,t,r,n,o,i,a){try{var f=e[i](a),s=f.value}catch(p){r(p);return}f.done?t(s):Promise.resolve(s).then(n,o)}function Qu(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(s){Yn(i,n,o,a,f,"next",s)}function f(s){Yn(i,n,o,a,f,"throw",s)}a(void 0)})}}function qn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tf(n.key),n)}}function ef(e,t,r){return t&&qn(e.prototype,t),r&&qn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function tf(e){var t=rf(e,"string");return ee(t)==="symbol"?t:String(t)}function rf(e,t){if(ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function of(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Zt(e,t)}function Zt(e,t){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Zt(e,t)}function af(e){var t=cf();return function(){var n=vt(e),o;if(t){var i=vt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return uf(this,o)}}function uf(e,t){if(t&&(ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ff(e)}function ff(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vt(e){return vt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vt(e)}function sf(e){var t;return e.byteLength||((t=e.data)===null||t===void 0?void 0:t.byteLength)||0}var gt=function(e){of(r,e);var t=af(r);function r(o,i){var a;nf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.byteLength=void 0,a.device=o,a.byteLength=sf(i);var f=Boolean(i.data),s=Math.ceil(a.byteLength/4)*4;return a.handle=a.props.handle||a.device.handle.createBuffer({size:s,usage:a.props.usage||GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:a.props.mappedAtCreation||f,label:a.props.id}),i.data&&a._writeMapped(i.data),f&&!i.mappedAtCreation&&a.handle.unmap(),a}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.write=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.device.handle.queue.writeBuffer(this.handle,a,i.buffer,i.byteOffset,i.byteLength)},n.readAsync=function(){var o=Qu(Jt().mark(function a(){var f,s,p,b,m,w=arguments;return Jt().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return f=w.length>0&&w[0]!==void 0?w[0]:0,s=w.length>1&&w[1]!==void 0?w[1]:this.byteLength,p=new r(this.device,{usage:L.MAP_READ|L.COPY_DST,byteLength:s}),b=this.device.handle.createCommandEncoder(),b.copyBufferToBuffer(this.handle,f,p.handle,0,s),this.device.handle.queue.submit([b.finish()]),_.next=8,p.handle.mapAsync(GPUMapMode.READ,f,s);case 8:return m=p.handle.getMappedRange().slice(0),p.handle.unmap(),p.destroy(),_.abrupt("return",new Uint8Array(m));case 12:case"end":return _.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),n._writeMapped=function(i){var a=this.handle.getMappedRange();new i.constructor(a).set(i)},n.mapAsync=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=arguments.length>2?arguments[2]:void 0;return this.handle.mapAsync(i,a,f)},n.getMappedRange=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1?arguments[1]:void 0;return this.handle.getMappedRange(i,a)},n.unmap=function(){this.handle.unmap()},ef(r)}(L);function _e(e){if(e.includes("webgl"))throw new Error("webgl-only format");return e}function Oe(e){return Oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe(e)}function Xn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function lf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xn(Object(r),!0).forEach(function(n){pf(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pf(e,t,r){return t=Zn(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Zn(n.key),n)}}function hf(e,t,r){return t&&Jn(e.prototype,t),r&&Jn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zn(e){var t=df(e,"string");return Oe(t)==="symbol"?t:String(t)}function df(e,t){if(Oe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Oe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qt(e,t)}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Qt(e,t)}function bf(e){var t=wf();return function(){var n=wt(e),o;if(t){var i=wt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return vf(this,o)}}function vf(e,t){if(t&&(Oe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gf(e)}function gf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function wt(e){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wt(e)}var V=function(e){mf(r,e);var t=bf(r);function r(o,i){var a;yf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var f=lf({},a.props);return f.type!=="comparison-sampler"&&delete f.compare,a.handle=a.handle||a.device.handle.createSampler(f),a.handle.label=a.props.id,a}var n=r.prototype;return n.destroy=function(){},hf(r)}(he);function Pe(e){return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pe(e)}function Qn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Of(n.key),n)}}function _f(e,t,r){return t&&Qn(e.prototype,t),r&&Qn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Of(e){var t=Pf(e,"string");return Pe(t)==="symbol"?t:String(t)}function Pf(e,t){if(Pe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&er(e,t)}function er(e,t){return er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},er(e,t)}function jf(e){var t=Rf();return function(){var n=_t(e),o;if(t){var i=_t(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ef(this,o)}}function Ef(e,t){if(t&&(Pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xf(e)}function xf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _t(e){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_t(e)}var Af={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},Ot=function(e){Tf(r,e);var t=jf(r);function r(o,i){var a;if(Sf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.view=void 0,a.sampler=void 0,a.height=1,a.width=1,typeof a.props.format=="number")throw new Error("number format");return a.device=o,a.handle=a.props.handle||a.createHandle(),a.props.data&&a.setData({data:a.props.data}),a.width=a.handle.width,a.height=a.handle.height,a.sampler=i.sampler instanceof V?i.sampler:new V(a.device,i.sampler),a.view=a.handle.createView({}),a}var n=r.prototype;return n.createHandle=function(){var i,a;if(typeof this.props.format=="number")throw new Error("number format");var f=this.props.width||((i=this.props.data)===null||i===void 0?void 0:i.width)||1,s=this.props.height||((a=this.props.data)===null||a===void 0?void 0:a.height)||1;return this.device.handle.createTexture({size:{width:f,height:s,depthOrArrayLayers:this.props.depth},dimension:Af[this.props.dimension],format:_e(this.props.format),usage:this.props.usage,mipLevelCount:this.props.mipLevels,sampleCount:this.props.samples})},n.destroy=function(){this.handle.destroy()},n.setSampler=function(i){return this.sampler=i instanceof V?i:new V(this.device,i),this},n.setData=function(i){return this.setImage({source:i.data})},n.setImage=function(i){var a=i.source,f=i.width,s=f===void 0?i.source.width:f,p=i.height,b=p===void 0?i.source.height:p,m=i.depth,w=m===void 0?1:m,g=i.sourceX,_=g===void 0?0:g,I=i.sourceY,B=I===void 0?0:I,x=i.mipLevel,j=x===void 0?0:x,D=i.x,N=D===void 0?0:D,K=i.y,W=K===void 0?0:K,$=i.z,k=$===void 0?0:$,C=i.aspect,M=C===void 0?"all":C,U=i.colorSpace,l=U===void 0?"srgb":U,u=i.premultipliedAlpha,c=u===void 0?!1:u;return this.device.handle.queue.copyExternalImageToTexture({source:a,origin:[_,B]},{texture:this.handle,origin:[N,W,k],mipLevel:j,aspect:M,colorSpace:l,premultipliedAlpha:c},[s,b,w]),{width:s,height:b}},_f(r)}(F);function Se(e){return Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(e)}function eo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Bf(n.key),n)}}function If(e,t,r){return t&&eo(e.prototype,t),r&&eo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bf(e){var t=Df(e,"string");return Se(t)==="symbol"?t:String(t)}function Df(e,t){if(Se(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tr(e,t)}function tr(e,t){return tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},tr(e,t)}function Gf(e){var t=Mf();return function(){var n=Pt(e),o;if(t){var i=Pt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Cf(this,o)}}function Cf(e,t){if(t&&(Se(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kf(e)}function kf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pt(e){return Pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Pt(e)}var to=function(e){Nf(r,e);var t=Gf(r);function r(o,i){var a;return Lf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.sampler=void 0,a.device=o,a.handle=a.props.handle||a.device.handle.importExternalTexture({source:i.source,colorSpace:i.colorSpace}),a.sampler=null,a}var n=r.prototype;return n.destroy=function(){},n.setSampler=function(i){return this.sampler=i instanceof V?i:new V(this.device,i),this},If(r)}(rt);function te(e){return te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},te(e)}function Ue(){"use strict";Ue=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,c){l[u]=c.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",f=o.toStringTag||"@@toStringTag";function s(l,u,c){return Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{s({},"")}catch{s=function(c,h,y){return c[h]=y}}function p(l,u,c,h){var y=u&&u.prototype instanceof w?u:w,d=Object.create(y.prototype),v=new C(h||[]);return n(d,"_invoke",{value:K(l,c,v)}),d}function b(l,u,c){try{return{type:"normal",arg:l.call(u,c)}}catch(h){return{type:"throw",arg:h}}}e.wrap=p;var m={};function w(){}function g(){}function _(){}var I={};s(I,i,function(){return this});var B=Object.getPrototypeOf,x=B&&B(B(M([])));x&&x!==t&&r.call(x,i)&&(I=x);var j=_.prototype=w.prototype=Object.create(I);function D(l){["next","throw","return"].forEach(function(u){s(l,u,function(c){return this._invoke(u,c)})})}function N(l,u){function c(y,d,v,O){var P=b(l[y],l,d);if(P.type!=="throw"){var R=P.arg,E=R.value;return E&&te(E)=="object"&&r.call(E,"__await")?u.resolve(E.__await).then(function(A){c("next",A,v,O)},function(A){c("throw",A,v,O)}):u.resolve(E).then(function(A){R.value=A,v(R)},function(A){return c("throw",A,v,O)})}O(P.arg)}var h;n(this,"_invoke",{value:function(d,v){function O(){return new u(function(P,R){c(d,v,P,R)})}return h=h?h.then(O,O):O()}})}function K(l,u,c){var h="suspendedStart";return function(y,d){if(h==="executing")throw new Error("Generator is already running");if(h==="completed"){if(y==="throw")throw d;return U()}for(c.method=y,c.arg=d;;){var v=c.delegate;if(v){var O=W(v,c);if(O){if(O===m)continue;return O}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(h==="suspendedStart")throw h="completed",c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);h="executing";var P=b(l,u,c);if(P.type==="normal"){if(h=c.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:c.done}}P.type==="throw"&&(h="completed",c.method="throw",c.arg=P.arg)}}}function W(l,u){var c=u.method,h=l.iterator[c];if(h===void 0)return u.delegate=null,c==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,W(l,u),u.method==="throw")||c!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var y=b(h,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function $(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function k(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function C(l){this.tryEntries=[{tryLoc:"root"}],l.forEach($,this),this.reset(!0)}function M(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var c=-1,h=function y(){for(;++c<l.length;)if(r.call(l,c))return y.value=l[c],y.done=!1,y;return y.value=void 0,y.done=!0,y};return h.next=h}}return{next:U}}function U(){return{value:void 0,done:!0}}return g.prototype=_,n(j,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,f,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===g||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,_):(l.__proto__=_,s(l,f,"GeneratorFunction")),l.prototype=Object.create(j),l},e.awrap=function(l){return{__await:l}},D(N.prototype),s(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,c,h,y){y===void 0&&(y=Promise);var d=new N(p(l,u,c,h),y);return e.isGeneratorFunction(u)?d:d.next().then(function(v){return v.done?v.value:d.next()})},D(j),s(j,f,"Generator"),s(j,i,function(){return this}),s(j,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),c=[];for(var h in u)c.push(h);return c.reverse(),function y(){for(;c.length;){var d=c.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=M,C.prototype={constructor:C,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!u)for(var c in this)c.charAt(0)==="t"&&r.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var c=this;function h(R,E){return v.type="throw",v.arg=u,c.next=R,E&&(c.method="next",c.arg=void 0),!!E}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],v=d.completion;if(d.tryLoc==="root")return h("end");if(d.tryLoc<=this.prev){var O=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(O&&P){if(this.prev<d.catchLoc)return h(d.catchLoc,!0);if(this.prev<d.finallyLoc)return h(d.finallyLoc)}else if(O){if(this.prev<d.catchLoc)return h(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return h(d.finallyLoc)}}}},abrupt:function(u,c){for(var h=this.tryEntries.length-1;h>=0;--h){var y=this.tryEntries[h];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=c&&c<=d.finallyLoc&&(d=null);var v=d?d.completion:{};return v.type=u,v.arg=c,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(v)},complete:function(u,c){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&c&&(this.next=c),m},finish:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.finallyLoc===u)return this.complete(h.completion,h.afterLoc),k(h),m}},catch:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.tryLoc===u){var y=h.completion;if(y.type==="throw"){var d=y.arg;k(h)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,c,h){return this.delegate={iterator:M(u),resultName:c,nextLoc:h},this.method==="next"&&(this.arg=void 0),m}},e}function ro(e,t,r,n,o,i,a){try{var f=e[i](a),s=f.value}catch(p){r(p);return}f.done?t(s):Promise.resolve(s).then(n,o)}function no(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(s){ro(i,n,o,a,f,"next",s)}function f(s){ro(i,n,o,a,f,"throw",s)}a(void 0)})}}function oo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Uf(n.key),n)}}function Ff(e,t,r){return t&&oo(e.prototype,t),r&&oo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uf(e){var t=Wf(e,"string");return te(t)==="symbol"?t:String(t)}function Wf(e,t){if(te(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(te(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rr(e,t)}function rr(e,t){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},rr(e,t)}function Hf(e){var t=Yf();return function(){var n=St(e),o;if(t){var i=St(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Kf(this,o)}}function Kf(e,t){if(t&&(te(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $f(e)}function $f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function St(e){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},St(e)}var Tt=function(e){Vf(r,e);var t=Hf(r);function r(o,i){var a;return zf(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a.device.handle.pushErrorScope("validation"),a.handle=a.props.handle||a.createHandle(),a.handle.label=a.props.id,a._checkCompilationError(a.device.handle.popErrorScope()),a}var n=r.prototype;return n._checkCompilationError=function(){var o=no(Ue().mark(function a(f){var s,p;return Ue().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,f;case 2:if(s=m.sent,!s){m.next=9;break}return m.next=6,this.compilationInfo();case 6:throw p=m.sent,S.error("Shader compilation error: ".concat(s.message),p)(),new Error("Shader compilation error: ".concat(s.message));case 9:case"end":return m.stop()}},a,this)}));function i(a){return o.apply(this,arguments)}return i}(),n.destroy=function(){},n.createHandle=function(){var i=this,a=this.props,f=a.source,s=a.stage,p=this.props.language;switch(p==="auto"&&(p=f.includes("->")?"wgsl":"glsl"),p){case"wgsl":return this.device.handle.createShaderModule({code:f});case"glsl":return this.device.handle.createShaderModule({code:f,transform:function(m){return i.device.glslang.compileGLSL(m,s)}});default:throw new Error(p)}},n.compilationInfo=function(){var o=no(Ue().mark(function a(){var f;return Ue().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.handle.getCompilationInfo();case 2:return f=p.sent,p.abrupt("return",f.messages);case 4:case"end":return p.stop()}},a,this)}));function i(){return o.apply(this,arguments)}return i}(),Ff(r)}(ot);function We(e){return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},We(e)}function qf(e,t){return Qf(e)||Zf(e,t)||Jf(e,t)||Xf()}function Xf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
14
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jf(e,t){if(e){if(typeof e=="string")return io(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return io(e,t)}}function io(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zf(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Qf(e){if(Array.isArray(e))return e}function ao(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function uo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ao(Object(r),!0).forEach(function(n){ec(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ao(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ec(e,t,r){return t=tc(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tc(e){var t=rc(e,"string");return We(t)==="symbol"?t:String(t)}function rc(e,t){if(We(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(We(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H(e){return e.depthStencil=e.depthStencil||{format:"depth24plus",stencilFront:{},stencilBack:{},depthWriteEnabled:!1,depthCompare:"less-equal"},e.depthStencil}var nc={cullMode:function(t,r,n){n.primitive=n.primitive||{},n.primitive.cullMode=r},frontFace:function(t,r,n){n.primitive=n.primitive||{},n.primitive.frontFace=r},depthWriteEnabled:function(t,r,n){var o=H(n);o.depthWriteEnabled=r},depthCompare:function(t,r,n){var o=H(n);o.depthCompare=r},depthFormat:function(t,r,n){var o=H(n);o.format=r},depthBias:function(t,r,n){var o=H(n);o.depthBias=r},depthBiasSlopeScale:function(t,r,n){var o=H(n);o.depthBiasSlopeScale=r},depthBiasClamp:function(t,r,n){var o=H(n);o.depthBiasClamp=r},stencilReadMask:function(t,r,n){var o=H(n);o.stencilReadMask=r},stencilWriteMask:function(t,r,n){var o=H(n);o.stencilWriteMask=r},stencilCompare:function(t,r,n){var o=H(n);o.stencilFront.compare=r,o.stencilBack.compare=r},stencilPassOperation:function(t,r,n){var o=H(n);o.stencilFront.passOp=r,o.stencilBack.passOp=r},stencilFailOperation:function(t,r,n){var o=H(n);o.stencilFront.failOp=r,o.stencilBack.failOp=r},stencilDepthFailOperation:function(t,r,n){var o=H(n);o.stencilFront.depthFailOp=r,o.stencilBack.depthFailOp=r},sampleCount:function(t,r,n){n.multisample=n.multisample||{},n.multisample.count=r},sampleMask:function(t,r,n){n.multisample=n.multisample||{},n.multisample.mask=r},sampleAlphaToCoverageEnabled:function(t,r,n){n.multisample=n.multisample||{},n.multisample.alphaToCoverageEnabled=r},colorMask:function(t,r,n){var o=fo(n);o[0].writeMask=r},blendColorOperation:function(t,r,n){fo(n)}},oc={primitive:{cullMode:"back",topology:"triangle-list"},vertex:{module:void 0,entryPoint:"main"},fragment:{module:void 0,entryPoint:"main",targets:[]},layout:"auto"};function co(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Object.assign(e,uo(uo({},oc),e)),ic(e,t)}function ic(e,t){for(var r=0,n=Object.entries(t);r<n.length;r++){var o=qf(n[r],2),i=o[0],a=o[1],f=nc[i];if(!f)throw new Error("Illegal parameter ".concat(i));f(i,a,e)}}function fo(e){var t,r,n,o;if(e.fragment.targets=((t=e.fragment)===null||t===void 0?void 0:t.targets)||[],!Array.isArray((r=e.fragment)===null||r===void 0?void 0:r.targets))throw new Error("colorstate");if(((n=e.fragment)===null||n===void 0||(n=n.targets)===null||n===void 0?void 0:n.length)===0){var i;(i=e.fragment.targets)===null||i===void 0||i.push({})}return(o=e.fragment)===null||o===void 0?void 0:o.targets}function ac(e,t){return sc(e)||cc(e,t)||fc(e,t)||uc()}function uc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
15
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fc(e,t){if(e){if(typeof e=="string")return so(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return so(e,t)}}function so(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function cc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function sc(e){if(Array.isArray(e))return e}function lo(e,t,r,n){var o=pc(n,r);return e.createBindGroup({layout:t,entries:o})}function lc(e,t){var r=e.bindings.find(function(n){return n.name===t});return r||S.warn("Binding ".concat(t," not set: Not found in shader layout."))(),r}function pc(e,t){for(var r=[],n=0,o=Object.entries(e);n<o.length;n++){var i=ac(o[n],2),a=i[0],f=i[1],s=lc(t,a);s&&r.push(hc(f,s.location))}return r}function hc(e,t){if(e instanceof L)return{binding:t,resource:{buffer:e.handle}};if(e instanceof he)return{binding:t,resource:e.handle};if(e instanceof F)return{binding:t,resource:e.handle.createView()};throw new Error("invalid binding")}function Te(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=dc(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
16
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,f;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return i=p.done,p},e:function(p){a=!0,f=p},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw f}}}}function dc(e,t){if(e){if(typeof e=="string")return po(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return po(e,t)}}function po(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function nr(e){if(e.endsWith("-webgl"))throw new Error("WebGPU does not support vertex format ".concat(e));return e}function yo(e,t){var r=[],n=new Set,o=Te(t),i;try{for(o.s();!(i=o.n()).done;){var a=i.value,f=[],s="vertex",p=0;if(a.attributes){var b=Te(a.attributes),m;try{for(b.s();!(m=b.n()).done;){var w=m.value,g=w.attribute,_=ho(e,g,n);s=_.stepMode||"vertex",f.push({format:nr(w.format||a.format),offset:w.byteOffset,shaderLocation:_.location}),p+=q(a.format).byteLength}}catch(D){b.e(D)}finally{b.f()}}else{var I=ho(e,a.name,n);p=q(a.format).byteLength,s=I.stepMode||"vertex",f.push({format:nr(a.format),offset:0,shaderLocation:I.location})}r.push({arrayStride:a.byteStride||p,stepMode:s||"vertex",attributes:f})}}catch(D){o.e(D)}finally{o.f()}var B=Te(e.attributes),x;try{for(B.s();!(x=B.n()).done;){var j=x.value;n.has(j.name)||r.push({arrayStride:q("float32x3").byteLength,stepMode:j.stepMode||"vertex",attributes:[{format:nr("float32x3"),offset:0,shaderLocation:j.location}]})}}catch(D){B.e(D)}finally{B.f()}return r}function mo(e,t){var r=new Set,n=0,o={},i=Te(t),a;try{for(i.s();!(a=i.n()).done;){var f=a.value;if("attributes"in f){var s=Te(f.attributes),p;try{for(s.s();!(p=s.n()).done;){var b=p.value;r.add(b.attribute)}}catch(_){s.e(_)}finally{s.f()}}else r.add(f.name);o[f.name]=n++}}catch(_){i.e(_)}finally{i.f()}var m=Te(e.attributes),w;try{for(m.s();!(w=m.n()).done;){var g=w.value;r.has(g.name)||(o[g.name]=n++)}}catch(_){m.e(_)}finally{m.f()}return o}function ho(e,t,r){var n=e.attributes.find(function(o){return o.name===t});if(!n)throw new Error("Unknown attribute ".concat(t));if(r.has(t))throw new Error("Duplicate attribute ".concat(t));return r.add(t),n}function je(e){return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},je(e)}function yc(e,t){return gc(e)||vc(e,t)||bc(e,t)||mc()}function mc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
17
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bc(e,t){if(e){if(typeof e=="string")return bo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bo(e,t)}}function bo(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function vc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function gc(e){if(Array.isArray(e))return e}function vo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_c(n.key),n)}}function wc(e,t,r){return t&&vo(e.prototype,t),r&&vo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _c(e){var t=Oc(e,"string");return je(t)==="symbol"?t:String(t)}function Oc(e,t){if(je(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(je(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&or(e,t)}function or(e,t){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},or(e,t)}function Tc(e){var t=xc();return function(){var n=Et(e),o;if(t){var i=Et(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return jc(this,o)}}function jc(e,t){if(t&&(je(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ec(e)}function Ec(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Et(e)}var go=function(e){Sc(r,e);var t=Tc(r);function r(o,i){var a;if(Pc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.vs=void 0,a.fs=null,a._bufferSlots=void 0,a._buffers=void 0,a._indexBuffer=null,a._bindGroupLayout=null,a._bindGroup=null,a.device=o,a.handle=a.props.handle,!a.handle){var f=a._getRenderPipelineDescriptor();S.groupCollapsed(1,"new WebGPURenderPipeline(".concat(a.id,")"))(),S.probe(1,JSON.stringify(f,null,2))(),S.groupEnd(1)(),a.handle=a.device.handle.createRenderPipeline(f)}return a.handle.label=a.props.id,a.vs=i.vs,a.fs=i.fs,a._bufferSlots=mo(a.props.shaderLayout,a.props.bufferLayout),a._buffers=new Array(Object.keys(a._bufferSlots).length).fill(null),a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this._indexBuffer=i},n.setAttributes=function(i){for(var a=0,f=Object.entries(i);a<f.length;a++){var s=yc(f[a],2),p=s[0],b=s[1],m=this._bufferSlots[p];if(m>=0)this._buffers[m]=b;else throw new Error("Setting attribute '".concat(p,"' not listed in shader layout for program ").concat(this.id))}},n.setConstantAttributes=function(i){throw new Error("not implemented")},n.setBindings=function(i){Xe(this.props.bindings)||(Object.assign(this.props.bindings,i),this._bindGroupLayout=this._bindGroupLayout||this.handle.getBindGroupLayout(0),this._bindGroup=lo(this.device.handle,this._bindGroupLayout,this.props.shaderLayout,this.props.bindings))},n.setUniforms=function(i){if(!Xe(i))throw new Error("WebGPU does not support uniforms")},n._getBuffers=function(){return this._buffers},n._getBindGroup=function(){return this._bindGroup},n._getRenderPipelineDescriptor=function(){var i={module:this.props.vs.handle,entryPoint:this.props.vsEntryPoint||"main",buffers:yo(this.props.shaderLayout,this.props.bufferLayout)},a;if(this.props.fs){var f;a={module:this.props.fs.handle,entryPoint:this.props.fsEntryPoint||"main",targets:[{format:_e((f=this.device)===null||f===void 0||(f=f.canvasContext)===null||f===void 0?void 0:f.format)}]}}switch(this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":throw new Error("WebGPU does not support primitive topology ".concat(this.props.topology));default:}var s={vertex:i,fragment:a,primitive:{topology:this.props.topology},layout:"auto"};return co(s,this.props.parameters),s},n.draw=function(i){var a=i.renderPass||this.device.getDefaultRenderPass();a.handle.setPipeline(this.handle);var f=this._getBindGroup();f&&a.handle.setBindGroup(0,f),this._setAttributeBuffers(a),i.indexCount?a.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):a.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstInstance)},n._setAttributeBuffers=function(i){var a=this;this._indexBuffer&&i.handle.setIndexBuffer(this._indexBuffer.handle,this._indexBuffer.props.indexType);for(var f=this._getBuffers(),s=function(m){var w=f[m];if(!w){var g=a.props.shaderLayout.attributes.find(function(_){return _.location===m});throw new Error("No buffer provided for attribute '".concat(g?.name||"","' in Model '").concat(a.props.id,"'"))}i.handle.setVertexBuffer(m,w.handle)},p=0;p<f.length;++p)s(p)},wc(r)}(ct);function Ee(e){return Ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(e)}function wo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ac(n.key),n)}}function Rc(e,t,r){return t&&wo(e.prototype,t),r&&wo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ac(e){var t=Ic(e,"string");return Ee(t)==="symbol"?t:String(t)}function Ic(e,t){if(Ee(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ir(e,t)}function ir(e,t){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ir(e,t)}function Lc(e){var t=Cc();return function(){var n=xt(e),o;if(t){var i=xt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Nc(this,o)}}function Nc(e,t){if(t&&(Ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gc(e)}function Gc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xt(e)}var _o=function(e){Dc(r,e);var t=Lc(r);function r(o,i){var a;Bc(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o;var f=a.props.cs.handle;return a.handle=a.props.handle||a.device.handle.createComputePipeline({label:a.props.id,compute:{module:f,entryPoint:a.props.csEntryPoint},layout:"auto"}),a}var n=r.prototype;return n._getBindGroupLayout=function(){return this.handle.getBindGroupLayout(0)},Rc(r)}(lt);function xe(e){return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xe(e)}function Oo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Mc(n.key),n)}}function kc(e,t,r){return t&&Oo(e.prototype,t),r&&Oo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mc(e){var t=Fc(e,"string");return xe(t)==="symbol"?t:String(t)}function Fc(e,t){if(xe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Uc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ar(e,t)}function ar(e,t){return ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ar(e,t)}function zc(e){var t=Kc();return function(){var n=Rt(e),o;if(t){var i=Rt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Vc(this,o)}}function Vc(e,t){if(t&&(xe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hc(e)}function Hc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rt(e)}var Po=function(e){Wc(r,e);var t=zc(r);function r(o){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Uc(this,r),i=t.call(this,o,a),i.device=void 0,i.handle=void 0,i.pipeline=null,i.device=o;var f=a.framebuffer||o.canvasContext.getCurrentFramebuffer(),s=i.getRenderPassDescriptor(f);return S.groupCollapsed(1,"new WebGPURenderPass(".concat(i.id,")"))(),S.probe(1,JSON.stringify(s,null,2))(),S.groupEnd(1)(),i.handle=i.props.handle||o.commandEncoder.beginRenderPass(s),i.handle.label=i.props.id,i}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){this.pipeline=i,this.handle.setPipeline(this.pipeline.handle)},n.setBindings=function(i){var a,f;(a=this.pipeline)===null||a===void 0||a.setBindings(i);var s=(f=this.pipeline)===null||f===void 0?void 0:f._getBindGroup();s&&this.handle.setBindGroup(0,s)},n.setIndexBuffer=function(i,a){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;this.handle.setIndexBuffer(i.handle,a,f,s)},n.setVertexBuffer=function(i,a){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;this.handle.setVertexBuffer(i,a.handle,f)},n.draw=function(i){i.indexCount?this.handle.drawIndexed(i.indexCount,i.instanceCount,i.firstIndex,i.baseVertex,i.firstInstance):this.handle.draw(i.vertexCount||0,i.instanceCount||1,i.firstIndex,i.firstInstance)},n.drawIndirect=function(){},n.setParameters=function(i){var a=i.blendConstant,f=i.stencilReference,s=i.scissorRect,p=i.viewport;a&&this.handle.setBlendConstant(a),f&&this.handle.setStencilReference(f),s&&this.handle.setScissorRect(s[0],s[1],s[2],s[3]),p&&this.handle.setViewport(p[0],p[1],p[2],p[3],p[4],p[5])},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},n.getRenderPassDescriptor=function(i){var a=this,f={colorAttachments:[]};if(f.colorAttachments=i.colorAttachments.map(function(m){return{loadOp:a.props.clearColor!==!1?"clear":"load",colorClearValue:a.props.clearColor||[0,0,0,0],storeOp:a.props.discard?"discard":"store",view:m.handle.createView()}}),i.depthStencilAttachment){f.depthStencilAttachment={view:i.depthStencilAttachment.handle.createView()};var s=f.depthStencilAttachment;this.props.depthReadOnly&&(s.depthReadOnly=!0),s.depthClearValue=this.props.clearDepth||0;var p=!0;p&&(s.depthLoadOp=this.props.clearDepth!==!1?"clear":"load",s.depthStoreOp="store");var b=!1;b&&(s.stencilLoadOp=this.props.clearStencil!==!1?"clear":"load",s.stencilStoreOp="store")}return f},kc(r)}(ht);function Re(e){return Re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Re(e)}function So(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Yc(n.key),n)}}function $c(e,t,r){return t&&So(e.prototype,t),r&&So(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yc(e){var t=qc(e,"string");return Re(t)==="symbol"?t:String(t)}function qc(e,t){if(Re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ur(e,t)}function ur(e,t){return ur=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ur(e,t)}function Zc(e){var t=ts();return function(){var n=At(e),o;if(t){var i=At(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Qc(this,o)}}function Qc(e,t){if(t&&(Re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return es(e)}function es(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ts(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},At(e)}var To=function(e){Jc(r,e);var t=Zc(r);function r(o,i){var a,f;return Xc(this,r),f=t.call(this,o,i),f.device=void 0,f.handle=void 0,f._bindGroupLayout=null,f.device=o,f.handle=f.props.handle||((a=o.commandEncoder)===null||a===void 0?void 0:a.beginComputePass({label:f.props.id})),f}var n=r.prototype;return n.destroy=function(){},n.end=function(){this.handle.end()},n.setPipeline=function(i){var a=i;this.handle.setPipeline(a.handle),this._bindGroupLayout=a._getBindGroupLayout()},n.setBindings=function(i){throw new Error("fix me")},n.dispatch=function(i,a,f){this.handle.dispatchWorkgroups(i,a,f)},n.dispatchIndirect=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.handle.dispatchWorkgroupsIndirect(i.handle,a)},n.pushDebugGroup=function(i){this.handle.pushDebugGroup(i)},n.popDebugGroup=function(){this.handle.popDebugGroup()},n.insertDebugMarker=function(i){this.handle.insertDebugMarker(i)},$c(r)}(yt);function Ae(e){return Ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(e)}var Eo;function rs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,os(n.key),n)}}function ns(e,t,r){return t&&jo(e.prototype,t),r&&jo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function os(e){var t=is(e,"string");return Ae(t)==="symbol"?t:String(t)}function is(e,t){if(Ae(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ae(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function as(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fr(e,t)}function fr(e,t){return fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},fr(e,t)}function us(e){var t=ss();return function(){var n=It(e),o;if(t){var i=It(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return fs(this,o)}}function fs(e,t){if(t&&(Ae(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cs(e)}function cs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ss(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},It(e)}Eo=Symbol.toStringTag;var xo=function(e){as(r,e);var t=us(r);r.isConstantAttributeZeroSupported=function(i){return i.info.type==="webgl2"||He()==="Chrome"};function r(o,i){var a;return rs(this,r),a=t.call(this,o,i),a.device=void 0,a.handle=void 0,a.device=o,a}var n=r.prototype;return n.destroy=function(){},n.setIndexBuffer=function(i){this.indexBuffer=i},n.setBuffer=function(i,a){this.attributes[i]=a},n.setConstant=function(i,a){S.warn("".concat(this.id," constant attributes not supported on WebGPU"))},n.bindBeforeRender=function(i,a,f){var s=i,p=this.indexBuffer;s.handle.setIndexBuffer(p?.handle,p?.indexType);for(var b=0;b<this.maxVertexAttributes;b++){var m=this.attributes[b];s.handle.setVertexBuffer(b,m.handle)}},n.unbindAfterRender=function(i){},ns(r,[{key:Eo,get:function(){return"WebGPUVertexArray"}}]),r}(bt);function Ie(e){return Ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(e)}function Ro(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ps(n.key),n)}}function ls(e,t,r){return t&&Ro(e.prototype,t),r&&Ro(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ps(e){var t=hs(e,"string");return Ie(t)==="symbol"?t:String(t)}function hs(e,t){if(Ie(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ie(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ys(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cr(e,t)}function cr(e,t){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},cr(e,t)}function ms(e){var t=gs();return function(){var n=Bt(e),o;if(t){var i=Bt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return bs(this,o)}}function bs(e,t){if(t&&(Ie(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vs(e)}function vs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Bt(e){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Bt(e)}var Ao=function(e){ys(r,e);var t=ms(r);function r(n,o){var i;return ds(this,r),i=t.call(this,n,o),i.device=void 0,i.device=n,i.autoCreateAttachmentTextures(),i}return ls(r)}(ut);function Be(e){return Be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Be(e)}function ws(e,t){return Ss(e)||Ps(e,t)||Os(e,t)||_s()}function _s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
18
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Os(e,t){if(e){if(typeof e=="string")return Io(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Io(e,t)}}function Io(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ps(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,f=[],s=!0,p=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);s=!0);}catch(b){p=!0,o=b}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw o}}return f}}function Ss(e){if(Array.isArray(e))return e}function Bo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,js(n.key),n)}}function Ts(e,t,r){return t&&Bo(e.prototype,t),r&&Bo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function js(e){var t=Es(e,"string");return Be(t)==="symbol"?t:String(t)}function Es(e,t){if(Be(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rs(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sr(e,t)}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},sr(e,t)}function As(e){var t=Ds();return function(){var n=Dt(e),o;if(t){var i=Dt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Is(this,o)}}function Is(e,t){if(t&&(Be(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bs(e)}function Bs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ds(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Dt(e){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dt(e)}var lr=function(e){Rs(r,e);var t=As(r);function r(o,i,a){var f;return xs(this,r),f=t.call(this,a),f.device=void 0,f.gpuCanvasContext=void 0,f.format=navigator.gpu.getPreferredCanvasFormat(),f.depthStencilFormat="depth24plus",f.depthStencilAttachment=null,f.device=o,f.width=-1,f.height=-1,f._setAutoCreatedCanvasId("".concat(f.device.id,"-canvas")),f.gpuCanvasContext=f.canvas.getContext("webgpu"),f.format="bgra8unorm",f}var n=r.prototype;return n.destroy=function(){this.gpuCanvasContext.unconfigure()},n.getCurrentTexture=function(){return this.device._createTexture({id:"default-render-target",handle:this.gpuCanvasContext.getCurrentTexture()})},n.getCurrentFramebuffer=function(){this.update();var i=this.getCurrentTexture();return this.width=i.width,this.height=i.height,this._createDepthStencilAttachment(),new Ao(this.device,{colorAttachments:[i],depthStencilAttachment:this.depthStencilAttachment})},n.update=function(){var i=this.getPixelSize(),a=ws(i,2),f=a[0],s=a[1],p=f!==this.width||s!==this.height;p&&(this.width=f,this.height=s,this.depthStencilAttachment&&(this.depthStencilAttachment.destroy(),this.depthStencilAttachment=null),this.gpuCanvasContext.configure({device:this.device.handle,format:_e(this.format),colorSpace:this.props.colorSpace,alphaMode:this.props.alphaMode}),S.log(1,"Resized to ".concat(this.width,"x").concat(this.height,"px"))())},n.resize=function(i){this.update()},n._createDepthStencilAttachment=function(){return this.depthStencilAttachment||(this.depthStencilAttachment=this.device.createTexture({id:"depth-stencil-target",format:this.depthStencilFormat,width:this.width,height:this.height,usage:GPUTextureUsage.RENDER_ATTACHMENT})),this.depthStencilAttachment},Ts(r)}(fe);function re(e){return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(e)}function Do(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Lo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Do(Object(r),!0).forEach(function(n){Ls(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Do(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ls(e,t,r){return t=ko(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ze(){"use strict";ze=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,u,c){l[u]=c.value},o=typeof Symbol=="function"?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",f=o.toStringTag||"@@toStringTag";function s(l,u,c){return Object.defineProperty(l,u,{value:c,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{s({},"")}catch{s=function(c,h,y){return c[h]=y}}function p(l,u,c,h){var y=u&&u.prototype instanceof w?u:w,d=Object.create(y.prototype),v=new C(h||[]);return n(d,"_invoke",{value:K(l,c,v)}),d}function b(l,u,c){try{return{type:"normal",arg:l.call(u,c)}}catch(h){return{type:"throw",arg:h}}}e.wrap=p;var m={};function w(){}function g(){}function _(){}var I={};s(I,i,function(){return this});var B=Object.getPrototypeOf,x=B&&B(B(M([])));x&&x!==t&&r.call(x,i)&&(I=x);var j=_.prototype=w.prototype=Object.create(I);function D(l){["next","throw","return"].forEach(function(u){s(l,u,function(c){return this._invoke(u,c)})})}function N(l,u){function c(y,d,v,O){var P=b(l[y],l,d);if(P.type!=="throw"){var R=P.arg,E=R.value;return E&&re(E)=="object"&&r.call(E,"__await")?u.resolve(E.__await).then(function(A){c("next",A,v,O)},function(A){c("throw",A,v,O)}):u.resolve(E).then(function(A){R.value=A,v(R)},function(A){return c("throw",A,v,O)})}O(P.arg)}var h;n(this,"_invoke",{value:function(d,v){function O(){return new u(function(P,R){c(d,v,P,R)})}return h=h?h.then(O,O):O()}})}function K(l,u,c){var h="suspendedStart";return function(y,d){if(h==="executing")throw new Error("Generator is already running");if(h==="completed"){if(y==="throw")throw d;return U()}for(c.method=y,c.arg=d;;){var v=c.delegate;if(v){var O=W(v,c);if(O){if(O===m)continue;return O}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(h==="suspendedStart")throw h="completed",c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);h="executing";var P=b(l,u,c);if(P.type==="normal"){if(h=c.done?"completed":"suspendedYield",P.arg===m)continue;return{value:P.arg,done:c.done}}P.type==="throw"&&(h="completed",c.method="throw",c.arg=P.arg)}}}function W(l,u){var c=u.method,h=l.iterator[c];if(h===void 0)return u.delegate=null,c==="throw"&&l.iterator.return&&(u.method="return",u.arg=void 0,W(l,u),u.method==="throw")||c!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var y=b(h,l.iterator,u.arg);if(y.type==="throw")return u.method="throw",u.arg=y.arg,u.delegate=null,m;var d=y.arg;return d?d.done?(u[l.resultName]=d.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=void 0),u.delegate=null,m):d:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,m)}function $(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function k(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function C(l){this.tryEntries=[{tryLoc:"root"}],l.forEach($,this),this.reset(!0)}function M(l){if(l){var u=l[i];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var c=-1,h=function y(){for(;++c<l.length;)if(r.call(l,c))return y.value=l[c],y.done=!1,y;return y.value=void 0,y.done=!0,y};return h.next=h}}return{next:U}}function U(){return{value:void 0,done:!0}}return g.prototype=_,n(j,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,f,"GeneratorFunction"),e.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return!!u&&(u===g||(u.displayName||u.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,_):(l.__proto__=_,s(l,f,"GeneratorFunction")),l.prototype=Object.create(j),l},e.awrap=function(l){return{__await:l}},D(N.prototype),s(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,u,c,h,y){y===void 0&&(y=Promise);var d=new N(p(l,u,c,h),y);return e.isGeneratorFunction(u)?d:d.next().then(function(v){return v.done?v.value:d.next()})},D(j),s(j,f,"Generator"),s(j,i,function(){return this}),s(j,"toString",function(){return"[object Generator]"}),e.keys=function(l){var u=Object(l),c=[];for(var h in u)c.push(h);return c.reverse(),function y(){for(;c.length;){var d=c.pop();if(d in u)return y.value=d,y.done=!1,y}return y.done=!0,y}},e.values=M,C.prototype={constructor:C,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!u)for(var c in this)c.charAt(0)==="t"&&r.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=void 0)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var c=this;function h(R,E){return v.type="throw",v.arg=u,c.next=R,E&&(c.method="next",c.arg=void 0),!!E}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],v=d.completion;if(d.tryLoc==="root")return h("end");if(d.tryLoc<=this.prev){var O=r.call(d,"catchLoc"),P=r.call(d,"finallyLoc");if(O&&P){if(this.prev<d.catchLoc)return h(d.catchLoc,!0);if(this.prev<d.finallyLoc)return h(d.finallyLoc)}else if(O){if(this.prev<d.catchLoc)return h(d.catchLoc,!0)}else{if(!P)throw new Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return h(d.finallyLoc)}}}},abrupt:function(u,c){for(var h=this.tryEntries.length-1;h>=0;--h){var y=this.tryEntries[h];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=c&&c<=d.finallyLoc&&(d=null);var v=d?d.completion:{};return v.type=u,v.arg=c,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(v)},complete:function(u,c){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&c&&(this.next=c),m},finish:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.finallyLoc===u)return this.complete(h.completion,h.afterLoc),k(h),m}},catch:function(u){for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c];if(h.tryLoc===u){var y=h.completion;if(y.type==="throw"){var d=y.arg;k(h)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,c,h){return this.delegate={iterator:M(u),resultName:c,nextLoc:h},this.method==="next"&&(this.arg=void 0),m}},e}function No(e,t,r,n,o,i,a){try{var f=e[i](a),s=f.value}catch(p){r(p);return}f.done?t(s):Promise.resolve(s).then(n,o)}function Go(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(s){No(i,n,o,a,f,"next",s)}function f(s){No(i,n,o,a,f,"throw",s)}a(void 0)})}}function Ns(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Co(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ko(n.key),n)}}function Gs(e,t,r){return t&&Co(e.prototype,t),r&&Co(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ko(e){var t=Cs(e,"string");return re(t)==="symbol"?t:String(t)}function Cs(e,t){if(re(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ks(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pr(e,t)}function pr(e,t){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},pr(e,t)}function Ms(e){var t=Us();return function(){var n=Lt(e),o;if(t){var i=Lt(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Fs(this,o)}}function Fs(e,t){if(t&&(re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mo(e)}function Mo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Us(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Lt(e){return Lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lt(e)}var hr=function(e){ks(r,e);var t=Ms(r);r.isSupported=function(){return Boolean(typeof navigator<"u"&&navigator.gpu)},r.create=function(){var o=Go(ze().mark(function a(f){var s,p,b,m;return ze().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(navigator.gpu){g.next=2;break}throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");case 2:return S.groupCollapsed(1,"WebGPUDevice created")(),g.next=5,navigator.gpu.requestAdapter({powerPreference:"high-performance"});case 5:if(s=g.sent,s){g.next=8;break}throw new Error("Failed to request WebGPU adapter");case 8:return g.next=10,s.requestAdapterInfo();case 10:return p=g.sent,S.probe(1,"Adapter available",p)(),g.next=14,s.requestDevice({requiredFeatures:s.features});case 14:if(b=g.sent,S.probe(1,"GPUDevice available")(),typeof f.canvas!="string"){g.next=20;break}return g.next=19,fe.pageLoaded;case 19:S.probe(1,"DOM is loaded")();case 20:return m=new r(b,s,f),S.probe(1,"Device created",m.info)(),S.table(1,m.info)(),S.groupEnd(1)(),g.abrupt("return",m);case 25:case"end":return g.stop()}},a)}));function i(a){return o.apply(this,arguments)}return i}();function r(o,i,a){var f;return Ns(this,r),f=t.call(this,Lo(Lo({},a),{},{id:a.id||Q("webgpu-device")})),f.handle=void 0,f.adapter=void 0,f.lost=void 0,f.canvasContext=null,f.commandEncoder=null,f.renderPass=null,f._info=void 0,f._isLost=!1,f.features=void 0,f.handle=o,f.adapter=i,f._info={type:"webgpu",vendor:f.adapter.__brand,renderer:"",version:"",gpu:"unknown",shadingLanguage:"wgsl",shadingLanguageVersion:100,vendorMasked:"",rendererMasked:""},f.lost=new Promise(function(){var s=Go(ze().mark(function p(b){var m;return ze().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,f.handle.lost;case 2:m=g.sent,f._isLost=!0,b({reason:"destroyed",message:m.message});case 5:case"end":return g.stop()}},p)}));return function(p){return s.apply(this,arguments)}}()),f.canvasContext=new lr(Mo(f),f.adapter,{canvas:a.canvas,height:a.height,width:a.width,container:a.container}),f.features=f._getFeatures(),f}var n=r.prototype;return n.destroy=function(){this.handle.destroy()},n.isTextureFormatSupported=function(i){return!i.includes("webgl")},n.isTextureFormatFilterable=function(i){return this.isTextureFormatSupported(i)},n.isTextureFormatRenderable=function(i){return this.isTextureFormatSupported(i)},n.createBuffer=function(i){var a=this._getBufferProps(i);return new gt(this,a)},n._createTexture=function(i){return new Ot(this,i)},n.createExternalTexture=function(i){return new to(this,i)},n.createShader=function(i){return new Tt(this,i)},n.createSampler=function(i){return new V(this,i)},n.createRenderPipeline=function(i){return new go(this,i)},n.createFramebuffer=function(i){throw new Error("Not implemented")},n.createComputePipeline=function(i){return new _o(this,i)},n.createVertexArray=function(i){return new xo(this,i)},n.beginRenderPass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new Po(this,i)},n.beginComputePass=function(i){return this.commandEncoder=this.commandEncoder||this.handle.createCommandEncoder(),new To(this,i)},n.createTransformFeedback=function(i){throw new Error("Transform feedback not supported in WebGPU")},n.createCanvasContext=function(i){return new lr(this,this.adapter,i)},n.getDefaultRenderPass=function(){throw new Error("a")},n.submit=function(){var i,a=(i=this.commandEncoder)===null||i===void 0?void 0:i.finish();a&&this.handle.queue.submit([a]),this.commandEncoder=null},n._getFeatures=function(){var i=new Set(this.handle.features);return i.has("depth-clamping")&&(i.delete("depth-clamping"),i.add("depth-clip-control")),i.has("texture-compression-bc")&&i.add("texture-compression-bc5-webgl"),i.add("webgpu"),i.add("timer-query-webgl"),i.add("vertex-array-object-webgl1"),i.add("instanced-rendering-webgl1"),i.add("multiple-render-targets-webgl1"),i.add("index-uint32-webgl1"),i.add("blend-minmax-webgl1"),i.add("texture-blend-float-webgl1"),i.add("texture-formats-srgb-webgl1"),i.add("texture-formats-depth-webgl1"),i.add("texture-formats-float32-webgl1"),i.add("texture-formats-float16-webgl1"),i.add("texture-filter-linear-float32-webgl"),i.add("texture-filter-linear-float16-webgl"),i.add("texture-filter-anisotropic-webgl"),i.add("texture-renderable-rgba32float-webgl"),i.add("texture-renderable-float32-webgl"),i.add("texture-renderable-float16-webgl"),i.add("glsl-frag-data"),i.add("glsl-frag-depth"),i.add("glsl-derivatives"),i.add("glsl-texture-lod"),i},n.copyExternalImageToTexture=function(i){var a,f=i.source,s=i.sourceX,p=s===void 0?0:s,b=i.sourceY,m=b===void 0?0:b,w=i.texture,g=i.mipLevel,_=g===void 0?0:g,I=i.aspect,B=I===void 0?"all":I,x=i.colorSpace,j=x===void 0?"display-p3":x,D=i.premultipliedAlpha,N=D===void 0?!1:D,K=i.width,W=K===void 0?w.width:K,$=i.height,k=$===void 0?w.height:$,C=i.depth,M=C===void 0?1:C,U=w;(a=this.handle)===null||a===void 0||a.queue.copyExternalImageToTexture({source:f,origin:[p,m]},{texture:U.handle,origin:[0,0,0],mipLevel:_,aspect:B,colorSpace:j,premultipliedAlpha:N},[W,k,M])},Gs(r,[{key:"info",get:function(){return this._info}},{key:"limits",get:function(){return this.handle.limits}},{key:"isLost",get:function(){return this._isLost}}]),r}(ke);hr.type="webgpu";return Ho(Ws);})();
|
|
19
19
|
return __exports__;
|
|
20
20
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgpu",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.50",
|
|
4
4
|
"description": "WebGPU adapter for the luma.gl API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
40
|
+
"@luma.gl/core": "9.0.0-alpha.50",
|
|
41
41
|
"@probe.gl/env": "^4.0.2",
|
|
42
42
|
"@webgpu/types": "^0.1.34"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "83899806fcfab67f97cc8b308f81e4844a05ca05"
|
|
45
45
|
}
|
|
@@ -67,7 +67,7 @@ export class WebGPUMipmapGenerator {
|
|
|
67
67
|
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.SAMPLED | GPUTextureUsage.OUTPUT_ATTACHMENT,
|
|
68
68
|
mipLevelCount
|
|
69
69
|
});
|
|
70
|
-
this.device.queue.copyImageBitmapToTexture({ imageBitmap }, { texture
|
|
70
|
+
this.device.queue.copyImageBitmapToTexture({ imageBitmap }, { texture }, textureSize);
|
|
71
71
|
|
|
72
72
|
const commandEncoder = this.device.createCommandEncoder({});
|
|
73
73
|
for (let i = 1; i < mipLevelCount; ++i) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
2
|
import type {ShaderLayout, BufferLayout, AttributeDeclaration, VertexFormat} from '@luma.gl/core';
|
|
3
|
-
import {
|
|
3
|
+
import {decodeVertexFormat} from '@luma.gl/core';
|
|
4
4
|
|
|
5
5
|
/** Throw error on any WebGL-only vertex formats */
|
|
6
6
|
function getWebGPUVertexFormat(format: VertexFormat): GPUVertexFormat {
|
|
@@ -21,9 +21,6 @@ export function getVertexBufferLayout(
|
|
|
21
21
|
shaderLayout: ShaderLayout,
|
|
22
22
|
bufferLayout: BufferLayout[]
|
|
23
23
|
): GPUVertexBufferLayout[] {
|
|
24
|
-
// @ts-expect-error Deduplicate and make use of the new core attribute logic here in webgpu module
|
|
25
|
-
const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);
|
|
26
|
-
|
|
27
24
|
const vertexBufferLayouts: GPUVertexBufferLayout[] = [];
|
|
28
25
|
const usedAttributes = new Set<string>();
|
|
29
26
|
|