summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2014-08-05 11:02:02 -0700
committerJason Ekstrand <[email protected]>2015-01-15 07:18:58 -0800
commit616a48ebc6b858cf15ade15238f1a549b701ebc3 (patch)
tree487c6c678f816c15f333ee4a28f60b2792b5b4f7 /src
parent7602385ac5c0e9935a69ec9f636fbbc392c55744 (diff)
i965/fs: make emit_fragcoord_interpolation() not take an ir_variable
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp13
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_fp.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp3
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 {