|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
WGSL shader sources used by the Slug rendering pipeline. More...
#include <webgpu/webgpu.hpp>Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Functions | |
| wgpu::ShaderModule | donner::geode::createSlugFillShader (const wgpu::Device &device) |
| Compile the Slug fill shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createSlugGradientShader (const wgpu::Device &device) |
| Compile the Slug gradient-fill shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createSlugMaskShader (const wgpu::Device &device) |
| Compile the path-clip mask shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createSlugFillAlphaCoverageShader (const wgpu::Device &device) |
| Compile the alpha-coverage variant of the Slug fill shader. | |
| wgpu::ShaderModule | donner::geode::createSlugGradientAlphaCoverageShader (const wgpu::Device &device) |
| Alpha-coverage variant of createSlugGradientShader. | |
| wgpu::ShaderModule | donner::geode::createSlugMaskAlphaCoverageShader (const wgpu::Device &device) |
| Alpha-coverage variant of createSlugMaskShader. | |
| wgpu::ShaderModule | donner::geode::createImageBlitShader (const wgpu::Device &device) |
| Compile the image-blit shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createGaussianBlurShader (const wgpu::Device &device) |
| Compile the Gaussian blur compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterOffsetShader (const wgpu::Device &device) |
| Compile the feOffset compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterColorMatrixShader (const wgpu::Device &device) |
| Compile the feColorMatrix compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterFloodShader (const wgpu::Device &device) |
| Compile the feFlood compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterMergeShader (const wgpu::Device &device) |
| Compile the feMerge alpha-over blit compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterCompositeShader (const wgpu::Device &device) |
| Compile the feComposite compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterBlendShader (const wgpu::Device &device) |
| Compile the feBlend compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterMorphologyShader (const wgpu::Device &device) |
| Compile the feMorphology compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterComponentTransferShader (const wgpu::Device &device) |
| Compile the feComponentTransfer compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterConvolveMatrixShader (const wgpu::Device &device) |
| Compile the feConvolveMatrix compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterTurbulenceShader (const wgpu::Device &device) |
| Compile the feTurbulence compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterDisplacementMapShader (const wgpu::Device &device) |
| Compile the feDisplacementMap compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterDiffuseLightingShader (const wgpu::Device &device) |
| Compile the feDiffuseLighting compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterSpecularLightingShader (const wgpu::Device &device) |
| Compile the feSpecularLighting compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterDropShadowShader (const wgpu::Device &device) |
| Compile the feDropShadow compose compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterImageShader (const wgpu::Device &device) |
| Compile the feImage compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterTileShader (const wgpu::Device &device) |
| Compile the feTile compute shader for the given device. | |
| wgpu::ShaderModule | donner::geode::createFilterSubregionClipShader (const wgpu::Device &device) |
| Compile the per-primitive subregion clipping compute shader. | |
| wgpu::ShaderModule | donner::geode::createFilterColorSpaceConvertShader (const wgpu::Device &device) |
| Compile the sRGB↔linearRGB color space conversion compute shader. | |
WGSL shader sources used by the Slug rendering pipeline.
| wgpu::ShaderModule donner::geode::createFilterBlendShader | ( | const wgpu::Device & | device | ) |
Compile the feBlend compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_blend.wgsl via the embed_resources() Bazel rule. The shader applies one of 16 W3C Compositing 1 blend modes to two premultiplied-alpha input textures, using the same blend formulas as image_blit.wgsl.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterColorMatrixShader | ( | const wgpu::Device & | device | ) |
Compile the feColorMatrix compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_color_matrix.wgsl via the embed_resources() Bazel rule. The shader applies a 4x5 color matrix to each pixel's RGBA channels. All type variants (matrix, saturate, hueRotate, luminanceToAlpha) are pre-computed to a 4x5 matrix on the CPU side.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterColorSpaceConvertShader | ( | const wgpu::Device & | device | ) |
Compile the sRGB↔linearRGB color space conversion compute shader.
The WGSL source is embedded at build time from shaders/filter_color_space_convert.wgsl via the embed_resources() Bazel rule. The shader converts premultiplied sRGB textures to premultiplied linear (or vice-versa) to implement color-interpolation-filters: linearRGB.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterComponentTransferShader | ( | const wgpu::Device & | device | ) |
Compile the feComponentTransfer compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_component_transfer.wgsl via the embed_resources() Bazel rule. The shader un-premultiplies, applies per-channel 256-entry LUTs, then re-premultiplies.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterCompositeShader | ( | const wgpu::Device & | device | ) |
Compile the feComposite compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_composite.wgsl via the embed_resources() Bazel rule. The shader applies one of 7 Porter-Duff compositing operators to two premultiplied-alpha input textures.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterConvolveMatrixShader | ( | const wgpu::Device & | device | ) |
Compile the feConvolveMatrix compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_convolve_matrix.wgsl via the embed_resources() Bazel rule. The shader applies an NxM kernel convolution with configurable edge mode, divisor, bias, and preserveAlpha.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterDiffuseLightingShader | ( | const wgpu::Device & | device | ) |
Compile the feDiffuseLighting compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_diffuse_lighting.wgsl via the embed_resources() Bazel rule. The shader computes Lambertian diffuse lighting from the input's alpha channel used as a height map. Supports distant, point, and spot light sources via uniforms.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterDisplacementMapShader | ( | const wgpu::Device & | device | ) |
Compile the feDisplacementMap compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_displacement_map.wgsl via the embed_resources() Bazel rule. The shader displaces each output pixel from in1 by channel values read from in2.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterDropShadowShader | ( | const wgpu::Device & | device | ) |
Compile the feDropShadow compose compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_drop_shadow.wgsl via the embed_resources() Bazel rule. The shader takes the original source and its pre-blurred counterpart and produces source over flood-tinted-offset-blur, implementing the compose-step of feDropShadow. The blur itself is run through the existing Gaussian blur pipeline before this shader executes.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterFloodShader | ( | const wgpu::Device & | device | ) |
Compile the feFlood compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_flood.wgsl via the embed_resources() Bazel rule. The shader fills every pixel with a constant color uniform. No input texture is required.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterImageShader | ( | const wgpu::Device & | device | ) |
Compile the feImage compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_image.wgsl via the embed_resources() Bazel rule. The shader bilinearly samples a premultiplied-alpha image through a 2×3 image-from-output transform, producing transparent black outside the image bounds. Covers the external-raster and simple in-document fragment reference cases where the caller supplies the image pixels and the placement transform.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterMergeShader | ( | const wgpu::Device & | device | ) |
Compile the feMerge alpha-over blit compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_merge.wgsl via the embed_resources() Bazel rule. The shader composites a source texture over a destination texture using Porter-Duff source-over: out = src + dst * (1 - src.a).
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterMorphologyShader | ( | const wgpu::Device & | device | ) |
Compile the feMorphology compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_morphology.wgsl via the embed_resources() Bazel rule. The shader applies a rectangular min/max kernel for erode/dilate.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterOffsetShader | ( | const wgpu::Device & | device | ) |
Compile the feOffset compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_offset.wgsl via the embed_resources() Bazel rule. The shader shifts input pixels by a uniform (dx, dy) offset with configurable edge-mode handling.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterSpecularLightingShader | ( | const wgpu::Device & | device | ) |
Compile the feSpecularLighting compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_specular_lighting.wgsl via the embed_resources() Bazel rule. The shader computes Phong specular lighting from the input's alpha channel used as a height map. Supports distant, point, and spot light sources via uniforms.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterSubregionClipShader | ( | const wgpu::Device & | device | ) |
Compile the per-primitive subregion clipping compute shader.
The WGSL source is embedded at build time from shaders/filter_subregion_clip.wgsl via the embed_resources() Bazel rule. The shader transforms each pixel center to user space via an inverse CTM and zeroes pixels outside the user-space subregion rectangle. Used after each filter primitive dispatch when the node has x/y/width/height overrides or when a non-axis-aligned ancestor transform requires rotation-aware clipping.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterTileShader | ( | const wgpu::Device & | device | ) |
Compile the feTile compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_tile.wgsl via the embed_resources() Bazel rule. The shader tiles an input subregion across the entire output texture with modular (wraparound) sampling.
Bind group layout:
| wgpu::ShaderModule donner::geode::createFilterTurbulenceShader | ( | const wgpu::Device & | device | ) |
Compile the feTurbulence compute shader for the given device.
The WGSL source is embedded at build time from shaders/filter_turbulence.wgsl via the embed_resources() Bazel rule. The shader generates Perlin noise / fractal noise patterns per the SVG feTurbulence specification.
Bind group layout:
| wgpu::ShaderModule donner::geode::createGaussianBlurShader | ( | const wgpu::Device & | device | ) |
Compile the Gaussian blur compute shader for the given device.
The WGSL source is embedded at build time from shaders/gaussian_blur.wgsl via the embed_resources() Bazel rule. The shader implements a two-pass separable Gaussian blur with configurable edge-mode handling (None / Duplicate / Wrap).
Bind group layout:
| wgpu::ShaderModule donner::geode::createImageBlitShader | ( | const wgpu::Device & | device | ) |
Compile the image-blit shader for the given device.
The WGSL source is embedded at build time from shaders/image_blit.wgsl via the embed_resources() Bazel rule. The shader expects:
and no vertex buffer — corners are generated from @builtin(vertex_index).
| wgpu::ShaderModule donner::geode::createSlugFillAlphaCoverageShader | ( | const wgpu::Device & | device | ) |
Compile the alpha-coverage variant of the Slug fill shader.
Identical to createSlugFillShader except the fragment stage has no @builtin(sample_mask) output — coverage is folded into the fragment color as popcount(mask) / 4.0. Used on Intel + Vulkan where writing sample_mask from overlapping band quads hangs Mesa ANV / Xe KMD.
| wgpu::ShaderModule donner::geode::createSlugFillShader | ( | const wgpu::Device & | device | ) |
Compile the Slug fill shader for the given device.
The WGSL source is embedded at build time from shaders/slug_fill.wgsl via the embed_resources() Bazel rule. The shader expects:
and vertex attributes:
| wgpu::ShaderModule donner::geode::createSlugGradientShader | ( | const wgpu::Device & | device | ) |
Compile the Slug gradient-fill shader for the given device.
Parallel to createSlugFillShader, but bound to a different uniform layout that carries linear-gradient parameters (transform, start/end, spread mode, stops) alongside the Slug coverage machinery. See shaders/slug_gradient.wgsl for the exact struct layout.
| wgpu::ShaderModule donner::geode::createSlugMaskShader | ( | const wgpu::Device & | device | ) |
Compile the path-clip mask shader for the given device.
Same band/curve encoding as createSlugFillShader but the fragment stage writes clip coverage into an RGBA8Unorm target. The uniform layout is reduced to just the mvp matrix, viewport size, and fill rule — no paint mode, no pattern, no clip polygon. Used by the Phase 3b path-clipping pipeline to materialise a per-pixel clip mask texture that subsequent fill / gradient draws sample as a coverage multiplier.