@luxonis/visualizer-protobuf 3.1.13 → 3.1.14

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 (68) hide show
  1. package/dist/{FoxgloveServer-Da9kV1cr.js → FoxgloveServer-CpnCBMeV.js} +1 -1
  2. package/dist/{communicator-Dh2aL-rj.js → communicator-DO6hmBxI.js} +1 -1
  3. package/dist/{depth-DiD1V2Sg.js → depth-Me_0Xnx6.js} +89 -2
  4. package/dist/{deserialization.worker-DU2Hs4UP.js → deserialization.worker-CUrCdjHf.js} +401 -137
  5. package/dist/{foxglove-protocol-BtLMVx24.js → foxglove-protocol-SrBOBs-8.js} +1 -1
  6. package/dist/{index-B5oN0fQm.js → index-5ZSfZI8d.js} +1 -1
  7. package/dist/{index-CNjpp5xs.js → index-B8aafdRQ.js} +5 -5
  8. package/dist/{index-B_3PleIH.js → index-BMew9qiQ.js} +57 -126
  9. package/dist/{index-D686pHc1.js → index-BsIRFSYD.js} +36 -9
  10. package/dist/{index-CqayH0_I.js → index-CIhAU5Cs.js} +5 -5
  11. package/dist/{index-DnhrXuH6.js → index-CN6tI-uI.js} +5 -5
  12. package/dist/{index--95nXh6E.js → index-CQtXiN8I.js} +5 -5
  13. package/dist/{index-DewnJOHY.js → index-CZGEFE1k.js} +5 -5
  14. package/dist/{index-CcWunxJv.js → index-CeRrHeG_.js} +5 -5
  15. package/dist/{index-BMp_L7Aa.js → index-CqH6rdRP.js} +5 -5
  16. package/dist/{index-JlGCfxtk.js → index-CrPun-aU.js} +5 -5
  17. package/dist/{index-B9-rLgJ9.js → index-Dc3rS1Cf.js} +7 -7
  18. package/dist/{index-CidrwlEk.js → index-DgNYLOM9.js} +5 -5
  19. package/dist/{index-DzOBiI2h.js → index-DjRF0u25.js} +5 -5
  20. package/dist/{index-CxKEiKY9.js → index-Dmc1065I.js} +5 -5
  21. package/dist/{index-BjiepKHF.js → index-Dn6pTTdu.js} +5 -5
  22. package/dist/{index-CCq5_y78.js → index-N2I7Bhtx.js} +5 -5
  23. package/dist/{index-X1k93Nku.js → index-_Z7btKy-.js} +5 -5
  24. package/dist/{index-C45UVGjk.js → index-_ggcs841.js} +5 -5
  25. package/dist/{index-DopAEQk2.js → index-svPKcEP3.js} +5 -5
  26. package/dist/{index-DWt4Nj5G.js → index-u1cGSF5c.js} +5 -5
  27. package/dist/index.js +5 -5
  28. package/dist/lib/src/components/PanelToolbar.d.ts.map +1 -1
  29. package/dist/lib/src/components/PanelToolbar.js +2 -2
  30. package/dist/lib/src/components/PanelToolbar.js.map +1 -1
  31. package/dist/lib/src/connection/foxglove-connection.d.ts.map +1 -1
  32. package/dist/lib/src/connection/foxglove-connection.js +12 -2
  33. package/dist/lib/src/connection/foxglove-connection.js.map +1 -1
  34. package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.js +59 -20
  35. package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.js.map +1 -1
  36. package/dist/lib/src/messaging/deserialization/pointcloud/utils.d.ts.map +1 -1
  37. package/dist/lib/src/messaging/deserialization/pointcloud/utils.js.map +1 -1
  38. package/dist/lib/src/messaging/deserialization/video/h264.d.ts +2 -1
  39. package/dist/lib/src/messaging/deserialization/video/h264.d.ts.map +1 -1
  40. package/dist/lib/src/messaging/deserialization/video/h264.js +14 -10
  41. package/dist/lib/src/messaging/deserialization/video/h264.js.map +1 -1
  42. package/dist/lib/src/messaging/deserialization/video/h265.d.ts +1 -0
  43. package/dist/lib/src/messaging/deserialization/video/h265.d.ts.map +1 -1
  44. package/dist/lib/src/messaging/deserialization/video/h265.js +12 -6
  45. package/dist/lib/src/messaging/deserialization/video/h265.js.map +1 -1
  46. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.d.ts +4 -4
  47. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.d.ts.map +1 -1
  48. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.js +350 -84
  49. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.js.map +1 -1
  50. package/dist/lib/src/messaging/protobuf.d.ts +2 -2
  51. package/dist/lib/src/messaging/protobuf.d.ts.map +1 -1
  52. package/dist/lib/src/messaging/protobuf.js +3 -3
  53. package/dist/lib/src/messaging/protobuf.js.map +1 -1
  54. package/dist/lib/src/utils/poitcloud-sync.d.ts +7 -2
  55. package/dist/lib/src/utils/poitcloud-sync.d.ts.map +1 -1
  56. package/dist/lib/src/utils/poitcloud-sync.js +10 -6
  57. package/dist/lib/src/utils/poitcloud-sync.js.map +1 -1
  58. package/dist/packages/studio-base/src/panels/ThreeDeeRender/Renderer.d.ts.map +1 -1
  59. package/dist/packages/studio-base/src/panels/ThreeDeeRender/Renderer.js +7 -2
  60. package/dist/packages/studio-base/src/panels/ThreeDeeRender/Renderer.js.map +1 -1
  61. package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.d.ts.map +1 -1
  62. package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.js +33 -1
  63. package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.js.map +1 -1
  64. package/dist/{pointcloudFromDepth.worker-60RA4Ief.js → pointcloudFromDepth.worker-wzSOsJVb.js} +86 -47
  65. package/dist/{protobuf-OcbVtxg1.js → protobuf-CKMA2Rn8.js} +214 -214
  66. package/dist/{worker-C2MHIq3t.js → worker-Bhe7uYcO.js} +4 -4
  67. package/dist/{worker-Be-hru8f.js → worker-VIU0v1ZW.js} +3 -3
  68. package/package.json +1 -1
