vello/piet-gpu/shader/drawtag.h
Raph Levien 875c8badf4 Add draw object stage
This is one of the stages in the new element pipeline. It's a simple
one, just a prefix sum of a couple counts, and some of it will probably
get merged with a downstream stage, but we'll do it separately for now
for convenience.

This patch also contains an update to Vulkan tools 1.2.198, which
accounts for the large diff of translated shaders.
2021-12-02 13:37:16 -08:00

37 lines
810 B
GLSL

// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense
// Common data structures and functions for the draw tag stream.
struct DrawMonoid {
uint path_ix;
uint clip_ix;
};
DrawMonoid tag_monoid_identity() {
return DrawMonoid(0, 0);
}
DrawMonoid combine_tag_monoid(DrawMonoid a, DrawMonoid b) {
DrawMonoid c;
c.path_ix = a.path_ix + b.path_ix;
c.clip_ix = a.clip_ix + b.clip_ix;
return c;
}
#ifdef Element_size
DrawMonoid map_tag(uint tag_word) {
switch (tag_word) {
case Element_FillColor:
case Element_FillLinGradient:
case Element_FillImage:
return DrawMonoid(1, 0);
case Element_BeginClip:
return DrawMonoid(1, 1);
case Element_EndClip:
return DrawMonoid(0, 1);
default:
return DrawMonoid(0, 0);
}
}
#endif