@nodetool-ai/gpu 0.8.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 (359) hide show
  1. package/README.md +52 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/blend/blendModes.d.ts +67 -0
  4. package/dist/blend/blendModes.d.ts.map +1 -0
  5. package/dist/blend/blendModes.js +80 -0
  6. package/dist/blend/blendModes.js.map +1 -0
  7. package/dist/blend/index.d.ts +10 -0
  8. package/dist/blend/index.d.ts.map +1 -0
  9. package/dist/blend/index.js +10 -0
  10. package/dist/blend/index.js.map +1 -0
  11. package/dist/blend/wgsl.d.ts +16 -0
  12. package/dist/blend/wgsl.d.ts.map +1 -0
  13. package/dist/blend/wgsl.js +85 -0
  14. package/dist/blend/wgsl.js.map +1 -0
  15. package/dist/compositor/compositor.d.ts +112 -0
  16. package/dist/compositor/compositor.d.ts.map +1 -0
  17. package/dist/compositor/compositor.js +353 -0
  18. package/dist/compositor/compositor.js.map +1 -0
  19. package/dist/compositor/headless.d.ts +47 -0
  20. package/dist/compositor/headless.d.ts.map +1 -0
  21. package/dist/compositor/headless.js +158 -0
  22. package/dist/compositor/headless.js.map +1 -0
  23. package/dist/compositor/index.d.ts +8 -0
  24. package/dist/compositor/index.d.ts.map +1 -0
  25. package/dist/compositor/index.js +8 -0
  26. package/dist/compositor/index.js.map +1 -0
  27. package/dist/compositor/shaders.d.ts +24 -0
  28. package/dist/compositor/shaders.d.ts.map +1 -0
  29. package/dist/compositor/shaders.js +241 -0
  30. package/dist/compositor/shaders.js.map +1 -0
  31. package/dist/compositor/transform.d.ts +49 -0
  32. package/dist/compositor/transform.d.ts.map +1 -0
  33. package/dist/compositor/transform.js +74 -0
  34. package/dist/compositor/transform.js.map +1 -0
  35. package/dist/context.d.ts +108 -0
  36. package/dist/context.d.ts.map +1 -0
  37. package/dist/context.js +205 -0
  38. package/dist/context.js.map +1 -0
  39. package/dist/debug/premulValidator.d.ts +85 -0
  40. package/dist/debug/premulValidator.d.ts.map +1 -0
  41. package/dist/debug/premulValidator.js +239 -0
  42. package/dist/debug/premulValidator.js.map +1 -0
  43. package/dist/executor.d.ts +74 -0
  44. package/dist/executor.d.ts.map +1 -0
  45. package/dist/executor.js +413 -0
  46. package/dist/executor.js.map +1 -0
  47. package/dist/fullscreenQuad.d.ts +11 -0
  48. package/dist/fullscreenQuad.d.ts.map +1 -0
  49. package/dist/fullscreenQuad.js +31 -0
  50. package/dist/fullscreenQuad.js.map +1 -0
  51. package/dist/index.d.ts +16 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +16 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/module.d.ts +162 -0
  56. package/dist/module.d.ts.map +1 -0
  57. package/dist/module.js +100 -0
  58. package/dist/module.js.map +1 -0
  59. package/dist/node.d.ts +38 -0
  60. package/dist/node.d.ts.map +1 -0
  61. package/dist/node.js +140 -0
  62. package/dist/node.js.map +1 -0
  63. package/dist/pool.d.ts +30 -0
  64. package/dist/pool.d.ts.map +1 -0
  65. package/dist/pool.js +33 -0
  66. package/dist/pool.js.map +1 -0
  67. package/dist/recipe.d.ts +148 -0
  68. package/dist/recipe.d.ts.map +1 -0
  69. package/dist/recipe.js +181 -0
  70. package/dist/recipe.js.map +1 -0
  71. package/dist/registry.d.ts +49 -0
  72. package/dist/registry.d.ts.map +1 -0
  73. package/dist/registry.js +100 -0
  74. package/dist/registry.js.map +1 -0
  75. package/dist/shaders/_canary/passthrough/v1/module.d.ts +13 -0
  76. package/dist/shaders/_canary/passthrough/v1/module.d.ts.map +1 -0
  77. package/dist/shaders/_canary/passthrough/v1/module.js +71 -0
  78. package/dist/shaders/_canary/passthrough/v1/module.js.map +1 -0
  79. package/dist/shaders/alpha/premulToStraight/v1/module.d.ts +16 -0
  80. package/dist/shaders/alpha/premulToStraight/v1/module.d.ts.map +1 -0
  81. package/dist/shaders/alpha/premulToStraight/v1/module.js +62 -0
  82. package/dist/shaders/alpha/premulToStraight/v1/module.js.map +1 -0
  83. package/dist/shaders/alpha/straightToPremul/v1/module.d.ts +19 -0
  84. package/dist/shaders/alpha/straightToPremul/v1/module.d.ts.map +1 -0
  85. package/dist/shaders/alpha/straightToPremul/v1/module.js +61 -0
  86. package/dist/shaders/alpha/straightToPremul/v1/module.js.map +1 -0
  87. package/dist/shaders/color/brightnessContrast/v1/module.d.ts +17 -0
  88. package/dist/shaders/color/brightnessContrast/v1/module.d.ts.map +1 -0
  89. package/dist/shaders/color/brightnessContrast/v1/module.js +84 -0
  90. package/dist/shaders/color/brightnessContrast/v1/module.js.map +1 -0
  91. package/dist/shaders/color/cdl/v1/module.d.ts +35 -0
  92. package/dist/shaders/color/cdl/v1/module.d.ts.map +1 -0
  93. package/dist/shaders/color/cdl/v1/module.js +106 -0
  94. package/dist/shaders/color/cdl/v1/module.js.map +1 -0
  95. package/dist/shaders/color/channelMerge/v1/module.d.ts +22 -0
  96. package/dist/shaders/color/channelMerge/v1/module.d.ts.map +1 -0
  97. package/dist/shaders/color/channelMerge/v1/module.js +101 -0
  98. package/dist/shaders/color/channelMerge/v1/module.js.map +1 -0
  99. package/dist/shaders/color/channelShuffle/v1/module.d.ts +29 -0
  100. package/dist/shaders/color/channelShuffle/v1/module.d.ts.map +1 -0
  101. package/dist/shaders/color/channelShuffle/v1/module.js +94 -0
  102. package/dist/shaders/color/channelShuffle/v1/module.js.map +1 -0
  103. package/dist/shaders/color/channelSplit/v1/module.d.ts +18 -0
  104. package/dist/shaders/color/channelSplit/v1/module.d.ts.map +1 -0
  105. package/dist/shaders/color/channelSplit/v1/module.js +90 -0
  106. package/dist/shaders/color/channelSplit/v1/module.js.map +1 -0
  107. package/dist/shaders/color/colorBalance/v1/module.d.ts +18 -0
  108. package/dist/shaders/color/colorBalance/v1/module.d.ts.map +1 -0
  109. package/dist/shaders/color/colorBalance/v1/module.js +86 -0
  110. package/dist/shaders/color/colorBalance/v1/module.js.map +1 -0
  111. package/dist/shaders/color/cubeLut/v1/module.d.ts +14 -0
  112. package/dist/shaders/color/cubeLut/v1/module.d.ts.map +1 -0
  113. package/dist/shaders/color/cubeLut/v1/module.js +78 -0
  114. package/dist/shaders/color/cubeLut/v1/module.js.map +1 -0
  115. package/dist/shaders/color/curves/v1/module.d.ts +31 -0
  116. package/dist/shaders/color/curves/v1/module.d.ts.map +1 -0
  117. package/dist/shaders/color/curves/v1/module.js +102 -0
  118. package/dist/shaders/color/curves/v1/module.js.map +1 -0
  119. package/dist/shaders/color/exposure/v1/module.d.ts +15 -0
  120. package/dist/shaders/color/exposure/v1/module.d.ts.map +1 -0
  121. package/dist/shaders/color/exposure/v1/module.js +78 -0
  122. package/dist/shaders/color/exposure/v1/module.js.map +1 -0
  123. package/dist/shaders/color/exposureTone/v1/module.d.ts +28 -0
  124. package/dist/shaders/color/exposureTone/v1/module.d.ts.map +1 -0
  125. package/dist/shaders/color/exposureTone/v1/module.js +107 -0
  126. package/dist/shaders/color/exposureTone/v1/module.js.map +1 -0
  127. package/dist/shaders/color/filmLook/v1/module.d.ts +28 -0
  128. package/dist/shaders/color/filmLook/v1/module.d.ts.map +1 -0
  129. package/dist/shaders/color/filmLook/v1/module.js +103 -0
  130. package/dist/shaders/color/filmLook/v1/module.js.map +1 -0
  131. package/dist/shaders/color/grade/v1/module.d.ts +35 -0
  132. package/dist/shaders/color/grade/v1/module.d.ts.map +1 -0
  133. package/dist/shaders/color/grade/v1/module.js +182 -0
  134. package/dist/shaders/color/grade/v1/module.js.map +1 -0
  135. package/dist/shaders/color/grayscale/v1/module.d.ts +14 -0
  136. package/dist/shaders/color/grayscale/v1/module.d.ts.map +1 -0
  137. package/dist/shaders/color/grayscale/v1/module.js +79 -0
  138. package/dist/shaders/color/grayscale/v1/module.js.map +1 -0
  139. package/dist/shaders/color/hsb/v1/module.d.ts +20 -0
  140. package/dist/shaders/color/hsb/v1/module.d.ts.map +1 -0
  141. package/dist/shaders/color/hsb/v1/module.js +131 -0
  142. package/dist/shaders/color/hsb/v1/module.js.map +1 -0
  143. package/dist/shaders/color/hslAdjust/v1/module.d.ts +30 -0
  144. package/dist/shaders/color/hslAdjust/v1/module.d.ts.map +1 -0
  145. package/dist/shaders/color/hslAdjust/v1/module.js +170 -0
  146. package/dist/shaders/color/hslAdjust/v1/module.js.map +1 -0
  147. package/dist/shaders/color/invert/v1/module.d.ts +15 -0
  148. package/dist/shaders/color/invert/v1/module.d.ts.map +1 -0
  149. package/dist/shaders/color/invert/v1/module.js +85 -0
  150. package/dist/shaders/color/invert/v1/module.js.map +1 -0
  151. package/dist/shaders/color/levels/v1/module.d.ts +33 -0
  152. package/dist/shaders/color/levels/v1/module.d.ts.map +1 -0
  153. package/dist/shaders/color/levels/v1/module.js +116 -0
  154. package/dist/shaders/color/levels/v1/module.js.map +1 -0
  155. package/dist/shaders/color/liftGammaGain/v1/module.d.ts +40 -0
  156. package/dist/shaders/color/liftGammaGain/v1/module.d.ts.map +1 -0
  157. package/dist/shaders/color/liftGammaGain/v1/module.js +114 -0
  158. package/dist/shaders/color/liftGammaGain/v1/module.js.map +1 -0
  159. package/dist/shaders/color/posterize/v1/module.d.ts +16 -0
  160. package/dist/shaders/color/posterize/v1/module.d.ts.map +1 -0
  161. package/dist/shaders/color/posterize/v1/module.js +80 -0
  162. package/dist/shaders/color/posterize/v1/module.js.map +1 -0
  163. package/dist/shaders/color/solarize/v1/module.d.ts +15 -0
  164. package/dist/shaders/color/solarize/v1/module.d.ts.map +1 -0
  165. package/dist/shaders/color/solarize/v1/module.js +83 -0
  166. package/dist/shaders/color/solarize/v1/module.js.map +1 -0
  167. package/dist/shaders/color/splitToning/v1/module.d.ts +26 -0
  168. package/dist/shaders/color/splitToning/v1/module.d.ts.map +1 -0
  169. package/dist/shaders/color/splitToning/v1/module.js +95 -0
  170. package/dist/shaders/color/splitToning/v1/module.js.map +1 -0
  171. package/dist/shaders/filters/blur/gaussian/v1/module.d.ts +23 -0
  172. package/dist/shaders/filters/blur/gaussian/v1/module.d.ts.map +1 -0
  173. package/dist/shaders/filters/blur/gaussian/v1/module.js +110 -0
  174. package/dist/shaders/filters/blur/gaussian/v1/module.js.map +1 -0
  175. package/dist/shaders/filters/blur/separable/v1/module.d.ts +18 -0
  176. package/dist/shaders/filters/blur/separable/v1/module.d.ts.map +1 -0
  177. package/dist/shaders/filters/blur/separable/v1/module.js +64 -0
  178. package/dist/shaders/filters/blur/separable/v1/module.js.map +1 -0
  179. package/dist/shaders/filters/convolve3x3/v1/module.d.ts +23 -0
  180. package/dist/shaders/filters/convolve3x3/v1/module.d.ts.map +1 -0
  181. package/dist/shaders/filters/convolve3x3/v1/module.js +128 -0
  182. package/dist/shaders/filters/convolve3x3/v1/module.js.map +1 -0
  183. package/dist/shaders/filters/glow/v1/module.d.ts +26 -0
  184. package/dist/shaders/filters/glow/v1/module.d.ts.map +1 -0
  185. package/dist/shaders/filters/glow/v1/module.js +102 -0
  186. package/dist/shaders/filters/glow/v1/module.js.map +1 -0
  187. package/dist/shaders/filters/grain/v1/module.d.ts +38 -0
  188. package/dist/shaders/filters/grain/v1/module.d.ts.map +1 -0
  189. package/dist/shaders/filters/grain/v1/module.js +110 -0
  190. package/dist/shaders/filters/grain/v1/module.js.map +1 -0
  191. package/dist/shaders/filters/pixelate/v1/module.d.ts +14 -0
  192. package/dist/shaders/filters/pixelate/v1/module.d.ts.map +1 -0
  193. package/dist/shaders/filters/pixelate/v1/module.js +76 -0
  194. package/dist/shaders/filters/pixelate/v1/module.js.map +1 -0
  195. package/dist/shaders/filters/sharpen/unsharpMask/v1/module.d.ts +17 -0
  196. package/dist/shaders/filters/sharpen/unsharpMask/v1/module.d.ts.map +1 -0
  197. package/dist/shaders/filters/sharpen/unsharpMask/v1/module.js +93 -0
  198. package/dist/shaders/filters/sharpen/unsharpMask/v1/module.js.map +1 -0
  199. package/dist/shaders/filters/threshold/v1/module.d.ts +17 -0
  200. package/dist/shaders/filters/threshold/v1/module.d.ts.map +1 -0
  201. package/dist/shaders/filters/threshold/v1/module.js +71 -0
  202. package/dist/shaders/filters/threshold/v1/module.js.map +1 -0
  203. package/dist/shaders/filters/vignette/v1/module.d.ts +18 -0
  204. package/dist/shaders/filters/vignette/v1/module.d.ts.map +1 -0
  205. package/dist/shaders/filters/vignette/v1/module.js +78 -0
  206. package/dist/shaders/filters/vignette/v1/module.js.map +1 -0
  207. package/dist/shaders/filters/visualFx/v1/module.d.ts +24 -0
  208. package/dist/shaders/filters/visualFx/v1/module.d.ts.map +1 -0
  209. package/dist/shaders/filters/visualFx/v1/module.js +210 -0
  210. package/dist/shaders/filters/visualFx/v1/module.js.map +1 -0
  211. package/dist/shaders/index.d.ts +86 -0
  212. package/dist/shaders/index.d.ts.map +1 -0
  213. package/dist/shaders/index.js +161 -0
  214. package/dist/shaders/index.js.map +1 -0
  215. package/dist/shaders/keyer/chromaKey/v1/module.d.ts +25 -0
  216. package/dist/shaders/keyer/chromaKey/v1/module.d.ts.map +1 -0
  217. package/dist/shaders/keyer/chromaKey/v1/module.js +111 -0
  218. package/dist/shaders/keyer/chromaKey/v1/module.js.map +1 -0
  219. package/dist/shaders/keyer/lumaKey/v1/module.d.ts +22 -0
  220. package/dist/shaders/keyer/lumaKey/v1/module.d.ts.map +1 -0
  221. package/dist/shaders/keyer/lumaKey/v1/module.js +89 -0
  222. package/dist/shaders/keyer/lumaKey/v1/module.js.map +1 -0
  223. package/dist/shaders/mask/apply/v1/module.d.ts +16 -0
  224. package/dist/shaders/mask/apply/v1/module.d.ts.map +1 -0
  225. package/dist/shaders/mask/apply/v1/module.js +79 -0
  226. package/dist/shaders/mask/apply/v1/module.js.map +1 -0
  227. package/dist/shaders/mask/fromImage/v1/module.d.ts +18 -0
  228. package/dist/shaders/mask/fromImage/v1/module.d.ts.map +1 -0
  229. package/dist/shaders/mask/fromImage/v1/module.js +99 -0
  230. package/dist/shaders/mask/fromImage/v1/module.js.map +1 -0
  231. package/dist/shaders/mask/invert/v1/module.d.ts +12 -0
  232. package/dist/shaders/mask/invert/v1/module.d.ts.map +1 -0
  233. package/dist/shaders/mask/invert/v1/module.js +57 -0
  234. package/dist/shaders/mask/invert/v1/module.js.map +1 -0
  235. package/dist/shaders/mixer/add/v1/module.d.ts +17 -0
  236. package/dist/shaders/mixer/add/v1/module.d.ts.map +1 -0
  237. package/dist/shaders/mixer/add/v1/module.js +73 -0
  238. package/dist/shaders/mixer/add/v1/module.js.map +1 -0
  239. package/dist/shaders/mixer/colorOverlay/v1/module.d.ts +26 -0
  240. package/dist/shaders/mixer/colorOverlay/v1/module.d.ts.map +1 -0
  241. package/dist/shaders/mixer/colorOverlay/v1/module.js +81 -0
  242. package/dist/shaders/mixer/colorOverlay/v1/module.js.map +1 -0
  243. package/dist/shaders/mixer/dropShadow/v1/module.d.ts +28 -0
  244. package/dist/shaders/mixer/dropShadow/v1/module.d.ts.map +1 -0
  245. package/dist/shaders/mixer/dropShadow/v1/module.js +104 -0
  246. package/dist/shaders/mixer/dropShadow/v1/module.js.map +1 -0
  247. package/dist/shaders/mixer/outline/v1/module.d.ts +27 -0
  248. package/dist/shaders/mixer/outline/v1/module.d.ts.map +1 -0
  249. package/dist/shaders/mixer/outline/v1/module.js +105 -0
  250. package/dist/shaders/mixer/outline/v1/module.js.map +1 -0
  251. package/dist/shaders/mixer/over/v1/module.d.ts +16 -0
  252. package/dist/shaders/mixer/over/v1/module.d.ts.map +1 -0
  253. package/dist/shaders/mixer/over/v1/module.js +71 -0
  254. package/dist/shaders/mixer/over/v1/module.js.map +1 -0
  255. package/dist/shaders/mixer/shadowCompose/v1/module.d.ts +26 -0
  256. package/dist/shaders/mixer/shadowCompose/v1/module.d.ts.map +1 -0
  257. package/dist/shaders/mixer/shadowCompose/v1/module.js +95 -0
  258. package/dist/shaders/mixer/shadowCompose/v1/module.js.map +1 -0
  259. package/dist/shaders/sources/angularGradient/v1/module.d.ts +18 -0
  260. package/dist/shaders/sources/angularGradient/v1/module.d.ts.map +1 -0
  261. package/dist/shaders/sources/angularGradient/v1/module.js +67 -0
  262. package/dist/shaders/sources/angularGradient/v1/module.js.map +1 -0
  263. package/dist/shaders/sources/checkerboard/v1/module.d.ts +19 -0
  264. package/dist/shaders/sources/checkerboard/v1/module.d.ts.map +1 -0
  265. package/dist/shaders/sources/checkerboard/v1/module.js +70 -0
  266. package/dist/shaders/sources/checkerboard/v1/module.js.map +1 -0
  267. package/dist/shaders/sources/diamondGradient/v1/module.d.ts +18 -0
  268. package/dist/shaders/sources/diamondGradient/v1/module.d.ts.map +1 -0
  269. package/dist/shaders/sources/diamondGradient/v1/module.js +61 -0
  270. package/dist/shaders/sources/diamondGradient/v1/module.js.map +1 -0
  271. package/dist/shaders/sources/gaussianNoise/v1/module.d.ts +21 -0
  272. package/dist/shaders/sources/gaussianNoise/v1/module.d.ts.map +1 -0
  273. package/dist/shaders/sources/gaussianNoise/v1/module.js +72 -0
  274. package/dist/shaders/sources/gaussianNoise/v1/module.js.map +1 -0
  275. package/dist/shaders/sources/linearGradient/v1/module.d.ts +21 -0
  276. package/dist/shaders/sources/linearGradient/v1/module.d.ts.map +1 -0
  277. package/dist/shaders/sources/linearGradient/v1/module.js +72 -0
  278. package/dist/shaders/sources/linearGradient/v1/module.js.map +1 -0
  279. package/dist/shaders/sources/radialGradient/v1/module.d.ts +18 -0
  280. package/dist/shaders/sources/radialGradient/v1/module.d.ts.map +1 -0
  281. package/dist/shaders/sources/radialGradient/v1/module.js +60 -0
  282. package/dist/shaders/sources/radialGradient/v1/module.js.map +1 -0
  283. package/dist/shaders/sources/solid/v1/module.d.ts +17 -0
  284. package/dist/shaders/sources/solid/v1/module.d.ts.map +1 -0
  285. package/dist/shaders/sources/solid/v1/module.js +49 -0
  286. package/dist/shaders/sources/solid/v1/module.js.map +1 -0
  287. package/dist/shaders/transform/affine/v1/module.d.ts +36 -0
  288. package/dist/shaders/transform/affine/v1/module.d.ts.map +1 -0
  289. package/dist/shaders/transform/affine/v1/module.js +94 -0
  290. package/dist/shaders/transform/affine/v1/module.js.map +1 -0
  291. package/dist/shaders/transform/cornerPin/v1/module.d.ts +40 -0
  292. package/dist/shaders/transform/cornerPin/v1/module.d.ts.map +1 -0
  293. package/dist/shaders/transform/cornerPin/v1/module.js +109 -0
  294. package/dist/shaders/transform/cornerPin/v1/module.js.map +1 -0
  295. package/dist/shaders/transform/crop/v1/module.d.ts +26 -0
  296. package/dist/shaders/transform/crop/v1/module.d.ts.map +1 -0
  297. package/dist/shaders/transform/crop/v1/module.js +82 -0
  298. package/dist/shaders/transform/crop/v1/module.js.map +1 -0
  299. package/dist/shaders/transform/displace/v1/module.d.ts +23 -0
  300. package/dist/shaders/transform/displace/v1/module.d.ts.map +1 -0
  301. package/dist/shaders/transform/displace/v1/module.js +95 -0
  302. package/dist/shaders/transform/displace/v1/module.js.map +1 -0
  303. package/dist/shaders/transform/mirror/v1/module.d.ts +14 -0
  304. package/dist/shaders/transform/mirror/v1/module.d.ts.map +1 -0
  305. package/dist/shaders/transform/mirror/v1/module.js +73 -0
  306. package/dist/shaders/transform/mirror/v1/module.js.map +1 -0
  307. package/dist/shaders/transform/offset/v1/module.d.ts +21 -0
  308. package/dist/shaders/transform/offset/v1/module.d.ts.map +1 -0
  309. package/dist/shaders/transform/offset/v1/module.js +88 -0
  310. package/dist/shaders/transform/offset/v1/module.js.map +1 -0
  311. package/dist/shaders/transform/pad/v1/module.d.ts +26 -0
  312. package/dist/shaders/transform/pad/v1/module.d.ts.map +1 -0
  313. package/dist/shaders/transform/pad/v1/module.js +95 -0
  314. package/dist/shaders/transform/pad/v1/module.js.map +1 -0
  315. package/dist/shaders/transform/polarRemap/v1/module.d.ts +20 -0
  316. package/dist/shaders/transform/polarRemap/v1/module.d.ts.map +1 -0
  317. package/dist/shaders/transform/polarRemap/v1/module.js +95 -0
  318. package/dist/shaders/transform/polarRemap/v1/module.js.map +1 -0
  319. package/dist/shaders/transform/resize/v1/module.d.ts +20 -0
  320. package/dist/shaders/transform/resize/v1/module.d.ts.map +1 -0
  321. package/dist/shaders/transform/resize/v1/module.js +116 -0
  322. package/dist/shaders/transform/resize/v1/module.js.map +1 -0
  323. package/dist/shaders/transform/rotate90/v1/module.d.ts +25 -0
  324. package/dist/shaders/transform/rotate90/v1/module.d.ts.map +1 -0
  325. package/dist/shaders/transform/rotate90/v1/module.js +90 -0
  326. package/dist/shaders/transform/rotate90/v1/module.js.map +1 -0
  327. package/dist/shaders/transform/spherize/v1/module.d.ts +21 -0
  328. package/dist/shaders/transform/spherize/v1/module.d.ts.map +1 -0
  329. package/dist/shaders/transform/spherize/v1/module.js +94 -0
  330. package/dist/shaders/transform/spherize/v1/module.js.map +1 -0
  331. package/dist/shaders/transform/tile/v1/module.d.ts +22 -0
  332. package/dist/shaders/transform/tile/v1/module.d.ts.map +1 -0
  333. package/dist/shaders/transform/tile/v1/module.js +89 -0
  334. package/dist/shaders/transform/tile/v1/module.js.map +1 -0
  335. package/dist/shared/lumaWgsl.d.ts +14 -0
  336. package/dist/shared/lumaWgsl.d.ts.map +1 -0
  337. package/dist/shared/lumaWgsl.js +18 -0
  338. package/dist/shared/lumaWgsl.js.map +1 -0
  339. package/dist/shared/premulWgsl.d.ts +46 -0
  340. package/dist/shared/premulWgsl.d.ts.map +1 -0
  341. package/dist/shared/premulWgsl.js +90 -0
  342. package/dist/shared/premulWgsl.js.map +1 -0
  343. package/dist/texture.d.ts +54 -0
  344. package/dist/texture.d.ts.map +1 -0
  345. package/dist/texture.js +70 -0
  346. package/dist/texture.js.map +1 -0
  347. package/dist/types.d.ts +103 -0
  348. package/dist/types.d.ts.map +1 -0
  349. package/dist/types.js +8 -0
  350. package/dist/types.js.map +1 -0
  351. package/dist/validate/wgslLinearity.d.ts +86 -0
  352. package/dist/validate/wgslLinearity.d.ts.map +1 -0
  353. package/dist/validate/wgslLinearity.js +298 -0
  354. package/dist/validate/wgslLinearity.js.map +1 -0
  355. package/dist/webgpu/index.d.ts +11 -0
  356. package/dist/webgpu/index.d.ts.map +1 -0
  357. package/dist/webgpu/index.js +11 -0
  358. package/dist/webgpu/index.js.map +1 -0
  359. package/package.json +85 -0
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @nodetool-ai/gpu
2
+
3
+ Canonical blend-mode catalog and shared WGSL blend functions for NodeTool compositors (sketch, timeline, Compositor node) for [NodeTool](https://nodetool.ai).
4
+
5
+ The single source of truth for the `BlendMode` union, its stable numeric GPU ids, the Canvas2D and Sharp/libvips mappings, and the shared WGSL `applyBlendMode` shader math. The package root is pure — no WebGPU runtime — so Node consumers can pull in the catalog without the GPU stack. The TypeGPU shader pool lives behind `./pool` and the browser layer-compositing engine behind `./webgpu`.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @nodetool-ai/gpu
11
+ ```
12
+
13
+ ## Exported symbols
14
+
15
+ | Symbol | Kind | Description |
16
+ | --- | --- | --- |
17
+ | `BlendMode` | type | Union of the 13 canonical blend modes (`normal`, `multiply`, `add`, …) |
18
+ | `BLEND_MODE_TUPLE` | const | Ordered `const` tuple of mode names — drives the union and Zod enums |
19
+ | `BLEND_MODE_INFOS` | const | Full table: value, label, `gpuId`, Canvas2D op, Sharp blend |
20
+ | `BLEND_MODES` | const | `{ value, label }[]` for UI dropdowns |
21
+ | `BLEND_MODE_VALUES` | const | Alias of `BLEND_MODE_TUPLE` |
22
+ | `BlendModeInfo` | interface | One catalog row |
23
+ | `CanvasCompositeOp` | type | Literal union of the Canvas2D `globalCompositeOperation` values used |
24
+ | `coerceBlendMode` | function | Coerce unknown input to a valid `BlendMode` (falls back to `normal`) |
25
+ | `blendModeGpuId` | function | Map a mode to its stable numeric shader id |
26
+ | `blendModeToCanvasOp` | function | Map a mode to its Canvas2D composite op |
27
+ | `blendModeToSharpBlend` | function | Map a mode to its Sharp/libvips `blend` string |
28
+ | `WGSL_BLEND_FUNCTIONS` | const | WGSL source for `applyBlendMode(src, dst, mode)`, injected into fragment shaders |
29
+
30
+ ## Usage
31
+
32
+ ```ts
33
+ import {
34
+ BLEND_MODES,
35
+ blendModeToCanvasOp,
36
+ WGSL_BLEND_FUNCTIONS
37
+ } from "@nodetool-ai/gpu";
38
+
39
+ // Populate a UI dropdown
40
+ BLEND_MODES.forEach(({ value, label }) => addOption(value, label));
41
+
42
+ // Canvas2D compositing
43
+ ctx.globalCompositeOperation = blendModeToCanvasOp("multiply") as GlobalCompositeOperation;
44
+
45
+ // Inject the shared blend math into a WGSL fragment shader
46
+ const fragment = `${WGSL_BLEND_FUNCTIONS}\n@fragment fn fs(...) { ... }`;
47
+ ```
48
+
49
+ ## Links
50
+
51
+ - [NodeTool](https://nodetool.ai)
52
+ - [GitHub](https://github.com/nodetool-ai/nodetool)
@@ -0,0 +1 @@
1
+ 2026-09-28T09:19:03.821Z
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Canonical blend-mode catalog shared by every NodeTool compositor:
3
+ *
4
+ * - the sketch editor (WebGPU + Canvas2D layer compositing)
5
+ * - the timeline preview compositor (WebGPU clip compositing)
6
+ * - the Compositor image node (server-side Sharp/libvips compositing)
7
+ *
8
+ * The mode names come from `@nodetool-ai/protocol/blend-modes`, where the
9
+ * document schemas validate against them, and are re-exported here so callers
10
+ * see one catalog. This module owns what a compositor needs on top of a name:
11
+ * the stable numeric ids baked into WGSL shader uniforms, the Canvas2D
12
+ * `globalCompositeOperation` mapping, the Sharp/libvips `blend` mapping, and
13
+ * the ordered list that populates UI dropdowns. Keeping those in one table
14
+ * guarantees the implementations agree on ordering and on the numeric ids the
15
+ * shaders switch on.
16
+ */
17
+ import { BLEND_MODE_TUPLE, type BlendMode } from "@nodetool-ai/protocol/blend-modes";
18
+ export { BLEND_MODE_TUPLE, type BlendMode };
19
+ /**
20
+ * Canvas2D `globalCompositeOperation` values we map onto. Declared as a
21
+ * literal union (not the DOM `GlobalCompositeOperation`) so this package
22
+ * builds without the DOM lib; every member is a valid DOM value, so callers
23
+ * can cast the result to `GlobalCompositeOperation` safely.
24
+ */
25
+ export type CanvasCompositeOp = "source-over" | "multiply" | "screen" | "overlay" | "darken" | "lighten" | "color-dodge" | "color-burn" | "hard-light" | "soft-light" | "difference" | "exclusion" | "lighter";
26
+ export interface BlendModeInfo {
27
+ value: BlendMode;
28
+ /** Human-readable label for UI dropdowns. */
29
+ label: string;
30
+ /**
31
+ * Stable numeric id consumed by the WGSL `applyBlendMode` switch (see
32
+ * {@link WGSL_BLEND_FUNCTIONS}). Never renumber — shaders depend on it.
33
+ */
34
+ gpuId: number;
35
+ /** Canvas2D `globalCompositeOperation` equivalent. */
36
+ canvasOp: CanvasCompositeOp;
37
+ /** Sharp/libvips `blend` string for server-side compositing. */
38
+ sharpBlend: string;
39
+ }
40
+ /**
41
+ * The canonical table. Order is the UI display order. `gpuId` values 0–11
42
+ * match the historical sketch-editor shader switch; `add` is 12.
43
+ */
44
+ export declare const BLEND_MODE_INFOS: readonly BlendModeInfo[];
45
+ /** Ordered list of `{ value, label }` for populating UI dropdowns. */
46
+ export declare const BLEND_MODES: readonly {
47
+ value: BlendMode;
48
+ label: string;
49
+ }[];
50
+ /** All canonical blend-mode values in display order (literal tuple). */
51
+ export declare const BLEND_MODE_VALUES: readonly ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "add"];
52
+ /**
53
+ * Coerce an arbitrary input to a canonical {@link BlendMode}. Unknown values
54
+ * (including stray data URLs that can leak into persisted UI state) fall back
55
+ * to `"normal"`. Accepts the legacy `"over"` alias.
56
+ */
57
+ export declare function coerceBlendMode(value: unknown): BlendMode;
58
+ /**
59
+ * Numeric id for the WGSL `applyBlendMode` switch. Takes a persisted value
60
+ * (canonical, legacy alias, or junk); anything unrecognized blends as normal.
61
+ */
62
+ export declare function blendModeGpuId(value: unknown): number;
63
+ /** Canvas2D `globalCompositeOperation` for a persisted blend mode. */
64
+ export declare function blendModeToCanvasOp(value: unknown): CanvasCompositeOp;
65
+ /** Sharp/libvips `blend` string for a persisted blend mode. */
66
+ export declare function blendModeToSharpBlend(value: unknown): string;
67
+ //# sourceMappingURL=blendModes.d.ts.map
@@ -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AO,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Canonical blend-mode catalog shared by every NodeTool compositor:
3
+ *
4
+ * - the sketch editor (WebGPU + Canvas2D layer compositing)
5
+ * - the timeline preview compositor (WebGPU clip compositing)
6
+ * - the Compositor image node (server-side Sharp/libvips compositing)
7
+ *
8
+ * The mode names come from `@nodetool-ai/protocol/blend-modes`, where the
9
+ * document schemas validate against them, and are re-exported here so callers
10
+ * see one catalog. This module owns what a compositor needs on top of a name:
11
+ * the stable numeric ids baked into WGSL shader uniforms, the Canvas2D
12
+ * `globalCompositeOperation` mapping, the Sharp/libvips `blend` mapping, and
13
+ * the ordered list that populates UI dropdowns. Keeping those in one table
14
+ * guarantees the implementations agree on ordering and on the numeric ids the
15
+ * shaders switch on.
16
+ */
17
+ import { BLEND_MODE_TUPLE } from "@nodetool-ai/protocol/blend-modes";
18
+ export { BLEND_MODE_TUPLE };
19
+ /**
20
+ * The canonical table. Order is the UI display order. `gpuId` values 0–11
21
+ * match the historical sketch-editor shader switch; `add` is 12.
22
+ */
23
+ export const BLEND_MODE_INFOS = [
24
+ { value: "normal", label: "Normal", gpuId: 0, canvasOp: "source-over", sharpBlend: "over" },
25
+ { value: "multiply", label: "Multiply", gpuId: 1, canvasOp: "multiply", sharpBlend: "multiply" },
26
+ { value: "screen", label: "Screen", gpuId: 2, canvasOp: "screen", sharpBlend: "screen" },
27
+ { value: "overlay", label: "Overlay", gpuId: 3, canvasOp: "overlay", sharpBlend: "overlay" },
28
+ { value: "darken", label: "Darken", gpuId: 4, canvasOp: "darken", sharpBlend: "darken" },
29
+ { value: "lighten", label: "Lighten", gpuId: 5, canvasOp: "lighten", sharpBlend: "lighten" },
30
+ { value: "color-dodge", label: "Color Dodge", gpuId: 6, canvasOp: "color-dodge", sharpBlend: "color-dodge" },
31
+ { value: "color-burn", label: "Color Burn", gpuId: 7, canvasOp: "color-burn", sharpBlend: "color-burn" },
32
+ { value: "hard-light", label: "Hard Light", gpuId: 8, canvasOp: "hard-light", sharpBlend: "hard-light" },
33
+ { value: "soft-light", label: "Soft Light", gpuId: 9, canvasOp: "soft-light", sharpBlend: "soft-light" },
34
+ { value: "difference", label: "Difference", gpuId: 10, canvasOp: "difference", sharpBlend: "difference" },
35
+ { value: "exclusion", label: "Exclusion", gpuId: 11, canvasOp: "exclusion", sharpBlend: "exclusion" },
36
+ { value: "add", label: "Add", gpuId: 12, canvasOp: "lighter", sharpBlend: "add" }
37
+ ];
38
+ /** Ordered list of `{ value, label }` for populating UI dropdowns. */
39
+ export const BLEND_MODES = BLEND_MODE_INFOS.map(({ value, label }) => ({ value, label }));
40
+ /** All canonical blend-mode values in display order (literal tuple). */
41
+ export const BLEND_MODE_VALUES = BLEND_MODE_TUPLE;
42
+ const INFO_BY_VALUE = new Map(BLEND_MODE_INFOS.map((info) => [info.value, info]));
43
+ /**
44
+ * Every persisted spelling of a blend mode, mapped to its canonical value:
45
+ * each canonical value itself, plus the legacy aliases — the Compositor image
46
+ * node historically stored `"over"` (the libvips name) for normal blending.
47
+ *
48
+ * Keyed by `unknown` so a persisted value that is not a blend-mode string at
49
+ * all (a number, an object, a stray data URL that leaked into UI state) simply
50
+ * misses the lookup instead of needing a representation check first.
51
+ */
52
+ const CANONICAL_BY_PERSISTED_VALUE = new Map();
53
+ for (const info of BLEND_MODE_INFOS) {
54
+ CANONICAL_BY_PERSISTED_VALUE.set(info.value, info.value);
55
+ }
56
+ CANONICAL_BY_PERSISTED_VALUE.set("over", "normal");
57
+ /**
58
+ * Coerce an arbitrary input to a canonical {@link BlendMode}. Unknown values
59
+ * (including stray data URLs that can leak into persisted UI state) fall back
60
+ * to `"normal"`. Accepts the legacy `"over"` alias.
61
+ */
62
+ export function coerceBlendMode(value) {
63
+ return CANONICAL_BY_PERSISTED_VALUE.get(value) ?? "normal";
64
+ }
65
+ /**
66
+ * Numeric id for the WGSL `applyBlendMode` switch. Takes a persisted value
67
+ * (canonical, legacy alias, or junk); anything unrecognized blends as normal.
68
+ */
69
+ export function blendModeGpuId(value) {
70
+ return INFO_BY_VALUE.get(coerceBlendMode(value))?.gpuId ?? 0;
71
+ }
72
+ /** Canvas2D `globalCompositeOperation` for a persisted blend mode. */
73
+ export function blendModeToCanvasOp(value) {
74
+ return INFO_BY_VALUE.get(coerceBlendMode(value))?.canvasOp ?? "source-over";
75
+ }
76
+ /** Sharp/libvips `blend` string for a persisted blend mode. */
77
+ export function blendModeToSharpBlend(value) {
78
+ return INFO_BY_VALUE.get(coerceBlendMode(value))?.sharpBlend ?? "over";
79
+ }
80
+ //# sourceMappingURL=blendModes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blendModes.js","sourceRoot":"","sources":["../../src/blend/blendModes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,gBAAgB,EAEjB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAkB,CAAC;AAsC5C;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE;IAC3F,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE;IAChG,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;IACxF,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE;IAC5F,EAAE,KAAK,EAAE,QAAQ,EAAE,KAA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U,IAAI,MAAM,CAAC;AACzE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Blend catalog — pure, Node-safe.
3
+ *
4
+ * The canonical `BlendMode` union, the ordered UI list, stable `gpuId`s, the
5
+ * Canvas2D / Sharp-libvips mappings, and the shared WGSL `applyBlendMode`
6
+ * switch. No WebGPU runtime — importable from Node consumers.
7
+ */
8
+ export * from "./blendModes.js";
9
+ export * from "./wgsl.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blend/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Blend catalog — pure, Node-safe.
3
+ *
4
+ * The canonical `BlendMode` union, the ordered UI list, stable `gpuId`s, the
5
+ * Canvas2D / Sharp-libvips mappings, and the shared WGSL `applyBlendMode`
6
+ * switch. No WebGPU runtime — importable from Node consumers.
7
+ */
8
+ export * from "./blendModes.js";
9
+ export * from "./wgsl.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blend/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared WGSL blend-mode functions.
3
+ *
4
+ * Both the sketch editor and the timeline preview compositor inject this
5
+ * string into their fragment shaders (via template interpolation) so the
6
+ * blend math is defined once. It exposes:
7
+ *
8
+ * fn applyBlendMode(src: vec3f, dst: vec3f, mode: u32) -> vec3f
9
+ *
10
+ * `mode` is the `gpuId` from the canonical blend-mode table in
11
+ * `blendModes.ts` — keep the switch cases in lock-step with that table.
12
+ * The per-channel functions implement the W3C compositing spec; `add` (12)
13
+ * is additive (saturating sum).
14
+ */
15
+ export declare const WGSL_BLEND_FUNCTIONS = "\n// Blend mode ids (must match BLEND_MODE_INFOS[*].gpuId in blendModes.ts):\n// 0 = normal, 1 = multiply, 2 = screen, 3 = overlay, 4 = darken,\n// 5 = lighten, 6 = color-dodge, 7 = color-burn, 8 = hard-light,\n// 9 = soft-light, 10 = difference, 11 = exclusion, 12 = add\n\nfn softLightD(x: f32) -> f32 {\n if (x <= 0.25) {\n return ((16.0 * x - 12.0) * x + 4.0) * x;\n }\n return sqrt(x);\n}\n\nfn blendChannel(s: f32, d: f32, mode: u32) -> f32 {\n switch (mode) {\n case 0u: { return s; }\n case 1u: { return s * d; }\n case 2u: { return s + d - s * d; }\n case 3u: {\n return select(\n 1.0 - 2.0 * (1.0 - s) * (1.0 - d),\n 2.0 * s * d,\n d <= 0.5\n );\n }\n case 4u: { return min(s, d); }\n case 5u: { return max(s, d); }\n case 6u: {\n return select(\n min(1.0, d / max(1.0 - s, 0.001)),\n 1.0,\n s >= 1.0\n );\n }\n case 7u: {\n return select(\n max(0.0, 1.0 - (1.0 - d) / max(s, 0.001)),\n 0.0,\n s <= 0.0\n );\n }\n case 8u: {\n return select(\n 1.0 - 2.0 * (1.0 - s) * (1.0 - d),\n 2.0 * s * d,\n s <= 0.5\n );\n }\n case 9u: {\n return select(\n d + (2.0 * s - 1.0) * (softLightD(d) - d),\n d - (1.0 - 2.0 * s) * d * (1.0 - d),\n s <= 0.5\n );\n }\n case 10u: { return abs(s - d); }\n case 11u: { return s + d - 2.0 * s * d; }\n case 12u: { return min(1.0, s + d); }\n default: { return s; }\n }\n}\n\nfn applyBlendMode(src: vec3f, dst: vec3f, mode: u32) -> vec3f {\n return vec3f(\n blendChannel(src.x, dst.x, mode),\n blendChannel(src.y, dst.y, mode),\n blendChannel(src.z, dst.z, mode)\n );\n}\n";
16
+ //# sourceMappingURL=wgsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wgsl.d.ts","sourceRoot":"","sources":["../../src/blend/wgsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,gtDAqEhC,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Shared WGSL blend-mode functions.
3
+ *
4
+ * Both the sketch editor and the timeline preview compositor inject this
5
+ * string into their fragment shaders (via template interpolation) so the
6
+ * blend math is defined once. It exposes:
7
+ *
8
+ * fn applyBlendMode(src: vec3f, dst: vec3f, mode: u32) -> vec3f
9
+ *
10
+ * `mode` is the `gpuId` from the canonical blend-mode table in
11
+ * `blendModes.ts` — keep the switch cases in lock-step with that table.
12
+ * The per-channel functions implement the W3C compositing spec; `add` (12)
13
+ * is additive (saturating sum).
14
+ */
15
+ export const WGSL_BLEND_FUNCTIONS = /* wgsl */ `
16
+ // Blend mode ids (must match BLEND_MODE_INFOS[*].gpuId in blendModes.ts):
17
+ // 0 = normal, 1 = multiply, 2 = screen, 3 = overlay, 4 = darken,
18
+ // 5 = lighten, 6 = color-dodge, 7 = color-burn, 8 = hard-light,
19
+ // 9 = soft-light, 10 = difference, 11 = exclusion, 12 = add
20
+
21
+ fn softLightD(x: f32) -> f32 {
22
+ if (x <= 0.25) {
23
+ return ((16.0 * x - 12.0) * x + 4.0) * x;
24
+ }
25
+ return sqrt(x);
26
+ }
27
+
28
+ fn blendChannel(s: f32, d: f32, mode: u32) -> f32 {
29
+ switch (mode) {
30
+ case 0u: { return s; }
31
+ case 1u: { return s * d; }
32
+ case 2u: { return s + d - s * d; }
33
+ case 3u: {
34
+ return select(
35
+ 1.0 - 2.0 * (1.0 - s) * (1.0 - d),
36
+ 2.0 * s * d,
37
+ d <= 0.5
38
+ );
39
+ }
40
+ case 4u: { return min(s, d); }
41
+ case 5u: { return max(s, d); }
42
+ case 6u: {
43
+ return select(
44
+ min(1.0, d / max(1.0 - s, 0.001)),
45
+ 1.0,
46
+ s >= 1.0
47
+ );
48
+ }
49
+ case 7u: {
50
+ return select(
51
+ max(0.0, 1.0 - (1.0 - d) / max(s, 0.001)),
52
+ 0.0,
53
+ s <= 0.0
54
+ );
55
+ }
56
+ case 8u: {
57
+ return select(
58
+ 1.0 - 2.0 * (1.0 - s) * (1.0 - d),
59
+ 2.0 * s * d,
60
+ s <= 0.5
61
+ );
62
+ }
63
+ case 9u: {
64
+ return select(
65
+ d + (2.0 * s - 1.0) * (softLightD(d) - d),
66
+ d - (1.0 - 2.0 * s) * d * (1.0 - d),
67
+ s <= 0.5
68
+ );
69
+ }
70
+ case 10u: { return abs(s - d); }
71
+ case 11u: { return s + d - 2.0 * s * d; }
72
+ case 12u: { return min(1.0, s + d); }
73
+ default: { return s; }
74
+ }
75
+ }
76
+
77
+ fn applyBlendMode(src: vec3f, dst: vec3f, mode: u32) -> vec3f {
78
+ return vec3f(
79
+ blendChannel(src.x, dst.x, mode),
80
+ blendChannel(src.y, dst.y, mode),
81
+ blendChannel(src.z, dst.z, mode)
82
+ );
83
+ }
84
+ `;
85
+ //# sourceMappingURL=wgsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wgsl.js","sourceRoot":"","sources":["../../src/blend/wgsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE9C,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * WebGPULayerCompositor — the shared layer-compositing engine.
3
+ *
4
+ * Owns the blend + blit render pipelines, the ping-pong accumulation
5
+ * textures, and the sampler. Both the sketch editor and the timeline
6
+ * preview drive it: they upload their own source textures (canvas layers /
7
+ * video frames), seed the background into the read texture, then call
8
+ * {@link renderBlendPass} once per layer and {@link blit} to present.
9
+ *
10
+ * The engine is source-agnostic — it composites `GPUTexture`s addressed by a
11
+ * 2×3 inverse-affine matrix (screen px → layer texel). Sketch supplies
12
+ * `nearest` filtering (pixel-exact paint); the timeline supplies `linear`
13
+ * (smooth scaled video) plus an optional rounded-rect mask.
14
+ */
15
+ /** 2×3 affine matrix mapping screen pixels → layer texels. */
16
+ export interface InverseAffine {
17
+ a: number;
18
+ b: number;
19
+ tx: number;
20
+ c: number;
21
+ d: number;
22
+ ty: number;
23
+ p?: number;
24
+ q?: number;
25
+ r?: number;
26
+ }
27
+ export type CompositorFilter = "nearest" | "linear";
28
+ export interface BlendPassParams {
29
+ /** Layer source texture. */
30
+ source: GPUTexture;
31
+ opacity: number;
32
+ /** Canonical blend-mode gpuId (see blendModes.ts). */
33
+ blendModeId: number;
34
+ canvasW: number;
35
+ canvasH: number;
36
+ invAffine: InverseAffine;
37
+ /** Normalized rounded-corner radius 0..0.5. 0 = sharp (default). */
38
+ borderRadius?: number;
39
+ /**
40
+ * Directional wipe mask in the layer's own normalized quad space (the mask
41
+ * edge rotates with the layer). Omit for no mask.
42
+ */
43
+ wipe?: {
44
+ /** Edge the reveal starts from: 1 = left, 2 = right, 3 = top, 4 = bottom. */
45
+ edge: 1 | 2 | 3 | 4;
46
+ /** 0 = fully hidden, 1 = fully revealed. */
47
+ progress: number;
48
+ /** Feathered edge width as a fraction of the wipe axis. 0 = hard edge. */
49
+ softness: number;
50
+ };
51
+ iris?: {
52
+ progress: number;
53
+ softness: number;
54
+ };
55
+ }
56
+ /**
57
+ * Convert a column-major 4×4 clip-space placement matrix (mapping a quad
58
+ * with local coords in [-1,1]² to clip space, as produced by the timeline's
59
+ * `buildTransformMatrix`) into the inverse-affine matrix (screen px → layer
60
+ * texel) the compositor shader expects.
61
+ *
62
+ * The composed screen→texel map is affine, so it is reconstructed exactly by
63
+ * evaluating three points and differencing — no hand-derived trigonometry,
64
+ * which keeps placement faithful to the matrix the caller already trusts.
65
+ */
66
+ export declare function forwardClipMatrixToInverseAffine(m: Float32Array | number[], sourceWidth: number, sourceHeight: number, canvasWidth: number, canvasHeight: number): InverseAffine;
67
+ /**
68
+ * {@link forwardClipMatrixToInverseAffine} without the identity fallback: null
69
+ * when the placement covers no area, such as a layer scaled to zero on either
70
+ * axis. A caller that draws layers must skip a null placement. The identity
71
+ * would draw the source 1:1 from the frame's top-left corner.
72
+ */
73
+ export declare function invertClipPlacement(m: Float32Array | number[], sourceWidth: number, sourceHeight: number, canvasWidth: number, canvasHeight: number): InverseAffine | null;
74
+ export declare class WebGPULayerCompositor {
75
+ private readonly device;
76
+ private readonly format;
77
+ private readonly root;
78
+ private readonly blendBindGroupLayout;
79
+ private readonly blendPipeline;
80
+ private readonly blitBindGroupLayout;
81
+ private readonly blitPipeline;
82
+ private readonly sampler;
83
+ private readonly filterMode;
84
+ private pingPongA;
85
+ private pingPongB;
86
+ private widthPx;
87
+ private heightPx;
88
+ private uniformBuffers;
89
+ private passIndex;
90
+ constructor(device: GPUDevice, format: GPUTextureFormat, filter?: CompositorFilter, label?: string);
91
+ get width(): number;
92
+ get height(): number;
93
+ /** The ping-pong accumulation textures. Seed the background into A. */
94
+ get textureA(): GPUTexture | null;
95
+ get textureB(): GPUTexture | null;
96
+ /** (Re)allocate the ping-pong textures when the canvas size changes. */
97
+ ensureSize(width: number, height: number): void;
98
+ /**
99
+ * Reset the per-frame uniform-buffer ring. Call once before the frame's
100
+ * sequence of {@link renderBlendPass} calls.
101
+ */
102
+ beginFrame(): void;
103
+ /**
104
+ * Composite one layer: reads `readTex` (current accumulation) and the
105
+ * layer source, writes the blended result to `writeTex` (full-screen).
106
+ */
107
+ renderBlendPass(encoder: GPUCommandEncoder, readTex: GPUTexture, writeTex: GPUTexture, params: BlendPassParams): void;
108
+ /** Present `srcTex` to a target view (swap chain or other attachment). */
109
+ blit(encoder: GPUCommandEncoder, srcTex: GPUTexture, targetView: GPUTextureView): void;
110
+ dispose(): void;
111
+ }
112
+ //# sourceMappingURL=compositor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compositor.d.ts","sourceRoot":"","sources":["../../src/compositor/compositor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;A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