if (ir->shadow_comparitor && ir->op != ir_txd) {
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- fs_inst *inst = emit(BRW_OPCODE_MOV,
- fs_reg(MRF, base_mrf + mlen + i), coordinate);
- if (i < 3 && c->key.tex.gl_clamp_mask[i] & (1 << sampler))
- inst->saturate = true;
-
+ emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i), coordinate);
coordinate.reg_offset++;
}
/* gen4's SIMD8 sampler always has the slots for u,v,r present. */
mlen++;
} else if (ir->op == ir_tex) {
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- fs_inst *inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i),
- coordinate);
- if (i < 3 && c->key.tex.gl_clamp_mask[i] & (1 << sampler))
- inst->saturate = true;
+ emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i), coordinate);
coordinate.reg_offset++;
}
/* gen4's SIMD8 sampler always has the slots for u,v,r present. */
assert(ir->op == ir_txb || ir->op == ir_txl || ir->op == ir_txf);
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- fs_inst *inst = emit(BRW_OPCODE_MOV, fs_reg(MRF,
- base_mrf + mlen + i * 2,
- coordinate.type),
- coordinate);
- if (i < 3 && c->key.tex.gl_clamp_mask[i] & (1 << sampler))
- inst->saturate = true;
+ emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i * 2, coordinate.type),
+ coordinate);
coordinate.reg_offset++;
}
}
for (int i = 0; i < vector_elements; i++) {
- fs_inst *inst = emit(BRW_OPCODE_MOV,
- fs_reg(MRF, base_mrf + mlen + i * reg_width,
- coordinate.type),
- coordinate);
- if (i < 3 && c->key.tex.gl_clamp_mask[i] & (1 << sampler))
- inst->saturate = true;
+ emit(BRW_OPCODE_MOV,
+ fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type),
+ coordinate);
coordinate.reg_offset++;
}
mlen += vector_elements * reg_width;
* [hdr], [ref], x, dPdx.x, dPdy.x, y, dPdx.y, dPdy.y, z, dPdx.z, dPdy.z
*/
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- fs_inst *inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
- coordinate);
- if (i < 3 && c->key.tex.gl_clamp_mask[i] & (1 << sampler))
- inst->saturate = true;
+ emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate);
coordinate.reg_offset++;
mlen += reg_width;
/* Set up the coordinate (except for cases where it was done above) */
if (ir->op != ir_txd && ir->op != ir_txs && ir->op != ir_txf) {
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- fs_inst *inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
- coordinate);
- if (i < 3 && c->key.tex.gl_clamp_mask[i] & (1 << sampler))
- inst->saturate = true;
+ emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate);
coordinate.reg_offset++;
mlen += reg_width;
}
emit(BRW_OPCODE_MUL, dst, src, scale_y);
}
+ if (ir->coordinate) {
+ for (int i = 0; i < MIN2(ir->coordinate->type->vector_elements, 3); i++) {
+ if (c->key.tex.gl_clamp_mask[i] & (1 << sampler)) {
+ fs_reg chan = coordinate;
+ chan.reg_offset += i;
+
+ fs_inst *inst = emit(BRW_OPCODE_MOV, chan, chan);
+ inst->saturate = true;
+ }
+ }
+ }
+
/* Writemasking doesn't eliminate channels on SIMD8 texture
* samples, so don't worry about them.
*/