typegpu 0.10.0 → 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-Dg5ybJro.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-ClEnM-Ye.js +0 -818
  244. package/builtin-ClEnM-Ye.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-yZXvaV2C.js +0 -413
  250. package/deepEqual-yZXvaV2C.js.map +0 -1
  251. package/extensions-0SFbU9FH.js +0 -2032
  252. package/extensions-0SFbU9FH.js.map +0 -1
  253. package/fullScreenTriangle-MdLGaAMR.js +0 -543
  254. package/fullScreenTriangle-MdLGaAMR.js.map +0 -1
  255. package/index.d.ts.map +0 -1
  256. package/index.js.map +0 -1
  257. package/indexNamedExports-Cdy7USiY.d.ts +0 -5696
  258. package/indexNamedExports-Cdy7USiY.d.ts.map +0 -1
  259. package/operators-HTxa_0k9.js +0 -4156
  260. package/operators-HTxa_0k9.js.map +0 -1
  261. package/std/index.d.ts.map +0 -1
  262. package/std/index.js.map +0 -1
  263. package/texture-Dg5ybJro.js.map +0 -1
@@ -0,0 +1,97 @@
1
+ import { $internal, isMarkedInternal } from "../shared/symbols.js";
2
+ import { setName } from "../shared/meta.js";
3
+ import { vertexFormats } from "../shared/vertexFormat.js";
4
+ import { isAlignAttrib, isDecorated, isLocationAttrib, isPtr, isSizeAttrib, isWgslData } from "./wgslTypes.js";
5
+
6
+ //#region src/data/dataTypes.ts
7
+ /**
8
+ * Runtime function to extract the inner data type from decorated types.
9
+ * If the data is not decorated, returns the data as-is.
10
+ */
11
+ function undecorate(data) {
12
+ if (isDecorated(data) || isLooseDecorated(data)) return data.inner;
13
+ return data;
14
+ }
15
+ function unptr(data) {
16
+ if (isPtr(data)) return data.inner;
17
+ return data;
18
+ }
19
+ const looseTypeLiterals = [
20
+ "unstruct",
21
+ "disarray",
22
+ "loose-decorated",
23
+ ...vertexFormats
24
+ ];
25
+ function isLooseData(data) {
26
+ return isMarkedInternal(data) && looseTypeLiterals.includes(data?.type);
27
+ }
28
+ /**
29
+ * Checks whether the passed in value is a disarray schema,
30
+ * as opposed to, e.g., a regular array schema.
31
+ *
32
+ * Array schemas can be used to describe uniform and storage buffers,
33
+ * whereas disarray schemas cannot. Disarrays are useful for
34
+ * defining vertex buffers instead.
35
+ *
36
+ * @example
37
+ * isDisarray(d.arrayOf(d.u32, 4)) // false
38
+ * isDisarray(d.disarrayOf(d.u32, 4)) // true
39
+ * isDisarray(d.vec3f) // false
40
+ */
41
+ function isDisarray(schema) {
42
+ return isMarkedInternal(schema) && schema?.type === "disarray";
43
+ }
44
+ /**
45
+ * Checks whether passed in value is a unstruct schema,
46
+ * as opposed to, e.g., a struct schema.
47
+ *
48
+ * Struct schemas can be used to describe uniform and storage buffers,
49
+ * whereas unstruct schemas cannot. Unstructs are useful for
50
+ * defining vertex buffers instead.
51
+ *
52
+ * @example
53
+ * isUnstruct(d.struct({ a: d.u32 })) // false
54
+ * isUnstruct(d.unstruct({ a: d.u32 })) // true
55
+ * isUnstruct(d.vec3f) // false
56
+ */
57
+ function isUnstruct(schema) {
58
+ return isMarkedInternal(schema) && schema?.type === "unstruct";
59
+ }
60
+ function isLooseDecorated(value) {
61
+ return isMarkedInternal(value) && value?.type === "loose-decorated";
62
+ }
63
+ function getCustomAlignment(data) {
64
+ return data.attribs?.find(isAlignAttrib)?.params[0];
65
+ }
66
+ function getCustomSize(data) {
67
+ return data.attribs?.find(isSizeAttrib)?.params[0];
68
+ }
69
+ function getCustomLocation(data) {
70
+ return data.attribs?.find(isLocationAttrib)?.params[0];
71
+ }
72
+ function isData(value) {
73
+ return isWgslData(value) || isLooseData(value);
74
+ }
75
+ const UnknownData = Symbol("UNKNOWN");
76
+ var InfixDispatch = class {
77
+ constructor(name, lhs, operator) {
78
+ this.name = name;
79
+ this.lhs = lhs;
80
+ this.operator = operator;
81
+ }
82
+ };
83
+ var MatrixColumnsAccess = class {
84
+ constructor(matrix) {
85
+ this.matrix = matrix;
86
+ }
87
+ };
88
+ var ConsoleLog = class {
89
+ [$internal] = true;
90
+ constructor(op) {
91
+ this.op = op;
92
+ setName(this, "consoleLog");
93
+ }
94
+ };
95
+
96
+ //#endregion
97
+ export { ConsoleLog, InfixDispatch, MatrixColumnsAccess, UnknownData, getCustomAlignment, getCustomLocation, getCustomSize, isData, isDisarray, isLooseData, isLooseDecorated, isUnstruct, undecorate, unptr };
@@ -0,0 +1,25 @@
1
+ import { AnyData } from "./dataTypes.js";
2
+
3
+ //#region src/data/deepEqual.d.ts
4
+ /**
5
+ * Performs a deep comparison of two TypeGPU data schemas.
6
+ *
7
+ * @param a The first data schema to compare.
8
+ * @param b The second data schema to compare.
9
+ * @returns `true` if the schemas are deeply equal, `false` otherwise.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { vec3f, struct, deepEqual } from 'typegpu/data';
14
+ *
15
+ * const schema1 = struct({ a: vec3f });
16
+ * const schema2 = struct({ a: vec3f });
17
+ * const schema3 = struct({ b: vec3f });
18
+ *
19
+ * console.log(deepEqual(schema1, schema2)); // true
20
+ * console.log(deepEqual(schema1, schema3)); // false
21
+ * ```
22
+ */
23
+ declare function deepEqual(a: AnyData, b: AnyData): boolean;
24
+ //#endregion
25
+ export { deepEqual };
@@ -0,0 +1,58 @@
1
+ import { isAtomic, isDecorated, isPtr, isWgslArray, isWgslStruct } from "./wgslTypes.js";
2
+ import { isDisarray, isLooseDecorated, isUnstruct } from "./dataTypes.js";
3
+
4
+ //#region src/data/deepEqual.ts
5
+ /**
6
+ * Performs a deep comparison of two TypeGPU data schemas.
7
+ *
8
+ * @param a The first data schema to compare.
9
+ * @param b The second data schema to compare.
10
+ * @returns `true` if the schemas are deeply equal, `false` otherwise.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { vec3f, struct, deepEqual } from 'typegpu/data';
15
+ *
16
+ * const schema1 = struct({ a: vec3f });
17
+ * const schema2 = struct({ a: vec3f });
18
+ * const schema3 = struct({ b: vec3f });
19
+ *
20
+ * console.log(deepEqual(schema1, schema2)); // true
21
+ * console.log(deepEqual(schema1, schema3)); // false
22
+ * ```
23
+ */
24
+ function deepEqual(a, b) {
25
+ if (a === b) return true;
26
+ if (a.type !== b.type) return false;
27
+ if (isWgslStruct(a) && isWgslStruct(b) || isUnstruct(a) && isUnstruct(b)) {
28
+ const aProps = a.propTypes;
29
+ const bProps = b.propTypes;
30
+ const aKeys = Object.keys(aProps);
31
+ const bKeys = Object.keys(bProps);
32
+ if (aKeys.length !== bKeys.length) return false;
33
+ for (let i = 0; i < aKeys.length; i++) {
34
+ const keyA = aKeys[i];
35
+ const keyB = bKeys[i];
36
+ if (keyA !== keyB || !keyA || !keyB || !deepEqual(aProps[keyA], bProps[keyB])) return false;
37
+ }
38
+ return true;
39
+ }
40
+ if (isWgslArray(a) && isWgslArray(b) || isDisarray(a) && isDisarray(b)) return a.elementCount === b.elementCount && deepEqual(a.elementType, b.elementType);
41
+ if (isPtr(a) && isPtr(b)) return a.addressSpace === b.addressSpace && a.access === b.access && deepEqual(a.inner, b.inner);
42
+ if (isAtomic(a) && isAtomic(b)) return deepEqual(a.inner, b.inner);
43
+ if (isDecorated(a) && isDecorated(b) || isLooseDecorated(a) && isLooseDecorated(b)) {
44
+ if (!deepEqual(a.inner, b.inner)) return false;
45
+ if (a.attribs.length !== b.attribs.length) return false;
46
+ const getAttrKey = (attr) => {
47
+ const anyAttr = attr;
48
+ return `${anyAttr.type}(${(anyAttr.params ?? []).join(",")})`;
49
+ };
50
+ const attrsA = a.attribs.map(getAttrKey);
51
+ const attrsB = b.attribs.map(getAttrKey);
52
+ for (let i = 0; i < attrsA.length; i++) if (attrsA[i] !== attrsB[i]) return false;
53
+ }
54
+ return true;
55
+ }
56
+
57
+ //#endregion
58
+ export { deepEqual };
@@ -0,0 +1,34 @@
1
+ import { AnyData, Disarray } from "./dataTypes.js";
2
+ import { TgpuComptime } from "../core/function/comptime.js";
3
+ import "../indexNamedExports.js";
4
+
5
+ //#region src/data/disarray.d.ts
6
+ interface DisarrayConstructor {
7
+ <TElement extends AnyData>(elementType: TElement): (elementCount: number) => Disarray<TElement>;
8
+ <TElement extends AnyData>(elementType: TElement, elementCount: number): Disarray<TElement>;
9
+ }
10
+ /**
11
+ * Creates an array schema that can be used to construct vertex buffers.
12
+ * Describes arrays with fixed-size length, storing elements of the same type.
13
+ *
14
+ * Elements in the schema are not aligned in respect to their `byteAlignment`,
15
+ * unless they are explicitly decorated with the custom align attribute
16
+ * via `d.align` function.
17
+ *
18
+ * @example
19
+ * const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f
20
+ *
21
+ * @example
22
+ * const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);
23
+ *
24
+ * If `elementCount` is not specified, a partially applied function is returned.
25
+ * @example
26
+ * const disarray = d.disarrayOf(d.vec3f);
27
+ * // ^? (n: number) => Disarray<d.Vec3f>
28
+ *
29
+ * @param elementType The type of elements in the array.
30
+ * @param elementCount The number of elements in the array.
31
+ */
32
+ declare const disarrayOf: TgpuComptime<DisarrayConstructor>;
33
+ //#endregion
34
+ export { disarrayOf };
@@ -0,0 +1,52 @@
1
+ import { $internal } from "../shared/symbols.js";
2
+ import { schemaCallWrapper } from "./schemaCallWrapper.js";
3
+ import { comptime } from "../core/function/comptime.js";
4
+
5
+ //#region src/data/disarray.ts
6
+ /**
7
+ * Creates an array schema that can be used to construct vertex buffers.
8
+ * Describes arrays with fixed-size length, storing elements of the same type.
9
+ *
10
+ * Elements in the schema are not aligned in respect to their `byteAlignment`,
11
+ * unless they are explicitly decorated with the custom align attribute
12
+ * via `d.align` function.
13
+ *
14
+ * @example
15
+ * const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f
16
+ *
17
+ * @example
18
+ * const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);
19
+ *
20
+ * If `elementCount` is not specified, a partially applied function is returned.
21
+ * @example
22
+ * const disarray = d.disarrayOf(d.vec3f);
23
+ * // ^? (n: number) => Disarray<d.Vec3f>
24
+ *
25
+ * @param elementType The type of elements in the array.
26
+ * @param elementCount The number of elements in the array.
27
+ */
28
+ const disarrayOf = comptime(((elementType, elementCount) => {
29
+ if (elementCount === void 0) return (count) => cpu_disarrayOf(elementType, count);
30
+ return cpu_disarrayOf(elementType, elementCount);
31
+ })).$name("disarrayOf");
32
+ function cpu_disarrayOf(elementType, elementCount) {
33
+ const disarraySchema = (elements) => {
34
+ if (elements && elements.length !== elementCount) throw new Error(`Disarray schema of ${elementCount} elements of type ${elementType.type} called with ${elements.length} argument(s).`);
35
+ return Array.from({ length: elementCount }, (_, i) => schemaCallWrapper(elementType, elements?.[i]));
36
+ };
37
+ Object.setPrototypeOf(disarraySchema, DisarrayImpl);
38
+ disarraySchema.elementType = elementType;
39
+ if (!Number.isInteger(elementCount) || elementCount < 0) throw new Error(`Cannot create disarray schema with invalid element count: ${elementCount}.`);
40
+ disarraySchema.elementCount = elementCount;
41
+ return disarraySchema;
42
+ }
43
+ const DisarrayImpl = {
44
+ [$internal]: true,
45
+ type: "disarray",
46
+ toString() {
47
+ return `disarrayOf(${this.elementType}, ${this.elementCount})`;
48
+ }
49
+ };
50
+
51
+ //#endregion
52
+ export { disarrayOf };
@@ -0,0 +1,10 @@
1
+ import "./wgslTypes.js";
2
+ import { AnyData } from "./dataTypes.js";
3
+
4
+ //#region src/data/getLongestContiguousPrefix.d.ts
5
+ /**
6
+ * Returns the size (in bytes) of the longest contiguous memory prefix of data represented by the `schema`.
7
+ */
8
+ declare function PUBLIC_getLongestContiguousPrefix(schema: AnyData): number;
9
+ //#endregion
10
+ export { PUBLIC_getLongestContiguousPrefix };
@@ -0,0 +1,15 @@
1
+ import { getLayoutInfo } from "./schemaMemoryLayout.js";
2
+
3
+ //#region src/data/getLongestContiguousPrefix.ts
4
+ function getLongestContiguousPrefix(schema) {
5
+ return getLayoutInfo(schema, "longestContiguousPrefix");
6
+ }
7
+ /**
8
+ * Returns the size (in bytes) of the longest contiguous memory prefix of data represented by the `schema`.
9
+ */
10
+ function PUBLIC_getLongestContiguousPrefix(schema) {
11
+ return getLongestContiguousPrefix(schema);
12
+ }
13
+
14
+ //#endregion
15
+ export { PUBLIC_getLongestContiguousPrefix, getLongestContiguousPrefix };
package/data/index.d.ts CHANGED
@@ -1,9 +1,31 @@
1
- import { $a as m3x3f, $c as align, $i as textureStorage2dArray, $n as atomic, $s as uint32x2, Aa as Vec3h, Ai as WgslTextureCube, Ar as ptrHandle, As as formatToWGSLType, Ba as WgslStruct, Bi as texture2dArray, Br as i32, Bs as sint8, Ca as Vec2b, Ci as WgslStorageTexture3d, Cl as BuiltinNumWorkgroups, Cr as vec3u, Cs as float16, Da as Vec2u, Di as WgslTexture2d, Dl as BuiltinVertexIndex, Dr as vec4i, Ds as float32x2, Ea as Vec2i, Ei as WgslTexture1d, El as BuiltinSampleMask, Er as vec4h, Es as float32, Fa as Vec4h, Fi as WgslTextureDepthCubeArray, Fl as comparisonSampler, Fr as arrayOf, Fs as sint16x4, Ga as isInterpolateAttrib, Gi as textureDepth2dArray, Gs as snorm16x4, Ha as isAtomic, Hi as textureCube, Hr as u32, Hs as sint8x4, Ia as Vec4i, Ii as WgslTextureDepthMultisampled2d, Il as sampler, Ir as struct, Is as sint32, Ja as isSizeAttrib, Ji as textureDepthMultisampled2d, Jn as deepEqual, Js as snorm8x4, Ka as isLocationAttrib, Ki as textureDepthCube, Ks as snorm8, La as Vec4u, Li as WgslTextureMultisampled2d, Lr as bool, Ls as sint32x2, Ma as Vec3u, Mi as WgslTextureDepth2d, Mr as ptrStorage, Ms as packedFormats, Na as Vec4b, Ni as WgslTextureDepth2dArray, Nl as WgslComparisonSampler, Nr as ptrUniform, Ns as sint16, Oa as Vec3b, Oi as WgslTexture2dArray, Ol as BuiltinWorkgroupId, Or as vec4u, Os as float32x3, Pa as Vec4f, Pi as WgslTextureDepthCube, Pl as WgslSampler, Pr as ptrWorkgroup, Ps as sint16x2, Qa as m2x2f, Qc as IsBuiltin, Qi as textureStorage2d, Qn as PUBLIC_sizeOf, Qs as uint32, Ra as Void, Ri as texture1d, Rr as f16, Rs as sint32x3, Sa as U32, Si as WgslStorageTexture2dArray, Sl as BuiltinLocalInvocationIndex, Sr as vec3i, Ss as TgpuVertexFormatData, Ta as Vec2h, Ti as WgslTexture, Tl as BuiltinSampleIndex, Tr as vec4f, Ts as float16x4, Ua as isBuiltinAttrib, Ui as textureCubeArray, Us as snorm16, Va as isAlignAttrib, Vi as texture3d, Vr as u16, Vs as sint8x2, Wa as isDecorated, Wi as textureDepth2d, Ws as snorm16x2, Xa as isWgslData, Xc as AnyAttribute, Xi as textureMultisampled2d, Xn as PUBLIC_getLongestContiguousPrefix, Xs as uint16x2, Ya as isWgslArray, Yi as textureExternal, Yn as PUBLIC_alignmentOf, Ys as uint16, Za as isWgslStruct, Zc as HasCustomLocation, Zi as textureStorage1d, Zn as PUBLIC_isContiguous, Zs as uint16x4, _a as Mat4x4f, _l as BuiltinFragDepth, _r as vec2i, aa as Atomic, ac as unorm10_10_10_2, ai as LooseDecorated, ao as v2u, ar as mat4x4f, ba as StorableData, bi as WgslStorageTexture1d, bl as BuiltinInstanceIndex, br as vec3f, bs as FormatToWGSLType, ca as Builtin, cc as unorm16x4, ci as isDisarray, co as v3i, da as F32, dc as unorm8x4, di as isUnstruct, do as v4f, ea as textureStorage3d, ec as uint32x3, el as interpolate, eo as m4x4f, fa as I32, fc as unorm8x4_bgra, fi as Infer, fo as v4i, fr as unstruct, ga as Mat3x3f, gl as BuiltinClipDistances, gr as vec2h, ha as Mat2x2f, hl as AnyBuiltin, ho as _ref, hr as vec2f, ia as AnyWgslStruct, ic as uint8x4, ii as Disarray, il as size, io as v2i, ir as mat3x3f, ja as Vec3i, jc as memoryLayoutOf, ji as WgslTextureCubeArray, jr as ptrPrivate, js as isPackedData, ka as Vec3f, ki as WgslTexture3d, kl as builtin, kr as ptrFn, ks as float32x4, la as Decorated, lc as unorm8, li as isLooseData, lo as v3u, ma as Location, mi as InferPartial, mo as vecBase, mr as vec2b, na as AnyVecInstance, nc as uint8, ni as AnyData, nl as isBuiltin, no as v2b, oa as BaseData, oc as unorm16, oi as Unstruct, oo as v3b, or as matToArray, pa as Interpolate, pi as InferGPU, po as v4u, pr as disarrayOf, qa as isPtr, qi as textureDepthCubeArray, qs as snorm8x2, ra as AnyWgslData, rc as uint8x2, ri as AnyLooseData, rl as location, ro as v2f, rr as mat2x2f, sa as Bool, sc as unorm16x2, si as isData, so as v3f, ta as Align, tc as uint32x4, tl as invariant, to as matBase, ua as F16, uc as unorm8x2, ui as isLooseDecorated, uo as v4b, va as Ptr, vi as WgslExternalTexture, vl as BuiltinFrontFacing, vr as vec2u, wa as Vec2f, wi as WgslStorageTextureProps, wl as BuiltinPosition, wr as vec4b, ws as float16x2, xa as U16, xi as WgslStorageTexture2d, xl as BuiltinLocalInvocationId, xr as vec3h, xs as PackedData, ya as Size, yi as WgslStorageTexture, yl as BuiltinGlobalInvocationId, yr as vec3b, ys as FormatToAcceptedData, za as WgslArray, zi as texture2d, zr as f32, zs as sint32x4 } from "../indexNamedExports-Cdy7USiY.js";
1
+ import { WgslComparisonSampler, WgslSampler, comparisonSampler, sampler } from "./sampler.js";
2
+ import { AnyBuiltin, BuiltinClipDistances, BuiltinFragDepth, BuiltinFrontFacing, BuiltinGlobalInvocationId, BuiltinInstanceIndex, BuiltinLocalInvocationId, BuiltinLocalInvocationIndex, BuiltinNumWorkgroups, BuiltinPosition, BuiltinSampleIndex, BuiltinSampleMask, BuiltinVertexIndex, BuiltinWorkgroupId, builtin } from "../builtin.js";
3
+ import { AnyAttribute, HasCustomLocation, IsBuiltin, align, interpolate, invariant, isBuiltin, location, size } from "./attributes.js";
4
+ import { memoryLayoutOf } from "./offsetUtils.js";
5
+ import { FormatToAcceptedData, FormatToWGSLType, PackedData, TgpuVertexFormatData, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, isPackedData, packedFormats, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra } from "./vertexFormatData.js";
6
+ import { _ref } from "./ref.js";
7
+ import { Align, AnyVecInstance, AnyWgslData, AnyWgslStruct, Atomic, BaseData, Bool, Builtin, Decorated, F16, F32, I32, Interpolate, Location, Mat2x2f, Mat3x3f, Mat4x4f, Ptr, Size, StorableData, 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, matBase, v2b, v2f, v2i, v2u, v3b, v3f, v3i, v3u, v4b, v4f, v4i, v4u, vecBase } from "./wgslTypes.js";
8
+ import { WgslExternalTexture, WgslStorageTexture, WgslStorageTexture1d, WgslStorageTexture2d, WgslStorageTexture2dArray, WgslStorageTexture3d, WgslStorageTextureProps, WgslTexture, WgslTexture1d, WgslTexture2d, WgslTexture2dArray, WgslTexture3d, WgslTextureCube, WgslTextureCubeArray, WgslTextureDepth2d, WgslTextureDepth2dArray, WgslTextureDepthCube, WgslTextureDepthCubeArray, WgslTextureDepthMultisampled2d, WgslTextureMultisampled2d, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d } from "./texture.js";
9
+ import { Infer, InferGPU, InferPartial } from "../shared/repr.js";
10
+ import { AnyData, AnyLooseData, Disarray, LooseDecorated, Unstruct, isData, isDisarray, isLooseData, isLooseDecorated, isUnstruct } from "./dataTypes.js";
11
+ import { bool, f16, f32, i32, u16, u32 } from "./numeric.js";
12
+ import { struct } from "./struct.js";
13
+ import { arrayOf } from "./array.js";
14
+ import { ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup } from "./ptr.js";
15
+ import { vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u } from "./vector.js";
16
+ import { disarrayOf } from "./disarray.js";
17
+ import { unstruct } from "./unstruct.js";
18
+ import { mat2x2f, mat3x3f, mat4x4f, matToArray } from "./matrix.js";
19
+ import { atomic } from "./atomic.js";
20
+ import { PUBLIC_sizeOf } from "./sizeOf.js";
21
+ import { PUBLIC_isContiguous } from "./isContiguous.js";
22
+ import { PUBLIC_getLongestContiguousPrefix } from "./getLongestContiguousPrefix.js";
23
+ import { PUBLIC_alignmentOf } from "./alignmentOf.js";
24
+ import { deepEqual } from "./deepEqual.js";
2
25
 
