Avoid unnecessary sqrt calls
authorCampbell Barton <ideasman42@gmail.com>
Thu, 15 Feb 2018 10:38:24 +0000 (21:38 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 15 Feb 2018 10:38:24 +0000 (21:38 +1100)
source/blender/draw/engines/eevee/eevee_lightprobes.c

index a6bedafc16ce261aecee2e5842546fc38f42a99c..b4de6081457ebcf86249e1e8d6ad4400f2285da7 100644 (file)
@@ -837,9 +837,10 @@ static void EEVEE_lightprobes_updates(EEVEE_ViewLayerData *sldata, EEVEE_PassLis
                /* Visibility bias */
                egrid->visibility_bias = 0.05f * probe->vis_bias;
                egrid->visibility_bleed = probe->vis_bleedbias;
-               egrid->visibility_range = max_ff(max_ff(len_v3(egrid->increment_x),
-                                                       len_v3(egrid->increment_y)),
-                                                       len_v3(egrid->increment_z)) + 1.0f;
+               egrid->visibility_range = (
+                       sqrtf(max_fff(len_squared_v3(egrid->increment_x),
+                                     len_squared_v3(egrid->increment_y),
+                                     len_squared_v3(egrid->increment_z))) + 1.0f);
 
                /* Debug Display */
                if (DRW_state_draw_support() &&