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

View File

@@ -44,12 +44,11 @@ build_background_op(nir_builder *b, enum agx_meta_op op, unsigned rt,
tex->dest_type = nir_type_uint32; tex->dest_type = nir_type_uint32;
tex->sampler_dim = msaa ? GLSL_SAMPLER_DIM_MS : GLSL_SAMPLER_DIM_2D; tex->sampler_dim = msaa ? GLSL_SAMPLER_DIM_MS : GLSL_SAMPLER_DIM_2D;
tex->op = nir_texop_tex; tex->op = nir_texop_tex;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
tex->src[0].src = nir_src_for_ssa(coord);
if (msaa) { if (msaa) {
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] =
tex->src[1].src = nir_src_for_ssa(nir_load_sample_id(b)); nir_tex_src_for_ssa(nir_tex_src_ms_index, nir_load_sample_id(b));
} }
tex->coord_components = 2; tex->coord_components = 2;

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); nir_tex_instr *tex = nir_tex_instr_create(b.shader, 2);
tex->sampler_dim = GLSL_SAMPLER_DIM_BUF; tex->sampler_dim = GLSL_SAMPLER_DIM_BUF;
tex->op = nir_texop_txf; tex->op = nir_texop_txf;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, texel_offset);
tex->src[0].src = nir_src_for_ssa(texel_offset); tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->src[1].src_type = nir_tex_src_texture_deref;
tex->src[1].src = nir_src_for_ssa(tex_deref);
tex->dest_type = nir_type_uint32; tex->dest_type = nir_type_uint32;
tex->is_array = false; tex->is_array = false;
tex->coord_components = 1; 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); nir_tex_instr *tex = nir_tex_instr_create(b->shader, 3);
tex->sampler_dim = dim; tex->sampler_dim = dim;
tex->op = nir_texop_tex; tex->op = nir_texop_tex;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, tex_pos);
tex->src[0].src = nir_src_for_ssa(tex_pos); tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->src[1].src_type = nir_tex_src_texture_deref; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref, tex_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->dest_type = nir_get_nir_type_for_glsl_base_type(tex_type); tex->dest_type = nir_get_nir_type_for_glsl_base_type(tex_type);
tex->is_array = glsl_sampler_type_is_array(sampler_type); tex->is_array = glsl_sampler_type_is_array(sampler_type);
tex->coord_components = tex_pos->num_components; 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); nir_tex_instr *tex = nir_tex_instr_create(b->shader, 4);
tex->sampler_dim = GLSL_SAMPLER_DIM_MS; tex->sampler_dim = GLSL_SAMPLER_DIM_MS;
tex->op = nir_texop_txf_ms; tex->op = nir_texop_txf_ms;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, tex_pos);
tex->src[0].src = nir_src_for_ssa(tex_pos); tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->src[1].src_type = nir_tex_src_texture_deref; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref, tex_deref);
tex->src[1].src = nir_src_for_ssa(tex_deref); tex->src[3] = nir_tex_src_for_ssa(nir_tex_src_ms_index, sample_idx);
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->dest_type = nir_get_nir_type_for_glsl_base_type(tex_type); tex->dest_type = nir_get_nir_type_for_glsl_base_type(tex_type);
tex->is_array = false; tex->is_array = false;
tex->coord_components = tex_pos->num_components; tex->coord_components = tex_pos->num_components;

View File

