glsl: Modify uniform_field_visitor::visit_field to take a row_major parameter
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 22 Jan 2013 03:41:13 +0000 (22:41 -0500)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 25 Jan 2013 14:07:34 +0000 (09:07 -0500)
Not used yet, but the UBO layout visitor will use this.

v2: Remove a spruious hunk.  This is moved to the patch "glsl: Remove
ir_variable::uniform_block".  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/link_uniforms.cpp
src/glsl/linker.h
src/mesa/program/ir_to_mesa.cpp

index c5661bb2f47e0cac20836b6f9e1aed56d5ea54b1..90d46da07213ac28e1fee5a4f56600638c048386 100644 (file)
@@ -73,7 +73,7 @@ uniform_field_visitor::process(ir_variable *var)
       recursion(var->type, &name, strlen(name), false);
       ralloc_free(name);
    } else {
-      this->visit_field(t, var->name);
+      this->visit_field(t, var->name, false);
    }
 }
 
@@ -109,7 +109,7 @@ uniform_field_visitor::recursion(const glsl_type *t, char **name,
                    t->fields.structure[i].row_major);
       }
    } else {
-      this->visit_field(t, *name);
+      this->visit_field(t, *name, row_major);
    }
 }
 
@@ -159,11 +159,14 @@ public:
    unsigned num_shader_uniform_components;
 
 private:
-   virtual void visit_field(const glsl_type *type, const char *name)
+   virtual void visit_field(const glsl_type *type, const char *name,
+                            bool row_major)
    {
       assert(!type->is_record());
       assert(!(type->is_array() && type->fields.array->is_record()));
 
+      (void) row_major;
+
       /* Count the number of samplers regardless of whether the uniform is
        * already in the hash table.  The hash table prevents adding the same
        * uniform for multiple shader targets, but in this case we want to
@@ -263,11 +266,14 @@ public:
    int ubo_byte_offset;
 
 private:
-   virtual void visit_field(const glsl_type *type, const char *name)
+   virtual void visit_field(const glsl_type *type, const char *name,
+                            bool row_major)
    {
       assert(!type->is_record());
       assert(!(type->is_array() && type->fields.array->is_record()));
 
+      (void) row_major;
+
       unsigned id;
       bool found = this->map->get(id, name);
       assert(found);
index e69098afdc3d450a337ac0063531ca062289d198..0ad217f841c977f924f6f86f5ed21a101938a494 100644 (file)
@@ -90,8 +90,10 @@ protected:
     *
     * \param type  Type of the field.
     * \param name  Fully qualified name of the field.
+    * \param row_major  For a matrix type, is it stored row-major.
     */
-   virtual void visit_field(const glsl_type *type, const char *name) = 0;
+   virtual void visit_field(const glsl_type *type, const char *name,
+                            bool row_major) = 0;
 
 private:
    /**
index 03a1dc402c39123d51e10bbf4c69b27a0bb05b4c..b197ad3443784bafe23843cda0abffa67fa20c42 100644 (file)
@@ -2389,7 +2389,8 @@ public:
    }
 
 private:
-   virtual void visit_field(const glsl_type *type, const char *name);
+   virtual void visit_field(const glsl_type *type, const char *name,
+                            bool row_major);
 
    struct gl_shader_program *shader_program;
    struct gl_program_parameter_list *params;
@@ -2397,10 +2398,13 @@ private:
 };
 
 void
-add_uniform_to_shader::visit_field(const glsl_type *type, const char *name)
+add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
+                                   bool row_major)
 {
    unsigned int size;
 
+   (void) row_major;
+
    if (type->is_vector() || type->is_scalar()) {
       size = type->vector_elements;
    } else {