- execute_phase(phase, render_to_texture, &output_textures, &generated_mipmaps);
+ // Find a texture for this phase.
+ inform_input_sizes(phase);
+ find_output_size(phase);
+ GLuint tex_num = 0;
+ if (!last_phase) {
+ tex_num = resource_pool->create_2d_texture(intermediate_format, phase->output_width, phase->output_height);
+ assert(tex_num != 0);
+ output_textures.insert(make_pair(phase, tex_num));
+
+ // The output texture needs to have valid state to be written to by a compute shader.
+ glActiveTexture(GL_TEXTURE0);
+ check_error();
+ glBindTexture(GL_TEXTURE_2D, tex_num);
+ check_error();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ check_error();
+ } else if (phase->is_compute_shader) {
+ // TODO: Support more than one destination.
+ assert(!destinations.empty());
+ tex_num = destinations[0].texnum;
+ assert(destinations[0].format == GL_RGBA16F);
+ assert(destinations[0].texnum != 0);
+ }
+
+ execute_phase(phase, output_textures, tex_num, &generated_mipmaps);