diff --git a/src/Magnum/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp index 2daf03574..dabc8b881 100644 --- a/src/Magnum/AbstractShaderProgram.cpp +++ b/src/Magnum/AbstractShaderProgram.cpp @@ -262,6 +262,10 @@ void AbstractShaderProgram::attachShader(Shader& shader) { glAttachShader(_id, shader.id()); } +void AbstractShaderProgram::attachShaders(std::initializer_list> shaders) { + for(Shader& s: shaders) attachShader(s); +} + void AbstractShaderProgram::bindAttributeLocation(UnsignedInt location, const std::string& name) { glBindAttribLocation(_id, location, name.data()); } diff --git a/src/Magnum/AbstractShaderProgram.h b/src/Magnum/AbstractShaderProgram.h index 0957857e1..9da0dc74f 100644 --- a/src/Magnum/AbstractShaderProgram.h +++ b/src/Magnum/AbstractShaderProgram.h @@ -614,6 +614,15 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { */ void attachShader(Shader& shader); + /** + * @brief Attach shaders + * + * Convenience overload to the above, allowing the user to specify more + * than one shader at once. Other than that there is no other + * (performance) difference when using this function. + */ + void attachShaders(std::initializer_list> shaders); + /** * @brief Bind attribute to given location * @param location Location