Browse Source

GCC 4.5 compatibility: no range-based for.

Vladimír Vondruš 12 years ago
parent
commit
4a5ea35961
  1. 6
      src/Magnum/AbstractShaderProgram.cpp
  2. 8
      src/Magnum/AbstractTexture.cpp
  3. 4
      src/Magnum/Context.cpp
  4. 7
      src/Magnum/Platform/magnum-info.cpp
  5. 12
      src/Magnum/Shader.cpp

6
src/Magnum/AbstractShaderProgram.cpp

@ -275,11 +275,13 @@ bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<Ab
bool allSuccess = true;
/* Invoke (possibly parallel) linking on all shaders */
for(AbstractShaderProgram& shader: shaders) glLinkProgram(shader._id);
for(auto it = shaders.begin(); it != shaders.end(); ++it) glLinkProgram(it->get()._id);
/* After linking phase, check status of all shaders */
Int i = 1;
for(AbstractShaderProgram& shader: shaders) {
for(auto it = shaders.begin(); it != shaders.end(); ++it) {
AbstractShaderProgram& shader = *it;
GLint success, logLength;
glGetProgramiv(shader._id, GL_LINK_STATUS, &success);
glGetProgramiv(shader._id, GL_INFO_LOG_LENGTH, &logLength);

8
src/Magnum/AbstractTexture.cpp

@ -134,8 +134,8 @@ void AbstractTexture::bind(const Int firstTextureUnit, std::initializer_list<Abs
void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, std::initializer_list<AbstractTexture*> textures) {
Int unit = firstTextureUnit;
for(AbstractTexture* const texture: textures) {
if(texture) texture->bind(unit);
for(auto it = textures.begin(); it != textures.end(); ++it) {
if(*it) (*it)->bind(unit);
else unbind(unit);
++unit;
}
@ -148,8 +148,8 @@ void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, std:
/* Create array of IDs and also update bindings in state tracker */
Containers::Array<GLuint> ids{textures.size()};
Int i{};
for(const AbstractTexture* const texture: textures) {
textureState->bindings[firstTextureUnit + i].second = ids[i] = texture ? texture->id() : 0;
for(auto it = textures.begin(); it != textures.end(); ++it) {
textureState->bindings[firstTextureUnit + i].second = ids[i] = *it ? (*it)->id() : 0;
++i;
}

4
src/Magnum/Context.cpp

@ -415,8 +415,8 @@ Context::Context() {
/* Check for presence of future and vendor extensions */
const std::vector<std::string> extensions = extensionStrings();
for(const std::string& extension: extensions) {
const auto found = futureExtensions.find(extension);
for(auto it = extensions.begin(); it != extensions.end(); ++it) {
const auto found = futureExtensions.find(*it);
if(found != futureExtensions.end()) {
_supportedExtensions.push_back(found->second);
extensionStatus.set(found->second._index);

7
src/Magnum/Platform/magnum-info.cpp

@ -152,11 +152,12 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
Debug() << "Context flags:";
#ifndef MAGNUM_TARGET_GLES
for(const auto flag: {Context::Flag::Debug, Context::Flag::RobustAccess})
auto flags = {Context::Flag::Debug, Context::Flag::RobustAccess};
#else
for(const auto flag: {Context::Flag::Debug})
auto flags = {Context::Flag::Debug};
#endif
if(c->flags() & flag) Debug() << " " << flag;
for(auto it = flags.begin(); it != flags.end(); ++it)
if(c->flags() & *it) Debug() << " " << *it;
Debug() << "Supported GLSL versions:";
const std::vector<std::string> shadingLanguageVersions = c->shadingLanguageVersionStrings();

12
src/Magnum/Shader.cpp

@ -634,7 +634,8 @@ bool Shader::compile(std::initializer_list<std::reference_wrapper<Shader>> shade
/* Allocate large enough array for source pointers and sizes (to avoid
reallocating it for each of them) */
std::size_t maxSourceCount = 0;
for(Shader& shader: shaders) {
for(auto it = shaders.begin(); it != shaders.end(); ++it) {
Shader& shader = *it;
CORRADE_ASSERT(shader._sources.size() > 1, "Shader::compile(): no files added", false);
maxSourceCount = std::max(shader._sources.size(), maxSourceCount);
}
@ -642,7 +643,8 @@ bool Shader::compile(std::initializer_list<std::reference_wrapper<Shader>> shade
Containers::Array<GLint> sizes(maxSourceCount);
/* Upload sources of all shaders */
for(Shader& shader: shaders) {
for(auto it = shaders.begin(); it != shaders.end(); ++it) {
Shader& shader = *it;
for(std::size_t i = 0; i != shader._sources.size(); ++i) {
pointers[i] = static_cast<const GLchar*>(shader._sources[i].data());
sizes[i] = shader._sources[i].size();
@ -652,11 +654,13 @@ bool Shader::compile(std::initializer_list<std::reference_wrapper<Shader>> shade
}
/* Invoke (possibly parallel) compilation on all shaders */
for(Shader& shader: shaders) glCompileShader(shader._id);
for(auto it = shaders.begin(); it != shaders.end(); ++it) glCompileShader(it->get()._id);
/* After compilation phase, check status of all shaders */
Int i = 1;
for(Shader& shader: shaders) {
for(auto it = shaders.begin(); it != shaders.end(); ++it) {
Shader& shader = *it;
GLint success, logLength;
glGetShaderiv(shader._id, GL_COMPILE_STATUS, &success);
glGetShaderiv(shader._id, GL_INFO_LOG_LENGTH, &logLength);

Loading…
Cancel
Save