Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-11-17 19:22:05 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-11-17 19:29:41 +0300
commit89d5714d8f233b4bbb83f6a7b33237e2ec04ee79 (patch)
treebeee985786bb7660ec42f7f11bda91bc77c31bc9 /intern/cycles
parentea7efa556936851075c2bda2f772ba4a7674a01c (diff)
Build: match GCC and Clang float conversion warnings in Cycles
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/CMakeLists.txt5
-rw-r--r--intern/cycles/blender/sync.cpp2
-rw-r--r--intern/cycles/bvh/embree.cpp2
-rw-r--r--intern/cycles/scene/mesh_subdivision.cpp3
-rw-r--r--intern/cycles/util/math.h2
-rw-r--r--intern/cycles/util/progress.h2
6 files changed, 7 insertions, 9 deletions
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 64fe70c886d..6ba80bf9e18 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -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))
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 59d684dcf05..76118fdc6b7 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -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
diff --git a/intern/cycles/bvh/embree.cpp b/intern/cycles/bvh/embree.cpp
index 944a84ce0da..b54b38f2798 100644
--- a/intern/cycles/bvh/embree.cpp
+++ b/intern/cycles/bvh/embree.cpp
@@ -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)
{
diff --git a/intern/cycles/scene/mesh_subdivision.cpp b/intern/cycles/scene/mesh_subdivision.cpp
index a0c0bc68f8b..35f15cfafbc 100644
--- a/intern/cycles/scene/mesh_subdivision.cpp
+++ b/intern/cycles/scene/mesh_subdivision.cpp
@@ -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];
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index e4c7df6e44a..2e13eecd002 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -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;
diff --git a/intern/cycles/util/progress.h b/intern/cycles/util/progress.h
index f2d80e49ab8..15bd26d34bf 100644
--- a/intern/cycles/util/progress.h
+++ b/intern/cycles/util/progress.h
@@ -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)