glsl: store the image format in glsl_struct_field
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 6 May 2017 14:55:46 +0000 (16:55 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 8 May 2017 14:04:05 +0000 (16:04 +0200)
ARB_bindless_texture allows to declare image types inside
structures, which means we need to keep track of the format.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/glsl/builtin_variables.cpp
src/compiler/glsl_types.cpp
src/compiler/glsl_types.h

index a45c9d62c71afda30f4478ee99712c85f239513c..ce4dd43730c1c04796d61363ca3ad69040374a30 100644 (file)
@@ -341,6 +341,7 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type,
    this->fields[this->num_fields].memory_coherent = 0;
    this->fields[this->num_fields].memory_volatile = 0;
    this->fields[this->num_fields].memory_restrict = 0;
+   this->fields[this->num_fields].image_format = 0;
    this->fields[this->num_fields].explicit_xfb_buffer = 0;
    this->fields[this->num_fields].xfb_buffer = -1;
    this->fields[this->num_fields].xfb_stride = -1;
index 3930029180d52d7c2b257a7d9586670c5ba67038..43c0188e47f3450e8381e355a96ec0f2331647b8 100644 (file)
@@ -965,6 +965,9 @@ glsl_type::record_compare(const glsl_type *b, bool match_locations) const
       if (this->fields.structure[i].memory_restrict
           != b->fields.structure[i].memory_restrict)
          return false;
+      if (this->fields.structure[i].image_format
+          != b->fields.structure[i].image_format)
+         return false;
       if (this->fields.structure[i].precision
           != b->fields.structure[i].precision)
          return false;
index 04490872385303c420750859de6c5c7382f71464..67c152119f8344ff106f1f8174923778d31e0687 100644 (file)
@@ -977,6 +977,11 @@ struct glsl_struct_field {
    unsigned memory_volatile:1;
    unsigned memory_restrict:1;
 
+   /**
+    * Layout format, applicable to image variables only.
+    */
+   unsigned image_format:16;
+
    /**
     * Any of the xfb_* qualifiers trigger the shader to be in transform
     * feedback mode so we need to keep track of whether the buffer was
@@ -992,7 +997,8 @@ struct glsl_struct_field {
         sample(0), matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED), patch(0),
         precision(GLSL_PRECISION_NONE), memory_read_only(0),
         memory_write_only(0), memory_coherent(0), memory_volatile(0),
-        memory_restrict(0), explicit_xfb_buffer(0), implicit_sized_array(0)
+        memory_restrict(0), image_format(0), explicit_xfb_buffer(0),
+        implicit_sized_array(0)
    {
       /* empty */
    }