From 21af952fec8e72d005c39276dfc360f9e4878ec9 Mon Sep 17 00:00:00 2001 From: castano Date: Tue, 14 Feb 2012 18:00:47 +0000 Subject: [PATCH] osx fixes. Update cmake files. --- src/CMakeLists.txt | 2 +- src/nvcore/DefsGnucDarwin.h | 2 +- src/nvcore/DefsGnucLinux.h | 2 +- src/nvcore/Utils.h | 2 +- src/nvmath/CMakeLists.txt | 1 + src/nvthread/Event.cpp | 29 +++++++++++++++++++++++------ src/nvthread/ParallelFor.cpp | 6 +++++- 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16fc8df..5dc953e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,7 +50,7 @@ ELSE(CG_FOUND) ENDIF(CG_FOUND) # CUDA -FIND_PACKAGE(CUDA) +#FIND_PACKAGE(CUDA) IF(CUDA_FOUND) IF(MINGW) MESSAGE(STATUS "Looking for CUDA - not supported on MinGW") diff --git a/src/nvcore/DefsGnucDarwin.h b/src/nvcore/DefsGnucDarwin.h index 79a47ff..0c6579b 100644 --- a/src/nvcore/DefsGnucDarwin.h +++ b/src/nvcore/DefsGnucDarwin.h @@ -25,7 +25,7 @@ #endif #define NV_FASTCALL __attribute__((fastcall)) -#define NV_FORCEINLINE __attribute__((always_inline)) +#define NV_FORCEINLINE inline __attribute__((always_inline)) #define NV_DEPRECATED __attribute__((deprecated)) #if __GNUC__ > 2 diff --git a/src/nvcore/DefsGnucLinux.h b/src/nvcore/DefsGnucLinux.h index 6abdc67..6ecd123 100644 --- a/src/nvcore/DefsGnucLinux.h +++ b/src/nvcore/DefsGnucLinux.h @@ -25,7 +25,7 @@ #endif #define NV_FASTCALL __attribute__((fastcall)) -#define NV_FORCEINLINE __attribute__((always_inline)) +#define NV_FORCEINLINE inline __attribute__((always_inline)) #define NV_DEPRECATED __attribute__((deprecated)) diff --git a/src/nvcore/Utils.h b/src/nvcore/Utils.h index ed17aba..a15e523 100644 --- a/src/nvcore/Utils.h +++ b/src/nvcore/Utils.h @@ -82,7 +82,7 @@ namespace nv template <> inline uint8 toU8(uint16 x) { nvDebugCheck(x <= NV_UINT8_MAX); return (uint8)x; } template <> inline uint8 toU8(int16 x) { nvDebugCheck(x >= 0 && x <= NV_UINT8_MAX); return (uint8)x; } //template <> inline uint8 toU8(uint8 x) { return x; } - template <> inline uint8 toU8(int8 x) { nvDebugCheck(x >= 0 && x <= NV_UINT8_MAX); return (uint8)x; } + template <> inline uint8 toU8(int8 x) { nvDebugCheck(x >= 0); return (uint8)x; } // int8 casts: template inline int8 toI8(T x) { return x; } diff --git a/src/nvmath/CMakeLists.txt b/src/nvmath/CMakeLists.txt index 2460661..093f108 100644 --- a/src/nvmath/CMakeLists.txt +++ b/src/nvmath/CMakeLists.txt @@ -9,6 +9,7 @@ SET(MATH_SRCS Matrix.h Plane.h Plane.inl Plane.cpp SphericalHarmonic.h SphericalHarmonic.cpp + SimdVector.h SimdVector_SSE.h SimdVector_VE.h Vector.h Vector.inl) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/nvthread/Event.cpp b/src/nvthread/Event.cpp index b9f8c9b..b80ce00 100644 --- a/src/nvthread/Event.cpp +++ b/src/nvthread/Event.cpp @@ -32,6 +32,28 @@ void Event::wait() { WaitForSingleObject(m->handle, INFINITE); } +#elif NV_OS_UNIX + +// @@ TODO +#pragma NV_MESSAGE("Implement event using pthreads!") + +struct Event::Private { +}; + +Event::Event() : m(new Private) { +} + +Event::~Event() { +} + +void Event::post() { +} + +void Event::wait() { +} + +#endif + /*static*/ void Event::post(Event * events, uint count) { for (uint i = 0; i < count; i++) { @@ -40,14 +62,9 @@ void Event::wait() { } /*static*/ void Event::wait(Event * events, uint count) { - // @@ Use wait for multiple objects? + // @@ Use wait for multiple objects in win32? for (uint i = 0; i < count; i++) { events[i].wait(); } } - -#elif NV_OS_UNIX -// @@ TODO -#pragma NV_MESSAGE("Implement event using pthreads!") -#endif diff --git a/src/nvthread/ParallelFor.cpp b/src/nvthread/ParallelFor.cpp index ab81cd2..9ab8144 100644 --- a/src/nvthread/ParallelFor.cpp +++ b/src/nvthread/ParallelFor.cpp @@ -9,8 +9,12 @@ using namespace nv; +// @@ nvthread is only fully implemented in win32. +#if NV_OS_WIN32 #define ENABLE_PARALLEL_FOR 1 - +#else +#define ENABLE_PARALLEL_FOR 0 +#endif void worker(void * arg) { ParallelFor * owner = (ParallelFor *)arg;