gpu: [compute] remove more unused commands

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-02-24 10:04:34 +01:00
parent 284659d3ea
commit 51ba55071b
3 changed files with 13 additions and 70 deletions
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -11
View File
@@ -166,16 +166,6 @@ void main() {
break;
}
switch (tag) {
case Cmd_Circle:
CmdCircle circle = Cmd_Circle_read(cmd_alloc, cmd_ref);
vec4 fg_rgba = unpacksRGB(circle.rgba_color);
for (uint i = 0; i < CHUNK; i++) {
float dy = float(i * CHUNK_DY);
float r = length(vec2(xy.x, xy.y + dy) + vec2(0.5, 0.5) - circle.center.xy);
float alpha = clamp(0.5 + circle.radius - r, 0.0, 1.0);
rgb[i] = mix(rgb[i], fg_rgba.rgb, mask[i] * alpha * fg_rgba.a);
}
break;
case Cmd_Stroke:
// Calculate distance field from all the line segments in this tile.
CmdStroke stroke = Cmd_Stroke_read(cmd_alloc, cmd_ref);
@@ -193,7 +183,7 @@ void main() {
}
tile_seg_ref = seg.next;
} while (tile_seg_ref.offset != 0);
fg_rgba = unpacksRGB(stroke.rgba_color);
vec4 fg_rgba = unpacksRGB(stroke.rgba_color);
for (uint k = 0; k < CHUNK; k++) {
float alpha = clamp(stroke.half_width + 0.5 - df[k], 0.0, 1.0);
rgb[k] = mix(rgb[k], fg_rgba.rgb, mask[k] * alpha * fg_rgba.a);
+10 -57
View File
@@ -2,10 +2,6 @@
// Code auto-generated by piet-gpu-derive
struct CmdCircleRef {
uint offset;
};
struct CmdLineRef {
uint offset;
};
@@ -50,18 +46,6 @@ struct CmdRef {
uint offset;
};
struct CmdCircle {
vec2 center;
float radius;
uint rgba_color;
};
#define CmdCircle_size 16
CmdCircleRef CmdCircle_index(CmdCircleRef ref, uint index) {
return CmdCircleRef(ref.offset + index * CmdCircle_size);
}
struct CmdLine {
vec2 start;
vec2 end;
@@ -173,44 +157,22 @@ CmdJumpRef CmdJump_index(CmdJumpRef ref, uint index) {
}
#define Cmd_End 0
#define Cmd_Circle 1
#define Cmd_Line 2
#define Cmd_Fill 3
#define Cmd_FillImage 4
#define Cmd_BeginClip 5
#define Cmd_BeginSolidClip 6
#define Cmd_EndClip 7
#define Cmd_Stroke 8
#define Cmd_Solid 9
#define Cmd_SolidImage 10
#define Cmd_Jump 11
#define Cmd_Line 1
#define Cmd_Fill 2
#define Cmd_FillImage 3
#define Cmd_BeginClip 4
#define Cmd_BeginSolidClip 5
#define Cmd_EndClip 6
#define Cmd_Stroke 7
#define Cmd_Solid 8
#define Cmd_SolidImage 9
#define Cmd_Jump 10
#define Cmd_size 20
CmdRef Cmd_index(CmdRef ref, uint index) {
return CmdRef(ref.offset + index * Cmd_size);
}
CmdCircle CmdCircle_read(Alloc a, CmdCircleRef 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);
CmdCircle s;
s.center = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1));
s.radius = uintBitsToFloat(raw2);
s.rgba_color = raw3;
return s;
}
void CmdCircle_write(Alloc a, CmdCircleRef ref, CmdCircle s) {
uint ix = ref.offset >> 2;
write_mem(a, ix + 0, floatBitsToUint(s.center.x));
write_mem(a, ix + 1, floatBitsToUint(s.center.y));
write_mem(a, ix + 2, floatBitsToUint(s.radius));
write_mem(a, ix + 3, s.rgba_color);
}
CmdLine CmdLine_read(Alloc a, CmdLineRef ref) {
uint ix = ref.offset >> 2;
uint raw0 = read_mem(a, ix + 0);
@@ -379,10 +341,6 @@ uint Cmd_tag(Alloc a, CmdRef ref) {
return read_mem(a, ref.offset >> 2);
}
CmdCircle Cmd_Circle_read(Alloc a, CmdRef ref) {
return CmdCircle_read(a, CmdCircleRef(ref.offset + 4));
}
CmdLine Cmd_Line_read(Alloc a, CmdRef ref) {
return CmdLine_read(a, CmdLineRef(ref.offset + 4));
}
@@ -427,11 +385,6 @@ void Cmd_End_write(Alloc a, CmdRef ref) {
write_mem(a, ref.offset >> 2, Cmd_End);
}
void Cmd_Circle_write(Alloc a, CmdRef ref, CmdCircle s) {
write_mem(a, ref.offset >> 2, Cmd_Circle);
CmdCircle_write(a, CmdCircleRef(ref.offset + 4), s);
}
void Cmd_Line_write(Alloc a, CmdRef ref, CmdLine s) {
write_mem(a, ref.offset >> 2, Cmd_Line);
CmdLine_write(a, CmdLineRef(ref.offset + 4), s);