[Mesa-stable] [PATCH 5/5] radeonsi: bail out instead of crashing if the main shader part failed to compile

Nicolai Hähnle nhaehnle at gmail.com
Mon Jul 17 10:57:37 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/gallium/drivers/radeonsi/si_shader.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index af93ca1..30de03f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -7359,20 +7359,23 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
 		 * - the prolog part is inserted at the beginning
 		 * - the epilog part is inserted at the end
 		 *
 		 * The prolog and epilog have many (but simple) variants.
 		 *
 		 * Starting with gfx9, geometry and tessellation control
 		 * shaders also contain the prolog and user shader parts of
 		 * the previous shader stage.
 		 */
 
+		if (!mainp)
+			return -1;
+
 		/* Copy the compiled TGSI shader data over. */
 		shader->is_binary_shared = true;
 		shader->binary = mainp->binary;
 		shader->config = mainp->config;
 		shader->info.num_input_sgprs = mainp->info.num_input_sgprs;
 		shader->info.num_input_vgprs = mainp->info.num_input_vgprs;
 		shader->info.face_vgpr_index = mainp->info.face_vgpr_index;
 		memcpy(shader->info.vs_output_param_offset,
 		       mainp->info.vs_output_param_offset,
 		       sizeof(mainp->info.vs_output_param_offset));
-- 
2.9.3



More information about the mesa-stable mailing list