glsl: fix explicit uniform block alignment
authorTimothy Arceri <timothy.arceri@collabora.com>
Sat, 28 May 2016 01:40:22 +0000 (11:40 +1000)
committerTimothy Arceri <timothy.arceri@collabora.com>
Mon, 30 May 2016 01:01:32 +0000 (11:01 +1000)
This stops the offset being bumped again when and an explicit
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.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/compiler/glsl/ast_to_hir.cpp

index e1e26f8f6ac45e7e1d8a75ecd7f5c139928baf20..c3af715b934e571d8365b0c03ef78942100e6c1e 100644 (file)
@@ -6811,9 +6811,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);
          }