Build: match GCC and Clang float conversion warnings in Cycles

This commit is contained in:
Brecht Van Lommel 2021-11-17 17:22:05 +01:00
parent ea7efa5569
commit 89d5714d8f
6 changed files with 7 additions and 9 deletions

View File

@ -334,16 +334,13 @@ else()
endif()
# Warnings
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
unset(_has_cxxflag_float_conversion)
unset(_has_cxxflag_double_promotion)
unset(_has_no_error_unused_macros)
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_implicit_float_conversion "-Werror=implicit-float-conversion")
unset(_has_cxxflag_implicit_float_conversion)
endif()
if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))

View File

@ -872,7 +872,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
/* Time limit. */
if (background) {
params.time_limit = get_float(cscene, "time_limit");
params.time_limit = (double)get_float(cscene, "time_limit");
}
else {
/* For the viewport it kind of makes more sense to think in terms of the noise floor, which is

View File

@ -303,7 +303,7 @@ static void rtc_error_func(void *, enum RTCError, const char *str)
VLOG(1) << str;
}
static double progress_start_time = 0.0f;
static double progress_start_time = 0.0;
static bool rtc_progress_func(void *user_ptr, const double n)
{

View File

@ -331,7 +331,8 @@ struct OsdPatch : Patch {
void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v)
{
const Far::PatchTable::PatchHandle *handle = osd_data->patch_map->FindPatch(patch_index, u, v);
const Far::PatchTable::PatchHandle *handle = osd_data->patch_map->FindPatch(
patch_index, (double)u, (double)v);
assert(handle);
float p_weights[20], du_weights[20], dv_weights[20];

View File

@ -801,7 +801,7 @@ ccl_device_inline float2 map_to_sphere(const float3 co)
* https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
*/
ccl_device_inline float compare_floats(float a, float b, float abs_diff, int ulp_diff)
ccl_device_inline bool compare_floats(float a, float b, float abs_diff, int ulp_diff)
{
if (fabsf(a - b) < abs_diff) {
return true;

View File

@ -207,7 +207,7 @@ class Progress {
if (total_pixel_samples > 0) {
return ((double)pixel_samples) / (double)total_pixel_samples;
}
return 0.0f;
return 0.0;
}
void add_samples(uint64_t pixel_samples_, int tile_sample)