typegpu 0.11.1 → 0.11.3

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 (216) hide show
  1. package/_virtual/{_rolldown/runtime.js → rolldown_runtime.js} +4 -4
  2. package/builtin.js +3 -1
  3. package/common/fullScreenTriangle.d.ts +6 -1
  4. package/common/fullScreenTriangle.js +3 -1
  5. package/common/index.js +5 -3
  6. package/common/writeSoA.js +3 -1
  7. package/core/buffer/buffer.d.ts +3 -0
  8. package/core/buffer/buffer.js +5 -3
  9. package/core/buffer/bufferShorthand.d.ts +2 -0
  10. package/core/buffer/bufferShorthand.js +3 -1
  11. package/core/buffer/bufferUsage.d.ts +2 -0
  12. package/core/buffer/bufferUsage.js +3 -1
  13. package/core/constant/tgpuConstant.d.ts +2 -1
  14. package/core/constant/tgpuConstant.js +3 -1
  15. package/core/declare/tgpuDeclare.js +3 -1
  16. package/core/function/autoIO.d.ts +3 -0
  17. package/core/function/autoIO.js +5 -3
  18. package/core/function/comptime.js +3 -1
  19. package/core/function/createCallableSchema.js +3 -1
  20. package/core/function/dualImpl.js +3 -1
  21. package/core/function/entryInputRouter.js +13 -17
  22. package/core/function/extractArgs.js +2 -1
  23. package/core/function/fnCore.js +17 -11
  24. package/core/function/fnTypes.d.ts +2 -0
  25. package/core/function/ioSchema.d.ts +1 -0
  26. package/core/function/ioSchema.js +3 -1
  27. package/core/function/shelllessImpl.d.ts +1 -0
  28. package/core/function/shelllessImpl.js +4 -2
  29. package/core/function/templateUtils.js +2 -1
  30. package/core/function/tgpuComputeFn.d.ts +1 -0
  31. package/core/function/tgpuComputeFn.js +4 -2
  32. package/core/function/tgpuFn.d.ts +1 -0
  33. package/core/function/tgpuFn.js +17 -15
  34. package/core/function/tgpuFragmentFn.js +4 -2
  35. package/core/function/tgpuVertexFn.js +4 -2
  36. package/core/pipeline/applyPipelineState.js +3 -1
  37. package/core/pipeline/computePipeline.d.ts +4 -0
  38. package/core/pipeline/computePipeline.js +8 -6
  39. package/core/pipeline/connectAttachmentToShader.js +3 -1
  40. package/core/pipeline/connectTargetsToShader.js +3 -1
  41. package/core/pipeline/limitsOverflow.js +2 -1
  42. package/core/pipeline/pipelineUtils.js +6 -4
  43. package/core/pipeline/renderPipeline.js +21 -19
  44. package/core/pipeline/timeable.d.ts +2 -0
  45. package/core/pipeline/timeable.js +3 -1
  46. package/core/pipeline/typeGuards.js +3 -1
  47. package/core/querySet/querySet.d.ts +2 -0
  48. package/core/querySet/querySet.js +3 -1
  49. package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +1 -0
  50. package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +3 -1
  51. package/core/resolve/externals.d.ts +3 -0
  52. package/core/resolve/externals.js +7 -5
  53. package/core/resolve/namespace.js +6 -4
  54. package/core/resolve/resolveData.js +3 -1
  55. package/core/resolve/stitch.js +3 -1
  56. package/core/resolve/tgpuResolve.js +7 -5
  57. package/core/root/configurableImpl.js +3 -1
  58. package/core/root/init.d.ts +10 -2
  59. package/core/root/init.js +4 -2
  60. package/core/root/rootTypes.d.ts +11 -11
  61. package/core/sampler/sampler.d.ts +4 -0
  62. package/core/sampler/sampler.js +3 -1
  63. package/core/simulate/tgpuSimulate.js +6 -4
  64. package/core/slot/accessor.d.ts +4 -0
  65. package/core/slot/accessor.js +3 -1
  66. package/core/slot/internalSlots.js +3 -1
  67. package/core/slot/lazy.js +3 -1
  68. package/core/slot/slot.js +3 -1
  69. package/core/slot/slotTypes.js +3 -1
  70. package/core/texture/externalTexture.d.ts +6 -0
  71. package/core/texture/externalTexture.js +3 -1
  72. package/core/texture/texture.d.ts +4 -0
  73. package/core/texture/texture.js +6 -4
  74. package/core/texture/textureFormats.js +3 -1
  75. package/core/texture/textureUtils.js +3 -1
  76. package/core/texture/usageExtension.js +3 -1
  77. package/core/unroll/tgpuUnroll.d.ts +3 -1
  78. package/core/unroll/tgpuUnroll.js +3 -1
  79. package/core/valueProxyUtils.js +7 -5
  80. package/core/variable/tgpuVariable.d.ts +3 -1
  81. package/core/variable/tgpuVariable.js +3 -1
  82. package/core/vertexLayout/connectAttributesToShader.js +3 -1
  83. package/core/vertexLayout/vertexAttribute.d.ts +1 -0
  84. package/core/vertexLayout/vertexLayout.js +7 -5
  85. package/data/alignIO.js +3 -1
  86. package/data/alignmentOf.d.ts +2 -0
  87. package/data/alignmentOf.js +3 -1
  88. package/data/array.js +3 -1
  89. package/data/atomic.d.ts +1 -0
  90. package/data/atomic.js +3 -1
  91. package/data/attributes.js +7 -5
  92. package/data/autoStruct.d.ts +3 -1
  93. package/data/autoStruct.js +3 -1
  94. package/data/compiledIO.js +39 -37
  95. package/data/dataIO.js +22 -20
  96. package/data/dataTypes.d.ts +9 -4
  97. package/data/dataTypes.js +3 -1
  98. package/data/deepEqual.d.ts +1 -0
  99. package/data/deepEqual.js +3 -1
  100. package/data/disarray.d.ts +3 -1
  101. package/data/disarray.js +3 -1
  102. package/data/getLongestContiguousPrefix.d.ts +2 -0
  103. package/data/getLongestContiguousPrefix.js +3 -1
  104. package/data/index.d.ts +3 -3
  105. package/data/index.js +5 -6
  106. package/data/isContiguous.d.ts +2 -0
  107. package/data/isContiguous.js +3 -1
  108. package/data/matrix.d.ts +11 -8
  109. package/data/matrix.js +3 -1
  110. package/data/numberOps.js +2 -1
  111. package/data/numeric.d.ts +1 -0
  112. package/data/numeric.js +19 -15
  113. package/data/offsetUtils.d.ts +1 -0
  114. package/data/offsetUtils.js +3 -1
  115. package/data/offsets.js +5 -3
  116. package/data/partialIO.js +3 -1
  117. package/data/ptr.d.ts +1 -0
  118. package/data/ptr.js +3 -1
  119. package/data/ref.d.ts +3 -0
  120. package/data/ref.js +5 -3
  121. package/data/sampler.js +3 -1
  122. package/data/schemaCallWrapper.js +3 -1
  123. package/data/schemaMemoryLayout.js +3 -1
  124. package/data/sizeOf.d.ts +2 -0
  125. package/data/sizeOf.js +3 -1
  126. package/data/snippet.d.ts +1 -6
  127. package/data/snippet.js +3 -1
  128. package/data/struct.d.ts +1 -0
  129. package/data/struct.js +3 -1
  130. package/data/texture.js +3 -1
  131. package/data/unstruct.d.ts +1 -0
  132. package/data/unstruct.js +3 -1
  133. package/data/vector.d.ts +1 -0
  134. package/data/vector.js +3 -1
  135. package/data/vectorImpl.js +3 -1
  136. package/data/vectorOps.js +3 -1
  137. package/data/vertexFormatData.js +3 -1
  138. package/data/wgslTypes.d.ts +4 -0
  139. package/data/wgslTypes.js +3 -1
  140. package/errors.d.ts +1 -0
  141. package/errors.js +3 -1
  142. package/execMode.js +3 -1
  143. package/extension.d.ts +1 -0
  144. package/extension.js +3 -1
  145. package/getGPUValue.js +3 -1
  146. package/index.js +3 -4
  147. package/indexNamedExports.d.ts +1 -0
  148. package/mathUtils.js +2 -1
  149. package/memo.js +2 -1
  150. package/nameRegistry.js +3 -1
  151. package/package.js +3 -2
  152. package/package.json +1 -1
  153. package/resolutionCtx.d.ts +11 -0
  154. package/resolutionCtx.js +86 -87
  155. package/shared/env.js +2 -1
  156. package/shared/generators.js +2 -1
  157. package/shared/meta.js +3 -1
  158. package/shared/repr.d.ts +1 -0
  159. package/shared/stringify.js +3 -1
  160. package/shared/symbols.js +42 -10
  161. package/shared/utilityTypes.js +2 -1
  162. package/shared/vertexFormat.js +2 -1
  163. package/std/array.d.ts +1 -1
  164. package/std/array.js +3 -1
  165. package/std/atomic.d.ts +12 -12
  166. package/std/atomic.js +3 -1
  167. package/std/bitcast.d.ts +2 -2
  168. package/std/bitcast.js +3 -1
  169. package/std/boolean.d.ts +15 -14
  170. package/std/boolean.js +3 -1
  171. package/std/derivative.d.ts +9 -9
  172. package/std/derivative.js +3 -1
  173. package/std/discard.d.ts +1 -1
  174. package/std/discard.js +3 -1
  175. package/std/extensions.d.ts +3 -1
  176. package/std/extensions.js +3 -1
  177. package/std/index.js +5 -3
  178. package/std/matrix.d.ts +6 -5
  179. package/std/matrix.js +3 -1
  180. package/std/numeric.d.ts +132 -78
  181. package/std/numeric.js +7 -5
  182. package/std/operators.d.ts +8 -8
  183. package/std/operators.js +7 -5
  184. package/std/packing.d.ts +5 -4
  185. package/std/packing.js +3 -1
  186. package/std/range.d.ts +3 -1
  187. package/std/range.js +3 -1
  188. package/std/subgroup.d.ts +21 -21
  189. package/std/subgroup.js +3 -1
  190. package/std/texture.d.ts +11 -11
  191. package/std/texture.js +9 -7
  192. package/tgpu.js +5 -3
  193. package/tgpuBindGroupLayout.d.ts +11 -7
  194. package/tgpuBindGroupLayout.js +3 -1
  195. package/tgpuUnstable.js +5 -3
  196. package/tgsl/accessIndex.js +5 -3
  197. package/tgsl/accessProp.js +10 -3
  198. package/tgsl/consoleLog/deserializers.js +3 -1
  199. package/tgsl/consoleLog/logGenerator.js +18 -9
  200. package/tgsl/consoleLog/serializers.js +3 -1
  201. package/tgsl/consoleLog/types.d.ts +3 -0
  202. package/tgsl/consoleLog/types.js +2 -1
  203. package/tgsl/conversion.js +18 -6
  204. package/tgsl/forOfUtils.js +17 -7
  205. package/tgsl/generationHelpers.d.ts +1 -0
  206. package/tgsl/generationHelpers.js +3 -4
  207. package/tgsl/math.js +3 -1
  208. package/tgsl/shaderGenerator.d.ts +3 -2
  209. package/tgsl/shaderGenerator_members.d.ts +15 -2
  210. package/tgsl/shaderGenerator_members.js +5 -3
  211. package/tgsl/shellless.js +3 -1
  212. package/tgsl/wgslGenerator.d.ts +3 -1
  213. package/tgsl/wgslGenerator.js +54 -44
  214. package/types.d.ts +11 -7
  215. package/types.js +3 -1
  216. package/wgslExtensions.js +2 -1
