draw: defensively reset render primitive, which can get clobbered by clipping
authorKeith Whitwell <keith@tungstengraphics.com>
Mon, 26 May 2008 17:37:34 +0000 (18:37 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 26 May 2008 17:37:34 +0000 (18:37 +0100)
src/gallium/auxiliary/draw/draw_pt_emit.c

index e21af3d287773306eac7cbb3186f0828c557d745..01396a749ee7fd5e9032bce1455fbeb046b89232 100644 (file)
@@ -40,6 +40,7 @@ struct pt_emit {
    struct translate *translate;
 
    struct translate_cache *cache;
+   unsigned prim;
 };
 
 void draw_pt_emit_prepare( struct pt_emit *emit,
@@ -51,8 +52,14 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
    struct translate_key hw_key;
    unsigned i;
    boolean ok;
+   
 
-   ok = draw->render->set_primitive(draw->render, prim);
+   /* XXX: may need to defensively reset this later on as clipping can
+    * clobber this state in the render backend.
+    */
+   emit->prim = prim;
+
+   ok = draw->render->set_primitive(draw->render, emit->prim);
    if (!ok) {
       assert(0);
       return;
@@ -145,6 +152,14 @@ void draw_pt_emit( struct pt_emit *emit,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   /* XXX: and work out some way to coordinate the render primitive
+    * between vbuf.c and here...
+    */
+   if (!draw->render->set_primitive(draw->render, emit->prim)) {
+      assert(0);
+      return;
+   }
+
    hw_verts = render->allocate_vertices(render,
                                        (ushort)translate->key.output_stride,
                                        (ushort)vertex_count);