Module: Mesa
Branch: master
Commit: f2e7268a550e84e1f3c036effdeca3f8f9237044
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2e7268a550e84e1f3c036effdeca3f8f9237044

Author: Ilia Mirkin <[email protected]>
Date:   Sat May 28 22:38:24 2016 -0400

st/mesa: fix setting of point_size_per_vertex in ES contexts

GL ES 2.0+ does not have a GL_PROGRAM_POINT_SIZE enable, unlike desktop
GL. So we have to go and check the last pre-rasterizer stage to see
whether it outputs a point size or not.

This fixes a number of dEQP tests that use a geometry or tessellation
shader to emit points primitives.

Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Cc: "11.1 11.2" <[email protected]>

---

 src/mesa/state_tracker/st_atom_rasterizer.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c 
b/src/mesa/state_tracker/st_atom_rasterizer.c
index ed9deb0..ab5fa8f 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -204,10 +204,24 @@ static void update_raster_state( struct st_context *st )
             raster->point_size_per_vertex = TRUE;
          }
       }
-      else if (ctx->VertexProgram.PointSizeEnabled) {
-         /* user-defined program and GL_VERTEX_PROGRAM_POINT_SIZE set */
+      else if (ctx->API != API_OPENGLES2) {
+         /* PointSizeEnabled is always set in ES2 contexts */
          raster->point_size_per_vertex = ctx->VertexProgram.PointSizeEnabled;
       }
+      else {
+         /* ST_NEW_TESSEVAL_PROGRAM | ST_NEW_GEOMETRY_PROGRAM */
+         /* We have to check the last bound stage and see if it writes psize */
+         struct gl_program *last = NULL;
+         if (ctx->GeometryProgram._Current)
+            last = &ctx->GeometryProgram._Current->Base;
+         else if (ctx->TessEvalProgram._Current)
+            last = &ctx->TessEvalProgram._Current->Base;
+         else if (ctx->VertexProgram._Current)
+            last = &ctx->VertexProgram._Current->Base;
+         if (last)
+            raster->point_size_per_vertex =
+               !!(last->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ));
+      }
    }
    if (!raster->point_size_per_vertex) {
       /* clamp size now */
@@ -293,6 +307,8 @@ const struct st_tracked_state st_update_rasterizer = {
        _NEW_FRAG_CLAMP |
        _NEW_TRANSFORM),     /* mesa state dependencies*/
       (ST_NEW_VERTEX_PROGRAM |
+       ST_NEW_TESSEVAL_PROGRAM |
+       ST_NEW_GEOMETRY_PROGRAM |
        ST_NEW_RASTERIZER),  /* state tracker dependencies */
    },
    update_raster_state     /* update function */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to