mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
875c8badf4
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.
37 lines
810 B
GLSL
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
|