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');
libcore_objects += coreEnv_osx.SharedObject('src/libcore/platform_darwin.mm')
elif sys.platform == 'win32':
libcore_objects += coreEnv_osx.SharedObject('src/libcore/getopt.c')
libcore_objects += coreEnv_osx.SharedObject('src/libcore/platform_win32.cpp')
libcore_objects += coreEnv.SharedObject('src/libcore/getopt.c')
libcore_objects += coreEnv.SharedObject('src/libcore/platform_win32.cpp')
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) {
#if defined(WIN32)
return InterlockedCompareExchange(v, newValue, oldValue) == oldValue;
return InterlockedCompareExchangePointer(
reinterpret_cast<volatile PVOID *>(v), newValue, oldValue) == oldValue;
#else
return __sync_bool_compare_and_swap(v, oldValue, newValue);
#endif

View File

@ -168,8 +168,10 @@ inline bool ubi_isnan(double f) {
int classification = ::_fpclass(f);
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
inline bool ubi_isnan(float f) {
return std::fpclassify(f) == FP_NAN;

View File

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

View File

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

View File

@ -100,7 +100,7 @@
GNU application programs can use a third alternative mode in which
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.
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);
bool needsLensSample = camera->needsLensSample();
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()) {
for (y = sy; y < ey; y++) {