@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `keyer.lumaKey@1` — clear pixels whose luma falls outside `[low, high]`.
|
|
3
|
+
*
|
|
4
|
+
* Coverage ramps smoothly across `softness` on each side of the band so the
|
|
5
|
+
* matte feathers rather than aliasing. Output alpha is multiplied by the
|
|
6
|
+
* resulting coverage (the source alpha is preserved when fully inside the
|
|
7
|
+
* band, dropped to zero outside). Fragment.
|
|
8
|
+
*/
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
export declare const LumaKeyParams: d.WgslStruct<{
|
|
11
|
+
low: d.F32;
|
|
12
|
+
high: d.F32;
|
|
13
|
+
softness: d.F32;
|
|
14
|
+
invert: d.F32;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const keyerLumaKeyV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
17
|
+
low: d.F32;
|
|
18
|
+
high: d.F32;
|
|
19
|
+
softness: d.F32;
|
|
20
|
+
invert: d.F32;
|
|
21
|
+
}>>;
|
|
22
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/keyer/lumaKey/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAIlC,eAAO,MAAM,aAAa;;;;;EAKxB,CAAC;AAeH,eAAO,MAAM,cAAc;;;;;GA0DzB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `keyer.lumaKey@1` — clear pixels whose luma falls outside `[low, high]`.
|
|
3
|
+
*
|
|
4
|
+
* Coverage ramps smoothly across `softness` on each side of the band so the
|
|
5
|
+
* matte feathers rather than aliasing. Output alpha is multiplied by the
|
|
6
|
+
* resulting coverage (the source alpha is preserved when fully inside the
|
|
7
|
+
* band, dropped to zero outside). Fragment.
|
|
8
|
+
*/
|
|
9
|
+
import tgpu from "typegpu";
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
import { defineModule } from "../../../../module.js";
|
|
12
|
+
import { WGSL_LUMA709 } from "../../../../shared/lumaWgsl.js";
|
|
13
|
+
export const LumaKeyParams = d.struct({
|
|
14
|
+
low: d.f32,
|
|
15
|
+
high: d.f32,
|
|
16
|
+
softness: d.f32,
|
|
17
|
+
invert: d.f32
|
|
18
|
+
});
|
|
19
|
+
const layout = tgpu.bindGroupLayout({
|
|
20
|
+
params: { uniform: LumaKeyParams },
|
|
21
|
+
source: { texture: "float" },
|
|
22
|
+
samp: { sampler: "filtering" }
|
|
23
|
+
});
|
|
24
|
+
const samplerDescriptor = {
|
|
25
|
+
magFilter: "linear",
|
|
26
|
+
minFilter: "linear",
|
|
27
|
+
addressModeU: "clamp-to-edge",
|
|
28
|
+
addressModeV: "clamp-to-edge"
|
|
29
|
+
};
|
|
30
|
+
export const keyerLumaKeyV1 = defineModule({
|
|
31
|
+
id: "keyer.lumaKey",
|
|
32
|
+
version: 1,
|
|
33
|
+
// Luminance keyer with a stable `(low, high, softness)` schema; the core op
|
|
34
|
+
// for matte-from-brightness workflows.
|
|
35
|
+
surface: "published",
|
|
36
|
+
category: "keyer",
|
|
37
|
+
linearity: "nonlinear-in-rgb",
|
|
38
|
+
kind: "fragment",
|
|
39
|
+
params: LumaKeyParams,
|
|
40
|
+
paramDefaults: { low: 0, high: 1, softness: 0.05, invert: 0 },
|
|
41
|
+
paramUi: {
|
|
42
|
+
low: { min: 0, max: 1, step: 0.01, label: "Low" },
|
|
43
|
+
high: { min: 0, max: 1, step: 0.01, label: "High" },
|
|
44
|
+
softness: { min: 0, max: 0.5, step: 0.01, label: "Softness" },
|
|
45
|
+
invert: { min: 0, max: 1, step: 1, label: "Invert", notes: "0 keep band / 1 cut band" }
|
|
46
|
+
},
|
|
47
|
+
layout,
|
|
48
|
+
samplers: { samp: samplerDescriptor },
|
|
49
|
+
wgsl: /* wgsl */ `
|
|
50
|
+
${WGSL_LUMA709}
|
|
51
|
+
|
|
52
|
+
@fragment
|
|
53
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
54
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
55
|
+
let p = layout.$.params;
|
|
56
|
+
// Input is premultiplied; compute luma on the underlying straight color so
|
|
57
|
+
// the band thresholds don't drift with a.
|
|
58
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
59
|
+
let straight = src.rgb / safeA;
|
|
60
|
+
let luma = luma709(straight);
|
|
61
|
+
let soft = max(p.softness, 0.0001);
|
|
62
|
+
let lowEdge = smoothstep(p.low - soft, p.low + soft, luma);
|
|
63
|
+
let highEdge = 1.0 - smoothstep(p.high - soft, p.high + soft, luma);
|
|
64
|
+
var coverage = lowEdge * highEdge;
|
|
65
|
+
if (p.invert > 0.5) {
|
|
66
|
+
coverage = 1.0 - coverage;
|
|
67
|
+
}
|
|
68
|
+
// Multiply RGB by coverage too so the result stays valid premultiplied.
|
|
69
|
+
return vec4f(src.rgb * coverage, src.a * coverage);
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
io: {
|
|
73
|
+
inputs: {
|
|
74
|
+
source: {
|
|
75
|
+
colorSpace: "linear",
|
|
76
|
+
alpha: "premultiplied",
|
|
77
|
+
bindingKinds: ["texture_2d"]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
output: {
|
|
81
|
+
colorSpace: "linear",
|
|
82
|
+
alpha: "premultiplied",
|
|
83
|
+
format: "rgba8unorm",
|
|
84
|
+
dimensions: "same-as:source"
|
|
85
|
+
},
|
|
86
|
+
rod: "same-as:source"
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/keyer/lumaKey/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,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,IAAI,EAAE,CAAC,CAAC,GAAG;IACX,QAAQ,EAAE,CAAC,CAAC,GAAG;IACf,MAAM,EAAE,CAAC,CAAC,GAAG;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAyB;IAC9C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;IACzC,EAAE,EAAE,eAAe;IACnB,OAAO,EAAE,CAA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EAAE,gBAAgB;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mask.apply@1` — multiply mask coverage into source's alpha; RGB unchanged.
|
|
3
|
+
*
|
|
4
|
+
* Coverage comes from `mask.a` (the canonical channel). The `invert` flag
|
|
5
|
+
* inverts the mask first. Fragment; the mask input here is **required** (the
|
|
6
|
+
* op is about applying a mask, after all), unlike the optional `mask` slot
|
|
7
|
+
* on filter/color modules.
|
|
8
|
+
*/
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
export declare const MaskApplyParams: d.WgslStruct<{
|
|
11
|
+
invert: d.F32;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const maskApplyV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
14
|
+
invert: d.F32;
|
|
15
|
+
}>>;
|
|
16
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/mask/apply/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,eAAe;;EAE1B,CAAC;AAgBH,eAAO,MAAM,WAAW;;GAmDtB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mask.apply@1` — multiply mask coverage into source's alpha; RGB unchanged.
|
|
3
|
+
*
|
|
4
|
+
* Coverage comes from `mask.a` (the canonical channel). The `invert` flag
|
|
5
|
+
* inverts the mask first. Fragment; the mask input here is **required** (the
|
|
6
|
+
* op is about applying a mask, after all), unlike the optional `mask` slot
|
|
7
|
+
* on filter/color modules.
|
|
8
|
+
*/
|
|
9
|
+
import tgpu from "typegpu";
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
import { defineModule } from "../../../../module.js";
|
|
12
|
+
export const MaskApplyParams = d.struct({
|
|
13
|
+
invert: d.f32
|
|
14
|
+
});
|
|
15
|
+
const layout = tgpu.bindGroupLayout({
|
|
16
|
+
params: { uniform: MaskApplyParams },
|
|
17
|
+
source: { texture: "float" },
|
|
18
|
+
mask: { texture: "float" },
|
|
19
|
+
samp: { sampler: "filtering" }
|
|
20
|
+
});
|
|
21
|
+
const samplerDescriptor = {
|
|
22
|
+
magFilter: "linear",
|
|
23
|
+
minFilter: "linear",
|
|
24
|
+
addressModeU: "clamp-to-edge",
|
|
25
|
+
addressModeV: "clamp-to-edge"
|
|
26
|
+
};
|
|
27
|
+
export const maskApplyV1 = defineModule({
|
|
28
|
+
id: "mask.apply",
|
|
29
|
+
version: 1,
|
|
30
|
+
// Promoted in Phase 3 Batch 1: the canonical "apply a mask" op; pairs with
|
|
31
|
+
// every mask-producing module (`mask.fromImage`, `keyer.*`, recipes).
|
|
32
|
+
surface: "published",
|
|
33
|
+
category: "mask",
|
|
34
|
+
linearity: "linear-in-rgb",
|
|
35
|
+
kind: "fragment",
|
|
36
|
+
params: MaskApplyParams,
|
|
37
|
+
paramDefaults: { invert: 0 },
|
|
38
|
+
paramUi: {
|
|
39
|
+
invert: { min: 0, max: 1, step: 1, label: "Invert mask" }
|
|
40
|
+
},
|
|
41
|
+
layout,
|
|
42
|
+
samplers: { samp: samplerDescriptor },
|
|
43
|
+
wgsl: /* wgsl */ `
|
|
44
|
+
@fragment
|
|
45
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
46
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
47
|
+
var coverage = textureSample(layout.$.mask, layout.$.samp, uv).a;
|
|
48
|
+
if (layout.$.params.invert > 0.5) {
|
|
49
|
+
coverage = 1.0 - coverage;
|
|
50
|
+
}
|
|
51
|
+
// Source is premultiplied (rgb = a*C). Scaling alpha by coverage requires
|
|
52
|
+
// scaling RGB by the same factor so the output stays valid premultiplied
|
|
53
|
+
// (rgb <= a). Without this, a 50% mask on opaque white produced rgb=1, a=0.5.
|
|
54
|
+
return vec4f(src.rgb * coverage, src.a * coverage);
|
|
55
|
+
}
|
|
56
|
+
`,
|
|
57
|
+
io: {
|
|
58
|
+
inputs: {
|
|
59
|
+
source: {
|
|
60
|
+
colorSpace: "linear",
|
|
61
|
+
alpha: "premultiplied",
|
|
62
|
+
bindingKinds: ["texture_2d"]
|
|
63
|
+
},
|
|
64
|
+
mask: {
|
|
65
|
+
colorSpace: "linear",
|
|
66
|
+
alpha: "premultiplied",
|
|
67
|
+
bindingKinds: ["texture_2d"]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
output: {
|
|
71
|
+
colorSpace: "linear",
|
|
72
|
+
alpha: "premultiplied",
|
|
73
|
+
format: "rgba8unorm",
|
|
74
|
+
dimensions: "same-as:source"
|
|
75
|
+
},
|
|
76
|
+
rod: "same-as:source"
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/mask/apply/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;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,GAAG;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;IACpC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;CAC/B,CAAC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|
+
*
|
|
4
|
+
* `mode` selects the source channel(s): `0` alpha, `1` luminance,
|
|
5
|
+
* `2` red, `3` green, `4` blue, `5` max-channel. Output writes the derived
|
|
6
|
+
* coverage into the alpha channel and zeroes RGB — downstream `mask.apply`
|
|
7
|
+
* (or any module reading `mask.a`) consumes it directly.
|
|
8
|
+
*/
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
export declare const MaskFromImageParams: d.WgslStruct<{
|
|
11
|
+
mode: d.F32;
|
|
12
|
+
invert: d.F32;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const maskFromImageV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
15
|
+
mode: d.F32;
|
|
16
|
+
invert: d.F32;
|
|
17
|
+
}>>;
|
|
18
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/mask/fromImage/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAIlC,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAeH,eAAO,MAAM,eAAe;;;GAsE1B,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mask.fromImage@1` — derive a mask from an image's channels.
|
|
3
|
+
*
|
|
4
|
+
* `mode` selects the source channel(s): `0` alpha, `1` luminance,
|
|
5
|
+
* `2` red, `3` green, `4` blue, `5` max-channel. Output writes the derived
|
|
6
|
+
* coverage into the alpha channel and zeroes RGB — downstream `mask.apply`
|
|
7
|
+
* (or any module reading `mask.a`) consumes it directly.
|
|
8
|
+
*/
|
|
9
|
+
import tgpu from "typegpu";
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
import { defineModule } from "../../../../module.js";
|
|
12
|
+
import { WGSL_LUMA709 } from "../../../../shared/lumaWgsl.js";
|
|
13
|
+
export const MaskFromImageParams = d.struct({
|
|
14
|
+
mode: d.f32,
|
|
15
|
+
invert: d.f32
|
|
16
|
+
});
|
|
17
|
+
const layout = tgpu.bindGroupLayout({
|
|
18
|
+
params: { uniform: MaskFromImageParams },
|
|
19
|
+
source: { texture: "float" },
|
|
20
|
+
samp: { sampler: "filtering" }
|
|
21
|
+
});
|
|
22
|
+
const samplerDescriptor = {
|
|
23
|
+
magFilter: "linear",
|
|
24
|
+
minFilter: "linear",
|
|
25
|
+
addressModeU: "clamp-to-edge",
|
|
26
|
+
addressModeV: "clamp-to-edge"
|
|
27
|
+
};
|
|
28
|
+
export const maskFromImageV1 = defineModule({
|
|
29
|
+
id: "mask.fromImage",
|
|
30
|
+
version: 1,
|
|
31
|
+
surface: "internal",
|
|
32
|
+
category: "mask",
|
|
33
|
+
linearity: "nonlinear-in-rgb",
|
|
34
|
+
kind: "fragment",
|
|
35
|
+
params: MaskFromImageParams,
|
|
36
|
+
paramDefaults: { mode: 1, invert: 0 },
|
|
37
|
+
paramUi: {
|
|
38
|
+
mode: {
|
|
39
|
+
min: 0,
|
|
40
|
+
max: 5,
|
|
41
|
+
step: 1,
|
|
42
|
+
label: "Mode",
|
|
43
|
+
notes: "0 alpha / 1 luma / 2 R / 3 G / 4 B / 5 max"
|
|
44
|
+
},
|
|
45
|
+
invert: { min: 0, max: 1, step: 1, label: "Invert" }
|
|
46
|
+
},
|
|
47
|
+
layout,
|
|
48
|
+
samplers: { samp: samplerDescriptor },
|
|
49
|
+
wgsl: /* wgsl */ `
|
|
50
|
+
${WGSL_LUMA709}
|
|
51
|
+
|
|
52
|
+
@fragment
|
|
53
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
54
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
55
|
+
let p = layout.$.params;
|
|
56
|
+
let mode = i32(round(p.mode));
|
|
57
|
+
// Source is premultiplied (rgb = a*C); divide back out so the derived mask
|
|
58
|
+
// reflects the underlying color, not the alpha-dimmed display value. Modes
|
|
59
|
+
// that already pick the alpha channel (mode 0) read src.a directly.
|
|
60
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
61
|
+
let straight = src.rgb / safeA;
|
|
62
|
+
var value: f32 = 0.0;
|
|
63
|
+
if (mode == 0) {
|
|
64
|
+
value = src.a;
|
|
65
|
+
} else if (mode == 1) {
|
|
66
|
+
value = luma709(straight);
|
|
67
|
+
} else if (mode == 2) {
|
|
68
|
+
value = straight.r;
|
|
69
|
+
} else if (mode == 3) {
|
|
70
|
+
value = straight.g;
|
|
71
|
+
} else if (mode == 4) {
|
|
72
|
+
value = straight.b;
|
|
73
|
+
} else {
|
|
74
|
+
value = max(max(straight.r, straight.g), straight.b);
|
|
75
|
+
}
|
|
76
|
+
if (p.invert > 0.5) {
|
|
77
|
+
value = 1.0 - value;
|
|
78
|
+
}
|
|
79
|
+
return vec4f(0.0, 0.0, 0.0, clamp(value, 0.0, 1.0));
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
io: {
|
|
83
|
+
inputs: {
|
|
84
|
+
source: {
|
|
85
|
+
colorSpace: "linear",
|
|
86
|
+
alpha: "premultiplied",
|
|
87
|
+
bindingKinds: ["texture_2d"]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
output: {
|
|
91
|
+
colorSpace: "linear",
|
|
92
|
+
alpha: "premultiplied",
|
|
93
|
+
format: "rgba8unorm",
|
|
94
|
+
dimensions: "same-as:source"
|
|
95
|
+
},
|
|
96
|
+
rod: "same-as:source"
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/mask/fromImage/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,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BAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;EACjB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bb;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,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mask.invert@1` — `output.a = 1 - mask.a`, RGB zeroed.
|
|
3
|
+
*
|
|
4
|
+
* The pool's masks are alpha-coverage textures. Invert is its own module
|
|
5
|
+
* (rather than a flag on every consumer) because chaining mask ops cleanly is
|
|
6
|
+
* a frequent enough pattern. Fragment.
|
|
7
|
+
*/
|
|
8
|
+
import * as d from "typegpu/data";
|
|
9
|
+
export declare const maskInvertV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
10
|
+
unused: d.F32;
|
|
11
|
+
}>>;
|
|
12
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/mask/invert/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAiBlC,eAAO,MAAM,YAAY;;GAkCvB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mask.invert@1` — `output.a = 1 - mask.a`, RGB zeroed.
|
|
3
|
+
*
|
|
4
|
+
* The pool's masks are alpha-coverage textures. Invert is its own module
|
|
5
|
+
* (rather than a flag on every consumer) because chaining mask ops cleanly is
|
|
6
|
+
* a frequent enough pattern. Fragment.
|
|
7
|
+
*/
|
|
8
|
+
import tgpu from "typegpu";
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
import { defineModule } from "../../../../module.js";
|
|
11
|
+
const NoParams = d.struct({ unused: d.f32 });
|
|
12
|
+
const layout = tgpu.bindGroupLayout({
|
|
13
|
+
source: { texture: "float" },
|
|
14
|
+
samp: { sampler: "filtering" }
|
|
15
|
+
});
|
|
16
|
+
const samplerDescriptor = {
|
|
17
|
+
magFilter: "linear",
|
|
18
|
+
minFilter: "linear",
|
|
19
|
+
addressModeU: "clamp-to-edge",
|
|
20
|
+
addressModeV: "clamp-to-edge"
|
|
21
|
+
};
|
|
22
|
+
export const maskInvertV1 = defineModule({
|
|
23
|
+
id: "mask.invert",
|
|
24
|
+
version: 1,
|
|
25
|
+
surface: "internal",
|
|
26
|
+
category: "mask",
|
|
27
|
+
linearity: "alpha-only",
|
|
28
|
+
kind: "fragment",
|
|
29
|
+
params: NoParams,
|
|
30
|
+
paramDefaults: { unused: 0 },
|
|
31
|
+
layout,
|
|
32
|
+
samplers: { samp: samplerDescriptor },
|
|
33
|
+
wgsl: /* wgsl */ `
|
|
34
|
+
@fragment
|
|
35
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
36
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
37
|
+
return vec4f(0.0, 0.0, 0.0, clamp(1.0 - src.a, 0.0, 1.0));
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
io: {
|
|
41
|
+
inputs: {
|
|
42
|
+
source: {
|
|
43
|
+
colorSpace: "linear",
|
|
44
|
+
alpha: "premultiplied",
|
|
45
|
+
bindingKinds: ["texture_2d"]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
output: {
|
|
49
|
+
colorSpace: "linear",
|
|
50
|
+
alpha: "premultiplied",
|
|
51
|
+
format: "rgba8unorm",
|
|
52
|
+
dimensions: "same-as:source"
|
|
53
|
+
},
|
|
54
|
+
rod: "same-as:source"
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/mask/invert/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAE7C,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAyB;IAC9C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;IACvC,EAAE,EAAE,aAAa;IACjB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;IAC5B,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;CAMlB;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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mixer.add@1` — additive composite of two textures, `out = source + over * gain`.
|
|
3
|
+
*
|
|
4
|
+
* Premultiplied alpha throughout; alpha follows the same additive rule. Used
|
|
5
|
+
* by the `filters.glow` recipe to fold a blurred bright pass back into the
|
|
6
|
+
* original, and as a general-purpose add layer. Real multi-mode composite
|
|
7
|
+
* (over/multiply/screen/…) is `mixer.composite` (Phase 4 Batch 4 — wraps
|
|
8
|
+
* `WebGPULayerCompositor`).
|
|
9
|
+
*/
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
export declare const AddParams: d.WgslStruct<{
|
|
12
|
+
gain: d.F32;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const mixerAddV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
15
|
+
gain: d.F32;
|
|
16
|
+
}>>;
|
|
17
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/mixer/add/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,SAAS;;EAEpB,CAAC;AAgBH,eAAO,MAAM,UAAU;;GA4CrB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mixer.add@1` — additive composite of two textures, `out = source + over * gain`.
|
|
3
|
+
*
|
|
4
|
+
* Premultiplied alpha throughout; alpha follows the same additive rule. Used
|
|
5
|
+
* by the `filters.glow` recipe to fold a blurred bright pass back into the
|
|
6
|
+
* original, and as a general-purpose add layer. Real multi-mode composite
|
|
7
|
+
* (over/multiply/screen/…) is `mixer.composite` (Phase 4 Batch 4 — wraps
|
|
8
|
+
* `WebGPULayerCompositor`).
|
|
9
|
+
*/
|
|
10
|
+
import tgpu from "typegpu";
|
|
11
|
+
import * as d from "typegpu/data";
|
|
12
|
+
import { defineModule } from "../../../../module.js";
|
|
13
|
+
export const AddParams = d.struct({
|
|
14
|
+
gain: d.f32
|
|
15
|
+
});
|
|
16
|
+
const layout = tgpu.bindGroupLayout({
|
|
17
|
+
params: { uniform: AddParams },
|
|
18
|
+
source: { texture: "float" },
|
|
19
|
+
over: { texture: "float" },
|
|
20
|
+
samp: { sampler: "filtering" }
|
|
21
|
+
});
|
|
22
|
+
const samplerDescriptor = {
|
|
23
|
+
magFilter: "linear",
|
|
24
|
+
minFilter: "linear",
|
|
25
|
+
addressModeU: "clamp-to-edge",
|
|
26
|
+
addressModeV: "clamp-to-edge"
|
|
27
|
+
};
|
|
28
|
+
export const mixerAddV1 = defineModule({
|
|
29
|
+
id: "mixer.add",
|
|
30
|
+
version: 1,
|
|
31
|
+
surface: "internal",
|
|
32
|
+
category: "mixer",
|
|
33
|
+
linearity: "linear-in-rgb",
|
|
34
|
+
kind: "fragment",
|
|
35
|
+
params: AddParams,
|
|
36
|
+
paramDefaults: { gain: 1 },
|
|
37
|
+
paramUi: {
|
|
38
|
+
gain: { min: 0, max: 4, step: 0.01, label: "Gain" }
|
|
39
|
+
},
|
|
40
|
+
layout,
|
|
41
|
+
samplers: { samp: samplerDescriptor },
|
|
42
|
+
wgsl: /* wgsl */ `
|
|
43
|
+
@fragment
|
|
44
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
45
|
+
let s = textureSample(layout.$.source, layout.$.samp, uv);
|
|
46
|
+
let o = textureSample(layout.$.over, layout.$.samp, uv);
|
|
47
|
+
let g = layout.$.params.gain;
|
|
48
|
+
return clamp(s + o * g, vec4f(0.0), vec4f(1.0));
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
io: {
|
|
52
|
+
inputs: {
|
|
53
|
+
source: {
|
|
54
|
+
colorSpace: "linear",
|
|
55
|
+
alpha: "premultiplied",
|
|
56
|
+
bindingKinds: ["texture_2d"]
|
|
57
|
+
},
|
|
58
|
+
over: {
|
|
59
|
+
colorSpace: "linear",
|
|
60
|
+
alpha: "premultiplied",
|
|
61
|
+
bindingKinds: ["texture_2d"]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
output: {
|
|
65
|
+
colorSpace: "linear",
|
|
66
|
+
alpha: "premultiplied",
|
|
67
|
+
format: "rgba8unorm",
|
|
68
|
+
dimensions: "same-as:source"
|
|
69
|
+
},
|
|
70
|
+
rod: "union-of-inputs"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/mixer/add/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,GAAG;CACZ,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;IAC9B,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC1B,IAAI,EAAE,EAAE,O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3
|
+
* source coverage.
|
|
4
|
+
*
|
|
5
|
+
* The "Color Overlay" layer-effect from sketch / image-editor vocabulary: a
|
|
6
|
+
* constant RGB fill is mixed into the source's colours but the output
|
|
7
|
+
* **silhouette (alpha) is preserved** — the overlay never spills outside
|
|
8
|
+
* the source, and never erodes its coverage either. `amount` controls the
|
|
9
|
+
* RGB mix strength (`0` passthrough, `1` full overlay) and is scaled by the
|
|
10
|
+
* picker's `color.a`, so a half-opacity colour applied at full amount
|
|
11
|
+
* behaves like a fully-opaque colour at half amount.
|
|
12
|
+
*
|
|
13
|
+
* `color` is supplied straight (R, G, B, opacity) — the shader handles
|
|
14
|
+
* un/re-premultiplication so the output stays premultiplied per the pool
|
|
15
|
+
* convention.
|
|
16
|
+
*/
|
|
17
|
+
import * as d from "typegpu/data";
|
|
18
|
+
export declare const ColorOverlayParams: d.WgslStruct<{
|
|
19
|
+
color: d.Vec4f;
|
|
20
|
+
amount: d.F32;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const mixerColorOverlayV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
23
|
+
color: d.Vec4f;
|
|
24
|
+
amount: d.F32;
|
|
25
|
+
}>>;
|
|
26
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/mixer/colorOverlay/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,kBAAkB;;;EAG7B,CAAC;AAeH,eAAO,MAAM,mBAAmB;;;GA6C9B,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mixer.colorOverlay@1` — flat colour applied across the source, masked by
|
|
3
|
+
* source coverage.
|
|
4
|
+
*
|
|
5
|
+
* The "Color Overlay" layer-effect from sketch / image-editor vocabulary: a
|
|
6
|
+
* constant RGB fill is mixed into the source's colours but the output
|
|
7
|
+
* **silhouette (alpha) is preserved** — the overlay never spills outside
|
|
8
|
+
* the source, and never erodes its coverage either. `amount` controls the
|
|
9
|
+
* RGB mix strength (`0` passthrough, `1` full overlay) and is scaled by the
|
|
10
|
+
* picker's `color.a`, so a half-opacity colour applied at full amount
|
|
11
|
+
* behaves like a fully-opaque colour at half amount.
|
|
12
|
+
*
|
|
13
|
+
* `color` is supplied straight (R, G, B, opacity) — the shader handles
|
|
14
|
+
* un/re-premultiplication so the output stays premultiplied per the pool
|
|
15
|
+
* convention.
|
|
16
|
+
*/
|
|
17
|
+
import tgpu from "typegpu";
|
|
18
|
+
import * as d from "typegpu/data";
|
|
19
|
+
import { defineModule } from "../../../../module.js";
|
|
20
|
+
export const ColorOverlayParams = d.struct({
|
|
21
|
+
color: d.vec4f,
|
|
22
|
+
amount: d.f32
|
|
23
|
+
});
|
|
24
|
+
const layout = tgpu.bindGroupLayout({
|
|
25
|
+
params: { uniform: ColorOverlayParams },
|
|
26
|
+
source: { texture: "float" },
|
|
27
|
+
samp: { sampler: "filtering" }
|
|
28
|
+
});
|
|
29
|
+
const samplerDescriptor = {
|
|
30
|
+
magFilter: "linear",
|
|
31
|
+
minFilter: "linear",
|
|
32
|
+
addressModeU: "clamp-to-edge",
|
|
33
|
+
addressModeV: "clamp-to-edge"
|
|
34
|
+
};
|
|
35
|
+
export const mixerColorOverlayV1 = defineModule({
|
|
36
|
+
id: "mixer.colorOverlay",
|
|
37
|
+
version: 1,
|
|
38
|
+
surface: "internal",
|
|
39
|
+
category: "mixer",
|
|
40
|
+
linearity: "nonlinear-in-rgb",
|
|
41
|
+
kind: "fragment",
|
|
42
|
+
params: ColorOverlayParams,
|
|
43
|
+
paramDefaults: { color: d.vec4f(1, 0, 0, 1), amount: 0.5 },
|
|
44
|
+
paramUi: {
|
|
45
|
+
color: { label: "Color", notes: "RGBA, straight alpha" },
|
|
46
|
+
amount: { min: 0, max: 1, step: 0.01, label: "Amount" }
|
|
47
|
+
},
|
|
48
|
+
layout,
|
|
49
|
+
samplers: { samp: samplerDescriptor },
|
|
50
|
+
wgsl: /* wgsl */ `
|
|
51
|
+
@fragment
|
|
52
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
53
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
54
|
+
let p = layout.$.params;
|
|
55
|
+
// Blend RGB in straight space, then re-premultiply against the source's
|
|
56
|
+
// own coverage. The output silhouette stays = src.a regardless of color.a
|
|
57
|
+
// or amount — overlay opacity affects colour, not coverage.
|
|
58
|
+
let safeA = max(src.a, 0.0001);
|
|
59
|
+
let straightRgb = src.rgb / safeA;
|
|
60
|
+
let mixedStraight = mix(straightRgb, p.color.rgb, clamp(p.amount * p.color.a, 0.0, 1.0));
|
|
61
|
+
return vec4f(mixedStraight * src.a, src.a);
|
|
62
|
+
}
|
|
63
|
+
`,
|
|
64
|
+
io: {
|
|
65
|
+
inputs: {
|
|
66
|
+
source: {
|
|
67
|
+
colorSpace: "linear",
|
|
68
|
+
alpha: "premultiplied",
|
|
69
|
+
bindingKinds: ["texture_2d"]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
output: {
|
|
73
|
+
colorSpace: "linear",
|
|
74
|
+
alpha: "premultiplied",
|
|
75
|
+
format: "rgba8unorm",
|
|
76
|
+
dimensions: "same-as:source"
|
|
77
|
+
},
|
|
78
|
+
rod: "same-as:source"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/mixer/colorOverlay/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,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