From 62504944698295c8c48d88df124855af6874fdfe Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 12 Oct 2012 22:14:46 +0200 Subject: [PATCH 1/1] 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. --- .gitignore | 1 + effect_chain.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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); -- 2.39.2