diff --git a/include/mitsuba/core/platform.h b/include/mitsuba/core/platform.h index 382d3d53..24a128a1 100644 --- a/include/mitsuba/core/platform.h +++ b/include/mitsuba/core/platform.h @@ -52,6 +52,17 @@ #include #pragma intrinsic(memset, memcmp, memcpy, strlen, strcmp, strcpy, _strset, strcat, fabs, abs) #endif + + #if _MSC_VER >= 1600 + #ifdef SINGLE_PRECISION + #pragma detect_mismatch( "MTS_FLOAT_PRECISION", "SINGLE") + #elif DOUBLE_PRECISION + #pragma detect_mismatch( "MTS_FLOAT_PRECISION", "DOUBLE") + #endif + #define MTS_STRINGIFY(s) #s + #define MTS_XSTRINGIFY(s) MTS_STRINGIFY(s) + #pragma detect_mismatch("MTS_SPECTRUM_SAMPLES", MTS_XSTRINGIFY(SPECTRUM_SAMPLES)) + #endif #elif defined(__APPLE__) #define __OSX__ #elif defined(__linux) diff --git a/src/films/hdrfilm.cpp b/src/films/hdrfilm.cpp index 0bc9633d..e39fcf58 100644 --- a/src/films/hdrfilm.cpp +++ b/src/films/hdrfilm.cpp @@ -348,7 +348,7 @@ public: m_storage = new ImageBlock(Bitmap::ESpectrumAlphaWeight, m_cropSize); } else { m_storage = new ImageBlock(Bitmap::EMultiSpectrumAlphaWeight, m_cropSize, - NULL, SPECTRUM_SAMPLES * m_pixelFormats.size() + 2); + NULL, (int) (SPECTRUM_SAMPLES * m_pixelFormats.size() + 2)); } } diff --git a/src/integrators/misc/multichannel.cpp b/src/integrators/misc/multichannel.cpp index b8597e64..b48b330f 100644 --- a/src/integrators/misc/multichannel.cpp +++ b/src/integrators/misc/multichannel.cpp @@ -142,7 +142,7 @@ public: proc->setPixelFormat( m_integrators.size() > 1 ? Bitmap::EMultiSpectrumAlphaWeight : Bitmap::ESpectrumAlphaWeight, - m_integrators.size() * SPECTRUM_SAMPLES + 2, false); + (int) (m_integrators.size() * SPECTRUM_SAMPLES + 2), false); int integratorResID = sched->registerResource(this); proc->bindResource("integrator", integratorResID); diff --git a/src/libcore/bitmap.cpp b/src/libcore/bitmap.cpp index edb16a26..8a5f4c9c 100644 --- a/src/libcore/bitmap.cpp +++ b/src/libcore/bitmap.cpp @@ -1399,7 +1399,10 @@ ref Bitmap::convert(EPixelFormat pixelFormat, ref Bitmap::convertMultiSpectrumAlphaWeight(const std::vector &pixelFormats, EComponentFormat componentFormat, const std::vector &channelNames) const { - ref bitmap = new Bitmap(Bitmap::EMultiChannel, componentFormat, m_size, channelNames.size()); + if (channelNames.size() > std::numeric_limits::max()) + Log(EError, "convertMultiSpectrumAlphaWeight(): excessive number of channels!"); + ref bitmap = new Bitmap(Bitmap::EMultiChannel, componentFormat, + m_size, (uint8_t) channelNames.size()); bitmap->setChannelNames(channelNames); convertMultiSpectrumAlphaWeight(this, getUInt8Data(), bitmap, bitmap->getUInt8Data(), pixelFormats, componentFormat, diff --git a/src/libcore/spectrum.cpp b/src/libcore/spectrum.cpp index 6e0847c4..f4466f32 100644 --- a/src/libcore/spectrum.cpp +++ b/src/libcore/spectrum.cpp @@ -69,7 +69,6 @@ static InterpolatedSpectrum CIE_D65_interp(CIE_wavelengths, CIE_D65_entries, CIE Spectrum Spectrum::CIE_X; Spectrum Spectrum::CIE_Y; Spectrum Spectrum::CIE_Z; -Spectrum Spectrum::CIE_D65; Float Spectrum::CIE_normalization; /// @} diff --git a/src/libpython/core.cpp b/src/libpython/core.cpp index 89261ba1..8f4088a4 100644 --- a/src/libpython/core.cpp +++ b/src/libpython/core.cpp @@ -276,7 +276,9 @@ static bp::tuple Matrix4x4_lu(Matrix4x4 *matrix) { static Vector4 Matrix4x4_cholSolve(Matrix4x4 *matrix, Vector B) { typedef Matrix<4, 1, Float> Matrix4x1; Vector4 X; - matrix->cholSolve<1>((Matrix4x1 &) B, (Matrix4x1 &) X); + Matrix4x1 & aliasedB MTS_MAY_ALIAS = reinterpret_cast(B); + Matrix4x1 & aliasedX MTS_MAY_ALIAS = reinterpret_cast(X); + matrix->cholSolve<1>(aliasedB, aliasedX); return X; } @@ -290,7 +292,9 @@ static Vector4 Matrix4x4_luSolve(Matrix4x4 *matrix, Vector B, bp::list pivList) for (int i=0; i<4; ++i) piv[i] = bp::extract(pivList[i]); - matrix->luSolve<1>((Matrix4x1 &) B, (Matrix4x1 &) X, piv); + Matrix4x1 & aliasedB MTS_MAY_ALIAS = reinterpret_cast(B); + Matrix4x1 & aliasedX MTS_MAY_ALIAS = reinterpret_cast(X); + matrix->luSolve<1>(aliasedB, aliasedX, piv); return X; }