diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-06 10:36:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-06 10:36:34 +0400 |
commit | 34c64b8ea33236ae5b1fd3720defc73d08710e29 (patch) | |
tree | 7cd74761cfea213e7d78fe6788e4684cd39abfed | |
parent | bff75bafbd7608d5c9c79f51d2941a3c1b9d51bf (diff) |
cycles builds with -Wdouble-promotion again.
-rw-r--r-- | intern/cycles/kernel/svm/svm_blackbody.h | 6 | ||||
-rw-r--r-- | intern/cycles/render/blackbody.cpp | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/intern/cycles/kernel/svm/svm_blackbody.h b/intern/cycles/kernel/svm/svm_blackbody.h index 3c6e11ca683..c3987f378a4 100644 --- a/intern/cycles/kernel/svm/svm_blackbody.h +++ b/intern/cycles/kernel/svm/svm_blackbody.h @@ -42,18 +42,18 @@ __device void svm_node_blackbody(KernelGlobals *kg, ShaderData *sd, float *stack /* Input */ float temperature = stack_load_float(stack, temperature_offset); - if (temperature < BB_DRAPPER) { + if (temperature < (float)BB_DRAPPER) { /* just return very very dim red */ color_rgb = make_float3(1.0e-6f,0.0f,0.0f); } - else if (temperature <= BB_MAX_TABLE_RANGE) { + else if (temperature <= (float)BB_MAX_TABLE_RANGE) { /* This is the overall size of the table */ const int lookuptablesize = 956; const float lookuptablenormalize = 1.0f/956.0f; /* reconstruct a proper index for the table lookup, compared to OSL we don't look up two colors just one (the OSL-lerp is also automatically done for us by "lookup_table_read") */ - float t = powf((temperature - BB_DRAPPER) * (1.0f / BB_TABLE_SPACING), 1.0f/BB_TABLE_XPOWER); + float t = powf((temperature - (float)BB_DRAPPER) * (float)(1.0 / BB_TABLE_SPACING), (float)(1.0 / BB_TABLE_XPOWER)); int blackbody_table_offset = kernel_data.blackbody.table_offset; diff --git a/intern/cycles/render/blackbody.cpp b/intern/cycles/render/blackbody.cpp index 467368935d7..72e3e5d938d 100644 --- a/intern/cycles/render/blackbody.cpp +++ b/intern/cycles/render/blackbody.cpp @@ -91,7 +91,7 @@ vector<float> blackbody_table() const double c1 = 3.74183e-16; // 2*pi*h*c^2, W*m^2 const double c2 = 1.4388e-2; // h*c/k, m*K // h is Planck's const, k is Boltzmann's - const float dlambda = 5.0f * 1e-9; // in meters + const float dlambda = 5.0f * 1e-9f; // in meters /* Blackbody table from 800 to 12k Kelvin (319 entries (317+2 offset) * 3) */ vector<float> blackbody_table(956); @@ -100,7 +100,7 @@ vector<float> blackbody_table() /* ToDo: bring this back to what OSL does with the lastTemperature limit ? */ for (int i = 0; i <= 317; ++i) { - float Temperature = powf (float(i), BB_TABLE_XPOWER) * BB_TABLE_SPACING + BB_DRAPPER; + double Temperature = pow((double)i, BB_TABLE_XPOWER) * BB_TABLE_SPACING + BB_DRAPPER; X = 0; Y = 0; Z = 0; @@ -108,10 +108,10 @@ vector<float> blackbody_table() /* from OSL "spectrum_to_XYZ" */ for (int n = 0; n < 81; ++n) { float lambda = 380.0f + 5.0f * n; - double wlm = lambda * 1e-9; // Wavelength in meters + double wlm = lambda * 1e-9f; // Wavelength in meters // N.B. spec_intens returns result in W/m^2 but it's a differential, // needs to be scaled by dlambda! - float spec_intens = float((c1 * powf(wlm,-5.0)) / (expf(c2 / (wlm * Temperature)) -1.0f)); + float spec_intens = float((c1 * pow(wlm, -5.0)) / (exp(c2 / (wlm * Temperature)) -1.0)); float Me = spec_intens * dlambda; X += Me * cie_colour_match[n][0]; @@ -125,9 +125,9 @@ vector<float> blackbody_table() /* Clamp to zero if values are smaller */ col = max(col, make_float3(0.0f, 0.0f, 0.0f)); - col.x = powf(col.x, 1.0f / BB_TABLE_YPOWER); - col.y = powf(col.y, 1.0f / BB_TABLE_YPOWER); - col.z = powf(col.z, 1.0f / BB_TABLE_YPOWER); + col.x = powf(col.x, 1.0 / BB_TABLE_YPOWER); + col.y = powf(col.y, 1.0 / BB_TABLE_YPOWER); + col.z = powf(col.z, 1.0 / BB_TABLE_YPOWER); /* Store in table in RRRGGGBBB format */ blackbody_table[i] = col.x; |