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

Author: Gert Wollny <[email protected]>
Date:   Tue Jul 26 12:18:07 2022 +0200

r600/sb: fall back to unoptimized shader if RA fails

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Filip Gawin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17755>

---

 src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp | 12 +++++++-----
 src/gallium/drivers/r600/sb/sb_shader.h        |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp 
b/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp
index 7f388af6e81..4a9462d91e6 100644
--- a/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp
+++ b/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp
@@ -273,7 +273,7 @@ void coalescer::build_constraint_queue() {
        }
 }
 
-void coalescer::color_chunks() {
+int coalescer::color_chunks() {
 
        for (chunk_queue::iterator I = chunks.begin(), E = chunks.end();
                        I != E; ++I) {
@@ -333,9 +333,13 @@ void coalescer::color_chunks() {
                        ++pass;
                }
 
-               assert(color);
+               if (!color) {
+                       fprintf(stderr, "r600/SB: unable to color registers\n");
+                       return -1;
+               }
                color_chunk(c, color);
        }
+       return 0;
 }
 
 void coalescer::init_reg_bitset(sb_bitset &bs, val_set &vs) {
@@ -431,9 +435,7 @@ int coalescer::run() {
                return r;
 
        build_chunk_queue();
-       color_chunks();
-
-       return 0;
+       return color_chunks();
 }
 
 void coalescer::color_phi_constraint(ra_constraint* c) {
diff --git a/src/gallium/drivers/r600/sb/sb_shader.h 
b/src/gallium/drivers/r600/sb/sb_shader.h
index 70bea891b76..19e55246c4f 100644
--- a/src/gallium/drivers/r600/sb/sb_shader.h
+++ b/src/gallium/drivers/r600/sb/sb_shader.h
@@ -209,7 +209,7 @@ public:
        void build_constraint_queue();
        void build_chunk_queue();
        int color_constraints();
-       void color_chunks();
+       int color_chunks();
 
        ra_constraint* create_constraint(constraint_kind kind);
 

Reply via email to