package/data/matrix.js CHANGED
@@ -7,6 +7,7 @@ import { numericLiteralToSnippet } from "../tgsl/generationHelpers.js";
7
7
  import { vec2f, vec3f, vec4f } from "./vector.js";
8
8
  import { dualImpl } from "../core/function/dualImpl.js";
9
9
  import { comptime } from "../core/function/comptime.js";
10
+
10
11
  //#region src/data/matrix.ts
11
12
  var MatBase = class {};
12
13
  function createMatSchema(options) {
@@ -527,5 +528,6 @@ function matToArray(mat) {
527
528
  ];
528
529
  return Array.from({ length: mat.length }).map((_, idx) => mat[idx]);
529
530
  }
531
+
530
532
  //#endregion
531
- export { MatBase, identity2, identity3, identity4, mat2x2f, mat3x3f, mat4x4f, matToArray, rotationX4, rotationY4, rotationZ4, scaling4, translation4 };
533
+ export { MatBase, identity2, identity3, identity4, mat2x2f, mat3x3f, mat4x4f, matToArray, rotationX4, rotationY4, rotationZ4, scaling4, translation4 };
package/data/numberOps.js CHANGED
@@ -19,5 +19,6 @@ function bitcastU32toI32Impl(n) {
19
19
  dataView.setUint32(0, n, true);
20
20
  return dataView.getInt32(0, true);
21
21
  }
