From 39bf61aa37b0336aa27d8e3d2bf64587f07ff477 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 21 Mar 2018 16:48:35 -0700 Subject: nir: Add a concept of per-member structs and a lowering pass This adds a concept of "members" to a variable with an interface type. It allows you to specify the full variable data for each member of the interface instead of once for the variable. We also add a lowering pass to lower those variables to a sequence of variables and rewrite all the derefs accordingly. Acked-by: Rob Clark Acked-by: Bas Nieuwenhuizen Acked-by: Dave Airlie Reviewed-by: Kenneth Graunke --- src/compiler/nir/nir.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/compiler/nir/nir.h') diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 99ec43c1778..9e4aa1df5bd 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -370,6 +370,17 @@ typedef struct nir_variable { * \sa ir_variable::location */ const struct glsl_type *interface_type; + + /** + * Description of per-member data for per-member struct variables + * + * This is used for variables which are actually an amalgamation of + * multiple entities such as a struct of built-in values or a struct of + * inputs each with their own layout specifier. This is only allowed on + * variables with a struct or array of array of struct type. + */ + unsigned num_members; + struct nir_variable_data *members; } nir_variable; #define nir_foreach_variable(var, var_list) \ @@ -2678,6 +2689,7 @@ void nir_dump_cfg(nir_shader *shader, FILE *fp); int nir_gs_count_vertices(const nir_shader *shader); bool nir_split_var_copies(nir_shader *shader); +bool nir_split_per_member_structs(nir_shader *shader); bool nir_lower_returns_impl(nir_function_impl *impl); bool nir_lower_returns(nir_shader *shader); -- cgit v1.2.3