[Mesa-dev] [PATCH] glsl: fix explicit uniform block alignment

Eduardo Lima Mitev elima at igalia.com
Sun May 29 17:04:53 UTC 2016


On 05/28/2016 03:40 AM, Timothy Arceri wrote:
> This stops the offset being bumped again when and an explicit

there seems to be an extra "and" above.

> alignment has already been applied.
> 
> Fixes alignment issues in:
> GL44-CTS.enhanced_layouts.uniform_block_alignment
> 
> Note the test still fails due to unrelated issues with doubles.
> ---
>  src/compiler/glsl/ast_to_hir.cpp | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index b6db669..a2eb32d 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -6790,9 +6790,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
>                 fields[i].offset = glsl_align(offset, expl_align);
>                 next_offset = glsl_align(fields[i].offset + size, align);
>              }
> -         }
> -
> -         if (!qual->flags.q.explicit_offset) {
> +         } else if (!qual->flags.q.explicit_offset) {
>              if (align != 0 && size != 0)
>                 next_offset = glsl_align(next_offset + size, align);
>           }
> 

The two "if"s can be merged, but maybe is better this way, clarity-wise.

Either way:

Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>


More information about the mesa-dev mailing list