22
+
22
23
  //#endregion
23
- export { bitcastU32toF32Impl, bitcastU32toI32Impl, clamp, divInteger, smoothstepScalar };
24
+ export { bitcastU32toF32Impl, bitcastU32toI32Impl, clamp, divInteger, smoothstepScalar };
package/data/numeric.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Bool, F16, F32, I32, U16, U32 } from "./wgslTypes.js";
2
2
 
3
3
  //#region src/data/numeric.d.ts
4
+
4
5
  /**
5
6
  * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
6
7
  *
package/data/numeric.js CHANGED
@@ -1,20 +1,7 @@
1
1
  import { $internal } from "../shared/symbols.js";
2
2
  import { callableSchema } from "../core/function/createCallableSchema.js";
3
+
3
4
  //#region src/data/numeric.ts
4
- const abstractInt = {
5
- [$internal]: {},
6
- type: "abstractInt",
7
- toString() {
8
- return "abstractInt";
9
- }
10
- };
11
- const abstractFloat = {
12
- [$internal]: {},
13
- type: "abstractFloat",
14
- toString() {
15
- return "abstractFloat";
16
- }
17
- };
18
5
  const boolCast = callableSchema({
19
6
  name: "bool",
20
7
  schema: () => bool,
@@ -217,5 +204,22 @@ const f16 = Object.assign(f16Cast, {
217
204
  [$internal]: {},
218
205
  type: "f16"
219
206
  });
207
+ const abstractInt = {
208
+ [$internal]: {},
209
+ type: "abstractInt",
210
+ toString() {
211
+ return "abstractInt";
212
+ },
213
+ concretized: i32
214
+ };
215
+ const abstractFloat = {
216
+ [$internal]: {},
217
+ type: "abstractFloat",
218
+ toString() {
219
+ return "abstractFloat";
220
+ },
221
+ concretized: f32
222
+ };
223
+
220
224
  //#endregion
221
- export { abstractFloat, abstractInt, bool, f16, f32, i32, u16, u32 };
225
+ export { abstractFloat, abstractInt, bool, f16, f32, i32, u16, u32 };
@@ -2,6 +2,7 @@ import { BaseData } from "./wgslTypes.js";
2
2
  import { Infer } from "../shared/repr.js";
3
3
 
4
4
  //#region src/data/offsetUtils.d.ts
5
+
5
6
  /**
6
7
  * Interface containing information about the offset and the available contiguous after a selected primitive.
7
8
  */
@@ -6,6 +6,7 @@ import { sizeOf } from "./sizeOf.js";
6
6
  import { offsetsForProps } from "./offsets.js";
7
7
  import { isContiguous } from "./isContiguous.js";
8
8
  import { getLongestContiguousPrefix } from "./getLongestContiguousPrefix.js";
9
+
9
10
  //#region src/data/offsetUtils.ts
10
11
  const OFFSET_MARKER = Symbol("indirectOffset");
11
12
  const CONTIGUOUS_MARKER = Symbol("indirectContiguous");
@@ -161,5 +162,6 @@ function memoryLayoutOf(schema, accessor) {
161
162
  };
162
163
  throw new Error("memoryLayoutOf: accessor did not return a schema element. Make sure the accessor navigates to a field or element of the schema (e.g. `(s) => s.position.x`).");
163
164
  }
165
+
164
166
  //#endregion
165
- export { memoryLayoutOf };
167
+ export { memoryLayoutOf };
package/data/offsets.js CHANGED
@@ -2,8 +2,9 @@ import { isUnstruct } from "./dataTypes.js";
2
2
  import { alignmentOf, customAlignmentOf } from "./alignmentOf.js";
