typegpu 0.3.3 → 0.3.4

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AnyWgslData, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, B as BaseWgslData, L as Location, n as AnyWgslStruct, W as WgslArray, o as WgslTypeLiteral, p as AnyVecInstance, q as AnyMatInstance } from './vector-CDD2FV2v.cjs';
2
- import { T as TgpuNamable, E as Exotic, A as AnyBuiltin, a as AnyAttribute, D as Default, U as UnionToIntersection, b as AnyData, c as Decorate, d as TgpuStruct, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, e as Disarray, K as KindToAcceptedAttribMap, f as Unstruct, V as VertexFormat, g as TgpuVertexAttrib, h as KindToDefaultFormatMap, i as OmitProps, P as Prettify, M as Mutable, j as Infer$1, k as ExoticArray } from './index-CuzbyKXg.cjs';
1
+ import { A as AnyWgslData, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, n as AnyWgslStruct, o as AnyData, B as BaseWgslData, L as Location, W as WgslArray, p as Disarray, K as KindToAcceptedAttribMap, q as Unstruct, r as VertexFormat, T as TgpuVertexAttrib, s as KindToDefaultFormatMap, M as MemIdentity, t as WgslTypeLiteral, u as AnyVecInstance, v as AnyMatInstance } from './wgslTypes-DHAmU620.cjs';
2
+ import { T as TgpuNamable, E as Exotic, A as AnyAttribute, a as AnyComputeBuiltin, D as Default, U as UnionToIntersection, b as Decorate, c as TgpuStruct, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, d as OmitProps, P as Prettify, M as Mutable, e as Infer$1, f as ExoticArray } from './index-DtGAMBfJ.cjs';
3
3
  import * as smol from 'tinyest';
4
4
  import { Block } from 'tinyest';
5
5
 
