[Mesa-dev] [PATCH 5/5] i965/fs: Apply gl_FrontFacing ? -1 : 1 optimization only for floats
Ian Romanick
idr at freedesktop.org
Wed Mar 11 13:44:16 PDT 2015
From: Ian Romanick <ian.d.romanick at intel.com>
At the very least, unreal4/sun-temple/102.shader_test uses this pattern
for a signed integer result. However, that shader did not hit the
optimization in the first place because it uses !gl_FronFacing. I
changed the shader to use remove the logical-not and reverse the other
operands. I verified that incorrect code is generated before this
change and correct code is generated after.
I'll send a piglit test out shortly...
No shader-db changes.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Matt Turner <mattst88 at gmail.com>
---
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 917d3da..3740722 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2845,6 +2845,9 @@ fs_visitor::try_opt_frontfacing_ternary(ir_if *ir)
if (!then_rhs || !else_rhs)
return false;
+ if (then_rhs->type->base_type != GLSL_TYPE_FLOAT)
+ return false;
+
if ((then_rhs->is_one() && else_rhs->is_negative_one()) ||
(else_rhs->is_one() && then_rhs->is_negative_one())) {
then_assign->lhs->accept(this);
--
2.1.0
More information about the mesa-dev
mailing list