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

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26190>

---

 src/gallium/drivers/radeonsi/si_state_shaders.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp 
b/src/gallium/drivers/radeonsi/si_state_shaders.cpp
index c9c7a02197c..42d3e78af8d 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp
@@ -4396,8 +4396,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