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,127 @@
1
+ import { DualFn } from "../types.js";
2
+ import { AnyBooleanVecInstance, AnyFloatVecInstance, AnyNumericVecInstance, AnyVec2Instance, AnyVec3Instance, AnyVecInstance, v2b, v3b, v4b } from "../data/wgslTypes.js";
3
+
4
+ //#region src/std/boolean.d.ts
5
+ /**
6
+ * Checks whether `lhs == rhs` on all components.
7
+ * Equivalent to `all(eq(lhs, rhs))`.
8
+ * @example
9
+ * allEq(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns false
10
+ * allEq(vec3u(0, 1, 2), vec3u(0, 1, 2)) // returns true
11
+ */
12
+ declare const allEq: DualFn<(<T extends AnyVecInstance>(lhs: T, rhs: T) => boolean)>;
13
+ /**
14
+ * Checks **component-wise** whether `lhs == rhs`.
15
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`, or use `allEq`.
16
+ * @example
17
+ * eq(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns vec2b(true, false)
18
+ * eq(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, true, false)
19
+ * all(eq(vec4i(4, 3, 2, 1), vec4i(4, 3, 2, 1))) // returns true
20
+ * allEq(vec4i(4, 3, 2, 1), vec4i(4, 3, 2, 1)) // returns true
21
+ */
22
+ declare const eq: DualFn<(<T extends AnyVecInstance>(lhs: T, rhs: T) => T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)>;
23
+ /**
24
+ * Checks **component-wise** whether `lhs != rhs`.
25
+ * This function does **not** return `bool`, for that use-case, wrap the result in `any`.
26
+ * @example
27
+ * ne(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns vec2b(false, true)
28
+ * ne(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, false, true)
29
+ * any(ne(vec4i(4, 3, 2, 1), vec4i(4, 2, 2, 1))) // returns true
30
+ */
31
+ declare const ne: DualFn<(<T extends AnyVecInstance>(lhs: T, rhs: T) => T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)>;
32
+ /**
33
+ * Checks **component-wise** whether `lhs < rhs`.
34
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
35
+ * @example
36
+ * lt(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(false, true)
37
+ * lt(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, false, false)
38
+ * all(lt(vec4i(1, 2, 3, 4), vec4i(2, 3, 4, 5))) // returns true
39
+ */
40
+ declare const lt: DualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)>;
41
+ /**
42
+ * Checks **component-wise** whether `lhs <= rhs`.
43
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
44
+ * @example
45
+ * le(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(true, true)
46
+ * le(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, true, false)
47
+ * all(le(vec4i(1, 2, 3, 4), vec4i(2, 3, 3, 5))) // returns true
48
+ */
49
+ declare const le: DualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)>;
50
+ /**
51
+ * Checks **component-wise** whether `lhs > rhs`.
52
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
53
+ * @example
54
+ * gt(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(false, false)
55
+ * gt(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, false, true)
56
+ * all(gt(vec4i(2, 3, 4, 5), vec4i(1, 2, 3, 4))) // returns true
57
+ */
58
+ declare const gt: DualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)>;
59
+ /**
60
+ * Checks **component-wise** whether `lhs >= rhs`.
61
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
62
+ * @example
63
+ * ge(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(true, false)
64
+ * ge(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, true, true)
65
+ * all(ge(vec4i(2, 2, 4, 5), vec4i(1, 2, 3, 4))) // returns true
66
+ */
67
+ declare const ge: DualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)>;
68
+ /**
69
+ * Returns **component-wise** `!value`.
70
+ * @example
71
+ * not(vec2b(false, true)) // returns vec2b(true, false)
72
+ * not(vec3b(true, true, false)) // returns vec3b(false, false, true)
73
+ */
74
+ declare const not: DualFn<(<T extends AnyBooleanVecInstance>(value: T) => T)>;
75
+ /**
76
+ * Returns **component-wise** logical `or` result.
77
+ * @example
78
+ * or(vec2b(false, true), vec2b(false, false)) // returns vec2b(false, true)
79
+ * or(vec3b(true, true, false), vec3b(false, true, false)) // returns vec3b(true, true, false)
80
+ */
81
+ declare const or: DualFn<(<T extends AnyBooleanVecInstance>(lhs: T, rhs: T) => T)>;
82
+ /**
83
+ * Returns **component-wise** logical `and` result.
84
+ * @example
85
+ * and(vec2b(false, true), vec2b(true, true)) // returns vec2b(false, true)
86
+ * and(vec3b(true, true, false), vec3b(false, true, false)) // returns vec3b(false, true, false)
87
+ */
88
+ declare const and: DualFn<(<T extends AnyBooleanVecInstance>(lhs: T, rhs: T) => T)>;
89
+ /**
90
+ * Returns `true` if each component of `value` is true.
91
+ * @example
92
+ * all(vec2b(false, true)) // returns false
93
+ * all(vec3b(true, true, true)) // returns true
94
+ */
95
+ declare const all: DualFn<(value: AnyBooleanVecInstance) => boolean>;
96
+ /**
97
+ * Returns `true` if any component of `value` is true.
98
+ * @example
99
+ * any(vec2b(false, true)) // returns true
100
+ * any(vec3b(false, false, false)) // returns false
101
+ */
102
+ declare const any: DualFn<(value: AnyBooleanVecInstance) => boolean>;
103
+ /**
104
+ * Checks whether the given elements differ by at most the `precision` value.
105
+ * Checks all elements of `lhs` and `rhs` if arguments are vectors.
106
+ * @example
107
+ * isCloseTo(0, 0.1) // returns false
108
+ * isCloseTo(vec3f(0, 0, 0), vec3f(0.002, -0.009, 0)) // returns true
109
+ *
110
+ * @param {number} precision argument that specifies the maximum allowed difference, 0.01 by default.
111
+ */
112
+ declare const isCloseTo: DualFn<(<T extends AnyFloatVecInstance | number>(lhs: T, rhs: T, precision?: number) => boolean)>;
113
+ declare function cpuSelect(f: boolean, t: boolean, cond: boolean): boolean;
114
+ declare function cpuSelect(f: number, t: number, cond: boolean): number;
115
+ declare function cpuSelect<T extends AnyVecInstance>(f: T, t: T, cond: boolean | (T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b)): T;
116
+ /**
117
+ * Returns `t` if `cond` is `true`, and `f` otherwise.
118
+ * Component-wise if `cond` is a vector.
119
+ * @example
120
+ * select(1, 2, false) // returns 1
121
+ * select(1, 2, true) // returns 2
122
+ * select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)
123
+ * select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)
124
+ */
125
+ declare const select: DualFn<typeof cpuSelect>;
126
+ //#endregion
127
+ export { all, allEq, and, any, eq, ge, gt, isCloseTo, le, lt, ne, not, or, select };
package/std/boolean.js ADDED
@@ -0,0 +1,274 @@
1
+ import { isVecInstance } from "../data/wgslTypes.js";
2
+ import { isSnippetNumeric, snip } from "../data/snippet.js";
3
+ import { stitch } from "../core/resolve/stitch.js";
4
+ import { unify } from "../tgsl/conversion.js";
5
+ import { bool, f32 } from "../data/numeric.js";
6
+ import { vec2b, vec3b, vec4b } from "../data/vector.js";
7
+ import { dualImpl } from "../core/function/dualImpl.js";
8
+ import { VectorOps } from "../data/vectorOps.js";
9
+ import { sub } from "./operators.js";
10
+
11
+ //#region src/std/boolean.ts
12
+ function correspondingBooleanVectorSchema(dataType) {
13
+ if (dataType.type.includes("2")) return vec2b;
14
+ if (dataType.type.includes("3")) return vec3b;
15
+ return vec4b;
16
+ }
17
+ /**
18
+ * Checks whether `lhs == rhs` on all components.
19
+ * Equivalent to `all(eq(lhs, rhs))`.
20
+ * @example
21
+ * allEq(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns false
22
+ * allEq(vec3u(0, 1, 2), vec3u(0, 1, 2)) // returns true
23
+ */
24
+ const allEq = dualImpl({
25
+ name: "allEq",
26
+ signature: (...argTypes) => ({
27
+ argTypes,
28
+ returnType: bool
29
+ }),
30
+ normalImpl: (lhs, rhs) => cpuAll(cpuEq(lhs, rhs)),
31
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`all(${lhs} == ${rhs})`
32
+ });
33
+ const cpuEq = (lhs, rhs) => VectorOps.eq[lhs.kind](lhs, rhs);
34
+ /**
35
+ * Checks **component-wise** whether `lhs == rhs`.
36
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`, or use `allEq`.
37
+ * @example
38
+ * eq(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns vec2b(true, false)
39
+ * eq(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, true, false)
40
+ * all(eq(vec4i(4, 3, 2, 1), vec4i(4, 3, 2, 1))) // returns true
41
+ * allEq(vec4i(4, 3, 2, 1), vec4i(4, 3, 2, 1)) // returns true
42
+ */
43
+ const eq = dualImpl({
44
+ name: "eq",
45
+ signature: (...argTypes) => ({
46
+ argTypes,
47
+ returnType: correspondingBooleanVectorSchema(argTypes[0])
48
+ }),
49
+ normalImpl: cpuEq,
50
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} == ${rhs})`
51
+ });
52
+ /**
53
+ * Checks **component-wise** whether `lhs != rhs`.
54
+ * This function does **not** return `bool`, for that use-case, wrap the result in `any`.
55
+ * @example
56
+ * ne(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns vec2b(false, true)
57
+ * ne(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, false, true)
58
+ * any(ne(vec4i(4, 3, 2, 1), vec4i(4, 2, 2, 1))) // returns true
59
+ */
60
+ const ne = dualImpl({
61
+ name: "ne",
62
+ signature: (...argTypes) => ({
63
+ argTypes,
64
+ returnType: correspondingBooleanVectorSchema(argTypes[0])
65
+ }),
66
+ normalImpl: (lhs, rhs) => cpuNot(cpuEq(lhs, rhs)),
67
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} != ${rhs})`
68
+ });
69
+ const cpuLt = (lhs, rhs) => VectorOps.lt[lhs.kind](lhs, rhs);
70
+ /**
71
+ * Checks **component-wise** whether `lhs < rhs`.
72
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
73
+ * @example
74
+ * lt(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(false, true)
75
+ * lt(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, false, false)
76
+ * all(lt(vec4i(1, 2, 3, 4), vec4i(2, 3, 4, 5))) // returns true
77
+ */
78
+ const lt = dualImpl({
79
+ name: "lt",
80
+ signature: (...argTypes) => ({
81
+ argTypes,
82
+ returnType: correspondingBooleanVectorSchema(argTypes[0])
83
+ }),
84
+ normalImpl: cpuLt,
85
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} < ${rhs})`
86
+ });
87
+ /**
88
+ * Checks **component-wise** whether `lhs <= rhs`.
89
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
90
+ * @example
91
+ * le(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(true, true)
92
+ * le(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, true, false)
93
+ * all(le(vec4i(1, 2, 3, 4), vec4i(2, 3, 3, 5))) // returns true
94
+ */
95
+ const le = dualImpl({
96
+ name: "le",
97
+ signature: (...argTypes) => ({
98
+ argTypes,
99
+ returnType: correspondingBooleanVectorSchema(argTypes[0])
100
+ }),
101
+ normalImpl: (lhs, rhs) => cpuOr(cpuLt(lhs, rhs), cpuEq(lhs, rhs)),
102
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} <= ${rhs})`
103
+ });
104
+ /**
105
+ * Checks **component-wise** whether `lhs > rhs`.
106
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
107
+ * @example
108
+ * gt(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(false, false)
109
+ * gt(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, false, true)
110
+ * all(gt(vec4i(2, 3, 4, 5), vec4i(1, 2, 3, 4))) // returns true
111
+ */
112
+ const gt = dualImpl({
113
+ name: "gt",
114
+ signature: (...argTypes) => ({
115
+ argTypes,
116
+ returnType: correspondingBooleanVectorSchema(argTypes[0])
117
+ }),
118
+ normalImpl: (lhs, rhs) => cpuAnd(cpuNot(cpuLt(lhs, rhs)), cpuNot(cpuEq(lhs, rhs))),
119
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} > ${rhs})`
120
+ });
121
+ /**
122
+ * Checks **component-wise** whether `lhs >= rhs`.
123
+ * This function does **not** return `bool`, for that use-case, wrap the result in `all`.
124
+ * @example
125
+ * ge(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(true, false)
126
+ * ge(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, true, true)
127
+ * all(ge(vec4i(2, 2, 4, 5), vec4i(1, 2, 3, 4))) // returns true
128
+ */
129
+ const ge = dualImpl({
130
+ name: "ge",
131
+ signature: (...argTypes) => ({
132
+ argTypes,
133
+ returnType: correspondingBooleanVectorSchema(argTypes[0])
134
+ }),
135
+ normalImpl: (lhs, rhs) => cpuNot(cpuLt(lhs, rhs)),
136
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} >= ${rhs})`
137
+ });
138
+ const cpuNot = (value) => VectorOps.neg[value.kind](value);
139
+ /**
140
+ * Returns **component-wise** `!value`.
141
+ * @example
142
+ * not(vec2b(false, true)) // returns vec2b(true, false)
143
+ * not(vec3b(true, true, false)) // returns vec3b(false, false, true)
144
+ */
145
+ const not = dualImpl({
146
+ name: "not",
147
+ signature: (...argTypes) => ({
148
+ argTypes,
149
+ returnType: argTypes[0]
150
+ }),
151
+ normalImpl: cpuNot,
152
+ codegenImpl: (_ctx, [arg]) => stitch`!(${arg})`
153
+ });
154
+ const cpuOr = (lhs, rhs) => VectorOps.or[lhs.kind](lhs, rhs);
155
+ /**
156
+ * Returns **component-wise** logical `or` result.
157
+ * @example
158
+ * or(vec2b(false, true), vec2b(false, false)) // returns vec2b(false, true)
159
+ * or(vec3b(true, true, false), vec3b(false, true, false)) // returns vec3b(true, true, false)
160
+ */
161
+ const or = dualImpl({
162
+ name: "or",
163
+ signature: (...argTypes) => ({
164
+ argTypes,
165
+ returnType: argTypes[0]
166
+ }),
167
+ normalImpl: cpuOr,
168
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} | ${rhs})`
169
+ });
170
+ const cpuAnd = (lhs, rhs) => cpuNot(cpuOr(cpuNot(lhs), cpuNot(rhs)));
171
+ /**
172
+ * Returns **component-wise** logical `and` result.
173
+ * @example
174
+ * and(vec2b(false, true), vec2b(true, true)) // returns vec2b(false, true)
175
+ * and(vec3b(true, true, false), vec3b(false, true, false)) // returns vec3b(false, true, false)
176
+ */
177
+ const and = dualImpl({
178
+ name: "and",
179
+ signature: (...argTypes) => ({
180
+ argTypes,
181
+ returnType: argTypes[0]
182
+ }),
183
+ normalImpl: cpuAnd,
184
+ codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} & ${rhs})`
185
+ });
186
+ const cpuAll = (value) => VectorOps.all[value.kind](value);
187
+ /**
188
+ * Returns `true` if each component of `value` is true.
189
+ * @example
190
+ * all(vec2b(false, true)) // returns false
191
+ * all(vec3b(true, true, true)) // returns true
192
+ */
193
+ const all = dualImpl({
194
+ name: "all",
195
+ signature: (...argTypes) => ({
196
+ argTypes,
197
+ returnType: bool
198
+ }),
199
+ normalImpl: cpuAll,
200
+ codegenImpl: (_ctx, [value]) => stitch`all(${value})`
201
+ });
202
+ /**
203
+ * Returns `true` if any component of `value` is true.
204
+ * @example
205
+ * any(vec2b(false, true)) // returns true
206
+ * any(vec3b(false, false, false)) // returns false
207
+ */
208
+ const any = dualImpl({
209
+ name: "any",
210
+ signature: (...argTypes) => ({
211
+ argTypes,
212
+ returnType: bool
213
+ }),
214
+ normalImpl: (value) => !cpuAll(cpuNot(value)),
215
+ codegenImpl: (_ctx, [arg]) => stitch`any(${arg})`
216
+ });
217
+ /**
218
+ * Checks whether the given elements differ by at most the `precision` value.
219
+ * Checks all elements of `lhs` and `rhs` if arguments are vectors.
220
+ * @example
221
+ * isCloseTo(0, 0.1) // returns false
222
+ * isCloseTo(vec3f(0, 0, 0), vec3f(0.002, -0.009, 0)) // returns true
223
+ *
224
+ * @param {number} precision argument that specifies the maximum allowed difference, 0.01 by default.
225
+ */
226
+ const isCloseTo = dualImpl({
227
+ name: "isCloseTo",
228
+ signature: (...args) => ({
229
+ argTypes: args,
230
+ returnType: bool
231
+ }),
232
+ normalImpl: (lhs, rhs, precision = .01) => {
233
+ if (typeof lhs === "number" && typeof rhs === "number") return Math.abs(lhs - rhs) < precision;
234
+ if (isVecInstance(lhs) && isVecInstance(rhs)) return VectorOps.isCloseToZero[lhs.kind](sub(lhs, rhs), precision);
235
+ return false;
236
+ },
237
+ codegenImpl: (_ctx, [lhs, rhs, precision = snip(.01, f32, "constant")]) => {
238
+ if (isSnippetNumeric(lhs) && isSnippetNumeric(rhs)) return stitch`(abs(f32(${lhs}) - f32(${rhs})) <= ${precision})`;
239
+ if (!isSnippetNumeric(lhs) && !isSnippetNumeric(rhs)) return stitch`all(abs(${lhs} - ${rhs}) <= (${lhs} - ${lhs}) + ${precision})`;
240
+ return "false";
241
+ }
242
+ });
243
+ function cpuSelect(f, t, cond) {
244
+ if (typeof cond === "boolean") return cond ? t : f;
245
+ return VectorOps.select[f.kind](f, t, cond);
246
+ }
247
+ /**
248
+ * Returns `t` if `cond` is `true`, and `f` otherwise.
249
+ * Component-wise if `cond` is a vector.
250
+ * @example
251
+ * select(1, 2, false) // returns 1
252
+ * select(1, 2, true) // returns 2
253
+ * select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)
254
+ * select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)
255
+ */
256
+ const select = dualImpl({
257
+ name: "select",
258
+ signature: (f, t, cond) => {
259
+ const [uf, ut] = unify([f, t]) ?? [f, t];
260
+ return {
261
+ argTypes: [
262
+ uf,
263
+ ut,
264
+ cond
265
+ ],
266
+ returnType: uf
267
+ };
268
+ },
269
+ normalImpl: cpuSelect,
270
+ codegenImpl: (_ctx, [f, t, cond]) => stitch`select(${f}, ${t}, ${cond})`
271
+ });
272
+
273
+ //#endregion
274
+ export { all, allEq, and, any, eq, ge, gt, isCloseTo, le, lt, ne, not, or, select };
@@ -0,0 +1,16 @@
1
+ import { DualFn } from "../types.js";
2
+ import { AnyFloat32VecInstance } from "../data/wgslTypes.js";
3
+
4
+ //#region src/std/derivative.d.ts
5
+ type DerivativeSignature = ((value: number) => number) & (<T extends AnyFloat32VecInstance>(value: T) => T);
6
+ declare const dpdx: DualFn<DerivativeSignature>;
7
+ declare const dpdxCoarse: DualFn<DerivativeSignature>;
8
+ declare const dpdxFine: DualFn<DerivativeSignature>;
9
+ declare const dpdy: DualFn<DerivativeSignature>;
10
+ declare const dpdyCoarse: DualFn<DerivativeSignature>;
11
+ declare const dpdyFine: DualFn<DerivativeSignature>;
12
+ declare const fwidth: DualFn<DerivativeSignature>;
13
+ declare const fwidthCoarse: DualFn<DerivativeSignature>;
14
+ declare const fwidthFine: DualFn<DerivativeSignature>;
15
+ //#endregion
16
+ export { dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, fwidth, fwidthCoarse, fwidthFine };
@@ -0,0 +1,89 @@
1
+ import { stitch } from "../core/resolve/stitch.js";
2
+ import { dualImpl } from "../core/function/dualImpl.js";
3
+
4
+ //#region src/std/derivative.ts
5
+ const derivativeNormalError = "Derivative builtins are not allowed on the CPU";
6
+ const dpdx = dualImpl({
7
+ name: "dpdx",
8
+ normalImpl: derivativeNormalError,
9
+ signature: (value) => ({
10
+ argTypes: [value],
11
+ returnType: value
12
+ }),
13
+ codegenImpl: (_ctx, [value]) => stitch`dpdx(${value})`
14
+ });
15
+ const dpdxCoarse = dualImpl({
16
+ name: "dpdxCoarse",
17
+ normalImpl: derivativeNormalError,
18
+ signature: (value) => ({
19
+ argTypes: [value],
20
+ returnType: value
21
+ }),
22
+ codegenImpl: (_ctx, [value]) => stitch`dpdxCoarse(${value})`
23
+ });
24
+ const dpdxFine = dualImpl({
25
+ name: "dpdxFine",
26
+ normalImpl: derivativeNormalError,
27
+ signature: (value) => ({
28
+ argTypes: [value],
29
+ returnType: value
30
+ }),
31
+ codegenImpl: (_ctx, [value]) => stitch`dpdxFine(${value})`
32
+ });
33
+ const dpdy = dualImpl({
34
+ name: "dpdy",
35
+ normalImpl: derivativeNormalError,
36
+ signature: (value) => ({
37
+ argTypes: [value],
38
+ returnType: value
39
+ }),
40
+ codegenImpl: (_ctx, [value]) => stitch`dpdy(${value})`
41
+ });
42
+ const dpdyCoarse = dualImpl({
43
+ name: "dpdyCoarse",
44
+ normalImpl: derivativeNormalError,
45
+ signature: (value) => ({
46
+ argTypes: [value],
47
+ returnType: value
48
+ }),
49
+ codegenImpl: (_ctx, [value]) => stitch`dpdyCoarse(${value})`
50
+ });
51
+ const dpdyFine = dualImpl({
52
+ name: "dpdyFine",
53
+ normalImpl: derivativeNormalError,
54
+ signature: (value) => ({
55
+ argTypes: [value],
56
+ returnType: value
57
+ }),
58
+ codegenImpl: (_ctx, [value]) => stitch`dpdyFine(${value})`
59
+ });
60
+ const fwidth = dualImpl({
61
+ name: "fwidth",
62
+ normalImpl: derivativeNormalError,
63
+ signature: (value) => ({
64
+ argTypes: [value],
65
+ returnType: value
66
+ }),
67
+ codegenImpl: (_ctx, [value]) => stitch`fwidth(${value})`
68
+ });
69
+ const fwidthCoarse = dualImpl({
70
+ name: "fwidthCoarse",
71
+ normalImpl: derivativeNormalError,
72
+ signature: (value) => ({
73
+ argTypes: [value],
74
+ returnType: value
75
+ }),
76
+ codegenImpl: (_ctx, [value]) => stitch`fwidthCoarse(${value})`
77
+ });
78
+ const fwidthFine = dualImpl({
79
+ name: "fwidthFine",
80
+ normalImpl: derivativeNormalError,
81
+ signature: (value) => ({
82
+ argTypes: [value],
83
+ returnType: value
84
+ }),
85
+ codegenImpl: (_ctx, [value]) => stitch`fwidthFine(${value})`
86
+ });
87
+
88
+ //#endregion
89
+ export { dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, fwidth, fwidthCoarse, fwidthFine };
@@ -0,0 +1,6 @@
1
+ import { DualFn } from "../types.js";
2
+
3
+ //#region src/std/discard.d.ts
4
+ declare const discard: DualFn<() => never>;
5
+ //#endregion
6
+ export { discard };
package/std/discard.js ADDED
@@ -0,0 +1,16 @@
1
+ import { Void } from "../data/wgslTypes.js";
2
+ import { dualImpl } from "../core/function/dualImpl.js";
3
+
4
+ //#region src/std/discard.ts
5
+ const discard = dualImpl({
6
+ name: "discard",
7
+ normalImpl: "`discard` relies on GPU resources and cannot be executed outside of a draw call",
8
+ signature: {
9
+ argTypes: [],
10
+ returnType: Void
11
+ },
12
+ codegenImpl: () => "discard;"
13
+ });
14
+
15
+ //#endregion
16
+ export { discard };
@@ -0,0 +1,8 @@
1
+ import { WgslExtension } from "../wgslExtensions.js";
2
+ import { TgpuComptime } from "../core/function/comptime.js";
3
+ import "../indexNamedExports.js";
4
+
5
+ //#region src/std/extensions.d.ts
6
+ declare const extensionEnabled: TgpuComptime<(extensionName: WgslExtension) => boolean>;
7
+ //#endregion
8
+ export { extensionEnabled };
@@ -0,0 +1,14 @@
1
+ import { getResolutionCtx } from "../execMode.js";
2
+ import { comptime } from "../core/function/comptime.js";
3
+ import { wgslExtensions } from "../wgslExtensions.js";
4
+
5
+ //#region src/std/extensions.ts
6
+ const extensionEnabled = comptime((extensionName) => {
7
+ const resolutionCtx = getResolutionCtx();
8
+ if (!resolutionCtx) throw new Error("Functions using `extensionEnabled` cannot be called directly. Either generate WGSL from them, or use tgpu['~unstable'].simulate(...)");
9
+ if (typeof extensionName !== "string" || !wgslExtensions.includes(extensionName)) throw new Error(`extensionEnabled has to be called with a string literal representing a valid WGSL extension name. Got: '${extensionName}'`);
10
+ return (resolutionCtx.enableExtensions ?? []).includes(extensionName);
11
+ });
12
+
13
+ //#endregion
14
+ export { extensionEnabled };
package/std/index.d.ts CHANGED
@@ -1,9 +1,21 @@
1
- import { $ as dpdyFine, $t as countOneBits, A as subgroupShuffleUp, An as quantizeToF16, At as rotateY4, B as textureSampleCompareLevel, Bn as smoothstep, Bt as abs, C as subgroupInclusiveMul, Cn as log2, Ct as le, D as subgroupOr, Dn as modf, Dt as or, E as subgroupMul, En as mix, Et as not, F as textureLoad, Fn as round, Ft as div, G as unpack2x16float, Gn as transpose, Gt as atan, H as textureStore, Hn as step, Ht as acosh, I as textureSample, In as saturate, It as mod, J as dpdx, Jt as ceil, K as unpack4x8unorm, Kn as trunc, Kt as atan2, L as textureSampleBaseClampToEdge, Ln as sign, Lt as mul, M as subgroupXor, Mn as reflect, Mt as scale4, N as textureDimensions, Nn as refract, Nt as translate4, O as subgroupShuffle, On as normalize, Ot as select, P as textureGather, Pn as reverseBits, Pt as add, Q as dpdyCoarse, Qt as countLeadingZeros, R as textureSampleBias, Rn as sin, Rt as neg, S as subgroupInclusiveAdd, Sn as log, St as isCloseTo, T as subgroupMin, Tn as min, Tt as ne, U as pack2x16float, Un as tan, Ut as asin, V as textureSampleLevel, Vn as sqrt, Vt as acos, W as pack4x8unorm, Wn as tanh, Wt as asinh, X as dpdxFine, Xt as cos, Y as dpdxCoarse, Yt as clamp, Z as dpdy, Zt as cosh, _ as subgroupBroadcast, _n as frexp, _t as and, an as dot, at as atomicLoad, b as subgroupExclusiveAdd, bn as ldexp, bt as ge, cn as exp, cr as rotationY4, ct as atomicOr, d as extensionEnabled, dn as faceForward, dr as translation4, dt as atomicXor, en as countTrailingZeros, er as identity2, et as fwidth, f as subgroupAdd, fn as firstLeadingBit, ft as storageBarrier, g as subgroupBallot, gn as fract, gt as allEq, h as subgroupAny, hn as fma, ht as all, in as distance, it as atomicAnd, j as subgroupShuffleXor, jn as radians, jt as rotateZ4, k as subgroupShuffleDown, kn as pow, kt as rotateX4, l as bitcastU32toF32, ln as exp2, lr as rotationZ4, lt as atomicStore, m as subgroupAnd, mn as floor, mt as workgroupBarrier, nn as degrees, nr as identity4, nt as fwidthFine, on as dot4I8Packed, ot as atomicMax, p as subgroupAll, pn as firstTrailingBit, pt as textureBarrier, q as arrayLength, qn as discard, qt as atanh, rn as determinant, rt as atomicAdd, sn as dot4U8Packed, sr as rotationX4, st as atomicMin, tn as cross, tr as identity3, tt as fwidthCoarse, u as bitcastU32toI32, un as extractBits, ur as scaling4, ut as atomicSub, v as subgroupBroadcastFirst, vn as insertBits, vt as any, w as subgroupMax, wn as max, wt as lt, x as subgroupExclusiveMul, xn as length, xt as gt, y as subgroupElect, yn as inverseSqrt, yt as eq, z as textureSampleCompare, zn as sinh, zt as sub } from "../indexNamedExports-oL6tyaJ9.js";
1
+ import { identity2, identity3, identity4, rotationX4, rotationY4, rotationZ4, scaling4, translation4 } from "../data/matrix.js";
2
+ import { discard } from "./discard.js";
3
+ import { abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, distance, dot, dot4I8Packed, dot4U8Packed, exp, exp2, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, insertBits, inverseSqrt, ldexp, length, log, log2, max, min, mix, modf, normalize, pow, quantizeToF16, radians, reflect, refract, reverseBits, round, saturate, sign, sin, sinh, smoothstep, sqrt, step, tan, tanh, transpose, trunc } from "./numeric.js";
4
+ import { add, div, mod, mul, neg, sub } from "./operators.js";
5
+ import { rotateX4, rotateY4, rotateZ4, scale4, translate4 } from "./matrix.js";
6
+ import { all, allEq, and, any, eq, ge, gt, isCloseTo, le, lt, ne, not, or, select } from "./boolean.js";
7
+ import { atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, storageBarrier, textureBarrier, workgroupBarrier } from "./atomic.js";
8
+ import { dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, fwidth, fwidthCoarse, fwidthFine } from "./derivative.js";
9
+ import { arrayLength } from "./array.js";
10
+ import { pack2x16float, pack4x8unorm, unpack2x16float, unpack4x8unorm } from "./packing.js";
11
+ import { textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore } from "./texture.js";
12
+ import { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor } from "./subgroup.js";
13
+ import { extensionEnabled } from "./extensions.js";
14
+ import { bitcastU32toF32, bitcastU32toI32 } from "./bitcast.js";
2
15
 
