@luma.gl/core 9.1.0-beta.8 → 9.1.0

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 (33) hide show
  1. package/dist/adapter/canvas-context.d.ts +30 -73
  2. package/dist/adapter/canvas-context.d.ts.map +1 -1
  3. package/dist/adapter/canvas-context.js +97 -203
  4. package/dist/adapter/canvas-context.js.map +1 -1
  5. package/dist/adapter/device.d.ts +3 -24
  6. package/dist/adapter/device.d.ts.map +1 -1
  7. package/dist/adapter/device.js +10 -22
  8. package/dist/adapter/device.js.map +1 -1
  9. package/dist/adapter/luma.js +1 -1
  10. package/dist/adapter/luma.js.map +1 -1
  11. package/dist/adapter/resources/render-pipeline.d.ts +1 -6
  12. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  13. package/dist/adapter/resources/render-pipeline.js +4 -2
  14. package/dist/adapter/resources/render-pipeline.js.map +1 -1
  15. package/dist/adapter/resources/vertex-array.d.ts +2 -4
  16. package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
  17. package/dist/adapter/resources/vertex-array.js +6 -3
  18. package/dist/adapter/resources/vertex-array.js.map +1 -1
  19. package/dist/dist.dev.js +115 -210
  20. package/dist/dist.min.js +6 -6
  21. package/dist/gpu-type-utils/texture-format-table.js +1 -1
  22. package/dist/gpu-type-utils/texture-format-table.js.map +1 -1
  23. package/dist/gpu-type-utils/texture-formats.d.ts +2 -2
  24. package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -1
  25. package/dist/index.cjs +117 -206
  26. package/dist/index.cjs.map +3 -3
  27. package/package.json +2 -2
  28. package/src/adapter/canvas-context.ts +122 -272
  29. package/src/adapter/device.ts +15 -50
  30. package/src/adapter/resources/render-pipeline.ts +12 -18
  31. package/src/adapter/resources/vertex-array.ts +9 -8
  32. package/src/gpu-type-utils/texture-format-table.ts +1 -1
  33. package/src/gpu-type-utils/texture-formats.ts +1 -2
@@ -7,13 +7,10 @@ import type {UniformValue} from '../types/uniforms';
7
7
  import type {PrimitiveTopology, RenderPipelineParameters} from '../types/parameters';
8
8
  import type {ShaderLayout, Binding} from '../types/shader-layout';
9
9
  import type {BufferLayout} from '../types/buffer-layout';
10
- import type {
11
- ColorTextureFormat,
12
- DepthStencilTextureFormat
13
- } from '@luma.gl/core/gpu-type-utils/texture-formats';
10
+ // import {normalizeAttributeMap} from '../helpers/attribute-bindings';
11
+ import {Resource, ResourceProps} from './resource';
14
12
  import type {Shader} from './shader';
15
13
  import type {RenderPass} from './render-pass';
16
- import {Resource, ResourceProps} from './resource';
17
14
  import {VertexArray} from './vertex-array';
18
15
  import {TransformFeedback} from './transform-feedback';
19
16
 
