mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
gpu,op/clip: [compute] get rid of stroke vs fill flags
The fill mode is now controlled by a SetFillMode command, not by flags on each path segment and fill command. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+101
-101
@@ -2,19 +2,19 @@
|
||||
|
||||
// Code auto-generated by piet-gpu-derive
|
||||
|
||||
struct AnnoFillRef {
|
||||
struct AnnoImageRef {
|
||||
uint offset;
|
||||
};
|
||||
|
||||
struct AnnoFillImageRef {
|
||||
struct AnnoColorRef {
|
||||
uint offset;
|
||||
};
|
||||
|
||||
struct AnnoStrokeRef {
|
||||
struct AnnoBeginClipRef {
|
||||
uint offset;
|
||||
};
|
||||
|
||||
struct AnnoClipRef {
|
||||
struct AnnoEndClipRef {
|
||||
uint offset;
|
||||
};
|
||||
|
||||
@@ -22,86 +22,69 @@ struct AnnotatedRef {
|
||||
uint offset;
|
||||
};
|
||||
|
||||
struct AnnoFill {
|
||||
vec4 bbox;
|
||||
uint rgba_color;
|
||||
};
|
||||
|
||||
#define AnnoFill_size 20
|
||||
|
||||
AnnoFillRef AnnoFill_index(AnnoFillRef ref, uint index) {
|
||||
return AnnoFillRef(ref.offset + index * AnnoFill_size);
|
||||
}
|
||||
|
||||
struct AnnoFillImage {
|
||||
struct AnnoImage {
|
||||
vec4 bbox;
|
||||
float linewidth;
|
||||
uint index;
|
||||
ivec2 offset;
|
||||
};
|
||||
|
||||
#define AnnoFillImage_size 24
|
||||
#define AnnoImage_size 28
|
||||
|
||||
AnnoFillImageRef AnnoFillImage_index(AnnoFillImageRef ref, uint index) {
|
||||
return AnnoFillImageRef(ref.offset + index * AnnoFillImage_size);
|
||||
AnnoImageRef AnnoImage_index(AnnoImageRef ref, uint index) {
|
||||
return AnnoImageRef(ref.offset + index * AnnoImage_size);
|
||||
}
|
||||
|
||||
struct AnnoStroke {
|
||||
struct AnnoColor {
|
||||
vec4 bbox;
|
||||
float linewidth;
|
||||
uint rgba_color;
|
||||
};
|
||||
|
||||
#define AnnoColor_size 24
|
||||
|
||||
AnnoColorRef AnnoColor_index(AnnoColorRef ref, uint index) {
|
||||
return AnnoColorRef(ref.offset + index * AnnoColor_size);
|
||||
}
|
||||
|
||||
struct AnnoBeginClip {
|
||||
vec4 bbox;
|
||||
float linewidth;
|
||||
};
|
||||
|
||||
#define AnnoStroke_size 24
|
||||
#define AnnoBeginClip_size 20
|
||||
|
||||
AnnoStrokeRef AnnoStroke_index(AnnoStrokeRef ref, uint index) {
|
||||
return AnnoStrokeRef(ref.offset + index * AnnoStroke_size);
|
||||
AnnoBeginClipRef AnnoBeginClip_index(AnnoBeginClipRef ref, uint index) {
|
||||
return AnnoBeginClipRef(ref.offset + index * AnnoBeginClip_size);
|
||||
}
|
||||
|
||||
struct AnnoClip {
|
||||
struct AnnoEndClip {
|
||||
vec4 bbox;
|
||||
};
|
||||
|
||||
#define AnnoClip_size 16
|
||||
#define AnnoEndClip_size 16
|
||||
|
||||
AnnoClipRef AnnoClip_index(AnnoClipRef ref, uint index) {
|
||||
return AnnoClipRef(ref.offset + index * AnnoClip_size);
|
||||
AnnoEndClipRef AnnoEndClip_index(AnnoEndClipRef ref, uint index) {
|
||||
return AnnoEndClipRef(ref.offset + index * AnnoEndClip_size);
|
||||
}
|
||||
|
||||
#define Annotated_Nop 0
|
||||
#define Annotated_Stroke 1
|
||||
#define Annotated_Fill 2
|
||||
#define Annotated_FillImage 3
|
||||
#define Annotated_BeginClip 4
|
||||
#define Annotated_EndClip 5
|
||||
#define Annotated_size 28
|
||||
#define Annotated_Color 1
|
||||
#define Annotated_Image 2
|
||||
#define Annotated_BeginClip 3
|
||||
#define Annotated_EndClip 4
|
||||
#define Annotated_size 32
|
||||
|
||||
AnnotatedRef Annotated_index(AnnotatedRef ref, uint index) {
|
||||
return AnnotatedRef(ref.offset + index * Annotated_size);
|
||||
}
|
||||
|
||||
AnnoFill AnnoFill_read(Alloc a, AnnoFillRef ref) {
|
||||
uint ix = ref.offset >> 2;
|
||||
uint raw0 = read_mem(a, ix + 0);
|
||||
uint raw1 = read_mem(a, ix + 1);
|
||||
uint raw2 = read_mem(a, ix + 2);
|
||||
uint raw3 = read_mem(a, ix + 3);
|
||||
uint raw4 = read_mem(a, ix + 4);
|
||||
AnnoFill s;
|
||||
s.bbox = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
||||
s.rgba_color = raw4;
|
||||
return s;
|
||||
}
|
||||
struct AnnotatedTag {
|
||||
uint tag;
|
||||
uint flags;
|
||||
};
|
||||
|
||||
void AnnoFill_write(Alloc a, AnnoFillRef ref, AnnoFill s) {
|
||||
uint ix = ref.offset >> 2;
|
||||
write_mem(a, ix + 0, floatBitsToUint(s.bbox.x));
|
||||
write_mem(a, ix + 1, floatBitsToUint(s.bbox.y));
|
||||
write_mem(a, ix + 2, floatBitsToUint(s.bbox.z));
|
||||
write_mem(a, ix + 3, floatBitsToUint(s.bbox.w));
|
||||
write_mem(a, ix + 4, s.rgba_color);
|
||||
}
|
||||
|
||||
AnnoFillImage AnnoFillImage_read(Alloc a, AnnoFillImageRef ref) {
|
||||
AnnoImage AnnoImage_read(Alloc a, AnnoImageRef ref) {
|
||||
uint ix = ref.offset >> 2;
|
||||
uint raw0 = read_mem(a, ix + 0);
|
||||
uint raw1 = read_mem(a, ix + 1);
|
||||
@@ -109,24 +92,27 @@ AnnoFillImage AnnoFillImage_read(Alloc a, AnnoFillImageRef ref) {
|
||||
uint raw3 = read_mem(a, ix + 3);
|
||||
uint raw4 = read_mem(a, ix + 4);
|
||||
uint raw5 = read_mem(a, ix + 5);
|
||||
AnnoFillImage s;
|
||||
uint raw6 = read_mem(a, ix + 6);
|
||||
AnnoImage s;
|
||||
s.bbox = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
||||
s.index = raw4;
|
||||
s.offset = ivec2(int(raw5 << 16) >> 16, int(raw5) >> 16);
|
||||
s.linewidth = uintBitsToFloat(raw4);
|
||||
s.index = raw5;
|
||||
s.offset = ivec2(int(raw6 << 16) >> 16, int(raw6) >> 16);
|
||||
return s;
|
||||
}
|
||||
|
||||
void AnnoFillImage_write(Alloc a, AnnoFillImageRef ref, AnnoFillImage s) {
|
||||
void AnnoImage_write(Alloc a, AnnoImageRef ref, AnnoImage s) {
|
||||
uint ix = ref.offset >> 2;
|
||||
write_mem(a, ix + 0, floatBitsToUint(s.bbox.x));
|
||||
write_mem(a, ix + 1, floatBitsToUint(s.bbox.y));
|
||||
write_mem(a, ix + 2, floatBitsToUint(s.bbox.z));
|
||||
write_mem(a, ix + 3, floatBitsToUint(s.bbox.w));
|
||||
write_mem(a, ix + 4, s.index);
|
||||
write_mem(a, ix + 5, (uint(s.offset.x) & 0xffff) | (uint(s.offset.y) << 16));
|
||||
write_mem(a, ix + 4, floatBitsToUint(s.linewidth));
|
||||
write_mem(a, ix + 5, s.index);
|
||||
write_mem(a, ix + 6, (uint(s.offset.x) & 0xffff) | (uint(s.offset.y) << 16));
|
||||
}
|
||||
|
||||
AnnoStroke AnnoStroke_read(Alloc a, AnnoStrokeRef ref) {
|
||||
AnnoColor AnnoColor_read(Alloc a, AnnoColorRef ref) {
|
||||
uint ix = ref.offset >> 2;
|
||||
uint raw0 = read_mem(a, ix + 0);
|
||||
uint raw1 = read_mem(a, ix + 1);
|
||||
@@ -134,35 +120,57 @@ AnnoStroke AnnoStroke_read(Alloc a, AnnoStrokeRef ref) {
|
||||
uint raw3 = read_mem(a, ix + 3);
|
||||
uint raw4 = read_mem(a, ix + 4);
|
||||
uint raw5 = read_mem(a, ix + 5);
|
||||
AnnoStroke s;
|
||||
AnnoColor s;
|
||||
s.bbox = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
||||
s.rgba_color = raw4;
|
||||
s.linewidth = uintBitsToFloat(raw5);
|
||||
s.linewidth = uintBitsToFloat(raw4);
|
||||
s.rgba_color = raw5;
|
||||
return s;
|
||||
}
|
||||
|
||||
void AnnoStroke_write(Alloc a, AnnoStrokeRef ref, AnnoStroke s) {
|
||||
void AnnoColor_write(Alloc a, AnnoColorRef ref, AnnoColor s) {
|
||||
uint ix = ref.offset >> 2;
|
||||
write_mem(a, ix + 0, floatBitsToUint(s.bbox.x));
|
||||
write_mem(a, ix + 1, floatBitsToUint(s.bbox.y));
|
||||
write_mem(a, ix + 2, floatBitsToUint(s.bbox.z));
|
||||
write_mem(a, ix + 3, floatBitsToUint(s.bbox.w));
|
||||
write_mem(a, ix + 4, s.rgba_color);
|
||||
write_mem(a, ix + 5, floatBitsToUint(s.linewidth));
|
||||
write_mem(a, ix + 4, floatBitsToUint(s.linewidth));
|
||||
write_mem(a, ix + 5, s.rgba_color);
|
||||
}
|
||||
|
||||
AnnoClip AnnoClip_read(Alloc a, AnnoClipRef ref) {
|
||||
AnnoBeginClip AnnoBeginClip_read(Alloc a, AnnoBeginClipRef ref) {
|
||||
uint ix = ref.offset >> 2;
|
||||
uint raw0 = read_mem(a, ix + 0);
|
||||
uint raw1 = read_mem(a, ix + 1);
|
||||
uint raw2 = read_mem(a, ix + 2);
|
||||
uint raw3 = read_mem(a, ix + 3);
|
||||
AnnoClip s;
|
||||
uint raw4 = read_mem(a, ix + 4);
|
||||
AnnoBeginClip s;
|
||||
s.bbox = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
||||
s.linewidth = uintBitsToFloat(raw4);
|
||||
return s;
|
||||
}
|
||||
|
||||
void AnnoBeginClip_write(Alloc a, AnnoBeginClipRef ref, AnnoBeginClip s) {
|
||||
uint ix = ref.offset >> 2;
|
||||
write_mem(a, ix + 0, floatBitsToUint(s.bbox.x));
|
||||
write_mem(a, ix + 1, floatBitsToUint(s.bbox.y));
|
||||
write_mem(a, ix + 2, floatBitsToUint(s.bbox.z));
|
||||
write_mem(a, ix + 3, floatBitsToUint(s.bbox.w));
|
||||
write_mem(a, ix + 4, floatBitsToUint(s.linewidth));
|
||||
}
|
||||
|
||||
AnnoEndClip AnnoEndClip_read(Alloc a, AnnoEndClipRef ref) {
|
||||
uint ix = ref.offset >> 2;
|
||||
uint raw0 = read_mem(a, ix + 0);
|
||||
uint raw1 = read_mem(a, ix + 1);
|
||||
uint raw2 = read_mem(a, ix + 2);
|
||||
uint raw3 = read_mem(a, ix + 3);
|
||||
AnnoEndClip s;
|
||||
s.bbox = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
||||
return s;
|
||||
}
|
||||
|
||||
void AnnoClip_write(Alloc a, AnnoClipRef ref, AnnoClip s) {
|
||||
void AnnoEndClip_write(Alloc a, AnnoEndClipRef ref, AnnoEndClip s) {
|
||||
uint ix = ref.offset >> 2;
|
||||
write_mem(a, ix + 0, floatBitsToUint(s.bbox.x));
|
||||
write_mem(a, ix + 1, floatBitsToUint(s.bbox.y));
|
||||
@@ -170,56 +178,48 @@ void AnnoClip_write(Alloc a, AnnoClipRef ref, AnnoClip s) {
|
||||
write_mem(a, ix + 3, floatBitsToUint(s.bbox.w));
|
||||
}
|
||||
|
||||
uint Annotated_tag(Alloc a, AnnotatedRef ref) {
|
||||
return read_mem(a, ref.offset >> 2);
|
||||
AnnotatedTag Annotated_tag(Alloc a, AnnotatedRef ref) {
|
||||
uint tag_and_flags = read_mem(a, ref.offset >> 2);
|
||||
return AnnotatedTag(tag_and_flags & 0xffff, tag_and_flags >> 16);
|
||||
}
|
||||
|
||||
AnnoStroke Annotated_Stroke_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoStroke_read(a, AnnoStrokeRef(ref.offset + 4));
|
||||
AnnoColor Annotated_Color_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoColor_read(a, AnnoColorRef(ref.offset + 4));
|
||||
}
|
||||
|
||||
AnnoFill Annotated_Fill_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoFill_read(a, AnnoFillRef(ref.offset + 4));
|
||||
AnnoImage Annotated_Image_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoImage_read(a, AnnoImageRef(ref.offset + 4));
|
||||
}
|
||||
|
||||
AnnoFillImage Annotated_FillImage_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoFillImage_read(a, AnnoFillImageRef(ref.offset + 4));
|
||||
AnnoBeginClip Annotated_BeginClip_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoBeginClip_read(a, AnnoBeginClipRef(ref.offset + 4));
|
||||
}
|
||||
|
||||
AnnoClip Annotated_BeginClip_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoClip_read(a, AnnoClipRef(ref.offset + 4));
|
||||
}
|
||||
|
||||
AnnoClip Annotated_EndClip_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoClip_read(a, AnnoClipRef(ref.offset + 4));
|
||||
AnnoEndClip Annotated_EndClip_read(Alloc a, AnnotatedRef ref) {
|
||||
return AnnoEndClip_read(a, AnnoEndClipRef(ref.offset + 4));
|
||||
}
|
||||
|
||||
void Annotated_Nop_write(Alloc a, AnnotatedRef ref) {
|
||||
write_mem(a, ref.offset >> 2, Annotated_Nop);
|
||||
}
|
||||
|
||||
void Annotated_Stroke_write(Alloc a, AnnotatedRef ref, AnnoStroke s) {
|
||||
write_mem(a, ref.offset >> 2, Annotated_Stroke);
|
||||
AnnoStroke_write(a, AnnoStrokeRef(ref.offset + 4), s);
|
||||
void Annotated_Color_write(Alloc a, AnnotatedRef ref, uint flags, AnnoColor s) {
|
||||
write_mem(a, ref.offset >> 2, (flags << 16) | Annotated_Color);
|
||||
AnnoColor_write(a, AnnoColorRef(ref.offset + 4), s);
|
||||
}
|
||||
|
||||
void Annotated_Fill_write(Alloc a, AnnotatedRef ref, AnnoFill s) {
|
||||
write_mem(a, ref.offset >> 2, Annotated_Fill);
|
||||
AnnoFill_write(a, AnnoFillRef(ref.offset + 4), s);
|
||||
void Annotated_Image_write(Alloc a, AnnotatedRef ref, uint flags, AnnoImage s) {
|
||||
write_mem(a, ref.offset >> 2, (flags << 16) | Annotated_Image);
|
||||
AnnoImage_write(a, AnnoImageRef(ref.offset + 4), s);
|
||||
}
|
||||
|
||||
void Annotated_FillImage_write(Alloc a, AnnotatedRef ref, AnnoFillImage s) {
|
||||
write_mem(a, ref.offset >> 2, Annotated_FillImage);
|
||||
AnnoFillImage_write(a, AnnoFillImageRef(ref.offset + 4), s);
|
||||
void Annotated_BeginClip_write(Alloc a, AnnotatedRef ref, uint flags, AnnoBeginClip s) {
|
||||
write_mem(a, ref.offset >> 2, (flags << 16) | Annotated_BeginClip);
|
||||
AnnoBeginClip_write(a, AnnoBeginClipRef(ref.offset + 4), s);
|
||||
}
|
||||
|
||||
void Annotated_BeginClip_write(Alloc a, AnnotatedRef ref, AnnoClip s) {
|
||||
write_mem(a, ref.offset >> 2, Annotated_BeginClip);
|
||||
AnnoClip_write(a, AnnoClipRef(ref.offset + 4), s);
|
||||
}
|
||||
|
||||
void Annotated_EndClip_write(Alloc a, AnnotatedRef ref, AnnoClip s) {
|
||||
void Annotated_EndClip_write(Alloc a, AnnotatedRef ref, AnnoEndClip s) {
|
||||
write_mem(a, ref.offset >> 2, Annotated_EndClip);
|
||||
AnnoClip_write(a, AnnoClipRef(ref.offset + 4), s);
|
||||
AnnoEndClip_write(a, AnnoEndClipRef(ref.offset + 4), s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user