@luma.gl/webgpu 9.0.0-alpha.21 → 9.0.0-alpha.24

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 (41) hide show
  1. package/dist/adapter/resources/webgpu-command-encoder.d.ts +3 -11
  2. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  3. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  4. package/dist/adapter/resources/webgpu-framebuffer.d.ts +0 -17
  5. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  6. package/dist/adapter/resources/webgpu-framebuffer.js +2 -84
  7. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  8. package/dist/adapter/resources/webgpu-render-pass.d.ts +6 -1
  9. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  10. package/dist/adapter/resources/webgpu-render-pass.js +19 -1
  11. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  12. package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
  13. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  14. package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
  15. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  16. package/dist/adapter/resources/webgpu-shader.js +3 -2
  17. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  18. package/dist/adapter/resources/webgpu-texture.d.ts +10 -3
  19. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  20. package/dist/adapter/resources/webgpu-texture.js +8 -1
  21. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  22. package/dist/adapter/webgpu-canvas-context.d.ts +1 -1
  23. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  24. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  25. package/dist/adapter/webgpu-device.d.ts +15 -2
  26. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  27. package/dist/adapter/webgpu-device.js +33 -3
  28. package/dist/adapter/webgpu-device.js.map +1 -1
  29. package/dist/dist.dev.js +386 -172
  30. package/dist/index.cjs +82 -88
  31. package/dist.min.js +4 -4
  32. package/package.json +4 -4
  33. package/src/adapter/resources/webgpu-command-encoder.ts +40 -21
  34. package/src/adapter/resources/webgpu-framebuffer.ts +6 -107
  35. package/src/adapter/resources/webgpu-render-pass.ts +34 -4
  36. package/src/adapter/resources/webgpu-shader.ts +2 -2
  37. package/src/adapter/resources/webgpu-texture.ts +8 -2
  38. package/src/adapter/webgpu-canvas-context.ts +2 -1
  39. package/src/adapter/webgpu-device.ts +73 -4
  40. package/src/.DS_Store +0 -0
  41. package/src/adapter/.DS_Store +0 -0
@@ -1,5 +1,5 @@
1
1
  /// <reference types="dist" />
2
- import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/api';
2
+ import { CommandEncoder, CommandEncoderProps, Buffer, Texture, CopyTextureToTextureOptions, CopyTextureToBufferOptions } from '@luma.gl/api';
3
3
  import { WebGPUDevice } from '../webgpu-device';
4
4
  export declare class WebGPUCommandEncoder extends CommandEncoder {
5
5
  readonly device: WebGPUDevice;
@@ -27,16 +27,8 @@ export declare class WebGPUCommandEncoder extends CommandEncoder {
27
27
  origin?: number[] | [number, number, number];
28
28
  extent?: number[] | [number, number, number];
29
29
  }): void;
30
- copyTextureToBuffer(options: {
31
- source: GPUImageCopyTexture;
32
- destination: GPUImageCopyBuffer;
33
- copySize: GPUExtent3D;
34
- }): void;
35
- copyTextureToTexture(options: {
36
- source: GPUImageCopyTexture;
37
- destination: GPUImageCopyTexture;
38
- copySize: GPUExtent3D;
39
- }): void;
30
+ copyTextureToBuffer(options: CopyTextureToBufferOptions): void;
31
+ copyTextureToTexture(options: CopyTextureToTextureOptions): void;
40
32
  pushDebugGroup(groupLabel: string): void;
41
33
  popDebugGroup(): void;