@@ -2484,38 +2484,33 @@ nir_visitor::visit(ir_texture *ir)
if (!nir_deref_mode_is(sampler_deref, nir_var_uniform) || if (!nir_deref_mode_is(sampler_deref, nir_var_uniform) ||
nir_deref_instr_get_variable(sampler_deref)->data.bindless) { nir_deref_instr_get_variable(sampler_deref)->data.bindless) {
nir_ssa_def *load = nir_load_deref(&b, sampler_deref); nir_ssa_def *load = nir_load_deref(&b, sampler_deref);
instr->src[0].src = nir_src_for_ssa(load); instr->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_handle, load);
instr->src[0].src_type = nir_tex_src_texture_handle; instr->src[1] = nir_tex_src_for_ssa(nir_tex_src_sampler_handle, load);
instr->src[1].src = nir_src_for_ssa(load);
instr->src[1].src_type = nir_tex_src_sampler_handle;
} else { } else {
instr->src[0].src = nir_src_for_ssa(&sampler_deref->dest.ssa); instr->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
instr->src[0].src_type = nir_tex_src_texture_deref; &sampler_deref->dest.ssa);
instr->src[1].src = nir_src_for_ssa(&sampler_deref->dest.ssa); instr->src[1] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
instr->src[1].src_type = nir_tex_src_sampler_deref; &sampler_deref->dest.ssa);
} }
unsigned src_number = 2; unsigned src_number = 2;
if (ir->coordinate != NULL) { if (ir->coordinate != NULL) {
instr->coord_components = ir->coordinate->type->vector_elements; instr->coord_components = ir->coordinate->type->vector_elements;
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_coord,
nir_src_for_ssa(evaluate_rvalue(ir->coordinate)); evaluate_rvalue(ir->coordinate));
instr->src[src_number].src_type = nir_tex_src_coord;
src_number++; src_number++;
} }
if (ir->projector != NULL) { if (ir->projector != NULL) {
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_projector,
nir_src_for_ssa(evaluate_rvalue(ir->projector)); evaluate_rvalue(ir->projector));
instr->src[src_number].src_type = nir_tex_src_projector;
src_number++; src_number++;
} }
if (ir->shadow_comparator != NULL) { if (ir->shadow_comparator != NULL) {
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_comparator,
nir_src_for_ssa(evaluate_rvalue(ir->shadow_comparator)); evaluate_rvalue(ir->shadow_comparator));
instr->src[src_number].src_type = nir_tex_src_comparator;
src_number++; src_number++;
} }
@@ -2533,25 +2528,22 @@ nir_visitor::visit(ir_texture *ir)
} else { } else {
assert(ir->offset->type->is_vector() || ir->offset->type->is_scalar()); assert(ir->offset->type->is_vector() || ir->offset->type->is_scalar());
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_offset,
nir_src_for_ssa(evaluate_rvalue(ir->offset)); evaluate_rvalue(ir->offset));
instr->src[src_number].src_type = nir_tex_src_offset;
src_number++; src_number++;
} }
} }
if (ir->clamp) { if (ir->clamp) {
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_min_lod,
nir_src_for_ssa(evaluate_rvalue(ir->clamp)); evaluate_rvalue(ir->clamp));
instr->src[src_number].src_type = nir_tex_src_min_lod;
src_number++; src_number++;
} }
switch (ir->op) { switch (ir->op) {
case ir_txb: case ir_txb:
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_bias,
nir_src_for_ssa(evaluate_rvalue(ir->lod_info.bias)); evaluate_rvalue(ir->lod_info.bias));
instr->src[src_number].src_type = nir_tex_src_bias;
src_number++; src_number++;
break; break;
@@ -2559,28 +2551,24 @@ nir_visitor::visit(ir_texture *ir)
case ir_txf: case ir_txf:
case ir_txs: case ir_txs:
if (ir->lod_info.lod != NULL) { if (ir->lod_info.lod != NULL) {
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_lod,
nir_src_for_ssa(evaluate_rvalue(ir->lod_info.lod)); evaluate_rvalue(ir->lod_info.lod));
instr->src[src_number].src_type = nir_tex_src_lod;
src_number++; src_number++;
} }
break; break;
case ir_txd: case ir_txd:
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_ddx,
nir_src_for_ssa(evaluate_rvalue(ir->lod_info.grad.dPdx)); evaluate_rvalue(ir->lod_info.grad.dPdx));
instr->src[src_number].src_type = nir_tex_src_ddx;
src_number++; src_number++;
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_ddy,
nir_src_for_ssa(evaluate_rvalue(ir->lod_info.grad.dPdy)); evaluate_rvalue(ir->lod_info.grad.dPdy));
instr->src[src_number].src_type = nir_tex_src_ddy;
src_number++; src_number++;
break; break;
case ir_txf_ms: case ir_txf_ms:
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_ms_index,
nir_src_for_ssa(evaluate_rvalue(ir->lod_info.sample_index)); evaluate_rvalue(ir->lod_info.sample_index));
instr->src[src_number].src_type = nir_tex_src_ms_index;
src_number++; src_number++;
break; break;

View File

@@ -79,14 +79,12 @@ lower_bitmap(nir_shader *shader, nir_builder *b,
tex->sampler_dim = GLSL_SAMPLER_DIM_2D; tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
tex->coord_components = 2; tex->coord_components = 2;
tex->dest_type = nir_type_float32; tex->dest_type = nir_type_float32;
tex->src[0].src_type = nir_tex_src_texture_deref; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[0].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
tex->src[1].src_type = nir_tex_src_sampler_deref; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
tex->src[1].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
tex->src[2].src_type = nir_tex_src_coord; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[2].src = nir_channels(b, texcoord, (1 << tex->coord_components) - 1));
nir_src_for_ssa(nir_channels(b, texcoord,
(1 << tex->coord_components) - 1));
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(b, &tex->instr); nir_builder_instr_insert(b, &tex->instr);

View File

