Fix Cycles compile errors with GCC due to double promotion as errors.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 22 May 2016 17:11:26 +0000 (19:11 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 22 May 2016 17:17:22 +0000 (19:17 +0200)
intern/cycles/blender/blender_sync.cpp
intern/cycles/device/device_cuda.cpp
intern/cycles/graph/node_xml.cpp
intern/cycles/render/nodes.cpp
intern/cycles/render/shader.cpp
intern/cycles/util/util_progress.h
intern/cycles/util/util_sky_model.cpp
intern/cycles/util/util_transform.cpp
intern/cycles/util/util_view.cpp

index 00f9f58cd12b0602ecda41e03bc2d6b81e00eb7c..33084f1c16329eb272b551bbd73261c83b836cae 100644 (file)
@@ -627,9 +627,9 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
        else
                params.threads = 0;
 
-       params.cancel_timeout = get_float(cscene, "debug_cancel_timeout");
-       params.reset_timeout = get_float(cscene, "debug_reset_timeout");
-       params.text_timeout = get_float(cscene, "debug_text_timeout");
+       params.cancel_timeout = (double)get_float(cscene, "debug_cancel_timeout");
+       params.reset_timeout = (double)get_float(cscene, "debug_reset_timeout");
+       params.text_timeout = (double)get_float(cscene, "debug_text_timeout");
 
        params.progressive_refine = get_boolean(cscene, "use_progressive_refine");
 
index 7fc621365124b84ecce659d1d3acb47a4ec926b7..9a78d05558079073da4e59e1cbe42341e569e359 100644 (file)
@@ -812,8 +812,8 @@ public:
                printf("threads_per_block %d\n", threads_per_block);
                printf("num_registers %d\n", num_registers);*/
 
-               int xthreads = (int)sqrt((float)threads_per_block);
-               int ythreads = (int)sqrt((float)threads_per_block);
+               int xthreads = (int)sqrt(threads_per_block);
+               int ythreads = (int)sqrt(threads_per_block);
                int xblocks = (rtile.w + xthreads - 1)/xthreads;
                int yblocks = (rtile.h + ythreads - 1)/ythreads;
 
@@ -866,8 +866,8 @@ public:
                int threads_per_block;
                cuda_assert(cuFuncGetAttribute(&threads_per_block, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, cuFilmConvert));
 
-               int xthreads = (int)sqrt((float)threads_per_block);
-               int ythreads = (int)sqrt((float)threads_per_block);
+               int xthreads = (int)sqrt(threads_per_block);
+               int ythreads = (int)sqrt(threads_per_block);
                int xblocks = (task.w + xthreads - 1)/xthreads;
                int yblocks = (task.h + ythreads - 1)/ythreads;
 
index 6a85c66fd8b34c4b0ffa28780e2fb23122e512da..fe06a243998797dbf367ea47e35963d4252395b2 100644 (file)
@@ -281,7 +281,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                        }
                        case SocketType::FLOAT:
                        {
-                               attr = node->get_float(socket);
+                               attr = (double)node->get_float(socket);
                                break;
                        }
                        case SocketType::FLOAT_ARRAY:
@@ -321,7 +321,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                        case SocketType::NORMAL:
                        {
                                float3 value = node->get_float3(socket);
-                               attr = string_printf("%g %g %g", value.x, value.y, value.z).c_str();
+                               attr = string_printf("%g %g %g", (double)value.x, (double)value.y, (double)value.z).c_str();
                                break;
                        }
                        case SocketType::COLOR_ARRAY:
