nir_instr *instr,
bool is_read,
unsigned srcdest,
- unsigned offset,
- nir_src *indirect_offset,
+ nir_src *offset,
bool is_shared)
{
/* TODO: types */
else
ins = m_st_int4(srcdest, 0);
- ins.constants.u32[0] = offset;
-
- /* The source array:
- *
- * src[0] = store ? value : unused
- * src[1] = arg_1
- * src[2] = arg_2
- *
- * We would like arg_1 = the address and
- * arg_2 = the offset. For shareds, there is no address and we use a
- * magic number instead.
- */
-
- /* TODO: What is this? */
- ins.load_store.arg_1 = is_shared ?
- indirect_offset ? 0xEE : 0x6E :
- 0x7E;
-
- assert(indirect_offset || is_shared); /* is_global => indirect */
-
- if (indirect_offset)
- ins.src[2] = nir_src_index(ctx, indirect_offset);
- else
- ins.load_store.arg_2 = 0x1E;
-
+ mir_set_offset(ctx, &ins, offset, is_shared);
mir_set_intr_mask(instr, &ins, is_read);
emit_mir_instruction(ctx, ins);
uint32_t uindex = nir_src_as_uint(index) + 1;
emit_ubo_read(ctx, &instr->instr, reg, offset, indirect_offset, 0, uindex);
} else if (is_global || is_shared) {
- emit_global(ctx, &instr->instr, true, reg, offset, indirect_offset, is_shared);
+ emit_global(ctx, &instr->instr, true, reg, src_offset, is_shared);
} else if (ctx->stage == MESA_SHADER_FRAGMENT && !ctx->is_blend) {
emit_varying_read(ctx, reg, offset, nr_comp, component, indirect_offset, t, is_flat);
} else if (ctx->is_blend) {
reg = nir_src_index(ctx, &instr->src[0]);
emit_explicit_constant(ctx, reg, reg);
- nir_src *indirect_offset = &instr->src[1];
- unsigned offset = 0;
-
- if (nir_src_is_const(*indirect_offset)) {
- offset = nir_src_as_uint(*indirect_offset);
- indirect_offset = NULL;
- }
-
- emit_global(ctx, &instr->instr, false, reg, offset, indirect_offset, instr->intrinsic == nir_intrinsic_store_shared);
+ emit_global(ctx, &instr->instr, false, reg, &instr->src[1], instr->intrinsic == nir_intrinsic_store_shared);
break;
case nir_intrinsic_load_ssbo_address: