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/core/root/init.js CHANGED
@@ -23,6 +23,7 @@ import { INTERNAL_createComputePipeline } from "../pipeline/computePipeline.js";
23
23
  import { isVertexLayout } from "../vertexLayout/vertexLayout.js";
24
24
  import { INTERNAL_createRenderPipeline } from "../pipeline/renderPipeline.js";
25
25
  import { allEq } from "../../std/boolean.js";
26
+
26
27
  //#region src/core/root/init.ts
27
28
  /**
28
29
  * Changes the given array to a vec of 3 numbers, filling missing values with 1.
@@ -122,7 +123,7 @@ var WithBindingImpl = class WithBindingImpl {
122
123
  sizeUniform,
123
124
  wrappedCallback
124
125
  });
125
- return new TgpuGuardedComputePipelineImpl(root, this.createComputePipeline({ compute: mainCompute }), sizeUniform, workgroupSize);
126
+ return new TgpuGuardedComputePipelineImpl(root, (() => this.createComputePipeline({ compute: mainCompute }))(), sizeUniform, workgroupSize);
126
127
  }
127
128
  withVertex(entryFn, attribs) {
128
129
  return new WithVertexImpl(this.#getRoot(), this.#slotBindings, {
@@ -460,5 +461,6 @@ function initFromDevice(options) {
460
461
  const { device, unstable_names: names = "strict", unstable_logOptions } = options ?? {};
461
462
  return new TgpuRootImpl(device, names, false, unstable_logOptions ?? {}, options?.shaderGenerator);
462
463
  }
464
+
463
465
  //#endregion
464
- export { init, initFromDevice };
466
+ export { init, initFromDevice };
@@ -62,7 +62,7 @@ interface TgpuGuardedComputePipeline<TArgs extends number[] = number[]> extends
62
62
  interface WithCompute {
63
63
  createPipeline(): TgpuComputePipeline;
64
64
  }
65
- type OptionalArgs<T> = T extends Record<string, never> | undefined ? [] | [T] : [T];
65
+ type OptionalArgs<T$1> = T$1 extends Record<string, never> | undefined ? [] | [T$1] : [T$1];
66
66
  /**
67
67
  * TODO: Remove in favor of createRenderPipeline's validation
68
68
  */
@@ -100,9 +100,9 @@ interface WithFragment<Targets extends FragmentOutConstrained = FragmentOutConst
100
100
  createPipeline(): TgpuRenderPipeline<Targets>;
101
101
  }
102
102
  interface Withable<TSelf> {
103
- with<T>(slot: TgpuSlot<T>, value: Eventual<T>): TSelf;
104
- with<T extends BaseData>(accessor: TgpuAccessor<T>, value: TgpuAccessor.In<NoInfer<T>>): TSelf;
105
- with<T extends BaseData>(accessor: TgpuMutableAccessor<T>, value: TgpuMutableAccessor.In<NoInfer<T>>): TSelf;
103
+ with<T$1>(slot: TgpuSlot<T$1>, value: Eventual<T$1>): TSelf;
104
+ with<T$1 extends BaseData>(accessor: TgpuAccessor<T$1>, value: TgpuAccessor.In<NoInfer<T$1>>): TSelf;
105
+ with<T$1 extends BaseData>(accessor: TgpuMutableAccessor<T$1>, value: TgpuMutableAccessor.In<NoInfer<T$1>>): TSelf;
106
106
  }
107
107
  interface Withable_Deprecated<TSelf> {
108
108
  /**
@@ -110,19 +110,19 @@ interface Withable_Deprecated<TSelf> {
110
110
  * @param slot
111
111
  * @param value
112
112
  */
113
- with<T>(slot: TgpuSlot<T>, value: Eventual<T>): TSelf;
113
+ with<T$1>(slot: TgpuSlot<T$1>, value: Eventual<T$1>): TSelf;
114
114
  /**
115
115
  * @deprecated This feature is stable, remove the `['~unstable']`
116
116
  * @param slot
117
117
  * @param value
118
118
  */
119
- with<T extends BaseData>(accessor: TgpuAccessor<T>, value: TgpuAccessor.In<NoInfer<T>>): TSelf;
119
+ with<T$1 extends BaseData>(accessor: TgpuAccessor<T$1>, value: TgpuAccessor.In<NoInfer<T$1>>): TSelf;
120
120
  /**
121
121
  * @deprecated This feature is stable, remove the `['~unstable']`
122
122
  * @param slot
123
123
  * @param value
124
124
  */
125
- with<T extends BaseData>(accessor: TgpuMutableAccessor<T>, value: TgpuMutableAccessor.In<NoInfer<T>>): TSelf;
125
+ with<T$1 extends BaseData>(accessor: TgpuMutableAccessor<T$1>, value: TgpuMutableAccessor.In<NoInfer<T$1>>): TSelf;
126
126
  }