@@ -60,6 +60,8 @@ function depthToPointCloudBuffer(uint16Array, width, height, fx, fy, maxSteroDep
60
60
  }
61
61
  const WORKGROUP_SIZE_X = 128;
62
62
  const POINT_STRIDE_BYTES = 16;
63
+ let cachedGpuContext;
64
+ let gpuContextPromise;
63
65
  const shader = `
64
66
  struct Intrinsics {
65
67
  fx: f32,
@@ -195,6 +197,85 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
195
197
  }
196
198
  }
197
199
  `;
200
+ async function getGPUContext() {
201
+ if (cachedGpuContext) {
202
+ return cachedGpuContext;
203
+ }
204
+ if (gpuContextPromise) {
205
+ return await gpuContextPromise;
206
+ }
207
+ gpuContextPromise = (async () => {
208
+ if (typeof navigator.gpu === "undefined") {
209
+ return undefined;
210
+ }
211
+ const adapter = await navigator.gpu.requestAdapter();
212
+ if (!adapter) {
213
+ return undefined;
214
+ }
215
+ const device = await adapter.requestDevice();
216
+ const bindGroupLayout = device.createBindGroupLayout({
217
+ label: "Compute Bind Group Layout",
218
+ entries: [{
219
+ binding: 0,
220
+ visibility: GPUShaderStage.COMPUTE,
221
+ buffer: {
222
+ type: "read-only-storage"
223
+ }
224
+ }, {
225
+ binding: 1,
226
+ visibility: GPUShaderStage.COMPUTE,
227
+ buffer: {
228
+ type: "read-only-storage"
229
+ }
230
+ }, {
231
+ binding: 2,
232
+ visibility: GPUShaderStage.COMPUTE,
233
+ buffer: {
234
+ type: "storage"
235
+ }
236
+ }, {
237
+ binding: 3,
238
+ visibility: GPUShaderStage.COMPUTE,
239
+ buffer: {
240
+ type: "read-only-storage"
241
+ }
242
+ }]
243
+ });
244
+ const shaderModule = device.createShaderModule({
245
+ label: "Compute Shader Module",
246
+ code: shader
247
+ });
248
+ const pipeline = device.createComputePipeline({
249
+ label: "Compute Pipeline",
250
+ layout: device.createPipelineLayout({
251
+ bindGroupLayouts: [bindGroupLayout]
252
+ }),
253
+ compute: {
254
+ module: shaderModule,
255
+ entryPoint: "main"
256
+ }
257
+ });
258
+ const context = {
259
+ device,
260
+ bindGroupLayout,
261
+ pipeline
262
+ };
263
+ void device.lost.then(() => {
264
+ var _cachedGpuContext;
265
+ if (((_cachedGpuContext = cachedGpuContext) === null || _cachedGpuContext === void 0 ? void 0 : _cachedGpuContext.device) === device) {
266
+ cachedGpuContext = undefined;
267
+ }
268
+ gpuContextPromise = undefined;
269
+ });
270
+ cachedGpuContext = context;
271
+ return context;
272
+ })();
273
+ try {
274
+ return await gpuContextPromise;
275
+ } finally {
276
+ gpuContextPromise = undefined;
277
+ }
278
+ }
198
279
  async function depthToPointcloudGPU(depthFrames, depthWidth, depthHeight, fx, fy, cx, cy, i420Frames, i420Width, i420Height, maxSteroDepth, {
199
280
  hasGPU
200
281
  }) {
@@ -243,11 +324,11 @@ async function depthToPointcloudGPU(depthFrames, depthWidth, depthHeight, fx, fy
243
324
  let readbackBuffer = null;
244
325
  try {
245
326
  var _i420Frames$0$byteLen, _i420Frames$;
246
- const adapter = await navigator.gpu.requestAdapter();
247
- if (!adapter) {
327
+ const gpuContext = await getGPUContext();
328
+ if (!gpuContext) {
248
329
  throw new Error("Failed to get GPU adapter.");
249
330
  }
250
- device = await adapter.requestDevice();
331
+ device = gpuContext.device;
251
332
  const queue = device.queue;
252
333
  const numPixelsPerFrame = depthWidth * depthHeight;
253
334
  const outputFrameSize = numPixelsPerFrame * POINT_STRIDE_BYTES;
@@ -340,37 +421,9 @@ async function depthToPointcloudGPU(depthFrames, depthWidth, depthHeight, fx, fy
340
421
  size: totalOutputBufferSize,
341
422
  usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
342
423
  });
343
- const bindGroupLayout = device.createBindGroupLayout({
344
- label: "Compute Bind Group Layout",
345
- entries: [{
346
- binding: 0,
347
- visibility: GPUShaderStage.COMPUTE,
348
- buffer: {
349
- type: "read-only-storage"
350
- }
351
- }, {
352
- binding: 1,
353
- visibility: GPUShaderStage.COMPUTE,
354
- buffer: {
355
- type: "read-only-storage"
356
- }
357
- }, {
358
- binding: 2,
359
- visibility: GPUShaderStage.COMPUTE,
360
- buffer: {
361
- type: "storage"
362
- }
363
- }, {
364
- binding: 3,
365
- visibility: GPUShaderStage.COMPUTE,
366
- buffer: {
367
- type: "read-only-storage"
368
- }
369
- }]
370
- });
371
424
  const bindGroup = device.createBindGroup({
372
425
  label: "Compute Bind Group",
373
- layout: bindGroupLayout,
426
+ layout: gpuContext.bindGroupLayout,
374
427
  entries: [{
375
428
  binding: 0,
376
429
  resource: {
@@ -393,27 +446,13 @@ async function depthToPointcloudGPU(depthFrames, depthWidth, depthHeight, fx, fy
393
446
  }
394
447
  }]
395
448
  });
396
- const shaderModule = device.createShaderModule({
397
- label: "Compute Shader Module",
398
- code: shader
399
- });
400
- const pipeline = device.createComputePipeline({
401
- label: "Compute Pipeline",
402
- layout: device.createPipelineLayout({
403
- bindGroupLayouts: [bindGroupLayout]
404
- }),
405
- compute: {
406
- module: shaderModule,
407
- entryPoint: "main"
408
- }
409
- });
410
449
  const commandEncoder = device.createCommandEncoder({
411
450
  label: "Compute Command Encoder"
412
451
  });
413
452
  const passEncoder = commandEncoder.beginComputePass({
414
453
  label: "Compute Pass"
415
454
  });
416
- passEncoder.setPipeline(pipeline);
455
+ passEncoder.setPipeline(gpuContext.pipeline);
417
456
  passEncoder.setBindGroup(0, bindGroup);
418
457
  const numWorkgroupsX = Math.ceil(numPixelsPerFrame / WORKGROUP_SIZE_X);
419
458
  const numWorkgroupsY = numFrames;