Merge branch 'gallium-polygon-stipple'
[mesa.git] / src / mesa / state_tracker / st_draw.c
index 1bb9b80298e12ad69e1846ee2ca386e34f9766ad..5040c6fa5ab9ebfb084a9a5979824c7455af12df 100644 (file)
@@ -33,7 +33,7 @@
  *
  * We basically convert the VBO's vertex attribute/array information into
  * Gallium vertex state, bind the vertex buffer objects and call
- * pipe->draw_elements(), pipe->draw_range_elements() or pipe->draw_arrays().
+ * pipe->draw_vbo().
  *
  * Authors:
  *   Keith Whitwell <keith@tungstengraphics.com>
@@ -233,6 +233,22 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
 }
 
 
+/**
+ * This is very similar to vbo_all_varyings_in_vbos() but we test
+ * the stride.  See bug 38626.
+ */
+static GLboolean
+all_varyings_in_vbos(const struct gl_client_array *arrays[])
+{
+   GLuint i;
+   
+   for (i = 0; i < VERT_ATTRIB_MAX; i++)
+      if (arrays[i]->StrideB && !_mesa_is_bufferobj(arrays[i]->BufferObj))
+        return GL_FALSE;
+
+   return GL_TRUE;
+}
+
 
 /**
  * Examine the active arrays to determine if we have interleaved
@@ -498,6 +514,7 @@ setup_index_buffer(struct gl_context *ctx,
    }
 }
 
+
 /**
  * Prior to drawing, check that any uniforms referenced by the
  * current shader have been set.  If a uniform has not been set,
@@ -544,8 +561,8 @@ translate_prim(const struct gl_context *ctx, unsigned prim)
    assert(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
 
    /* Avoid quadstrips if it's easy to do so:
-    * Note: it's imporant to do the correct trimming if we change the prim type!
-    * We do that wherever this function is called.
+    * Note: it's important to do the correct trimming if we change the
+    * prim type!  We do that wherever this function is called.
     */
    if (prim == GL_QUAD_STRIP &&
        ctx->Light.ShadeModel != GL_FLAT &&
@@ -647,7 +664,7 @@ st_draw_vbo(struct gl_context *ctx,
    if (ib) {
       /* Gallium probably doesn't want this in some cases. */
       if (!index_bounds_valid)
-         if (!vbo_all_varyings_in_vbos(arrays))
+         if (!all_varyings_in_vbos(arrays))
             vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
 
       for (i = 0; i < nr_prims; i++) {
@@ -727,8 +744,8 @@ st_draw_vbo(struct gl_context *ctx,
       }
    }
 
-   info.primitive_restart = st->ctx->Array.PrimitiveRestart;
-   info.restart_index = st->ctx->Array.RestartIndex;
+   info.primitive_restart = ctx->Array.PrimitiveRestart;
+   info.restart_index = ctx->Array.RestartIndex;
 
    /* do actual drawing */
    for (i = 0; i < nr_prims; i++) {