]> git.sesse.net Git - movit/blobdiff - effect_chain.cpp
Use auto and range-based for loops a few places where it aids clarity.
[movit] / effect_chain.cpp
index 0c46768fd5d7db4470430556ee9b3ea7342b4b3c..0e20ce097be8a29ff85ff9b4fbe089a273ddbe75 100644 (file)
@@ -311,10 +311,10 @@ string replace_prefix(const string &text, const string &prefix)
 namespace {
 
 template<class T>
-void extract_uniform_declarations(const vector<Uniform<T> > &effect_uniforms,
+void extract_uniform_declarations(const vector<Uniform<T>> &effect_uniforms,
                                   const string &type_specifier,
                                   const string &effect_id,
-                                  vector<Uniform<T> > *phase_uniforms,
+                                  vector<Uniform<T>> *phase_uniforms,
                                   string *glsl_string)
 {
        for (unsigned i = 0; i < effect_uniforms.size(); ++i) {
@@ -327,10 +327,10 @@ void extract_uniform_declarations(const vector<Uniform<T> > &effect_uniforms,
 }
 
 template<class T>
-void extract_uniform_array_declarations(const vector<Uniform<T> > &effect_uniforms,
+void extract_uniform_array_declarations(const vector<Uniform<T>> &effect_uniforms,
                                         const string &type_specifier,
                                         const string &effect_id,
-                                        vector<Uniform<T> > *phase_uniforms,
+                                        vector<Uniform<T>> *phase_uniforms,
                                         string *glsl_string)
 {
        for (unsigned i = 0; i < effect_uniforms.size(); ++i) {
@@ -347,7 +347,7 @@ void extract_uniform_array_declarations(const vector<Uniform<T> > &effect_unifor
 }
 
 template<class T>
-void collect_uniform_locations(GLuint glsl_program_num, vector<Uniform<T> > *phase_uniforms)
+void collect_uniform_locations(GLuint glsl_program_num, vector<Uniform<T>> *phase_uniforms)
 {
        for (unsigned i = 0; i < phase_uniforms->size(); ++i) {
                Uniform<T> &uniform = (*phase_uniforms)[i];
@@ -361,7 +361,7 @@ void EffectChain::compile_glsl_program(Phase *phase)
 {
        string frag_shader_header;
        if (phase->is_compute_shader) {
-               frag_shader_header = read_file("header.compute");
+               frag_shader_header = read_file("header.comp");
        } else {
                frag_shader_header = read_version_dependent_file("header", "frag");
        }
@@ -1906,10 +1906,8 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                }
        }
 
-       for (map<Phase *, GLuint>::const_iterator texture_it = output_textures.begin();
-            texture_it != output_textures.end();
-            ++texture_it) {
-               resource_pool->release_2d_texture(texture_it->second);
+       for (const auto &phase_and_texnum : output_textures) {
+               resource_pool->release_2d_texture(phase_and_texnum.second);
        }
 
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1926,8 +1924,8 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                // Get back the timer queries.
                for (unsigned phase_num = 0; phase_num < phases.size(); ++phase_num) {
                        Phase *phase = phases[phase_num];
-                       for (std::list<GLuint>::iterator timer_it = phase->timer_query_objects_running.begin();
-                            timer_it != phase->timer_query_objects_running.end(); ) {
+                       for (auto timer_it = phase->timer_query_objects_running.cbegin();
+                            timer_it != phase->timer_query_objects_running.cend(); ) {
                                GLint timer_query_object = *timer_it;
                                GLint available;
                                glGetQueryObjectiv(timer_query_object, GL_QUERY_RESULT_AVAILABLE, &available);