@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,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.levels@1` — per-channel input black point, gamma, and white point.
|
|
3
|
+
*
|
|
4
|
+
* For each of R/G/B independently: remap `[black, white]` onto `[0, 1]` then
|
|
5
|
+
* apply gamma — `out = pow(clamp((in - black) / (white - black), 0, 1), 1/gamma)`.
|
|
6
|
+
* `black`/`white` are normalized to `[0, 1]` (the host divides 0–255 inputs by
|
|
7
|
+
* 255); `gamma` is the channel gamma. The identity is `black=0, gamma=1,
|
|
8
|
+
* white=1`. Alpha is untouched. Fragment, with the canonical mask slot.
|
|
9
|
+
*/
|
|
10
|
+
import tgpu from "typegpu";
|
|
11
|
+
import * as d from "typegpu/data";
|
|
12
|
+
import { defineModule } from "../../../../module.js";
|
|
13
|
+
export const LevelsParams = d.struct({
|
|
14
|
+
rBlack: d.f32,
|
|
15
|
+
rGamma: d.f32,
|
|
16
|
+
rWhite: d.f32,
|
|
17
|
+
gBlack: d.f32,
|
|
18
|
+
gGamma: d.f32,
|
|
19
|
+
gWhite: d.f32,
|
|
20
|
+
bBlack: d.f32,
|
|
21
|
+
bGamma: d.f32,
|
|
22
|
+
bWhite: d.f32
|
|
23
|
+
});
|
|
24
|
+
const layout = tgpu.bindGroupLayout({
|
|
25
|
+
params: { uniform: LevelsParams },
|
|
26
|
+
source: { texture: "float" },
|
|
27
|
+
mask: { texture: "float" },
|
|
28
|
+
samp: { sampler: "filtering" }
|
|
29
|
+
});
|
|
30
|
+
const samplerDescriptor = {
|
|
31
|
+
magFilter: "linear",
|
|
32
|
+
minFilter: "linear",
|
|
33
|
+
addressModeU: "clamp-to-edge",
|
|
34
|
+
addressModeV: "clamp-to-edge"
|
|
35
|
+
};
|
|
36
|
+
export const colorLevelsV1 = defineModule({
|
|
37
|
+
id: "color.levels",
|
|
38
|
+
version: 1,
|
|
39
|
+
surface: "internal",
|
|
40
|
+
category: "color",
|
|
41
|
+
linearity: "nonlinear-in-rgb",
|
|
42
|
+
kind: "fragment",
|
|
43
|
+
params: LevelsParams,
|
|
44
|
+
paramDefaults: {
|
|
45
|
+
rBlack: 0,
|
|
46
|
+
rGamma: 1,
|
|
47
|
+
rWhite: 1,
|
|
48
|
+
gBlack: 0,
|
|
49
|
+
gGamma: 1,
|
|
50
|
+
gWhite: 1,
|
|
51
|
+
bBlack: 0,
|
|
52
|
+
bGamma: 1,
|
|
53
|
+
bWhite: 1
|
|
54
|
+
},
|
|
55
|
+
paramUi: {
|
|
56
|
+
rBlack: { min: 0, max: 1, step: 0.01, label: "Red black" },
|
|
57
|
+
rGamma: { min: 0.01, max: 10, step: 0.01, label: "Red gamma" },
|
|
58
|
+
rWhite: { min: 0, max: 1, step: 0.01, label: "Red white" },
|
|
59
|
+
gBlack: { min: 0, max: 1, step: 0.01, label: "Green black" },
|
|
60
|
+
gGamma: { min: 0.01, max: 10, step: 0.01, label: "Green gamma" },
|
|
61
|
+
gWhite: { min: 0, max: 1, step: 0.01, label: "Green white" },
|
|
62
|
+
bBlack: { min: 0, max: 1, step: 0.01, label: "Blue black" },
|
|
63
|
+
bGamma: { min: 0.01, max: 10, step: 0.01, label: "Blue gamma" },
|
|
64
|
+
bWhite: { min: 0, max: 1, step: 0.01, label: "Blue white" }
|
|
65
|
+
},
|
|
66
|
+
layout,
|
|
67
|
+
samplers: { samp: samplerDescriptor },
|
|
68
|
+
wgsl: /* wgsl */ `
|
|
69
|
+
fn levelChannel(x: f32, black: f32, gamma: f32, white: f32) -> f32 {
|
|
70
|
+
let denom = max(1.0 / 255.0, white - black);
|
|
71
|
+
let t = clamp((x - black) / denom, 0.0, 1.0);
|
|
72
|
+
return pow(t, 1.0 / max(0.01, gamma));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@fragment
|
|
76
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
77
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
78
|
+
let coverage = textureSample(layout.$.mask, layout.$.samp, uv).a;
|
|
79
|
+
// Operate on straight (un-premultiplied) color so the per-channel remap is
|
|
80
|
+
// correct on partial-alpha pixels, then re-premultiply on output.
|
|
81
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
82
|
+
let straight = src.rgb / safeA;
|
|
83
|
+
let p = layout.$.params;
|
|
84
|
+
let leveled = vec3f(
|
|
85
|
+
levelChannel(straight.r, p.rBlack, p.rGamma, p.rWhite),
|
|
86
|
+
levelChannel(straight.g, p.gBlack, p.gGamma, p.gWhite),
|
|
87
|
+
levelChannel(straight.b, p.bBlack, p.bGamma, p.bWhite)
|
|
88
|
+
);
|
|
89
|
+
let mixedStraight = mix(straight, clamp(leveled, vec3f(0.0), vec3f(1.0)), coverage);
|
|
90
|
+
return vec4f(mixedStraight * src.a, src.a);
|
|
91
|
+
}
|
|
92
|
+
`,
|
|
93
|
+
io: {
|
|
94
|
+
inputs: {
|
|
95
|
+
source: {
|
|
96
|
+
colorSpace: "linear",
|
|
97
|
+
alpha: "premultiplied",
|
|
98
|
+
bindingKinds: ["texture_2d"]
|
|
99
|
+
},
|
|
100
|
+
mask: {
|
|
101
|
+
colorSpace: "linear",
|
|
102
|
+
alpha: "premultiplied",
|
|
103
|
+
bindingKinds: ["texture_2d"],
|
|
104
|
+
optional: true
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
output: {
|
|
108
|
+
colorSpace: "linear",
|
|
109
|
+
alpha: "premultiplied",
|
|
110
|
+
format: "rgba8unorm",
|
|
111
|
+
dimensions: "same-as:source"
|
|
112
|
+
},
|
|
113
|
+
rod: "same-as:source"
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/color/levels/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,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,MAAM,EAAE,CAAC,CAAC,GAAG;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;IACjC,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,CAAC;AAEH,MAAM,iBAAiB,GAAyB;IAC9C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;CAC9B,CAA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AAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE;QAC3D,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE;QAC/D,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE;KAC5D;IACD,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAwBlB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,QAAQ,EAAE,IAAI;aACf;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,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.liftGammaGain@1` — three-way (shadows / midtones / highlights) color
|
|
3
|
+
* corrector.
|
|
4
|
+
*
|
|
5
|
+
* Ported verbatim from the CPU `lib.image.color_grading.LiftGammaGain` loop:
|
|
6
|
+
* `out = ((in + lift) * gain) ^ (1 / gamma)` per channel, with master
|
|
7
|
+
* multipliers folded into each per-channel knob. Lift shifts shadows, gain
|
|
8
|
+
* scales highlights, gamma bends midtones. Fragment, with the canonical
|
|
9
|
+
* optional mask slot.
|
|
10
|
+
*/
|
|
11
|
+
import * as d from "typegpu/data";
|
|
12
|
+
export declare const LiftGammaGainParams: d.WgslStruct<{
|
|
13
|
+
liftR: d.F32;
|
|
14
|
+
liftG: d.F32;
|
|
15
|
+
liftB: d.F32;
|
|
16
|
+
liftMaster: d.F32;
|
|
17
|
+
gammaR: d.F32;
|
|
18
|
+
gammaG: d.F32;
|
|
19
|
+
gammaB: d.F32;
|
|
20
|
+
gammaMaster: d.F32;
|
|
21
|
+
gainR: d.F32;
|
|
22
|
+
gainG: d.F32;
|
|
23
|
+
gainB: d.F32;
|
|
24
|
+
gainMaster: d.F32;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const colorLiftGammaGainV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
27
|
+
liftR: d.F32;
|
|
28
|
+
liftG: d.F32;
|
|
29
|
+
liftB: d.F32;
|
|
30
|
+
liftMaster: d.F32;
|
|
31
|
+
gammaR: d.F32;
|
|
32
|
+
gammaG: d.F32;
|
|
33
|
+
gammaB: d.F32;
|
|
34
|
+
gammaMaster: d.F32;
|
|
35
|
+
gainR: d.F32;
|
|
36
|
+
gainG: d.F32;
|
|
37
|
+
gainB: d.F32;
|
|
38
|
+
gainMaster: d.F32;
|
|
39
|
+
}>>;
|
|
40
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/color/liftGammaGain/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;EAa9B,CAAC;AAgBH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;GAyE/B,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.liftGammaGain@1` — three-way (shadows / midtones / highlights) color
|
|
3
|
+
* corrector.
|
|
4
|
+
*
|
|
5
|
+
* Ported verbatim from the CPU `lib.image.color_grading.LiftGammaGain` loop:
|
|
6
|
+
* `out = ((in + lift) * gain) ^ (1 / gamma)` per channel, with master
|
|
7
|
+
* multipliers folded into each per-channel knob. Lift shifts shadows, gain
|
|
8
|
+
* scales highlights, gamma bends midtones. Fragment, with the canonical
|
|
9
|
+
* optional mask slot.
|
|
10
|
+
*/
|
|
11
|
+
import tgpu from "typegpu";
|
|
12
|
+
import * as d from "typegpu/data";
|
|
13
|
+
import { defineModule } from "../../../../module.js";
|
|
14
|
+
export const LiftGammaGainParams = d.struct({
|
|
15
|
+
liftR: d.f32,
|
|
16
|
+
liftG: d.f32,
|
|
17
|
+
liftB: d.f32,
|
|
18
|
+
liftMaster: d.f32,
|
|
19
|
+
gammaR: d.f32,
|
|
20
|
+
gammaG: d.f32,
|
|
21
|
+
gammaB: d.f32,
|
|
22
|
+
gammaMaster: d.f32,
|
|
23
|
+
gainR: d.f32,
|
|
24
|
+
gainG: d.f32,
|
|
25
|
+
gainB: d.f32,
|
|
26
|
+
gainMaster: d.f32
|
|
27
|
+
});
|
|
28
|
+
const layout = tgpu.bindGroupLayout({
|
|
29
|
+
params: { uniform: LiftGammaGainParams },
|
|
30
|
+
source: { texture: "float" },
|
|
31
|
+
mask: { texture: "float" },
|
|
32
|
+
samp: { sampler: "filtering" }
|
|
33
|
+
});
|
|
34
|
+
const samplerDescriptor = {
|
|
35
|
+
magFilter: "linear",
|
|
36
|
+
minFilter: "linear",
|
|
37
|
+
addressModeU: "clamp-to-edge",
|
|
38
|
+
addressModeV: "clamp-to-edge"
|
|
39
|
+
};
|
|
40
|
+
export const colorLiftGammaGainV1 = defineModule({
|
|
41
|
+
id: "color.liftGammaGain",
|
|
42
|
+
version: 1,
|
|
43
|
+
surface: "internal",
|
|
44
|
+
category: "color",
|
|
45
|
+
linearity: "nonlinear-in-rgb",
|
|
46
|
+
kind: "fragment",
|
|
47
|
+
params: LiftGammaGainParams,
|
|
48
|
+
paramDefaults: {
|
|
49
|
+
liftR: 0,
|
|
50
|
+
liftG: 0,
|
|
51
|
+
liftB: 0,
|
|
52
|
+
liftMaster: 0,
|
|
53
|
+
gammaR: 1,
|
|
54
|
+
gammaG: 1,
|
|
55
|
+
gammaB: 1,
|
|
56
|
+
gammaMaster: 1,
|
|
57
|
+
gainR: 1,
|
|
58
|
+
gainG: 1,
|
|
59
|
+
gainB: 1,
|
|
60
|
+
gainMaster: 1
|
|
61
|
+
},
|
|
62
|
+
layout,
|
|
63
|
+
samplers: { samp: samplerDescriptor },
|
|
64
|
+
wgsl: /* wgsl */ `
|
|
65
|
+
@fragment
|
|
66
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
67
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
68
|
+
let coverage = textureSample(layout.$.mask, layout.$.samp, uv).a;
|
|
69
|
+
let p = layout.$.params;
|
|
70
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
71
|
+
let straight = src.rgb / safeA;
|
|
72
|
+
let lift = vec3f(p.liftR + p.liftMaster, p.liftG + p.liftMaster, p.liftB + p.liftMaster);
|
|
73
|
+
let gain = vec3f(p.gainR * p.gainMaster, p.gainG * p.gainMaster, p.gainB * p.gainMaster);
|
|
74
|
+
let r = (straight + lift) * gain;
|
|
75
|
+
let gammaInv = vec3f(
|
|
76
|
+
1.0 / max(0.01, p.gammaR * p.gammaMaster),
|
|
77
|
+
1.0 / max(0.01, p.gammaG * p.gammaMaster),
|
|
78
|
+
1.0 / max(0.01, p.gammaB * p.gammaMaster)
|
|
79
|
+
);
|
|
80
|
+
// pow(negative, x) is undefined; the CPU path returns 0 for r <= 0, so
|
|
81
|
+
// guard with max() and select the 0 branch to match exactly.
|
|
82
|
+
var rgb = vec3f(
|
|
83
|
+
select(0.0, pow(max(r.r, 0.0), gammaInv.r), r.r > 0.0),
|
|
84
|
+
select(0.0, pow(max(r.g, 0.0), gammaInv.g), r.g > 0.0),
|
|
85
|
+
select(0.0, pow(max(r.b, 0.0), gammaInv.b), r.b > 0.0)
|
|
86
|
+
);
|
|
87
|
+
let mixed = mix(straight, rgb, coverage);
|
|
88
|
+
return vec4f(clamp(mixed, vec3f(0.0), vec3f(1.0)) * src.a, src.a);
|
|
89
|
+
}
|
|
90
|
+
`,
|
|
91
|
+
io: {
|
|
92
|
+
inputs: {
|
|
93
|
+
source: {
|
|
94
|
+
colorSpace: "srgb",
|
|
95
|
+
alpha: "premultiplied",
|
|
96
|
+
bindingKinds: ["texture_2d"]
|
|
97
|
+
},
|
|
98
|
+
mask: {
|
|
99
|
+
colorSpace: "srgb",
|
|
100
|
+
alpha: "premultiplied",
|
|
101
|
+
bindingKinds: ["texture_2d"],
|
|
102
|
+
optional: true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
output: {
|
|
106
|
+
colorSpace: "srgb",
|
|
107
|
+
alpha: "premultiplied",
|
|
108
|
+
format: "rgba8unorm",
|
|
109
|
+
dimensions: "same-as:source"
|
|
110
|
+
},
|
|
111
|
+
rod: "same-as:source"
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/color/liftGammaGain/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,GAAG;IACZ,KAAK,EAAE,CAAC,CAAC,GAAG;IACZ,KAAK,EAAE,CAAC,CAAC,GAAG;IACZ,UAAU,EA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ACR,UAAU,EAAE,CAAC;KACd;IACD,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BlB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,QAAQ,EAAE,IAAI;aACf;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,MAAM;YAClB,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
|
+
* `color.posterize@1` — quantize each channel to N levels.
|
|
3
|
+
*
|
|
4
|
+
* `levels` clamps to `[2, 256]`. At `levels = 2` the output is binary
|
|
5
|
+
* per channel (eight discrete colors); at `levels = 256` it's the full
|
|
6
|
+
* 8-bit range (effectively passthrough — covers PIL `bits=8` semantics).
|
|
7
|
+
* Fragment, with the canonical mask slot.
|
|
8
|
+
*/
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
export declare const PosterizeParams: d.WgslStruct<{
|
|
11
|
+
levels: d.F32;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const colorPosterizeV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
14
|
+
levels: d.F32;
|
|
15
|
+
}>>;
|
|
16
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/color/posterize/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,eAAe;;EAE1B,CAAC;AAgBH,eAAO,MAAM,gBAAgB;;GAoD3B,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.posterize@1` — quantize each channel to N levels.
|
|
3
|
+
*
|
|
4
|
+
* `levels` clamps to `[2, 256]`. At `levels = 2` the output is binary
|
|
5
|
+
* per channel (eight discrete colors); at `levels = 256` it's the full
|
|
6
|
+
* 8-bit range (effectively passthrough — covers PIL `bits=8` semantics).
|
|
7
|
+
* Fragment, with the canonical mask slot.
|
|
8
|
+
*/
|
|
9
|
+
import tgpu from "typegpu";
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
import { defineModule } from "../../../../module.js";
|
|
12
|
+
export const PosterizeParams = d.struct({
|
|
13
|
+
levels: d.f32
|
|
14
|
+
});
|
|
15
|
+
const layout = tgpu.bindGroupLayout({
|
|
16
|
+
params: { uniform: PosterizeParams },
|
|
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 colorPosterizeV1 = defineModule({
|
|
28
|
+
id: "color.posterize",
|
|
29
|
+
version: 1,
|
|
30
|
+
surface: "internal",
|
|
31
|
+
category: "color",
|
|
32
|
+
linearity: "nonlinear-in-rgb",
|
|
33
|
+
kind: "fragment",
|
|
34
|
+
params: PosterizeParams,
|
|
35
|
+
paramDefaults: { levels: 4 },
|
|
36
|
+
paramUi: {
|
|
37
|
+
levels: { min: 2, max: 256, step: 1, label: "Levels" }
|
|
38
|
+
},
|
|
39
|
+
layout,
|
|
40
|
+
samplers: { samp: samplerDescriptor },
|
|
41
|
+
wgsl: /* wgsl */ `
|
|
42
|
+
@fragment
|
|
43
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
44
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
45
|
+
let coverage = textureSample(layout.$.mask, layout.$.samp, uv).a;
|
|
46
|
+
let n = max(2.0, min(256.0, layout.$.params.levels));
|
|
47
|
+
// Quantize the underlying straight color, not the premultiplied RGB; on
|
|
48
|
+
// partial-alpha pixels the premultiplied form has rgb <= a, so quantizing
|
|
49
|
+
// before un-premultiplying snaps to the wrong bin and can push rgb > a.
|
|
50
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
51
|
+
let straight = src.rgb / safeA;
|
|
52
|
+
let quantized = floor(clamp(straight, vec3f(0.0), vec3f(1.0)) * n) / (n - 1.0);
|
|
53
|
+
let mixedStraight = mix(straight, clamp(quantized, vec3f(0.0), vec3f(1.0)), coverage);
|
|
54
|
+
return vec4f(mixedStraight * src.a, src.a);
|
|
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
|
+
optional: true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
output: {
|
|
72
|
+
colorSpace: "linear",
|
|
73
|
+
alpha: "premultiplied",
|
|
74
|
+
format: "rgba8unorm",
|
|
75
|
+
dimensions: "same-as:source"
|
|
76
|
+
},
|
|
77
|
+
rod: "same-as:source"
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/color/posterize/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,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,gBAAgB,GAAG,YAAY,CAAC;IAC3C,EAAE,EAAE,iBAAiB;IACrB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,kBAAkB;IAC7B,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,eAAe;IACvB,aAAa,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;IAC5B,OAAO,EAAE;QACP,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;KACvD;IACD,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;CAelB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,QAAQ,EAAE,IAAI;aACf;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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.solarize@1` — invert RGB channels whose value exceeds `threshold`.
|
|
3
|
+
*
|
|
4
|
+
* Classic PIL `ImageOps.solarize`. Each channel independently: if its value
|
|
5
|
+
* is greater than `threshold` (0..1), output `1 - v`; otherwise pass through.
|
|
6
|
+
* Alpha preserved.
|
|
7
|
+
*/
|
|
8
|
+
import * as d from "typegpu/data";
|
|
9
|
+
export declare const SolarizeParams: d.WgslStruct<{
|
|
10
|
+
threshold: d.F32;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const colorSolarizeV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
13
|
+
threshold: d.F32;
|
|
14
|
+
}>>;
|
|
15
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/color/solarize/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,cAAc;;EAEzB,CAAC;AAgBH,eAAO,MAAM,eAAe;;GAwD1B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.solarize@1` — invert RGB channels whose value exceeds `threshold`.
|
|
3
|
+
*
|
|
4
|
+
* Classic PIL `ImageOps.solarize`. Each channel independently: if its value
|
|
5
|
+
* is greater than `threshold` (0..1), output `1 - v`; otherwise pass through.
|
|
6
|
+
* Alpha preserved.
|
|
7
|
+
*/
|
|
8
|
+
import tgpu from "typegpu";
|
|
9
|
+
import * as d from "typegpu/data";
|
|
10
|
+
import { defineModule } from "../../../../module.js";
|
|
11
|
+
export const SolarizeParams = d.struct({
|
|
12
|
+
threshold: d.f32
|
|
13
|
+
});
|
|
14
|
+
const layout = tgpu.bindGroupLayout({
|
|
15
|
+
params: { uniform: SolarizeParams },
|
|
16
|
+
source: { texture: "float" },
|
|
17
|
+
mask: { texture: "float" },
|
|
18
|
+
samp: { sampler: "filtering" }
|
|
19
|
+
});
|
|
20
|
+
const samplerDescriptor = {
|
|
21
|
+
magFilter: "linear",
|
|
22
|
+
minFilter: "linear",
|
|
23
|
+
addressModeU: "clamp-to-edge",
|
|
24
|
+
addressModeV: "clamp-to-edge"
|
|
25
|
+
};
|
|
26
|
+
export const colorSolarizeV1 = defineModule({
|
|
27
|
+
id: "color.solarize",
|
|
28
|
+
version: 1,
|
|
29
|
+
surface: "internal",
|
|
30
|
+
category: "color",
|
|
31
|
+
linearity: "nonlinear-in-rgb",
|
|
32
|
+
kind: "fragment",
|
|
33
|
+
params: SolarizeParams,
|
|
34
|
+
paramDefaults: { threshold: 0.5 },
|
|
35
|
+
paramUi: {
|
|
36
|
+
threshold: { min: 0, max: 1, step: 0.01, label: "Threshold" }
|
|
37
|
+
},
|
|
38
|
+
layout,
|
|
39
|
+
samplers: { samp: samplerDescriptor },
|
|
40
|
+
wgsl: /* wgsl */ `
|
|
41
|
+
@fragment
|
|
42
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
43
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
44
|
+
let coverage = textureSample(layout.$.mask, layout.$.samp, uv).a;
|
|
45
|
+
let t = layout.$.params.threshold;
|
|
46
|
+
// Threshold the underlying straight color so the comparison against t is
|
|
47
|
+
// alpha-independent; otherwise transparent pixels (premultiplied near 0)
|
|
48
|
+
// are below threshold even when their underlying color is bright.
|
|
49
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
50
|
+
let straight = src.rgb / safeA;
|
|
51
|
+
let inverted = vec3f(
|
|
52
|
+
select(straight.r, 1.0 - straight.r, straight.r > t),
|
|
53
|
+
select(straight.g, 1.0 - straight.g, straight.g > t),
|
|
54
|
+
select(straight.b, 1.0 - straight.b, straight.b > t)
|
|
55
|
+
);
|
|
56
|
+
let mixedStraight = mix(straight, inverted, coverage);
|
|
57
|
+
return vec4f(mixedStraight * src.a, src.a);
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
io: {
|
|
61
|
+
inputs: {
|
|
62
|
+
source: {
|
|
63
|
+
colorSpace: "linear",
|
|
64
|
+
alpha: "premultiplied",
|
|
65
|
+
bindingKinds: ["texture_2d"]
|
|
66
|
+
},
|
|
67
|
+
mask: {
|
|
68
|
+
colorSpace: "linear",
|
|
69
|
+
alpha: "premultiplied",
|
|
70
|
+
bindingKinds: ["texture_2d"],
|
|
71
|
+
optional: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
output: {
|
|
75
|
+
colorSpace: "linear",
|
|
76
|
+
alpha: "premultiplied",
|
|
77
|
+
format: "rgba8unorm",
|
|
78
|
+
dimensions: "same-as:source"
|
|
79
|
+
},
|
|
80
|
+
rod: "same-as:source"
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":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;;;;;;;;CAmBlB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,QAAQ,EAAE,IAAI;aACf;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,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.splitToning@1` — tint shadows and highlights toward two different
|
|
3
|
+
* colours.
|
|
4
|
+
*
|
|
5
|
+
* Ported verbatim from the CPU `lib.image.color_grading.SplitToning` loop. The
|
|
6
|
+
* host resolves the shadow/highlight hues to normalized RGB tint colours
|
|
7
|
+
* (`hsv→rgb` at full saturation/value) and passes them as `vec3f`s; the shader
|
|
8
|
+
* weights each toward shadows/highlights by a balance-shifted luminance mask.
|
|
9
|
+
* Fragment, with the canonical optional mask slot.
|
|
10
|
+
*/
|
|
11
|
+
import * as d from "typegpu/data";
|
|
12
|
+
export declare const SplitToningParams: d.WgslStruct<{
|
|
13
|
+
shadowColor: d.Vec3f;
|
|
14
|
+
shadowSat: d.F32;
|
|
15
|
+
highlightColor: d.Vec3f;
|
|
16
|
+
highlightSat: d.F32;
|
|
17
|
+
balance: d.F32;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const colorSplitToningV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
20
|
+
shadowColor: d.Vec3f;
|
|
21
|
+
shadowSat: d.F32;
|
|
22
|
+
highlightColor: d.Vec3f;
|
|
23
|
+
highlightSat: d.F32;
|
|
24
|
+
balance: d.F32;
|
|
25
|
+
}>>;
|
|
26
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/color/splitToning/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAIlC,eAAO,MAAM,iBAAiB;;;;;;EAM5B,CAAC;AAgBH,eAAO,MAAM,kBAAkB;;;;;;GA4D7B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `color.splitToning@1` — tint shadows and highlights toward two different
|
|
3
|
+
* colours.
|
|
4
|
+
*
|
|
5
|
+
* Ported verbatim from the CPU `lib.image.color_grading.SplitToning` loop. The
|
|
6
|
+
* host resolves the shadow/highlight hues to normalized RGB tint colours
|
|
7
|
+
* (`hsv→rgb` at full saturation/value) and passes them as `vec3f`s; the shader
|
|
8
|
+
* weights each toward shadows/highlights by a balance-shifted luminance mask.
|
|
9
|
+
* Fragment, with the canonical optional mask slot.
|
|
10
|
+
*/
|
|
11
|
+
import tgpu from "typegpu";
|
|
12
|
+
import * as d from "typegpu/data";
|
|
13
|
+
import { defineModule } from "../../../../module.js";
|
|
14
|
+
import { WGSL_LUMA709 } from "../../../../shared/lumaWgsl.js";
|
|
15
|
+
export const SplitToningParams = d.struct({
|
|
16
|
+
shadowColor: d.vec3f,
|
|
17
|
+
shadowSat: d.f32,
|
|
18
|
+
highlightColor: d.vec3f,
|
|
19
|
+
highlightSat: d.f32,
|
|
20
|
+
balance: d.f32
|
|
21
|
+
});
|
|
22
|
+
const layout = tgpu.bindGroupLayout({
|
|
23
|
+
params: { uniform: SplitToningParams },
|
|
24
|
+
source: { texture: "float" },
|
|
25
|
+
mask: { texture: "float" },
|
|
26
|
+
samp: { sampler: "filtering" }
|
|
27
|
+
});
|
|
28
|
+
const samplerDescriptor = {
|
|
29
|
+
magFilter: "linear",
|
|
30
|
+
minFilter: "linear",
|
|
31
|
+
addressModeU: "clamp-to-edge",
|
|
32
|
+
addressModeV: "clamp-to-edge"
|
|
33
|
+
};
|
|
34
|
+
export const colorSplitToningV1 = defineModule({
|
|
35
|
+
id: "color.splitToning",
|
|
36
|
+
version: 1,
|
|
37
|
+
surface: "internal",
|
|
38
|
+
category: "color",
|
|
39
|
+
linearity: "nonlinear-in-rgb",
|
|
40
|
+
kind: "fragment",
|
|
41
|
+
params: SplitToningParams,
|
|
42
|
+
paramDefaults: {
|
|
43
|
+
shadowColor: d.vec3f(0.5, 0.5, 0.5),
|
|
44
|
+
shadowSat: 0,
|
|
45
|
+
highlightColor: d.vec3f(0.5, 0.5, 0.5),
|
|
46
|
+
highlightSat: 0,
|
|
47
|
+
balance: 0
|
|
48
|
+
},
|
|
49
|
+
layout,
|
|
50
|
+
samplers: { samp: samplerDescriptor },
|
|
51
|
+
wgsl: /* wgsl */ `
|
|
52
|
+
${WGSL_LUMA709}
|
|
53
|
+
|
|
54
|
+
@fragment
|
|
55
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
56
|
+
let src = textureSample(layout.$.source, layout.$.samp, uv);
|
|
57
|
+
let coverage = textureSample(layout.$.mask, layout.$.samp, uv).a;
|
|
58
|
+
let p = layout.$.params;
|
|
59
|
+
let safeA = max(src.a, 1.0 / 255.0);
|
|
60
|
+
let straight = src.rgb / safeA;
|
|
61
|
+
let lum = luma709(straight);
|
|
62
|
+
let balOff = p.balance * 0.25;
|
|
63
|
+
let shMask = clamp((0.5 + balOff - lum) * 2.0, 0.0, 1.0);
|
|
64
|
+
let hlMask = clamp((lum - 0.5 + balOff) * 2.0, 0.0, 1.0);
|
|
65
|
+
let rgb = straight
|
|
66
|
+
+ shMask * (p.shadowColor - vec3f(0.5)) * p.shadowSat
|
|
67
|
+
+ hlMask * (p.highlightColor - vec3f(0.5)) * p.highlightSat;
|
|
68
|
+
let mixed = mix(straight, rgb, coverage);
|
|
69
|
+
return vec4f(clamp(mixed, vec3f(0.0), vec3f(1.0)) * src.a, src.a);
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
io: {
|
|
73
|
+
inputs: {
|
|
74
|
+
source: {
|
|
75
|
+
colorSpace: "srgb",
|
|
76
|
+
alpha: "premultiplied",
|
|
77
|
+
bindingKinds: ["texture_2d"]
|
|
78
|
+
},
|
|
79
|
+
mask: {
|
|
80
|
+
colorSpace: "srgb",
|
|
81
|
+
alpha: "premultiplied",
|
|
82
|
+
bindingKinds: ["texture_2d"],
|
|
83
|
+
optional: true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
output: {
|
|
87
|
+
colorSpace: "srgb",
|
|
88
|
+
alpha: "premultiplied",
|
|
89
|
+
format: "rgba8unorm",
|
|
90
|
+
dimensions: "same-as:source"
|
|
91
|
+
},
|
|
92
|
+
rod: "same-as:source"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/color/splitToning/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,KAAK;IACpB,SAAS,EAAE,CAAC,CAAC,GAAG;IAChB,cAAc,EAAE,CAAC,CAAC,KAAK;IACvB,YAAY,EAAE,CAAC,CAAC,GAAG;IACnB,OAAO,EAAE,CAAC,CAAC,GAAG;CACf,CAAC,CAAC;AAE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YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,QAAQ,EAAE,IAAI;aACf;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,gBAAgB;SAC7B;QACD,GAAG,EAAE,gBAAgB;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `filters.blur.gaussian@1` — separable Gaussian blur (one axis per dispatch).
|
|
3
|
+
*
|
|
4
|
+
* Migrated verbatim from the timeline preview's `blurComputeShader`. The host
|
|
5
|
+
* runs it twice — horizontal (`direction = (1,0)`) then vertical
|
|
6
|
+
* (`direction = (0,1)`) — sharing the same module. The hand-packed uniform is
|
|
7
|
+
* replaced by the TypeGPU `BlurParams` schema; the kernel math is unchanged.
|
|
8
|
+
*
|
|
9
|
+
* RoD is `same-as:source` for now; a real expand-by-radius declaration lands
|
|
10
|
+
* when a consumer needs region propagation (Phase 3+).
|
|
11
|
+
*/
|
|
12
|
+
import * as d from "typegpu/data";
|
|
13
|
+
export declare const BlurParams: d.WgslStruct<{
|
|
14
|
+
radius: d.F32;
|
|
15
|
+
sigma: d.F32;
|
|
16
|
+
direction: d.Vec2f;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const blurGaussianV1: import("../../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
19
|
+
radius: d.F32;
|
|
20
|
+
sigma: d.F32;
|
|
21
|
+
direction: d.Vec2f;
|
|
22
|
+
}>>;
|
|
23
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/shaders/filters/blur/gaussian/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,UAAU;;;;EAIrB,CAAC;AAQH,eAAO,MAAM,cAAc;;;;GAoFzB,CAAC"}
|