i965: Use rcp in brw_lower_texture_gradients rather than 1.0 / x.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 5 Jan 2016 12:46:33 +0000 (04:46 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 6 Jan 2016 02:07:27 +0000 (18:07 -0800)
That's what it's for.  Plus, we actually implement rcp.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp

index d571ecd4394a374f080cf519b335c611b3b378c5..c83b2728b988240fb6f10f9be6bf3d9ccefd988d 100644 (file)
@@ -279,7 +279,7 @@ lower_texture_grad_visitor::visit_leave(ir_texture *ir)
 
       /* 2. quotient rule */
       ir_variable *recip = temp(mem_ctx, glsl_type::float_type, "recip");
-      EMIT(assign(recip, div(new(mem_ctx) ir_constant(1.0f), swizzle_z(Q))));
+      EMIT(assign(recip, expr(ir_unop_rcp, swizzle_z(Q))));
 
       ir_variable *dx = temp(mem_ctx, glsl_type::vec2_type, "dx");
       ir_variable *dy = temp(mem_ctx, glsl_type::vec2_type, "dy");