Module: Mesa
Branch: staging/21.2
Commit: 00b88496e1e9454ad093e4f5350c7445d4787634
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=00b88496e1e9454ad093e4f5350c7445d4787634

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>
(cherry picked from commit b1cf504f7837b7a165da0956f54e0cc539860666)

---

 .pick_status.json                              | 2 +-
 src/gallium/drivers/radeonsi/si_state_draw.cpp | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index b388dd10967..fd2a5a911b4 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -139,7 +139,7 @@
         "description": "radeonsi: fix clearing index_size for NGG fast launch",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp 
b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 4fc81ab1811..616d9700e36 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -2043,8 +2043,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;
                }
             }
          }
@@ -2092,6 +2090,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