typegpu 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/{chunk-BYypO7fO.js → _virtual/_rolldown/runtime.js} +1 -1
  2. package/builtin.d.ts +50 -0
  3. package/builtin.js +37 -0
  4. package/common/fullScreenTriangle.d.ts +26 -0
  5. package/common/fullScreenTriangle.js +36 -0
  6. package/common/index.d.ts +2 -3
  7. package/common/index.js +3 -4
  8. package/core/buffer/buffer.d.ts +74 -0
  9. package/core/buffer/buffer.js +197 -0
  10. package/core/buffer/bufferShorthand.d.ts +48 -0
  11. package/core/buffer/bufferShorthand.js +49 -0
  12. package/core/buffer/bufferUsage.d.ts +45 -0
  13. package/core/buffer/bufferUsage.js +163 -0
  14. package/core/constant/tgpuConstant.d.ts +28 -0
  15. package/core/constant/tgpuConstant.js +67 -0
  16. package/core/declare/tgpuDeclare.d.ts +18 -0
  17. package/core/declare/tgpuDeclare.js +40 -0
  18. package/core/function/autoIO.d.ts +37 -0
  19. package/core/function/autoIO.js +87 -0
  20. package/core/function/comptime.d.ts +39 -0
  21. package/core/function/comptime.js +51 -0
  22. package/core/function/createCallableSchema.js +42 -0
  23. package/core/function/dualImpl.js +54 -0
  24. package/core/function/extractArgs.js +204 -0
  25. package/core/function/fnCore.js +79 -0
  26. package/core/function/fnTypes.d.ts +34 -0
  27. package/core/function/ioSchema.d.ts +10 -0
  28. package/core/function/ioSchema.js +30 -0
  29. package/core/function/shelllessImpl.d.ts +28 -0
  30. package/core/function/shelllessImpl.js +23 -0
  31. package/core/function/templateUtils.js +13 -0
  32. package/core/function/tgpuComputeFn.d.ts +49 -0
  33. package/core/function/tgpuComputeFn.js +62 -0
  34. package/core/function/tgpuFn.d.ts +52 -0
  35. package/core/function/tgpuFn.js +170 -0
  36. package/core/function/tgpuFragmentFn.d.ts +68 -0
  37. package/core/function/tgpuFragmentFn.js +68 -0
  38. package/core/function/tgpuVertexFn.d.ts +55 -0
  39. package/core/function/tgpuVertexFn.js +65 -0
  40. package/core/pipeline/applyPipelineState.js +37 -0
  41. package/core/pipeline/computePipeline.d.ts +58 -0
  42. package/core/pipeline/computePipeline.js +226 -0
  43. package/core/pipeline/connectAttachmentToShader.js +26 -0
  44. package/core/pipeline/connectTargetsToShader.js +29 -0
  45. package/core/pipeline/limitsOverflow.js +13 -0
  46. package/core/pipeline/renderPipeline.d.ts +266 -0
  47. package/core/pipeline/renderPipeline.js +471 -0
  48. package/core/pipeline/timeable.d.ts +23 -0
  49. package/core/pipeline/timeable.js +61 -0
  50. package/core/pipeline/typeGuards.js +29 -0
  51. package/core/querySet/querySet.d.ts +22 -0
  52. package/core/querySet/querySet.js +103 -0
  53. package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +59 -0
  54. package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +96 -0
  55. package/core/resolve/externals.d.ts +10 -0
  56. package/core/resolve/externals.js +58 -0
  57. package/core/resolve/namespace.d.ts +38 -0
  58. package/core/resolve/namespace.js +41 -0
  59. package/core/resolve/resolveData.js +146 -0
  60. package/core/resolve/stitch.js +25 -0
  61. package/core/resolve/tgpuResolve.d.ts +151 -0
  62. package/core/resolve/tgpuResolve.js +68 -0
  63. package/core/root/configurableImpl.js +18 -0
  64. package/core/root/init.d.ts +69 -0
  65. package/core/root/init.js +457 -0
  66. package/core/root/rootTypes.d.ts +622 -0
  67. package/core/sampler/sampler.d.ts +35 -0
  68. package/core/sampler/sampler.js +116 -0
  69. package/core/simulate/tgpuSimulate.d.ts +36 -0
  70. package/core/simulate/tgpuSimulate.js +76 -0
  71. package/core/slot/accessor.d.ts +13 -0
  72. package/core/slot/accessor.js +97 -0
  73. package/core/slot/internalSlots.js +7 -0
  74. package/core/slot/lazy.d.ts +6 -0
  75. package/core/slot/lazy.js +42 -0
  76. package/core/slot/slot.d.ts +6 -0
  77. package/core/slot/slot.js +40 -0
  78. package/core/slot/slotTypes.d.ts +92 -0
  79. package/core/slot/slotTypes.js +21 -0
  80. package/core/texture/externalTexture.d.ts +12 -0
  81. package/core/texture/externalTexture.js +48 -0
  82. package/core/texture/texture.d.ts +118 -0
  83. package/core/texture/texture.js +312 -0
  84. package/core/texture/textureFormats.d.ts +29 -0
  85. package/core/texture/textureFormats.js +99 -0
  86. package/core/texture/textureProps.d.ts +11 -0
  87. package/core/texture/textureUtils.js +224 -0
  88. package/core/texture/usageExtension.d.ts +21 -0
  89. package/core/texture/usageExtension.js +21 -0
  90. package/core/unroll/tgpuUnroll.d.ts +13 -0
  91. package/core/unroll/tgpuUnroll.js +36 -0
  92. package/core/valueProxyUtils.js +44 -0
  93. package/core/variable/tgpuVariable.d.ts +38 -0
  94. package/core/variable/tgpuVariable.js +101 -0
  95. package/core/vertexLayout/connectAttributesToShader.js +59 -0
  96. package/core/vertexLayout/vertexAttribute.d.ts +29 -0
  97. package/core/vertexLayout/vertexLayout.d.ts +19 -0
  98. package/core/vertexLayout/vertexLayout.js +103 -0
  99. package/data/alignIO.js +15 -0
  100. package/data/alignmentOf.d.ts +10 -0
  101. package/data/alignmentOf.js +88 -0
  102. package/data/array.d.ts +28 -0
  103. package/data/array.js +48 -0
  104. package/data/atomic.d.ts +15 -0
  105. package/data/atomic.js +25 -0
  106. package/data/attributes.d.ts +121 -0
  107. package/data/attributes.js +145 -0
  108. package/data/autoStruct.d.ts +3 -0
  109. package/data/autoStruct.js +83 -0
  110. package/data/compiledIO.js +231 -0
  111. package/data/dataIO.js +549 -0
  112. package/data/dataTypes.d.ts +115 -0
  113. package/data/dataTypes.js +97 -0
  114. package/data/deepEqual.d.ts +25 -0
  115. package/data/deepEqual.js +58 -0
  116. package/data/disarray.d.ts +34 -0
  117. package/data/disarray.js +52 -0
  118. package/data/getLongestContiguousPrefix.d.ts +10 -0
  119. package/data/getLongestContiguousPrefix.js +15 -0
  120. package/data/index.d.ts +26 -4
  121. package/data/index.js +27 -7
  122. package/data/instanceToSchema.d.ts +33 -0
  123. package/data/isContiguous.d.ts +10 -0
  124. package/data/isContiguous.js +15 -0
  125. package/data/matrix.d.ts +126 -0
  126. package/data/matrix.js +517 -0
  127. package/data/numberOps.js +24 -0
  128. package/data/numeric.d.ts +81 -0
  129. package/data/numeric.js +234 -0
  130. package/data/offsetUtils.d.ts +33 -0
  131. package/data/offsetUtils.js +167 -0
  132. package/data/offsets.js +36 -0
  133. package/data/partialIO.js +68 -0
  134. package/data/ptr.d.ts +12 -0
  135. package/data/ptr.js +46 -0
  136. package/data/ref.d.ts +37 -0
  137. package/data/ref.js +96 -0
  138. package/data/sampler.d.ts +107 -0
  139. package/data/sampler.js +26 -0
  140. package/data/schemaCallWrapper.js +32 -0
  141. package/data/schemaMemoryLayout.js +200 -0
  142. package/data/sizeOf.d.ts +10 -0
  143. package/data/sizeOf.js +15 -0
  144. package/data/snippet.d.ts +26 -0
  145. package/data/snippet.js +61 -0
  146. package/data/struct.d.ts +17 -0
  147. package/data/struct.js +46 -0
  148. package/data/texture.d.ts +292 -0
  149. package/{texture-BagDrrks.js → data/texture.js} +6 -3
  150. package/data/unstruct.d.ts +24 -0
  151. package/data/unstruct.js +43 -0
  152. package/data/vector.d.ts +191 -0
  153. package/data/vector.js +247 -0
  154. package/data/vectorImpl.js +516 -0
  155. package/data/vectorOps.js +664 -0
  156. package/data/vertexFormatData.d.ts +190 -0
  157. package/data/vertexFormatData.js +110 -0
  158. package/data/wgslTypes.d.ts +896 -0
  159. package/data/wgslTypes.js +215 -0
  160. package/errors.d.ts +44 -0
  161. package/errors.js +128 -0
  162. package/execMode.js +51 -0
  163. package/extension.d.ts +11 -0
  164. package/extension.js +18 -0
  165. package/getGPUValue.js +9 -0
  166. package/index.d.ts +40 -243
  167. package/index.js +19 -6318
  168. package/indexNamedExports.d.ts +38 -0
  169. package/mathUtils.js +13 -0
  170. package/memo.js +22 -0
  171. package/nameRegistry.d.ts +30 -0
  172. package/nameRegistry.js +449 -0
  173. package/package.js +5 -0
  174. package/package.json +23 -23
  175. package/resolutionCtx.d.ts +29 -0
  176. package/resolutionCtx.js +546 -0
  177. package/shared/env.js +13 -0
  178. package/shared/generators.js +14 -0
  179. package/shared/meta.d.ts +39 -0
  180. package/shared/meta.js +63 -0
  181. package/shared/repr.d.ts +108 -0
  182. package/shared/stringify.js +22 -0
  183. package/shared/symbols.d.ts +61 -0
  184. package/shared/symbols.js +71 -0
  185. package/shared/utilityTypes.d.ts +29 -0
  186. package/shared/utilityTypes.js +7 -0
  187. package/shared/vertexFormat.d.ts +70 -0
  188. package/shared/vertexFormat.js +64 -0
  189. package/std/array.d.ts +7 -0
  190. package/std/array.js +27 -0
  191. package/std/atomic.d.ts +19 -0
  192. package/std/atomic.js +113 -0
  193. package/std/bitcast.d.ts +10 -0
  194. package/std/bitcast.js +43 -0
  195. package/std/boolean.d.ts +127 -0
  196. package/std/boolean.js +274 -0
  197. package/std/derivative.d.ts +16 -0
  198. package/std/derivative.js +89 -0
  199. package/std/discard.d.ts +6 -0
  200. package/std/discard.js +16 -0
  201. package/std/extensions.d.ts +8 -0
  202. package/std/extensions.js +14 -0
  203. package/std/index.d.ts +15 -3
  204. package/std/index.js +16 -5
  205. package/std/matrix.d.ts +41 -0
  206. package/std/matrix.js +87 -0
  207. package/std/numeric.d.ts +254 -0
  208. package/std/numeric.js +847 -0
  209. package/std/operators.d.ts +48 -0
  210. package/std/operators.js +153 -0
  211. package/std/packing.d.ts +26 -0
  212. package/std/packing.js +86 -0
  213. package/std/subgroup.d.ts +47 -0
  214. package/std/subgroup.js +220 -0
  215. package/std/texture.d.ts +108 -0
  216. package/std/texture.js +197 -0
  217. package/tgpu.js +44 -0
  218. package/tgpuBindGroupLayout.d.ts +161 -0
  219. package/tgpuBindGroupLayout.js +271 -0
  220. package/tgpuUnstable.d.ts +48 -0
  221. package/tgpuUnstable.js +66 -0
  222. package/tgsl/accessIndex.js +45 -0
  223. package/tgsl/accessProp.js +113 -0
  224. package/tgsl/consoleLog/deserializers.js +117 -0
  225. package/tgsl/consoleLog/logGenerator.js +86 -0
  226. package/tgsl/consoleLog/serializers.js +225 -0
  227. package/tgsl/consoleLog/types.d.ts +54 -0
  228. package/tgsl/consoleLog/types.js +12 -0
  229. package/tgsl/conversion.js +200 -0
  230. package/tgsl/forOfUtils.js +45 -0
  231. package/tgsl/generationHelpers.d.ts +37 -0
  232. package/tgsl/generationHelpers.js +67 -0
  233. package/tgsl/math.js +45 -0
  234. package/tgsl/shaderGenerator.d.ts +18 -0
  235. package/tgsl/shellless.d.ts +11 -0
  236. package/tgsl/shellless.js +53 -0
  237. package/tgsl/wgslGenerator.js +585 -0
  238. package/types.d.ts +255 -0
  239. package/types.js +43 -0
  240. package/unwrapper.d.ts +27 -0
  241. package/wgslExtensions.d.ts +5 -0
  242. package/wgslExtensions.js +18 -0
  243. package/builtin-DdtWpk2t.js +0 -818
  244. package/builtin-DdtWpk2t.js.map +0 -1
  245. package/common/index.d.ts.map +0 -1
  246. package/common/index.js.map +0 -1
  247. package/data/index.d.ts.map +0 -1
  248. package/data/index.js.map +0 -1
  249. package/deepEqual-DQxK4vdp.js +0 -413
  250. package/deepEqual-DQxK4vdp.js.map +0 -1
  251. package/extensions-DIVuAfBM.js +0 -2032
  252. package/extensions-DIVuAfBM.js.map +0 -1
  253. package/fullScreenTriangle-CfFyQd_0.js +0 -543
  254. package/fullScreenTriangle-CfFyQd_0.js.map +0 -1
  255. package/index.d.ts.map +0 -1
  256. package/index.js.map +0 -1
  257. package/indexNamedExports-oL6tyaJ9.d.ts +0 -5697
  258. package/indexNamedExports-oL6tyaJ9.d.ts.map +0 -1
  259. package/operators-d-PMVTo7.js +0 -4158
  260. package/operators-d-PMVTo7.js.map +0 -1
  261. package/std/index.d.ts.map +0 -1
  262. package/std/index.js.map +0 -1
  263. package/texture-BagDrrks.js.map +0 -1
