typegpu 0.10.1 → 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 (273) hide show
  1. package/_virtual/_rolldown/runtime.js +13 -0
  2. package/builtin.d.ts +50 -0
  3. package/builtin.js +35 -0
  4. package/common/fullScreenTriangle.d.ts +22 -0
  5. package/common/fullScreenTriangle.js +34 -0
  6. package/common/index.d.ts +4 -4
  7. package/common/index.js +8 -7
  8. package/common/writeSoA.d.ts +16 -0
  9. package/common/writeSoA.js +90 -0
  10. package/core/buffer/buffer.d.ts +79 -0
  11. package/core/buffer/buffer.js +246 -0
  12. package/core/buffer/bufferShorthand.d.ts +48 -0
  13. package/core/buffer/bufferShorthand.js +53 -0
  14. package/core/buffer/bufferUsage.d.ts +43 -0
  15. package/core/buffer/bufferUsage.js +165 -0
  16. package/core/constant/tgpuConstant.d.ts +29 -0
  17. package/core/constant/tgpuConstant.js +68 -0
  18. package/core/declare/tgpuDeclare.d.ts +18 -0
  19. package/core/declare/tgpuDeclare.js +39 -0
  20. package/core/function/autoIO.d.ts +38 -0
  21. package/core/function/autoIO.js +85 -0
  22. package/core/function/comptime.d.ts +39 -0
  23. package/core/function/comptime.js +49 -0
  24. package/core/function/createCallableSchema.js +40 -0
  25. package/core/function/dualImpl.js +52 -0
  26. package/core/function/entryInputRouter.js +39 -0
  27. package/core/function/extractArgs.js +204 -0
  28. package/core/function/fnCore.js +90 -0
  29. package/core/function/fnTypes.d.ts +40 -0
  30. package/core/function/ioSchema.d.ts +10 -0
  31. package/core/function/ioSchema.js +51 -0
  32. package/core/function/shelllessImpl.d.ts +28 -0
  33. package/core/function/shelllessImpl.js +21 -0
  34. package/core/function/templateUtils.js +12 -0
  35. package/core/function/tgpuComputeFn.d.ts +48 -0
  36. package/core/function/tgpuComputeFn.js +55 -0
  37. package/core/function/tgpuFn.d.ts +52 -0
  38. package/core/function/tgpuFn.js +168 -0
  39. package/core/function/tgpuFragmentFn.d.ts +72 -0
  40. package/core/function/tgpuFragmentFn.js +63 -0
  41. package/core/function/tgpuVertexFn.d.ts +59 -0
  42. package/core/function/tgpuVertexFn.js +59 -0
  43. package/core/pipeline/applyPipelineState.js +35 -0
  44. package/core/pipeline/computePipeline.d.ts +54 -0
  45. package/core/pipeline/computePipeline.js +227 -0
  46. package/core/pipeline/connectAttachmentToShader.js +24 -0
  47. package/core/pipeline/connectTargetsToShader.js +27 -0
  48. package/core/pipeline/limitsOverflow.js +12 -0
  49. package/core/pipeline/pipelineUtils.js +29 -0
  50. package/core/pipeline/renderPipeline.d.ts +284 -0
  51. package/core/pipeline/renderPipeline.js +489 -0
  52. package/core/pipeline/timeable.d.ts +20 -0
  53. package/core/pipeline/timeable.js +55 -0
  54. package/core/pipeline/typeGuards.js +27 -0
  55. package/core/querySet/querySet.d.ts +20 -0
  56. package/core/querySet/querySet.js +104 -0
  57. package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +59 -0
  58. package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +94 -0
  59. package/core/resolve/externals.d.ts +8 -0
  60. package/core/resolve/externals.js +56 -0
  61. package/core/resolve/namespace.d.ts +38 -0
  62. package/core/resolve/namespace.js +39 -0
  63. package/core/resolve/resolveData.js +144 -0
  64. package/core/resolve/stitch.js +23 -0
  65. package/core/resolve/tgpuResolve.d.ts +153 -0
  66. package/core/resolve/tgpuResolve.js +66 -0
  67. package/core/root/configurableImpl.js +17 -0
  68. package/core/root/init.d.ts +64 -0
  69. package/core/root/init.js +464 -0
  70. package/core/root/rootTypes.d.ts +642 -0
  71. package/core/sampler/sampler.d.ts +31 -0
  72. package/core/sampler/sampler.js +116 -0
  73. package/core/simulate/tgpuSimulate.d.ts +36 -0
  74. package/core/simulate/tgpuSimulate.js +74 -0
  75. package/core/slot/accessor.d.ts +9 -0
  76. package/core/slot/accessor.js +95 -0
  77. package/core/slot/internalSlots.js +5 -0
  78. package/core/slot/lazy.d.ts +6 -0
  79. package/core/slot/lazy.js +40 -0
  80. package/core/slot/slot.d.ts +6 -0
  81. package/core/slot/slot.js +39 -0
  82. package/core/slot/slotTypes.d.ts +92 -0
  83. package/core/slot/slotTypes.js +19 -0
  84. package/core/texture/externalTexture.d.ts +6 -0
  85. package/core/texture/externalTexture.js +47 -0
  86. package/core/texture/texture.d.ts +114 -0
  87. package/core/texture/texture.js +314 -0
  88. package/core/texture/textureFormats.d.ts +29 -0
  89. package/core/texture/textureFormats.js +97 -0
  90. package/core/texture/textureProps.d.ts +11 -0
  91. package/core/texture/textureUtils.js +222 -0
  92. package/core/texture/usageExtension.d.ts +21 -0
  93. package/core/texture/usageExtension.js +19 -0
  94. package/core/unroll/tgpuUnroll.d.ts +68 -0
  95. package/core/unroll/tgpuUnroll.js +94 -0
  96. package/core/valueProxyUtils.js +42 -0
  97. package/core/variable/tgpuVariable.d.ts +38 -0
  98. package/core/variable/tgpuVariable.js +99 -0
  99. package/core/vertexLayout/connectAttributesToShader.js +57 -0
  100. package/core/vertexLayout/vertexAttribute.d.ts +29 -0
  101. package/core/vertexLayout/vertexLayout.d.ts +19 -0
  102. package/core/vertexLayout/vertexLayout.js +103 -0
  103. package/data/alignIO.js +14 -0
  104. package/data/alignmentOf.d.ts +9 -0
  105. package/data/alignmentOf.js +86 -0
  106. package/data/array.d.ts +26 -0
  107. package/data/array.js +46 -0
  108. package/data/atomic.d.ts +15 -0
  109. package/data/atomic.js +24 -0
  110. package/data/attributes.d.ts +121 -0
  111. package/data/attributes.js +145 -0
  112. package/data/autoStruct.d.ts +1 -0
  113. package/data/autoStruct.js +81 -0
  114. package/data/compiledIO.js +228 -0
  115. package/data/dataIO.js +556 -0
  116. package/data/dataTypes.d.ts +115 -0
  117. package/data/dataTypes.js +100 -0
  118. package/data/deepEqual.d.ts +25 -0
  119. package/data/deepEqual.js +56 -0
  120. package/data/disarray.d.ts +32 -0
  121. package/data/disarray.js +50 -0
  122. package/data/getLongestContiguousPrefix.d.ts +9 -0
  123. package/data/getLongestContiguousPrefix.js +13 -0
  124. package/data/index.d.ts +26 -4
  125. package/data/index.js +36 -9
  126. package/data/instanceToSchema.d.ts +33 -0
  127. package/data/isContiguous.d.ts +9 -0
  128. package/data/isContiguous.js +13 -0
  129. package/data/matrix.d.ts +124 -0
  130. package/data/matrix.js +531 -0
  131. package/data/numberOps.js +23 -0
  132. package/data/numeric.d.ts +81 -0
  133. package/data/numeric.js +221 -0
  134. package/data/offsetUtils.d.ts +33 -0
  135. package/data/offsetUtils.js +165 -0
  136. package/data/offsets.js +34 -0
  137. package/data/partialIO.js +113 -0
  138. package/data/ptr.d.ts +11 -0
  139. package/data/ptr.js +44 -0
  140. package/data/ref.d.ts +34 -0
  141. package/data/ref.js +94 -0
  142. package/data/sampler.d.ts +107 -0
  143. package/data/sampler.js +24 -0
  144. package/data/schemaCallWrapper.js +30 -0
  145. package/data/schemaMemoryLayout.js +198 -0
  146. package/data/sizeOf.d.ts +9 -0
  147. package/data/sizeOf.js +13 -0
  148. package/data/snippet.d.ts +26 -0
  149. package/data/snippet.js +70 -0
  150. package/data/struct.d.ts +17 -0
  151. package/data/struct.js +44 -0
  152. package/data/texture.d.ts +292 -0
  153. package/{texture-BagDrrks.js → data/texture.js} +6 -5
  154. package/data/unstruct.d.ts +24 -0
  155. package/data/unstruct.js +41 -0
  156. package/data/vector.d.ts +191 -0
  157. package/data/vector.js +239 -0
  158. package/data/vectorImpl.js +515 -0
  159. package/data/vectorOps.js +681 -0
  160. package/data/vertexFormatData.d.ts +190 -0
  161. package/data/vertexFormatData.js +109 -0
  162. package/data/wgslTypes.d.ts +924 -0
  163. package/data/wgslTypes.js +222 -0
  164. package/errors.d.ts +44 -0
  165. package/errors.js +131 -0
  166. package/execMode.js +49 -0
  167. package/extension.d.ts +11 -0
  168. package/extension.js +16 -0
  169. package/getGPUValue.js +7 -0
  170. package/index.d.ts +42 -243
  171. package/index.js +21 -6320
  172. package/indexNamedExports.d.ts +40 -0
  173. package/mathUtils.js +12 -0
  174. package/memo.js +22 -0
  175. package/nameRegistry.d.ts +30 -0
  176. package/nameRegistry.js +447 -0
  177. package/package.js +4 -0
  178. package/package.json +26 -26
  179. package/resolutionCtx.d.ts +19 -0
  180. package/resolutionCtx.js +612 -0
  181. package/shared/env.js +12 -0
  182. package/shared/generators.js +13 -0
  183. package/shared/meta.d.ts +39 -0
  184. package/shared/meta.js +61 -0
  185. package/shared/repr.d.ts +138 -0
  186. package/shared/stringify.js +20 -0
  187. package/shared/symbols.d.ts +70 -0
  188. package/shared/symbols.js +48 -0
  189. package/shared/utilityTypes.d.ts +33 -0
  190. package/shared/utilityTypes.js +6 -0
  191. package/shared/vertexFormat.d.ts +70 -0
  192. package/shared/vertexFormat.js +63 -0
  193. package/std/array.d.ts +7 -0
  194. package/std/array.js +25 -0
  195. package/std/atomic.d.ts +19 -0
  196. package/std/atomic.js +111 -0
  197. package/std/bitcast.d.ts +10 -0
  198. package/std/bitcast.js +41 -0
  199. package/std/boolean.d.ts +141 -0
  200. package/std/boolean.js +299 -0
  201. package/std/derivative.d.ts +16 -0
  202. package/std/derivative.js +87 -0
  203. package/std/discard.d.ts +6 -0
  204. package/std/discard.js +14 -0
  205. package/std/extensions.d.ts +6 -0
  206. package/std/extensions.js +12 -0
  207. package/std/index.d.ts +17 -4
  208. package/std/index.js +21 -7
  209. package/std/matrix.d.ts +41 -0
  210. package/std/matrix.js +85 -0
  211. package/std/numeric.d.ts +200 -0
  212. package/std/numeric.js +845 -0
  213. package/std/operators.d.ts +56 -0
  214. package/std/operators.js +227 -0
  215. package/std/packing.d.ts +26 -0
  216. package/std/packing.js +84 -0
  217. package/std/range.d.ts +24 -0
  218. package/std/range.js +38 -0
  219. package/std/subgroup.d.ts +47 -0
  220. package/std/subgroup.js +218 -0
  221. package/std/texture.d.ts +117 -0
  222. package/std/texture.js +207 -0
  223. package/tgpu.js +42 -0
  224. package/tgpuBindGroupLayout.d.ts +161 -0
  225. package/tgpuBindGroupLayout.js +272 -0
  226. package/tgpuUnstable.d.ts +48 -0
  227. package/tgpuUnstable.js +64 -0
  228. package/tgsl/accessIndex.js +43 -0
  229. package/tgsl/accessProp.js +115 -0
  230. package/tgsl/consoleLog/deserializers.js +115 -0
  231. package/tgsl/consoleLog/logGenerator.js +84 -0
  232. package/tgsl/consoleLog/serializers.js +223 -0
  233. package/tgsl/consoleLog/types.d.ts +52 -0
  234. package/tgsl/consoleLog/types.js +11 -0
  235. package/tgsl/conversion.js +198 -0
  236. package/tgsl/forOfUtils.js +71 -0
  237. package/tgsl/generationHelpers.d.ts +37 -0
  238. package/tgsl/generationHelpers.js +67 -0
  239. package/tgsl/math.js +43 -0
  240. package/tgsl/shaderGenerator.d.ts +20 -0
  241. package/tgsl/shaderGenerator_members.d.ts +2 -0
  242. package/tgsl/shaderGenerator_members.js +6 -0
  243. package/tgsl/shellless.d.ts +11 -0
  244. package/tgsl/shellless.js +46 -0
  245. package/tgsl/wgslGenerator.d.ts +36 -0
  246. package/tgsl/wgslGenerator.js +639 -0
  247. package/types.d.ts +265 -0
  248. package/types.js +43 -0
  249. package/unwrapper.d.ts +27 -0
  250. package/wgslExtensions.d.ts +5 -0
  251. package/wgslExtensions.js +17 -0
  252. package/builtin-DdtWpk2t.js +0 -818
  253. package/builtin-DdtWpk2t.js.map +0 -1
  254. package/chunk-BYypO7fO.js +0 -18
  255. package/common/index.d.ts.map +0 -1
  256. package/common/index.js.map +0 -1
  257. package/data/index.d.ts.map +0 -1
  258. package/data/index.js.map +0 -1
  259. package/deepEqual-DQxK4vdp.js +0 -413
  260. package/deepEqual-DQxK4vdp.js.map +0 -1
  261. package/extensions-DIVuAfBM.js +0 -2032
  262. package/extensions-DIVuAfBM.js.map +0 -1
  263. package/fullScreenTriangle-CfFyQd_0.js +0 -543
  264. package/fullScreenTriangle-CfFyQd_0.js.map +0 -1
  265. package/index.d.ts.map +0 -1
  266. package/index.js.map +0 -1
  267. package/indexNamedExports-oL6tyaJ9.d.ts +0 -5697
  268. package/indexNamedExports-oL6tyaJ9.d.ts.map +0 -1
  269. package/operators-d-PMVTo7.js +0 -4158
  270. package/operators-d-PMVTo7.js.map +0 -1
  271. package/std/index.d.ts.map +0 -1
  272. package/std/index.js.map +0 -1
  273. package/texture-BagDrrks.js.map +0 -1