@@ -69,14 +69,12 @@ nir_lower_fb_read_instr(nir_builder *b, nir_instr *instr, UNUSED void *cb_data)
tex->coord_components = 3; tex->coord_components = 3;
tex->dest_type = nir_type_float32; tex->dest_type = nir_type_float32;
tex->is_array = true; tex->is_array = true;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[0].src = nir_vec3(b, nir_channel(b, fragcoord, 0), nir_channel(b, fragcoord, 1), layer));
nir_src_for_ssa(nir_vec3(b, nir_channel(b, fragcoord, 0), nir_channel(b, fragcoord, 1), layer)); tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_ms_index, sampid);
tex->src[1].src_type = nir_tex_src_ms_index;
tex->src[1].src = nir_src_for_ssa(sampid);
struct nir_io_semantics io = nir_intrinsic_io_semantics(intr); struct nir_io_semantics io = nir_intrinsic_io_semantics(intr);
tex->src[2].src = nir_src_for_ssa(nir_imm_intN_t(b, io.location - FRAG_RESULT_DATA0, 32)); tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_texture_handle,
tex->src[2].src_type = nir_tex_src_texture_handle; nir_imm_intN_t(b, io.location - FRAG_RESULT_DATA0, 32));
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(b, &tex->instr); nir_builder_instr_insert(b, &tex->instr);

View File

@@ -2690,10 +2690,7 @@ vtn_create_ssa_value(struct vtn_builder *b, const struct glsl_type *type)
static nir_tex_src static nir_tex_src
vtn_tex_src(struct vtn_builder *b, unsigned index, nir_tex_src_type type) vtn_tex_src(struct vtn_builder *b, unsigned index, nir_tex_src_type type)
{ {
nir_tex_src src; return nir_tex_src_for_ssa(type, vtn_get_nir_ssa(b, index));
src.src = nir_src_for_ssa(vtn_get_nir_ssa(b, index));
src.src_type = type;
return src;
} }
static uint32_t static uint32_t

View File

@@ -619,8 +619,8 @@ build_blit_fs_shader(bool zscale)
b->shader->info.num_textures = 1; b->shader->info.num_textures = 1;
BITSET_SET(b->shader->info.textures_used, 0); BITSET_SET(b->shader->info.textures_used, 0);
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[0].src = nir_src_for_ssa(nir_load_var(b, in_coords)); nir_load_var(b, in_coords));
tex->coord_components = coord_components; tex->coord_components = coord_components;
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
@@ -675,12 +675,11 @@ build_ms_copy_fs_shader(void)
nir_ssa_def *coord = nir_f2i32(b, nir_load_var(b, in_coords)); nir_ssa_def *coord = nir_f2i32(b, nir_load_var(b, in_coords));
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
tex->src[0].src = nir_src_for_ssa(coord);
tex->coord_components = 2; tex->coord_components = 2;
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_ms_index,
tex->src[1].src = nir_src_for_ssa(nir_load_sample_id(b)); nir_load_sample_id(b));
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(b, &tex->instr); nir_builder_instr_insert(b, &tex->instr);

View File

@@ -77,8 +77,7 @@ nir_lower_pstipple_block(nir_block *block,
tex->dest_type = nir_type_float32; tex->dest_type = nir_type_float32;
tex->texture_index = state->stip_tex->data.binding; tex->texture_index = state->stip_tex->data.binding;
tex->sampler_index = state->stip_tex->data.binding; tex->sampler_index = state->stip_tex->data.binding;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, texcoord);
tex->src[0].src = nir_src_for_ssa(texcoord);
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(b, &tex->instr); nir_builder_instr_insert(b, &tex->instr);

View File

