<div dir="ltr">On 22 January 2013 00:52, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
<br>
Not used yet, but the UBO layout visitor will use this.<br>
<br>
Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
---<br>
src/glsl/link_uniforms.cpp | 15 ++++++++++-----<br>
src/glsl/linker.h | 4 +++-<br>
src/mesa/program/ir_to_mesa.cpp | 8 ++++++--<br>
3 files changed, 19 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp<br>
index 66a2804..4b8dc42 100644<br>
--- a/src/glsl/link_uniforms.cpp<br>
+++ b/src/glsl/link_uniforms.cpp<br>
@@ -68,7 +68,7 @@ uniform_field_visitor::process(ir_variable *var)<br>
recursion(var->type, &name, strlen(name), false);<br>
ralloc_free(name);<br>
} else {<br>
- this->visit_field(t, var->name);<br>
+ this->visit_field(t, var->name, false);<br></blockquote><div><br></div><div>Similar question here to the question I had on the last patch: why is it safe to pass false for row_major here?<br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
}<br>
<br>
@@ -104,7 +104,7 @@ uniform_field_visitor::recursion(const glsl_type *t, char **name,<br>
t->fields.structure[i].row_major);<br>
}<br>
} else {<br>
- this->visit_field(t, *name);<br>
+ this->visit_field(t, *name, row_major);<br>
}<br>
}<br>
<br>
@@ -154,11 +154,14 @@ public:<br>
unsigned num_shader_uniform_components;<br>
<br>
private:<br>
- virtual void visit_field(const glsl_type *type, const char *name)<br>
+ virtual void visit_field(const glsl_type *type, const char *name,<br>
+ bool row_major)<br>
{<br>
assert(!type->is_record());<br>
assert(!(type->is_array() && type->fields.array->is_record()));<br>
<br>
+ (void) row_major;<br>
+<br>
/* Count the number of samplers regardless of whether the uniform is<br>
* already in the hash table. The hash table prevents adding the same<br>
* uniform for multiple shader targets, but in this case we want to<br>
@@ -258,11 +261,14 @@ public:<br>
int ubo_byte_offset;<br>
<br>
private:<br>
- virtual void visit_field(const glsl_type *type, const char *name)<br>
+ virtual void visit_field(const glsl_type *type, const char *name,<br>
+ bool row_major)<br>
{<br>
assert(!type->is_record());<br>
assert(!(type->is_array() && type->fields.array->is_record()));<br>
<br>
+ (void) row_major;<br>
+<br>
unsigned id;<br>
bool found = this->map->get(id, name);<br>
assert(found);<br>
@@ -454,7 +460,6 @@ link_update_uniform_buffer_variables(struct gl_shader *shader)<br>
for (unsigned j = 0; j < shader->UniformBlocks[i].NumUniforms; j++) {<br>
if (!strcmp(var->name, shader->UniformBlocks[i].Uniforms[j].Name)) {<br>
found = true;<br>
- var->uniform_block = i;<br>
var->location = j;<br>
break;<br>
}<br>
diff --git a/src/glsl/linker.h b/src/glsl/linker.h<br>
index 2af1925..f394bfe 100644<br>
--- a/src/glsl/linker.h<br>
+++ b/src/glsl/linker.h<br>
@@ -84,8 +84,10 @@ protected:<br>
*<br>
* \param type Type of the field.<br>
* \param name Fully qualified name of the field.<br>
+ * \param row_major For a matrix type, is it stored row-major.<br>
*/<br>
- virtual void visit_field(const glsl_type *type, const char *name) = 0;<br>
+ virtual void visit_field(const glsl_type *type, const char *name,<br>
+ bool row_major) = 0;<br>
<br>
private:<br>
/**<br>
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp<br>
index 36d0bdc..c85372a 100644<br>
--- a/src/mesa/program/ir_to_mesa.cpp<br>
+++ b/src/mesa/program/ir_to_mesa.cpp<br>
@@ -2382,7 +2382,8 @@ public:<br>
}<br>
<br>
private:<br>
- virtual void visit_field(const glsl_type *type, const char *name);<br>
+ virtual void visit_field(const glsl_type *type, const char *name,<br>
+ bool row_major);<br>
<br>
struct gl_shader_program *shader_program;<br>
struct gl_program_parameter_list *params;<br>
@@ -2390,10 +2391,13 @@ private:<br>
};<br>
<br>
void<br>
-add_uniform_to_shader::visit_field(const glsl_type *type, const char *name)<br>
+add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,<br>
+ bool row_major)<br>
{<br>
unsigned int size;<br>
<br>
+ (void) row_major;<br>
+<br>
if (type->is_vector() || type->is_scalar()) {<br>
size = type->vector_elements;<br>
} else {<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.7<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>