diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-27 03:29:33 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-27 03:29:33 +0400 |
commit | 7902fa57b6553c8c6e5ae19d1a25ce2200ea4a95 (patch) | |
tree | 7e07f248cd7aaff6630bedcceff55f35bae2e49b /intern/cycles/util/util_types.h | |
parent | 372c4f80f4e8bdec79c9ae6aa0a29c97c9d8797c (diff) |
Code cleanup: cycles
* Reshuffle SSE #ifdefs to try to avoid compilation errors enabling SSE on 32 bit.
* Remove CUDA kernel launch size exception on Mac, is not needed.
* Make OSL file compilation quiet like c/cpp files.
Diffstat (limited to 'intern/cycles/util/util_types.h')
-rw-r--r-- | intern/cycles/util/util_types.h | 68 |
1 files changed, 17 insertions, 51 deletions
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index 868502bc0ac..b2d842edccd 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -61,59 +61,49 @@ #ifndef __KERNEL_GPU__ -/* not enabled, globally applying it just gives slowdown, - * but useful for testing. */ -//#define __KERNEL_SSE__ -#ifdef __KERNEL_SSE__ - -#include <xmmintrin.h> /* SSE 1 */ -#include <emmintrin.h> /* SSE 2 */ -#include <pmmintrin.h> /* SSE 3 */ -#include <tmmintrin.h> /* SSSE 3 */ -#include <smmintrin.h> /* SSE 4 */ - +/* not enabled, globally applying it gives slowdown, only for testing. */ +#if 0 +#define __KERNEL_SSE__ #ifndef __KERNEL_SSE2__ #define __KERNEL_SSE2__ #endif - #ifndef __KERNEL_SSE3__ #define __KERNEL_SSE3__ #endif - #ifndef __KERNEL_SSSE3__ #define __KERNEL_SSSE3__ #endif - #ifndef __KERNEL_SSE4__ #define __KERNEL_SSE4__ #endif +#endif -#else +/* SSE2 is always available on x86_64 CPUs, so auto enable */ +#if defined(__x86_64__) && !defined(__KERNEL_SSE2__) +#define __KERNEL_SSE2__ +#endif -#if defined(__x86_64__) || defined(__KERNEL_SSSE3__) +/* SSE intrinsics headers */ +#ifndef FREE_WINDOWS64 -/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>. - * Since we can't avoid including <windows.h>, better only include that */ -#ifdef FREE_WINDOWS64 -#include <windows.h> -#else +#ifdef __KERNEL_SSE2__ #include <xmmintrin.h> /* SSE 1 */ #include <emmintrin.h> /* SSE 2 */ +#endif #ifdef __KERNEL_SSE3__ #include <pmmintrin.h> /* SSE 3 */ #endif + #ifdef __KERNEL_SSSE3__ #include <tmmintrin.h> /* SSSE 3 */ #endif -#endif -/* SSE2 is available on x64 and SSE3 CPUs, so enable here as well */ -#ifndef __KERNEL_SSE2__ -#define __KERNEL_SSE2__ -#endif +#else -#endif +/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>. + * Since we can't avoid including <windows.h>, better only include that */ +#include <windows.h> #endif @@ -553,30 +543,6 @@ template<size_t i0, size_t i1, size_t i2, size_t i3> __device_inline const __m12 } #endif -#ifndef __KERNEL_GPU__ - -static inline void *malloc_aligned(size_t size, size_t alignment) -{ - void *data = (void*)malloc(size + sizeof(void*) + alignment - 1); - - union { void *ptr; size_t offset; } u; - u.ptr = (char*)data + sizeof(void*); - u.offset = (u.offset + alignment - 1) & ~(alignment - 1); - *(((void**)u.ptr) - 1) = data; - - return u.ptr; -} - -static inline void free_aligned(void *ptr) -{ - if(ptr) { - void *data = *(((void**)ptr) - 1); - free(data); - } -} - -#endif - CCL_NAMESPACE_END #endif /* __UTIL_TYPES_H__ */ |