some OSX build fixes, missing virtual destructors

metadata
Wenzel Jakob 2010-09-20 22:19:41 +02:00
parent 686030ef7e
commit e2dfe9a330
10 changed files with 527 additions and 255 deletions

View File

@ -39,6 +39,8 @@ public:
* at the given wavelength.
*/
virtual Float eval(Float lambda) const = 0;
virtual ~SmoothSpectrum() { }
};
/**
@ -57,6 +59,8 @@ public:
m_temperature = temperature;
}
virtual ~BlackBodySpectrum() { }
/** \brief Return the value of the spectral power distribution
* at the given wavelength.
*/
@ -91,6 +95,8 @@ public:
* at the given wavelength.
*/
virtual Float eval(Float lambda) const;
virtual ~InterpolatedSpectrum() { }
private:
std::vector<Float> m_wavelength, m_value;
};

View File

@ -36,6 +36,8 @@ class GPUProgram;
class MTS_EXPORT_RENDER HWResource {
public:
virtual Shader *createShader(Renderer *renderer) const;
virtual ~HWResource() { }
};
/**

View File

@ -19,7 +19,9 @@
#include <mitsuba/core/plugin.h>
#include <mitsuba/render/gatherproc.h>
#include <mitsuba/render/renderqueue.h>
#if !defined(__OSX__)
#include <omp.h>
#endif
MTS_NAMESPACE_BEGIN
@ -122,8 +124,9 @@ public:
Vector2i cropSize = film->getCropSize();
Point2i cropOffset = film->getCropOffset();
#if !defined(__OSX__)
omp_set_num_threads(nCores);
#endif
m_gatherPoints.clear();
m_running = true;
for (size_t i=0; i<m_blocks.size(); ++i)

View File

@ -20,7 +20,9 @@
#include <mitsuba/core/bitmap.h>
#include <mitsuba/render/gatherproc.h>
#include <mitsuba/render/renderqueue.h>
#if !defined(__OSX__)
#include <omp.h>
#endif
MTS_NAMESPACE_BEGIN
@ -148,7 +150,9 @@ public:
int samplerResID = sched->registerManifoldResource(
static_cast<std::vector<SerializableObject*> &>(samplers));
#if !defined(__OSX__)
omp_set_num_threads(nCores);
#endif
int it=0;
while (m_running) {
@ -174,7 +178,11 @@ public:
#pragma omp parallel for schedule(dynamic)
for (int i=-1; i<(int) m_gatherBlocks.size(); ++i) {
std::vector<GatherPoint> &gatherPoints = m_gatherBlocks[i];
#if !defined(__OSX__)
Sampler *sampler = static_cast<Sampler *>(samplers[omp_get_thread_num()]);
#else
Sampler *sampler = static_cast<Sampler *>(samplers[0]);
#endif
int xofs = m_offset[i].x, yofs = m_offset[i].y;
int index = 0;
for (int yofsInt = 0; yofsInt < m_blockSize; ++yofsInt) {

View File

@ -0,0 +1,85 @@
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
//
// Copyright (c) 2008 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/smart_ptr/detail/yield_k.hpp>
namespace boost
{
namespace detail
{
class spinlock
{
public:
int v_;
public:
bool try_lock()
{
int r;
__asm__ __volatile__(
"swp %0, %1, [%2]":
"=&r"( r ): // outputs
"r"( 1 ), "r"( &v_ ): // inputs
"memory", "cc" );
return r == 0;
}
void lock()
{
for( unsigned k = 0; !try_lock(); ++k )
{
boost::detail::yield( k );
}
}
void unlock()
{
__asm__ __volatile__( "" ::: "memory" );
*const_cast< int volatile* >( &v_ ) = 0;
}
public:
class scoped_lock
{
private:
spinlock & sp_;
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & sp ): sp_( sp )
{
sp.lock();
}
~scoped_lock()
{
sp_.unlock();
}
};
};
} // namespace detail
} // namespace boost
#define BOOST_DETAIL_SPINLOCK_INIT {0}
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED

View File

@ -0,0 +1,89 @@
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// Copyright (c) 2008 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/assert.hpp>
namespace boost
{
namespace detail
{
class spinlock
{
public:
bool locked_;
public:
inline bool try_lock()
{
if( locked_ )
{
return false;
}
else
{
locked_ = true;
return true;
}
}
inline void lock()
{
BOOST_ASSERT( !locked_ );
locked_ = true;
}
inline void unlock()
{
BOOST_ASSERT( locked_ );
locked_ = false;
}
public:
class scoped_lock
{
private:
spinlock & sp_;
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & sp ): sp_( sp )
{
sp.lock();
}
~scoped_lock()
{
sp_.unlock();
}
};
};
} // namespace detail
} // namespace boost
#define BOOST_DETAIL_SPINLOCK_INIT { false }
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED

View File

@ -0,0 +1,79 @@
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// Copyright (c) 2008 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <pthread.h>
namespace boost
{
namespace detail
{
class spinlock
{
public:
pthread_mutex_t v_;
public:
bool try_lock()
{
return pthread_mutex_trylock( &v_ ) == 0;
}
void lock()
{
pthread_mutex_lock( &v_ );
}
void unlock()
{
pthread_mutex_unlock( &v_ );
}
public:
class scoped_lock
{
private:
spinlock & sp_;
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & sp ): sp_( sp )
{
sp.lock();
}
~scoped_lock()
{
sp_.unlock();
}
};
};
} // namespace detail
} // namespace boost
#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER }
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED