Fix linewidth math

Coarse rasterization wasn't entirely taking line width into account.

Also fix swizzle in matrix (not yet used). And fix missing End command
in ptcl output (hasn't been a problem because buffer was cleared).
This commit is contained in:
Raph Levien 2020-05-23 11:25:22 -07:00
parent b5e96b5b87
commit 55df3e6cc8
4 changed files with 4 additions and 3 deletions

View file

@ -221,7 +221,7 @@ void main() {
} }
// Set up for per-scanline coverage formula, below. // Set up for per-scanline coverage formula, below.
float invslope = abs(dy) < 1e-9 ? 1e9 : dx / dy; float invslope = abs(dy) < 1e-9 ? 1e9 : dx / dy;
c = abs(invslope) * (0.5 * float(TILE_HEIGHT_PX) + line.stroke.y) * SX; c = (line.stroke.x + abs(invslope) * (0.5 * float(TILE_HEIGHT_PX) + line.stroke.y)) * SX;
b = invslope; // Note: assumes square tiles, otherwise scale. b = invslope; // Note: assumes square tiles, otherwise scale.
a = (line.p0.x - xy0.x - (line.p0.y - 0.5 * float(TILE_HEIGHT_PX) - xy0.y) * b) * SX; a = (line.p0.x - xy0.x - (line.p0.y - 0.5 * float(TILE_HEIGHT_PX) - xy0.y) * b) * SX;
break; break;
@ -392,4 +392,5 @@ void main() {
// removed, then the kernel fails with ERROR_DEVICE_LOST. // removed, then the kernel fails with ERROR_DEVICE_LOST.
if (rd_ix >= wr_ix || bin_ix == ~0) break; if (rd_ix >= wr_ix || bin_ix == ~0) break;
} }
Cmd_End_write(cmd_ref);
} }

Binary file not shown.

View file

@ -291,8 +291,8 @@ void main() {
case Element_StrokeLine: case Element_StrokeLine:
LineSeg line = Element_StrokeLine_read(this_ref); LineSeg line = Element_StrokeLine_read(this_ref);
AnnoStrokeLineSeg anno_line; AnnoStrokeLineSeg anno_line;
anno_line.p0 = st.mat.xz * line.p0.x + st.mat.yw * line.p0.y + st.translate; anno_line.p0 = st.mat.xy * line.p0.x + st.mat.zw * line.p0.y + st.translate;
anno_line.p1 = st.mat.xz * line.p1.x + st.mat.yw * line.p1.y + st.translate; anno_line.p1 = st.mat.xy * line.p1.x + st.mat.zw * line.p1.y + st.translate;
if (tag == Element_StrokeLine) { if (tag == Element_StrokeLine) {
anno_line.stroke = get_linewidth(st); anno_line.stroke = get_linewidth(st);
} else { } else {

Binary file not shown.