@luma.gl/engine 10.0.0-rc.2 → 10.0.0
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/THIRD-PARTY-NOTICES.md +7 -0
- package/dist/dist.dev.js +106 -37
- package/dist/dist.min.js +51 -51
- package/dist/effects/graph/gpu-effect-operation.cjs +79 -20
- package/dist/effects/graph/gpu-effect-operation.d.ts +44 -18
- package/dist/effects/graph/gpu-effect-operation.d.ts.map +1 -1
- package/dist/effects/graph/gpu-effect-operation.js +72 -8
- package/dist/effects/graph/gpu-effect-operation.js.map +1 -1
- package/dist/effects/index.cjs +62 -4
- package/dist/effects/index.cjs.map +3 -3
- package/dist/effects/index.d.ts +34 -13
- package/dist/effects/index.d.ts.map +1 -1
- package/dist/effects/index.js +23 -3
- package/dist/effects/index.js.map +1 -1
- package/dist/effects/passes/postprocessing/detail/detail-blur.cjs +95 -0
- package/dist/effects/passes/postprocessing/detail/detail-blur.d.ts +126 -0
- package/dist/effects/passes/postprocessing/detail/detail-blur.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/detail/detail-blur.js +63 -0
- package/dist/effects/passes/postprocessing/detail/detail-blur.js.map +1 -0
- package/dist/effects/passes/postprocessing/detail/high-pass.cjs +80 -0
- package/dist/effects/passes/postprocessing/detail/high-pass.d.ts +183 -0
- package/dist/effects/passes/postprocessing/detail/high-pass.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/detail/high-pass.js +59 -0
- package/dist/effects/passes/postprocessing/detail/high-pass.js.map +1 -0
- package/dist/effects/passes/postprocessing/detail/local-contrast.cjs +81 -0
- package/dist/effects/passes/postprocessing/detail/local-contrast.d.ts +163 -0
- package/dist/effects/passes/postprocessing/detail/local-contrast.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/detail/local-contrast.js +57 -0
- package/dist/effects/passes/postprocessing/detail/local-contrast.js.map +1 -0
- package/dist/effects/passes/postprocessing/detail/unsharp-mask.cjs +73 -0
- package/dist/effects/passes/postprocessing/detail/unsharp-mask.d.ts +43 -0
- package/dist/effects/passes/postprocessing/detail/unsharp-mask.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/detail/unsharp-mask.js +46 -0
- package/dist/effects/passes/postprocessing/detail/unsharp-mask.js.map +1 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/effects/passes/postprocessing/grading/curves.cjs +91 -0
- package/dist/effects/passes/postprocessing/grading/curves.d.ts +54 -0
- package/dist/effects/passes/postprocessing/grading/curves.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/grading/curves.js +73 -0
- package/dist/effects/passes/postprocessing/grading/curves.js.map +1 -0
- package/dist/effects/passes/postprocessing/grading/lift-gamma-gain.cjs +71 -0
- package/dist/effects/passes/postprocessing/grading/lift-gamma-gain.d.ts +76 -0
- package/dist/effects/passes/postprocessing/grading/lift-gamma-gain.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/grading/lift-gamma-gain.js +50 -0
- package/dist/effects/passes/postprocessing/grading/lift-gamma-gain.js.map +1 -0
- package/dist/effects/passes/postprocessing/grading/shadows-highlights.cjs +160 -0
- package/dist/effects/passes/postprocessing/grading/shadows-highlights.d.ts +232 -0
- package/dist/effects/passes/postprocessing/grading/shadows-highlights.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/grading/shadows-highlights.js +138 -0
- package/dist/effects/passes/postprocessing/grading/shadows-highlights.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/chromatic-aberration.cjs +84 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/chromatic-aberration.d.ts +36 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/chromatic-aberration.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/chromatic-aberration.js +58 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/chromatic-aberration.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/levels.cjs +106 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/levels.d.ts +105 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/levels.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/levels.js +89 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/levels.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/lut-color-grading.cjs +327 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/lut-color-grading.d.ts +201 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/lut-color-grading.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/lut-color-grading.js +296 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/lut-color-grading.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/output-dithering.cjs +85 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/output-dithering.d.ts +36 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/output-dithering.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/output-dithering.js +59 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/output-dithering.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/pack-color-lut.cjs +58 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/pack-color-lut.d.ts +27 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/pack-color-lut.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/pack-color-lut.js +45 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/pack-color-lut.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/posterize.cjs +64 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/posterize.d.ts +48 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/posterize.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/posterize.js +42 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/posterize.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/sharpen.cjs +110 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sharpen.d.ts +214 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sharpen.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sharpen.js +89 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sharpen.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/threshold.cjs +62 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/threshold.d.ts +47 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/threshold.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/threshold.js +40 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/threshold.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts +6 -6
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts +2 -2
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.cjs +8 -6
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.d.ts +7 -7
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.js +8 -6
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-warp-filters/displacement-map.cjs +79 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/displacement-map.d.ts +59 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/displacement-map.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/displacement-map.js +63 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/displacement-map.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.js.map +1 -1
- package/dist/effects/passes/postprocessing/layer-styles/bevel.cjs +100 -0
- package/dist/effects/passes/postprocessing/layer-styles/bevel.d.ts +73 -0
- package/dist/effects/passes/postprocessing/layer-styles/bevel.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/layer-styles/bevel.js +78 -0
- package/dist/effects/passes/postprocessing/layer-styles/bevel.js.map +1 -0
- package/dist/effects/passes/postprocessing/layer-styles/drop-shadow.cjs +180 -0
- package/dist/effects/passes/postprocessing/layer-styles/drop-shadow.d.ts +152 -0
- package/dist/effects/passes/postprocessing/layer-styles/drop-shadow.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/layer-styles/drop-shadow.js +157 -0
- package/dist/effects/passes/postprocessing/layer-styles/drop-shadow.js.map +1 -0
- package/dist/effects/passes/postprocessing/optical/lens-flare.cjs +67 -0
- package/dist/effects/passes/postprocessing/optical/lens-flare.d.ts +181 -0
- package/dist/effects/passes/postprocessing/optical/lens-flare.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/optical/lens-flare.js +52 -0
- package/dist/effects/passes/postprocessing/optical/lens-flare.js.map +1 -0
- package/dist/effects/passes/postprocessing/optical/light-shafts.cjs +138 -0
- package/dist/effects/passes/postprocessing/optical/light-shafts.d.ts +138 -0
- package/dist/effects/passes/postprocessing/optical/light-shafts.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/optical/light-shafts.js +119 -0
- package/dist/effects/passes/postprocessing/optical/light-shafts.js.map +1 -0
- package/dist/effects/passes/postprocessing/optical/optical-textures.cjs +104 -0
- package/dist/effects/passes/postprocessing/optical/optical-textures.d.ts +43 -0
- package/dist/effects/passes/postprocessing/optical/optical-textures.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/optical/optical-textures.js +69 -0
- package/dist/effects/passes/postprocessing/optical/optical-textures.js.map +1 -0
- package/dist/effects/passes/postprocessing/optical/selective-glow.cjs +64 -0
- package/dist/effects/passes/postprocessing/optical/selective-glow.d.ts +190 -0
- package/dist/effects/passes/postprocessing/optical/selective-glow.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/optical/selective-glow.js +49 -0
- package/dist/effects/passes/postprocessing/optical/selective-glow.js.map +1 -0
- package/dist/effects/passes/postprocessing/smaa.cjs +279 -0
- package/dist/effects/passes/postprocessing/smaa.d.ts +95 -0
- package/dist/effects/passes/postprocessing/smaa.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/smaa.js +253 -0
- package/dist/effects/passes/postprocessing/smaa.js.map +1 -0
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.cjs +18 -4
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +28 -5
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js +17 -3
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js.map +1 -1
- package/dist/effects/passes/screen-space/copy-pass.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/copy-pass.js.map +1 -1
- package/dist/effects/passes/screen-space/depth-aware-blur.cjs +0 -7
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts +0 -106
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/depth-aware-blur.js +0 -6
- package/dist/effects/passes/screen-space/depth-aware-blur.js.map +1 -1
- package/dist/effects/passes/screen-space/dof.cjs +2 -9
- package/dist/effects/passes/screen-space/dof.d.ts +1 -123
- package/dist/effects/passes/screen-space/dof.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/dof.js +1 -7
- package/dist/effects/passes/screen-space/dof.js.map +1 -1
- package/dist/effects/passes/screen-space/gtao.cjs +11 -2
- package/dist/effects/passes/screen-space/gtao.d.ts +37 -6
- package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/gtao.js +11 -2
- package/dist/effects/passes/screen-space/gtao.js.map +1 -1
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts +2 -2
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.js.map +1 -1
- package/dist/effects/passes/screen-space/motion-blur.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/motion-blur.js.map +1 -1
- package/dist/effects/passes/screen-space/outlines.d.ts +2 -2
- package/dist/effects/passes/screen-space/outlines.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/outlines.js.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.cjs +12 -2
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +26 -5
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js +12 -2
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.cjs +14 -2
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +26 -5
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.js +14 -2
- package/dist/effects/passes/screen-space/screen-space-reflections.js.map +1 -1
- package/dist/effects/passes/screen-space/selection-outline.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/selection-outline.js.map +1 -1
- package/dist/effects/passes/screen-space/ssao.d.ts +2 -2
- package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/ssao.js.map +1 -1
- package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/ssr-camera-temporal.js.map +1 -1
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/temporal-antialiasing.js.map +1 -1
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts +2 -2
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/volumetric-fog.js.map +1 -1
- package/dist/effects/scene-effect-attachments.cjs +15 -0
- package/dist/effects/scene-effect-attachments.d.ts +23 -0
- package/dist/effects/scene-effect-attachments.d.ts.map +1 -0
- package/dist/effects/scene-effect-attachments.js +5 -0
- package/dist/effects/scene-effect-attachments.js.map +1 -0
- package/dist/graph/models/index.cjs.map +1 -1
- package/dist/graph/physics/index.cjs.map +1 -1
- package/dist/graph/tables/index.cjs.map +1 -1
- package/dist/index.cjs +0 -3
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lighting/clustered-light-grid.cjs +2 -6
- package/dist/lighting/clustered-light-grid.d.ts +1 -5
- package/dist/lighting/clustered-light-grid.d.ts.map +1 -1
- package/dist/lighting/clustered-light-grid.js +2 -6
- package/dist/lighting/clustered-light-grid.js.map +1 -1
- package/dist/lighting/contact-shadow-composite.cjs +8 -8
- package/dist/lighting/contact-shadow-composite.d.ts +10 -22
- package/dist/lighting/contact-shadow-composite.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-composite.js +8 -8
- package/dist/lighting/contact-shadow-composite.js.map +1 -1
- package/dist/lighting/contact-shadow-pass.cjs +6 -6
- package/dist/lighting/contact-shadow-pass.js +6 -6
- package/dist/lighting/contact-shadow-pass.js.map +1 -1
- package/dist/lighting/index.cjs.map +3 -3
- package/dist/lighting/index.d.ts +2 -2
- package/dist/lighting/index.d.ts.map +1 -1
- package/dist/lighting/index.js.map +1 -1
- package/dist/passes/effect-renderer.cjs +43 -8
- package/dist/passes/effect-renderer.d.ts +41 -17
- package/dist/passes/effect-renderer.d.ts.map +1 -1
- package/dist/passes/effect-renderer.js +47 -8
- package/dist/passes/effect-renderer.js.map +1 -1
- package/dist/passes/{shader-pass-renderer.cjs → fullscreen-effect-executor.cjs} +39 -28
- package/dist/passes/{shader-pass-renderer.d.ts → fullscreen-effect-executor.d.ts} +48 -37
- package/dist/passes/fullscreen-effect-executor.d.ts.map +1 -0
- package/dist/passes/{shader-pass-renderer.js → fullscreen-effect-executor.js} +30 -26
- package/dist/passes/fullscreen-effect-executor.js.map +1 -0
- package/dist/passes/fullscreen-effect-module.cjs +15 -0
- package/dist/passes/fullscreen-effect-module.d.ts +47 -0
- package/dist/passes/fullscreen-effect-module.d.ts.map +1 -0
- package/dist/passes/fullscreen-effect-module.js +5 -0
- package/dist/passes/fullscreen-effect-module.js.map +1 -0
- package/dist/passes/fullscreen-effect-plan.cjs +15 -0
- package/dist/passes/fullscreen-effect-plan.d.ts +49 -0
- package/dist/passes/fullscreen-effect-plan.d.ts.map +1 -0
- package/dist/passes/fullscreen-effect-plan.js +5 -0
- package/dist/passes/fullscreen-effect-plan.js.map +1 -0
- package/dist/passes/get-fragment-shader.cjs +3 -0
- package/dist/passes/get-fragment-shader.d.ts +2 -2
- package/dist/passes/get-fragment-shader.d.ts.map +1 -1
- package/dist/passes/get-fragment-shader.js +3 -0
- package/dist/passes/get-fragment-shader.js.map +1 -1
- package/dist/shader-inputs.cjs +1 -1
- package/dist/shader-inputs.d.ts +1 -1
- package/dist/shader-inputs.js +1 -1
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts +1 -0
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts.map +1 -1
- package/dist/text/fonts/atlas/browser-font-atlas.js +1 -0
- package/dist/text/fonts/atlas/browser-font-atlas.js.map +1 -1
- package/dist/text/fonts/build-sdf-font-atlas.cjs +1 -1
- package/dist/text/fonts/build-sdf-font-atlas.d.ts.map +1 -1
- package/dist/text/fonts/build-sdf-font-atlas.js +4 -2
- package/dist/text/fonts/build-sdf-font-atlas.js.map +1 -1
- package/dist/text/fonts/index.cjs +2 -0
- package/dist/text/fonts/index.cjs.map +1 -1
- package/dist/text/fonts/index.d.ts +1 -1
- package/dist/text/fonts/index.d.ts.map +1 -1
- package/dist/text/fonts/index.js +1 -1
- package/dist/text/fonts/index.js.map +1 -1
- package/dist/text/index.cjs.map +1 -1
- package/dist/utils/shader-module-utils.cjs +3 -0
- package/dist/utils/shader-module-utils.d.ts.map +1 -1
- package/dist/utils/shader-module-utils.js +3 -0
- package/dist/utils/shader-module-utils.js.map +1 -1
- package/licenses/smaa.txt +24 -0
- package/package.json +6 -6
- package/src/effects/README.md +2 -2
- package/src/effects/graph/gpu-effect-operation.ts +152 -33
- package/src/effects/index.ts +85 -14
- package/src/effects/passes/postprocessing/detail/detail-blur.ts +77 -0
- package/src/effects/passes/postprocessing/detail/high-pass.ts +86 -0
- package/src/effects/passes/postprocessing/detail/local-contrast.ts +79 -0
- package/src/effects/passes/postprocessing/detail/unsharp-mask.ts +56 -0
- package/src/effects/passes/postprocessing/fxaa/fxaa.ts +2 -2
- package/src/effects/passes/postprocessing/grading/curves.ts +83 -0
- package/src/effects/passes/postprocessing/grading/lift-gamma-gain.ts +68 -0
- package/src/effects/passes/postprocessing/grading/shadows-highlights.ts +169 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/chromatic-aberration.ts +68 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/denoise.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/huesaturation.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/levels.ts +111 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/lut-color-grading.ts +347 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/noise.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/output-dithering.ts +69 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/pack-color-lut.ts +67 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/persistence.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/posterize.ts +52 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/sepia.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/sharpen.ts +112 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/threshold.ts +50 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/tone-mapping.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/vibrance.ts +2 -2
- package/src/effects/passes/postprocessing/image-adjust-filters/vignette.ts +2 -2
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.ts +21 -17
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.ts +2 -2
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.ts +13 -11
- package/src/effects/passes/postprocessing/image-blur-filters/bloom.ts +2 -2
- package/src/effects/passes/postprocessing/image-blur-filters/gaussianblur.ts +2 -2
- package/src/effects/passes/postprocessing/image-blur-filters/tiltshift.ts +2 -2
- package/src/effects/passes/postprocessing/image-blur-filters/triangleblur.ts +2 -2
- package/src/effects/passes/postprocessing/image-blur-filters/zoomblur.ts +2 -2
- package/src/effects/passes/postprocessing/image-fun-filters/colorhalftone.ts +2 -2
- package/src/effects/passes/postprocessing/image-fun-filters/dotscreen.ts +2 -2
- package/src/effects/passes/postprocessing/image-fun-filters/edgework.ts +2 -2
- package/src/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +2 -2
- package/src/effects/passes/postprocessing/image-fun-filters/ink.ts +2 -2
- package/src/effects/passes/postprocessing/image-fun-filters/magnify.ts +2 -2
- package/src/effects/passes/postprocessing/image-warp-filters/bulgepinch.ts +2 -2
- package/src/effects/passes/postprocessing/image-warp-filters/displacement-map.ts +74 -0
- package/src/effects/passes/postprocessing/image-warp-filters/swirl.ts +2 -2
- package/src/effects/passes/postprocessing/image-warp-filters/warp.ts +2 -2
- package/src/effects/passes/postprocessing/layer-styles/bevel.ts +92 -0
- package/src/effects/passes/postprocessing/layer-styles/drop-shadow.ts +176 -0
- package/src/effects/passes/postprocessing/optical/lens-flare.ts +64 -0
- package/src/effects/passes/postprocessing/optical/light-shafts.ts +139 -0
- package/src/effects/passes/postprocessing/optical/optical-textures.ts +74 -0
- package/src/effects/passes/postprocessing/optical/selective-glow.ts +62 -0
- package/src/effects/passes/postprocessing/smaa.ts +265 -0
- package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +3 -3
- package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +28 -12
- package/src/effects/passes/screen-space/copy-pass.ts +2 -2
- package/src/effects/passes/screen-space/depth-aware-blur.ts +2 -9
- package/src/effects/passes/screen-space/dof.ts +12 -11
- package/src/effects/passes/screen-space/gtao.ts +22 -12
- package/src/effects/passes/screen-space/hdr-auto-exposure.ts +8 -8
- package/src/effects/passes/screen-space/height-fog.ts +3 -3
- package/src/effects/passes/screen-space/motion-blur.ts +2 -2
- package/src/effects/passes/screen-space/outlines.ts +6 -6
- package/src/effects/passes/screen-space/screen-space-global-illumination.ts +23 -12
- package/src/effects/passes/screen-space/screen-space-reflections.ts +24 -12
- package/src/effects/passes/screen-space/selection-outline.ts +2 -2
- package/src/effects/passes/screen-space/ssao.ts +6 -6
- package/src/effects/passes/screen-space/ssr-camera-temporal.ts +4 -4
- package/src/effects/passes/screen-space/temporal-antialiasing.ts +3 -3
- package/src/effects/passes/screen-space/volumetric-fog.ts +5 -5
- package/src/effects/scene-effect-attachments.ts +26 -0
- package/src/index.ts +3 -6
- package/src/lighting/clustered-light-grid.ts +2 -10
- package/src/lighting/contact-shadow-composite.ts +11 -11
- package/src/lighting/contact-shadow-pass.ts +6 -6
- package/src/lighting/index.ts +2 -3
- package/src/passes/effect-renderer.ts +106 -34
- package/src/passes/{shader-pass-renderer.ts → fullscreen-effect-executor.ts} +115 -75
- package/src/passes/fullscreen-effect-module.ts +71 -0
- package/src/passes/fullscreen-effect-plan.ts +59 -0
- package/src/passes/get-fragment-shader.ts +7 -2
- package/src/shader-inputs.ts +1 -1
- package/src/text/fonts/atlas/browser-font-atlas.ts +1 -0
- package/src/text/fonts/build-sdf-font-atlas.ts +4 -2
- package/src/text/fonts/index.ts +1 -0
- package/src/utils/shader-module-utils.ts +3 -0
- package/dist/passes/shader-pass-renderer.d.ts.map +0 -1
- package/dist/passes/shader-pass-renderer.js.map +0 -1
|
@@ -13,12 +13,11 @@ import type {
|
|
|
13
13
|
} from '@luma.gl/core';
|
|
14
14
|
import {Buffer, Device, Framebuffer, RenderPass, Texture} from '@luma.gl/core';
|
|
15
15
|
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from '@luma.gl/shaders';
|
|
16
|
+
FullscreenEffectModule,
|
|
17
|
+
EffectInputSource,
|
|
18
|
+
EffectResource
|
|
19
|
+
} from './fullscreen-effect-module';
|
|
20
|
+
import type {FullscreenEffectComputeStage, FullscreenEffectPlan} from './fullscreen-effect-plan';
|
|
22
21
|
import {initializeShaderModule} from '@luma.gl/shaders';
|
|
23
22
|
import {ShaderInputs} from '../shader-inputs';
|
|
24
23
|
import {DynamicTexture} from '@luma.gl/core/dynamic';
|
|
@@ -31,16 +30,16 @@ import {BackgroundTextureModel} from '../models/billboard-texture-model';
|
|
|
31
30
|
import {getFragmentShaderForRenderPass} from './get-fragment-shader';
|
|
32
31
|
import {textureTransform} from './texture-transform-module';
|
|
33
32
|
|
|
34
|
-
type ShaderPassLike =
|
|
35
|
-
type ComputeStage = Omit<
|
|
36
|
-
type
|
|
33
|
+
type ShaderPassLike = FullscreenEffectModule | FullscreenEffectPlan;
|
|
34
|
+
type ComputeStage = Omit<FullscreenEffectComputeStage, 'replacedPasses'>;
|
|
35
|
+
type FullscreenEffectDraw = NonNullable<FullscreenEffectModule['passes']>[0];
|
|
37
36
|
|
|
38
37
|
/** @internal One resolved fullscreen draw, before GPU objects are constructed. */
|
|
39
38
|
export type PlannedFullscreenPass = {
|
|
40
39
|
ownerName: string;
|
|
41
|
-
shaderPass:
|
|
42
|
-
subPass:
|
|
43
|
-
inputs?: Partial<Record<string,
|
|
40
|
+
shaderPass: FullscreenEffectModule;
|
|
41
|
+
subPass: FullscreenEffectDraw;
|
|
42
|
+
inputs?: Partial<Record<string, EffectInputSource<string>>>;
|
|
44
43
|
output?: 'previous' | string;
|
|
45
44
|
uniforms?: Record<string, unknown>;
|
|
46
45
|
};
|
|
@@ -51,7 +50,7 @@ type EffectiveSubPass = Omit<PlannedFullscreenPass, 'subPass'> & {
|
|
|
51
50
|
|
|
52
51
|
type ManagedRenderTarget = {
|
|
53
52
|
name: string;
|
|
54
|
-
spec:
|
|
53
|
+
spec: EffectResource;
|
|
55
54
|
texture: Texture;
|
|
56
55
|
framebuffer: Framebuffer;
|
|
57
56
|
historyTexture?: Texture;
|
|
@@ -62,10 +61,20 @@ type ManagedRenderTarget = {
|
|
|
62
61
|
|
|
63
62
|
const RESERVED_RENDER_TARGET_NAMES = new Set(['original', 'previous']);
|
|
64
63
|
|
|
65
|
-
/**
|
|
66
|
-
export type
|
|
64
|
+
/** Per-occurrence inputs keyed by shader module or binding name. */
|
|
65
|
+
export type EffectOccurrenceOverrides<BindingValue> = {
|
|
66
|
+
/** Overrides shared frame bindings for this occurrence. */
|
|
67
|
+
bindings?: Readonly<Record<string, BindingValue>>;
|
|
68
|
+
/** Overrides shared frame uniforms for this occurrence. */
|
|
69
|
+
uniforms?: Readonly<Record<string, Record<string, unknown>>>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/** Construction props for {@link FullscreenEffectExecutor}. */
|
|
73
|
+
export type FullscreenEffectExecutorProps = {
|
|
67
74
|
/** List of ShaderPasses or CompositeShaderPasses to apply to the sourceTexture */
|
|
68
75
|
shaderPasses: ShaderPassLike[];
|
|
76
|
+
/** Static overrides parallel to shaderPasses. */
|
|
77
|
+
occurrences?: readonly (EffectOccurrenceOverrides<EffectBinding> | undefined)[];
|
|
69
78
|
/** Optional typed ShaderInputs object for setting uniforms */
|
|
70
79
|
shaderInputs?: ShaderInputs;
|
|
71
80
|
/** Format of the shared previous-chain textures. Defaults to the canvas-preferred format. */
|
|
@@ -74,16 +83,16 @@ export type ShaderPassRendererProps = {
|
|
|
74
83
|
flipY?: boolean;
|
|
75
84
|
};
|
|
76
85
|
|
|
77
|
-
/** Source texture accepted by {@link
|
|
78
|
-
export type
|
|
86
|
+
/** Source texture accepted by {@link FullscreenEffectExecutor}. */
|
|
87
|
+
export type EffectSourceTexture = DynamicTexture | Texture;
|
|
79
88
|
/** Binding accepted by shader pass inputs, including deferred texture binding sources. */
|
|
80
|
-
export type
|
|
89
|
+
export type EffectBinding = Binding | TextureBindingSource;
|
|
81
90
|
|
|
82
|
-
/** Per-frame inputs accepted by {@link
|
|
83
|
-
export type
|
|
84
|
-
sourceTexture:
|
|
91
|
+
/** Per-frame inputs accepted by {@link FullscreenEffectExecutor}. */
|
|
92
|
+
export type FullscreenEffectExecutorRenderOptions = {
|
|
93
|
+
sourceTexture: EffectSourceTexture;
|
|
85
94
|
uniforms?: Record<string, Record<string, unknown>>;
|
|
86
|
-
bindings?: Record<string,
|
|
95
|
+
bindings?: Record<string, EffectBinding>;
|
|
87
96
|
/** Invalidates all persistent render targets before rendering this frame. */
|
|
88
97
|
resetHistory?: boolean;
|
|
89
98
|
};
|
|
@@ -93,21 +102,21 @@ export type ShaderPassRendererRenderOptions = {
|
|
|
93
102
|
*
|
|
94
103
|
* The renderer owns:
|
|
95
104
|
* - a shared ping-pong pair for the logical `previous` chain
|
|
96
|
-
* - any named render targets declared by `
|
|
105
|
+
* - any named render targets declared by `FullscreenEffectPlan`
|
|
97
106
|
* - a fullscreen model used both to seed the chain and to present to the screen
|
|
98
107
|
*
|
|
99
108
|
* Per-draw `uniforms` and `bindings` passed to `renderToTexture()` or `renderToScreen()` are
|
|
100
109
|
* merged on top of the renderer's `shaderInputs`, which lets callers reuse one renderer instance
|
|
101
110
|
* while varying pass inputs frame to frame.
|
|
102
111
|
*/
|
|
103
|
-
export class
|
|
112
|
+
export class FullscreenEffectExecutor {
|
|
104
113
|
device: Device;
|
|
105
114
|
shaderInputs: ShaderInputs;
|
|
106
115
|
passRenderers: PassRenderer[];
|
|
107
116
|
swapFramebuffers: SwapFramebuffers;
|
|
108
117
|
textureModel: BackgroundTextureModel;
|
|
109
118
|
|
|
110
|
-
constructor(device: Device, props:
|
|
119
|
+
constructor(device: Device, props: FullscreenEffectExecutorProps) {
|
|
111
120
|
this.device = device;
|
|
112
121
|
|
|
113
122
|
const executableShaderPasses = getExecutableShaderPasses(props.shaderPasses);
|
|
@@ -120,8 +129,9 @@ export class ShaderPassRenderer {
|
|
|
120
129
|
this.shaderInputs = props.shaderInputs || new ShaderInputs(modules);
|
|
121
130
|
|
|
122
131
|
const size = device.getCanvasContext().getDrawingBufferSize();
|
|
132
|
+
const colorFormat = props.colorFormat ?? device.preferredColorFormat;
|
|
123
133
|
this.swapFramebuffers = new SwapFramebuffers(device, {
|
|
124
|
-
colorAttachments: [
|
|
134
|
+
colorAttachments: [colorFormat],
|
|
125
135
|
width: size[0],
|
|
126
136
|
height: size[1]
|
|
127
137
|
});
|
|
@@ -133,11 +143,19 @@ export class ShaderPassRenderer {
|
|
|
133
143
|
|
|
134
144
|
const flipY = props.flipY ?? device.type === 'webgpu';
|
|
135
145
|
this.passRenderers = props.shaderPasses.map(
|
|
136
|
-
|
|
146
|
+
(shaderPass, index) =>
|
|
147
|
+
new PassRenderer(
|
|
148
|
+
device,
|
|
149
|
+
shaderPass,
|
|
150
|
+
this.shaderInputs,
|
|
151
|
+
flipY,
|
|
152
|
+
colorFormat,
|
|
153
|
+
props.occurrences?.[index]
|
|
154
|
+
)
|
|
137
155
|
);
|
|
138
156
|
}
|
|
139
157
|
|
|
140
|
-
/** Destroys resources created by this
|
|
158
|
+
/** Destroys resources created by this FullscreenEffectExecutor */
|
|
141
159
|
destroy() {
|
|
142
160
|
for (const passRenderer of this.passRenderers) {
|
|
143
161
|
passRenderer.destroy();
|
|
@@ -161,7 +179,7 @@ export class ShaderPassRenderer {
|
|
|
161
179
|
}
|
|
162
180
|
}
|
|
163
181
|
|
|
164
|
-
renderToScreen(options:
|
|
182
|
+
renderToScreen(options: FullscreenEffectExecutorRenderOptions): boolean {
|
|
165
183
|
return this.encodeToScreen(this.device.commandEncoder, options);
|
|
166
184
|
}
|
|
167
185
|
|
|
@@ -172,7 +190,7 @@ export class ShaderPassRenderer {
|
|
|
172
190
|
*/
|
|
173
191
|
encodeToScreen(
|
|
174
192
|
commandEncoder: CommandEncoder,
|
|
175
|
-
options:
|
|
193
|
+
options: FullscreenEffectExecutorRenderOptions
|
|
176
194
|
): boolean {
|
|
177
195
|
const outputTexture = this.encodeToTexture(commandEncoder, options);
|
|
178
196
|
if (!outputTexture) {
|
|
@@ -184,7 +202,7 @@ export class ShaderPassRenderer {
|
|
|
184
202
|
}
|
|
185
203
|
|
|
186
204
|
/** @internal Records presentation of a completed effect output. */
|
|
187
|
-
|
|
205
|
+
drawOutput(
|
|
188
206
|
commandEncoder: CommandEncoder,
|
|
189
207
|
outputTexture: Texture,
|
|
190
208
|
target: Framebuffer | null
|
|
@@ -197,7 +215,7 @@ export class ShaderPassRenderer {
|
|
|
197
215
|
this.textureModel.setProps({backgroundTexture: outputTexture});
|
|
198
216
|
this.textureModel.predraw(commandEncoder);
|
|
199
217
|
const renderPass = commandEncoder.beginRenderPass({
|
|
200
|
-
id: '
|
|
218
|
+
id: 'fullscreen-effect-executor-to-screen',
|
|
201
219
|
framebuffer,
|
|
202
220
|
clearDepth: false
|
|
203
221
|
});
|
|
@@ -211,7 +229,7 @@ export class ShaderPassRenderer {
|
|
|
211
229
|
/** Runs the shaderPasses in sequence on the sourceTexture and returns a texture with the results.
|
|
212
230
|
* @returns null if the the sourceTexture has not yet been loaded
|
|
213
231
|
*/
|
|
214
|
-
renderToTexture(options:
|
|
232
|
+
renderToTexture(options: FullscreenEffectExecutorRenderOptions): Texture | null {
|
|
215
233
|
return this.encodeToTexture(this.device.commandEncoder, options);
|
|
216
234
|
}
|
|
217
235
|
|
|
@@ -222,10 +240,12 @@ export class ShaderPassRenderer {
|
|
|
222
240
|
*/
|
|
223
241
|
encodeToTexture(
|
|
224
242
|
commandEncoder: CommandEncoder,
|
|
225
|
-
options:
|
|
243
|
+
options: FullscreenEffectExecutorRenderOptions
|
|
226
244
|
): Texture | null {
|
|
227
245
|
if (commandEncoder.device !== this.device) {
|
|
228
|
-
throw new Error(
|
|
246
|
+
throw new Error(
|
|
247
|
+
'FullscreenEffectExecutor command encoder must belong to the renderer device'
|
|
248
|
+
);
|
|
229
249
|
}
|
|
230
250
|
const {sourceTexture} = options;
|
|
231
251
|
if (sourceTexture instanceof DynamicTexture && !sourceTexture.isReady) {
|
|
@@ -251,7 +271,7 @@ export class ShaderPassRenderer {
|
|
|
251
271
|
|
|
252
272
|
const sourceFramebuffer = getSeedFramebuffer(this.swapFramebuffers, originalTexture);
|
|
253
273
|
const seedRenderPass = commandEncoder.beginRenderPass({
|
|
254
|
-
id: '
|
|
274
|
+
id: 'fullscreen-effect-executor-seed-source',
|
|
255
275
|
framebuffer: sourceFramebuffer,
|
|
256
276
|
clearColor: [0, 0, 0, 1],
|
|
257
277
|
clearDepth: false
|
|
@@ -292,7 +312,8 @@ export class ShaderPassRenderer {
|
|
|
292
312
|
const resolvedUniforms = resolveExecutionUniforms(
|
|
293
313
|
this.shaderInputs,
|
|
294
314
|
execution,
|
|
295
|
-
options.uniforms || {}
|
|
315
|
+
options.uniforms || {},
|
|
316
|
+
passRenderer.occurrence?.uniforms
|
|
296
317
|
);
|
|
297
318
|
|
|
298
319
|
execution.subPassRenderer.prepare({
|
|
@@ -305,7 +326,7 @@ export class ShaderPassRenderer {
|
|
|
305
326
|
uniforms: resolvedUniforms
|
|
306
327
|
});
|
|
307
328
|
const renderPass = commandEncoder.beginRenderPass({
|
|
308
|
-
id: '
|
|
329
|
+
id: 'fullscreen-effect-executor-run-pass',
|
|
309
330
|
framebuffer: outputFramebuffer,
|
|
310
331
|
clearColor: [0, 0, 0, 1],
|
|
311
332
|
clearDepth: 1
|
|
@@ -332,7 +353,7 @@ export class ShaderPassRenderer {
|
|
|
332
353
|
}
|
|
333
354
|
}
|
|
334
355
|
|
|
335
|
-
/** Renders one `
|
|
356
|
+
/** Renders one `FullscreenEffectModule` or `FullscreenEffectPlan` entry in the chain. */
|
|
336
357
|
class PassRenderer {
|
|
337
358
|
device: Device;
|
|
338
359
|
shaderInputs: ShaderInputs;
|
|
@@ -345,7 +366,9 @@ class PassRenderer {
|
|
|
345
366
|
device: Device,
|
|
346
367
|
passDefinition: ShaderPassLike,
|
|
347
368
|
shaderInputs: ShaderInputs,
|
|
348
|
-
flipY: boolean
|
|
369
|
+
flipY: boolean,
|
|
370
|
+
colorFormat: TextureFormatColor,
|
|
371
|
+
readonly occurrence?: EffectOccurrenceOverrides<EffectBinding>
|
|
349
372
|
) {
|
|
350
373
|
this.device = device;
|
|
351
374
|
this.shaderInputs = shaderInputs;
|
|
@@ -353,8 +376,12 @@ class PassRenderer {
|
|
|
353
376
|
|
|
354
377
|
if (isCompositeShaderPass(passDefinition)) {
|
|
355
378
|
validateRenderTargetNames(passDefinition.name, passDefinition.renderTargets || {});
|
|
356
|
-
this.renderTargets = createManagedRenderTargets(
|
|
357
|
-
|
|
379
|
+
this.renderTargets = createManagedRenderTargets(
|
|
380
|
+
device,
|
|
381
|
+
passDefinition.renderTargets || {},
|
|
382
|
+
colorFormat
|
|
383
|
+
);
|
|
384
|
+
const {compute, passes} = planFullscreenPasses(device, passDefinition, {colorFormat});
|
|
358
385
|
if (compute) {
|
|
359
386
|
this.computeRenderer = new FullscreenComputePass(
|
|
360
387
|
device,
|
|
@@ -415,7 +442,8 @@ class PassRenderer {
|
|
|
415
442
|
this.computeRenderer.prepare(options.commandEncoder, sourceTexture.view, outputs, {
|
|
416
443
|
...this.shaderInputs.getUniformValues()[optimization.uniformModule],
|
|
417
444
|
...optimization.uniforms,
|
|
418
|
-
...options.runtimeUniforms[optimization.uniformModule]
|
|
445
|
+
...options.runtimeUniforms[optimization.uniformModule],
|
|
446
|
+
...this.occurrence?.uniforms?.[optimization.uniformModule]
|
|
419
447
|
});
|
|
420
448
|
const target = this.renderTargets[Object.values(optimization.outputs)[0]].texture;
|
|
421
449
|
const pass = options.commandEncoder.beginComputePass({id: optimization.name});
|
|
@@ -506,20 +534,20 @@ class PassRenderer {
|
|
|
506
534
|
originalTexture: Texture;
|
|
507
535
|
previousTexture: Texture;
|
|
508
536
|
outputTexture: Texture;
|
|
509
|
-
externalBindings: Record<string,
|
|
510
|
-
}): Record<string,
|
|
537
|
+
externalBindings: Record<string, EffectBinding>;
|
|
538
|
+
}): Record<string, EffectBinding> {
|
|
511
539
|
const {execution, originalTexture, previousTexture, outputTexture, externalBindings} = options;
|
|
512
540
|
const inputMap = execution.inputs || {sourceTexture: 'previous'};
|
|
513
541
|
const shaderInputBindings = this.shaderInputs.getModuleBindingValues(execution.shaderPass.name);
|
|
514
542
|
const externalBindingsForPass = Object.fromEntries(
|
|
515
|
-
Object.entries(externalBindings).filter(([name]) =>
|
|
543
|
+
Object.entries({...externalBindings, ...this.occurrence?.bindings}).filter(([name]) =>
|
|
516
544
|
execution.shaderPass.bindingLayout?.some(binding => binding.name === name)
|
|
517
545
|
)
|
|
518
546
|
);
|
|
519
547
|
// Shader-pass bindings stored in `shaderInputs` act as renderer-owned defaults. Per-draw
|
|
520
548
|
// external bindings can override those defaults for frame-specific resources, while routed
|
|
521
549
|
// logical inputs such as `sourceTexture` remain authoritative below.
|
|
522
|
-
const resolvedBindings: Record<string,
|
|
550
|
+
const resolvedBindings: Record<string, EffectBinding> = {
|
|
523
551
|
...shaderInputBindings,
|
|
524
552
|
...externalBindingsForPass
|
|
525
553
|
};
|
|
@@ -691,11 +719,16 @@ export class FullscreenComputePass {
|
|
|
691
719
|
/** @internal Shared fullscreen draw executable. */
|
|
692
720
|
export class SubPassRenderer {
|
|
693
721
|
model: ClipSpace;
|
|
694
|
-
shaderPass:
|
|
695
|
-
subPass:
|
|
722
|
+
shaderPass: FullscreenEffectModule;
|
|
723
|
+
subPass: FullscreenEffectDraw;
|
|
696
724
|
flipY: boolean;
|
|
697
725
|
|
|
698
|
-
constructor(
|
|
726
|
+
constructor(
|
|
727
|
+
device: Device,
|
|
728
|
+
shaderPass: FullscreenEffectModule,
|
|
729
|
+
subPass: FullscreenEffectDraw,
|
|
730
|
+
flipY: boolean
|
|
731
|
+
) {
|
|
699
732
|
initializeShaderModule(shaderPass);
|
|
700
733
|
this.shaderPass = shaderPass;
|
|
701
734
|
this.subPass = subPass;
|
|
@@ -725,7 +758,7 @@ export class SubPassRenderer {
|
|
|
725
758
|
|
|
726
759
|
prepare(options: {
|
|
727
760
|
commandEncoder: CommandEncoder;
|
|
728
|
-
bindings: Record<string,
|
|
761
|
+
bindings: Record<string, EffectBinding>;
|
|
729
762
|
textureScale: [number, number];
|
|
730
763
|
uniforms?: Record<string, unknown>;
|
|
731
764
|
}): void {
|
|
@@ -752,7 +785,7 @@ export class SubPassRenderer {
|
|
|
752
785
|
/** @internal Resolves compute selection and fullscreen draw routing for both executors. */
|
|
753
786
|
export function planFullscreenPasses(
|
|
754
787
|
device: Device,
|
|
755
|
-
effect:
|
|
788
|
+
effect: FullscreenEffectPlan,
|
|
756
789
|
options: {allowCompute?: boolean; colorFormat?: TextureFormatColor} = {}
|
|
757
790
|
): {compute?: ComputeStage; passes: PlannedFullscreenPass[]} {
|
|
758
791
|
const fallback = effect.initialPasses?.fragment ?? [];
|
|
@@ -780,9 +813,9 @@ export function planFullscreenPasses(
|
|
|
780
813
|
|
|
781
814
|
/** Applies step-level routing to the first input and last output of a shader pass. */
|
|
782
815
|
function planShaderSubpasses(
|
|
783
|
-
shaderPass:
|
|
816
|
+
shaderPass: FullscreenEffectModule,
|
|
784
817
|
ownerName: string,
|
|
785
|
-
step?:
|
|
818
|
+
step?: FullscreenEffectPlan['steps'][number]
|
|
786
819
|
): PlannedFullscreenPass[] {
|
|
787
820
|
const subPasses = shaderPass.passes ?? [];
|
|
788
821
|
return subPasses.map((subPass, index) => ({
|
|
@@ -795,7 +828,7 @@ function planShaderSubpasses(
|
|
|
795
828
|
}));
|
|
796
829
|
}
|
|
797
830
|
|
|
798
|
-
function getExecutableShaderPasses(shaderPasses: ShaderPassLike[]):
|
|
831
|
+
function getExecutableShaderPasses(shaderPasses: ShaderPassLike[]): FullscreenEffectModule[] {
|
|
799
832
|
return shaderPasses.flatMap(shaderPass =>
|
|
800
833
|
isCompositeShaderPass(shaderPass)
|
|
801
834
|
? [...(shaderPass.initialPasses?.fragment ?? []), ...shaderPass.steps].map(
|
|
@@ -805,14 +838,14 @@ function getExecutableShaderPasses(shaderPasses: ShaderPassLike[]): ShaderPass[]
|
|
|
805
838
|
);
|
|
806
839
|
}
|
|
807
840
|
|
|
808
|
-
function isCompositeShaderPass(shaderPass: ShaderPassLike): shaderPass is
|
|
841
|
+
function isCompositeShaderPass(shaderPass: ShaderPassLike): shaderPass is FullscreenEffectPlan {
|
|
809
842
|
return 'steps' in shaderPass;
|
|
810
843
|
}
|
|
811
844
|
|
|
812
845
|
/** @internal Returns whether a composite pass's optional compute path is valid for this device. */
|
|
813
846
|
export function supportsComputeOptimization(
|
|
814
847
|
device: Device,
|
|
815
|
-
compositeShaderPass:
|
|
848
|
+
compositeShaderPass: FullscreenEffectPlan,
|
|
816
849
|
colorFormat: TextureFormatColor = device.preferredColorFormat
|
|
817
850
|
): boolean {
|
|
818
851
|
const optimization = compositeShaderPass.initialPasses
|
|
@@ -845,21 +878,22 @@ export function supportsComputeOptimization(
|
|
|
845
878
|
}
|
|
846
879
|
|
|
847
880
|
function validateShaderPassDoesNotOwnRenderTargets(
|
|
848
|
-
shaderPass:
|
|
881
|
+
shaderPass: FullscreenEffectModule,
|
|
849
882
|
ownerName: string
|
|
850
883
|
): void {
|
|
851
|
-
const renderTargets = (
|
|
852
|
-
|
|
884
|
+
const renderTargets = (
|
|
885
|
+
shaderPass as FullscreenEffectModule & {renderTargets?: Record<string, unknown>}
|
|
886
|
+
).renderTargets;
|
|
853
887
|
if (renderTargets && Object.keys(renderTargets).length > 0) {
|
|
854
888
|
throw new Error(
|
|
855
|
-
`${ownerName}:
|
|
889
|
+
`${ownerName}: FullscreenEffectModule.renderTargets is not supported; use FullscreenEffectPlan.renderTargets instead`
|
|
856
890
|
);
|
|
857
891
|
}
|
|
858
892
|
}
|
|
859
893
|
|
|
860
894
|
function validateRenderTargetNames(
|
|
861
895
|
ownerName: string,
|
|
862
|
-
renderTargets: Record<string,
|
|
896
|
+
renderTargets: Record<string, EffectResource>
|
|
863
897
|
): void {
|
|
864
898
|
for (const name of Object.keys(renderTargets)) {
|
|
865
899
|
if (RESERVED_RENDER_TARGET_NAMES.has(name)) {
|
|
@@ -870,7 +904,7 @@ function validateRenderTargetNames(
|
|
|
870
904
|
|
|
871
905
|
function validateSubPassRouting(
|
|
872
906
|
ownerName: string,
|
|
873
|
-
inputs: Partial<Record<string,
|
|
907
|
+
inputs: Partial<Record<string, EffectInputSource<string>>> | undefined,
|
|
874
908
|
output: 'previous' | string | undefined,
|
|
875
909
|
renderTargets: Record<string, ManagedRenderTarget>
|
|
876
910
|
): void {
|
|
@@ -916,32 +950,38 @@ function mergeUniforms(
|
|
|
916
950
|
function resolveExecutionUniforms(
|
|
917
951
|
shaderInputs: ShaderInputs,
|
|
918
952
|
execution: EffectiveSubPass,
|
|
919
|
-
runtimeUniforms: Record<string, Record<string, unknown
|
|
953
|
+
runtimeUniforms: Record<string, Record<string, unknown>>,
|
|
954
|
+
occurrenceUniforms?: Readonly<Record<string, Record<string, unknown>>>
|
|
920
955
|
): Record<string, unknown> | undefined {
|
|
921
956
|
return mergeUniforms(
|
|
922
957
|
mergeUniforms(
|
|
923
958
|
shaderInputs.getUniformValues()[execution.shaderPass.name] as Record<string, unknown>,
|
|
924
959
|
execution.uniforms
|
|
925
960
|
),
|
|
926
|
-
|
|
961
|
+
mergeUniforms(
|
|
962
|
+
runtimeUniforms[execution.shaderPass.name],
|
|
963
|
+
occurrenceUniforms?.[execution.shaderPass.name]
|
|
964
|
+
)
|
|
927
965
|
);
|
|
928
966
|
}
|
|
929
967
|
|
|
930
968
|
function createManagedRenderTargets(
|
|
931
969
|
device: Device,
|
|
932
|
-
renderTargets: Record<string,
|
|
970
|
+
renderTargets: Record<string, EffectResource>,
|
|
971
|
+
colorFormat: TextureFormatColor
|
|
933
972
|
): Record<string, ManagedRenderTarget> {
|
|
934
973
|
const size = device.getCanvasContext().getDrawingBufferSize();
|
|
935
974
|
const managedRenderTargets: Record<string, ManagedRenderTarget> = {};
|
|
936
975
|
|
|
937
|
-
for (const [name,
|
|
976
|
+
for (const [name, resource] of Object.entries(renderTargets)) {
|
|
977
|
+
const spec = resource.format ? resource : {...resource, format: colorFormat};
|
|
938
978
|
if (spec.aliasFor) {
|
|
939
979
|
const aliasedTarget = managedRenderTargets[spec.aliasFor];
|
|
940
980
|
if (!aliasedTarget) {
|
|
941
981
|
throw new Error(`${name}: target alias references an unknown earlier target`);
|
|
942
982
|
}
|
|
943
983
|
const targetSize = getRenderTargetSize(size, spec.scale);
|
|
944
|
-
const targetFormat = spec.format
|
|
984
|
+
const targetFormat = spec.format ?? colorFormat;
|
|
945
985
|
if (
|
|
946
986
|
spec.lifetime === 'history' ||
|
|
947
987
|
aliasedTarget.spec.lifetime === 'history' ||
|
|
@@ -967,8 +1007,8 @@ function createManagedRenderTargets(
|
|
|
967
1007
|
}
|
|
968
1008
|
|
|
969
1009
|
function hasMatchingRenderTargetScale(
|
|
970
|
-
firstTarget:
|
|
971
|
-
secondTarget:
|
|
1010
|
+
firstTarget: EffectResource,
|
|
1011
|
+
secondTarget: EffectResource
|
|
972
1012
|
): boolean {
|
|
973
1013
|
const firstScale = firstTarget.scale || [1, 1];
|
|
974
1014
|
const secondScale = secondTarget.scale || [1, 1];
|
|
@@ -976,8 +1016,8 @@ function hasMatchingRenderTargetScale(
|
|
|
976
1016
|
}
|
|
977
1017
|
|
|
978
1018
|
function hasMatchingRenderTargetSampler(
|
|
979
|
-
firstTarget:
|
|
980
|
-
secondTarget:
|
|
1019
|
+
firstTarget: EffectResource,
|
|
1020
|
+
secondTarget: EffectResource
|
|
981
1021
|
): boolean {
|
|
982
1022
|
const firstSampler = firstTarget.sampler || {};
|
|
983
1023
|
const secondSampler = secondTarget.sampler || {};
|
|
@@ -1035,7 +1075,7 @@ function resizeManagedRenderTargets(
|
|
|
1035
1075
|
function createManagedRenderTarget(
|
|
1036
1076
|
device: Device,
|
|
1037
1077
|
name: string,
|
|
1038
|
-
spec:
|
|
1078
|
+
spec: EffectResource,
|
|
1039
1079
|
size: [number, number]
|
|
1040
1080
|
): ManagedRenderTarget {
|
|
1041
1081
|
const targetSize = getRenderTargetSize(size, spec.scale);
|
|
@@ -1063,7 +1103,7 @@ function createManagedRenderTarget(
|
|
|
1063
1103
|
function createTargetResources(
|
|
1064
1104
|
device: Device,
|
|
1065
1105
|
name: string,
|
|
1066
|
-
spec:
|
|
1106
|
+
spec: EffectResource,
|
|
1067
1107
|
targetSize: [number, number]
|
|
1068
1108
|
): {texture: Texture; framebuffer: Framebuffer} {
|
|
1069
1109
|
const texture = device.createTexture({
|
|
@@ -1117,7 +1157,7 @@ function getRenderTargetSize(
|
|
|
1117
1157
|
function getFramebufferTexture(framebuffer: Framebuffer): Texture {
|
|
1118
1158
|
const texture = framebuffer.colorAttachments[0]?.texture;
|
|
1119
1159
|
if (!texture) {
|
|
1120
|
-
throw new Error('
|
|
1160
|
+
throw new Error('FullscreenEffectExecutor: framebuffer is missing a color attachment texture');
|
|
1121
1161
|
}
|
|
1122
1162
|
return texture;
|
|
1123
1163
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {SamplerProps, TextureFormat} from '@luma.gl/shaders/types';
|
|
6
|
+
import type {ShaderModule, ShaderModuleUniformValue} from '@luma.gl/shaders';
|
|
7
|
+
|
|
8
|
+
export type EffectResource = {
|
|
9
|
+
/** Width and height scale relative to the renderer output size. */
|
|
10
|
+
scale?: [number, number];
|
|
11
|
+
/** Render target format. Defaults to the color chain format. */
|
|
12
|
+
format?: TextureFormat;
|
|
13
|
+
/** Optional sampling behavior when later passes read this target. */
|
|
14
|
+
sampler?: SamplerProps;
|
|
15
|
+
/** Reuse an earlier transient target with an identical size, format, and sampler. */
|
|
16
|
+
aliasFor?: string;
|
|
17
|
+
/** Allow WebGPU compute shaders to write this target as a storage texture. */
|
|
18
|
+
storage?: boolean;
|
|
19
|
+
/** Resource lifetime. History targets retain their last successfully rendered value. */
|
|
20
|
+
lifetime?: 'transient' | 'history';
|
|
21
|
+
/** Initial value used after construction, resize, or an explicit history reset. */
|
|
22
|
+
initialize?: 'original' | {clearColor: [number, number, number, number]};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type EffectInputSource<TargetNameT extends string = string> =
|
|
26
|
+
| 'original'
|
|
27
|
+
| 'previous'
|
|
28
|
+
| TargetNameT;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A FullscreenEffectModule is a ShaderModule that can be run "standalone" (e.g. post processing effects)
|
|
32
|
+
* It adds additional information on how to run the module.
|
|
33
|
+
* A FullscreenEffectModule can require one or more sub passes.
|
|
34
|
+
*/
|
|
35
|
+
export type FullscreenEffectModule<
|
|
36
|
+
PropsT extends Record<string, any> = Record<string, any>,
|
|
37
|
+
UniformsT extends Record<string, ShaderModuleUniformValue> = NonNullable<
|
|
38
|
+
ShaderModule<PropsT>['uniforms']
|
|
39
|
+
>,
|
|
40
|
+
BindingsT extends Record<string, unknown> = NonNullable<ShaderModule<PropsT>['bindings']>,
|
|
41
|
+
RenderTargetNameT extends string = never
|
|
42
|
+
> = ShaderModule<PropsT, UniformsT, BindingsT> & {
|
|
43
|
+
/** A shader pass can run multiple sub passes */
|
|
44
|
+
passes?: FullscreenEffectDraw<UniformsT, Extract<keyof BindingsT, string>, RenderTargetNameT>[];
|
|
45
|
+
// TODO better name
|
|
46
|
+
// subPasses?: FullscreenEffectDraw[];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Information on how to run a specific sub pass */
|
|
50
|
+
export type FullscreenEffectDraw<
|
|
51
|
+
UniformsT extends Record<string, ShaderModuleUniformValue> = Record<
|
|
52
|
+
string,
|
|
53
|
+
ShaderModuleUniformValue
|
|
54
|
+
>,
|
|
55
|
+
BindingNameT extends string = string,
|
|
56
|
+
RenderTargetNameT extends string = string
|
|
57
|
+
> = {
|
|
58
|
+
/**
|
|
59
|
+
* Action indicates whether this pass:
|
|
60
|
+
* - filters the color in each pixel (provides a `<pass.name>_filterColor()` shader function)
|
|
61
|
+
* - performs its own sampling (provides a `<pass.name>_sampleColor()` shader function)
|
|
62
|
+
*/
|
|
63
|
+
action?: 'filter' | 'sample';
|
|
64
|
+
sampler?: boolean;
|
|
65
|
+
filter?: boolean;
|
|
66
|
+
uniforms?: UniformsT;
|
|
67
|
+
/** Mapping from shader binding name to the logical texture source. */
|
|
68
|
+
inputs?: Partial<Record<BindingNameT | 'sourceTexture', EffectInputSource<RenderTargetNameT>>>;
|
|
69
|
+
/** Output target for this sub pass. Defaults to the shared "previous" chain. */
|
|
70
|
+
output?: 'previous' | RenderTargetNameT;
|
|
71
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModuleUniformValue} from '@luma.gl/shaders';
|
|
6
|
+
import type {
|
|
7
|
+
FullscreenEffectModule,
|
|
8
|
+
EffectInputSource,
|
|
9
|
+
EffectResource
|
|
10
|
+
} from './fullscreen-effect-module';
|
|
11
|
+
|
|
12
|
+
/** One ordered step in a {@link FullscreenEffectPlan}. */
|
|
13
|
+
export type FullscreenEffectStep<TargetNameT extends string = string> = {
|
|
14
|
+
shaderPass: FullscreenEffectModule<any, any, any, any>;
|
|
15
|
+
inputs?: Record<string, EffectInputSource<TargetNameT>>;
|
|
16
|
+
output?: 'previous' | TargetNameT;
|
|
17
|
+
uniforms?: Record<string, ShaderModuleUniformValue>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Optional WebGPU compute stage that replaces equivalent fragment-only fallback passes. */
|
|
21
|
+
export type FullscreenEffectComputeStage<TargetNameT extends string = string> = {
|
|
22
|
+
/** Stable identifier used for compute resources and command labels. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Complete WGSL compute entry point with explicit binding locations. */
|
|
25
|
+
source: string;
|
|
26
|
+
/** Existing fragment module that owns the scalar runtime uniforms. */
|
|
27
|
+
uniformModule: string;
|
|
28
|
+
/** Explicit WGSL uniform-buffer binding name used by the compute entry point. */
|
|
29
|
+
uniformBinding: string;
|
|
30
|
+
/** Scalar uniform packing order used by the compute shader. */
|
|
31
|
+
uniformNames: readonly string[];
|
|
32
|
+
/** Composite-pass scalar defaults layered below per-frame runtime overrides. */
|
|
33
|
+
uniforms: Record<string, number>;
|
|
34
|
+
/** Logical source image consumed by the fused compute dispatch. */
|
|
35
|
+
input: EffectInputSource<TargetNameT>;
|
|
36
|
+
/** Mapping from compute storage-texture names to owned render targets. */
|
|
37
|
+
outputs: Record<string, TargetNameT>;
|
|
38
|
+
/** Fragment pass names removed when the WebGPU optimization is supported. */
|
|
39
|
+
replacedPasses: readonly string[];
|
|
40
|
+
/** Compute workgroup width and height in highest-resolution output texels. */
|
|
41
|
+
workgroupSize: readonly [number, number];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Composition format accepted by FullscreenEffectExecutor. Use EffectDefinition from
|
|
46
|
+
* @luma.gl/engine to author new fullscreen effect chains.
|
|
47
|
+
*/
|
|
48
|
+
export type FullscreenEffectPlan<TargetNameT extends string = string> = {
|
|
49
|
+
name: string;
|
|
50
|
+
renderTargets?: Record<TargetNameT, EffectResource>;
|
|
51
|
+
/** Selects an implementation for the initial stage before running shared steps. */
|
|
52
|
+
initialPasses?: {
|
|
53
|
+
compute?: Omit<FullscreenEffectComputeStage<TargetNameT>, 'replacedPasses'>;
|
|
54
|
+
fragment: FullscreenEffectStep<TargetNameT>[];
|
|
55
|
+
};
|
|
56
|
+
steps: FullscreenEffectStep<TargetNameT>[];
|
|
57
|
+
/** Optional fused WebGPU dispatch; existing fragment steps remain the portable fallback. */
|
|
58
|
+
compute?: FullscreenEffectComputeStage<TargetNameT>;
|
|
59
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type {FullscreenEffectModule} from './fullscreen-effect-module';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Gets fragment shader source for a shader pass sub pass
|
|
@@ -10,11 +10,16 @@ import {ShaderPass} from '@luma.gl/shaders';
|
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
12
|
export function getFragmentShaderForRenderPass(options: {
|
|
13
|
-
shaderPass:
|
|
13
|
+
shaderPass: FullscreenEffectModule;
|
|
14
14
|
action: 'filter' | 'sample';
|
|
15
15
|
shadingLanguage: 'wgsl' | 'glsl';
|
|
16
16
|
}): string {
|
|
17
17
|
const {shaderPass, action, shadingLanguage} = options;
|
|
18
|
+
if (shadingLanguage === 'glsl' ? !shaderPass.fs : !shaderPass.source) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`${shaderPass.name}: fullscreen effect requires a ${shadingLanguage} fragment implementation`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
18
23
|
switch (action) {
|
|
19
24
|
case 'filter':
|
|
20
25
|
const filterFunc = `${shaderPass.name}_filterColor_ext`;
|
package/src/shader-inputs.ts
CHANGED
|
@@ -194,7 +194,7 @@ export class ShaderInputs<
|
|
|
194
194
|
/**
|
|
195
195
|
* Gets binding values for a single shader module without flattening them into the full shader map.
|
|
196
196
|
*
|
|
197
|
-
* This is used by systems such as {@link
|
|
197
|
+
* This is used by systems such as {@link FullscreenEffectExecutor} that execute one shader module at a
|
|
198
198
|
* time and need the defaults for just that module.
|
|
199
199
|
*/
|
|
200
200
|
getModuleBindingValues(
|