Mesa (master): glsl: Initialize all fields of ir_variable in constructor

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 28 13:38:28 UTC 2019


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

Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date:   Fri Oct 25 19:33:08 2019 +0300

glsl: Initialize all fields of ir_variable in constructor

Better be safe, even if we could technically avoid this for
some fields.

Cc: <mesa-stable at lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1999
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Tested-by: Witold Baryluk <witold.baryluk at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/compiler/glsl/ir.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 1144cbcae8d..7a6fe46073a 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1720,15 +1720,28 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
    this->u.max_ifc_array_access = NULL;
 
    this->data.explicit_location = false;
+   this->data.explicit_index = false;
+   this->data.explicit_binding = false;
+   this->data.explicit_component = false;
    this->data.has_initializer = false;
+   this->data.is_unmatched_generic_inout = false;
+   this->data.is_xfb_only = false;
+   this->data.explicit_xfb_buffer = false;
+   this->data.explicit_xfb_offset = false;
+   this->data.explicit_xfb_stride = false;
    this->data.location = -1;
    this->data.location_frac = 0;
+   this->data.matrix_layout = GLSL_MATRIX_LAYOUT_INHERITED;
+   this->data.from_named_ifc_block = false;
+   this->data.must_be_shader_input = false;
+   this->data.index = 0;
    this->data.binding = 0;
    this->data.warn_extension_index = 0;
    this->constant_value = NULL;
    this->constant_initializer = NULL;
    this->data.depth_layout = ir_depth_layout_none;
    this->data.used = false;
+   this->data.assigned = false;
    this->data.always_active_io = false;
    this->data.read_only = false;
    this->data.centroid = false;
@@ -1736,6 +1749,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
    this->data.patch = false;
    this->data.explicit_invariant = false;
    this->data.invariant = false;
+   this->data.precise = false;
    this->data.how_declared = ir_var_declared_normally;
    this->data.mode = mode;
    this->data.interpolation = INTERP_MODE_NONE;
@@ -1748,9 +1762,18 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
    this->data.memory_volatile = false;
    this->data.memory_restrict = false;
    this->data.from_ssbo_unsized_array = false;
+   this->data.implicit_sized_array = false;
    this->data.fb_fetch_output = false;
    this->data.bindless = false;
    this->data.bound = false;
+   this->data.image_format = GL_NONE;
+   this->data._num_state_slots = 0;
+   this->data.param_index = 0;
+   this->data.stream = 0;
+   this->data.xfb_buffer = -1;
+   this->data.xfb_stride = -1;
+
+   this->interface_type = NULL;
 
    if (type != NULL) {
       if (type->is_interface())




More information about the mesa-commit mailing list