diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-02-02 13:17:13 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-02-09 16:45:39 +0300 |
commit | d74bb7be1916744ae56347b49333eac22ebb7339 (patch) | |
tree | 62ce91633945c40a6fe8f390a797e10c75127ca4 /intern/cycles/bvh | |
parent | d82384f7e1a0ae6fd3b27bb261a4cd671c9939ac (diff) |
Fix size_t -> int -> size_t round trip in Cycles
There are two things achieved by this change:
- No possible downcast of size_t to int when calculating motion steps.
- Disambiguate call to min() which was for some reason considered
ambiguous on 32bit platforms `min(int, unsigned int)`.
On an implementation side the `min()` is defined for a fixed width
integer type to disambiguate uint from size_t on 32bit platforms,
and yet be able to use it for 32bit operands on 64bit platforms without
upcast.
Fixes 32bit platforms (such as i386) in Debian package build system.
Differential Revision: https://developer.blender.org/D13992
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/embree.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/bvh/embree.cpp b/intern/cycles/bvh/embree.cpp index 616b6273e6a..731fef52063 100644 --- a/intern/cycles/bvh/embree.cpp +++ b/intern/cycles/bvh/embree.cpp @@ -471,7 +471,7 @@ void BVHEmbree::add_instance(Object *ob, int i) assert(instance_bvh != NULL); const size_t num_object_motion_steps = ob->use_motion() ? ob->get_motion().size() : 1; - const size_t num_motion_steps = min(num_object_motion_steps, RTC_MAX_TIME_STEP_COUNT); + const size_t num_motion_steps = min(num_object_motion_steps, (size_t)RTC_MAX_TIME_STEP_COUNT); assert(num_object_motion_steps <= RTC_MAX_TIME_STEP_COUNT); RTCGeometry geom_id = rtcNewGeometry(rtc_device, RTC_GEOMETRY_TYPE_INSTANCE); @@ -522,7 +522,7 @@ void BVHEmbree::add_triangles(const Object *ob, const Mesh *mesh, int i) } assert(num_motion_steps <= RTC_MAX_TIME_STEP_COUNT); - num_motion_steps = min(num_motion_steps, RTC_MAX_TIME_STEP_COUNT); + num_motion_steps = min(num_motion_steps, (size_t)RTC_MAX_TIME_STEP_COUNT); const size_t num_triangles = mesh->num_triangles(); @@ -775,7 +775,7 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i) } assert(num_motion_steps <= RTC_MAX_TIME_STEP_COUNT); - num_motion_steps = min(num_motion_steps, RTC_MAX_TIME_STEP_COUNT); + num_motion_steps = min(num_motion_steps, (size_t)RTC_MAX_TIME_STEP_COUNT); const size_t num_curves = hair->num_curves(); size_t num_segments = 0; |