@@ -40,18 +37,15 @@ export type RenderPipelineProps = ResourceProps & {
40
37
 
41
38
  /** Determines how vertices are read from the 'vertex' attributes */
42
39
  topology?: PrimitiveTopology;
43
-
44
- // color attachment information (needed on WebGPU)
45
-
46
- /** Color attachments expected by this pipeline. Defaults to [device.preferredColorFormat]. Array needs not be contiguous. */
47
- colorAttachmentFormats?: (ColorTextureFormat | null)[];
48
- /** Depth attachment expected by this pipeline (if depth parameters are specified). Defaults to device.preferredDepthFormat */
49
- depthStencilAttachmentFormat?: DepthStencilTextureFormat;
50
-
51
40
  /** Parameters that are controlled by pipeline */
52
41
  parameters?: RenderPipelineParameters;
53
42
 
54
- // Dynamic bindings (TODO - pipelines should be immutable, move to RenderPass)
43
+ // /** Use instanced rendering? */
44
+ // isInstanced?: boolean;
45
+ // /** Number of instances */
46
+ // instanceCount?: number;
47
+ // /** Number of vertices */
48
+ // vertexCount?: number;
55
49
 
56
50
  /** Buffers, Textures, Samplers for the shader bindings */
57
51
  bindings?: Record<string, Binding>;
@@ -77,12 +71,12 @@ export abstract class RenderPipeline extends Resource<RenderPipelineProps> {
77
71
  shaderLayout: null,
78
72
  bufferLayout: [],
79
73
  topology: 'triangle-list',
80
-
81
- colorAttachmentFormats: undefined!,
82
- depthStencilAttachmentFormat: undefined!,
83
-
84
74
  parameters: {},
85
75
 
76
+ // isInstanced: false,
77
+ // instanceCount: 0,
78
+ // vertexCount: 0,
79
+
86
80
  bindings: {},
87
81
  uniforms: {}
88
82
  };
@@ -10,14 +10,12 @@ import {
10
10
  import type {Device} from '../device';
11
11
  import type {Buffer} from './buffer';
12
12
  import type {RenderPass} from './render-pass';
13
+ import type {RenderPipeline} from './render-pipeline';
13
14
  import {Resource, ResourceProps} from './resource';
14
- import {ShaderLayout} from '../types/shader-layout';
15
- import {BufferLayout} from '../types/buffer-layout';
16
15
 
17
16
  /** Properties for initializing a VertexArray */
18
17
  export type VertexArrayProps = ResourceProps & {
19
- shaderLayout: ShaderLayout;
20
- bufferLayout: BufferLayout[];
18
+ renderPipeline: RenderPipeline | null;
21
19
  };
22
20
 
23
21
  /**
@@ -30,8 +28,7 @@ export type VertexArrayProps = ResourceProps & {
30
28
  export abstract class VertexArray extends Resource<VertexArrayProps> {
31
29
  static override defaultProps: Required<VertexArrayProps> = {
32
30
  ...Resource.defaultProps,
33
- shaderLayout: undefined!,
34
- bufferLayout: []
31
+ renderPipeline: null
35
32
  };
36
33
 
37
34
  override get [Symbol.toStringTag](): string {
@@ -52,9 +49,13 @@ export abstract class VertexArray extends Resource<VertexArrayProps> {
52
49
  super(device, props, VertexArray.defaultProps);
53
50
  this.maxVertexAttributes = device.limits.maxVertexAttributes;
54
51
  this.attributes = new Array(this.maxVertexAttributes).fill(null);
52
+ const {shaderLayout, bufferLayout} = props.renderPipeline || {};
53
+ if (!shaderLayout || !bufferLayout) {
54
+ throw new Error('VertexArray');
55
+ }
55
56
  this.attributeInfos = getAttributeInfosByLocation(
56
- props.shaderLayout,
57
- props.bufferLayout,
57
+ shaderLayout,
58
+ bufferLayout,
58
59
  this.maxVertexAttributes
59
60
  );
60
61
  }
@@ -117,7 +117,7 @@ const TEXTURE_FORMAT_TABLE: Readonly<Record<TextureFormat, TextureFormatDefiniti
117
117
  'rgb9e5ufloat': {channels: 'rgb', packed: true, render: rgb9e5ufloat_renderable}, // , filter: true},
118
118
  'rg11b10ufloat': {channels: 'rgb', bitsPerChannel: [11, 11, 10, 0], packed: true, p: 1,render: float32_renderable},
119
119
  'rgb10a2unorm': {channels: 'rgba', bitsPerChannel: [10, 10, 10, 2], packed: true, p: 1},
120
- 'rgb10a2uint': {channels: 'rgba', bitsPerChannel: [10, 10, 10, 2], packed: true, p: 1},
120
+ 'rgb10a2uint-webgl': {channels: 'rgba', bitsPerChannel: [10, 10, 10, 2], packed: true, p: 1, wgpu: false},
121
121
 
122
122
  // 48-bit formats
123
123
  'rgb16unorm-webgl': {f: norm16_renderable}, // rgb not renderable
@@ -54,7 +54,6 @@ export type WebGPUColorTextureFormat =
54
54
  // Packed 32-bit formats
55
55
  | 'rgb9e5ufloat'
56
56
  | 'rgb10a2unorm'
57
- | 'rgb10a2uint'
58
57
  | 'rg11b10ufloat'
59
58
 
60
59
  // 64-bit formats
@@ -144,7 +143,7 @@ export type WebGL2ColorTextureFormat =
144
143
  | 'rgb8snorm-webgl'
145
144
  | 'rg16unorm-webgl'
146
145
  | 'rg16snorm-webgl'
147
- | 'rgb10a2uint'
146
+ | 'rgb10a2uint-webgl'
148
147
  | 'rgb16unorm-webgl'
149
148
  | 'rgb16snorm-webgl'
150
149
  | 'rgba16unorm-webgl'