}
fs_reg *
-fs_visitor::emit_fragcoord_interpolation(ir_variable *ir)
+fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,
+ bool origin_upper_left)
{
assert(stage == MESA_SHADER_FRAGMENT);
brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
- fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
+ fs_reg *reg = new(this->mem_ctx) fs_reg(this, glsl_type::vec4_type);
fs_reg wpos = *reg;
- bool flip = !ir->data.origin_upper_left ^ key->render_to_fbo;
+ bool flip = !origin_upper_left ^ key->render_to_fbo;
/* gl_FragCoord.x */
- if (ir->data.pixel_center_integer) {
+ if (pixel_center_integer) {
emit(MOV(wpos, this->pixel_x));
} else {
emit(ADD(wpos, this->pixel_x, fs_reg(0.5f)));
wpos = offset(wpos, 1);
/* gl_FragCoord.y */
- if (!flip && ir->data.pixel_center_integer) {
+ if (!flip && pixel_center_integer) {
emit(MOV(wpos, this->pixel_y));
} else {
fs_reg pixel_y = this->pixel_y;
- float offset = (ir->data.pixel_center_integer ? 0.0 : 0.5);
+ float offset = (pixel_center_integer ? 0.0 : 0.5);
if (flip) {
pixel_y.negate = true;
void emit_dummy_fs();
void emit_repclear_shader();
- fs_reg *emit_fragcoord_interpolation(ir_variable *ir);
+ fs_reg *emit_fragcoord_interpolation(bool pixel_center_integer,
+ bool origin_upper_left);
fs_inst *emit_linterp(const fs_reg &attr, const fs_reg &interp,
glsl_interp_qualifier interpolation_mode,
bool is_centroid, bool is_sample);
gl_fragment_program *fp = (gl_fragment_program*) prog;
ir->data.pixel_center_integer = fp->PixelCenterInteger;
ir->data.origin_upper_left = fp->OriginUpperLeft;
+ fp_input_regs[i] =
+ *emit_fragcoord_interpolation(fp->PixelCenterInteger,
+ fp->OriginUpperLeft);
}
- fp_input_regs[i] = *emit_fragcoord_interpolation(ir);
break;
case VARYING_SLOT_FACE:
fp_input_regs[i] = *emit_frontfacing_interpolation();
fs_reg(ATTR, ir->data.location,
brw_type_for_base_type(ir->type->get_scalar_type()));
} else if (!strcmp(ir->name, "gl_FragCoord")) {
- reg = emit_fragcoord_interpolation(ir);
+ reg = emit_fragcoord_interpolation(ir->data.pixel_center_integer,
+ ir->data.origin_upper_left);
} else if (!strcmp(ir->name, "gl_FrontFacing")) {
reg = emit_frontfacing_interpolation();
} else {