Browse Source

Math: fix a build issue with CUDA on Windows.

pull/362/head
Vladimír Vondruš 7 years ago
parent
commit
b83c4366e7
  1. 3
      doc/changelog.dox
  2. 9
      src/Magnum/Math/RectangularMatrix.h

3
doc/changelog.dox

@ -369,6 +369,9 @@ See also:
- Removed mention of the outdated Ubuntu PPA from @ref building as it doesn't - Removed mention of the outdated Ubuntu PPA from @ref building as it doesn't
seem to be maintained anymore (see seem to be maintained anymore (see
[mosra/magnum-examples#61](https://github.com/mosra/magnum-examples/issues/61)) [mosra/magnum-examples#61](https://github.com/mosra/magnum-examples/issues/61))
- Worked around a bug in the NVCC compiler on Windows involving
@ref Math::RectangularMatrix::DiagonalSize to make Magnum usable with CUDA
(see [mosra/magnum#345](https://github.com/mosra/magnum/issues/345))
@subsection changelog-latest-bugfixes Bug fixes @subsection changelog-latest-bugfixes Bug fixes

9
src/Magnum/Math/RectangularMatrix.h

@ -407,7 +407,12 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* *
* @see @ref fromDiagonal() * @see @ref fromDiagonal()
*/ */
constexpr Vector<DiagonalSize, T> diagonal() const; constexpr Vector<DiagonalSize, T> diagonal() const {
/* NVCC (from CUDA) has problems compiling this function under
Windows when there's a separate definition due to DiagonalSize
(see https://github.com/mosra/magnum/issues/345 for details) */
return diagonalInternal(typename Implementation::GenerateSequence<DiagonalSize>::Type());
}
/** /**
* @brief Convert matrix to vector * @brief Convert matrix to vector
@ -754,8 +759,6 @@ template<std::size_t cols, std::size_t rows, class T> inline RectangularMatrix<r
return out; return out;
} }
template<std::size_t cols, std::size_t rows, class T> constexpr auto RectangularMatrix<cols, rows, T>::diagonal() const -> Vector<DiagonalSize, T> { return diagonalInternal(typename Implementation::GenerateSequence<DiagonalSize>::Type()); }
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
template<std::size_t cols, std::size_t rows, class T> template<std::size_t ...sequence> constexpr auto RectangularMatrix<cols, rows, T>::diagonalInternal(Implementation::Sequence<sequence...>) const -> Vector<DiagonalSize, T> { template<std::size_t cols, std::size_t rows, class T> template<std::size_t ...sequence> constexpr auto RectangularMatrix<cols, rows, T>::diagonalInternal(Implementation::Sequence<sequence...>) const -> Vector<DiagonalSize, T> {
return {_data[sequence][sequence]...}; return {_data[sequence][sequence]...};

Loading…
Cancel
Save