freedreno/ir3: handle arrays of images
[mesa.git] / src / gallium / drivers / freedreno / a2xx / ir-a2xx.c
index 18afba8a5a34c31a1aec648085a974021d189c98..42a9ab494e6ca649d231ef29f71393f8838b94b3 100644 (file)
@@ -146,7 +146,7 @@ void * ir2_shader_assemble(struct ir2_shader *shader, struct ir2_shader_info *in
                goto fail;
        }
 
-       ptr = dwords = calloc(1, 4 * info->sizedwords);
+       ptr = dwords = calloc(4, info->sizedwords);
 
        /* second pass, emit CF program in pairs: */
        for (i = 0; i < shader->cfs_count; i += 2) {
@@ -341,6 +341,7 @@ static int instr_emit_fetch(struct ir2_instruction *instr,
                tex->use_comp_lod = 1;
                tex->use_reg_lod = !instr->fetch.is_cube;
                tex->sample_location = SAMPLE_CENTER;
+               tex->tx_coord_denorm = instr->fetch.is_rect;
 
                if (instr->pred != IR2_PRED_NONE) {
                        tex->pred_select = 1;
@@ -403,7 +404,7 @@ static int instr_emit_alu(struct ir2_instruction *instr, uint32_t *dwords,
        assert((src2_reg->flags & IR2_REG_EXPORT) == 0);
        assert(!src2_reg->swizzle || (strlen(src2_reg->swizzle) == 4));
 
-       if (instr->alu.vector_opc == ~0) {
+       if (instr->alu.vector_opc == (instr_vector_opc_t)~0) {
                alu->vector_opc          = MAXv;
                alu->vector_write_mask   = 0;
        } else {
@@ -431,7 +432,7 @@ static int instr_emit_alu(struct ir2_instruction *instr, uint32_t *dwords,
        alu->vector_clamp        = instr->alu.vector_clamp;
        alu->scalar_clamp        = instr->alu.scalar_clamp;
 
-       if (instr->alu.scalar_opc != ~0) {
+       if (instr->alu.scalar_opc != (instr_scalar_opc_t)~0) {
                struct ir2_register *sdst_reg = instr->regs[reg++];
 
                reg_update_stats(sdst_reg, info, true);
@@ -439,7 +440,8 @@ static int instr_emit_alu(struct ir2_instruction *instr, uint32_t *dwords,
                assert(sdst_reg->flags == dst_reg->flags);
 
                if (src3_reg) {
-                       assert(src3_reg == instr->regs[reg++]);
+                       assert(src3_reg == instr->regs[reg]);
+                       reg++;
                } else {
                        src3_reg = instr->regs[reg++];
                }