Module: Mesa
Branch: 23.3
Commit: 3ed7b95a559930479edcca7466e6cede430836d4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ed7b95a559930479edcca7466e6cede430836d4

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com>
Date:   Tue Nov 14 13:41:47 2023 +0100

radeonsi: check sctx->tess_rings is valid before using it

Fixes: c89ca3b47f1 ("radeonsi: change si_emit_derived_tess_state into a state 
atom")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10015

Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26190>
(cherry picked from commit 945288ffaecac106c978d10cd4d8512fa2992c47)

---

 .pick_status.json                                 |  2 +-
 src/gallium/drivers/radeonsi/si_state_shaders.cpp | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9dda1c32a4b..7625de7581a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -154,7 +154,7 @@
         "description": "radeonsi: check sctx->tess_rings is valid before using 
it",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "c89ca3b47f11ce2c2e6953d37590021e89c1d119",
         "notes": null
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp 
b/src/gallium/drivers/radeonsi/si_state_shaders.cpp
index c6d0010e6c2..7f4a73335da 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp
@@ -4274,8 +4274,16 @@ static void si_set_patch_vertices(struct pipe_context 
*ctx, uint8_t patch_vertic
    if (sctx->patch_vertices != patch_vertices) {
       sctx->patch_vertices = patch_vertices;
       si_update_tess_in_out_patch_vertices(sctx);
-      if (sctx->shader.tcs.current)
-         si_update_tess_io_layout_state(sctx);
+      if (sctx->shader.tcs.current) {
+         /* Update the io layout now if possible,
+          * otherwise make sure it's done by si_update_shaders.
+          */
+         if (sctx->tess_rings)
+            si_update_tess_io_layout_state(sctx);
+         else
+            sctx->do_update_shaders = true;
+      }
+
    }
 }
 

Reply via email to