Fix Cycles compile errors with GCC due to double promotion as errors.

This commit is contained in:
Brecht Van Lommel 2016-05-22 19:11:26 +02:00
parent 2f978656ab
commit f7c28a66e2
9 changed files with 27 additions and 27 deletions

View 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");

View 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;

View 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 << " ";
}

View 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) {

View 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);

View 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 = "";

View 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);

View 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) {

View 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,