glsl: Put `sample`-qualified varyings in their own packing classes
[mesa.git] / src / glsl / glsl_types.cpp
index bc8d87f5fa6ca1eeced6768acea093e3a0a4fdac..12d4ac0eeba038b8e7474d355e82b8d851383428 100644 (file)
@@ -103,6 +103,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
       this->fields.structure[i].location = fields[i].location;
       this->fields.structure[i].interpolation = fields[i].interpolation;
       this->fields.structure[i].centroid = fields[i].centroid;
+      this->fields.structure[i].sample = fields[i].sample;
       this->fields.structure[i].row_major = fields[i].row_major;
    }
 }
@@ -130,6 +131,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
       this->fields.structure[i].location = fields[i].location;
       this->fields.structure[i].interpolation = fields[i].interpolation;
       this->fields.structure[i].centroid = fields[i].centroid;
+      this->fields.structure[i].sample = fields[i].sample;
       this->fields.structure[i].row_major = fields[i].row_major;
    }
 }
@@ -168,6 +170,24 @@ glsl_type::contains_integer() const
    }
 }
 
+bool
+glsl_type::contains_opaque() const {
+   switch (base_type) {
+   case GLSL_TYPE_SAMPLER:
+   case GLSL_TYPE_ATOMIC_UINT:
+      return true;
+   case GLSL_TYPE_ARRAY:
+      return element_type()->contains_opaque();
+   case GLSL_TYPE_STRUCT:
+      for (unsigned int i = 0; i < length; i++) {
+         if (fields.structure[i].type->contains_opaque())
+            return true;
+      }
+      return false;
+   default:
+      return false;
+   }
+}
 
 gl_texture_index
 glsl_type::sampler_index() const
@@ -465,6 +485,9 @@ glsl_type::record_key_compare(const void *a, const void *b)
       if (key1->fields.structure[i].centroid
           != key2->fields.structure[i].centroid)
          return 1;
+      if (key1->fields.structure[i].sample
+          != key2->fields.structure[i].sample)
+         return 1;
    }
 
    return 0;
@@ -601,6 +624,7 @@ glsl_type::component_slots() const
       return this->length * this->fields.array->component_slots();
 
    case GLSL_TYPE_SAMPLER:
+   case GLSL_TYPE_ATOMIC_UINT:
    case GLSL_TYPE_VOID:
    case GLSL_TYPE_ERROR:
       break;
@@ -889,6 +913,7 @@ glsl_type::count_attribute_slots() const
       return this->length * this->fields.array->count_attribute_slots();
 
    case GLSL_TYPE_SAMPLER:
+   case GLSL_TYPE_ATOMIC_UINT:
    case GLSL_TYPE_VOID:
    case GLSL_TYPE_ERROR:
       break;