@flighthq/scene3d-wgpu 0.5.1-next.908.b072fbc → 0.5.1-next.911.32a089f

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.
package/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/scene3d-wgpu`. The `
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/scene3d-wgpu@0.5.1-next.908.b072fbc](https://github.com/flighthq/flight/tree/b072fbc49d0745bb96842601b864551b37ab3ca1/packages/scene3d-wgpu)
17
- - [License](https://github.com/flighthq/flight/blob/b072fbc49d0745bb96842601b864551b37ab3ca1/LICENSE.md)
16
+ - [Source for @flighthq/scene3d-wgpu@0.5.1-next.911.32a089f](https://github.com/flighthq/flight/tree/32a089f1342d08547fc2359dfd5e8fe9f7e3c12e/packages/scene3d-wgpu)
17
+ - [License](https://github.com/flighthq/flight/blob/32a089f1342d08547fc2359dfd5e8fe9f7e3c12e/LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/scene3d-wgpu",
3
- "version": "0.5.1-next.908.b072fbc",
3
+ "version": "0.5.1-next.911.32a089f",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,22 +38,22 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/camera": "0.5.1-next.908.b072fbc",
42
- "@flighthq/color": "0.5.1-next.908.b072fbc",
43
- "@flighthq/entity": "0.5.1-next.908.b072fbc",
44
- "@flighthq/geometry": "0.5.1-next.908.b072fbc",
45
- "@flighthq/image": "0.5.1-next.908.b072fbc",
46
- "@flighthq/lighting": "0.5.1-next.908.b072fbc",
47
- "@flighthq/log": "0.5.1-next.908.b072fbc",
48
- "@flighthq/materials": "0.5.1-next.908.b072fbc",
49
- "@flighthq/node": "0.5.1-next.908.b072fbc",
50
- "@flighthq/registry": "0.5.1-next.908.b072fbc",
51
- "@flighthq/render": "0.5.1-next.908.b072fbc",
52
- "@flighthq/render-wgpu": "0.5.1-next.908.b072fbc",
53
- "@flighthq/scene3d": "0.5.1-next.908.b072fbc",
54
- "@flighthq/shading": "0.5.1-next.908.b072fbc",
55
- "@flighthq/texture": "0.5.1-next.908.b072fbc",
56
- "@flighthq/types": "0.5.1-next.908.b072fbc"
41
+ "@flighthq/camera": "0.5.1-next.911.32a089f",
42
+ "@flighthq/color": "0.5.1-next.911.32a089f",
43
+ "@flighthq/entity": "0.5.1-next.911.32a089f",
44
+ "@flighthq/geometry": "0.5.1-next.911.32a089f",
45
+ "@flighthq/image": "0.5.1-next.911.32a089f",
46
+ "@flighthq/lighting": "0.5.1-next.911.32a089f",
47
+ "@flighthq/log": "0.5.1-next.911.32a089f",
48
+ "@flighthq/materials": "0.5.1-next.911.32a089f",
49
+ "@flighthq/node": "0.5.1-next.911.32a089f",
50
+ "@flighthq/registry": "0.5.1-next.911.32a089f",
51
+ "@flighthq/render": "0.5.1-next.911.32a089f",
52
+ "@flighthq/render-wgpu": "0.5.1-next.911.32a089f",
53
+ "@flighthq/scene3d": "0.5.1-next.911.32a089f",
54
+ "@flighthq/shading": "0.5.1-next.911.32a089f",
55
+ "@flighthq/texture": "0.5.1-next.911.32a089f",
56
+ "@flighthq/types": "0.5.1-next.911.32a089f"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@webgpu/types": "^0.1.70"
@@ -30,6 +30,7 @@ import {
30
30
  drawWgpuMeshSubset,
31
31
  ensureWgpuFrameBindGroup,
32
32
  ensureWgpuIblSampleBindGroup,
33
+ ensureWgpuInstanceBuffer,
33
34
  ensureWgpuIblSampleLayout,
34
35
  ensureWgpuMaterialBinding,
35
36
  ensureWgpuPbrSampleBindGroup,
@@ -372,6 +373,40 @@ describe('ensureWgpuIblSampleLayout', () => {
372
373
  });
373
374
  });
374
375
 
376
+ describe('ensureWgpuInstanceBuffer', () => {
377
+ it('creates a GPU buffer sized for the given instance count', () => {
378
+ const { fake, state } = makeWgpuScene3DState();
379
+ const matrices = new Float32Array(16);
380
+ matrices[0] = 1;
381
+ matrices[5] = 1;
382
+ matrices[10] = 1;
383
+ matrices[15] = 1;
384
+ const buffer = ensureWgpuInstanceBuffer(state, matrices, 1);
385
+ expect(buffer).toBeDefined();
386
+ expect(fake.calls.some((c) => c.name === 'createBuffer')).toBe(true);
387
+ });
388
+
389
+ it('reuses the buffer when capacity is sufficient', () => {
390
+ const { fake, state } = makeWgpuScene3DState();
391
+ const matrices = new Float32Array(16);
392
+ matrices[0] = 1;
393
+ matrices[5] = 1;
394
+ matrices[10] = 1;
395
+ matrices[15] = 1;
396
+ const a = ensureWgpuInstanceBuffer(state, matrices, 1);
397
+ const buffersBefore = fake.calls.filter((c) => c.name === 'createBuffer').length;
398
+ const b = ensureWgpuInstanceBuffer(state, matrices, 1);
399
+ expect(a).toBe(b);
400
+ expect(fake.calls.filter((c) => c.name === 'createBuffer').length).toBe(buffersBefore);
401
+ });
402
+
403
+ it('falls back to an identity matrix when matrices is null', () => {
404
+ const { state } = makeWgpuScene3DState();
405
+ const buffer = ensureWgpuInstanceBuffer(state, null, 1);
406
+ expect(buffer).toBeDefined();
407
+ });
408
+ });
409
+
375
410
  describe('ensureWgpuMaterialBinding', () => {
376
411
  const layout = {} as GPUBindGroupLayout;
377
412
  const sampler = {} as GPUSampler;