3
16
  //#region src/std/index.d.ts
4
17
  declare namespace index_d_exports {
5
18
  export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, asinh, atan, atan2, atanh, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, bitcastU32toF32, bitcastU32toI32, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, discard, distance, div, dot, dot4I8Packed, dot4U8Packed, dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, eq, exp, exp2, extensionEnabled, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, fwidth, fwidthCoarse, fwidthFine, ge, gt, identity2, identity3, identity4, insertBits, inverseSqrt, isCloseTo, ldexp, le, length, log, log2, lt, max, min, mix, mod, modf, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, quantizeToF16, radians, reflect, refract, reverseBits, rotateX4, rotateY4, rotateZ4, rotationX4, rotationY4, rotationZ4, round, saturate, scale4, scaling4, select, sign, sin, sinh, smoothstep, sqrt, step, storageBarrier, sub, subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, tan, tanh, textureBarrier, textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore, translate4, translation4, transpose, trunc, unpack2x16float, unpack4x8unorm, workgroupBarrier };
6
19
  }
7
20
  //#endregion
8
- export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, asinh, atan, atan2, atanh, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, bitcastU32toF32, bitcastU32toI32, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, discard, distance, div, dot, dot4I8Packed, dot4U8Packed, dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, eq, exp, exp2, extensionEnabled, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, fwidth, fwidthCoarse, fwidthFine, ge, gt, identity2, identity3, identity4, insertBits, inverseSqrt, isCloseTo, ldexp, le, length, log, log2, lt, max, min, mix, mod, modf, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, quantizeToF16, radians, reflect, refract, reverseBits, rotateX4, rotateY4, rotateZ4, rotationX4, rotationY4, rotationZ4, round, saturate, scale4, scaling4, select, sign, sin, sinh, smoothstep, sqrt, step, storageBarrier, sub, subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, index_d_exports as t, tan, tanh, textureBarrier, textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore, translate4, translation4, transpose, trunc, unpack2x16float, unpack4x8unorm, workgroupBarrier };
9
- //# sourceMappingURL=index.d.ts.map
21
+ export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, asinh, atan, atan2, atanh, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, bitcastU32toF32, bitcastU32toI32, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, discard, distance, div, dot, dot4I8Packed, dot4U8Packed, dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, eq, exp, exp2, extensionEnabled, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, fwidth, fwidthCoarse, fwidthFine, ge, gt, identity2, identity3, identity4, index_d_exports, insertBits, inverseSqrt, isCloseTo, ldexp, le, length, log, log2, lt, max, min, mix, mod, modf, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, quantizeToF16, radians, reflect, refract, reverseBits, rotateX4, rotateY4, rotateZ4, rotationX4, rotationY4, rotationZ4, round, saturate, scale4, scaling4, select, sign, sin, sinh, smoothstep, sqrt, step, storageBarrier, sub, subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, tan, tanh, textureBarrier, textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore, translate4, translation4, transpose, trunc, unpack2x16float, unpack4x8unorm, workgroupBarrier };
package/std/index.js CHANGED
@@ -1,6 +1,18 @@
1
- import { t as __exportAll } from "../chunk-BYypO7fO.js";
2
- import { C as translation4, S as scaling4, a as neg, b as rotationY4, f as identity2, i as mul, m as identity4, n as div, o as sub, p as identity3, r as mod, t as add, x as rotationZ4, y as rotationX4 } from "../operators-d-PMVTo7.js";
3
- import { $ as workgroupBarrier, $t as extractBits, A as textureSampleCompareLevel, An as sqrt, At as acos, B as fwidthCoarse, Bt as cosh, C as textureDimensions, Cn as reverseBits, Ct as pack4x8unorm, D as textureSampleBaseClampToEdge, Dn as sin, Dt as bitcastU32toI32, E as textureSample, En as sign, Et as bitcastU32toF32, F as dpdxFine, Fn as trunc, Ft as atan2, G as atomicMax, Gt as degrees, H as atomicAdd, Ht as countOneBits, I as dpdy, It as atanh, J as atomicStore, Jt as dot, K as atomicMin, Kt as determinant, L as dpdyCoarse, Lt as ceil, M as textureStore, Mn as tan, Mt as asin, N as dpdx, Nn as tanh, Nt as asinh, O as textureSampleBias, On as sinh, Ot as arrayLength, P as dpdxCoarse, Pn as transpose, Pt as atan, Q as textureBarrier, Qt as exp2, R as dpdyFine, Rt as clamp, S as subgroupXor, Sn as refract, St as pack2x16float, T as textureLoad, Tn as saturate, Tt as unpack4x8unorm, U as atomicAnd, Ut as countTrailingZeros, V as fwidthFine, Vt as countLeadingZeros, W as atomicLoad, Wt as cross, X as atomicXor, Xt as dot4U8Packed, Y as atomicSub, Yt as dot4I8Packed, Z as storageBarrier, Zt as exp, _ as subgroupOr, _n as normalize, _t as not, a as subgroupAny, an as fract, at as discard, b as subgroupShuffleUp, bn as radians, c as subgroupBroadcastFirst, cn as inverseSqrt, ct as and, d as subgroupExclusiveMul, dn as log, dt as ge, en as faceForward, et as rotateX4, f as subgroupInclusiveAdd, fn as log2, ft as gt, g as subgroupMul, gn as modf, gt as ne, h as subgroupMin, hn as mix, ht as lt, i as subgroupAnd, in as fma, it as translate4, j as textureSampleLevel, jn as step, jt as acosh, k as textureSampleCompare, kn as smoothstep, kt as abs, l as subgroupElect, ln as ldexp, lt as any, m as subgroupMax, mn as min, mt as le, n as subgroupAdd, nn as firstTrailingBit, nt as rotateZ4, o as subgroupBallot, on as frexp, ot as all, p as subgroupInclusiveMul, pn as max, pt as isCloseTo, q as atomicOr, qt as distance, r as subgroupAll, rn as floor, rt as scale4, s as subgroupBroadcast, sn as insertBits, st as allEq, t as extensionEnabled, tn as firstLeadingBit, tt as rotateY4, u as subgroupExclusiveAdd, un as length, ut as eq, v as subgroupShuffle, vn as pow, vt as or, w as textureGather, wn as round, wt as unpack2x16float, x as subgroupShuffleXor, xn as reflect, y as subgroupShuffleDown, yn as quantizeToF16, yt as select, z as fwidth, zt as cos } from "../extensions-DIVuAfBM.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { identity2, identity3, identity4, rotationX4, rotationY4, rotationZ4, scaling4, translation4 } from "../data/matrix.js";
3
+ import { add, div, mod, mul, neg, sub } from "./operators.js";
4
+ import { abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, distance, dot, dot4I8Packed, dot4U8Packed, exp, exp2, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, insertBits, inverseSqrt, ldexp, length, log, log2, max, min, mix, modf, normalize, pow, quantizeToF16, radians, reflect, refract, reverseBits, round, saturate, sign, sin, sinh, smoothstep, sqrt, step, tan, tanh, transpose, trunc } from "./numeric.js";
5
+ import { arrayLength } from "./array.js";
6
+ import { bitcastU32toF32, bitcastU32toI32 } from "./bitcast.js";
7
+ import { pack2x16float, pack4x8unorm, unpack2x16float, unpack4x8unorm } from "./packing.js";
8
+ import { all, allEq, and, any, eq, ge, gt, isCloseTo, le, lt, ne, not, or, select } from "./boolean.js";
9
+ import { discard } from "./discard.js";
10
+ import { rotateX4, rotateY4, rotateZ4, scale4, translate4 } from "./matrix.js";
11
+ import { atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, storageBarrier, textureBarrier, workgroupBarrier } from "./atomic.js";
12
+ import { dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, fwidth, fwidthCoarse, fwidthFine } from "./derivative.js";
13
+ import { textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore } from "./texture.js";
14
+ import { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor } from "./subgroup.js";
15
+ import { extensionEnabled } from "./extensions.js";
4
16
 
