mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 15:50:11 +01:00
i965/vs: Fix texelFetchOffset()
It appears that when using 'ld' with the offset bits, address bounds checking happens before the offset is applied, so parts of the drawing in piglit texelFetchOffset() with a negative texcoord go black.
This commit is contained in:
parent
f41ecade7b
commit
4650aea7a5
1 changed files with 23 additions and 3 deletions
|
|
@ -1838,7 +1838,7 @@ vec4_visitor::visit(ir_texture *ir)
|
||||||
inst->dst = dst_reg(this, ir->type);
|
inst->dst = dst_reg(this, ir->type);
|
||||||
inst->shadow_compare = ir->shadow_comparitor != NULL;
|
inst->shadow_compare = ir->shadow_comparitor != NULL;
|
||||||
|
|
||||||
if (ir->offset != NULL)
|
if (ir->offset != NULL && !(intel->gen >= 7 && ir->op == ir_txf))
|
||||||
inst->texture_offset = brw_texture_offset(ir->offset->as_constant());
|
inst->texture_offset = brw_texture_offset(ir->offset->as_constant());
|
||||||
|
|
||||||
/* MRF for the first parameter */
|
/* MRF for the first parameter */
|
||||||
|
|
@ -1859,8 +1859,28 @@ vec4_visitor::visit(ir_texture *ir)
|
||||||
zero_mask |= (1 << i);
|
zero_mask |= (1 << i);
|
||||||
|
|
||||||
ir->coordinate->accept(this);
|
ir->coordinate->accept(this);
|
||||||
emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, coord_mask),
|
if (ir->offset && intel->gen >= 7 && ir->op == ir_txf) {
|
||||||
this->result));
|
/* 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 = this->result;
|
||||||
|
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),
|
||||||
|
this->result));
|
||||||
|
}
|
||||||
emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, zero_mask),
|
emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, zero_mask),
|
||||||
src_reg(0)));
|
src_reg(0)));
|
||||||
/* Load the shadow comparitor */
|
/* Load the shadow comparitor */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue