[Mesa-dev] [PATCH] r600/sb: Add a NOP/EOP if the shader is optimized away completely

Gert Wollny gw.fossdev at gmail.com
Wed Jan 10 10:11:31 UTC 2018


sb might optimize away a shader completely which results in a segfault, since
in this case last_cf is NULL.

Signed-off-by: Gert Wollny <gw.fossdev at gmail.com>
---
 src/gallium/drivers/r600/sb/sb_bc_finalize.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
index 5b202c3737..f5654c90f1 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
@@ -95,7 +95,7 @@ int bc_finalizer::run() {
 		last_cf = c;
 	}
 
-	if (!ctx.is_cayman() && last_cf->bc.op_ptr->flags & CF_ALU) {
+	if (!ctx.is_cayman() && (!last_cf || last_cf->bc.op_ptr->flags & CF_ALU)) {
 		last_cf = sh.create_cf(CF_OP_NOP);
 		sh.root->push_back(last_cf);
 	}
-- 
2.13.6



More information about the mesa-dev mailing list