From: Jason Ekstrand Date: Wed, 22 Jul 2020 16:26:14 +0000 (-0500) Subject: r600/sfn/lower_tex: Get rid of the lower_sampler vector X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc51cec9c08b18055596a4823b272f62f928c062;p=mesa.git r600/sfn/lower_tex: Get rid of the lower_sampler vector We can get the result type information easily from nir_tex_instr itself by looking at dest_type. There's no reason to construct a vector and try to index into it. Reviewed-by: Gert Wollny Part-of: --- diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_tex.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_tex.cpp index 823674c2f97..49d3d9a8098 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instruction_tex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instruction_tex.cpp @@ -165,7 +165,7 @@ static bool lower_coord_shift_unnormalized(nir_builder& b, nir_tex_instr *tex) } static bool -r600_nir_lower_int_tg4_impl(nir_function_impl *impl, const std::vector& lower) +r600_nir_lower_int_tg4_impl(nir_function_impl *impl) { nir_builder b; nir_builder_init(&b, impl); @@ -177,7 +177,7 @@ r600_nir_lower_int_tg4_impl(nir_function_impl *impl, const std::vector& lo nir_tex_instr *tex = nir_instr_as_tex(instr); if (tex->op == nir_texop_tg4 && tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE) { - if (lower[tex->sampler_index]) { + if (nir_alu_type_get_base_type(tex->dest_type) != nir_type_float) { if (tex->sampler_dim != GLSL_SAMPLER_DIM_RECT) lower_coord_shift_normalized(b, tex); else @@ -207,24 +207,17 @@ bool r600_nir_lower_int_tg4(nir_shader *shader) bool progress = false; bool need_lowering = false; - int i = 0; - - std::vector lower_sampler(shader->uniforms.length(), false); - auto is = lower_sampler.begin(); - nir_foreach_uniform_variable(var, shader) { if (var->type->is_sampler()) { if (glsl_base_type_is_integer(var->type->sampled_type)) { - need_lowering = *is = true; + need_lowering = true; } - ++i; - ++is; } } if (need_lowering) { nir_foreach_function(function, shader) { - if (function->impl && r600_nir_lower_int_tg4_impl(function->impl, lower_sampler)) + if (function->impl && r600_nir_lower_int_tg4_impl(function->impl)) progress = true; } }