Module: Mesa
Branch: main
Commit: b1cf504f7837b7a165da0956f54e0cc539860666
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1cf504f7837b7a165da0956f54e0cc539860666

Author: Marek Olšák <[email protected]>
Date:   Sun Sep 26 08:40:18 2021 -0400

radeonsi: fix clearing index_size for NGG fast launch

Cc: 21.1 21.2 <[email protected]>

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13048>

---

 src/gallium/drivers/radeonsi/si_state_draw.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp 
b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index f582160177c..847515b454e 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -2187,8 +2187,6 @@ static void si_draw_vbo(struct pipe_context *ctx,
                } else if (!primitive_restart) {
                   ngg_culling |= SI_NGG_CULL_GS_FAST_LAUNCH_TRI_STRIP |
                                  
SI_NGG_CULL_GS_FAST_LAUNCH_INDEX_SIZE_PACKED(MIN2(index_size, 3));
-                  /* The index buffer will be emulated. */
-                  index_size = 0;
                }
             }
          }
@@ -2236,6 +2234,11 @@ static void si_draw_vbo(struct pipe_context *ctx,
       }
    }
 
+   /* ngg_culling can be changed after si_update_shaders above, so determine 
index_size here. */
+   if (GFX_VERSION >= GFX10 && NGG &&
+       sctx->ngg_culling & SI_NGG_CULL_GS_FAST_LAUNCH_INDEX_SIZE_PACKED(~0))
+      index_size = 0; /* The index buffer will be emulated. */
+
    /* Since we've called si_context_add_resource_size for vertex buffers,
     * this must be called after si_need_cs_space, because we must let
     * need_cs_space flush before we add buffers to the buffer list.

Reply via email to