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:
authorMai Lavelle <mai.lavelle@gmail.com>2017-03-11 13:23:11 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2017-03-11 13:39:28 +0300
commit96868a39419f1c9a8962c56e02480fabbf1e5156 (patch)
tree64128db60a690d0223dad4e6e4073230ffd174ac /intern/cycles/util
parent5afe4c787f0ed3ac30f7609c7f07c5092a20eac9 (diff)
Fix T50888: Numeric overflow in split kernel state buffer size calculation
Overflow led to the state buffer being too small and the split kernel to get stuck doing nothing forever.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_types.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index 36d2f1053c7..dcd0b78e4a4 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -106,10 +106,16 @@ typedef unsigned int uint;
#endif
-#ifndef __KERNEL_GPU__
-
/* Fixed Bits Types */
+#ifdef __KERNEL_OPENCL__
+
+typedef ulong uint64_t;
+
+#endif
+
+#ifndef __KERNEL_GPU__
+
#ifdef _WIN32
typedef signed char int8_t;
@@ -474,17 +480,17 @@ ccl_device_inline int4 make_int4(const float3& f)
#endif
-ccl_device_inline int align_up(int offset, int alignment)
+ccl_device_inline size_t align_up(size_t offset, size_t alignment)
{
return (offset + alignment - 1) & ~(alignment - 1);
}
-ccl_device_inline int round_up(int x, int multiple)
+ccl_device_inline size_t round_up(size_t x, size_t multiple)
{
return ((x + multiple - 1) / multiple) * multiple;
}
-ccl_device_inline int round_down(int x, int multiple)
+ccl_device_inline size_t round_down(size_t x, size_t multiple)
{
return (x / multiple) * multiple;
}