Browse Source

GCC 4.4 compatibility: explicit std::reference_wrapper cconstructor.

Vladimír Vondruš 12 years ago
parent
commit
b100f34f24
  1. 5
      src/Magnum/AbstractShaderProgram.h
  2. 5
      src/Magnum/Shader.h
  3. 5
      src/Magnum/Shaders/DistanceFieldVector.cpp
  4. 5
      src/Magnum/Shaders/Flat.cpp
  5. 5
      src/Magnum/Shaders/MeshVisualizer.cpp
  6. 3
      src/Magnum/Shaders/Phong.cpp
  7. 5
      src/Magnum/Shaders/Vector.cpp
  8. 5
      src/Magnum/Shaders/VertexColor.cpp

5
src/Magnum/AbstractShaderProgram.h

@ -666,7 +666,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* for improved performance, see its documentation for more
* information.
*/
bool link() { return link({*this}); }
bool link() {
/* GCC 4.4: explicit std::reference_wrapper constructor */
return link({std::ref(*this)});
}
/**
* @brief Get uniform location

5
src/Magnum/Shader.h

@ -548,7 +548,10 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* for improved performance, see its documentation for more
* information.
*/
bool compile() { return compile({*this}); }
bool compile() {
/* GCC 4.4: explicit std::reference_wrapper constructor */
return compile({std::ref(*this)});
}
private:
Type _type;

5
src/Magnum/Shaders/DistanceFieldVector.cpp

@ -60,8 +60,9 @@ template<UnsignedInt dimensions> DistanceFieldVector<dimensions>::DistanceFieldV
.addSource(rs.get(vertexShaderName<dimensions>()));
vert.addSource(rs.get("DistanceFieldVector.frag"));
/* GCC 4.5: the same issue */
std::initializer_list<std::reference_wrapper<Shader>> ss{frag, vert};
/* GCC 4.5: the same issue, GCC 4.4 additionally has explicit
std::reference_wrapper constructor */
std::initializer_list<std::reference_wrapper<Shader>> ss{std::ref(frag), std::ref(vert)};
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile(ss));
AbstractShaderProgram::attachShader(frag);

5
src/Magnum/Shaders/Flat.cpp

@ -65,8 +65,9 @@ template<UnsignedInt dimensions> Flat<dimensions>::Flat(const Flags flags): tran
frag.addSource(flags & Flag::Textured ? "#define TEXTURED\n" : "")
.addSource(rs.get("Flat.frag"));
/* GCC 4.5: the same issue */
std::initializer_list<std::reference_wrapper<Shader>> ss{frag, vert};
/* GCC 4.5: the same issue, GCC 4.4 additionally has explicit
std::reference_wrapper constructor */
std::initializer_list<std::reference_wrapper<Shader>> ss{std::ref(frag), std::ref(vert)};
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile(ss));
attachShader(vert);

5
src/Magnum/Shaders/MeshVisualizer.cpp

@ -75,11 +75,12 @@ MeshVisualizer::MeshVisualizer(const Flags flags): flags(flags), transformationP
}
#endif
/* GCC 4.4 has explicit std::reference_wrapper constructor */
#ifndef MAGNUM_TARGET_GLES
if(geom) Shader::compile({vert, *geom, frag});
if(geom) Shader::compile({std::ref(vert), std::ref(*geom), std::ref(frag)});
else
#endif
Shader::compile({vert, frag});
Shader::compile({std::ref(vert), std::ref(frag)});
attachShader(vert);
attachShader(frag);

3
src/Magnum/Shaders/Phong.cpp

@ -64,7 +64,8 @@ Phong::Phong(const Flags flags): transformationMatrixUniform(0), projectionMatri
.addSource(flags & Flag::SpecularTexture ? "#define SPECULAR_TEXTURE\n" : "")
.addSource(rs.get("Phong.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag}));
/* GCC 4.4 has explicit std::reference_wrapper constructor */
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({std::ref(vert), std::ref(frag)}));
attachShader(vert);
attachShader(frag);

5
src/Magnum/Shaders/Vector.cpp

@ -60,8 +60,9 @@ template<UnsignedInt dimensions> Vector<dimensions>::Vector(): transformationPro
.addSource(rs.get(vertexShaderName<dimensions>()));
frag.addSource(rs.get("Vector.frag"));
/* GCC 4.5: the same issue */
std::initializer_list<std::reference_wrapper<Shader>> ss{frag, vert};
/* GCC 4.5: the same issue, GCC 4.4 additionally has explicit
std::reference_wrapper constructor */
std::initializer_list<std::reference_wrapper<Shader>> ss{std::ref(frag), std::ref(vert)};
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile(ss));
AbstractShaderProgram::attachShader(vert);

5
src/Magnum/Shaders/VertexColor.cpp

@ -68,8 +68,9 @@ template<UnsignedInt dimensions> VertexColor<dimensions>::VertexColor(): transfo
.addSource(rs.get(vertexShaderName<dimensions>()));
frag.addSource(rs.get("VertexColor.frag"));
/* GCC 4.5: the same issue */
std::initializer_list<std::reference_wrapper<Shader>> ss{frag, vert};
/* GCC 4.5: the same issue, GCC 4.4 additionally has explicit
std::reference_wrapper constructor */
std::initializer_list<std::reference_wrapper<Shader>> ss{std::ref(frag), std::ref(vert)};
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile(ss));
attachShader(vert);

Loading…
Cancel
Save