X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=effect_chain.cpp;h=fcf94f8505299c0ec12156c8ab427b06e9fa73c0;hb=f23c7768e6c13d6a719aaea89074d86b74148aeb;hp=c55ee26849617374010b879785b6fcfd5cd55b52;hpb=0b4a4101426130d2b7037cdb219d5c05b8d4c3d3;p=movit diff --git a/effect_chain.cpp b/effect_chain.cpp index c55ee26..fcf94f8 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -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();