@@ -332,7 +332,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                                std::stringstream ss;
                                const array<float3>& value = node->get_float3_array(socket);
                                for(size_t i = 0; i < value.size(); i++) {
-                                       ss << string_printf("%g %g %g", value[i].x, value[i].y, value[i].z);
+                                       ss << string_printf("%g %g %g", (double)value[i].x, (double)value[i].y, (double)value[i].z);
                                        if(i != value.size() - 1) {
                                                ss << " ";
                                        }
@@ -343,7 +343,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                        case SocketType::POINT2:
                        {
                                float2 value = node->get_float2(socket);
-                               attr = string_printf("%g %g", value.x, value.y).c_str();
+                               attr = string_printf("%g %g", (double)value.x, (double)value.y).c_str();
                                break;
                        }
                        case SocketType::POINT2_ARRAY:
@@ -351,7 +351,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                                std::stringstream ss;
                                const array<float2>& value = node->get_float2_array(socket);
                                for(size_t i = 0; i < value.size(); i++) {
-                                       ss << string_printf("%g %g", value[i].x, value[i].y);
+                                       ss << string_printf("%g %g", (double)value[i].x, (double)value[i].y);
                                        if(i != value.size() - 1) {
                                                ss << " ";
                                        }
@@ -383,7 +383,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                                Transform tfm = node->get_transform(socket);
                                std::stringstream ss;
                                for(int i = 0; i < 4; i++) {
-                                       ss << string_printf("%g %g %g %g", tfm[i][0], tfm[i][1], tfm[i][2], tfm[i][3]);
+                                       ss << string_printf("%g %g %g %g", (double)tfm[i][0], (double)tfm[i][1], (double)tfm[i][2], (double)tfm[i][3]);
                                        if(i != 3) {
                                                ss << " ";
                                        }
@@ -399,7 +399,7 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
                                        const Transform& tfm = value[j];
 
                                        for(int i = 0; i < 4; i++) {
-                                               ss << string_printf("%g %g %g %g", tfm[i][0], tfm[i][1], tfm[i][2], tfm[i][3]);
+                                               ss << string_printf("%g %g %g %g", (double)tfm[i][0], (double)tfm[i][1], (double)tfm[i][2], (double)tfm[i][3]);
                                                if(j != value.size() - 1 || i != 3) {
                                                        ss << " ";
                                                }
index 110bbca85769547d9ee5819bc18de3e832b7cb4d..998d9cf31dd1a8b0a894781f1015ae63ee319e03 100644 (file)
@@ -718,11 +718,11 @@ static void sky_texture_precompute_new(SunSky *sunsky, float3 dir, float turbidi
        sunsky->theta = theta;
        sunsky->phi = phi;
 
-       double solarElevation = M_PI_2_F - theta;
+       float solarElevation = M_PI_2_F - theta;
 
        /* Initialize Sky Model */
        ArHosekSkyModelState *sky_state;
-       sky_state = arhosek_xyz_skymodelstate_alloc_init(turbidity, ground_albedo, solarElevation);
+       sky_state = arhosek_xyz_skymodelstate_alloc_init((double)turbidity, (double)ground_albedo, (double)solarElevation);
 
        /* Copy values from sky_state to SunSky */
        for(int i = 0; i < 9; ++i) {
index b140af66b5b9047de453064aa6611d691cfa3e72..635024d7bdff5c51847b8129c1d5bbaaa825cdb6 100644 (file)
@@ -69,12 +69,12 @@ static void beckmann_table_rows(float *table, int row_from, int row_to)
 
                /* for a given incident vector
                 * integrate P22_{omega_i}(x_slope, 1, 1), Eq. (10) */
-               slope_x[0] = -beckmann_table_slope_max();
+               slope_x[0] = (double)-beckmann_table_slope_max();
                CDF_P22_omega_i[0] = 0;
 
                for(int index_slope_x = 1; index_slope_x < DATA_TMP_SIZE; ++index_slope_x) {
                        /* slope_x */
-                       slope_x[index_slope_x] = -beckmann_table_slope_max() + 2.0f * beckmann_table_slope_max() * index_slope_x/(DATA_TMP_SIZE - 1.0f);
+                       slope_x[index_slope_x] = (double)(-beckmann_table_slope_max() + 2.0f * beckmann_table_slope_max() * index_slope_x/(DATA_TMP_SIZE - 1.0f));
 
                        /* dot product with incident vector */
                        float dot_product = fmaxf(0.0f, -(float)slope_x[index_slope_x]*sin_theta + cos_theta);
index 0b35142ddb36d9a29250b32a71f538387b9d0c4b..4ae1d61dd17039946531123022a4ac4e7724ab2a 100644 (file)
@@ -37,9 +37,9 @@ public:
                tile = 0;
                sample = 0;
                start_time = time_dt();
-               total_time = 0.0f;
-               render_time = 0.0f;
-               tile_time = 0.0f;
+               total_time = 0.0;
+               render_time = 0.0;
+               tile_time = 0.0;
                status = "Initializing";
                substatus = "";
                sync_status = "";
@@ -75,9 +75,9 @@ public:
                sample = 0;
                start_time = time_dt();
                render_start_time = time_dt();
-               total_time = 0.0f;
-               render_time = 0.0f;
-               tile_time = 0.0f;
+               total_time = 0.0;
+               render_time = 0.0;
+               tile_time = 0.0;
                status = "Initializing";
                substatus = "";
                sync_status = "";
index a53c2ce1bb62431bce7b9af146c0a5867fc13ab6..5730986cc4f9c53652047a757715a316822d8dab 100644 (file)
@@ -301,7 +301,7 @@ double arhosekskymodel_radiance(ArHosekSkyModelState  *state,
        int low_wl = (int)((wavelength - 320.0) / 40.0);
 
        if(low_wl < 0 || low_wl >= 11)
-               return 0.0f;
+               return 0.0;
 
        double interp = fmod((wavelength - 320.0 ) / 40.0, 1.0);
 
index 79e1137d23897f04f1d8c81216000ae4f324472e..2f10540c94ed26fb7121d1fe69477f9ee4ad7c26 100644 (file)
@@ -158,7 +158,7 @@ Transform transform_inverse(const Transform& tfm)
 
 float4 transform_to_quat(const Transform& tfm)
 {
-       double trace = tfm[0][0] + tfm[1][1] + tfm[2][2];
+       double trace = (double)(tfm[0][0] + tfm[1][1] + tfm[2][2]);
        float4 qt;
 
        if(trace > 0.0) {
index 4d2adf33a7aa8ddc127164d4f2f427389ae0fe58..9796a5f896d467fe1a2c089adea3535115af62ab 100644 (file)
@@ -222,7 +222,7 @@ static void view_idle(void)
                glutPostRedisplay();
        }
 
-       time_sleep(0.1f);
+       time_sleep(0.1);
 }
 
 void view_main_loop(const char *title, int width, int height,