code cleanup: quiet all warnings about double promotion (either by changing the type or explicitly casting).

This commit is contained in:
Campbell Barton 2012-06-09 17:45:22 +00:00
parent 0fbb6bff27
commit 43361487ba
11 changed files with 28 additions and 28 deletions

@ -297,7 +297,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
cam->fisheye_lens = bcam->fisheye_lens;
/* perspective */
cam->fov = 2.0f*atan((0.5f*sensor_size)/bcam->lens/aspectratio);
cam->fov = 2.0f * atanf((0.5f * sensor_size) / bcam->lens / aspectratio);
cam->focaldistance = bcam->focaldistance;
cam->aperturesize = bcam->aperturesize;
cam->blades = bcam->apertureblades;
@ -405,7 +405,7 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
}
else if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) {
/* orthographic view */
bcam->farclip *= 0.5;
bcam->farclip *= 0.5f;
bcam->nearclip = -bcam->farclip;
bcam->type = CAMERA_ORTHOGRAPHIC;

@ -433,7 +433,7 @@ void BlenderSession::tag_redraw()
update_status_progress();
/* offline render, redraw if timeout passed */
if(time_dt() - last_redraw_time > 1.0f) {
if(time_dt() - last_redraw_time > 1.0) {
write_render_result();
engine_tag_redraw((RenderEngine*)b_engine.ptr.data);
last_redraw_time = time_dt();

@ -196,14 +196,14 @@ BVHNode* BVHBuild::run()
void BVHBuild::progress_update()
{
if(time_dt() - progress_start_time < 0.25f)
if(time_dt() - progress_start_time < 0.25)
return;
double progress_start = (double)progress_count/(double)progress_total;
double duplicates = (double)(progress_total - progress_original_total)/(double)progress_total;
string msg = string_printf("Building BVH %.0f%%, duplicates %.0f%%",
progress_start*100.0f, duplicates*100.0f);
progress_start * 100.0, duplicates * 100.0);
progress.set_substatus(msg);
progress_start_time = time_dt();

@ -119,7 +119,7 @@ __device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dime
else
shift = (*rng & 0xFFFF)/((float)0xFFFF);
return r + shift - floor(r + shift);
return r + shift - floorf(r + shift);
#endif
}

@ -45,7 +45,7 @@ __device float svm_gradient(float3 p, NodeGradientType type)
return (x + y)/2.0f;
}
else if(type == NODE_BLEND_RADIAL) {
return atan2(y, x)/(2.0f*M_PI_F) + 0.5f;
return atan2f(y, x) / (2.0f * M_PI_F) + 0.5f;
}
else {
float r = fmaxf(1.0f - sqrtf(x*x + y*y + z*z), 0.0f);

@ -41,7 +41,7 @@ __device_noinline float noise_musgrave_fBm(float3 p, NodeNoiseBasis basis, float
p *= lacunarity;
}
rmd = octaves - floor(octaves);
rmd = octaves - floorf(octaves);
if(rmd != 0.0f)
value += rmd * snoise(p) * pwr;
@ -69,7 +69,7 @@ __device_noinline float noise_musgrave_multi_fractal(float3 p, NodeNoiseBasis ba
p *= lacunarity;
}
rmd = octaves - floor(octaves);
rmd = octaves - floorf(octaves);
if(rmd != 0.0f)
value *= (rmd * pwr * snoise(p) + 1.0f); /* correct? */
@ -102,7 +102,7 @@ __device_noinline float noise_musgrave_hetero_terrain(float3 p, NodeNoiseBasis b
p *= lacunarity;
}
rmd = octaves - floor(octaves);
rmd = octaves - floorf(octaves);
if(rmd != 0.0f) {
increment = (snoise(p) + offset) * pwr * value;
value += rmd * increment;
@ -141,7 +141,7 @@ __device_noinline float noise_musgrave_hybrid_multi_fractal(float3 p, NodeNoiseB
p *= lacunarity;
}
rmd = octaves - floor(octaves);
rmd = octaves - floorf(octaves);
if(rmd != 0.0f)
result += rmd * ((snoise(p) + offset) * pwr);

@ -191,7 +191,7 @@ __device float noise_basis_hard(float3 p, NodeNoiseBasis basis, int hard)
__device float noise_wave(NodeWaveBasis wave, float a)
{
if(wave == NODE_WAVE_SINE) {
return 0.5f + 0.5f*sin(a);
return 0.5f + 0.5f * sinf(a);
}
else if(wave == NODE_WAVE_SAW) {
float b = 2.0f*M_PI_F;
@ -234,7 +234,7 @@ __device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float o
fscale *= 2.0f;
}
float rmd = octaves - floor(octaves);
float rmd = octaves - floorf(octaves);
if(rmd != 0.0f) {
float t = noise_basis(fscale*p, basis);

@ -332,7 +332,7 @@ static void sky_texture_precompute(KernelSunSky *ksunsky, float3 dir, float turb
float T2 = T * T;
float chi = (4.0f / 9.0f - T / 120.0f) * (M_PI_F - 2.0f * theta);
ksunsky->zenith_Y = (4.0453f * T - 4.9710f) * tan(chi) - 0.2155f * T + 2.4192f;
ksunsky->zenith_Y = (4.0453f * T - 4.9710f) * tanf(chi) - 0.2155f * T + 2.4192f;
ksunsky->zenith_Y *= 0.06f;
ksunsky->zenith_x =

@ -29,15 +29,15 @@ __device float color_srgb_to_scene_linear(float c)
if(c < 0.04045f)
return (c < 0.0f)? 0.0f: c * (1.0f/12.92f);
else
return pow((c + 0.055f)*(1.0f/1.055f), 2.4f);
return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f);
}
__device float color_scene_linear_to_srgb(float c)
{
if(c < 0.0031308f)
return (c < 0.0f)? 0.0f: c * 12.92f;
else
return 1.055f * pow(c, 1.0f/2.4f) - 0.055f;
else
return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;
}
#ifndef __KERNEL_OPENCL__

@ -334,7 +334,7 @@ __device_inline float2 as_float2(const float4 a)
__device_inline void print_float2(const char *label, const float2& a)
{
printf("%s: %.8f %.8f\n", label, a.x, a.y);
printf("%s: %.8f %.8f\n", label, (double)a.x, (double)a.y);
}
#endif
@ -532,7 +532,7 @@ __device_inline float4 float3_to_float4(const float3 a)
__device_inline void print_float3(const char *label, const float3& a)
{
printf("%s: %.8f %.8f %.8f\n", label, a.x, a.y, a.z);
printf("%s: %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z);
}
__device_inline float3 rcp(const float3& a)
@ -844,7 +844,7 @@ __device_inline float4 reduce_add(const float4& a)
__device_inline void print_float4(const char *label, const float4& a)
{
printf("%s: %.8f %.8f %.8f %.8f\n", label, a.x, a.y, a.z, a.w);
printf("%s: %.8f %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z, (double)a.w);
}
#endif

@ -160,15 +160,15 @@ static float4 transform_to_quat(const Transform& tfm)
double trace = tfm[0][0] + tfm[1][1] + tfm[2][2];
float4 qt;
if(trace > 0.0f) {
if(trace > 0.0) {
double s = sqrt(trace + 1.0);
qt.w = (float)(s/2.0);
s = 0.5/s;
qt.x = (float)((tfm[2][1] - tfm[1][2]) * s);
qt.y = (float)((tfm[0][2] - tfm[2][0]) * s);
qt.z = (float)((tfm[1][0] - tfm[0][1]) * s);
qt.x = (float)((double)(tfm[2][1] - tfm[1][2]) * s);
qt.y = (float)((double)(tfm[0][2] - tfm[2][0]) * s);
qt.z = (float)((double)(tfm[1][0] - tfm[0][1]) * s);
}
else {
int i = 0;
@ -181,16 +181,16 @@ static float4 transform_to_quat(const Transform& tfm)
int j = (i + 1)%3;
int k = (j + 1)%3;
double s = sqrt((tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0);
double s = sqrt((double)(tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0);
double q[3];
q[i] = s * 0.5;
if(s != 0.0)
s = 0.5/s;
double w = (tfm[k][j] - tfm[j][k]) * s;
q[j] = (tfm[j][i] + tfm[i][j]) * s;
q[k] = (tfm[k][i] + tfm[i][k]) * s;
double w = (double)(tfm[k][j] - tfm[j][k]) * s;
q[j] = (double)(tfm[j][i] + tfm[i][j]) * s;
q[k] = (double)(tfm[k][i] + tfm[i][k]) * s;
qt.x = (float)q[0];
qt.y = (float)q[1];