Browse Source

Make Shader::addSource() no-op for empty string.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
950dde62f1
  1. 2
      src/Shader.cpp
  2. 2
      src/Shader.h

2
src/Shader.cpp

@ -80,6 +80,8 @@ Shader& Shader::operator=(Shader&& other) {
} }
Shader& Shader::addSource(const std::string& source) { Shader& Shader::addSource(const std::string& source) {
if(source.empty()) return *this;
if(_state == State::Initialized) if(_state == State::Initialized)
/* Fix line numbers, so line 41 of third added file is marked as 3(41). /* Fix line numbers, so line 41 of third added file is marked as 3(41).
Source 0 is the #version string added in constructor. */ Source 0 is the #version string added in constructor. */

2
src/Shader.h

@ -139,7 +139,7 @@ class MAGNUM_EXPORT Shader {
* *
* If the shader is not compiled already, adds given source to source * If the shader is not compiled already, adds given source to source
* list. Note that it is possible to compile shader from more than * list. Note that it is possible to compile shader from more than
* one source. * one source. If passed string is empty, the function does nothing.
* @see addFile() * @see addFile()
*/ */
Shader& addSource(const std::string& source); Shader& addSource(const std::string& source);

Loading…
Cancel
Save