@luma.gl/webgpu 9.0.0-beta.3 → 9.0.0-beta.5
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/accessor-to-format.js +99 -1
- package/dist/adapter/helpers/convert-texture-format.js +5 -5
- package/dist/adapter/helpers/generate-mipmaps.js +76 -82
- package/dist/adapter/helpers/get-bind-group.js +54 -41
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +110 -80
- package/dist/adapter/helpers/webgpu-parameters.js +182 -125
- package/dist/adapter/resources/webgpu-buffer.js +110 -62
- package/dist/adapter/resources/webgpu-command-encoder.js +73 -49
- package/dist/adapter/resources/webgpu-compute-pass.js +54 -41
- package/dist/adapter/resources/webgpu-compute-pipeline.js +24 -19
- package/dist/adapter/resources/webgpu-external-texture.js +29 -19
- package/dist/adapter/resources/webgpu-framebuffer.js +11 -7
- package/dist/adapter/resources/webgpu-query.js +42 -1
- package/dist/adapter/resources/webgpu-render-pass.js +115 -105
- package/dist/adapter/resources/webgpu-render-pipeline.js +148 -83
- package/dist/adapter/resources/webgpu-sampler.js +18 -15
- package/dist/adapter/resources/webgpu-shader.js +55 -45
- package/dist/adapter/resources/webgpu-texture.js +129 -109
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +4 -1
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +64 -41
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +100 -69
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +257 -230
- package/dist/adapter/webgpu-types.js +0 -2
- package/dist/dist.dev.js +661 -2178
- package/dist/glsl/glsllang.js +9 -6
- package/dist/index.cjs +58 -239
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +9 -6
- package/dist.min.js +1 -22
- package/package.json +9 -7
- package/src/adapter/resources/webgpu-vertex-array.ts +5 -2
- package/src/adapter/webgpu-canvas-context.ts +1 -0
- package/src/adapter/webgpu-device.ts +16 -36
- package/dist/adapter/helpers/accessor-to-format.js.map +0 -1
- package/dist/adapter/helpers/convert-texture-format.js.map +0 -1
- package/dist/adapter/helpers/generate-mipmaps.js.map +0 -1
- package/dist/adapter/helpers/get-bind-group.js.map +0 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
- package/dist/adapter/helpers/webgpu-parameters.js.map +0 -1
- package/dist/adapter/resources/webgpu-buffer.js.map +0 -1
- package/dist/adapter/resources/webgpu-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgpu-compute-pass.js.map +0 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgpu-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgpu-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgpu-query.js.map +0 -1
- package/dist/adapter/resources/webgpu-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgpu-sampler.js.map +0 -1
- package/dist/adapter/resources/webgpu-shader.js.map +0 -1
- package/dist/adapter/resources/webgpu-texture.js.map +0 -1
- package/dist/adapter/resources/webgpu-vertex-array.js.map +0 -1
- package/dist/adapter/webgpu-canvas-context.js.map +0 -1
- package/dist/adapter/webgpu-device.js.map +0 -1
- package/dist/adapter/webgpu-types.js.map +0 -1
- package/dist/glsl/glsllang.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -278,7 +278,7 @@ export class WebGPUDevice extends Device {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
_getFeatures() {
|
|
281
|
-
// WebGPU Features
|
|
281
|
+
// Initialize with actual WebGPU Features (note that unknown features may not be in DeviceFeature type)
|
|
282
282
|
const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);
|
|
283
283
|
|
|
284
284
|
// Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133
|
|
@@ -289,45 +289,25 @@ export class WebGPUDevice extends Device {
|
|
|
289
289
|
features.add('depth-clip-control');
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
//
|
|
292
|
+
// Some subsets of WebGPU extensions correspond to WebGL extensions
|
|
293
293
|
if (features.has('texture-compression-bc')) {
|
|
294
294
|
features.add('texture-compression-bc5-webgl');
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// TEXTURES
|
|
313
|
-
features.add('texture-formats-depth-webgl1');
|
|
314
|
-
features.add('texture-formats-float32-webgl1');
|
|
315
|
-
features.add('texture-formats-float16-webgl1');
|
|
316
|
-
|
|
317
|
-
features.add('texture-filter-linear-float32-webgl');
|
|
318
|
-
features.add('texture-filter-linear-float16-webgl');
|
|
319
|
-
features.add('texture-filter-anisotropic-webgl');
|
|
320
|
-
|
|
321
|
-
// FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS
|
|
322
|
-
features.add('texture-renderable-rgba32float-webgl');
|
|
323
|
-
features.add('texture-renderable-float32-webgl');
|
|
324
|
-
features.add('texture-renderable-float16-webgl');
|
|
325
|
-
|
|
326
|
-
// GLSL extensions
|
|
327
|
-
features.add('glsl-frag-data');
|
|
328
|
-
features.add('glsl-frag-depth');
|
|
329
|
-
features.add('glsl-derivatives');
|
|
330
|
-
features.add('glsl-texture-lod');
|
|
297
|
+
const WEBGPU_ALWAYS_FEATURES: DeviceFeature[] = [
|
|
298
|
+
'webgpu',
|
|
299
|
+
'wgsl',
|
|
300
|
+
'timer-query-webgl',
|
|
301
|
+
'float32-filterable-linear-webgl',
|
|
302
|
+
'float16-filterable-linear-webgl',
|
|
303
|
+
'texture-filterable-anisotropic-webgl',
|
|
304
|
+
'float32-renderable-webgl',
|
|
305
|
+
'float16-renderable-webgl'
|
|
306
|
+
];
|
|
307
|
+
|
|
308
|
+
for (const feature of WEBGPU_ALWAYS_FEATURES) {
|
|
309
|
+
features.add(feature);
|
|
310
|
+
}
|
|
331
311
|
|
|
332
312
|
return features;
|
|
333
313
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessor-to-format.js","names":[],"sources":["../../../src/adapter/helpers/accessor-to-format.ts"],"sourcesContent":["/*\nimport {assert} from '@luma.gl/core';\n\ntype Accessor = Record<string, any>;\n\nconst FORMAT_TO_ACCESSOR: Record<GPUVertexFormat, Accessor> = {\n uchar2: {type: 'uchar', size: 2},\n uchar4: {type: 'uchar', size: 4},\n char2: {type: 'char', size: 2},\n char4: {type: 'char', size: 4},\n uchar2norm: {type: 'uchar', size: 2, normalized: true},\n uchar4norm: {type: 'uchar', size: 4, normalized: true},\n char2norm: {type: 'char', size: 2, normalized: true},\n char4norm: {type: 'char', size: 4, normalized: true},\n ushort2: {type: 'ushort', size: 2},\n ushort4: {type: 'ushort', size: 4},\n short2: {type: 'short', size: 2},\n short4: {type: 'short', size: 4},\n ushort2norm: {type: 'ushort', size: 2, normalized: true},\n ushort4norm: {type: 'ushort', size: 4, normalized: true},\n short2norm: {type: 'short', size: 1, normalized: true},\n short4norm: {type: 'short', size: 1, normalized: true},\n half2: {type: 'half', size: 2},\n half4: {type: 'half', size: 4},\n float: {type: 'float', size: 1},\n float2: {type: 'float', size: 2},\n float3: {type: 'float', size: 3},\n float4: {type: 'float', size: 4},\n uint: {type: 'uint', size: 1, integer: true},\n uint2: {type: 'uint', size: 2, integer: true},\n uint3: {type: 'uint', size: 3, integer: true},\n uint4: {type: 'uint', size: 4, integer: true},\n int: {type: 'int', size: 1, integer: true},\n int2: {type: 'int', size: 2, integer: true},\n int3: {type: 'int', size: 3, integer: true},\n int4: {type: 'int', size: 4, integer: true}\n};\n\n/**\n * Convert from WebGPU attribute format strings to accessor {type, size, normalized, integer}\n * @param {*} format\n *\nexport function mapWebGPUFormatToAccessor(format) {\n const accessorDefinition = FORMAT_TO_ACCESSOR[format];\n assert(accessorDefinition, 'invalid attribute format');\n return Object.freeze(accessorDefinition);\n}\n\n/**\n * Convert from accessor {type, size, normalized, integer} to WebGPU attribute format strings\n * @param {*} format\n *\nexport function mapAccessorToWebGPUFormat(accessor) {\n const {type = GL.FLOAT, size = 1, normalized = false, integer = false} = accessor;\n assert(size >=1 && size <=4);\n // `norm` suffix (uchar4norm)\n const norm = normalized ? 'norm' : '';\n // size 1 is ommitted in format names (float vs float2)\n const count = size === 1 ? '' : size;\n switch (type) {\n case GL.UNSIGNED_BYTE:\n switch (size) {\n case 2:\n case 4:\n return `uchar${count}${norm}`;\n }\n case GL.BYTE:\n switch (size) {\n case 2:\n case 4:\n return `char${count}${norm}`;\n }\n case GL.UNSIGNED_SHORT:\n switch (size) {\n case 2:\n case 4:\n return `ushort${count}${norm}`;\n }\n case GL.SHORT:\n switch (size) {\n case 2:\n case 4:\n return `short${count}${norm}`;\n }\n case GL.HALF_FLOAT:\n switch (size) {\n case 2:\n case 4:\n return `half${count}`;\n }\n case GL.FLOAT:\n return `float${count}`;\n case GL.UNSIGNED_INT:\n return `uint${count}`;\n case GL.INT:\n return `int${count}`;\n }\n throw new Error('illegal accessor');\n}\n*/"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-texture-format.js","names":["getWebGPUTextureFormat","format","includes","Error"],"sources":["../../../src/adapter/helpers/convert-texture-format.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {TextureFormat} from '@luma.gl/core';\n\n/** Ensure a texture format is WebGPU compatible */\nexport function getWebGPUTextureFormat(format: TextureFormat): GPUTextureFormat {\n if (format.includes('webgl')) {\n throw new Error('webgl-only format');\n }\n return format as GPUTextureFormat;\n}\n"],"mappings":"AAIA,OAAO,SAASA,sBAAsBA,CAACC,MAAqB,EAAoB;EAC9E,IAAIA,MAAM,CAACC,QAAQ,CAAC,OAAO,CAAC,EAAE;IAC5B,MAAM,IAAIC,KAAK,CAAC,mBAAmB,CAAC;EACtC;EACA,OAAOF,MAAM;AACf"}
|
|
@@ -1 +0,0 @@
|
|
|
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,W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AC;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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-bind-group.js","names":["Buffer","Sampler","Texture","log","cast","makeBindGroupLayout","device","layout","bindings","Error","getBindGroup","bindGroupLayout","shaderLayout","entries","getBindGroupEntries","createBindGroup","getShaderLayoutBinding","bindingName","bindingLayout","find","binding","name","toLocaleLowerCase","warn","value","Object","push","getBindGroupEntry","location","index","resource","buffer","handle","createView","label"],"sources":["../../../src/adapter/helpers/get-bind-group.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {ShaderLayout, BindingDeclaration, Binding} from '@luma.gl/core';\nimport {Buffer, Sampler, Texture, log, cast} from '@luma.gl/core';\nimport type {WebGPUBuffer} from '../resources/webgpu-buffer';\nimport type {WebGPUSampler} from '../resources/webgpu-sampler';\nimport type {WebGPUTexture} from '../resources/webgpu-texture';\n\n/**\n * Create a WebGPU \"bind group layout\" from an array of luma.gl bindings\n * @note bind groups can be automatically generated by WebGPU.\n */\nexport function makeBindGroupLayout(\n device: GPUDevice,\n layout: GPUBindGroupLayout,\n bindings: Binding[]\n): GPUBindGroupLayout {\n throw new Error('not implemented');\n // return device.createBindGroupLayout({\n // layout,\n // entries: getBindGroupEntries(bindings)\n // })\n}\n\n/**\n * Create a WebGPU \"bind group\" from an array of luma.gl bindings\n */\nexport function getBindGroup(\n device: GPUDevice,\n bindGroupLayout: GPUBindGroupLayout,\n shaderLayout: ShaderLayout,\n bindings: Record<string, Binding>\n): GPUBindGroup {\n const entries = getBindGroupEntries(bindings, shaderLayout);\n return device.createBindGroup({\n layout: bindGroupLayout,\n entries\n });\n}\n\nexport function getShaderLayoutBinding(\n shaderLayout: ShaderLayout,\n bindingName: string\n): BindingDeclaration {\n const bindingLayout = shaderLayout.bindings.find(binding => binding.name === bindingName || `${binding.name}uniforms` === bindingName.toLocaleLowerCase());\n if (!bindingLayout) {\n log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();\n }\n return bindingLayout;\n}\n\n/**\n * @param bindings\n * @returns\n */\nfunction getBindGroupEntries(\n bindings: Record<string, Binding>,\n shaderLayout: ShaderLayout\n): GPUBindGroupEntry[] {\n const entries: GPUBindGroupEntry[] = [];\n\n for (const [bindingName, value] of Object.entries(bindings)) {\n const bindingLayout = getShaderLayoutBinding(shaderLayout, bindingName);\n if (bindingLayout) {\n entries.push(getBindGroupEntry(value, bindingLayout.location));\n }\n }\n\n return entries;\n}\n\nfunction getBindGroupEntry(binding: Binding, index: number): GPUBindGroupEntry {\n if (binding instanceof Buffer) {\n return {\n binding: index,\n resource: {\n buffer: cast<WebGPUBuffer>(binding).handle\n }\n };\n }\n if (binding instanceof Sampler) {\n return {\n binding: index,\n resource: cast<WebGPUSampler>(binding).handle\n };\n } else if (binding instanceof Texture) {\n return {\n binding: index,\n resource: cast<WebGPUTexture>(binding).handle.createView({label: 'bind-group-auto-created'})\n };\n }\n throw new Error('invalid binding');\n}\n"],"mappings":"AAEA,SAAQA,MAAM,EAAEC,OAAO,EAAE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;AAChB;AAEA,SAASc,iBAAiBA,CAACP,OAAgB,EAAES,KAAa,EAAqB;EAC7E,IAAIT,OAAO,YAAYpB,MAAM,EAAE;IAC7B,OAAO;MACLoB,OAAO,EAAES,KAAK;MACdC,QAAQ,EAAE;QACRC,MAAM,EAAE3B,IAAI,CAAegB,OAAO,CAAC,CAACY;MACtC;IACF,CAAC;EACH;EACA,IAAIZ,OAAO,YAAYnB,OAAO,EAAE;IAC9B,OAAO;MACLmB,OAAO,EAAES,KAAK;MACdC,QAAQ,EAAE1B,IAAI,CAAgBgB,OAAO,CAAC,CAACY;IACzC,CAAC;EACH,CAAC,MAAM,IAAIZ,OAAO,YAAYlB,OAAO,EAAE;IACrC,OAAO;MACLkB,OAAO,EAAES,KAAK;MACdC,QAAQ,EAAE1B,IAAI,CAAgBgB,OAAO,CAAC,CAACY,MAAM,CAACC,UAAU,CAAC;QAACC,KAAK,EAAE;MAAyB,CAAC;IAC7F,CAAC;EACH;EACA,MAAM,IAAIzB,KAAK,CAAC,iBAAiB,CAAC;AACpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-vertex-buffer-layout.js","names":["log","decodeVertexFormat","getWebGPUVertexFormat","format","endsWith","Error","getVertexBufferLayout","shaderLayout","bufferLayout","vertexBufferLayouts","usedAttributes","Set","mapping","vertexAttributes","stepMode","byteStride","attributes","attributeMapping","attributeName","attribute","attributeLayout","findAttributeLayout","name","startsWith","push","offset","byteOffset","shaderLocation","location","byteLength","arrayStride","has","getBufferSlots","bufferSlot","bufferSlots","interleaved","add","attributeNames","find","warn"],"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 {log, decodeVertexFormat} from '@luma.gl/core';\n// import {getAttributeInfosFromLayouts} 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 || (attributeLayout.name.startsWith('instance') ? 'instance' : '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 if (!attributeLayout) {\n continue; // eslint-disable-line no-continue\n }\n byteStride = decodeVertexFormat(mapping.format).byteLength;\n\n stepMode = attributeLayout.stepMode || (attributeLayout.name.startsWith('instance') ? 'instance' : '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,\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 || (attribute.name.startsWith('instance') ? 'instance' : '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 log.warn(`Unknown attribute ${name}`)();\n return null;\n }\n if (attributeNames.has(name)) {\n throw new Error(`Duplicate attribute ${name}`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,IAAI,CAAC;EACxB,OAAOH,SAAS;AAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-parameters.js","names":["addDepthStencil","descriptor","depthStencil","format","stencilFront","stencilBack","depthWriteEnabled","depthCompare","PARAMETER_TABLE","cullMode","parameter","value","primitive","frontFace","depthFormat","depthBias","depthBiasSlopeScale","depthBiasClamp","stencilReadMask","stencilWriteMask","stencilCompare","compare","stencilPassOperation","passOp","stencilFailOperation","failOp","stencilDepthFailOperation","depthFailOp","sampleCount","multisample","count","sampleMask","mask","sampleAlphaToCoverageEnabled","alphaToCoverageEnabled","colorMask","targets","addColorState","writeMask","blendColorOperation","DEFAULT_PIPELINE_DESCRIPTOR","topology","vertex","module","undefined","entryPoint","fragment","layout","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","arguments","length","Object","assign","setParameters","key","entries","setterFunction","Error","_descriptor$fragment","_descriptor$fragment2","_descriptor$fragment3","_descriptor$fragment4","Array","isArray","_descriptor$fragment$","push"],"sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"sourcesContent":["import {Parameters} from '@luma.gl/core';\n\nfunction addDepthStencil(descriptor: GPURenderPipelineDescriptor): GPUDepthStencilState {\n descriptor.depthStencil = descriptor.depthStencil || {\n // required, set something\n format: 'depth24plus',\n stencilFront: {},\n stencilBack: {},\n // TODO can this cause trouble? Should we set to WebGPU defaults? Are there defaults?\n depthWriteEnabled: false,\n depthCompare: 'less-equal'\n };\n return descriptor.depthStencil;\n}\n\n/**\n * Supports for luma.gl's flat parameter space\n * Populates the corresponding sub-objects in a GPURenderPipelineDescriptor\n */\n// @ts-expect-error\nexport const PARAMETER_TABLE: Record<keyof Parameters, Function> = {\n // RASTERIZATION PARAMETERS\n\n cullMode: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.cullMode = value;\n },\n\n frontFace: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.frontFace = value;\n },\n\n // DEPTH\n\n depthWriteEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthCompare = value;\n },\n\n depthFormat: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.format = value;\n },\n\n depthBias: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBias = value;\n },\n\n depthBiasSlopeScale: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.compare = value;\n depthStencil.stencilBack.compare = value;\n },\n\n stencilPassOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.passOp = value;\n depthStencil.stencilBack.passOp = value;\n },\n\n stencilFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.failOp = value;\n depthStencil.stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.depthFailOp = value;\n depthStencil.stencilBack.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.alphaToCoverageEnabled = value;\n },\n\n // COLOR\n\n colorMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const targets = addColorState(descriptor);\n targets[0].writeMask = value;\n },\n\n blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n // const targets = addColorState(descriptor);\n // const target = targets[0];\n // const blend: GPUBlendState = target.blend || {color: {alpha: 0}};\n // blend.color = blend.color || {};\n // target.blend.color.operation = value;\n }\n\n /*\n blendColorSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.srcTarget = value;\n },\n\n blendColorDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.dstTarget = value;\n },\n\n blendAlphaOperation: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.operation = value;\n },\n\n blendAlphaSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.srcTarget = value;\n },\n\n blendAlphaDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.dstTarget = value;\n },\n */\n};\n\nconst DEFAULT_PIPELINE_DESCRIPTOR: GPURenderPipelineDescriptor = {\n // depthStencil: {\n // stencilFront: {},\n // stencilBack: {},\n // // depthWriteEnabled: true,\n // // depthCompare: 'less',\n // // format: 'depth24plus-stencil8',\n // },\n\n primitive: {\n cullMode: 'back',\n topology: 'triangle-list'\n },\n\n vertex: {\n module: undefined!,\n entryPoint: 'main'\n },\n\n fragment: {\n module: undefined!,\n entryPoint: 'main',\n targets: [\n // { format: props.color0Format || 'bgra8unorm' }\n ]\n },\n\n layout: 'auto'\n};\n\nexport function applyParametersToRenderPipelineDescriptor(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters = {}\n): void {\n // Apply defaults\n Object.assign(pipelineDescriptor, {...DEFAULT_PIPELINE_DESCRIPTOR, ...pipelineDescriptor});\n setParameters(pipelineDescriptor, parameters);\n}\n\n// Apply any supplied parameters\nfunction setParameters(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters\n): void {\n for (const [key, value] of Object.entries(parameters)) {\n const setterFunction = PARAMETER_TABLE[key as keyof Parameters];\n if (!setterFunction) {\n throw new Error(`Illegal parameter ${key}`);\n }\n setterFunction(key, value, pipelineDescriptor);\n }\n}\n\nfunction addColorState(descriptor: GPURenderPipelineDescriptor): GPUColorTargetState[] {\n descriptor.fragment.targets = descriptor.fragment?.targets || [];\n if (!Array.isArray(descriptor.fragment?.targets)) {\n throw new Error('colorstate');\n }\n if (descriptor.fragment?.targets?.length === 0) {\n descriptor.fragment.targets?.push({});\n }\n return descriptor.fragment?.targets as GPUColorTargetState[];\n}\n"],"mappings":"AAEA,SAASA,eAAeA,CAACC,UAAuC,EAAwB;EACtFA,UAAU,CAACC,YAAY,GAAGD,UAAU,CAACC,YAAY,IAAI;IAEnDC,MAAM,EAAE,aAAa;IACrBC,YAAY,EAAE,CAAC,CAAC;IAChBC,WAAW,EAAE,CAAC,CAAC;IAEfC,iBAAiB,EAAE,KAAK;IACxBC,YAAY,EAAE;EAChB,CAAC;EACD,OAAON,UAAU,CAACC,YAAY;AAChC;AAOA,OAAO,MAAMM,eAAmD,GAAG;EAGjEC,QAAQ,EAAEA,CAACC,SAA2B,EAAEC,KAAU,EAAEV,UAAuC,KAAK;IAC9FA,UAAU,CAACW,SAAS,GAAGX,UAAU,CAACW,SAAS,IAAI,CAAC,CAAC;IACjDX,UAAU,CAACW,SAAS,CAACH,QAAQ,GAAGE,KAAK;EACvC,CAAC;EAEDE,SAAS,EAAEA,CAACH,SAA2B,EAAEC,KAAU,EAAEV,UAAuC,KAAK;IAC/FA,UAAU,CAACW,SAAS,GAAGX,UAAU,CAACW,SAAS,IAAI,CAAC,CAAC;IACjDX,UAAU,CAACW,SAAS,CAACC,SAAS,GAAGF,KAAK;EACxC,CAAC;EAIDL,iBAAiB,EAAEA,CAACI,SAA2B,EAAEC,KAAU,EAAEV,UAAuC,KAAK;IACvG,MAAMC,YAAY,GAAGF,eAAe,CAACC,UAAU,CAAC;IAChDC,YAAY,CAACI,iBAAiB,GAAGK,KAAK;EACxC,CAAC;EAEDJ,YAAY,EAAEA,CAACG,SAA2B,EAAEC,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Q,cAAAiB,qBAAA,uBAAnBA,qBAAA,CAAqB3B,OAAO;AACrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","handle","mapBuffer","Boolean","size","Math","ceil","createBuffer","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","arguments","length","undefined","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","Uint8Array","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n // WebGPU buffers must be aligned to 4 bytes\n const size = Math.ceil(this.byteLength / 4) * 4;\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n override write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<Uint8Array> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return new Uint8Array(arrayBuffer);\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n\n/*\n// Convenience API\n /** Read data from the buffer *\n async readAsync(options: {\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<ArrayBuffer> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_READ, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n if (options.unmap ?? true) {\n this.unmap();\n }\n return arrayBuffer;\n }\n\n /** Write data to the buffer *\n async writeAsync(options: {\n data: ArrayBuffer,\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<void> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_WRITE, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n const destArray = new Uint8Array(arrayBuffer);\n const srcArray = new Uint8Array(options.data);\n destArray.set(srcArray);\n if (options.unmap ?? true) {\n this.unmap();\n }\n }\n */\n\n// Mapped API (WebGPU)\n\n/** Maps the memory so that it can be read *\n // abstract mapAsync(mode, byteOffset, byteLength): Promise<void>\n\n /** Get the mapped range of data for reading or writing *\n // abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;\n\n /** unmap makes the contents of the buffer available to the GPU again *\n // abstract unmap(): void;\n*/\n"],"mappings":"AACA,SAAQA,MAAM,QAAoB,eAAe;AAGjD,SAASC,aAAaA,CAACC,KAAkB,EAAU;EAAA,IAAAC,WAAA;EACjD,OAAOD,KAAK,CAACE,UAAU,MAAAD,WAAA,GAAID,KAAK,CAACG,IAAI,cAAAF,WAAA,uBAAVA,WAAA,CAAYC,UAAU,KAAI,CAAC;AACxD;AAEA,OAAO,MAAME,YAAY,SAASN,MAAM,CAAC;EAKvCO,WAAWA,CAACC,MAAoB,EAAEN,KAAkB,EAAE;IACpD,KAAK,CAACM,MAAM,EAAEN,KAAK,CAAC;IAAC,KALdM,MAAM;IAAA,KACNC,MAAM;IAAA,KACNL,UAAU;IAIjB,IAAI,CAACI,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAGrC,MAAMO,IAAI,GAAGC,IAAI,CAACC,IAAI,CAAC,IAAI,CAACV,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC;IAE/C,IAAI,CAACK,MAAM,GAAG,IAAI,CAACP,KAAK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,IAAI,CAACrB,MAAM,CAACiC,QAAQ,CAACS,IAAI,EAAEC,MAAM,EAAExC,IAAI,CAAC;EACjD;EAEAkC,cAAcA,CAAA,EAAiD;IAAA,IAAhDM,MAAc,GAAAxB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEhB,IAAa,GAAAgB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAC9C,OAAO,IAAI,CAACrB,MAAM,CAACqC,cAAc,CAACM,MAAM,EAAExC,IAAI,CAAC;EACjD;EAEAY,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACf,MAAM,CAACe,KAAK,CAAC,CAAC;EACrB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","WebGPUCommandEncoder","constructor","device","props","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","webgpuSourceBuffer","source","WebGPUDestinationBuffer","destination","sourceOffset","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","WebGPUDestinationTexture","buffer","offset","bytesPerRow","rowsPerImage","texture","mipLevel","origin","width","extent","height","depthOrArrayLayers","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps, Buffer, Texture} from '@luma.gl/core';\nimport type {CopyTextureToTextureOptions, CopyTextureToBufferOptions} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n\nexport class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(device, props);\n this.device = device;\n this.handle =\n props.handle ||\n this.device.handle.createCommandEncoder({\n // TODO was this removed in standard?\n // measureExecutionTime: this.props.measureExecutionTime\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {}\n\n finish(options?: {id?: string}): GPUCommandBuffer {\n return this.finish(options);\n }\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n\n copyBufferToBuffer(options: // CopyBufferToBufferOptions\n {\n source: Buffer;\n sourceOffset?: number;\n destination: Buffer;\n destinationOffset?: number;\n size?: number;\n }): void {\n const webgpuSourceBuffer = options.source as WebGPUBuffer;\n const WebGPUDestinationBuffer = options.destination as WebGPUBuffer;\n this.handle.copyBufferToBuffer(\n webgpuSourceBuffer.handle,\n options.sourceOffset ?? 0,\n WebGPUDestinationBuffer.handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: // CopyBufferToTextureOptions\n {\n source: Buffer;\n offset?: number;\n bytesPerRow: number;\n rowsPerImage: number;\n\n destination: Texture;\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n\n origin?: number[] | [number, number, number];\n extent?: number[] | [number, number, number];\n }): void {\n const webgpuSourceBuffer = options.source as WebGPUBuffer;\n const WebGPUDestinationTexture = options.destination as WebGPUTexture;\n this.handle.copyBufferToTexture(\n {\n buffer: webgpuSourceBuffer.handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage\n },\n {\n texture: WebGPUDestinationTexture.handle,\n mipLevel: options.mipLevel ?? 0,\n origin: options.origin ?? {}\n // aspect: options.aspect\n },\n {\n // TODO exclamation mark hack\n width: options.extent[0],\n height: options.extent[1],\n depthOrArrayLayers: options.extent[2]\n }\n );\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n // this.handle.copyTextureToBuffer(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n // this.handle.copyTextureToTexture(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n override pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n\n override popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n\n override insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":"AAAA,SAAQA,cAAc,QAA6C,eAAe;AAMlF,OAAO,MAAMC,oBAAoB,SAASD,cAAc,CAAC;EAIvDE,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJdD,MAAM;IAAA,KACNE,MAAM;IAIb,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,MAAM,GACTD,KAAK,CAACC,MAAM,IACZ,IAAI,CAACF,MAAM,CAACE,MAAM,CAACC,oBAAoB,CAAC,CAGxC,CAAC,CAAC;IACJ,IAAI,CAACD,MAAM,CAACE,KAAK,GAAG,IAAI,CAACH,KAAK,CAACI,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,MAAMA,CAACC,OAAuB,EAAoB;IAChD,OAAO,IAAI,CAACD,MAAM,CAACC,OAAO,CAAC;EAC7B;EAKAC,kBAAkBA,CAACD,OAOlB,EAAQ;IAAA,IAAAE,qBAAA,EAAAC,qBAAA,EAAAC,aAAA;IACP,MAAMC,kBAAkB,GAAGL,OAAO,CAACM,MAAsB;IACzD,MAAMC,uBAAuB,GAAGP,OAAO,CAACQ,WAA2B;IACnE,IAAI,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C;EACH;EAEAG,mBAAmBA,CAAC5B,OAAmC,EAAQ,CAS/D;EAEA6B,oBAAoBA,CAAC7B,OAAoC,EAAQ,CASjE;EAES8B,cAAcA,CAACC,UAAkB,EAAQ;IAChD,IAAI,CAACrC,MAAM,CAACoC,cAAc,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACtC,MAAM,CAACsC,aAAa,CAAC,CAAC;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACxC,MAAM,CAACuC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","WebGPUComputePass","constructor","device","props","_device$commandEncode","handle","_bindGroupLayout","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchWorkgroups","dispatchIndirect","indirectBuffer","indirectOffset","arguments","length","undefined","webgpuBuffer","dispatchWorkgroupsIndirect","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"sourcesContent":["import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPUComputePipeline} from './webgpu-compute-pipeline';\n\nexport class WebGPUComputePass extends ComputePass {\n readonly device: WebGPUDevice;\n readonly handle: GPUComputePassEncoder;\n _bindGroupLayout: GPUBindGroupLayout | null = null;\n\n constructor(device: WebGPUDevice, props: ComputePassProps) {\n super(device, props);\n this.device = device;\n\n this.handle = this.props.handle || device.commandEncoder?.beginComputePass({\n label: this.props.id,\n // timestampWrites?: GPUComputePassTimestampWrites;\n });\n }\n\n /** @note no WebGPU destroy method, just gc */\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: ComputePipeline): void {\n const wgpuPipeline = pipeline as WebGPUComputePipeline;\n this.handle.setPipeline(wgpuPipeline.handle);\n this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Binding[]): void {\n throw new Error('fix me');\n // const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);\n // this.handle.setBindGroup(0, bindGroup);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param x X dimension of the grid of workgroups to dispatch.\n * @param y Y dimension of the grid of workgroups to dispatch.\n * @param z Z dimension of the grid of workgroups to dispatch.\n */\n dispatch(x: number, y?: number, z?: number): void {\n this.handle.dispatchWorkgroups(x, y, z);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()\n * @param indirectOffset\n */\n dispatchIndirect(indirectBuffer: Buffer, indirectOffset: number = 0): void {\n const webgpuBuffer = indirectBuffer as WebGPUBuffer;\n this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);\n }\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n}\n"],"mappings":"AAAA,SAAQA,WAAW,QAA2D,eAAe;AAM7F,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAC;EAKjDE,WAAWA,CAACC,MAAo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Ac,CAAC;EAC7E;EAEAM,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC7B,MAAM,CAAC4B,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC9B,MAAM,CAAC8B,aAAa,CAAC,CAAC;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAChC,MAAM,CAAC+B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","WebGPUComputePipeline","constructor","device","props","handle","webgpuShader","cs","createComputePipeline","label","id","compute","module","entryPoint","csEntryPoint","layout","_getBindGroupLayout","getBindGroupLayout"],"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"sourcesContent":["// prettier-ignore\nimport {ComputePipeline, ComputePipelineProps} from '@luma.gl/core';\n\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUShader} from './webgpu-shader';\n\n// COMPUTE PIPELINE\n\n/** Creates a new compute pipeline when parameters change */\nexport class WebGPUComputePipeline extends ComputePipeline {\n device: WebGPUDevice;\n handle: GPUComputePipeline;\n\n constructor(device: WebGPUDevice, props: ComputePipelineProps) {\n super(device, props);\n this.device = device;\n\n const webgpuShader = this.props.cs as WebGPUShader;\n this.handle = this.props.handle || this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module: webgpuShader.handle,\n entryPoint: this.props.csEntryPoint,\n // constants: this.props.csConstants\n },\n layout: 'auto'\n });\n }\n\n /** For internal use in render passes */\n _getBindGroupLayout() {\n // TODO: Cache?\n return this.handle.getBindGroupLayout(0);\n }\n}\n"],"mappings":"AACA,SAAQA,eAAe,QAA6B,eAAe;AAQnE,OAAO,MAAMC,qBAAqB,SAASD,eAAe,CAAC;EAIzDE,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJvBD,MAAM;IAAA,KACNE,MAAM;IAIJ,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,YAAY,GAAG,IAAI,CAACF,KAAK,CAACG,EAAkB;IAClD,IAAI,CAACF,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACE,MAAM,CAACG,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACL,KAAK,CAACM,EAAE;MACpBC,OAAO,EAAE;QACPC,MAAM,EAAEN,YAAY,CAACD,MAAM;QAC3BQ,UAAU,EAAE,IAAI,CAACT,KAAK,CAACU;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACX,MAAM,CAACY,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-external-texture.js","names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","handle","sampler","importExternalTexture","source","colorSpace","destroy","setSampler"],"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\n\n/**\n * Cheap, temporary texture view for videos\n * Only valid within same callback, destroyed automatically as a microtask.\n */\nexport class WebGPUExternalTexture extends ExternalTexture {\n readonly device: WebGPUDevice;\n readonly handle: GPUExternalTexture;\n sampler: WebGPUSampler;\n\n constructor(device: WebGPUDevice, props: ExternalTextureProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.handle.importExternalTexture({\n source: props.source,\n colorSpace: props.colorSpace\n });\n this.sampler = null;\n }\n\n override destroy(): void {\n // External textures are destroyed automatically,\n // as a microtask, instead of manually or upon garbage collection like other resources.\n // this.handle.destroy();\n }\n\n /** Set default sampler */\n setSampler(sampler: Sampler | SamplerProps): this {\n // We can accept a sampler instance or set of props;\n this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n}\n"],"mappings":"AACA,SAAQA,eAAe,QAAoD,eAAe;AAAC,SAEnFC,aAAa;AAMrB,OAAO,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAKzDG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KALdD,MAAM;IAAA,KACNE,MAAM;IAAA,KACfC,OAAO;IAIL,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACE,MAAM,CAACE,qBAAqB,CAAC;MAC1EC,MAAM,EAAEJ,KAAK,CAACI,MAAM;MACpBC,UAAU,EAAEL,KAAK,CAACK;IACpB,CAAC,CAAC;IACF,IAAI,CAACH,OAAO,GAAG,IAAI;EACrB;EAESI,OAAOA,CAAA,EAAS,CAIzB;EAGAC,UAAUA,CAACL,OAA+B,EAAQ;IAEhD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYN,aAAa,GAAGM,OAAO,GAAG,IAAIN,aAAa,CAAC,IAAI,CAACG,MAAM,EAAEG,OAAO,CAAC;IACnG,OAAO,IAAI;EACb;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-framebuffer.js","names":["Framebuffer","WebGPUFramebuffer","constructor","device","props","autoCreateAttachmentTextures"],"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"sourcesContent":["import type {FramebufferProps} from '@luma.gl/core';\nimport {Framebuffer} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n // Auto create textures for attachments if needed\n this.autoCreateAttachmentTextures();\n }\n}\n"],"mappings":"AACA,SAAQA,WAAW,QAAO,eAAe;AAOzC,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAC;EAGjDE,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAHdD,MAAM;IAIb,IAAI,CAACA,MAAM,GAAGA,MAAM;IAGpB,IAAI,CAACE,4BAA4B,CAAC,CAAC;EACrC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-query.js","names":[],"sources":["../../../src/adapter/resources/webgpu-query.ts"],"sourcesContent":["/*\nimport {Resource, Query, QueryProps} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUQueryProps = QueryProps & {\n handle?: any;\n};\n\nconst DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {\n id: undefined,\n handle: undefined,\n userData: undefined,\n type: 'timestamp',\n count: 1,\n pipelineStatistics: []\n};\n\n/**\n * Immutable\n *\nclass WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {\n readonly device: WebGPUDevice;\n readonly handle: GPUQuerySet;\n\n constructor(device: WebGPUDevice, props: WebGPUQueryProps) {\n super(device, props, DEFAULT_QUERY_PROPS);\n this.handle = this.props.handle as GPUQuerySet || this.createHandle();\n this.handle.label = this.props.id;\n }\n\n protected createHandle() {\n return this.device.handle.createQuerySet({\n type: this.props.type,\n count: this.props.count,\n pipelineStatistics: this.props.pipelineStatistics\n });\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n}\n*/"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pass.js","names":["RenderPass","cast","log","WebGPURenderPass","constructor","device","props","arguments","length","undefined","handle","pipeline","framebuffer","canvasContext","getCurrentFramebuffer","renderPassDescriptor","getRenderPassDescriptor","groupCollapsed","id","probe","JSON","stringify","groupEnd","commandEncoder","beginRenderPass","label","destroy","end","setPipeline","setBindings","bindings","_this$pipeline","_this$pipeline2","bindGroup","_getBindGroup","setBindGroup","setIndexBuffer","buffer","indexFormat","offset","size","setVertexBuffer","slot","draw","options","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","drawIndirect","setParameters","parameters","blendConstant","stencilReference","scissorRect","viewport","setBlendConstant","setStencilReference","setScissorRect","setViewport","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel","colorAttachments","map","colorAttachment","loadOp","clearColor","colorClearValue","storeOp","discard","view","createView","depthStencilAttachment","depthReadOnly","depthClearValue","clearDepth","hasDepthAspect","depthLoadOp","depthStoreOp","hasStencilAspect","stencilLoadOp","clearStencil","stencilStoreOp"],"sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"sourcesContent":["import type {RenderPassProps, RenderPassParameters, Binding, Framebuffer} from '@luma.gl/core';\nimport {Buffer, RenderPass, RenderPipeline, cast, log} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPURenderPipeline} from './webgpu-render-pipeline';\n\nexport class WebGPURenderPass extends RenderPass {\n readonly device: WebGPUDevice;\n readonly handle: GPURenderPassEncoder;\n\n /** Active pipeline */\n pipeline: WebGPURenderPipeline | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPassProps = {}) {\n super(device, props);\n this.device = device;\n const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer() ;\n const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);\n log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();\n log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();\n log.groupEnd(3)();\n this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: RenderPipeline): void {\n this.pipeline = cast<WebGPURenderPipeline>(pipeline);\n this.handle.setPipeline(this.pipeline.handle);\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Record<string, Binding>): void {\n this.pipeline?.setBindings(bindings);\n const bindGroup = this.pipeline?._getBindGroup();\n if (bindGroup) {\n this.handle.setBindGroup(0, bindGroup);\n }\n }\n\n setIndexBuffer(\n buffer: Buffer,\n indexFormat: GPUIndexFormat,\n offset: number = 0,\n size?: number\n ): void {\n this.handle.setIndexBuffer(cast<WebGPUBuffer>(buffer).handle, indexFormat, offset, size);\n }\n\n setVertexBuffer(slot: number, buffer: Buffer, offset: number = 0): void {\n this.handle.setVertexBuffer(slot, cast<WebGPUBuffer>(buffer).handle, offset);\n }\n\n draw(options: {\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n if (options.indexCount) {\n this.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n this.handle.draw(\n options.vertexCount || 0,\n options.instanceCount || 1,\n options.firstIndex,\n options.firstInstance\n );\n }\n }\n\n drawIndirect(): void {\n // drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n // drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n }\n\n setParameters(parameters: RenderPassParameters): void {\n const {blendConstant, stencilReference, scissorRect, viewport} = parameters;\n if (blendConstant) {\n this.handle.setBlendConstant(blendConstant);\n }\n if (stencilReference) {\n this.handle.setStencilReference(stencilReference);\n }\n if (scissorRect) {\n this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);\n }\n // TODO - explain how 3 dimensions vs 2 in WebGL works.\n if (viewport) {\n this.handle.setViewport(\n viewport[0],\n viewport[1],\n viewport[2],\n viewport[3],\n viewport[4],\n viewport[5]\n );\n }\n }\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginOcclusionQuery(queryIndex: number): void;\n // endOcclusionQuery(): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n\n // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n\n // INTERNAL\n\n /** \n * Partial render pass descriptor. Used by WebGPURenderPass.\n * @returns attachments fields of a renderpass descriptor. \n */\n protected getRenderPassDescriptor(framebuffer: Framebuffer): GPURenderPassDescriptor {\n const renderPassDescriptor: GPURenderPassDescriptor = {\n colorAttachments: []\n };\n\n renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(colorAttachment => ({\n // clear values\n loadOp: this.props.clearColor !== false ? 'clear' : 'load',\n colorClearValue: this.props.clearColor || [0, 0, 0, 0],\n storeOp: this.props.discard? 'discard': 'store',\n // ...colorAttachment,\n view: (colorAttachment as WebGPUTexture).createView()\n }));\n\n if (framebuffer.depthStencilAttachment) {\n renderPassDescriptor.depthStencilAttachment = {\n view: (framebuffer.depthStencilAttachment as WebGPUTexture).createView()\n };\n const {depthStencilAttachment} = renderPassDescriptor;\n\n // DEPTH\n if (this.props.depthReadOnly) {\n depthStencilAttachment.depthReadOnly = true;\n }\n depthStencilAttachment.depthClearValue = this.props.clearDepth || 0;\n\n // WebGPU only wants us to set these parameters if the texture format actually has a depth aspect\n const hasDepthAspect = true;\n if (hasDepthAspect) {\n depthStencilAttachment.depthLoadOp = this.props.clearDepth !== false ? 'clear' : 'load';\n depthStencilAttachment.depthStoreOp = 'store'; // TODO - support 'discard'?\n }\n\n // WebGPU only wants us to set these parameters if the texture format actually has a stencil aspect\n const hasStencilAspect = false;\n if (hasStencilAspect) {\n depthStencilAttachment.stencilLoadOp = this.props.clearStencil !== false ? 'clear' : 'load';\n depthStencilAttachment.stencilStoreOp = 'store'; // TODO - support 'discard'?\n }\n }\n\n return renderPassDescriptor;\n }\n}\n"],"mappings":"AACA,SAAgBA,UAAU,EAAkBC,IAAI,EAAEC,GAAG,QAAO,eAAe;AAO3E,OAAO,MAAMC,gBAAgB,SAASH,UAAU,CAAC;EAO/CI,WAAWA,CAACC,MAAoB,EAA+B;IAAA,IAA7BC,KAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC3D,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAAC,KAPdD,MAAM;IAAA,KACNK,MAAM;IAAA,KAGfC,QAAQ,GAAgC,IAAI;IAI1C,IAAI,CAACN,MAAM,GAAGA,MAAM;IACpB,MAAMO,WAAW,GAAGN,KAAK,CAACM,WAAW,IAAIP,MAAM,CAACQ,aAAa,CAACC,qBAAqB,CAAC,CAAC;IACrF,MAAMC,oBAAoB,GAAG,IAAI,CAACC,uBAAuB,CAACJ,WAAW,CAAC;IACtEV,GAAG,CAACe,cAAc,CAAC,CAAC,EAAG,wBAAuB,IAAI,CAACC,EAAG,GAAE,CAAC,CAAC,CAAC;IAC3DhB,GAAG,CAACiB,KAAK,CAAC,CAAC,EAAEC,IAAI,CAACC,SAAS,CAACN,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7Db,GAAG,CAACoB,QAAQ,CAAC,CAAC,CAAC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AAsB,GAAG;QAC5CF,IAAI,EAAGhE,WAAW,CAACkE,sBAAsB,CAAmBD,UAAU,CAAC;MACzE,CAAC;MACD,MAAM;QAACC;MAAsB,CAAC,GAAG/D,oBAAoB;MAGrD,IAAI,IAAI,CAACT,KAAK,CAACyE,aAAa,EAAE;QAC5BD,sBAAsB,CAACC,aAAa,GAAG,IAAI;MAC7C;MACAD,sBAAsB,CAACE,eAAe,GAAG,IAAI,CAAC1E,KAAK,CAAC2E,UAAU,IAAI,CAAC;MAGnE,MAAMC,cAAc,GAAG,IAAI;MAC3B,IAAIA,cAAc,EAAE;QAClBJ,sBAAsB,CAACK,WAAW,GAAG,IAAI,CAAC7E,KAAK,CAAC2E,UAAU,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM;QACvFH,sBAAsB,CAACM,YAAY,GAAG,OAAO;MAC/C;MAGA,MAAMC,gBAAgB,GAAG,KAAK;MAC9B,IAAIA,gBAAgB,EAAE;QACpBP,sBAAsB,CAACQ,aAAa,GAAG,IAAI,CAAChF,KAAK,CAACiF,YAAY,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM;QAC3FT,sBAAsB,CAACU,cAAc,GAAG,OAAO;MACjD;IACF;IAEA,OAAOzE,oBAAoB;EAC7B;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pipeline.js","names":["RenderPipeline","cast","log","isObjectEmpty","applyParametersToRenderPipelineDescriptor","getWebGPUTextureFormat","getBindGroup","getVertexBufferLayout","WebGPURenderPipeline","constructor","device","props","handle","vs","fs","_bindGroupLayout","_bindGroup","descriptor","_getRenderPipelineDescriptor","groupCollapsed","id","probe","JSON","stringify","groupEnd","createRenderPipeline","label","destroy","setBindings","bindings","Object","assign","setUniforms","uniforms","Error","draw","options","webgpuRenderPass","renderPass","getDefaultRenderPass","setPipeline","bindGroup","_getBindGroup","setBindGroup","vertexArray","bindBeforeRender","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","unbindAfterRender","getBindGroupLayout","shaderLayout","vertex","module","entryPoint","vsEntryPoint","buffers","bufferLayout","fragment","_this$device","fsEntryPoint","targets","format","canvasContext","topology","primitive","layout","parameters"],"sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"sourcesContent":["// luma.gl MIT license\n\nimport type {Binding, UniformValue, RenderPass, VertexArray} from '@luma.gl/core';\nimport {RenderPipeline, RenderPipelineProps, cast, log, isObjectEmpty} from '@luma.gl/core';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout} from '../helpers/get-vertex-buffer-layout';\n// import {convertAttributesVertexBufferToLayout} from '../helpers/get-vertex-buffer-layout';\n// import {mapAccessorToWebGPUFormat} from './helpers/accessor-to-format';\n// import type {BufferAccessors} from './webgpu-pipeline';\n\nimport type {WebGPUDevice} from '../webgpu-device';\n// import type {WebGPUBuffer} from './webgpu-buffer';\nimport type {WebGPUShader} from './webgpu-shader';\nimport type {WebGPURenderPass} from './webgpu-render-pass';\n\n// RENDER PIPELINE\n\n/** Creates a new render pipeline when parameters change */\nexport class WebGPURenderPipeline extends RenderPipeline {\n device: WebGPUDevice;\n handle: GPURenderPipeline;\n\n vs: WebGPUShader;\n fs: WebGPUShader | null = null;\n\n // private _bufferSlots: Record<string, number>;\n // private _buffers: Buffer[];\n // private _firstIndex: number;\n // private _lastIndex: number;\n\n /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout | null = null;\n private _bindGroup: GPUBindGroup | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle as GPURenderPipeline;\n if (!this.handle) {\n const descriptor = this._getRenderPipelineDescriptor();\n log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)();\n log.probe(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n this.handle = this.device.handle.createRenderPipeline(descriptor); \n }\n this.handle.label = this.props.id;\n\n this.vs = cast<WebGPUShader>(props.vs);\n this.fs = cast<WebGPUShader>(props.fs);\n\n // this._bufferSlots = getBufferSlots(this.props.shaderLayout, this.props.bufferLayout);\n // this._buffers = new Array<Buffer>(Object.keys(this._bufferSlots).length).fill(null);\n }\n\n override destroy(): void {\n // WebGPURenderPipeline has no destroy method.\n }\n\n // setIndexBuffer(indexBuffer: Buffer): void {\n // this._indexBuffer = cast<WebGPUBuffer>(indexBuffer);\n // }\n\n /*\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const bufferIndex = this._bufferSlots[name];\n if (bufferIndex >= 0) {\n this._buffers[bufferIndex] = buffer;\n } else {\n throw new Error(\n `Setting attribute '${name}' not listed in shader layout for program ${this.id}`\n );\n }\n }\n // for (let i = 0; i < this._bufferSlots.length; ++i) {\n // const bufferName = this._bufferSlots[i];\n // if (attributes[bufferName]) {\n // this.handle\n // }\n // }\n }\n */\n\n // setConstantAttributes(attributes: Record<string, TypedArray>): void {\n // throw new Error('not implemented');\n // }\n\n setBindings(bindings: Record<string, Binding>): void {\n // if (isObjectEmpty(bindings)) {\n // return;\n // }\n\n // Do we want to save things on CPU side?\n Object.assign(this.props.bindings, bindings);\n }\n\n setUniforms(uniforms: Record<string, UniformValue>): void {\n if (!isObjectEmpty(uniforms)) {\n throw new Error('WebGPU does not support uniforms');\n }\n }\n\n draw(options: {\n renderPass: RenderPass;\n vertexArray: VertexArray;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n const webgpuRenderPass: WebGPURenderPass =\n cast<WebGPURenderPass>(options.renderPass) || this.device.getDefaultRenderPass();\n\n // Set pipeline\n webgpuRenderPass.handle.setPipeline(this.handle);\n\n // Set bindings (uniform buffers, textures etc)\n const bindGroup = this._getBindGroup();\n if (bindGroup) {\n webgpuRenderPass.handle.setBindGroup(0, bindGroup);\n }\n\n\n // Set attributes\n // Note: Rebinds constant attributes before each draw call\n options.vertexArray.bindBeforeRender(options.renderPass);\n\n // Draw\n if (options.indexCount) {\n webgpuRenderPass.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n webgpuRenderPass.handle.draw(\n options.vertexCount || 0,\n options.instanceCount || 1, // If 0, nothing will be drawn\n options.firstInstance\n );\n }\n\n // Note: Rebinds constant attributes before each draw call\n options.vertexArray.unbindAfterRender(options.renderPass);\n }\n\n // _getBuffers() {\n // return this._buffers;\n // }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group\n this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);\n\n // Set up the bindings\n this._bindGroup = this._bindGroup || getBindGroup(\n this.device.handle,\n this._bindGroupLayout,\n this.props.shaderLayout,\n this.props.bindings\n );\n\n return this._bindGroup;\n }\n\n /** \n * Populate the complex WebGPU GPURenderPipelineDescriptor \n */\n protected _getRenderPipelineDescriptor() {\n // Set up the vertex stage\n const vertex: GPUVertexState = {\n module: cast<WebGPUShader>(this.props.vs).handle,\n entryPoint: this.props.vsEntryPoint || 'main',\n buffers: getVertexBufferLayout(this.props.shaderLayout, this.props.bufferLayout)\n };\n\n // Set up the fragment stage\n let fragment: GPUFragmentState | undefined;\n if (this.props.fs) {\n fragment = {\n module: cast<WebGPUShader>(this.props.fs).handle,\n entryPoint: this.props.fsEntryPoint || 'main',\n targets: [\n {\n // TODO exclamation mark hack!\n format: getWebGPUTextureFormat(this.device?.canvasContext?.format)\n }\n ]\n };\n }\n\n // WebGPU has more restrictive topology support than WebGL\n switch (this.props.topology) {\n case 'triangle-fan-webgl':\n case 'line-loop-webgl':\n throw new Error(`WebGPU does not support primitive topology ${this.props.topology}`);\n default:\n }\n\n // Create a partially populated descriptor\n const descriptor: GPURenderPipelineDescriptor = {\n vertex,\n fragment,\n primitive: {\n topology: this.props.topology\n },\n layout: 'auto'\n };\n\n // Set parameters on the descriptor\n applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);\n\n return descriptor;\n }\n\n /**\n _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {\n if (this._indexBuffer) {\n webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);\n }\n\n const buffers = this._getBuffers();\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = cast<WebGPUBuffer>(buffers[i]);\n if (!buffer) {\n const attribute = this.props.shaderLayout.attributes.find(\n (attribute) => attribute.location === i\n );\n throw new Error(\n `No buffer provided for attribute '${attribute?.name || ''}' in Model '${this.props.id}'`\n );\n }\n webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);\n }\n\n // TODO - HANDLE buffer maps\n /*\n for (const [bufferName, attributeMapping] of Object.entries(this.props.bufferLayout)) {\n const buffer = cast<WebGPUBuffer>(this.props.attributes[bufferName]);\n if (!buffer) {\n log.warn(`Missing buffer for buffer map ${bufferName}`)();\n continue;\n }\n\n if ('location' in attributeMapping) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(layout.location, buffer.handle);\n } else {\n for (const [bufferName, mapping] of Object.entries(attributeMapping)) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(field.location, buffer.handle);\n }\n }\n }\n *\n }\n */\n}\n"],"mappings":"AAGA,SAAQA,cAAc,EAAuBC,IAAI,EAAEC,GAAG,EAAEC,aAAa,QAAO,eAAe;AAAC,SACpFC,yCAAyC;AAAA,SACzCC,sBAAsB;AAAA,SACtBC,YAAY;AAAA,SACZC,qBAAqB;AAa7B,OAAO,MAAMC,oBAAoB,SAASR,cAAc,CAAC;EAgBvDS,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACD,MA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AAI,CAACzD,KAAK,CAACyD;MACvB,CAAC;MACDE,MAAM,EAAE;IACV,CAAC;IAGDlE,yCAAyC,CAACa,UAAU,EAAE,IAAI,CAACN,KAAK,CAAC4D,UAAU,CAAC;IAE5E,OAAOtD,UAAU;EACnB;AA4CF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-sampler.js","names":["Sampler","WebGPUSampler","constructor","device","props","handle","samplerProps","type","compare","createSampler","label","id","destroy"],"sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"sourcesContent":["import {Sampler, SamplerProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUSamplerProps = SamplerProps & {\n handle?: GPUSampler;\n}\n\n/**\n *\n */\nexport class WebGPUSampler extends Sampler {\n readonly device: WebGPUDevice;\n readonly handle: GPUSampler;\n\n constructor(device: WebGPUDevice, props: WebGPUSamplerProps) {\n super(device, props);\n this.device = device;\n\n // Prepare sampler props\n const samplerProps: Partial<WebGPUSamplerProps> = {...this.props};\n if (samplerProps.type !== 'comparison-sampler') {\n delete samplerProps.compare;\n }\n\n this.handle = this.handle || this.device.handle.createSampler(samplerProps);\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n // this.handle.destroy();\n }\n}\n"],"mappings":"AAAA,SAAQA,OAAO,QAAqB,eAAe;AAUnD,OAAO,MAAMC,aAAa,SAASD,OAAO,CAAC;EAIzCE,WAAWA,CAACC,MAAoB,EAAEC,KAAyB,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJdD,MAAM;IAAA,KACNE,MAAM;IAIb,IAAI,CAACF,MAAM,GAAGA,MAAM;IAGpB,MAAMG,YAAyC,GAAG;MAAC,GAAG,IAAI,CAACF;IAAK,CAAC;IACjE,IAAIE,YAAY,CAACC,IAAI,KAAK,oBAAoB,EAAE;MAC9C,OAAOD,YAAY,CAACE,OAAO;IAC7B;IAEA,IAAI,CAACH,MAAM,GAAG,IAAI,CAACA,MAAM,IAAI,IAAI,CAACF,MAAM,CAACE,MAAM,CAACI,aAAa,CAACH,YAAY,CAAC;IAC3E,IAAI,CAACD,MAAM,CAACK,KAAK,GAAG,IAAI,CAACN,KAAK,CAACO,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAEzB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-shader.js","names":["Shader","log","WebGPUShader","constructor","device","props","handle","pushErrorScope","createHandle","label","id","_checkCompilationError","popErrorScope","errorScope","error","debugShader","shaderLog","getCompilationInfo","message","Error","destroy","compilationInfo","messages","source","stage","language","includes","createShaderModule","code","transform","glsl","glslang","compileGLSL"],"sources":["../../../src/adapter/resources/webgpu-shader.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderProps, CompilerMessage} from '@luma.gl/core';\nimport {Shader, log} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUShaderProps = ShaderProps & {\n handle?: GPUShaderModule;\n};\n\n/**\n * Immutable shader\n */\nexport class WebGPUShader extends Shader {\n readonly device: WebGPUDevice;\n readonly handle: GPUShaderModule;\n\n constructor(device: WebGPUDevice, props: WebGPUShaderProps) {\n super(device, props);\n this.device = device;\n\n this.device.handle.pushErrorScope('validation');\n\n this.handle = this.props.handle || this.createHandle();\n this.handle.label = this.props.id;\n\n this._checkCompilationError(this.device.handle.popErrorScope());\n }\n\n async _checkCompilationError(errorScope: Promise<GPUError | null>): Promise<void> {\n const error = await errorScope as GPUValidationError;\n if (error) {\n // The `Shader` base class will determine if debug window should be opened based on props\n this.debugShader();\n\n const shaderLog = await this.getCompilationInfo();\n log.error(`Shader compilation error: ${error.message}`, shaderLog)();\n // Note: Even though this error is asynchronous and thrown after the constructor completes,\n // it will result in a useful stack trace leading back to the constructor\n throw new Error(`Shader compilation error: ${error.message}`);\n }\n }\n\n override destroy(): void {\n // Note: WebGPU does not offer a method to destroy shaders\n // this.handle.destroy();\n }\n\n /** Returns compilation info for this shader */\n async getCompilationInfo(): Promise<readonly CompilerMessage[]> {\n const compilationInfo = await this.handle.getCompilationInfo();\n return compilationInfo.messages;\n }\n\n // PRIVATE METHODS\n\n protected createHandle(): GPUShaderModule {\n const {source, stage} = this.props;\n\n let language = this.props.language;\n // Compile from src\n if (language === 'auto') {\n // wgsl uses C++ \"auto\" style arrow notation\n language = source.includes('->') ? 'wgsl' : 'glsl';\n }\n\n switch(language) {\n case 'wgsl':\n return this.device.handle.createShaderModule({code: source});\n case 'glsl':\n return this.device.handle.createShaderModule({\n code: source,\n // @ts-expect-error\n transform: (glsl) => this.device.glslang.compileGLSL(glsl, stage)\n });\n default:\n throw new Error(language);\n }\n }\n}\n"],"mappings":"AAIA,SAAQA,MAAM,EAAEC,GAAG,QAAO,eAAe;AAUzC,OAAO,MAAMC,YAAY,SAASF,MAAM,CAAC;EAIvCG,WAAWA,CAACC,MAAoB,EAAEC,KAAwB,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJdD,MAAM;IAAA,KACNE,MAAM;IAIb,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACA,MAAM,CAACE,MAAM,CAACC,cAAc,CAAC,YAAY,CAAC;IAE/C,IAAI,CAACD,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACE,YAAY,CAAC,CAAC;IACtD,IAAI,CAACF,MAAM,CAACG,KAAK,GAAG,IAAI,CAACJ,KAAK,CAACK,EAAE;IAEjC,IAAI,CAACC,sBAAsB,CAAC,IAAI,CAACP,MAAM,CAACE,MAAM,CAACM,aAAa,CAAC,CAAC,CAAC;EACjE;EAEA,MAAMD,sBAAsBA,CAACE,UAAoC,EAAiB;IAChF,MAAMC,KAAK,GAAG,MAAMD,UAAgC;IACpD,IAAIC,KAAK,EAAE;MAET,IAAI,CAACC,WAAW,CAAC,CAAC;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GPUTextureFormat","WebGPUSampler","BASE_DIMENSIONS","WebGPUTexture","constructor","device","props","handle","view","sampler","height","width","data","Promise","then","resolvedImageData","initialize","_this$handle","createHandle","label","id","setData","createView","_this$props$data","_this$props$data2","createTexture","size","depthOrArrayLayers","depth","dimension","format","usage","mipLevelCount","mipLevels","sampleCount","samples","destroy","setSampler","options","setImage","source","sourceX","sourceY","mipLevel","x","y","z","aspect","colorSpace","premultipliedAlpha","queue","copyExternalImageToTexture","origin","texture"],"sources":["../../../src/adapter/resources/webgpu-texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {Texture, TextureProps, Sampler, SamplerProps} from '@luma.gl/core';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\n\nconst BASE_DIMENSIONS: Record<string, '1d' | '2d' | '3d'> = {\n '1d': '1d',\n '2d': '2d',\n '2d-array': '2d',\n 'cube': '2d',\n 'cube-array': '2d',\n '3d': '3d'\n};\n\nexport class WebGPUTexture extends Texture {\n readonly device: WebGPUDevice;\n readonly handle: GPUTexture;\n readonly view: GPUTextureView;\n sampler: WebGPUSampler;\n\n override height: number = 1;\n override width: number = 1;\n\n // static async createFromImageURL(src, usage = 0) {\n // const img = document.createElement('img');\n // img.src = src;\n // await img.decode();\n // return WebGPUTexture(img, usage);\n // }\n\n constructor(device: WebGPUDevice, props: TextureProps) {\n super(device, props);\n\n this.device = device;\n\n if (props.data instanceof Promise) {\n props.data.then(resolvedImageData => {\n // @ts-expect-error\n this.props = {...props, data: resolvedImageData};\n this.initialize(this.props);\n });\n return;\n }\n\n this.initialize(props);\n }\n\n protected initialize(props: TextureProps): void {\n // @ts-expect-error\n this.handle = this.props.handle || this.createHandle();\n this.handle.label ||= this.id;\n\n if (this.props.data) {\n this.setData({data: this.props.data});\n }\n\n this.width = this.handle.width;\n this.height = this.handle.height;\n // Why not just read all properties directly from the texture\n // this.depthOrArrayLayers = this.handle.depthOrArrayLayers;\n // this.mipLevelCount = this.handle.mipLevelCount;\n // this.sampleCount = this.handle.sampleCount;\n // this.dimension = this.handle.dimension;\n // this.format = this.handle.format;\n // this.usage = this.handle.usage;\n\n // Create a default sampler. This mimics the WebGL1 API where sampler props are stored on the texture\n // this.setSampler(props.sampler);\n this.sampler = props.sampler instanceof WebGPUSampler ? props.sampler : new WebGPUSampler(this.device, props.sampler);\n\n // TODO - To support texture arrays we need to create custom views...\n // But we are not ready to expose TextureViews to the public API.\n // @ts-expect-error\n this.view = this.createView();\n // format: this.props.format,\n // dimension: this.props.dimension,\n // aspect = \"all\";\n // baseMipLevel: 0;\n // mipLevelCount;\n // baseArrayLayer = 0;\n // arrayLayerCount;\n }\n\n protected createHandle(): GPUTexture {\n // Deduce size from data - TODO this is a hack\n // @ts-expect-error\n const width = this.props.width || this.props.data?.width || 1;\n // @ts-expect-error\n const height = this.props.height || this.props.data?.height || 1;\n\n return this.device.handle.createTexture({\n label: this.id,\n size: {\n width,\n height,\n depthOrArrayLayers: this.props.depth\n },\n dimension: BASE_DIMENSIONS[this.props.dimension],\n format: getWebGPUTextureFormat(this.props.format),\n usage: this.props.usage,\n mipLevelCount: this.props.mipLevels,\n sampleCount: this.props.samples\n });\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n /**\n * Set default sampler\n * Accept a sampler instance or set of props;\n */\n setSampler(sampler: Sampler | SamplerProps): this {\n this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n\n setData(options: {\n data: any;\n }) {\n return this.setImage({source: options.data});\n }\n\n /** Set image */\n setImage(options: {\n source: ImageBitmap | HTMLCanvasElement | OffscreenCanvas;\n width?: number;\n height?: number;\n depth?: number;\n sourceX?: number;\n sourceY?: number;\n mipLevel?: number;\n x?: number;\n y?: number;\n z?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n colorSpace?: 'srgb';\n premultipliedAlpha?: boolean;\n }): {width: number, height: number} {\n const {\n source,\n width = options.source.width,\n height = options.source.height,\n depth = 1,\n sourceX = 0,\n sourceY = 0,\n mipLevel = 0,\n x = 0,\n y = 0,\n z = 0,\n aspect = 'all',\n colorSpace = 'srgb',\n premultipliedAlpha = false\n } = options;\n\n // TODO - max out width\n\n this.device.handle.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source,\n origin: [sourceX, sourceY]\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: this.handle,\n origin: [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [\n width,\n height,\n depth\n ]\n );\n return {width, height};\n }\n\n // WebGPU specific \n \n /** TODO - intention is to expose TextureViews in the public API */\n createView(): GPUTextureView {\n return this.handle.createView({label: this.id});\n }\n \n /*\n async readPixels() {\n const readbackBuffer = device.createBuffer({\n usage: Buffer.COPY_DST | Buffer.MAP_READ,\n size: 4 * textureWidth * textureHeight,\n });\n\n // Copy data from the texture to the buffer.\n const encoder = device.createCommandEncoder();\n encoder.copyTextureToBuffer(\n { texture },\n { buffer, rowPitch: textureWidth * 4 },\n [textureWidth, textureHeight],\n );\n device.submit([encoder.finish()]);\n\n // Get the data on the CPU.\n await buffer.mapAsync(GPUMapMode.READ);\n saveScreenshot(buffer.getMappedRange());\n buffer.unmap();\n }\n\n setImageData(imageData, usage): this {\n let data = null;\n\n const bytesPerRow = Math.ceil((img.width * 4) / 256) * 256;\n if (bytesPerRow == img.width * 4) {\n data = imageData.data;\n } else {\n data = new Uint8Array(bytesPerRow * img.height);\n let imagePixelIndex = 0;\n for (let y = 0; y < img.height; ++y) {\n for (let x = 0; x < img.width; ++x) {\n const i = x * 4 + y * bytesPerRow;\n data[i] = imageData.data[imagePixelIndex];\n data[i + 1] = imageData.data[imagePixelIndex + 1];\n data[i + 2] = imageData.data[imagePixelIndex + 2];\n data[i + 3] = imageData.data[imagePixelIndex + 3];\n imagePixelIndex += 4;\n }\n }\n }\n return this;\n }\n\n setData(data): this {\n const textureDataBuffer = this.device.handle.createBuffer({\n size: data.byteLength,\n usage: Buffer.COPY_DST | Buffer.COPY_SRC,\n mappedAtCreation: true\n });\n new Uint8Array(textureDataBuffer.getMappedRange()).set(data);\n textureDataBuffer.unmap();\n\n this.setBuffer(textureDataBuffer);\n\n textureDataBuffer.destroy();\n return this;\n }\n\n setBuffer(textureDataBuffer, {bytesPerRow}): this {\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToTexture(\n {\n buffer: textureDataBuffer,\n bytesPerRow\n },\n {\n texture: this.handle\n },\n {\n width,\n height,\n depth\n }\n );\n\n this.device.handle.defaultQueue.submit([commandEncoder.finish()]);\n return this;\n }\n */\n}\n"],"mappings":"AACA,SAAQA,OAAO,QAA4C,eAAe;AAAC,SACnEC,sBAAsB;AAAA,SAEtBC,aAAa;AAErB,MAAMC,eAAmD,GAAG;EAC1D,IAAI,EAAE,IAAI;EACV,IAAI,EAAE,IAAI;EACV,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,IAAI;EACZ,YAAY,EAAE,IAAI;EAClB,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,aAAa,SAASJ,OAAO,CAAC;EAgBzCK,WAAWA,CAACC,MAAoB,EAAEC,KAAmB,EAAE;IACrD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAhBdD,MAAM;IAAA,KACNE,MAAM;IAAA,KACNC,IAAI;IAAA,KACbC,OAAO;IAAA,KAEEC,MAAM,GAAW,CAAC;IAAA,KAClBC,KAAK,GAAW,CAAC;IAYxB,IAAI,CAACN,MAAM,GAAGA,MAAM;IAEpB,IAAIC,KAAK,CAACM,IAAI,YAAYC,OAAO,EAAE;MACjCP,KAAK,CAACM,IAAI,CAACE,IAAI,CAACC,iBAAiB,IAAI;QAEnC,IAAI,CAACT,KAAK,GAAG;UAAC,GAAGA,KAAK;UAAEM,IAAI,EAAEG;QAAiB,CAAC;QAChD,IAAI,CAAC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,CAAC,GAAG,CAAC;MACLC,CAAC,GAAG,CAAC;MACLC,CAAC,GAAG,CAAC;MACLC,MAAM,GAAG,KAAK;MACdC,UAAU,GAAG,MAAM;MACnBC,kBAAkB,GAAG;IACvB,CAAC,GAAGX,OAAO;IAIX,IAAI,CAACjC,MAAM,CAACE,MAAM,CAAC2C,KAAK,CAACC,0BAA0B,CAEjD;MACEX,MAAM;MACNY,MAAM,EAAE,CAACX,OAAO,EAAEC,OAAO;IAC3B,CAAC,EAED;MACEW,OAAO,EAAE,IAAI,CAAC9C,MAAM;MACpB6C,MAAM,EAAE,CAACR,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;MACjBH,QAAQ;MACRI,MAAM;MACNC,UAAU;MACVC;IACF,CAAC,EAED,CACEtC,KAAK,EACLD,MAAM,EACNkB,KAAK,CAET,CAAC;IACD,OAAO;MAACjB,KAAK;MAAED;IAAM,CAAC;EACxB;EAKAY,UAAUA,CAAA,EAAmB;IAC3B,OAAO,IAAI,CAACf,MAAM,CAACe,UAAU,CAAC;MAACH,KAAK,EAAE,IAAI,CAACC;IAAE,CAAC,CAAC;EACjD;AAmFF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-vertex-array.js","names":["VertexArray","log","getBrowser","_Symbol$toStringTag","Symbol","toStringTag","WebGPUVertexArray","isConstantAttributeZeroSupported","device","info","type","constructor","props","handle","destroy","setIndexBuffer","buffer","indexBuffer","setBuffer","bufferSlot","attributes","setConstant","location","value","warn","id","bindBeforeRender","renderPass","firstIndex","indexCount","webgpuRenderPass","webgpuIndexBuffer","indexType","maxVertexAttributes","webgpuBuffer","setVertexBuffer","unbindAfterRender"],"sources":["../../../src/adapter/resources/webgpu-vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device, Buffer, VertexArrayProps, RenderPass, TypedArray} from '@luma.gl/core';\nimport {VertexArray, log} from '@luma.gl/core';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from '../resources/webgpu-buffer';\n\nimport {WebGPURenderPass} from './webgpu-render-pass';\n\n/** VertexArrayObject wrapper */\nexport class WebGPUVertexArray extends VertexArray {\n override get [Symbol.toStringTag](): string {\n return 'WebGPUVertexArray';\n }\n\n readonly device: WebGPUDevice;\n /** Vertex Array is a helper class under WebGPU */\n readonly handle: never;\n\n /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */\n static isConstantAttributeZeroSupported(device: Device): boolean {\n return device.info.type === 'webgl2' || getBrowser() === 'Chrome';\n }\n\n // Create a VertexArray\n constructor(device: WebGPUDevice, props?: VertexArrayProps) {\n super(device, props);\n this.device = device;\n }\n\n override destroy(): void {}\n\n /**\n * Set an elements buffer, for indexed rendering.\n * Must be a Buffer bound to buffer with usage bit Buffer.INDEX set. \n */\n setIndexBuffer(buffer: Buffer | null): void {\n // assert(!elementBuffer || elementBuffer.glTarget === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);\n this.indexBuffer = buffer;\n }\n\n /** Set a bufferSlot in vertex attributes array to a buffer, enables the bufferSlot, sets divisor */\n setBuffer(bufferSlot: number, buffer: Buffer): void {\n // Sanity check target\n // if (buffer.glUsage === GL.ELEMENT_ARRAY_BUFFER) {\n // throw new Error('Use setIndexBuffer');\n // }\n\n this.attributes[bufferSlot] = buffer;\n }\n\n /** Set a location in vertex attributes array to a constant value, disables the location */\n override setConstant(location: number, value: TypedArray): void {\n log.warn(`${this.id} constant attributes not supported on WebGPU`)\n }\n\n override bindBeforeRender(renderPass: RenderPass, firstIndex?: number, indexCount?: number): void {\n const webgpuRenderPass = renderPass as WebGPURenderPass;\n const webgpuIndexBuffer = this.indexBuffer as WebGPUBuffer;\n if (webgpuIndexBuffer?.handle) {\n // Note we can't unset an index buffer\n log.warn('setting index buffer', webgpuIndexBuffer?.handle, webgpuIndexBuffer?.indexType)();\n webgpuRenderPass.handle.setIndexBuffer(webgpuIndexBuffer?.handle, webgpuIndexBuffer?.indexType);\n }\n for (let location = 0; location < this.maxVertexAttributes; location++) {\n const webgpuBuffer = this.attributes[location] as WebGPUBuffer;\n if (webgpuBuffer?.handle) {\n log.warn(`setting vertex buffer ${location}`,webgpuBuffer?.handle)();\n webgpuRenderPass.handle.setVertexBuffer(location, webgpuBuffer?.handle);\n }\n }\n // TODO - emit warnings/errors/throw if constants have been set on this vertex array\n }\n\n override unbindAfterRender(renderPass: RenderPass): void {\n // On WebGPU we don't need to unbind. \n // In fact we can't easily do it. setIndexBuffer/setVertexBuffer don't accept null.\n // Unbinding presumably happens automatically when the render pass is ended.\n }\n}\n"],"mappings":";AAIA,SAAQA,WAAW,EAAEC,GAAG,QAAO,eAAe;AAC9C,SAAQC,UAAU,QAAO,eAAe;AAACC,mBAAA,GASzBC,MAAM,CAACC,WAAW;AADlC,OAAO,MAAMC,iBAAiB,SAASN,WAAW,CAAC;EACjD,KAAAG,mBAAA,IAA4C;IAC1C,OAAO,mBAAmB;EAC5B;EAOA,OAAOI,gCAAgCA,CAACC,MAAc,EAAW;IAC/D,OAAOA,MAAM,CAACC,IAAI,CAACC,IAAI,KAAK,QAAQ,IAAIR,UAAU,CAAC,CAAC,KAAK,QAAQ;EACnE;EAGAS,WAAWA,CAACH,MAAoB,EAAEI,KAAwB,EAAE;IAC1D,KAAK,CAACJ,MAAM,EAAEI,KAAK,CAAC;IAAC,KAXdJ,MAAM;IAAA,KAENK,MAAM;IAUb,IAAI,CAACL,MAAM,GAAGA,MAAM;EACtB;EAESM,OAAOA,CAAA,EAAS,CAAC;EAM1BC,cAAcA,CAACC,MAAqB,EAAQ;IAE1C,IAAI,CAACC,WAAW,GAAGD,MAAM;EAC3B;EAGAE,SAASA,CAACC,UAAkB,EAAEH,MAAc,EAAQ;IAMlD,IAAI,CAACI,UAAU,CAACD,UAAU,CAAC,GAAGH,MAAM;EACtC;EAGSK,WAAWA,CAACC,QAAgB,EAAEC,KAAiB,EAAQ;IAC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0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-canvas-context.js","names":["CanvasContext","log","getWebGPUTextureFormat","WebGPUFramebuffer","WebGPUCanvasContext","constructor","device","adapter","props","gpuCanvasContext","format","navigator","gpu","getPreferredCanvasFormat","depthStencilFormat","depthStencilAttachment","width","height","_setAutoCreatedCanvasId","id","canvas","getContext","destroy","unconfigure","getCurrentFramebuffer","update","currentColorAttachment","getCurrentTexture","_createDepthStencilAttachment","colorAttachments","getPixelSize","sizeChanged","configure","handle","colorSpace","alphaMode","resize","options","_createTexture","createTexture","usage","GPUTextureUsage","RENDER_ATTACHMENT"],"sources":["../../src/adapter/webgpu-canvas-context.ts"],"sourcesContent":["// / <reference types=\"@webgpu/types\" />\nimport type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/core';\nimport {CanvasContext, log} from '@luma.gl/core';\nimport {getWebGPUTextureFormat} from './helpers/convert-texture-format';\nimport {WebGPUDevice} from './webgpu-device';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\n\n/** \n * Holds a WebGPU Canvas Context\n * The primary job of the CanvasContext is to generate textures for rendering into the current canvas\n * It also manages canvas sizing calculations and resizing.\n */\nexport class WebGPUCanvasContext extends CanvasContext {\n readonly device: WebGPUDevice;\n readonly gpuCanvasContext: GPUCanvasContext;\n /** Format of returned textures: \"bgra8unorm\", \"rgba8unorm\", \"rgba16float\". */\n readonly format: TextureFormat = navigator.gpu.getPreferredCanvasFormat();\n /** Default stencil format for depth textures */\n depthStencilFormat: TextureFormat = 'depth24plus';\n\n private depthStencilAttachment: Texture | null = null;\n\n constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps) {\n super(props);\n this.device = device;\n // TODO - hack to trigger resize?\n this.width = -1;\n this.height = -1;\n\n this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);\n // @ts-ignore TODO - we don't handle OffscreenRenderingContext.\n this.gpuCanvasContext = this.canvas.getContext('webgpu');\n // TODO this has been replaced\n // this.format = this.gpuCanvasContext.getPreferredFormat(adapter);\n this.format = 'bgra8unorm';\n }\n\n /** Destroy any textures produced while configured and remove the context configuration. */\n destroy(): void {\n this.gpuCanvasContext.unconfigure();\n }\n\n /** Update framebuffer with properly resized \"swap chain\" texture views */\n getCurrentFramebuffer(): WebGPUFramebuffer {\n // Ensure the canvas context size is updated\n this.update();\n\n // Wrap the current canvas context texture in a luma.gl texture\n // const currentColorAttachment = this.device.createTexture({\n // id: 'default-render-target',\n // handle: this.gpuCanvasContext.getCurrentTexture(),\n // format: this.format,\n // width: this.width,\n // height: this.height\n // });\n\n // Wrap the current canvas context texture in a luma.gl texture \n const currentColorAttachment = this.getCurrentTexture();\n this.width = currentColorAttachment.width;\n this.height = currentColorAttachment.height;\n\n // Resize the depth stencil attachment\n this._createDepthStencilAttachment();\n\n return new WebGPUFramebuffer(this.device, {\n colorAttachments: [currentColorAttachment],\n depthStencilAttachment: this.depthStencilAttachment\n });\n }\n\n /** Resizes and updates render targets if necessary */\n update() {\n const [width, height] = this.getPixelSize();\n\n const sizeChanged = width !== this.width || height !== this.height;\n\n if (sizeChanged) {\n this.width = width;\n this.height = height;\n\n if (this.depthStencilAttachment) {\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = null;\n }\n\n // Reconfigure the canvas size.\n // https://www.w3.org/TR/webgpu/#canvas-configuration\n this.gpuCanvasContext.configure({\n device: this.device.handle,\n format: getWebGPUTextureFormat(this.format),\n // Can be used to define e.g. -srgb views\n // viewFormats: [...]\n colorSpace: this.props.colorSpace,\n alphaMode: this.props.alphaMode\n });\n\n log.log(1, `Resized to ${this.width}x${this.height}px`)();\n }\n }\n\n resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n this.update();\n }\n\n /** Wrap the current canvas context texture in a luma.gl texture */\n getCurrentTexture(): WebGPUTexture {\n return this.device._createTexture({\n id: `${this.id}#color-texture`,\n handle: this.gpuCanvasContext.getCurrentTexture()\n });\n }\n\n /** We build render targets on demand (i.e. not when size changes but when about to render) */\n _createDepthStencilAttachment() {\n if (!this.depthStencilAttachment) {\n this.depthStencilAttachment = this.device.createTexture({\n id: `${this.id}#depth-stencil-texture`,\n format: this.depthStencilFormat,\n width: this.width,\n height: this.height,\n usage: GPUTextureUsage.RENDER_ATTACHMENT\n });\n }\n return this.depthStencilAttachment;\n }\n}\n"],"mappings":"AAEA,SAAQA,aAAa,EAAEC,GAAG,QAAO,eAAe;AAAC,SACzCC,sBAAsB;AAAA,SAEtBC,iBAAiB;AAQzB,OAAO,MAAMC,mBAAmB,SAASJ,aAAa,CAAC;EAUrDK,WAAWA,CAACC,MAAoB,EAAEC,OAAmB,EAAEC,KAAyB,EAAE;IAChF,KAAK,CAACA,KAAK,CAAC;IAAC,KAVNF,MAAM;IAAA,KACNG,gBAAgB;IAAA,KAEhBC,MAAM,GAAkBC,SAAS,CAACC,GAAG,CAACC,wBAAwB,CAAC,CAAC;IAAA,KAEzEC,kBAAkB,GAAkB,aAAa;IAAA,KAEzCC,sBAAsB,GAAmB,IAAI;IAInD,IAAI,CAACT,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACU,KAAK,GAAG,CAAC,CAAC;IACf,IAAI,CAACC,MAAM,GAAG,CAAC,CAAC;IAEhB,IAAI,CAACC,uBAAuB,CAAE,GAAE,IAAI,CAACZ,MAAM,CAACa,EAAG,SAAQ,CAAC;IAExD,IAAI,CAACV,gBAAgB,GAAG,IAAI,CAACW,MAAM,CAACC,UAAU,CAAC,QAAQ,CAAC;IAGxD,IAAI,CAACX,MAAM,GAAG,YAAY;EAC5B;EAGAY,OAAOA,CAAA,EAAS;IACd,IAAI,CAACb,gBAAgB,CAACc,WAAW,CAAC,CAAC;EACrC;EAGAC,qBAAqBA,CAAA,EAAsB;IAEzC,IAAI,CAACC,MAAM,CAAC,CAAC;IAYb,MAAMC,sBAAsB,GAAG,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACvD,IAAI,CAACX,KAAK,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EAAkB;IACjC,OAAO,IAAI,CAACrB,MAAM,CAACgC,cAAc,CAAC;MAChCnB,EAAE,EAAG,GAAE,IAAI,CAACA,EAAG,gBAAe;MAC9Bc,MAAM,EAAE,IAAI,CAACxB,gBAAgB,CAACkB,iBAAiB,CAAC;IAClD,CAAC,CAAC;EACJ;EAGAC,6BAA6BA,CAAA,EAAG;IAC9B,IAAI,CAAC,IAAI,CAACb,sBAAsB,EAAE;MAChC,IAAI,CAACA,sBAAsB,GAAG,IAAI,CAACT,MAAM,CAACiC,aAAa,CAAC;QACtDpB,EAAE,EAAG,GAAE,IAAI,CAACA,EAAG,wBAAuB;QACtCT,MAAM,EAAE,IAAI,CAACI,kBAAkB;QAC/BE,KAAK,EAAE,IAAI,CAACA,KAAK;QACjBC,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBuB,KAAK,EAAEC,eAAe,CAACC;MACzB,CAAC,CAAC;IACJ;IACA,OAAO,IAAI,CAAC3B,sBAAsB;EACpC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-device.js","names":["Device","CanvasContext","log","uid","WebGPUBuffer","WebGPUTexture","WebGPUExternalTexture","WebGPUSampler","WebGPUShader","WebGPURenderPipeline","WebGPUComputePipeline","WebGPURenderPass","WebGPUComputePass","WebGPUVertexArray","WebGPUCanvasContext","WebGPUDevice","isSupported","Boolean","navigator","gpu","create","props","Error","groupCollapsed","adapter","requestAdapter","powerPreference","adapterInfo","requestAdapterInfo","probe","gpuDevice","requestDevice","requiredFeatures","features","canvas","pageLoaded","device","table","info","groupEnd","constructor","id","handle","lost","canvasContext","commandEncoder","renderPass","_info","_isLost","driver","driverVersion","split","vendor","__brand","renderer","version","gpuArchitecture","architecture","gpuBackend","backend","gpuType","type","toLowerCase","shadingLanguage","shadingLanguageVersion","Promise","resolve","lostInfo","reason","message","height","width","container","_getFeatures","destroy","limits","isTextureFormatSupported","format","includes","isTextureFormatFilterable","isTextureFormatRenderable","isLost","createBuffer","newProps","_getBufferProps","_createTexture","createExternalTexture","createShader","createSampler","createRenderPipeline","createFramebuffer","createComputePipeline","createVertexArray","beginRenderPass","createCommandEncoder","beginComputePass","createTransformFeedback","createCanvasContext","getDefaultRenderPass","submit","_this$commandEncoder","commandBuffer","finish","queue","Set","has","delete","add","copyExternalImageToTexture","options","_this$handle","source","sourceX","sourceY","texture","mipLevel","aspect","colorSpace","premultipliedAlpha","depth","webGpuTexture","origin"],"sources":["../../src/adapter/webgpu-device.ts"],"sourcesContent":["// prettier-ignore\n// / <reference types=\"@webgpu/types\" />\n\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n BufferProps,\n SamplerProps,\n ShaderProps,\n Texture,\n TextureProps,\n TextureFormat,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps,\n // CommandEncoderProps,\n VertexArrayProps,\n TransformFeedback,\n TransformFeedbackProps\n} from '@luma.gl/core';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/core';\nimport {WebGPUBuffer} from './resources/webgpu-buffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\nimport {WebGPUExternalTexture} from './resources/webgpu-external-texture';\nimport {WebGPUSampler} from './resources/webgpu-sampler';\nimport {WebGPUShader} from './resources/webgpu-shader';\nimport {WebGPURenderPipeline} from './resources/webgpu-render-pipeline';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUComputePipeline} from './resources/webgpu-compute-pipeline';\nimport {WebGPURenderPass} from './resources/webgpu-render-pass';\nimport {WebGPUComputePass} from './resources/webgpu-compute-pass';\n// import {WebGPUCommandEncoder} from './resources/webgpu-command-encoder';\nimport {WebGPUVertexArray} from './resources/webgpu-vertex-array';\n\nimport {WebGPUCanvasContext} from './webgpu-canvas-context';\n// import {loadGlslangModule} from '../glsl/glslang';\n\n/** WebGPU Device implementation */\nexport class WebGPUDevice extends Device {\n readonly handle: GPUDevice;\n readonly adapter: GPUAdapter;\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n canvasContext: WebGPUCanvasContext | null = null;\n\n commandEncoder: GPUCommandEncoder | null = null;\n renderPass: WebGPURenderPass | null = null;\n\n private _info: DeviceInfo;\n private _isLost: boolean = false;\n\n static type: string = 'webgpu';\n\n /** Check if WebGPU is available */\n static isSupported(): boolean {\n return Boolean(typeof navigator !== 'undefined' && navigator.gpu);\n }\n\n static async create(props: DeviceProps): Promise<WebGPUDevice> {\n if (!navigator.gpu) {\n throw new Error(\n 'WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu'\n );\n }\n log.groupCollapsed(1, 'WebGPUDevice created')();\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: 'high-performance'\n // forceSoftware: false\n });\n if (!adapter) {\n throw new Error('Failed to request WebGPU adapter');\n }\n\n const adapterInfo = await adapter.requestAdapterInfo();\n log.probe(2, 'Adapter available', adapterInfo)();\n\n const gpuDevice = await adapter.requestDevice({\n requiredFeatures: adapter.features as ReadonlySet<GPUFeatureName>\n // TODO ensure we obtain best limits\n // requiredLimits: adapter.limits\n });\n log.probe(1, 'GPUDevice available')();\n\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n log.probe(1, 'DOM is loaded')();\n }\n\n const device = new WebGPUDevice(gpuDevice, adapter, adapterInfo, props);\n\n log.probe(1, 'Device created. For more info, set chrome://flags/#enable-webgpu-developer-features')();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n constructor(device: GPUDevice, adapter: GPUAdapter, adapterInfo: GPUAdapterInfo, props: DeviceProps) {\n super({...props, id: props.id || uid('webgpu-device')});\n this.handle = device;\n this.adapter = adapter;\n\n const [driver, driverVersion] = ((adapterInfo as any).driver || '').split(' Version ');\n\n // See https://developer.chrome.com/blog/new-in-webgpu-120#adapter_information_updates\n const vendor = adapterInfo.vendor || this.adapter.__brand || 'unknown';\n const renderer = driver || '';\n const version = driverVersion || '';\n\n const gpu = vendor === 'apple' ? 'apple' : 'unknown'; // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n const gpuArchitecture = adapterInfo.architecture || 'unknown';\n const gpuBackend = (adapterInfo as any).backend || 'unknown';\n const gpuType = ((adapterInfo as any).type || '').split(' ')[0].toLowerCase() || 'unknown'\n\n this._info = {\n type: 'webgpu',\n vendor,\n renderer,\n version,\n gpu, \n gpuType,\n gpuBackend,\n gpuArchitecture,\n shadingLanguage: 'wgsl',\n shadingLanguageVersion: 100\n };\n\n // \"Context\" loss handling\n this.lost = new Promise<{reason: 'destroyed'; message: string}>(async resolve => {\n const lostInfo = await this.handle.lost;\n this._isLost = true;\n resolve({reason: 'destroyed', message: lostInfo.message});\n });\n\n // Note: WebGPU devices can be created without a canvas, for compute shader purposes\n // if (props.canvas) {\n this.canvasContext = new WebGPUCanvasContext(this, this.adapter, {\n canvas: props.canvas,\n height: props.height,\n width: props.width,\n container: props.container\n });\n // }\n\n this.features = this._getFeatures();\n }\n\n // TODO\n // Load the glslang module now so that it is available synchronously when compiling shaders\n // const {glsl = true} = props;\n // this.glslang = glsl && await loadGlslangModule();\n\n destroy(): void {\n this.handle.destroy();\n }\n\n get info(): DeviceInfo {\n return this._info;\n }\n\n features: Set<DeviceFeature>;\n\n get limits(): DeviceLimits {\n return this.handle.limits;\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return !format.includes('webgl');\n }\n\n /** @todo implement proper check? */\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return this.isTextureFormatSupported(format);\n }\n\n /** @todo implement proper check? */\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return this.isTextureFormatSupported(format);\n }\n\n get isLost(): boolean {\n return this._isLost;\n }\n\n createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WebGPUBuffer {\n const newProps = this._getBufferProps(props);\n return new WebGPUBuffer(this, newProps);\n }\n\n _createTexture(props: TextureProps): WebGPUTexture {\n return new WebGPUTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture {\n return new WebGPUExternalTexture(this, props);\n }\n\n createShader(props: ShaderProps): WebGPUShader {\n return new WebGPUShader(this, props);\n }\n\n createSampler(props: SamplerProps): WebGPUSampler {\n return new WebGPUSampler(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline {\n return new WebGPURenderPipeline(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WebGPUFramebuffer {\n throw new Error('Not implemented');\n }\n\n createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline {\n return new WebGPUComputePipeline(this, props);\n }\n\n createVertexArray(props: VertexArrayProps): WebGPUVertexArray {\n return new WebGPUVertexArray(this, props);\n }\n\n // WebGPU specifics\n\n /**\n * Allows a render pass to begin against a canvas context\n * @todo need to support a \"Framebuffer\" equivalent (aka preconfigured RenderPassDescriptors?).\n */\n beginRenderPass(props: RenderPassProps): WebGPURenderPass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPURenderPass(this, props);\n }\n\n beginComputePass(props: ComputePassProps): WebGPUComputePass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPUComputePass(this, props);\n }\n\n // createCommandEncoder(props: CommandEncoderProps): WebGPUCommandEncoder {\n // return new WebGPUCommandEncoder(this, props);\n // }\n\n createTransformFeedback(props: TransformFeedbackProps): TransformFeedback {\n throw new Error('Transform feedback not supported in WebGPU');\n }\n\n createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext {\n return new WebGPUCanvasContext(this, this.adapter, props);\n }\n\n /**\n * Gets default renderpass encoder.\n * Creates a new encoder against default canvasContext if not already created\n * @note Called internally by Model.\n * @deprecated Create explicit pass with device.beginRenderPass\n */\n getDefaultRenderPass(): WebGPURenderPass {\n // this.renderPass =\n // this.renderPass ||\n // this.beginRenderPass({\n // framebuffer: this.canvasContext?.getCurrentFramebuffer()\n // });\n // return this.renderPass;\n throw new Error('a');\n }\n\n submit(): void {\n // this.renderPass?.end();\n const commandBuffer = this.commandEncoder?.finish();\n if (commandBuffer) {\n this.handle.queue.submit([commandBuffer]);\n }\n this.commandEncoder = null;\n // this.renderPass = null;\n }\n\n _getFeatures() {\n // WebGPU Features\n const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);\n\n // Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133\n // @ts-expect-error Chrome Canary v99\n if (features.has('depth-clamping')) {\n // @ts-expect-error Chrome Canary v99\n features.delete('depth-clamping');\n features.add('depth-clip-control');\n }\n\n // Add subsets\n if (features.has('texture-compression-bc')) {\n features.add('texture-compression-bc5-webgl');\n }\n\n features.add('webgpu');\n\n features.add('timer-query-webgl');\n\n // WEBGL1 SUPPORT\n features.add('vertex-array-object-webgl1');\n features.add('instanced-rendering-webgl1');\n features.add('multiple-render-targets-webgl1');\n features.add('index-uint32-webgl1');\n features.add('blend-minmax-webgl1');\n features.add('texture-blend-float-webgl1');\n\n // TEXTURES, RENDERBUFFERS\n features.add('texture-formats-srgb-webgl1');\n\n // TEXTURES\n features.add('texture-formats-depth-webgl1');\n features.add('texture-formats-float32-webgl1');\n features.add('texture-formats-float16-webgl1');\n\n features.add('texture-filter-linear-float32-webgl');\n features.add('texture-filter-linear-float16-webgl');\n features.add('texture-filter-anisotropic-webgl');\n\n // FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS\n features.add('texture-renderable-rgba32float-webgl');\n features.add('texture-renderable-float32-webgl');\n features.add('texture-renderable-float16-webgl');\n\n // GLSL extensions\n features.add('glsl-frag-data');\n features.add('glsl-frag-depth');\n features.add('glsl-derivatives');\n features.add('glsl-texture-lod');\n\n return features;\n }\n\n copyExternalImageToTexture(options: {\n texture: Texture;\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n colorSpace?: 'display-p3' | 'srgb';\n premultipliedAlpha?: boolean;\n\n source: ImageBitmap | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n sourceX?: number;\n sourceY?: number;\n\n width?: number;\n height?: number;\n depth?: number;\n }): void {\n const {\n source,\n sourceX = 0,\n sourceY = 0,\n\n texture,\n mipLevel = 0,\n aspect = 'all',\n colorSpace = 'display-p3',\n premultipliedAlpha = false,\n // destinationX,\n // destinationY,\n // desitnationZ,\n\n width = texture.width,\n height = texture.height,\n depth = 1\n } = options;\n\n const webGpuTexture = texture as WebGPUTexture;\n\n this.handle?.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source,\n origin: [sourceX, sourceY]\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: webGpuTexture.handle,\n origin: [0, 0, 0], // [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [width, height, depth]\n );\n }\n}\n"],"mappings":"AA0BA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,eAAe;AAAC,SACtDC,YAAY;AAAA,SACZC,aAAa;AAAA,SACbC,qBAAqB;AAAA,SACrBC,aAAa;AAAA,SACbC,YAAY;AAAA,SACZC,oBAAoB;AAAA,SAEpBC,qBAAqB;AAAA,SACrBC,gBAAgB;AAAA,SAChBC,iBAAiB;AAAA,SAEjBC,iBAAiB;AAAA,SAEjBC,mBAAmB;AAI3B,OAAO,MAAMC,YAAY,SAASf,MAAM,CAAC;EAevC,OAAOgB,WAAWA,CAAA,EAAY;IAC5B,OAAOC,OAAO,CAAC,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,GAAG,CAAC;EACnE;EAEA,aAAaC,MAAMA,CAACC,KAAkB,EAAyB;IAC7D,IAAI,CAACH,SAAS,CAACC,GAAG,EAAE;MAClB,MAAM,IAAIG,KAAK,CACb,8FACF,CAAC;IACH;IACApB,GAAG,CAACqB,cAAc,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAC/C,MAAMC,OAAO,GAAG,MAAMN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,GAAG,YAAY;MACzBC,kBAAkB,GAAG,KAAK;MAK1B/C,KAAK,GAAG2C,OAAO,CAAC3C,KAAK;MACrBD,MAAM,GAAG4C,OAAO,CAAC5C,MAAM;MACvBiD,KAAK,GAAG;IACV,CAAC,GAAGV,OAAO;IAEX,MAAMW,aAAa,GAAGN,OAAwB;IAE9C,CAAAJ,YAAA,OAAI,CAACpE,MAAM,cAAAoE,YAAA,uBAAXA,YAAA,CAAaP,KAAK,CAACK,0BAA0B,CAE3C;MACEG,MAAM;MACNU,MAAM,EAAE,CAACT,OAAO,EAAEC,OAAO;IAC3B,CAAC,EAED;MACEC,OAAO,EAAEM,aAAa,CAAC9E,MAAM;MAC7B+E,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;MACjBN,QAAQ;MACRC,MAAM;MACNC,UAAU;MACVC;IACF,CAAC,EAED,CAAC/C,KAAK,EAAED,MAAM,EAAEiD,KAAK,CACvB,CAAC;EACH;AACF;AAzVaxG,YAAY,CAYhB8C,IAAI,GAAW,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-types.js","names":[],"sources":["../../src/adapter/webgpu-types.ts"],"sourcesContent":[""],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glsllang.js","names":["glslang","loadGlslangModule","glslangModule","default"],"sources":["../../src/glsl/glsllang.ts"],"sourcesContent":["// Inspired by webgpu samples at https://github.com/austinEng/webgpu-samples/blob/master/src/glslang.ts\n// under BSD 3-clause license\n\nlet glslang: unknown;\n\n/** Dynamically load the GLSL compiler */\nexport async function loadGlslangModule() {\n if (!glslang) {\n // @ts-ignore\n const glslangModule = await import(/* webpackIgnore: true */ 'https://unpkg.com/@webgpu/glslang@0.0.15/dist/web-devel/glslang.js');\n glslang = await glslangModule.default();\n }\n return glslang;\n}\n"],"mappings":"AAGA,IAAIA,OAAgB;AAGpB,OAAO,eAAeC,iBAAiBA,CAAA,EAAG;EACxC,IAAI,CAACD,OAAO,EAAE;IAEZ,MAAME,aAAa,GAAG,MAAM,MAAM,CAA2B,oEAAoE,CAAC;IAClIF,OAAO,GAAG,MAAME,aAAa,CAACC,OAAO,CAAC,CAAC;EACzC;EACA,OAAOH,OAAO;AAChB"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["WebGPUDevice","WebGPUBuffer","WebGPUTexture","WebGPUSampler","WebGPUShader"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// WEBGPU ADAPTER\nexport {WebGPUDevice} from './adapter/webgpu-device';\n\n// WEBGPU CLASSES (typically not accessed directly)\nexport {WebGPUBuffer} from './adapter/resources/webgpu-buffer';\nexport {WebGPUTexture} from './adapter/resources/webgpu-texture';\nexport {WebGPUSampler} from './adapter/resources/webgpu-sampler';\nexport {WebGPUShader} from './adapter/resources/webgpu-shader';\n"],"mappings":"SAIQA,YAAY;AAAA,SAGZC,YAAY;AAAA,SACZC,aAAa;AAAA,SACbC,aAAa;AAAA,SACbC,YAAY"}
|