@luma.gl/webgpu 9.0.0-alpha.2 → 9.0.0-alpha.20

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 (112) hide show
  1. package/LICENSE +32 -0
  2. package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.d.ts +1 -1
  4. package/dist/adapter/helpers/convert-texture-format.js +0 -1
  5. package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
  6. package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
  7. package/dist/adapter/helpers/generate-mipmaps.js +1 -8
  8. package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
  9. package/dist/adapter/helpers/get-bind-group.d.ts +1 -1
  10. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  11. package/dist/adapter/helpers/get-bind-group.js +0 -9
  12. package/dist/adapter/helpers/get-bind-group.js.map +1 -1
  13. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +1 -1
  14. package/dist/adapter/helpers/get-vertex-buffer-layout.js +3 -17
  15. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
  16. package/dist/adapter/helpers/webgpu-parameters.d.ts +1 -1
  17. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  18. package/dist/adapter/helpers/webgpu-parameters.js +50 -47
  19. package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
  20. package/dist/adapter/resources/webgpu-buffer.d.ts +2 -3
  21. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  22. package/dist/adapter/resources/webgpu-buffer.js +11 -25
  23. package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
  24. package/dist/adapter/resources/webgpu-command-encoder.d.ts +2 -3
  25. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  26. package/dist/adapter/resources/webgpu-command-encoder.js +6 -23
  27. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  28. package/dist/adapter/resources/webgpu-compute-pass.d.ts +4 -4
  29. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  30. package/dist/adapter/resources/webgpu-compute-pass.js +10 -22
  31. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
  32. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +2 -2
  33. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  34. package/dist/adapter/resources/webgpu-compute-pipeline.js +2 -6
  35. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
  36. package/dist/adapter/resources/webgpu-external-texture.d.ts +2 -2
  37. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  38. package/dist/adapter/resources/webgpu-external-texture.js +1 -8
  39. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
  40. package/dist/adapter/resources/webgpu-framebuffer.d.ts +3 -3
  41. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  42. package/dist/adapter/resources/webgpu-framebuffer.js +9 -27
  43. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  44. package/dist/adapter/resources/webgpu-query.js.map +1 -1
  45. package/dist/adapter/resources/webgpu-render-pass.d.ts +3 -3
  46. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  47. package/dist/adapter/resources/webgpu-render-pass.js +16 -29
  48. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  49. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +5 -2
  50. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgpu-render-pipeline.js +24 -42
  52. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
  53. package/dist/adapter/resources/webgpu-sampler.d.ts +2 -2
  54. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  55. package/dist/adapter/resources/webgpu-sampler.js +7 -6
  56. package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
  57. package/dist/adapter/resources/webgpu-shader.d.ts +3 -3
  58. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  59. package/dist/adapter/resources/webgpu-shader.js +1 -15
  60. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  61. package/dist/adapter/resources/webgpu-texture.d.ts +2 -2
  62. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  63. package/dist/adapter/resources/webgpu-texture.js +3 -19
  64. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  65. package/dist/adapter/webgpu-canvas-context.d.ts +2 -4
  66. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  67. package/dist/adapter/webgpu-canvas-context.js +8 -29
  68. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  69. package/dist/adapter/webgpu-device.d.ts +8 -8
  70. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  71. package/dist/adapter/webgpu-device.js +42 -71
  72. package/dist/adapter/webgpu-device.js.map +1 -1
  73. package/dist/adapter/webgpu-types.js.map +1 -1
  74. package/dist/dist.dev.js +3061 -0
  75. package/dist/glsl/glsllang.js +0 -1
  76. package/dist/glsl/glsllang.js.map +1 -1
  77. package/dist/index.cjs +1442 -0
  78. package/dist/index.d.ts +1 -3
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +5 -7
  81. package/dist/index.js.map +1 -1
  82. package/dist.min.js +17 -0
  83. package/package.json +18 -9
  84. package/src/adapter/helpers/generate-mipmaps.ts +1 -1
  85. package/src/adapter/helpers/get-bind-group.ts +1 -1
  86. package/src/adapter/helpers/get-vertex-buffer-layout.ts +3 -3
  87. package/src/adapter/helpers/webgpu-parameters.ts +55 -46
  88. package/src/adapter/resources/webgpu-buffer.ts +5 -9
  89. package/src/adapter/resources/webgpu-command-encoder.ts +16 -14
  90. package/src/adapter/resources/webgpu-compute-pass.ts +8 -8
  91. package/src/adapter/resources/webgpu-compute-pipeline.ts +3 -2
  92. package/src/adapter/resources/webgpu-external-texture.ts +2 -2
  93. package/src/adapter/resources/webgpu-framebuffer.ts +11 -10
  94. package/src/adapter/resources/webgpu-query.ts +2 -2
  95. package/src/adapter/resources/webgpu-render-pass.ts +11 -8
  96. package/src/adapter/resources/webgpu-render-pipeline.ts +28 -11
  97. package/src/adapter/resources/webgpu-sampler.ts +10 -3
  98. package/src/adapter/resources/webgpu-shader.ts +6 -4
  99. package/src/adapter/resources/webgpu-texture.ts +5 -4
  100. package/src/adapter/webgpu-canvas-context.ts +12 -8
  101. package/src/adapter/webgpu-device.ts +51 -38
  102. package/src/index.ts +2 -5
  103. package/dist/bundle.d.ts +0 -2
  104. package/dist/bundle.d.ts.map +0 -1
  105. package/dist/bundle.js +0 -5
  106. package/dist/bundle.js.map +0 -1
  107. package/dist/init.d.ts +0 -2
  108. package/dist/init.d.ts.map +0 -1
  109. package/dist/init.js +0 -4
  110. package/dist/init.js.map +0 -1
  111. package/src/bundle.ts +0 -4
  112. package/src/init.ts +0 -4
@@ -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,EAAqB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAU,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAG9C,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,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,55 +1,44 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { Framebuffer, Texture } from '@luma.gl/api';
3
- import WEBGPUTexture from './webgpu-texture';
4
- const MAX_COLOR_ATTACHMENTS = 8;
3
+ import WEBGPUTexture from "./webgpu-texture.js";
5
4
  export default class WebGPUFramebuffer extends Framebuffer {
6
5
  constructor(device, props) {
7
6
  super(device, props);
8
-
9
7
  _defineProperty(this, "device", void 0);
10
-
11
8
  _defineProperty(this, "colorAttachments", []);
12
-
13
- _defineProperty(this, "depthStencilAttachment", void 0);
14
-
9
+ _defineProperty(this, "depthStencilAttachment", null);
15
10
  _defineProperty(this, "renderPassDescriptor", {
16
11
  colorAttachments: []
17
12
  });
18
-
19
13
  this.device = device;
20
-
21
14
  if (props.depthStencilAttachment) {
22
15
  this.depthStencilAttachment = this.createDepthStencilTexture(props);
23
16
  }
24
-
25
17
  if (props.colorAttachments) {
26
18
  this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));
27
19
  }
