typegpu 0.10.1 → 0.10.2

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 (263) hide show
  1. package/{chunk-BYypO7fO.js → _virtual/_rolldown/runtime.js} +1 -1
  2. package/builtin.d.ts +50 -0
  3. package/builtin.js +37 -0
  4. package/common/fullScreenTriangle.d.ts +26 -0
  5. package/common/fullScreenTriangle.js +36 -0
  6. package/common/index.d.ts +2 -3
  7. package/common/index.js +3 -4
  8. package/core/buffer/buffer.d.ts +74 -0
  9. package/core/buffer/buffer.js +197 -0
  10. package/core/buffer/bufferShorthand.d.ts +48 -0
  11. package/core/buffer/bufferShorthand.js +49 -0
  12. package/core/buffer/bufferUsage.d.ts +45 -0
  13. package/core/buffer/bufferUsage.js +163 -0
  14. package/core/constant/tgpuConstant.d.ts +28 -0
  15. package/core/constant/tgpuConstant.js +67 -0
  16. package/core/declare/tgpuDeclare.d.ts +18 -0
  17. package/core/declare/tgpuDeclare.js +40 -0
  18. package/core/function/autoIO.d.ts +37 -0
  19. package/core/function/autoIO.js +87 -0
  20. package/core/function/comptime.d.ts +39 -0
  21. package/core/function/comptime.js +51 -0
  22. package/core/function/createCallableSchema.js +42 -0
  23. package/core/function/dualImpl.js +54 -0
  24. package/core/function/extractArgs.js +204 -0
  25. package/core/function/fnCore.js +79 -0
  26. package/core/function/fnTypes.d.ts +34 -0
  27. package/core/function/ioSchema.d.ts +10 -0
  28. package/core/function/ioSchema.js +30 -0
  29. package/core/function/shelllessImpl.d.ts +28 -0
  30. package/core/function/shelllessImpl.js +23 -0
  31. package/core/function/templateUtils.js +13 -0
  32. package/core/function/tgpuComputeFn.d.ts +49 -0
  33. package/core/function/tgpuComputeFn.js +62 -0
  34. package/core/function/tgpuFn.d.ts +52 -0
  35. package/core/function/tgpuFn.js +170 -0
  36. package/core/function/tgpuFragmentFn.d.ts +68 -0
  37. package/core/function/tgpuFragmentFn.js +68 -0
  38. package/core/function/tgpuVertexFn.d.ts +55 -0
  39. package/core/function/tgpuVertexFn.js +65 -0
  40. package/core/pipeline/applyPipelineState.js +37 -0
  41. package/core/pipeline/computePipeline.d.ts +58 -0
  42. package/core/pipeline/computePipeline.js +226 -0
  43. package/core/pipeline/connectAttachmentToShader.js +26 -0
  44. package/core/pipeline/connectTargetsToShader.js +29 -0
  45. package/core/pipeline/limitsOverflow.js +13 -0
  46. package/core/pipeline/renderPipeline.d.ts +266 -0
  47. package/core/pipeline/renderPipeline.js +471 -0
  48. package/core/pipeline/timeable.d.ts +23 -0
  49. package/core/pipeline/timeable.js +61 -0
  50. package/core/pipeline/typeGuards.js +29 -0
  51. package/core/querySet/querySet.d.ts +22 -0
  52. package/core/querySet/querySet.js +103 -0
  53. package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +59 -0
  54. package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +96 -0
  55. package/core/resolve/externals.d.ts +10 -0
  56. package/core/resolve/externals.js +58 -0
  57. package/core/resolve/namespace.d.ts +38 -0
  58. package/core/resolve/namespace.js +41 -0
  59. package/core/resolve/resolveData.js +146 -0
  60. package/core/resolve/stitch.js +25 -0
  61. package/core/resolve/tgpuResolve.d.ts +151 -0
  62. package/core/resolve/tgpuResolve.js +68 -0
  63. package/core/root/configurableImpl.js +18 -0
  64. package/core/root/init.d.ts +69 -0
  65. package/core/root/init.js +457 -0
  66. package/core/root/rootTypes.d.ts +622 -0
  67. package/core/sampler/sampler.d.ts +35 -0
  68. package/core/sampler/sampler.js +116 -0
  69. package/core/simulate/tgpuSimulate.d.ts +36 -0
  70. package/core/simulate/tgpuSimulate.js +76 -0
  71. package/core/slot/accessor.d.ts +13 -0
  72. package/core/slot/accessor.js +97 -0
  73. package/core/slot/internalSlots.js +7 -0
  74. package/core/slot/lazy.d.ts +6 -0
  75. package/core/slot/lazy.js +42 -0
  76. package/core/slot/slot.d.ts +6 -0
  77. package/core/slot/slot.js +40 -0
  78. package/core/slot/slotTypes.d.ts +92 -0
  79. package/core/slot/slotTypes.js +21 -0
  80. package/core/texture/externalTexture.d.ts +12 -0
  81. package/core/texture/externalTexture.js +48 -0
  82. package/core/texture/texture.d.ts +118 -0
  83. package/core/texture/texture.js +312 -0
  84. package/core/texture/textureFormats.d.ts +29 -0
  85. package/core/texture/textureFormats.js +99 -0
  86. package/core/texture/textureProps.d.ts +11 -0
  87. package/core/texture/textureUtils.js +224 -0
  88. package/core/texture/usageExtension.d.ts +21 -0
  89. package/core/texture/usageExtension.js +21 -0
  90. package/core/unroll/tgpuUnroll.d.ts +13 -0
  91. package/core/unroll/tgpuUnroll.js +36 -0
  92. package/core/valueProxyUtils.js +44 -0
  93. package/core/variable/tgpuVariable.d.ts +38 -0
  94. package/core/variable/tgpuVariable.js +101 -0
  95. package/core/vertexLayout/connectAttributesToShader.js +59 -0
  96. package/core/vertexLayout/vertexAttribute.d.ts +29 -0
  97. package/core/vertexLayout/vertexLayout.d.ts +19 -0
  98. package/core/vertexLayout/vertexLayout.js +103 -0
  99. package/data/alignIO.js +15 -0
  100. package/data/alignmentOf.d.ts +10 -0
  101. package/data/alignmentOf.js +88 -0
  102. package/data/array.d.ts +28 -0
  103. package/data/array.js +48 -0
  104. package/data/atomic.d.ts +15 -0
  105. package/data/atomic.js +25 -0
  106. package/data/attributes.d.ts +121 -0
  107. package/data/attributes.js +145 -0
  108. package/data/autoStruct.d.ts +3 -0
  109. package/data/autoStruct.js +83 -0
  110. package/data/compiledIO.js +231 -0
  111. package/data/dataIO.js +549 -0
  112. package/data/dataTypes.d.ts +115 -0
  113. package/data/dataTypes.js +97 -0
  114. package/data/deepEqual.d.ts +25 -0
  115. package/data/deepEqual.js +58 -0
  116. package/data/disarray.d.ts +34 -0
  117. package/data/disarray.js +52 -0
  118. package/data/getLongestContiguousPrefix.d.ts +10 -0
  119. package/data/getLongestContiguousPrefix.js +15 -0
  120. package/data/index.d.ts +26 -4
  121. package/data/index.js +27 -7
  122. package/data/instanceToSchema.d.ts +33 -0
  123. package/data/isContiguous.d.ts +10 -0
  124. package/data/isContiguous.js +15 -0
  125. package/data/matrix.d.ts +126 -0
  126. package/data/matrix.js +517 -0
  127. package/data/numberOps.js +24 -0
  128. package/data/numeric.d.ts +81 -0
  129. package/data/numeric.js +234 -0
  130. package/data/offsetUtils.d.ts +33 -0
  131. package/data/offsetUtils.js +167 -0
  132. package/data/offsets.js +36 -0
  133. package/data/partialIO.js +68 -0
  134. package/data/ptr.d.ts +12 -0
  135. package/data/ptr.js +46 -0
  136. package/data/ref.d.ts +37 -0
  137. package/data/ref.js +96 -0
  138. package/data/sampler.d.ts +107 -0
  139. package/data/sampler.js +26 -0
  140. package/data/schemaCallWrapper.js +32 -0
  141. package/data/schemaMemoryLayout.js +200 -0
  142. package/data/sizeOf.d.ts +10 -0
  143. package/data/sizeOf.js +15 -0
  144. package/data/snippet.d.ts +26 -0
  145. package/data/snippet.js +61 -0
  146. package/data/struct.d.ts +17 -0
  147. package/data/struct.js +46 -0
  148. package/data/texture.d.ts +292 -0
  149. package/{texture-BagDrrks.js → data/texture.js} +6 -3
  150. package/data/unstruct.d.ts +24 -0
  151. package/data/unstruct.js +43 -0
  152. package/data/vector.d.ts +191 -0
  153. package/data/vector.js +247 -0
  154. package/data/vectorImpl.js +516 -0
  155. package/data/vectorOps.js +664 -0
  156. package/data/vertexFormatData.d.ts +190 -0
  157. package/data/vertexFormatData.js +110 -0
  158. package/data/wgslTypes.d.ts +896 -0
  159. package/data/wgslTypes.js +215 -0
  160. package/errors.d.ts +44 -0
  161. package/errors.js +128 -0
  162. package/execMode.js +51 -0
  163. package/extension.d.ts +11 -0
  164. package/extension.js +18 -0
  165. package/getGPUValue.js +9 -0
  166. package/index.d.ts +40 -243
  167. package/index.js +19 -6318
  168. package/indexNamedExports.d.ts +38 -0
  169. package/mathUtils.js +13 -0
  170. package/memo.js +22 -0
  171. package/nameRegistry.d.ts +30 -0
  172. package/nameRegistry.js +449 -0
  173. package/package.js +5 -0
  174. package/package.json +23 -23
  175. package/resolutionCtx.d.ts +29 -0
  176. package/resolutionCtx.js +546 -0
  177. package/shared/env.js +13 -0
  178. package/shared/generators.js +14 -0
  179. package/shared/meta.d.ts +39 -0
  180. package/shared/meta.js +63 -0
  181. package/shared/repr.d.ts +108 -0
  182. package/shared/stringify.js +22 -0
  183. package/shared/symbols.d.ts +61 -0
  184. package/shared/symbols.js +71 -0
  185. package/shared/utilityTypes.d.ts +29 -0
  186. package/shared/utilityTypes.js +7 -0
  187. package/shared/vertexFormat.d.ts +70 -0
  188. package/shared/vertexFormat.js +64 -0
  189. package/std/array.d.ts +7 -0
  190. package/std/array.js +27 -0
  191. package/std/atomic.d.ts +19 -0
  192. package/std/atomic.js +113 -0
  193. package/std/bitcast.d.ts +10 -0
  194. package/std/bitcast.js +43 -0
  195. package/std/boolean.d.ts +127 -0
  196. package/std/boolean.js +274 -0
  197. package/std/derivative.d.ts +16 -0
  198. package/std/derivative.js +89 -0
  199. package/std/discard.d.ts +6 -0
  200. package/std/discard.js +16 -0
  201. package/std/extensions.d.ts +8 -0
  202. package/std/extensions.js +14 -0
  203. package/std/index.d.ts +15 -3
  204. package/std/index.js +16 -5
  205. package/std/matrix.d.ts +41 -0
  206. package/std/matrix.js +87 -0
  207. package/std/numeric.d.ts +254 -0
  208. package/std/numeric.js +847 -0
  209. package/std/operators.d.ts +48 -0
  210. package/std/operators.js +153 -0
  211. package/std/packing.d.ts +26 -0
  212. package/std/packing.js +86 -0
  213. package/std/subgroup.d.ts +47 -0
  214. package/std/subgroup.js +220 -0
  215. package/std/texture.d.ts +108 -0
  216. package/std/texture.js +197 -0
  217. package/tgpu.js +44 -0
  218. package/tgpuBindGroupLayout.d.ts +161 -0
  219. package/tgpuBindGroupLayout.js +271 -0
  220. package/tgpuUnstable.d.ts +48 -0
  221. package/tgpuUnstable.js +66 -0
  222. package/tgsl/accessIndex.js +45 -0
  223. package/tgsl/accessProp.js +113 -0
  224. package/tgsl/consoleLog/deserializers.js +117 -0
  225. package/tgsl/consoleLog/logGenerator.js +86 -0
  226. package/tgsl/consoleLog/serializers.js +225 -0
  227. package/tgsl/consoleLog/types.d.ts +54 -0
  228. package/tgsl/consoleLog/types.js +12 -0
  229. package/tgsl/conversion.js +200 -0
  230. package/tgsl/forOfUtils.js +45 -0
  231. package/tgsl/generationHelpers.d.ts +37 -0
  232. package/tgsl/generationHelpers.js +67 -0
  233. package/tgsl/math.js +45 -0
  234. package/tgsl/shaderGenerator.d.ts +18 -0
  235. package/tgsl/shellless.d.ts +11 -0
  236. package/tgsl/shellless.js +53 -0
  237. package/tgsl/wgslGenerator.js +585 -0
  238. package/types.d.ts +255 -0
  239. package/types.js +43 -0
  240. package/unwrapper.d.ts +27 -0
  241. package/wgslExtensions.d.ts +5 -0
  242. package/wgslExtensions.js +18 -0
  243. package/builtin-DdtWpk2t.js +0 -818
  244. package/builtin-DdtWpk2t.js.map +0 -1
  245. package/common/index.d.ts.map +0 -1
  246. package/common/index.js.map +0 -1
  247. package/data/index.d.ts.map +0 -1
  248. package/data/index.js.map +0 -1
  249. package/deepEqual-DQxK4vdp.js +0 -413
  250. package/deepEqual-DQxK4vdp.js.map +0 -1
  251. package/extensions-DIVuAfBM.js +0 -2032
  252. package/extensions-DIVuAfBM.js.map +0 -1
  253. package/fullScreenTriangle-CfFyQd_0.js +0 -543
  254. package/fullScreenTriangle-CfFyQd_0.js.map +0 -1
  255. package/index.d.ts.map +0 -1
  256. package/index.js.map +0 -1
  257. package/indexNamedExports-oL6tyaJ9.d.ts +0 -5697
  258. package/indexNamedExports-oL6tyaJ9.d.ts.map +0 -1
  259. package/operators-d-PMVTo7.js +0 -4158
  260. package/operators-d-PMVTo7.js.map +0 -1
  261. package/std/index.d.ts.map +0 -1
  262. package/std/index.js.map +0 -1
  263. package/texture-BagDrrks.js.map +0 -1