@@ -1457,34 +1457,33 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
unsigned src_number = 0; unsigned src_number = 0;
instr->src[src_number].src = nir_src_for_ssa(&deref->dest.ssa); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
instr->src[src_number].src_type = nir_tex_src_texture_deref; &deref->dest.ssa);
src_number++; src_number++;
instr->src[src_number].src = nir_src_for_ssa(&deref->dest.ssa); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
instr->src[src_number].src_type = nir_tex_src_sampler_deref; &deref->dest.ssa);
src_number++; src_number++;
instr->src[src_number].src = instr->src[src_number] =
nir_src_for_ssa(nir_swizzle(b, src[0], SWIZ(X, Y, Z, W), nir_tex_src_for_ssa(nir_tex_src_coord,
instr->coord_components)); nir_trim_vector(b, src[0], instr->coord_components));
instr->src[src_number].src_type = nir_tex_src_coord;
src_number++; src_number++;
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXP) { if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], W)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_projector,
instr->src[src_number].src_type = nir_tex_src_projector; ttn_channel(b, src[0], W));
src_number++; src_number++;
} }
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXB) { if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXB) {
instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], W)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_bias,
instr->src[src_number].src_type = nir_tex_src_bias; ttn_channel(b, src[0], W));
src_number++; src_number++;
} }
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXB2) { if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXB2) {
instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[1], X)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_bias,
instr->src[src_number].src_type = nir_tex_src_bias; ttn_channel(b, src[1], X));
src_number++; src_number++;
} }
@@ -1499,16 +1498,16 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
} }
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXL2) { if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXL2) {
instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[1], X)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_lod,
instr->src[src_number].src_type = nir_tex_src_lod; ttn_channel(b, src[1], X));
src_number++; src_number++;
} }
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF || if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF ||
tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF_LZ) { tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF_LZ) {
if (op == nir_texop_txf_ms) { if (op == nir_texop_txf_ms) {
instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], W)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_ms_index,
instr->src[src_number].src_type = nir_tex_src_ms_index; ttn_channel(b, src[0], W));
} else { } else {
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF_LZ) if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF_LZ)
instr->src[src_number].src = nir_src_for_ssa(nir_imm_int(b, 0)); instr->src[src_number].src = nir_src_for_ssa(nir_imm_int(b, 0));
@@ -1520,15 +1519,13 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
} }
if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXD) { if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
instr->src[src_number].src_type = nir_tex_src_ddx; instr->src[src_number] =
instr->src[src_number].src = nir_tex_src_for_ssa(nir_tex_src_ddx,
nir_src_for_ssa(nir_swizzle(b, src[1], SWIZ(X, Y, Z, W), nir_trim_vector(b, src[1], nir_tex_instr_src_size(instr, src_number)));
nir_tex_instr_src_size(instr, src_number)));
src_number++; src_number++;
instr->src[src_number].src_type = nir_tex_src_ddy; instr->src[src_number] =
instr->src[src_number].src = nir_tex_src_for_ssa(nir_tex_src_ddy,
nir_src_for_ssa(nir_swizzle(b, src[2], SWIZ(X, Y, Z, W), nir_trim_vector(b, src[2], nir_tex_instr_src_size(instr, src_number)));
nir_tex_instr_src_size(instr, src_number)));
src_number++; src_number++;
} }
@@ -1564,9 +1561,8 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
src.swizzle[2] = tex_offset->SwizzleZ; src.swizzle[2] = tex_offset->SwizzleZ;
src.swizzle[3] = TGSI_SWIZZLE_W; src.swizzle[3] = TGSI_SWIZZLE_W;
instr->src[src_number].src_type = nir_tex_src_offset; instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_offset,
instr->src[src_number].src = nir_src_for_ssa( nir_mov_alu(b, src, nir_tex_instr_src_size(instr, src_number)));
nir_mov_alu(b, src, nir_tex_instr_src_size(instr, src_number)));
src_number++; src_number++;
} }
@@ -1624,15 +1620,15 @@ ttn_txq(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
nir_deref_instr *deref = nir_build_deref_var(b, var); nir_deref_instr *deref = nir_build_deref_var(b, var);
txs->src[0].src = nir_src_for_ssa(&deref->dest.ssa); txs->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
txs->src[0].src_type = nir_tex_src_texture_deref; &deref->dest.ssa);
qlv->src[0].src = nir_src_for_ssa(&deref->dest.ssa); qlv->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
qlv->src[0].src_type = nir_tex_src_texture_deref; &deref->dest.ssa);
/* lod: */ /* lod: */
txs->src[1].src = nir_src_for_ssa(ttn_channel(b, src[0], X)); txs->src[1] = nir_tex_src_for_ssa(nir_tex_src_lod,
txs->src[1].src_type = nir_tex_src_lod; ttn_channel(b, src[0], X));
nir_ssa_dest_init(&txs->instr, &txs->dest, nir_tex_instr_dest_size(txs), nir_ssa_dest_init(&txs->instr, &txs->dest, nir_tex_instr_dest_size(txs),
32); 32);

View File

@@ -676,8 +676,7 @@ get_stencil_resolve_fs(struct d3d12_context *ctx, bool no_flip)
nir_tex_instr *txs = nir_tex_instr_create(b.shader, 1); nir_tex_instr *txs = nir_tex_instr_create(b.shader, 1);
txs->op = nir_texop_txs; txs->op = nir_texop_txs;
txs->sampler_dim = GLSL_SAMPLER_DIM_MS; txs->sampler_dim = GLSL_SAMPLER_DIM_MS;
txs->src[0].src_type = nir_tex_src_texture_deref; txs->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
txs->src[0].src = nir_src_for_ssa(tex_deref);
txs->is_array = false; txs->is_array = false;
txs->dest_type = nir_type_int; txs->dest_type = nir_type_int;
@@ -699,12 +698,10 @@ get_stencil_resolve_fs(struct d3d12_context *ctx, bool no_flip)
nir_tex_instr *tex = nir_tex_instr_create(b.shader, 3); nir_tex_instr *tex = nir_tex_instr_create(b.shader, 3);
tex->sampler_dim = GLSL_SAMPLER_DIM_MS; tex->sampler_dim = GLSL_SAMPLER_DIM_MS;
tex->op = nir_texop_txf_ms; tex->op = nir_texop_txf_ms;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[0].src = nir_src_for_ssa(nir_channels(&b, nir_f2i32(&b, pos_src), 0x3)); nir_channels(&b, nir_f2i32(&b, pos_src), 0x3));
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_ms_index, nir_imm_int(&b, 0)); /* just use first sample */
tex->src[1].src = nir_src_for_ssa(nir_imm_int(&b, 0)); /* just use first sample */ tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_texture_deref, tex_deref);
tex->src[2].src_type = nir_tex_src_texture_deref;
tex->src[2].src = nir_src_for_ssa(tex_deref);
tex->dest_type = nir_type_uint32; tex->dest_type = nir_type_uint32;
tex->is_array = false; tex->is_array = false;
tex->coord_components = 2; tex->coord_components = 2;