3
26
  //#region src/data/index.d.ts
4
27
  declare namespace index_d_exports {
5
- export { Align, AnyAttribute, AnyBuiltin, AnyData, AnyLooseData, AnyVecInstance, AnyWgslData, AnyWgslStruct, Atomic, BaseData, BaseData as BaseWgslData, Bool, Builtin, BuiltinClipDistances, BuiltinFragDepth, BuiltinFrontFacing, BuiltinGlobalInvocationId, BuiltinInstanceIndex, BuiltinLocalInvocationId, BuiltinLocalInvocationIndex, BuiltinNumWorkgroups, BuiltinPosition, BuiltinSampleIndex, BuiltinSampleMask, BuiltinVertexIndex, BuiltinWorkgroupId, Decorated, Disarray, F16, F32, FormatToAcceptedData, FormatToWGSLType, HasCustomLocation, I32, Infer, InferGPU, InferPartial, Interpolate, IsBuiltin, Location, LooseDecorated, Mat2x2f, Mat3x3f, Mat4x4f, PackedData, Ptr, Size, StorableData, TgpuVertexFormatData, U16, U32, Unstruct, Vec2b, Vec2f, Vec2h, Vec2i, Vec2u, Vec3b, Vec3f, Vec3h, Vec3i, Vec3u, Vec4b, Vec4f, Vec4h, Vec4i, Vec4u, Void, WgslArray, WgslComparisonSampler, WgslExternalTexture, WgslSampler, WgslStorageTexture, WgslStorageTexture1d, WgslStorageTexture2d, WgslStorageTexture2dArray, WgslStorageTexture3d, WgslStorageTextureProps, WgslStruct, WgslTexture, WgslTexture1d, WgslTexture2d, WgslTexture2dArray, WgslTexture3d, WgslTextureCube, WgslTextureCubeArray, WgslTextureDepth2d, WgslTextureDepth2dArray, WgslTextureDepthCube, WgslTextureDepthCubeArray, WgslTextureDepthMultisampled2d, WgslTextureMultisampled2d, align, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, bool, builtin, comparisonSampler, deepEqual, disarrayOf, f16, f32, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, PUBLIC_getLongestContiguousPrefix as getLongestContiguousPrefix, i32, interpolate, invariant, isAlignAttrib, isAtomic, isBuiltin, isBuiltinAttrib, PUBLIC_isContiguous as isContiguous, isData, isDecorated, isDisarray, isInterpolateAttrib, isLocationAttrib, isLooseData, isLooseDecorated, isPackedData, isPtr, isSizeAttrib, isUnstruct, isWgslArray, isWgslData, isWgslStruct, location, m2x2f, m3x3f, m4x4f, mat2x2f, mat3x3f, mat4x4f, matBase, matToArray, memoryLayoutOf, packedFormats, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, _ref as ref, sampler, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, size, PUBLIC_sizeOf as sizeOf, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, struct, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d, u16, u32, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra, unstruct, v2b, v2f, v2i, v2u, v3b, v3f, v3i, v3u, v4b, v4f, v4i, v4u, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u, vecBase };
28
+ export { Align, AnyAttribute, AnyBuiltin, AnyData, AnyLooseData, AnyVecInstance, AnyWgslData, AnyWgslStruct, Atomic, BaseData, BaseData as BaseWgslData, Bool, Builtin, BuiltinClipDistances, BuiltinFragDepth, BuiltinFrontFacing, BuiltinGlobalInvocationId, BuiltinInstanceIndex, BuiltinLocalInvocationId, BuiltinLocalInvocationIndex, BuiltinNumWorkgroups, BuiltinPosition, BuiltinSampleIndex, BuiltinSampleMask, BuiltinVertexIndex, BuiltinWorkgroupId, Decorated, Disarray, F16, F32, FormatToAcceptedData, FormatToWGSLType, HasCustomLocation, I32, Infer, InferGPU, InferPartial, Interpolate, IsBuiltin, Location, LooseDecorated, Mat2x2f, Mat3x3f, Mat4x4f, PackedData, Ptr, Size, StorableData, TgpuVertexFormatData, U16, U32, Unstruct, Vec2b, Vec2f, Vec2h, Vec2i, Vec2u, Vec3b, Vec3f, Vec3h, Vec3i, Vec3u, Vec4b, Vec4f, Vec4h, Vec4i, Vec4u, Void, WgslArray, WgslComparisonSampler, WgslExternalTexture, WgslSampler, WgslStorageTexture, WgslStorageTexture1d, WgslStorageTexture2d, WgslStorageTexture2dArray, WgslStorageTexture3d, WgslStorageTextureProps, WgslStruct, WgslTexture, WgslTexture1d, WgslTexture2d, WgslTexture2dArray, WgslTexture3d, WgslTextureCube, WgslTextureCubeArray, WgslTextureDepth2d, WgslTextureDepth2dArray, WgslTextureDepthCube, WgslTextureDepthCubeArray, WgslTextureDepthMultisampled2d, WgslTextureMultisampled2d, align, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, atomicI32, atomicU32, bool, builtin, comparisonSampler, deepEqual, disarrayOf, f16, f32, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, PUBLIC_getLongestContiguousPrefix as getLongestContiguousPrefix, i32, interpolate, invariant, isAlignAttrib, isAtomic, isBuiltin, isBuiltinAttrib, PUBLIC_isContiguous as isContiguous, isData, isDecorated, isDisarray, isInterpolateAttrib, isLocationAttrib, isLooseData, isLooseDecorated, isPackedData, isPtr, isSizeAttrib, isUnstruct, isWgslArray, isWgslData, isWgslStruct, location, m2x2f, m3x3f, m4x4f, mat2x2f, mat3x3f, mat4x4f, matBase, matToArray, memoryLayoutOf, packedFormats, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, _ref as ref, sampler, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, size, PUBLIC_sizeOf as sizeOf, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, struct, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d, u16, u32, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra, unstruct, v2b, v2f, v2i, v2u, v3b, v3f, v3i, v3u, v4b, v4f, v4i, v4u, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u, vecBase };
6
29
  }
