1 /*
2  * Mesa 3-D graphics library
3  *
4  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 
26 #ifndef PROG_PRINT_H
27 #define PROG_PRINT_H
28 
29 #include <stdio.h>
30 
31 #include "main/glheader.h"
32 #include "prog_parameter.h"
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 
40 struct gl_program;
41 struct gl_program_parameter_list;
42 struct gl_shader;
43 struct prog_instruction;
44 
45 
46 /**
47  * The output style to use when printing programs.
48  */
49 typedef enum {
50    PROG_PRINT_ARB,
51    PROG_PRINT_DEBUG
52 } gl_prog_print_mode;
53 
54 
55 extern const char *
56 _mesa_register_file_name(gl_register_file f);
57 
58 extern void
59 _mesa_print_vp_inputs(GLbitfield inputs);
60 
61 extern void
62 _mesa_print_fp_inputs(GLbitfield inputs);
63 
64 extern const char *
65 _mesa_condcode_string(GLuint condcode);
66 
67 extern const char *
68 _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended);
69 
70 const char *
71 _mesa_writemask_string(GLuint writeMask);
72 
73 extern void
74 _mesa_print_swizzle(GLuint swizzle);
75 
76 extern void
77 _mesa_fprint_alu_instruction(FILE *f,
78 			     const struct prog_instruction *inst,
79 			     const char *opcode_string, GLuint numRegs,
80 			     gl_prog_print_mode mode,
81 			     const struct gl_program *prog);
82 
83 extern void
84 _mesa_print_alu_instruction(const struct prog_instruction *inst,
85                             const char *opcode_string, GLuint numRegs);
86 
87 extern void
88 _mesa_print_instruction(const struct prog_instruction *inst);
89 
90 extern GLint
91 _mesa_fprint_instruction_opt(FILE *f,
92                             const struct prog_instruction *inst,
93                             GLint indent,
94                             gl_prog_print_mode mode,
95                             const struct gl_program *prog);
96 
97 extern GLint
98 _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent,
99                             gl_prog_print_mode mode,
100                             const struct gl_program *prog);
101 
102 extern void
103 _mesa_print_program(const struct gl_program *prog);
104 
105 extern void
106 _mesa_fprint_program_opt(FILE *f,
107                          const struct gl_program *prog, gl_prog_print_mode mode,
108                          GLboolean lineNumbers);
109 
110 extern void
111 _mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog);
112 
113 extern void
114 _mesa_print_parameter_list(const struct gl_program_parameter_list *list);
115 
116 
117 extern void
118 _mesa_write_shader_to_file(const struct gl_shader *shader);
119 
120 extern void
121 _mesa_append_uniforms_to_file(const struct gl_program *prog);
122 
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 
129 #endif /* PROG_PRINT_H */
130