5
17
  //#region src/std/index.ts
6
18
  var std_exports = /* @__PURE__ */ __exportAll({
@@ -162,5 +174,4 @@ var std_exports = /* @__PURE__ */ __exportAll({
162
174
  });
163
175
 
164
176
  //#endregion
165
- export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, asinh, atan, atan2, atanh, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, bitcastU32toF32, bitcastU32toI32, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, discard, distance, div, dot, dot4I8Packed, dot4U8Packed, dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, eq, exp, exp2, extensionEnabled, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, fwidth, fwidthCoarse, fwidthFine, ge, gt, identity2, identity3, identity4, insertBits, inverseSqrt, isCloseTo, ldexp, le, length, log, log2, lt, max, min, mix, mod, modf, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, quantizeToF16, radians, reflect, refract, reverseBits, rotateX4, rotateY4, rotateZ4, rotationX4, rotationY4, rotationZ4, round, saturate, scale4, scaling4, select, sign, sin, sinh, smoothstep, sqrt, step, storageBarrier, sub, subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, std_exports as t, tan, tanh, textureBarrier, textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore, translate4, translation4, transpose, trunc, unpack2x16float, unpack4x8unorm, workgroupBarrier };
166
- //# sourceMappingURL=index.js.map
177
+ export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, asinh, atan, atan2, atanh, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, bitcastU32toF32, bitcastU32toI32, ceil, clamp, cos, cosh, countLeadingZeros, countOneBits, countTrailingZeros, cross, degrees, determinant, discard, distance, div, dot, dot4I8Packed, dot4U8Packed, dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, eq, exp, exp2, extensionEnabled, extractBits, faceForward, firstLeadingBit, firstTrailingBit, floor, fma, fract, frexp, fwidth, fwidthCoarse, fwidthFine, ge, gt, identity2, identity3, identity4, insertBits, inverseSqrt, isCloseTo, ldexp, le, length, log, log2, lt, max, min, mix, mod, modf, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, quantizeToF16, radians, reflect, refract, reverseBits, rotateX4, rotateY4, rotateZ4, rotationX4, rotationY4, rotationZ4, round, saturate, scale4, scaling4, select, sign, sin, sinh, smoothstep, sqrt, std_exports, step, storageBarrier, sub, subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, tan, tanh, textureBarrier, textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleLevel, textureStore, translate4, translation4, transpose, trunc, unpack2x16float, unpack4x8unorm, workgroupBarrier };