@luma.gl/webgpu 9.0.0-alpha.3 → 9.0.0-alpha.30

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 (116) hide show
  1. package/LICENSE +2 -1
  2. package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.d.ts +2 -2
  4. package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
  5. package/dist/adapter/helpers/convert-texture-format.js +0 -1
  6. package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
  7. package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
  8. package/dist/adapter/helpers/generate-mipmaps.js +1 -8
  9. package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
  10. package/dist/adapter/helpers/get-bind-group.d.ts +2 -2
  11. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  12. package/dist/adapter/helpers/get-bind-group.js +1 -10
  13. package/dist/adapter/helpers/get-bind-group.js.map +1 -1
  14. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +2 -2
  15. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
  16. package/dist/adapter/helpers/get-vertex-buffer-layout.js +13 -21
  17. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
  18. package/dist/adapter/helpers/webgpu-parameters.d.ts +2 -2
  19. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  20. package/dist/adapter/helpers/webgpu-parameters.js +50 -47
  21. package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
  22. package/dist/adapter/resources/webgpu-buffer.d.ts +4 -5
  23. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  24. package/dist/adapter/resources/webgpu-buffer.js +13 -27
  25. package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
  26. package/dist/adapter/resources/webgpu-command-encoder.d.ts +6 -15
  27. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  28. package/dist/adapter/resources/webgpu-command-encoder.js +8 -25
  29. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  30. package/dist/adapter/resources/webgpu-compute-pass.d.ts +6 -6
  31. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  32. package/dist/adapter/resources/webgpu-compute-pass.js +12 -24
  33. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
  34. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +4 -4
  35. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  36. package/dist/adapter/resources/webgpu-compute-pipeline.js +4 -8
  37. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
  38. package/dist/adapter/resources/webgpu-external-texture.d.ts +5 -5
  39. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  40. package/dist/adapter/resources/webgpu-external-texture.js +3 -10
  41. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
  42. package/dist/adapter/resources/webgpu-framebuffer.d.ts +4 -21
  43. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  44. package/dist/adapter/resources/webgpu-framebuffer.js +3 -103
  45. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  46. package/dist/adapter/resources/webgpu-query.js.map +1 -1
  47. package/dist/adapter/resources/webgpu-render-pass.d.ts +12 -7
  48. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  49. package/dist/adapter/resources/webgpu-render-pass.js +37 -32
  50. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  51. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +11 -6
  52. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  53. package/dist/adapter/resources/webgpu-render-pipeline.js +29 -44
  54. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
  55. package/dist/adapter/resources/webgpu-sampler.d.ts +5 -5
  56. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  57. package/dist/adapter/resources/webgpu-sampler.js +9 -8
  58. package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
  59. package/dist/adapter/resources/webgpu-shader.d.ts +7 -7
  60. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  61. package/dist/adapter/resources/webgpu-shader.js +6 -19
  62. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  63. package/dist/adapter/resources/webgpu-texture.d.ts +15 -8
  64. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  65. package/dist/adapter/resources/webgpu-texture.js +13 -22
  66. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  67. package/dist/adapter/webgpu-canvas-context.d.ts +8 -10
  68. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  69. package/dist/adapter/webgpu-canvas-context.js +11 -32
  70. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  71. package/dist/adapter/webgpu-device.d.ts +35 -22
  72. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  73. package/dist/adapter/webgpu-device.js +74 -73
  74. package/dist/adapter/webgpu-device.js.map +1 -1
  75. package/dist/adapter/webgpu-types.js.map +1 -1
  76. package/dist/dist.dev.js +3252 -0
  77. package/dist/glsl/glsllang.js +0 -1
  78. package/dist/glsl/glsllang.js.map +1 -1
  79. package/dist/index.cjs +1446 -0
  80. package/dist/index.d.ts +5 -7
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +5 -7
  83. package/dist/index.js.map +1 -1
  84. package/dist.min.js +17 -0
  85. package/package.json +18 -9
  86. package/src/adapter/helpers/accessor-to-format.ts +2 -2
  87. package/src/adapter/helpers/convert-texture-format.ts +1 -1
  88. package/src/adapter/helpers/generate-mipmaps.ts +1 -1
  89. package/src/adapter/helpers/get-bind-group.ts +6 -6
  90. package/src/adapter/helpers/get-vertex-buffer-layout.ts +16 -8
  91. package/src/adapter/helpers/webgpu-parameters.ts +56 -47
  92. package/src/adapter/resources/webgpu-buffer.ts +6 -10
  93. package/src/adapter/resources/webgpu-command-encoder.ts +61 -40
  94. package/src/adapter/resources/webgpu-compute-pass.ts +13 -13
  95. package/src/adapter/resources/webgpu-compute-pipeline.ts +6 -5
  96. package/src/adapter/resources/webgpu-external-texture.ts +5 -5
  97. package/src/adapter/resources/webgpu-framebuffer.ts +8 -109
  98. package/src/adapter/resources/webgpu-query.ts +3 -3
  99. package/src/adapter/resources/webgpu-render-pass.ts +50 -17
  100. package/src/adapter/resources/webgpu-render-pipeline.ts +41 -17
  101. package/src/adapter/resources/webgpu-sampler.ts +12 -5
  102. package/src/adapter/resources/webgpu-shader.ts +11 -9
  103. package/src/adapter/resources/webgpu-texture.ts +15 -8
  104. package/src/adapter/webgpu-canvas-context.ts +20 -15
  105. package/src/adapter/webgpu-device.ts +136 -54
  106. package/src/index.ts +6 -9
  107. package/dist/bundle.d.ts +0 -2
  108. package/dist/bundle.d.ts.map +0 -1
  109. package/dist/bundle.js +0 -5
  110. package/dist/bundle.js.map +0 -1
  111. package/dist/init.d.ts +0 -2
  112. package/dist/init.d.ts.map +0 -1
  113. package/dist/init.js +0 -4
  114. package/dist/init.js.map +0 -1
  115. package/src/bundle.ts +0 -4
  116. package/src/init.ts +0 -4
