[PATCH 04/13] glamor: Use glamor_program and GL_LINES for 0-width lines

Markus Wick markus at selfnet.de
Tue May 13 05:05:46 PDT 2014


Am 2014-05-06 00:02, schrieb Keith Packard:
> +static const glamor_facet glamor_facet_poly_lines = {
> +    .name = "poly_lines",
> +    .vs_vars = "attribute vec2 primitive;\n",
> +    .vs_exec = ("       vec2 pos = vec2(0.0,0.0);\n"
> +                GLAMOR_POS(gl_Position, primitive.xy)),
> +};

iirc this will add the offset of (0.5,0.5) to the position? So neither 
the first nor the last pixel is defined to be overwritten. I doubt X11 
defines the same :/
Without this offset, the position of this line isn't defined for 
vertical or horizontal lines.

So in the end, I fear we have to add an offset based on the direction of 
the line. But this shouldn't be as hard with instancing :)

> +static Bool
> +glamor_poly_lines_gl(DrawablePtr drawable, GCPtr gc,
> +                     int mode, int n, DDXPointPtr points)
...
> +    if (add_last) {
> +        v[n].x = v[n-1].x + 1;
> +        v[n].y = v[n-1].y;
> +    }

First, you aren't allowed to access a write_only mapped buffer (v) in a 
reading way.
Second, I'm not familiar with the X11 line rasterization, but I doubt 
that this flag is just for painting an additional pixel on the right 
side after the last one. eg nothing happens for lines from right to 
left, and it will look quite funny for lines from top to bottom:

   X
   X
   X
   XX



More information about the xorg-devel mailing list