127
127
  interface Configurable extends Withable<Configurable> {
128
128
  readonly bindings: [slot: TgpuSlot<unknown>, value: unknown][];
@@ -134,9 +134,9 @@ interface Configurable extends Withable<Configurable> {
134
134
  * @example d.builtin.position => d.Void
135
135
  * @example { a: d.v4f, $fragDepth: number } => { a: d.Vec4f }
136
136
  */
137
- type NormalizeOutput<T> = T extends {
137
+ type NormalizeOutput<T$1> = T$1 extends {
138
138
  readonly [$internal]: unknown;
139
- } | number | boolean ? [OmitBuiltins<InstanceToSchema<T>>] extends [never] ? Void : OmitBuiltins<InstanceToSchema<T>> : { [K in keyof OmitBuiltins<T>]: InstanceToSchema<OmitBuiltins<T>[K]> };
139
+ } | number | boolean ? [OmitBuiltins<InstanceToSchema<T$1>>] extends [never] ? Void : OmitBuiltins<InstanceToSchema<T$1>> : { [K in keyof OmitBuiltins<T$1>]: InstanceToSchema<OmitBuiltins<T$1>[K]> };
140
140
  interface WithBinding extends Withable<WithBinding> {
141
141
  /** @deprecated Use `root.createComputePipeline` instead. */
142
142
  withCompute<ComputeIn extends IORecord<AnyComputeBuiltin>>(entryFn: TgpuComputeFn<ComputeIn>): WithCompute;
@@ -241,7 +241,7 @@ type SrgbVariants = {
241
241
  'astc-12x10-unorm': 'astc-12x10-unorm-srgb';
242
242
  'astc-12x12-unorm': 'astc-12x12-unorm-srgb';
243
243
  };
244
- type SrgbVariantOrSelf<T extends GPUTextureFormat> = T extends keyof SrgbVariants ? (SrgbVariants[T] | T)[] | undefined : T extends `${infer Base}-srgb` ? Base extends keyof SrgbVariants ? (T | SrgbVariants[Base])[] | undefined : T[] | undefined : T[] | undefined;
244
+ type SrgbVariantOrSelf<T$1 extends GPUTextureFormat> = T$1 extends keyof SrgbVariants ? (SrgbVariants[T$1] | T$1)[] | undefined : T$1 extends `${infer Base}-srgb` ? Base extends keyof SrgbVariants ? (T$1 | SrgbVariants[Base])[] | undefined : T$1[] | undefined : T$1[] | undefined;
245
245
  type CreateTextureOptions<TSize, TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormats extends GPUTextureFormat[], TDimension extends GPUTextureDimension> = {
246
246
  /**
247
247
  * The width, height, and depth or layer count of the texture.
@@ -561,7 +561,7 @@ interface TgpuRoot extends Unwrapper, WithBinding {
561
561
  * @param count The number of queries in the set.
562
562
  * @param rawQuerySet An optional pre-existing GPUQuerySet to use instead of creating a new one.
563
563
  */
564
- createQuerySet<T extends GPUQueryType>(type: T, count: number, rawQuerySet?: GPUQuerySet): TgpuQuerySet<T>;
564
+ createQuerySet<T$1 extends GPUQueryType>(type: T$1, count: number, rawQuerySet?: GPUQuerySet): TgpuQuerySet<T$1>;
565
565
  /**
566
566
  * Creates a group of resources that can be bound to a shader based on a specified layout.
567
567
  *
@@ -1,6 +1,10 @@
1
1
  import { TgpuNamable } from "../../shared/meta.js";
2
2
  import { $gpuValueOf, $internal } from "../../shared/symbols.js";
3
3
  import { WgslComparisonSampler, WgslSampler } from "../../data/sampler.js";
4
+ import "../../data/snippet.js";
5
+ import "../../unwrapper.js";
6
+ import "../../tgpuBindGroupLayout.js";
7
+ import "../../types.js";
4
8
  import { Infer } from "../../shared/repr.js";
5
9
 
6
10
  //#region src/core/sampler/sampler.d.ts
@@ -4,6 +4,7 @@ import { snip } from "../../data/snippet.js";
4
4
  import { inCodegenMode } from "../../execMode.js";
5
5
  import { valueProxyHandler } from "../valueProxyUtils.js";
6
6
  import { comparisonSampler, sampler } from "../../data/sampler.js";
7
+
7
8
  //#region src/core/sampler/sampler.ts
8
9
  function INTERNAL_createSampler(props, branch) {
9
10
  return new TgpuFixedSamplerImpl(sampler(), props, branch);
@@ -112,5 +113,6 @@ var TgpuFixedSamplerImpl = class {
112
113
  return `${this.resourceType}:${getName(this) ?? "<unnamed>"}`;
113
114
  }
114
115
  };
116
+
115
117
  //#endregion
116
- export { INTERNAL_createComparisonSampler, INTERNAL_createSampler, TgpuLaidOutSamplerImpl, isComparisonSampler, isSampler };
118
+ export { INTERNAL_createComparisonSampler, INTERNAL_createSampler, TgpuLaidOutSamplerImpl, isComparisonSampler, isSampler };
@@ -1,8 +1,9 @@
1
1
  import { SimulationState } from "../../types.js";
2
2
  import { getResolutionCtx, provideCtx } from "../../execMode.js";
3
3
  import { namespace } from "../resolve/namespace.js";
4
- import wgslGenerator from "../../tgsl/wgslGenerator.js";
4
+ import wgslGenerator_default from "../../tgsl/wgslGenerator.js";
5
5
  import { ResolutionCtxImpl } from "../../resolutionCtx.js";
6
+
6
7
  //#region src/core/simulate/tgpuSimulate.ts
7
8
  /**
8
9
  * Runs the provided callback in a simulated environment, giving
@@ -29,7 +30,7 @@ import { ResolutionCtxImpl } from "../../resolutionCtx.js";
29
30
  function simulate(callback) {
30
31
  const ctx = getResolutionCtx() ?? new ResolutionCtxImpl({
31
32
  namespace: namespace(),
32
- shaderGenerator: wgslGenerator
33
+ shaderGenerator: wgslGenerator_default
33
34
  });
34
35
  const workgroups = [
35
36
  1,
@@ -49,7 +50,7 @@ function simulate(callback) {
49
50
  const buffers = /* @__PURE__ */ new Map();
50
51
  const workgroupVars = Array.from({ length: workgroups[0] }, () => Array.from({ length: workgroups[1] }, () => Array.from({ length: workgroups[2] }, () => /* @__PURE__ */ new Map())));
51
52
  const privateVars = Array.from({ length: threads[0] }, () => Array.from({ length: threads[1] }, () => Array.from({ length: threads[2] }, () => /* @__PURE__ */ new Map())));
52
- const simStates = Array.from({ length: threads[0] }, (_, i) => Array.from({ length: threads[1] }, (_, j) => Array.from({ length: threads[2] }, (_, k) => {
53
+ const simStates = Array.from({ length: threads[0] }, (_, i) => Array.from({ length: threads[1] }, (_$1, j) => Array.from({ length: threads[2] }, (_$2, k) => {
53
54
  const wi = Math.floor(i / workgroupSize[0]);
54
55
  const wj = Math.floor(j / workgroupSize[1]);
55
56
  const wk = Math.floor(k / workgroupSize[2]);
@@ -70,5 +71,6 @@ function simulate(callback) {
70
71
  ctx.popMode("simulate");
71
72
  }
72
73
  }
74
+
73
75
  //#endregion
74
- export { simulate };
76
+ export { simulate };
@@ -1,5 +1,9 @@
1
+ import "../../data/snippet.js";
1
2
  import { TgpuAccessor, TgpuMutableAccessor } from "./slotTypes.js";
2
3
  import { UnwrapRuntimeConstructor } from "../../tgpuBindGroupLayout.js";
4
+ import "../../types.js";
5
+ import "../../data/wgslTypes.js";
6
+ import "../../shared/repr.js";
3
7
  import { AnyData } from "../../data/dataTypes.js";
4
8
 
5
9
  //#region src/core/slot/accessor.d.ts
@@ -8,6 +8,7 @@ import { schemaCallWrapper } from "../../data/schemaCallWrapper.js";
8
8
  import { getGpuValueRecursively, valueProxyHandler } from "../valueProxyUtils.js";
9
9
  import { isTgpuFn } from "../function/tgpuFn.js";
10
10
  import { slot } from "./slot.js";
11
+
11
12
  //#region src/core/slot/accessor.ts
12
13
  function accessor(schemaOrConstructor, defaultValue) {
13
14
  return new TgpuAccessorImpl(schemaOrConstructor, defaultValue);
@@ -91,5 +92,6 @@ var TgpuMutableAccessorImpl = class extends AccessorBase {
91
92
  throw new Error("`tgpu.mutableAccessor` relies on GPU resources and cannot be accessed outside of a compute dispatch or draw call");
92
93
  }
93
94
  };
95
+
94
96
  //#endregion
95
- export { accessor, mutableAccessor };
97
+ export { accessor, mutableAccessor };
@@ -1,5 +1,7 @@
1
1
  import { slot } from "./slot.js";
2
+
2
3
  //#region src/core/slot/internalSlots.ts
3
4
  const shaderStageSlot = slot(void 0);
5
+
4
6
  //#endregion
5
- export { shaderStageSlot };
7
+ export { shaderStageSlot };
package/core/slot/lazy.js CHANGED
@@ -2,6 +2,7 @@ import { $gpuValueOf, $internal, $providing } from "../../shared/symbols.js";
2
2
  import { isAccessor, isMutableAccessor } from "./slotTypes.js";
3
3
  import { getResolutionCtx } from "../../execMode.js";
4
4
  import { getGpuValueRecursively } from "../valueProxyUtils.js";
5
+
5
6
  //#region src/core/slot/lazy.ts
6
7
  function lazy(compute) {
7
8
  if (getResolutionCtx()) throw new Error("Cannot create tgpu.lazy objects during shader resolution.");
@@ -36,5 +37,6 @@ var TgpuLazyImpl = class TgpuLazyImpl {
36
37
  }
37
38
  };
38
39
  TgpuLazyImpl.prototype.resourceType = "lazy";
40
+
39
41
  //#endregion
40
- export { lazy };
42
+ export { lazy };
package/core/slot/slot.js CHANGED
@@ -2,6 +2,7 @@ import { $gpuValueOf, $internal } from "../../shared/symbols.js";
2
2
  import { getName, setName } from "../../shared/meta.js";
3
3
  import { getResolutionCtx } from "../../execMode.js";
4
4
  import { getGpuValueRecursively } from "../valueProxyUtils.js";
5
+
5
6
  //#region src/core/slot/slot.ts
6
7
  function slot(defaultValue) {
7
8
  return new TgpuSlotImpl(defaultValue);
@@ -35,5 +36,6 @@ var TgpuSlotImpl = class {
35
36
  return this.value;
36
37
  }
37
38
  };
39
+
38
40
  //#endregion
39
- export { slot };
41
+ export { slot };
@@ -1,4 +1,5 @@
1
1
  import { $providing } from "../../shared/symbols.js";
2
+
2
3
  //#region src/core/slot/slotTypes.ts
3
4
  function isSlot(value) {
4
5
  return value?.resourceType === "slot";
@@ -15,5 +16,6 @@ function isAccessor(value) {
15
16
  function isMutableAccessor(value) {
16
17
  return value?.resourceType === "mutable-accessor";
17
18
  }
19
+
18
20
  //#endregion
19
- export { isAccessor, isLazy, isMutableAccessor, isProviding, isSlot };
21
+ export { isAccessor, isLazy, isMutableAccessor, isProviding, isSlot };
@@ -1,3 +1,9 @@
1
+ import "../../data/snippet.js";
2
+ import "../../tgpuBindGroupLayout.js";
3
+ import "../../types.js";
4
+ import "../../data/texture.js";
5
+ import "../../shared/repr.js";
6
+
1
7
  //#region src/core/texture/externalTexture.d.ts
2
8
  interface TgpuExternalTexture {
3
9
  readonly resourceType: 'external-texture';
@@ -4,6 +4,7 @@ import { snip } from "../../data/snippet.js";
4
4
  import { inCodegenMode } from "../../execMode.js";
5
5
  import { valueProxyHandler } from "../valueProxyUtils.js";
6
6
  import { textureExternal } from "../../data/texture.js";
7
+
7
8
  //#region src/core/texture/externalTexture.ts
8
9
  var TgpuExternalTextureImpl = class {
9
10
  resourceType = "external-texture";
@@ -43,5 +44,6 @@ var TgpuExternalTextureImpl = class {
43
44
  return `textureExternal:${getName(this) ?? "<unnamed>"}`;
44
45
  }
45
46
  };
47
+
46
48
  //#endregion
47
- export { TgpuExternalTextureImpl };
49
+ export { TgpuExternalTextureImpl };
@@ -1,8 +1,12 @@
1
1
  import { TgpuNamable } from "../../shared/meta.js";
2
2
  import { $gpuValueOf, $internal } from "../../shared/symbols.js";
3
3
  import { Default, TypedArray, UnionToIntersection } from "../../shared/utilityTypes.js";
4
+ import "../../data/snippet.js";
4
5
  import { TextureProps } from "./textureProps.js";
5
6
  import { AllowedUsages, LiteralToExtensionMap } from "./usageExtension.js";
7
+ import "../../tgpuBindGroupLayout.js";
8
+ import "../root/rootTypes.js";
9
+ import "../../types.js";
6
10
  import { F32 } from "../../data/wgslTypes.js";
7
11
  import { TextureFormats, ViewDimensionToDimension } from "./textureFormats.js";
8
12
  import { TextureSchemaForDescriptor, WgslStorageTexture, WgslTexture } from "../../data/texture.js";
@@ -6,6 +6,7 @@ import { valueProxyHandler } from "../valueProxyUtils.js";
6
6
  import { isWgslStorageTexture, textureDescriptorToSchema } from "../../data/texture.js";
7
7
  import { getTextureFormatInfo } from "./textureFormats.js";
8
8
  import { generateTextureMipmaps, getImageSourceDimensions, resampleImage } from "./textureUtils.js";
9
+
9
10
  //#region src/core/texture/texture.ts
10
11
  function getDescriptorForProps(props) {
11
12
  return {
@@ -203,13 +204,13 @@ var TgpuFixedTextureViewImpl = class {
203
204
  this.#descriptor = descriptor;
204
205
  this[$internal] = { unwrap: () => {
205
206
  if (!this.#view) {
206
- const schema = this.schema;
207
- const format = isWgslStorageTexture(schema) ? schema.format : this.#baseTexture.props.format;
207
+ const schema$1 = this.schema;
208
+ const format = isWgslStorageTexture(schema$1) ? schema$1.format : this.#baseTexture.props.format;
208
209
  this.#view = this.#baseTexture[$internal].unwrap().createView({
209
210
  ...this.#descriptor,
210
211
  label: getName(this) ?? "<unnamed>",
211
212
  format: this.#descriptor?.format ?? format,
212
- dimension: schema.dimension
213
+ dimension: schema$1.dimension
213
214
  });
214
215
  }
215
216
  return this.#view;
@@ -310,5 +311,6 @@ var TgpuTextureRenderViewImpl = class {
310
311
  } };
311
312
  }
312
313
  };
314
+
313
315
  //#endregion
314
- export { INTERNAL_createTexture, TgpuLaidOutTextureViewImpl, isTexture, isTextureView };
316
+ export { INTERNAL_createTexture, TgpuLaidOutTextureViewImpl, isTexture, isTextureView };
@@ -1,5 +1,6 @@
1
1
  import { f32, i32, u32 } from "../../data/numeric.js";
2
2
  import { vec4f, vec4i, vec4u } from "../../data/vector.js";
3
+
3
4
  //#region src/core/texture/textureFormats.ts
4
5
  const DEPTH_ASPECT_NON_COPYABLE = {
5
6
  channelType: f32,
@@ -93,5 +94,6 @@ function getEffectiveSampleTypes(device, format) {
93
94
  if (FLOAT32_FORMATS.has(format) && !device.features.has("float32-filterable")) return ["unfilterable-float"];
94
95
  return getTextureFormatInfo(format).sampleTypes;
95
96
  }
97
+
96
98
  //#endregion
97
- export { getEffectiveSampleTypes, getTextureFormatInfo };
99
+ export { getEffectiveSampleTypes, getTextureFormatInfo };
@@ -1,4 +1,5 @@
1
1
  import { getEffectiveSampleTypes, getTextureFormatInfo } from "./textureFormats.js";
2
+
2
3
  //#region src/core/texture/textureUtils.ts
3
4
  function getImageSourceDimensions(source) {
4
5
  const { videoWidth, videoHeight } = source;
@@ -218,5 +219,6 @@ function resampleImage(device, targetTexture, image, layer = 0) {
218
219
  inputTexture.destroy();
219
220
  renderTexture.destroy();
220
221
  }
222
+
221
223
  //#endregion
222
- export { clearTextureUtilsCache, generateTextureMipmaps, getImageSourceDimensions, resampleImage };
224
+ export { clearTextureUtilsCache, generateTextureMipmaps, getImageSourceDimensions, resampleImage };
@@ -1,4 +1,5 @@
1
1
  import { getName } from "../../shared/meta.js";
2
+
2
3
  //#region src/core/texture/usageExtension.ts
3
4
  function isUsableAsSampled(value) {
4
5
  return !!value?.usableAsSampled;
@@ -15,5 +16,6 @@ var NotSampledError = class NotSampledError extends Error {
15
16
  Object.setPrototypeOf(this, NotSampledError.prototype);
16
17
  }
17
18
  };
19
+
18
20
  //#endregion
19
- export { NotSampledError, isUsableAsRender, isUsableAsSampled };
21
+ export { NotSampledError, isUsableAsRender, isUsableAsSampled };
@@ -1,7 +1,9 @@
1
1
  import { $internal } from "../../shared/symbols.js";
2
+ import "../../data/snippet.js";
2
3
  import { GPUCallable } from "../../types.js";
3
4
 
4
5
  //#region src/core/unroll/tgpuUnroll.d.ts
6
+
5
7
  /**
6
8
  * Marks an iterable to be unrolled by the shader generator when used in a for loop.
7
9
  *
@@ -61,7 +63,7 @@ import { GPUCallable } from "../../types.js";
61
63
  * }
62
64
  * ```
63
65
  */
64
- declare const unroll: (<T extends Iterable<unknown>>(iterable: T) => T) & GPUCallable & {
66
+ declare const unroll: (<T extends Iterable<unknown>>(iterable: T) => T) & GPUCallable<[iterable: Iterable<unknown>]> & {
65
67
  [$internal]: true;
66
68
  };
67
69
  //#endregion
@@ -2,6 +2,7 @@ import { $gpuCallable, $internal, $resolve } from "../../shared/symbols.js";
2
2
  import { setName } from "../../shared/meta.js";
3
3
  import { snip } from "../../data/snippet.js";
4
4
  import { stitch } from "../resolve/stitch.js";
5
+
5
6
  //#region src/core/unroll/tgpuUnroll.ts
6
7
  /**
7
8
  * The result of calling `tgpu.unroll(...)`. The code responsible for
@@ -90,5 +91,6 @@ const unroll = (() => {
90
91
  } };
91
92
  return impl;
92
93
  })();
94
+
93
95
  //#endregion
94
- export { UnrollableIterable, unroll };
96
+ export { UnrollableIterable, unroll };
@@ -3,6 +3,7 @@ import { getOwnSnippet } from "../types.js";
3
3
  import { getGPUValue } from "../getGPUValue.js";
4
4
  import { accessProp } from "../tgsl/accessProp.js";
5
5
  import { accessIndex } from "../tgsl/accessIndex.js";
6
+
6
7
  //#region src/core/valueProxyUtils.ts
7
8
  const valueProxyHandler = { get(target, prop) {
8
9
  if (prop in target) return Reflect.get(target, prop);
@@ -11,12 +12,12 @@ const valueProxyHandler = { get(target, prop) {
11
12
  const targetSnippet = getOwnSnippet(target);
12
13
  const index = Number(prop);
13
14
  if (!Number.isNaN(index)) {
14
- const accessed = accessIndex(targetSnippet, index);
15
- if (!accessed) return;
15
+ const accessed$1 = accessIndex(targetSnippet, index);
16
+ if (!accessed$1) return;
16
17
  return new Proxy({
17
18
  [$internal]: true,
18
- [$resolve]: (ctx) => ctx.resolve(accessed.value, accessed.dataType),
19
- [$ownSnippet]: accessed,
19
+ [$resolve]: (ctx) => ctx.resolve(accessed$1.value, accessed$1.dataType),
20
+ [$ownSnippet]: accessed$1,
20
21
  toString: () => `${String(target)}[${prop}]`
21
22
  }, valueProxyHandler);
22
23
  }
@@ -38,5 +39,6 @@ function getGpuValueRecursively(value) {
38
39
  }
39
40
  return unwrapped;
40
41
  }
42
+
41
43
  //#endregion
42
- export { getGpuValueRecursively, valueProxyHandler };
44
+ export { getGpuValueRecursively, valueProxyHandler };
@@ -15,7 +15,9 @@ interface TgpuVar<TScope extends VariableScope = VariableScope, TDataType extend
15
15
  value: InferGPU<TDataType>;
16
16
  $: InferGPU<TDataType>;
17
17
  readonly [$internal]: {
18
- /** Makes it differentiable on the type level. Does not exist at runtime. */dataType?: TDataType; /** Makes it differentiable on the type level. Does not exist at runtime. */
18
+ /** Makes it differentiable on the type level. Does not exist at runtime. */
19
+ dataType?: TDataType;
20
+ /** Makes it differentiable on the type level. Does not exist at runtime. */
19
21
  scope?: TScope;
20
22
  };
21
23
  }
@@ -6,6 +6,7 @@ import { IllegalVarAccessError } from "../../errors.js";
6
6
  import { getExecMode, isInsideTgpuFn } from "../../execMode.js";
7
7
  import { assertExhaustive } from "../../shared/utilityTypes.js";
8
8
  import { valueProxyHandler } from "../valueProxyUtils.js";
9
+
9
10
  //#region src/core/variable/tgpuVariable.ts
10
11
  /**
11
12
  * Defines a variable scoped to each entry function (private).
@@ -95,5 +96,6 @@ var TgpuVarImpl = class {
95
96
  this.$ = v;
96
97
  }
97
98
  };
99
+
98
100
  //#endregion
99
- export { isVariable, privateVar, workgroupVar };
101
+ export { isVariable, privateVar, workgroupVar };
@@ -1,5 +1,6 @@
1
1
  import { getCustomLocation, isData } from "../../data/dataTypes.js";
2
2
  import { isBuiltin } from "../../data/attributes.js";
3
+
3
4
  //#region src/core/vertexLayout/connectAttributesToShader.ts
4
5
  function isAttribute(value) {
5
6
  return typeof value?.format === "string";
@@ -53,5 +54,6 @@ function connectAttributesToShader(shaderInputLayout, attributes) {
53
54
  bufferDefinitions
54
55
  };
55
56
  }
57
+
56
58
  //#endregion
57
- export { connectAttributesToShader, isAttribute };
59
+ export { connectAttributesToShader, isAttribute };
@@ -4,6 +4,7 @@ import { Decorated, WgslArray, WgslStruct } from "../../data/wgslTypes.js";
4
4
  import { Disarray, LooseDecorated, Unstruct } from "../../data/dataTypes.js";
5
5
 
6
6
  //#region src/core/vertexLayout/vertexAttribute.d.ts
7
+
7
8
  /**
8
9
  * The array can hold T, where T is a single/multi-component numeric, or a struct with members of type T.
9
10
  * Examples of valid array members:
@@ -6,6 +6,7 @@ import { getCustomLocation, isLooseDecorated, isUnstruct } from "../../data/data
6
6
  import { alignmentOf, customAlignmentOf } from "../../data/alignmentOf.js";
7
7
  import { roundUp } from "../../mathUtils.js";
8
8
  import { sizeOf } from "../../data/sizeOf.js";
9
+
9
10
  //#region src/core/vertexLayout/vertexLayout.ts
10
11
  function vertexLayout(schemaForCount, stepMode = "vertex") {
11
12
  return new TgpuVertexLayoutImpl(schemaForCount, stepMode);
@@ -23,9 +24,9 @@ function dataToContainedAttribs(layout, data, offset, customLocationMap, key) {
23
24
  if (isWgslStruct(data)) {
24
25
  let memberOffset = offset;
25
26
  const propTypes = data.propTypes;
26
- return Object.fromEntries(Object.entries(propTypes).map(([key, value]) => {
27
+ return Object.fromEntries(Object.entries(propTypes).map(([key$1, value]) => {
27
28
  memberOffset = roundUp(memberOffset, alignmentOf(value));
28
- const attrib = [key, dataToContainedAttribs(layout, value, memberOffset, customLocationMap, key)];
29
+ const attrib = [key$1, dataToContainedAttribs(layout, value, memberOffset, customLocationMap, key$1)];
29
30
  memberOffset += sizeOf(value);
30
31
  return attrib;
31
32
  }));
@@ -33,9 +34,9 @@ function dataToContainedAttribs(layout, data, offset, customLocationMap, key) {
33
34
  if (isUnstruct(data)) {
34
35
  let memberOffset = offset;
35
36
  const propTypes = data.propTypes;
36
- return Object.fromEntries(Object.entries(propTypes).map(([key, value]) => {
37
+ return Object.fromEntries(Object.entries(propTypes).map(([key$1, value]) => {
37
38
  memberOffset = roundUp(memberOffset, customAlignmentOf(value));
38
- const attrib = [key, dataToContainedAttribs(layout, value, memberOffset, customLocationMap, key)];
39
+ const attrib = [key$1, dataToContainedAttribs(layout, value, memberOffset, customLocationMap, key$1)];
39
40
  memberOffset += sizeOf(value);
40
41
  return attrib;
41
42
  }));
@@ -99,5 +100,6 @@ var TgpuVertexLayoutImpl = class {
99
100
  return this;
100
101
  }
101
102
  };
103
+
102
104
  //#endregion
103
- export { isVertexLayout, vertexLayout };
105
+ export { isVertexLayout, vertexLayout };
package/data/alignIO.js CHANGED
@@ -10,5 +10,7 @@ function alignIO(io, baseAlignment) {
10
10
  if ("skipBytes" in io) io.skipBytes(baseAlignment - offset & bitMask);
11
11
  else io.add(baseAlignment - offset & bitMask);
12
12
  }
13
+ var alignIO_default = alignIO;
14
+
13
15
  //#endregion
14
- export { alignIO as default };
16
+ export { alignIO_default as default };
@@ -1,6 +1,8 @@
1
+ import "./wgslTypes.js";
1
2
  import { AnyData } from "./dataTypes.js";
2
3
 
3
4
  //#region src/data/alignmentOf.d.ts
5
+
4
6
  /**
5
7
  * Returns the alignment (in bytes) of data represented by the `schema`.
6
8
  */
@@ -2,6 +2,7 @@ import { isDecorated, isWgslArray, isWgslStruct } from "./wgslTypes.js";
2
2
  import { getCustomAlignment, isDisarray, isLooseDecorated, isUnstruct } from "./dataTypes.js";
3
3
  import { safeStringify } from "../shared/stringify.js";
4
4
  import { packedFormats } from "./vertexFormatData.js";
5
+
5
6
  //#region src/data/alignmentOf.ts
6
7
  const knownAlignmentMap = {
7
8
  f32: 4,
@@ -82,5 +83,6 @@ function customAlignmentOf(data) {
82
83
  function PUBLIC_alignmentOf(schema) {
83
84
  return alignmentOf(schema);
84
85
  }
86
+
85
87
  //#endregion
86
- export { PUBLIC_alignmentOf, alignmentOf, customAlignmentOf };
88
+ export { PUBLIC_alignmentOf, alignmentOf, customAlignmentOf };
package/data/array.js CHANGED
@@ -2,6 +2,7 @@ import { $internal } from "../shared/symbols.js";
2
2
  import { schemaCallWrapper } from "./schemaCallWrapper.js";
3
3
  import { sizeOf } from "./sizeOf.js";
4
4
  import { comptime } from "../core/function/comptime.js";
5
+
5
6
  //#region src/data/array.ts
6
7
  /**
7
8
  * Creates an array schema that can be used to construct gpu buffers.
@@ -42,5 +43,6 @@ const WgslArrayImpl = {
42
43
  return `arrayOf(${String(this.elementType)}, ${this.elementCount})`;
43
44
  }
44
45
  };
46
+
45
47
  //#endregion
46
- export { arrayOf };
48
+ export { arrayOf };
package/data/atomic.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Atomic, I32, U32 } from "./wgslTypes.js";
2
2
 
3
3
  //#region src/data/atomic.d.ts
4
+
4
5
  /**
5
6
  * Marks a concrete integer scalar type schema (u32 or i32) as a WGSL atomic.
6
7
  *
package/data/atomic.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { $internal } from "../shared/symbols.js";
2
+
2
3
  //#region src/data/atomic.ts
3
4
  /**
4
5
  * Marks a concrete integer scalar type schema (u32 or i32) as a WGSL atomic.
@@ -20,5 +21,6 @@ var AtomicImpl = class {
20
21
  this.inner = inner;
21
22
  }
22
23
  };
24
+
23
25
  //#endregion
24
- export { atomic };
26
+ export { atomic };