7
30
  //#endregion
8
- export { type Align, type AnyAttribute, type AnyBuiltin, type AnyData, type AnyLooseData, type AnyVecInstance, type AnyWgslData, type AnyWgslStruct, type Atomic, type BaseData, type BaseData as BaseWgslData, type Bool, type Builtin, type BuiltinClipDistances, type BuiltinFragDepth, type BuiltinFrontFacing, type BuiltinGlobalInvocationId, type BuiltinInstanceIndex, type BuiltinLocalInvocationId, type BuiltinLocalInvocationIndex, type BuiltinNumWorkgroups, type BuiltinPosition, type BuiltinSampleIndex, type BuiltinSampleMask, type BuiltinVertexIndex, type BuiltinWorkgroupId, type Decorated, type Disarray, type F16, type F32, FormatToAcceptedData, FormatToWGSLType, type HasCustomLocation, type I32, type Infer, type InferGPU, type InferPartial, type Interpolate, type IsBuiltin, type Location, type LooseDecorated, type Mat2x2f, type Mat3x3f, type Mat4x4f, PackedData, type Ptr, type Size, type StorableData, TgpuVertexFormatData, type U16, type U32, type Unstruct, type Vec2b, type Vec2f, type Vec2h, type Vec2i, type Vec2u, type Vec3b, type Vec3f, type Vec3h, type Vec3i, type Vec3u, type Vec4b, type Vec4f, type Vec4h, type Vec4i, type Vec4u, Void, type WgslArray, type WgslComparisonSampler, type WgslExternalTexture, type WgslSampler, type WgslStorageTexture, type WgslStorageTexture1d, type WgslStorageTexture2d, type WgslStorageTexture2dArray, type WgslStorageTexture3d, type WgslStorageTextureProps, type WgslStruct, type WgslTexture, type WgslTexture1d, type WgslTexture2d, type WgslTexture2dArray, type WgslTexture3d, type WgslTextureCube, type WgslTextureCubeArray, type WgslTextureDepth2d, type WgslTextureDepth2dArray, type WgslTextureDepthCube, type WgslTextureDepthCubeArray, type WgslTextureDepthMultisampled2d, type WgslTextureMultisampled2d, align, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, bool, builtin, comparisonSampler, deepEqual, disarrayOf, f16, f32, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, PUBLIC_getLongestContiguousPrefix as getLongestContiguousPrefix, i32, interpolate, invariant, isAlignAttrib, isAtomic, isBuiltin, isBuiltinAttrib, PUBLIC_isContiguous as isContiguous, isData, isDecorated, isDisarray, isInterpolateAttrib, isLocationAttrib, isLooseData, isLooseDecorated, isPackedData, isPtr, isSizeAttrib, isUnstruct, isWgslArray, isWgslData, isWgslStruct, location, type m2x2f, type m3x3f, type m4x4f, mat2x2f, mat3x3f, mat4x4f, type matBase, matToArray, memoryLayoutOf, packedFormats, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, _ref as ref, sampler, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, size, PUBLIC_sizeOf as sizeOf, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, struct, index_d_exports as t, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d, u16, u32, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra, unstruct, type v2b, type v2f, type v2i, type v2u, type v3b, type v3f, type v3i, type v3u, type v4b, type v4f, type v4i, type v4u, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u, type vecBase };
9
- //# sourceMappingURL=index.d.ts.map
31
+ export { type Align, type AnyAttribute, type AnyBuiltin, type AnyData, type AnyLooseData, type AnyVecInstance, type AnyWgslData, type AnyWgslStruct, type Atomic, type BaseData, type BaseData as BaseWgslData, type Bool, type Builtin, type BuiltinClipDistances, type BuiltinFragDepth, type BuiltinFrontFacing, type BuiltinGlobalInvocationId, type BuiltinInstanceIndex, type BuiltinLocalInvocationId, type BuiltinLocalInvocationIndex, type BuiltinNumWorkgroups, type BuiltinPosition, type BuiltinSampleIndex, type BuiltinSampleMask, type BuiltinVertexIndex, type BuiltinWorkgroupId, type Decorated, type Disarray, type F16, type F32, FormatToAcceptedData, FormatToWGSLType, type HasCustomLocation, type I32, type Infer, type InferGPU, type InferPartial, type Interpolate, type IsBuiltin, type Location, type LooseDecorated, type Mat2x2f, type Mat3x3f, type Mat4x4f, PackedData, type Ptr, type Size, type StorableData, TgpuVertexFormatData, type U16, type U32, type Unstruct, type Vec2b, type Vec2f, type Vec2h, type Vec2i, type Vec2u, type Vec3b, type Vec3f, type Vec3h, type Vec3i, type Vec3u, type Vec4b, type Vec4f, type Vec4h, type Vec4i, type Vec4u, Void, type WgslArray, type WgslComparisonSampler, type WgslExternalTexture, type WgslSampler, type WgslStorageTexture, type WgslStorageTexture1d, type WgslStorageTexture2d, type WgslStorageTexture2dArray, type WgslStorageTexture3d, type WgslStorageTextureProps, type WgslStruct, type WgslTexture, type WgslTexture1d, type WgslTexture2d, type WgslTexture2dArray, type WgslTexture3d, type WgslTextureCube, type WgslTextureCubeArray, type WgslTextureDepth2d, type WgslTextureDepth2dArray, type WgslTextureDepthCube, type WgslTextureDepthCubeArray, type WgslTextureDepthMultisampled2d, type WgslTextureMultisampled2d, align, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, type atomicI32, type atomicU32, bool, builtin, comparisonSampler, deepEqual, disarrayOf, f16, f32, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, PUBLIC_getLongestContiguousPrefix as getLongestContiguousPrefix, i32, index_d_exports, interpolate, invariant, isAlignAttrib, isAtomic, isBuiltin, isBuiltinAttrib, PUBLIC_isContiguous as isContiguous, isData, isDecorated, isDisarray, isInterpolateAttrib, isLocationAttrib, isLooseData, isLooseDecorated, isPackedData, isPtr, isSizeAttrib, isUnstruct, isWgslArray, isWgslData, isWgslStruct, location, type m2x2f, type m3x3f, type m4x4f, mat2x2f, mat3x3f, mat4x4f, type matBase, matToArray, memoryLayoutOf, packedFormats, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, _ref as ref, sampler, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, size, PUBLIC_sizeOf as sizeOf, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, struct, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d, u16, u32, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra, unstruct, type v2b, type v2f, type v2i, type v2u, type v3b, type v3f, type v3i, type v3u, type v4b, type v4f, type v4i, type v4u, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u, type vecBase };
package/data/index.js CHANGED
@@ -1,8 +1,29 @@
1
- import { t as __exportAll } from "../chunk-BYypO7fO.js";
2
- import { $ as VecBase, An as isAlignAttrib, B as vec2h, Cn as isDisarray, Dt as ptrStorage, En as isUnstruct, Et as ptrPrivate, Fn as isInterpolateAttrib, G as vec3h, H as vec2u, Hn as isSizeAttrib, In as isLocationAttrib, J as vec4b, Jn as isWgslData, K as vec3i, Mn as isBuiltinAttrib, Nn as isDecorated, Ot as ptrUniform, P as struct, Q as vec4u, R as vec2b, Sn as isData, Tn as isLooseDecorated, Tt as ptrHandle, U as vec3b, V as vec2i, Vn as isPtr, W as vec3f, X as vec4h, Y as vec4f, Yn as isWgslStruct, Z as vec4i, _ as mat4x4f, at as i32, d as MatBase, g as mat3x3f, h as mat2x2f, it as f32, jn as isAtomic, kn as Void, kt as ptrWorkgroup, nt as bool, ot as u16, q as vec3u, qn as isWgslArray, rt as f16, st as u32, v as matToArray, wn as isLooseData, wt as ptrFn, yt as _ref, z as vec2f } from "../operators-HTxa_0k9.js";
3
- import { $ as uint32x4, A as packedFormats, B as sint8x4, C as float16x4, D as float32x4, E as float32x3, F as sint32x2, G as snorm8x2, H as snorm16x2, I as sint32x3, J as uint16x2, K as snorm8x4, L as sint32x4, M as sint16x2, N as sint16x4, O as formatToWGSLType, P as sint32, Q as uint32x3, R as sint8, S as float16x2, T as float32x2, U as snorm16x4, V as snorm16, W as snorm8, X as uint32, Y as uint16x4, Z as uint32x2, at as unorm16x2, ct as unorm8x2, d as isBuiltin, et as uint8, f as location, i as infixOperators, it as unorm16, j as sint16, k as isPackedData, l as interpolate, lt as unorm8x4, m as PUBLIC_sizeOf, n as arrayOf, nt as uint8x4, ot as unorm16x4, p as size, q as uint16, rt as unorm10_10_10_2, s as align, st as unorm8, t as builtin, tt as uint8x2, u as invariant, ut as unorm8x4_bgra, v as PUBLIC_alignmentOf, w as float32, x as float16, z as sint8x2 } from "../builtin-ClEnM-Ye.js";
4
- import { a as PUBLIC_getLongestContiguousPrefix, i as memoryLayoutOf, n as unstruct, o as PUBLIC_isContiguous, p as sampler, r as disarrayOf, s as atomic, t as deepEqual, u as comparisonSampler } from "../deepEqual-yZXvaV2C.js";
5
- import { _ as textureMultisampled2d, a as texture2d, b as textureStorage2dArray, c as textureCube, d as textureDepth2dArray, f as textureDepthCube, g as textureExternal, i as texture1d, l as textureCubeArray, m as textureDepthMultisampled2d, o as texture2dArray, p as textureDepthCubeArray, s as texture3d, u as textureDepth2d, v as textureStorage1d, x as textureStorage3d, y as textureStorage2d } from "../texture-Dg5ybJro.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { Void, isAlignAttrib, isAtomic, isBuiltinAttrib, isDecorated, isInterpolateAttrib, isLocationAttrib, isPtr, isSizeAttrib, isWgslArray, isWgslData, isWgslStruct } from "./wgslTypes.js";
3
+ import { isData, isDisarray, isLooseData, isLooseDecorated, isUnstruct } from "./dataTypes.js";
4
+ import { ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup } from "./ptr.js";
5
+ import { _ref } from "./ref.js";
6
+ import { bool, f16, f32, i32, u16, u32 } from "./numeric.js";
7
+ import { VecBase } from "./vectorImpl.js";
8
+ import { vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u } from "./vector.js";
9
+ import { float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, isPackedData, packedFormats, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra } from "./vertexFormatData.js";
10
+ import { PUBLIC_alignmentOf } from "./alignmentOf.js";
11
+ import { PUBLIC_sizeOf } from "./sizeOf.js";
12
+ import { align, interpolate, invariant, isBuiltin, location, size } from "./attributes.js";
13
+ import { struct } from "./struct.js";
14
+ import { MatBase, mat2x2f, mat3x3f, mat4x4f, matToArray } from "./matrix.js";
15
+ import { infixOperators } from "../tgsl/accessProp.js";
16
+ import { comparisonSampler, sampler } from "./sampler.js";
17
+ import { texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d } from "./texture.js";
18
+ import { arrayOf } from "./array.js";
19
+ import { atomic } from "./atomic.js";
20
+ import { builtin } from "../builtin.js";
21
+ import { PUBLIC_isContiguous } from "./isContiguous.js";
22
+ import { PUBLIC_getLongestContiguousPrefix } from "./getLongestContiguousPrefix.js";
23
+ import { memoryLayoutOf } from "./offsetUtils.js";
24
+ import { disarrayOf } from "./disarray.js";
25
+ import { unstruct } from "./unstruct.js";
26
+ import { deepEqual } from "./deepEqual.js";
6
27
  import { Operator } from "tsover-runtime";
