Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenshader_debug.c
Go to the documentation of this file.
00001 00002 00003 #include "main/glheader.h" 00004 #include "main/mtypes.h" 00005 00006 00010 void 00011 _mesa_write_shader_to_file(const struct gl_shader *shader) 00012 { 00013 const char *type; 00014 char filename[100]; 00015 FILE *f; 00016 00017 if (shader->Type == GL_FRAGMENT_SHADER) 00018 type = "frag"; 00019 else 00020 type = "vert"; 00021 00022 snprintf(filename, strlen(filename), "shader_%u.%s", shader->Name, type); 00023 f = fopen(filename, "w"); 00024 if (!f) { 00025 fprintf(stderr, "Unable to open %s for writing\n", filename); 00026 return; 00027 } 00028 00029 fprintf(f, "/* Shader %u source */\n", shader->Name); 00030 fputs(shader->Source, f); 00031 fprintf(f, "\n"); 00032 00033 fprintf(f, "/* Compile status: %d */\n", shader->CompileStatus); 00034 fprintf(f, "\n"); 00035 00036 if (shader->CompileStatus) { 00037 FILE *stdout_save; 00038 00039 stdout_save = stdout; 00040 stdout = f; 00041 00042 fprintf(f, "/*GPU code */\n"); 00043 _mesa_print_program(shader->Program); 00044 00045 stdout = stdout_save; 00046 } 00047 00048 fclose(f); 00049 } 00050 00051 00052 00053 Generated on Fri May 25 2012 04:18:47 for ReactOS by
1.7.6.1
|