nir: Take a nir_def * in nir_tex_instr_add_src()
NIR bits were hand-typed. Driver updates done through the following semantic patch: @@ expression T, ST, D; @@ -nir_tex_instr_add_src(T, ST, nir_src_for_ssa(D)); +nir_tex_instr_add_src(T, ST, D); Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24729>
This commit is contained in:

committed by
Marge Bot

parent
6d168b93bc
commit
298a3eebd8
@@ -394,7 +394,7 @@ move_tex_coords(struct move_tex_coords_state *state, nir_function_impl *impl, ni
|
||||
nir_tex_instr_remove_src(tex, nir_tex_instr_src_index(tex, nir_tex_src_coord));
|
||||
tex->coord_components = 0;
|
||||
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, nir_src_for_ssa(linear_vgpr));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, linear_vgpr);
|
||||
|
||||
int offset_src = nir_tex_instr_src_index(tex, nir_tex_src_offset);
|
||||
if (offset_src >= 0) /* Workaround requirement in nir_tex_instr_src_size(). */
|
||||
|
@@ -272,7 +272,7 @@ lower_buffer_texture(nir_builder *b, nir_tex_instr *tex)
|
||||
nir_def *coord2d = coords_for_buffer_texture(b, coord);
|
||||
nir_instr_remove(&tex->instr);
|
||||
nir_builder_instr_insert(b, &tex->instr);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, nir_src_for_ssa(coord2d));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, coord2d);
|
||||
nir_block *else_block = nir_cursor_current_block(b->cursor);
|
||||
nir_pop_if(b, nif);
|
||||
|
||||
@@ -339,7 +339,7 @@ lower_regular_texture(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
|
||||
assert(src->num_components == 1);
|
||||
src = nir_vec2(b, src, nir_imm_intN_t(b, 0, src->bit_size));
|
||||
nir_tex_instr_add_src(tex, other_srcs[i], nir_src_for_ssa(src));
|
||||
nir_tex_instr_add_src(tex, other_srcs[i], src);
|
||||
}
|
||||
|
||||
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||
@@ -386,7 +386,7 @@ lower_regular_texture(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
coord = nir_vector_insert_imm(b, coord, sample_array, end);
|
||||
}
|
||||
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, nir_src_for_ssa(coord));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, coord);
|
||||
|
||||
/* Furthermore, if there is an offset vector, it must be packed */
|
||||
nir_def *offset = nir_steal_tex_src(tex, nir_tex_src_offset);
|
||||
@@ -404,7 +404,7 @@ lower_regular_texture(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
packed = shifted;
|
||||
}
|
||||
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend2, nir_src_for_ssa(packed));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend2, packed);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -435,8 +435,7 @@ lower_sampler_bias(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
switch (tex->op) {
|
||||
case nir_texop_tex: {
|
||||
tex->op = nir_texop_txb;
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_bias,
|
||||
nir_src_for_ssa(bias_for_tex(b, tex)));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_bias, bias_for_tex(b, tex));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -451,8 +450,7 @@ lower_sampler_bias(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
if (orig->bit_size != 16)
|
||||
orig = nir_f2f16(b, orig);
|
||||
|
||||
nir_tex_instr_add_src(
|
||||
tex, src, nir_src_for_ssa(nir_fadd(b, orig, bias_for_tex(b, tex))));
|
||||
nir_tex_instr_add_src(tex, src, nir_fadd(b, orig, bias_for_tex(b, tex)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -470,7 +468,7 @@ lower_sampler_bias(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
assert(orig != NULL && "invalid");
|
||||
|
||||
nir_def *scaled = nir_fmul(b, nir_f2f32(b, orig), scale);
|
||||
nir_tex_instr_add_src(tex, src[s], nir_src_for_ssa(scaled));
|
||||
nir_tex_instr_add_src(tex, src[s], scaled);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -54,7 +54,7 @@ v3d_nir_lower_txf_ms_instr(nir_builder *b, nir_instr *in_instr, void *data)
|
||||
else
|
||||
coord = nir_vec2(b, x, y);
|
||||
|
||||
nir_tex_instr_add_src(instr, nir_tex_src_coord, nir_src_for_ssa(coord));
|
||||
nir_tex_instr_add_src(instr, nir_tex_src_coord, coord);
|
||||
instr->op = nir_texop_txf;
|
||||
instr->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||
|
||||
|
@@ -783,7 +783,7 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
|
||||
void
|
||||
nir_tex_instr_add_src(nir_tex_instr *tex,
|
||||
nir_tex_src_type src_type,
|
||||
nir_src src)
|
||||
nir_def *src)
|
||||
{
|
||||
nir_tex_src *new_srcs = gc_zalloc(gc_get_context(tex), nir_tex_src, tex->num_srcs + 1);
|
||||
|
||||
@@ -797,7 +797,8 @@ nir_tex_instr_add_src(nir_tex_instr *tex,
|
||||
tex->src = new_srcs;
|
||||
|
||||
tex->src[tex->num_srcs].src_type = src_type;
|
||||
nir_instr_rewrite_src(&tex->instr, &tex->src[tex->num_srcs].src, src);
|
||||
nir_instr_rewrite_src(&tex->instr, &tex->src[tex->num_srcs].src,
|
||||
nir_src_for_ssa(src));
|
||||
tex->num_srcs++;
|
||||
}
|
||||
|
||||
|
@@ -2387,7 +2387,7 @@ nir_tex_instr_src_index(const nir_tex_instr *instr, nir_tex_src_type type)
|
||||
/** Adds a source to a texture instruction */
|
||||
void nir_tex_instr_add_src(nir_tex_instr *tex,
|
||||
nir_tex_src_type src_type,
|
||||
nir_src src);
|
||||
nir_def *src);
|
||||
|
||||
/** Removes a source from a texture instruction */
|
||||
void nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx);
|
||||
|
@@ -271,7 +271,7 @@ lower_lod(nir_builder *b, nir_tex_instr *tex, nir_def *lod)
|
||||
if (min_lod)
|
||||
lod = nir_fmax(b, lod, min_lod);
|
||||
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(lod));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_lod, lod);
|
||||
tex->op = nir_texop_txl;
|
||||
}
|
||||
|
||||
@@ -649,7 +649,7 @@ replace_gradient_with_lod(nir_builder *b, nir_def *lod, nir_tex_instr *tex)
|
||||
if (min_lod)
|
||||
lod = nir_fmax(b, lod, min_lod);
|
||||
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(lod));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_lod, lod);
|
||||
tex->op = nir_texop_txl;
|
||||
}
|
||||
|
||||
@@ -1647,7 +1647,7 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
|
||||
(tex->op == nir_texop_txf || tex->op == nir_texop_txs ||
|
||||
tex->op == nir_texop_txl || tex->op == nir_texop_query_levels)) {
|
||||
b->cursor = nir_before_instr(&tex->instr);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(nir_imm_int(b, 0)));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_imm_int(b, 0));
|
||||
progress = true;
|
||||
continue;
|
||||
}
|
||||
|
@@ -551,8 +551,8 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options,
|
||||
|
||||
nir_def *zero =
|
||||
nir_imm_zero(b, tex->coord_components - tex->is_array, 32);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddx, nir_src_for_ssa(zero));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddy, nir_src_for_ssa(zero));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddx, zero);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddy, zero);
|
||||
tex->op = nir_texop_txd;
|
||||
|
||||
b->cursor = nir_after_instr(clone);
|
||||
|
@@ -3635,9 +3635,11 @@ nir_to_tgsi_lower_tex_instr(nir_builder *b, nir_instr *instr, void *data)
|
||||
s.channels[i] = s.channels[0];
|
||||
}
|
||||
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, nir_src_for_ssa(nir_vec_scalars(b, s.channels, MIN2(s.i, 4))));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1,
|
||||
nir_vec_scalars(b, s.channels, MIN2(s.i, 4)));
|
||||
if (s.i > 4)
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend2, nir_src_for_ssa(nir_vec_scalars(b, &s.channels[4], s.i - 4)));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend2,
|
||||
nir_vec_scalars(b, &s.channels[4], s.i - 4));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ lower(nir_builder *b, nir_instr *instr, void *data)
|
||||
|
||||
*internal_bindless = true;
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_texture_handle,
|
||||
nir_src_for_ssa(index_to_handle(b, index)));
|
||||
index_to_handle(b, index));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -149,7 +149,7 @@ lima_nir_lower_txp_instr(nir_builder *b, nir_instr *instr,
|
||||
|
||||
nir_tex_instr_remove_src(tex, nir_tex_instr_src_index(tex, nir_tex_src_coord));
|
||||
nir_tex_instr_remove_src(tex, nir_tex_instr_src_index(tex, nir_tex_src_projector));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, nir_src_for_ssa(combined));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, combined);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -1151,8 +1151,8 @@ LowerTexToBackend::finalize(nir_tex_instr *tex,
|
||||
nir_def *backend1,
|
||||
nir_def *backend2)
|
||||
{
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, nir_src_for_ssa(backend1));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend2, nir_src_for_ssa(backend2));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend1, backend1);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_backend2, backend2);
|
||||
nir_tex_instr_remove_src(tex, nir_tex_src_coord);
|
||||
|
||||
static const nir_tex_src_type cleanup[] = {nir_tex_src_coord,
|
||||
|
@@ -190,8 +190,8 @@ lower_txl_txf_array_or_cube(nir_builder *b, nir_tex_instr *tex)
|
||||
nir_tex_instr_remove_src(tex, bias_idx);
|
||||
if (min_lod_idx >= 0)
|
||||
nir_tex_instr_remove_src(tex, min_lod_idx);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddx, nir_src_for_ssa(grad));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddy, nir_src_for_ssa(grad));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddx, grad);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_ddy, grad);
|
||||
|
||||
tex->op = nir_texop_txd;
|
||||
return true;
|
||||
|
@@ -325,8 +325,8 @@ load_texel(nir_builder *b, nir_tex_instr *tex, wrap_lower_param_t *params)
|
||||
texcoord = nir_f2i32(b, texcoord);
|
||||
|
||||
nir_tex_instr *load = create_txf_from_tex(b, tex);
|
||||
nir_tex_instr_add_src(load, nir_tex_src_lod, nir_src_for_ssa(params->lod));
|
||||
nir_tex_instr_add_src(load, nir_tex_src_coord, nir_src_for_ssa(texcoord));
|
||||
nir_tex_instr_add_src(load, nir_tex_src_lod, params->lod);
|
||||
nir_tex_instr_add_src(load, nir_tex_src_coord, texcoord);
|
||||
b->cursor = nir_after_instr(&load->instr);
|
||||
return &load->def;
|
||||
}
|
||||
|
@@ -396,8 +396,7 @@ lower_tex(nir_builder *b, nir_tex_instr *tex,
|
||||
tex->src[texture_src_idx].src_type = nir_tex_src_texture_handle;
|
||||
|
||||
if (sampler_src_idx < 0) {
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_sampler_handle,
|
||||
nir_src_for_ssa(combined_handle));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_sampler_handle, combined_handle);
|
||||
} else {
|
||||
nir_instr_rewrite_src_ssa(&tex->instr,
|
||||
&tex->src[sampler_src_idx].src,
|
||||
|
@@ -434,8 +434,7 @@ lower_tex(nir_builder *b, nir_tex_instr *tex,
|
||||
bind_layout->sampler_idx + index_imm;
|
||||
|
||||
if (index_ssa != NULL) {
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_sampler_offset,
|
||||
nir_src_for_ssa(index_ssa));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_sampler_offset, index_ssa);
|
||||
}
|
||||
progress = true;
|
||||
}
|
||||
@@ -456,8 +455,7 @@ lower_tex(nir_builder *b, nir_tex_instr *tex,
|
||||
ctx->layout->sets[set].tex_offset + bind_layout->tex_idx + index_imm;
|
||||
|
||||
if (index_ssa != NULL) {
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_texture_offset,
|
||||
nir_src_for_ssa(index_ssa));
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_texture_offset, index_ssa);
|
||||
}
|
||||
progress = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user