7
28
 
8
29
  //#region src/data/index.ts
@@ -161,5 +182,4 @@ assignInfixOperator(MatBase, "sub", Operator.minus);
161
182
  assignInfixOperator(MatBase, "mul", Operator.star);
162
183
 
163
184
  //#endregion
164
- export { Void, align, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, bool, builtin, comparisonSampler, deepEqual, disarrayOf, f16, f32, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, PUBLIC_getLongestContiguousPrefix as getLongestContiguousPrefix, i32, interpolate, invariant, isAlignAttrib, isAtomic, isBuiltin, isBuiltinAttrib, PUBLIC_isContiguous as isContiguous, isData, isDecorated, isDisarray, isInterpolateAttrib, isLocationAttrib, isLooseData, isLooseDecorated, isPackedData, isPtr, isSizeAttrib, isUnstruct, isWgslArray, isWgslData, isWgslStruct, location, mat2x2f, mat3x3f, mat4x4f, matToArray, memoryLayoutOf, packedFormats, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, _ref as ref, sampler, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, size, PUBLIC_sizeOf as sizeOf, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, struct, data_exports as t, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d, u16, u32, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra, unstruct, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u };
165
- //# sourceMappingURL=index.js.map
185
+ export { Void, align, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, bool, builtin, comparisonSampler, data_exports, deepEqual, disarrayOf, f16, f32, float16, float16x2, float16x4, float32, float32x2, float32x3, float32x4, formatToWGSLType, PUBLIC_getLongestContiguousPrefix as getLongestContiguousPrefix, i32, interpolate, invariant, isAlignAttrib, isAtomic, isBuiltin, isBuiltinAttrib, PUBLIC_isContiguous as isContiguous, isData, isDecorated, isDisarray, isInterpolateAttrib, isLocationAttrib, isLooseData, isLooseDecorated, isPackedData, isPtr, isSizeAttrib, isUnstruct, isWgslArray, isWgslData, isWgslStruct, location, mat2x2f, mat3x3f, mat4x4f, matToArray, memoryLayoutOf, packedFormats, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, _ref as ref, sampler, sint16, sint16x2, sint16x4, sint32, sint32x2, sint32x3, sint32x4, sint8, sint8x2, sint8x4, size, PUBLIC_sizeOf as sizeOf, snorm16, snorm16x2, snorm16x4, snorm8, snorm8x2, snorm8x4, struct, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d, u16, u32, uint16, uint16x2, uint16x4, uint32, uint32x2, uint32x3, uint32x4, uint8, uint8x2, uint8x4, unorm10_10_10_2, unorm16, unorm16x2, unorm16x4, unorm8, unorm8x2, unorm8x4, unorm8x4_bgra, unstruct, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u };
@@ -0,0 +1,33 @@
1
+ import { $internal } from "../shared/symbols.js";
2
+ import { Bool, F16, F32, I32, Mat2x2f, Mat3x3f, Mat4x4f, U16, U32, Vec2b, Vec2f, Vec2h, Vec2i, Vec2u, Vec3b, Vec3f, Vec3h, Vec3i, Vec3u, Vec4b, Vec4f, Vec4h, Vec4i, Vec4u, Void } from "./wgslTypes.js";
3
+
4
+ //#region src/data/instanceToSchema.d.ts
5
+ type KindToSchemaMap = {
6
+ vec2f: Vec2f;
7
+ vec3f: Vec3f;
8
+ vec4f: Vec4f;
9
+ vec2h: Vec2h;
10
+ vec3h: Vec3h;
11
+ vec4h: Vec4h;
12
+ vec2i: Vec2i;
13
+ vec3i: Vec3i;
14
+ vec4i: Vec4i;
15
+ vec2u: Vec2u;
16
+ vec3u: Vec3u;
17
+ vec4u: Vec4u;
18
+ 'vec2<bool>': Vec2b;
19
+ 'vec3<bool>': Vec3b;
20
+ 'vec4<bool>': Vec4b;
21
+ mat2x2f: Mat2x2f;
22
+ mat3x3f: Mat3x3f;
23
+ mat4x4f: Mat4x4f;
24
+ };
25
+ /**
26
+ * Inverse operation to d.Infer<T>
27
+ */
28
+ type InstanceToSchema<T> = T extends number ? U32 | U16 | I32 | F32 | F16 : T extends boolean ? Bool : T extends undefined ? Void : T extends {
29
+ readonly [$internal]: unknown;
30
+ readonly kind: infer TKind extends keyof KindToSchemaMap;
31
+ } ? KindToSchemaMap[TKind] : T;
32
+ //#endregion
33
+ export { InstanceToSchema };
@@ -0,0 +1,10 @@
1
+ import "./wgslTypes.js";
2
+ import { AnyData } from "./dataTypes.js";
3
+
4
+ //#region src/data/isContiguous.d.ts
5
+ /**
6
+ * Returns `true` if data represented by the `schema` doesn't have padding.
7
+ */
8
+ declare function PUBLIC_isContiguous(schema: AnyData): boolean;
9
+ //#endregion
10
+ export { PUBLIC_isContiguous };
@@ -0,0 +1,15 @@
1
+ import { getLayoutInfo } from "./schemaMemoryLayout.js";
2
+
3
+ //#region src/data/isContiguous.ts
4
+ function isContiguous(schema) {
5
+ return getLayoutInfo(schema, "isContiguous");
6
+ }
7
+ /**
8
+ * Returns `true` if data represented by the `schema` doesn't have padding.
9
+ */
10
+ function PUBLIC_isContiguous(schema) {
11
+ return isContiguous(schema);
12
+ }
13
+
14
+ //#endregion
15
+ export { PUBLIC_isContiguous, isContiguous };
@@ -0,0 +1,126 @@
1
+ import { DualFn } from "../types.js";
2
+ import { Mat2x2f, Mat3x3f, Mat4x4f, m2x2f, m3x3f, m4x4f, v3f } from "./wgslTypes.js";
3
+ import { TgpuComptime } from "../core/function/comptime.js";
4
+ import "../indexNamedExports.js";
5
+
6
+ //#region src/data/matrix.d.ts
7
+ /**
8
+ * Returns a 2-by-2 identity matrix.
9
+ * @returns {m2x2f} The result matrix.
10
+ */
11
+ declare const identity2: TgpuComptime<() => m2x2f>;
12
+ /**
13
+ * Returns a 3-by-3 identity matrix.
14
+ * @returns {m3x3f} The result matrix.
15
+ */
16
+ declare const identity3: TgpuComptime<() => m3x3f>;
17
+ /**
18
+ * Returns a 4-by-4 identity matrix.
19
+ * @returns {m4x4f} The result matrix.
20
+ */
21
+ declare const identity4: TgpuComptime<() => m4x4f>;
22
+ /**
23
+ * Creates a 4-by-4 matrix which translates by the given vector v.
24
+ * @param {v3f} vector - The vector by which to translate.
25
+ * @returns {m4x4f} The translation matrix.
26
+ */
27
+ declare const translation4: DualFn<(vector: v3f) => m4x4f>;
28
+ /**
29
+ * Creates a 4-by-4 matrix which scales in each dimension by an amount given by the corresponding entry in the given vector.
30
+ * @param {v3f} vector - A vector of three entries specifying the factor by which to scale in each dimension.
31
+ * @returns {m4x4f} The scaling matrix.
32
+ */
33
+ declare const scaling4: DualFn<(vector: v3f) => m4x4f>;
34
+ /**
35
+ * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.
36
+ * @param {number} angle - The angle by which to rotate (in radians).
37
+ * @returns {m4x4f} The rotation matrix.
38
+ */
39
+ declare const rotationX4: DualFn<(a: number) => m4x4f>;
40
+ /**
41
+ * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.
42
+ * @param {number} angle - The angle by which to rotate (in radians).
43
+ * @returns {m4x4f} The rotation matrix.
44
+ */
45
+ declare const rotationY4: DualFn<(a: number) => m4x4f>;
46
+ /**
47
+ * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.
48
+ * @param {number} angle - The angle by which to rotate (in radians).
49
+ * @returns {m4x4f} The rotation matrix.
50
+ */
51
+ declare const rotationZ4: DualFn<(a: number) => m4x4f>;
52
+ /**
53
+ * Schema representing mat2x2f - a matrix with 2 rows and 2 columns, with elements of type f32.
54
+ * Also a constructor function for this matrix type.
55
+ *
56
+ * @example
57
+ * const zero2x2 = mat2x2f(); // filled with zeros
58
+ *
59
+ * @example
60
+ * const mat = mat2x2f(0, 1, 2, 3);
61
+ * mat.columns[0] // vec2f(0, 1)
62
+ * mat.columns[1] // vec2f(2, 3)
63
+ *
64
+ * @example
65
+ * const mat = mat2x2f(
66
+ * vec2f(0, 1), // column 0
67
+ * vec2f(1, 2), // column 1
68
+ * );
69
+ *
70
+ * @example
71
+ * const buffer = root.createBuffer(d.mat2x2f, d.mat2x2f(0, 1, 2, 3)); // buffer holding a d.mat2x2f value, with an initial value of ((0, 1), (2, 3))
72
+ */
73
+ declare const mat2x2f: Mat2x2f;
74
+ /**
75
+ * Schema representing mat3x3f - a matrix with 3 rows and 3 columns, with elements of type f32.
76
+ * Also a constructor function for this matrix type.
77
+ *
78
+ * @example
79
+ * const zero3x3 = mat3x3f(); // filled with zeros
80
+ *
81
+ * @example
82
+ * const mat = mat3x3f(0, 1, 2, 3, 4, 5, 6, 7, 8);
83
+ * mat.columns[0] // vec3f(0, 1, 2)
84
+ * mat.columns[1] // vec3f(3, 4, 5)
85
+ * mat.columns[2] // vec3f(6, 7, 8)
86
+ *
87
+ * @example
88
+ * const mat = mat3x3f(
89
+ * vec3f(0, 1, 2), // column 0
90
+ * vec3f(2, 3, 4), // column 1
91
+ * vec3f(5, 6, 7), // column 2
92
+ * );
93
+ *
94
+ * @example
95
+ * const buffer = root.createBuffer(d.mat3x3f, d.mat3x3f()); // buffer holding a d.mat3x3f value, with an initial value of mat3x3f filled with zeros
96
+ */
97
+ declare const mat3x3f: Mat3x3f;
98
+ /**
99
+ * Schema representing mat4x4f - a matrix with 4 rows and 4 columns, with elements of type f32.
100
+ * Also a constructor function for this matrix type.
101
+ *
102
+ * @example
103
+ * const zero4x4 = mat4x4f(); // filled with zeros
104
+ *
105
+ * @example
106
+ * const mat = mat4x4f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
107
+ * mat.columns[0] // vec4f(0, 1, 2, 3)
108
+ * mat.columns[1] // vec4f(4, 5, 6, 7)
109
+ * mat.columns[2] // vec4f(8, 9, 10, 11)
110
+ * mat.columns[3] // vec4f(12, 13, 14, 15)
111
+ *
112
+ * @example
113
+ * const mat = mat4x4f(
114
+ * vec4f(0, 1, 2, 3), // column 0
115
+ * vec4f(4, 5, 6, 7), // column 1
116
+ * vec4f(8, 9, 10, 11), // column 2
117
+ * vec4f(12, 13, 14, 15), // column 3
118
+ * );
119
+ *
120
+ * @example
121
+ * const buffer = root.createBuffer(d.mat4x4f, d.mat4x4f()); // buffer holding a d.mat4x4f value, with an initial value of mat4x4f filled with zeros
122
+ */
123
+ declare const mat4x4f: Mat4x4f;
124
+ declare function matToArray(mat: m2x2f | m3x3f | m4x4f): number[];
125
+ //#endregion
126
+ export { identity2, identity3, identity4, mat2x2f, mat3x3f, mat4x4f, matToArray, rotationX4, rotationY4, rotationZ4, scaling4, translation4 };