typegpu 0.10.2 → 0.11.0-rc.1

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 (211) hide show
  1. package/_virtual/_rolldown/runtime.js +6 -11
  2. package/builtin.js +1 -3
  3. package/common/fullScreenTriangle.d.ts +1 -5
  4. package/common/fullScreenTriangle.js +1 -3
  5. package/common/index.d.ts +3 -2
  6. package/common/index.js +6 -4
  7. package/common/writeSoA.d.ts +16 -0
  8. package/common/writeSoA.js +90 -0
  9. package/core/buffer/buffer.d.ts +12 -7
  10. package/core/buffer/buffer.js +102 -53
  11. package/core/buffer/bufferShorthand.d.ts +5 -5
  12. package/core/buffer/bufferShorthand.js +9 -5
  13. package/core/buffer/bufferUsage.d.ts +0 -2
  14. package/core/buffer/bufferUsage.js +6 -4
  15. package/core/constant/tgpuConstant.d.ts +2 -1
  16. package/core/constant/tgpuConstant.js +8 -7
  17. package/core/declare/tgpuDeclare.js +8 -9
  18. package/core/function/autoIO.d.ts +7 -6
  19. package/core/function/autoIO.js +1 -3
  20. package/core/function/comptime.js +1 -3
  21. package/core/function/createCallableSchema.js +4 -6
  22. package/core/function/dualImpl.js +1 -3
  23. package/core/function/entryInputRouter.js +39 -0
  24. package/core/function/extractArgs.js +2 -2
  25. package/core/function/fnCore.js +19 -8
  26. package/core/function/fnTypes.d.ts +14 -8
  27. package/core/function/ioSchema.js +24 -3
  28. package/core/function/shelllessImpl.js +1 -3
  29. package/core/function/templateUtils.js +1 -2
  30. package/core/function/tgpuComputeFn.d.ts +2 -3
  31. package/core/function/tgpuComputeFn.js +9 -16
  32. package/core/function/tgpuFn.d.ts +2 -2
  33. package/core/function/tgpuFn.js +1 -3
  34. package/core/function/tgpuFragmentFn.d.ts +5 -1
  35. package/core/function/tgpuFragmentFn.js +5 -10
  36. package/core/function/tgpuVertexFn.d.ts +4 -0
  37. package/core/function/tgpuVertexFn.js +6 -12
  38. package/core/pipeline/applyPipelineState.js +1 -3
  39. package/core/pipeline/computePipeline.d.ts +2 -6
  40. package/core/pipeline/computePipeline.js +64 -63
  41. package/core/pipeline/connectAttachmentToShader.js +1 -3
  42. package/core/pipeline/connectTargetsToShader.js +1 -3
  43. package/core/pipeline/limitsOverflow.js +1 -2
  44. package/core/pipeline/pipelineUtils.js +29 -0
  45. package/core/pipeline/renderPipeline.d.ts +23 -5
  46. package/core/pipeline/renderPipeline.js +32 -14
  47. package/core/pipeline/timeable.d.ts +0 -3
  48. package/core/pipeline/timeable.js +3 -9
  49. package/core/pipeline/typeGuards.js +1 -3
  50. package/core/querySet/querySet.d.ts +0 -2
  51. package/core/querySet/querySet.js +37 -36
  52. package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +1 -3
  53. package/core/resolve/externals.d.ts +0 -2
  54. package/core/resolve/externals.js +2 -4
  55. package/core/resolve/namespace.js +1 -3
  56. package/core/resolve/resolveData.js +1 -3
  57. package/core/resolve/stitch.js +1 -3
  58. package/core/resolve/tgpuResolve.d.ts +3 -1
  59. package/core/resolve/tgpuResolve.js +3 -5
  60. package/core/root/configurableImpl.js +2 -3
  61. package/core/root/init.d.ts +0 -5
  62. package/core/root/init.js +35 -28
  63. package/core/root/rootTypes.d.ts +25 -5
  64. package/core/sampler/sampler.d.ts +0 -4
  65. package/core/sampler/sampler.js +3 -3
  66. package/core/simulate/tgpuSimulate.js +1 -3
  67. package/core/slot/accessor.d.ts +0 -4
  68. package/core/slot/accessor.js +1 -3
  69. package/core/slot/internalSlots.js +1 -3
  70. package/core/slot/lazy.js +1 -3
  71. package/core/slot/slot.js +2 -3
  72. package/core/slot/slotTypes.js +1 -3
  73. package/core/texture/externalTexture.d.ts +0 -6
  74. package/core/texture/externalTexture.js +2 -3
  75. package/core/texture/texture.d.ts +0 -4
  76. package/core/texture/texture.js +5 -3
  77. package/core/texture/textureFormats.js +1 -3
  78. package/core/texture/textureUtils.js +1 -3
  79. package/core/texture/usageExtension.js +1 -3
  80. package/core/unroll/tgpuUnroll.d.ts +58 -3
  81. package/core/unroll/tgpuUnroll.js +63 -5
  82. package/core/valueProxyUtils.js +1 -3
  83. package/core/variable/tgpuVariable.js +1 -3
  84. package/core/vertexLayout/connectAttributesToShader.js +1 -3
  85. package/core/vertexLayout/vertexLayout.js +9 -9
  86. package/data/alignIO.js +1 -2
  87. package/data/alignmentOf.d.ts +0 -1
  88. package/data/alignmentOf.js +1 -3
  89. package/data/array.d.ts +1 -3
  90. package/data/array.js +2 -4
  91. package/data/atomic.js +2 -3
  92. package/data/attributes.js +3 -3
  93. package/data/autoStruct.d.ts +1 -3
  94. package/data/autoStruct.js +1 -3
  95. package/data/compiledIO.js +83 -86
  96. package/data/dataIO.js +46 -39
  97. package/data/dataTypes.d.ts +7 -7
  98. package/data/dataTypes.js +6 -3
  99. package/data/deepEqual.js +1 -3
  100. package/data/disarray.d.ts +1 -3
  101. package/data/disarray.js +1 -3
  102. package/data/getLongestContiguousPrefix.d.ts +0 -1
  103. package/data/getLongestContiguousPrefix.js +1 -3
  104. package/data/index.d.ts +3 -3
  105. package/data/index.js +10 -3
  106. package/data/isContiguous.d.ts +0 -1
  107. package/data/isContiguous.js +1 -3
  108. package/data/matrix.d.ts +8 -10
  109. package/data/matrix.js +32 -18
  110. package/data/numberOps.js +1 -2
  111. package/data/numeric.js +16 -29
  112. package/data/offsetUtils.d.ts +2 -2
  113. package/data/offsetUtils.js +3 -5
  114. package/data/offsets.js +1 -3
  115. package/data/partialIO.js +84 -39
  116. package/data/ptr.d.ts +0 -1
  117. package/data/ptr.js +1 -3
  118. package/data/ref.d.ts +0 -3
  119. package/data/ref.js +1 -3
  120. package/data/sampler.js +1 -3
  121. package/data/schemaCallWrapper.js +1 -3
  122. package/data/schemaMemoryLayout.js +1 -3
  123. package/data/sizeOf.d.ts +0 -1
  124. package/data/sizeOf.js +1 -3
  125. package/data/snippet.js +12 -3
  126. package/data/struct.js +1 -3
  127. package/data/texture.js +1 -3
  128. package/data/unstruct.js +1 -3
  129. package/data/vector.js +4 -12
  130. package/data/vectorImpl.js +27 -28
  131. package/data/vectorOps.js +20 -3
  132. package/data/vertexFormatData.js +2 -3
  133. package/data/wgslTypes.d.ts +39 -11
  134. package/data/wgslTypes.js +10 -3
  135. package/errors.js +6 -3
  136. package/execMode.js +1 -3
  137. package/extension.js +1 -3
  138. package/getGPUValue.js +1 -3
  139. package/index.d.ts +4 -2
  140. package/index.js +3 -3
  141. package/indexNamedExports.d.ts +3 -1
  142. package/mathUtils.js +1 -2
  143. package/memo.js +8 -8
  144. package/nameRegistry.js +1 -3
  145. package/package.js +2 -3
  146. package/package.json +5 -5
  147. package/resolutionCtx.d.ts +0 -10
  148. package/resolutionCtx.js +84 -18
  149. package/shared/env.js +1 -2
  150. package/shared/generators.js +1 -2
  151. package/shared/meta.js +1 -3
  152. package/shared/repr.d.ts +32 -2
  153. package/shared/stringify.js +1 -3
  154. package/shared/symbols.d.ts +10 -1
  155. package/shared/symbols.js +10 -33
  156. package/shared/utilityTypes.d.ts +6 -2
  157. package/shared/utilityTypes.js +1 -2
  158. package/shared/vertexFormat.js +1 -2
  159. package/std/array.d.ts +1 -1
  160. package/std/array.js +1 -3
  161. package/std/atomic.d.ts +12 -12
  162. package/std/atomic.js +1 -3
  163. package/std/bitcast.d.ts +2 -2
  164. package/std/bitcast.js +1 -3
  165. package/std/boolean.d.ts +30 -16
  166. package/std/boolean.js +37 -12
  167. package/std/derivative.d.ts +9 -9
  168. package/std/derivative.js +1 -3
  169. package/std/discard.d.ts +1 -1
  170. package/std/discard.js +1 -3
  171. package/std/extensions.d.ts +1 -3
  172. package/std/extensions.js +1 -3
  173. package/std/index.d.ts +5 -4
  174. package/std/index.js +8 -5
  175. package/std/matrix.d.ts +5 -5
  176. package/std/matrix.js +1 -3
  177. package/std/numeric.d.ts +78 -132
  178. package/std/numeric.js +1 -3
  179. package/std/operators.d.ts +16 -8
  180. package/std/operators.js +80 -6
  181. package/std/packing.d.ts +4 -4
  182. package/std/packing.js +1 -3
  183. package/std/range.d.ts +24 -0
  184. package/std/range.js +38 -0
  185. package/std/subgroup.d.ts +21 -21
  186. package/std/subgroup.js +1 -3
  187. package/std/texture.d.ts +20 -11
  188. package/std/texture.js +13 -3
  189. package/tgpu.js +1 -3
  190. package/tgpuBindGroupLayout.js +9 -8
  191. package/tgpuUnstable.js +1 -3
  192. package/tgsl/accessIndex.js +2 -4
  193. package/tgsl/accessProp.js +8 -6
  194. package/tgsl/consoleLog/deserializers.js +1 -3
  195. package/tgsl/consoleLog/logGenerator.js +2 -4
  196. package/tgsl/consoleLog/serializers.js +24 -26
  197. package/tgsl/consoleLog/types.d.ts +0 -2
  198. package/tgsl/consoleLog/types.js +1 -2
  199. package/tgsl/conversion.js +1 -3
  200. package/tgsl/forOfUtils.js +35 -9
  201. package/tgsl/generationHelpers.js +3 -3
  202. package/tgsl/math.js +1 -3
  203. package/tgsl/shaderGenerator.d.ts +10 -8
  204. package/tgsl/shaderGenerator_members.d.ts +2 -0
  205. package/tgsl/shaderGenerator_members.js +6 -0
  206. package/tgsl/shellless.js +1 -8
  207. package/tgsl/wgslGenerator.d.ts +36 -0
  208. package/tgsl/wgslGenerator.js +135 -81
  209. package/types.d.ts +14 -4
  210. package/types.js +3 -3
  211. package/wgslExtensions.js +1 -2
