|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
The SVG color-matrix filter primitive, expressed in the donner::gpu::shader IR.
More...
#include "donner/gpu/shader/IrModule.h"Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Enumerations | |
| enum class | donner::gpu::shader::programs::FilterColorMatrixBinding : uint32_t { InputTexture = 0 , OutputTexture = 1 , Params = 2 } |
| Bind group indices of the color-matrix filter program, shared by the IR builder and every host that creates its bind group layout. More... | |
Functions | |
| ShaderResult< IrModule > | donner::gpu::shader::programs::BuildFilterColorMatrixModule () |
| Builds the SVG color-matrix filter program: one @compute @workgroup_size(8, 8, 1) entry point named cs_main that applies a four-by-five color matrix to every texel. | |
The SVG color-matrix filter primitive, expressed in the donner::gpu::shader IR.
|
strong |
Bind group indices of the color-matrix filter program, shared by the IR builder and every host that creates its bind group layout.
| Enumerator | |
|---|---|
| InputTexture | Sampled texture_2d<f32> source. |
| OutputTexture | texture_storage_2d<rgba8unorm, write> destination. |
| Params | Uniform buffer holding the five matrix columns. |
| ShaderResult< IrModule > donner::gpu::shader::programs::BuildFilterColorMatrixModule | ( | ) |
Builds the SVG color-matrix filter program: one @compute @workgroup_size(8, 8, 1) entry point named cs_main that applies a four-by-five color matrix to every texel.
The matrix arrives as five columns: four of per-input-channel multipliers and a constant column added after them. Every matrix form the specification defines - the explicit one, saturation, hue rotation, and luminance-to-alpha - is baked into those five columns by the caller, so this program has one path rather than a branch per form.
The specification defines the operation on straight-alpha values while the filter chain carries premultiplied ones, so the program un-premultiplies, applies the matrix, clamps each channel to the representable range, and premultiplies again. A fully transparent source texel has no straight-alpha value to recover, so it is handled directly: the constant column is the whole result there, and it produces transparent black unless that column raises alpha.
Invocations outside the destination extent return without writing, so a dispatch rounded up to whole workgroups is safe.