Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
Flood.h File Reference

The flood compute program, expressed in the donner::gpu::shader IR. More...

Include dependency graph for Flood.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::FloodBinding : uint32_t {
  OutputTexture = 0 ,
  Params = 1
}
 Bind group indices of the flood compute program, shared by the IR builder and every host that creates its bind group layout. More...

Functions

ShaderResult< IrModuledonner::gpu::shader::programs::BuildFloodModule ()
 Builds the flood compute program: one @compute @workgroup_size(8, 8, 1) entry point named cs_main that writes one uniform color to every texel of a write-only storage texture.

Variables

constexpr uint32_t donner::gpu::shader::programs::kFloodWorkgroupSize = 8
 Workgroup size the flood entry point declares. Hosts divide the destination extent by this to compute dispatch counts.

Detailed Description

The flood compute program, expressed in the donner::gpu::shader IR.

Enumeration Type Documentation

◆ FloodBinding

enum class donner::gpu::shader::programs::FloodBinding : uint32_t
strong

Bind group indices of the flood compute program, shared by the IR builder and every host that creates its bind group layout.

Enumerator
OutputTexture 

texture_storage_2d<rgba8unorm, write> destination.

Params 

Uniform buffer holding the single color the destination is filled with.

Function Documentation

◆ BuildFloodModule()

ShaderResult< IrModule > donner::gpu::shader::programs::BuildFloodModule ( )

Builds the flood compute program: one @compute @workgroup_size(8, 8, 1) entry point named cs_main that writes one uniform color to every texel of a write-only storage texture.

The program reads no texture, so the destination extent is the only thing that bounds it. The color is written exactly as the uniform carries it: whether it is premultiplied is the caller's decision, and nothing here re-associates it with the alpha channel.

Invocations outside the destination extent return without writing, so a dispatch rounded up to whole workgroups is safe.