[Mesa-dev] [PATCH] intel/fs: Fix memory corruption when compiling a CS

Oscar Blumberg carnaval at 12-10e.me
Sat Jan 26 15:47:42 UTC 2019


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.
---
 src/intel/compiler/brw_fs_nir.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index bdc883e53..21b03a089 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -3779,8 +3779,9 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
                                  BRW_REGISTER_TYPE_UD);
       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);
-- 
2.20.1



More information about the mesa-dev mailing list