[Mesa-dev] [PATCH] i965: make sure _NEW_POLYGONSTIPPLE state is set

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed Sep 14 02:38:05 PDT 2011


Make sure _NEW_POLYGONSTIPPLE state is set. A simple call case like the
following:

  glEnable(GL_POLYGON_STIPPLE);
  glPolygonStipple(pattern);
  glClear(GL_COLOR_BUFFER_BIT);  /* <---!!---> */
  glRectf(...);
  glFlush();

would simply make the polygon stipple fail. The glClear would fire a
draw call, it then would reset those state. So, when it about to hangle
the glRectf() draw, if would find that no _NEW_POLYGONSTIPPLE state set,
thus will not call upload_polygon_stipple function.

This would fix all the oglc tristip test fail:
 basic.strip
 basic.fan
 basic.triangles

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 src/mesa/drivers/dri/i965/brw_state_upload.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 76ffa0d..e34f190 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -467,6 +467,17 @@ void brw_validate_state( struct brw_context *brw )
       brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
    }
 
+   /*
+    * Make sure _NEW_POLYGONSTIPPLE is set
+    *
+    * A glClear() call after glPolygonStipple() would reset
+    * this state.  This would cause the later _real_ draw
+    * submitted with no polygon stipple info(will not call
+    * upload_polygon_stipple).
+    */
+   if (ctx->Polygon.StippleFlag)
+      ctx->NewState |= _NEW_POLYGONSTIPPLE;
+
    if ((state->mesa | state->cache | state->brw) == 0)
       return;
 
-- 
1.7.4.4



More information about the mesa-dev mailing list