42
34
  insertDebugMarker(markerLabel: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources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CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,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,GACE,IAAI;IAuBP,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAW9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAWvD,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 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,OAAO,MAAMC,oBAAoB,SAASF,cAAc,CAAC;EAIvDG,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,OAAO,CAACM,YAAY,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,CAAC,EACzBd,IAAI,CAAeY,OAAO,CAACO,WAAW,CAAC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AC;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, \n CopyTextureToTextureOptions, \n CopyTextureToBufferOptions\n // CopyBufferToTextureOptions,\n // CopyBufferToBufferOptions,\n} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n\nexport class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(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: // CopyBufferToBufferOptions\n {\n source: Buffer,\n sourceOffset?: number,\n destination: Buffer,\n destinationOffset?: number,\n size?: number\n }\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: // CopyBufferToTextureOptions\n {\n source: Buffer,\n offset?: number,\n bytesPerRow: number,\n rowsPerImage: number,\n\n destination: Texture,\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only',\n\n origin?: number[] | [number, number, number],\n extent?: number[] | [number, number, number]\n }\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: CopyTextureToBufferOptions): void {\n // this.handle.copyTextureToBuffer(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n // this.handle.copyTextureToTexture(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n override pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n\n override popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n\n override insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n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MACEI,MAAM,EAAE1B,IAAI,CAAeY,OAAO,CAACK,MAAM,CAAC,CAACX,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,OAAmC,EAAQ,CAS/D;EAEA0B,oBAAoBA,CAAC1B,OAAoC,EAAQ,CASjE;EAES2B,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,29 +1,12 @@
1
- /// <reference types="dist" />
2
1
  import type { FramebufferProps } from '@luma.gl/api';
3
2
  import { Framebuffer } from '@luma.gl/api';
4
3
  import { WebGPUDevice } from '../webgpu-device';
5
- import { WebGPUTexture } from './webgpu-texture';
6
4
  /**
7
5
  * Create new textures with correct size for all attachments.
8
6
  * @note resize() destroys existing textures (if size has changed).
9
7
  */
10
8
  export declare class WebGPUFramebuffer extends Framebuffer {
11
9
  readonly device: WebGPUDevice;
12
- colorAttachments: WebGPUTexture[];
13
- depthStencilAttachment: WebGPUTexture | null;
14
- /** Partial render pass descriptor. Used by WebGPURenderPass */
15
- renderPassDescriptor: {
16
- colorAttachments: GPURenderPassColorAttachment[];
17
- depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
18
- };
19
10
  constructor(device: WebGPUDevice, props: FramebufferProps);
20
- /** Create depth stencil texture */
21
- private createDepthStencilTexture;
22
- private createColorTexture;
23
- /**
24
- * Create new textures with correct size for all attachments.
25
- * @note destroys existing textures.
26
- */
27
- protected _resizeAttachments(width: number, height: number): void;
28
11
  }
29
12
  //# sourceMappingURL=webgpu-framebuffer.d.ts.map
@@ -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,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAM/C;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,gBAAgB,EAAE,aAAa,EAAE,CAAM;IACvC,sBAAsB,EAAE,aAAa,GAAG,IAAI,CAAQ;IAEpD,+DAA+D;IAC/D,oBAAoB,EAAE;QACpB,gBAAgB,EAAE,4BAA4B,EAAE,CAAC;QACjD,sBAAsB,CAAC,EAAE,mCAAmC,CAAC;KAC9D,CAEC;gBAEU,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAiCzD,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
+ {"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAElB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAO1D"}
@@ -1,93 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Framebuffer, Texture } from '@luma.gl/api';
3
- import { WebGPUTexture } from "./webgpu-texture.js";
2
+ import { Framebuffer } from '@luma.gl/api';
4
3
  export class WebGPUFramebuffer extends Framebuffer {
5
4
  constructor(device, props) {
6
5
  super(device, props);
7
6
  _defineProperty(this, "device", void 0);
8
- _defineProperty(this, "colorAttachments", []);
9
- _defineProperty(this, "depthStencilAttachment", null);
10
- _defineProperty(this, "renderPassDescriptor", {
11
- colorAttachments: []
12
- });
13
7
  this.device = device;
14
- if (props.depthStencilAttachment) {
15
- this.depthStencilAttachment = this.createDepthStencilTexture(props);
16
- }
17
- if (props.colorAttachments) {
18
- this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));
19
- }
20
- if (this.depthStencilAttachment) {
21
- this.renderPassDescriptor.depthStencilAttachment = {
22
- view: this.depthStencilAttachment.handle.createView(),
23
- depthClearValue: 1.0,
24
- depthStoreOp: 'store',
25
- stencilClearValue: 0,
26
- stencilStoreOp: 'store'
27
- };
28
- }
29
- if (this.colorAttachments.length > 0) {
30
- this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({
31
- view: colorAttachment.handle.createView(),
32
- loadOp: 'clear',
33
- loadValue: [0.0, 0.0, 0.0, 0.0],
34
- storeOp: 'store'
35
- }));
36
- }
37
- }
38
- createDepthStencilTexture(props) {
39
- if (props.depthStencilAttachment instanceof WebGPUTexture) {
40
- return props.depthStencilAttachment;
41
- }
42
- if (typeof props.depthStencilAttachment === 'string') {
43
- return this.device._createTexture({
44
- id: 'depth-stencil-attachment',
45
- format: props.depthStencilAttachment,
46
- width: props.width,
47
- height: props.height,
48
- usage: Texture.RENDER_ATTACHMENT
49
- });
50
- }
51
- throw new Error('type');
52
- }
53
- createColorTexture(props, texture) {
54
- if (texture instanceof WebGPUTexture) {
55
- return texture;
56
- }
57
- if (typeof texture === 'string') {
58
- return this.device._createTexture({
59
- id: 'color-attachment',
60
- format: texture,
61
- width: props.width,
62
- height: props.height,
63
- usage: Texture.RENDER_ATTACHMENT
64
- });
65
- }
66
- throw new Error('type');
67
- }
68
- _resizeAttachments(width, height) {
69
- for (let i = 0; i < this.colorAttachments.length; ++i) {
70
- if (this.colorAttachments[i]) {
71
- const resizedTexture = this.device._createTexture({
72
- ...this.colorAttachments[i].props,
73
- width,
74
- height
75
- });
76
- this.colorAttachments[i].destroy();
77
- this.colorAttachments[i] = resizedTexture;
78
- this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();
79
- }
80
- }
81
- if (this.depthStencilAttachment) {
82
- const resizedTexture = this.device._createTexture({
83
- ...this.depthStencilAttachment.props,
84
- width,
85
- height
86
- });
87
- this.depthStencilAttachment.destroy();
88
- this.depthStencilAttachment = resizedTexture;
89
- this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();
90
- }
8
+ this.autoCreateAttachmentTextures();
91
9
  }
