OSDN Git Service

swr: limit pipe_draw_info->restart_index usage
authorTim Rowley <timothy.o.rowley@intel.com>
Tue, 22 Aug 2017 15:39:57 +0000 (10:39 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Wed, 23 Aug 2017 16:37:50 +0000 (11:37 -0500)
Only copy this value when in restart drawing mode.

Eliminates valgrind errors when running trivial programs.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/swr_draw.cpp

index df1c11a..2363800 100644 (file)
@@ -107,7 +107,10 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    }
 
    struct swr_vertex_element_state *velems = ctx->velems;
-   velems->fsState.cutIndex = info->restart_index;
+   if (info->primitive_restart)
+      velems->fsState.cutIndex = info->restart_index;
+   else
+      velems->fsState.cutIndex = 0;
    velems->fsState.bEnableCutIndex = info->primitive_restart;
    velems->fsState.bPartialVertexBuffer = (info->min_index > 0);