Browse Source

Don't yell at people.

Also minor cleanup and string copy optimization.
pull/132/head
Vladimír Vondruš 10 years ago
parent
commit
c463526feb
  1. 4
      src/Magnum/AbstractShaderProgram.cpp
  2. 10
      src/Magnum/Test/AbstractShaderProgramGLTest.cpp

4
src/Magnum/AbstractShaderProgram.cpp

@ -395,9 +395,9 @@ bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<Ab
} }
Int AbstractShaderProgram::uniformLocationInternal(const Containers::ArrayView<const char> name) { Int AbstractShaderProgram::uniformLocationInternal(const Containers::ArrayView<const char> name) {
GLint location = glGetUniformLocation(_id, name); const GLint location = glGetUniformLocation(_id, name);
if(location == -1) if(location == -1)
Warning() << "AbstractShaderProgram: location of uniform \'" + std::string{name, name.size()} + "\' cannot be retrieved!"; Warning() << "AbstractShaderProgram: location of uniform \'" << Debug::nospace << std::string{name, name.size()} << Debug::nospace << "\' cannot be retrieved";
return location; return location;
} }

10
src/Magnum/Test/AbstractShaderProgramGLTest.cpp

@ -51,7 +51,7 @@ struct AbstractShaderProgramGLTest: AbstractOpenGLTester {
void createMultipleOutputsIndexed(); void createMultipleOutputsIndexed();
#endif #endif
void uniformLocationOptimizedOut(); void uniformNotFound();
void uniform(); void uniform();
void uniformVector(); void uniformVector();
void uniformMatrix(); void uniformMatrix();
@ -71,7 +71,7 @@ AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() {
&AbstractShaderProgramGLTest::createMultipleOutputsIndexed, &AbstractShaderProgramGLTest::createMultipleOutputsIndexed,
#endif #endif
&AbstractShaderProgramGLTest::uniformLocationOptimizedOut, &AbstractShaderProgramGLTest::uniformNotFound,
&AbstractShaderProgramGLTest::uniform, &AbstractShaderProgramGLTest::uniform,
&AbstractShaderProgramGLTest::uniformVector, &AbstractShaderProgramGLTest::uniformVector,
&AbstractShaderProgramGLTest::uniformMatrix, &AbstractShaderProgramGLTest::uniformMatrix,
@ -320,7 +320,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputsIndexed() {
} }
#endif #endif
void AbstractShaderProgramGLTest::uniformLocationOptimizedOut() { void AbstractShaderProgramGLTest::uniformNotFound() {
MyPublicShader program; MyPublicShader program;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -361,8 +361,8 @@ void AbstractShaderProgramGLTest::uniformLocationOptimizedOut() {
program.uniformLocation("nonexistent"); program.uniformLocation("nonexistent");
program.uniformLocation(std::string{"another"}); program.uniformLocation(std::string{"another"});
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"AbstractShaderProgram: location of uniform 'nonexistent' cannot be retrieved!\n" "AbstractShaderProgram: location of uniform 'nonexistent' cannot be retrieved\n"
"AbstractShaderProgram: location of uniform 'another' cannot be retrieved!\n"); "AbstractShaderProgram: location of uniform 'another' cannot be retrieved\n");
} }
namespace { namespace {

Loading…
Cancel
Save