View File

@@ -117,8 +117,8 @@ vc4_nir_lower_txf_ms_instr(nir_builder *b, nir_instr *instr, void *data)
nir_ior(b, sample_addr, pixel_addr), nir_ior(b, sample_addr, pixel_addr),
nir_iadd(b, subspan_addr, tile_addr)); nir_iadd(b, subspan_addr, tile_addr));
txf->src[0].src_type = nir_tex_src_coord; txf->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord,
txf->src[0].src = nir_src_for_ssa(nir_vec2(b, addr, nir_imm_int(b, 0))); nir_vec2(b, addr, nir_imm_int(b, 0)));
nir_ssa_dest_init(&txf->instr, &txf->dest, 4, 32); nir_ssa_dest_init(&txf->instr, &txf->dest, 4, 32);
nir_builder_instr_insert(b, &txf->instr); nir_builder_instr_insert(b, &txf->instr);

View File

@@ -442,8 +442,7 @@ lower_tex_to_txl(nir_builder *b, nir_tex_instr *tex)
if (bias_idx >= 0) if (bias_idx >= 0)
lod = nir_fadd(b, lod, nir_ssa_for_src(b, tex->src[bias_idx].src, 1)); lod = nir_fadd(b, lod, nir_ssa_for_src(b, tex->src[bias_idx].src, 1));
lod = nir_fadd_imm(b, lod, -1.0); lod = nir_fadd_imm(b, lod, -1.0);
txl->src[s].src = nir_src_for_ssa(lod); txl->src[s] = nir_tex_src_for_ssa(nir_tex_src_lod, lod);
txl->src[s].src_type = nir_tex_src_lod;
b->cursor = nir_before_instr(&tex->instr); b->cursor = nir_before_instr(&tex->instr);
nir_ssa_dest_init(&txl->instr, &txl->dest, nir_ssa_dest_init(&txl->instr, &txl->dest,

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)); nir_load_var(b, v->v_src_z));
} }
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, pos);
tex->src[0].src = nir_src_for_ssa(pos);
tex->coord_components = 3; tex->coord_components = 3;
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); 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); assert(pos->num_components == 2);
tex->sampler_dim = GLSL_SAMPLER_DIM_2D; tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
tex->src[1].src_type = nir_tex_src_lod; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(b, 0));
tex->src[1].src = nir_src_for_ssa(nir_imm_int(b, 0));
nir_builder_instr_insert(b, &tex->instr); 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); blorp_create_nir_tex_instr(b, v, nir_texop_txf, pos, 2, dst_type);
tex->sampler_dim = GLSL_SAMPLER_DIM_3D; tex->sampler_dim = GLSL_SAMPLER_DIM_3D;
tex->src[1].src_type = nir_tex_src_lod; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(b, 0));
tex->src[1].src = nir_src_for_ssa(nir_imm_int(b, 0));
nir_builder_instr_insert(b, &tex->instr); 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) if (!mcs)
mcs = nir_imm_zero(b, 4, 32); mcs = nir_imm_zero(b, 4, 32);
tex->src[2].src_type = nir_tex_src_ms_mcs_intel; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_ms_mcs_intel, mcs);
tex->src[2].src = nir_src_for_ssa(mcs);
nir_builder_instr_insert(b, &tex->instr); nir_builder_instr_insert(b, &tex->instr);

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; tex->coord_components = 2;
coord = nir_channels(b, xy_pos, 0x3); coord = nir_channels(b, xy_pos, 0x3);
} }
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
tex->src[0].src = nir_src_for_ssa(coord);
/* Blorp only has one texture and it's bound at unit 0 */ /* Blorp only has one texture and it's bound at unit 0 */
tex->texture_index = 0; tex->texture_index = 0;

View File