92
10
  }
93
11
  //# sourceMappingURL=webgpu-framebuffer.js.map
@@ -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';\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 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.create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C,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","WebGPUFramebuffer","constructor","device","props","_defineProperty","autoCreateAttachmentTextures"],"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"sourcesContent":["import type {FramebufferProps} from '@luma.gl/api';\nimport {Framebuffer} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n // Auto create textures for attachments if needed\n this.autoCreateAttachmentTextures();\n }\n}\n"],"mappings":";AACA,SAAQA,WAAW,QAAO,cAAc;AAOxC,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAC;EAGjDE,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAGpB,IAAI,CAACG,4BAA4B,EAAE;EACrC;AACF"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="dist" />
2
- import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/api';
2
+ import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/api';
3
3
  import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/api';
4
4
  import { WebGPUDevice } from '../webgpu-device';
5
5
  import { WebGPURenderPipeline } from './webgpu-render-pipeline';
@@ -30,5 +30,10 @@ export declare class WebGPURenderPass extends RenderPass {
30
30
  pushDebugGroup(groupLabel: string): void;
31
31
  popDebugGroup(): void;
32
32
  insertDebugMarker(markerLabel: string): void;
33
+ /**
34
+ * Partial render pass descriptor. Used by WebGPURenderPass.
35
+ * @returns attachments fields of a renderpass descriptor.
36
+ */
37
+ protected getRenderPassDescriptor(framebuffer: Framebuffer): GPURenderPassDescriptor;
33
38
  }
34
39
  //# sourceMappingURL=webgpu-render-pass.d.ts.map
@@ -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,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAO,MAAM,cAAc,CAAC;AACtE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,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;IAc5C;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,uBAAuB;CAuBrF"}
@@ -9,7 +9,7 @@ export class WebGPURenderPass extends RenderPass {
9
9
  _defineProperty(this, "pipeline", null);
10
10
  this.device = device;
11
11
  const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
12
- const renderPassDescriptor = framebuffer.renderPassDescriptor;
12
+ const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
13
13
  this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
14
14
  this.handle.label = this.props.id;
15
15
  }
@@ -75,5 +75,23 @@ export class WebGPURenderPass extends RenderPass {
75
75
  insertDebugMarker(markerLabel) {
76
76
  this.handle.insertDebugMarker(markerLabel);
77
77
  }
78
+ getRenderPassDescriptor(framebuffer) {
79
+ const renderPassDescriptor = {
80
+ colorAttachments: []
81
+ };
82
+ renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(colorAttachment => ({
83
+ loadOp: 'clear',
84
+ colorClearValue: this.props.clearColor || [0, 0, 0, 0],
85
+ storeOp: this.props.discard ? 'discard' : 'store',
86
+ view: colorAttachment.handle.createView()
87
+ }));
88
+ if (framebuffer.depthStencilAttachment) {
89
+ renderPassDescriptor.depthStencilAttachment = {
90
+ ...this.props,
91
+ view: framebuffer.depthStencilAttachment.handle.createView()
92
+ };
93
+ }
94
+ return renderPassDescriptor;
95
+ }
78
96
  }
