@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.
- package/README.md +52 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/blend/blendModes.d.ts +67 -0
- package/dist/blend/blendModes.d.ts.map +1 -0
- package/dist/blend/blendModes.js +80 -0
- package/dist/blend/blendModes.js.map +1 -0
- package/dist/blend/index.d.ts +10 -0
- package/dist/blend/index.d.ts.map +1 -0
- package/dist/blend/index.js +10 -0
- package/dist/blend/index.js.map +1 -0
- package/dist/blend/wgsl.d.ts +16 -0
- package/dist/blend/wgsl.d.ts.map +1 -0
- package/dist/blend/wgsl.js +85 -0
- package/dist/blend/wgsl.js.map +1 -0
- package/dist/compositor/compositor.d.ts +112 -0
- package/dist/compositor/compositor.d.ts.map +1 -0
- package/dist/compositor/compositor.js +353 -0
- package/dist/compositor/compositor.js.map +1 -0
- package/dist/compositor/headless.d.ts +47 -0
- package/dist/compositor/headless.d.ts.map +1 -0
- package/dist/compositor/headless.js +158 -0
- package/dist/compositor/headless.js.map +1 -0
- package/dist/compositor/index.d.ts +8 -0
- package/dist/compositor/index.d.ts.map +1 -0
- package/dist/compositor/index.js +8 -0
- package/dist/compositor/index.js.map +1 -0
- package/dist/compositor/shaders.d.ts +24 -0
- package/dist/compositor/shaders.d.ts.map +1 -0
- package/dist/compositor/shaders.js +241 -0
- package/dist/compositor/shaders.js.map +1 -0
- package/dist/compositor/transform.d.ts +49 -0
- package/dist/compositor/transform.d.ts.map +1 -0
- package/dist/compositor/transform.js +74 -0
- package/dist/compositor/transform.js.map +1 -0
- package/dist/context.d.ts +108 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +205 -0
- package/dist/context.js.map +1 -0
- package/dist/debug/premulValidator.d.ts +85 -0
- package/dist/debug/premulValidator.d.ts.map +1 -0
- package/dist/debug/premulValidator.js +239 -0
- package/dist/debug/premulValidator.js.map +1 -0
- package/dist/executor.d.ts +74 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +413 -0
- package/dist/executor.js.map +1 -0
- package/dist/fullscreenQuad.d.ts +11 -0
- package/dist/fullscreenQuad.d.ts.map +1 -0
- package/dist/fullscreenQuad.js +31 -0
- package/dist/fullscreenQuad.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +162 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +100 -0
- package/dist/module.js.map +1 -0
- package/dist/node.d.ts +38 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +140 -0
- package/dist/node.js.map +1 -0
- package/dist/pool.d.ts +30 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +33 -0
- package/dist/pool.js.map +1 -0
- package/dist/recipe.d.ts +148 -0
- package/dist/recipe.d.ts.map +1 -0
- package/dist/recipe.js +181 -0
- package/dist/recipe.js.map +1 -0
- package/dist/registry.d.ts +49 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +100 -0
- package/dist/registry.js.map +1 -0
- package/dist/shaders/_canary/passthrough/v1/module.d.ts +13 -0
- package/dist/shaders/_canary/passthrough/v1/module.d.ts.map +1 -0
- package/dist/shaders/_canary/passthrough/v1/module.js +71 -0
- package/dist/shaders/_canary/passthrough/v1/module.js.map +1 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.d.ts +16 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.d.ts.map +1 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.js +62 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.js.map +1 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.d.ts +19 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.d.ts.map +1 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.js +61 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.js.map +1 -0
- package/dist/shaders/color/brightnessContrast/v1/module.d.ts +17 -0
- package/dist/shaders/color/brightnessContrast/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/brightnessContrast/v1/module.js +84 -0
- package/dist/shaders/color/brightnessContrast/v1/module.js.map +1 -0
- package/dist/shaders/color/cdl/v1/module.d.ts +35 -0
- package/dist/shaders/color/cdl/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/cdl/v1/module.js +106 -0
- package/dist/shaders/color/cdl/v1/module.js.map +1 -0
- package/dist/shaders/color/channelMerge/v1/module.d.ts +22 -0
- package/dist/shaders/color/channelMerge/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/channelMerge/v1/module.js +101 -0
- package/dist/shaders/color/channelMerge/v1/module.js.map +1 -0
- package/dist/shaders/color/channelShuffle/v1/module.d.ts +29 -0
- package/dist/shaders/color/channelShuffle/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/channelShuffle/v1/module.js +94 -0
- package/dist/shaders/color/channelShuffle/v1/module.js.map +1 -0
- package/dist/shaders/color/channelSplit/v1/module.d.ts +18 -0
- package/dist/shaders/color/channelSplit/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/channelSplit/v1/module.js +90 -0
- package/dist/shaders/color/channelSplit/v1/module.js.map +1 -0
- package/dist/shaders/color/colorBalance/v1/module.d.ts +18 -0
- package/dist/shaders/color/colorBalance/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/colorBalance/v1/module.js +86 -0
- package/dist/shaders/color/colorBalance/v1/module.js.map +1 -0
- package/dist/shaders/color/cubeLut/v1/module.d.ts +14 -0
- package/dist/shaders/color/cubeLut/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/cubeLut/v1/module.js +78 -0
- package/dist/shaders/color/cubeLut/v1/module.js.map +1 -0
- package/dist/shaders/color/curves/v1/module.d.ts +31 -0
- package/dist/shaders/color/curves/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/curves/v1/module.js +102 -0
- package/dist/shaders/color/curves/v1/module.js.map +1 -0
- package/dist/shaders/color/exposure/v1/module.d.ts +15 -0
- package/dist/shaders/color/exposure/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/exposure/v1/module.js +78 -0
- package/dist/shaders/color/exposure/v1/module.js.map +1 -0
- package/dist/shaders/color/exposureTone/v1/module.d.ts +28 -0
- package/dist/shaders/color/exposureTone/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/exposureTone/v1/module.js +107 -0
- package/dist/shaders/color/exposureTone/v1/module.js.map +1 -0
- package/dist/shaders/color/filmLook/v1/module.d.ts +28 -0
- package/dist/shaders/color/filmLook/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/filmLook/v1/module.js +103 -0
- package/dist/shaders/color/filmLook/v1/module.js.map +1 -0
- package/dist/shaders/color/grade/v1/module.d.ts +35 -0
- package/dist/shaders/color/grade/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/grade/v1/module.js +182 -0
- package/dist/shaders/color/grade/v1/module.js.map +1 -0
- package/dist/shaders/color/grayscale/v1/module.d.ts +14 -0
- package/dist/shaders/color/grayscale/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/grayscale/v1/module.js +79 -0
- package/dist/shaders/color/grayscale/v1/module.js.map +1 -0
- package/dist/shaders/color/hsb/v1/module.d.ts +20 -0
- package/dist/shaders/color/hsb/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/hsb/v1/module.js +131 -0
- package/dist/shaders/color/hsb/v1/module.js.map +1 -0
- package/dist/shaders/color/hslAdjust/v1/module.d.ts +30 -0
- package/dist/shaders/color/hslAdjust/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/hslAdjust/v1/module.js +170 -0
- package/dist/shaders/color/hslAdjust/v1/module.js.map +1 -0
- package/dist/shaders/color/invert/v1/module.d.ts +15 -0
- package/dist/shaders/color/invert/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/invert/v1/module.js +85 -0
- package/dist/shaders/color/invert/v1/module.js.map +1 -0
- package/dist/shaders/color/levels/v1/module.d.ts +33 -0
- package/dist/shaders/color/levels/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/levels/v1/module.js +116 -0
- package/dist/shaders/color/levels/v1/module.js.map +1 -0
- package/dist/shaders/color/liftGammaGain/v1/module.d.ts +40 -0
- package/dist/shaders/color/liftGammaGain/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/liftGammaGain/v1/module.js +114 -0
- package/dist/shaders/color/liftGammaGain/v1/module.js.map +1 -0
- package/dist/shaders/color/posterize/v1/module.d.ts +16 -0
- package/dist/shaders/color/posterize/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/posterize/v1/module.js +80 -0
- package/dist/shaders/color/posterize/v1/module.js.map +1 -0
- package/dist/shaders/color/solarize/v1/module.d.ts +15 -0
- package/dist/shaders/color/solarize/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/solarize/v1/module.js +83 -0
- package/dist/shaders/color/solarize/v1/module.js.map +1 -0
- package/dist/shaders/color/splitToning/v1/module.d.ts +26 -0
- package/dist/shaders/color/splitToning/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/splitToning/v1/module.js +95 -0
- package/dist/shaders/color/splitToning/v1/module.js.map +1 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.d.ts +23 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.js +110 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.js.map +1 -0
- package/dist/shaders/filters/blur/separable/v1/module.d.ts +18 -0
- package/dist/shaders/filters/blur/separable/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/blur/separable/v1/module.js +64 -0
- package/dist/shaders/filters/blur/separable/v1/module.js.map +1 -0
- package/dist/shaders/filters/convolve3x3/v1/module.d.ts +23 -0
- package/dist/shaders/filters/convolve3x3/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/convolve3x3/v1/module.js +128 -0
- package/dist/shaders/filters/convolve3x3/v1/module.js.map +1 -0
- package/dist/shaders/filters/glow/v1/module.d.ts +26 -0
- package/dist/shaders/filters/glow/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/glow/v1/module.js +102 -0
- package/dist/shaders/filters/glow/v1/module.js.map +1 -0
- package/dist/shaders/filters/grain/v1/module.d.ts +38 -0
- package/dist/shaders/filters/grain/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/grain/v1/module.js +110 -0
- package/dist/shaders/filters/grain/v1/module.js.map +1 -0
- package/dist/shaders/filters/pixelate/v1/module.d.ts +14 -0
- package/dist/shaders/filters/pixelate/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/pixelate/v1/module.js +76 -0
- package/dist/shaders/filters/pixelate/v1/module.js.map +1 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.d.ts +17 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.js +93 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.js.map +1 -0
- package/dist/shaders/filters/threshold/v1/module.d.ts +17 -0
- package/dist/shaders/filters/threshold/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/threshold/v1/module.js +71 -0
- package/dist/shaders/filters/threshold/v1/module.js.map +1 -0
- package/dist/shaders/filters/vignette/v1/module.d.ts +18 -0
- package/dist/shaders/filters/vignette/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/vignette/v1/module.js +78 -0
- package/dist/shaders/filters/vignette/v1/module.js.map +1 -0
- package/dist/shaders/filters/visualFx/v1/module.d.ts +24 -0
- package/dist/shaders/filters/visualFx/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/visualFx/v1/module.js +210 -0
- package/dist/shaders/filters/visualFx/v1/module.js.map +1 -0
- package/dist/shaders/index.d.ts +86 -0
- package/dist/shaders/index.d.ts.map +1 -0
- package/dist/shaders/index.js +161 -0
- package/dist/shaders/index.js.map +1 -0
- package/dist/shaders/keyer/chromaKey/v1/module.d.ts +25 -0
- package/dist/shaders/keyer/chromaKey/v1/module.d.ts.map +1 -0
- package/dist/shaders/keyer/chromaKey/v1/module.js +111 -0
- package/dist/shaders/keyer/chromaKey/v1/module.js.map +1 -0
- package/dist/shaders/keyer/lumaKey/v1/module.d.ts +22 -0
- package/dist/shaders/keyer/lumaKey/v1/module.d.ts.map +1 -0
- package/dist/shaders/keyer/lumaKey/v1/module.js +89 -0
- package/dist/shaders/keyer/lumaKey/v1/module.js.map +1 -0
- package/dist/shaders/mask/apply/v1/module.d.ts +16 -0
- package/dist/shaders/mask/apply/v1/module.d.ts.map +1 -0
- package/dist/shaders/mask/apply/v1/module.js +79 -0
- package/dist/shaders/mask/apply/v1/module.js.map +1 -0
- package/dist/shaders/mask/fromImage/v1/module.d.ts +18 -0
- package/dist/shaders/mask/fromImage/v1/module.d.ts.map +1 -0
- package/dist/shaders/mask/fromImage/v1/module.js +99 -0
- package/dist/shaders/mask/fromImage/v1/module.js.map +1 -0
- package/dist/shaders/mask/invert/v1/module.d.ts +12 -0
- package/dist/shaders/mask/invert/v1/module.d.ts.map +1 -0
- package/dist/shaders/mask/invert/v1/module.js +57 -0
- package/dist/shaders/mask/invert/v1/module.js.map +1 -0
- package/dist/shaders/mixer/add/v1/module.d.ts +17 -0
- package/dist/shaders/mixer/add/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/add/v1/module.js +73 -0
- package/dist/shaders/mixer/add/v1/module.js.map +1 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.d.ts +26 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.js +81 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.js.map +1 -0
- package/dist/shaders/mixer/dropShadow/v1/module.d.ts +28 -0
- package/dist/shaders/mixer/dropShadow/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/dropShadow/v1/module.js +104 -0
- package/dist/shaders/mixer/dropShadow/v1/module.js.map +1 -0
- package/dist/shaders/mixer/outline/v1/module.d.ts +27 -0
- package/dist/shaders/mixer/outline/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/outline/v1/module.js +105 -0
- package/dist/shaders/mixer/outline/v1/module.js.map +1 -0
- package/dist/shaders/mixer/over/v1/module.d.ts +16 -0
- package/dist/shaders/mixer/over/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/over/v1/module.js +71 -0
- package/dist/shaders/mixer/over/v1/module.js.map +1 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.d.ts +26 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.js +95 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.js.map +1 -0
- package/dist/shaders/sources/angularGradient/v1/module.d.ts +18 -0
- package/dist/shaders/sources/angularGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/angularGradient/v1/module.js +67 -0
- package/dist/shaders/sources/angularGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/checkerboard/v1/module.d.ts +19 -0
- package/dist/shaders/sources/checkerboard/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/checkerboard/v1/module.js +70 -0
- package/dist/shaders/sources/checkerboard/v1/module.js.map +1 -0
- package/dist/shaders/sources/diamondGradient/v1/module.d.ts +18 -0
- package/dist/shaders/sources/diamondGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/diamondGradient/v1/module.js +61 -0
- package/dist/shaders/sources/diamondGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.d.ts +21 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.js +72 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.js.map +1 -0
- package/dist/shaders/sources/linearGradient/v1/module.d.ts +21 -0
- package/dist/shaders/sources/linearGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/linearGradient/v1/module.js +72 -0
- package/dist/shaders/sources/linearGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/radialGradient/v1/module.d.ts +18 -0
- package/dist/shaders/sources/radialGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/radialGradient/v1/module.js +60 -0
- package/dist/shaders/sources/radialGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/solid/v1/module.d.ts +17 -0
- package/dist/shaders/sources/solid/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/solid/v1/module.js +49 -0
- package/dist/shaders/sources/solid/v1/module.js.map +1 -0
- package/dist/shaders/transform/affine/v1/module.d.ts +36 -0
- package/dist/shaders/transform/affine/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/affine/v1/module.js +94 -0
- package/dist/shaders/transform/affine/v1/module.js.map +1 -0
- package/dist/shaders/transform/cornerPin/v1/module.d.ts +40 -0
- package/dist/shaders/transform/cornerPin/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/cornerPin/v1/module.js +109 -0
- package/dist/shaders/transform/cornerPin/v1/module.js.map +1 -0
- package/dist/shaders/transform/crop/v1/module.d.ts +26 -0
- package/dist/shaders/transform/crop/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/crop/v1/module.js +82 -0
- package/dist/shaders/transform/crop/v1/module.js.map +1 -0
- package/dist/shaders/transform/displace/v1/module.d.ts +23 -0
- package/dist/shaders/transform/displace/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/displace/v1/module.js +95 -0
- package/dist/shaders/transform/displace/v1/module.js.map +1 -0
- package/dist/shaders/transform/mirror/v1/module.d.ts +14 -0
- package/dist/shaders/transform/mirror/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/mirror/v1/module.js +73 -0
- package/dist/shaders/transform/mirror/v1/module.js.map +1 -0
- package/dist/shaders/transform/offset/v1/module.d.ts +21 -0
- package/dist/shaders/transform/offset/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/offset/v1/module.js +88 -0
- package/dist/shaders/transform/offset/v1/module.js.map +1 -0
- package/dist/shaders/transform/pad/v1/module.d.ts +26 -0
- package/dist/shaders/transform/pad/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/pad/v1/module.js +95 -0
- package/dist/shaders/transform/pad/v1/module.js.map +1 -0
- package/dist/shaders/transform/polarRemap/v1/module.d.ts +20 -0
- package/dist/shaders/transform/polarRemap/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/polarRemap/v1/module.js +95 -0
- package/dist/shaders/transform/polarRemap/v1/module.js.map +1 -0
- package/dist/shaders/transform/resize/v1/module.d.ts +20 -0
- package/dist/shaders/transform/resize/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/resize/v1/module.js +116 -0
- package/dist/shaders/transform/resize/v1/module.js.map +1 -0
- package/dist/shaders/transform/rotate90/v1/module.d.ts +25 -0
- package/dist/shaders/transform/rotate90/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/rotate90/v1/module.js +90 -0
- package/dist/shaders/transform/rotate90/v1/module.js.map +1 -0
- package/dist/shaders/transform/spherize/v1/module.d.ts +21 -0
- package/dist/shaders/transform/spherize/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/spherize/v1/module.js +94 -0
- package/dist/shaders/transform/spherize/v1/module.js.map +1 -0
- package/dist/shaders/transform/tile/v1/module.d.ts +22 -0
- package/dist/shaders/transform/tile/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/tile/v1/module.js +89 -0
- package/dist/shaders/transform/tile/v1/module.js.map +1 -0
- package/dist/shared/lumaWgsl.d.ts +14 -0
- package/dist/shared/lumaWgsl.d.ts.map +1 -0
- package/dist/shared/lumaWgsl.js +18 -0
- package/dist/shared/lumaWgsl.js.map +1 -0
- package/dist/shared/premulWgsl.d.ts +46 -0
- package/dist/shared/premulWgsl.d.ts.map +1 -0
- package/dist/shared/premulWgsl.js +90 -0
- package/dist/shared/premulWgsl.js.map +1 -0
- package/dist/texture.d.ts +54 -0
- package/dist/texture.d.ts.map +1 -0
- package/dist/texture.js +70 -0
- package/dist/texture.js.map +1 -0
- package/dist/types.d.ts +103 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/validate/wgslLinearity.d.ts +86 -0
- package/dist/validate/wgslLinearity.d.ts.map +1 -0
- package/dist/validate/wgslLinearity.js +298 -0
- package/dist/validate/wgslLinearity.js.map +1 -0
- package/dist/webgpu/index.d.ts +11 -0
- package/dist/webgpu/index.d.ts.map +1 -0
- package/dist/webgpu/index.js +11 -0
- package/dist/webgpu/index.js.map +1 -0
- package/package.json +85 -0
package/dist/recipe.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RecipeModule` + `RecipeRunner` — multi-pass orchestration.
|
|
3
|
+
*
|
|
4
|
+
* A recipe module is a registry-visible operation whose work is expressed as
|
|
5
|
+
* a small DAG of single-pass `ShaderModule` invocations rather than a single
|
|
6
|
+
* shader. `RecipeRunner.encode` walks the passes, acquires intermediate
|
|
7
|
+
* textures from `ctx.scratch`, dispatches each pass through the shared
|
|
8
|
+
* `Executor`, and releases intermediates in reverse order on return.
|
|
9
|
+
*
|
|
10
|
+
* Intermediate formats are declared in the module — not chosen by the host —
|
|
11
|
+
* so a recipe like `filters.glow` produces the same output everywhere.
|
|
12
|
+
*
|
|
13
|
+
* Like `Executor.encode`, the runner encodes GPU work only: no readback, no
|
|
14
|
+
* `copyTextureToBuffer`, no `mapAsync`. The host owns submission and the
|
|
15
|
+
* final output texture's lifetime.
|
|
16
|
+
*/
|
|
17
|
+
import type { AnyVecInstance } from "typegpu/data";
|
|
18
|
+
import type { GPUContext } from "./context.js";
|
|
19
|
+
import type { Executor } from "./executor.js";
|
|
20
|
+
import { type ShaderModule } from "./module.js";
|
|
21
|
+
import type { ShaderRegistry } from "./registry.js";
|
|
22
|
+
import type { LabeledTexture } from "./texture.js";
|
|
23
|
+
import type { IOContract, ShaderCategory, ShaderSurface, UiHint } from "./types.js";
|
|
24
|
+
/** A JSON path into the recipe's params, e.g. `"$.radius"`. */
|
|
25
|
+
export type ParamRef = `$.${string}`;
|
|
26
|
+
/**
|
|
27
|
+
* A literal param value: what a module's WGSL uniform field can hold — a
|
|
28
|
+
* scalar, or a TypeGPU vector instance such as `d.vec2f(1, 0)`.
|
|
29
|
+
*/
|
|
30
|
+
export type RecipeParamLiteral = number | boolean | AnyVecInstance;
|
|
31
|
+
/** A recipe's own params: a flat bag of uniform literals, addressed by `$.name`. */
|
|
32
|
+
export type RecipeParams = Record<string, RecipeParamLiteral>;
|
|
33
|
+
/** A pass's param value: a literal, or a {@link ParamRef} into the recipe's params. */
|
|
34
|
+
export type RecipeParamValue = ParamRef | RecipeParamLiteral;
|
|
35
|
+
/** Intermediate texture specification. Sizes default to the input source. */
|
|
36
|
+
export interface IntermediateSpec {
|
|
37
|
+
format: GPUTextureFormat;
|
|
38
|
+
usage: GPUTextureUsageFlags;
|
|
39
|
+
/** Defaults to the source dimensions if omitted. */
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
label?: string;
|
|
43
|
+
}
|
|
44
|
+
/** A single Executor dispatch inside a recipe. */
|
|
45
|
+
export interface RecipePass {
|
|
46
|
+
/** `(id, version)` of the `ShaderModule` to invoke. */
|
|
47
|
+
op: {
|
|
48
|
+
id: string;
|
|
49
|
+
version: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Map a module input name to either `"source"` (the recipe's main input,
|
|
53
|
+
* the same `source` the recipe was called with) or a named intermediate.
|
|
54
|
+
* Use `{ name, from }` to bind a recipe input under a different key — that
|
|
55
|
+
* supports `mask` and other non-`source` slots without forcing renames.
|
|
56
|
+
*/
|
|
57
|
+
in: Record<string, "source" | {
|
|
58
|
+
kind: "intermediate";
|
|
59
|
+
name: string;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "input";
|
|
62
|
+
name: string;
|
|
63
|
+
}>;
|
|
64
|
+
/** `"output"` (the recipe's final target) or a named intermediate. */
|
|
65
|
+
out: "output" | {
|
|
66
|
+
kind: "intermediate";
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
/** Param values: literals or `ParamRef`s into the recipe's params object. */
|
|
70
|
+
params: Record<string, RecipeParamValue>;
|
|
71
|
+
/**
|
|
72
|
+
* Compute dispatch sizing. Fragment passes omit it (always full-screen).
|
|
73
|
+
* If the workgroup size is `[wx, wy, 1]`, set `kind: "compute"` and the
|
|
74
|
+
* runner derives `(ceil(width/wx), ceil(height/wy))` from the **output**
|
|
75
|
+
* texture's dimensions; pass an explicit `x`/`y` to override.
|
|
76
|
+
*/
|
|
77
|
+
dispatch?: {
|
|
78
|
+
kind: "fragment";
|
|
79
|
+
} | {
|
|
80
|
+
kind: "compute";
|
|
81
|
+
x?: number;
|
|
82
|
+
y?: number;
|
|
83
|
+
z?: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Declarative recipe payload bundled with a {@link RecipeModule}. */
|
|
87
|
+
export interface Recipe<Params> {
|
|
88
|
+
intermediates: Record<string, IntermediateSpec>;
|
|
89
|
+
passes: readonly RecipePass[];
|
|
90
|
+
/**
|
|
91
|
+
* Optional resolver. Default uses the `(id, version)` registry. Recipes
|
|
92
|
+
* may pass a partial registry (a `Map`) for unit testing.
|
|
93
|
+
*/
|
|
94
|
+
resolve?: (op: {
|
|
95
|
+
id: string;
|
|
96
|
+
version: number;
|
|
97
|
+
}) => ShaderModule;
|
|
98
|
+
/**
|
|
99
|
+
* Optional type-only marker so `Recipe<P>` instances retain the params type
|
|
100
|
+
* after registration. Never read at runtime.
|
|
101
|
+
*/
|
|
102
|
+
readonly _params?: Params;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A module whose execution is a recipe of single-pass `ShaderModule` calls.
|
|
106
|
+
* Lives in the same registry as `ShaderModule` (Phase 3 onward), but has no
|
|
107
|
+
* own WGSL — its `kind` is `"recipe"`.
|
|
108
|
+
*/
|
|
109
|
+
export interface RecipeModule<Params = RecipeParams> {
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly version: number;
|
|
112
|
+
readonly surface: ShaderSurface;
|
|
113
|
+
readonly category: ShaderCategory;
|
|
114
|
+
readonly kind: "recipe";
|
|
115
|
+
readonly paramDefaults: Params;
|
|
116
|
+
readonly paramUi?: Readonly<Record<string, UiHint>>;
|
|
117
|
+
readonly io: IOContract;
|
|
118
|
+
readonly recipe: Recipe<Params>;
|
|
119
|
+
}
|
|
120
|
+
/** Build a frozen {@link RecipeModule}. */
|
|
121
|
+
export declare function defineRecipe<Params extends RecipeParams>(spec: {
|
|
122
|
+
id: string;
|
|
123
|
+
version: number;
|
|
124
|
+
surface: ShaderSurface;
|
|
125
|
+
category: ShaderCategory;
|
|
126
|
+
paramDefaults: Params;
|
|
127
|
+
paramUi?: Record<string, UiHint>;
|
|
128
|
+
io: IOContract;
|
|
129
|
+
recipe: Recipe<Params>;
|
|
130
|
+
}): RecipeModule<Params>;
|
|
131
|
+
/** Run a recipe end-to-end against a context, encoder, and output target. */
|
|
132
|
+
export interface RecipeRunner {
|
|
133
|
+
encode<P>(args: {
|
|
134
|
+
ctx: GPUContext;
|
|
135
|
+
module: RecipeModule<P>;
|
|
136
|
+
encoder: GPUCommandEncoder;
|
|
137
|
+
inputs: Record<string, LabeledTexture>;
|
|
138
|
+
output: LabeledTexture;
|
|
139
|
+
params: P;
|
|
140
|
+
/** Optional registry for op resolution; falls back to `recipe.resolve`. */
|
|
141
|
+
registry?: ShaderRegistry;
|
|
142
|
+
/** Optional executor; default `createExecutor()` is fine for most cases. */
|
|
143
|
+
executor?: Executor;
|
|
144
|
+
}): void;
|
|
145
|
+
}
|
|
146
|
+
/** Default {@link RecipeRunner}: scratch-pool intermediates, sequential passes. */
|
|
147
|
+
export declare function createRecipeRunner(): RecipeRunner;
|
|
148
|
+
//# sourceMappingURL=recipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe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ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RecipeModule` + `RecipeRunner` — multi-pass orchestration.
|
|
3
|
+
*
|
|
4
|
+
* A recipe module is a registry-visible operation whose work is expressed as
|
|
5
|
+
* a small DAG of single-pass `ShaderModule` invocations rather than a single
|
|
6
|
+
* shader. `RecipeRunner.encode` walks the passes, acquires intermediate
|
|
7
|
+
* textures from `ctx.scratch`, dispatches each pass through the shared
|
|
8
|
+
* `Executor`, and releases intermediates in reverse order on return.
|
|
9
|
+
*
|
|
10
|
+
* Intermediate formats are declared in the module — not chosen by the host —
|
|
11
|
+
* so a recipe like `filters.glow` produces the same output everywhere.
|
|
12
|
+
*
|
|
13
|
+
* Like `Executor.encode`, the runner encodes GPU work only: no readback, no
|
|
14
|
+
* `copyTextureToBuffer`, no `mapAsync`. The host owns submission and the
|
|
15
|
+
* final output texture's lifetime.
|
|
16
|
+
*/
|
|
17
|
+
import { createExecutor } from "./executor.js";
|
|
18
|
+
import { moduleKey } from "./module.js";
|
|
19
|
+
/** Build a frozen {@link RecipeModule}. */
|
|
20
|
+
export function defineRecipe(spec) {
|
|
21
|
+
if (!spec.id) {
|
|
22
|
+
throw new Error("defineRecipe: id is required");
|
|
23
|
+
}
|
|
24
|
+
if (!Number.isInteger(spec.version) || spec.version < 1) {
|
|
25
|
+
throw new Error(`defineRecipe(${spec.id}): version must be a positive integer`);
|
|
26
|
+
}
|
|
27
|
+
if (spec.recipe.passes.length === 0) {
|
|
28
|
+
throw new Error(`defineRecipe(${spec.id}): recipe must have ≥1 pass`);
|
|
29
|
+
}
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
id: spec.id,
|
|
32
|
+
version: spec.version,
|
|
33
|
+
surface: spec.surface,
|
|
34
|
+
category: spec.category,
|
|
35
|
+
kind: "recipe",
|
|
36
|
+
paramDefaults: spec.paramDefaults,
|
|
37
|
+
paramUi: spec.paramUi,
|
|
38
|
+
io: spec.io,
|
|
39
|
+
recipe: spec.recipe
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function isParamRef(value) {
|
|
43
|
+
return typeof value === "string" && value.startsWith("$.");
|
|
44
|
+
}
|
|
45
|
+
function readPath(params, path) {
|
|
46
|
+
// Strip leading `$.`; recipes are intentionally shallow (no nesting yet).
|
|
47
|
+
return params[path.slice(2)];
|
|
48
|
+
}
|
|
49
|
+
function resolveParams(raw, recipeParams) {
|
|
50
|
+
const out = {};
|
|
51
|
+
for (const [name, value] of Object.entries(raw)) {
|
|
52
|
+
out[name] = isParamRef(value) ? readPath(recipeParams, value) : value;
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
function resolveOp(pass, recipe, registry, recipeKey) {
|
|
57
|
+
if (recipe.resolve) {
|
|
58
|
+
return recipe.resolve(pass.op);
|
|
59
|
+
}
|
|
60
|
+
if (!registry) {
|
|
61
|
+
throw new Error(`RecipeRunner(${recipeKey}): no registry or recipe.resolve to resolve ${pass.op.id}@${pass.op.version}`);
|
|
62
|
+
}
|
|
63
|
+
return registry.getShader(pass.op);
|
|
64
|
+
}
|
|
65
|
+
/** Default {@link RecipeRunner}: scratch-pool intermediates, sequential passes. */
|
|
66
|
+
export function createRecipeRunner() {
|
|
67
|
+
return {
|
|
68
|
+
encode({ ctx, module, encoder, inputs, output, params, registry, executor }) {
|
|
69
|
+
const ex = executor ?? createExecutor();
|
|
70
|
+
const recipe = module.recipe;
|
|
71
|
+
const key = moduleKey(module.id, module.version);
|
|
72
|
+
const source = inputs.source;
|
|
73
|
+
if (!source) {
|
|
74
|
+
throw new Error(`RecipeRunner(${key}): missing "source" input`);
|
|
75
|
+
}
|
|
76
|
+
// Resolve intermediates, defaulting unspecified dimensions to source.
|
|
77
|
+
const intermediates = new Map();
|
|
78
|
+
const acquired = [];
|
|
79
|
+
for (const [name, spec] of Object.entries(recipe.intermediates)) {
|
|
80
|
+
const fullSpec = {
|
|
81
|
+
width: spec.width ?? source.width,
|
|
82
|
+
height: spec.height ?? source.height,
|
|
83
|
+
// Exact size, not bucketed: passes derive dispatch size and texel
|
|
84
|
+
// bounds from the texture's physical dimensions, and fragment
|
|
85
|
+
// passes always cover the whole attachment. A bucketed intermediate
|
|
86
|
+
// therefore either leaves an unwritten margin that the next pass's
|
|
87
|
+
// clamped taps blend in (compute) or stretches the image to the
|
|
88
|
+
// bucket and back, rescaling pixel-unit params like blur radius
|
|
89
|
+
// (fragment). Physical size must equal logical size.
|
|
90
|
+
exact: true,
|
|
91
|
+
format: spec.format,
|
|
92
|
+
usage: spec.usage,
|
|
93
|
+
label: spec.label ?? `${key}-${name}`
|
|
94
|
+
};
|
|
95
|
+
const tex = ctx.scratch.acquire(fullSpec);
|
|
96
|
+
intermediates.set(name, tex);
|
|
97
|
+
acquired.push(tex);
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
for (const pass of recipe.passes) {
|
|
101
|
+
const op = resolveOp(pass, recipe, registry, key);
|
|
102
|
+
// Map declared `in` bindings to actual labeled textures.
|
|
103
|
+
const passInputs = {};
|
|
104
|
+
for (const [bindName, ref] of Object.entries(pass.in)) {
|
|
105
|
+
if (ref === "source") {
|
|
106
|
+
passInputs[bindName] = source;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (ref.kind === "intermediate") {
|
|
110
|
+
const tex = intermediates.get(ref.name);
|
|
111
|
+
if (!tex) {
|
|
112
|
+
throw new Error(`RecipeRunner(${key}): unknown intermediate "${ref.name}"`);
|
|
113
|
+
}
|
|
114
|
+
passInputs[bindName] = tex;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
// ref.kind === "input"
|
|
118
|
+
const tex = inputs[ref.name];
|
|
119
|
+
if (!tex) {
|
|
120
|
+
throw new Error(`RecipeRunner(${key}): pass binds "${bindName}" to recipe input "${ref.name}" but that input is unbound`);
|
|
121
|
+
}
|
|
122
|
+
passInputs[bindName] = tex;
|
|
123
|
+
}
|
|
124
|
+
const target = pass.out === "output"
|
|
125
|
+
? output
|
|
126
|
+
: intermediates.get(pass.out.name) ??
|
|
127
|
+
(() => {
|
|
128
|
+
throw new Error(`RecipeRunner(${key}): unknown intermediate "${pass.out.name}"`);
|
|
129
|
+
})();
|
|
130
|
+
// SAFETY: `defineRecipe` constrains a recipe's params to
|
|
131
|
+
// `RecipeParams` — a flat bag of uniform literals. `P` is
|
|
132
|
+
// unconstrained here only so hosts can thread their own generic
|
|
133
|
+
// through `encode`; every module that reaches this line was built
|
|
134
|
+
// by `defineRecipe`.
|
|
135
|
+
const resolvedParams = resolveParams(pass.params, params);
|
|
136
|
+
const dispatch = resolveDispatch(pass, op, target);
|
|
137
|
+
ex.encode({
|
|
138
|
+
ctx,
|
|
139
|
+
module: op,
|
|
140
|
+
encoder,
|
|
141
|
+
inputs: passInputs,
|
|
142
|
+
output: target,
|
|
143
|
+
params: resolvedParams,
|
|
144
|
+
dispatch
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
for (const tex of acquired.reverse()) {
|
|
150
|
+
ctx.scratch.release(tex);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function resolveDispatch(pass, op, target) {
|
|
157
|
+
if (op.kind === "fragment") {
|
|
158
|
+
return { kind: "fragment" };
|
|
159
|
+
}
|
|
160
|
+
if (op.kind !== "compute") {
|
|
161
|
+
throw new Error(`RecipeRunner: op "${op.id}@${op.version}" has unsupported kind "${op.kind}"`);
|
|
162
|
+
}
|
|
163
|
+
const dispatch = pass.dispatch;
|
|
164
|
+
if (dispatch && dispatch.kind === "compute") {
|
|
165
|
+
const [wx, wy] = op.workgroupSize;
|
|
166
|
+
return {
|
|
167
|
+
kind: "compute",
|
|
168
|
+
x: dispatch.x ?? Math.ceil(target.width / wx),
|
|
169
|
+
y: dispatch.y ?? Math.ceil(target.height / wy),
|
|
170
|
+
z: dispatch.z ?? 1
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const [wx, wy] = op.workgroupSize;
|
|
174
|
+
return {
|
|
175
|
+
kind: "compute",
|
|
176
|
+
x: Math.ceil(target.width / wx),
|
|
177
|
+
y: Math.ceil(target.height / wy),
|
|
178
|
+
z: 1
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAqB,MAAM,aAAa,CAAC;AAgG3D,2CAA2C;AAC3C,MAAM,UAAU,YAAY,CAA8B,IASzD;IACC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,gBAAgB,IAAI,CAAC,EAAE,uCAAuC,CAC/D,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,EAAE,6BAA6B,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,QAAiB;QACvB,aAAa,EAAE,IAAI,CAAC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AAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,qBAAqB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,2BAA2B,EAAE,CAAC,IAAI,GAAG,CAC9E,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC;QAClC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;YAC7C,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;YAC9C,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC;SACnB,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC;IAClC,OAAO;QACL,IAAI,EAAE,SAAS;QACf,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;QAC/B,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;QAChC,CAAC,EAAE,CAAC;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shader registry — the lookup surface for `(id, version)` modules.
|
|
3
|
+
*
|
|
4
|
+
* Population is via an explicit barrel (`ALL_CATALOG`), not `import.meta.glob`:
|
|
5
|
+
* Node-bundling-safe, grep-able, tree-shakeable. A module's identity is
|
|
6
|
+
* `(id, version)`; registering the same pair twice is a programming error
|
|
7
|
+
* and throws.
|
|
8
|
+
*
|
|
9
|
+
* From Phase 3 the registry stores both single-pass {@link ShaderModule}s and
|
|
10
|
+
* multi-pass {@link RecipeModule}s under the same key space — they share the
|
|
11
|
+
* `(id, version, surface, category)` identity. Consumers that only want
|
|
12
|
+
* one kind can use the narrower `getShader` / `getRecipe` helpers.
|
|
13
|
+
*/
|
|
14
|
+
import type { ShaderModule } from "./module.js";
|
|
15
|
+
import type { RecipeModule } from "./recipe.js";
|
|
16
|
+
import type { ShaderCategory, ShaderSurface } from "./types.js";
|
|
17
|
+
/** Either kind of registry entry. Discriminated by `.kind`. */
|
|
18
|
+
export type AnyShader = ShaderModule | RecipeModule;
|
|
19
|
+
export interface ShaderQuery {
|
|
20
|
+
id: string;
|
|
21
|
+
/** Pin a version. Omit to resolve the highest registered version. */
|
|
22
|
+
version?: number;
|
|
23
|
+
/** Require a surface (e.g. `"published"` for workflow nodes). */
|
|
24
|
+
surface?: ShaderSurface;
|
|
25
|
+
}
|
|
26
|
+
export interface ShaderListFilter {
|
|
27
|
+
surface?: ShaderSurface;
|
|
28
|
+
category?: ShaderCategory;
|
|
29
|
+
}
|
|
30
|
+
export declare class ShaderRegistry {
|
|
31
|
+
private readonly byKey;
|
|
32
|
+
register(module: AnyShader): void;
|
|
33
|
+
registerAll(modules: readonly AnyShader[]): void;
|
|
34
|
+
/** Resolve a module or `undefined`. Pins version when given; else latest. */
|
|
35
|
+
tryGet(query: ShaderQuery): AnyShader | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve a module or throw, naming the missing `(id, version)`. This is
|
|
38
|
+
* the workflow-load failure mode: no silent fallback to another version.
|
|
39
|
+
*/
|
|
40
|
+
get(query: ShaderQuery): AnyShader;
|
|
41
|
+
/** Narrowed `get` for the Executor path; throws if the entry is a recipe. */
|
|
42
|
+
getShader(query: ShaderQuery): ShaderModule;
|
|
43
|
+
/** Narrowed `get` for the RecipeRunner path; throws if the entry is single-pass. */
|
|
44
|
+
getRecipe(query: ShaderQuery): RecipeModule;
|
|
45
|
+
has(query: ShaderQuery): boolean;
|
|
46
|
+
list(filter?: ShaderListFilter): AnyShader[];
|
|
47
|
+
private latest;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,YAAY,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IAEtD,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAMhC;IAED,WAAW,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAI/C;IAED,6EAA6E;IAC7E,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAYhD;IAED;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAQjC;IAED,6EAA6E;IAC7E,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAQ1C;IAED,oFAAoF;IACpF,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAQ1C;IAED,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE/B;IAED,IAAI,CAAC,MAAM,GAAE,gBAAqB,GAAG,SAAS,EAAE,CAY/C;IAED,OAAO,CAAC,MAAM;CAYf"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shader registry — the lookup surface for `(id, version)` modules.
|
|
3
|
+
*
|
|
4
|
+
* Population is via an explicit barrel (`ALL_CATALOG`), not `import.meta.glob`:
|
|
5
|
+
* Node-bundling-safe, grep-able, tree-shakeable. A module's identity is
|
|
6
|
+
* `(id, version)`; registering the same pair twice is a programming error
|
|
7
|
+
* and throws.
|
|
8
|
+
*
|
|
9
|
+
* From Phase 3 the registry stores both single-pass {@link ShaderModule}s and
|
|
10
|
+
* multi-pass {@link RecipeModule}s under the same key space — they share the
|
|
11
|
+
* `(id, version, surface, category)` identity. Consumers that only want
|
|
12
|
+
* one kind can use the narrower `getShader` / `getRecipe` helpers.
|
|
13
|
+
*/
|
|
14
|
+
import { moduleKey } from "./module.js";
|
|
15
|
+
export class ShaderRegistry {
|
|
16
|
+
byKey = new Map();
|
|
17
|
+
register(module) {
|
|
18
|
+
const key = moduleKey(module.id, module.version);
|
|
19
|
+
if (this.byKey.has(key)) {
|
|
20
|
+
throw new Error(`Shader module already registered: ${key}`);
|
|
21
|
+
}
|
|
22
|
+
this.byKey.set(key, module);
|
|
23
|
+
}
|
|
24
|
+
registerAll(modules) {
|
|
25
|
+
for (const module of modules) {
|
|
26
|
+
this.register(module);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Resolve a module or `undefined`. Pins version when given; else latest. */
|
|
30
|
+
tryGet(query) {
|
|
31
|
+
const candidate = query.version !== undefined
|
|
32
|
+
? this.byKey.get(moduleKey(query.id, query.version))
|
|
33
|
+
: this.latest(query.id);
|
|
34
|
+
if (!candidate) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (query.surface && candidate.surface !== query.surface) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return candidate;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a module or throw, naming the missing `(id, version)`. This is
|
|
44
|
+
* the workflow-load failure mode: no silent fallback to another version.
|
|
45
|
+
*/
|
|
46
|
+
get(query) {
|
|
47
|
+
const found = this.tryGet(query);
|
|
48
|
+
if (!found) {
|
|
49
|
+
const ver = query.version !== undefined ? `@${query.version}` : "";
|
|
50
|
+
const surf = query.surface ? ` (surface=${query.surface})` : "";
|
|
51
|
+
throw new Error(`Shader module not found: ${query.id}${ver}${surf}`);
|
|
52
|
+
}
|
|
53
|
+
return found;
|
|
54
|
+
}
|
|
55
|
+
/** Narrowed `get` for the Executor path; throws if the entry is a recipe. */
|
|
56
|
+
getShader(query) {
|
|
57
|
+
const entry = this.get(query);
|
|
58
|
+
if (entry.kind === "recipe") {
|
|
59
|
+
throw new Error(`Shader registry: ${entry.id}@${entry.version} is a recipe; use getRecipe or RecipeRunner`);
|
|
60
|
+
}
|
|
61
|
+
return entry;
|
|
62
|
+
}
|
|
63
|
+
/** Narrowed `get` for the RecipeRunner path; throws if the entry is single-pass. */
|
|
64
|
+
getRecipe(query) {
|
|
65
|
+
const entry = this.get(query);
|
|
66
|
+
if (entry.kind !== "recipe") {
|
|
67
|
+
throw new Error(`Shader registry: ${entry.id}@${entry.version} is a single-pass module; use getShader or Executor`);
|
|
68
|
+
}
|
|
69
|
+
return entry;
|
|
70
|
+
}
|
|
71
|
+
has(query) {
|
|
72
|
+
return this.tryGet(query) !== undefined;
|
|
73
|
+
}
|
|
74
|
+
list(filter = {}) {
|
|
75
|
+
const out = [];
|
|
76
|
+
for (const module of this.byKey.values()) {
|
|
77
|
+
if (filter.surface && module.surface !== filter.surface) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (filter.category && module.category !== filter.category) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
out.push(module);
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
latest(id) {
|
|
88
|
+
let best;
|
|
89
|
+
for (const module of this.byKey.values()) {
|
|
90
|
+
if (module.id !== id) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (!best || module.version > best.version) {
|
|
94
|
+
best = module;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return best;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoBxC,MAAM,OAAO,cAAc;IACR,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEtD,QAAQ,CAAC,MAAiB;QACxB,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,WAAW,CAAC,OAA6B;QACvC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,6EAA6E;IAC7E,MAAM,CAAC,KAAkB;QACvB,MAAM,SAAS,GACb,KAAK,CAAC,OAAO,KAAK,SAAS;YACzB,CAAC,CAAC,IA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AChB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canary module — `_canary.passthrough@1`.
|
|
3
|
+
*
|
|
4
|
+
* Copies an input texture to an output texture, modulated by a `tint` uniform
|
|
5
|
+
* that defaults to white (an identity copy). It exists to prove the whole
|
|
6
|
+
* Phase 1 chain end-to-end in one file: TypeGPU schema → bind group layout →
|
|
7
|
+
* WGSL resolution → executor → labeled output. Not a published operation.
|
|
8
|
+
*/
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
export declare const passthroughV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
11
|
+
tint: d.Vec4f;
|
|
12
|
+
}>>;
|
|
13
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/_canary/passthrough/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAclC,eAAO,MAAM,aAAa;;GAiDxB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canary module — `_canary.passthrough@1`.
|
|
3
|
+
*
|
|
4
|
+
* Copies an input texture to an output texture, modulated by a `tint` uniform
|
|
5
|
+
* that defaults to white (an identity copy). It exists to prove the whole
|
|
6
|
+
* Phase 1 chain end-to-end in one file: TypeGPU schema → bind group layout →
|
|
7
|
+
* WGSL resolution → executor → labeled output. Not a published operation.
|
|
8
|
+
*/
|
|
9
|
+
import tgpu from "typegpu";
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
import { defineModule } from "../../../../module.js";
|
|
12
|
+
import { WGSL_PREMUL_HELPERS } from "../../../../shared/premulWgsl.js";
|
|
13
|
+
const PassthroughParams = d.struct({
|
|
14
|
+
tint: d.vec4f
|
|
15
|
+
});
|
|
16
|
+
const layout = tgpu.bindGroupLayout({
|
|
17
|
+
params: { uniform: PassthroughParams },
|
|
18
|
+
source: { texture: "float" },
|
|
19
|
+
samp: { sampler: "filtering" }
|
|
20
|
+
});
|
|
21
|
+
export const passthroughV1 = defineModule({
|
|
22
|
+
id: "_canary.passthrough",
|
|
23
|
+
version: 1,
|
|
24
|
+
surface: "internal",
|
|
25
|
+
category: "_canary",
|
|
26
|
+
linearity: "linear-in-rgb",
|
|
27
|
+
kind: "fragment",
|
|
28
|
+
params: PassthroughParams,
|
|
29
|
+
paramDefaults: { tint: d.vec4f(1, 1, 1, 1) },
|
|
30
|
+
paramUi: {
|
|
31
|
+
tint: { label: "Tint", notes: "RGBA multiplier; white = identity copy" }
|
|
32
|
+
},
|
|
33
|
+
layout,
|
|
34
|
+
samplers: {
|
|
35
|
+
samp: {
|
|
36
|
+
magFilter: "nearest",
|
|
37
|
+
minFilter: "nearest",
|
|
38
|
+
addressModeU: "clamp-to-edge",
|
|
39
|
+
addressModeV: "clamp-to-edge"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
wgsl: /* wgsl */ `
|
|
43
|
+
${WGSL_PREMUL_HELPERS}
|
|
44
|
+
|
|
45
|
+
@fragment
|
|
46
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
47
|
+
let src = samplePremul(layout.$.source, layout.$.samp, uv);
|
|
48
|
+
// Tint is a per-channel multiplier applied in premul space — a linear op,
|
|
49
|
+
// so the typed Premul value passes through without an unpremul round-trip.
|
|
50
|
+
let tinted = Premul(src.v * layout.$.params.tint);
|
|
51
|
+
return tinted.v;
|
|
52
|
+
}
|
|
53
|
+
`,
|
|
54
|
+
io: {
|
|
55
|
+
inputs: {
|
|
56
|
+
source: {
|
|
57
|
+
colorSpace: "linear",
|
|
58
|
+
alpha: "premultiplied",
|
|
59
|
+
bindingKinds: ["texture_2d"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
output: {
|
|
63
|
+
colorSpace: "linear",
|
|
64
|
+
alpha: "premultiplied",
|
|
65
|
+
format: "rgba8unorm",
|
|
66
|
+
dimensions: "same-as:source"
|
|
67
|
+
},
|
|
68
|
+
rod: "same-as:source"
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/_canary/passthrough/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,KAAK;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE;IACtC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;IACxC,EAAE,EAAE,qBAAqB;IACzB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,iBAAiB;IACzB,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;IAC5C,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,wCAAwC,EAAE;KACzE;IACD,MAAM;IACN,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,SAAS;YACpB,YAAY,EAAE,eAAe;YAC7B,YAAY,EAAE,eAAe;SAC9B;KACF;IACD,IAAI,EAAE,UAAU,CAAC;EACjB,mBAAmB;;;;;;;;;;CAUpB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,gBAAgB;SAC7B;QACD,GAAG,EAAE,gBAAgB;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `alpha.premulToStraight@1` — convert premultiplied-alpha RGB to straight.
|
|
3
|
+
*
|
|
4
|
+
* Per-pixel `vec4(rgb, a) → vec4(rgb / a, a)` (transparent pixels collapse to
|
|
5
|
+
* `vec4(0)`). The inverse of
|
|
6
|
+
* {@link ./../straightToPremul/v1/module alphaStraightToPremulV1}; the two
|
|
7
|
+
* exist so hosts can bridge straight↔premultiplied boundaries explicitly
|
|
8
|
+
* instead of letting metadata drift.
|
|
9
|
+
*
|
|
10
|
+
* Output color space matches input — this module touches association only.
|
|
11
|
+
*/
|
|
12
|
+
import * as d from "typegpu/data";
|
|
13
|
+
export declare const alphaPremulToStraightV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
14
|
+
_unused: d.F32;
|
|
15
|
+
}>>;
|
|
16
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/alpha/premulToStraight/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAUlC,eAAO,MAAM,uBAAuB;;GAyClC,CAAC"}
|