etnaviv: Rename etna_emit_tex() args

Rename the args from low_bias/compare to src1/src2, since they
are used for different purposes depending on the texture load
type. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17500>
This commit is contained in:
Marek Vasut 2022-04-25 23:35:26 +02:00 committed by Marge Bot
parent 20eeb529f7
commit 221d042c31
4 changed files with 21 additions and 21 deletions

View file

@ -513,7 +513,7 @@ emit_tex(struct etna_compile *c, nir_tex_instr * tex)
{
unsigned dst_swiz;
hw_dst dst = ra_dest(c, &tex->dest, &dst_swiz);
nir_src *coord = NULL, *lod_bias = NULL, *compare = NULL;
nir_src *coord = NULL, *src1 = NULL, *src2 = NULL;
for (unsigned i = 0; i < tex->num_srcs; i++) {
switch (tex->src[i].src_type) {
@ -522,11 +522,11 @@ emit_tex(struct etna_compile *c, nir_tex_instr * tex)
break;
case nir_tex_src_bias:
case nir_tex_src_lod:
assert(!lod_bias);
lod_bias = &tex->src[i].src;
assert(!src1);
src1 = &tex->src[i].src;
break;
case nir_tex_src_comparator:
compare = &tex->src[i].src;
src2 = &tex->src[i].src;
break;
default:
compile_error(c, "Unhandled NIR tex src type: %d\n",
@ -536,8 +536,8 @@ emit_tex(struct etna_compile *c, nir_tex_instr * tex)
}
etna_emit_tex(c, tex->op, tex->sampler_index, dst_swiz, dst, get_src(c, coord),
lod_bias ? get_src(c, lod_bias) : SRC_DISABLE,
compare ? get_src(c, compare) : SRC_DISABLE);
src1 ? get_src(c, src1) : SRC_DISABLE,
src2 ? get_src(c, src2) : SRC_DISABLE);
}
static void

View file

@ -342,7 +342,7 @@ etna_emit_alu(struct etna_compile *c, nir_op op, struct etna_inst_dst dst,
void
etna_emit_tex(struct etna_compile *c, nir_texop op, unsigned texid, unsigned dst_swiz,
struct etna_inst_dst dst, struct etna_inst_src coord,
struct etna_inst_src lod_bias, struct etna_inst_src compare);
struct etna_inst_src src1, struct etna_inst_src src2);
void
etna_emit_jump(struct etna_compile *c, unsigned block, struct etna_inst_src condition);

View file

@ -194,7 +194,7 @@ etna_emit_alu(struct etna_compile *c, nir_op op, struct etna_inst_dst dst,
void
etna_emit_tex(struct etna_compile *c, nir_texop op, unsigned texid, unsigned dst_swiz,
struct etna_inst_dst dst, struct etna_inst_src coord,
struct etna_inst_src lod_bias, struct etna_inst_src compare)
struct etna_inst_src src1, struct etna_inst_src src2)
{
struct etna_inst inst = {
.dst = dst,
@ -203,11 +203,11 @@ etna_emit_tex(struct etna_compile *c, nir_texop op, unsigned texid, unsigned dst
.src[0] = coord,
};
if (lod_bias.use)
inst.src[1] = lod_bias;
if (src1.use)
inst.src[1] = src1;
if (compare.use)
inst.src[2] = compare;
if (src2.use)
inst.src[2] = src2;
switch (op) {
case nir_texop_tex: inst.opcode = INST_OPCODE_TEXLD; break;

View file

@ -92,8 +92,8 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
nir_tex_instr *tex = nir_instr_as_tex(instr);
nir_src *coord = NULL;
nir_src *lod_bias = NULL;
unsigned lod_bias_idx;
nir_src *src1 = NULL;
unsigned src1_idx;
assert(tex->sampler_index == tex->texture_index);
@ -104,9 +104,9 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
break;
case nir_tex_src_bias:
case nir_tex_src_lod:
assert(!lod_bias);
lod_bias = &tex->src[i].src;
lod_bias_idx = i;
assert(!src1);
src1 = &tex->src[i].src;
src1_idx = i;
break;
case nir_tex_src_comparator:
break;
@ -118,10 +118,10 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
/* pre HALTI5 needs texture sources in a single source */
if (!lod_bias || v->shader->specs->halti >= 5)
if (!src1 || v->shader->specs->halti >= 5)
continue;
assert(coord && lod_bias && tex->coord_components < 4);
assert(coord && src1 && tex->coord_components < 4);
nir_alu_instr *vec = nir_alu_instr_create(shader, nir_op_vec4);
for (unsigned i = 0; i < tex->coord_components; i++) {
@ -129,12 +129,12 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
vec->src[i].swizzle[0] = i;
}
for (unsigned i = tex->coord_components; i < 4; i++)
vec->src[i].src = nir_src_for_ssa(lod_bias->ssa);
vec->src[i].src = nir_src_for_ssa(src1->ssa);
vec->dest.write_mask = 0xf;
nir_ssa_dest_init(&vec->instr, &vec->dest.dest, 4, 32, NULL);
nir_tex_instr_remove_src(tex, lod_bias_idx);
nir_tex_instr_remove_src(tex, src1_idx);
nir_instr_rewrite_src(&tex->instr, coord, nir_src_for_ssa(&vec->dest.dest.ssa));
tex->coord_components = 4;