@luma.gl/core 9.2.5 → 9.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/core",
3
- "version": "9.2.5",
3
+ "version": "9.2.6",
4
4
  "description": "The luma.gl core Device API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,5 +46,5 @@
46
46
  "@probe.gl/stats": "^4.0.8",
47
47
  "@types/offscreencanvas": "^2019.6.4"
48
48
  },
49
- "gitHead": "a8efd26edd0c61c7bb29ea700c6c38f544f60326"
49
+ "gitHead": "9c7a3adc09c7b23800df3f916762445ebc1fa924"
50
50
  }
@@ -756,6 +756,10 @@ or create a device with the 'debug: true' prop.`;
756
756
  newProps.indexType = 'uint32';
757
757
  } else if (props.data instanceof Uint16Array) {
758
758
  newProps.indexType = 'uint16';
759
+ } else if (props.data instanceof Uint8Array) {
760
+ // Convert uint8 to uint16 for WebGPU compatibility (WebGPU doesn't support uint8 indices)
761
+ newProps.data = new Uint16Array(props.data);
762
+ newProps.indexType = 'uint16';
759
763
  }
760
764
  }
761
765
  if (!newProps.indexType) {
@@ -17,8 +17,8 @@ export type BufferProps = ResourceProps & {
17
17
  byteLength?: number;
18
18
  /** Byte offset into the newly created Buffer to store data at */
19
19
  byteOffset?: number;
20
- /** If props.usage includes Buffer.INDEX */
21
- indexType?: 'uint16' | 'uint32';
20
+ /** If props.usage includes Buffer.INDEX. Note: uint8 indices are automatically converted to uint16 for WebGPU compatibility */
21
+ indexType?: 'uint8' | 'uint16' | 'uint32';
22
22
  /** Data to initialize the buffer with. */
23
23
  data?: ArrayBuffer | ArrayBufferView | null;
24
24
  /** Callback to initialize data without copy */
@@ -50,8 +50,8 @@ export abstract class Buffer extends Resource<BufferProps> {
50
50
 
51
51
  /** The usage with which this buffer was created */
52
52
  readonly usage: number;
53
- /** For index buffers, whether indices are 16 or 32 bit */
54
- readonly indexType?: 'uint16' | 'uint32';
53
+ /** For index buffers, whether indices are 8, 16 or 32 bit. Note: uint8 indices are automatically converted to uint16 for WebGPU compatibility */
54
+ readonly indexType?: 'uint8' | 'uint16' | 'uint32';
55
55
  /** Length of buffer in bytes */
56
56
  abstract byteLength: number;
57
57
  /** "Time" of last update, can be used to check if redraw is needed */
@@ -66,6 +66,8 @@ export abstract class Buffer extends Resource<BufferProps> {
66
66
  deducedProps.indexType = 'uint32';
67
67
  } else if (props.data instanceof Uint16Array) {
68
68
  deducedProps.indexType = 'uint16';
69
+ } else if (props.data instanceof Uint8Array) {
70
+ deducedProps.indexType = 'uint8';
69
71
  }
70
72
  }
71
73