X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain.cpp;h=617d1cb007f392bf6fe816c9ccbd1ead68c9722b;hp=c3776e85f605568a51ca61e221e826b87dbc2231;hb=45c3b698b97bfcf4036910ee3539bd5eab4e9751;hpb=b8b7f286300668679e61a25beb48f353b5a83f43 diff --git a/effect_chain.cpp b/effect_chain.cpp index c3776e8..617d1cb 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -242,7 +242,18 @@ Phase *EffectChain::compile_glsl_program( } frag_shader += std::string("#define INPUT ") + effects.back()->effect_id + "\n"; frag_shader.append(read_file("footer.frag")); - printf("%s\n", frag_shader.c_str()); + + // Output shader to a temporary file, for easier debugging. + static int compiled_shader_num = 0; + char filename[256]; + sprintf(filename, "chain-%03d.frag", compiled_shader_num++); + FILE *fp = fopen(filename, "w"); + if (fp == NULL) { + perror(filename); + exit(1); + } + fprintf(fp, "%s\n", frag_shader.c_str()); + fclose(fp); GLuint glsl_program_num = glCreateProgram(); GLuint vs_obj = compile_shader(read_file("vs.vert"), GL_VERTEX_SHADER); @@ -718,7 +729,8 @@ bool EffectChain::node_needs_gamma_fix(Node *node) // This needs to be before everything else, since it could // even apply to inputs (if they are the only effect). if (node->outgoing_links.empty() && - node->output_gamma_curve != output_format.gamma_curve) { + node->output_gamma_curve != output_format.gamma_curve && + node->output_gamma_curve != GAMMA_LINEAR) { return true; } @@ -961,7 +973,7 @@ void EffectChain::finalize() finalized = true; } -void EffectChain::render_to_fbo(GLuint fbo, unsigned width, unsigned height) +void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height) { assert(finalized); @@ -1054,7 +1066,7 @@ void EffectChain::render_to_fbo(GLuint fbo, unsigned width, unsigned height) // And now the output. if (phase == phases.size() - 1) { // Last phase goes to the output the user specified. - glBindFramebuffer(GL_FRAMEBUFFER, fbo); + glBindFramebuffer(GL_FRAMEBUFFER, dest_fbo); check_error(); glViewport(x, y, width, height); } else {