const int vector_elements =
ir->coordinate ? ir->coordinate->type->vector_elements : 0;
- if (ir->offset != NULL && ir->op == ir_txf) {
- /* It appears that the ld instruction used for txf does its
- * address bounds check before adding in the offset. To work
- * around this, just add the integer offset to the integer texel
- * coordinate, and don't put the offset in the header.
+ if (ir->offset) {
+ /* The offsets set up by the ir_texture visitor are in the
+ * m1 header, so we can't go headerless.
*/
- ir_constant *offset = ir->offset->as_constant();
- for (int i = 0; i < vector_elements; i++) {
- emit(ADD(fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type),
- coordinate,
- offset->value.i[i]));
- coordinate.reg_offset++;
- }
- } else {
- if (ir->offset) {
- /* The offsets set up by the ir_texture visitor are in the
- * m1 header, so we can't go headerless.
- */
- header_present = true;
- mlen++;
- base_mrf--;
- }
+ header_present = true;
+ mlen++;
+ base_mrf--;
+ }
- for (int i = 0; i < vector_elements; i++) {
- emit(MOV(fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type),
- coordinate));
- coordinate.reg_offset++;
- }
+ for (int i = 0; i < vector_elements; i++) {
+ emit(MOV(fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type),
+ coordinate));
+ coordinate.reg_offset++;
}
mlen += vector_elements * reg_width;
{
int reg_width = dispatch_width / 8;
bool header_present = false;
- int offsets[3];
fs_reg payload = fs_reg(this, glsl_type::float_type);
fs_reg next = payload;
next.reg_offset++;
break;
case ir_txf:
- /* It appears that the ld instruction used for txf does its
- * address bounds check before adding in the offset. To work
- * around this, just add the integer offset to the integer texel
- * coordinate, and don't put the offset in the header.
- */
- if (ir->offset) {
- ir_constant *offset = ir->offset->as_constant();
- offsets[0] = offset->value.i[0];
- offsets[1] = offset->value.i[1];
- offsets[2] = offset->value.i[2];
- } else {
- memset(offsets, 0, sizeof(offsets));
- }
-
/* Unfortunately, the parameters for LD are intermixed: u, lod, v, r. */
- emit(ADD(next.retype(BRW_REGISTER_TYPE_D), coordinate, offsets[0]));
+ emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate));
coordinate.reg_offset++;
next.reg_offset++;
next.reg_offset++;
for (int i = 1; i < ir->coordinate->type->vector_elements; i++) {
- emit(ADD(next.retype(BRW_REGISTER_TYPE_D), coordinate, offsets[i]));
+ emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate));
coordinate.reg_offset++;
next.reg_offset++;
}
int coord_mask = (1 << ir->coordinate->type->vector_elements) - 1;
int zero_mask = 0xf & ~coord_mask;
- if (ir->offset && ir->op == ir_txf) {
- /* It appears that the ld instruction used for txf does its
- * address bounds check before adding in the offset. To work
- * around this, just add the integer offset to the integer
- * texel coordinate, and don't put the offset in the header.
- */
- ir_constant *offset = ir->offset->as_constant();
- assert(offset);
-
- for (int j = 0; j < ir->coordinate->type->vector_elements; j++) {
- src_reg src = coordinate;
- src.swizzle = BRW_SWIZZLE4(BRW_GET_SWZ(src.swizzle, j),
- BRW_GET_SWZ(src.swizzle, j),
- BRW_GET_SWZ(src.swizzle, j),
- BRW_GET_SWZ(src.swizzle, j));
- emit(ADD(dst_reg(MRF, param_base, ir->coordinate->type, 1 << j),
- src, offset->value.i[j]));
- }
- } else {
- emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, coord_mask),
- coordinate));
- }
+ emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, coord_mask),
+ coordinate));
+
if (zero_mask != 0) {
emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, zero_mask),
src_reg(0)));