diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 |
4 files changed, 14 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index cbe4fda63dd..642b9dc3405 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1203,16 +1203,17 @@ fs_visitor::setup_builtin_uniform_values(ir_variable *ir) } 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))); @@ -1220,11 +1221,11 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) 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; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index c9f235cd09e..d488c621566 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -471,7 +471,8 @@ public: 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); diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index bead05a21a8..8041740784e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -584,8 +584,10 @@ fs_visitor::setup_fp_regs() 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(); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 1e7fdf5b4f2..9c6b197a923 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -93,7 +93,8 @@ fs_visitor::visit(ir_variable *ir) 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 { |