@@ -28,47 +28,6 @@ interface TgpuDeclare {
28
28
  */
29
29
  declare function declare(declaration: string): TgpuDeclare;
30
30
 
31
- /**
32
- * Describes a compute entry function signature (its arguments and return type)
33
- */
34
- interface TgpuComputeFnShell {
35
- readonly argTypes: [];
36
- readonly returnType: undefined;
37
- readonly workgroupSize: [number, number, number];
38
- /**
39
- * Creates a type-safe implementation of this signature
40
- */
41
- does(implementation: () => undefined): TgpuComputeFn;
42
- /**
43
- * @param implementation
44
- * Raw WGSL function implementation with header and body
45
- * without `fn` keyword and function name
46
- * e.g. `"(x: f32) -> f32 { return x; }"`;
47
- */
48
- does(implementation: string): TgpuComputeFn;
49
- }
50
- interface TgpuComputeFn extends TgpuNamable {
51
- readonly shell: TgpuComputeFnShell;
52
- $uses(dependencyMap: Record<string, unknown>): this;
53
- }
54
- interface ComputeFnOptions {
55
- workgroupSize: number[];
56
- }
57
- /**
58
- * Creates a shell of a typed entry function for the compute shader stage. Any function
59
- * that implements this shell can perform general-purpose computation.
60
- *
61
- * @param workgroupSize
62
- * Size of blocks that the thread grid will be divided into (up to 3 dimensions).
63
- */
64
- declare function computeFn(argTypes: AnyBuiltin[], options: ComputeFnOptions): TgpuComputeFnShell;
65
-
66
- interface Storage {
67
- usableAsStorage: true;
68
- }
69
- declare const Storage: Storage;
70
- declare function isUsableAsStorage<T>(value: T): value is T & Storage;
71
-
72
31
  /**
73
32
  * Information extracted from transpiling a JS function.
74
33
  */
@@ -103,6 +62,47 @@ type ExoticIO<T> = T extends {
103
62
  [K in keyof T]: Exotic<T[K]>;
104
63
  } : T;
105
64
 
65
+ /**
66
+ * Describes a compute entry function signature (its arguments and return type)
67
+ */
68
+ interface TgpuComputeFnShell<ComputeIn extends Record<string, AnyComputeBuiltin>> {
69
+ readonly argTypes: [AnyWgslStruct];
70
+ readonly returnType: undefined;
71
+ readonly workgroupSize: [number, number, number];
72
+ /**
73
+ * Creates a type-safe implementation of this signature
74
+ */
75
+ does(implementation: (input: InferIO<ComputeIn>) => undefined): TgpuComputeFn<ComputeIn>;
76
+ /**
77
+ * @param implementation
78
+ * Raw WGSL function implementation with header and body
79
+ * without `fn` keyword and function name
80
+ * e.g. `"(x: f32) -> f32 { return x; }"`;
81
+ */
82
+ does(implementation: string): TgpuComputeFn<ComputeIn>;
83
+ }
84
+ interface TgpuComputeFn<ComputeIn extends Record<string, AnyComputeBuiltin> = Record<string, AnyComputeBuiltin>> extends TgpuNamable {
85
+ readonly shell: TgpuComputeFnShell<ComputeIn>;
86
+ $uses(dependencyMap: Record<string, unknown>): this;
87
+ }
88
+ interface ComputeFnOptions {
89
+ workgroupSize: number[];
90
+ }
91
+ /**
92
+ * Creates a shell of a typed entry function for the compute shader stage. Any function
93
+ * that implements this shell can perform general-purpose computation.
94
+ *
95
+ * @param workgroupSize
96
+ * Size of blocks that the thread grid will be divided into (up to 3 dimensions).
97
+ */
98
+ declare function computeFn<ComputeIn extends Record<string, AnyComputeBuiltin>>(argTypes: ComputeIn, options: ComputeFnOptions): TgpuComputeFnShell<ComputeIn>;
99
+
100
+ interface Storage {
101
+ usableAsStorage: true;
102
+ }
103
+ declare const Storage: Storage;
104
+ declare function isUsableAsStorage<T>(value: T): value is T & Storage;
105
+
106
106
  /**
107
107
  * Used to transpile JS resources into SMoL on demand.
108
108
  */
@@ -842,7 +842,7 @@ interface TgpuBuffer$1<TData extends AnyData> extends TgpuNamable {
842
842
  $usage<T extends RestrictVertexUsages<TData>>(...usages: T): this & UnionToIntersection<LiteralToUsageType<T[number]>>;
843
843
  $addFlags(flags: GPUBufferUsageFlags): this;
844
844
  write(data: Infer<TData>): void;
845
- copyFrom(srcBuffer: TgpuBuffer$1<TData>): void;
845
+ copyFrom(srcBuffer: TgpuBuffer$1<MemIdentity<TData>>): void;
846
846
  read(): Promise<Infer<TData>>;
847
847
  destroy(): void;
848
848
  }
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AnyWgslData, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, B as BaseWgslData, L as Location, n as AnyWgslStruct, W as WgslArray, o as WgslTypeLiteral, p as AnyVecInstance, q as AnyMatInstance } from './vector-CDD2FV2v.js';
2
- import { T as TgpuNamable, E as Exotic, A as AnyBuiltin, a as AnyAttribute, D as Default, U as UnionToIntersection, b as AnyData, c as Decorate, d as TgpuStruct, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, e as Disarray, K as KindToAcceptedAttribMap, f as Unstruct, V as VertexFormat, g as TgpuVertexAttrib, h as KindToDefaultFormatMap, i as OmitProps, P as Prettify, M as Mutable, j as Infer$1, k as ExoticArray } from './index-FHKuURMs.js';
1
+ import { A as AnyWgslData, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, n as AnyWgslStruct, o as AnyData, B as BaseWgslData, L as Location, W as WgslArray, p as Disarray, K as KindToAcceptedAttribMap, q as Unstruct, r as VertexFormat, T as TgpuVertexAttrib, s as KindToDefaultFormatMap, M as MemIdentity, t as WgslTypeLiteral, u as AnyVecInstance, v as AnyMatInstance } from './wgslTypes-DHAmU620.js';
2
+ import { T as TgpuNamable, E as Exotic, A as AnyAttribute, a as AnyComputeBuiltin, D as Default, U as UnionToIntersection, b as Decorate, c as TgpuStruct, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, d as OmitProps, P as Prettify, M as Mutable, e as Infer$1, f as ExoticArray } from './index-FeXoGB17.js';
3
3
  import * as smol from 'tinyest';
4
4
  import { Block } from 'tinyest';
5
5
 
