gpu: [compute] fix path gaps by eliminating redundant path points

See https://github.com/linebender/piet-gpu/issues/62 for description
of the issue. The fix is the Gio copy of the piet-gpu fix.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-02-15 20:04:01 +01:00
parent b5d21b209c
commit 2feec23561
6 changed files with 105 additions and 158 deletions
+13 -9
View File
@@ -10,13 +10,14 @@ struct State {
vec4 mat;
vec2 translate;
vec4 bbox;
uint tail;
float linewidth;
uint flags;
uint path_count;
uint pathseg_count;
};
#define State_size 56
#define State_size 60
StateRef State_index(StateRef ref, uint index) {
return StateRef(ref.offset + index * State_size);
@@ -38,14 +39,16 @@ State State_read(StateRef ref) {
uint raw11 = state[ix + 11];
uint raw12 = state[ix + 12];
uint raw13 = state[ix + 13];
uint raw14 = state[ix + 14];
State s;
s.mat = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
s.translate = vec2(uintBitsToFloat(raw4), uintBitsToFloat(raw5));
s.bbox = vec4(uintBitsToFloat(raw6), uintBitsToFloat(raw7), uintBitsToFloat(raw8), uintBitsToFloat(raw9));
s.linewidth = uintBitsToFloat(raw10);
s.flags = raw11;
s.path_count = raw12;
s.pathseg_count = raw13;
s.tail = raw10;
s.linewidth = uintBitsToFloat(raw11);
s.flags = raw12;
s.path_count = raw13;
s.pathseg_count = raw14;
return s;
}
@@ -61,9 +64,10 @@ void State_write(StateRef ref, State s) {
state[ix + 7] = floatBitsToUint(s.bbox.y);
state[ix + 8] = floatBitsToUint(s.bbox.z);
state[ix + 9] = floatBitsToUint(s.bbox.w);
state[ix + 10] = floatBitsToUint(s.linewidth);
state[ix + 11] = s.flags;
state[ix + 12] = s.path_count;
state[ix + 13] = s.pathseg_count;
state[ix + 10] = s.tail;
state[ix + 11] = floatBitsToUint(s.linewidth);
state[ix + 12] = s.flags;
state[ix + 13] = s.path_count;
state[ix + 14] = s.pathseg_count;
}