[Mesa-dev] [PATCH] i965/gen8: Fix antialiased line rendering with width < 1.5

Kenneth Graunke kenneth at whitecape.org
Thu Jun 11 00:18:50 PDT 2015


On Thursday, June 11, 2015 09:03:37 AM Iago Toral Quiroga wrote:
> The same fix Marius implemented for gen6 (commit a9b04d8a) and
> gen7 (commit 24ecf37a).
> ---
>  src/mesa/drivers/dri/i965/gen8_sf_state.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> Ken, I don't have gen8 hardware available to test this so it would
> be nice if someone else verifies that this fixes the piglit tests you
> mentioned.

Oh, sorry - I was hoping we could include this in the helper function,
since it's the exact same code for Gen6/7/8...

> diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c
> index 83ef62b..22c1c4a 100644
> --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c
> @@ -156,8 +156,26 @@ upload_sf(struct brw_context *brw)
>     /* _NEW_LINE */
>     float line_width = brw_get_line_width(brw);
>     uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
> -   if (line_width_u3_7 == 0)
> -      line_width_u3_7 = 1;
> +
> +   /* Line width of 0 is not allowed when MSAA enabled */
> +   if (ctx->Multisample._Enabled) {
> +      if (line_width_u3_7 == 0)
> +          line_width_u3_7 = 1;
> +   } else if (ctx->Line.SmoothFlag && ctx->Line.Width < 1.5) {
> +      /* For 1 pixel line thickness or less, the general
> +       * anti-aliasing algorithm gives up, and a garbage line is
> +       * generated.  Setting a Line Width of 0.0 specifies the
> +       * rasterization of the "thinnest" (one-pixel-wide),
> +       * non-antialiased lines.
> +       *
> +       * Lines rendered with zero Line Width are rasterized using
> +       * Grid Intersection Quantization rules as specified by
> +       * bspec section 6.3.12.1 Zero-Width (Cosmetic) Line
> +       * Rasterization.
> +       */
> +      line_width_u3_7 = 0;
> +   }
> +
>     if (brw->gen >= 9 || brw->is_cherryview) {
>        dw1 |= line_width_u3_7 << GEN9_SF_LINE_WIDTH_SHIFT;
>     } else {
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150611/9c4bd638/attachment.sig>


More information about the mesa-dev mailing list