mir_foreach_instr_global(ctx, ins) {
mir_rewrite_index_dst_single(ins, old, new);
}
+
+ /* Implicitly written before the shader */
+ if (ctx->blend_input == old)
+ ctx->blend_input = new;
}
void
uint16_t
mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i)
{
- if (ins->compact_branch && ins->writeout && (i == 0)) {
- /* Non-ZS writeout uses all components */
- if (!ins->writeout_depth && !ins->writeout_stencil)
- return 0xFFFF;
-
- /* For ZS-writeout, if both Z and S are written we need two
- * components, otherwise we only need one.
- */
- if (ins->writeout_depth && ins->writeout_stencil)
- return 0xFF;
- else
- return 0xF;
- }
-
/* Conditional branches read one 32-bit component = 4 bytes (TODO: multi branch??) */
if (ins->compact_branch && ins->branch.conditional && (i == 0))
return 0xF;
/* ALU ops act componentwise so we need to pay attention to
* their mask. Texture/ldst does not so we don't clamp source
* readmasks based on the writemask */
- unsigned qmask = (ins->type == TAG_ALU_4) ? ins->mask : ~0;
+ unsigned qmask = ~0;
/* Handle dot products and things */
if (ins->type == TAG_ALU_4 && !ins->compact_branch) {
if (channel_override)
qmask = mask_of(channel_override);
+ else
+ qmask = ins->mask;
}
return mir_bytemask_of_read_components_single(ins->swizzle[i], qmask,
ins->src_neg[0] = ins->src_neg[1];
ins->src_neg[1] = temp;
+ temp = ins->src_invert[0];
+ ins->src_invert[0] = ins->src_invert[1];
+ ins->src_invert[1] = temp;
+
unsigned temp_swizzle[16];
memcpy(temp_swizzle, ins->swizzle[0], sizeof(ins->swizzle[0]));
memcpy(ins->swizzle[0], ins->swizzle[1], sizeof(ins->swizzle[0]));