@@ -28,47 +28,6 @@ interface TgpuDeclare {
28
28
  */
29
29
  declare function declare(declaration: string): TgpuDeclare;
30
30
 
31
- /**
32
- * Describes a compute entry function signature (its arguments and return type)
33
- */
34
- interface TgpuComputeFnShell {
35
- readonly argTypes: [];
36
- readonly returnType: undefined;
37
- readonly workgroupSize: [number, number, number];
38
- /**
39
- * Creates a type-safe implementation of this signature
40
- */
41
- does(implementation: () => undefined): TgpuComputeFn;
42
- /**
43
- * @param implementation
44
- * Raw WGSL function implementation with header and body
45
- * without `fn` keyword and function name
46
- * e.g. `"(x: f32) -> f32 { return x; }"`;
47
- */
48
- does(implementation: string): TgpuComputeFn;
49
- }
50
- interface TgpuComputeFn extends TgpuNamable {
51
- readonly shell: TgpuComputeFnShell;
52
- $uses(dependencyMap: Record<string, unknown>): this;
53
- }
54
- interface ComputeFnOptions {
55
- workgroupSize: number[];
56
- }
57
- /**
58
- * Creates a shell of a typed entry function for the compute shader stage. Any function
59
- * that implements this shell can perform general-purpose computation.
60
- *
61
- * @param workgroupSize
62
- * Size of blocks that the thread grid will be divided into (up to 3 dimensions).
63
- */
64
- declare function computeFn(argTypes: AnyBuiltin[], options: ComputeFnOptions): TgpuComputeFnShell;
65
-
66
- interface Storage {
67
- usableAsStorage: true;
68
- }
69
- declare const Storage: Storage;
70
- declare function isUsableAsStorage<T>(value: T): value is T & Storage;
71
-
72
31
  /**
73
32
  * Information extracted from transpiling a JS function.
74
33
  */
@@ -103,6 +62,47 @@ type ExoticIO<T> = T extends {
103
62
  [K in keyof T]: Exotic<T[K]>;
104
63
  } : T;
105
64
 
65
+ /**
66
+ * Describes a compute entry function signature (its arguments and return type)
67
+ */
68
+ interface TgpuComputeFnShell<ComputeIn extends Record<string, AnyComputeBuiltin>> {
69
+ readonly argTypes: [AnyWgslStruct];
70
+ readonly returnType: undefined;
71
+ readonly workgroupSize: [number, number, number];
72
+ /**
73
+ * Creates a type-safe implementation of this signature
74
+ */
75
+ does(implementation: (input: InferIO<ComputeIn>) => undefined): TgpuComputeFn<ComputeIn>;
76
+ /**
77
+ * @param implementation
78
+ * Raw WGSL function implementation with header and body
79
+ * without `fn` keyword and function name
80
+ * e.g. `"(x: f32) -> f32 { return x; }"`;
81
+ */
82
+ does(implementation: string): TgpuComputeFn<ComputeIn>;
83
+ }
84
+ interface TgpuComputeFn<ComputeIn extends Record<string, AnyComputeBuiltin> = Record<string, AnyComputeBuiltin>> extends TgpuNamable {
85
+ readonly shell: TgpuComputeFnShell<ComputeIn>;
86
+ $uses(dependencyMap: Record<string, unknown>): this;
87
+ }
88
+ interface ComputeFnOptions {
89
+ workgroupSize: number[];
90
+ }
91
+ /**
92
+ * Creates a shell of a typed entry function for the compute shader stage. Any function
93
+ * that implements this shell can perform general-purpose computation.
94
+ *
95
+ * @param workgroupSize
96
+ * Size of blocks that the thread grid will be divided into (up to 3 dimensions).
97
+ */
98
+ declare function computeFn<ComputeIn extends Record<string, AnyComputeBuiltin>>(argTypes: ComputeIn, options: ComputeFnOptions): TgpuComputeFnShell<ComputeIn>;
99
+
100
+ interface Storage {
101
+ usableAsStorage: true;
102
+ }
103
+ declare const Storage: Storage;
104
+ declare function isUsableAsStorage<T>(value: T): value is T & Storage;
105
+
106
106
  /**
107
107
  * Used to transpile JS resources into SMoL on demand.
108
108
  */
@@ -842,7 +842,7 @@ interface TgpuBuffer$1<TData extends AnyData> extends TgpuNamable {
842
842
  $usage<T extends RestrictVertexUsages<TData>>(...usages: T): this & UnionToIntersection<LiteralToUsageType<T[number]>>;
843
843
  $addFlags(flags: GPUBufferUsageFlags): this;
844
844
  write(data: Infer<TData>): void;
845
- copyFrom(srcBuffer: TgpuBuffer$1<TData>): void;
845
+ copyFrom(srcBuffer: TgpuBuffer$1<MemIdentity<TData>>): void;
846
846
  read(): Promise<Infer<TData>>;
847
847
  destroy(): void;
848
848
  }