3
3
  import { roundUp } from "../mathUtils.js";
4
4
  import { sizeOf } from "./sizeOf.js";
5
- import alignIO from "./alignIO.js";
5
+ import alignIO_default from "./alignIO.js";
6
6
  import { Measurer } from "typed-binary";
7
+
7
8
  //#region src/data/offsets.ts
8
9
  const cachedOffsets = /* @__PURE__ */ new WeakMap();
9
10
  function offsetsForProps(struct) {
@@ -16,7 +17,7 @@ function offsetsForProps(struct) {
16
17
  const prop = struct.propTypes[key];
17
18
  if (prop === void 0) throw new Error(`Property ${key} is undefined in struct`);
18
19
  const beforeAlignment = measurer.size;
19
- alignIO(measurer, isUnstruct(struct) ? customAlignmentOf(prop) : alignmentOf(prop));
20
+ alignIO_default(measurer, isUnstruct(struct) ? customAlignmentOf(prop) : alignmentOf(prop));
20
21
  if (lastEntry) lastEntry.padding = measurer.size - beforeAlignment;
21
22
  const propSize = sizeOf(prop);
22
23
  offsets[key] = {
@@ -30,5 +31,6 @@ function offsetsForProps(struct) {
30
31
  cachedOffsets.set(struct, offsets);
31
32
  return offsets;
32
33
  }
34
+
33
35
  //#endregion
34
- export { offsetsForProps };
36
+ export { offsetsForProps };
package/data/partialIO.js CHANGED
@@ -7,6 +7,7 @@ import { offsetsForProps } from "./offsets.js";
7
7
  import { getCompiledWriter } from "./compiledIO.js";
8
8
  import { writeData } from "./dataIO.js";
9
9
  import { BufferWriter, getSystemEndianness } from "typed-binary";
10
+
10
11
  //#region src/data/partialIO.ts
11
12
  /**
12
13
  * Converts `{idx, value}[]` sparse arrays into `Record<number, T>` format.
@@ -109,5 +110,6 @@ function getPatchInstructions(schema, data, targetBuffer) {
109
110
  });
110
111
  return instructions;
111
112
  }
113
+
112
114
  //#endregion
113
- export { convertPartialToPatch, getPatchInstructions };
115
+ export { convertPartialToPatch, getPatchInstructions };
package/data/ptr.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "./snippet.js";
1
2
  import { Ptr, StorableData } from "./wgslTypes.js";
2
3
 
3
4
  //#region src/data/ptr.d.ts
package/data/ptr.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { $internal } from "../shared/symbols.js";
2
2
  import { originToPtrParams } from "./snippet.js";
3
+
3
4
  //#region src/data/ptr.ts
4
5
  function ptrFn(inner) {
5
6
  return INTERNAL_createPtr("function", inner, "read-write");
@@ -40,5 +41,6 @@ function implicitFrom(ptr) {
40
41
  function explicitFrom(ptr) {
41
42
  return INTERNAL_createPtr(ptr.addressSpace, ptr.inner, ptr.access, false);
42
43
  }
44
+
43
45
  //#endregion
44
- export { createPtrFromOrigin, explicitFrom, implicitFrom, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup };
46
+ export { createPtrFromOrigin, explicitFrom, implicitFrom, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup };
package/data/ref.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { $internal } from "../shared/symbols.js";
2
+ import "./snippet.js";
2
3
  import { DualFn } from "../types.js";
4
+ import "./wgslTypes.js";
5
+
3
6
  //#region src/data/ref.d.ts
4
7
  interface ref<T> {
5
8
  readonly [$internal]: {
package/data/ref.js CHANGED
@@ -6,6 +6,7 @@ import { snip } from "./snippet.js";
6
6
  import { WgslTypeError } from "../errors.js";
7
7
  import { stitch } from "../core/resolve/stitch.js";
8
8
  import { createPtrFromOrigin, explicitFrom } from "./ptr.js";
9
+
9
10
  //#region src/data/ref.ts
10
11
  const _ref = (() => {
11
12
  const impl = ((value) => INTERNAL_createRef(value));
@@ -45,8 +46,8 @@ function INTERNAL_createRef(value) {
45
46
  };
46
47
  if (value === void 0 || value === null) throw new Error("Cannot create a ref from undefined or null");
47
48
  if (typeof value === "object") return new Proxy(target, {
48
- get(target, prop) {
49
- if (prop in target) return target[prop];
49
+ get(target$1, prop) {
50
+ if (prop in target$1) return target$1[prop];
50
51
  return value[prop];
51
52
  },
52
53
  set(_target, prop, propValue) {
@@ -90,5 +91,6 @@ function derefSnippet(snippet) {
90
91
  if (snippet.value instanceof RefOperator) return snip(stitch`${snippet.value.snippet}`, innerType, origin);
91
92
  return snip(stitch`(*${snippet})`, innerType, origin);
92
93
  }
94
+
93
95
  //#endregion
94
- export { RefOperator, _ref, derefSnippet, isRef };
96
+ export { RefOperator, _ref, derefSnippet, isRef };
package/data/sampler.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { $internal, $repr } from "../shared/symbols.js";
2
+
2
3
  //#region src/data/sampler.ts
3
4
  function sampler() {
4
5
  return {
@@ -20,5 +21,6 @@ function isWgslSampler(value) {
20
21
  function isWgslComparisonSampler(value) {
21
22
  return !!value[$internal] && value.type === "sampler_comparison";
22
23
  }
24
+
23
25
  //#endregion
24
- export { comparisonSampler, isWgslComparisonSampler, isWgslSampler, sampler };
26
+ export { comparisonSampler, isWgslComparisonSampler, isWgslSampler, sampler };
@@ -1,5 +1,6 @@
1
1
  import { $cast, $gpuCallable } from "../shared/symbols.js";
2
2
  import { hasCast, isGPUCallable } from "../types.js";
3
+
3
4
  //#region src/data/schemaCallWrapper.ts
4
5
  /**
5
6
  * A wrapper for `schema(item)` or `schema()` call on JS side.
@@ -26,5 +27,6 @@ function schemaCallWrapperGPU(ctx, schema, item) {
26
27
  const callSchema = schema;
27
28
  return item === void 0 || item.value === void 0 ? callSchema[$gpuCallable].call(ctx, []) : callSchema[$gpuCallable].call(ctx, [item]);
28
29
  }
30
+
29
31
  //#endregion
30
- export { schemaCallWrapper, schemaCallWrapperGPU };
32
+ export { schemaCallWrapper, schemaCallWrapperGPU };
@@ -2,6 +2,7 @@ import { isDecorated, isWgslArray, isWgslStruct } from "./wgslTypes.js";
2
2
  import { getCustomSize, isDisarray, isLooseDecorated, isUnstruct, undecorate } from "./dataTypes.js";
3
3
  import { alignmentOf, customAlignmentOf } from "./alignmentOf.js";
4
4
  import { roundUp } from "../mathUtils.js";
5
+
5
6
  //#region src/data/schemaMemoryLayout.ts
6
7
  const knownSizesMap = {
7
8
  bool: 4,
@@ -194,5 +195,6 @@ function getLayoutInfo(schema, key) {
194
195
  }
195
196
  return layout[key];
196
197
  }
198
+
197
199
  //#endregion
198
- export { getLayoutInfo };
200
+ export { getLayoutInfo };
package/data/sizeOf.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import "./wgslTypes.js";
1
2
  import { AnyData } from "./dataTypes.js";
2
3
 
3
4
  //#region src/data/sizeOf.d.ts
5
+
4
6
  /**
5
7
  * Returns the size (in bytes) of data represented by the `schema`.
6
8
  */
package/data/sizeOf.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { getLayoutInfo } from "./schemaMemoryLayout.js";
2
+
2
3
  //#region src/data/sizeOf.ts
3
4
  function sizeOf(schema) {
4
5
  return getLayoutInfo(schema, "size");
@@ -9,5 +10,6 @@ function sizeOf(schema) {
9
10
  function PUBLIC_sizeOf(schema) {
10
11
  return sizeOf(schema);
11
12
  }
13
+
12
14
  //#endregion
13
- export { PUBLIC_sizeOf, sizeOf };
15
+ export { PUBLIC_sizeOf, sizeOf };
package/data/snippet.d.ts CHANGED
@@ -12,14 +12,9 @@ interface Snippet {
12
12
  readonly dataType: BaseData | UnknownData;
13
13
  readonly origin: Origin;
14
14
  }
15
- interface ResolvedSnippet {
15
+ interface ResolvedSnippet extends Snippet {
16
16
  readonly value: string;
17
- /**
18
- * The type that `value` is assignable to (not necessary exactly inferred as).
19
- * E.g. `1.1` is assignable to `f32`, but `1.1` itself is an abstract float
20
- */
21
17
  readonly dataType: BaseData;
22
- readonly origin: Origin;
23
18
  }
24
19
  type MapValueToSnippet<T> = { [K in keyof T]: Snippet };
25
20
  //#endregion
package/data/snippet.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { DEV } from "../shared/env.js";
2
2
  import { isNumericSchema } from "./wgslTypes.js";
3
3
  import { undecorate } from "./dataTypes.js";
4
+
4
5
  //#region src/data/snippet.ts
5
6
  function isEphemeralOrigin(space) {
6
7
  return space === "runtime" || space === "constant" || space === "argument";
@@ -66,5 +67,6 @@ function snip(value, dataType, origin) {
66
67
  if (DEV && isSnippet(value)) throw new Error("Cannot nest snippets");
67
68
  return new SnippetImpl(value, undecorate(dataType), origin);
68
69
  }
70
+
69
71
  //#endregion
70
- export { fallthroughCopyOrigin, isEphemeralOrigin, isEphemeralSnippet, isSnippet, isSnippetNumeric, originToPtrParams, snip };
72
+ export { fallthroughCopyOrigin, isEphemeralOrigin, isEphemeralSnippet, isSnippet, isSnippetNumeric, originToPtrParams, snip };
package/data/struct.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AnyWgslData, WgslStruct } from "./wgslTypes.js";
2
2
 
3
3
  //#region src/data/struct.d.ts
4
+
4
5
  /**
5
6
  * Creates a struct schema that can be used to construct GPU buffers.
6
7
  * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).
package/data/struct.js CHANGED
@@ -2,6 +2,7 @@ import { $internal } from "../shared/symbols.js";
2
2
  import { getName, setName } from "../shared/meta.js";
3
3
  import { schemaCallWrapper } from "./schemaCallWrapper.js";
4
4
  import { isValidProp } from "../nameRegistry.js";
5
+
5
6
  //#region src/data/struct.ts
6
7
  /**
7
8
  * Creates a struct schema that can be used to construct GPU buffers.
@@ -40,5 +41,6 @@ const WgslStructImpl = {
40
41
  return `struct:${getName(this) ?? "<unnamed>"}`;
41
42
  }
42
43
  };
44
+
43
45
  //#endregion
44
- export { INTERNAL_createStruct, abstruct, struct };
46
+ export { INTERNAL_createStruct, abstruct, struct };
package/data/texture.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { $internal, $repr } from "../shared/symbols.js";
2
2
  import { f32 } from "./numeric.js";
3
+
3
4
  //#region src/data/texture.ts
4
5
  function textureDescriptorToSchema(desc) {
5
6
  if ("multisampled" in desc) {
@@ -202,5 +203,6 @@ function isWgslStorageTexture(value) {
202
203
  function isWgslExternalTexture(value) {
203
204
  return !!value[$internal] && value.type === "texture_external";
204
205
  }
206
+
205
207
  //#endregion
206
- export { accessModeMap, isWgslExternalTexture, isWgslStorageTexture, isWgslTexture, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureDescriptorToSchema, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d };
208
+ export { accessModeMap, isWgslExternalTexture, isWgslStorageTexture, isWgslTexture, texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureDescriptorToSchema, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d };
@@ -1,6 +1,7 @@
1
1
  import { AnyData, Unstruct } from "./dataTypes.js";
2
2
 
3
3
  //#region src/data/unstruct.d.ts
4
+
4
5
  /**
5
6
  * Creates a loose struct schema that can be used to construct vertex buffers.
6
7
  * Describes structs with members of both loose and non-loose types.
package/data/unstruct.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { $internal } from "../shared/symbols.js";
2
2
  import { getName, setName } from "../shared/meta.js";
3
3
  import { schemaCallWrapper } from "./schemaCallWrapper.js";
4
+
4
5
  //#region src/data/unstruct.ts
5
6
  /**
6
7
  * Creates a loose struct schema that can be used to construct vertex buffers.
@@ -37,5 +38,6 @@ const UnstructImpl = {
37
38
  return `unstruct:${getName(this) ?? "<unnamed>"}`;
38
39
  }
39
40
  };
41
+
40
42
  //#endregion
41
- export { unstruct };
43
+ export { unstruct };
package/data/vector.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Vec2b, Vec2f, Vec2h, Vec2i, Vec2u, Vec3b, Vec3f, Vec3h, Vec3i, Vec3u, Vec4b, Vec4f, Vec4h, Vec4i, Vec4u } from "./wgslTypes.js";
2
2
 
3
3
  //#region src/data/vector.d.ts
4
+
4
5
  /**
5
6
  * Schema representing vec2f - a vector with 2 elements of type f32.
6
7
  * Also a constructor function for this vector value.
package/data/vector.js CHANGED
@@ -3,6 +3,7 @@ import { isVec } from "./wgslTypes.js";
3
3
  import { callableSchema } from "../core/function/createCallableSchema.js";
4
4
  import { bool, f16, f32, i32, u32 } from "./numeric.js";
5
5
  import { Vec2bImpl, Vec2fImpl, Vec2hImpl, Vec2iImpl, Vec2uImpl, Vec3bImpl, Vec3fImpl, Vec3hImpl, Vec3iImpl, Vec3uImpl, Vec4bImpl, Vec4fImpl, Vec4hImpl, Vec4iImpl, Vec4uImpl } from "./vectorImpl.js";
6
+
6
7
  //#region src/data/vector.ts
7
8
  /**
8
9
  * Schema representing vec2f - a vector with 2 elements of type f32.
@@ -235,5 +236,6 @@ function makeVecSchema(VecImpl, primitive) {
235
236
  VecImpl.prototype.schema = schema;
236
237
  return schema;
237
238
  }
239
+
238
240
  //#endregion
239
- export { vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u, vecTypeToConstructor };
241
+ export { vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u, vecTypeToConstructor };
@@ -2,6 +2,7 @@ import { $internal, $resolve } from "../shared/symbols.js";
2
2
  import { WORKAROUND_getSchema } from "./wgslTypes.js";
3
3
  import { bool, f16, f32, i32, u32 } from "./numeric.js";
4
4
  import { numericLiteralToSnippet } from "../tgsl/generationHelpers.js";
5
+
5
6
  //#region src/data/vectorImpl.ts
6
7
  const XYZW = [
7
8
  "x",
@@ -511,5 +512,6 @@ var Vec4bImpl = class Vec4bImpl extends Vec4 {
511
512
  return Vec4bImpl;
512
513
  }
513
514
  };
515
+
514
516
  //#endregion
515
- export { Vec2bImpl, Vec2fImpl, Vec2hImpl, Vec2iImpl, Vec2uImpl, Vec3bImpl, Vec3fImpl, Vec3hImpl, Vec3iImpl, Vec3uImpl, Vec4bImpl, Vec4fImpl, Vec4hImpl, Vec4iImpl, Vec4uImpl, VecBase };
517
+ export { Vec2bImpl, Vec2fImpl, Vec2hImpl, Vec2iImpl, Vec2uImpl, Vec3bImpl, Vec3fImpl, Vec3hImpl, Vec3iImpl, Vec3uImpl, Vec4bImpl, Vec4fImpl, Vec4hImpl, Vec4iImpl, Vec4uImpl, VecBase };
package/data/vectorOps.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { vec2b as vec2b$1, vec2f as vec2f$1, vec2h as vec2h$1, vec2i as vec2i$1, vec2u as vec2u$1, vec3b as vec3b$1, vec3f as vec3f$1, vec3h as vec3h$1, vec3i as vec3i$1, vec3u as vec3u$1, vec4b as vec4b$1, vec4f as vec4f$1, vec4h as vec4h$1, vec4i as vec4i$1, vec4u as vec4u$1 } from "./vector.js";
2
2
  import { mat2x2f, mat3x3f, mat4x4f } from "./matrix.js";
3
3
  import { bitcastU32toF32Impl, bitcastU32toI32Impl, clamp, divInteger, smoothstepScalar } from "./numberOps.js";
4
+
4
5
  //#region src/data/vectorOps.ts
5
6
  const vec2b = vec2b$1;
6
7
  const vec2f = vec2f$1;
@@ -677,5 +678,6 @@ const VectorOps = {
677
678
  vec4u: (n) => vec4i(bitcastU32toI32Impl(n.x), bitcastU32toI32Impl(n.y), bitcastU32toI32Impl(n.z), bitcastU32toI32Impl(n.w))
678
679
  }
679
680
  };
681
+
680
682
  //#endregion
681
- export { VectorOps };
683
+ export { VectorOps };
@@ -2,6 +2,7 @@ import { $cast, $gpuCallable, $internal, isMarkedInternal } from "../shared/symb
2
2
  import { schemaCallWrapper, schemaCallWrapperGPU } from "./schemaCallWrapper.js";
3
3
  import { f32, i32, u32 } from "./numeric.js";
4
4
  import { vec2f, vec2i, vec2u, vec3f, vec3i, vec3u, vec4f, vec4i, vec4u } from "./vector.js";
5
+
5
6
  //#region src/data/vertexFormatData.ts
6
7
  var TgpuVertexFormatDataImpl = class {
7
8
  [$internal] = {};
@@ -105,5 +106,6 @@ const unorm8x4_bgra = new TgpuVertexFormatDataImpl("unorm8x4-bgra");
105
106
  function isPackedData(value) {
106
107
  return isMarkedInternal(value) && packedFormats.has(value?.type);
107
108
  }
109
+
108
110
  //#endregion
109
- export { 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 };
111
+ export { 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 };
@@ -6,6 +6,8 @@ import { DualFn } from "../types.js";
6
6
  import { _ref } from "./ref.js";
7
7
  import { WgslExternalTexture, WgslStorageTexture, WgslTexture } from "./texture.js";
8
8
  import { ExtractInvalidSchemaError, Infer, InferGPU, InferGPURecord, InferInput, InferInputRecord, InferPartial, InferPartialRecord, InferPatch, InferPatchRecord, InferRecord, IsValidStorageSchema, IsValidUniformSchema, IsValidVertexSchema, MemIdentity, MemIdentityRecord } from "../shared/repr.js";
9
+ import "tsover-runtime";
10
+
9
11
  //#region src/data/wgslTypes.d.ts
10
12
  type DecoratedLocation<T extends BaseData> = Decorated<T, Location[]>;
11
13
  interface BaseData {
@@ -70,6 +72,7 @@ interface matInfixNotation<T extends matBase> {
70
72
  */
71
73
  interface AbstractInt extends BaseData {
72
74
  readonly type: 'abstractInt';
75
+ readonly concretized: I32;
73
76
  readonly [$repr]: number;
74
77
  readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';
75
78
  }
@@ -78,6 +81,7 @@ interface AbstractInt extends BaseData {
78
81
  */
79
82
  interface AbstractFloat extends BaseData {
80
83
  readonly type: 'abstractFloat';
84
+ readonly concretized: F32;
81
85
  readonly [$repr]: number;
82
86
  readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';
83
87
  }
package/data/wgslTypes.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { $internal, isMarkedInternal } from "../shared/symbols.js";
2
2
  import "tsover-runtime";
3
+
3
4
  //#region src/data/wgslTypes.ts
4
5
  const Void = {
5
6
  [$internal]: {},
@@ -218,5 +219,6 @@ function isNaturallyEphemeral(schema) {
218
219
  function WORKAROUND_getSchema(vec) {
219
220
  return vec.schema;
220
221
  }
222
+
221
223
  //#endregion
222
- export { Void, WORKAROUND_getSchema, isAlignAttrib, isAtomic, isBool, isBuiltinAttrib, isDecorated, isFloat32VecInstance, isHalfPrecisionSchema, isInteger32VecInstance, isInterpolateAttrib, isLocationAttrib, isMat, isMat2x2f, isMat3x3f, isMatInstance, isNaturallyEphemeral, isNumericSchema, isPtr, isSizeAttrib, isUint32VecInstance, isVec, isVecBool, isVecInstance, isVoid, isWgslArray, isWgslData, isWgslStruct };
224
+ export { Void, WORKAROUND_getSchema, isAlignAttrib, isAtomic, isBool, isBuiltinAttrib, isDecorated, isFloat32VecInstance, isHalfPrecisionSchema, isInteger32VecInstance, isInterpolateAttrib, isLocationAttrib, isMat, isMat2x2f, isMat3x3f, isMatInstance, isNaturallyEphemeral, isNumericSchema, isPtr, isSizeAttrib, isUint32VecInstance, isVec, isVecBool, isVecInstance, isVoid, isWgslArray, isWgslData, isWgslStruct };
package/errors.d.ts CHANGED
@@ -5,6 +5,7 @@ import { TgpuBuffer } from "./core/buffer/buffer.js";
5
5
  import { BaseData } from "./data/wgslTypes.js";
6
6
 
7
7
  //#region src/errors.d.ts
8
+
8
9
  /**
9
10
  * An error that happens during resolution of WGSL code.
10
11
  * Contains a trace of all ancestor resolvables in
package/errors.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DEV, TEST } from "./shared/env.js";
2
2
  import { getName, hasTinyestMetadata } from "./shared/meta.js";
3
+
3
4
  //#region src/errors.ts
4
5
  const prefix = "Invariant failed";
5
6
  /**
@@ -127,5 +128,6 @@ var SignatureNotSupportedError = class SignatureNotSupportedError extends Error
127
128
  Object.setPrototypeOf(this, SignatureNotSupportedError.prototype);
128
129
  }
129
130
  };
131
+
130
132
  //#endregion
131
- export { ExecutionError, IllegalBufferAccessError, IllegalVarAccessError, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, SignatureNotSupportedError, WgslTypeError, invariant };
133
+ export { ExecutionError, IllegalBufferAccessError, IllegalVarAccessError, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, SignatureNotSupportedError, WgslTypeError, invariant };
package/execMode.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { invariant } from "./errors.js";
2
2
  import { NormalState } from "./types.js";
3
+
3
4
  //#region src/execMode.ts
4
5
  /**
5
6
  * Used to track if the code we're currently
@@ -45,5 +46,6 @@ function getExecMode() {
45
46
  function inCodegenMode() {
46
47
  return resolutionCtx?.mode.type === "codegen";
47
48
  }
49
+
48
50
  //#endregion
49
- export { getExecMode, getResolutionCtx, inCodegenMode, isInsideTgpuFn, provideCtx, provideInsideTgpuFn, topLevelState };
51
+ export { getExecMode, getResolutionCtx, inCodegenMode, isInsideTgpuFn, provideCtx, provideInsideTgpuFn, topLevelState };
package/extension.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  //#region src/extension.d.ts
2
+
2
3
  interface StorageFlag {
3
4
  usableAsStorage: true;
4
5
  }
package/extension.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { getName } from "./shared/meta.js";
2
+
2
3
  //#region src/extension.ts
3
4
  function isUsableAsStorage(value) {
4
5
  return !!value?.usableAsStorage;
@@ -12,5 +13,6 @@ var NotStorageError = class NotStorageError extends Error {
12
13
  Object.setPrototypeOf(this, NotStorageError.prototype);
13
14
  }
14
15
  };
16
+
15
17
  //#endregion
16
- export { NotStorageError, isUsableAsStorage };
18
+ export { NotStorageError, isUsableAsStorage };
package/getGPUValue.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { $gpuValueOf } from "./shared/symbols.js";
2
+
2
3
  //#region src/getGPUValue.ts
3
4
  function getGPUValue(object) {
4
5
  return object?.[$gpuValueOf];
5
6
  }
7
+
6
8
  //#endregion
7
- export { getGPUValue };
9
+ export { getGPUValue };
package/index.js CHANGED
@@ -18,10 +18,9 @@ import { tgpu_exports } from "./tgpu.js";
18
18
  import { data_exports } from "./data/index.js";
19
19
  import { std_exports } from "./std/index.js";
20
20
  import { common_exports } from "./common/index.js";
21
+
21
22
  //#region src/index.js
22
- /**
23
- * @module typegpu
24
- */
25
23
  var src_default = tgpu_exports;
24
+
26
25
  //#endregion
27
- export { MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, shaderGenerator_members_exports as ShaderGenerator, WgslGenerator, common_exports as common, data_exports as d, src_default as default, isAccessor, isBuffer, isBufferShorthand, isComparisonSampler, isLazy, isMutableAccessor, isSampler, isSlot, isTexture, isTgpuComputeFn, isTgpuFn, isTgpuFragmentFn, isTgpuVertexFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, isVariable, std_exports as std, tgpu_exports as tgpu };
26
+ export { MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, shaderGenerator_members_exports as ShaderGenerator, WgslGenerator, common_exports as common, data_exports as d, src_default as default, isAccessor, isBuffer, isBufferShorthand, isComparisonSampler, isLazy, isMutableAccessor, isSampler, isSlot, isTexture, isTgpuComputeFn, isTgpuFn, isTgpuFragmentFn, isTgpuVertexFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, isVariable, std_exports as std, tgpu_exports as tgpu };
@@ -34,6 +34,7 @@ import { MissingBindGroupsError, MissingLinksError, MissingSlotValueError, Missi
34
34
  import { WgslGenerator } from "./tgsl/wgslGenerator.js";
35
35
 
36
36
  //#region src/indexNamedExports.d.ts
37
+
37
38
  /** @deprecated Use TgpuRenderPipeline.Descriptor */
38
39
  type TgpuRenderPipelineDescriptor = TgpuRenderPipeline.Descriptor;
39
40
  //#endregion
package/mathUtils.js CHANGED
@@ -8,5 +8,6 @@ const roundUp = (value, modulo) => {
8
8
  const invBitMask = ~bitMask;
9
9
  return (value & bitMask) === 0 ? value : (value & invBitMask) + modulo;
10
10
  };
11
+
11
12
  //#endregion
12
- export { roundUp };
13
+ export { roundUp };
package/memo.js CHANGED
@@ -18,5 +18,6 @@ var WeakMemo = class {
18
18
  return value;
19
19
  }
20
20
  };
21
+
21
22
  //#endregion
22
- export { WeakMemo };
23
+ export { WeakMemo };
package/nameRegistry.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { invariant } from "./errors.js";
2
+
2
3
  //#region src/nameRegistry.ts
3
4
  const bannedTokens = new Set([
4
5
  "alias",
@@ -443,5 +444,6 @@ var StrictNameRegistry = class extends NameRegistryImpl {
443
444
  return name;
444
445
  }
445
446
  };
447
+
446
448
  //#endregion
447
- export { RandomNameRegistry, StrictNameRegistry, isValidProp };
449
+ export { RandomNameRegistry, StrictNameRegistry, isValidProp };
package/package.js CHANGED
@@ -1,4 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.11.1";
2
+ var version = "0.11.3";
3
+
3
4
  //#endregion
4
- export { version };
5
+ export { version };