79
97
  //# sourceMappingURL=webgpu-render-pass.js.map
@@ -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 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,OAAO,MAAMC,gBAAgB,SAASF,UAAU,CAAC;EAO/CG,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,WAAW,CAACG,oBAAoB;IAC7D,IAAI,CAACC,MAAM,GAAG,IAAI,CAACT,KAAK,CAACS,MAAM,IAAIV,MAAM,CAACW,cAAc,CAACC,eAAe,CAACH,oBAAoB,CAAC;IAC9F,IAAI,CAACC,MAAM,CAACG,KAAK,GAAG,IAAI,CAACZ,KAAK,CAACa,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,GAAGA,CAAA,EAAS;IACV,IAAI,CAACN,MAAM,CAACM,GAAG,EAAE;EACnB;EAEAC,WAAWA,CAACC,QAAwB,EAAQ;IAC1C,IAAI,CAACA,QAA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AU,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","getRenderPassDescriptor","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","colorAttachments","map","colorAttachment","loadOp","colorClearValue","clearColor","storeOp","discard","view","createView","depthStencilAttachment"],"sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"sourcesContent":["import type {RenderPassProps, RenderPassParameters, Binding, Framebuffer} from '@luma.gl/api';\nimport {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPURenderPipeline} from './webgpu-render-pipeline';\n\nexport class WebGPURenderPass extends RenderPass {\n readonly device: WebGPUDevice;\n readonly handle: GPURenderPassEncoder;\n\n /** Active pipeline */\n pipeline: WebGPURenderPipeline | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPassProps = {}) {\n super(device, props);\n this.device = device;\n const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer() ;\n const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);\n 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 // INTERNAL\n\n /** \n * Partial render pass descriptor. Used by WebGPURenderPass.\n * @returns attachments fields of a renderpass descriptor. \n */\n protected getRenderPassDescriptor(framebuffer: Framebuffer): GPURenderPassDescriptor {\n const renderPassDescriptor: GPURenderPassDescriptor = {\n colorAttachments: []\n };\n\n renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(colorAttachment => ({\n // clear values\n loadOp: 'clear',\n colorClearValue: this.props.clearColor || [0, 0, 0, 0],\n storeOp: this.props.discard? 'discard': 'store',\n // ...colorAttachment,\n view: (colorAttachment as WebGPUTexture).handle.createView()\n }));\n\n if (framebuffer.depthStencilAttachment) {\n renderPassDescriptor.depthStencilAttachment = {\n ...this.props,\n view: (framebuffer.depthStencilAttachment as WebGPUTexture).handle.createView()\n };\n }\n\n return renderPassDescriptor;\n }\n}\n"],"mappings":";AACA,SAAgBA,UAAU,EAAkBC,IAAI,QAAO,cAAc;AAOrE,OAAO,MAAMC,gBAAgB,SAASF,UAAU,CAAC;EAO/CG,WAAWA,CAACC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KAAK,CAAC+D,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;MACtDC,OAAO,EAAE,IAAI,CAAChE,KAAK,CAACiE,OAAO,GAAE,SAAS,GAAE,OAAO;MAE/CC,IAAI,EAAGN,eAAe,CAAmBlD,MAAM,CAACyD,UAAU;IAC5D,CAAC,CAAC,CAAC;IAEH,IAAI9D,WAAW,CAAC+D,sBAAsB,EAAE;MACtC5D,oBAAoB,CAAC4D,sBAAsB,GAAG;QAC5C,GAAG,IAAI,CAACpE,KAAK;QACbkE,IAAI,EAAG7D,WAAW,CAAC+D,sBAAsB,CAAmB1D,MAAM,CAACyD,UAAU;MAC/E,CAAC;IACH;IAEA,OAAO3D,oBAAoB;EAC7B;AACF"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import { Sampler, SamplerProps } from '@luma.gl/api';
3
3
  import type { WebGPUDevice } from '../webgpu-device';