@@ -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->is_shadow = glsl_sampler_type_is_shadow(type);
tex->dest_type = nir_type_int32; tex->dest_type = nir_type_int32;
tex->src[0].src_type = nir_tex_src_texture_deref; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[0].src = nir_src_for_ssa(&texture->dest.ssa); &texture->dest.ssa);
nir_ssa_dest_init(&tex->instr, &tex->dest, nir_tex_instr_dest_size(tex), nir_ssa_dest_init(&tex->instr, &tex->dest, nir_tex_instr_dest_size(tex),
32); 32);
@@ -139,8 +139,8 @@ create_plane_tex_instr_implicit(struct ycbcr_state *state,
break; break;
} }
} }
tex->src[tex->num_srcs - 1].src = nir_src_for_ssa(nir_imm_int(b, plane)); tex->src[tex->num_srcs - 1] = nir_tex_src_for_ssa(nir_tex_src_plane,
tex->src[tex->num_srcs - 1].src_type = nir_tex_src_plane; nir_imm_int(b, plane));
tex->sampler_dim = old_tex->sampler_dim; tex->sampler_dim = old_tex->sampler_dim;
tex->dest_type = old_tex->dest_type; tex->dest_type = old_tex->dest_type;

View File

@@ -799,26 +799,24 @@ load_texture(struct texenv_fragment_program *p, GLuint unit)
} }
nir_deref_instr *deref = nir_build_deref_var(p->b, var); nir_deref_instr *deref = nir_build_deref_var(p->b, var);
tex->src[0].src = nir_src_for_ssa(&deref->dest.ssa); tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[0].src_type = nir_tex_src_texture_deref; &deref->dest.ssa);
tex->src[1].src = nir_src_for_ssa(&deref->dest.ssa); tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
tex->src[1].src_type = nir_tex_src_sampler_deref; &deref->dest.ssa);
nir_ssa_def *src2 = nir_ssa_def *src2 =
nir_channels(p->b, texcoord, nir_channels(p->b, texcoord,
nir_component_mask(tex->coord_components)); nir_component_mask(tex->coord_components));
tex->src[2].src_type = nir_tex_src_coord; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_coord, src2);
tex->src[2].src = nir_src_for_ssa(src2);
tex->src[3].src_type = nir_tex_src_projector; tex->src[3] = nir_tex_src_for_ssa(nir_tex_src_projector,
tex->src[3].src = nir_src_for_ssa(nir_channel(p->b, texcoord, 3)); nir_channel(p->b, texcoord, 3));
if (p->state->unit[unit].shadow) { if (p->state->unit[unit].shadow) {
tex->is_shadow = true; tex->is_shadow = true;
nir_ssa_def *src4 = nir_ssa_def *src4 =
nir_channel(p->b, texcoord, tex->coord_components); nir_channel(p->b, texcoord, tex->coord_components);
tex->src[4].src_type = nir_tex_src_comparator; tex->src[4] = nir_tex_src_for_ssa(nir_tex_src_comparator, src4);
tex->src[4].src = nir_src_for_ssa(src4);
} }
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);

View File

@@ -575,34 +575,33 @@ ptn_tex(struct ptn_compile *c, nir_alu_dest dest, nir_ssa_def **src,
unsigned src_number = 0; unsigned src_number = 0;
instr->src[src_number].src = nir_src_for_ssa(&deref->dest.ssa); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
instr->src[src_number].src_type = nir_tex_src_texture_deref; &deref->dest.ssa);
src_number++; src_number++;
instr->src[src_number].src = nir_src_for_ssa(&deref->dest.ssa); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
instr->src[src_number].src_type = nir_tex_src_sampler_deref; &deref->dest.ssa);
src_number++; src_number++;
instr->src[src_number].src = instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_coord,
nir_src_for_ssa(nir_swizzle(b, src[0], SWIZ(X, Y, Z, W), nir_trim_vector(b, src[0],
instr->coord_components)); instr->coord_components));
instr->src[src_number].src_type = nir_tex_src_coord;
src_number++; src_number++;
if (prog_inst->Opcode == OPCODE_TXP) { if (prog_inst->Opcode == OPCODE_TXP) {
instr->src[src_number].src = nir_src_for_ssa(ptn_channel(b, src[0], W)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_projector,
instr->src[src_number].src_type = nir_tex_src_projector; ptn_channel(b, src[0], W));
src_number++; src_number++;
} }
if (prog_inst->Opcode == OPCODE_TXB) { if (prog_inst->Opcode == OPCODE_TXB) {
instr->src[src_number].src = nir_src_for_ssa(ptn_channel(b, src[0], W)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_bias,
instr->src[src_number].src_type = nir_tex_src_bias; ptn_channel(b, src[0], W));
src_number++; src_number++;
} }
if (prog_inst->Opcode == OPCODE_TXL) { if (prog_inst->Opcode == OPCODE_TXL) {
instr->src[src_number].src = nir_src_for_ssa(ptn_channel(b, src[0], W)); instr->src[src_number] = nir_tex_src_for_ssa(nir_tex_src_lod,
instr->src[src_number].src_type = nir_tex_src_lod; ptn_channel(b, src[0], W));
src_number++; src_number++;
} }

View File

