glsl: copy explicit offset to uniform storage
[mesa.git] / src / compiler / glsl / link_uniforms.cpp
index deaba94df1cc5298638353552329b671cf1317b2..fb915c9e5f1c243fffc484237027296207a7aa2e 100644 (file)
@@ -194,6 +194,9 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
          if (t->fields.structure[i].type->is_record())
             this->visit_field(&t->fields.structure[i]);
 
+         if (t->is_interface() && t->fields.structure[i].offset != -1)
+            this->set_buffer_offset(t->fields.structure[i].offset);
+
          /* Append '.field' to the current variable name. */
          if (name_length == 0) {
             ralloc_asprintf_rewrite_tail(name, &new_length, "%s", field);
@@ -297,6 +300,11 @@ program_resource_visitor::leave_record(const glsl_type *, const char *, bool,
 {
 }
 
+void
+program_resource_visitor::set_buffer_offset(unsigned)
+{
+}
+
 void
 program_resource_visitor::set_record_array_count(unsigned)
 {
@@ -676,6 +684,11 @@ private:
       }
    }
 
+   virtual void set_buffer_offset(unsigned offset)
+   {
+      this->ubo_byte_offset = offset;
+   }
+
    virtual void set_record_array_count(unsigned record_array_count)
    {
       this->record_array_count = record_array_count;