diff options
author | Jason Ekstrand <[email protected]> | 2015-06-18 12:07:27 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-06-30 16:13:48 -0700 |
commit | f7dcc1160331462a071c54ca1067f9e2f57b55be (patch) | |
tree | ab471cafed1bd40a479787ed981388ff28a4298e /src/mesa/drivers | |
parent | 7fcbe141076d18bf0245de1fd589c82f7c543fdf (diff) |
i965/fs: Add a builder argument to offset()
Reviewed-by: Topi Pohjolainen <[email protected]>
Acked-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 42 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 58 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 143 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp | 4 |
7 files changed, 132 insertions, 123 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index cae4e4263ea..ceac20cc97a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -267,7 +267,7 @@ fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_builder &bld, inst->mlen = 1 + dispatch_width / 8; } - bld.MOV(dst, offset(vec4_result, (const_offset & 3) * scale)); + bld.MOV(dst, offset(vec4_result, bld, (const_offset & 3) * scale)); } /** @@ -361,7 +361,12 @@ fs_inst::is_copy_payload(const brw::simple_allocator &grf_alloc) const reg.width = this->src[i].width; if (!this->src[i].equals(reg)) return false; - reg = ::offset(reg, 1); + + if (i < this->header_size) { + reg.reg_offset += 1; + } else { + reg.reg_offset += this->exec_size / 8; + } } return true; @@ -926,7 +931,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer, } else { bld.ADD(wpos, this->pixel_x, fs_reg(0.5f)); } - wpos = offset(wpos, 1); + wpos = offset(wpos, bld, 1); /* gl_FragCoord.y */ if (!flip && pixel_center_integer) { @@ -942,7 +947,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer, bld.ADD(wpos, pixel_y, fs_reg(offset)); } - wpos = offset(wpos, 1); + wpos = offset(wpos, bld, 1); /* gl_FragCoord.z */ if (devinfo->gen >= 6) { @@ -952,7 +957,7 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer, this->delta_xy[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC], interp_reg(VARYING_SLOT_POS, 2)); } - wpos = offset(wpos, 1); + wpos = offset(wpos, bld, 1); /* gl_FragCoord.w: Already set up in emit_interpolation */ bld.MOV(wpos, this->wpos_w); @@ -1035,7 +1040,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name, /* If there's no incoming setup data for this slot, don't * emit interpolation for it. */ - attr = offset(attr, type->vector_elements); + attr = offset(attr, bld, type->vector_elements); location++; continue; } @@ -1050,7 +1055,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name, interp = suboffset(interp, 3); interp.type = attr.type; bld.emit(FS_OPCODE_CINTERP, attr, fs_reg(interp)); - attr = offset(attr, 1); + attr = offset(attr, bld, 1); } } else { /* Smooth/noperspective interpolation case. */ @@ -1088,7 +1093,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name, if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) { bld.MUL(attr, attr, this->pixel_w); } - attr = offset(attr, 1); + attr = offset(attr, bld, 1); } } @@ -1196,7 +1201,7 @@ fs_visitor::emit_samplepos_setup() } /* Compute gl_SamplePosition.x */ compute_sample_position(pos, int_sample_x); - pos = offset(pos, 1); + pos = offset(pos, abld, 1); if (dispatch_width == 8) { abld.MOV(int_sample_y, fs_reg(suboffset(sample_pos_reg, 1))); } else { @@ -2986,10 +2991,6 @@ fs_visitor::lower_load_payload() assert(inst->dst.file == MRF || inst->dst.file == GRF); assert(inst->saturate == false); - - const fs_builder ibld = bld.group(inst->exec_size, inst->force_sechalf) - .exec_all(inst->force_writemask_all) - .at(block, inst); fs_reg dst = inst->dst; /* Get rid of COMPR4. We'll add it back in if we need it */ @@ -2997,17 +2998,23 @@ fs_visitor::lower_load_payload() dst.reg = dst.reg & ~BRW_MRF_COMPR4; dst.width = 8; + const fs_builder hbld = bld.group(8, 0).exec_all().at(block, inst); + for (uint8_t i = 0; i < inst->header_size; i++) { if (inst->src[i].file != BAD_FILE) { fs_reg mov_dst = retype(dst, BRW_REGISTER_TYPE_UD); fs_reg mov_src = retype(inst->src[i], BRW_REGISTER_TYPE_UD); mov_src.width = 8; - ibld.exec_all().MOV(mov_dst, mov_src); + hbld.MOV(mov_dst, mov_src); } - dst = offset(dst, 1); + dst = offset(dst, hbld, 1); } dst.width = inst->exec_size; + const fs_builder ibld = bld.group(inst->exec_size, inst->force_sechalf) + .exec_all(inst->force_writemask_all) + .at(block, inst); + if (inst->dst.file == MRF && (inst->dst.reg & BRW_MRF_COMPR4) && inst->exec_size > 8) { /* In this case, the payload portion of the LOAD_PAYLOAD isn't @@ -3039,7 +3046,8 @@ fs_visitor::lower_load_payload() fs_reg mov_dst = retype(dst, inst->src[i].type); mov_dst.width = 8; ibld.half(0).MOV(mov_dst, half(inst->src[i], 0)); - ibld.half(1).MOV(offset(mov_dst, 4), half(inst->src[i], 1)); + mov_dst.reg += 4; + ibld.half(1).MOV(mov_dst, half(inst->src[i], 1)); } } @@ -3064,7 +3072,7 @@ fs_visitor::lower_load_payload() for (uint8_t i = inst->header_size; i < inst->sources; i++) { if (inst->src[i].file != BAD_FILE) ibld.MOV(retype(dst, inst->src[i].type), inst->src[i]); - dst = offset(dst, 1); + dst = offset(dst, ibld, 1); } inst->remove(block); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 06f46765dd1..ece7e49ea17 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -63,7 +63,7 @@ namespace brw { } static inline fs_reg -offset(fs_reg reg, unsigned delta) +offset(fs_reg reg, const brw::fs_builder& bld, unsigned delta) { switch (reg.file) { case BAD_FILE: diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index 70f0217b93d..29d1f2a6a57 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp @@ -205,7 +205,7 @@ create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate) } for (int i = header_size; i < sources; i++) { payload[i] = src; - src = offset(src, 1); + src = offset(src, ubld, 1); } copy = ubld.LOAD_PAYLOAD(inst->dst, payload, sources, header_size); } else { diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 58896d72e14..f52f344ccff 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -76,7 +76,7 @@ fs_visitor::nir_setup_inputs(nir_shader *shader) { foreach_list_typed(nir_variable, var, node, &shader->inputs) { enum brw_reg_type type = brw_type_for_base_type(var->type); - fs_reg input = offset(nir_inputs, var->data.driver_location); + fs_reg input = offset(nir_inputs, bld, var->data.driver_location); fs_reg reg; switch (stage) { @@ -95,8 +95,8 @@ fs_visitor::nir_setup_inputs(nir_shader *shader) unsigned array_length = var->type->is_array() ? var->type->length : 1; for (unsigned i = 0; i < array_length; i++) { for (unsigned j = 0; j < components; j++) { - bld.MOV(retype(offset(input, components * i + j), type), - offset(fs_reg(ATTR, var->data.location + i, type), j)); + bld.MOV(retype(offset(input, bld, components * i + j), type), + offset(fs_reg(ATTR, var->data.location + i, type), bld, j)); } } break; @@ -127,7 +127,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader) brw_wm_prog_key *key = (brw_wm_prog_key*) this->key; foreach_list_typed(nir_variable, var, node, &shader->outputs) { - fs_reg reg = offset(nir_outputs, var->data.driver_location); + fs_reg reg = offset(nir_outputs, bld, var->data.driver_location); int vector_elements = var->type->is_array() ? var->type->fields.array->vector_elements @@ -136,7 +136,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader) if (stage == MESA_SHADER_VERTEX) { for (int i = 0; i < ALIGN(type_size(var->type), 4) / 4; i++) { int output = var->data.location + i; - this->outputs[output] = offset(reg, 4 * i); + this->outputs[output] = offset(reg, bld, 4 * i); this->output_components[output] = vector_elements; } } else if (var->data.index > 0) { @@ -162,7 +162,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader) /* General color output. */ for (unsigned int i = 0; i < MAX2(1, var->type->length); i++) { int output = var->data.location - FRAG_RESULT_DATA0 + i; - this->outputs[output] = offset(reg, vector_elements * i); + this->outputs[output] = offset(reg, bld, vector_elements * i); this->output_components[output] = vector_elements; } } @@ -618,11 +618,11 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) continue; if (instr->op == nir_op_imov || instr->op == nir_op_fmov) { - inst = bld.MOV(offset(temp, i), - offset(op[0], instr->src[0].swizzle[i])); + inst = bld.MOV(offset(temp, bld, i), + offset(op[0], bld, instr->src[0].swizzle[i])); } else { - inst = bld.MOV(offset(temp, i), - offset(op[i], instr->src[i].swizzle[0])); + inst = bld.MOV(offset(temp, bld, i), + offset(op[i], bld, instr->src[i].swizzle[0])); } inst->saturate = instr->dest.saturate; } @@ -636,7 +636,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) if (!(instr->dest.write_mask & (1 << i))) continue; - bld.MOV(offset(result, i), offset(temp, i)); + bld.MOV(offset(result, bld, i), offset(temp, bld, i)); } } return; @@ -657,12 +657,12 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) assert(_mesa_bitcount(instr->dest.write_mask) == 1); channel = ffs(instr->dest.write_mask) - 1; - result = offset(result, channel); + result = offset(result, bld, channel); } for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) { assert(nir_op_infos[instr->op].input_sizes[i] < 2); - op[i] = offset(op[i], instr->src[i].swizzle[channel]); + op[i] = offset(op[i], bld, instr->src[i].swizzle[channel]); } switch (instr->op) { @@ -1153,7 +1153,7 @@ fs_visitor::nir_emit_load_const(const fs_builder &bld, fs_reg reg = bld.vgrf(BRW_REGISTER_TYPE_D, instr->def.num_components); for (unsigned i = 0; i < instr->def.num_components; i++) - bld.MOV(offset(reg, i), fs_reg(instr->value.i[i])); + bld.MOV(offset(reg, bld, i), fs_reg(instr->value.i[i])); nir_ssa_values[instr->def.index] = reg; } @@ -1175,7 +1175,7 @@ fs_reg_for_nir_reg(fs_visitor *v, nir_register *nir_reg, else reg = v->nir_locals[nir_reg->index]; - reg = offset(reg, base_offset * nir_reg->num_components); + reg = offset(reg, v->bld, base_offset * nir_reg->num_components); if (indirect) { int multiplier = nir_reg->num_components * (v->dispatch_width / 8); @@ -1227,10 +1227,10 @@ fs_visitor::emit_percomp(const fs_builder &bld, const fs_inst &inst, continue; fs_inst *new_inst = new(mem_ctx) fs_inst(inst); - new_inst->dst = offset(new_inst->dst, i); + new_inst->dst = offset(new_inst->dst, bld, i); for (unsigned j = 0; j < new_inst->sources; j++) if (new_inst->src[j].file == GRF) - new_inst->src[j] = offset(new_inst->src[j], i); + new_inst->src[j] = offset(new_inst->src[j], bld, i); bld.emit(new_inst); } @@ -1341,7 +1341,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr assert(sample_pos.file != BAD_FILE); dest.type = sample_pos.type; bld.MOV(dest, sample_pos); - bld.MOV(offset(dest, 1), offset(sample_pos, 1)); + bld.MOV(offset(dest, bld, 1), offset(sample_pos, bld, 1)); break; } @@ -1368,13 +1368,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr } for (unsigned j = 0; j < instr->num_components; j++) { - fs_reg src = offset(retype(uniform_reg, dest.type), index); + fs_reg src = offset(retype(uniform_reg, dest.type), bld, index); if (has_indirect) src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[0])); index++; bld.MOV(dest, src); - dest = offset(dest, 1); + dest = offset(dest, bld, 1); } break; } @@ -1416,7 +1416,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr unsigned vec4_offset = instr->const_index[0] / 4; for (int i = 0; i < instr->num_components; i++) - VARYING_PULL_CONSTANT_LOAD(bld, offset(dest, i), surf_index, + VARYING_PULL_CONSTANT_LOAD(bld, offset(dest, bld, i), surf_index, base_offset, vec4_offset + i); } else { fs_reg packed_consts = vgrf(glsl_type::float_type); @@ -1435,7 +1435,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr assert(packed_consts.subreg_offset < 32); bld.MOV(dest, packed_consts); - dest = offset(dest, 1); + dest = offset(dest, bld, 1); } } break; @@ -1447,14 +1447,14 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr case nir_intrinsic_load_input: { unsigned index = 0; for (unsigned j = 0; j < instr->num_components; j++) { - fs_reg src = offset(retype(nir_inputs, dest.type), + fs_reg src = offset(retype(nir_inputs, dest.type), bld, instr->const_index[0] + index); if (has_indirect) src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[0])); index++; bld.MOV(dest, src); - dest = offset(dest, 1); + dest = offset(dest, bld, 1); } break; } @@ -1527,7 +1527,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr BRW_REGISTER_TYPE_F); for (int i = 0; i < 2; i++) { fs_reg temp = vgrf(glsl_type::float_type); - bld.MUL(temp, offset(offset_src, i), fs_reg(16.0f)); + bld.MUL(temp, offset(offset_src, bld, i), fs_reg(16.0f)); fs_reg itemp = vgrf(glsl_type::int_type); bld.MOV(itemp, temp); /* float to int */ @@ -1547,7 +1547,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr * FRAGMENT_INTERPOLATION_OFFSET_BITS" */ set_condmod(BRW_CONDITIONAL_L, - bld.SEL(offset(src, i), itemp, fs_reg(7))); + bld.SEL(offset(src, bld, i), itemp, fs_reg(7))); } mlen = 2; @@ -1571,7 +1571,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr src.type = dest.type; bld.emit(FS_OPCODE_LINTERP, dest, dst_xy, src); - dest = offset(dest, 1); + dest = offset(dest, bld, 1); } break; } @@ -1583,13 +1583,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr fs_reg src = get_nir_src(instr->src[0]); unsigned index = 0; for (unsigned j = 0; j < instr->num_components; j++) { - fs_reg new_dest = offset(retype(nir_outputs, src.type), + fs_reg new_dest = offset(retype(nir_outputs, src.type), bld, instr->const_index[0] + index); if (has_indirect) src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[1])); index++; bld.MOV(new_dest, src); - src = offset(src, 1); + src = offset(src, bld, 1); } break; } diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 69d3cfa8897..9b91f47d264 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -95,7 +95,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst, if (shadow_c.file != BAD_FILE) { for (int i = 0; i < coord_components; i++) { bld.MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); } /* gen4's SIMD8 sampler always has the slots for u,v,r present. @@ -124,7 +124,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst, } else if (op == ir_tex) { for (int i = 0; i < coord_components; i++) { bld.MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); } /* zero the others. */ for (int i = coord_components; i<3; i++) { @@ -137,7 +137,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst, for (int i = 0; i < coord_components; i++) { bld.MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); } /* the slots for u and v are always present, but r is optional */ mlen += MAX2(coord_components, 2); @@ -158,13 +158,13 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst, */ for (int i = 0; i < grad_components; i++) { bld.MOV(fs_reg(MRF, base_mrf + mlen), dPdx); - dPdx = offset(dPdx, 1); + dPdx = offset(dPdx, bld, 1); } mlen += MAX2(grad_components, 2); for (int i = 0; i < grad_components; i++) { bld.MOV(fs_reg(MRF, base_mrf + mlen), dPdy); - dPdy = offset(dPdy, 1); + dPdy = offset(dPdy, bld, 1); } mlen += MAX2(grad_components, 2); } else if (op == ir_txs) { @@ -182,7 +182,7 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst, for (int i = 0; i < coord_components; i++) { bld.MOV(fs_reg(MRF, base_mrf + mlen + i * 2, coordinate.type), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); } /* Initialize the rest of u/v/r with 0.0. Empirically, this seems to @@ -232,8 +232,8 @@ fs_visitor::emit_texture_gen4(ir_texture_opcode op, fs_reg dst, if (simd16) { for (int i = 0; i < 4; i++) { bld.MOV(orig_dst, dst); - orig_dst = offset(orig_dst, 1); - dst = offset(dst, 2); + orig_dst = offset(orig_dst, bld, 1); + dst = offset(dst, bld, 2); } } @@ -257,31 +257,31 @@ fs_visitor::emit_texture_gen4_simd16(ir_texture_opcode op, fs_reg dst, /* Copy the coordinates. */ for (int i = 0; i < vector_elements; i++) { - bld.MOV(retype(offset(message, i), coordinate.type), coordinate); - coordinate = offset(coordinate, 1); + bld.MOV(retype(offset(message, bld, i), coordinate.type), coordinate); + coordinate = offset(coordinate, bld, 1); } - fs_reg msg_end = offset(message, vector_elements); + fs_reg msg_end = offset(message, bld, vector_elements); /* Messages other than sample and ld require all three components */ if (vector_elements > 0 && (has_lod || shadow_c.file != BAD_FILE)) { for (int i = vector_elements; i < 3; i++) { - bld.MOV(offset(message, i), fs_reg(0.0f)); + bld.MOV(offset(message, bld, i), fs_reg(0.0f)); } - msg_end = offset(message, 3); + msg_end = offset(message, bld, 3); } if (has_lod) { fs_reg msg_lod = retype(msg_end, op == ir_txf ? BRW_REGISTER_TYPE_UD : BRW_REGISTER_TYPE_F); bld.MOV(msg_lod, lod); - msg_end = offset(msg_lod, 1); + msg_end = offset(msg_lod, bld, 1); } if (shadow_c.file != BAD_FILE) { - fs_reg msg_ref = offset(message, 3 + has_lod); + fs_reg msg_ref = offset(message, bld, 3 + has_lod); bld.MOV(msg_ref, shadow_c); - msg_end = offset(msg_ref, 1); + msg_end = offset(msg_ref, bld, 1); } enum opcode opcode; @@ -335,16 +335,16 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst, } for (int i = 0; i < vector_elements; i++) { - bld.MOV(retype(offset(msg_coords, i), coordinate.type), coordinate); - coordinate = offset(coordinate, 1); + bld.MOV(retype(offset(msg_coords, bld, i), coordinate.type), coordinate); + coordinate = offset(coordinate, bld, 1); } - fs_reg msg_end = offset(msg_coords, vector_elements); - fs_reg msg_lod = offset(msg_coords, 4); + fs_reg msg_end = offset(msg_coords, bld, vector_elements); + fs_reg msg_lod = offset(msg_coords, bld, 4); if (shadow_c.file != BAD_FILE) { fs_reg msg_shadow = msg_lod; bld.MOV(msg_shadow, shadow_c); - msg_lod = offset(msg_shadow, 1); + msg_lod = offset(msg_shadow, bld, 1); msg_end = msg_lod; } @@ -355,13 +355,13 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst, break; case ir_txb: bld.MOV(msg_lod, lod); - msg_end = offset(msg_lod, 1); + msg_end = offset(msg_lod, bld, 1); opcode = FS_OPCODE_TXB; break; case ir_txl: bld.MOV(msg_lod, lod); - msg_end = offset(msg_lod, 1); + msg_end = offset(msg_lod, bld, 1); opcode = SHADER_OPCODE_TXL; break; @@ -378,12 +378,12 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst, msg_end = msg_lod; for (int i = 0; i < grad_components; i++) { bld.MOV(msg_end, lod); - lod = offset(lod, 1); - msg_end = offset(msg_end, 1); + lod = offset(lod, bld, 1); + msg_end = offset(msg_end, bld, 1); bld.MOV(msg_end, lod2); - lod2 = offset(lod2, 1); - msg_end = offset(msg_end, 1); + lod2 = offset(lod2, bld, 1); + msg_end = offset(msg_end, bld, 1); } opcode = SHADER_OPCODE_TXD; @@ -392,31 +392,31 @@ fs_visitor::emit_texture_gen5(ir_texture_opcode op, fs_reg dst, case ir_txs: msg_lod = retype(msg_end, BRW_REGISTER_TYPE_UD); bld.MOV(msg_lod, lod); - msg_end = offset(msg_lod, 1); + msg_end = offset(msg_lod, bld, 1); opcode = SHADER_OPCODE_TXS; break; case ir_query_levels: msg_lod = msg_end; bld.MOV(retype(msg_lod, BRW_REGISTER_TYPE_UD), fs_reg(0u)); - msg_end = offset(msg_lod, 1); + msg_end = offset(msg_lod, bld, 1); opcode = SHADER_OPCODE_TXS; break; case ir_txf: - msg_lod = offset(msg_coords, 3); + msg_lod = offset(msg_coords, bld, 3); bld.MOV(retype(msg_lod, BRW_REGISTER_TYPE_UD), lod); - msg_end = offset(msg_lod, 1); + msg_end = offset(msg_lod, bld, 1); opcode = SHADER_OPCODE_TXF; break; case ir_txf_ms: - msg_lod = offset(msg_coords, 3); + msg_lod = offset(msg_coords, bld, 3); /* lod */ bld.MOV(retype(msg_lod, BRW_REGISTER_TYPE_UD), fs_reg(0u)); /* sample index */ - bld.MOV(retype(offset(msg_lod, 1), BRW_REGISTER_TYPE_UD), sample_index); - msg_end = offset(msg_lod, 2); + bld.MOV(retype(offset(msg_lod, bld, 1), BRW_REGISTER_TYPE_UD), sample_index); + msg_end = offset(msg_lod, bld, 2); opcode = SHADER_OPCODE_TXF_CMS; break; @@ -526,7 +526,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, */ for (int i = 0; i < coord_components; i++) { bld.MOV(sources[length], coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; /* For cube map array, the coordinate is (u,v,r,ai) but there are @@ -534,11 +534,11 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, */ if (i < grad_components) { bld.MOV(sources[length], lod); - lod = offset(lod, 1); + lod = offset(lod, bld, 1); length++; bld.MOV(sources[length], lod2); - lod2 = offset(lod2, 1); + lod2 = offset(lod2, bld, 1); length++; } } @@ -560,13 +560,13 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, */ bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; if (devinfo->gen >= 9) { if (coord_components >= 2) { bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); } length++; } @@ -576,7 +576,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, for (int i = devinfo->gen >= 9 ? 2 : 1; i < coord_components; i++) { bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; } @@ -595,7 +595,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, */ for (int i = 0; i < coord_components; i++) { bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; } @@ -609,19 +609,19 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, /* More crazy intermixing */ for (int i = 0; i < 2; i++) { /* u, v */ bld.MOV(sources[length], coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; } for (int i = 0; i < 2; i++) { /* offu, offv */ bld.MOV(retype(sources[length], BRW_REGISTER_TYPE_D), offset_value); - offset_value = offset(offset_value, 1); + offset_value = offset(offset_value, bld, 1); length++; } if (coord_components == 3) { /* r if present */ bld.MOV(sources[length], coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; } @@ -634,7 +634,7 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, if (!coordinate_done) { for (int i = 0; i < coord_components; i++) { bld.MOV(sources[length], coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); length++; } } @@ -747,8 +747,8 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components, coordinate = dst; bld.MUL(dst, src, scale_x); - dst = offset(dst, 1); - src = offset(src, 1); + dst = offset(dst, bld, 1); + src = offset(src, bld, 1); bld.MUL(dst, src, scale_y); } else if (is_rect) { /* On gen6+, the sampler handles the rectangle coordinates @@ -761,7 +761,7 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components, for (int i = 0; i < 2; i++) { if (key_tex->gl_clamp_mask[i] & (1 << sampler)) { fs_reg chan = coordinate; - chan = offset(chan, i); + chan = offset(chan, bld, i); set_condmod(BRW_CONDITIONAL_GE, bld.emit(BRW_OPCODE_SEL, chan, chan, fs_reg(0.0f))); @@ -786,7 +786,7 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components, for (int i = 0; i < MIN2(coord_components, 3); i++) { if (key_tex->gl_clamp_mask[i] & (1 << sampler)) { fs_reg chan = coordinate; - chan = offset(chan, i); + chan = offset(chan, bld, i); set_saturate(true, bld.MOV(chan, chan)); } } @@ -808,7 +808,7 @@ fs_visitor::emit_mcs_fetch(fs_reg coordinate, int components, fs_reg sampler) for (int i = 0; i < components; i++) { sources[i] = vgrf(glsl_type::float_type); bld.MOV(retype(sources[i], BRW_REGISTER_TYPE_D), coordinate); - coordinate = offset(coordinate, 1); + coordinate = offset(coordinate, bld, 1); } bld.LOAD_PAYLOAD(payload, sources, components, 0); @@ -854,7 +854,7 @@ fs_visitor::emit_texture(ir_texture_opcode op, for (int i=0; i<4; i++) { bld.MOV(res, fs_reg(swiz == SWIZZLE_ZERO ? 0.0f : 1.0f)); - res = offset(res, 1); + res = offset(res, bld, 1); } return; } @@ -908,7 +908,7 @@ fs_visitor::emit_texture(ir_texture_opcode op, /* fixup #layers for cube map arrays */ if (op == ir_txs && is_cube_array) { - fs_reg depth = offset(dst, 2); + fs_reg depth = offset(dst, bld, 2); fs_reg fixed_depth = vgrf(glsl_type::int_type); bld.emit(SHADER_OPCODE_INT_QUOTIENT, fixed_depth, depth, fs_reg(6)); @@ -918,7 +918,7 @@ fs_visitor::emit_texture(ir_texture_opcode op, if (i == 2) { fixed_payload[i] = fixed_depth; } else { - fixed_payload[i] = offset(dst, i); + fixed_payload[i] = offset(dst, bld, i); } } bld.LOAD_PAYLOAD(dst, fixed_payload, components, 0); @@ -953,7 +953,7 @@ fs_visitor::emit_gen6_gather_wa(uint8_t wa, fs_reg dst) bld.ASR(dst, dst, fs_reg(32 - width)); } - dst = offset(dst, 1); + dst = offset(dst, bld, 1); } } @@ -990,7 +990,7 @@ fs_visitor::swizzle_result(ir_texture_opcode op, int dest_components, { if (op == ir_query_levels) { /* # levels is in .w */ - this->result = offset(orig_val, 3); + this->result = offset(orig_val, bld, 3); return; } @@ -1011,15 +1011,15 @@ fs_visitor::swizzle_result(ir_texture_opcode op, int dest_components, for (int i = 0; i < 4; i++) { int swiz = GET_SWZ(key_tex->swizzles[sampler], i); fs_reg l = swizzled_result; - l = offset(l, i); + l = offset(l, bld, i); if (swiz == SWIZZLE_ZERO) { bld.MOV(l, fs_reg(0.0f)); } else if (swiz == SWIZZLE_ONE) { bld.MOV(l, fs_reg(1.0f)); } else { - bld.MOV(l, offset(orig_val, - GET_SWZ(key_tex->swizzles[sampler], i))); + bld.MOV(l, offset(orig_val, bld, + GET_SWZ(key_tex->swizzles[sampler], i))); } } this->result = swizzled_result; @@ -1316,14 +1316,14 @@ fs_visitor::emit_interpolation_setup_gen4() if (devinfo->has_pln && dispatch_width == 16) { for (unsigned i = 0; i < 2; i++) { - abld.half(i).ADD(half(offset(delta_xy, i), 0), + abld.half(i).ADD(half(offset(delta_xy, abld, i), 0), half(this->pixel_x, i), xstart); - abld.half(i).ADD(half(offset(delta_xy, i), 1), + abld.half(i).ADD(half(offset(delta_xy, abld, i), 1), half(this->pixel_y, i), ystart); } } else { - abld.ADD(offset(delta_xy, 0), this->pixel_x, xstart); - abld.ADD(offset(delta_xy, 1), this->pixel_y, ystart); + abld.ADD(offset(delta_xy, abld, 0), this->pixel_x, xstart); + abld.ADD(offset(delta_xy, abld, 1), this->pixel_y, ystart); } abld = bld.annotate("compute pos.w and 1/pos.w"); @@ -1421,7 +1421,7 @@ fs_visitor::setup_color_payload(fs_reg *dst, fs_reg color, unsigned components, fs_reg tmp = vgrf(glsl_type::vec4_type); assert(color.type == BRW_REGISTER_TYPE_F); for (unsigned i = 0; i < components; i++) { - inst = bld.MOV(offset(tmp, i), offset(color, i)); + inst = bld.MOV(offset(tmp, bld, i), offset(color, bld, i)); inst->saturate = true; } color = tmp; @@ -1430,10 +1430,10 @@ fs_visitor::setup_color_payload(fs_reg *dst, fs_reg color, unsigned components, if (exec_size < dispatch_width) { unsigned half_idx = use_2nd_half ? 1 : 0; for (unsigned i = 0; i < components; i++) - dst[i] = half(offset(color, i), half_idx); + dst[i] = half(offset(color, bld, i), half_idx); } else { for (unsigned i = 0; i < components; i++) - dst[i] = offset(color, i); + dst[i] = offset(color, bld, i); } } @@ -1481,7 +1481,7 @@ fs_visitor::emit_alpha_test() BRW_CONDITIONAL_NEQ); } else { /* RT0 alpha */ - fs_reg color = offset(outputs[0], 3); + fs_reg color = offset(outputs[0], bld, 3); /* f0.1 &= func(color, ref) */ cmp = abld.CMP(bld.null_reg_f(), color, fs_reg(key->alpha_test_ref), @@ -1558,7 +1558,8 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld, * alpha-testing, alpha-to-coverage, and so on. */ if (this->outputs[0].file != BAD_FILE) - setup_color_payload(&sources[length + 3], offset(this->outputs[0], 3), + setup_color_payload(&sources[length + 3], + offset(this->outputs[0], bld, 3), 1, exec_size, false); length += 4; } else if (color1.file == BAD_FILE) { @@ -1694,7 +1695,7 @@ fs_visitor::emit_fb_writes() fs_reg src0_alpha; if (devinfo->gen >= 6 && key->replicate_alpha && target != 0) - src0_alpha = offset(outputs[0], 3); + src0_alpha = offset(outputs[0], bld, 3); inst = emit_single_fb_write(abld, this->outputs[target], reg_undef, src0_alpha, @@ -1787,7 +1788,7 @@ void fs_visitor::compute_clip_distance(gl_clip_plane *clip_planes) abld.MUL(output, outputs[clip_vertex], u); for (int j = 1; j < 4; j++) { u.reg = userplane[i].reg + j; - abld.MAD(output, output, offset(outputs[clip_vertex], j), u); + abld.MAD(output, output, offset(outputs[clip_vertex], bld, j), u); } } } @@ -1904,13 +1905,13 @@ fs_visitor::emit_urb_writes() */ for (int i = 0; i < 4; i++) { reg = fs_reg(GRF, alloc.allocate(1), outputs[varying].type); - src = offset(this->outputs[varying], i); + src = offset(this->outputs[varying], bld, i); set_saturate(true, bld.MOV(reg, src)); sources[length++] = reg; } } else { for (int i = 0; i < 4; i++) - sources[length++] = offset(this->outputs[varying], i); + sources[length++] = offset(this->outputs[varying], bld, i); } break; } diff --git a/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp index 8010fb4f610..ba67bc59e19 100644 --- a/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp +++ b/src/mesa/drivers/dri/i965/test_fs_cmod_propagation.cpp @@ -283,10 +283,10 @@ TEST_F(cmod_propagation_test, intervening_dest_write) fs_reg src1 = v->vgrf(glsl_type::float_type); fs_reg src2 = v->vgrf(glsl_type::vec2_type); fs_reg zero(0.0f); - bld.ADD(offset(dest, 2), src0, src1); + bld.ADD(offset(dest, bld, 2), src0, src1); bld.emit(SHADER_OPCODE_TEX, dest, src2) ->regs_written = 4; - bld.CMP(bld.null_reg_f(), offset(dest, 2), zero, BRW_CONDITIONAL_GE); + bld.CMP(bld.null_reg_f(), offset(dest, bld, 2), zero, BRW_CONDITIONAL_GE); /* = Before = * diff --git a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp index 3ef0cb319eb..1caa0b50ec6 100644 --- a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp +++ b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp @@ -367,10 +367,10 @@ TEST_F(saturate_propagation_test, intervening_dest_write) fs_reg src0 = v->vgrf(glsl_type::float_type); fs_reg src1 = v->vgrf(glsl_type::float_type); fs_reg src2 = v->vgrf(glsl_type::vec2_type); - bld.ADD(offset(dst0, 2), src0, src1); + bld.ADD(offset(dst0, bld, 2), src0, src1); bld.emit(SHADER_OPCODE_TEX, dst0, src2) ->regs_written = 4; - set_saturate(true, bld.MOV(dst1, offset(dst0, 2))); + set_saturate(true, bld.MOV(dst1, offset(dst0, bld, 2))); /* = Before = * |