@@ -359,14 +359,12 @@ compile_setupinst(struct st_translate *t,
tex->coord_components = tex->coord_components =
glsl_get_sampler_dim_coordinate_components(tex->sampler_dim); glsl_get_sampler_dim_coordinate_components(tex->sampler_dim);
tex->src[0].src_type = nir_tex_src_texture_deref; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[0].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
tex->src[1].src_type = nir_tex_src_sampler_deref; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
tex->src[1].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
tex->src[2].src_type = nir_tex_src_coord; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[2].src = nir_channels(t->b, coord, (1 << tex->coord_components) - 1));
nir_src_for_ssa(nir_channels(t->b, coord,
(1 << tex->coord_components) - 1));
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(t->b, &tex->instr); nir_builder_instr_insert(t->b, &tex->instr);

View File

@@ -125,14 +125,14 @@ sample_via_nir(nir_builder *b, nir_variable *texcoord,
tex->sampler_dim = GLSL_SAMPLER_DIM_2D; tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
tex->coord_components = 2; tex->coord_components = 2;
tex->dest_type = alu_type; tex->dest_type = alu_type;
tex->src[0].src_type = nir_tex_src_texture_deref; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[0].src = nir_src_for_ssa(&deref->dest.ssa); &deref->dest.ssa);
tex->src[1].src_type = nir_tex_src_sampler_deref; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
tex->src[1].src = nir_src_for_ssa(&deref->dest.ssa); &deref->dest.ssa);
tex->src[2].src_type = nir_tex_src_coord; tex->src[2] =
tex->src[2].src = nir_tex_src_for_ssa(nir_tex_src_coord,
nir_src_for_ssa(nir_channels(b, nir_load_var(b, texcoord), nir_trim_vector(b, nir_load_var(b, texcoord),
(1 << tex->coord_components) - 1)); tex->coord_components));
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(b, &tex->instr); nir_builder_instr_insert(b, &tex->instr);

View File

@@ -678,10 +678,8 @@ create_conversion_shader(struct st_context *st, enum pipe_texture_target target,
txf->coord_components = coord_components; txf->coord_components = coord_components;
txf->texture_index = 0; txf->texture_index = 0;
txf->sampler_index = 0; txf->sampler_index = 0;
txf->src[0].src_type = nir_tex_src_coord; txf->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
txf->src[0].src = nir_src_for_ssa(coord); txf->src[1] = nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(&b, 0));
txf->src[1].src_type = nir_tex_src_lod;
txf->src[1].src = nir_src_for_ssa(nir_imm_int(&b, 0));
txf->src[2].src_type = nir_tex_src_texture_deref; txf->src[2].src_type = nir_tex_src_texture_deref;
nir_deref_instr *sampler_deref = nir_build_deref_var(&b, sampler); nir_deref_instr *sampler_deref = nir_build_deref_var(&b, sampler);
txf->src[2].src = nir_src_for_ssa(&sampler_deref->dest.ssa); txf->src[2].src = nir_src_for_ssa(&sampler_deref->dest.ssa);

View File

@@ -704,18 +704,18 @@ dzn_nir_blit_fs(const struct dzn_nir_blit_info *info)
tex->is_array = info->src_is_array; tex->is_array = info->src_is_array;
tex->sampler_dim = info->sampler_dim; tex->sampler_dim = info->sampler_dim;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[0].src = nir_src_for_ssa(nir_f2i32(&b, coord)); nir_f2i32(&b, coord));
tex->coord_components = coord_comps; tex->coord_components = coord_comps;
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_ms_index,
tex->src[1].src = nir_src_for_ssa(nir_imm_int(&b, s)); nir_imm_int(&b, s));
tex->src[2].src_type = nir_tex_src_lod; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_lod,
tex->src[2].src = nir_src_for_ssa(nir_imm_int(&b, 0)); nir_imm_int(&b, 0));
tex->src[3].src_type = nir_tex_src_texture_deref; tex->src[3] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[3].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
@@ -736,18 +736,18 @@ dzn_nir_blit_fs(const struct dzn_nir_blit_info *info)
if (ms) { if (ms) {
tex->op = nir_texop_txf_ms; tex->op = nir_texop_txf_ms;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord,
tex->src[0].src = nir_src_for_ssa(nir_f2i32(&b, coord)); nir_f2i32(&b, coord));
tex->coord_components = coord_comps; tex->coord_components = coord_comps;
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_ms_index,
tex->src[1].src = nir_src_for_ssa(nir_load_sample_id(&b)); nir_load_sample_id(&b));
tex->src[2].src_type = nir_tex_src_lod; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_lod,
tex->src[2].src = nir_src_for_ssa(nir_imm_int(&b, 0)); nir_imm_int(&b, 0));
tex->src[3].src_type = nir_tex_src_texture_deref; tex->src[3] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[3].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
} else { } else {
nir_variable *sampler_var = nir_variable *sampler_var =
nir_variable_create(b.shader, nir_var_uniform, glsl_bare_sampler_type(), "sampler"); nir_variable_create(b.shader, nir_var_uniform, glsl_bare_sampler_type(), "sampler");
@@ -756,15 +756,14 @@ dzn_nir_blit_fs(const struct dzn_nir_blit_info *info)
tex->op = nir_texop_tex; tex->op = nir_texop_tex;
tex->sampler_index = 0; tex->sampler_index = 0;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
tex->src[0].src = nir_src_for_ssa(coord);
tex->coord_components = coord_comps; tex->coord_components = coord_comps;
tex->src[1].src_type = nir_tex_src_texture_deref; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_texture_deref,
tex->src[1].src = nir_src_for_ssa(&tex_deref->dest.ssa); &tex_deref->dest.ssa);
tex->src[2].src_type = nir_tex_src_sampler_deref; tex->src[2] = nir_tex_src_for_ssa(nir_tex_src_sampler_deref,
tex->src[2].src = nir_src_for_ssa(&sampler_deref->dest.ssa); &sampler_deref->dest.ssa);
} }
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);

