]> git.sesse.net Git - movit/blobdiff - effect_chain.cpp
Properly check framebuffer status when generating FBOs.
[movit] / effect_chain.cpp
index 0f8876d8f70c68ccb6b4d2a41a538414eddf9efe..574c44e2a68a0c7dac6e5ff43693a628c7ae61af 100644 (file)
@@ -1,27 +1,29 @@
 #define GL_GLEXT_PROTOTYPES 1
 
-#include <stdio.h>
+#include <GL/glew.h>
+#include <assert.h>
+#include <locale.h>
 #include <math.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <locale.h>
-#include <assert.h>
-#include <GL/glew.h>
-
 #include <algorithm>
 #include <set>
 #include <stack>
 #include <vector>
 
-#include "util.h"
-#include "effect_chain.h"
-#include "gamma_expansion_effect.h"
-#include "gamma_compression_effect.h"
-#include "colorspace_conversion_effect.h"
-#include "alpha_multiplication_effect.h"
 #include "alpha_division_effect.h"
+#include "alpha_multiplication_effect.h"
+#include "colorspace_conversion_effect.h"
 #include "dither_effect.h"
-#include "input.h"
+#include "effect.h"
+#include "effect_chain.h"
+#include "gamma_compression_effect.h"
+#include "gamma_expansion_effect.h"
 #include "init.h"
+#include "input.h"
+#include "util.h"
 
 EffectChain::EffectChain(float aspect_nom, float aspect_denom)
        : aspect_nom(aspect_nom),
@@ -1557,6 +1559,8 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                        // Last phase goes to the output the user specified.
                        glBindFramebuffer(GL_FRAMEBUFFER, dest_fbo);
                        check_error();
+                       GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+                       assert(status == GL_FRAMEBUFFER_COMPLETE);
                        glViewport(x, y, width, height);
                        if (dither_effect != NULL) {
                                CHECK(dither_effect->set_int("output_width", width));
@@ -1571,6 +1575,8 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                                output_node->output_texture,
                                0);
                        check_error();
+                       GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+                       assert(status == GL_FRAMEBUFFER_COMPLETE);
                        glViewport(0, 0, phases[phase]->output_width, phases[phase]->output_height);
                }