[Mesa-dev] [PATCH 15/32] glsl: Modify uniform_field_visitor::recursion to take a row_major parameter

Paul Berry stereotype441 at gmail.com
Wed Jan 23 19:28:26 PST 2013


On 22 January 2013 00:52, Ian Romanick <idr at freedesktop.org> wrote:

> 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 | 10 ++++++----
>  src/glsl/linker.h          |  3 ++-
>  2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
> index c639a3d..66a2804 100644
> --- a/src/glsl/link_uniforms.cpp
> +++ b/src/glsl/link_uniforms.cpp
> @@ -65,7 +65,7 @@ uniform_field_visitor::process(ir_variable *var)
>     /* Only strdup the name if we actually will need to modify it. */
>     if (t->is_record() || (t->is_array() && t->fields.array->is_record()))
> {
>        char *name = ralloc_strdup(NULL, var->name);
> -      recursion(var->type, &name, strlen(name));
> +      recursion(var->type, &name, strlen(name), false);
>

It's not clear to me why it's ok to pass "false" for row_major here.  Can
you clarify?


>        ralloc_free(name);
>     } else {
>        this->visit_field(t, var->name);
> @@ -74,7 +74,7 @@ uniform_field_visitor::process(ir_variable *var)
>
>  void
>  uniform_field_visitor::recursion(const glsl_type *t, char **name,
> -                                size_t name_length)
> +                                 size_t name_length, bool row_major)
>  {
>     /* Records need to have each field processed individually.
>      *
> @@ -90,7 +90,8 @@ uniform_field_visitor::recursion(const glsl_type *t,
> char **name,
>          /* Append '.field' to the current uniform name. */
>          ralloc_asprintf_rewrite_tail(name, &new_length, ".%s", field);
>
> -        recursion(t->fields.structure[i].type, name, new_length);
> +         recursion(t->fields.structure[i].type, name, new_length,
> +                   t->fields.structure[i].row_major);
>        }
>     } else if (t->is_array() && t->fields.array->is_record()) {
>        for (unsigned i = 0; i < t->length; i++) {
> @@ -99,7 +100,8 @@ uniform_field_visitor::recursion(const glsl_type *t,
> char **name,
>          /* Append the subscript to the current uniform name */
>          ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", i);
>
> -        recursion(t->fields.array, name, new_length);
> +         recursion(t->fields.array, name, new_length,
> +                   t->fields.structure[i].row_major);
>        }
>     } else {
>        this->visit_field(t, *name);
> diff --git a/src/glsl/linker.h b/src/glsl/linker.h
> index c8f3844..2af1925 100644
> --- a/src/glsl/linker.h
> +++ b/src/glsl/linker.h
> @@ -92,7 +92,8 @@ private:
>      * \param name_length  Length of the current name \b not including the
>      *                     terminating \c NUL character.
>      */
> -   void recursion(const glsl_type *t, char **name, size_t name_length);
> +   void recursion(const glsl_type *t, char **name, size_t name_length,
> +                  bool row_major);
>  };
>
>  void
> --
> 1.7.11.7
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130123/fcf287d2/attachment-0001.html>


More information about the mesa-dev mailing list