View File

@@ -549,15 +549,15 @@ pan_blitter_get_blit_shader(struct panfrost_device *dev,
tex->is_array = key->surfaces[i].array; tex->is_array = key->surfaces[i].array;
tex->sampler_dim = sampler_dim; tex->sampler_dim = sampler_dim;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] =
tex->src[0].src = nir_src_for_ssa(nir_f2i32(&b, coord)); nir_tex_src_for_ssa(nir_tex_src_coord, nir_f2i32(&b, coord));
tex->coord_components = coord_comps; tex->coord_components = coord_comps;
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] =
tex->src[1].src = nir_src_for_ssa(nir_imm_int(&b, s)); nir_tex_src_for_ssa(nir_tex_src_ms_index, nir_imm_int(&b, s));
tex->src[2].src_type = nir_tex_src_lod; tex->src[2] =
tex->src[2].src = nir_src_for_ssa(nir_imm_int(&b, 0)); nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(&b, 0));
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32);
nir_builder_instr_insert(&b, &tex->instr); nir_builder_instr_insert(&b, &tex->instr);
@@ -577,20 +577,19 @@ pan_blitter_get_blit_shader(struct panfrost_device *dev,
if (ms) { if (ms) {
tex->op = nir_texop_txf_ms; tex->op = nir_texop_txf_ms;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] =
tex->src[0].src = nir_src_for_ssa(nir_f2i32(&b, coord)); nir_tex_src_for_ssa(nir_tex_src_coord, nir_f2i32(&b, coord));
tex->coord_components = coord_comps; tex->coord_components = coord_comps;
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] = nir_tex_src_for_ssa(nir_tex_src_ms_index,
tex->src[1].src = nir_src_for_ssa(nir_load_sample_id(&b)); nir_load_sample_id(&b));
tex->src[2].src_type = nir_tex_src_lod; tex->src[2] =
tex->src[2].src = nir_src_for_ssa(nir_imm_int(&b, 0)); nir_tex_src_for_ssa(nir_tex_src_lod, nir_imm_int(&b, 0));
} else { } else {
tex->op = nir_texop_txl; tex->op = nir_texop_txl;
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
tex->src[0].src = nir_src_for_ssa(coord);
tex->coord_components = coord_comps; tex->coord_components = coord_comps;
} }

View File

@@ -326,13 +326,12 @@ panvk_meta_copy_img2img_shader(struct panfrost_device *pdev,
unreachable("Invalid texture dimension"); unreachable("Invalid texture dimension");
} }
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, coord);
tex->src[0].src = nir_src_for_ssa(coord);
tex->coord_components = texdim + texisarray; tex->coord_components = texdim + texisarray;
if (is_ms) { if (is_ms) {
tex->src[1].src_type = nir_tex_src_ms_index; tex->src[1] =
tex->src[1].src = nir_src_for_ssa(nir_load_sample_id(&b)); nir_tex_src_for_ssa(nir_tex_src_ms_index, nir_load_sample_id(&b));
} }
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, nir_ssa_dest_init(&tex->instr, &tex->dest, 4,
@@ -1358,8 +1357,7 @@ panvk_meta_copy_img2buf_shader(struct panfrost_device *pdev,
unreachable("Invalid texture dimension"); unreachable("Invalid texture dimension");
} }
tex->src[0].src_type = nir_tex_src_coord; tex->src[0] = nir_tex_src_for_ssa(nir_tex_src_coord, imgcoords);
tex->src[0].src = nir_src_for_ssa(imgcoords);
tex->coord_components = texdim + texisarray; tex->coord_components = texdim + texisarray;
nir_ssa_dest_init(&tex->instr, &tex->dest, 4, nir_ssa_dest_init(&tex->instr, &tex->dest, 4,
nir_alu_type_get_type_size(tex->dest_type)); nir_alu_type_get_type_size(tex->dest_type));