4
- export declare type WebGPUSamplerProps = SamplerProps & {
4
+ export type WebGPUSamplerProps = SamplerProps & {
5
5
  handle?: GPUSampler;
6
6
  };
7
7
  /**
@@ -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,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAEnD,oBAAY,kBAAkB,GAAG,YAAY,GAAG;IAC9C,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAA;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,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,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAA;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,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"}
@@ -2,7 +2,7 @@
2
2
  import type { ShaderProps, CompilerMessage } from '@luma.gl/api';
3
3
  import { Shader } from '@luma.gl/api';
4
4
  import type { WebGPUDevice } from '../webgpu-device';
5
- export declare type WebGPUShaderProps = ShaderProps & {
5
+ export type WebGPUShaderProps = ShaderProps & {
6
6
  handle?: GPUShaderModule;
7
7
  };
8
8
  /**
@@ -1 +1 @@
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,qBAAa,YAAa,SAAQ,MAAM;IACtC,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,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAa,SAAQ,MAAM;IACtC,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"}
@@ -22,7 +22,8 @@ export class WebGPUShader extends Shader {
22
22
  destroy() {}
23
23
  createHandle() {
24
24
  const {
25
- source
25
+ source,
26
+ stage
26
27
  } = this.props;
27
28
  let language = this.props.language;
28
29
  if (!language) {
@@ -36,7 +37,7 @@ export class WebGPUShader extends Shader {
36
37
  case 'glsl':
37
38
  return this.device.handle.createShaderModule({
38
39
  code: source,
39
- transform: glsl => this.device.glslang.compileGLSL(glsl, type)
40
+ transform: glsl => this.device.glslang.compileGLSL(glsl, stage)
40
41
  });
41
42
  default:
42
43
  throw new Error(language);
@@ -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":["// 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 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,OAAO,MAAMC,YAAY,SAASF,MAAM,CAAC;EAIvCG,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
+ {"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","stage","language","includes","createShaderModule","code","transform","glsl","glslang","compileGLSL","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 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, stage} = 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, stage)\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,OAAO,MAAMC,YAAY,SAASF,MAAM,CAAC;EAIvCG,WAAWA,CAACC,MAAoB,EAAEC,KAAwB,EAAE;IAC1D,KAAK,CAACD,MAAM,EAA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ClB,MAAM,CAACG,MAAM,CAACmB,kBAAkB,CAAC;UAC3CC,IAAI,EAAEL,MAAM;UAEZM,SAAS,EAAGC,IAAI,IAAK,IAAI,CAACzB,MAAM,CAAC0B,OAAO,CAACC,WAAW,CAACF,IAAI,EAAEN,KAAK;QAClE,CAAC,CAAC;MACJ;QACE,MAAM,IAAIH,KAAK,CAACI,QAAQ,CAAC;IAAC;EAEhC;EAGA,MAAMP,eAAeA,CAAA,EAAwC;IAC3D,MAAMA,eAAe,GAAG,MAAM,IAAI,CAACV,MAAM,CAACyB,kBAAkB,EAAE;IAC9D,OAAOf,eAAe,CAACgB,QAAQ;EACjC;AACF"}
@@ -1,5 +1,4 @@
1
1
  /// <reference types="dist" />
2
- /// <reference types="offscreencanvas" />
3
2
  import { Texture, TextureProps, Sampler, SamplerProps } from '@luma.gl/api';
4
3
  import type { WebGPUDevice } from '../webgpu-device';
5
4
  import { WebGPUSampler } from './webgpu-sampler';
@@ -8,6 +7,8 @@ export declare class WebGPUTexture extends Texture {
8
7
  readonly handle: GPUTexture;
9
8
  readonly view: GPUTextureView;
10
9
  sampler: WebGPUSampler;
10
+ height: number;
11
+ width: number;
11
12
  constructor(device: WebGPUDevice, props: TextureProps);
12
13
  protected createHandle(): GPUTexture;
13
14
  destroy(): void;
@@ -18,7 +19,10 @@ export declare class WebGPUTexture extends Texture {
18
19
  setSampler(sampler: Sampler | SamplerProps): this;
19
20
  setData(options: {
20
21
  data: any;
21
- }): this;
22
+ }): {
23
+ width: number;
24
+ height: number;
25
+ };
22
26
  /** Set image */
23
27
  setImage(options: {
24
28
  source: ImageBitmap | HTMLCanvasElement | OffscreenCanvas;
@@ -34,6 +38,9 @@ export declare class WebGPUTexture extends Texture {
34
38
  aspect?: 'all' | 'stencil-only' | 'depth-only';
35
39
  colorSpace?: 'srgb';
36
40
  premultipliedAlpha?: boolean;
37
- }): this;
41
+ }): {
42
+ width: number;
43
+ height: number;
44
+ };
38
45
  }
