Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_types.h
| Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | public: | ||||
| ccl_always_inline vector3(const T& a) | ccl_always_inline vector3(const T& a) | ||||
| : x(a), y(a), z(a) {} | : x(a), y(a), z(a) {} | ||||
| ccl_always_inline vector3(const T& x, const T& y, const T& z) | ccl_always_inline vector3(const T& x, const T& y, const T& z) | ||||
| : x(x), y(y), z(z) {} | : x(x), y(y), z(z) {} | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| #ifndef __KERNEL_GPU__ | #ifndef __KERNEL_GPU__ | ||||
brecht: This is not used it seems, and there's `align_up` anyway. | |||||
| /* Vector Type Constructors | /* Vector Type Constructors | ||||
| * | * | ||||
| * OpenCL does not support C++ class, so we use these instead. */ | * OpenCL does not support C++ class, so we use these instead. */ | ||||
| ccl_device_inline uchar2 make_uchar2(uchar x, uchar y) | ccl_device_inline uchar2 make_uchar2(uchar x, uchar y) | ||||
| { | { | ||||
| uchar2 a = {x, y}; | uchar2 a = {x, y}; | ||||
| ▲ Show 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| ccl_device_inline size_t align_up(size_t offset, size_t alignment) | ccl_device_inline size_t align_up(size_t offset, size_t alignment) | ||||
| { | { | ||||
| return (offset + alignment - 1) & ~(alignment - 1); | return (offset + alignment - 1) & ~(alignment - 1); | ||||
| } | } | ||||
| ccl_device_inline size_t divide_up(size_t x, size_t y) | |||||
| { | |||||
| return (x + y - 1) / y; | |||||
| } | |||||
| ccl_device_inline size_t round_up(size_t x, size_t multiple) | ccl_device_inline size_t round_up(size_t x, size_t multiple) | ||||
| { | { | ||||
| return ((x + multiple - 1) / multiple) * multiple; | return ((x + multiple - 1) / multiple) * multiple; | ||||
| } | } | ||||
| ccl_device_inline size_t round_down(size_t x, size_t multiple) | ccl_device_inline size_t round_down(size_t x, size_t multiple) | ||||
| { | { | ||||
| return (x / multiple) * multiple; | return (x / multiple) * multiple; | ||||
| ▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines | |||||
This is not used it seems, and there's align_up anyway.