@@ -1,16 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { ExternalTexture } from '@luma.gl/api';
3
- import WebGPUSampler from './webgpu-sampler';
4
- export default class WebGPUExternalTexture extends ExternalTexture {
2
+ import { ExternalTexture } from '@luma.gl/core';
3
+ import { WebGPUSampler } from "./webgpu-sampler.js";
4
+ export class WebGPUExternalTexture extends ExternalTexture {
5
5
  constructor(device, props) {
6
6
  super(device, props);
7
-
8
7
  _defineProperty(this, "device", void 0);
9
-
10
8
  _defineProperty(this, "handle", void 0);
11
-
12
9
  _defineProperty(this, "sampler", void 0);
13
-
14
10
  this.device = device;
15
11
  this.handle = this.props.handle || this.device.handle.importExternalTexture({
16
12
  source: props.source,
@@ -18,13 +14,10 @@ export default class WebGPUExternalTexture extends ExternalTexture {
18
14
  });
19
15
  this.sampler = null;
20
16
  }
21
-
22
17
  destroy() {}
23
-
24
18
  setSampler(sampler) {
25
19
  this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
26
20
  return this;
27
21
  }
28
-
29
22
  }
30
23
  //# sourceMappingURL=webgpu-external-texture.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","handle","importExternalTexture","source","colorSpace","sampler","destroy","setSampler"],"mappings":";AACA,SAAQA,eAAR,QAA2E,cAA3E;AAEA,OAAOC,aAAP,MAA0B,kBAA1B;AAMA,eAAe,MAAMC,qBAAN,SAAoCF,eAApC,CAAoD;AAKjEG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAoD;AAC7D,UAAMD,MAAN,EAAcC,KAAd;;AAD6D;;AAAA;;AAAA;;AAE7D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,MAAL,GAAc,KAAKD,KAAL,CAAWC,MAAX,IAAqB,KAAKF,MAAL,CAAYE,MAAZ,CAAmBC,qBAAnB,CAAyC;AAC1EC,MAAAA,MAAM,EAAEH,KAAK,CAACG,MAD4D;AAE1EC,MAAAA,UAAU,EAAEJ,KAAK,CAACI;AAFwD,KAAzC,CAAnC;AAIA,SAAKC,OAAL,GAAe,IAAf;AACD;;AAEDC,EAAAA,OAAO,GAAS,CAIf;;AAGDC,EAAAA,UAAU,CAACF,OAAD,EAAwC;AAEhD,SAAKA,OAAL,GAAeA,OAAO,YAAYT,aAAnB,GAAmCS,OAAnC,GAA6C,IAAIT,aAAJ,CAAkB,KAAKG,MAAvB,EAA+BM,OAA/B,CAA5D;AACA,WAAO,IAAP;AACD;;AA1BgE","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 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"],"file":"webgpu-external-texture.js"}
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/core';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\n\n/**\n * Cheap, temporary texture view for videos\n * Only valid within same callback, destroyed automatically as a microtask.\n */\nexport class WebGPUExternalTexture extends ExternalTexture {\n readonly device: WebGPUDevice;\n readonly handle: GPUExternalTexture;\n sampler: WebGPUSampler;\n\n constructor(device: WebGPUDevice, props: ExternalTextureProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.handle.importExternalTexture({\n source: props.source,\n colorSpace: props.colorSpace\n });\n this.sampler = null;\n }\n\n override destroy(): void {\n // External textures are destroyed automatically,\n // as a microtask, instead of manually or upon garbage collection like other resources.\n // this.handle.destroy();\n }\n\n /** Set default sampler */\n setSampler(sampler: Sampler | SamplerProps): this {\n // We can accept a sampler instance or set of props;\n this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n}\n"],"mappings":";AACA,SAAQA,eAAe,QAAoD,eAAe;AAAC,SAEnFC,aAAa;AAMrB,OAAO,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAKzDG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;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,29 +1,12 @@
1
- /// <reference types="@webgpu/types" />
2
- import type { FramebufferProps } from '@luma.gl/api';
3
- import { Framebuffer } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
5
- import WebGPUTexture from './webgpu-texture';
1
+ import type { FramebufferProps } from '@luma.gl/core';
2
+ import { Framebuffer } from '@luma.gl/core';
3
+ import { WebGPUDevice } from '../webgpu-device';
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
- export default class WebGPUFramebuffer extends Framebuffer {
8
+ export declare class WebGPUFramebuffer extends Framebuffer {
11
9
  readonly device: WebGPUDevice;
12
- colorAttachments: WebGPUTexture[];
13
- depthStencilAttachment: WebGPUTexture;
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,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,gBAAgB,EAAE,aAAa,EAAE,CAAM;IACvC,sBAAsB,EAAE,aAAa,CAAC;IAEtC,+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;IAgCzD,mCAAmC;IACnC,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,kBAAkB;IAkB1B;;;OAGG;IACF,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAiBnE"}
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,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,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,111 +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';
4
- const MAX_COLOR_ATTACHMENTS = 8;
5
- export default class WebGPUFramebuffer extends Framebuffer {
2
+ import { Framebuffer } from '@luma.gl/core';
3
+ export class WebGPUFramebuffer extends Framebuffer {
6
4
  constructor(device, props) {
7
5
  super(device, props);
8
-
9
6
  _defineProperty(this, "device", void 0);
10
-
11
- _defineProperty(this, "colorAttachments", []);
12
-
13
- _defineProperty(this, "depthStencilAttachment", void 0);
14
-
15
- _defineProperty(this, "renderPassDescriptor", {
16
- colorAttachments: []
17
- });
18
-
19
7
  this.device = device;
20
-
21
- if (props.depthStencilAttachment) {
22
- this.depthStencilAttachment = this.createDepthStencilTexture(props);
23
- }
24
-
25
- if (props.colorAttachments) {
26
- this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));
27
- }
28
-
29
- if (this.depthStencilAttachment) {
30
- this.renderPassDescriptor.depthStencilAttachment = {
31
- view: this.depthStencilAttachment.handle.createView(),
32
- depthLoadValue: 1.0,
33
- depthStoreOp: 'store',
34
- stencilLoadValue: 0,
35
- stencilStoreOp: 'store'
36
- };
37
- }
38
-
39
- if (this.colorAttachments.length > 0) {
40
- this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({
41
- view: colorAttachment.handle.createView(),
42
- loadValue: [0.0, 0.0, 0.0, 0.0],
43
- storeOp: 'store'
44
- }));
45
- }
8
+ this.autoCreateAttachmentTextures();
46
9
  }
47
-
48
- createDepthStencilTexture(props) {
49
- if (props.depthStencilAttachment instanceof WEBGPUTexture) {
50
- return props.depthStencilAttachment;
51
- }
52
-
53
- if (typeof props.depthStencilAttachment === 'string') {
54
- return this.device._createTexture({
55
- id: 'depth-stencil-attachment',
56
- format: props.depthStencilAttachment,
57
- width: props.width,
58
- height: props.height,
59
- usage: Texture.RENDER_ATTACHMENT
60
- });
61
- }
62
-
63
- throw new Error('type');
64
- }
65
-
66
- createColorTexture(props, texture) {
67
- if (texture instanceof WEBGPUTexture) {
68
- return texture;
69
- }
70
-
71
- if (typeof texture === 'string') {
72
- return this.device._createTexture({
73
- id: 'color-attachment',
74
- format: texture,
75
- width: props.width,
76
- height: props.height,
77
- usage: Texture.RENDER_ATTACHMENT
78
- });
79
- }
80
-
81
- throw new Error('type');
82
- }
83
-
84
- _resizeAttachments(width, height) {
85
- for (let i = 0; i < this.colorAttachments.length; ++i) {
86
- if (this.colorAttachments[i]) {
87
- const resizedTexture = this.device._createTexture({ ...this.colorAttachments[i].props,
88
- width,
89
- height
90
- });
91
-
92
- this.colorAttachments[i].destroy();
93
- this.colorAttachments[i] = resizedTexture;
94
- this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();
95
- }
96
- }
97
-
98
- if (this.depthStencilAttachment) {
99
- const resizedTexture = this.device._createTexture({ ...this.depthStencilAttachment.props,
100
- width,
101
- height
102
- });
103
-
104
- this.depthStencilAttachment.destroy();
105
- this.depthStencilAttachment = resizedTexture;
106
- this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();
107
- }
108
- }
109
-
110
10
  }
111
11
  //# sourceMappingURL=webgpu-framebuffer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":["Framebuffer","Texture","WEBGPUTexture","MAX_COLOR_ATTACHMENTS","WebGPUFramebuffer","constructor","device","props","colorAttachments","depthStencilAttachment","createDepthStencilTexture","map","colorAttachment","createColorTexture","renderPassDescriptor","view","handle","createView","depthLoadValue","depthStoreOp","stencilLoadValue","stencilStoreOp","length","loadValue","storeOp","_createTexture","id","format","width","height","usage","RENDER_ATTACHMENT","Error","texture","_resizeAttachments","i","resizedTexture","destroy"],"mappings":";AACA,SAAQA,WAAR,EAAqBC,OAArB,QAAmC,cAAnC;AAGA,OAAOC,aAAP,MAA0B,kBAA1B;AAKA,MAAMC,qBAAqB,GAAG,CAA9B;AAMA,eAAe,MAAMC,iBAAN,SAAgCJ,WAAhC,CAA4C;AAczDK,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAgD;AACzD,UAAMD,MAAN,EAAcC,KAAd;;AADyD;;AAAA,8CAXvB,EAWuB;;AAAA;;AAAA,kDAJvD;AACFC,MAAAA,gBAAgB,EAAE;AADhB,KAIuD;;AAEzD,SAAKF,MAAL,GAAcA,MAAd;;AAEA,QAAIC,KAAK,CAACE,sBAAV,EAAkC;AAChC,WAAKA,sBAAL,GAA8B,KAAKC,yBAAL,CAA+BH,KAA/B,CAA9B;AACD;;AAED,QAAIA,KAAK,CAACC,gBAAV,EAA4B;AAC1B,WAAKA,gBAAL,GAAwBD,KAAK,CAACC,gBAAN,CAAuBG,GAAvB,CAA2BC,eAAe,IAAI,KAAKC,kBAAL,CAAwB,KAAKN,KAA7B,EAAoCK,eAApC,CAA9C,CAAxB;AACD;;AAED,QAAI,KAAKH,sBAAT,EAAiC;AAC/B,WAAKK,oBAAL,CAA0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G,KAAKhB,sBAAL,CAA4BF,KAAhC;AAAuCqB,QAAAA,KAAvC;AAA8CC,QAAAA;AAA9C,OAA3B,CAAvB;;AACA,WAAKpB,sBAAL,CAA4B4B,OAA5B;AACA,WAAK5B,sBAAL,GAA8B2B,cAA9B;AACA,WAAKtB,oBAAL,CAA0BL,sBAA1B,CAAiDM,IAAjD,GAAwDqB,cAAc,CAACpB,MAAf,CAAsBC,UAAtB,EAAxD;AACF;AACF;;AAvGwD","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\nconst 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;\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 depthLoadValue: 1.0,\n depthStoreOp: 'store',\n stencilLoadValue: 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 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"],"file":"webgpu-framebuffer.js"}
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/core';\nimport {Framebuffer} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n // Auto create textures for attachments if needed\n this.autoCreateAttachmentTextures();\n }\n}\n"],"mappings":";AACA,SAAQA,WAAW,QAAO,eAAe;AAOzC,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAC;EAGjDE,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAGpB,IAAI,CAACG,4BAA4B,CAAC,CAAC;EACrC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"webgpu-query.js"}
1
+ {"version":3,"file":"webgpu-query.js","names":[],"sources":["../../../src/adapter/resources/webgpu-query.ts"],"sourcesContent":["/*\nimport {Resource, Query, QueryProps} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUQueryProps = QueryProps & {\n handle?: any;\n};\n\nconst DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {\n id: undefined,\n handle: undefined,\n userData: undefined,\n type: 'timestamp',\n count: 1,\n pipelineStatistics: []\n};\n\n/**\n * Immutable\n *\nclass WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {\n readonly device: WebGPUDevice;\n readonly handle: GPUQuerySet;\n\n constructor(device: WebGPUDevice, props: WebGPUQueryProps) {\n super(device, props, DEFAULT_QUERY_PROPS);\n this.handle = this.props.handle as GPUQuerySet || this.createHandle();\n this.handle.label = this.props.id;\n }\n\n protected createHandle() {\n return this.device.handle.createQuerySet({\n type: this.props.type,\n count: this.props.count,\n pipelineStatistics: this.props.pipelineStatistics\n });\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n}\n*/"],"mappings":""}
@@ -1,16 +1,16 @@
1
- /// <reference types="@webgpu/types" />
2
- import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/api';
3
- import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
5
- import WebGPURenderPipeline from './webgpu-render-pipeline';
6
- export default class WebGPURenderPass extends RenderPass {
1
+ /// <reference types="dist" />
2
+ import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/core';
3
+ import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
+ import { WebGPURenderPipeline } from './webgpu-render-pipeline';
6
+ export declare class WebGPURenderPass extends RenderPass {
7
7
  readonly device: WebGPUDevice;
8
8
  readonly handle: GPURenderPassEncoder;
9
9
  /** Active pipeline */
10
10
  pipeline: WebGPURenderPipeline | null;
11
11
  constructor(device: WebGPUDevice, props?: RenderPassProps);
12
12
  destroy(): void;
13
- endPass(): void;
13
+ end(): void;
14
14
  setPipeline(pipeline: RenderPipeline): void;
15
15
  /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
16
16
  setBindings(bindings: Record<string, Binding>): void;
@@ -30,5 +30,10 @@ export default 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
- {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AAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,IAAI;IAIvE,IAAI,CAAC,OAAO,EAAE;QACZ,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;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"}
@@ -1,56 +1,51 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { RenderPass, cast } from '@luma.gl/api';
3
- export default class WebGPURenderPass extends RenderPass {
4
- constructor(device, props = {}) {
2
+ import { RenderPass, cast } from '@luma.gl/core';
3
+ export class WebGPURenderPass extends RenderPass {
4
+ constructor(device) {
5
+ let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5
6
  super(device, props);
6
-
7
7
  _defineProperty(this, "device", void 0);
8
-
9
8
  _defineProperty(this, "handle", void 0);
10
-
11
9
  _defineProperty(this, "pipeline", null);
12
-
13
10
  this.device = device;
14
11
  const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
15
- const renderPassDescriptor = framebuffer.renderPassDescriptor;
12
+ const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
16
13
  this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
17
14
  this.handle.label = this.props.id;
18
15
  }
19
-
20
16
  destroy() {}
21
-
22
- endPass() {
23
- this.handle.endPass();
17
+ end() {
18
+ this.handle.end();
24
19
  }
25
-
26
20
  setPipeline(pipeline) {
27
21
  this.pipeline = cast(pipeline);
28
22
  this.handle.setPipeline(this.pipeline.handle);
29
23
  }
30
-
31
24
  setBindings(bindings) {
32
- this.pipeline.setBindings(bindings);
33
- this.handle.setBindGroup(0, this.pipeline._getBindGroup());
25
+ var _this$pipeline, _this$pipeline2;
26
+ (_this$pipeline = this.pipeline) === null || _this$pipeline === void 0 ? void 0 : _this$pipeline.setBindings(bindings);
27
+ const bindGroup = (_this$pipeline2 = this.pipeline) === null || _this$pipeline2 === void 0 ? void 0 : _this$pipeline2._getBindGroup();
28
+ if (bindGroup) {
29
+ this.handle.setBindGroup(0, bindGroup);
30
+ }
34
31
  }
35
-
36
- setIndexBuffer(buffer, indexFormat, offset = 0, size) {
32
+ setIndexBuffer(buffer, indexFormat) {
33
+ let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
34
+ let size = arguments.length > 3 ? arguments[3] : undefined;
37
35
  this.handle.setIndexBuffer(cast(buffer).handle, indexFormat, offset, size);
38
36
  }
39
-
40
- setVertexBuffer(slot, buffer, offset = 0) {
37
+ setVertexBuffer(slot, buffer) {
38
+ let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
41
39
  this.handle.setVertexBuffer(slot, cast(buffer).handle, offset);
42
40
  }
43
-
44
41
  draw(options) {
45
42
  if (options.indexCount) {
46
43
  this.handle.drawIndexed(options.indexCount, options.instanceCount, options.firstIndex, options.baseVertex, options.firstInstance);
47
44
  } else {
48
- this.handle.draw(options.vertexCount, options.instanceCount, options.firstIndex, options.firstInstance);
45
+ this.handle.draw(options.vertexCount || 0, options.instanceCount, options.firstIndex, options.firstInstance);
49
46
  }
50
47
  }
51
-
52
48
  drawIndirect() {}
53
-
54
49
  setParameters(parameters) {
55
50
  const {
56
51
  blendConstant,
@@ -58,35 +53,45 @@ export default class WebGPURenderPass extends RenderPass {
58
53
  scissorRect,
59
54
  viewport
60
55
  } = parameters;
61
-
62
56
  if (blendConstant) {
63
57
  this.handle.setBlendConstant(blendConstant);
64
58
  }
65
-
66
59
  if (stencilReference) {
67
60
  this.handle.setStencilReference(stencilReference);
68
61
  }
69
-
70
62
  if (scissorRect) {
71
63
  this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
72
64
  }
73
-
74
65
  if (viewport) {
75
66
  this.handle.setViewport(viewport[0], viewport[1], viewport[2], viewport[3], viewport[4], viewport[5]);
76
67
  }
77
68
  }
78
-
79
69
  pushDebugGroup(groupLabel) {
80
70
  this.handle.pushDebugGroup(groupLabel);
81
71
  }
82
-
83
72
  popDebugGroup() {
84
73
  this.handle.popDebugGroup();
85
74
  }
86
-
87
75
  insertDebugMarker(markerLabel) {
88
76
  this.handle.insertDebugMarker(markerLabel);
89
77
  }
90
-
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
+ }
91
96
  }
92
97
  //# sourceMappingURL=webgpu-render-pass.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":["RenderPass","cast","WebGPURenderPass","constructor","device","props","framebuffer","canvasContext","getCurrentFramebuffer","renderPassDescriptor","handle","commandEncoder","beginRenderPass","label","id","destroy","endPass","setPipeline","pipeline","setBindings","bindings","setBindGroup","_getBindGroup","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"],"mappings":";AACA,SAAgBA,UAAhB,EAA4CC,IAA5C,QAA4D,cAA5D;AAMA,eAAe,MAAMC,gBAAN,SAA+BF,UAA/B,CAA0C;AAOvDG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAsB,GAAG,EAAhD,EAAoD;AAC7D,UAAMD,MAAN,EAAcC,KAAd;;AAD6D;;AAAA;;AAAA,sCAFvB,IAEuB;;AAE7D,SAAKD,MAAL,GAAcA,MAAd;AACA,UAAME,WAAW,GAAGD,KAAK,CAACC,WAAN,IAAqBF,MAAM,CAACG,aAAP,CAAqBC,qBAArB,EAAzC;AAEA,UAAMC,oBAAoB,GAAGH,WAAW,CAACG,oBAAzC;AACA,SAAKC,MAAL,GAAc,KAAKL,KAAL,CAAWK,MAAX,IAAqBN,MAAM,CAACO,cAAP,CAAsBC,eAAtB,CAAsCH,oBAAtC,CAAnC;AACA,SAAKC,MAAL,CAAYG,KAAZ,GAAoB,KAAKR,KAAL,CAAWS,EAA/B;AACD;;AAEDC,EAAAA,OAAO,GAAG,CAAE;;AAEZC,EAAAA,OAAO,GAAS;AACd,SAAKN,MAAL,CAAYM,OAAZ;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAiC;AAC1C,SAAKA,QAAL,GAAgBjB,IAAI,CAAuBiB,QAAvB,CAApB;AACA,SAAKR,MAAL,CAAYO,WAAZ,CAAwB,KAAKC,QAAL,CAAcR,MAAtC;AACD;;AAGDS,EAAAA,WAAW,CAACC,QAAD,EAA0C;AACnD,SAAKF,QAAL,CAAcC,WAAd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QAAIC,gBAAJ,EAAsB;AACpB,WAAKjC,MAAL,CAAYqC,mBAAZ,CAAgCJ,gBAAhC;AACD;;AACD,QAAIC,WAAJ,EAAiB;AACf,WAAKlC,MAAL,CAAYsC,cAAZ,CAA2BJ,WAAW,CAAC,CAAD,CAAtC,EAA2CA,WAAW,CAAC,CAAD,CAAtD,EAA2DA,WAAW,CAAC,CAAD,CAAtE,EAA2EA,WAAW,CAAC,CAAD,CAAtF;AACD;;AAED,QAAIC,QAAJ,EAAc;AACZ,WAAKnC,MAAL,CAAYuC,WAAZ,CACEJ,QAAQ,CAAC,CAAD,CADV,EAEEA,QAAQ,CAAC,CAAD,CAFV,EAGEA,QAAQ,CAAC,CAAD,CAHV,EAIEA,QAAQ,CAAC,CAAD,CAJV,EAKEA,QAAQ,CAAC,CAAD,CALV,EAMEA,QAAQ,CAAC,CAAD,CANV;AAQD;AACF;;AAEDK,EAAAA,cAAc,CAACC,UAAD,EAA2B;AACvC,SAAKzC,MAAL,CAAYwC,cAAZ,CAA2BC,UAA3B;AACD;;AACDC,EAAAA,aAAa,GAAS;AACpB,SAAK1C,MAAL,CAAY0C,aAAZ;AACD;;AACDC,EAAAA,iBAAiB,CAACC,WAAD,EAA4B;AAC3C,SAAK5C,MAAL,CAAY2C,iBAAZ,CAA8BC,WAA9B;AACD;;AA/GsD","sourcesContent":["import type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/api';\nimport {Buffer, RenderPass, RenderPipeline, cast, log} 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 destroy() {}\n\n endPass(): void {\n this.handle.endPass();\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 this.handle.setBindGroup(0, this.pipeline._getBindGroup());\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,\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"],"file":"webgpu-render-pass.js"}
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/core';\nimport {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPURenderPipeline} from './webgpu-render-pipeline';\n\nexport class WebGPURenderPass extends RenderPass {\n readonly device: WebGPUDevice;\n readonly handle: GPURenderPassEncoder;\n\n /** Active pipeline */\n pipeline: WebGPURenderPipeline | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPassProps = {}) {\n super(device, props);\n this.device = device;\n const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer() ;\n const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);\n 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,eAAe;AAOtE,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,CAAC,CAAC;IACrF,MAAMC,oBAAoB,GAAG,IAAI,CAACC,uBAAuB,CAACJ,WAAW,CAAC;IACtE,IAAI,CAACK,MAAM,GAAG,IAAI,CAACV,KAAK,CAACU,MAAM,IAAIX,MAAM,CAACY,cAAc,CAACC,eAAe,CAACJ,oBAAoB,CAAC;IAC9F,IAAI,CAACE,MAAM,CAACG,KAAK,GAAG,IAAI,CAACb,KAAK,CAACc,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,GAAGA,CAAA,EAAS;IACV,IAAI,CAACN,MAAM,CAACM,GAAG,CAAC,CAAC;EACnB;EAEAC,WAAWA,CAACC,QAAwB,EAAQ;IAC1C,IAAI,CAACA,QAAQ,GAAGtB,IAAI,CAAuBsB,QAAQ,CAAC;IACpD,IAAI,CAACR,MAAM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MAAM,CAAC6C,aAAa,CAAC,CAAC;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/C,MAAM,CAAC8C,iBAAiB,CAACC,WAAW,CAAC;EAC5C;EAgBUhD,uBAAuBA,CAACJ,WAAwB,EAA2B;IACnF,MAAMG,oBAA6C,GAAG;MACpDkD,gBAAgB,EAAE;IACpB,CAAC;IAEDlD,oBAAoB,CAACkD,gBAAgB,GAAGrD,WAAW,CAACqD,gBAAgB,CAACC,GAAG,CAACC,eAAe,KAAK;MAE3FC,MAAM,EAAE,OAAO;MACfC,eAAe,EAAE,IAAI,CAAC9D,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,CAAC;IAC7D,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,CAAC;MAChF,CAAC;IACH;IAEA,OAAO3D,oBAAoB;EAC7B;AACF"}
@@ -1,12 +1,15 @@
1
- /// <reference types="@webgpu/types" />
2
- import type { Binding, RenderPass } from '@luma.gl/api';
3
- import { Buffer, RenderPipeline, RenderPipelineProps } from '@luma.gl/api';
4
- import type WebGPUDevice from '../webgpu-device';
5
- import type WebGPURenderPass from './webgpu-render-pass';
1
+ /// <reference types="dist" />
2
+ import type { Binding, RenderPass, TypedArray } from '@luma.gl/core';
3
+ import { Buffer, RenderPipeline, RenderPipelineProps } from '@luma.gl/core';
4
+ import type { WebGPUDevice } from '../webgpu-device';
5
+ import type { WebGPUShader } from './webgpu-shader';
6
+ import type { WebGPURenderPass } from './webgpu-render-pass';
6
7
  /** Creates a new render pipeline when parameters change */
7
- export default class WebGPURenderPipeline extends RenderPipeline {
8
+ export declare class WebGPURenderPipeline extends RenderPipeline {
8
9
  device: WebGPUDevice;
9
10
  handle: GPURenderPipeline;
11
+ vs: WebGPUShader;
12
+ fs: WebGPUShader | null;
10
13
  private _bufferSlots;
11
14
  private _buffers;
12
15
  private _indexBuffer;
@@ -18,6 +21,8 @@ export default class WebGPURenderPipeline extends RenderPipeline {
18
21
  destroy(): void;
19
22
  setIndexBuffer(indexBuffer: Buffer): void;
20
23
  setAttributes(attributes: Record<string, Buffer>): void;
24
+ /** Constant attributes are not available in WebGPU */
25
+ setConstantAttributes(attributes: Record<string, TypedArray>): void;
21
26
  /** Set the bindings */
22
27
  setBindings(bindings: Record<string, Binding>): void;
23
28
  setUniforms(uniforms: Record<string, any>): void;
@@ -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,EAA2B,MAAM,cAAc,CAAC;AASnG,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,gBAAgB,MAAM,sBAAsB,CAAC;AAIzD,2DAA2D;AAC3D,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,cAAc;IAC9D,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAE1B,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,YAAY,CAAe;IAInC,4CAA4C;IAC5C,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,UAAU,CAAs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