From: Steinar H. Gunderson Date: Fri, 12 Oct 2012 20:14:46 +0000 (+0200) Subject: Output the chained shaders to temporary files instead of to stdout, since it's near... X-Git-Tag: 1.0~302 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=62504944698295c8c48d88df124855af6874fdfe;hp=1a595d0396e943d09a1459707785d66406deb354 Output the chained shaders to temporary files instead of to stdout, since it's near-impossible to see the test output with so much stuff in the way. --- diff --git a/.gitignore b/.gitignore index a515fe1..3790ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ perf.data *.dot demo effect_chain_test +chain-*.frag diff --git a/effect_chain.cpp b/effect_chain.cpp index c3776e8..a549087 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);