[Mesa-dev] [PATCH 16/32] glsl: Modify uniform_field_visitor::visit_field to take a row_major parameter
Ian Romanick
idr at freedesktop.org
Tue Jan 22 00:52:07 PST 2013
From: Ian Romanick <ian.d.romanick at intel.com>
Not used yet, but the UBO layout visitor will use this.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/link_uniforms.cpp | 15 ++++++++++-----
src/glsl/linker.h | 4 +++-
src/mesa/program/ir_to_mesa.cpp | 8 ++++++--
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 66a2804..4b8dc42 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -68,7 +68,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);
}
}
@@ -104,7 +104,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);
}
}
@@ -154,11 +154,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
@@ -258,11 +261,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);
@@ -454,7 +460,6 @@ link_update_uniform_buffer_variables(struct gl_shader *shader)
for (unsigned j = 0; j < shader->UniformBlocks[i].NumUniforms; j++) {
if (!strcmp(var->name, shader->UniformBlocks[i].Uniforms[j].Name)) {
found = true;
- var->uniform_block = i;
var->location = j;
break;
}
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index 2af1925..f394bfe 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -84,8 +84,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:
/**
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 36d0bdc..c85372a 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2382,7 +2382,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;
@@ -2390,10 +2391,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 {
--
1.7.11.7
More information about the mesa-dev
mailing list