From 53bf7c8fd2e11a6c64d6ff3a98b56d64d2242505 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Tue, 10 Feb 2015 03:02:09 -0500 Subject: glsl: fix uniform linking logic in the presence of structs Add a enter/leave record callback so that the offset may be aligned to the proper value. Otherwise only leaf fields are called, and the first field needs to be aligned to the outer struct's base alignment while the last field needs to be aligned to the inner struct's base alignment. This removes most usage of the last field/record type values passed into visit_field. Signed-off-by: Ilia Mirkin Reviewed-by: Dave Airlie --- src/glsl/linker.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl/linker.h') diff --git a/src/glsl/linker.h b/src/glsl/linker.h index 6ee5858..be4da5e 100644 --- a/src/glsl/linker.h +++ b/src/glsl/linker.h @@ -170,6 +170,12 @@ protected: */ virtual void visit_field(const glsl_struct_field *field); + virtual void enter_record(const glsl_type *type, const char *name, + bool row_major); + + virtual void leave_record(const glsl_type *type, const char *name, + bool row_major); + private: /** * \param name_length Length of the current name \b not including the -- cgit v1.1