.type = TAG_TEXTURE_4,
.dest = ~0,
.src = { ~0, ~0, ~0, ~0 },
+ .op = TEXTURE_OP_BARRIER,
.texture = {
- .op = TEXTURE_OP_BARRIER,
-
/* TODO: optimize */
.out_of_order = MIDGARD_BARRIER_BUFFER |
MIDGARD_BARRIER_SHARED ,
.dest_type = dest_type,
.swizzle = SWIZZLE_IDENTITY_4,
.outmod = outmod,
+ .op = midgard_texop,
.texture = {
- .op = midgard_texop,
.format = midgard_tex_format(instr->sampler_dim),
.texture_handle = texture_index,
.sampler_handle = sampler_index,
.src = { ~0, nir_src_index(ctx, &instr->src[0].src), ~0, ~0 },
.swizzle = SWIZZLE_IDENTITY_4,
.src_types = { nir_type_float32, nir_type_float32 },
+ .op = mir_derivative_op(instr->op),
.texture = {
- .op = mir_derivative_op(instr->op),
.format = MALI_TEX_2D,
.in_reg_full = 1,
.out_full = 1,
{
mir_foreach_instr_in_block_safe(block, ins) {
if (ins->type != TAG_TEXTURE_4) continue;
- if (!OP_IS_DERIVATIVE(ins->texture.op)) continue;
+ if (!OP_IS_DERIVATIVE(ins->op)) continue;
/* Check if we need to split */
}
}
+static midgard_texture_word
+texture_word_from_instr(midgard_instruction *ins)
+{
+ midgard_texture_word tex = ins->texture;
+ tex.op = ins->op;
+ return tex;
+}
+
static midgard_vector_alu
vector_alu_from_instr(midgard_instruction *ins)
{
ins->texture.next_type = next_tag;
/* Nothing else to pack for barriers */
- if (ins->texture.op == TEXTURE_OP_BARRIER) {
+ if (ins->op == TEXTURE_OP_BARRIER) {
ins->texture.cont = ins->texture.last = 1;
util_dynarray_append(emission, midgard_texture_word, ins->texture);
return;
ins->texture.sampler_type = midgard_sampler_type(ins->dest_type);
ins->texture.outmod = ins->outmod;
- if (mir_op_computes_derivatives(ctx->stage, ins->texture.op)) {
+ if (mir_op_computes_derivatives(ctx->stage, ins->op)) {
ins->texture.cont = !ins->helper_terminate;
ins->texture.last = ins->helper_terminate || ins->helper_execute;
} else {
ins->texture.cont = ins->texture.last = 1;
}
- util_dynarray_append(emission, midgard_texture_word, ins->texture);
+ midgard_texture_word texture = texture_word_from_instr(ins);
+ util_dynarray_append(emission, midgard_texture_word, texture);
break;
}
{
mir_foreach_instr_in_block(block, ins) {
if (ins->type != TAG_TEXTURE_4) continue;
- if (mir_op_computes_derivatives(stage, ins->texture.op))
+ if (mir_op_computes_derivatives(stage, ins->op))
return true;
}
mir_foreach_instr_in_block_rev(block, ins) {
if (ins->type != TAG_TEXTURE_4) continue;
- if (!mir_op_computes_derivatives(ctx->stage, ins->texture.op)) continue;
+ if (!mir_op_computes_derivatives(ctx->stage, ins->op)) continue;
ins->helper_terminate = true;
break;
mir_foreach_instr_global(ctx, ins) {
if (ins->type != TAG_TEXTURE_4) continue;
if (ins->dest >= ctx->temp_count) continue;
- if (!mir_op_computes_derivatives(ctx->stage, ins->texture.op)) continue;
+ if (!mir_op_computes_derivatives(ctx->stage, ins->op)) continue;
mir_foreach_src(ins, s) {
if (ins->src[s] < temp_count)
return false;
if (ins->type == TAG_TEXTURE_4)
- if (ins->texture.op == TEXTURE_OP_BARRIER)
+ if (ins->op == TEXTURE_OP_BARRIER)
return false;
return true;
}
case TAG_TEXTURE_4: {
- if (ins->texture.op == TEXTURE_OP_BARRIER)
+ if (ins->op == TEXTURE_OP_BARRIER)
break;
/* Grab RA results */
mir_update_worklist(worklist, len, instructions, ins);
struct midgard_bundle out = {
- .tag = ins->texture.op == TEXTURE_OP_BARRIER ?
+ .tag = ins->op == TEXTURE_OP_BARRIER ?
TAG_TEXTURE_4_BARRIER :
- (ins->texture.op == TEXTURE_OP_TEXEL_FETCH) || is_vertex ?
+ (ins->op == TEXTURE_OP_TEXEL_FETCH) || is_vertex ?
TAG_TEXTURE_4_VTX : TAG_TEXTURE_4,
.instruction_count = 1,
.instructions = { ins }