28
-
29
20
  if (this.depthStencilAttachment) {
30
21
  this.renderPassDescriptor.depthStencilAttachment = {
31
22
  view: this.depthStencilAttachment.handle.createView(),
32
- depthLoadValue: 1.0,
23
+ depthClearValue: 1.0,
33
24
  depthStoreOp: 'store',
34
- stencilLoadValue: 0,
25
+ stencilClearValue: 0,
35
26
  stencilStoreOp: 'store'
36
27
  };
37
28
  }
38
-
39
29
  if (this.colorAttachments.length > 0) {
40
30
  this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({
41
31
  view: colorAttachment.handle.createView(),
32
+ loadOp: 'clear',
42
33
  loadValue: [0.0, 0.0, 0.0, 0.0],
43
34
  storeOp: 'store'
44
35
  }));
45
36
  }
46
37
  }
47
-
48
38
  createDepthStencilTexture(props) {
49
39
  if (props.depthStencilAttachment instanceof WEBGPUTexture) {
50
40
  return props.depthStencilAttachment;
51
41
  }
52
-
53
42
  if (typeof props.depthStencilAttachment === 'string') {
54
43
  return this.device._createTexture({
55
44
  id: 'depth-stencil-attachment',
@@ -59,15 +48,12 @@ export default class WebGPUFramebuffer extends Framebuffer {
59
48
  usage: Texture.RENDER_ATTACHMENT
60
49
  });
61
50
  }
62
-
63
51
  throw new Error('type');
64
52
  }
65
-
66
53
  createColorTexture(props, texture) {
67
54
  if (texture instanceof WEBGPUTexture) {
68
55
  return texture;
69
56
  }
70
-
71
57
  if (typeof texture === 'string') {
72
58
  return this.device._createTexture({
73
59
  id: 'color-attachment',
@@ -77,35 +63,31 @@ export default class WebGPUFramebuffer extends Framebuffer {
77
63
  usage: Texture.RENDER_ATTACHMENT
78
64
  });
79
65
  }
80
-
81
66
  throw new Error('type');
82
67
  }
83
-
84
68
  _resizeAttachments(width, height) {
85
69
  for (let i = 0; i < this.colorAttachments.length; ++i) {
86
70
  if (this.colorAttachments[i]) {
87
- const resizedTexture = this.device._createTexture({ ...this.colorAttachments[i].props,
71
+ const resizedTexture = this.device._createTexture({
72
+ ...this.colorAttachments[i].props,
88
73
  width,
89
74
  height
90
75
  });
91
-
92
76
  this.colorAttachments[i].destroy();
93
77
  this.colorAttachments[i] = resizedTexture;
94
78
  this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();
95
79
  }
96
80
  }
97
-
98
81
  if (this.depthStencilAttachment) {
99
- const resizedTexture = this.device._createTexture({ ...this.depthStencilAttachment.props,
82
+ const resizedTexture = this.device._createTexture({
83
+ ...this.depthStencilAttachment.props,
100
84
  width,
101
85
  height
102
86
  });
103
-
104
87
  this.depthStencilAttachment.destroy();
105
88
  this.depthStencilAttachment = resizedTexture;
106
89
  this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();
107
90
  }
108
91
  }
109
-
110
92
  }
111
93
  //# 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,CAA0BL,sBAA1B,GAAmD;AACjDM,QAAAA,IAAI,EAAE,KAAKN,sBAAL,CAA4BO,MAA5B,CAAmCC,UAAnC,EAD2C;AAGjDC,QAAAA,cAAc,EAAE,GAHiC;AAIjDC,QAAAA,YAAY,EAAE,OAJmC;AAKjDC,QAAAA,gBAAgB,EAAE,CAL+B;AAMjDC,QAAAA,cAAc,EAAE;AANiC,OAAnD;AAQD;;AAED,QAAI,KAAKb,gBAAL,CAAsBc,MAAtB,GAA+B,CAAnC,EAAsC;AACpC,WAAKR,oBAAL,CAA0BN,gBAA1B,GAA6C,KAAKA,gBAAL,CAAsBG,GAAtB,CAA0BC,e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3B,CAAP;AAOD;;AAED,UAAM,IAAIC,KAAJ,CAAU,MAAV,CAAN;AACD;;AAMUE,EAAAA,kBAAkB,CAACN,KAAD,EAAgBC,MAAhB,EAAsC;AACjE,SAAK,IAAIM,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAK3B,gBAAL,CAAsBc,MAA1C,EAAkD,EAAEa,CAApD,EAAuD;AACrD,UAAI,KAAK3B,gBAAL,CAAsB2B,CAAtB,CAAJ,EAA8B;AAC5B,cAAMC,cAAc,GAAG,KAAK9B,MAAL,CAAYmB,cAAZ,CAA2B,EAAC,GAAG,KAAKjB,gBAAL,CAAsB2B,CAAtB,EAAyB5B,KAA7B;AAAoCqB,UAAAA,KAApC;AAA2CC,UAAAA;AAA3C,SAA3B,CAAvB;;AACA,aAAKrB,gBAAL,CAAsB2B,CAAtB,EAAyBE,OAAzB;AACA,aAAK7B,gBAAL,CAAsB2B,CAAtB,IAA2BC,cAA3B;AACA,aAAKtB,oBAAL,CAA0BN,gBAA1B,CAA2C2B,CAA3C,EAA8CpB,IAA9C,GAAqDqB,cAAc,CAACpB,MAAf,CAAsBC,UAAtB,EAArD;AACD;AACF;;AAED,QAAI,KAAKR,sBAAT,EAAiC;AAC9B,YAAM2B,cAAc,GAAG,KAAK9B,MAAL,CAAYmB,cAAZ,CAA2B,EAAC,GAAG,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","Texture","WEBGPUTexture","WebGPUFramebuffer","constructor","device","props","_defineProperty","colorAttachments","depthStencilAttachment","createDepthStencilTexture","map","colorAttachment","createColorTexture","renderPassDescriptor","view","handle","createView","depthClearValue","depthStoreOp","stencilClearValue","stencilStoreOp","length","loadOp","loadValue","storeOp","_createTexture","id","format","width","height","usage","RENDER_ATTACHMENT","Error","texture","_resizeAttachments","i","resizedTexture","destroy"],"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"sourcesContent":["import type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';\nimport {Framebuffer, Texture} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\n// import WebGPUCanvasContext from '../webgpu-canvas-context';\nimport WEBGPUTexture from './webgpu-texture';\nimport WebGPUTexture from './webgpu-texture';\n\n// const DEFAULT_DEPTH_STENCIL_FORMAT: DepthStencilTextureFormat = 'depth24plus';\n\n// const MAX_COLOR_ATTACHMENTS = 8;\n\n/**\n * Create new textures with correct size for all attachments. \n * @note resize() destroys existing textures (if size has changed). \n */\nexport default class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n colorAttachments: WebGPUTexture[] = [];\n depthStencilAttachment: WebGPUTexture | null = null;\n\n /** Partial render pass descriptor. Used by WebGPURenderPass */\n renderPassDescriptor: {\n colorAttachments: GPURenderPassColorAttachment[];\n depthStencilAttachment?: GPURenderPassDepthStencilAttachment;\n } = {\n colorAttachments: []\n };\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n if (props.depthStencilAttachment) {\n this.depthStencilAttachment = this.createDepthStencilTexture(props);\n }\n\n if (props.colorAttachments) {\n this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));\n }\n\n if (this.depthStencilAttachment) {\n this.renderPassDescriptor.depthStencilAttachment = {\n view: this.depthStencilAttachment.handle.createView(),\n // Add default clear values\n depthClearValue: 1.0,\n depthStoreOp: 'store',\n stencilClearValue: 0,\n stencilStoreOp: 'store',\n }\n }\n\n if (this.colorAttachments.length > 0) {\n this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({\n view: colorAttachment.handle.createView(),\n loadOp: 'clear',\n loadValue: [0.0, 0.0, 0.0, 0.0],\n storeOp: 'store'\n }));\n }\n }\n\n /** Create depth stencil texture */\n private createDepthStencilTexture(props: FramebufferProps): WEBGPUTexture {\n if (props.depthStencilAttachment instanceof WEBGPUTexture) {\n return props.depthStencilAttachment;\n }\n\n if (typeof props.depthStencilAttachment === 'string') {\n return this.device._createTexture({\n id: 'depth-stencil-attachment',\n format: props.depthStencilAttachment,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n private createColorTexture(props: FramebufferProps, texture: Texture | ColorTextureFormat): WEBGPUTexture {\n if (texture instanceof WEBGPUTexture) {\n return texture;\n }\n\n if (typeof texture === 'string') {\n return this.device._createTexture({\n id: 'color-attachment',\n format: texture,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n /**\n * Create new textures with correct size for all attachments.\n * @note destroys existing textures.\n */\n protected _resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({...this.colorAttachments[i].props, width, height})\n this.colorAttachments[i].destroy();\n this.colorAttachments[i] = resizedTexture;\n this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({...this.depthStencilAttachment.props, width, height})\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = resizedTexture;\n this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();\n }\n }\n}\n"],"mappings":";AACA,SAAQA,WAAW,EAAEC,OAAO,QAAO,cAAc;AAAC,OAG3CC,aAAa;AAWpB,eAAe,MAAMC,iBAAiB,SAASH,WAAW,CAAC;EAczDI,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,2BAZa,EAAE;IAAAA,eAAA,iCACS,IAAI;IAAAA,eAAA,+BAM/C;MACFC,gBAAgB,EAAE;IACpB,CAAC;IAIC,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAIC,KAAK,CAACG,sBAAsB,EAAE;MAChC,IAAI,CAACA,sBAAsB,GAAG,IAAI,CAACC,yBAAyB,CAACJ,KAAK,CAAC;IACrE;IAEA,IAAIA,KAAK,CAACE,gBAAgB,EAA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E;MAC/B,MAAM4B,cAAc,GAAG,IAAI,CAAChC,MAAM,CAACqB,cAAc,CAAC;QAAC,GAAG,IAAI,CAACjB,sBAAsB,CAACH,KAAK;QAAEuB,KAAK;QAAEC;MAAM,CAAC,CAAC;MACxG,IAAI,CAACrB,sBAAsB,CAAC6B,OAAO,EAAE;MACrC,IAAI,CAAC7B,sBAAsB,GAAG4B,cAAc;MAC5C,IAAI,CAACvB,oBAAoB,CAACL,sBAAsB,CAACM,IAAI,GAAGsB,cAAc,CAACrB,MAAM,CAACC,UAAU,EAAE;IAC5F;EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"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/api';\nimport {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUQueryProps = QueryProps & {\n handle?: any;\n};\n\nconst DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {\n id: undefined,\n handle: undefined,\n userData: undefined,\n type: 'timestamp',\n count: 1,\n pipelineStatistics: []\n};\n\n/**\n * Immutable\n *\nclass WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {\n readonly device: WebGPUDevice;\n readonly handle: GPUQuerySet;\n\n constructor(device: WebGPUDevice, props: WebGPUQueryProps) {\n super(device, props, DEFAULT_QUERY_PROPS);\n this.handle = this.props.handle as GPUQuerySet || this.createHandle();\n this.handle.label = this.props.id;\n }\n\n protected createHandle() {\n return this.device.handle.createQuerySet({\n type: this.props.type,\n count: this.props.count,\n pipelineStatistics: this.props.pipelineStatistics\n });\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n}\n*/"],"mappings":""}
@@ -1,7 +1,7 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/api';
3
3
  import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
5
  import WebGPURenderPipeline from './webgpu-render-pipeline';
6
6
  export default class WebGPURenderPass extends RenderPass {
7
7
  readonly device: WebGPUDevice;
@@ -10,7 +10,7 @@ export default class WebGPURenderPass extends RenderPass {
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;
@@ -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,EAAY,MAAM,cAAc,CAAC;AAC3E,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAEtC,sBAAsB;IACtB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAQ;gBAEjC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,eAAoB;IAU7D,OAAO;IAEP,OAAO,IAAI,IAAI;IAIf,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK3C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,G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C;IAEtC,sBAAsB;IACtB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAQ;gBAEjC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,eAAoB;IAUpD,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK3C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQpD,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,EAC3B,MAAM,GAAE,MAAU,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI;IAIP,eAAe,CAAC,IAAI,EAAE,MAAM,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;CAW7C"}
@@ -1,56 +1,51 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { RenderPass, cast } from '@luma.gl/api';
3
3
  export default class WebGPURenderPass extends RenderPass {
4
- constructor(device, props = {}) {
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
12
  const renderPassDescriptor = framebuffer.renderPassDescriptor;
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,27 @@ 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
-
91
78
  }
92
79
  //# 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,CAA0BC,QAA1B;AACA,SAAKV,MAAL,CAAYW,YAAZ,CAAyB,CAAzB,EAA4B,KAAKH,QAAL,CAAcI,aAAd,EAA5B;AACD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B;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","handle","commandEncoder","beginRenderPass","label","id","destroy","end","setPipeline","pipeline","setBindings","bindings","_this$pipeline","_this$pipeline2","bindGroup","_getBindGroup","setBindGroup","setIndexBuffer","buffer","indexFormat","offset","size","setVertexBuffer","slot","draw","options","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","drawIndirect","setParameters","parameters","blendConstant","stencilReference","scissorRect","viewport","setBlendConstant","setStencilReference","setScissorRect","setViewport","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"sourcesContent":["import type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/api';\nimport {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport WebGPUBuffer from './webgpu-buffer';\n// import WebGPUCommandEncoder from './webgpu-command-encoder';\nimport WebGPURenderPipeline from './webgpu-render-pipeline';\n\nexport default class WebGPURenderPass extends RenderPass {\n readonly device: WebGPUDevice;\n readonly handle: GPURenderPassEncoder;\n\n /** Active pipeline */\n pipeline: WebGPURenderPipeline | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPassProps = {}) {\n super(device, props);\n this.device = device;\n const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();\n // @ts-expect-error\n const renderPassDescriptor = framebuffer.renderPassDescriptor;\n this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: RenderPipeline): void {\n this.pipeline = cast<WebGPURenderPipeline>(pipeline);\n this.handle.setPipeline(this.pipeline.handle);\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Record<string, Binding>): void {\n this.pipeline?.setBindings(bindings);\n const bindGroup = this.pipeline?._getBindGroup();\n if (bindGroup) {\n this.handle.setBindGroup(0, bindGroup);\n }\n }\n\n setIndexBuffer(\n buffer: Buffer,\n indexFormat: GPUIndexFormat,\n offset: number = 0,\n size?: number\n ): void {\n this.handle.setIndexBuffer(cast<WebGPUBuffer>(buffer).handle, indexFormat, offset, size);\n }\n\n setVertexBuffer(slot: number, buffer: Buffer, offset: number = 0): void {\n this.handle.setVertexBuffer(slot, cast<WebGPUBuffer>(buffer).handle, offset);\n }\n\n draw(options: {\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n if (options.indexCount) {\n this.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n this.handle.draw(\n options.vertexCount || 0,\n options.instanceCount,\n options.firstIndex,\n options.firstInstance\n );\n }\n }\n\n drawIndirect(): void {\n // drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n // drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n }\n\n setParameters(parameters: RenderPassParameters): void {\n const {blendConstant, stencilReference, scissorRect, viewport} = parameters;\n if (blendConstant) {\n this.handle.setBlendConstant(blendConstant);\n }\n if (stencilReference) {\n this.handle.setStencilReference(stencilReference);\n }\n if (scissorRect) {\n this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);\n }\n // TODO - explain how 3 dimensions vs 2 in WebGL works.\n if (viewport) {\n this.handle.setViewport(\n viewport[0],\n viewport[1],\n viewport[2],\n viewport[3],\n viewport[4],\n viewport[5]\n );\n }\n }\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginOcclusionQuery(queryIndex: number): void;\n // endOcclusionQuery(): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n\n // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n}\n"],"mappings":";AACA,SAAgBA,UAAU,EAAkBC,IAAI,QAAO,cAAc;AAMrE,eAAe,MAAMC,gBAAgB,SAASF,UAAU,CAAC;EAOvDG,WAAWA,CAACC,MAAoB,EAA+B;IAAA,IAA7BC,KAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC3D,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAHiB,IAAI;IAI1C,IAAI,CAACL,MAAM,GAAGA,MAAM;IACpB,MAAMM,WAAW,GAAGL,KAAK,CAACK,WAAW,IAAIN,MAAM,CAACO,aAAa,CAACC,qBAAqB,EAAE;IAErF,MAAM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,EAAEA,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5F;IAEA,IAAIC,QAAQ,EAAE;MACZ,IAAI,CAACtC,MAAM,CAAC0C,WAAW,CACrBJ,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,EACXA,QAAQ,CAAC,CAAC,CAAC,CACZ;IACH;EACF;EAEAK,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC5C,MAAM,CAAC2C,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC7C,MAAM,CAAC6C,aAAa,EAAE;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/C,MAAM,CAAC8C,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AASF"}
@@ -1,12 +1,15 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import type { Binding, RenderPass } from '@luma.gl/api';
3
3
  import { Buffer, RenderPipeline, RenderPipelineProps } from '@luma.gl/api';
4
- import type WebGPUDevice from '../webgpu-device';
4
+ import type { WebGPUDevice } from '../webgpu-device';
5
+ import type WebGPUShader from './webgpu-shader';
5
6
  import type WebGPURenderPass from './webgpu-render-pass';
6
7
  /** Creates a new render pipeline when parameters change */
7
8
  export default 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;
@@ -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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AE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAapD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMhD,WAAW;IAIX,iDAAiD;IACjD,aAAa;IAKb,8DAA8D;IAC9D,SAAS,CAAC,4BAA4B;IA+CtC,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmCR,oBAAoB,CAAC,gBAAgB,EAAE,gBAAgB;CAwCxD"}
@@ -1,55 +1,45 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { RenderPipeline, cast, log, isObjectEmpty } from '@luma.gl/api';
3
- import { applyParametersToRenderPipelineDescriptor } from '../helpers/webgpu-parameters';
4
- import { getWebGPUTextureFormat } from '../helpers/convert-texture-format';
5
- import { getBindGroup } from '../helpers/get-bind-group';
6
- import { getVertexBufferLayout, getBufferSlots } from '../helpers/get-vertex-buffer-layout';
3
+ import { applyParametersToRenderPipelineDescriptor } from "../helpers/webgpu-parameters.js";
4
+ import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
5
+ import { getBindGroup } from "../helpers/get-bind-group.js";
6
+ import { getVertexBufferLayout, getBufferSlots } from "../helpers/get-vertex-buffer-layout.js";
7
7
  export default class WebGPURenderPipeline extends RenderPipeline {
8
8
  constructor(device, props) {
9
9
  super(device, props);
10
-
11
10
  _defineProperty(this, "device", void 0);
12
-
13
11
  _defineProperty(this, "handle", void 0);
14
-
12
+ _defineProperty(this, "vs", void 0);
13
+ _defineProperty(this, "fs", null);
15
14
  _defineProperty(this, "_bufferSlots", void 0);
16
-
17
15
  _defineProperty(this, "_buffers", void 0);
18
-
19
- _defineProperty(this, "_indexBuffer", void 0);
20
-
16
+ _defineProperty(this, "_indexBuffer", null);
21
17
  _defineProperty(this, "_bindGroupLayout", void 0);
22
-
23
18
  _defineProperty(this, "_bindGroup", null);
24
-
25
19
  this.device = device;
26
20
  this.handle = this.props.handle || this.createHandle();
27
21
  this.handle.label = this.props.id;
22
+ this.vs = cast(props.vs);
23
+ this.fs = cast(props.fs);
28
24
  this._bufferSlots = getBufferSlots(this.props.layout, this.props.bufferMap);
29
25
  this._buffers = new Array(Object.keys(this._bufferSlots).length).fill(null);
30
26
  this._bindGroupLayout = this.handle.getBindGroupLayout(0);
31
27
  }
32
-
33
28
  createHandle() {
34
29
  const descriptor = this._getRenderPipelineDescriptor();
35
-
36
30
  const renderPipeline = this.device.handle.createRenderPipeline(descriptor);
37
31
  log.groupCollapsed(1, "new WebGPRenderPipeline(".concat(this.id, ")"))();
38
32
  log.log(1, JSON.stringify(descriptor, null, 2))();
39
33
  log.groupEnd(1)();
40
34
  return renderPipeline;
41
35
  }
42
-
43
36
  destroy() {}
44
-
45
37
  setIndexBuffer(indexBuffer) {
46
38
  this._indexBuffer = cast(indexBuffer);
47
39
  }
48
-
49
40
  setAttributes(attributes) {
50
41
  for (const [name, buffer] of Object.entries(attributes)) {
51
42
  const bufferIndex = this._bufferSlots[name];
52
-
53
43
  if (bufferIndex >= 0) {
54
44
  this._buffers[bufferIndex] = buffer;
55
45
  } else {
@@ -57,28 +47,23 @@ export default class WebGPURenderPipeline extends RenderPipeline {
57
47
  }
58
48
  }
59
49
  }
60
-
61
50
  setBindings(bindings) {
62
51
  if (!isObjectEmpty(this.props.bindings)) {
63
52
  Object.assign(this.props.bindings, bindings);
64
53
  this._bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.layout, this.props.bindings);
65
54
  }
66
55
  }
67
-
68
56
  setUniforms(uniforms) {
69
57
  if (!isObjectEmpty(uniforms)) {
70
58
  throw new Error('WebGPU does not support uniforms');
71
59
  }
72
60
  }
73
-
74
61
  _getBuffers() {
75
62
  return this._buffers;
76
63
  }
77
-
78
64
  _getBindGroup() {
79
65
  return this._bindGroup;
80
66
  }
81
-
82
67
  _getRenderPipelineDescriptor() {
83
68
  const vertex = {
84
69
  module: cast(this.props.vs).handle,
@@ -86,63 +71,60 @@ export default class WebGPURenderPipeline extends RenderPipeline {
86
71
  buffers: getVertexBufferLayout(this.props.layout, this.props.bufferMap)
87
72
  };
88
73
  let fragment;
89
-
90
74
  if (this.props.fs) {
75
+ var _this$device, _this$device$canvasCo;
91
76
  fragment = {
92
77
  module: cast(this.props.fs).handle,
93
78
  entryPoint: this.props.fsEntryPoint || 'main',
94
79
  targets: [{
95
- format: getWebGPUTextureFormat(this.device.canvasContext.format)
80
+ format: getWebGPUTextureFormat((_this$device = this.device) === null || _this$device === void 0 ? void 0 : (_this$device$canvasCo = _this$device.canvasContext) === null || _this$device$canvasCo === void 0 ? void 0 : _this$device$canvasCo.format)
96
81
  }]
97
82
  };
98
83
  }
99
-
100
- let descriptor = {
84
+ switch (this.props.topology) {
85
+ case 'triangle-fan':
86
+ case 'line-loop':
87
+ throw new Error("WebGPU does not support primitive topology ".concat(this.props.topology));
88
+ default:
89
+ }
90
+ const descriptor = {
101
91
  vertex,
102
92
  fragment,
103
93
  primitive: {
104
94
  topology: this.props.topology
105
- }
95
+ },
96
+ layout: 'auto'
106
97
  };
107
98
  applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);
108
99
  return descriptor;
109
100
  }
110
-
111
101
  draw(options) {
112
102
  const webgpuRenderPass = cast(options.renderPass) || this.device.getDefaultRenderPass();
113
103
  webgpuRenderPass.handle.setPipeline(this.handle);
114
-
115
- if (this._getBindGroup()) {
116
- webgpuRenderPass.handle.setBindGroup(0, this._getBindGroup());
104
+ const bindGroup = this._getBindGroup();
105
+ if (bindGroup) {
106
+ webgpuRenderPass.handle.setBindGroup(0, bindGroup);
117
107
  }
118
-
119
108
  this._setAttributeBuffers(webgpuRenderPass);
120
-
121
109
  if (options.indexCount) {
122
110
  webgpuRenderPass.handle.drawIndexed(options.indexCount, options.instanceCount, options.firstIndex, options.baseVertex, options.firstInstance);
123
111
  } else {
124
- webgpuRenderPass.handle.draw(options.vertexCount, options.instanceCount, options.firstIndex, options.firstInstance);
112
+ webgpuRenderPass.handle.draw(options.vertexCount || 0, options.instanceCount, options.firstIndex, options.firstInstance);
125
113
  }
126
114
  }
127
-
128
115
  _setAttributeBuffers(webgpuRenderPass) {
129
116
  if (this._indexBuffer) {
130
117
  webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);
131
118
  }
132
-
133
119
  const buffers = this._getBuffers();
134
-
135
120
  for (let i = 0; i < buffers.length; ++i) {
136
121
  const buffer = cast(buffers[i]);
137
-
138
122
  if (!buffer) {
139
123
  const attribute = this.props.layout.attributes.find(attribute => attribute.location === i);
140
124
  throw new Error("No buffer provided for attribute '".concat((attribute === null || attribute === void 0 ? void 0 : attribute.name) || '', "' in Model '").concat(this.props.id, "'"));
141
125
  }
142
-
143
126
  webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);
144
127
  }
145
128
  }
146
-
147
129
  }
148
130
  //# sourceMappingURL=webgpu-render-pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":["RenderPipeline","cast","log","isObjectEmpty","applyParametersToRenderPipelineDescriptor","getWebGPUTextureFormat","getBindGroup","getVertexBufferLayout","getBufferSlots","WebGPURenderPipeline","constructor","device","props","handle","createHandle","label","id","_bufferSlots","layout","bufferMap","_buffers","Array","Object","keys","length","fill","_bindGroupLayout","getBindGroupLayout","descriptor","_getRenderPipelineDescriptor","renderPipeline","createRenderPipeline","groupCollapsed","JSON","stringify","groupEnd","destroy","setIndexBuffer","indexBuffer","_indexBuffer","setAttributes","attributes","name","buffer","entries","bufferIndex","Error","setBindings","bindings","assign","_bindGroup","setUniforms","uniforms","_getBuffers","_getBindGroup","vertex","module","vs","entryPoint","vsEntryPoint","buffers","fragment","fs","fsEntryPoint","targets","format","canvasContext","primitive","topology","parameters","draw","options","webgpuRenderPass","renderPass","getDefaultRenderPass","setPipeline","setBindGroup","_setAttributeBuffers","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","indexType","i","attribute","find","location","setVertexBuffer"],"mappings":";AACA,SAAgBA,cAAhB,EAAqDC,IAArD,EAA2DC,GAA3D,EAAgEC,aAAhE,QAAoF,cAApF;AACA,SAAQC,yCAAR,QAAwD,8BAAxD;AACA,SAAQC,sBAAR,QAAqC,mCAArC;AACA,SAAQC,YAAR,QAA2B,2BAA3B;AACA,SAAQC,qBAAR,EAA+BC,cAA/B,QAAoD,qCAApD;AAaA,eAAe,MAAMC,oBAAN,SAAmCT,cAAnC,CAAkD;AAc/DU,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAmD;AAC5D,UAAMD,MAAN,EAAcC,KAAd;;AAD4D;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,wCAF3B,IAE2B;;AAE5D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,MAAL,GAAe,KAAKD,KAAL,CAAWC,MAAZ,IAA4C,KAAKC,YAAL,EAA1D;AACA,SAAKD,MAAL,CAAYE,KAAZ,GAAoB,KAAKH,KAAL,CAAWI,EAA/B;AAEA,SAAKC,YAAL,GAAoBT,cAAc,CAAC,KAAKI,KAAL,CAAWM,MAAZ,EAAoB,KAAKN,KAAL,CAAWO,SAA/B,CAAlC;AACA,SAAKC,QAAL,GAAgB,IAAIC,KAAJ,CAAkBC,MAAM,CAACC,IAAP,CAAY,KAAKN,YAAjB,EAA+BO,MAAjD,EAAyDC,IAAzD,CAA8D,IAA9D,CAAhB;AACA,SAAKC,gBAAL,GAAwB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AAiE,KAAK0B,YAAL,CAAkB3B,KAAlB,CAAwByE,SAAzF;AACD;;AAED,UAAMzB,OAAO,GAAG,KAAKP,WAAL,EAAhB;;AACA,SAAK,IAAIiC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG1B,OAAO,CAACpC,MAA5B,EAAoC,EAAE8D,CAAtC,EAAyC;AACvC,YAAM3C,MAAM,GAAG1C,IAAI,CAAe2D,OAAO,CAAC0B,CAAD,CAAtB,CAAnB;;AACA,UAAI,CAAC3C,MAAL,EAAa;AACX,cAAM4C,SAAS,GAAG,KAAK3E,KAAL,CAAWM,MAAX,CAAkBuB,UAAlB,CAA6B+C,IAA7B,CACfD,SAAD,IAAeA,SAAS,CAACE,QAAV,KAAuBH,CADtB,CAAlB;AAGA,cAAM,IAAIxC,KAAJ,6CACiC,CAAAyC,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAE7C,IAAX,KAAmB,EADpD,yBACqE,KAAK9B,KAAL,CAAWI,EADhF,OAAN;AAGD;;AACDwD,MAAAA,gBAAgB,CAAC3D,MAAjB,CAAwB6E,eAAxB,CAAwCJ,CAAxC,EAA2C3C,MAAM,CAAC9B,MAAlD;AACD;AAsBF;;AAnN8D","sourcesContent":["import type {Binding, RenderPass} from '@luma.gl/api';\nimport {Buffer, RenderPipeline, RenderPipelineProps, cast, log, isObjectEmpty} from '@luma.gl/api';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout, getBufferSlots} from '../helpers/get-vertex-buffer-layout';\n// import {convertAttributesVertexBufferToLayout} from '../helpers/get-vertex-buffer-layout';\n// import {mapAccessorToWebGPUFormat} from './helpers/accessor-to-format';\n// import type {BufferAccessors} from './webgpu-pipeline';\n\nimport type WebGPUDevice from '../webgpu-device';\nimport type WebGPUBuffer from './webgpu-buffer';\nimport type WebGPUShader from './webgpu-shader';\nimport type WebGPURenderPass from './webgpu-render-pass';\n\n// RENDER PIPELINE\n\n/** Creates a new render pipeline when parameters change */\nexport default class WebGPURenderPipeline extends RenderPipeline {\n device: WebGPUDevice;\n handle: GPURenderPipeline;\n\n private _bufferSlots: Record<string, number>;\n private _buffers: Buffer[];\n private _indexBuffer: WebGPUBuffer;\n // private _firstIndex: number;\n // private _lastIndex: number;\n\n /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout;\n private _bindGroup: GPUBindGroup = null;\n\n constructor(device: WebGPUDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = (this.props.handle as GPURenderPipeline) || this.createHandle();\n this.handle.label = this.props.id;\n\n this._bufferSlots = getBufferSlots(this.props.layout, this.props.bufferMap);\n this._buffers = new Array<Buffer>(Object.keys(this._bufferSlots).length).fill(null);\n this._bindGroupLayout = this.handle.getBindGroupLayout(0);\n }\n\n protected createHandle(): GPURenderPipeline {\n const descriptor = this._getRenderPipelineDescriptor();\n const renderPipeline = this.device.handle.createRenderPipeline(descriptor);\n log.groupCollapsed(1, `new WebGPRenderPipeline(${this.id})`)();\n log.log(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n return renderPipeline;\n }\n\n destroy() {\n // WebGPURenderPipeline has no destroy method.\n }\n\n setIndexBuffer(indexBuffer: Buffer): void {\n this._indexBuffer = cast<WebGPUBuffer>(indexBuffer);\n }\n\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const bufferIndex = this._bufferSlots[name];\n if (bufferIndex >= 0) {\n this._buffers[bufferIndex] = buffer;\n } else {\n throw new Error(\n `Setting attribute '${name}' not listed in shader layout for program ${this.id}`\n );\n }\n }\n // for (let i = 0; i < this._bufferSlots.length; ++i) {\n // const bufferName = this._bufferSlots[i];\n // if (attributes[bufferName]) {\n // this.handle\n // }\n // }\n }\n\n /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): void {\n if (!isObjectEmpty(this.props.bindings)) {\n Object.assign(this.props.bindings, bindings);\n // Set up the bindings\n this._bindGroup = getBindGroup(\n this.device.handle,\n this._bindGroupLayout,\n this.props.layout,\n this.props.bindings\n );\n }\n }\n\n setUniforms(uniforms: Record<string, any>): void {\n if (!isObjectEmpty(uniforms)) {\n throw new Error('WebGPU does not support uniforms');\n }\n }\n\n _getBuffers() {\n return this._buffers;\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // assert(this._bindGroup);\n return this._bindGroup;\n }\n\n /** Populate the complex WebGPU GPURenderPipelineDescriptor */\n protected _getRenderPipelineDescriptor() {\n // Set up the vertex stage\n const vertex: GPUVertexState = {\n module: cast<WebGPUShader>(this.props.vs).handle,\n entryPoint: this.props.vsEntryPoint || 'main',\n buffers: getVertexBufferLayout(this.props.layout, this.props.bufferMap)\n };\n\n // Set up the fragment stage\n let fragment: GPUFragmentState | undefined;\n if (this.props.fs) {\n fragment = {\n module: cast<WebGPUShader>(this.props.fs).handle,\n entryPoint: this.props.fsEntryPoint || 'main',\n targets: [\n {\n format: getWebGPUTextureFormat(this.device.canvasContext.format)\n }\n ]\n };\n }\n\n // Create a partially populated descriptor\n let descriptor: GPURenderPipelineDescriptor = {\n vertex,\n fragment,\n primitive: {\n topology: this.props.topology\n }\n };\n\n // Set parameters on the descriptor\n applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);\n\n return descriptor;\n }\n\n draw(options: {\n renderPass?: RenderPass;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n const webgpuRenderPass =\n cast<WebGPURenderPass>(options.renderPass) || this.device.getDefaultRenderPass();\n\n // Set pipeline\n webgpuRenderPass.handle.setPipeline(this.handle);\n\n // Set bindings (uniform buffers, textures etc)\n if (this._getBindGroup()) {\n webgpuRenderPass.handle.setBindGroup(0, this._getBindGroup());\n }\n\n // Set attributes\n this._setAttributeBuffers(webgpuRenderPass);\n\n // Draw\n if (options.indexCount) {\n webgpuRenderPass.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n webgpuRenderPass.handle.draw(\n options.vertexCount,\n options.instanceCount,\n options.firstIndex,\n options.firstInstance\n );\n }\n }\n\n _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {\n if (this._indexBuffer) {\n webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);\n }\n\n const buffers = this._getBuffers();\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = cast<WebGPUBuffer>(buffers[i]);\n if (!buffer) {\n const attribute = this.props.layout.attributes.find(\n (attribute) => attribute.location === i\n );\n throw new Error(\n `No buffer provided for attribute '${attribute?.name || ''}' in Model '${this.props.id}'`\n );\n }\n webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);\n }\n\n // TODO - HANDLE buffer maps\n /*\n for (const [bufferName, attributeMapping] of Object.entries(this.props.bufferMap)) {\n const buffer = cast<WebGPUBuffer>(this.props.attributes[bufferName]);\n if (!buffer) {\n log.warn(`Missing buffer for buffer map ${bufferName}`)();\n continue;\n }\n\n if ('location' in attributeMapping) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(layout.location, buffer.handle);\n } else {\n for (const [bufferName, mapping] of Object.entries(attributeMapping)) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(field.location, buffer.handle);\n }\n }\n }\n */\n }\n}\n"],"file":"webgpu-render-pipeline.js"}
1
+ {"version":3,"file":"webgpu-render-pipeline.js","names":["RenderPipeline","cast","log","isObjectEmpty","applyParametersToRenderPipelineDescriptor","getWebGPUTextureFormat","getBindGroup","getVertexBufferLayout","getBufferSlots","WebGPURenderPipeline","constructor","device","props","_defineProperty","handle","createHandle","label","id","vs","fs","_bufferSlots","layout","bufferMap","_buffers","Array","Object","keys","length","fill","_bindGroupLayout","getBindGroupLayout","descriptor","_getRenderPipelineDescriptor","renderPipeline","createRenderPipeline","groupCollapsed","concat","JSON","stringify","groupEnd","destroy","setIndexBuffer","indexBuffer","_indexBuffer","setAttributes","attributes","name","buffer","entries","bufferIndex","Error","setBindings","bindings","assign","_bindGroup","setUniforms","uniforms","_getBuffers","_getBindGroup","vertex","module","entryPoint","vsEntryPoint","buffers","fragment","_this$device","_this$device$canvasCo","fsEntryPoint","targets","format","canvasContext","topology","primitive","parameters","draw","options","webgpuRenderPass","renderPass","getDefaultRenderPass","setPipeline","bindGroup","setBindGroup","_setAttributeBuffers","indexCount","drawIndexed","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","indexType","i","attribute","find","location","setVertexBuffer"],"sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"sourcesContent":["import type {Binding, RenderPass} from '@luma.gl/api';\nimport {Buffer, RenderPipeline, RenderPipelineProps, cast, log, isObjectEmpty} from '@luma.gl/api';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout, getBufferSlots} from '../helpers/get-vertex-buffer-layout';\n// import {convertAttributesVertexBufferToLayout} from '../helpers/get-vertex-buffer-layout';\n// import {mapAccessorToWebGPUFormat} from './helpers/accessor-to-format';\n// import type {BufferAccessors} from './webgpu-pipeline';\n\nimport type {WebGPUDevice} from '../webgpu-device';\nimport type WebGPUBuffer from './webgpu-buffer';\nimport type WebGPUShader from './webgpu-shader';\nimport type WebGPURenderPass from './webgpu-render-pass';\n\n// RENDER PIPELINE\n\n/** Creates a new render pipeline when parameters change */\nexport default class WebGPURenderPipeline extends RenderPipeline {\n device: WebGPUDevice;\n handle: GPURenderPipeline;\n\n vs: WebGPUShader;\n fs: WebGPUShader | null = null;\n\n private _bufferSlots: Record<string, number>;\n private _buffers: Buffer[];\n private _indexBuffer: WebGPUBuffer | null = null;\n // private _firstIndex: number;\n // private _lastIndex: number;\n\n /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout;\n private _bindGroup: GPUBindGroup | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = (this.props.handle as GPURenderPipeline) || this.createHandle();\n this.handle.label = this.props.id;\n\n this.vs = cast<WebGPUShader>(props.vs);\n this.fs = cast<WebGPUShader>(props.fs);\n\n this._bufferSlots = getBufferSlots(this.props.layout, this.props.bufferMap);\n this._buffers = new Array<Buffer>(Object.keys(this._bufferSlots).length).fill(null);\n this._bindGroupLayout = this.handle.getBindGroupLayout(0);\n }\n\n protected createHandle(): GPURenderPipeline {\n const descriptor = this._getRenderPipelineDescriptor();\n const renderPipeline = this.device.handle.createRenderPipeline(descriptor);\n log.groupCollapsed(1, `new WebGPRenderPipeline(${this.id})`)();\n log.log(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n return renderPipeline;\n }\n\n override destroy(): void {\n // WebGPURenderPipeline has no destroy method.\n }\n\n setIndexBuffer(indexBuffer: Buffer): void {\n this._indexBuffer = cast<WebGPUBuffer>(indexBuffer);\n }\n\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const bufferIndex = this._bufferSlots[name];\n if (bufferIndex >= 0) {\n this._buffers[bufferIndex] = buffer;\n } else {\n throw new Error(\n `Setting attribute '${name}' not listed in shader layout for program ${this.id}`\n );\n }\n }\n // for (let i = 0; i < this._bufferSlots.length; ++i) {\n // const bufferName = this._bufferSlots[i];\n // if (attributes[bufferName]) {\n // this.handle\n // }\n // }\n }\n\n /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): void {\n if (!isObjectEmpty(this.props.bindings)) {\n Object.assign(this.props.bindings, bindings);\n // Set up the bindings\n this._bindGroup = getBindGroup(\n this.device.handle,\n this._bindGroupLayout,\n this.props.layout,\n this.props.bindings\n );\n }\n }\n\n setUniforms(uniforms: Record<string, any>): void {\n if (!isObjectEmpty(uniforms)) {\n throw new Error('WebGPU does not support uniforms');\n }\n }\n\n _getBuffers() {\n return this._buffers;\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // assert(this._bindGroup);\n return this._bindGroup;\n }\n\n /** Populate the complex WebGPU GPURenderPipelineDescriptor */\n protected _getRenderPipelineDescriptor() {\n // Set up the vertex stage\n const vertex: GPUVertexState = {\n module: cast<WebGPUShader>(this.props.vs).handle,\n entryPoint: this.props.vsEntryPoint || 'main',\n buffers: getVertexBufferLayout(this.props.layout, this.props.bufferMap)\n };\n\n // Set up the fragment stage\n let fragment: GPUFragmentState | undefined;\n if (this.props.fs) {\n fragment = {\n module: cast<WebGPUShader>(this.props.fs).handle,\n entryPoint: this.props.fsEntryPoint || 'main',\n targets: [\n {\n // TODO exclamation mark hack!\n format: getWebGPUTextureFormat(this.device?.canvasContext?.format)\n }\n ]\n };\n }\n\n // WebGPU has more restrictive topology support than WebGL\n switch (this.props.topology) {\n case 'triangle-fan':\n case 'line-loop':\n throw new Error(`WebGPU does not support primitive topology ${this.props.topology}`);\n default:\n }\n\n // Create a partially populated descriptor\n const descriptor: GPURenderPipelineDescriptor = {\n vertex,\n fragment,\n primitive: {\n topology: this.props.topology\n },\n layout: 'auto'\n };\n\n // Set parameters on the descriptor\n applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);\n\n return descriptor;\n }\n\n draw(options: {\n renderPass?: RenderPass;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n const webgpuRenderPass: WebGPURenderPass =\n cast<WebGPURenderPass>(options.renderPass) || this.device.getDefaultRenderPass();\n\n // Set pipeline\n webgpuRenderPass.handle.setPipeline(this.handle);\n\n // Set bindings (uniform buffers, textures etc)\n const bindGroup = this._getBindGroup();\n if (bindGroup) {\n webgpuRenderPass.handle.setBindGroup(0, bindGroup);\n }\n\n // Set attributes\n this._setAttributeBuffers(webgpuRenderPass);\n\n // Draw\n if (options.indexCount) {\n webgpuRenderPass.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n webgpuRenderPass.handle.draw(\n options.vertexCount || 0,\n options.instanceCount,\n options.firstIndex,\n options.firstInstance\n );\n }\n }\n\n _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {\n if (this._indexBuffer) {\n webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);\n }\n\n const buffers = this._getBuffers();\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = cast<WebGPUBuffer>(buffers[i]);\n if (!buffer) {\n const attribute = this.props.layout.attributes.find(\n (attribute) => attribute.location === i\n );\n throw new Error(\n `No buffer provided for attribute '${attribute?.name || ''}' in Model '${this.props.id}'`\n );\n }\n webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);\n }\n\n // TODO - HANDLE buffer maps\n /*\n for (const [bufferName, attributeMapping] of Object.entries(this.props.bufferMap)) {\n const buffer = cast<WebGPUBuffer>(this.props.attributes[bufferName]);\n if (!buffer) {\n log.warn(`Missing buffer for buffer map ${bufferName}`)();\n continue;\n }\n\n if ('location' in attributeMapping) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(layout.location, buffer.handle);\n } else {\n for (const [bufferName, mapping] of Object.entries(attributeMapping)) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(field.location, buffer.handle);\n }\n }\n }\n */\n }\n}\n"],"mappings":";AACA,SAAgBA,cAAc,EAAuBC,IAAI,EAAEC,GAAG,EAAEC,aAAa,QAAO,cAAc;AAAC,SAC3FC,yCAAyC;AAAA,SACzCC,sBAAsB;AAAA,SACtBC,YAAY;AAAA,SACZC,qBAAqB,EAAEC,cAAc;AAa7C,eAAe,MAAMC,oBAAoB,S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