Cycles: reduce float/double conversions
authorCampbell Barton <ideasman42@gmail.com>
Tue, 7 Oct 2014 22:09:36 +0000 (00:09 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 7 Oct 2014 22:13:26 +0000 (00:13 +0200)
intern/cycles/blender/blender_session.cpp
intern/cycles/render/shader.cpp

index 0610c3f6579f55e977f059b92ad17130e347f5c9..57ffea4b1a9b1de659311e99350f3d14df91daca 100644 (file)
@@ -830,7 +830,7 @@ void BlenderSession::update_status_progress()
 
        if(background) {
                if(progress>0)
-                       remaining_time = (1-progress) * (total_time / progress);
+                       remaining_time = (1.0 - (double)progress) * (total_time / (double)progress);
 
                scene += " | " + b_scene.name();
                if(b_rlay_name != "")
@@ -849,7 +849,7 @@ void BlenderSession::update_status_progress()
                timestatus += "Remaining:" + string(time_str) + " | ";
        }
        
-       timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", mem_used, mem_peak);
+       timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", (double)mem_used, (double)mem_peak);
 
        if(status.size() > 0)
                status = " | " + status;
index d76e511859a97ec77c1a8a56a24aa5c913dc0a2e..d8925852c2177ecff66359c2da96b3be1569ed00 100644 (file)
@@ -83,7 +83,7 @@ static void beckmann_table_rows(float *table, int row_from, int row_to)
                        }
 
                        /* CDF of P22_{omega_i}(x_slope, 1, 1), Eq. (10) */
-                       CDF_P22_omega_i[index_slope_x] = CDF_P22_omega_i[index_slope_x - 1] + P22_omega_i;
+                       CDF_P22_omega_i[index_slope_x] = CDF_P22_omega_i[index_slope_x - 1] + (double)P22_omega_i;
                }
 
                /* renormalize CDF_P22_omega_i */
@@ -106,8 +106,8 @@ static void beckmann_table_rows(float *table, int row_from, int row_to)
 
                        /* store value */
                        table[index_U + index_theta*BECKMANN_TABLE_SIZE] = (float)(
-                               interp * slope_x[index_slope_x - 1]
-                               + (1.0f-interp) * slope_x[index_slope_x]);
+                               interp * slope_x[index_slope_x - 1] +
+                                   (1.0 - interp) * slope_x[index_slope_x]);
                }
        }
 }