glsl: always initialize image_* fields, copy them on interface init
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 19 Jan 2016 06:43:40 +0000 (01:43 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 30 Jan 2016 02:04:56 +0000 (21:04 -0500)
Interfaces can have image properties set in case they are buffer
interfaces. Make sure not to lose this information.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/glsl/builtin_variables.cpp
src/compiler/glsl_types.cpp
src/compiler/glsl_types.h

index 25d92cc691b759b04b29d511911c4d14dc252d2b..6db74f1c634f638fad128273edfaac8ec42a7ccf 100644 (file)
@@ -328,6 +328,11 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type,
    this->fields[this->num_fields].sample = 0;
    this->fields[this->num_fields].patch = 0;
    this->fields[this->num_fields].precision = GLSL_PRECISION_NONE;
+   this->fields[this->num_fields].image_read_only = 0;
+   this->fields[this->num_fields].image_write_only = 0;
+   this->fields[this->num_fields].image_coherent = 0;
+   this->fields[this->num_fields].image_volatile = 0;
+   this->fields[this->num_fields].image_restrict = 0;
    this->num_fields++;
 }
 
index ef6c3c6e3b7dbc053c481f9721a55da1d593a2d4..1458ad366cdc0c8dc3add6cf03a4b679f3fdae5d 100644 (file)
@@ -163,6 +163,11 @@ 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].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;
+      this->fields.structure[i].image_volatile = fields[i].image_volatile;
+      this->fields.structure[i].image_restrict = fields[i].image_restrict;
       this->fields.structure[i].precision = fields[i].precision;
    }
 
index e63d7945c9f437937d2cb62927d26e3d28be58f5..00133d9cb258b16a557aae0f1bd6609579b06d8a 100644 (file)
@@ -863,7 +863,8 @@ 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),
-        precision(GLSL_PRECISION_NONE)
+        precision(GLSL_PRECISION_NONE), image_read_only(0), image_write_only(0),
+        image_coherent(0), image_volatile(0), image_restrict(0)
    {
       /* empty */
    }