diff options
author | Jason Ekstrand <[email protected]> | 2017-05-04 14:57:52 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-05-09 15:08:06 -0700 |
commit | 5b00c3cc05cb2f6a5e15f2d2d4cd77f5014a3345 (patch) | |
tree | 966ac8dad5484a097f6d5de733df58d01bf9f3d1 /src/intel | |
parent | 0d5f89cdc376445c46f4aa1ae126286cbaebde2b (diff) |
i965/nir: Inline remap_inputs_with_vue_map
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/compiler/brw_nir.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 2b41e0470c6..026f6a2bc1a 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -97,25 +97,6 @@ add_const_offset_to_base(nir_shader *nir, nir_variable_mode mode) } static bool -remap_inputs_with_vue_map(nir_block *block, const struct brw_vue_map *vue_map) -{ - nir_foreach_instr(instr, block) { - if (instr->type != nir_instr_type_intrinsic) - continue; - - nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); - - if (intrin->intrinsic == nir_intrinsic_load_input || - intrin->intrinsic == nir_intrinsic_load_per_vertex_input) { - int vue_slot = vue_map->varying_to_slot[intrin->const_index[0]]; - assert(vue_slot != -1); - intrin->const_index[0] = vue_slot; - } - } - return true; -} - -static bool remap_tess_levels(nir_builder *b, nir_intrinsic_instr *intr, GLenum primitive_mode) { @@ -363,16 +344,30 @@ brw_nir_lower_vue_inputs(nir_shader *nir, bool is_scalar, /* Inputs are stored in vec4 slots, so use type_size_vec4(). */ nir_lower_io(nir, nir_var_shader_in, type_size_vec4, 0); - if (is_scalar || nir->stage != MESA_SHADER_GEOMETRY) { - /* This pass needs actual constants */ - nir_opt_constant_folding(nir); + if (nir->stage == MESA_SHADER_GEOMETRY && !is_scalar) + return; - add_const_offset_to_base(nir, nir_var_shader_in); + /* This pass needs actual constants */ + nir_opt_constant_folding(nir); - nir_foreach_function(function, nir) { - if (function->impl) { - nir_foreach_block(block, function->impl) { - remap_inputs_with_vue_map(block, vue_map); + add_const_offset_to_base(nir, nir_var_shader_in); + + nir_foreach_function(function, nir) { + if (!function->impl) + continue; + + nir_foreach_block(block, function->impl) { + nir_foreach_instr(instr, block) { + if (instr->type != nir_instr_type_intrinsic) + continue; + + nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); + + if (intrin->intrinsic == nir_intrinsic_load_input || + intrin->intrinsic == nir_intrinsic_load_per_vertex_input) { + int vue_slot = vue_map->varying_to_slot[intrin->const_index[0]]; + assert(vue_slot != -1); + intrin->const_index[0] = vue_slot; } } } |