[Mesa-dev] [PATCH 4/4] st/mesa: don't call util_draw_init_info in st_draw_vbo

Marek Olšák maraeo at gmail.com
Fri Apr 28 23:12:09 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/state_tracker/st_draw.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 3fee0cd..8b657be 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -159,66 +159,72 @@ st_draw_vbo(struct gl_context *ctx,
    /* Validate state. */
    if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_RENDER_STATE_MASK ||
        st->gfx_shaders_may_be_dirty) {
       st_validate_state(st, ST_PIPELINE_RENDER);
    }
 
    if (st->vertex_array_out_of_memory) {
       return;
    }
 
-   util_draw_init_info(&info);
+   /* Initialize pipe_draw_info. */
+   info.primitive_restart = false;
+   info.vertices_per_patch = ctx->TessCtrlProgram.patch_vertices;
+   info.indirect = NULL;
+   info.count_from_stream_output = NULL;
 
    if (ib) {
       struct gl_buffer_object *bufobj = ib->obj;
 
       /* Get index bounds for user buffers. */
       if (!index_bounds_valid)
          if (!all_varyings_in_vbos(arrays))
             vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
                                    nr_prims);
 
       info.index_size = ib->index_size;
       info.min_index = min_index;
       info.max_index = max_index;
 
       if (_mesa_is_bufferobj(bufobj)) {
          /* indices are in a real VBO */
+         info.has_user_indices = false;
          info.index.resource = st_buffer_object(bufobj)->buffer;
          start = pointer_to_offset(ib->ptr) / info.index_size;
       } else {
          /* indices are in user space memory */
          info.has_user_indices = true;
          info.index.user = ib->ptr;
       }
 
       setup_primitive_restart(ctx, &info);
    }
    else {
+      info.index_size = 0;
+
       /* Transform feedback drawing is always non-indexed. */
       /* Set info.count_from_stream_output. */
       if (tfb_vertcount) {
          if (!st_transform_feedback_draw_init(tfb_vertcount, stream, &info))
             return;
       }
    }
 
    assert(!indirect);
 
    /* do actual drawing */
    for (i = 0; i < nr_prims; i++) {
       info.mode = translate_prim(ctx, prims[i].mode);
       info.start = start + prims[i].start;
       info.count = prims[i].count;
       info.start_instance = prims[i].base_instance;
       info.instance_count = prims[i].num_instances;
-      info.vertices_per_patch = ctx->TessCtrlProgram.patch_vertices;
       info.index_bias = prims[i].basevertex;
       info.drawid = prims[i].draw_id;
       if (!ib) {
          info.min_index = info.start;
          info.max_index = info.start + info.count - 1;
       }
 
       if (ST_DEBUG & DEBUG_DRAW) {
          debug_printf("st/draw: mode %s  start %u  count %u  index_size %d\n",
                       u_prim_name(info.mode),
-- 
2.7.4



More information about the mesa-dev mailing list