intel/fs: Fix memory corruption when compiling a CS
authorOscar Blumberg <carnaval@12-10e.me>
Sat, 26 Jan 2019 15:47:42 +0000 (16:47 +0100)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 1 Feb 2019 18:53:33 +0000 (10:53 -0800)
Missing check for shader stage in the fs_visitor would corrupt the
cs_prog_data.push information and trigger crashes / corruption later
when uploading the CS state.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_fs_nir.cpp

index f16627b8a6481a75ade8a994f218c7840ace0153..9012fe11d4434ccc489dfac8f9a2b51b3ce22982 100644 (file)
@@ -3782,7 +3782,8 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
       const fs_reg data = retype(get_nir_src(instr->src[2]),
                                  BRW_REGISTER_TYPE_UD);
 
-      brw_wm_prog_data(prog_data)->has_side_effects = true;
+      if (stage == MESA_SHADER_FRAGMENT)
+         brw_wm_prog_data(prog_data)->has_side_effects = true;
 
       emit_untyped_write(bld, image, addr, data, 1,
                          instr->num_components);