Mesa (master): lima/ppir: fix crash when program uses no registers at all

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 6 04:41:24 UTC 2019


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

Author: Vasily Khoruzhick <anarsoul at gmail.com>
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 <anarsoul at gmail.com>
Reviewed-by: Qiang Yu <yuq825 at gmail.com>

---

 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))




More information about the mesa-commit mailing list