@@ -0,0 +1,218 @@
1
+ import { stitch } from "../core/resolve/stitch.js";
2
+ import { unify } from "../tgsl/conversion.js";
3
+ import { bool, i32, u32 } from "../data/numeric.js";
4
+ import { vec4u } from "../data/vector.js";
5
+ import { dualImpl } from "../core/function/dualImpl.js";
6
+ //#region src/std/subgroup.ts
7
+ const errorMessage = "Subgroup operations can only be used in the GPU context.";
8
+ const subgroupAdd = dualImpl({
9
+ name: "subgroupAdd",
10
+ signature: (arg) => ({
11
+ argTypes: [arg],
12
+ returnType: arg
13
+ }),
14
+ normalImpl: errorMessage,
15
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupAdd(${arg})`
16
+ });
17
+ const subgroupExclusiveAdd = dualImpl({
18
+ name: "subgroupExclusiveAdd",
19
+ signature: (arg) => ({
20
+ argTypes: [arg],
21
+ returnType: arg
22
+ }),
23
+ normalImpl: errorMessage,
24
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupExclusiveAdd(${arg})`
25
+ });
26
+ const subgroupInclusiveAdd = dualImpl({
27
+ name: "subgroupInclusiveAdd",
28
+ signature: (arg) => ({
29
+ argTypes: [arg],
30
+ returnType: arg
31
+ }),
32
+ normalImpl: errorMessage,
33
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupInclusiveAdd(${arg})`
34
+ });
35
+ const subgroupAll = dualImpl({
36
+ name: "subgroupAll",
37
+ signature: {
38
+ argTypes: [bool],
39
+ returnType: bool
40
+ },
41
+ normalImpl: errorMessage,
42
+ codegenImpl: (_ctx, [e]) => stitch`subgroupAll(${e})`
43
+ });
44
+ const subgroupAnd = dualImpl({
45
+ name: "subgroupAnd",
46
+ signature: (arg) => ({
47
+ argTypes: [arg],
48
+ returnType: arg
49
+ }),
50
+ normalImpl: errorMessage,
51
+ codegenImpl: (_ctx, [e]) => stitch`subgroupAnd(${e})`
52
+ });
53
+ const subgroupAny = dualImpl({
54
+ name: "subgroupAny",
55
+ signature: {
56
+ argTypes: [bool],
57
+ returnType: bool
58
+ },
59
+ normalImpl: errorMessage,
60
+ codegenImpl: (_ctx, [e]) => stitch`subgroupAny(${e})`
61
+ });
62
+ const subgroupBallot = dualImpl({
63
+ name: "subgroupBallot",
64
+ signature: {
65
+ argTypes: [bool],
66
+ returnType: vec4u
67
+ },
68
+ normalImpl: errorMessage,
69
+ codegenImpl: (_ctx, [e]) => stitch`subgroupBallot(${e})`
70
+ });
71
+ const subgroupBroadcast = dualImpl({
72
+ name: "subgroupBroadcast",
73
+ signature: (...args) => {
74
+ const id = unify([args[1]], [i32, u32]);
75
+ if (!id) throw new Error(`subgroupBroadcast's second argument has to be compatible with i32 or u32. Got: ${args[1].type}`);
76
+ return {
77
+ argTypes: [args[0], id[0]],
78
+ returnType: args[0]
79
+ };
80
+ },
81
+ normalImpl: errorMessage,
82
+ codegenImpl: (_ctx, [e, index]) => stitch`subgroupBroadcast(${e}, ${index})`
83
+ });
84
+ const subgroupBroadcastFirst = dualImpl({
85
+ name: "subgroupBroadcastFirst",
86
+ signature: (arg) => ({
87
+ argTypes: [arg],
88
+ returnType: arg
89
+ }),
90
+ normalImpl: errorMessage,
91
+ codegenImpl: (_ctx, [e]) => stitch`subgroupBroadcastFirst(${e})`
92
+ });
93
+ const subgroupElect = dualImpl({
94
+ name: "subgroupElect",
95
+ signature: {
96
+ argTypes: [],
97
+ returnType: bool
98
+ },
99
+ normalImpl: errorMessage,
100
+ codegenImpl: () => stitch`subgroupElect()`
101
+ });
102
+ const subgroupMax = dualImpl({
103
+ name: "subgroupMax",
104
+ signature: (arg) => ({
105
+ argTypes: [arg],
106
+ returnType: arg
107
+ }),
108
+ normalImpl: errorMessage,
109
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupMax(${arg})`
110
+ });
111
+ const subgroupMin = dualImpl({
112
+ name: "subgroupMin",
113
+ signature: (arg) => ({
114
+ argTypes: [arg],
115
+ returnType: arg
116
+ }),
117
+ normalImpl: errorMessage,
118
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupMin(${arg})`
119
+ });
120
+ const subgroupMul = dualImpl({
121
+ name: "subgroupMul",
122
+ signature: (arg) => ({
123
+ argTypes: [arg],
124
+ returnType: arg
125
+ }),
126
+ normalImpl: errorMessage,
127
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupMul(${arg})`
128
+ });
129
+ const subgroupExclusiveMul = dualImpl({
130
+ name: "subgroupExclusiveMul",
131
+ signature: (arg) => ({
132
+ argTypes: [arg],
133
+ returnType: arg
134
+ }),
135
+ normalImpl: errorMessage,
136
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupExclusiveMul(${arg})`
137
+ });
138
+ const subgroupInclusiveMul = dualImpl({
139
+ name: "subgroupInclusiveMul",
140
+ signature: (arg) => ({
141
+ argTypes: [arg],
142
+ returnType: arg
143
+ }),
144
+ normalImpl: errorMessage,
145
+ codegenImpl: (_ctx, [arg]) => stitch`subgroupInclusiveMul(${arg})`
146
+ });
147
+ const subgroupOr = dualImpl({
148
+ name: "subgroupOr",
149
+ signature: (arg) => ({
150
+ argTypes: [arg],
151
+ returnType: arg
152
+ }),
153
+ normalImpl: errorMessage,
154
+ codegenImpl: (_ctx, [e]) => stitch`subgroupOr(${e})`
155
+ });
156
+ const subgroupShuffle = dualImpl({
157
+ name: "subgroupShuffle",
158
+ signature: (...args) => {
159
+ const id = unify([args[1]], [i32, u32]);
160
+ if (!id) throw new Error(`subgroupShuffle's second argument has to be compatible with i32 or u32. Got: ${args[1].type}`);
161
+ return {
162
+ argTypes: [args[0], id[0]],
163
+ returnType: args[0]
164
+ };
165
+ },
166
+ normalImpl: errorMessage,
167
+ codegenImpl: (_ctx, [e, index]) => stitch`subgroupShuffle(${e}, ${index})`
168
+ });
169
+ const subgroupShuffleDown = dualImpl({
170
+ name: "subgroupShuffleDown",
171
+ signature: (...args) => {
172
+ const delta = unify([args[1]], [u32]);
173
+ if (!delta) throw new Error(`subgroupShuffleDown's second argument has to be compatible with u32. Got: ${args[1].type}`);
174
+ return {
175
+ argTypes: [args[0], delta[0]],
176
+ returnType: args[0]
177
+ };
178
+ },
179
+ normalImpl: errorMessage,
180
+ codegenImpl: (_ctx, [e, delta]) => stitch`subgroupShuffleDown(${e}, ${delta})`
181
+ });
182
+ const subgroupShuffleUp = dualImpl({
183
+ name: "subgroupShuffleUp",
184
+ signature: (...args) => {
185
+ const delta = unify([args[1]], [u32]);
186
+ if (!delta) throw new Error(`subgroupShuffleUp's second argument has to be compatible with u32. Got: ${args[1].type}`);
187
+ return {
188
+ argTypes: [args[0], delta[0]],
189
+ returnType: args[0]
190
+ };
191
+ },
192
+ normalImpl: errorMessage,
193
+ codegenImpl: (_ctx, [e, delta]) => stitch`subgroupShuffleUp(${e}, ${delta})`
194
+ });
195
+ const subgroupShuffleXor = dualImpl({
196
+ name: "subgroupShuffleXor",
197
+ signature: (...args) => {
198
+ const mask = unify([args[1]], [u32]);
199
+ if (!mask) throw new Error(`subgroupShuffleXor's second argument has to be compatible with u32. Got: ${args[1].type}`);
200
+ return {
201
+ argTypes: [args[0], mask[0]],
202
+ returnType: args[0]
203
+ };
204
+ },
205
+ normalImpl: errorMessage,
206
+ codegenImpl: (_ctx, [e, mask]) => stitch`subgroupShuffleXor(${e}, ${mask})`
207
+ });
208
+ const subgroupXor = dualImpl({
209
+ name: "subgroupXor",
210
+ signature: (arg) => ({
211
+ argTypes: [arg],
212
+ returnType: arg
213
+ }),
214
+ normalImpl: errorMessage,
215
+ codegenImpl: (_ctx, [e]) => stitch`subgroupXor(${e})`
216
+ });
217
+ //#endregion
218
+ export { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor };
@@ -0,0 +1,117 @@
1
+ import { $internal, $repr } from "../shared/symbols.js";
2
+ import { comparisonSampler, sampler } from "../data/sampler.js";
3
+ import { DualFn } from "../types.js";
4
+ import { v2f, v2i, v2u, v3f, v3i, v3u, v4f, v4i, v4u } from "../data/wgslTypes.js";
5
+ import { StorageTextureFormats, TextureFormats } from "../core/texture/textureFormats.js";
6
+ import { texture1d, texture2d, texture2dArray, texture3d, textureCube, textureCubeArray, textureDepth2d, textureDepth2dArray, textureDepthCube, textureDepthCubeArray, textureDepthMultisampled2d, textureExternal, textureMultisampled2d, textureStorage1d, textureStorage2d, textureStorage2dArray, textureStorage3d } from "../data/texture.js";
7
+
8
+ //#region src/std/texture.d.ts
9
+ declare function sampleCpu<T extends texture1d>(texture: T, sampler: sampler, coords: number): v4f;
10
+ declare function sampleCpu<T extends texture2d>(texture: T, sampler: sampler, coords: v2f, offset?: v2i): v4f;
11
+ declare function sampleCpu<T extends texture2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, offset?: v2i): v4f;
12
+ declare function sampleCpu<T extends texture3d | textureCube>(texture: T, sampler: sampler, coords: v3f): v4f;
13
+ declare function sampleCpu<T extends texture3d>(texture: T, sampler: sampler, coords: v3f, offset: v3i): v4f;
14
+ declare function sampleCpu<T extends textureCubeArray>(texture: T, sampler: sampler, coords: v3f, arrayIndex: number): v4f;
15
+ declare function sampleCpu<T extends textureDepth2d>(texture: T, sampler: sampler, coords: v2f, offset?: v2i): number;
16
+ declare function sampleCpu<T extends textureDepth2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, offset?: v2i): number;
17
+ declare function sampleCpu<T extends textureDepthCube>(texture: T, sampler: sampler, coords: v3f, arrayIndex?: number): number;
18
+ declare const textureSample: DualFn;
19
+ declare function sampleBiasCpu<T extends texture1d>(texture: T, sampler: sampler, coords: number, bias: number): v4f;
20
+ declare function sampleBiasCpu<T extends texture2d>(texture: T, sampler: sampler, coords: v2f, bias: number, offset?: v2i): v4f;
21
+ declare function sampleBiasCpu<T extends texture2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, bias: number, offset?: v2i): v4f;
22
+ declare function sampleBiasCpu<T extends texture3d | textureCube>(texture: T, sampler: sampler, coords: v3f, bias: number, offset?: v3i): v4f;
23
+ declare function sampleBiasCpu<T extends textureCubeArray>(texture: T, sampler: sampler, coords: v3f, arrayIndex: number, bias: number): v4f;
24
+ declare const textureSampleBias: DualFn;
25
+ declare function sampleLevelCpu<T extends texture1d>(texture: T, sampler: sampler, coords: number, level: number): v4f;
26
+ declare function sampleLevelCpu<T extends texture2d>(texture: T, sampler: sampler, coords: v2f, level: number): v4f;
27
+ declare function sampleLevelCpu<T extends texture2d>(texture: T, sampler: sampler, coords: v2f, level: number, offset: v2i): v4f;
28
+ declare function sampleLevelCpu<T extends texture2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, level: number): v4f;
29
+ declare function sampleLevelCpu<T extends texture2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, level: number, offset: v2i): v4f;
30
+ declare function sampleLevelCpu<T extends texture3d | textureCube>(texture: T, sampler: sampler, coords: v3f, level: number): v4f;
31
+ declare function sampleLevelCpu<T extends texture3d>(texture: T, sampler: sampler, coords: v3f, level: number, offset: v3i): v4f;
32
+ declare function sampleLevelCpu<T extends textureCubeArray>(texture: T, sampler: sampler, coords: v3f, arrayIndex: number, level: number): v4f;
33
+ declare function sampleLevelCpu<T extends textureDepth2d>(texture: T, sampler: sampler, coords: v2f, level: number): number;
34
+ declare function sampleLevelCpu<T extends textureDepth2d>(texture: T, sampler: sampler, coords: v2f, level: number, offset: v2i): number;
35
+ declare function sampleLevelCpu<T extends textureDepth2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, level: number): number;
36
+ declare function sampleLevelCpu<T extends textureDepth2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, level: number, offset: v2i): number;
37
+ declare function sampleLevelCpu<T extends textureDepthCube>(texture: T, sampler: sampler, coords: v3f, level: number): number;
38
+ declare function sampleLevelCpu<T extends textureCubeArray>(texture: T, sampler: sampler, coords: v3f, arrayIndex: number, level: number): number;
39
+ declare const textureSampleLevel: DualFn;
40
+ type PrimitiveToLoadedType = {
41
+ f32: v4f;
42
+ i32: v4i;
43
+ u32: v4u;
44
+ };
45
+ type TexelFormatToInstanceType<T extends StorageTextureFormats> = TextureFormats[T]['vectorType'][typeof $repr];
46
+ declare function textureLoadCpu<T extends texture1d>(texture: T, coords: number, level: number): PrimitiveToLoadedType[T[typeof $internal]['type']];
47
+ declare function textureLoadCpu<T extends texture2d>(texture: T, coords: v2i | v2u, level: number): PrimitiveToLoadedType[T[typeof $internal]['type']];
48
+ declare function textureLoadCpu<T extends texture2dArray>(texture: T, coords: v2i | v2u, arrayIndex: number, level: number): PrimitiveToLoadedType[T[typeof $internal]['type']];
49
+ declare function textureLoadCpu<T extends texture3d>(texture: T, coords: v3i | v3u, level: number): PrimitiveToLoadedType[T[typeof $internal]['type']];
50
+ declare function textureLoadCpu<T extends textureMultisampled2d>(texture: T, coords: v2i | v2u, sampleIndex: number): PrimitiveToLoadedType[T[typeof $internal]['type']];
51
+ declare function textureLoadCpu<T extends textureDepth2d>(texture: T, coords: v2i | v2u, level: number): number;
52
+ declare function textureLoadCpu<T extends textureDepth2dArray>(texture: T, coords: v2i | v2u, arrayIndex: number, level: number): number;
53
+ declare function textureLoadCpu<T extends textureDepthMultisampled2d>(texture: T, coords: v2i | v2u, sampleIndex: number): number;
54
+ declare function textureLoadCpu<T extends textureExternal>(texture: T, coords: v2i | v2u): v4f;
55
+ declare function textureLoadCpu<T extends textureStorage1d>(texture: T, coords: number): TexelFormatToInstanceType<T[typeof $internal][0]>;
56
+ declare function textureLoadCpu<T extends textureStorage2d>(texture: T, coords: v2i | v2u): TexelFormatToInstanceType<T[typeof $internal][0]>;
57
+ declare function textureLoadCpu<T extends textureStorage2dArray>(texture: T, coords: v2i | v2u, arrayIndex: number): TexelFormatToInstanceType<T[typeof $internal][0]>;
58
+ declare function textureLoadCpu<T extends textureStorage3d>(texture: T, coords: v3i | v3u): TexelFormatToInstanceType<T[typeof $internal][0]>;
59
+ declare const textureLoad: DualFn;
60
+ declare function textureStoreCpu<T extends textureStorage1d>(texture: T, coords: number, value: TexelFormatToInstanceType<T[typeof $internal][0]>): void;
61
+ declare function textureStoreCpu<T extends textureStorage2d>(texture: T, coords: v2i | v2u, value: TexelFormatToInstanceType<T[typeof $internal][0]>): void;
62
+ declare function textureStoreCpu<T extends textureStorage2dArray>(texture: T, coords: v2i | v2u, arrayIndex: number, value: TexelFormatToInstanceType<T[typeof $internal][0]>): void;
63
+ declare function textureStoreCpu<T extends textureStorage3d>(texture: T, coords: v3i | v3u, value: TexelFormatToInstanceType<T[typeof $internal][0]>): void;
64
+ declare const textureStore: DualFn;
65
+ declare function textureDimensionsCpu<T extends texture1d | textureStorage1d>(texture: T): number;
66
+ declare function textureDimensionsCpu<T extends texture1d>(texture: T, level: number): number;
67
+ declare function textureDimensionsCpu<T extends texture2d | texture2dArray | textureCube | textureCubeArray | textureStorage2d | textureStorage2dArray | textureExternal>(texture: T): v2u;
68
+ declare function textureDimensionsCpu<T extends texture2d | texture2dArray | textureCube | textureCubeArray>(texture: T, level: number): v2u;
69
+ declare function textureDimensionsCpu<T extends texture3d | textureStorage3d>(texture: T): v3u;
70
+ declare function textureDimensionsCpu<T extends texture3d>(texture: T, level: number): v3u;
71
+ declare const textureDimensions: DualFn;
72
+ type Gather2dArgs<T extends texture2d = texture2d> = [component: number, texture: T, sampler: sampler, coords: v2f, offset?: v2i];
73
+ type Gather2dArrayArgs<T extends texture2dArray = texture2dArray> = [component: number, texture: T, sampler: sampler, coords: v2f, arrayIndex: number, offset?: v2i];
74
+ type GatherCubeArgs<T extends textureCube = textureCube> = [component: number, texture: T, sampler: sampler, coords: v3f];
75
+ type GatherCubeArrayArgs<T extends textureCubeArray = textureCubeArray> = [component: number, texture: T, sampler: sampler, coords: v3f, arrayIndex: number];
76
+ type GatherDepth2dArgs = [texture: textureDepth2d, sampler: sampler, coords: v2f, offset?: v2i];
77
+ type GatherDepth2dArrayArgs = [texture: textureDepth2dArray, sampler: sampler, coords: v2f, arrayIndex: number, offset?: v2i];
78
+ type GatherDepthCubeArgs = [texture: textureDepthCube, sampler: sampler, coords: v3f];
79
+ type GatherDepthCubeArrayArgs = [texture: textureDepthCubeArray, sampler: sampler, coords: v3f, arrayIndex: number];
80
+ type TextureGatherCpuFn = {
81
+ <T extends texture2d>(...args: Gather2dArgs<T>): PrimitiveToLoadedType[T[typeof $internal]['type']];
82
+ <T extends texture2dArray>(...args: Gather2dArrayArgs<T>): PrimitiveToLoadedType[T[typeof $internal]['type']];
83
+ <T extends textureCube>(...args: GatherCubeArgs<T>): PrimitiveToLoadedType[T[typeof $internal]['type']];
84
+ <T extends textureCubeArray>(...args: GatherCubeArrayArgs<T>): PrimitiveToLoadedType[T[typeof $internal]['type']];
85
+ (...args: GatherDepth2dArgs): v4f;
86
+ (...args: GatherDepth2dArrayArgs): v4f;
87
+ (...args: GatherDepthCubeArgs): v4f;
88
+ (...args: GatherDepthCubeArrayArgs): v4f;
89
+ };
90
+ declare const textureGather: DualFn;
91
+ declare function textureSampleCompareCpu<T extends textureDepth2d>(texture: T, sampler: comparisonSampler, coords: v2f, depthRef: number): number;
92
+ declare function textureSampleCompareCpu<T extends textureDepth2d>(texture: T, sampler: comparisonSampler, coords: v2f, depthRef: number, offset: v2i): number;
93
+ declare function textureSampleCompareCpu<T extends textureDepth2dArray>(texture: T, sampler: comparisonSampler, coords: v2f, arrayIndex: number, depthRef: number): number;
94
+ declare function textureSampleCompareCpu<T extends textureDepth2dArray>(texture: T, sampler: comparisonSampler, coords: v2f, arrayIndex: number, depthRef: number, offset: v2i): number;
95
+ declare function textureSampleCompareCpu<T extends textureDepthCube>(texture: T, sampler: comparisonSampler, coords: v3f, depthRef: number): number;
96
+ declare function textureSampleCompareCpu<T extends textureDepthCubeArray>(texture: T, sampler: comparisonSampler, coords: v3f, arrayIndex: number, depthRef: number): number;
97
+ declare const textureSampleCompare: DualFn;
98
+ declare function textureSampleCompareLevelCpu<T extends textureDepth2d>(texture: T, sampler: comparisonSampler, coords: v2f, depthRef: number): number;
99
+ declare function textureSampleCompareLevelCpu<T extends textureDepth2d>(texture: T, sampler: comparisonSampler, coords: v2f, depthRef: number, offset: v2i): number;
100
+ declare function textureSampleCompareLevelCpu<T extends textureDepth2dArray>(texture: T, sampler: comparisonSampler, coords: v2f, arrayIndex: number, depthRef: number): number;
101
+ declare function textureSampleCompareLevelCpu<T extends textureDepth2dArray>(texture: T, sampler: comparisonSampler, coords: v2f, arrayIndex: number, depthRef: number, offset: v2i): number;
102
+ declare function textureSampleCompareLevelCpu<T extends textureDepthCube>(texture: T, sampler: comparisonSampler, coords: v3f, depthRef: number): number;
103
+ declare function textureSampleCompareLevelCpu<T extends textureDepthCubeArray>(texture: T, sampler: comparisonSampler, coords: v3f, arrayIndex: number, depthRef: number): number;
104
+ declare const textureSampleCompareLevel: DualFn;
105
+ declare function textureSampleBaseClampToEdgeCpu<T extends texture2d | textureExternal>(_texture: T, _sampler: sampler, _coords: v2f): v4f;
106
+ declare function sampleGradCpu<T extends texture2d>(texture: T, sampler: sampler, coords: v2f, ddx: v2f, ddy: v2f): v4f;
107
+ declare function sampleGradCpu<T extends texture2d>(texture: T, sampler: sampler, coords: v2f, ddx: v2f, ddy: v2f, offset: v2i): v4f;
108
+ declare function sampleGradCpu<T extends texture2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, ddx: v2f, ddy: v2f): v4f;
109
+ declare function sampleGradCpu<T extends texture2dArray>(texture: T, sampler: sampler, coords: v2f, arrayIndex: number, ddx: v2f, ddy: v2f, offset: v2i): v4f;
110
+ declare function sampleGradCpu<T extends texture3d>(texture: T, sampler: sampler, coords: v3f, ddx: v3f, ddy: v3f): v4f;
111
+ declare function sampleGradCpu<T extends texture3d>(texture: T, sampler: sampler, coords: v3f, ddx: v3f, ddy: v3f, offset: v3i): v4f;
112
+ declare function sampleGradCpu<T extends textureCube>(texture: T, sampler: sampler, coords: v3f, ddx: v3f, ddy: v3f): v4f;
113
+ declare function sampleGradCpu<T extends textureCubeArray>(texture: T, sampler: sampler, coords: v3f, arrayIndex: number, ddx: v3f, ddy: v3f): v4f;
114
+ declare const textureSampleGrad: DualFn;
115
+ declare const textureSampleBaseClampToEdge: DualFn;
116
+ //#endregion
117
+ export { textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleGrad, textureSampleLevel, textureStore };
package/std/texture.js ADDED
@@ -0,0 +1,207 @@
1
+ import { Void } from "../data/wgslTypes.js";
2
+ import { stitch } from "../core/resolve/stitch.js";
3
+ import { f32, i32, u32 } from "../data/numeric.js";
4
+ import { vec2u, vec3u, vec4f, vec4i, vec4u } from "../data/vector.js";
5
+ import { MissingCpuImplError, dualImpl } from "../core/function/dualImpl.js";
6
+ import { isWgslExternalTexture, isWgslTexture } from "../data/texture.js";
7
+ import { getTextureFormatInfo } from "../core/texture/textureFormats.js";
8
+ //#region src/std/texture.ts
9
+ function sampleCpu(_texture, _sampler, _coords, _offsetOrArrayIndex, _maybeOffset) {
10
+ throw new MissingCpuImplError("Texture sampling relies on GPU resources and cannot be executed outside of a draw call");
11
+ }
12
+ const textureSample = dualImpl({
13
+ name: "textureSample",
14
+ normalImpl: sampleCpu,
15
+ codegenImpl: (_ctx, args) => stitch`textureSample(${args})`,
16
+ signature: (...args) => {
17
+ return {
18
+ argTypes: args,
19
+ returnType: args[0].type.startsWith("texture_depth") ? f32 : vec4f
20
+ };
21
+ }
22
+ });
23
+ function sampleBiasCpu(_texture, _sampler, _coords, _biasOrArrayIndex, _biasOrOffset, _maybeOffset) {
24
+ throw new MissingCpuImplError("Texture sampling with bias relies on GPU resources and cannot be executed outside of a draw call");
25
+ }
26
+ const textureSampleBias = dualImpl({
27
+ name: "textureSampleBias",
28
+ normalImpl: sampleBiasCpu,
29
+ codegenImpl: (_ctx, args) => stitch`textureSampleBias(${args})`,
30
+ signature: (...args) => ({
31
+ argTypes: args,
32
+ returnType: vec4f
33
+ })
34
+ });
35
+ function sampleLevelCpu(_texture, _sampler, _coords, _level, _offsetOrArrayIndex, _maybeOffset) {
36
+ throw new MissingCpuImplError("Texture sampling relies on GPU resources and cannot be executed outside of a draw call");
37
+ }
38
+ const textureSampleLevel = dualImpl({
39
+ name: "textureSampleLevel",
40
+ normalImpl: sampleLevelCpu,
41
+ codegenImpl: (_ctx, args) => stitch`textureSampleLevel(${args})`,
42
+ signature: (...args) => {
43
+ return {
44
+ argTypes: args,
45
+ returnType: args[0].type.startsWith("texture_depth") ? f32 : vec4f
46
+ };
47
+ }
48
+ });
49
+ function textureLoadCpu(_texture, _coords, _levelOrArrayIndex) {
50
+ throw new MissingCpuImplError("`textureLoad` relies on GPU resources and cannot be executed outside of a draw call");
51
+ }
52
+ const textureLoad = dualImpl({
53
+ name: "textureLoad",
54
+ normalImpl: textureLoadCpu,
55
+ codegenImpl: (_ctx, args) => stitch`textureLoad(${args})`,
56
+ signature: (...args) => {
57
+ const texture = args[0];
58
+ if (isWgslTexture(texture)) {
59
+ const isDepth = texture.type.startsWith("texture_depth");
60
+ const sampleType = texture.sampleType;
61
+ return {
62
+ argTypes: args,
63
+ returnType: isDepth ? f32 : sampleType.type === "f32" ? vec4f : sampleType.type === "u32" ? vec4u : vec4i
64
+ };
65
+ }
66
+ if (isWgslExternalTexture(texture)) return {
67
+ argTypes: args,
68
+ returnType: vec4f
69
+ };
70
+ const format = texture.format;
71
+ return {
72
+ argTypes: args,
73
+ returnType: getTextureFormatInfo(format).vectorType
74
+ };
75
+ }
76
+ });
77
+ function textureStoreCpu(_texture, _coords, _arrayIndexOrValue, _maybeValue) {
78
+ throw new MissingCpuImplError("`textureStore` relies on GPU resources and cannot be executed outside of a draw call");
79
+ }
80
+ const textureStore = dualImpl({
81
+ name: "textureStore",
82
+ normalImpl: textureStoreCpu,
83
+ codegenImpl: (_ctx, args) => stitch`textureStore(${args})`,
84
+ signature: (...args) => ({
85
+ argTypes: args,
86
+ returnType: Void
87
+ })
88
+ });
89
+ function textureDimensionsCpu(_texture, _level) {
90
+ throw new MissingCpuImplError("`textureDimensions` relies on GPU resources and cannot be executed outside of a draw call");
91
+ }
92
+ const textureDimensions = dualImpl({
93
+ name: "textureDimensions",
94
+ normalImpl: textureDimensionsCpu,
95
+ codegenImpl: (_ctx, args) => stitch`textureDimensions(${args})`,
96
+ signature: (...args) => {
97
+ const dim = args[0].dimension;
98
+ if (dim === "1d") return {
99
+ argTypes: args,
100
+ returnType: u32
101
+ };
102
+ if (dim === "3d") return {
103
+ argTypes: args,
104
+ returnType: vec3u
105
+ };
106
+ return {
107
+ argTypes: args,
108
+ returnType: vec2u
109
+ };
110
+ }
111
+ });
112
+ const textureGatherCpu = (..._args) => {
113
+ throw new Error("Texture gather relies on GPU resources and cannot be executed outside of a draw call");
114
+ };
115
+ const sampleTypeToVecType = {
116
+ f32: vec4f,
117
+ i32: vec4i,
118
+ u32: vec4u
119
+ };
120
+ const textureGather = dualImpl({
121
+ name: "textureGather",
122
+ normalImpl: textureGatherCpu,
123
+ codegenImpl: (_ctx, args) => stitch`textureGather(${args})`,
124
+ signature: (...args) => {
125
+ if (args[0].type.startsWith("texture")) {
126
+ const [texture, sampler, coords, _, ...rest] = args;
127
+ return {
128
+ argTypes: texture.type === "texture_depth_2d_array" || texture.type === "texture_depth_cube_array" ? [
129
+ texture,
130
+ sampler,
131
+ coords,
132
+ [u32, i32],
133
+ ...rest
134
+ ] : args,
135
+ returnType: vec4f
136
+ };
137
+ }
138
+ const [_, texture, sampler, coords, ...rest] = args;
139
+ return {
140
+ argTypes: texture.type === "texture_2d_array" || texture.type === "texture_cube_array" ? [
141
+ [u32, i32],
142
+ texture,
143
+ sampler,
144
+ coords,
145
+ [u32, i32],
146
+ ...rest
147
+ ] : [
148
+ [u32, i32],
149
+ texture,
150
+ sampler,
151
+ coords,
152
+ ...rest
153
+ ],
154
+ returnType: sampleTypeToVecType[texture.sampleType.type]
155
+ };
156
+ }
157
+ });
158
+ function textureSampleCompareCpu(_texture, _sampler, _coords, _depthRefOrArrayIndex, _depthRefOrOffset, _maybeOffset) {
159
+ throw new MissingCpuImplError("Texture comparison sampling relies on GPU resources and cannot be executed outside of a draw call");
160
+ }
161
+ const textureSampleCompare = dualImpl({
162
+ name: "textureSampleCompare",
163
+ normalImpl: textureSampleCompareCpu,
164
+ codegenImpl: (_ctx, args) => stitch`textureSampleCompare(${args})`,
165
+ signature: (...args) => ({
166
+ argTypes: args,
167
+ returnType: f32
168
+ })
169
+ });
170
+ function textureSampleCompareLevelCpu(_texture, _sampler, _coords, _depthRefOrArrayIndex, _depthRefOrOffset, _maybeOffset) {
171
+ throw new MissingCpuImplError("Texture comparison sampling with level relies on GPU resources and cannot be executed outside of a draw call");
172
+ }
173
+ const textureSampleCompareLevel = dualImpl({
174
+ name: "textureSampleCompareLevel",
175
+ normalImpl: textureSampleCompareLevelCpu,
176
+ codegenImpl: (ctx, args) => stitch`textureSampleCompareLevel(${args})`,
177
+ signature: (...args) => ({
178
+ argTypes: args,
179
+ returnType: f32
180
+ })
181
+ });
182
+ function textureSampleBaseClampToEdgeCpu(_texture, _sampler, _coords) {
183
+ throw new MissingCpuImplError("Texture sampling with base clamp to edge is not supported outside of GPU mode.");
184
+ }
185
+ function sampleGradCpu(_texture, _sampler, _coords, _ddxOrArrayIndex, _ddyOrDdx, _offsetOrDdy, _maybeOffset) {
186
+ throw new MissingCpuImplError("Texture sampling with gradients relies on GPU resources and cannot be executed outside of a draw call");
187
+ }
188
+ const textureSampleGrad = dualImpl({
189
+ name: "textureSampleGrad",
190
+ normalImpl: sampleGradCpu,
191
+ codegenImpl: (_ctx, args) => stitch`textureSampleGrad(${args})`,
192
+ signature: (...args) => ({
193
+ argTypes: args,
194
+ returnType: vec4f
195
+ })
196
+ });
197
+ const textureSampleBaseClampToEdge = dualImpl({
198
+ name: "textureSampleBaseClampToEdge",
199
+ normalImpl: textureSampleBaseClampToEdgeCpu,
200
+ codegenImpl: (_ctx, args) => stitch`textureSampleBaseClampToEdge(${args})`,
201
+ signature: (...args) => ({
202
+ argTypes: args,
203
+ returnType: vec4f
204
+ })
205
+ });
206
+ //#endregion
207
+ export { textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleGrad, textureSampleLevel, textureStore };
package/tgpu.js ADDED
@@ -0,0 +1,42 @@
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 { bindGroupLayout } from "./tgpuBindGroupLayout.js";
6
+ import { slot } from "./core/slot/slot.js";
7
+ import { privateVar, workgroupVar } from "./core/variable/tgpuVariable.js";
8
+ import { unroll } from "./core/unroll/tgpuUnroll.js";
9
+ import { resolve, resolveWithContext } from "./core/resolve/tgpuResolve.js";
10
+ import { computeFn } from "./core/function/tgpuComputeFn.js";
11
+ import { vertexLayout } from "./core/vertexLayout/vertexLayout.js";
12
+ import { init, initFromDevice } from "./core/root/init.js";
13
+ import { lazy } from "./core/slot/lazy.js";
14
+ import { accessor, mutableAccessor } from "./core/slot/accessor.js";
15
+ import { fragmentFn } from "./core/function/tgpuFragmentFn.js";
16
+ import { vertexFn } from "./core/function/tgpuVertexFn.js";
17
+ import { tgpuUnstable_exports } from "./tgpuUnstable.js";
18
+ //#region src/tgpu.ts
19
+ var tgpu_exports = /* @__PURE__ */ __exportAll({
20
+ accessor: () => accessor,
21
+ bindGroupLayout: () => bindGroupLayout,
22
+ comptime: () => comptime,
23
+ computeFn: () => computeFn,
24
+ const: () => constant,
25
+ fn: () => fn,
26
+ fragmentFn: () => fragmentFn,
27
+ init: () => init,
28
+ initFromDevice: () => initFromDevice,
29
+ lazy: () => lazy,
30
+ mutableAccessor: () => mutableAccessor,
31
+ privateVar: () => privateVar,
32
+ resolve: () => resolve,
33
+ resolveWithContext: () => resolveWithContext,
34
+ slot: () => slot,
35
+ unroll: () => unroll,
36
+ vertexFn: () => vertexFn,
37
+ vertexLayout: () => vertexLayout,
38
+ workgroupVar: () => workgroupVar,
39
+ "~unstable": () => tgpuUnstable_exports
40
+ });
41
+ //#endregion
42
+ export { tgpu_exports };