<div dir="ltr">Hi Kenneth,<div>You're absolutely right, just setting <span style="font-size:12.8px">ctx->VertexProgram.</span><span style="font-size:12.8px">PointSizeEnabled would be much simpler and cleaner, I'll go ahead and update the patch. Thank you for reviewing!</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 1, 2016 at 10:07 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tuesday, March 1, 2016 6:39:49 PM PST Plamena Manolova wrote:<br>
> When a user defines a point size array and enables it, the point<br>
> size value set via glPointSize should be ignored. To achieve this,<br>
> we can simply omit point size when creating a batch inside<br>
> upload_sf_state for brw, gen6, gen7 and gen8.<br>
><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=42187" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=42187</a><br>
> Signed-off-by: Plamena Manolova <<a href="mailto:plamena.manolova@intel.com">plamena.manolova@intel.com</a>><br>
<br>
</span>Wow!  Great work tracking this down!<br>
<br>
So...not filling out these fields is equivalent to just setting<br>
"use point size state" to false.  We can still set the actual<br>
point size (the big CLAMP expression) if we want.<br>
<br>
I think a simpler fix would be to make core Mesa set the<br>
ctx->VertexProgram.PointSizeEnabled boolean whenever<br>
GL_POINT_SIZE_ARRAY_OES is enabled/disabled.  Then, no driver changes<br>
should be necessary.<br>
<br>
vao->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled means "please read the<br>
point size array".  It makes ffvertex_prog.c copy the input point size<br>
to the output varying.  But ctx->VertexProgram.PointSizeEnabled essentially<br>
means "use the value of the program's output varying", so I think it<br>
makes sense for drivers to check that, and core Mesa to set it.<br>
<br>
Does that seem reasonable?<br>
<br>
Thanks for fixing this longstanding bug!<br>
<div class="HOEnZb"><div class="h5"><br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_sf_state.c  | 19 +++++++++++--------<br>
>  src/mesa/drivers/dri/i965/gen6_sf_state.c | 23 +++++++++++++----------<br>
>  src/mesa/drivers/dri/i965/gen7_sf_state.c | 17 ++++++++++-------<br>
>  src/mesa/drivers/dri/i965/gen8_sf_state.c | 17 ++++++++++-------<br>
>  4 files changed, 44 insertions(+), 32 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/<br>
dri/i965/brw_sf_state.c<br>
> index b126f82..18504b1 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_sf_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c<br>
> @@ -259,15 +259,18 @@ static void upload_sf_unit( struct brw_context *brw )<br>
><br>
>     /* _NEW_POINT */<br>
>     sf->sf7.sprite_point = ctx->Point.PointSprite;<br>
> -   sf->sf7.point_size = CLAMP(rintf(CLAMP(ctx->Point.Size,<br>
> -                                          ctx->Point.MinSize,<br>
> -                                          ctx->Point.MaxSize)), 1.0f,<br>
255.0f) *<br>
> -                        (1<<3);<br>
> -   /* _NEW_PROGRAM | _NEW_POINT */<br>
> -   sf->sf7.use_point_size_state = !(ctx->VertexProgram.PointSizeEnabled ||<br>
> -                                 ctx->Point._Attenuated);<br>
> -   sf->sf7.aa_line_distance_mode = 0;<br>
><br>
> +   if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) {<br>
> +      sf->sf7.point_size = CLAMP(rintf(CLAMP(ctx->Point.Size,<br>
> +                                             ctx->Point.MinSize,<br>
> +                                             ctx->Point.MaxSize)),<br>
> +                                 1.0f, 255.0f) * (1<<3);<br>
> +      /* _NEW_PROGRAM | _NEW_POINT */<br>
> +      sf->sf7.use_point_size_state = !(ctx->VertexProgram.PointSizeEnabled<br>
||<br>
> +         ctx->Point._Attenuated);<br>
> +   }<br>
> +<br>
> +   sf->sf7.aa_line_distance_mode = 0;<br>
>     /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons:<br>
>      * _NEW_LIGHT<br>
>      */<br>
> diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/<br>
dri/i965/gen6_sf_state.c<br>
> index 2634e6b..d506a2b 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c<br>
> @@ -406,16 +406,19 @@ upload_sf_state(struct brw_context *brw)<br>
>     if (multisampled_fbo && ctx->Multisample.Enabled)<br>
>        dw3 |= GEN6_SF_MSRAST_ON_PATTERN;<br>
><br>
> -   /* _NEW_PROGRAM | _NEW_POINT */<br>
> -   if (!(ctx->VertexProgram.PointSizeEnabled ||<br>
> -      ctx->Point._Attenuated))<br>
> -      dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH;<br>
> -<br>
> -   /* Clamp to ARB_point_parameters user limits */<br>
> -   point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx-<br>
>Point.MaxSize);<br>
> -<br>
> -   /* Clamp to the hardware limits and convert to fixed point */<br>
> -   dw4 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3);<br>
> +   if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) {<br>
> +      /* _NEW_PROGRAM | _NEW_POINT */<br>
> +      if (!(ctx->VertexProgram.PointSizeEnabled ||<br>
> +         ctx->Point._Attenuated))<br>
> +         dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH;<br>
> +<br>
> +      /* Clamp to ARB_point_parameters user limits */<br>
> +      point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize,<br>
> +                         ctx->Point.MaxSize);<br>
> +<br>
> +      /* Clamp to the hardware limits and convert to fixed point */<br>
> +      dw4 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3);<br>
> +   }<br>
><br>
>     /*<br>
>      * Window coordinates in an FBO are inverted, which means point<br>
> diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/<br>
dri/i965/gen7_sf_state.c<br>
> index b1f13ac..a17e5a2 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen7_sf_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c<br>
> @@ -213,15 +213,18 @@ upload_sf_state(struct brw_context *brw)<br>
><br>
>     dw3 = GEN6_SF_LINE_AA_MODE_TRUE;<br>
><br>
> -   /* _NEW_PROGRAM | _NEW_POINT */<br>
> -   if (!(ctx->VertexProgram.PointSizeEnabled || ctx->Point._Attenuated))<br>
> -      dw3 |= GEN6_SF_USE_STATE_POINT_WIDTH;<br>
> +   if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) {<br>
> +      /* _NEW_PROGRAM | _NEW_POINT */<br>
> +      if (!(ctx->VertexProgram.PointSizeEnabled || ctx->Point._Attenuated))<br>
> +         dw3 |= GEN6_SF_USE_STATE_POINT_WIDTH;<br>
><br>
> -   /* Clamp to ARB_point_parameters user limits */<br>
> -   point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx-<br>
>Point.MaxSize);<br>
> +      /* Clamp to ARB_point_parameters user limits */<br>
> +      point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize,<br>
> +                         ctx->Point.MaxSize);<br>
><br>
> -   /* Clamp to the hardware limits and convert to fixed point */<br>
> -   dw3 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3);<br>
> +      /* Clamp to the hardware limits and convert to fixed point */<br>
> +      dw3 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3);<br>
> +   }<br>
><br>
>     /* _NEW_LIGHT */<br>
>     if (ctx->Light.ProvokingVertex != GL_FIRST_VERTEX_CONVENTION) {<br>
> diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/<br>
dri/i965/gen8_sf_state.c<br>
> index 8b6f31f..0146383 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c<br>
> @@ -167,15 +167,18 @@ upload_sf(struct brw_context *brw)<br>
>        dw2 |= GEN6_SF_LINE_END_CAP_WIDTH_1_0;<br>
>     }<br>
><br>
> -   /* Clamp to ARB_point_parameters user limits */<br>
> -   point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx-<br>
>Point.MaxSize);<br>
> +   if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) {<br>
> +      /* Clamp to ARB_point_parameters user limits */<br>
> +      point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize,<br>
> +                         ctx->Point.MaxSize);<br>
><br>
> -   /* Clamp to the hardware limits and convert to fixed point */<br>
> -   dw3 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3);<br>
> +      /* Clamp to the hardware limits and convert to fixed point */<br>
> +      dw3 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3);<br>
><br>
> -   /* _NEW_PROGRAM | _NEW_POINT */<br>
> -   if (!(ctx->VertexProgram.PointSizeEnabled || ctx->Point._Attenuated))<br>
> -      dw3 |= GEN6_SF_USE_STATE_POINT_WIDTH;<br>
> +      /* _NEW_PROGRAM | _NEW_POINT */<br>
> +      if (!(ctx->VertexProgram.PointSizeEnabled || ctx->Point._Attenuated))<br>
> +         dw3 |= GEN6_SF_USE_STATE_POINT_WIDTH;<br>
> +   }<br>
><br>
>     /* _NEW_POINT | _NEW_MULTISAMPLE */<br>
>     if ((ctx->Point.SmoothFlag || ctx->Multisample._Enabled) &&<br>
><br>
<br>
</div></div></blockquote></div><br></div>