Browse Source

GCC 4.5 compatibility: fixed initializer-list issues.

Vladimír Vondruš 14 years ago
parent
commit
02158cd0f9
  1. 6
      src/Mesh.h
  2. 11
      src/Shaders/FlatShader.cpp

6
src/Mesh.h

@ -619,7 +619,7 @@ class MAGNUM_EXPORT Mesh {
template<GLuint location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename TypeTraits<T>::AttributeType, GLfloat>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) {
for(GLuint i = 0; i != Implementation::Attribute<T>::vectorCount(); ++i) {
attributes.push_back({
attributes.push_back(Attribute{
buffer,
location+i,
Implementation::Attribute<T>::size(attribute.dataOptions()),
@ -635,7 +635,7 @@ class MAGNUM_EXPORT Mesh {
#ifndef MAGNUM_TARGET_GLES2
template<GLuint location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_integral<typename TypeTraits<T>::AttributeType>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) {
integerAttributes.push_back({
integerAttributes.push_back(IntegerAttribute{
buffer,
location,
Implementation::Attribute<T>::size(),
@ -650,7 +650,7 @@ class MAGNUM_EXPORT Mesh {
#ifndef MAGNUM_TARGET_GLES
template<GLuint location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename TypeTraits<T>::AttributeType, GLdouble>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) {
for(GLuint i = 0; i != Implementation::Attribute<T>::vectorCount(); ++i) {
longAttributes.push_back({
longAttributes.push_back(LongAttribute{
buffer,
location+i,
Implementation::Attribute<T>::size(),

11
src/Shaders/FlatShader.cpp

@ -39,11 +39,22 @@ namespace {
template<std::uint8_t dimensions> FlatShader<dimensions>::FlatShader() {
Corrade::Utility::Resource rs("MagnumShaders");
/* Weird bug in GCC 4.5 - cannot use initializer list here, although the
same thing works in PhongShader flawlessly*/
#ifndef CORRADE_GCC45_COMPATIBILITY
#ifndef MAGNUM_TARGET_GLES
Version v = Context::current()->supportedVersion({Version::GL320, Version::GL210});
#else
Version v = Context::current()->supportedVersion({Version::GLES300, Version::GLES200});
#endif
#else
#ifndef MAGNUM_TARGET_GLES
std::initializer_list<Version> vs{Version::GL320, Version::GL210};
#else
std::initializer_list<Version> vs{Version::GLES300, Version::GLES200};
#endif
Version v = Context::current()->supportedVersion(vs);
#endif
Shader vertexShader(v, Shader::Type::Vertex);
vertexShader.addSource(rs.get("compatibility.glsl"));

Loading…
Cancel
Save