@@ -0,0 +1,896 @@
1
+ import { TgpuNamable } from "../shared/meta.js";
2
+ import { $gpuRepr, $internal, $invalidSchemaReason, $memIdent, $repr, $reprPartial, $validStorageSchema, $validUniformSchema, $validVertexSchema } from "../shared/symbols.js";
3
+ import { Prettify, SwapNever } from "../shared/utilityTypes.js";
4
+ import { WgslComparisonSampler, WgslSampler } from "./sampler.js";
5
+ import { DualFn } from "../types.js";
6
+ import { _ref } from "./ref.js";
7
+ import { WgslExternalTexture, WgslStorageTexture, WgslTexture } from "./texture.js";
8
+ import { ExtractInvalidSchemaError, Infer, InferGPU, InferGPURecord, InferPartial, InferPartialRecord, InferRecord, IsValidStorageSchema, IsValidUniformSchema, IsValidVertexSchema, MemIdentity, MemIdentityRecord } from "../shared/repr.js";
9
+ import "tsover-runtime";
10
+
11
+ //#region src/data/wgslTypes.d.ts
12
+ type DecoratedLocation<T extends BaseData> = Decorated<T, Location[]>;
13
+ interface BaseData {
14
+ readonly [$internal]: Record<string, unknown>;
15
+ readonly type: string;
16
+ readonly [$repr]: unknown;
17
+ toString(): string;
18
+ }
19
+ interface NumberArrayView {
20
+ readonly length: number;
21
+ [n: number]: number;
22
+ [Symbol.iterator]: () => Iterator<number>;
23
+ }
24
+ /**
25
+ * Vector infix notation.
26
+ *
27
+ * @privateRemarks
28
+ * These functions are not defined on vectors,
29
+ * but are instead assigned to `VecBase` after both `data` and `std` are initialized.
30
+ */
31
+ interface vecInfixNotation<T extends vecBase> {
32
+ add(other: T | number): T;
33
+ sub(other: T | number): T;
34
+ mul(other: mBaseForVec<T> | T | number): T;
35
+ div(other: T | number): T;
36
+ mod(other: T | number): T;
37
+ [Symbol.operatorPlus](lhs: T | number, rhs: T | number): T;
38
+ [Symbol.operatorMinus](lhs: T | number, rhs: T | number): T;
39
+ [Symbol.operatorStar](lhs: mBaseForVec<T> | T | number, rhs: mBaseForVec<T> | T | number): T;
40
+ [Symbol.operatorSlash](lhs: T | number, rhs: T | number): T;
41
+ [Symbol.operatorPercent](lhs: T | number, rhs: T | number): T;
42
+ }
43
+ /**
44
+ * Matrix infix notation.
45
+ *
46
+ * @privateRemarks
47
+ * These functions are not defined on matrices,
48
+ * but are instead assigned to `MatBase` after both `data` and `std` are initialized.
49
+ */
50
+ interface matInfixNotation<T extends matBase> {
51
+ add(other: T): T;
52
+ sub(other: T): T;
53
+ mul(other: T | number): T;
54
+ mul(other: vBaseForMat<T>): vBaseForMat<T>;
55
+ [Symbol.operatorPlus](lhs: T, rhs: T): T;
56
+ [Symbol.operatorMinus](lhs: T, rhs: T): T;
57
+ [Symbol.operatorStar](lhs: T | number, rhs: T | number): T;
58
+ [Symbol.operatorStar](lhs: T, rhs: vBaseForMat<T>): vBaseForMat<T>;
59
+ [Symbol.operatorStar](lhs: vBaseForMat<T>, rhs: T): vBaseForMat<T>;
60
+ }
61
+ /**
62
+ * Represents a 64-bit integer.
63
+ */
64
+ interface AbstractInt extends BaseData {
65
+ readonly type: 'abstractInt';
66
+ readonly [$repr]: number;
67
+ readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';
68
+ }
69
+ /**
70
+ * Represents a 64-bit IEEE 754 floating point number.
71
+ */
72
+ interface AbstractFloat extends BaseData {
73
+ readonly type: 'abstractFloat';
74
+ readonly [$repr]: number;
75
+ readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';
76
+ }
77
+ interface Void extends BaseData {
78
+ readonly type: 'void';
79
+ readonly [$repr]: void;
80
+ readonly [$invalidSchemaReason]: 'Void is not host-shareable';
81
+ }
82
+ declare const Void: Void;
83
+ type XY = 'x' | 'y';
84
+ type XYZ = 'x' | 'y' | 'z';
85
+ type XYZW = 'x' | 'y' | 'z' | 'w';
86
+ type RG = 'r' | 'g';
87
+ type RGB = 'r' | 'g' | 'b';
88
+ type RGBA = 'r' | 'g' | 'b' | 'a';
89
+ type Swizzle2<T2, T3, T4> = { readonly [K in `${XY}${XY}` | `${RG}${RG}`]: T2 } & { readonly [K in `${XY}${XY}${XY}` | `${RG}${RG}${RG}`]: T3 } & { readonly [K in `${XY}${XY}${XY}${XY}` | `${RG}${RG}${RG}${RG}`]: T4 };
90
+ type Swizzle3<T2, T3, T4> = { readonly [K in `${XYZ}${XYZ}` | `${RGB}${RGB}`]: T2 } & { readonly [K in `${XYZ}${XYZ}${XYZ}` | `${RGB}${RGB}${RGB}`]: T3 } & { readonly [K in `${XYZ}${XYZ}${XYZ}${XYZ}` | `${RGB}${RGB}${RGB}${RGB}`]: T4 };
91
+ type Swizzle4<T2, T3, T4> = { readonly [K in `${XYZW}${XYZW}` | `${RGBA}${RGBA}`]: T2 } & { readonly [K in `${XYZW}${XYZW}${XYZW}` | `${RGBA}${RGBA}${RGBA}`]: T3 } & { readonly [K in `${XYZW}${XYZW}${XYZW}${XYZW}` | `${RGBA}${RGBA}${RGBA}${RGBA}`]: T4 };
92
+ type Tuple2<S> = [S, S];
93
+ type Tuple3<S> = [S, S, S];
94
+ type Tuple4<S> = [S, S, S, S];
95
+ /**
96
+ * A type which every numeric vector is assignable to. In most cases the union v2f | v3f | v4f | v2h | v3h | v4h | v2i | v3i | v4i | v2u | v3u | v4u
97
+ * is preferred, but when an implementation uses overloaded operators and is generic on the type,
98
+ * this makes the type checking much more laid back.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * export function quinticInterpolation(t: d.v2f): d.v2f;
103
+ * export function quinticInterpolation(t: d.v3f): d.v3f;
104
+ * export function quinticInterpolation(t: d.vecBase): d.vecBase {
105
+ * 'use gpu';
106
+ * return t * t * t * (t * (t * 6 - 15) + 10);
107
+ * }
108
+ * ```
109
+ */
110
+ interface vecBase extends vecInfixNotation<vecBase> {
111
+ readonly [$internal]: true;
112
+ readonly kind: 'vec2f' | 'vec3f' | 'vec4f' | 'vec2h' | 'vec3h' | 'vec4h' | 'vec2i' | 'vec3i' | 'vec4i' | 'vec2u' | 'vec3u' | 'vec4u';
113
+ }
114
+ /**
115
+ * Interface representing its WGSL vector type counterpart: vec2f or vec2<f32>.
116
+ * A vector with 2 elements of type f32
117
+ */
118
+ interface v2f extends Tuple2<number>, Swizzle2<v2f, v3f, v4f>, vecInfixNotation<v2f> {
119
+ readonly [$internal]: true;
120
+ /** use to distinguish between vectors of the same size on the type level */
121
+ readonly kind: 'vec2f';
122
+ x: number;
123
+ y: number;
124
+ r: number;
125
+ g: number;
126
+ }
127
+ /**
128
+ * Interface representing its WGSL vector type counterpart: vec2h or vec2<f16>.
129
+ * A vector with 2 elements of type f16
130
+ */
131
+ interface v2h extends Tuple2<number>, Swizzle2<v2h, v3h, v4h>, vecInfixNotation<v2h> {
132
+ readonly [$internal]: true;
133
+ /** use to distinguish between vectors of the same size on the type level */
134
+ readonly kind: 'vec2h';
135
+ x: number;
136
+ y: number;
137
+ r: number;
138
+ g: number;
139
+ }
140
+ /**
141
+ * Interface representing its WGSL vector type counterpart: vec2i or vec2<i32>.
142
+ * A vector with 2 elements of type i32
143
+ */
144
+ interface v2i extends Tuple2<number>, Swizzle2<v2i, v3i, v4i>, vecInfixNotation<v2i> {
145
+ readonly [$internal]: true;
146
+ /** use to distinguish between vectors of the same size on the type level */
147
+ readonly kind: 'vec2i';
148
+ x: number;
149
+ y: number;
150
+ r: number;
151
+ g: number;
152
+ }
153
+ /**
154
+ * Interface representing its WGSL vector type counterpart: vec2u or vec2<u32>.
155
+ * A vector with 2 elements of type u32
156
+ */
157
+ interface v2u extends Tuple2<number>, Swizzle2<v2u, v3u, v4u>, vecInfixNotation<v2u> {
158
+ readonly [$internal]: true;
159
+ /** use to distinguish between vectors of the same size on the type level */
160
+ readonly kind: 'vec2u';
161
+ x: number;
162
+ y: number;
163
+ r: number;
164
+ g: number;
165
+ }
166
+ /**
167
+ * Interface representing its WGSL vector type counterpart: `vec2<bool>`.
168
+ * A vector with 2 elements of type `bool`
169
+ */
170
+ interface v2b extends Tuple2<boolean>, Swizzle2<v2b, v3b, v4b> {
171
+ readonly [$internal]: true;
172
+ /** use to distinguish between vectors of the same size on the type level */
173
+ readonly kind: 'vec2<bool>';
174
+ x: boolean;
175
+ y: boolean;
176
+ r: boolean;
177
+ g: boolean;
178
+ }
179
+ /**
180
+ * Interface representing its WGSL vector type counterpart: vec3f or vec3<f32>.
181
+ * A vector with 3 elements of type f32
182
+ */
183
+ interface v3f extends Tuple3<number>, Swizzle3<v2f, v3f, v4f>, vecInfixNotation<v3f> {
184
+ readonly [$internal]: true;
185
+ /** use to distinguish between vectors of the same size on the type level */
186
+ readonly kind: 'vec3f';
187
+ x: number;
188
+ y: number;
189
+ z: number;
190
+ r: number;
191
+ g: number;
192
+ b: number;
193
+ }
194
+ /**
195
+ * Interface representing its WGSL vector type counterpart: vec3h or vec3<f16>.
196
+ * A vector with 3 elements of type f16
197
+ */
198
+ interface v3h extends Tuple3<number>, Swizzle3<v2h, v3h, v4h>, vecInfixNotation<v3h> {
199
+ readonly [$internal]: true;
200
+ /** use to distinguish between vectors of the same size on the type level */
201
+ readonly kind: 'vec3h';
202
+ x: number;
203
+ y: number;
204
+ z: number;
205
+ r: number;
206
+ g: number;
207
+ b: number;
208
+ }
209
+ /**
210
+ * Interface representing its WGSL vector type counterpart: vec3i or vec3<i32>.
211
+ * A vector with 3 elements of type i32
212
+ */
213
+ interface v3i extends Tuple3<number>, Swizzle3<v2i, v3i, v4i>, vecInfixNotation<v3i> {
214
+ readonly [$internal]: true;
215
+ /** use to distinguish between vectors of the same size on the type level */
216
+ readonly kind: 'vec3i';
217
+ x: number;
218
+ y: number;
219
+ z: number;
220
+ r: number;
221
+ g: number;
222
+ b: number;
223
+ }
224
+ /**
225
+ * Interface representing its WGSL vector type counterpart: vec3u or vec3<u32>.
226
+ * A vector with 3 elements of type u32
227
+ */
228
+ interface v3u extends Tuple3<number>, Swizzle3<v2u, v3u, v4u>, vecInfixNotation<v3u> {
229
+ readonly [$internal]: true;
230
+ /** use to distinguish between vectors of the same size on the type level */
231
+ readonly kind: 'vec3u';
232
+ x: number;
233
+ y: number;
234
+ z: number;
235
+ r: number;
236
+ g: number;
237
+ b: number;
238
+ }
239
+ /**
240
+ * Interface representing its WGSL vector type counterpart: `vec3<bool>`.
241
+ * A vector with 3 elements of type `bool`
242
+ */
243
+ interface v3b extends Tuple3<boolean>, Swizzle3<v2b, v3b, v4b> {
244
+ readonly [$internal]: true;
245
+ /** use to distinguish between vectors of the same size on the type level */
246
+ readonly kind: 'vec3<bool>';
247
+ x: boolean;
248
+ y: boolean;
249
+ z: boolean;
250
+ r: boolean;
251
+ g: boolean;
252
+ b: boolean;
253
+ }
254
+ /**
255
+ * Interface representing its WGSL vector type counterpart: vec4f or vec4<f32>.
256
+ * A vector with 4 elements of type f32
257
+ */
258
+ interface v4f extends Tuple4<number>, Swizzle4<v2f, v3f, v4f>, vecInfixNotation<v4f> {
259
+ readonly [$internal]: true;
260
+ /** use to distinguish between vectors of the same size on the type level */
261
+ readonly kind: 'vec4f';
262
+ x: number;
263
+ y: number;
264
+ z: number;
265
+ w: number;
266
+ r: number;
267
+ g: number;
268
+ b: number;
269
+ a: number;
270
+ }
271
+ /**
272
+ * Interface representing its WGSL vector type counterpart: vec4h or vec4<f16>.
273
+ * A vector with 4 elements of type f16
274
+ */
275
+ interface v4h extends Tuple4<number>, Swizzle4<v2h, v3h, v4h>, vecInfixNotation<v4h> {
276
+ readonly [$internal]: true;
277
+ /** use to distinguish between vectors of the same size on the type level */
278
+ readonly kind: 'vec4h';
279
+ x: number;
280
+ y: number;
281
+ z: number;
282
+ w: number;
283
+ r: number;
284
+ g: number;
285
+ b: number;
286
+ a: number;
287
+ }
288
+ /**
289
+ * Interface representing its WGSL vector type counterpart: vec4i or vec4<i32>.
290
+ * A vector with 4 elements of type i32
291
+ */
292
+ interface v4i extends Tuple4<number>, Swizzle4<v2i, v3i, v4i>, vecInfixNotation<v4i> {
293
+ readonly [$internal]: true;
294
+ /** use to distinguish between vectors of the same size on the type level */
295
+ readonly kind: 'vec4i';
296
+ x: number;
297
+ y: number;
298
+ z: number;
299
+ w: number;
300
+ r: number;
301
+ g: number;
302
+ b: number;
303
+ a: number;
304
+ }
305
+ /**
306
+ * Interface representing its WGSL vector type counterpart: vec4u or vec4<u32>.
307
+ * A vector with 4 elements of type u32
308
+ */
309
+ interface v4u extends Tuple4<number>, Swizzle4<v2u, v3u, v4u>, vecInfixNotation<v4u> {
310
+ readonly [$internal]: true;
311
+ /** use to distinguish between vectors of the same size on the type level */
312
+ readonly kind: 'vec4u';
313
+ x: number;
314
+ y: number;
315
+ z: number;
316
+ w: number;
317
+ r: number;
318
+ g: number;
319
+ b: number;
320
+ a: number;
321
+ }
322
+ /**
323
+ * Interface representing its WGSL vector type counterpart: `vec4<bool>`.
324
+ * A vector with 4 elements of type `bool`
325
+ */
326
+ interface v4b extends Tuple4<boolean>, Swizzle4<v2b, v3b, v4b> {
327
+ readonly [$internal]: true;
328
+ /** use to distinguish between vectors of the same size on the type level */
329
+ readonly kind: 'vec4<bool>';
330
+ x: boolean;
331
+ y: boolean;
332
+ z: boolean;
333
+ w: boolean;
334
+ r: boolean;
335
+ g: boolean;
336
+ b: boolean;
337
+ a: boolean;
338
+ }
339
+ type AnyFloat32VecInstance = v2f | v3f | v4f;
340
+ type AnyFloatVecInstance = v2f | v2h | v3f | v3h | v4f | v4h;
341
+ type AnyIntegerVecInstance = v2i | v2u | v3i | v3u | v4i | v4u;
342
+ type AnyBooleanVecInstance = v2b | v3b | v4b;
343
+ type AnySignedVecInstance = v2i | v2f | v2h | v3i | v3f | v3h | v4i | v4f | v4h;
344
+ type AnyNumericVec2Instance = v2f | v2h | v2i | v2u;
345
+ type AnyNumericVec3Instance = v3f | v3h | v3i | v3u;
346
+ type AnyNumericVec4Instance = v4f | v4h | v4i | v4u;
347
+ type AnyNumericVecInstance = AnyNumericVec2Instance | AnyNumericVec3Instance | AnyNumericVec4Instance;
348
+ type AnyVec2Instance = v2f | v2h | v2i | v2u | v2b;
349
+ type AnyVec3Instance = v3f | v3h | v3i | v3u | v3b;
350
+ type AnyVec4Instance = v4f | v4h | v4i | v4u | v4b;
351
+ type AnyVecInstance = AnyVec2Instance | AnyVec3Instance | AnyVec4Instance;
352
+ /**
353
+ * A type which every matrix is assignable to. In most cases the union m2x2f | m3x3f | m4x4f
354
+ * is preferred, but when an implementation uses overloaded operators and is generic on the type,
355
+ * this makes the type checking much more laid back.
356
+ */
357
+ interface matBase extends matInfixNotation<matBase> {
358
+ readonly [$internal]: true;
359
+ readonly kind: 'mat2x2f' | 'mat3x3f' | 'mat4x4f';
360
+ }
361
+ /**
362
+ * Interface representing its WGSL matrix type counterpart: mat2x2
363
+ * A matrix with 2 rows and 2 columns, with elements of type `TColumn`
364
+ */
365
+ interface mat2x2<TColumn> extends NumberArrayView {
366
+ readonly [$internal]: true;
367
+ readonly length: 4;
368
+ readonly kind: string;
369
+ readonly columns: readonly [TColumn, TColumn];
370
+ [n: number]: number;
371
+ }
372
+ /**
373
+ * Interface representing its WGSL matrix type counterpart: mat2x2f or mat2x2<f32>
374
+ * A matrix with 2 rows and 2 columns, with elements of type d.f32
375
+ */
376
+ interface m2x2f extends mat2x2<v2f>, matInfixNotation<m2x2f> {
377
+ readonly kind: 'mat2x2f';
378
+ }
379
+ /**
380
+ * Interface representing its WGSL matrix type counterpart: mat3x3
381
+ * A matrix with 3 rows and 3 columns, with elements of type `TColumn`
382
+ */
383
+ interface mat3x3<TColumn> extends NumberArrayView {
384
+ readonly [$internal]: true;
385
+ readonly length: 12;
386
+ readonly kind: string;
387
+ readonly columns: readonly [TColumn, TColumn, TColumn];
388
+ [n: number]: number;
389
+ }
390
+ /**
391
+ * Interface representing its WGSL matrix type counterpart: mat3x3f or mat3x3<f32>
392
+ * A matrix with 3 rows and 3 columns, with elements of type d.f32
393
+ */
394
+ interface m3x3f extends mat3x3<v3f>, matInfixNotation<m3x3f> {
395
+ readonly kind: 'mat3x3f';
396
+ }
397
+ /**
398
+ * Interface representing its WGSL matrix type counterpart: mat4x4
399
+ * A matrix with 4 rows and 4 columns, with elements of type `TColumn`
400
+ */
401
+ interface mat4x4<TColumn> extends NumberArrayView {
402
+ readonly [$internal]: true;
403
+ readonly length: 16;
404
+ readonly kind: string;
405
+ readonly columns: readonly [TColumn, TColumn, TColumn, TColumn];
406
+ [n: number]: number;
407
+ }
408
+ /**
409
+ * Interface representing its WGSL matrix type counterpart: mat4x4f or mat4x4<f32>
410
+ * A matrix with 4 rows and 4 columns, with elements of type d.f32
411
+ */
412
+ interface m4x4f extends mat4x4<v4f>, matInfixNotation<m4x4f> {
413
+ readonly kind: 'mat4x4f';
414
+ }
415
+ type AnyMatInstance = m2x2f | m3x3f | m4x4f;
416
+ type vBaseForMat<T extends matBase> = T extends m2x2f ? v2f : T extends m3x3f ? v3f : T extends m4x4f ? v4f : vecBase;
417
+ type mBaseForVec<T extends vecBase> = T extends v2f ? m2x2f : T extends v3f ? m3x3f : T extends v4f ? m4x4f : matBase;
418
+ /**
419
+ * Boolean schema representing a single WGSL bool value.
420
+ * Cannot be used inside buffers as it is not host-shareable.
421
+ */
422
+ interface Bool extends BaseData, DualFn<(v?: number | boolean) => boolean> {
423
+ readonly type: 'bool';
424
+ readonly [$repr]: boolean;
425
+ readonly [$invalidSchemaReason]: 'Bool is not host-shareable, use U32 or I32 instead';
426
+ }
427
+ /**
428
+ * 32-bit float schema representing a single WGSL f32 value.
429
+ */
430
+ interface F32 extends BaseData, DualFn<(v?: number | boolean) => number> {
431
+ readonly type: 'f32';
432
+ readonly [$repr]: number;
433
+ readonly [$validStorageSchema]: true;
434
+ readonly [$validUniformSchema]: true;
435
+ readonly [$validVertexSchema]: true;
436
+ }
437
+ /**
438
+ * 16-bit float schema representing a single WGSL f16 value.
439
+ */
440
+ interface F16 extends BaseData, DualFn<(v?: number | boolean) => number> {
441
+ readonly type: 'f16';
442
+ readonly [$repr]: number;
443
+ readonly [$validStorageSchema]: true;
444
+ readonly [$validUniformSchema]: true;
445
+ readonly [$validVertexSchema]: true;
446
+ }
447
+ /**
448
+ * Signed 32-bit integer schema representing a single WGSL i32 value.
449
+ */
450
+ interface I32 extends BaseData, DualFn<(v?: number | boolean) => number> {
451
+ readonly type: 'i32';
452
+ readonly [$repr]: number;
453
+ readonly [$memIdent]: I32 | Atomic<I32> | DecoratedLocation<I32>;
454
+ readonly [$validStorageSchema]: true;
455
+ readonly [$validUniformSchema]: true;
456
+ readonly [$validVertexSchema]: true;
457
+ }
458
+ /**
459
+ * Unsigned 32-bit integer schema representing a single WGSL u32 value.
460
+ */
461
+ interface U32 extends BaseData, DualFn<(v?: number | boolean) => number> {
462
+ readonly type: 'u32';
463
+ readonly [$repr]: number;
464
+ readonly [$memIdent]: U32 | Atomic<U32> | DecoratedLocation<U32>;
465
+ readonly [$validStorageSchema]: true;
466
+ readonly [$validUniformSchema]: true;
467
+ readonly [$validVertexSchema]: true;
468
+ }
469
+ /**
470
+ * Unsigned 16-bit integer schema used exclusively for index buffer schemas.
471
+ */
472
+ interface U16 extends BaseData {
473
+ readonly type: 'u16';
474
+ readonly [$repr]: number;
475
+ readonly [$invalidSchemaReason]: 'U16 is only usable inside arrays for index buffers, use U32 or I32 instead';
476
+ }
477
+ /**
478
+ * Type of the `d.vec2f` object/function: vector data type schema/constructor
479
+ */
480
+ interface Vec2f extends BaseData, DualFn<((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f) & ((v: AnyNumericVec2Instance) => v2f)> {
481
+ readonly type: 'vec2f';
482
+ readonly primitive: F32;
483
+ readonly componentCount: 2;
484
+ readonly [$repr]: v2f;
485
+ readonly [$validStorageSchema]: true;
486
+ readonly [$validUniformSchema]: true;
487
+ readonly [$validVertexSchema]: true;
488
+ }
489
+ /**
490
+ * Type of the `d.vec2h` object/function: vector data type schema/constructor
491
+ */
492
+ interface Vec2h extends BaseData, DualFn<((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h) & ((v: AnyNumericVec2Instance) => v2h)> {
493
+ readonly type: 'vec2h';
494
+ readonly primitive: F16;
495
+ readonly componentCount: 2;
496
+ readonly [$repr]: v2h;
497
+ readonly [$validStorageSchema]: true;
498
+ readonly [$validUniformSchema]: true;
499
+ readonly [$validVertexSchema]: true;
500
+ }
501
+ /**
502
+ * Type of the `d.vec2i` object/function: vector data type schema/constructor
503
+ */
504
+ interface Vec2i extends BaseData, DualFn<((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i) & ((v: AnyNumericVec2Instance) => v2i)> {
505
+ readonly type: 'vec2i';
506
+ readonly primitive: I32;
507
+ readonly componentCount: 2;
508
+ readonly [$repr]: v2i;
509
+ readonly [$validStorageSchema]: true;
510
+ readonly [$validUniformSchema]: true;
511
+ readonly [$validVertexSchema]: true;
512
+ }
513
+ /**
514
+ * Type of the `d.vec2u` object/function: vector data type schema/constructor
515
+ */
516
+ interface Vec2u extends BaseData, DualFn<((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u) & ((v: AnyNumericVec2Instance) => v2u)> {
517
+ readonly type: 'vec2u';
518
+ readonly primitive: U32;
519
+ readonly componentCount: 2;
520
+ readonly [$repr]: v2u;
521
+ readonly [$validStorageSchema]: true;
522
+ readonly [$validUniformSchema]: true;
523
+ readonly [$validVertexSchema]: true;
524
+ }
525
+ /**
526
+ * Type of the `d.vec2b` object/function: vector data type schema/constructor
527
+ * Cannot be used inside buffers as it is not host-shareable.
528
+ */
529
+ interface Vec2b extends BaseData, DualFn<((x: boolean, y: boolean) => v2b) & ((xy: boolean) => v2b) & (() => v2b) & ((v: v2b) => v2b)> {
530
+ readonly type: 'vec2<bool>';
531
+ readonly primitive: Bool;
532
+ readonly componentCount: 2;
533
+ readonly [$repr]: v2b;
534
+ readonly [$invalidSchemaReason]: 'Boolean vectors is not host-shareable, use numeric vectors instead';
535
+ }
536
+ /**
537
+ * Type of the `d.vec3f` object/function: vector data type schema/constructor
538
+ */
539
+ interface Vec3f extends BaseData, DualFn<((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f) & ((v: AnyNumericVec3Instance) => v3f) & ((v0: AnyNumericVec2Instance, z: number) => v3f) & ((x: number, v0: AnyNumericVec2Instance) => v3f)> {
540
+ readonly type: 'vec3f';
541
+ readonly primitive: F32;
542
+ readonly componentCount: 3;
543
+ readonly [$repr]: v3f;
544
+ readonly [$validStorageSchema]: true;
545
+ readonly [$validUniformSchema]: true;
546
+ readonly [$validVertexSchema]: true;
547
+ }
548
+ /**
549
+ * Type of the `d.vec3h` object/function: vector data type schema/constructor
550
+ */
551
+ interface Vec3h extends BaseData, DualFn<((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h) & ((v: AnyNumericVec3Instance) => v3h) & ((v0: AnyNumericVec2Instance, z: number) => v3h) & ((x: number, v0: AnyNumericVec2Instance) => v3h)> {
552
+ readonly type: 'vec3h';
553
+ readonly primitive: F16;
554
+ readonly componentCount: 3;
555
+ readonly [$repr]: v3h;
556
+ readonly [$validStorageSchema]: true;
557
+ readonly [$validUniformSchema]: true;
558
+ readonly [$validVertexSchema]: true;
559
+ }
560
+ /**
561
+ * Type of the `d.vec3i` object/function: vector data type schema/constructor
562
+ */
563
+ interface Vec3i extends BaseData, DualFn<((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i) & ((v: AnyNumericVec3Instance) => v3i) & ((v0: AnyNumericVec2Instance, z: number) => v3i) & ((x: number, v0: AnyNumericVec2Instance) => v3i)> {
564
+ readonly type: 'vec3i';
565
+ readonly primitive: I32;
566
+ readonly componentCount: 3;
567
+ readonly [$repr]: v3i;
568
+ readonly [$validStorageSchema]: true;
569
+ readonly [$validUniformSchema]: true;
570
+ readonly [$validVertexSchema]: true;
571
+ }
572
+ /**
573
+ * Type of the `d.vec3u` object/function: vector data type schema/constructor
574
+ */
575
+ interface Vec3u extends BaseData, DualFn<((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u) & ((v: AnyNumericVec3Instance) => v3u) & ((v0: AnyNumericVec2Instance, z: number) => v3u) & ((x: number, v0: AnyNumericVec2Instance) => v3u)> {
576
+ readonly type: 'vec3u';
577
+ readonly primitive: U32;
578
+ readonly componentCount: 3;
579
+ readonly [$repr]: v3u;
580
+ readonly [$validStorageSchema]: true;
581
+ readonly [$validUniformSchema]: true;
582
+ readonly [$validVertexSchema]: true;
583
+ }
584
+ /**
585
+ * Type of the `d.vec3b` object/function: vector data type schema/constructor
586
+ * Cannot be used inside buffers as it is not host-shareable.
587
+ */
588
+ interface Vec3b extends BaseData, DualFn<((x: boolean, y: boolean, z: boolean) => v3b) & ((xyz: boolean) => v3b) & (() => v3b) & ((v: v3b) => v3b) & ((v0: v2b, z: boolean) => v3b) & ((x: boolean, v0: v2b) => v3b)> {
589
+ readonly type: 'vec3<bool>';
590
+ readonly primitive: Bool;
591
+ readonly componentCount: 3;
592
+ readonly [$repr]: v3b;
593
+ readonly [$invalidSchemaReason]: 'Boolean vectors is not host-shareable, use numeric vectors instead';
594
+ }
595
+ /**
596
+ * Type of the `d.vec4f` object/function: vector data type schema/constructor
597
+ */
598
+ interface Vec4f extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f) & ((v: AnyNumericVec4Instance) => v4f) & ((v0: AnyNumericVec3Instance, w: number) => v4f) & ((x: number, v0: AnyNumericVec3Instance) => v4f) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4f) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4f) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4f) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4f)> {
599
+ readonly type: 'vec4f';
600
+ readonly primitive: F32;
601
+ readonly componentCount: 4;
602
+ readonly [$repr]: v4f;
603
+ readonly [$validStorageSchema]: true;
604
+ readonly [$validUniformSchema]: true;
605
+ readonly [$validVertexSchema]: true;
606
+ }
607
+ /**
608
+ * Type of the `d.vec4h` object/function: vector data type schema/constructor
609
+ */
610
+ interface Vec4h extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h) & ((v: AnyNumericVec4Instance) => v4h) & ((v0: AnyNumericVec3Instance, w: number) => v4h) & ((x: number, v0: AnyNumericVec3Instance) => v4h) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4h) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4h) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4h) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4h)> {
611
+ readonly type: 'vec4h';
612
+ readonly primitive: F16;
613
+ readonly componentCount: 4;
614
+ readonly [$repr]: v4h;
615
+ readonly [$validStorageSchema]: true;
616
+ readonly [$validUniformSchema]: true;
617
+ readonly [$validVertexSchema]: true;
618
+ }
619
+ /**
620
+ * Type of the `d.vec4i` object/function: vector data type schema/constructor
621
+ */
622
+ interface Vec4i extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i) & ((v: AnyNumericVec4Instance) => v4i) & ((v0: AnyNumericVec3Instance, w: number) => v4i) & ((x: number, v0: AnyNumericVec3Instance) => v4i) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4i) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4i) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4i) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4i)> {
623
+ readonly type: 'vec4i';
624
+ readonly primitive: I32;
625
+ readonly componentCount: 4;
626
+ readonly [$repr]: v4i;
627
+ readonly [$validStorageSchema]: true;
628
+ readonly [$validUniformSchema]: true;
629
+ readonly [$validVertexSchema]: true;
630
+ }
631
+ /**
632
+ * Type of the `d.vec4u` object/function: vector data type schema/constructor
633
+ */
634
+ interface Vec4u extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u) & ((v: AnyNumericVec4Instance) => v4u) & ((v0: AnyNumericVec3Instance, w: number) => v4u) & ((x: number, v0: AnyNumericVec3Instance) => v4u) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4u) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4u) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4u) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4u)> {
635
+ readonly type: 'vec4u';
636
+ readonly primitive: U32;
637
+ readonly componentCount: 4;
638
+ readonly [$repr]: v4u;
639
+ readonly [$validStorageSchema]: true;
640
+ readonly [$validUniformSchema]: true;
641
+ readonly [$validVertexSchema]: true;
642
+ }
643
+ /**
644
+ * Type of the `d.vec4b` object/function: vector data type schema/constructor
645
+ * Cannot be used inside buffers as it is not host-shareable.
646
+ */
647
+ interface Vec4b extends BaseData, DualFn<((x: boolean, y: boolean, z: boolean, w: boolean) => v4b) & ((xyzw: boolean) => v4b) & (() => v4b) & ((v: v4b) => v4b) & ((v0: v3b, w: boolean) => v4b) & ((x: boolean, v0: v3b) => v4b) & ((v0: v2b, v1: v2b) => v4b) & ((v0: v2b, z: boolean, w: boolean) => v4b) & ((x: boolean, v0: v2b, z: boolean) => v4b) & ((x: boolean, y: boolean, v0: v2b) => v4b)> {
648
+ readonly type: 'vec4<bool>';
649
+ readonly primitive: Bool;
650
+ readonly componentCount: 4;
651
+ readonly [$repr]: v4b;
652
+ readonly [$invalidSchemaReason]: 'Boolean vectors is not host-shareable, use numeric vectors instead';
653
+ }
654
+ /**
655
+ * Type of the `d.mat2x2f` object/function: matrix data type schema/constructor
656
+ */
657
+ interface Mat2x2f extends BaseData {
658
+ readonly type: 'mat2x2f';
659
+ readonly primitive: F32;
660
+ readonly [$repr]: m2x2f;
661
+ readonly [$validStorageSchema]: true;
662
+ readonly [$validUniformSchema]: true;
663
+ (...elements: [number, number, number, number]): m2x2f;
664
+ (...columns: [v2f, v2f]): m2x2f;
665
+ (): m2x2f;
666
+ identity(): m2x2f;
667
+ }
668
+ /**
669
+ * Type of the `d.mat3x3f` object/function: matrix data type schema/constructor
670
+ */
671
+ interface Mat3x3f extends BaseData {
672
+ readonly type: 'mat3x3f';
673
+ readonly primitive: F32;
674
+ readonly [$repr]: m3x3f;
675
+ readonly [$validStorageSchema]: true;
676
+ readonly [$validUniformSchema]: true;
677
+ (...elements: [number, number, number, number, number, number, number, number, number]): m3x3f;
678
+ (...columns: [v3f, v3f, v3f]): m3x3f;
679
+ (): m3x3f;
680
+ identity(): m3x3f;
681
+ }
682
+ /**
683
+ * Type of the `d.mat4x4f` object/function: matrix data type schema/constructor
684
+ */
685
+ interface Mat4x4f extends BaseData {
686
+ readonly type: 'mat4x4f';
687
+ readonly primitive: F32;
688
+ readonly [$repr]: m4x4f;
689
+ readonly [$validStorageSchema]: true;
690
+ readonly [$validUniformSchema]: true;
691
+ (...elements: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]): m4x4f;
692
+ (...columns: [v4f, v4f, v4f, v4f]): m4x4f;
693
+ (): m4x4f;
694
+ identity(): m4x4f;
695
+ translation(vec: v3f): m4x4f;
696
+ scaling(vec: v3f): m4x4f;
697
+ rotationX(angle: number): m4x4f;
698
+ rotationY(angle: number): m4x4f;
699
+ rotationZ(angle: number): m4x4f;
700
+ }
701
+ /**
702
+ * Array schema constructed via `d.arrayOf` function.
703
+ *
704
+ * Responsible for handling reading and writing array values
705
+ * between binary and JS representation. Takes into account
706
+ * the `byteAlignment` requirement of its elementType.
707
+ */
708
+ interface WgslArray<out TElement extends BaseData = BaseData> extends BaseData {
709
+ <T extends TElement>(elements: Infer<T>[]): Infer<T>[];
710
+ (): Infer<TElement>[];
711
+ readonly type: 'array';
712
+ readonly elementCount: number;
713
+ readonly elementType: TElement;
714
+ readonly [$repr]: Infer<TElement>[];
715
+ readonly [$gpuRepr]: InferGPU<TElement>[];
716
+ readonly [$reprPartial]: {
717
+ idx: number;
718
+ value: InferPartial<TElement>;
719
+ }[] | undefined;
720
+ readonly [$memIdent]: WgslArray<MemIdentity<TElement>>;
721
+ readonly [$validStorageSchema]: IsValidStorageSchema<TElement>;
722
+ readonly [$validUniformSchema]: IsValidUniformSchema<TElement>;
723
+ readonly [$validVertexSchema]: IsValidVertexSchema<TElement>;
724
+ readonly [$invalidSchemaReason]: `in array element — ${ExtractInvalidSchemaError<TElement>}`;
725
+ }
726
+ /**
727
+ * Struct schema constructed via `d.struct` function.
728
+ *
729
+ * Responsible for handling reading and writing struct values
730
+ * between binary and JS representation. Takes into account
731
+ * the `byteAlignment` requirement of its members.
732
+ */
733
+ interface WgslStruct<out TProps extends Record<string, BaseData> = Record<string, BaseData>> extends BaseData, TgpuNamable {
734
+ readonly [$internal]: {
735
+ isAbstruct: boolean;
736
+ };
737
+ readonly type: 'struct';
738
+ readonly propTypes: TProps;
739
+ (props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;
740
+ (): Prettify<InferRecord<TProps>>;
741
+ readonly [$repr]: Prettify<InferRecord<TProps>>;
742
+ readonly [$gpuRepr]: Prettify<InferGPURecord<TProps>>;
743
+ readonly [$memIdent]: WgslStruct<Prettify<MemIdentityRecord<TProps>>>;
744
+ readonly [$reprPartial]: Prettify<Partial<InferPartialRecord<TProps>>> | undefined;
745
+ readonly [$invalidSchemaReason]: SwapNever<{ [K in keyof TProps]: ExtractInvalidSchemaError<TProps[K], `in struct property '${K & string}' — `> }[keyof TProps], undefined>;
746
+ readonly [$validStorageSchema]: { [K in keyof TProps]: IsValidStorageSchema<TProps[K]> }[keyof TProps] extends true ? true : false;
747
+ readonly [$validUniformSchema]: { [K in keyof TProps]: IsValidUniformSchema<TProps[K]> }[keyof TProps] extends true ? true : false;
748
+ readonly [$validVertexSchema]: { [K in keyof TProps]: IsValidVertexSchema<TProps[K]> }[keyof TProps] extends true ? true : false;
749
+ }
750
+ /** @deprecated Just use `WgslStruct` without any type parameters */
751
+ type AnyWgslStruct = WgslStruct;
752
+ type AddressSpace = 'uniform' | 'storage' | 'workgroup' | 'private' | 'function' | 'handle';
753
+ type Access = 'read' | 'write' | 'read-write';
754
+ interface Ptr<TAddr extends AddressSpace = AddressSpace, TInner extends BaseData = BaseData, TAccess extends Access = Access> extends BaseData {
755
+ readonly type: 'ptr';
756
+ readonly inner: TInner;
757
+ readonly addressSpace: TAddr;
758
+ readonly access: TAccess;
759
+ readonly implicit: boolean;
760
+ readonly [$repr]: _ref<Infer<TInner>>;
761
+ readonly [$invalidSchemaReason]: 'Pointers are not host-shareable';
762
+ }
763
+ /**
764
+ * Schema representing the `atomic<...>` WGSL data type.
765
+ */
766
+ interface Atomic<TInner extends U32 | I32 = U32 | I32> extends BaseData {
767
+ readonly type: 'atomic';
768
+ readonly inner: TInner;
769
+ readonly [$repr]: Infer<TInner>;
770
+ readonly [$gpuRepr]: TInner extends U32 ? atomicU32 : atomicI32;
771
+ readonly [$memIdent]: MemIdentity<TInner>;
772
+ readonly [$validStorageSchema]: true;
773
+ readonly [$validUniformSchema]: true;
774
+ readonly [$validVertexSchema]: true;
775
+ }
776
+ interface atomicU32 {
777
+ readonly [$internal]: true;
778
+ readonly type: 'atomicU32';
779
+ }
780
+ interface atomicI32 {
781
+ readonly [$internal]: true;
782
+ readonly type: 'atomicI32';
783
+ }
784
+ interface Align<T extends number> {
785
+ readonly [$internal]: true;
786
+ readonly type: '@align';
787
+ readonly params: [T];
788
+ }
789
+ interface Size<T extends number> {
790
+ readonly [$internal]: true;
791
+ readonly type: '@size';
792
+ readonly params: [T];
793
+ }
794
+ interface Location<T extends number = number> {
795
+ readonly [$internal]: true;
796
+ readonly type: '@location';
797
+ readonly params: [T];
798
+ }
799
+ type PerspectiveOrLinearInterpolationType = `${'perspective' | 'linear'}${'' | ', center' | ', centroid' | ', sample'}`;
800
+ type FlatInterpolationType = `flat${'' | ', first' | ', either'}`;
801
+ type InterpolationType = PerspectiveOrLinearInterpolationType | FlatInterpolationType;
802
+ interface Interpolate<T extends InterpolationType = InterpolationType> {
803
+ readonly [$internal]: true;
804
+ readonly type: '@interpolate';
805
+ readonly params: [T];
806
+ }
807
+ interface Builtin<T extends string> {
808
+ readonly [$internal]: true;
809
+ readonly type: '@builtin';
810
+ readonly params: [T];
811
+ }
812
+ interface Invariant {
813
+ readonly [$internal]: true;
814
+ readonly type: '@invariant';
815
+ readonly params: [];
816
+ }
817
+ interface Decorated<out TInner extends BaseData = BaseData, out TAttribs extends unknown[] = unknown[]> extends BaseData {
818
+ readonly type: 'decorated';
819
+ readonly inner: TInner;
820
+ readonly attribs: TAttribs;
821
+ readonly [$repr]: Infer<TInner>;
822
+ readonly [$gpuRepr]: InferGPU<TInner>;
823
+ readonly [$reprPartial]: InferPartial<TInner>;
824
+ readonly [$memIdent]: TAttribs extends Location[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
825
+ readonly [$validStorageSchema]: IsValidStorageSchema<TInner>;
826
+ readonly [$validUniformSchema]: IsValidUniformSchema<TInner>;
827
+ readonly [$validVertexSchema]: IsValidVertexSchema<TInner>;
828
+ readonly [$invalidSchemaReason]: ExtractInvalidSchemaError<TInner>;
829
+ }
830
+ declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "u16", "vec2f", "vec2h", "vec2i", "vec2u", "vec2<bool>", "vec3f", "vec3h", "vec3i", "vec3u", "vec3<bool>", "vec4f", "vec4h", "vec4i", "vec4u", "vec4<bool>", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "ptr", "atomic", "decorated", "abstractInt", "abstractFloat", "void", "texture_1d", "texture_storage_1d", "texture_2d", "texture_storage_2d", "texture_multisampled_2d", "texture_depth_2d", "texture_depth_multisampled_2d", "texture_2d_array", "texture_storage_2d_array", "texture_depth_2d_array", "texture_cube", "texture_depth_cube", "texture_cube_array", "texture_depth_cube_array", "texture_3d", "texture_storage_3d", "texture_external", "sampler", "sampler_comparison"];
831
+ type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
832
+ type IsWgslData<T> = T extends {
833
+ readonly type: WgslTypeLiteral;
834
+ } ? true : false;
835
+ type PerspectiveOrLinearInterpolatableBaseType = F32 | F16 | Vec2f | Vec2h | Vec3f | Vec3h | Vec4f | Vec4h;
836
+ type PerspectiveOrLinearInterpolatableData = PerspectiveOrLinearInterpolatableBaseType | Decorated<PerspectiveOrLinearInterpolatableBaseType>;
837
+ type FlatInterpolatableAdditionalBaseType = I32 | U32 | Vec2i | Vec2u | Vec3i | Vec3u | Vec4i | Vec4u;
838
+ type FlatInterpolatableData = PerspectiveOrLinearInterpolatableData | FlatInterpolatableAdditionalBaseType | Decorated<FlatInterpolatableAdditionalBaseType>;
839
+ type TextureSampleTypes = F32 | I32 | U32;
840
+ type ScalarData = Bool | F32 | F16 | I32 | U32 | AbstractInt | AbstractFloat;
841
+ type VecData = Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b;
842
+ type MatData = Mat2x2f | Mat3x3f | Mat4x4f;
843
+ type StorableData = ScalarData | VecData | MatData | Atomic<I32> | Atomic<U32> | WgslArray | WgslStruct;
844
+ type AnyWgslData = Bool | F32 | F16 | I32 | U32 | U16 | Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b | Mat2x2f | Mat3x3f | Mat4x4f | WgslStruct | WgslArray | Ptr | Atomic<U32> | Atomic<I32> | Decorated | AbstractInt | AbstractFloat | Void | WgslTexture | WgslStorageTexture | WgslExternalTexture | WgslSampler | WgslComparisonSampler;
845
+ declare function isWgslData(value: unknown): value is AnyWgslData;
846
+ /**
847
+ * Checks whether passed in value is an array schema,
848
+ * as opposed to, e.g., a disarray schema.
849
+ *
850
+ * Array schemas can be used to describe uniform and storage buffers,
851
+ * whereas disarray schemas cannot.
852
+ *
853
+ * @example
854
+ * isWgslArray(d.arrayOf(d.u32, 4)) // true
855
+ * isWgslArray(d.disarray(d.u32, 4)) // false
856
+ * isWgslArray(d.vec3f) // false
857
+ */
858
+ declare function isWgslArray(schema: unknown): schema is WgslArray;
859
+ /**
860
+ * Checks whether passed in value is a struct schema,
861
+ * as opposed to, e.g., an unstruct schema.
862
+ *
863
+ * Struct schemas can be used to describe uniform and storage buffers,
864
+ * whereas unstruct schemas cannot.
865
+ *
866
+ * @example
867
+ * isWgslStruct(d.struct({ a: d.u32 })) // true
868
+ * isWgslStruct(d.unstruct({ a: d.u32 })) // false
869
+ * isWgslStruct(d.vec3f) // false
870
+ */
871
+ declare function isWgslStruct(schema: unknown): schema is WgslStruct;
872
+ /**
873
+ * Checks whether passed in value is a pointer schema.
874
+ *
875
+ * @example
876
+ * isPtr(d.ptrFn(d.f32)) // true
877
+ * isPtr(d.ptrPrivate(d.f32)) // true
878
+ * isPtr(d.f32) // false
879
+ */
880
+ declare function isPtr(schema: unknown): schema is Ptr;
881
+ /**
882
+ * Checks whether the passed in value is an atomic schema.
883
+ *
884
+ * @example
885
+ * isAtomic(d.atomic(d.u32)) // true
886
+ * isAtomic(d.u32) // false
887
+ */
888
+ declare function isAtomic(schema: unknown): schema is Atomic;
889
+ declare function isAlignAttrib<T extends number>(value: unknown): value is Align<T>;
890
+ declare function isSizeAttrib<T extends number>(value: unknown): value is Size<T>;
891
+ declare function isLocationAttrib<T extends number>(value: unknown): value is Location<T>;
892
+ declare function isInterpolateAttrib<T extends InterpolationType>(value: unknown): value is Interpolate<T>;
893
+ declare function isBuiltinAttrib(value: unknown): value is Builtin<string>;
894
+ declare function isDecorated(value: unknown): value is Decorated;
895
+ //#endregion
896
+ export { AbstractFloat, AbstractInt, Align, AnyBooleanVecInstance, AnyFloat32VecInstance, AnyFloatVecInstance, AnyIntegerVecInstance, AnyMatInstance, AnyNumericVecInstance, AnySignedVecInstance, AnyVec2Instance, AnyVec3Instance, AnyVecInstance, AnyWgslData, AnyWgslStruct, Atomic, BaseData, Bool, Builtin, Decorated, F16, F32, FlatInterpolatableData, FlatInterpolationType, I32, Interpolate, Invariant, IsWgslData, Location, Mat2x2f, Mat3x3f, Mat4x4f, PerspectiveOrLinearInterpolatableData, PerspectiveOrLinearInterpolationType, Ptr, Size, StorableData, TextureSampleTypes, U16, U32, Vec2b, Vec2f, Vec2h, Vec2i, Vec2u, Vec3b, Vec3f, Vec3h, Vec3i, Vec3u, Vec4b, Vec4f, Vec4h, Vec4i, Vec4u, Void, WgslArray, WgslStruct, atomicI32, atomicU32, isAlignAttrib, isAtomic, isBuiltinAttrib, isDecorated, isInterpolateAttrib, isLocationAttrib, isPtr, isSizeAttrib, isWgslArray, isWgslData, isWgslStruct, m2x2f, m3x3f, m4x4f, mBaseForVec, matBase, v2b, v2f, v2h, v2i, v2u, v3b, v3f, v3h, v3i, v3u, v4b, v4f, v4h, v4i, v4u, vBaseForMat, vecBase };