]> git.sesse.net Git - movit/blobdiff - effect_chain.cpp
Rename needs_many_samples() to needs_texture_bounce(), and update the comment.
[movit] / effect_chain.cpp
index c55ee26849617374010b879785b6fcfd5cd55b52..fcf94f8505299c0ec12156c8ab427b06e9fa73c0 100644 (file)
@@ -208,7 +208,7 @@ void EffectChain::finalize()
        // and of course at the end.
        unsigned start = 0;
        for (unsigned i = 0; i < effects.size(); ++i) {
-               if (effects[i]->needs_many_samples() && i != start) {
+               if (effects[i]->needs_texture_bounce() && i != start) {
                        phases.push_back(compile_glsl_program(start, i));
                        start = i;
                }
@@ -263,10 +263,7 @@ void EffectChain::finalize()
        check_error();
        glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, width * height * bytes_per_pixel, NULL, GL_STREAM_DRAW);
        check_error();
-
-       void *mapped_pbo = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY);
-       memset(mapped_pbo, 0, width * height * bytes_per_pixel);
-       glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);
+       glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
        check_error();
        
        glGenTextures(1, &source_image_num);
@@ -275,9 +272,10 @@ void EffectChain::finalize()
        check_error();
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        check_error();
-       glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
+       // Intel/Mesa seems to have a broken glGenerateMipmap() for non-FBO textures, so do it here.
+       glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, phases[0].input_needs_mipmaps ? GL_TRUE : GL_FALSE);
        check_error();
-       glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
+       glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, NULL);
        check_error();
 
        finalized = true;
@@ -306,11 +304,6 @@ void EffectChain::render_to_screen(unsigned char *src)
        check_error();
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
        check_error();
-
-       // Intel/Mesa seems to have a broken glGenerateMipmap() for non-FBO textures, so do it here.
-       glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, phases[0].input_needs_mipmaps ? GL_TRUE : GL_FALSE);
-       check_error();
-
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
        check_error();