39
46
  //# sourceMappingURL=webgp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,CAAC,CAAC,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;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;CA6HpC"}
@@ -17,6 +17,8 @@ export class WebGPUTexture extends Texture {
17
17
  _defineProperty(this, "handle", void 0);
18
18
  _defineProperty(this, "view", void 0);
19
19
  _defineProperty(this, "sampler", void 0);
20
+ _defineProperty(this, "height", void 0);
21
+ _defineProperty(this, "width", void 0);
20
22
  if (typeof this.props.format === 'number') {
21
23
  throw new Error('number format');
22
24
  }
@@ -27,6 +29,8 @@ export class WebGPUTexture extends Texture {
27
29
  data: this.props.data
28
30
  });
29
31
  }
32
+ this.width = this.handle.width;
33
+ this.height = this.handle.height;
30
34
  this.sampler = props.sampler instanceof WebGPUSampler ? props.sampler : new WebGPUSampler(this.device, props.sampler);
31
35
  this.view = this.handle.createView({});
32
36
  }
@@ -89,7 +93,10 @@ export class WebGPUTexture extends Texture {
89
93
  colorSpace,
90
94
  premultipliedAlpha
91
95
  }, [width, height, depth]);
92
- return this;
96
+ return {
97
+ width,
98
+ height
99
+ };
93
100
  }
94
101
  }
95
102
  //# sourceMappingURL=webgpu-texture.js.map
@@ -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 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,SAEtBC,aAAa;AAErB,MAAMC,eAAmD,GAAG;EAC1D,IAAI,EAAE,IAAI;EACV,IAAI,EAAE,IAAI;EACV,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,IAAI;EACZ,YAAY,EAAE,IAAI;EAClB,IAAI,EAAE;A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AAQ,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","width","height","sampler","view","createView","_this$props$data","_this$props$data2","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 class WebGPUTexture extends Texture {\n readonly device: WebGPUDevice;\n readonly handle: GPUTexture;\n readonly view: GPUTextureView;\n sampler: WebGPUSampler;\n\n override height: number;\n override width: number;\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 this.width = this.handle.width;\n this.height = this.handle.height;\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 }): {width: number, height: number} {\n const {\n source,\n width = options.source.width,\n height = options.source.height,\n depth = 1,\n sourceX = 0,\n sourceY = 0,\n mipLevel = 0,\n x = 0,\n y = 0,\n z = 0,\n aspect = 'all',\n colorSpace = 'srgb',\n premultipliedAlpha = false\n } = options;\n\n // TODO - max out width\n\n this.device.handle.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source,\n origin: [sourceX, sourceY]\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: this.handle,\n origin: [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [\n width,\n height,\n depth\n ]\n );\n return {width, height};\n }\n\n /*\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,SAEtBC,aAAa;AAErB,MAAMC,eAAmD,GAAG;EAC1D,IAAI,EAAE,IAAI;EACV,IAAI,EAAE,IAAI;EACV,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,IAAI;EACZ,YAAY,EAAE,IAAI;EAClB,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,aAAa,SAASJ,OAAO,CAAC;EAgBzCK,WAAWA,CAACC,MAAoB,EAAEC,KAAmB,EAAE;IACrD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAErB,IAAI,OAAO,IAAI,CAACD,KAAK,CAACE,MAAM,KAAK,QAAQ,EAAE;MACzC,MAAM,IAAIC,KAAK,CA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ACvB,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,CACE9B,KAAK,EACLC,MAAM,EACNS,KAAK,CACN,CACF;IACD,OAAO;MAACV,KAAK;MAAEC;IAAM,CAAC;EACxB;AAmFF"}
@@ -25,6 +25,6 @@ export declare class WebGPUCanvasContext extends CanvasContext {
25
25
  useDevicePixels?: boolean | number;
26
26
  }): void;
27
27
  /** We build render targets on demand (i.e. not when size changes but when about to render) */
28
- _createDepthStencilAttachment(): Texture;
28
+ _createDepthStencilAttachment(): Texture<import("@luma.gl/api").TextureProps>;
29
29
  }
30
30
  //# sourceMappingURL=webgpu-canvas-context.d.ts.map
@@ -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,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAEjE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,kBAAkB,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