Mesa (master): st/mesa: initialize members of glsl_to_tgsi_instruction in emit_asm()

Brian Paul brianp at kemper.freedesktop.org
Sat Nov 5 18:09:35 UTC 2016


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

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Nov  5 11:00:10 2016 -0600

st/mesa: initialize members of glsl_to_tgsi_instruction in emit_asm()

This fixes random crashes with MSVC release builds.  It seems the
members are implicitly initialized to zero with gcc, but not MSVC.
In particular, the tex_offset_num_offset field was non-zero causing
a loop over the NULL tex_offsets array to crash.

Zero-init those fields and a few others to be safe.

The regression began with acc23b04cfd64e "ralloc: remove memset from
ralloc_size".

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 882e959..a4679e5 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -680,6 +680,10 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned op,
    inst->is_64bit_expanded = false;
    inst->ir = ir;
    inst->dead_mask = 0;
+   inst->tex_offsets = NULL;
+   inst->tex_offset_num_offset = 0;
+   inst->saturate = 0;
+   inst->tex_shadow = 0;
    /* default to float, for paths where this is not initialized
     * (since 0==UINT which is likely wrong):
     */




More information about the mesa-commit mailing list