From f7c28a66e282eb9eb66bd02ccfe985beb6cb6f90 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 22 May 2016 19:11:26 +0200 Subject: Fix Cycles compile errors with GCC due to double promotion as errors. --- intern/cycles/blender/blender_sync.cpp | 6 +++--- intern/cycles/device/device_cuda.cpp | 8 ++++---- intern/cycles/graph/node_xml.cpp | 14 +++++++------- intern/cycles/render/nodes.cpp | 4 ++-- intern/cycles/render/shader.cpp | 4 ++-- intern/cycles/util/util_progress.h | 12 ++++++------ intern/cycles/util/util_sky_model.cpp | 2 +- intern/cycles/util/util_transform.cpp | 2 +- intern/cycles/util/util_view.cpp | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 00f9f58cd12..33084f1c163 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -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"); diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 7fc62136512..9a78d055580 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -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; diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp index 6a85c66fd8b..fe06a243998 100644 --- a/intern/cycles/graph/node_xml.cpp +++ b/intern/cycles/graph/node_xml.cpp @@ -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& 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& 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 << " "; } diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 110bbca8576..998d9cf31dd 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -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) { diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index b140af66b5b..635024d7bdf 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -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); diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h index 0b35142ddb3..4ae1d61dd17 100644 --- a/intern/cycles/util/util_progress.h +++ b/intern/cycles/util/util_progress.h @@ -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 = ""; diff --git a/intern/cycles/util/util_sky_model.cpp b/intern/cycles/util/util_sky_model.cpp index a53c2ce1bb6..5730986cc4f 100644 --- a/intern/cycles/util/util_sky_model.cpp +++ b/intern/cycles/util/util_sky_model.cpp @@ -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); diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp index 79e1137d238..2f10540c94e 100644 --- a/intern/cycles/util/util_transform.cpp +++ b/intern/cycles/util/util_transform.cpp @@ -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) { diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp index 4d2adf33a7a..9796a5f896d 100644 --- a/intern/cycles/util/util_view.cpp +++ b/intern/cycles/util/util_view.cpp @@ -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, -- cgit v1.2.3