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/chunk-RFXJKOYG.cjs +2 -0
- package/chunk-RFXJKOYG.cjs.map +1 -0
- package/chunk-RW6OZYQI.js +2 -0
- package/chunk-RW6OZYQI.js.map +1 -0
- package/data/index.cjs +1 -192
- package/data/index.d.cts +2 -2
- package/data/index.d.ts +2 -2
- package/data/index.js +1 -192
- package/index-DtGAMBfJ.d.cts +407 -0
- package/index-FeXoGB17.d.ts +407 -0
- package/index.cjs +14 -4269
- package/index.cjs.map +1 -1
- package/index.d.cts +44 -44
- package/index.d.ts +44 -44
- package/index.js +14 -4269
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/std/index.cjs +1 -490
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +3 -2
- package/std/index.d.ts +3 -2
- package/std/index.js +1 -490
- package/std/index.js.map +1 -1
- package/{vector-CDD2FV2v.d.ts → wgslTypes-DHAmU620.d.cts} +603 -246
- package/{vector-CDD2FV2v.d.cts → wgslTypes-DHAmU620.d.ts} +603 -246
- package/chunk-2CMWQRQC.cjs +0 -2
- package/chunk-2CMWQRQC.cjs.map +0 -1
- package/chunk-2ZAQFPSX.js +0 -1266
- package/chunk-2ZAQFPSX.js.map +0 -1
- package/chunk-35UVS2JJ.cjs +0 -591
- package/chunk-35UVS2JJ.cjs.map +0 -1
- package/chunk-CMYXKKUP.cjs +0 -1266
- package/chunk-CMYXKKUP.cjs.map +0 -1
- package/chunk-DDEF2Y4S.js +0 -591
- package/chunk-DDEF2Y4S.js.map +0 -1
- package/chunk-KYBPSQX5.js +0 -2
- package/chunk-KYBPSQX5.js.map +0 -1
- package/index-CuzbyKXg.d.cts +0 -751
- package/index-FHKuURMs.d.ts +0 -751
@@ -1,3 +1,592 @@
|
|
1
|
+
/**
|
2
|
+
* Type encompassing all available kinds of vector.
|
3
|
+
*/
|
4
|
+
type VecKind = 'vec2f' | 'vec2i' | 'vec2u' | 'vec2h' | 'vec3f' | 'vec3i' | 'vec3u' | 'vec3h' | 'vec4f' | 'vec4i' | 'vec4u' | 'vec4h';
|
5
|
+
/**
|
6
|
+
* Type of the `d.vec2f` object/function: vector data type schema/constructor
|
7
|
+
*/
|
8
|
+
type NativeVec2f = Vec2f & {
|
9
|
+
'~exotic': Vec2f;
|
10
|
+
} & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
|
11
|
+
/**
|
12
|
+
*
|
13
|
+
* Schema representing vec2f - a vector with 2 elements of type f32.
|
14
|
+
* Also a constructor function for this vector value.
|
15
|
+
*
|
16
|
+
* @example
|
17
|
+
* const vector = d.vec2f(); // (0.0, 0.0)
|
18
|
+
* const vector = d.vec2f(1); // (1.0, 1.0)
|
19
|
+
* const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
|
23
|
+
*/
|
24
|
+
declare const vec2f: NativeVec2f;
|
25
|
+
/**
|
26
|
+
* Type of the `d.vec2h` object/function: vector data type schema/constructor
|
27
|
+
*/
|
28
|
+
type NativeVec2h = Vec2h & {
|
29
|
+
'~exotic': Vec2h;
|
30
|
+
} & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
|
31
|
+
/**
|
32
|
+
*
|
33
|
+
* Schema representing vec2h - a vector with 2 elements of type f16.
|
34
|
+
* Also a constructor function for this vector value.
|
35
|
+
*
|
36
|
+
* @example
|
37
|
+
* const vector = d.vec2h(); // (0.0, 0.0)
|
38
|
+
* const vector = d.vec2h(1); // (1.0, 1.0)
|
39
|
+
* const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
|
40
|
+
*
|
41
|
+
* @example
|
42
|
+
* const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
|
43
|
+
*/
|
44
|
+
declare const vec2h: NativeVec2h;
|
45
|
+
/**
|
46
|
+
* Type of the `d.vec2i` object/function: vector data type schema/constructor
|
47
|
+
*/
|
48
|
+
type NativeVec2i = Vec2i & {
|
49
|
+
'~exotic': Vec2i;
|
50
|
+
} & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
|
51
|
+
/**
|
52
|
+
*
|
53
|
+
* Schema representing vec2i - a vector with 2 elements of type i32.
|
54
|
+
* Also a constructor function for this vector value.
|
55
|
+
*
|
56
|
+
* @example
|
57
|
+
* const vector = d.vec2i(); // (0, 0)
|
58
|
+
* const vector = d.vec2i(1); // (1, 1)
|
59
|
+
* const vector = d.vec2i(-1, 1); // (-1, 1)
|
60
|
+
*
|
61
|
+
* @example
|
62
|
+
* const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
|
63
|
+
*/
|
64
|
+
declare const vec2i: NativeVec2i;
|
65
|
+
/**
|
66
|
+
* Type of the `d.vec2u` object/function: vector data type schema/constructor
|
67
|
+
*/
|
68
|
+
type NativeVec2u = Vec2u & {
|
69
|
+
'~exotic': Vec2u;
|
70
|
+
} & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
|
71
|
+
/**
|
72
|
+
*
|
73
|
+
* Schema representing vec2u - a vector with 2 elements of type u32.
|
74
|
+
* Also a constructor function for this vector value.
|
75
|
+
*
|
76
|
+
* @example
|
77
|
+
* const vector = d.vec2u(); // (0, 0)
|
78
|
+
* const vector = d.vec2u(1); // (1, 1)
|
79
|
+
* const vector = d.vec2u(1, 2); // (1, 2)
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
|
83
|
+
*/
|
84
|
+
declare const vec2u: NativeVec2u;
|
85
|
+
/**
|
86
|
+
* Type of the `d.vec3f` object/function: vector data type schema/constructor
|
87
|
+
*/
|
88
|
+
type NativeVec3f = Vec3f & {
|
89
|
+
'~exotic': Vec3f;
|
90
|
+
} & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
|
91
|
+
/**
|
92
|
+
*
|
93
|
+
* Schema representing vec3f - a vector with 3 elements of type f32.
|
94
|
+
* Also a constructor function for this vector value.
|
95
|
+
*
|
96
|
+
* @example
|
97
|
+
* const vector = d.vec3f(); // (0.0, 0.0, 0.0)
|
98
|
+
* const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
|
99
|
+
* const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
|
100
|
+
*
|
101
|
+
* @example
|
102
|
+
* const buffer = root.createBuffer(d.vec3f, d.vec3f(0, 1, 2)); // buffer holding a d.vec3f value, with an initial value of vec3f(0, 1, 2);
|
103
|
+
*/
|
104
|
+
declare const vec3f: NativeVec3f;
|
105
|
+
/**
|
106
|
+
* Type of the `d.vec3h` object/function: vector data type schema/constructor
|
107
|
+
*/
|
108
|
+
type NativeVec3h = Vec3h & {
|
109
|
+
'~exotic': Vec3h;
|
110
|
+
} & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
|
111
|
+
/**
|
112
|
+
*
|
113
|
+
* Schema representing vec3h - a vector with 3 elements of type f16.
|
114
|
+
* Also a constructor function for this vector value.
|
115
|
+
*
|
116
|
+
* @example
|
117
|
+
* const vector = d.vec3h(); // (0.0, 0.0, 0.0)
|
118
|
+
* const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
|
119
|
+
* const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
|
120
|
+
*
|
121
|
+
* @example
|
122
|
+
* const buffer = root.createBuffer(d.vec3h, d.vec3h(0, 1, 2)); // buffer holding a d.vec3h value, with an initial value of vec3h(0, 1, 2);
|
123
|
+
*/
|
124
|
+
declare const vec3h: NativeVec3h;
|
125
|
+
/**
|
126
|
+
* Type of the `d.vec3i` object/function: vector data type schema/constructor
|
127
|
+
*/
|
128
|
+
type NativeVec3i = Vec3i & {
|
129
|
+
'~exotic': Vec3i;
|
130
|
+
} & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
|
131
|
+
/**
|
132
|
+
*
|
133
|
+
* Schema representing vec3i - a vector with 3 elements of type i32.
|
134
|
+
* Also a constructor function for this vector value.
|
135
|
+
*
|
136
|
+
* @example
|
137
|
+
* const vector = d.vec3i(); // (0, 0, 0)
|
138
|
+
* const vector = d.vec3i(1); // (1, 1, 1)
|
139
|
+
* const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
|
140
|
+
*
|
141
|
+
* @example
|
142
|
+
* const buffer = root.createBuffer(d.vec3i, d.vec3i(0, 1, 2)); // buffer holding a d.vec3i value, with an initial value of vec3i(0, 1, 2);
|
143
|
+
*/
|
144
|
+
declare const vec3i: NativeVec3i;
|
145
|
+
/**
|
146
|
+
* Type of the `d.vec3u` object/function: vector data type schema/constructor
|
147
|
+
*/
|
148
|
+
type NativeVec3u = Vec3u & {
|
149
|
+
'~exotic': Vec3u;
|
150
|
+
} & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
|
151
|
+
/**
|
152
|
+
*
|
153
|
+
* Schema representing vec3u - a vector with 3 elements of type u32.
|
154
|
+
* Also a constructor function for this vector value.
|
155
|
+
*
|
156
|
+
* @example
|
157
|
+
* const vector = d.vec3u(); // (0, 0, 0)
|
158
|
+
* const vector = d.vec3u(1); // (1, 1, 1)
|
159
|
+
* const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
|
160
|
+
*
|
161
|
+
* @example
|
162
|
+
* const buffer = root.createBuffer(d.vec3u, d.vec3u(0, 1, 2)); // buffer holding a d.vec3u value, with an initial value of vec3u(0, 1, 2);
|
163
|
+
*/
|
164
|
+
declare const vec3u: NativeVec3u;
|
165
|
+
/**
|
166
|
+
* Type of the `d.vec4f` object/function: vector data type schema/constructor
|
167
|
+
*/
|
168
|
+
type NativeVec4f = Vec4f & {
|
169
|
+
'~exotic': Vec4f;
|
170
|
+
} & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
|
171
|
+
/**
|
172
|
+
*
|
173
|
+
* Schema representing vec4f - a vector with 4 elements of type f32.
|
174
|
+
* Also a constructor function for this vector value.
|
175
|
+
*
|
176
|
+
* @example
|
177
|
+
* const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
|
178
|
+
* const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
|
179
|
+
* const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
|
180
|
+
*
|
181
|
+
* @example
|
182
|
+
* const buffer = root.createBuffer(d.vec4f, d.vec4f(0, 1, 2, 3)); // buffer holding a d.vec4f value, with an initial value of vec4f(0, 1, 2, 3);
|
183
|
+
*/
|
184
|
+
declare const vec4f: NativeVec4f;
|
185
|
+
/**
|
186
|
+
* Type of the `d.vec4h` object/function: vector data type schema/constructor
|
187
|
+
*/
|
188
|
+
type NativeVec4h = Vec4h & {
|
189
|
+
'~exotic': Vec4h;
|
190
|
+
} & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
|
191
|
+
/**
|
192
|
+
*
|
193
|
+
* Schema representing vec4h - a vector with 4 elements of type f16.
|
194
|
+
* Also a constructor function for this vector value.
|
195
|
+
*
|
196
|
+
* @example
|
197
|
+
* const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
|
198
|
+
* const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
|
199
|
+
* const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
|
200
|
+
*
|
201
|
+
* @example
|
202
|
+
* const buffer = root.createBuffer(d.vec4h, d.vec4h(0, 1, 2, 3)); // buffer holding a d.vec4h value, with an initial value of vec4h(0, 1, 2, 3);
|
203
|
+
*/
|
204
|
+
declare const vec4h: NativeVec4h;
|
205
|
+
/**
|
206
|
+
* Type of the `d.vec4i` object/function: vector data type schema/constructor
|
207
|
+
*/
|
208
|
+
type NativeVec4i = Vec4i & {
|
209
|
+
'~exotic': Vec4i;
|
210
|
+
} & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
|
211
|
+
/**
|
212
|
+
*
|
213
|
+
* Schema representing vec4i - a vector with 4 elements of type i32.
|
214
|
+
* Also a constructor function for this vector value.
|
215
|
+
*
|
216
|
+
* @example
|
217
|
+
* const vector = d.vec4i(); // (0, 0, 0, 0)
|
218
|
+
* const vector = d.vec4i(1); // (1, 1, 1, 1)
|
219
|
+
* const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
|
220
|
+
*
|
221
|
+
* @example
|
222
|
+
* const buffer = root.createBuffer(d.vec4i, d.vec4i(0, 1, 2, 3)); // buffer holding a d.vec4i value, with an initial value of vec4i(0, 1, 2, 3);
|
223
|
+
*/
|
224
|
+
declare const vec4i: NativeVec4i;
|
225
|
+
/**
|
226
|
+
* Type of the `d.vec4u` object/function: vector data type schema/constructor
|
227
|
+
*/
|
228
|
+
type NativeVec4u = Vec4u & {
|
229
|
+
'~exotic': Vec4u;
|
230
|
+
} & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
|
231
|
+
/**
|
232
|
+
*
|
233
|
+
* Schema representing vec4u - a vector with 4 elements of type u32.
|
234
|
+
* Also a constructor function for this vector value.
|
235
|
+
*
|
236
|
+
* @example
|
237
|
+
* const vector = d.vec4u(); // (0, 0, 0, 0)
|
238
|
+
* const vector = d.vec4u(1); // (1, 1, 1, 1)
|
239
|
+
* const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
|
240
|
+
*
|
241
|
+
* @example
|
242
|
+
* const buffer = root.createBuffer(d.vec4u, d.vec4u(0, 1, 2, 3)); // buffer holding a d.vec4u value, with an initial value of vec4u(0, 1, 2, 3);
|
243
|
+
*/
|
244
|
+
declare const vec4u: NativeVec4u;
|
245
|
+
|
246
|
+
/**
|
247
|
+
* A schema that represents a boolean value. (equivalent to `bool` in WGSL)
|
248
|
+
*/
|
249
|
+
declare const bool: Bool;
|
250
|
+
/**
|
251
|
+
* Unsigned 32-bit integer schema representing a single WGSL u32 value.
|
252
|
+
*/
|
253
|
+
type NativeU32 = U32 & {
|
254
|
+
'~exotic': U32;
|
255
|
+
} & ((v: number | boolean) => number);
|
256
|
+
/**
|
257
|
+
* A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
|
258
|
+
*
|
259
|
+
* Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
|
260
|
+
*
|
261
|
+
* @example
|
262
|
+
* const value = u32(3.14); // 3
|
263
|
+
* @example
|
264
|
+
* const value = u32(-1); // 4294967295
|
265
|
+
* @example
|
266
|
+
* const value = u32(-3.1); // 0
|
267
|
+
*/
|
268
|
+
declare const u32: NativeU32;
|
269
|
+
/**
|
270
|
+
* Signed 32-bit integer schema representing a single WGSL i32 value.
|
271
|
+
*/
|
272
|
+
type NativeI32 = I32 & {
|
273
|
+
'~exotic': I32;
|
274
|
+
} & ((v: number | boolean) => number);
|
275
|
+
/**
|
276
|
+
* A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
|
277
|
+
*
|
278
|
+
* Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
|
279
|
+
*
|
280
|
+
* @example
|
281
|
+
* const value = i32(3.14); // 3
|
282
|
+
* @example
|
283
|
+
* const value = i32(-3.9); // -3
|
284
|
+
* @example
|
285
|
+
* const value = i32(10000000000) // 1410065408
|
286
|
+
*/
|
287
|
+
declare const i32: NativeI32;
|
288
|
+
/**
|
289
|
+
* 32-bit float schema representing a single WGSL f32 value.
|
290
|
+
*/
|
291
|
+
type NativeF32 = F32 & {
|
292
|
+
'~exotic': F32;
|
293
|
+
} & ((v: number | boolean) => number);
|
294
|
+
/**
|
295
|
+
* A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
|
296
|
+
*
|
297
|
+
* Can also be called to cast a value to an f32.
|
298
|
+
*
|
299
|
+
* @example
|
300
|
+
* const value = f32(true); // 1
|
301
|
+
*/
|
302
|
+
declare const f32: NativeF32;
|
303
|
+
/**
|
304
|
+
* 16-bit float schema representing a single WGSL f16 value.
|
305
|
+
*/
|
306
|
+
type NativeF16 = F16 & {
|
307
|
+
'~exotic': F16;
|
308
|
+
} & ((v: number | boolean) => number);
|
309
|
+
/**
|
310
|
+
* A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
|
311
|
+
*
|
312
|
+
* Can also be called to cast a value to an f16.
|
313
|
+
*
|
314
|
+
* @example
|
315
|
+
* const value = f16(true); // 1
|
316
|
+
* @example
|
317
|
+
* const value = f16(21877.5); // 21872
|
318
|
+
*/
|
319
|
+
declare const f16: NativeF16;
|
320
|
+
|
321
|
+
declare const vertexFormats: readonly ["uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra"];
|
322
|
+
type VertexFormat = (typeof vertexFormats)[number];
|
323
|
+
declare const kindToDefaultFormatMap: {
|
324
|
+
readonly f32: "float32";
|
325
|
+
readonly vec2f: "float32x2";
|
326
|
+
readonly vec3f: "float32x3";
|
327
|
+
readonly vec4f: "float32x4";
|
328
|
+
readonly f16: "float16";
|
329
|
+
readonly vec2h: "float16x2";
|
330
|
+
readonly vec4h: "float16x4";
|
331
|
+
readonly u32: "uint32";
|
332
|
+
readonly vec2u: "uint32x2";
|
333
|
+
readonly vec3u: "uint32x3";
|
334
|
+
readonly vec4u: "uint32x4";
|
335
|
+
readonly i32: "sint32";
|
336
|
+
readonly vec2i: "sint32x2";
|
337
|
+
readonly vec3i: "sint32x3";
|
338
|
+
readonly vec4i: "sint32x4";
|
339
|
+
};
|
340
|
+
type KindToDefaultFormatMap = typeof kindToDefaultFormatMap;
|
341
|
+
interface TgpuVertexAttrib<TFormat extends VertexFormat = VertexFormat> {
|
342
|
+
readonly format: TFormat;
|
343
|
+
readonly offset: number;
|
344
|
+
}
|
345
|
+
/**
|
346
|
+
* All vertex attribute formats that can be interpreted as
|
347
|
+
* an single or multi component u32 in a shader.
|
348
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
349
|
+
*/
|
350
|
+
type U32CompatibleFormats = TgpuVertexAttrib<'uint8'> | TgpuVertexAttrib<'uint8x2'> | TgpuVertexAttrib<'uint8x4'> | TgpuVertexAttrib<'uint16'> | TgpuVertexAttrib<'uint16x2'> | TgpuVertexAttrib<'uint16x4'> | TgpuVertexAttrib<'uint32'> | TgpuVertexAttrib<'uint32x2'> | TgpuVertexAttrib<'uint32x3'> | TgpuVertexAttrib<'uint32x4'>;
|
351
|
+
/**
|
352
|
+
* All vertex attribute formats that can be interpreted as
|
353
|
+
* an single or multi component i32 in a shader.
|
354
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
355
|
+
*/
|
356
|
+
type I32CompatibleFormats = TgpuVertexAttrib<'sint8'> | TgpuVertexAttrib<'sint8x2'> | TgpuVertexAttrib<'sint8x4'> | TgpuVertexAttrib<'sint16'> | TgpuVertexAttrib<'sint16x2'> | TgpuVertexAttrib<'sint16x4'> | TgpuVertexAttrib<'sint32'> | TgpuVertexAttrib<'sint32x2'> | TgpuVertexAttrib<'sint32x3'> | TgpuVertexAttrib<'sint32x4'>;
|
357
|
+
/**
|
358
|
+
* All vertex attribute formats that can be interpreted as
|
359
|
+
* an single or multi component f32 in a shader.
|
360
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
361
|
+
*/
|
362
|
+
type F32CompatibleFormats = TgpuVertexAttrib<'unorm8'> | TgpuVertexAttrib<'unorm8x2'> | TgpuVertexAttrib<'unorm8x4'> | TgpuVertexAttrib<'snorm8'> | TgpuVertexAttrib<'snorm8x2'> | TgpuVertexAttrib<'snorm8x4'> | TgpuVertexAttrib<'unorm16'> | TgpuVertexAttrib<'unorm16x2'> | TgpuVertexAttrib<'unorm16x4'> | TgpuVertexAttrib<'snorm16'> | TgpuVertexAttrib<'snorm16x2'> | TgpuVertexAttrib<'snorm16x4'> | TgpuVertexAttrib<'float16'> | TgpuVertexAttrib<'float16x2'> | TgpuVertexAttrib<'float16x4'> | TgpuVertexAttrib<'float32'> | TgpuVertexAttrib<'float32x2'> | TgpuVertexAttrib<'float32x3'> | TgpuVertexAttrib<'float32x4'> | TgpuVertexAttrib<'unorm10-10-10-2'> | TgpuVertexAttrib<'unorm8x4-bgra'>;
|
363
|
+
/**
|
364
|
+
* All vertex attribute formats that can be interpreted as
|
365
|
+
* a single or multi component f16 in a shader. (same as f32 on the shader side)
|
366
|
+
* https://www.w3.org/TR/webgpu/#vertex-formats
|
367
|
+
*/
|
368
|
+
type F16CompatibleFormats = F32CompatibleFormats;
|
369
|
+
type KindToAcceptedAttribMap = {
|
370
|
+
u32: U32CompatibleFormats;
|
371
|
+
vec2u: U32CompatibleFormats;
|
372
|
+
vec3u: U32CompatibleFormats;
|
373
|
+
vec4u: U32CompatibleFormats;
|
374
|
+
i32: I32CompatibleFormats;
|
375
|
+
vec2i: I32CompatibleFormats;
|
376
|
+
vec3i: I32CompatibleFormats;
|
377
|
+
vec4i: I32CompatibleFormats;
|
378
|
+
f16: F16CompatibleFormats;
|
379
|
+
vec2h: F16CompatibleFormats;
|
380
|
+
vec3h: F16CompatibleFormats;
|
381
|
+
vec4h: F16CompatibleFormats;
|
382
|
+
f32: F32CompatibleFormats;
|
383
|
+
vec2f: F32CompatibleFormats;
|
384
|
+
vec3f: F32CompatibleFormats;
|
385
|
+
vec4f: F32CompatibleFormats;
|
386
|
+
};
|
387
|
+
|
388
|
+
type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
|
389
|
+
interface TgpuVertexFormatData<T extends VertexFormat> {
|
390
|
+
readonly '~repr': Infer<FormatToWGSLType<T>>;
|
391
|
+
readonly type: T;
|
392
|
+
}
|
393
|
+
declare const formatToWGSLType: {
|
394
|
+
readonly uint8: NativeU32;
|
395
|
+
readonly uint8x2: NativeVec2u;
|
396
|
+
readonly uint8x4: NativeVec4u;
|
397
|
+
readonly sint8: NativeI32;
|
398
|
+
readonly sint8x2: NativeVec2i;
|
399
|
+
readonly sint8x4: NativeVec4i;
|
400
|
+
readonly unorm8: NativeF32;
|
401
|
+
readonly unorm8x2: NativeVec2f;
|
402
|
+
readonly unorm8x4: NativeVec4f;
|
403
|
+
readonly snorm8: NativeF32;
|
404
|
+
readonly snorm8x2: NativeVec2f;
|
405
|
+
readonly snorm8x4: NativeVec4f;
|
406
|
+
readonly uint16: NativeU32;
|
407
|
+
readonly uint16x2: NativeVec2u;
|
408
|
+
readonly uint16x4: NativeVec4u;
|
409
|
+
readonly sint16: NativeI32;
|
410
|
+
readonly sint16x2: NativeVec2i;
|
411
|
+
readonly sint16x4: NativeVec4i;
|
412
|
+
readonly unorm16: NativeF32;
|
413
|
+
readonly unorm16x2: NativeVec2f;
|
414
|
+
readonly unorm16x4: NativeVec4f;
|
415
|
+
readonly snorm16: NativeF32;
|
416
|
+
readonly snorm16x2: NativeVec2f;
|
417
|
+
readonly snorm16x4: NativeVec4f;
|
418
|
+
readonly float16: NativeF32;
|
419
|
+
readonly float16x2: NativeVec2f;
|
420
|
+
readonly float16x4: NativeVec4f;
|
421
|
+
readonly float32: NativeF32;
|
422
|
+
readonly float32x2: NativeVec2f;
|
423
|
+
readonly float32x3: NativeVec3f;
|
424
|
+
readonly float32x4: NativeVec4f;
|
425
|
+
readonly uint32: NativeU32;
|
426
|
+
readonly uint32x2: NativeVec2u;
|
427
|
+
readonly uint32x3: NativeVec3u;
|
428
|
+
readonly uint32x4: NativeVec4u;
|
429
|
+
readonly sint32: NativeI32;
|
430
|
+
readonly sint32x2: NativeVec2i;
|
431
|
+
readonly sint32x3: NativeVec3i;
|
432
|
+
readonly sint32x4: NativeVec4i;
|
433
|
+
readonly 'unorm10-10-10-2': NativeVec4f;
|
434
|
+
readonly 'unorm8x4-bgra': NativeVec4f;
|
435
|
+
};
|
436
|
+
declare const packedFormats: string[];
|
437
|
+
type uint8 = TgpuVertexFormatData<'uint8'>;
|
438
|
+
declare const uint8: uint8;
|
439
|
+
type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
|
440
|
+
declare const uint8x2: uint8x2;
|
441
|
+
type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
|
442
|
+
declare const uint8x4: uint8x4;
|
443
|
+
type sint8 = TgpuVertexFormatData<'sint8'>;
|
444
|
+
declare const sint8: sint8;
|
445
|
+
type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
|
446
|
+
declare const sint8x2: sint8x2;
|
447
|
+
type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
|
448
|
+
declare const sint8x4: sint8x4;
|
449
|
+
type unorm8 = TgpuVertexFormatData<'unorm8'>;
|
450
|
+
declare const unorm8: unorm8;
|
451
|
+
type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
|
452
|
+
declare const unorm8x2: unorm8x2;
|
453
|
+
type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
|
454
|
+
declare const unorm8x4: unorm8x4;
|
455
|
+
type snorm8 = TgpuVertexFormatData<'snorm8'>;
|
456
|
+
declare const snorm8: snorm8;
|
457
|
+
type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
|
458
|
+
declare const snorm8x2: snorm8x2;
|
459
|
+
type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
|
460
|
+
declare const snorm8x4: snorm8x4;
|
461
|
+
type uint16 = TgpuVertexFormatData<'uint16'>;
|
462
|
+
declare const uint16: uint16;
|
463
|
+
type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
|
464
|
+
declare const uint16x2: uint16x2;
|
465
|
+
type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
|
466
|
+
declare const uint16x4: uint16x4;
|
467
|
+
type sint16 = TgpuVertexFormatData<'sint16'>;
|
468
|
+
declare const sint16: sint16;
|
469
|
+
type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
|
470
|
+
declare const sint16x2: sint16x2;
|
471
|
+
type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
|
472
|
+
declare const sint16x4: sint16x4;
|
473
|
+
type unorm16 = TgpuVertexFormatData<'unorm16'>;
|
474
|
+
declare const unorm16: unorm16;
|
475
|
+
type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
|
476
|
+
declare const unorm16x2: unorm16x2;
|
477
|
+
type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
|
478
|
+
declare const unorm16x4: unorm16x4;
|
479
|
+
type snorm16 = TgpuVertexFormatData<'snorm16'>;
|
480
|
+
declare const snorm16: snorm16;
|
481
|
+
type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
|
482
|
+
declare const snorm16x2: snorm16x2;
|
483
|
+
type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
|
484
|
+
declare const snorm16x4: snorm16x4;
|
485
|
+
type float16 = TgpuVertexFormatData<'float16'>;
|
486
|
+
declare const float16: float16;
|
487
|
+
type float16x2 = TgpuVertexFormatData<'float16x2'>;
|
488
|
+
declare const float16x2: float16x2;
|
489
|
+
type float16x4 = TgpuVertexFormatData<'float16x4'>;
|
490
|
+
declare const float16x4: float16x4;
|
491
|
+
type float32 = TgpuVertexFormatData<'float32'>;
|
492
|
+
declare const float32: float32;
|
493
|
+
type float32x2 = TgpuVertexFormatData<'float32x2'>;
|
494
|
+
declare const float32x2: float32x2;
|
495
|
+
type float32x3 = TgpuVertexFormatData<'float32x3'>;
|
496
|
+
declare const float32x3: float32x3;
|
497
|
+
type float32x4 = TgpuVertexFormatData<'float32x4'>;
|
498
|
+
declare const float32x4: float32x4;
|
499
|
+
type uint32 = TgpuVertexFormatData<'uint32'>;
|
500
|
+
declare const uint32: uint32;
|
501
|
+
type uint32x2 = TgpuVertexFormatData<'uint32x2'>;
|
502
|
+
declare const uint32x2: uint32x2;
|
503
|
+
type uint32x3 = TgpuVertexFormatData<'uint32x3'>;
|
504
|
+
declare const uint32x3: uint32x3;
|
505
|
+
type uint32x4 = TgpuVertexFormatData<'uint32x4'>;
|
506
|
+
declare const uint32x4: uint32x4;
|
507
|
+
type sint32 = TgpuVertexFormatData<'sint32'>;
|
508
|
+
declare const sint32: sint32;
|
509
|
+
type sint32x2 = TgpuVertexFormatData<'sint32x2'>;
|
510
|
+
declare const sint32x2: sint32x2;
|
511
|
+
type sint32x3 = TgpuVertexFormatData<'sint32x3'>;
|
512
|
+
declare const sint32x3: sint32x3;
|
513
|
+
type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
|
514
|
+
declare const sint32x4: sint32x4;
|
515
|
+
type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
|
516
|
+
declare const unorm10_10_10_2: unorm10_10_10_2;
|
517
|
+
type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
|
518
|
+
declare const unorm8x4_bgra: unorm8x4_bgra;
|
519
|
+
type PackedData = uint8 | uint8x2 | uint8x4 | sint8 | sint8x2 | sint8x4 | unorm8 | unorm8x2 | unorm8x4 | snorm8 | snorm8x2 | snorm8x4 | uint16 | uint16x2 | uint16x4 | sint16 | sint16x2 | sint16x4 | unorm16 | unorm16x2 | unorm16x4 | snorm16 | snorm16x2 | snorm16x4 | float16 | float16x2 | float16x4 | float32 | float32x2 | float32x3 | float32x4 | uint32 | uint32x2 | uint32x3 | uint32x4 | sint32 | sint32x2 | sint32x3 | sint32x4 | unorm10_10_10_2 | unorm8x4_bgra;
|
520
|
+
|
521
|
+
/**
|
522
|
+
* Array schema constructed via `d.disarrayOf` function.
|
523
|
+
*
|
524
|
+
* Useful for defining vertex buffers.
|
525
|
+
* Elements in the schema are not aligned in respect to their `byteAlignment`,
|
526
|
+
* unless they are explicitly decorated with the custom align attribute
|
527
|
+
* via `d.align` function.
|
528
|
+
*/
|
529
|
+
interface Disarray<TElement extends BaseWgslData = BaseWgslData> {
|
530
|
+
readonly type: 'disarray';
|
531
|
+
readonly elementCount: number;
|
532
|
+
readonly elementType: TElement;
|
533
|
+
readonly '~repr': Infer<TElement>[];
|
534
|
+
}
|
535
|
+
/**
|
536
|
+
* Struct schema constructed via `d.unstruct` function.
|
537
|
+
*
|
538
|
+
* Useful for defining vertex buffers, as the standard layout restrictions do not apply.
|
539
|
+
* Members are not aligned in respect to their `byteAlignment`,
|
540
|
+
* unless they are explicitly decorated with the custom align attribute
|
541
|
+
* via `d.align` function.
|
542
|
+
*/
|
543
|
+
interface Unstruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
|
544
|
+
readonly type: 'unstruct';
|
545
|
+
readonly propTypes: TProps;
|
546
|
+
readonly '~repr': InferRecord<TProps>;
|
547
|
+
}
|
548
|
+
interface LooseDecorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
|
549
|
+
readonly type: 'loose-decorated';
|
550
|
+
readonly inner: TInner;
|
551
|
+
readonly attribs: TAttribs;
|
552
|
+
readonly '~repr': Infer<TInner>;
|
553
|
+
}
|
554
|
+
declare const looseTypeLiterals: readonly ["unstruct", "disarray", "loose-decorated", "uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra"];
|
555
|
+
type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
|
556
|
+
type AnyLooseData = Disarray | Unstruct | LooseDecorated | PackedData;
|
557
|
+
declare function isLooseData(data: unknown): data is AnyLooseData;
|
558
|
+
/**
|
559
|
+
* Checks whether the passed in value is a disarray schema,
|
560
|
+
* as opposed to, e.g., a regular array schema.
|
561
|
+
*
|
562
|
+
* Array schemas can be used to describe uniform and storage buffers,
|
563
|
+
* whereas disarray schemas cannot. Disarrays are useful for
|
564
|
+
* defining vertex buffers instead.
|
565
|
+
*
|
566
|
+
* @example
|
567
|
+
* isDisarray(d.arrayOf(d.u32, 4)) // false
|
568
|
+
* isDisarray(d.disarrayOf(d.u32, 4)) // true
|
569
|
+
* isDisarray(d.vec3f) // false
|
570
|
+
*/
|
571
|
+
declare function isDisarray<T extends Disarray>(schema: T | unknown): schema is T;
|
572
|
+
/**
|
573
|
+
* Checks whether passed in value is a unstruct schema,
|
574
|
+
* as opposed to, e.g., a struct schema.
|
575
|
+
*
|
576
|
+
* Struct schemas can be used to describe uniform and storage buffers,
|
577
|
+
* whereas unstruct schemas cannot. Unstructs are useful for
|
578
|
+
* defining vertex buffers instead.
|
579
|
+
*
|
580
|
+
* @example
|
581
|
+
* isUnstruct(d.struct({ a: d.u32 })) // false
|
582
|
+
* isUnstruct(d.unstruct({ a: d.u32 })) // true
|
583
|
+
* isUnstruct(d.vec3f) // false
|
584
|
+
*/
|
585
|
+
declare function isUnstruct<T extends Unstruct>(schema: T | unknown): schema is T;
|
586
|
+
declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
|
587
|
+
declare function isData(value: unknown): value is AnyData;
|
588
|
+
type AnyData = AnyWgslData | AnyLooseData;
|
589
|
+
|
1
590
|
/**
|
2
591
|
* Extracts the inferred representation of a resource.
|
3
592
|
* @example
|
@@ -10,7 +599,14 @@ type Infer<T> = T extends {
|
|
10
599
|
type InferRecord<T extends Record<string | number | symbol, unknown>> = {
|
11
600
|
[Key in keyof T]: Infer<T[Key]>;
|
12
601
|
};
|
602
|
+
type MemIdentity<T> = T extends {
|
603
|
+
readonly '~memIdent': infer TMemIdent extends AnyData;
|
604
|
+
} ? TMemIdent : T;
|
605
|
+
type MemIdentityRecord<T extends Record<string | number | symbol, unknown>> = {
|
606
|
+
[Key in keyof T]: MemIdentity<T[Key]>;
|
607
|
+
};
|
13
608
|
|
609
|
+
type DecoratedLocation<T extends BaseWgslData> = Decorated<T, Location<number>[]>;
|
14
610
|
interface NumberArrayView {
|
15
611
|
readonly length: number;
|
16
612
|
[n: number]: number;
|
@@ -532,11 +1128,13 @@ interface I32 {
|
|
532
1128
|
readonly type: 'i32';
|
533
1129
|
/** Type-token, not available at runtime */
|
534
1130
|
readonly '~repr': number;
|
1131
|
+
readonly '~memIdent': I32 | Atomic<I32> | DecoratedLocation<I32>;
|
535
1132
|
}
|
536
1133
|
interface U32 {
|
537
1134
|
readonly type: 'u32';
|
538
1135
|
/** Type-token, not available at runtime */
|
539
1136
|
readonly '~repr': number;
|
1137
|
+
readonly '~memIdent': U32 | Atomic<U32> | DecoratedLocation<U32>;
|
540
1138
|
}
|
541
1139
|
interface Vec2f {
|
542
1140
|
readonly type: 'vec2f';
|
@@ -620,6 +1218,7 @@ interface WgslStruct<TProps extends Record<string, BaseWgslData> = Record<string
|
|
620
1218
|
readonly propTypes: TProps;
|
621
1219
|
/** Type-token, not available at runtime */
|
622
1220
|
readonly '~repr': InferRecord<TProps>;
|
1221
|
+
readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps>>;
|
623
1222
|
}
|
624
1223
|
type AnyWgslStruct = WgslStruct<any>;
|
625
1224
|
interface WgslArray<TElement = BaseWgslData> {
|
@@ -628,6 +1227,7 @@ interface WgslArray<TElement = BaseWgslData> {
|
|
628
1227
|
readonly elementType: TElement;
|
629
1228
|
/** Type-token, not available at runtime */
|
630
1229
|
readonly '~repr': Infer<TElement>[];
|
1230
|
+
readonly '~memIdent': WgslArray<MemIdentity<TElement>>;
|
631
1231
|
}
|
632
1232
|
interface PtrFn<TInner = BaseWgslData> {
|
633
1233
|
readonly type: 'ptrFn';
|
@@ -643,6 +1243,7 @@ interface Atomic<TInner extends U32 | I32 = U32 | I32> {
|
|
643
1243
|
readonly inner: TInner;
|
644
1244
|
/** Type-token, not available at runtime */
|
645
1245
|
readonly '~repr': Infer<TInner>;
|
1246
|
+
readonly '~memIdent': MemIdentity<TInner>;
|
646
1247
|
}
|
647
1248
|
interface Align<T extends number> {
|
648
1249
|
readonly type: '@align';
|
@@ -673,6 +1274,7 @@ interface Decorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends
|
|
673
1274
|
readonly attribs: TAttribs;
|
674
1275
|
/** Type-token, not available at runtime */
|
675
1276
|
readonly '~repr': Infer<TInner>;
|
1277
|
+
readonly '~memIdent': TAttribs extends Location<number>[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
|
676
1278
|
}
|
677
1279
|
declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f", "vec3h", "vec3i", "vec3u", "vec4f", "vec4h", "vec4i", "vec4u", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "ptrFn", "atomic", "decorated"];
|
678
1280
|
type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
|
@@ -729,249 +1331,4 @@ declare function isInterpolateAttrib<T extends Interpolate<InterpolationType>>(v
|
|
729
1331
|
declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
|
730
1332
|
declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
|
731
1333
|
|
732
|
-
|
733
|
-
* Type encompassing all available kinds of vector.
|
734
|
-
*/
|
735
|
-
type VecKind = 'vec2f' | 'vec2i' | 'vec2u' | 'vec2h' | 'vec3f' | 'vec3i' | 'vec3u' | 'vec3h' | 'vec4f' | 'vec4i' | 'vec4u' | 'vec4h';
|
736
|
-
/**
|
737
|
-
* Type of the `d.vec2f` object/function: vector data type schema/constructor
|
738
|
-
*/
|
739
|
-
type NativeVec2f = Vec2f & {
|
740
|
-
'~exotic': Vec2f;
|
741
|
-
} & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
|
742
|
-
/**
|
743
|
-
*
|
744
|
-
* Schema representing vec2f - a vector with 2 elements of type f32.
|
745
|
-
* Also a constructor function for this vector value.
|
746
|
-
*
|
747
|
-
* @example
|
748
|
-
* const vector = d.vec2f(); // (0.0, 0.0)
|
749
|
-
* const vector = d.vec2f(1); // (1.0, 1.0)
|
750
|
-
* const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
|
751
|
-
*
|
752
|
-
* @example
|
753
|
-
* const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
|
754
|
-
*/
|
755
|
-
declare const vec2f: NativeVec2f;
|
756
|
-
/**
|
757
|
-
* Type of the `d.vec2h` object/function: vector data type schema/constructor
|
758
|
-
*/
|
759
|
-
type NativeVec2h = Vec2h & {
|
760
|
-
'~exotic': Vec2h;
|
761
|
-
} & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
|
762
|
-
/**
|
763
|
-
*
|
764
|
-
* Schema representing vec2h - a vector with 2 elements of type f16.
|
765
|
-
* Also a constructor function for this vector value.
|
766
|
-
*
|
767
|
-
* @example
|
768
|
-
* const vector = d.vec2h(); // (0.0, 0.0)
|
769
|
-
* const vector = d.vec2h(1); // (1.0, 1.0)
|
770
|
-
* const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
|
771
|
-
*
|
772
|
-
* @example
|
773
|
-
* const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
|
774
|
-
*/
|
775
|
-
declare const vec2h: NativeVec2h;
|
776
|
-
/**
|
777
|
-
* Type of the `d.vec2i` object/function: vector data type schema/constructor
|
778
|
-
*/
|
779
|
-
type NativeVec2i = Vec2i & {
|
780
|
-
'~exotic': Vec2i;
|
781
|
-
} & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
|
782
|
-
/**
|
783
|
-
*
|
784
|
-
* Schema representing vec2i - a vector with 2 elements of type i32.
|
785
|
-
* Also a constructor function for this vector value.
|
786
|
-
*
|
787
|
-
* @example
|
788
|
-
* const vector = d.vec2i(); // (0, 0)
|
789
|
-
* const vector = d.vec2i(1); // (1, 1)
|
790
|
-
* const vector = d.vec2i(-1, 1); // (-1, 1)
|
791
|
-
*
|
792
|
-
* @example
|
793
|
-
* const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
|
794
|
-
*/
|
795
|
-
declare const vec2i: NativeVec2i;
|
796
|
-
/**
|
797
|
-
* Type of the `d.vec2u` object/function: vector data type schema/constructor
|
798
|
-
*/
|
799
|
-
type NativeVec2u = Vec2u & {
|
800
|
-
'~exotic': Vec2u;
|
801
|
-
} & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
|
802
|
-
/**
|
803
|
-
*
|
804
|
-
* Schema representing vec2u - a vector with 2 elements of type u32.
|
805
|
-
* Also a constructor function for this vector value.
|
806
|
-
*
|
807
|
-
* @example
|
808
|
-
* const vector = d.vec2u(); // (0, 0)
|
809
|
-
* const vector = d.vec2u(1); // (1, 1)
|
810
|
-
* const vector = d.vec2u(1, 2); // (1, 2)
|
811
|
-
*
|
812
|
-
* @example
|
813
|
-
* const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
|
814
|
-
*/
|
815
|
-
declare const vec2u: NativeVec2u;
|
816
|
-
/**
|
817
|
-
* Type of the `d.vec3f` object/function: vector data type schema/constructor
|
818
|
-
*/
|
819
|
-
type NativeVec3f = Vec3f & {
|
820
|
-
'~exotic': Vec3f;
|
821
|
-
} & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
|
822
|
-
/**
|
823
|
-
*
|
824
|
-
* Schema representing vec3f - a vector with 3 elements of type f32.
|
825
|
-
* Also a constructor function for this vector value.
|
826
|
-
*
|
827
|
-
* @example
|
828
|
-
* const vector = d.vec3f(); // (0.0, 0.0, 0.0)
|
829
|
-
* const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
|
830
|
-
* const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
|
831
|
-
*
|
832
|
-
* @example
|
833
|
-
* const buffer = root.createBuffer(d.vec3f, d.vec3f(0, 1, 2)); // buffer holding a d.vec3f value, with an initial value of vec3f(0, 1, 2);
|
834
|
-
*/
|
835
|
-
declare const vec3f: NativeVec3f;
|
836
|
-
/**
|
837
|
-
* Type of the `d.vec3h` object/function: vector data type schema/constructor
|
838
|
-
*/
|
839
|
-
type NativeVec3h = Vec3h & {
|
840
|
-
'~exotic': Vec3h;
|
841
|
-
} & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
|
842
|
-
/**
|
843
|
-
*
|
844
|
-
* Schema representing vec3h - a vector with 3 elements of type f16.
|
845
|
-
* Also a constructor function for this vector value.
|
846
|
-
*
|
847
|
-
* @example
|
848
|
-
* const vector = d.vec3h(); // (0.0, 0.0, 0.0)
|
849
|
-
* const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
|
850
|
-
* const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
|
851
|
-
*
|
852
|
-
* @example
|
853
|
-
* const buffer = root.createBuffer(d.vec3h, d.vec3h(0, 1, 2)); // buffer holding a d.vec3h value, with an initial value of vec3h(0, 1, 2);
|
854
|
-
*/
|
855
|
-
declare const vec3h: NativeVec3h;
|
856
|
-
/**
|
857
|
-
* Type of the `d.vec3i` object/function: vector data type schema/constructor
|
858
|
-
*/
|
859
|
-
type NativeVec3i = Vec3i & {
|
860
|
-
'~exotic': Vec3i;
|
861
|
-
} & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
|
862
|
-
/**
|
863
|
-
*
|
864
|
-
* Schema representing vec3i - a vector with 3 elements of type i32.
|
865
|
-
* Also a constructor function for this vector value.
|
866
|
-
*
|
867
|
-
* @example
|
868
|
-
* const vector = d.vec3i(); // (0, 0, 0)
|
869
|
-
* const vector = d.vec3i(1); // (1, 1, 1)
|
870
|
-
* const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
|
871
|
-
*
|
872
|
-
* @example
|
873
|
-
* const buffer = root.createBuffer(d.vec3i, d.vec3i(0, 1, 2)); // buffer holding a d.vec3i value, with an initial value of vec3i(0, 1, 2);
|
874
|
-
*/
|
875
|
-
declare const vec3i: NativeVec3i;
|
876
|
-
/**
|
877
|
-
* Type of the `d.vec3u` object/function: vector data type schema/constructor
|
878
|
-
*/
|
879
|
-
type NativeVec3u = Vec3u & {
|
880
|
-
'~exotic': Vec3u;
|
881
|
-
} & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
|
882
|
-
/**
|
883
|
-
*
|
884
|
-
* Schema representing vec3u - a vector with 3 elements of type u32.
|
885
|
-
* Also a constructor function for this vector value.
|
886
|
-
*
|
887
|
-
* @example
|
888
|
-
* const vector = d.vec3u(); // (0, 0, 0)
|
889
|
-
* const vector = d.vec3u(1); // (1, 1, 1)
|
890
|
-
* const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
|
891
|
-
*
|
892
|
-
* @example
|
893
|
-
* const buffer = root.createBuffer(d.vec3u, d.vec3u(0, 1, 2)); // buffer holding a d.vec3u value, with an initial value of vec3u(0, 1, 2);
|
894
|
-
*/
|
895
|
-
declare const vec3u: NativeVec3u;
|
896
|
-
/**
|
897
|
-
* Type of the `d.vec4f` object/function: vector data type schema/constructor
|
898
|
-
*/
|
899
|
-
type NativeVec4f = Vec4f & {
|
900
|
-
'~exotic': Vec4f;
|
901
|
-
} & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
|
902
|
-
/**
|
903
|
-
*
|
904
|
-
* Schema representing vec4f - a vector with 4 elements of type f32.
|
905
|
-
* Also a constructor function for this vector value.
|
906
|
-
*
|
907
|
-
* @example
|
908
|
-
* const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
|
909
|
-
* const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
|
910
|
-
* const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
|
911
|
-
*
|
912
|
-
* @example
|
913
|
-
* const buffer = root.createBuffer(d.vec4f, d.vec4f(0, 1, 2, 3)); // buffer holding a d.vec4f value, with an initial value of vec4f(0, 1, 2, 3);
|
914
|
-
*/
|
915
|
-
declare const vec4f: NativeVec4f;
|
916
|
-
/**
|
917
|
-
* Type of the `d.vec4h` object/function: vector data type schema/constructor
|
918
|
-
*/
|
919
|
-
type NativeVec4h = Vec4h & {
|
920
|
-
'~exotic': Vec4h;
|
921
|
-
} & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
|
922
|
-
/**
|
923
|
-
*
|
924
|
-
* Schema representing vec4h - a vector with 4 elements of type f16.
|
925
|
-
* Also a constructor function for this vector value.
|
926
|
-
*
|
927
|
-
* @example
|
928
|
-
* const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
|
929
|
-
* const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
|
930
|
-
* const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
|
931
|
-
*
|
932
|
-
* @example
|
933
|
-
* const buffer = root.createBuffer(d.vec4h, d.vec4h(0, 1, 2, 3)); // buffer holding a d.vec4h value, with an initial value of vec4h(0, 1, 2, 3);
|
934
|
-
*/
|
935
|
-
declare const vec4h: NativeVec4h;
|
936
|
-
/**
|
937
|
-
* Type of the `d.vec4i` object/function: vector data type schema/constructor
|
938
|
-
*/
|
939
|
-
type NativeVec4i = Vec4i & {
|
940
|
-
'~exotic': Vec4i;
|
941
|
-
} & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
|
942
|
-
/**
|
943
|
-
*
|
944
|
-
* Schema representing vec4i - a vector with 4 elements of type i32.
|
945
|
-
* Also a constructor function for this vector value.
|
946
|
-
*
|
947
|
-
* @example
|
948
|
-
* const vector = d.vec4i(); // (0, 0, 0, 0)
|
949
|
-
* const vector = d.vec4i(1); // (1, 1, 1, 1)
|
950
|
-
* const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
|
951
|
-
*
|
952
|
-
* @example
|
953
|
-
* const buffer = root.createBuffer(d.vec4i, d.vec4i(0, 1, 2, 3)); // buffer holding a d.vec4i value, with an initial value of vec4i(0, 1, 2, 3);
|
954
|
-
*/
|
955
|
-
declare const vec4i: NativeVec4i;
|
956
|
-
/**
|
957
|
-
* Type of the `d.vec4u` object/function: vector data type schema/constructor
|
958
|
-
*/
|
959
|
-
type NativeVec4u = Vec4u & {
|
960
|
-
'~exotic': Vec4u;
|
961
|
-
} & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
|
962
|
-
/**
|
963
|
-
*
|
964
|
-
* Schema representing vec4u - a vector with 4 elements of type u32.
|
965
|
-
* Also a constructor function for this vector value.
|
966
|
-
*
|
967
|
-
* @example
|
968
|
-
* const vector = d.vec4u(); // (0, 0, 0, 0)
|
969
|
-
* const vector = d.vec4u(1); // (1, 1, 1, 1)
|
970
|
-
* const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
|
971
|
-
*
|
972
|
-
* @example
|
973
|
-
* const buffer = root.createBuffer(d.vec4u, d.vec4u(0, 1, 2, 3)); // buffer holding a d.vec4u value, with an initial value of vec4u(0, 1, 2, 3);
|
974
|
-
*/
|
975
|
-
declare const vec4u: NativeVec4u;
|
976
|
-
|
977
|
-
export { type InterpolationType as $, type AnyWgslData as A, type BaseWgslData as B, type NativeVec3u as C, type Decorated as D, type NativeVec3i as E, type F32 as F, type InferRecord as G, type m2x2f as H, type Infer as I, type m3x3f as J, type m4x4f as K, type Location as L, type Mat2x2f as M, type NativeVec2u as N, type v2f as O, type PtrFn as P, type Mat3x3f as Q, type v3f as R, type Mat4x4f as S, type v4f as T, type U32 as U, type Vec2f as V, type WgslArray as W, type Atomic as X, type Align as Y, type Size as Z, type Interpolate as _, type F16 as a, type PerspectiveOrLinearInterpolationType as a0, type PerspectiveOrLinearInterpolatableData as a1, type FlatInterpolationType as a2, type FlatInterpolatableData as a3, isWgslData as a4, isWgslArray as a5, isWgslStruct as a6, isPtrFn as a7, isAtomic as a8, isDecorated as a9, isAlignAttrib as aa, isBuiltinAttrib as ab, isLocationAttrib as ac, isInterpolateAttrib as ad, isSizeAttrib as ae, type v2i as af, type v2u as ag, type v3i as ah, type v3u as ai, type v4i as aj, type v4u as ak, vec2f as al, vec2h as am, vec2i as an, vec2u as ao, vec3f as ap, vec3h as aq, vec3i as ar, vec3u as as, vec4f as at, vec4h as au, vec4i as av, vec4u as aw, type VecKind as ax, type I32 as b, type Vec3f as c, type Vec4f as d, type Vec2h as e, type Vec3h as f, type Vec4h as g, type Vec2i as h, type Vec3i as i, type Vec4i as j, type Vec2u as k, type Vec3u as l, type Vec4u as m, type AnyWgslStruct as n, type WgslTypeLiteral as o, type AnyVecInstance as p, type AnyMatInstance as q, type Builtin as r, type Bool as s, type WgslStruct as t, type NativeVec4u as u, type NativeVec2i as v, type NativeVec4i as w, type NativeVec2f as x, type NativeVec4f as y, type NativeVec3f as z };
|
1334
|
+
export { type Mat3x3f as $, type AnyWgslData as A, type BaseWgslData as B, type PerspectiveOrLinearInterpolatableData as C, type Decorated as D, type FlatInterpolationType as E, type F32 as F, type FlatInterpolatableData as G, type LooseDecorated as H, type Infer as I, type AnyLooseData as J, type KindToAcceptedAttribMap as K, type Location as L, type MemIdentity as M, type LooseTypeLiteral as N, type WgslStruct as O, type PerspectiveOrLinearInterpolationType as P, type PtrFn as Q, type m2x2f as R, type Size as S, type TgpuVertexAttrib as T, type U32 as U, type Vec2f as V, type WgslArray as W, type m3x3f as X, type m4x4f as Y, type Mat2x2f as Z, type v2f as _, type F16 as a, sint16x2 as a$, type v3f as a0, type Mat4x4f as a1, type v4f as a2, type Atomic as a3, bool as a4, f32 as a5, f16 as a6, i32 as a7, u32 as a8, isWgslData as a9, vec4h as aA, vec4i as aB, vec4u as aC, isDisarray as aD, isUnstruct as aE, isLooseDecorated as aF, isData as aG, isLooseData as aH, type FormatToWGSLType as aI, type TgpuVertexFormatData as aJ, packedFormats as aK, uint8 as aL, uint8x2 as aM, uint8x4 as aN, sint8 as aO, sint8x2 as aP, sint8x4 as aQ, unorm8 as aR, unorm8x2 as aS, unorm8x4 as aT, snorm8 as aU, snorm8x2 as aV, snorm8x4 as aW, uint16 as aX, uint16x2 as aY, uint16x4 as aZ, sint16 as a_, isWgslArray as aa, isWgslStruct as ab, isPtrFn as ac, isAtomic as ad, isDecorated as ae, isAlignAttrib as af, isBuiltinAttrib as ag, isLocationAttrib as ah, isInterpolateAttrib as ai, isSizeAttrib as aj, type Bool as ak, type v2i as al, type v2u as am, type v3i as an, type v3u as ao, type v4i as ap, type v4u as aq, vec2f as ar, vec2h as as, vec2i as at, vec2u as au, vec3f as av, vec3h as aw, vec3i as ax, vec3u as ay, vec4f as az, type I32 as b, sint16x4 as b0, unorm16 as b1, unorm16x2 as b2, unorm16x4 as b3, snorm16 as b4, snorm16x2 as b5, snorm16x4 as b6, float16 as b7, float16x2 as b8, float16x4 as b9, float32 as ba, float32x2 as bb, float32x3 as bc, float32x4 as bd, uint32 as be, uint32x2 as bf, uint32x3 as bg, uint32x4 as bh, sint32 as bi, sint32x2 as bj, sint32x3 as bk, sint32x4 as bl, unorm10_10_10_2 as bm, unorm8x4_bgra as bn, type PackedData as bo, type VecKind as bp, type Vec3f as c, type Vec4f as d, type Vec2h as e, type Vec3h as f, type Vec4h as g, type Vec2i as h, type Vec3i as i, type Vec4i as j, type Vec2u as k, type Vec3u as l, type Vec4u as m, type AnyWgslStruct as n, type AnyData as o, type Disarray as p, type Unstruct as q, type VertexFormat as r, type KindToDefaultFormatMap as s, type WgslTypeLiteral as t, type AnyVecInstance as u, type AnyMatInstance as v, type Builtin as w, type Align as x, type Interpolate as y, type InterpolationType as z };
|