glsl: Initialize patch member of glsl_struct_field
authorMichel Dänzer <michel.daenzer@amd.com>
Wed, 5 Aug 2015 09:17:14 +0000 (18:17 +0900)
committerMichel Dänzer <michel@daenzer.net>
Thu, 6 Aug 2015 02:53:43 +0000 (11:53 +0900)
commitf7ac4ef4eeea737115d0b574fed7ecae46426072
tree13d5faac944237c4cc4911e2933ccaa9e4621966
parent2c61d583f8c931fc9834dd852b1c960c95acefb5
glsl: Initialize patch member of glsl_struct_field

There is apparently a subtle difference in C++ between

    F f;

and

    F f();

The former will use the default constructor.  If there is no default
constructor specified, the compiler provides one that simply invokes the
default constructor for each field.  For built-in basic types, the
default constructor does nothing.  The later will, according to
http://stackoverflow.com/questions/2417065/does-the-default-constructor-initialize-built-in-types)
perform value-initialization of the type.  For built-in types this means
initializing to zero.

The per_vertex_accumulator constructor is:

    per_vertex_accumulator::per_vertex_accumulator()
       : fields(),
         num_fields(0)
    {
    }

This is the second form of constructor, so the glsl_struct_field
objects were previously zero initialized.  With the addition of an empty
default constructor in commit 7ac946e5, per_vertex_accumulator::fields
receive no initialization.

Fixes a bunch of random (mostly tessellation related) piglit failures
since commit 7ac946e5 ("glsl: Add constuctors for the common cases of
glsl_struct_field").

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91544
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/builtin_variables.cpp