[Mesa-dev] [PATCH v5 5/7] glsl: Add precision information to ir_variable

Ilia Mirkin imirkin at alum.mit.edu
Fri Nov 13 12:38:06 PST 2015


On Fri, Nov 13, 2015 at 2:37 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Looks like valgrind hates this for some reason. I'm seeing lots of
>
> ==16821== Conditional jump or move depends on uninitialised value(s)
> ==16821==    at 0xA074D09: glsl_type::record_compare(glsl_type const*)
> const (glsl_types.cpp:783)
>
> Where line 783 is:
>
>       if (this->fields.structure[i].precision
>           != b->fields.structure[i].precision)
>
> This happens with the trace from
> https://bugs.freedesktop.org/show_bug.cgi?id=92229 but I suspect it
> happens with just about anything with structs.

I tried the following but no go. I'm giving up for now.

  -ilia

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 51ea183..92f8b37 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -6584,6 +6584,8 @@ ast_interface_block::hir(exec_list *instructions,
                earlier_per_vertex->fields.structure[j].sample;
             fields[i].patch =
                earlier_per_vertex->fields.structure[j].patch;
+            fields[i].precision =
+               earlier_per_vertex->fields.structure[j].precision;
          }
       }

diff --git a/src/glsl/nir/glsl_types.cpp b/src/glsl/nir/glsl_types.cpp
index 975b815..7345765 100644
--- a/src/glsl/nir/glsl_types.cpp
+++ b/src/glsl/nir/glsl_types.cpp
@@ -124,6 +124,7 @@ glsl_type::glsl_type(const glsl_struct_field
*fields, unsigned num_fields,
       this->fields.structure[i].sample = fields[i].sample;
       this->fields.structure[i].matrix_layout = fields[i].matrix_layout;
       this->fields.structure[i].patch = fields[i].patch;
+      this->fields.structure[i].precision = fields[i].precision;
       this->fields.structure[i].image_read_only = fields[i].image_read_only;
       this->fields.structure[i].image_write_only = fields[i].image_write_only;
       this->fields.structure[i].image_coherent = fields[i].image_coherent;
diff --git a/src/glsl/nir/glsl_types.h b/src/glsl/nir/glsl_types.h
index d841a32..f3a0cf8 100644
--- a/src/glsl/nir/glsl_types.h
+++ b/src/glsl/nir/glsl_types.h
@@ -851,7 +851,7 @@ struct glsl_struct_field {

    glsl_struct_field(const struct glsl_type *_type, const char *_name)
       : type(_type), name(_name), location(-1), interpolation(0), centroid(0),
-        sample(0), matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED), patch(0)
+        sample(0), matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED),
patch(0), precision(0)
    {
       /* empty */
    }


More information about the mesa-dev mailing list