case LP_INTERP_LINEAR:
if (attrib == 0 && chan == 0) {
dadx = coeff_bld->one;
+ if (bld->pos_offset) {
+ a = lp_build_const_vec(gallivm, coeff_bld->type, bld->pos_offset);
+ }
}
else if (attrib == 0 && chan == 1) {
dady = coeff_bld->one;
+ if (bld->pos_offset) {
+ a = lp_build_const_vec(gallivm, coeff_bld->type, bld->pos_offset);
+ }
}
else {
dadx = lp_build_extract_broadcast(gallivm, setup_bld->type,
LLVMValueRef chan_index = lp_build_const_int32(gallivm, chan);
if (attrib == 0 && chan == 0) {
- a = lp_build_broadcast_scalar(coeff_bld, bld->x);
+ a = bld->x;
+ if (bld->pos_offset) {
+ a = LLVMBuildFAdd(builder, a, lp_build_const_float(gallivm, bld->pos_offset), "");
+ }
+ a = lp_build_broadcast_scalar(coeff_bld, a);
dadx = coeff_bld->one;
dady = coeff_bld->zero;
}
else if (attrib == 0 && chan == 1) {
- a = lp_build_broadcast_scalar(coeff_bld, bld->y);
+ a = bld->y;
+ if (bld->pos_offset) {
+ a = LLVMBuildFAdd(builder, a, lp_build_const_float(gallivm, bld->pos_offset), "");
+ }
+ a = lp_build_broadcast_scalar(coeff_bld, a);
dady = coeff_bld->one;
dadx = coeff_bld->zero;
}
struct gallivm_state *gallivm,
unsigned num_inputs,
const struct lp_shader_input *inputs,
+ boolean pixel_center_integer,
LLVMBuilderRef builder,
struct lp_type type,
LLVMValueRef a0_ptr,
}
}
+ if (pixel_center_integer) {
+ bld->pos_offset = 0.0;
+ } else {
+ bld->pos_offset = 0.5;
+ }
+
pos_init(bld, x0, y0);
if (coeff_type.length > 4) {
return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+ case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 0;
case PIPE_CAP_PRIMITIVE_RESTART:
return 1;