@luma.gl/webgpu 9.0.0-alpha.17 → 9.0.0-alpha.19

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.
Files changed (65) hide show
  1. package/dist/adapter/resources/webgpu-buffer.d.ts +1 -1
  2. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  3. package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
  4. package/dist/adapter/resources/webgpu-command-encoder.d.ts +1 -1
  5. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  6. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  7. package/dist/adapter/resources/webgpu-compute-pass.d.ts +1 -1
  8. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  9. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
  10. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +1 -1
  11. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  12. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
  13. package/dist/adapter/resources/webgpu-external-texture.d.ts +1 -1
  14. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  15. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
  16. package/dist/adapter/resources/webgpu-framebuffer.d.ts +1 -1
  17. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  18. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  19. package/dist/adapter/resources/webgpu-query.js.map +1 -1
  20. package/dist/adapter/resources/webgpu-render-pass.d.ts +1 -1
  21. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  22. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  23. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +1 -1
  24. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  25. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
  26. package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
  27. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  28. package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
  29. package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
  30. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  31. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  32. package/dist/adapter/resources/webgpu-texture.d.ts +1 -1
  33. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  34. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  35. package/dist/adapter/webgpu-canvas-context.d.ts +1 -1
  36. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  37. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  38. package/dist/adapter/webgpu-device.d.ts +1 -1
  39. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  40. package/dist/adapter/webgpu-device.js +1 -1
  41. package/dist/adapter/webgpu-device.js.map +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/package.json +3 -3
  47. package/src/adapter/resources/webgpu-buffer.ts +1 -1
  48. package/src/adapter/resources/webgpu-command-encoder.ts +1 -1
  49. package/src/adapter/resources/webgpu-compute-pass.ts +1 -1
  50. package/src/adapter/resources/webgpu-compute-pipeline.ts +1 -1
  51. package/src/adapter/resources/webgpu-external-texture.ts +1 -1
  52. package/src/adapter/resources/webgpu-framebuffer.ts +1 -1
  53. package/src/adapter/resources/webgpu-query.ts +1 -1
  54. package/src/adapter/resources/webgpu-render-pass.ts +1 -1
  55. package/src/adapter/resources/webgpu-render-pipeline.ts +1 -1
  56. package/src/adapter/resources/webgpu-sampler.ts +1 -1
  57. package/src/adapter/resources/webgpu-shader.ts +3 -1
  58. package/src/adapter/resources/webgpu-texture.ts +1 -1
  59. package/src/adapter/webgpu-canvas-context.ts +1 -1
  60. package/src/adapter/webgpu-device.ts +1 -1
  61. package/src/index.ts +1 -1
  62. package/dist/.DS_Store +0 -0
  63. package/dist/adapter/.DS_Store +0 -0
  64. package/src/.DS_Store +0 -0
  65. package/src/adapter/.DS_Store +0 -0
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { Buffer, BufferProps } from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
3
+ import type { WebGPUDevice } from '../webgpu-device';
4
4
  export default class WebGPUBuffer extends Buffer {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUBuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAMjD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IAyB3C,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CAAC,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAwB,GAAG,OAAO,CAAC,WAAW,CAAC;IAmB5G,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd"}
1
+ {"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAMnD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IAyB3C,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CAAC,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAwB,GAAG,OAAO,CAAC,WAAW,CAAC;IAmB5G,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","_defineProperty","mapBuffer","Boolean","handle","createBuffer","size","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","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/api';\nimport type WebGPUDevice from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport default 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 this.handle = this.props.handle || this.device.handle.createBuffer({\n size: this.byteLength,\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<ArrayBuffer> {\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 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"],"mappings":";AACA,SAAQA,MAAM,QAAoB,cAAc;AAGhD,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,eAAe,MAAME,YAAY,SAASN,MAAM,CAAC;EAK/CO,WAAWA,CAACC,MAAoB,EAAEN,KAAkB,EAAE;IACpD,KAAK,CAACM,MAAM,EAAEN,KAAK,CAAC;IAACO,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACD,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAErC,IAAI,CAACO,MAAM,GAAG,IAAI,CAACV,KAAK,CAACU,MAAM,IAAI,IAAI,CAACJ,MAAM,CAACI,MAAM,CAACC,YAAY,CAAC;MACjEC,IAAI,EAAE,IAAI,CAACV,UAA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QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEb,IAAa,GAAAa,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAC9C,OAAO,IAAI,CAACjB,MAAM,CAACiC,cAAc,CAACK,MAAM,EAAEpC,IAAI,CAAC;EACjD;EAEAS,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACX,MAAM,CAACW,KAAK,EAAE;EACrB;AACF"}
1
+ {"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","_defineProperty","mapBuffer","Boolean","handle","createBuffer","size","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","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/api';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport default 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 this.handle = this.props.handle || this.device.handle.createBuffer({\n size: this.byteLength,\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<ArrayBuffer> {\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 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"],"mappings":";AACA,SAAQA,MAAM,QAAoB,cAAc;AAGhD,SAASC,aAAaA,CAACC,KAAkB,EAAU;EAAA,IAAAC,WAAA;EACjD,OAAOD,KAAK,CAACE,UAAU,MAAAD,WAAA,GAAID,KAAK,C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,UAAsB,EAAQ;IACrD,MAAMH,WAAW,GAAG,IAAI,CAAChC,MAAM,CAACiC,cAAc,EAAE;IAEhD,IAAIE,UAAU,CAACxC,WAAW,CAACqC,WAAW,CAAC,CAACI,GAAG,CAACD,UAAU,CAAC;EACzD;EAIAN,QAAQA,CAACQ,IAAY,EAAoD;IAAA,IAAlDC,MAAc,GAAAvB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEb,IAAa,GAAAa,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IACtD,OAAO,IAAI,CAACjB,MAAM,CAAC6B,QAAQ,CAACQ,IAAI,EAAEC,MAAM,EAAEpC,IAAI,CAAC;EACjD;EAEA+B,cAAcA,CAAA,EAAiD;IAAA,IAAhDK,MAAc,GAAAvB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEb,IAAa,GAAAa,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAC9C,OAAO,IAAI,CAACjB,MAAM,CAACiC,cAAc,CAACK,MAAM,EAAEpC,IAAI,CAAC;EACjD;EAEAS,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACX,MAAM,CAACW,KAAK,EAAE;EACrB;AACF"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  export default class WebGPUCommandEncoder extends CommandEncoder {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUCommandEncoder;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAE,mBAAm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E,MAAM,CAAC;QAErB,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAE/C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KAC7C,GAAG,IAAI;IAuBR,mBAAmB,CAAC,OAAO,EAAE;QAC3B,MAAM,EAAE,mBAAmB,CAAC;QAC5B,WAAW,EAAE,kBAAkB,CAAC;QAChC,QAAQ,EAAE,WAAW,CAAA;KACtB,GAAG,IAAI;IAER,oBAAoB,CAAC,OAAO,EAAE;QAC5B,MAAM,EAAE,mBAAmB,CAAE;QAC7B,WAAW,EAAE,mBAAmB,CAAC;QACjC,QAAQ,EAAE,WAAW,CAAA;KACtB,GAAG,IAAI;IAEC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAatD"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","cast","WebGPUCommandEncoder","constructor","device","props","_defineProperty","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","source","sourceOffset","destination","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","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, cast} from '@luma.gl/api';\nimport WebGPUDevice from '../webgpu-device';\nimport WEBGPUBuffer from './webgpu-buffer';\nimport WebGPUTexture from './webgpu-texture';\n\nexport default class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n this.handle = props.handle || 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: {\n source: Buffer,\n sourceOffset?: number,\n destination: Buffer,\n destinationOffset?: number,\n size?: number\n }): void {\n this.handle.copyBufferToBuffer(\n cast<WEBGPUBuffer>(options.source).handle,\n options.sourceOffset ?? 0,\n cast<WEBGPUBuffer>(options.destination).handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: {\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 this.handle.copyBufferToTexture(\n {\n buffer: cast<WEBGPUBuffer>(options.source).handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage,\n },\n {\n texture: cast<WebGPUTexture>(options.destination).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: {\n source: GPUImageCopyTexture,\n destination: GPUImageCopyBuffer,\n copySize: GPUExtent3D\n }): void {}\n\n copyTextureToTexture(options: {\n source: GPUImageCopyTexture ,\n destination: GPUImageCopyTexture,\n copySize: GPUExtent3D\n }): void {}\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}"],"mappings":";AAAA,SAAQA,cAAc,EAAwCC,IAAI,QAAO,cAAc;AAKvF,eAAe,MAAMC,oBAAoB,SAASF,cAAc,CAAC;EAI/DG,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACb,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAGF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,oBAAoB,CAAC,CAGtE,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,CAACE,KAAK,GAAG,IAAI,CAACJ,KAAK,CAACK,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,MAAMA,CAACC,OAAuB,EAAoB;IAChD,OAAO,IAAI,CAACD,MAAM,CAACC,OAAO,CAAC;EAC7B;EAKAC,kBAAkBA,CAACD,OAMlB,EAAQ;IAAA,IAAAE,qBAAA,EAAAC,qBAAA,EAAAC,aAAA;IACP,IAAI,CAACV,MAAM,CAACO,kBAAkB,CAC5Bb,IAAI,CAAeY,OAAO,CAACK,MAAM,CAAC,CAACX,MAAM,GAAAQ,qBAAA,GACzCF,O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,EAAQ,CAAC;EAED2B,cAAcA,CAACC,UAAkB,EAAQ;IAChD,IAAI,CAAClC,MAAM,CAACiC,cAAc,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACnC,MAAM,CAACmC,aAAa,EAAE;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACrC,MAAM,CAACoC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
1
+ {"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","cast","WebGPUCommandEncoder","constructor","device","props","_defineProperty","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","source","sourceOffset","destination","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","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, cast} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport WEBGPUBuffer from './webgpu-buffer';\nimport WebGPUTexture from './webgpu-texture';\n\nexport default class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n this.handle = props.handle || 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: {\n source: Buffer,\n sourceOffset?: number,\n destination: Buffer,\n destinationOffset?: number,\n size?: number\n }): void {\n this.handle.copyBufferToBuffer(\n cast<WEBGPUBuffer>(options.source).handle,\n options.sourceOffset ?? 0,\n cast<WEBGPUBuffer>(options.destination).handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: {\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 this.handle.copyBufferToTexture(\n {\n buffer: cast<WEBGPUBuffer>(options.source).handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage,\n },\n {\n texture: cast<WebGPUTexture>(options.destination).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: {\n source: GPUImageCopyTexture,\n destination: GPUImageCopyBuffer,\n copySize: GPUExtent3D\n }): void {}\n\n copyTextureToTexture(options: {\n source: GPUImageCopyTexture ,\n destination: GPUImageCopyTexture,\n copySize: GPUExtent3D\n }): void {}\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}"],"mappings":";AAAA,SAAQA,cAAc,E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MAAM;MACjDqB,MAAM,GAAAJ,eAAA,GAAEX,OAAO,CAACe,MAAM,cAAAJ,eAAA,cAAAA,eAAA,GAAI,CAAC;MAC3BK,WAAW,EAAEhB,OAAO,CAACgB,WAAW;MAChCC,YAAY,EAAEjB,OAAO,CAACiB;IACxB,CAAC,EACD;MACEC,OAAO,EAAE9B,IAAI,CAAgBY,OAAO,CAACO,WAAW,CAAC,CAACb,MAAM;MACxDyB,QAAQ,GAAAP,iBAAA,GAAEZ,OAAO,CAACmB,QAAQ,cAAAP,iBAAA,cAAAA,iBAAA,GAAI,CAAC;MAC/BQ,MAAM,GAAAP,eAAA,GAAEb,OAAO,CAACoB,MAAM,cAAAP,eAAA,cAAAA,eAAA,GAAI,CAAC;IAE7B,CAAC,EACD;MAEEQ,KAAK,EAAErB,OAAO,CAACsB,MAAM,CAAC,CAAC,CAAC;MACxBC,MAAM,EAAEvB,OAAO,CAACsB,MAAM,CAAC,CAAC,CAAC;MACzBE,kBAAkB,EAAExB,OAAO,CAACsB,MAAM,CAAC,CAAC;IACtC,CAAC,CACF;EACH;EAEAG,mBAAmBA,CAACzB,OAInB,EAAQ,CAAC;EAEV0B,oBAAoBA,CAAC1B,OAIpB,EAAQ,CAAC;EAED2B,cAAcA,CAACC,UAAkB,EAAQ;IAChD,IAAI,CAAClC,MAAM,CAACiC,cAAc,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACnC,MAAM,CAACmC,aAAa,EAAE;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACrC,MAAM,CAACoC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  export default class WebGPUComputePass extends ComputePass {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUComputePassEncoder;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AACnG,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAQ;gBAEvC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAUzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM5C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAI1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
1
+ {"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AACnG,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAQ;gBAEvC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAUzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM5C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAI1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","_device$commandEncode","_defineProperty","handle","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_bindGroupLayout","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchWorkgroups","dispatchIndirect","indirectBuffer","indirectOffset","arguments","length","undefined","dispatchWorkgroupsIndirect","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"sourcesContent":["import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding, cast} from '@luma.gl/api';\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 default 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 = cast<WebGPUComputePipeline>(pipeline);\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 this.handle.dispatchWorkgroupsIndirect(cast<WebGPUBuffer>(indirectBuffer).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,EAAsDC,IAAI,QAAO,cAAc;AAMlG,eAAe,MAAMC,iBAAiB,SAASF,WAAW,CAAC;EAKzDG,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IAAA,IAAAC,qBAAA;IACzD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACE,eAAA;IAAAA,eAAA;IAAAA,eAAA,2BAHuB,IAAI;IAIhD,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACI,MAAM,GAAG,IAAI,CAACH,KAAK,CAACG,MAAM,MAAAF,qBAAA,GAAIF,MAAM,CAACK,cAAc,cAAAH,qBAAA,uBAArBA,qBAAA,CAAuBI,gBAAgB,CAAC;MACzEC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO;IAEpB,CAAC,CAAC;EACJ;EAGSC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,GAAGA,CAAA,EAAS;IACV,IAAI,CAACN,MAAM,CAACM,GAAG,EAAE;EACnB;EAEAC,WAAWA,CAACC,QAAyB,EAAQ;IAC3C,MAAMC,YAAY,GAAGhB,IAAI,CAAwBe,QAAQ,CAAC;IAC1D,IAAI,CAACR,MAAM,CAACO,WAAW,CAACE,YAAY,CAACT,MAAM,CAAC;IAC5C,IAAI,CAACU,gBAAgB,GAAGD,YAAY,CAACE,mBAAmB,EAAE;EAC5D;EAGAC,WAAWA,CAACC,QAAmB,EAAQ;IACrC,MAAM,IAAIC,KAAK,CAAC,QAAQ,CAAC;EAG3B;EAQAC,QAAQA,CAACC,CAAS,EAAEC,CAAU,EAAEC,CAAU,EAAQ;IAChD,IAAI,CAAClB,MAAM,CAACmB,kBAAkB,CAACH,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;EACzC;EAOAE,gBAAgBA,CAACC,cAAsB,EAAoC;IAAA,IAAlCC,cAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IACjE,IAAI,CAACvB,MAAM,CAAC0B,0BAA0B,CAACjC,IAAI,CAAe4B,cAAc,CAAC,CAACrB,MAAM,EAAEsB,cAAc,CAAC;EACnG;EAEAK,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC5B,MAAM,CAAC2B,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC7B,MAAM,CAAC6B,aAAa,EAAE;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/B,MAAM,CAAC8B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
1
+ {"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","_device$commandEncode","_defineProperty","handle","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_bindGroupLayout","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchWorkgroups","dispatchIndirect","indirectBuffer","indirectOffset","arguments","length","undefined","dispatchWorkgroupsIndirect","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"sourcesContent":["import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding, cast} from '@luma.gl/api';\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 default 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 = cast<WebGPUComputePipeline>(pipeline);\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 this.handle.dispatchWorkgroupsIndirect(cast<WebGPUBuffer>(indirectBuffer).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,EAAsDC,IAAI,QAAO,cAAc;AAMlG,eAAe,MAAMC,iBAAiB,SAASF,WAAW,CAAC;EAKzDG,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IAAA,IAAAC,qBAAA;IACzD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACE,eAAA;IAAAA,eAAA;IAAAA,eAAA,2BAHuB,IAAI;IAIhD,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACI,MAAM,GAAG,IAAI,CAACH,KAAK,CAACG,MAAM,MAAAF,qBAAA,GAAIF,MAAM,CAACK,cAAc,cAAAH,qBAAA,uBAArBA,qBAAA,CAAuBI,gBAAgB,CAAC;MACzEC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO;IAEpB,CAAC,CAAC;EACJ;EAGSC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,GAAGA,CAAA,EAAS;IACV,IAAI,CAACN,MAAM,CAACM,GAAG,EAAE;EACnB;EAEAC,WAAWA,CAACC,QAAyB,EAAQ;IAC3C,MAAMC,YAAY,GAAGhB,IAAI,CAAwBe,QAAQ,CAAC;IAC1D,IAAI,CAACR,MAAM,CAACO,WAAW,CAACE,YAAY,CAACT,MAAM,CAAC;IAC5C,IAAI,CAACU,gBAAgB,GAAGD,YAAY,CAACE,mBAAmB,EAAE;EAC5D;EAGAC,WAAWA,CAACC,QAAmB,EAAQ;IACrC,MAAM,IAAIC,KAAK,CAAC,QAAQ,CAAC;EAG3B;EAQAC,QAAQA,CAACC,CAAS,EAAEC,CAAU,EAAEC,CAAU,EAAQ;IAChD,IAAI,CAAClB,MAAM,CAACmB,kBAAkB,CAACH,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;EACzC;EAOAE,gBAAgBA,CAACC,cAAsB,EAAoC;IAAA,IAAlCC,cAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IACjE,IAAI,CAACvB,MAAM,CAAC0B,0BAA0B,CAACjC,IAAI,CAAe4B,cAAc,CAAC,CAACrB,MAAM,EAAEsB,cAAc,CAAC;EACnG;EAEAK,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC5B,MAAM,CAAC2B,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC7B,MAAM,CAAC6B,aAAa,EAAE;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/B,MAAM,CAAC8B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { ComputePipeline, ComputePipelineProps } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  /** Creates a new compute pipeline when parameters change */
5
5
  export default class WebGPUComputePipeline extends ComputePipeline {
6
6
  device: WebGPUDevice;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAgB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
1
+ {"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAgB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","_defineProperty","module","cs","handle","createComputePipeline","label","id","compute","entryPoint","csEntryPoint","layout","_getBindGroupLayout","getBindGroupLayout"],"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"sourcesContent":["// prettier-ignore\nimport {ComputePipeline, ComputePipelineProps, cast} from '@luma.gl/api';\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 default 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 module = cast<WebGPUShader>(this.props.cs).handle;\n this.handle = this.props.handle || this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module,\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,EAAwBC,IAAI,QAAO,cAAc;AAQxE,eAAe,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAIjEG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,MAAM,GAAGN,IAAI,CAAe,IAAI,CAACI,KAAK,CAACG,EAAE,CAAC,CAACC,MAAM;IACvD,IAAI,CAACA,MAAM,GAAG,IAAI,CAACJ,KAAK,CAACI,MAAM,IAAI,IAAI,CAACL,MAAM,CAACK,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO,EAAE;MACpBC,OAAO,EAAE;QACPN,MAAM;QACNO,UAAU,EAAE,IAAI,CAACT,KAAK,CAACU;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACR,MAAM,CAACS,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}
1
+ {"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","_defineProperty","module","cs","handle","createComputePipeline","label","id","compute","entryPoint","csEntryPoint","layout","_getBindGroupLayout","getBindGroupLayout"],"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"sourcesContent":["// prettier-ignore\nimport {ComputePipeline, ComputePipelineProps, cast} from '@luma.gl/api';\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 default 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 module = cast<WebGPUShader>(this.props.cs).handle;\n this.handle = this.props.handle || this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module,\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,EAAwBC,IAAI,QAAO,cAAc;AAQxE,eAAe,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAIjEG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,MAAM,GAAGN,IAAI,CAAe,IAAI,CAACI,KAAK,CAACG,EAAE,CAAC,CAACC,MAAM;IACvD,IAAI,CAACA,MAAM,GAAG,IAAI,CAACJ,KAAK,CAACI,MAAM,IAAI,IAAI,CAACL,MAAM,CAACK,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO,EAAE;MACpBC,OAAO,EAAE;QACPN,MAAM;QACNO,UAAU,EAAE,IAAI,CAACT,KAAK,CAACU;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACR,MAAM,CAACS,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
3
+ import type { WebGPUDevice } from '../webgpu-device';
4
4
  import WebGPUSampler from './webgpu-sampler';
5
5
  /**
6
6
  * Cheap, temporary texture view for videos
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;gBAEX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAUpD,OAAO,IAAI,IAAI;IAMxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAKlD"}
1
+ {"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;gBAEX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAUpD,OAAO,IAAI,IAAI;IAMxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAKlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-external-texture.js","names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","_defineProperty","handle","importExternalTexture","source","colorSpace","sampler","destroy","setSampler"],"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/api';\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 default 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,cAAc;AAAC,OAEnFC,aAAa;AAMpB,eAAe,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAKjEG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,MAAM,EAAEJ,KAAK,CAACI,MAAM;MACpBC,UAAU,EAAEL,KAAK,CAACK;IACpB,CAAC,CAAC;IACF,IAAI,CAACC,OAAO,GAAG,IAAI;EACrB;EAESC,OAAOA,CAAA,EAAS,CAIzB;EAGAC,UAAUA,CAACF,OAA+B,EAAQ;IAEhD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYV,aAAa,GAAGU,OAAO,GAAG,IAAIV,aAAa,CAAC,IAAI,CAACG,MAAM,EAAEO,OAAO,CAAC;IACnG,OAAO,IAAI;EACb;AACF"}
1
+ {"version":3,"file":"webgpu-external-texture.js","names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","_defineProperty","handle","importExternalTexture","source","colorSpace","sampler","destroy","setSampler"],"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/api';\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 default 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,cAAc;AAAC,OAEnFC,aAAa;AAMpB,eAAe,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAKjEG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,MAAM,EAAEJ,KAAK,CAACI,MAAM;MACpBC,UAAU,EAAEL,KAAK,CAACK;IACpB,CAAC,CAAC;IACF,IAAI,CAACC,OAAO,GAAG,IAAI;EACrB;EAESC,OAAOA,CAAA,EAAS,CAIzB;EAGAC,UAAUA,CAACF,OAA+B,EAAQ;IAEhD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYV,aAAa,GAAGU,OAAO,GAAG,IAAIV,aAAa,CAAC,IAAI,CAACG,MAAM,EAAEO,OAAO,CAAC;IACnG,OAAO,IAAI;EACb;AACF"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import type { FramebufferProps } from '@luma.gl/api';
3
3
  import { Framebuffer } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
5
  import WebGPUTexture from './webgpu-texture';
6
6
  /**
7
7
  * Create new textures with correct size for all attachments.
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAU,MAAM,cAAc,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C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AiCzD,mCAAmC;IACnC,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,kBAAkB;IAkB1B;;;OAGG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAiBlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-framebuffer.js","names":["Framebuffer","Texture","WEBGPUTexture","WebGPUFramebuffer","constructor","device","props","_defineProperty","colorAttachments","depthStencilAttachment","createDepthStencilTexture","map","colorAttachment","createColorTexture","renderPassDescriptor","view","handle","createView","depthClearValue","depthStoreOp","stencilClearValue","stencilStoreOp","length","loadOp","loadValue","storeOp","_createTexture","id","format","width","height","usage","RENDER_ATTACHMENT","Error","texture","_resizeAttachments","i","resizedTexture","destroy"],"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"sourcesContent":["import type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';\nimport {Framebuffer, Texture} from '@luma.gl/api';\nimport WebGPUDevice from '../webgpu-device';\n// import WebGPUCanvasContext from '../webgpu-canvas-context';\nimport WEBGPUTexture from './webgpu-texture';\nimport WebGPUTexture from './webgpu-texture';\n\n// const DEFAULT_DEPTH_STENCIL_FORMAT: DepthStencilTextureFormat = 'depth24plus';\n\n// const MAX_COLOR_ATTACHMENTS = 8;\n\n/**\n * Create new textures with correct size for all attachments. \n * @note resize() destroys existing textures (if size has changed). \n */\nexport default class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n colorAttachments: WebGPUTexture[] = [];\n depthStencilAttachment: WebGPUTexture | null = null;\n\n /** Partial render pass descriptor. Used by WebGPURenderPass */\n renderPassDescriptor: {\n colorAttachments: GPURenderPassColorAttachment[];\n depthStencilAttachment?: GPURenderPassDepthStencilAttachment;\n } = {\n colorAttachments: []\n };\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n if (props.depthStencilAttachment) {\n this.depthStencilAttachment = this.createDepthStencilTexture(props);\n }\n\n if (props.colorAttachments) {\n this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));\n }\n\n if (this.depthStencilAttachment) {\n this.renderPassDescriptor.depthStencilAttachment = {\n view: this.depthStencilAttachment.handle.createView(),\n // Add default clear values\n depthClearValue: 1.0,\n depthStoreOp: 'store',\n stencilClearValue: 0,\n stencilStoreOp: 'store',\n }\n }\n\n if (this.colorAttachments.length > 0) {\n this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({\n view: colorAttachment.handle.createView(),\n loadOp: 'clear',\n loadValue: [0.0, 0.0, 0.0, 0.0],\n storeOp: 'store'\n }));\n }\n }\n\n /** Create depth stencil texture */\n private createDepthStencilTexture(props: FramebufferProps): WEBGPUTexture {\n if (props.depthStencilAttachment instanceof WEBGPUTexture) {\n return props.depthStencilAttachment;\n }\n\n if (typeof props.depthStencilAttachment === 'string') {\n return this.device._createTexture({\n id: 'depth-stencil-attachment',\n format: props.depthStencilAttachment,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n private createColorTexture(props: FramebufferProps, texture: Texture | ColorTextureFormat): WEBGPUTexture {\n if (texture instanceof WEBGPUTexture) {\n return texture;\n }\n\n if (typeof texture === 'string') {\n return this.device._createTexture({\n id: 'color-attachment',\n format: texture,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n /**\n * Create new textures with correct size for all attachments.\n * @note destroys existing textures.\n */\n protected _resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({...this.colorAttachments[i].props, width, height})\n this.colorAttachments[i].destroy();\n this.colorAttachments[i] = resizedTexture;\n this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({...this.depthStencilAttachment.props, width, height})\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = resizedTexture;\n this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();\n }\n }\n}\n"],"mappings":";AACA,SAAQA,WAAW,EAAEC,OAAO,QAAO,cAAc;AAAC,OAG3CC,aAAa;AAWpB,eAAe,MAAMC,iBAAiB,SAASH,WAAW,CAAC;EAczDI,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,2BAZa,EAAE;IAAAA,eAAA,iCACS,IAAI;IAAAA,eAAA,+BAM/C;MACFC,gBAAgB,EAAE;IACpB,CAAC;IAIC,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAIC,KAAK,CAACG,sBAAsB,EAAE;MAChC,IAAI,CAACA,sBAAsB,GAAG,IAAI,CAACC,yBAAyB,CAACJ,KAAK,CAAC;IACrE;IAEA,IAAIA,KAAK,CAACE,gBAAgB,EAAE;MAC1B,IAAI,CAACA,gBAAgB,GAAGF,KAAK,CAACE,gBAAgB,CAACG,GAAG,CAACC,eAAe,IAAI,IAAI,CAACC,kBAAkB,CAAC,IAAI,CAACP,KAAK,EAAEM,eAAe,CAAC,CAAC;IAC7H;IAEA,IAAI,IAAI,CAACH,sBAAsB,EAAE;MAC/B,IAAI,CAACK,oBAAoB,CAACL,sBAAsB,GAAG;QACjDM,IAAI,EAAE,IAAI,CAACN,sBAAsB,CAACO,MAAM,CAACC,UAAU,EAAE;QAErDC,eAAe,EAAE,GAAG;QACpBC,YAAY,EAAE,OAAO;QACrBC,iBAAiB,EAAE,CAAC;QACpBC,cAAc,EAAE;MAClB,CAAC;IACH;IAEA,IAAI,IAAI,CAACb,gBAAgB,CAACc,MAAM,GAAG,CAAC,EAAE;MACpC,IAAI,CAACR,oBAAoB,CAACN,gBAAgB,GAAG,IAAI,CAACA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,KAAa,EAAEC,MAAc,EAAQ;IAChE,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,IAAI,CAAC5B,gBAAgB,CAACc,MAAM,EAAE,EAAEc,CAAC,EAAE;MACrD,IAAI,IAAI,CAAC5B,gBAAgB,CAAC4B,CAAC,CAAC,EAAE;QAC5B,MAAMC,cAAc,GAAG,IAAI,CAAChC,MAAM,CAACqB,cAAc,CAAC;UAAC,GAAG,IAAI,CAAClB,gBAAgB,CAAC4B,CAAC,CAAC,CAAC9B,KAAK;UAAEuB,KAAK;UAAEC;QAAM,CAAC,CAAC;QACrG,IAAI,CAACtB,gBAAgB,CAAC4B,CAAC,CAAC,CAACE,OAAO,EAAE;QAClC,IAAI,CAAC9B,gBAAgB,CAAC4B,CAAC,CAAC,GAAGC,cAAc;QACzC,IAAI,CAACvB,oBAAoB,CAACN,gBAAgB,CAAC4B,CAAC,CAAC,CAACrB,IAAI,GAAGsB,cAAc,CAACrB,MAAM,CAACC,UAAU,EAAE;MACzF;IACF;IAEA,IAAI,IAAI,CAACR,sBAAsB,EAAE;MAC/B,MAAM4B,cAAc,GAAG,IAAI,CAAChC,MAAM,CAACqB,cAAc,CAAC;QAAC,GAAG,IAAI,CAACjB,sBAAsB,CAACH,KAAK;QAAEuB,KAAK;QAAEC;MAAM,CAAC,CAAC;MACxG,IAAI,CAACrB,sBAAsB,CAAC6B,OAAO,EAAE;MACrC,IAAI,CAAC7B,sBAAsB,GAAG4B,cAAc;MAC5C,IAAI,CAACvB,oBAAoB,CAACL,sBAAsB,CAACM,IAAI,GAAGsB,cAAc,CAACrB,MAAM,CAACC,UAAU,EAAE;IAC5F;EACF;AACF"}
1
+ {"version":3,"file":"webgpu-framebuffer.js","names":["Framebuffer","Texture","WEBGPUTexture","WebGPUFramebuffer","constructor","device","props","_defineProperty","colorAttachments","depthStencilAttachment","createDepthStencilTexture","map","colorAttachment","createColorTexture","renderPassDescriptor","view","handle","createView","depthClearValue","depthStoreOp","stencilClearValue","stencilStoreOp","length","loadOp","loadValue","storeOp","_createTexture","id","format","width","height","usage","RENDER_ATTACHMENT","Error","texture","_resizeAttachments","i","resizedTexture","destroy"],"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"sourcesContent":["import type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';\nimport {Framebuffer, Texture} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\n// import WebGPUCanvasContext from '../webgpu-canvas-context';\nimport WEBGPUTexture from './webgpu-texture';\nimport WebGPUTexture from './webgpu-texture';\n\n// const DEFAULT_DEPTH_STENCIL_FORMAT: DepthStencilTextureFormat = 'depth24plus';\n\n// const MAX_COLOR_ATTACHMENTS = 8;\n\n/**\n * Create new textures with correct size for all attachments. \n * @note resize() destroys existing textures (if size has changed). \n */\nexport default class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n colorAttachments: WebGPUTexture[] = [];\n depthStencilAttachment: WebGPUTexture | null = null;\n\n /** Partial render pass descriptor. Used by WebGPURenderPass */\n renderPassDescriptor: {\n colorAttachments: GPURenderPassColorAttachment[];\n depthStencilAttachment?: GPURenderPassDepthStencilAttachment;\n } = {\n colorAttachments: []\n };\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n if (props.depthStencilAttachment) {\n this.depthStencilAttachment = this.createDepthStencilTexture(props);\n }\n\n if (props.colorAttachments) {\n this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));\n }\n\n if (this.depthStencilAttachment) {\n this.renderPassDescriptor.depthStencilAttachment = {\n view: this.depthStencilAttachment.handle.createView(),\n // Add default clear values\n depthClearValue: 1.0,\n depthStoreOp: 'store',\n stencilClearValue: 0,\n stencilStoreOp: 'store',\n }\n }\n\n if (this.colorAttachments.length > 0) {\n this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({\n view: colorAttachment.handle.createView(),\n loadOp: 'clear',\n loadValue: [0.0, 0.0, 0.0, 0.0],\n storeOp: 'store'\n }));\n }\n }\n\n /** Create depth stencil texture */\n private createDepthStencilTexture(props: FramebufferProps): WEBGPUTexture {\n if (props.depthStencilAttachment instanceof WEBGPUTexture) {\n return props.depthStencilAttachment;\n }\n\n if (typeof props.depthStencilAttachment === 'string') {\n return this.device._createTexture({\n id: 'depth-stencil-attachment',\n format: props.depthStencilAttachment,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n private createColorTexture(props: FramebufferProps, texture: Texture | ColorTextureFormat): WEBGPUTexture {\n if (texture instanceof WEBGPUTexture) {\n return texture;\n }\n\n if (typeof texture === 'string') {\n return this.device._createTexture({\n id: 'color-attachment',\n format: texture,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n /**\n * Create new textures with correct size for all attachments.\n * @note destroys existing textures.\n */\n protected _resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({...this.colorAttachments[i].props, width, height})\n this.colorAttachments[i].destroy();\n this.colorAttachments[i] = resizedTexture;\n this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({...this.depthStencilAttachment.props, width, height})\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = resizedTexture;\n this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();\n }\n }\n}\n"],"mappings":";AACA,SAAQA,WAAW,EAAEC,OAAO,QAAO,cAAc;AAAC,OAG3CC,aAAa;AAWpB,eAAe,MAAMC,iBAAiB,SAASH,WAAW,CAAC;EAczDI,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,e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IAAI,CAACtB,gBAAgB,CAAC4B,CAAC,CAAC,CAACE,OAAO,EAAE;QAClC,IAAI,CAAC9B,gBAAgB,CAAC4B,CAAC,CAAC,GAAGC,cAAc;QACzC,IAAI,CAACvB,oBAAoB,CAACN,gBAAgB,CAAC4B,CAAC,CAAC,CAACrB,IAAI,GAAGsB,cAAc,CAACrB,MAAM,CAACC,UAAU,EAAE;MACzF;IACF;IAEA,IAAI,IAAI,CAACR,sBAAsB,EAAE;MAC/B,MAAM4B,cAAc,GAAG,IAAI,CAAChC,MAAM,CAACqB,cAAc,CAAC;QAAC,GAAG,IAAI,CAACjB,sBAAsB,CAACH,KAAK;QAAEuB,KAAK;QAAEC;MAAM,CAAC,CAAC;MACxG,IAAI,CAACrB,sBAAsB,CAAC6B,OAAO,EAAE;MACrC,IAAI,CAAC7B,sBAAsB,GAAG4B,cAAc;MAC5C,IAAI,CAACvB,oBAAoB,CAACL,sBAAsB,CAACM,IAAI,GAAGsB,cAAc,CAACrB,MAAM,CAACC,UAAU,EAAE;IAC5F;EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-query.js","names":[],"sources":["../../../src/adapter/resources/webgpu-query.ts"],"sourcesContent":["/*\nimport {Resource, Query, QueryProps} from '@luma.gl/api';\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
+ {"version":3,"file":"webgpu-query.js","names":[],"sources":["../../../src/adapter/resources/webgpu-query.ts"],"sourcesContent":["/*\nimport {Resource, Query, QueryProps} from '@luma.gl/api';\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,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/api';
3
3
  import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
5
  import WebGPURenderPipeline from './webgpu-render-pipeline';
6
6
  export default class WebGPURenderPass extends RenderPass {
7
7
  readonly device: WebGPUDevice;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,E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QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmBR,YAAY,IAAI,IAAI;IAKpB,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAwBrD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAW7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-render-pass.js","names":["RenderPass","cast","WebGPURenderPass","constructor","device","props","arguments","length","undefined","_defineProperty","framebuffer","canvasContext","getCurrentFramebuffer","renderPassDescriptor","handle","commandEncoder","beginRenderPass","label","id","destroy","end","setPipeline","pipeline","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"],"sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"sourcesContent":["import type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/api';\nimport {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/api';\nimport WebGPUDevice from '../webgpu-device';\nimport WebGPUBuffer from './webgpu-buffer';\n// import WebGPUCommandEncoder from './webgpu-command-encoder';\nimport WebGPURenderPipeline from './webgpu-render-pipeline';\n\nexport default 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 // @ts-expect-error\n const renderPassDescriptor = framebuffer.renderPassDescriptor;\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,\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"],"mappings":";AACA,SAAgBA,UAAU,EAAkBC,IAAI,QAAO,cAAc;AAMrE,eAAe,MAAMC,gBAAgB,SAASF,UAAU,CAAC;EAOvDG,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;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAHiB,IAAI;IAI1C,IAAI,CAACL,MAAM,GAAGA,MAAM;IACpB,MAAMM,WAAW,GAAGL,KAAK,CAACK,WAAW,IAAIN,MAAM,CAACO,aAAa,CAACC,qBAAqB,EAAE;IAErF,MAAMC,oBAAoB,GAAGH,W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,CAAC,CAAC,CAAC;IAC5F;IAEA,IAAIC,QAAQ,EAAE;MACZ,IAAI,CAACtC,MAAM,CAAC0C,WAAW,CACrBJ,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,CACZ;IACH;EACF;EAEAK,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC5C,MAAM,CAAC2C,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC7C,MAAM,CAAC6C,aAAa,EAAE;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/C,MAAM,CAAC8C,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AASF"}
1
+ {"version":3,"file":"webgpu-render-pass.js","names":["RenderPass","cast","WebGPURenderPass","constructor","device","props","arguments","length","undefined","_defineProperty","framebuffer","canvasContext","getCurrentFramebuffer","renderPassDescriptor","handle","commandEncoder","beginRenderPass","label","id","destroy","end","setPipeline","pipeline","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"],"sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"sourcesContent":["import type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/api';\nimport {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport WebGPUBuffer from './webgpu-buffer';\n// import WebGPUCommandEncoder from './webgpu-command-encoder';\nimport WebGPURenderPipeline from './webgpu-render-pipeline';\n\nexport default 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 // @ts-expect-error\n const renderPassDescriptor = framebuffer.renderPassDescriptor;\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,\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"],"mappings":";AACA,SAAgBA,UAAU,EAAkBC,IAAI,QAAO,cAAc;AAMrE,eAAe,MAAMC,gBAAgB,SAASF,UAAU,CAAC;EAOvDG,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;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAHiB,IAAI;IAI1C,IAAI,CAACL,MAAM,GA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MAAM,CAACyC,cAAc,CAACJ,WAAW,CAAC,CAAC,CAAC,EAAEA,WAAW,CAAC,CAAC,CAAC,EAAEA,WAAW,CAAC,CAAC,CAAC,EAAEA,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5F;IAEA,IAAIC,QAAQ,EAAE;MACZ,IAAI,CAACtC,MAAM,CAAC0C,WAAW,CACrBJ,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,CACZ;IACH;EACF;EAEAK,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC5C,MAAM,CAAC2C,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC7C,MAAM,CAAC6C,aAAa,EAAE;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/C,MAAM,CAAC8C,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AASF"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import type { Binding, RenderPass } from '@luma.gl/api';
3
3
  import { Buffer, RenderPipeline, RenderPipelineProps } from '@luma.gl/api';
4
- import type WebGPUDevice from '../webgpu-device';
4
+ import type { WebGPUDevice } from '../webgpu-device';
5
5
  import type WebGPUShader from './webgpu-shader';
6
6
  import type WebGPURenderPass from './webgpu-render-pass';
7
7
  /** Creates a new render pipeline when parameters change */
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,OAAO,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AACtD,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,mBAAmB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G,IAAI;IAmBvD,uBAAuB;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAapD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMhD,WAAW;IAIX,iDAAiD;IACjD,aAAa;IAKb,8DAA8D;IAC9D,SAAS,CAAC,4BAA4B;IA+CtC,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmCR,oBAAoB,CAAC,gBAAgB,EAAE,gBAAgB;CAwCxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-render-pipeline.js","names":["RenderPipeline","cast","log","isObjectEmpty","applyParametersToRenderPipelineDescriptor","getWebGPUTextureFormat","getBindGroup","getVertexBufferLayout","getBufferSlots","WebGPURenderPipeline","constructor","device","props","_defineProperty","handle","createHandle","label","id","vs","fs","_bufferSlots","layout","bufferMap","_buffers","Array","Object","keys","length","fill","_bindGroupLayout","getBindGroupLayout","descriptor","_getRenderPipelineDescriptor","renderPipeline","createRenderPipeline","groupCollapsed","concat","JSON","stringify","groupEnd","destroy","setIndexBuffer","indexBuffer","_indexBuffer","setAttributes","attributes","name","buffer","entries","bufferIndex","Error","setBindings","bindings","assign","_bindGroup","setUniforms","uniforms","_getBuffers","_getBindGroup","vertex","module","entryPoint","vsEntryPoint","buffers","fragment","_this$device","_this$device$canvasCo","fsEntryPoint","targets","format","canvasContext","topology","primitive","parameters","draw","options","webgpuRenderPass","renderPass","getDefaultRenderPass","setPipeline","bindGroup","setBindGroup","_setAttributeBuffers","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","indexType","i","attribute","find","location","setVertexBuffer"],"sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"sourcesContent":["import type {Binding, RenderPass} from '@luma.gl/api';\nimport {Buffer, RenderPipeline, RenderPipelineProps, cast, log, isObjectEmpty} from '@luma.gl/api';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout, getBufferSlots} 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';\nimport 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 default 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 _indexBuffer: WebGPUBuffer | null = null;\n // private _firstIndex: number;\n // private _lastIndex: number;\n\n /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout;\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) || this.createHandle();\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.layout, this.props.bufferMap);\n this._buffers = new Array<Buffer>(Object.keys(this._bufferSlots).length).fill(null);\n this._bindGroupLayout = this.handle.getBindGroupLayout(0);\n }\n\n protected createHandle(): GPURenderPipeline {\n const descriptor = this._getRenderPipelineDescriptor();\n const renderPipeline = this.device.handle.createRenderPipeline(descriptor);\n log.groupCollapsed(1, `new WebGPRenderPipeline(${this.id})`)();\n log.log(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n return renderPipeline;\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 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 /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): void {\n if (!isObjectEmpty(this.props.bindings)) {\n Object.assign(this.props.bindings, bindings);\n // Set up the bindings\n this._bindGroup = getBindGroup(\n this.device.handle,\n this._bindGroupLayout,\n this.props.layout,\n this.props.bindings\n );\n }\n }\n\n setUniforms(uniforms: Record<string, any>): void {\n if (!isObjectEmpty(uniforms)) {\n throw new Error('WebGPU does not support uniforms');\n }\n }\n\n _getBuffers() {\n return this._buffers;\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // assert(this._bindGroup);\n return this._bindGroup;\n }\n\n /** Populate the complex WebGPU GPURenderPipelineDescriptor */\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.layout, this.props.bufferMap)\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':\n case 'line-loop':\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 draw(options: {\n renderPass?: RenderPass;\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 // Set attributes\n this._setAttributeBuffers(webgpuRenderPass);\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,\n options.firstIndex,\n options.firstInstance\n );\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.layout.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.bufferMap)) {\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"],"mappings":";AACA,SAAgBA,cAAc,EAAuBC,IAAI,EAAEC,GAAG,EAAEC,aAAa,QAAO,cAAc;AAAC,SAC3FC,yCAAyC;AAAA,SACzCC,sBAAsB;AAAA,SACtBC,YAAY;AAAA,SACZC,qBAAqB,EAAEC,cAAc;AAa7C,eAAe,MAAMC,oBAAoB,SAAST,cAAc,CAAC;EAiB/DU,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,aAbG,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBAIc,IAAI;IAAAA,eAAA;IAAAA,eAAA,qBAMN,IAAI;IAI5C,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAI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AC5C,MAAM,EAAE;QACX,MAAM6C,SAAS,GAAG,IAAI,CAAChF,KAAK,CAACS,MAAM,CAACwB,UAAU,CAACgD,IAAI,CAChDD,SAAS,IAAKA,SAAS,CAACE,QAAQ,KAAKH,CAAC,CACxC;QACD,MAAM,IAAIzC,KAAK,sCAAAd,MAAA,CACwB,CAAAwD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAE9C,IAAI,KAAI,EAAE,kBAAAV,MAAA,CAAe,IAAI,CAACxB,KAAK,CAACK,EAAE,OACvF;MACH;MACA2D,gBAAgB,CAAC9D,MAAM,CAACiF,eAAe,CAACJ,CAAC,EAAE5C,MAAM,CAACjC,MAAM,CAAC;IAC3D;EAsBF;AACF"}
1
+ {"version":3,"file":"webgpu-render-pipeline.js","names":["RenderPipeline","cast","log","isObjectEmpty","applyParametersToRenderPipelineDescriptor","getWebGPUTextureFormat","getBindGroup","getVertexBufferLayout","getBufferSlots","WebGPURenderPipeline","constructor","device","props","_defineProperty","handle","createHandle","label","id","vs","fs","_bufferSlots","layout","bufferMap","_buffers","Array","Object","keys","length","fill","_bindGroupLayout","getBindGroupLayout","descriptor","_getRenderPipelineDescriptor","renderPipeline","createRenderPipeline","groupCollapsed","concat","JSON","stringify","groupEnd","destroy","setIndexBuffer","indexBuffer","_indexBuffer","setAttributes","attributes","name","buffer","entries","bufferIndex","Error","setBindings","bindings","assign","_bindGroup","setUniforms","uniforms","_getBuffers","_getBindGroup","vertex","module","entryPoint","vsEntryPoint","buffers","fragment","_this$device","_this$device$canvasCo","fsEntryPoint","targets","format","canvasContext","topology","primitive","parameters","draw","options","webgpuRenderPass","renderPass","getDefaultRenderPass","setPipeline","bindGroup","setBindGroup","_setAttributeBuffers","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","indexType","i","attribute","find","location","setVertexBuffer"],"sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"sourcesContent":["import type {Binding, RenderPass} from '@luma.gl/api';\nimport {Buffer, RenderPipeline, RenderPipelineProps, cast, log, isObjectEmpty} from '@luma.gl/api';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout, getBufferSlots} 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';\nimport 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 default 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 _indexBuffer: WebGPUBuffer | null = null;\n // private _firstIndex: number;\n // private _lastIndex: number;\n\n /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout;\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) || this.createHandle();\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.layout, this.props.bufferMap);\n this._buffers = new Array<Buffer>(Object.keys(this._bufferSlots).length).fill(null);\n this._bindGroupLayout = this.handle.getBindGroupLayout(0);\n }\n\n protected createHandle(): GPURenderPipeline {\n const descriptor = this._getRenderPipelineDescriptor();\n const renderPipeline = this.device.handle.createRenderPipeline(descriptor);\n log.groupCollapsed(1, `new WebGPRenderPipeline(${this.id})`)();\n log.log(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n return renderPipeline;\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 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 /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): void {\n if (!isObjectEmpty(this.props.bindings)) {\n Object.assign(this.props.bindings, bindings);\n // Set up the bindings\n this._bindGroup = getBindGroup(\n this.device.handle,\n this._bindGroupLayout,\n this.props.layout,\n this.props.bindings\n );\n }\n }\n\n setUniforms(uniforms: Record<string, any>): void {\n if (!isObjectEmpty(uniforms)) {\n throw new Error('WebGPU does not support uniforms');\n }\n }\n\n _getBuffers() {\n return this._buffers;\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // assert(this._bindGroup);\n return this._bindGroup;\n }\n\n /** Populate the complex WebGPU GPURenderPipelineDescriptor */\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.layout, this.props.bufferMap)\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':\n case 'line-loop':\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 draw(options: {\n renderPass?: RenderPass;\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 // Set attributes\n this._setAttributeBuffers(webgpuRenderPass);\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,\n options.firstIndex,\n options.firstInstance\n );\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.layout.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.bufferMap)) {\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"],"mappings":";AACA,SAAgBA,cAAc,EAAuBC,IAAI,EAAEC,GAAG,EAAEC,aAAa,QAAO,cAAc;AAAC,SAC3FC,yCAAyC;AAAA,SACzCC,sBAAsB;AAAA,SACtBC,YAAY;AAAA,SACZC,qBAAqB,EAAEC,cAAc;AAa7C,eAAe,MAAMC,oBAAoB,SAAST,cAAc,CAAC;EAiB/DU,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,aAbG,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBAIc,IAAI;IAAAA,eAAA;IAAAA,eAAA,qBAMN,IAAI;IAI5C,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAI,IAAI,CAACF,KAAK,CAACE,MAAM,IAA0B,IAAI,CAACC,YAAY,EAAE;IAC7E,IAAI,CAACD,MAAM,CAACE,KAAK,GAAG,IAAI,CAACJ,KAAK,CAACK,EAAE;IAEjC,IAAI,CAACC,EAAE,GAAGjB,IAAI,CAAeW,KAAK,CAACM,EAAE,CAAC;IACtC,IAAI,CAACC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,SAAS,uBAATA,SAAS,CAAE9C,IAAI,KAAI,EAAE,kBAAAV,MAAA,CAAe,IAAI,CAACxB,KAAK,CAACK,EAAE,OACvF;MACH;MACA2D,gBAAgB,CAAC9D,MAAM,CAACiF,eAAe,CAACJ,CAAC,EAAE5C,MAAM,CAACjC,MAAM,CAAC;IAC3D;EAsBF;AACF"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { Sampler, SamplerProps } from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
3
+ import type { WebGPUDevice } from '../webgpu-device';
4
4
  export declare type WebGPUSamplerProps = SamplerProps & {
5
5
  handle?: GPUSampler;
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAEjD,oBAAY,kBAAkB,GAAG,YAAY,GAAG;IAC9C,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB;IAclD,OAAO,IAAI,IAAI;CAGzB"}
1
+ {"version":3,"file":"webgpu-sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAEnD,oBAAY,kBAAkB,GAAG,YAAY,GAAG;IAC9C,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB;IAclD,OAAO,IAAI,IAAI;CAGzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-sampler.js","names":["Sampler","WebGPUSampler","constructor","device","props","_defineProperty","samplerProps","type","compare","handle","createSampler","label","id","destroy"],"sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"sourcesContent":["import {Sampler, SamplerProps} from '@luma.gl/api';\nimport type WebGPUDevice from '../webgpu-device';\n\nexport type WebGPUSamplerProps = SamplerProps & {\n handle?: GPUSampler;\n}\n\n/**\n *\n */\nexport default 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,cAAc;AAUlD,eAAe,MAAMC,aAAa,SAASD,OAAO,CAAC;EAIjDE,WAAWA,CAACC,MAAoB,EAAEC,KAAyB,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,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,CAACC,MAAM,GAAG,IAAI,CAACA,MAAM,IAAI,IAAI,CAACN,MAAM,CAACM,MAAM,CAACC,aAAa,CAACJ,YAAY,CAAC;IAC3E,IAAI,CAACG,MAAM,CAACE,KAAK,GAAG,IAAI,CAACP,KAAK,CAACQ,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAEzB;AACF"}
1
+ {"version":3,"file":"webgpu-sampler.js","names":["Sampler","WebGPUSampler","constructor","device","props","_defineProperty","samplerProps","type","compare","handle","createSampler","label","id","destroy"],"sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"sourcesContent":["import {Sampler, SamplerProps} from '@luma.gl/api';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUSamplerProps = SamplerProps & {\n handle?: GPUSampler;\n}\n\n/**\n *\n */\nexport default 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,cAAc;AAUlD,eAAe,MAAMC,aAAa,SAASD,OAAO,CAAC;EAIjDE,WAAWA,CAACC,MAAoB,EAAEC,KAAyB,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,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,CAACC,MAAM,GAAG,IAAI,CAACA,MAAM,IAAI,IAAI,CAACN,MAAM,CAACM,MAAM,CAACC,aAAa,CAACJ,YAAY,CAAC;IAC3E,IAAI,CAACG,MAAM,CAACE,KAAK,GAAG,IAAI,CAACP,KAAK,CAACQ,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAEzB;AACF"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import type { ShaderProps, CompilerMessage } from '@luma.gl/api';
3
3
  import { Shader } from '@luma.gl/api';
4
- import type WebGPUDevice from '../webgpu-device';
4
+ import type { WebGPUDevice } from '../webgpu-device';
5
5
  export declare type WebGPUShaderProps = ShaderProps & {
6
6
  handle?: GPUShaderModule;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-shader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAM,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAEjD,oBAAY,iBAAiB,GAAG,WAAW,GAAG;IAC5C,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;gBAErB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB;IAYpD,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxE,OAAO,IAAI,IAAI;IAIxB,SAAS,CAAC,YAAY,IAAI,eAAe;IAwBzC,+CAA+C;IACzC,eAAe,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;CAI7D"}
1
+ {"version":3,"file":"webgpu-shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-shader.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAM,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAEnD,oBAAY,iBAAiB,GAAG,WAAW,GAAG;IAC5C,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;gBAErB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB;IAYpD,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxE,OAAO,IAAI,IAAI;IAIxB,SAAS,CAAC,YAAY,IAAI,eAAe;IAwBzC,+CAA+C;IACzC,eAAe,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;CAI7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-shader.js","names":["Shader","log","WebGPUShader","constructor","device","props","_defineProperty","handle","pushErrorScope","createHandle","label","id","_checkCompilationError","popErrorScope","errorScope","error","shaderLog","compilationInfo","concat","message","Error","destroy","source","language","includes","createShaderModule","code","transform","glsl","glslang","compileGLSL","type","getCompilationInfo","messages"],"sources":["../../../src/adapter/resources/webgpu-shader.ts"],"sourcesContent":["import type {ShaderProps, CompilerMessage} from '@luma.gl/api';\nimport {Shader, log} from '@luma.gl/api';\nimport type WebGPUDevice from '../webgpu-device';\n\nexport type WebGPUShaderProps = ShaderProps & {\n handle?: GPUShaderModule;\n};\n\n/**\n * Immutable shader\n */\nexport default 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 const shaderLog = await this.compilationInfo();\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 // this.handle.destroy();\n }\n\n protected createHandle(): GPUShaderModule {\n const {source} = this.props;\n\n let language = this.props.language;\n // Compile from src\n if (!language) {\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, type)\n });\n default:\n throw new Error(language);\n }\n }\n\n /** Returns compilation info for this shader */\n async compilationInfo(): Promise<readonly CompilerMessage[]> {\n const compilationInfo = await this.handle.getCompilationInfo();\n return compilationInfo.messages;\n }\n}\n"],"mappings":";AACA,SAAQA,MAAM,EAAEC,GAAG,QAAO,cAAc;AAUxC,eAAe,MAAMC,YAAY,SAASF,MAAM,CAAC;EAI/CG,WAAWA,CAACC,MAAoB,EAAEC,KAAwB,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,M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M;UAEZK,SAAS,EAAGC,IAAI,IAAK,IAAI,CAACxB,MAAM,CAACyB,OAAO,CAACC,WAAW,CAACF,IAAI,EAAEG,IAAI;QACjE,CAAC,CAAC;MACJ;QACE,MAAM,IAAIX,KAAK,CAACG,QAAQ,CAAC;IAAC;EAEhC;EAGA,MAAMN,eAAeA,CAAA,EAAwC;IAC3D,MAAMA,eAAe,GAAG,MAAM,IAAI,CAACV,MAAM,CAACyB,kBAAkB,EAAE;IAC9D,OAAOf,eAAe,CAACgB,QAAQ;EACjC;AACF"}
1
+ {"version":3,"file":"webgpu-shader.js","names":["Shader","log","WebGPUShader","constructor","device","props","_defineProperty","handle","pushErrorScope","createHandle","label","id","_checkCompilationError","popErrorScope","errorScope","error","shaderLog","compilationInfo","concat","message","Error","destroy","source","language","includes","createShaderModule","code","transform","glsl","glslang","compileGLSL","type","getCompilationInfo","messages"],"sources":["../../../src/adapter/resources/webgpu-shader.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {ShaderProps, CompilerMessage} from '@luma.gl/api';\nimport {Shader, log} from '@luma.gl/api';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUShaderProps = ShaderProps & {\n handle?: GPUShaderModule;\n};\n\n/**\n * Immutable shader\n */\nexport default 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 const shaderLog = await this.compilationInfo();\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 // this.handle.destroy();\n }\n\n protected createHandle(): GPUShaderModule {\n const {source} = this.props;\n\n let language = this.props.language;\n // Compile from src\n if (!language) {\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, type)\n });\n default:\n throw new Error(language);\n }\n }\n\n /** Returns compilation info for this shader */\n async compilationInfo(): Promise<readonly CompilerMessage[]> {\n const compilationInfo = await this.handle.getCompilationInfo();\n return compilationInfo.messages;\n }\n}\n"],"mappings":";AAGA,SAAQA,MAAM,EAAEC,GAAG,QAAO,cAAc;AAUxC,eAAe,MAAMC,YAAY,SAASF,MAAM,CAAC;EAI/CG,WAAWA,CAACC,MAAoB,EAAEC,KAAwB,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACA,MAAM,CAACG,MAAM,CAACC,cAAc,CAAC,YAAY,CAAC;IAE/C,IAAI,CAACD,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACE,YAAY,EAAE;IACtD,IAAI,CAACF,MAAM,CAACG,KAAK,GAAG,IAAI,CAACL,KAAK,CAACM,EAAE;IAEjC,IAAI,CAACC,sBAAsB,CAAC,IAAI,CAACR,MAAM,CAACG,MAAM,CAACM,aAAa,EAAE,CAAC;EACjE;EAEA,MAAMD,sBAAsBA,CAACE,UAAoC,EAAiB;IAChF,MAAMC,KAAK,GAAG,MAAMD,UAAgC;IACpD,IAAIC,KAAK,EAAE;MACT,MAAMC,SAAS,GAAG,MAAM,IAAI,CAACC,eAAe,EAAE;MAC9ChB,GAAG,CAACc,KAAK,8BAAAG,MAAA,CAA8BH,KAAK,CAACI,OAAO,GAAIH,SAAS,CAAC,EAAE;MAGpE,MAAM,IAAII,KAAK,8BAAAF,MAAA,CAA8BH,KAAK,CAACI,OAAO,EAAG;IAC/D;EACF;EAESE,OAAOA,CAAA,EAAS,CAEzB;EAEUZ,YAAYA,CAAA,EAAoB;IACxC,MAAM;MAACa;IAAM,CAAC,GAAG,IAAI,CAACjB,KAAK;IAE3B,IAAIkB,QAAQ,GAAG,IAAI,CAAClB,KAAK,CAACkB,QAAQ;IAElC,IAAI,CAACA,QAAQ,EAAE;MAEbA,QAAQ,GAAGD,MAAM,CAACE,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,MAAM;IACpD;IAEA,QAAOD,QAAQ;MACb,KAAK,MAAM;QACT,OAAO,IAAI,CAACnB,MAAM,CAACG,MAAM,CAACkB,kBAAkB,CAAC;UAACC,IAAI,EAAEJ;QAAM,CAAC,CAAC;MAC9D,KAAK,MAAM;QACT,OAAO,IAAI,CAAClB,MAAM,CAACG,MAAM,CAACkB,kBAAkB,CAAC;UAC3CC,IAAI,EAAEJ,MAAM;UAEZK,SAAS,EAAGC,IAAI,IAAK,IAAI,CAACxB,MAAM,CAACyB,OAAO,CAACC,WAAW,CAACF,IAAI,EAAEG,IAAI;QACjE,CAAC,CAAC;MACJ;QACE,MAAM,IAAIX,KAAK,CAACG,QAAQ,CAAC;IAAC;EAEhC;EAGA,MAAMN,eAAeA,CAAA,EAAwC;IAC3D,MAAMA,eAAe,GAAG,MAAM,IAAI,CAACV,MAAM,CAACyB,kBAAkB,EAAE;IAC9D,OAAOf,eAAe,CAACgB,QAAQ;EACjC;AACF"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  /// <reference types="offscreencanvas" />
3
3
  import { Texture, TextureProps, Sampler, SamplerProps } from '@luma.gl/api';
4
- import type WebGPUDevice from '../webgpu-device';
4
+ import type { WebGPUDevice } from '../webgpu-device';
5
5
  import WebGPUSampler from './webgpu-sampler';
6
6
  export default class WebGPUTexture extends Texture {
7
7
  readonly device: WebGPUDevice;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":[],"mappings":";;AACA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAW7C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,OAAO,EAAE,aAAa,CAAC;gBASX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY;IA+BrD,SAAS,CAAC,YAAY,IAAI,UAAU;IAyB3B,OAAO,IAAI,IAAI;IAIxB;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;IAKjD,OAAO,CAAC,OAAO,EAAE;QACf,IAAI,EAAE,GAAG,CAAC;KACX;IAID,gBAAgB;IAChB,QAAQ,CAAC,OAAO,EAAE;QAChB,MAAM,EAAE,WAAW,GAAG,iBAAiB,GAAG,eAAe,CAAC;QAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX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,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,IAAI;CA6HT"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-texture.js","names":["Texture","getWebGPUTextureFormat","WebGPUSampler","BASE_DIMENSIONS","WebGPUTexture","constructor","device","props","_defineProperty","format","Error","handle","createHandle","data","setData","sampler","view","createView","_this$props$data","_this$props$data2","width","height","createTexture","size","depthOrArrayLayers","depth","dimension","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/api';\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 default class WebGPUTexture extends Texture {\n readonly device: WebGPUDevice;\n readonly handle: GPUTexture;\n readonly view: GPUTextureView;\n sampler: WebGPUSampler;\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 if (typeof this.props.format === 'number') {\n throw new Error('number format');\n }\n\n this.device = device;\n this.handle = this.props.handle || this.createHandle();\n\n if (this.props.data) {\n this.setData({data: this.props.data} );\n }\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 this.view = this.handle.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\n protected createHandle(): GPUTexture {\n if (typeof this.props.format === 'number') {\n throw new Error('number format');\n }\n\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 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 }): this {\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 this;\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,cAAc;AAAC,SAClEC,sBAAsB;AAAA,OAEvBC,aAAa;AAEpB,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,eAAe,MAAMC,aAAa,SAASJ,OAAO,CAAC;EAajDK,WAAWA,CAACC,MAAoB,EAAEC,KAAmB,EAAE;IACrD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAErB,IAAI,OAAO,IAAI,CAACD,KAAK,CAACE,MAAM,KAAK,QAAQ,EAAE;MACzC,MAAM,IAAIC,KAAK,CAAC,eAAe,CAAC;IAClC;IAEA,IAAI,CAACJ,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACK,MAAM,GAAG,IAAI,CAACJ,KAAK,CAACI,MAAM,IAAI,IAAI,CAACC,YAAY,EAAE;IAEtD,IAAI,IAAI,CAACL,KAAK,CAACM,IAAI,EAAE;MACnB,IAAI,CAACC,OAAO,CAAC;QAACD,IAAI,EAAE,IAAI,CAACN,KAAK,CAACM;MAAI,CAAC,CAAG;IACzC;IAIA,IAAI,CAACE,OAAO,GAAGR,KAAK,CAACQ,OAAO,YAAYb,aAAa,GAAGK,KAAK,CAACQ,OAAO,GAAG,IAAIb,aAA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ClB,OAA+B,EAAQ;IAChD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYb,aAAa,GAAGa,OAAO,GAAG,IAAIb,aAAa,CAAC,IAAI,CAACI,MAAM,EAAES,OAAO,CAAC;IACnG,OAAO,IAAI;EACb;EAEAD,OAAOA,CAACoB,OAEP,EAAE;IACD,OAAO,IAAI,CAACC,QAAQ,CAAC;MAACC,MAAM,EAAEF,OAAO,CAACrB;IAAI,CAAC,CAAC;EAC9C;EAGAsB,QAAQA,CAACD,OAcR,EAAQ;IACP,MAAM;MACJE,MAAM;MACNhB,KAAK,GAAGc,OAAO,CAACE,MAAM,CAAChB,KAAK;MAC5BC,MAAM,GAAGa,OAAO,CAACE,MAAM,CAACf,MAAM;MAC9BI,KAAK,GAAG,CAAC;MACTY,OAAO,GAAG,CAAC;MACXC,OAAO,GAAG,CAAC;MACXC,QAAQ,GAAG,CAAC;MACZC,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,CAAC5B,MAAM,CAACK,MAAM,CAACmC,KAAK,CAACC,0BAA0B,CAEjD;MACEX,MAAM;MACNY,MAAM,EAAE,CAACX,OAAO,EAAEC,OAAO;IAC3B,CAAC,EAED;MACEW,OAAO,EAAE,IAAI,CAACtC,MAAM;MACpBqC,MAAM,EAAE,CAACR,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;MACjBH,QAAQ;MACRI,MAAM;MACNC,UAAU;MACVC;IACF,CAAC,EAED,CACEzB,KAAK,EACLC,MAAM,EACNI,KAAK,CACN,CACF;IACD,OAAO,IAAI;EACb;AAmFF"}
1
+ {"version":3,"file":"webgpu-texture.js","names":["Texture","getWebGPUTextureFormat","WebGPUSampler","BASE_DIMENSIONS","WebGPUTexture","constructor","device","props","_defineProperty","format","Error","handle","createHandle","data","setData","sampler","view","createView","_this$props$data","_this$props$data2","width","height","createTexture","size","depthOrArrayLayers","depth","dimension","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/api';\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 default class WebGPUTexture extends Texture {\n readonly device: WebGPUDevice;\n readonly handle: GPUTexture;\n readonly view: GPUTextureView;\n sampler: WebGPUSampler;\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 if (typeof this.props.format === 'number') {\n throw new Error('number format');\n }\n\n this.device = device;\n this.handle = this.props.handle || this.createHandle();\n\n if (this.props.data) {\n this.setData({data: this.props.data} );\n }\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 this.view = this.handle.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\n protected createHandle(): GPUTexture {\n if (typeof this.props.format === 'number') {\n throw new Error('number format');\n }\n\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 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 }): this {\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 this;\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,cAAc;AAAC,SAClEC,sBAAsB;AAAA,OAEvBC,aAAa;AAEpB,MAAMC,e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AM,CAAChB,KAAK;MAC5BC,MAAM,GAAGa,OAAO,CAACE,MAAM,CAACf,MAAM;MAC9BI,KAAK,GAAG,CAAC;MACTY,OAAO,GAAG,CAAC;MACXC,OAAO,GAAG,CAAC;MACXC,QAAQ,GAAG,CAAC;MACZC,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,CAAC5B,MAAM,CAACK,MAAM,CAACmC,KAAK,CAACC,0BAA0B,CAEjD;MACEX,MAAM;MACNY,MAAM,EAAE,CAACX,OAAO,EAAEC,OAAO;IAC3B,CAAC,EAED;MACEW,OAAO,EAAE,IAAI,CAACtC,MAAM;MACpBqC,MAAM,EAAE,CAACR,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;MACjBH,QAAQ;MACRI,MAAM;MACNC,UAAU;MACVC;IACF,CAAC,EAED,CACEzB,KAAK,EACLC,MAAM,EACNI,KAAK,CACN,CACF;IACD,OAAO,IAAI;EACb;AAmFF"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import type { Texture, TextureFormat, CanvasContextProps } from '@luma.gl/api';
3
3
  import { CanvasContext } from '@luma.gl/api';
4
- import WebGPUDevice from './webgpu-device';
4
+ import { WebGPUDevice } from './webgpu-device';
5
5
  import WEBGPUFramebuffer from './resources/webgpu-framebuffer';
6
6
  /**
7
7
  * Holds a WebGPU Canvas Context which handles resizing etc
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAC,aAAa,EAAM,MAAM,cAAc,CAAC;AAEhD,OA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B,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,kBAAkB,EAAE,aAAa,CAAiB;IAClD,WAAW,EAAE,MAAM,CAAK;IAExB,OAAO,CAAC,sBAAsB,CAAwB;gBAE1C,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB;IAahF,OAAO,IAAI,IAAI;IAIf,0EAA0E;IAC1E,qBAAqB,IAAI,iBAAiB;IAsB1C,sDAAsD;IACtD,MAAM;IA6BN,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAI7F,8FAA8F;IAC9F,6BAA6B;CAY9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-canvas-context.js","names":["CanvasContext","log","getWebGPUTextureFormat","WEBGPUFramebuffer","WebGPUCanvasContext","constructor","device","adapter","props","_defineProperty","width","height","_setAutoCreatedCanvasId","concat","id","gpuCanvasContext","canvas","getContext","format","getPreferredFormat","destroy","unconfigure","getCurrentFramebuffer","update","currentColorAttachment","createTexture","handle","getCurrentTexture","_createDepthStencilAttachment","colorAttachments","depthStencilAttachment","getPixelSize","sizeChanged","configure","colorSpace","alphaMode","resize","options","depthStencilFormat","usage","GPUTextureUsage","RENDER_ATTACHMENT"],"sources":["../../src/adapter/webgpu-canvas-context.ts"],"sourcesContent":["import type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/api';\nimport {CanvasContext, log} from '@luma.gl/api';\nimport {getWebGPUTextureFormat} from './helpers/convert-texture-format';\nimport WebGPUDevice from './webgpu-device';\nimport WEBGPUFramebuffer from './resources/webgpu-framebuffer';\n\n/** \n * Holds a WebGPU Canvas Context which handles resizing etc \n */\nexport default class WebGPUCanvasContext extends CanvasContext {\n readonly device: WebGPUDevice;\n readonly gpuCanvasContext: GPUCanvasContext;\n readonly format: TextureFormat;\n depthStencilFormat: TextureFormat = 'depth24plus';\n sampleCount: number = 1;\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 this.gpuCanvasContext = this.canvas.getContext('webgpu') as GPUCanvasContext;\n // @ts-expect-error TODO this has been replaced\n this.format = this.gpuCanvasContext.getPreferredFormat(adapter);\n }\n\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 // 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 // size: [this.width, this.height],\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\n resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n this.update();\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: 'depth-stencil-target',\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":";AACA,SAAQA,aAAa,EAAEC,GAAG,QAAO,cAAc;AAAC,SACxCC,sBAAsB;AAAA,OAEvBC,iBAAiB;AAKxB,eAAe,MAAMC,mBAAmB,SAASJ,aAAa,CAAC;EAS7DK,WAAWA,CAACC,MAAoB,EAAEC,OAAmB,EAAEC,KAAyB,EAAE;IAChF,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,6BANqB,aAAa;IAAAA,eAAA,sBAC3B,CAAC;IAAAA,eAAA,iCAE0B,IAAI;IAInD,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACI,KAAK,GAAG,CAAC,CAAC;IACf,IAAI,CAACC,MAAM,GAAG,CAAC,CAAC;IAEhB,IAAI,CAACC,uBAAuB,IAAAC,MAAA,CAAI,IAAI,CAACP,MAAM,CAACQ,EAAE,aAAU;IACxD,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACC,MAAM,CAACC,UAAU,CAAC,QAAQ,CAAqB;IAE5E,IAAI,CAACC,MAAM,GAAG,IAAI,CAACH,gBAAgB,CAACI,kBAAkB,CAACZ,OAAO,CAAC;EACjE;EAEAa,OAAOA,CAAA,EAAS;IACd,IAAI,CAACL,gBAAgB,CAACM,WAAW,EAAE;EACrC;EAGAC,qBAAqBA,CAAA,EAAsB;IAEzC,IAAI,CAACC,MAAM,EAAE;IAGb,MAAMC,sBAAsB,GAAG,IAAI,CAAClB,MAAM,CAACmB,aAAa,CAAC;MACvDX,EAAE,EAAE,uBAAuB;MAC3BY,MAAM,EA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,CAACC,OAA+E,EAAQ;IAC5F,IAAI,CAACd,MAAM,EAAE;EACf;EAGAK,6BAA6BA,CAAA,EAAG;IAC9B,IAAI,CAAC,IAAI,CAACE,sBAAsB,EAAE;MAChC,IAAI,CAACA,sBAAsB,GAAG,IAAI,CAACxB,MAAM,CAACmB,aAAa,CAAC;QACtDX,EAAE,EAAE,sBAAsB;QAC1BI,MAAM,EAAE,IAAI,CAACoB,kBAAkB;QAC/B5B,KAAK,EAAE,IAAI,CAACA,KAAK;QACjBC,MAAM,EAAE,IAAI,CAACA,MAAM;QACnB4B,KAAK,EAAEC,eAAe,CAACC;MACzB,CAAC,CAAC;IACJ;IACA,OAAO,IAAI,CAACX,sBAAsB;EACpC;AACF"}
1
+ {"version":3,"file":"webgpu-canvas-context.js","names":["CanvasContext","log","getWebGPUTextureFormat","WEBGPUFramebuffer","WebGPUCanvasContext","constructor","device","adapter","props","_defineProperty","width","height","_setAutoCreatedCanvasId","concat","id","gpuCanvasContext","canvas","getContext","format","getPreferredFormat","destroy","unconfigure","getCurrentFramebuffer","update","currentColorAttachment","createTexture","handle","getCurrentTexture","_createDepthStencilAttachment","colorAttachments","depthStencilAttachment","getPixelSize","sizeChanged","configure","colorSpace","alphaMode","resize","options","depthStencilFormat","usage","GPUTextureUsage","RENDER_ATTACHMENT"],"sources":["../../src/adapter/webgpu-canvas-context.ts"],"sourcesContent":["import type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/api';\nimport {CanvasContext, log} from '@luma.gl/api';\nimport {getWebGPUTextureFormat} from './helpers/convert-texture-format';\nimport {WebGPUDevice} from './webgpu-device';\nimport WEBGPUFramebuffer from './resources/webgpu-framebuffer';\n\n/** \n * Holds a WebGPU Canvas Context which handles resizing etc \n */\nexport default class WebGPUCanvasContext extends CanvasContext {\n readonly device: WebGPUDevice;\n readonly gpuCanvasContext: GPUCanvasContext;\n readonly format: TextureFormat;\n depthStencilFormat: TextureFormat = 'depth24plus';\n sampleCount: number = 1;\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 this.gpuCanvasContext = this.canvas.getContext('webgpu') as GPUCanvasContext;\n // @ts-expect-error TODO this has been replaced\n this.format = this.gpuCanvasContext.getPreferredFormat(adapter);\n }\n\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 // 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 // size: [this.width, this.height],\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\n resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n this.update();\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: 'depth-stencil-target',\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":";AACA,SAAQA,aAAa,EAAEC,GAAG,QAAO,cAAc;AAAC,SACxCC,sBAAsB;AAAA,OAEvBC,iBAAiB;AAKxB,eAAe,MAAMC,mBAAmB,SAASJ,aAAa,CAAC;EAS7DK,WAAWA,CAACC,MAAoB,EAAEC,OAAmB,EAAEC,KAAyB,EAAE;IAChF,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,6BANqB,aAAa;IAAAA,eAAA,sBAC3B,CAAC;IAAAA,eAAA,iCAE0B,IAAI;IAInD,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACI,KAAK,GAAG,CAAC,CAAC;IACf,IAAI,CAACC,MAAM,GAAG,CAAC,CAAC;IAEhB,IAAI,CAACC,uBAAuB,IAAAC,MAAA,CAAI,IAAI,CAACP,MAAM,CAACQ,EAAE,aAAU;IACxD,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACC,MAAM,CAACC,UAAU,CAAC,QAAQ,CAAqB;IAE5E,IAAI,CAACC,MAAM,GAAG,IAAI,CAACH,gBAAgB,CAACI,kBAAkB,CAACZ,OAAO,CAAC;EACjE;EAEAa,OAAOA,CAAA,EAAS;IACd,IAAI,CAACL,gBAAgB,CAACM,WAAW,EAAE;EACrC;EAGAC,qBAAqBA,CAAA,EAAsB;IAEzC,IAAI,CAACC,MAAM,EAAE;IAGb,MAAMC,sBAAsB,GAAG,IAAI,CAAClB,MAAM,CAACmB,aAAa,CAAC;MACvDX,EAAE,EAAE,uBAAuB;MAC3BY,MAAM,EAAE,IAAI,CAACX,gBAAgB,CAACY,iBAAiB,EAAE;MACjDT,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBR,KAAK,EAAE,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AAC,IAAI,CAACE,sBAAsB,EAAE;MAChC,IAAI,CAACA,sBAAsB,GAAG,IAAI,CAACxB,MAAM,CAACmB,aAAa,CAAC;QACtDX,EAAE,EAAE,sBAAsB;QAC1BI,MAAM,EAAE,IAAI,CAACoB,kBAAkB;QAC/B5B,KAAK,EAAE,IAAI,CAACA,KAAK;QACjBC,MAAM,EAAE,IAAI,CAACA,MAAM;QACnB4B,KAAK,EAAEC,eAAe,CAACC;MACzB,CAAC,CAAC;IACJ;IACA,OAAO,IAAI,CAACX,sBAAsB;EACpC;AACF"}
@@ -13,7 +13,7 @@ import WebGPURenderPass from './resources/webgpu-render-pass';
13
13
  import WebGPUComputePass from './resources/webgpu-compute-pass';
14
14
  import WebGPUCanvasContext from './webgpu-canvas-context';
15
15
  /** WebGPU Device implementation */
16
- export default class WebGPUDevice extends Device {
16
+ export declare class WebGPUDevice extends Device {
17
17
  readonly handle: GPUDevice;
18
18
  readonly adapter: GPUAdapter;
19
19
  readonly lost: Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-device.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,MAAM,EAA0B,MAAM,cAAc,CAAC;AAC7D,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,oBAAoB,MAAM,oCAA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AG,OAAO;IAIxD,oCAAoC;IACpC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAIzD,oCAAoC;IACpC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAIzD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY;IAI/C,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa;IAIlD,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB;IAIzE,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY;IAI9C,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa;IAIjD,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB;IAItE,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB;IAI7D,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB;IAMzE;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB;IAKzD,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB;IAK5D,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB;IAInE;;;;OAIG;IACH,oBAAoB,IAAI,gBAAgB;IASxC,MAAM,IAAI,IAAI;IAUd,YAAY;CAsDb"}
@@ -10,7 +10,7 @@ import WebGPUComputePipeline from "./resources/webgpu-compute-pipeline.js";
10
10
  import WebGPURenderPass from "./resources/webgpu-render-pass.js";
11
11
  import WebGPUComputePass from "./resources/webgpu-compute-pass.js";
12
12
  import WebGPUCanvasContext from "./webgpu-canvas-context.js";
13
- export default class WebGPUDevice extends Device {
13
+ export class WebGPUDevice extends Device {
14
14
  static isSupported() {
15
15
  return Boolean(typeof navigator !== 'undefined' && navigator.gpu);
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-device.js","names":["Device","CanvasContext","log","uid","WebGPUBuffer","WebGPUTexture","WebGPUExternalTexture","WebGPUSampler","WebGPUShader","WebGPURenderPipeline","WebGPUComputePipeline","WebGPURenderPass","WebGPUComputePass","WebGPUCanvasContext","WebGPUDevice","isSupported","Boolean","navigator","gpu","create","props","Error","groupCollapsed","adapter","requestAdapter","powerPreference","probe","gpuDevice","requestDevice","requiredFeatures","features","canvas","pageLoaded","device","info","table","groupEnd","constructor","id","_defineProperty","handle","_info","type","vendor","__brand","renderer","version","shadingLanguages","shadingLanguageVersions","glsl","wgsl","vendorMasked","rendererMasked","lost","Promise","resolve","lostInfo","_isLost","reason","message","canvasContext","_getFeatures","destroy","limits","isTextureFormatSupported","format","includes","isTextureFormatFilterable","isTextureFormatRenderable","isLost","_createBuffer","_createTexture","createExternalTexture","createShader","createSampler","createRenderPipeline","createFramebuffer","createComputePipeline","beginRenderPass","commandEncoder","createCommandEncoder","beginComputePass","createCanvasContext","getDefaultRenderPass","_this$canvasContext","renderPass","framebuffer","getCurrentFramebuffer","submit","_this$renderPass","_this$commandEncoder","end","commandBuffer","finish","queue","Set","has","delete","add"],"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 TextureProps,\n TextureFormat,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\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\nimport WebGPUCanvasContext from './webgpu-canvas-context';\n// import {loadGlslangModule} from '../glsl/glslang';\n\n/** WebGPU Device implementation */\nexport default 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 log.probe(1, 'Adapter available')();\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, props);\n log.probe(1, 'Device created', device.info)();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n constructor(device: GPUDevice, adapter: GPUAdapter, props: DeviceProps) {\n super({...props, id: props.id || uid('webgpu-device')});\n this.handle = device;\n this.adapter = adapter;\n\n this._info = {\n type: 'webgpu',\n vendor: this.adapter.__brand,\n renderer: '',\n version: '',\n gpu: 'unknown', // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n shadingLanguages: ['glsl', 'wgsl'],\n shadingLanguageVersions: {\n glsl: '450',\n wgsl: '100'\n },\n vendorMasked: '',\n rendererMasked: ''\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, {canvas: props.canvas});\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): WebGPUBuffer {\n return new WebGPUBuffer(this, props);\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 // 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 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 */\n getDefaultRenderPass(): WebGPURenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext?.getCurrentFramebuffer()\n });\n return this.renderPass;\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"],"mappings":";AAqBA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAAC,OACtDC,YAAY;AAAA,OACZC,aAAa;AAAA,OACbC,qBAAqB;AAAA,OACrBC,aAAa;AAAA,OACbC,YAAY;AAAA,OACZC,oBAAoB;AAAA,OAEpBC,qBAAqB;AAAA,OACrBC,gBAAgB;AAAA,OAChBC,iBAAiB;AAAA,OAEjBC,mBAAmB;AAI1B,eAAe,MAAMC,YAAY,SAASd,MAAM,CAAC;EAe/C,OAAOe,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,8FAA8F,CAC/F;IACH;IACAnB,GAAG,CAACoB,cAAc,CAAC,CAAC,EAAE,sBAAsB,CAAC,EAAE;IAC/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,GAAG,CAAC,kCAAkC,CAAC;IAChDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAGhDpE,QAAQ,CAACoE,GAAG,CAAC,gBAAgB,CAAC;IAC9BpE,QAAQ,CAACoE,GAAG,CAAC,iBAAiB,CAAC;IAC/BpE,QAAQ,CAACoE,GAAG,CAAC,kBAAkB,CAAC;IAChCpE,QAAQ,CAACoE,GAAG,CAAC,kBAAkB,CAAC;IAEhC,OAAOpE,QAAQ;EACjB;AACF;AAACS,eAAA,CAjQoBzB,YAAY,UAYT,QAAQ"}
1
+ {"version":3,"file":"webgpu-device.js","names":["Device","CanvasContext","log","uid","WebGPUBuffer","WebGPUTexture","WebGPUExternalTexture","WebGPUSampler","WebGPUShader","WebGPURenderPipeline","WebGPUComputePipeline","WebGPURenderPass","WebGPUComputePass","WebGPUCanvasContext","WebGPUDevice","isSupported","Boolean","navigator","gpu","create","props","Error","groupCollapsed","adapter","requestAdapter","powerPreference","probe","gpuDevice","requestDevice","requiredFeatures","features","canvas","pageLoaded","device","info","table","groupEnd","constructor","id","_defineProperty","handle","_info","type","vendor","__brand","renderer","version","shadingLanguages","shadingLanguageVersions","glsl","wgsl","vendorMasked","rendererMasked","lost","Promise","resolve","lostInfo","_isLost","reason","message","canvasContext","_getFeatures","destroy","limits","isTextureFormatSupported","format","includes","isTextureFormatFilterable","isTextureFormatRenderable","isLost","_createBuffer","_createTexture","createExternalTexture","createShader","createSampler","createRenderPipeline","createFramebuffer","createComputePipeline","beginRenderPass","commandEncoder","createCommandEncoder","beginComputePass","createCanvasContext","getDefaultRenderPass","_this$canvasContext","renderPass","framebuffer","getCurrentFramebuffer","submit","_this$renderPass","_this$commandEncoder","end","commandBuffer","finish","queue","Set","has","delete","add"],"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 TextureProps,\n TextureFormat,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\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\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 log.probe(1, 'Adapter available')();\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, props);\n log.probe(1, 'Device created', device.info)();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n constructor(device: GPUDevice, adapter: GPUAdapter, props: DeviceProps) {\n super({...props, id: props.id || uid('webgpu-device')});\n this.handle = device;\n this.adapter = adapter;\n\n this._info = {\n type: 'webgpu',\n vendor: this.adapter.__brand,\n renderer: '',\n version: '',\n gpu: 'unknown', // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n shadingLanguages: ['glsl', 'wgsl'],\n shadingLanguageVersions: {\n glsl: '450',\n wgsl: '100'\n },\n vendorMasked: '',\n rendererMasked: ''\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, {canvas: props.canvas});\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): WebGPUBuffer {\n return new WebGPUBuffer(this, props);\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 // 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 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 */\n getDefaultRenderPass(): WebGPURenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext?.getCurrentFramebuffer()\n });\n return this.renderPass;\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"],"mappings":";AAqBA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAAC,OACtDC,YAAY;AAAA,OACZC,aAAa;AAAA,OACbC,qBAAqB;AAAA,OACrBC,aAAa;AAAA,OACbC,YAAY;AAAA,OACZC,oBAAoB;AAAA,OAEpBC,qBAAqB;AAAA,OACrBC,gBAAgB;AAAA,OA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CAACoE,GAAG,CAAC,6BAA6B,CAAC;IAG3CpE,QAAQ,CAACoE,GAAG,CAAC,8BAA8B,CAAC;IAC5CpE,QAAQ,CAACoE,GAAG,CAAC,gCAAgC,CAAC;IAC9CpE,QAAQ,CAACoE,GAAG,CAAC,gCAAgC,CAAC;IAE9CpE,QAAQ,CAACoE,GAAG,CAAC,qCAAqC,CAAC;IACnDpE,QAAQ,CAACoE,GAAG,CAAC,qCAAqC,CAAC;IACnDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAGhDpE,QAAQ,CAACoE,GAAG,CAAC,sCAAsC,CAAC;IACpDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAChDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAGhDpE,QAAQ,CAACoE,GAAG,CAAC,gBAAgB,CAAC;IAC9BpE,QAAQ,CAACoE,GAAG,CAAC,iBAAiB,CAAC;IAC/BpE,QAAQ,CAACoE,GAAG,CAAC,kBAAkB,CAAC;IAChCpE,QAAQ,CAACoE,GAAG,CAAC,kBAAkB,CAAC;IAEhC,OAAOpE,QAAQ;EACjB;AACF;AAACS,eAAA,CAjQYzB,YAAY,UAYD,QAAQ"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default as WebGPUDevice } from './adapter/webgpu-device';
1
+ export { WebGPUDevice } from './adapter/webgpu-device';
2
2
  export { default as WebGPUBuffer } from './adapter/resources/webgpu-buffer';
3
3
  export { default as WebGPUTexture } from './adapter/resources/webgpu-texture';
4
4
  export { default as WebGPUSampler } from './adapter/resources/webgpu-sampler';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,mCAAmC,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { default as WebGPUDevice } from "./adapter/webgpu-device.js";
1
+ export { WebGPUDevice } from "./adapter/webgpu-device.js";
2
2
  export { default as WebGPUBuffer } from "./adapter/resources/webgpu-buffer.js";
3
3
  export { default as WebGPUTexture } from "./adapter/resources/webgpu-texture.js";
4
4
  export { default as WebGPUSampler } from "./adapter/resources/webgpu-sampler.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","WebGPUDevice","WebGPUBuffer","WebGPUTexture","WebGPUSampler","WebGPUShader"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl, MIT license\n\n// WEBGPU ADAPTER\nexport {default as WebGPUDevice} from './adapter/webgpu-device';\n\n// WEBGPU CLASSES (typically not accessed directly)\nexport {default as WebGPUBuffer} from './adapter/resources/webgpu-buffer';\nexport {default as WebGPUTexture} from './adapter/resources/webgpu-texture';\nexport {default as WebGPUSampler} from './adapter/resources/webgpu-sampler';\nexport {default as WebGPUShader} from './adapter/resources/webgpu-shader';\n"],"mappings":"SAGQA,OAAO,IAAIC,YAAY;AAAA,SAGvBD,OAAO,IAAIE,YAAY;AAAA,SACvBF,OAAO,IAAIG,aAAa;AAAA,SACxBH,OAAO,IAAII,aAAa;AAAA,SACxBJ,OAAO,IAAIK,YAAY"}
1
+ {"version":3,"file":"index.js","names":["WebGPUDevice","default","WebGPUBuffer","WebGPUTexture","WebGPUSampler","WebGPUShader"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl, MIT license\n\n// WEBGPU ADAPTER\nexport {WebGPUDevice} from './adapter/webgpu-device';\n\n// WEBGPU CLASSES (typically not accessed directly)\nexport {default as WebGPUBuffer} from './adapter/resources/webgpu-buffer';\nexport {default as WebGPUTexture} from './adapter/resources/webgpu-texture';\nexport {default as WebGPUSampler} from './adapter/resources/webgpu-sampler';\nexport {default as WebGPUShader} from './adapter/resources/webgpu-shader';\n"],"mappings":"SAGQA,YAAY;AAAA,SAGZC,OAAO,IAAIC,YAAY;AAAA,SACvBD,OAAO,IAAIE,aAAa;AAAA,SACxBF,OAAO,IAAIG,aAAa;AAAA,SACxBH,OAAO,IAAII,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/webgpu",
3
- "version": "9.0.0-alpha.17",
3
+ "version": "9.0.0-alpha.19",
4
4
  "description": "WebGPU adapter for the luma.gl API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@babel/runtime": "^7.0.0",
40
- "@luma.gl/api": "9.0.0-alpha.17",
40
+ "@luma.gl/api": "9.0.0-alpha.19",
41
41
  "@probe.gl/env": "^4.0.2",
42
42
  "@webgpu/types": "^0.1.31"
43
43
  },
44
- "gitHead": "9385b56a95f5f53ee5f11d2ccef5b6114a527d94"
44
+ "gitHead": "d57e5fd81825ae4c7c23040ba63f54ad4ea7e972"
45
45
  }
@@ -1,6 +1,6 @@
1
1
  // WEBGPU Buffer implementation
2
2
  import {Buffer, BufferProps} from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
3
+ import type {WebGPUDevice} from '../webgpu-device';
4
4
 
5
5
  function getByteLength(props: BufferProps): number {
6
6
  return props.byteLength || props.data?.byteLength || 0;
@@ -1,5 +1,5 @@
1
1
  import {CommandEncoder, CommandEncoderProps, Buffer, Texture, cast} from '@luma.gl/api';
2
- import WebGPUDevice from '../webgpu-device';
2
+ import {WebGPUDevice} from '../webgpu-device';
3
3
  import WEBGPUBuffer from './webgpu-buffer';
4
4
  import WebGPUTexture from './webgpu-texture';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding, cast} from '@luma.gl/api';
2
- import WebGPUDevice from '../webgpu-device';
2
+ import {WebGPUDevice} from '../webgpu-device';
3
3
  import WebGPUBuffer from './webgpu-buffer';
4
4
  // import WebGPUCommandEncoder from './webgpu-command-encoder';
5
5
  import WebGPUComputePipeline from './webgpu-compute-pipeline';
@@ -1,7 +1,7 @@
1
1
  // prettier-ignore
2
2
  import {ComputePipeline, ComputePipelineProps, cast} from '@luma.gl/api';
3
3
 
4
- import WebGPUDevice from '../webgpu-device';
4
+ import {WebGPUDevice} from '../webgpu-device';
5
5
  import WebGPUShader from './webgpu-shader';
6
6
 
7
7
  // COMPUTE PIPELINE
@@ -1,6 +1,6 @@
1
1
  // luma.gl, MIT license
2
2
  import {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
3
+ import type {WebGPUDevice} from '../webgpu-device';
4
4
  import WebGPUSampler from './webgpu-sampler';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';
2
2
  import {Framebuffer, Texture} from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import {WebGPUDevice} from '../webgpu-device';
4
4
  // import WebGPUCanvasContext from '../webgpu-canvas-context';
5
5
  import WEBGPUTexture from './webgpu-texture';
6
6
  import WebGPUTexture from './webgpu-texture';
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  import {Resource, Query, QueryProps} from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import {WebGPUDevice} from '../webgpu-device';
4
4
 
5
5
  export type WebGPUQueryProps = QueryProps & {
6
6
  handle?: any;
@@ -1,6 +1,6 @@
1
1
  import type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/api';
2
2
  import {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import {WebGPUDevice} from '../webgpu-device';
4
4
  import WebGPUBuffer from './webgpu-buffer';
5
5
  // import WebGPUCommandEncoder from './webgpu-command-encoder';
6
6
  import WebGPURenderPipeline from './webgpu-render-pipeline';
@@ -8,7 +8,7 @@ import {getVertexBufferLayout, getBufferSlots} from '../helpers/get-vertex-buffe
8
8
  // import {mapAccessorToWebGPUFormat} from './helpers/accessor-to-format';
9
9
  // import type {BufferAccessors} from './webgpu-pipeline';
10
10
 
11
- import type WebGPUDevice from '../webgpu-device';
11
+ import type {WebGPUDevice} from '../webgpu-device';
12
12
  import type WebGPUBuffer from './webgpu-buffer';
13
13
  import type WebGPUShader from './webgpu-shader';
14
14
  import type WebGPURenderPass from './webgpu-render-pass';
@@ -1,5 +1,5 @@
1
1
  import {Sampler, SamplerProps} from '@luma.gl/api';
2
- import type WebGPUDevice from '../webgpu-device';
2
+ import type {WebGPUDevice} from '../webgpu-device';
3
3
 
4
4
  export type WebGPUSamplerProps = SamplerProps & {
5
5
  handle?: GPUSampler;
@@ -1,6 +1,8 @@
1
+ // luma.gl, MIT license
2
+
1
3
  import type {ShaderProps, CompilerMessage} from '@luma.gl/api';
2
4
  import {Shader, log} from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
5
+ import type {WebGPUDevice} from '../webgpu-device';
4
6
 
5
7
  export type WebGPUShaderProps = ShaderProps & {
6
8
  handle?: GPUShaderModule;
@@ -1,7 +1,7 @@
1
1
  // luma.gl, MIT license
2
2
  import {Texture, TextureProps, Sampler, SamplerProps} from '@luma.gl/api';
3
3
  import {getWebGPUTextureFormat} from '../helpers/convert-texture-format';
4
- import type WebGPUDevice from '../webgpu-device';
4
+ import type {WebGPUDevice} from '../webgpu-device';
5
5
  import WebGPUSampler from './webgpu-sampler';
6
6
 
7
7
  const BASE_DIMENSIONS: Record<string, '1d' | '2d' | '3d'> = {
@@ -1,7 +1,7 @@
1
1
  import type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/api';
2
2
  import {CanvasContext, log} from '@luma.gl/api';
3
3
  import {getWebGPUTextureFormat} from './helpers/convert-texture-format';
4
- import WebGPUDevice from './webgpu-device';
4
+ import {WebGPUDevice} from './webgpu-device';
5
5
  import WEBGPUFramebuffer from './resources/webgpu-framebuffer';
6
6
 
7
7
  /**
@@ -35,7 +35,7 @@ import WebGPUCanvasContext from './webgpu-canvas-context';
35
35
  // import {loadGlslangModule} from '../glsl/glslang';
36
36
 
37
37
  /** WebGPU Device implementation */
38
- export default class WebGPUDevice extends Device {
38
+ export class WebGPUDevice extends Device {
39
39
  readonly handle: GPUDevice;
40
40
  readonly adapter: GPUAdapter;
41
41
  readonly lost: Promise<{reason: 'destroyed'; message: string}>;
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // luma.gl, MIT license
2
2
 
3
3
  // WEBGPU ADAPTER
4
- export {default as WebGPUDevice} from './adapter/webgpu-device';
4
+ export {WebGPUDevice} from './adapter/webgpu-device';
5
5
 
6
6
  // WEBGPU CLASSES (typically not accessed directly)
7
7
  export {default as WebGPUBuffer} from './adapter/resources/webgpu-buffer';
package/dist/.DS_Store DELETED
Binary file
Binary file
package/src/.DS_Store DELETED
Binary file
Binary file