]> git.sesse.net Git - movit/commitdiff
Output the chained shaders to temporary files instead of to stdout, since it's near...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 12 Oct 2012 20:14:46 +0000 (22:14 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 12 Oct 2012 20:14:46 +0000 (22:14 +0200)
.gitignore
effect_chain.cpp

index a515fe17d2abace6328d7d46f0c42adaae87c6f9..3790ba30142a182ea31218e4f3bdb6db3a2916b4 100644 (file)
@@ -9,3 +9,4 @@ perf.data
 *.dot
 demo
 effect_chain_test
+chain-*.frag
index c3776e85f605568a51ca61e221e826b87dbc2231..a549087862a47e5421ebe9b1a0db499911d7729b 100644 (file)
@@ -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);