diff options
author | Kenneth Graunke <[email protected]> | 2016-05-17 01:52:16 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-05-20 14:30:08 -0700 |
commit | dac10e8a1390711f1f36f224644c4a33586cebe3 (patch) | |
tree | fa332e97d19225f705f72a6247ef1e3c254cf832 /src/mesa/drivers/dri/i965/brw_fs.cpp | |
parent | 6e5d86c07af920fa52afbe075a04116b9ebb3cc3 (diff) |
i965, anv: Use NIR FragCoord re-center and y-transform passes.
This handles gl_FragCoord transformations and other window system vs.
user FBO coordinate system flipping by multiplying/adding uniform
values, rather than recompiles.
This is much better because we have no decent way to guess whether
the application is going to use a shader with the window system FBO
or a user FBO, much less the drawable height. This led to a lot of
recompiles in many applications.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index f5e8d6be21f..847a6d36566 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1060,37 +1060,18 @@ fs_visitor::import_uniforms(fs_visitor *v) } fs_reg * -fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer, - bool origin_upper_left) +fs_visitor::emit_fragcoord_interpolation() { 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(vgrf(glsl_type::vec4_type)); fs_reg wpos = *reg; - bool flip = !origin_upper_left ^ key->render_to_fbo; /* gl_FragCoord.x */ - if (pixel_center_integer) { - bld.MOV(wpos, this->pixel_x); - } else { - bld.ADD(wpos, this->pixel_x, brw_imm_f(0.5f)); - } + bld.MOV(wpos, this->pixel_x); wpos = offset(wpos, bld, 1); /* gl_FragCoord.y */ - if (!flip && pixel_center_integer) { - bld.MOV(wpos, this->pixel_y); - } else { - fs_reg pixel_y = this->pixel_y; - float offset = (pixel_center_integer ? 0.0f : 0.5f); - - if (flip) { - pixel_y.negate = true; - offset += key->drawable_height - 1.0f; - } - - bld.ADD(wpos, pixel_y, brw_imm_f(offset)); - } + bld.MOV(wpos, this->pixel_y); wpos = offset(wpos, bld, 1); /* gl_FragCoord.z */ |