merged dev branches

metadata
Wenzel Jakob 2010-10-19 02:06:48 +02:00
commit 2d2fb78e8b
10 changed files with 40 additions and 29 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

@ -23,6 +23,14 @@
# define _GETOPT_H 1 # define _GETOPT_H 1
#endif #endif
#if !defined(MTS_EXPORT_CORE)
#if MTS_BUILD_MODULE == MTS_MODULE_CORE
#define MTS_EXPORT_CORE __declspec(dllexport)
#else
#define MTS_EXPORT_CORE __declspec(dllimport)
#endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -33,7 +41,7 @@ extern "C" {
Also, when `ordering' is RETURN_IN_ORDER, Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */ each non-option ARGV-element is returned here. */
extern char *optarg; extern MTS_EXPORT_CORE char *optarg;
/* Index in ARGV of the next element to be scanned. /* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller This is used for communication to and from the caller
@ -47,16 +55,16 @@ extern char *optarg;
Otherwise, `optind' communicates from one call to the next Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */ how much of ARGV has been scanned so far. */
extern int optind; extern MTS_EXPORT_CORE int optind;
/* Callers store zero here to inhibit the error message `getopt' prints /* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */ for unrecognized options. */
extern int opterr; extern MTS_EXPORT_CORE int opterr;
/* Set to an option character which was unrecognized. */ /* Set to an option character which was unrecognized. */
extern int optopt; extern MTS_EXPORT_CORE int optopt;
#ifndef __need_getopt #ifndef __need_getopt
/* Describe the long-named options requested by the application. /* Describe the long-named options requested by the application.
@ -125,17 +133,17 @@ struct option
/* Many other libraries have conflicting prototypes for getopt, with /* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */ errors, only prototype getopt for the GNU C library. */
extern int getopt (int __argc, char *const *__argv, const char *__shortopts); extern MTS_EXPORT_CORE int getopt (int __argc, char *const *__argv, const char *__shortopts);
# ifndef __need_getopt # ifndef __need_getopt
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, extern MTS_EXPORT_CORE int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
const struct option *__longopts, int *__longind); const struct option *__longopts, int *__longind);
extern int getopt_long_only (int __argc, char *const *__argv, extern MTS_EXPORT_CORE int getopt_long_only (int __argc, char *const *__argv,
const char *__shortopts, const char *__shortopts,
const struct option *__longopts, int *__longind); const struct option *__longopts, int *__longind);
/* Internal only. Users should not call this directly. */ /* Internal only. Users should not call this directly. */
extern int _getopt_internal (int __argc, char *const *__argv, extern MTS_EXPORT_CORE int _getopt_internal (int __argc, char *const *__argv,
const char *__shortopts, const char *__shortopts,
const struct option *__longopts, int *__longind, const struct option *__longopts, int *__longind,
int __long_only); int __long_only);

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];
} }
@ -3092,9 +3092,9 @@ template <typename Derived> void GenericKDTree<Derived>::findCosts(
nIntersections++; nIntersections++;
if (i > warmup) { if (i > warmup) {
A[idx].x = 1; A[idx].x = 1;
A[idx].y = boost::get<1>(statistics); A[idx].y = (Float) boost::get<1>(statistics);
A[idx].z = boost::get<2>(statistics); A[idx].z = (Float) boost::get<2>(statistics);
b[idx] = boost::get<3>(statistics); b[idx] = (Float) boost::get<3>(statistics);
idx++; idx++;
} }
} }

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

@ -54,7 +54,7 @@ MTS_NAMESPACE_BEGIN
* *
* \sa GenericKDTree * \sa GenericKDTree
*/ */
class KDTree : public GenericKDTree<KDTree> { class MTS_EXPORT_RENDER KDTree : public GenericKDTree<KDTree> {
friend class GenericKDTree<KDTree>; friend class GenericKDTree<KDTree>;
public: public:
/// Create an empty kd-tree /// Create an empty kd-tree

View File

@ -32,7 +32,7 @@
#include <mitsuba/core/plugin.h> #include <mitsuba/core/plugin.h>
#include <mitsuba/core/statistics.h> #include <mitsuba/core/statistics.h>
#if defined(WIN32) #if defined(WIN32)
#include "../mitsuba/getopt.h" #include <mitsuba/core/getopt.h>
#endif #endif
XERCES_CPP_NAMESPACE_USE XERCES_CPP_NAMESPACE_USE

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++) {