diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 9bb375aad..1dbf1d640 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -42,18 +42,6 @@ namespace Magnum { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { template struct Attribute; - - /* Used in setUniform(Int, const T&), otherwise it would not be possible to - pass enum values as uniforms */ - struct NonEnumType { - template inline static typename std::enable_if::value, const typename std::conditional::value, UnsignedInt, Int>::type&>::type cast(const T& value) { - return static_cast::value, UnsignedInt, Int>::type&>(value); - } - - template inline static typename std::enable_if::value, const T&>::type cast(const T& value) { - return value; - } - }; } #endif @@ -694,9 +682,32 @@ class MAGNUM_EXPORT AbstractShaderProgram { * Convenience alternative for setting one value, see * setUniform(Int, UnsignedInt, const Float*) for more information. */ - template inline void setUniform(Int location, const T& value) { - setUniform(location, 1, &Implementation::NonEnumType::cast(value)); + #ifdef DOXYGEN_GENERATING_OUTPUT + template inline void setUniform(Int location, const T& value); + #else + inline void setUniform(Int location, Float value) { + setUniform(location, 1, &value); + } + inline void setUniform(Int location, Int value) { + setUniform(location, 1, &value); + } + #ifndef MAGNUM_TARGET_GLES2 + inline void setUniform(Int location, UnsignedInt value) { + setUniform(location, 1, &value); + } + #endif + #ifndef MAGNUM_TARGET_GLES + inline void setUniform(Int location, Double value) { + setUniform(location, 1, &value); } + #endif + template inline void setUniform(Int location, const Math::Vector& value) { + setUniform(location, 1, &value); + } + template inline void setUniform(Int location, const Math::RectangularMatrix& value) { + setUniform(location, 1, &value); + } + #endif /** * @brief Set uniform values