windows compilation fixes

metadata
Wenzel Jakob 2010-10-18 16:44:54 -07:00
parent 3d56ab699d
commit d4d34dfd0f
7 changed files with 19 additions and 16 deletions

View File

@ -285,8 +285,8 @@ if sys.platform == 'darwin':
coreEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing'); coreEnv_osx['CXXFLAGS'].append('-fno-strict-aliasing');
libcore_objects += coreEnv_osx.SharedObject('src/libcore/platform_darwin.mm') libcore_objects += coreEnv_osx.SharedObject('src/libcore/platform_darwin.mm')
elif sys.platform == 'win32': elif sys.platform == 'win32':
libcore_objects += coreEnv_osx.SharedObject('src/libcore/getopt.c') libcore_objects += coreEnv.SharedObject('src/libcore/getopt.c')
libcore_objects += coreEnv_osx.SharedObject('src/libcore/platform_win32.cpp') libcore_objects += coreEnv.SharedObject('src/libcore/platform_win32.cpp')
libcore = coreEnv.SharedLibrary('src/libcore/mitsuba-core', libcore_objects); libcore = coreEnv.SharedLibrary('src/libcore/mitsuba-core', libcore_objects);

View File

@ -29,7 +29,8 @@ MTS_NAMESPACE_BEGIN
template <typename T> inline bool atomicCompareAndExchangePtr(T **v, T *newValue, T *oldValue) { template <typename T> inline bool atomicCompareAndExchangePtr(T **v, T *newValue, T *oldValue) {
#if defined(WIN32) #if defined(WIN32)
return InterlockedCompareExchange(v, newValue, oldValue) == oldValue; return InterlockedCompareExchangePointer(
reinterpret_cast<volatile PVOID *>(v), newValue, oldValue) == oldValue;
#else #else
return __sync_bool_compare_and_swap(v, oldValue, newValue); return __sync_bool_compare_and_swap(v, oldValue, newValue);
#endif #endif

View File

@ -168,8 +168,10 @@ inline bool ubi_isnan(double f) {
int classification = ::_fpclass(f); int classification = ::_fpclass(f);
return classification == _FPCLASS_QNAN || classification == _FPCLASS_SNAN; return classification == _FPCLASS_QNAN || classification == _FPCLASS_SNAN;
} }
extern "C" {
extern MTS_EXPORT_CORE float nextafterf(float x, float y);
};
extern float nextafterf(float x, float y);
#else #else
inline bool ubi_isnan(float f) { inline bool ubi_isnan(float f) {
return std::fpclassify(f) == FP_NAN; return std::fpclassify(f) == FP_NAN;

View File

@ -119,7 +119,7 @@ public:
* Walks through the list of chunks to find one with enough * Walks through the list of chunks to find one with enough
* free memory. If no chunk could be found, a new one is created. * free memory. If no chunk could be found, a new one is created.
*/ */
template <typename T> T * __restrict__ allocate(size_t size) { template <typename T> T * __restrict allocate(size_t size) {
size *= sizeof(T); size *= sizeof(T);
for (std::vector<Chunk>::iterator it = m_chunks.begin(); for (std::vector<Chunk>::iterator it = m_chunks.begin();
it != m_chunks.end(); ++it) { it != m_chunks.end(); ++it) {
@ -295,7 +295,7 @@ public:
* create unused elements in the previous block if a new * create unused elements in the previous block if a new
* one has to be allocated. * one has to be allocated.
*/ */
inline T * __restrict__ allocate(size_t size) { inline T * __restrict allocate(size_t size) {
#if defined(MTS_KD_DEBUG) #if defined(MTS_KD_DEBUG)
SAssert(size <= BlockSize); SAssert(size <= BlockSize);
#endif #endif
@ -2174,10 +2174,10 @@ protected:
} }
} }
KDAssert(leftEventsTempEnd - leftEventsTempStart <= primsLeft * 6); KDAssert((size_type) (leftEventsTempEnd - leftEventsTempStart) <= primsLeft * 6);
KDAssert(rightEventsTempEnd - rightEventsTempStart <= primsRight * 6); KDAssert((size_type) (rightEventsTempEnd - rightEventsTempStart) <= primsRight * 6);
KDAssert(newEventsLeftEnd - newEventsLeftStart <= primsBoth * 6); KDAssert((size_type) (newEventsLeftEnd - newEventsLeftStart) <= primsBoth * 6);
KDAssert(newEventsRightEnd - newEventsRightStart <= primsBoth * 6); KDAssert((size_type) (newEventsRightEnd - newEventsRightStart) <= primsBoth * 6);
ctx.pruned += prunedLeft + prunedRight; ctx.pruned += prunedLeft + prunedRight;
/* Sort the events from overlapping prims */ /* Sort the events from overlapping prims */
@ -2216,8 +2216,8 @@ protected:
*rightEventsEnd++ = *event; *rightEventsEnd++ = *event;
} }
} }
KDAssert(leftEventsEnd - leftEventsStart <= bestSplit.numLeft * 6); KDAssert((size_type) (leftEventsEnd - leftEventsStart) <= bestSplit.numLeft * 6);
KDAssert(rightEventsEnd - rightEventsStart <= bestSplit.numRight * 6); KDAssert((size_type) (rightEventsEnd - rightEventsStart) <= bestSplit.numRight * 6);
} }
/* Shrink the edge event storage now that we know exactly how /* Shrink the edge event storage now that we know exactly how
@ -2317,7 +2317,7 @@ protected:
*/ */
void setAABB(const AABB &aabb) { void setAABB(const AABB &aabb) {
m_aabb = aabb; m_aabb = aabb;
m_binSize = m_aabb.getExtents() / m_binCount; m_binSize = m_aabb.getExtents() / (Float) m_binCount;
for (int axis=0; axis<3; ++axis) for (int axis=0; axis<3; ++axis)
m_invBinSize[axis] = 1/m_binSize[axis]; m_invBinSize[axis] = 1/m_binSize[axis];
} }

View File

@ -39,7 +39,7 @@ typedef Spectrum TranslationalGradient[3];
* *
* @author Wenzel Jakob * @author Wenzel Jakob
*/ */
struct MTS_EXPORT_RENDER HemisphereSampler : public Object { class MTS_EXPORT_RENDER HemisphereSampler : public Object {
public: public:
struct SampleEntry { struct SampleEntry {
Vector d; Vector d;

View File

@ -100,7 +100,7 @@
GNU application programs can use a third alternative mode in which GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */ they can distinguish the relative order of options and other arguments. */
#include "getopt.h" #include <mitsuba/core/getopt.h>
/* For communication from `getopt' to the caller. /* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument, When `getopt' finds an option that takes an argument,

View File

@ -163,7 +163,7 @@ void SampleIntegrator::renderBlock(const Scene *scene,
RadianceQueryRecord rRec(scene, sampler); RadianceQueryRecord rRec(scene, sampler);
bool needsLensSample = camera->needsLensSample(); bool needsLensSample = camera->needsLensSample();
const TabulatedFilter *filter = camera->getFilm()->getTabulatedFilter(); const TabulatedFilter *filter = camera->getFilm()->getTabulatedFilter();
Float scaleFactor = 1.0f/std::sqrt(sampler->getSampleCount()); Float scaleFactor = 1.0f/std::sqrt((Float) sampler->getSampleCount());
if (!block->collectStatistics()) { if (!block->collectStatistics()) {
for (y = sy; y < ey; y++) { for (y = sy; y < ey; y++) {