Module: Mesa
Branch: master
Commit: 5980565a37909c01281b483c371f5eec03e9689a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5980565a37909c01281b483c371f5eec03e9689a

Author: Vasily Khoruzhick <[email protected]>
Date:   Fri May 31 22:30:54 2019 -0700

lima/ppir: fix crash when program uses no registers at all

Program may need no regalloc at all, e.g. in case when program consists
of single discard op.

Signed-off-by: Vasily Khoruzhick <[email protected]>
Reviewed-by: Qiang Yu <[email protected]>

---

 src/gallium/drivers/lima/ir/pp/regalloc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/lima/ir/pp/regalloc.c 
b/src/gallium/drivers/lima/ir/pp/regalloc.c
index 6aa71e91cfe..dee530ca2b6 100644
--- a/src/gallium/drivers/lima/ir/pp/regalloc.c
+++ b/src/gallium/drivers/lima/ir/pp/regalloc.c
@@ -747,6 +747,10 @@ bool ppir_regalloc_prog(ppir_compiler *comp)
 
    ppir_regalloc_update_reglist_ssa(comp);
 
+   /* No registers? Probably shader consists of discard instruction */
+   if (list_empty(&comp->reg_list))
+      return true;
+
    /* this will most likely succeed in the first
     * try, except for very complicated shaders */
    while (!ppir_regalloc_prog_try(comp, &spilled))

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to