Okay... I screwed up this morning.  I pushed a set of four patches
without adding Jordan's Reviewed-by.  Realizing the error, I quickly
added the R-b to each commit and force-pushed the changes.

If you pushed something in the intervening 2 minutes, it got lost.

On 09/26/2014 08:00 AM, Ian Romanick wrote:
> Module: Mesa
> Branch: master
> Commit: 8e01c66da6c780601f941aa5b9939962c219fdbd
> URL:    
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e01c66da6c780601f941aa5b9939962c219fdbd
> 
> Author: Ian Romanick <ian.d.roman...@intel.com>
> Date:   Mon Sep  8 12:23:39 2014 -0700
> 
> glsl: Make sure fields after small structs have correct padding
> 
> Previously the linker would correctly calculate the layout, but the
> lower_ubo_reference pass would not apply correct alignment to fields
> following small (less than 16-byte) nested structures.
> 
> Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
> Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83533
> Cc: mesa-sta...@lists.freedesktop.org
> 
> ---
> 
>  src/glsl/lower_ubo_reference.cpp |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/src/glsl/lower_ubo_reference.cpp 
> b/src/glsl/lower_ubo_reference.cpp
> index 3cdfc04..4ae1aac 100644
> --- a/src/glsl/lower_ubo_reference.cpp
> +++ b/src/glsl/lower_ubo_reference.cpp
> @@ -327,6 +327,15 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue 
> **rvalue)
>        const glsl_type *struct_type = deref_record->record->type;
>        unsigned intra_struct_offset = 0;
>  
> +         /* glsl_type::std140_base_alignment doesn't grok interfaces.  Use
> +          * 16-bytes for the alignment because that is the general minimum of
> +          * std140.
> +          */
> +         const unsigned struct_alignment = struct_type->is_interface()
> +            ? 16
> +            : struct_type->std140_base_alignment(row_major);
> +
> +
>        for (unsigned int i = 0; i < struct_type->length; i++) {
>           const glsl_type *type = struct_type->fields.structure[i].type;
>  
> @@ -346,6 +355,19 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue 
> **rvalue)
>                      deref_record->field) == 0)
>              break;
>              intra_struct_offset += type->std140_size(field_row_major);
> +
> +            /* If the field just examined was itself a structure, apply rule
> +             * #9:
> +             *
> +             *     "The structure may have padding at the end; the base 
> offset
> +             *     of the member following the sub-structure is rounded up to
> +             *     the next multiple of the base alignment of the structure."
> +             */
> +            if (type->without_array()->is_record()) {
> +               intra_struct_offset = glsl_align(intra_struct_offset,
> +                                                struct_alignment);
> +
> +            }
>        }
>  
>        const_offset += intra_struct_offset;
> 
> _______________________________________________
> mesa-commit mailing list
> mesa-com...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
> 

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to