@@ -1,15 +1,16 @@
1
1
  import { $gpuValueOf, $internal, $ownSnippet, $resolve } from "../../shared/symbols.js";
2
2
  import { getName, setName } from "../../shared/meta.js";
3
3
  import { isNaturallyEphemeral } from "../../data/wgslTypes.js";
4
+ import { isData } from "../../data/dataTypes.js";
4
5
  import { snip } from "../../data/snippet.js";
5
6
  import { inCodegenMode } from "../../execMode.js";
6
7
  import { valueProxyHandler } from "../valueProxyUtils.js";
7
-
8
8
  //#region src/core/constant/tgpuConstant.ts
9
- /**
10
- * Creates a module constant with specified value.
11
- */
12
9
  function constant(dataType, value) {
10
+ if (!isData(dataType)) {
11
+ if (!Array.isArray(value)) throw new Error(`Expected an array value for a partially-applied array schema, but received: ${typeof value}.`);
12
+ return new TgpuConstImpl(dataType(value.length), value);
13
+ }
13
14
  return new TgpuConstImpl(dataType, value);
14
15
  }
15
16
  function deepFreeze(object) {
@@ -23,10 +24,11 @@ function deepFreeze(object) {
23
24
  var TgpuConstImpl = class {
24
25
  [$internal] = {};
25
26
  resourceType;
27
+ dataType;
26
28
  #value;
27
29
  constructor(dataType, value) {
28
- this.dataType = dataType;
29
30
  this.resourceType = "const";
31
+ this.dataType = dataType;
30
32
  this.#value = value && typeof value === "object" ? deepFreeze(value) : value;
31
33
  }
32
34
  $name(label) {
@@ -62,6 +64,5 @@ var TgpuConstImpl = class {
62
64
  return this.$;
63
65
  }
64
66
  };
65
-
66
67
  //#endregion
67
- export { constant };
68
+ export { constant };
@@ -2,7 +2,6 @@ import { $internal, $resolve } from "../../shared/symbols.js";
2
2
  import { Void } from "../../data/wgslTypes.js";
3
3
  import { snip } from "../../data/snippet.js";
4
4
  import { applyExternals, replaceExternalsInWgsl } from "../resolve/externals.js";
5
-
6
5
  //#region src/core/declare/tgpuDeclare.ts
7
6
  /**
8
7
  * Allows defining extra declarations that shall be included in the final WGSL code,
@@ -16,25 +15,25 @@ function declare(declaration) {
16
15
  }
17
16
  var TgpuDeclareImpl = class {
18
17
  [$internal] = true;
19
- externalsToApply = [];
18
+ #externalsToApply = [];
19
+ #declaration;
20
20
  constructor(declaration) {
21
- this.declaration = declaration;
21
+ this.#declaration = declaration;
22
22
  }
23
23
  $uses(dependencyMap) {
24
- this.externalsToApply.push(dependencyMap);
24
+ this.#externalsToApply.push(dependencyMap);
25
25
  return this;
26
26
  }
27
27
  [$resolve](ctx) {
28
28
  const externalMap = {};
29
- for (const externals of this.externalsToApply) applyExternals(externalMap, externals);
30
- const replacedDeclaration = replaceExternalsInWgsl(ctx, externalMap, this.declaration);
29
+ for (const externals of this.#externalsToApply) applyExternals(externalMap, externals);
30
+ const replacedDeclaration = replaceExternalsInWgsl(ctx, externalMap, this.#declaration);
31
31
  ctx.addDeclaration(replacedDeclaration);
32
32
  return snip("", Void, "constant");
33
33
  }
34
34
  toString() {
35
- return `declare: ${this.declaration}`;
35
+ return `declare: ${this.#declaration}`;
36
36
  }
37
37
  };
38
-
39
38
  //#endregion
40
- export { declare };
39
+ export { declare };
@@ -1,8 +1,8 @@
1
+ import { Assume, RemoveIndexSignature } from "../../shared/utilityTypes.js";
1
2
  import { BuiltinClipDistances, BuiltinFragDepth, BuiltinFrontFacing, BuiltinInstanceIndex, BuiltinPosition, BuiltinPrimitiveIndex, BuiltinSampleIndex, BuiltinSampleMask, BuiltinSubgroupInvocationId, BuiltinSubgroupSize, BuiltinVertexIndex, OmitBuiltins } from "../../builtin.js";
2
- import "../../data/snippet.js";
3
3
  import { BaseIOData } from "./fnTypes.js";
4
- import "../../data/autoStruct.js";
5
- import "../../types.js";
4
+ import { TgpuVertexAttrib } from "../../shared/vertexFormat.js";
5
+ import { FormatToWGSLType } from "../../data/vertexFormatData.js";
6
6
  import { v4f } from "../../data/wgslTypes.js";
7
7
  import { InferGPU, InferGPURecord, InferRecord } from "../../shared/repr.js";
8
8
 
@@ -12,7 +12,8 @@ declare const builtinVertexIn: {
12
12
  readonly $vertexIndex: BuiltinVertexIndex;
13
13
  readonly $instanceIndex: BuiltinInstanceIndex;
14
14
  };
15
- type AutoVertexIn<T extends AnyAutoCustoms> = T & InferRecord<typeof builtinVertexIn>;
15
+ type AutoVertexIn<T extends AnyAutoCustoms> = RemoveIndexSignature<T> & InferRecord<typeof builtinVertexIn>;
16
+ type _AutoVertexIn<T> = AutoVertexIn<{ [Key in keyof T]: T[Key] extends TgpuVertexAttrib ? InferGPU<FormatToWGSLType<T[Key]['format']>> : Assume<T[Key], InferGPU<BaseIOData>> }>;
16
17
  declare const builtinVertexOut: {
17
18
  readonly $clipDistances: BuiltinClipDistances;
18
19
  readonly $position: BuiltinPosition;
@@ -27,11 +28,11 @@ declare const builtinFragmentIn: {
27
28
  readonly $subgroupInvocationId: BuiltinSubgroupInvocationId;
28
29
  readonly $subgroupSize: BuiltinSubgroupSize;
29
30
  };
30
- type AutoFragmentIn<T extends AnyAutoCustoms> = T & InferRecord<typeof builtinFragmentIn>;
31
+ type AutoFragmentIn<T extends AnyAutoCustoms> = RemoveIndexSignature<T> & InferRecord<typeof builtinFragmentIn>;
31
32
  declare const builtinFragmentOut: {
32
33
  readonly $fragDepth: BuiltinFragDepth;
33
34
  readonly $sampleMask: BuiltinSampleMask;
34
35
  };
35
36
  type AutoFragmentOut<T extends undefined | v4f | AnyAutoCustoms> = T extends undefined | v4f ? T : T & Partial<InferGPURecord<typeof builtinFragmentOut>>;
36
37
  //#endregion
37
- export { AnyAutoCustoms, AutoFragmentIn, AutoFragmentOut, AutoVertexIn, AutoVertexOut };
38
+ export { AnyAutoCustoms, AutoFragmentIn, AutoFragmentOut, AutoVertexIn, AutoVertexOut, _AutoVertexIn };
@@ -5,7 +5,6 @@ import { AutoStruct } from "../../data/autoStruct.js";
5
5
  import { createFnCore } from "./fnCore.js";
6
6
  import { shaderStageSlot } from "../slot/internalSlots.js";
7
7
  import { builtin } from "../../builtin.js";
8
-
9
8
  //#region src/core/function/autoIO.ts
10
9
  const builtinVertexIn = {
11
10
  $vertexIndex: builtin.vertexIndex,
@@ -82,6 +81,5 @@ var AutoVertexFn = class {
82
81
  };
83
82
  AutoVertexFn.prototype[$internal] = true;
84
83
  AutoVertexFn.prototype.resourceType = "auto-vertex-fn";
85
-
86
84
  //#endregion
87
- export { AutoFragmentFn, AutoVertexFn };
85
+ export { AutoFragmentFn, AutoVertexFn };
@@ -3,7 +3,6 @@ import { setName } from "../../shared/meta.js";
3
3
  import { WgslTypeError } from "../../errors.js";
4
4
  import { isKnownAtComptime } from "../../types.js";
5
5
  import { coerceToSnippet } from "../../tgsl/generationHelpers.js";
6
-
7
6
  //#region src/core/function/comptime.ts
8
7
  /**
9
8
  * Creates a version of `func` that can called safely in a TypeGPU function to
@@ -46,6 +45,5 @@ function comptime(func) {
46
45
  Object.defineProperty(impl, $internal, { value: { isComptime: true } });
47
46
  return impl;
48
47
  }
49
-
50
48
  //#endregion
51
- export { comptime };
49
+ export { comptime };
@@ -4,7 +4,6 @@ import { isPtr } from "../../data/wgslTypes.js";
4
4
  import { snip } from "../../data/snippet.js";
5
5
  import { NormalState, isKnownAtComptime } from "../../types.js";
6
6
  import { tryConvertSnippet } from "../../tgsl/conversion.js";
7
-
8
7
  //#region src/core/function/createCallableSchema.ts
9
8
  function callableSchema(options) {
10
9
  const impl = ((...args) => {
@@ -15,7 +14,7 @@ function callableSchema(options) {
15
14
  impl[$gpuCallable] = {
16
15
  get strictSignature() {},
17
16
  call(ctx, args) {
18
- const { argTypes, returnType } = options.signature(...args.map((s) => {
17
+ const argTypes = options.argTypes(...args.map((s) => {
19
18
  if (isPtr(s.dataType) && s.dataType.implicit) return s.dataType.inner;
20
19
  return s.dataType;
21
20
  }));
@@ -27,16 +26,15 @@ function callableSchema(options) {
27
26
  if (converted.every((s) => isKnownAtComptime(s))) {
28
27
  ctx.pushMode(new NormalState());
29
28
  try {
30
- return snip(options.normalImpl(...converted.map((s) => s.value)), returnType, "constant");
29
+ return snip(options.normalImpl(...converted.map((s) => s.value)), options.schema(), "constant");
31
30
  } finally {
32
31
  ctx.popMode("normal");
33
32
  }
34
33
  }
35
- return snip(options.codegenImpl(ctx, converted), returnType, "runtime");
34
+ return options.codegenImpl(ctx, converted);
36
35
  }
37
36
  };
38
37
  return impl;
39
38
  }
40
-
41
39
  //#endregion
42
- export { callableSchema };
40
+ export { callableSchema };
@@ -5,7 +5,6 @@ import { snip } from "../../data/snippet.js";
5
5
  import { NormalState, isKnownAtComptime } from "../../types.js";
6
6
  import { tryConvertSnippet } from "../../tgsl/conversion.js";
7
7
  import { concretize } from "../../tgsl/generationHelpers.js";
8
-
9
8
  //#region src/core/function/dualImpl.ts
10
9
  var MissingCpuImplError = class extends Error {
11
10
  constructor(message) {
@@ -49,6 +48,5 @@ function dualImpl(options) {
49
48
  };
50
49
  return impl;
51
50
  }
52
-
53
51
  //#endregion
54
- export { MissingCpuImplError, dualImpl };
52
+ export { MissingCpuImplError, dualImpl };
@@ -0,0 +1,39 @@
1
+ import { $internal } from "../../shared/symbols.js";
2
+ import { isWgslStruct } from "../../data/wgslTypes.js";
3
+ import { undecorate } from "../../data/dataTypes.js";
4
+ import { snip } from "../../data/snippet.js";
5
+ //#region src/core/function/entryInputRouter.ts
6
+ /**
7
+ * Routes `(input) => { input.x }` style property access to the correct WGSL
8
+ * expression: positional args get a direct snippet, struct fields get
9
+ * `structArgName.fieldName`.
10
+ */
11
+ var EntryInputRouter = class {
12
+ [$internal] = {};
13
+ type = "entry-input-router";
14
+ structArgName;
15
+ dataSchema;
16
+ /** Maps schemaKey → { WGSL arg name, type } */
17
+ positionalArgsMap;
18
+ constructor(structArgName, dataSchema, positionalArgs) {
19
+ this.structArgName = structArgName;
20
+ this.dataSchema = dataSchema;
21
+ this.positionalArgsMap = new Map(positionalArgs.map((a) => [a.schemaKey, {
22
+ argName: a.argName,
23
+ type: a.type
24
+ }]));
25
+ }
26
+ toString() {
27
+ return "entry-input-router";
28
+ }
29
+ accessProp(propName) {
30
+ const positionalEntry = this.positionalArgsMap.get(propName);
31
+ if (positionalEntry) return snip(positionalEntry.argName, positionalEntry.type, "argument");
32
+ if (this.dataSchema && isWgslStruct(this.dataSchema)) {
33
+ const propType = this.dataSchema.propTypes[propName];
34
+ if (propType) return snip(`${this.structArgName}.${propName}`, undecorate(propType), "argument");
35
+ }
36
+ }
37
+ };
38
+ //#endregion
39
+ export { EntryInputRouter };
@@ -111,6 +111,7 @@ function strip(rawCode) {
111
111
  throw new Error("Invalid wgsl code!");
112
112
  }
113
113
  var ParsableString = class {
114
+ str;
114
115
  #parseStartPos;
115
116
  #pos;
116
117
  constructor(str) {
@@ -199,6 +200,5 @@ const openingCommentBlock = new Set(["*/"]);
199
200
  const parentheses = ["(", ")"];
200
201
  const angleBrackets = ["<", ">"];
201
202
  const commentBlocks = ["/*", "*/"];
202
-
203
203
  //#endregion
204
- export { extractArgs };
204
+ export { extractArgs };
@@ -7,7 +7,6 @@ import { MissingLinksError } from "../../errors.js";
7
7
  import { getAttributesString } from "../../data/attributes.js";
8
8
  import { applyExternals, replaceExternalsInWgsl } from "../resolve/externals.js";
9
9
  import { extractArgs } from "./extractArgs.js";
10
-
11
10
  //#region src/core/function/fnCore.ts
12
11
  function createFnCore(implementation, fnAttribute = "") {
13
12
  /**
@@ -22,24 +21,33 @@ function createFnCore(implementation, fnAttribute = "") {
22
21
  applyExternals(newExternals) {
23
22
  externalsToApply.push(newExternals);
24
23
  },
25
- resolve(ctx, argTypes, returnType) {
24
+ resolve(ctx, argTypes, returnType, entryInput) {
26
25
  const externalMap = {};
27
26
  for (const externals of externalsToApply) applyExternals(externalMap, externals);
28
27
  const id = ctx.getUniqueName(this);
29
28
  if (typeof implementation === "string") {
30
29
  if (!returnType) throw new Error("Explicit return type is required for string implementation");
30
+ const validArgNames = entryInput ? Object.fromEntries(entryInput.positionalArgs.map((a) => [a.schemaKey, ctx.makeNameValid(a.schemaKey)])) : void 0;
31
+ if (validArgNames && Object.keys(validArgNames).length > 0) applyExternals(externalMap, { in: validArgNames });
31
32
  const replacedImpl = replaceExternalsInWgsl(ctx, externalMap, implementation);
32
33
  let header = "";
33
34
  let body = "";
34
- if (fnAttribute !== "") {
35
- const input = isWgslStruct(argTypes[0]) ? `(in: ${ctx.resolve(argTypes[0]).value})` : "()";
35
+ if (fnAttribute !== "" && entryInput && validArgNames) {
36
+ const { dataSchema, positionalArgs } = entryInput;
37
+ const parts = [];
38
+ if (dataSchema && isArgUsedInBody("in", replacedImpl)) parts.push(`in: ${ctx.resolve(dataSchema).value}`);
39
+ for (const a of positionalArgs) {
40
+ const argName = validArgNames[a.schemaKey] ?? "";
41
+ if (argName !== "" && isArgUsedInBody(argName, replacedImpl)) parts.push(`${getAttributesString(a.type)}${argName}: ${ctx.resolve(a.type).value}`);
42
+ }
43
+ const input = `(${parts.join(", ")})`;
36
44
  const attributes = isWgslData(returnType) ? getAttributesString(returnType) : "";
37
- header = `${input} ${returnType !== Void ? isWgslStruct(returnType) ? `-> ${ctx.resolve(returnType).value}` : `-> ${attributes !== "" ? attributes : "@location(0)"} ${ctx.resolve(returnType).value}` : ""} `;
45
+ header = `${input}${returnType !== Void ? isWgslStruct(returnType) ? ` -> ${ctx.resolve(returnType).value} ` : ` -> ${attributes !== "" ? attributes : "@location(0)"} ${ctx.resolve(returnType).value} ` : " "}`;
38
46
  body = replacedImpl;
39
47
  } else {
40
48
  const providedArgs = extractArgs(replacedImpl);
41
49
  if (providedArgs.args.length !== argTypes.length) throw new Error(`WGSL implementation has ${providedArgs.args.length} arguments, while the shell has ${argTypes.length} arguments.`);
42
- header = `(${providedArgs.args.map((argInfo, i) => `${argInfo.identifier}: ${checkAndReturnType(ctx, `parameter ${argInfo.identifier}`, argInfo.type, argTypes[i])}`).join(", ")}) ${returnType === Void ? "" : `-> ${checkAndReturnType(ctx, "return type", providedArgs.ret?.type, returnType)}`}`;
50
+ header = `(${providedArgs.args.map((argInfo, i) => `${argInfo.identifier}: ${checkAndReturnType(ctx, `parameter ${argInfo.identifier}`, argInfo.type, argTypes[i])}`).join(", ")})${returnType === Void ? " " : ` -> ${checkAndReturnType(ctx, "return type", providedArgs.ret?.type, returnType)} `}`;
43
51
  body = replacedImpl.slice(providedArgs.range.end);
44
52
  }
45
53
  ctx.addDeclaration(`${fnAttribute}fn ${id}${header}${body}`);
@@ -57,6 +65,7 @@ function createFnCore(implementation, fnAttribute = "") {
57
65
  const { head, body, returnType: actualReturnType } = ctx.fnToWgsl({
58
66
  functionType: fnAttribute.includes("@compute") ? "compute" : fnAttribute.includes("@vertex") ? "vertex" : fnAttribute.includes("@fragment") ? "fragment" : "normal",
59
67
  argTypes,
68
+ entryInput,
60
69
  params: ast.params,
61
70
  returnType,
62
71
  body: ast.body,
@@ -67,6 +76,9 @@ function createFnCore(implementation, fnAttribute = "") {
67
76
  }
68
77
  };
69
78
  }
79
+ function isArgUsedInBody(argName, body) {
80
+ return new RegExp(`\\b${argName}\\b`).test(body);
81
+ }
70
82
  function checkAndReturnType(ctx, name, wgslType, jsType) {
71
83
  const resolvedJsType = ctx.resolve(jsType).value.replace(/\s/g, "");
72
84
  if (!wgslType) return resolvedJsType;
@@ -74,6 +86,5 @@ function checkAndReturnType(ctx, name, wgslType, jsType) {
74
86
  if (resolvedWgslType !== resolvedJsType) throw new Error(`Type mismatch between TGPU shell and WGSL code string: ${name}, JS type "${resolvedJsType}", WGSL type "${resolvedWgslType}".`);
75
87
  return wgslType;
76
88
  }
77
-
78
89
  //#endregion
79
- export { createFnCore };
90
+ export { createFnCore };
@@ -1,12 +1,10 @@
1
1
  import { BuiltinClipDistances } from "../../builtin.js";
2
2
  import { AnyAttribute } from "../../data/attributes.js";
3
- import { Bool, Decorated, F16, F32, I32, U32, Vec2f, Vec2h, Vec2i, Vec2u, Vec3f, Vec3h, Vec3i, Vec3u, Vec4f, Vec4h, Vec4i, Vec4u, Void } from "../../data/wgslTypes.js";
4
- import { Infer } from "../../shared/repr.js";
5
- import "tinyest";
6
-
3
+ import { BaseData, Bool, Decorated, F16, F32, I32, U32, Vec2f, Vec2h, Vec2i, Vec2u, Vec3f, Vec3h, Vec3i, Vec3u, Vec4f, Vec4h, Vec4i, Vec4u, Void } from "../../data/wgslTypes.js";
4
+ import { InferGPU } from "../../shared/repr.js";
7
5
  //#region src/core/function/fnTypes.d.ts
8
6
  type AnyFn = (...args: never[]) => unknown;
9
- type InferArgs<T extends unknown[]> = { [Idx in keyof T]: Infer<T[Idx]> };
7
+ type InferArgs<T extends unknown[]> = { [Idx in keyof T]: InferGPU<T[Idx]> };
10
8
  type InheritTupleValues<T, From> = { [K in keyof T]: K extends keyof From ? From[K] : never };
11
9
  /**
12
10
  * Returns a type that has arg and return types of `T`, but argument
@@ -18,7 +16,7 @@ type InheritTupleValues<T, From> = { [K in keyof T]: K extends keyof From ? From
18
16
  type InheritArgNames<T extends AnyFn, From extends AnyFn> = {
19
17
  result: (...args: Parameters<((...args: InheritTupleValues<Parameters<From>, Parameters<T>>) => ReturnType<T>) & T>) => ReturnType<T>;
20
18
  };
21
- type InferImplSchema<ImplSchema extends AnyFn> = (...args: InferArgs<Parameters<ImplSchema>>) => Infer<ReturnType<ImplSchema>>;
19
+ type InferImplSchema<ImplSchema extends AnyFn> = (...args: InferArgs<Parameters<ImplSchema>>) => InferGPU<ReturnType<ImplSchema>>;
22
20
  type Implementation<ImplSchema extends AnyFn = AnyFn> = string | InferImplSchema<ImplSchema>;
23
21
  type BaseIOData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec3f | Vec4f | Vec2h | Vec3h | Vec4h | Vec2i | Vec3i | Vec4i | Vec2u | Vec3u | Vec4u;
24
22
  type IOData = BaseIOData | Decorated<BaseIOData, AnyAttribute[]> | BuiltinClipDistances;
@@ -29,6 +27,14 @@ type IORecord<TElementType extends IOData = IOData> = Record<string, TElementTyp
29
27
  type IOLayout<TElementType extends IOData = IOData> = TElementType | IORecord<TElementType> | Void;
30
28
  type InferIO<T> = T extends {
31
29
  type: string;
32
- } ? Infer<T> : T extends Record<string, unknown> ? { [K in keyof T]: Infer<T[K]> } : T;
30
+ } ? InferGPU<T> : T extends Record<string, unknown> ? { [K in keyof T]: InferGPU<T[K]> } : T;
31
+ interface PositionalArgInfo {
32
+ schemaKey: string;
33
+ type: BaseData;
34
+ }
35
+ interface SeparatedEntryArgs {
36
+ dataSchema: BaseData | undefined;
37
+ positionalArgs: PositionalArgInfo[];
38
+ }
33
39
  //#endregion
34
- export { AnyFn, BaseIOData, IOLayout, IORecord, Implementation, InferArgs, InferIO, InferImplSchema, InheritArgNames };
40
+ export { AnyFn, BaseIOData, IOLayout, IORecord, Implementation, InferArgs, InferIO, InferImplSchema, InheritArgNames, SeparatedEntryArgs };
@@ -2,7 +2,6 @@ import { isVoid } from "../../data/wgslTypes.js";
2
2
  import { getCustomLocation, isData } from "../../data/dataTypes.js";
3
3
  import { isBuiltin, location } from "../../data/attributes.js";
4
4
  import { INTERNAL_createStruct } from "../../data/struct.js";
5
-
6
5
  //#region src/core/function/ioSchema.ts
7
6
  function withLocations(members, locations = {}) {
8
7
  let nextLocation = 0;
@@ -22,9 +21,31 @@ function withLocations(members, locations = {}) {
22
21
  return [key, location(nextLocation++, member)];
23
22
  }));
24
23
  }
24
+ function separateBuiltins(schema, locations = {}) {
25
+ const positionalArgs = [];
26
+ const dataFields = {};
27
+ for (const [key, type] of Object.entries(schema)) if (isBuiltin(type)) positionalArgs.push({
28
+ schemaKey: key,
29
+ type
30
+ });
31
+ else dataFields[key] = type;
32
+ return {
33
+ dataSchema: Object.keys(dataFields).length > 0 ? INTERNAL_createStruct(withLocations(dataFields, locations), false) : void 0,
34
+ positionalArgs
35
+ };
36
+ }
37
+ function separateAllAsPositional(schema) {
38
+ const withLocs = withLocations(schema);
39
+ return {
40
+ dataSchema: void 0,
41
+ positionalArgs: Object.entries(withLocs).map(([key, type]) => ({
42
+ schemaKey: key,
43
+ type
44
+ }))
45
+ };
46
+ }
25
47
  function createIoSchema(layout, locations = {}) {
26
48
  return isData(layout) ? isVoid(layout) ? layout : isBuiltin(layout) ? layout : getCustomLocation(layout) !== void 0 ? layout : location(0, layout) : INTERNAL_createStruct(withLocations(layout, locations), false);
27
49
  }
28
-
29
50
  //#endregion
30
- export { createIoSchema };
51
+ export { createIoSchema, separateAllAsPositional, separateBuiltins };
@@ -1,7 +1,6 @@
1
1
  import { $getNameForward, $internal, $resolve } from "../../shared/symbols.js";
2
2
  import { getName } from "../../shared/meta.js";
3
3
  import { createFnCore } from "./fnCore.js";
4
-
5
4
  //#region src/core/function/shelllessImpl.ts
6
5
  function createShelllessImpl(argTypes, implementation) {
7
6
  const core = createFnCore(implementation, "");
@@ -18,6 +17,5 @@ function createShelllessImpl(argTypes, implementation) {
18
17
  }
19
18
  };
20
19
  }
21
-
22
20
  //#endregion
23
- export { createShelllessImpl };
21
+ export { createShelllessImpl };
@@ -8,6 +8,5 @@ function isTemplateStringsArray(value) {
8
8
  function templateLiteralIdentity(strings, ...values) {
9
9
  return strings.slice(1).reduce((acc, elem, index) => `${acc}${values[index]}${elem}`, strings[0]);
10
10
  }
11
-
12
11
  //#endregion
13
- export { stripTemplate };
12
+ export { stripTemplate };
@@ -2,7 +2,6 @@ import { TgpuNamable } from "../../shared/meta.js";
2
2
  import { $internal } from "../../shared/symbols.js";
3
3
  import { AnyComputeBuiltin } from "../../builtin.js";
4
4
  import { IORecord, InferIO } from "./fnTypes.js";
5
- import { IOLayoutToSchema } from "./ioSchema.js";
6
5
  import { Void } from "../../data/wgslTypes.js";
7
6
 
8
7
  //#region src/core/function/tgpuComputeFn.d.ts
@@ -10,9 +9,9 @@ import { Void } from "../../data/wgslTypes.js";
10
9
  * Describes a compute entry function signature (its arguments, return type and workgroup size)
11
10
  */
12
11
  type TgpuComputeFnShellHeader<ComputeIn extends IORecord<AnyComputeBuiltin>> = {
13
- readonly argTypes: [IOLayoutToSchema<ComputeIn>] | [];
12
+ readonly argTypes: ComputeIn[keyof ComputeIn][];
14
13
  readonly returnType: Void;
15
- readonly workgroupSize: [number, number, number];
14
+ readonly workgroupSize: number[];
16
15
  readonly entryPoint: 'compute';
17
16
  };
18
17
  /**
@@ -1,11 +1,10 @@
1
1
  import { $getNameForward, $internal, $resolve } from "../../shared/symbols.js";
2
- import { getName, isNamable, setName } from "../../shared/meta.js";
2
+ import { getName, setName } from "../../shared/meta.js";
3
3
  import { Void } from "../../data/wgslTypes.js";
4
- import { createIoSchema } from "./ioSchema.js";
4
+ import { separateBuiltins } from "./ioSchema.js";
5
5
  import { createFnCore } from "./fnCore.js";
6
6
  import { stripTemplate } from "./templateUtils.js";
7
7
  import { shaderStageSlot } from "../slot/internalSlots.js";
8
-
9
8
  //#region src/core/function/tgpuComputeFn.ts
10
9
  /**
11
10
  * Creates a shell of a typed entry function for the compute shader stage. Any function
@@ -18,24 +17,20 @@ import { shaderStageSlot } from "../slot/internalSlots.js";
18
17
  */
19
18
  function computeFn(options) {
20
19
  const shell = {
21
- argTypes: options.in && Object.keys(options.in).length !== 0 ? [createIoSchema(options.in)] : [],
20
+ argTypes: Object.values(options.in ?? {}),
22
21
  returnType: Void,
23
- workgroupSize: [
24
- options.workgroupSize[0] ?? 1,
25
- options.workgroupSize[1] ?? 1,
26
- options.workgroupSize[2] ?? 1
27
- ],
22
+ workgroupSize: options.workgroupSize,
28
23
  entryPoint: "compute"
29
24
  };
30
- const call = (arg, ...values) => createComputeFn(shell, options.workgroupSize, stripTemplate(arg, ...values));
25
+ const entryInput = separateBuiltins(options.in ?? {});
26
+ const call = (arg, ...values) => createComputeFn(shell, options.workgroupSize, stripTemplate(arg, ...values), entryInput);
31
27
  return Object.assign(call, shell);
32
28
  }
33
29
  function isTgpuComputeFn(value) {
34
30
  return value?.shell?.entryPoint === "compute";
35
31
  }
36
- function createComputeFn(shell, workgroupSize, implementation) {
32
+ function createComputeFn(shell, workgroupSize, implementation, entryInput) {
37
33
  const core = createFnCore(implementation, `@compute @workgroup_size(${workgroupSize.join(", ")}) `);
38
- const inputType = shell.argTypes[0];
39
34
  return {
40
35
  shell,
41
36
  $uses(newExternals) {
@@ -46,17 +41,15 @@ function createComputeFn(shell, workgroupSize, implementation) {
46
41
  [$getNameForward]: core,
47
42
  $name(newLabel) {
48
43
  setName(this, newLabel);
49
- if (isNamable(inputType)) inputType.$name(`${newLabel}_Input`);
50
44
  return this;
51
45
  },
52
46
  [$resolve](ctx) {
53
- return ctx.withSlots([[shaderStageSlot, "compute"]], () => core.resolve(ctx, shell.argTypes, shell.returnType));
47
+ return ctx.withSlots([[shaderStageSlot, "compute"]], () => core.resolve(ctx, [], shell.returnType, entryInput));
54
48
  },
55
49
  toString() {
56
50
  return `computeFn:${getName(core) ?? "<unnamed>"}`;
57
51
  }
58
52
  };
59
53
  }
60
-
61
54
  //#endregion
62
- export { computeFn, isTgpuComputeFn };
55
+ export { computeFn, isTgpuComputeFn };
@@ -6,7 +6,7 @@ import { Providing } from "../slot/slotTypes.js";
6
6
  import { Withable } from "../root/rootTypes.js";
7
7
  import { DualFn } from "../../types.js";
8
8
  import { BaseData, Void } from "../../data/wgslTypes.js";
9
- import { Infer } from "../../shared/repr.js";
9
+ import { InferGPU } from "../../shared/repr.js";
10
10
 
11
11
  //#region src/core/function/tgpuFn.d.ts
12
12
  /**
@@ -22,7 +22,7 @@ type TgpuFnShellHeader<Args extends BaseData[], Return extends BaseData> = {
22
22
  * Allows creating tgpu functions by calling this shell
23
23
  * and passing the implementation (as WGSL string or JS function) as the argument.
24
24
  */
25
- type TgpuFnShell<Args extends BaseData[], Return extends BaseData> = TgpuFnShellHeader<Args, Return> & (<T extends (...args: InferArgs<Args>) => Infer<Return>>(implementation: T) => TgpuFn<Prettify<InheritArgNames<(...args: Args) => Return, T>>['result']>) & ((implementation: string) => TgpuFn<(...args: Args) => Return>) & ((strings: TemplateStringsArray, ...values: unknown[]) => TgpuFn<(...args: Args) => Return>);
25
+ type TgpuFnShell<Args extends BaseData[], Return extends BaseData> = TgpuFnShellHeader<Args, Return> & (<T extends (...args: InferArgs<Args>) => InferGPU<Return>>(implementation: T) => TgpuFn<Prettify<InheritArgNames<(...args: Args) => Return, T>>['result']>) & ((implementation: string) => TgpuFn<(...args: Args) => Return>) & ((strings: TemplateStringsArray, ...values: unknown[]) => TgpuFn<(...args: Args) => Return>);
26
26
  interface TgpuFnBase<ImplSchema extends AnyFn> extends TgpuNamable, Withable<TgpuFn<ImplSchema>> {
27
27
  [$internal]: {
28
28
  implementation: Implementation<ImplSchema>;
@@ -11,7 +11,6 @@ import { comptime } from "./comptime.js";
11
11
  import { addArgTypesToExternals, addReturnTypeToExternals } from "../resolve/externals.js";
12
12
  import { createFnCore } from "./fnCore.js";
13
13
  import { stripTemplate } from "./templateUtils.js";
14
-
15
14
  //#region src/core/function/tgpuFn.ts
16
15
  function fn(argTypesOrCallback, returnType) {
17
16
  if (typeof argTypesOrCallback === "function") return createGenericFn(argTypesOrCallback, []);
@@ -165,6 +164,5 @@ function createGenericFn(inner, pairs) {
165
164
  } });
166
165
  return genericFn;
167
166
  }
168
-
169
167
  //#endregion
170
- export { fn, isGenericFn, isTgpuFn };
168
+ export { fn, isGenericFn, isTgpuFn };
@@ -3,8 +3,9 @@ import { $internal } from "../../shared/symbols.js";
3
3
  import { Prettify } from "../../shared/utilityTypes.js";
4
4
  import { AnyFragmentInputBuiltin, AnyFragmentOutputBuiltin, OmitBuiltins } from "../../builtin.js";
5
5
  import { BaseIOData, IOLayout, IORecord, InferIO } from "./fnTypes.js";
6
- import { IOLayoutToSchema } from "./ioSchema.js";
6
+ import { AnyAutoCustoms, AutoFragmentIn, AutoFragmentOut } from "./autoIO.js";
7
7
  import { InstanceToSchema } from "../../data/instanceToSchema.js";
8
+ import { IOLayoutToSchema } from "./ioSchema.js";
8
9
  import { BaseData, Decorated, Interpolate, Location, Vec4f, Vec4i, Vec4u, WgslStruct } from "../../data/wgslTypes.js";
9
10
  import { UndecorateRecord } from "../../data/dataTypes.js";
10
11
 
@@ -55,6 +56,9 @@ interface TgpuFragmentFn<in Varying extends TgpuFragmentFn.In = Record<string, n
55
56
  declare namespace TgpuFragmentFn {
56
57
  type In = Record<string, BaseData>;
57
58
  type Out = Record<string, BaseData> | BaseData;
59
+ type AutoIn<T extends AnyAutoCustoms> = AutoFragmentIn<T>;
60
+ type AutoOut<T extends AnyAutoCustoms = AnyAutoCustoms> = AutoFragmentOut<T>;
61
+ type AutoInEmpty = AutoFragmentIn<Record<string, never>>;
58
62
  }
59
63
  declare function fragmentFn<FragmentOut extends FragmentOutConstrained>(options: {
60
64
  out: FragmentOut;
@@ -1,11 +1,10 @@
1
1
  import { $getNameForward, $internal, $resolve } from "../../shared/symbols.js";
2
2
  import { getName, isNamable, setName } from "../../shared/meta.js";
3
- import { createIoSchema } from "./ioSchema.js";
3
+ import { createIoSchema, separateBuiltins } from "./ioSchema.js";
4
4
  import { addReturnTypeToExternals } from "../resolve/externals.js";
5
5
  import { createFnCore } from "./fnCore.js";
6
6
  import { stripTemplate } from "./templateUtils.js";
7
7
  import { shaderStageSlot } from "../slot/internalSlots.js";
8
-
9
8
  //#region src/core/function/tgpuFragmentFn.ts
10
9
  /**
11
10
  * Creates a shell of a typed entry function for the fragment shader stage. Any function
@@ -50,19 +49,15 @@ function createFragmentFn(shell, implementation) {
50
49
  return this;
51
50
  },
52
51
  [$resolve](ctx) {
53
- const inputWithLocation = shell.in ? createIoSchema(shell.in, ctx.varyingLocations) : void 0;
54
- if (inputWithLocation) {
55
- inputWithLocation.$name(`${getName(this) ?? ""}_Input`);
56
- core.applyExternals({ In: inputWithLocation });
57
- }
52
+ const entryInput = separateBuiltins(shell.in ?? {}, ctx.varyingLocations ?? {});
53
+ if (entryInput.dataSchema && isNamable(entryInput.dataSchema)) entryInput.dataSchema.$name(`${getName(this) ?? ""}_Input`);
58
54
  core.applyExternals({ Out: outputType });
59
- return ctx.withSlots([[shaderStageSlot, "fragment"]], () => core.resolve(ctx, inputWithLocation ? [inputWithLocation] : [], shell.returnType));
55
+ return ctx.withSlots([[shaderStageSlot, "fragment"]], () => core.resolve(ctx, [], shell.returnType, entryInput));
60
56
  },
61
57
  toString() {
62
58
  return `fragmentFn:${getName(core) ?? "<unnamed>"}`;
63
59
  }
64
60
  };
65
61
  }
66
-
67
62
  //#endregion
68
- export { fragmentFn, isTgpuFragmentFn };
63
+ export { fragmentFn, isTgpuFragmentFn };
@@ -3,6 +3,7 @@ import { $internal } from "../../shared/symbols.js";
3
3
  import { Prettify } from "../../shared/utilityTypes.js";
4
4
  import { AnyVertexInputBuiltin, AnyVertexOutputBuiltin, OmitBuiltins } from "../../builtin.js";
5
5
  import { BaseIOData, IORecord, InferIO } from "./fnTypes.js";
6
+ import { AnyAutoCustoms, AutoVertexOut, _AutoVertexIn } from "./autoIO.js";
6
7
  import { IOLayoutToSchema } from "./ioSchema.js";
7
8
  import { BaseData, Decorated, Interpolate, Location } from "../../data/wgslTypes.js";
8
9
  import { UndecorateRecord } from "../../data/dataTypes.js";
@@ -42,6 +43,9 @@ interface TgpuVertexFn<in VertexIn extends TgpuVertexFn.In = Record<string, neve
42
43
  declare namespace TgpuVertexFn {
43
44
  type In = BaseData | Record<string, BaseData>;
44
45
  type Out = Record<string, BaseData>;
46
+ type AutoIn<T> = _AutoVertexIn<T>;
47
+ type AutoOut<T extends AnyAutoCustoms = AnyAutoCustoms> = AutoVertexOut<T>;
48
+ type AutoInEmpty = _AutoVertexIn<Record<string, never>>;
45
49
  }
46
50
  declare function vertexFn<VertexOut extends VertexOutConstrained>(options: {
47
51
  out: VertexOut;