diff options
author | Eric Anholt <[email protected]> | 2018-09-18 10:34:11 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-10-30 10:46:52 -0700 |
commit | 17c81989521731af25a633622a0ded437538ab00 (patch) | |
tree | f6d099f02c3e4927a58f5d430a2ade5b6a9f8b3c /src/broadcom/compiler/vir.c | |
parent | fc85f7cfdc154e6c2f29445b6023b379c3c18864 (diff) |
v3d: Use nir_lower_io_to_scalar_early to DCE unused VS input components.
This lets us trim unused trailing components in the vertex attributes,
reducing the size of our VPM allocations.
Diffstat (limited to 'src/broadcom/compiler/vir.c')
-rw-r--r-- | src/broadcom/compiler/vir.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index 6b55b0e03bc..faad6541151 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -585,6 +585,12 @@ vir_compile_init(const struct v3d_compiler *compiler, return c; } +static int +type_size_vec4(const struct glsl_type *type) +{ + return glsl_count_attribute_slots(type, false); +} + static void v3d_lower_nir(struct v3d_compile *c) { @@ -713,6 +719,16 @@ uint64_t *v3d_compile_vs(const struct v3d_compiler *compiler, c->vs_key = key; + /* Split our input vars and dead code eliminate the unused + * components. + */ + NIR_PASS_V(c->s, nir_lower_io_to_scalar_early, nir_var_shader_in); + v3d_optimize_nir(c->s); + NIR_PASS_V(c->s, nir_remove_dead_variables, nir_var_shader_in); + NIR_PASS_V(c->s, nir_lower_io, nir_var_shader_in, + type_size_vec4, + (nir_lower_io_options)0); + v3d_lower_nir(c); if (key->clamp_color) |