[Mesa-dev] [PATCH 2/7] nvc0: only update primitive restart for indexed draws

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Oct 25 19:41:11 UTC 2016


Unnecessary to update it at every draw calls, especially for
non-indexed draws. This is similar to what nv50 already does.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
index bc4ab9e..138e24d 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
@@ -1050,8 +1050,6 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
        nvc0->idxbuf.buffer->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT)
       nvc0->base.vbo_dirty = true;
 
-   nvc0_update_prim_restart(nvc0, info->primitive_restart, info->restart_index);
-
    if (nvc0->base.vbo_dirty) {
       if (nvc0->screen->eng3d->oclass < GM107_3D_CLASS)
          IMMED_NVC0(push, NVC0_3D(VERTEX_ARRAY_FLUSH), 0);
@@ -1067,6 +1065,9 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    if (info->indexed) {
       bool shorten = info->max_index <= 65535;
 
+      nvc0_update_prim_restart(nvc0, info->primitive_restart,
+                               info->restart_index);
+
       if (info->primitive_restart && info->restart_index > 65535)
          shorten = false;
 
-- 
2.10.1



More information about the mesa-dev mailing list