treewide: Use nir_tex_src_for_ssa

Via Coccinelle patch:

    @@
    expression a, b, c;
    @@

    -a.src = nir_src_for_ssa(b);
    -a.src_type = c;
    +a = nir_tex_src_for_ssa(c, b);

    @@
    expression a, b, c;
    @@

    -a.src_type = c;
    -a.src = nir_src_for_ssa(b);
    +a = nir_tex_src_for_ssa(c, b);

Plus manual fixups, including...

* a few identity swizzles changed to nir_trim_vector in TTN and prog-to-nir to
  fix the Coccinelle-botched formatting, and similarly a pointless nir_channels
* collapsing a now-pointless temp in vtn

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23352>
This commit is contained in:
Alyssa Rosenzweig
2023-05-31 20:56:31 -04:00
committed by Marge Bot
parent 3863280399
commit 68eda9456f
23 changed files with 179 additions and 234 deletions
+9 -18
View File
@@ -2014,10 +2014,8 @@ get_texel_buffer_copy_fs(struct v3dv_device *device, VkFormat format,
nir_tex_instr *tex = nir_tex_instr_create(b.shader, 2);
tex->sampler_dim = GLSL_SAMPLER_DIM_BUF;
tex->op = nir_texop_txf;
tex->src[0].src_type = nir_tex_src_coord;
tex->src[0].src = nir_src_for_ssa(texel_offset);
tex->src[1].src_type = nir_tex_src_texture_deref;
tex->src[1].src = nir_src_for_ssa(tex_deref);
tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, texel_offset);
tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->dest_type = nir_type_uint32;
tex->is_array = false;
tex->coord_components = 1;
@@ -3365,12 +3363,9 @@ build_nir_tex_op_read(struct nir_builder *b,
nir_tex_instr *tex = nir_tex_instr_create(b->shader, 3);
tex->sampler_dim = dim;
tex->op = nir_texop_tex;
tex->src[0].src_type = nir_tex_src_coord;
tex->src[0].src = nir_src_for_ssa(tex_pos);
tex->src[1].src_type = nir_tex_src_texture_deref;
tex->src[1].src = nir_src_for_ssa(tex_deref);
tex->src[2].src_type = nir_tex_src_sampler_deref;
tex->src[2].src = nir_src_for_ssa(tex_deref);
tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, tex_pos);
tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref, tex_deref);
tex->dest_type = nir_get_nir_type_for_glsl_base_type(tex_type);
tex->is_array = glsl_sampler_type_is_array(sampler_type);
tex->coord_components = tex_pos->num_components;
@@ -3391,14 +3386,10 @@ build_nir_tex_op_ms_fetch_sample(struct nir_builder *b,
nir_tex_instr *tex = nir_tex_instr_create(b->shader, 4);
tex->sampler_dim = GLSL_SAMPLER_DIM_MS;
tex->op = nir_texop_txf_ms;
tex->src[0].src_type = nir_tex_src_coord;
tex->src[0].src = nir_src_for_ssa(tex_pos);
tex->src[1].src_type = nir_tex_src_texture_deref;
tex->src[1].src = nir_src_for_ssa(tex_deref);
tex->src[2].src_type = nir_tex_src_sampler_deref;
tex->src[2].src = nir_src_for_ssa(tex_deref);
tex->src[3].src_type = nir_tex_src_ms_index;
tex->src[3].src = nir_src_for_ssa(sample_idx);
tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, tex_pos);
tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref, tex_deref);
tex->src[3] = nir_tex_src_for_ssa(nir_tex_src_ms_index, sample_idx);
tex->dest_type = nir_get_nir_type_for_glsl_base_type(tex_type);
tex->is_array = false;
tex->coord_components = tex_pos->num_components;