~ubuntu-branches/ubuntu/jaunty/mesa/jaunty

« back to all changes in this revision

Viewing changes to src/mesa/shader/shader_debug.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-04-03 12:42:06 UTC
  • mfrom: (1.2.16 upstream) (3.1.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20090403124206-0oo9dl0tcmd0qr38
Tags: 7.4-0ubuntu1
* New upstream release, merge from debian-experimental
  (LP: #330476, #347171, #349127)
* Drop 103_rs600_support.patch, included in this version.
* Drop 104_swrast_fbconfigs.patch, included in this version.
* Add 103_bump_965_texture_limit.diff. (LP: #146298)
* Add 104_fix_dri2_ext_tfp.diff. (LP: #324854)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
#include "main/glheader.h"
4
 
#include "main/mtypes.h"
5
 
 
6
 
 
7
 
/**
8
 
 * Write shader and associated info to a file.
9
 
 */
10
 
void
11
 
_mesa_write_shader_to_file(const struct gl_shader *shader)
12
 
{
13
 
   const char *type;
14
 
   char filename[100];
15
 
   FILE *f;
16
 
 
17
 
   if (shader->Type == GL_FRAGMENT_SHADER)
18
 
      type = "frag";
19
 
   else
20
 
      type = "vert";
21
 
 
22
 
   snprintf(filename, strlen(filename), "shader_%u.%s", shader->Name, type);
23
 
   f = fopen(filename, "w");
24
 
   if (!f) {
25
 
      fprintf(stderr, "Unable to open %s for writing\n", filename);
26
 
      return;
27
 
   }
28
 
 
29
 
   fprintf(f, "/* Shader %u source */\n", shader->Name);
30
 
   fputs(shader->Source, f);
31
 
   fprintf(f, "\n");
32
 
 
33
 
   fprintf(f, "/* Compile status: %d */\n", shader->CompileStatus);
34
 
   fprintf(f, "\n");
35
 
 
36
 
   if (shader->CompileStatus) {
37
 
      FILE *stdout_save;
38
 
 
39
 
      stdout_save = stdout;
40
 
      stdout = f;
41
 
 
42
 
      fprintf(f, "/*GPU code */\n");
43
 
      _mesa_print_program(shader->Program);
44
 
 
45
 
      stdout = stdout_save;
46
 
   }
47
 
 
48
 
   fclose(f);
49
 
}
50
 
 
51
 
 
52
 
 
53