From: Samuel Pitoiset Date: Thu, 1 Feb 2018 10:32:32 +0000 (+0100) Subject: ac/shader: scan vertex inputs usage mask X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c57a6da5e38c18926eca22b96901e4640ec430f;p=mesa.git ac/shader: scan vertex inputs usage mask Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c index d771cd250dc..e7132638172 100644 --- a/src/amd/common/ac_shader_info.c +++ b/src/amd/common/ac_shader_info.c @@ -133,6 +133,19 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, if (nir->info.stage == MESA_SHADER_FRAGMENT) info->ps.writes_memory = true; break; + case nir_intrinsic_load_var: + if (nir->info.stage == MESA_SHADER_VERTEX) { + nir_deref_var *dvar = instr->variables[0]; + nir_variable *var = dvar->var; + + if (var->data.mode == nir_var_shader_in) { + unsigned idx = var->data.location; + uint8_t mask = + nir_ssa_def_components_read(&instr->dest.ssa); + info->vs.input_usage_mask[idx] |= mask; + } + } + break; default: break; } diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h index 59b749576aa..380c06a8551 100644 --- a/src/amd/common/ac_shader_info.h +++ b/src/amd/common/ac_shader_info.h @@ -24,6 +24,8 @@ #ifndef AC_SHADER_INFO_H #define AC_SHADER_INFO_H +#include "compiler/shader_enums.h" + struct nir_shader; struct ac_nir_compiler_options; @@ -34,6 +36,7 @@ struct ac_shader_info { bool uses_invocation_id; bool uses_prim_id; struct { + uint8_t input_usage_mask[VERT_ATTRIB_MAX]; bool has_vertex_buffers; /* needs vertex buffers and base/start */ bool needs_draw_id; bool needs_instance_id;