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
+4 -8
View File
@@ -162,8 +162,7 @@ blorp_create_nir_tex_instr(nir_builder *b, struct brw_blorp_blit_vars *v,
nir_load_var(b, v->v_src_z));
}
tex->src[0].src_type = nir_tex_src_coord;
tex->src[0].src = nir_src_for_ssa(pos);
tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, pos);
tex->coord_components = 3;
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
@@ -188,8 +187,7 @@ blorp_nir_tex(nir_builder *b, struct brw_blorp_blit_vars *v,
assert(pos->num_components == 2);
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
tex->src[1].src_type = nir_tex_src_lod;
tex->src[1].src = nir_src_for_ssa(nir_imm_int(b, 0));
tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(b, 0));
nir_builder_instr_insert(b, &tex->instr);
@@ -204,8 +202,7 @@ blorp_nir_txf(nir_builder *b, struct brw_blorp_blit_vars *v,
blorp_create_nir_tex_instr(b, v, nir_texop_txf, pos, 2, dst_type);
tex->sampler_dim = GLSL_SAMPLER_DIM_3D;
tex->src[1].src_type = nir_tex_src_lod;
tex->src[1].src = nir_src_for_ssa(nir_imm_int(b, 0));
tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(b, 0));
nir_builder_instr_insert(b, &tex->instr);
@@ -232,8 +229,7 @@ blorp_nir_txf_ms(nir_builder *b, struct brw_blorp_blit_vars *v,
if (!mcs)
mcs = nir_imm_zero(b, 4, 32);
tex->src[2].src_type = nir_tex_src_ms_mcs_intel;
tex->src[2].src = nir_src_for_ssa(mcs);
tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_ms_mcs_intel, mcs);
nir_builder_instr_insert(b, &tex->instr);
+1 -2
View File
@@ -55,8 +55,7 @@ blorp_nir_txf_ms_mcs(nir_builder *b, nir_ssa_def *xy_pos, nir_ssa_def *layer)
tex->coord_components = 2;
coord = nir_channels(b, xy_pos, 0x3);
}
tex->src[0].src_type = nir_tex_src_coord;
tex->src[0].src = nir_src_for_ssa(coord);
tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
/* Blorp only has one texture and it's bound at unit 0 */
tex->texture_index = 0;
@@ -52,8 +52,8 @@ get_texture_size(struct ycbcr_state *state, nir_deref_instr *texture)
tex->is_shadow = glsl_sampler_type_is_shadow(type);
tex->dest_type = nir_type_int32;
tex->src[0].src_type = nir_tex_src_texture_deref;
tex->src[0].src = nir_src_for_ssa(&texture->dest.ssa);
tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
&texture->dest.ssa);
nir_ssa_dest_init(&tex->instr, &tex->dest, nir_tex_instr_dest_size(tex),
32);
@@ -139,8 +139,8 @@ create_plane_tex_instr_implicit(struct ycbcr_state *state,
break;
}
}
tex->src[tex->num_srcs - 1].src = nir_src_for_ssa(nir_imm_int(b, plane));
tex->src[tex->num_srcs - 1].src_type = nir_tex_src_plane;
tex->src[tex->num_srcs - 1] = nir_tex_src_for_ssa(nir_tex_src_plane,
nir_imm_int(b, plane));
tex->sampler_dim = old_tex->sampler_dim;
tex->dest_type = old_tex->dest_type;