@@ -0,0 +1,271 @@
1
+ import { $gpuValueOf, $internal } from "./shared/symbols.js";
2
+ import { getName, setName } from "./shared/meta.js";
3
+ import { NotUniformError } from "./errors.js";
4
+ import { safeStringify } from "./shared/stringify.js";
5
+ import { f32, i32, u32 } from "./data/numeric.js";
6
+ import { comparisonSampler, sampler } from "./data/sampler.js";
7
+ import { textureDescriptorToSchema } from "./data/texture.js";
8
+ import { NotStorageError, isUsableAsStorage } from "./extension.js";
9
+ import { TgpuLaidOutBufferImpl, isUsableAsUniform } from "./core/buffer/bufferUsage.js";
10
+ import { isBuffer } from "./core/buffer/buffer.js";
11
+ import { TgpuLaidOutSamplerImpl, isComparisonSampler, isSampler } from "./core/sampler/sampler.js";
12
+ import { TgpuExternalTextureImpl } from "./core/texture/externalTexture.js";
13
+ import { TgpuLaidOutTextureViewImpl, isTexture, isTextureView } from "./core/texture/texture.js";
14
+ import { NotSampledError, isUsableAsSampled } from "./core/texture/usageExtension.js";
15
+
16
+ //#region src/tgpuBindGroupLayout.ts
17
+ /**
18
+ * Converts legacy entries to new API format
19
+ */
20
+ function convertLegacyEntries(entries) {
21
+ const result = {};
22
+ for (const [key, entry] of Object.entries(entries)) {
23
+ if (entry === null) {
24
+ result[key] = null;
25
+ continue;
26
+ }
27
+ if ("texture" in entry && typeof entry.texture === "string") {
28
+ const sampleType = entry.texture;
29
+ result[key] = {
30
+ ...entry,
31
+ texture: textureDescriptorToSchema({
32
+ dimension: entry.viewDimension ?? "2d",
33
+ sampleType: sampleType === "sint" ? i32 : sampleType === "uint" ? u32 : f32,
34
+ multisampled: entry.multisampled ?? false
35
+ })
36
+ };
37
+ } else if ("storageTexture" in entry && typeof entry.storageTexture === "string") {
38
+ const accessMap = {
39
+ readonly: "read-only",
40
+ writeonly: "write-only",
41
+ mutable: "read-write"
42
+ };
43
+ result[key] = {
44
+ ...entry,
45
+ storageTexture: textureDescriptorToSchema({
46
+ access: accessMap[entry.access ?? "writeonly"],
47
+ format: entry.storageTexture,
48
+ dimension: entry.viewDimension ?? "2d"
49
+ })
50
+ };
51
+ } else if ("externalTexture" in entry && Object.keys(entry.externalTexture).length === 0) result[key] = {
52
+ ...entry,
53
+ externalTexture: {
54
+ type: "texture_external",
55
+ dimension: "2d"
56
+ }
57
+ };
58
+ else result[key] = entry;
59
+ }
60
+ return result;
61
+ }
62
+ function bindGroupLayout(entries) {
63
+ return new TgpuBindGroupLayoutImpl(convertLegacyEntries(entries));
64
+ }
65
+ function isBindGroupLayout(value) {
66
+ return !!value && value.resourceType === "bind-group-layout";
67
+ }
68
+ function isBindGroup(value) {
69
+ return !!value && value.resourceType === "bind-group";
70
+ }
71
+ /**
72
+ * @category Errors
73
+ */
74
+ var MissingBindingError = class MissingBindingError extends Error {
75
+ constructor(groupLabel, key) {
76
+ super(`Bind group '${groupLabel ?? "<unnamed>"}' is missing a required binding '${key}'`);
77
+ Object.setPrototypeOf(this, MissingBindingError.prototype);
78
+ }
79
+ };
80
+ const DEFAULT_MUTABLE_VISIBILITY = ["compute", "fragment"];
81
+ const DEFAULT_READONLY_VISIBILITY = [
82
+ "compute",
83
+ "vertex",
84
+ "fragment"
85
+ ];
86
+ var TgpuBindGroupLayoutImpl = class {
87
+ [$internal];
88
+ _index;
89
+ resourceType = "bind-group-layout";
90
+ value = {};
91
+ $ = this.value;
92
+ get [$gpuValueOf]() {
93
+ return this.$;
94
+ }
95
+ constructor(entries) {
96
+ this.entries = entries;
97
+ let idx = 0;
98
+ const bound = {};
99
+ this[$internal] = { bound };
100
+ for (const [key, entry] of Object.entries(entries)) {
101
+ if (entry === null) {
102
+ idx++;
103
+ continue;
104
+ }
105
+ const membership = {
106
+ layout: this,
107
+ key,
108
+ idx
109
+ };
110
+ if ("uniform" in entry) bound[key] = new TgpuLaidOutBufferImpl("uniform", entry.uniform, membership);
111
+ if ("storage" in entry) {
112
+ const dataType = "type" in entry.storage ? entry.storage : entry.storage(0);
113
+ bound[key] = new TgpuLaidOutBufferImpl(entry.access ?? "readonly", dataType, membership);
114
+ }
115
+ if ("texture" in entry) bound[key] = new TgpuLaidOutTextureViewImpl(entry.texture, membership);
116
+ if ("storageTexture" in entry) bound[key] = new TgpuLaidOutTextureViewImpl(entry.storageTexture, membership);
117
+ if ("externalTexture" in entry) bound[key] = new TgpuExternalTextureImpl(entry.externalTexture, membership);
118
+ if ("sampler" in entry) bound[key] = new TgpuLaidOutSamplerImpl(entry.sampler === "comparison" ? comparisonSampler() : sampler(), membership);
119
+ Object.defineProperty(this.value, key, { get: () => {
120
+ return bound[key].value;
121
+ } });
122
+ idx++;
123
+ }
124
+ }
125
+ toString() {
126
+ return `bindGroupLayout:${getName(this) ?? "<unnamed>"}`;
127
+ }
128
+ get index() {
129
+ return this._index;
130
+ }
131
+ $name(label) {
132
+ setName(this, label);
133
+ return this;
134
+ }
135
+ get bound() {
136
+ return this[$internal].bound;
137
+ }
138
+ $idx(index) {
139
+ this._index = index;
140
+ return this;
141
+ }
142
+ unwrap(unwrapper) {
143
+ return unwrapper.device.createBindGroupLayout({
144
+ label: getName(this) ?? "<unnamed>",
145
+ entries: Object.values(this.entries).map((entry, idx) => {
146
+ if (entry === null) return null;
147
+ let visibility = entry.visibility;
148
+ const binding = {
149
+ binding: idx,
150
+ visibility: 0
151
+ };
152
+ if ("uniform" in entry) {
153
+ visibility = visibility ?? DEFAULT_READONLY_VISIBILITY;
154
+ binding.buffer = { type: "uniform" };
155
+ } else if ("storage" in entry) {
156
+ visibility = visibility ?? (entry.access === "mutable" ? DEFAULT_MUTABLE_VISIBILITY : DEFAULT_READONLY_VISIBILITY);
157
+ binding.buffer = { type: entry.access === "mutable" ? "storage" : "read-only-storage" };
158
+ } else if ("sampler" in entry) {
159
+ visibility = visibility ?? DEFAULT_READONLY_VISIBILITY;
160
+ binding.sampler = { type: entry.sampler };
161
+ } else if ("texture" in entry) {
162
+ visibility = visibility ?? DEFAULT_READONLY_VISIBILITY;
163
+ const { multisampled, dimension, bindingSampleType } = entry.texture;
164
+ binding.texture = {
165
+ sampleType: entry.sampleType ?? bindingSampleType[0],
166
+ viewDimension: dimension,
167
+ multisampled
168
+ };
169
+ } else if ("storageTexture" in entry) {
170
+ visibility = visibility ?? DEFAULT_MUTABLE_VISIBILITY;
171
+ const { dimension, access, format } = entry.storageTexture;
172
+ binding.storageTexture = {
173
+ access,
174
+ format,
175
+ viewDimension: dimension
176
+ };
177
+ } else if ("externalTexture" in entry) {
178
+ visibility = visibility ?? DEFAULT_READONLY_VISIBILITY;
179
+ binding.externalTexture = {};
180
+ }
181
+ if (visibility?.includes("compute")) binding.visibility |= GPUShaderStage.COMPUTE;
182
+ if (visibility?.includes("vertex")) binding.visibility |= GPUShaderStage.VERTEX;
183
+ if (visibility?.includes("fragment")) binding.visibility |= GPUShaderStage.FRAGMENT;
184
+ return binding;
185
+ }).filter((v) => v !== null)
186
+ });
187
+ }
188
+ };
189
+ var TgpuBindGroupImpl = class {
190
+ resourceType = "bind-group";
191
+ constructor(layout, entries) {
192
+ this.layout = layout;
193
+ this.entries = entries;
194
+ for (const key of Object.keys(layout.entries)) if (layout.entries[key] !== null && !(key in entries)) throw new MissingBindingError(getName(layout), key);
195
+ }
196
+ unwrap(unwrapper) {
197
+ return unwrapper.device.createBindGroup({
198
+ label: getName(this.layout) ?? "<unnamed>",
199
+ layout: unwrapper.unwrap(this.layout),
200
+ entries: Object.entries(this.layout.entries).map(([key, entry], idx) => {
201
+ if (entry === null) return null;
202
+ const value = this.entries[key];
203
+ if (value === void 0) throw new Error(`'${key}' is a resource required to populate bind group layout '${getName(this.layout) ?? "<unnamed>"}'.`);
204
+ if ("uniform" in entry) {
205
+ let resource;
206
+ if (isBuffer(value)) {
207
+ if (!isUsableAsUniform(value)) throw new NotUniformError(value);
208
+ resource = { buffer: unwrapper.unwrap(value) };
209
+ } else resource = { buffer: value };
210
+ return {
211
+ binding: idx,
212
+ resource
213
+ };
214
+ }
215
+ if ("storage" in entry) {
216
+ let resource;
217
+ if (isBuffer(value)) {
218
+ if (!isUsableAsStorage(value)) throw new NotStorageError(value);
219
+ resource = { buffer: unwrapper.unwrap(value) };
220
+ } else resource = { buffer: value };
221
+ return {
222
+ binding: idx,
223
+ resource
224
+ };
225
+ }
226
+ if ("texture" in entry) {
227
+ let resource;
228
+ if (isTexture(value)) {
229
+ if (!isUsableAsSampled(value)) throw new NotSampledError(value);
230
+ resource = unwrapper.unwrap(value.createView(entry.texture));
231
+ } else if (isTextureView(value)) resource = unwrapper.unwrap(value);
232
+ else resource = value;
233
+ return {
234
+ binding: idx,
235
+ resource
236
+ };
237
+ }
238
+ if ("storageTexture" in entry) {
239
+ let resource;
240
+ if (isTexture(value)) {
241
+ if (!isUsableAsStorage(value)) throw new NotStorageError(value);
242
+ resource = unwrapper.unwrap(value.createView(entry.storageTexture));
243
+ } else if (isTextureView(value)) resource = unwrapper.unwrap(value);
244
+ else resource = value;
245
+ return {
246
+ binding: idx,
247
+ resource
248
+ };
249
+ }
250
+ if ("sampler" in entry) {
251
+ if (isComparisonSampler(value) || isSampler(value)) return {
252
+ binding: idx,
253
+ resource: unwrapper.unwrap(value)
254
+ };
255
+ return {
256
+ binding: idx,
257
+ resource: value
258
+ };
259
+ }
260
+ if ("externalTexture" in entry) return {
261
+ binding: idx,
262
+ resource: value
263
+ };
264
+ throw new Error(`Malformed bind group entry: ${safeStringify(value)}`);
265
+ }).filter((v) => v !== null)
266
+ });
267
+ }
268
+ };
269
+
270
+ //#endregion
271
+ export { TgpuBindGroupImpl, bindGroupLayout, isBindGroup, isBindGroupLayout };
@@ -0,0 +1,48 @@
1
+ import { computeFn } from "./core/function/tgpuComputeFn.js";
2
+ import { privateVar, workgroupVar } from "./core/variable/tgpuVariable.js";
3
+ import { fragmentFn } from "./core/function/tgpuFragmentFn.js";
4
+ import { vertexFn } from "./core/function/tgpuVertexFn.js";
5
+ import { vertexLayout } from "./core/vertexLayout/vertexLayout.js";
6
+ import { declare } from "./core/declare/tgpuDeclare.js";
7
+ import { fn } from "./core/function/tgpuFn.js";
8
+ import { constant } from "./core/constant/tgpuConstant.js";
9
+ import { comptime } from "./core/function/comptime.js";
10
+ import { namespace } from "./core/resolve/namespace.js";
11
+ import { slot } from "./core/slot/slot.js";
12
+ import { lazy } from "./core/slot/lazy.js";
13
+ import { accessor, mutableAccessor } from "./core/slot/accessor.js";
14
+ import { rawCodeSnippet } from "./core/rawCodeSnippet/tgpuRawCodeSnippet.js";
15
+ import { simulate } from "./core/simulate/tgpuSimulate.js";
16
+
17
+ //#region src/tgpuUnstable.d.ts
18
+ declare namespace tgpuUnstable_d_exports {
19
+ export { _accessor as accessor, _comptime as comptime, _computeFn as computeFn, _constant as const, declare, _lazy as derived, _fn as fn, _fragmentFn as fragmentFn, _mutableAccessor as mutableAccessor, namespace, _privateVar as privateVar, rawCodeSnippet, simulate, _slot as slot, _vertexFn as vertexFn, _vertexLayout as vertexLayout, _workgroupVar as workgroupVar };
20
+ }
21
+ /** @deprecated This feature is now stable, use tgpu.const. */
22
+ declare const _constant: typeof constant;
23
+ /** @deprecated This feature is now stable, use tgpu.comptime. */
24
+ declare const _comptime: typeof comptime;
25
+ /** @deprecated This feature is now stable, use tgpu.computeFn. */
26
+ declare const _computeFn: typeof computeFn;
27
+ /** @deprecated This feature is now stable, use tgpu.fn. */
28
+ declare const _fn: typeof fn;
29
+ /** @deprecated This feature is now stable, use tgpu.fragmentFn. */
30
+ declare const _fragmentFn: typeof fragmentFn;
31
+ /** @deprecated This feature is now stable, use tgpu.vertexFn. */
32
+ declare const _vertexFn: typeof vertexFn;
33
+ /** @deprecated This feature is now stable, use tgpu.accessor. */
34
+ declare const _accessor: typeof accessor;
35
+ /** @deprecated This feature is now stable, use tgpu.mutableAccessor. */
36
+ declare const _mutableAccessor: typeof mutableAccessor;
37
+ /** @deprecated This feature is now stable, use tgpu.lazy. */
38
+ declare const _lazy: typeof lazy;
39
+ /** @deprecated This feature is now stable, use tgpu.slot. */
40
+ declare const _slot: typeof slot;
41
+ /** @deprecated This feature is now stable, use tgpu.privateVar. */
42
+ declare const _privateVar: typeof privateVar;
43
+ /** @deprecated This feature is now stable, use tgpu.workgroupVar. */
44
+ declare const _workgroupVar: typeof workgroupVar;
45
+ /** @deprecated This feature is now stable, use tgpu.vertexLayout. */
46
+ declare const _vertexLayout: typeof vertexLayout;
47
+ //#endregion
48
+ export { tgpuUnstable_d_exports };
@@ -0,0 +1,66 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { comptime } from "./core/function/comptime.js";
3
+ import { constant } from "./core/constant/tgpuConstant.js";
4
+ import { fn } from "./core/function/tgpuFn.js";
5
+ import { namespace } from "./core/resolve/namespace.js";
6
+ import { slot } from "./core/slot/slot.js";
7
+ import { privateVar, workgroupVar } from "./core/variable/tgpuVariable.js";
8
+ import { computeFn } from "./core/function/tgpuComputeFn.js";
9
+ import { vertexLayout } from "./core/vertexLayout/vertexLayout.js";
10
+ import { lazy } from "./core/slot/lazy.js";
11
+ import { accessor, mutableAccessor } from "./core/slot/accessor.js";
12
+ import { fragmentFn } from "./core/function/tgpuFragmentFn.js";
13
+ import { vertexFn } from "./core/function/tgpuVertexFn.js";
14
+ import { declare } from "./core/declare/tgpuDeclare.js";
15
+ import { rawCodeSnippet } from "./core/rawCodeSnippet/tgpuRawCodeSnippet.js";
16
+ import { simulate } from "./core/simulate/tgpuSimulate.js";
17
+
18
+ //#region src/tgpuUnstable.ts
19
+ var tgpuUnstable_exports = /* @__PURE__ */ __exportAll({
20
+ accessor: () => _accessor,
21
+ comptime: () => _comptime,
22
+ computeFn: () => _computeFn,
23
+ const: () => _constant,
24
+ declare: () => declare,
25
+ derived: () => _lazy,
26
+ fn: () => _fn,
27
+ fragmentFn: () => _fragmentFn,
28
+ mutableAccessor: () => _mutableAccessor,
29
+ namespace: () => namespace,
30
+ privateVar: () => _privateVar,
31
+ rawCodeSnippet: () => rawCodeSnippet,
32
+ simulate: () => simulate,
33
+ slot: () => _slot,
34
+ vertexFn: () => _vertexFn,
35
+ vertexLayout: () => _vertexLayout,
36
+ workgroupVar: () => _workgroupVar
37
+ });
38
+ /** @deprecated This feature is now stable, use tgpu.const. */
39
+ const _constant = constant;
40
+ /** @deprecated This feature is now stable, use tgpu.comptime. */
41
+ const _comptime = comptime;
42
+ /** @deprecated This feature is now stable, use tgpu.computeFn. */
43
+ const _computeFn = computeFn;
44
+ /** @deprecated This feature is now stable, use tgpu.fn. */
45
+ const _fn = fn;
46
+ /** @deprecated This feature is now stable, use tgpu.fragmentFn. */
47
+ const _fragmentFn = fragmentFn;
48
+ /** @deprecated This feature is now stable, use tgpu.vertexFn. */
49
+ const _vertexFn = vertexFn;
50
+ /** @deprecated This feature is now stable, use tgpu.accessor. */
51
+ const _accessor = accessor;
52
+ /** @deprecated This feature is now stable, use tgpu.mutableAccessor. */
53
+ const _mutableAccessor = mutableAccessor;
54
+ /** @deprecated This feature is now stable, use tgpu.lazy. */
55
+ const _lazy = lazy;
56
+ /** @deprecated This feature is now stable, use tgpu.slot. */
57
+ const _slot = slot;
58
+ /** @deprecated This feature is now stable, use tgpu.privateVar. */
59
+ const _privateVar = privateVar;
60
+ /** @deprecated This feature is now stable, use tgpu.workgroupVar. */
61
+ const _workgroupVar = workgroupVar;
62
+ /** @deprecated This feature is now stable, use tgpu.vertexLayout. */
63
+ const _vertexLayout = vertexLayout;
64
+
65
+ //#endregion
66
+ export { tgpuUnstable_exports };
@@ -0,0 +1,45 @@
1
+ import { isNaturallyEphemeral, isPtr, isVec, isWgslArray, isWgslStruct } from "../data/wgslTypes.js";
2
+ import { MatrixColumnsAccess, UnknownData, isDisarray } from "../data/dataTypes.js";
3
+ import { isEphemeralSnippet, snip } from "../data/snippet.js";
4
+ import { isKnownAtComptime } from "../types.js";
5
+ import { stitch } from "../core/resolve/stitch.js";
6
+ import { derefSnippet } from "../data/ref.js";
7
+ import { vec2f, vec3f, vec4f } from "../data/vector.js";
8
+ import { coerceToSnippet } from "./generationHelpers.js";
9
+ import { accessProp } from "./accessProp.js";
10
+
11
+ //#region src/tgsl/accessIndex.ts
12
+ const indexableTypeToResult = {
13
+ mat2x2f: vec2f,
14
+ mat3x3f: vec3f,
15
+ mat4x4f: vec4f
16
+ };
17
+ function accessIndex(target, indexArg) {
18
+ const index = typeof indexArg === "number" ? coerceToSnippet(indexArg) : indexArg;
19
+ if (isWgslArray(target.dataType) || isDisarray(target.dataType)) {
20
+ const elementType = target.dataType.elementType;
21
+ const isElementNatEph = isNaturallyEphemeral(elementType);
22
+ const isTargetEphemeral = isEphemeralSnippet(target);
23
+ const isIndexConstant = index.origin === "constant";
24
+ let origin;
25
+ if (target.origin === "constant-tgpu-const-ref") if (isIndexConstant) origin = isElementNatEph ? "constant" : "constant-tgpu-const-ref";
26
+ else origin = isElementNatEph ? "runtime" : "runtime-tgpu-const-ref";
27
+ else if (target.origin === "runtime-tgpu-const-ref") origin = isElementNatEph ? "runtime" : "runtime-tgpu-const-ref";
28
+ else if (!isTargetEphemeral && !isElementNatEph) origin = target.origin;
29
+ else if (isIndexConstant && target.origin === "constant") origin = "constant";
30
+ else origin = "runtime";
31
+ return snip(isKnownAtComptime(target) && isKnownAtComptime(index) ? target.value[index.value] : stitch`${target}[${index}]`, elementType, origin);
32
+ }
33
+ if (isVec(target.dataType)) return snip(isKnownAtComptime(target) && isKnownAtComptime(index) ? target.value[index.value] : stitch`${target}[${index}]`, target.dataType.primitive, target.origin === "constant" || target.origin === "constant-tgpu-const-ref" ? "constant" : "runtime");
34
+ if (isPtr(target.dataType)) return accessIndex(derefSnippet(target), index);
35
+ if (target.value instanceof MatrixColumnsAccess) {
36
+ const propType = indexableTypeToResult[target.value.matrix.dataType.type];
37
+ return snip(stitch`${target.value.matrix}[${index}]`, propType, target.origin);
38
+ }
39
+ if (target.dataType.type in indexableTypeToResult) throw new Error("The only way of accessing matrix elements in TypeGPU functions is through the 'columns' property.");
40
+ if (isKnownAtComptime(target) && isKnownAtComptime(index) || target.dataType === UnknownData) return coerceToSnippet(target.value[index.value]);
41
+ if (isWgslStruct(target.dataType) && isKnownAtComptime(index) && typeof index.value === "string") return accessProp(target, index.value);
42
+ }
43
+
44
+ //#endregion
45
+ export { accessIndex };
@@ -0,0 +1,113 @@
1
+ import { $gpuCallable } from "../shared/symbols.js";
2
+ import { isMat, isNaturallyEphemeral, isPtr, isVec, isWgslArray, isWgslStruct } from "../data/wgslTypes.js";
3
+ import { InfixDispatch, MatrixColumnsAccess, UnknownData, isUnstruct, undecorate } from "../data/dataTypes.js";
4
+ import { isEphemeralSnippet, snip } from "../data/snippet.js";
5
+ import { isKnownAtComptime } from "../types.js";
6
+ import { stitch } from "../core/resolve/stitch.js";
7
+ import { derefSnippet } from "../data/ref.js";
8
+ import { abstractInt, bool, f16, f32, i32, u32 } from "../data/numeric.js";
9
+ import { vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u } from "../data/vector.js";
10
+ import { AutoStruct } from "../data/autoStruct.js";
11
+ import { coerceToSnippet } from "./generationHelpers.js";
12
+ import { add, div, mod, mul, sub } from "../std/operators.js";
13
+
14
+ //#region src/tgsl/accessProp.ts
15
+ const infixKinds = [
16
+ "vec2f",
17
+ "vec3f",
18
+ "vec4f",
19
+ "vec2h",
20
+ "vec3h",
21
+ "vec4h",
22
+ "vec2i",
23
+ "vec3i",
24
+ "vec4i",
25
+ "vec2u",
26
+ "vec3u",
27
+ "vec4u",
28
+ "mat2x2f",
29
+ "mat3x3f",
30
+ "mat4x4f"
31
+ ];
32
+ const infixOperators = {
33
+ add,
34
+ sub,
35
+ mul,
36
+ div,
37
+ mod
38
+ };
39
+ const swizzleLenToType = {
40
+ f: {
41
+ 1: f32,
42
+ 2: vec2f,
43
+ 3: vec3f,
44
+ 4: vec4f
45
+ },
46
+ h: {
47
+ 1: f16,
48
+ 2: vec2h,
49
+ 3: vec3h,
50
+ 4: vec4h
51
+ },
52
+ i: {
53
+ 1: i32,
54
+ 2: vec2i,
55
+ 3: vec3i,
56
+ 4: vec4i
57
+ },
58
+ u: {
59
+ 1: u32,
60
+ 2: vec2u,
61
+ 3: vec3u,
62
+ 4: vec4u
63
+ },
64
+ b: {
65
+ 1: bool,
66
+ 2: vec2b,
67
+ 3: vec3b,
68
+ 4: vec4b
69
+ }
70
+ };
71
+ function accessProp(target, propName) {
72
+ if (infixKinds.includes(target.dataType.type) && propName in infixOperators) {
73
+ const operator = infixOperators[propName];
74
+ return snip(new InfixDispatch(propName, target, operator[$gpuCallable].call.bind(operator)), UnknownData, target.origin);
75
+ }
76
+ if (isWgslArray(target.dataType) && propName === "length") {
77
+ if (target.dataType.elementCount === 0) return snip(stitch`arrayLength(&${target})`, u32, "runtime");
78
+ return snip(target.dataType.elementCount, abstractInt, "constant");
79
+ }
80
+ if (isMat(target.dataType) && propName === "columns") return snip(new MatrixColumnsAccess(target), UnknownData, target.origin);
81
+ if (isWgslStruct(target.dataType) || isUnstruct(target.dataType)) {
82
+ let propType = target.dataType.propTypes[propName];
83
+ if (!propType) return;
84
+ propType = undecorate(propType);
85
+ return snip(stitch`${target}.${propName}`, propType, target.origin === "argument" ? "argument" : !isEphemeralSnippet(target) && !isNaturallyEphemeral(propType) ? target.origin : target.origin === "constant" || target.origin === "constant-tgpu-const-ref" ? "constant" : "runtime");
86
+ }
87
+ if (target.dataType instanceof AutoStruct) {
88
+ const result = target.dataType.accessProp(propName);
89
+ if (!result) return;
90
+ return snip(stitch`${target}.${result.prop}`, result.type, "argument");
91
+ }
92
+ if (isPtr(target.dataType)) {
93
+ const derefed = derefSnippet(target);
94
+ if (propName === "$") return derefed;
95
+ return accessProp(derefed, propName);
96
+ }
97
+ if (isVec(target.dataType)) {
98
+ if (propName === "kind") return snip(target.dataType.type, UnknownData, "constant");
99
+ }
100
+ const propLength = propName.length;
101
+ if (isVec(target.dataType) && propLength >= 1 && propLength <= 4) {
102
+ const isXYZW = /^[xyzw]+$/.test(propName);
103
+ const isRGBA = /^[rgba]+$/.test(propName);
104
+ if (!isXYZW && !isRGBA) return;
105
+ const swizzleType = swizzleLenToType[target.dataType.type.includes("bool") ? "b" : target.dataType.type[4]][propLength];
106
+ if (!swizzleType) return;
107
+ return snip(isKnownAtComptime(target) ? target.value[propName] : stitch`${target}.${propName}`, swizzleType, target.origin === "argument" && propLength === 1 ? "argument" : target.origin === "constant" || target.origin === "constant-tgpu-const-ref" ? "constant" : "runtime");
108
+ }
109
+ if (isKnownAtComptime(target) || target.dataType === UnknownData) return coerceToSnippet(target.value[propName]);
110
+ }
111
+
112
+ //#endregion
113
+ export { accessProp, infixOperators };
@@ -0,0 +1,117 @@
1
+ import { isWgslArray, isWgslData, isWgslStruct } from "../../data/wgslTypes.js";
2
+ import { niceStringify } from "../../shared/stringify.js";
3
+ import { vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u } from "../../data/vector.js";
4
+ import { sizeOf } from "../../data/sizeOf.js";
5
+ import { mat2x2f, mat3x3f, mat4x4f } from "../../data/matrix.js";
6
+ import { bitcastU32toF32, bitcastU32toI32 } from "../../std/bitcast.js";
7
+ import { unpack2x16float } from "../../std/packing.js";
8
+
9
+ //#region src/tgsl/consoleLog/deserializers.ts
10
+ const toF = (n) => bitcastU32toF32(n ?? 0);
11
+ const toI = (n) => bitcastU32toI32(n ?? 0);
12
+ const unpack = (n) => unpack2x16float(n ?? 0);
13
+ const deserializerMap = {
14
+ f32: (d) => toF(d[0]),
15
+ f16: (d) => unpack(d[0]).x,
16
+ i32: (d) => toI(d[0]),
17
+ u32: (d) => d[0] ?? 0,
18
+ bool: (d) => !!d[0],
19
+ vec2f: (d) => vec2f(toF(d[0]), toF(d[1])),
20
+ vec3f: (d) => vec3f(toF(d[0]), toF(d[1]), toF(d[2])),
21
+ vec4f: (d) => vec4f(toF(d[0]), toF(d[1]), toF(d[2]), toF(d[3])),
22
+ vec2h(d) {
23
+ const xyVec = unpack(d[0]);
24
+ return vec2h(xyVec.x, xyVec.y);
25
+ },
26
+ vec3h(d) {
27
+ const xyVec = unpack(d[0]);
28
+ const zVec = unpack(d[1]);
29
+ return vec3h(xyVec.x, xyVec.y, zVec.x);
30
+ },
31
+ vec4h(d) {
32
+ const xyVec = unpack(d[0]);
33
+ const zwVec = unpack(d[1]);
34
+ return vec4h(xyVec.x, xyVec.y, zwVec.x, zwVec.y);
35
+ },
36
+ vec2i: (d) => vec2i(toI(d[0]), toI(d[1])),
37
+ vec3i: (d) => vec3i(toI(d[0]), toI(d[1]), toI(d[2])),
38
+ vec4i: (d) => vec4i(toI(d[0]), toI(d[1]), toI(d[2]), toI(d[3])),
39
+ vec2u: (d) => vec2u(d[0] ?? 0, d[1] ?? 0),
40
+ vec3u: (d) => vec3u(d[0] ?? 0, d[1] ?? 0, d[2] ?? 0),
41
+ vec4u: (d) => vec4u(d[0] ?? 0, d[1] ?? 0, d[2] ?? 0, d[3] ?? 0),
42
+ "vec2<bool>": (d) => vec2b(!!d[0], !!d[1]),
43
+ "vec3<bool>": (d) => vec3b(!!d[0], !!d[1], !!d[2]),
44
+ "vec4<bool>": (d) => vec4b(!!d[0], !!d[1], !!d[2], !!d[3]),
45
+ mat2x2f: (d) => mat2x2f(toF(d[0]), toF(d[1]), toF(d[2]), toF(d[3])),
46
+ mat3x3f: (d) => mat3x3f(toF(d[0]), toF(d[1]), toF(d[2]), toF(d[4]), toF(d[5]), toF(d[6]), toF(d[8]), toF(d[9]), toF(d[10])),
47
+ mat4x4f: (d) => mat4x4f(toF(d[0]), toF(d[1]), toF(d[2]), toF(d[3]), toF(d[4]), toF(d[5]), toF(d[6]), toF(d[7]), toF(d[8]), toF(d[9]), toF(d[10]), toF(d[11]), toF(d[12]), toF(d[13]), toF(d[14]), toF(d[15]))
48
+ };
49
+ /**
50
+ * Deserializes binary data from a Uint32Array into a JavaScript value based on the provided WGSL data type.
51
+ *
52
+ * @param data - The binary data as a Uint32Array to be deserialized
53
+ * @param dataType - The WGSL data type specification that determines how to interpret the binary data
54
+ */
55
+ function deserialize(data, dataType) {
56
+ const maybeDeserializer = deserializerMap[dataType.type];
57
+ if (maybeDeserializer) return maybeDeserializer(data);
58
+ if (isWgslStruct(dataType)) {
59
+ const props = Object.keys(dataType.propTypes);
60
+ const decodedProps = deserializeCompound(data, Object.values(dataType.propTypes));
61
+ return Object.fromEntries(props.map((key, index) => [key, decodedProps[index]]));
62
+ }
63
+ if (isWgslArray(dataType)) {
64
+ const elementType = dataType.elementType;
65
+ const length = dataType.elementCount;
66
+ return deserializeCompound(data, Array.from({ length }, () => elementType));
67
+ }
68
+ throw new Error(`Cannot deserialize data of type ${dataType.type}`);
69
+ }
70
+ /**
71
+ * Deserializes a list of elements from a Uint32Array buffer using provided type information.
72
+ * If there is a string value among the type information, it is returned as is.
73
+ *
74
+ * @param data - The Uint32Array buffer containing the serialized data
75
+ * @param dataTypes - The WGSL data type specification that determines how to interpret the binary data, or string literals
76
+ */
77
+ function deserializeCompound(data, dataTypes) {
78
+ let index = 0;
79
+ return dataTypes.map((info) => {
80
+ if (!isWgslData(info)) return info;
81
+ const size = Math.ceil(sizeOf(info) / 4);
82
+ const value = deserialize(data.subarray(index, index + size), info);
83
+ index += size;
84
+ return value;
85
+ });
86
+ }
87
+ function deserializeAndStringify(serializedData, argTypes) {
88
+ return deserializeCompound(serializedData, argTypes).map(niceStringify);
89
+ }
90
+ /**
91
+ * Reads and deserializes log data from GPU buffers, logging results to the console.
92
+ *
93
+ * @remarks
94
+ * - Log entries with IDs equal to 0 are filtered out.
95
+ * - Console messages are prepended with options.messagePrefix styled with purple background and white text.
96
+ * - A warning is displayed if the log count exceeds the limit passed in options.
97
+ * - After processing, the index buffer and the data buffer are cleared.
98
+ */
99
+ function logDataFromGPU(resources) {
100
+ const { indexBuffer, dataBuffer, logIdToMeta, options } = resources;
101
+ dataBuffer.read().then((data) => {
102
+ data.filter((e) => e.id).forEach(({ id, serializedData }) => {
103
+ const { argTypes, op } = logIdToMeta.get(id);
104
+ const results = deserializeAndStringify(new Uint32Array(serializedData), argTypes);
105
+ if (results.length === 0) results.push("");
106
+ console[op](`%c${options.messagePrefix}%c ${results[0]}`, "background: #936ff5; color: white;", "color: inherit; background: none", ...results.slice(1));
107
+ });
108
+ });
109
+ indexBuffer.read().then((totalCalls) => {
110
+ if (totalCalls > options.logCountLimit) console.warn(`Log count limit per dispatch (${options.logCountLimit}) exceeded by ${totalCalls - options.logCountLimit} calls. Consider increasing the limit by passing appropriate options to tgpu.init().`);
111
+ });
112
+ dataBuffer.buffer.clear();
113
+ indexBuffer.buffer.clear();
114
+ }
115
+
116
+ //#endregion
117
+ export { logDataFromGPU };