Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
56 | pj | 1 | /* $Id: t_imm_debug.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
2 | |||
3 | /* |
||
4 | * Mesa 3-D graphics library |
||
5 | * Version: 3.5 |
||
6 | * |
||
7 | * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
||
8 | * |
||
9 | * Permission is hereby granted, free of charge, to any person obtaining a |
||
10 | * copy of this software and associated documentation files (the "Software"), |
||
11 | * to deal in the Software without restriction, including without limitation |
||
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||
13 | * and/or sell copies of the Software, and to permit persons to whom the |
||
14 | * Software is furnished to do so, subject to the following conditions: |
||
15 | * |
||
16 | * The above copyright notice and this permission notice shall be included |
||
17 | * in all copies or substantial portions of the Software. |
||
18 | * |
||
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
||
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
||
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
25 | */ |
||
26 | |||
27 | #include "mtypes.h" |
||
28 | #include "context.h" |
||
29 | #include "imports.h" |
||
30 | #include "t_context.h" |
||
31 | #include "t_imm_debug.h" |
||
32 | |||
33 | |||
34 | void _tnl_print_vert_flags( const char *name, GLuint flags ) |
||
35 | { |
||
36 | _mesa_debug(NULL, |
||
37 | "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", |
||
38 | name, |
||
39 | flags, |
||
40 | (flags & VERT_BIT_CLIP) ? "clip/proj-clip/glend, " : "", |
||
41 | (flags & VERT_BIT_EDGEFLAG) ? "edgeflag, " : "", |
||
42 | (flags & VERT_BIT_ELT) ? "array-elt, " : "", |
||
43 | (flags & VERT_BIT_END_VB) ? "end-vb, " : "", |
||
44 | (flags & VERT_BITS_EVAL_ANY) ? "eval-coord, " : "", |
||
45 | (flags & VERT_BIT_EYE) ? "eye/glbegin, " : "", |
||
46 | (flags & VERT_BIT_FOG) ? "fog-coord, " : "", |
||
47 | (flags & VERT_BIT_INDEX) ? "index, " : "", |
||
48 | (flags & VERT_BIT_MATERIAL) ? "material, " : "", |
||
49 | (flags & VERT_BIT_NORMAL) ? "normals, " : "", |
||
50 | (flags & VERT_BIT_POS) ? "obj, " : "", |
||
51 | (flags & VERT_BIT_OBJ_3) ? "obj-3, " : "", |
||
52 | (flags & VERT_BIT_OBJ_4) ? "obj-4, " : "", |
||
53 | (flags & VERT_BIT_POINT_SIZE) ? "point-size, " : "", |
||
54 | (flags & VERT_BIT_COLOR0) ? "colors, " : "", |
||
55 | (flags & VERT_BIT_COLOR1) ? "specular, " : "", |
||
56 | (flags & VERT_BIT_TEX0) ? "texcoord0, " : "", |
||
57 | (flags & VERT_BIT_TEX1) ? "texcoord1, " : "", |
||
58 | (flags & VERT_BIT_TEX2) ? "texcoord2, " : "", |
||
59 | (flags & VERT_BIT_TEX3) ? "texcoord3, " : "", |
||
60 | (flags & VERT_BIT_TEX4) ? "texcoord4, " : "", |
||
61 | (flags & VERT_BIT_TEX5) ? "texcoord5, " : "", |
||
62 | (flags & VERT_BIT_TEX6) ? "texcoord6, " : "", |
||
63 | (flags & VERT_BIT_TEX7) ? "texcoord7, " : "" |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | void _tnl_print_cassette( struct immediate *IM ) |
||
68 | { |
||
69 | GLuint i; |
||
70 | GLuint *flags = IM->Flag; |
||
71 | GLuint andflag = IM->CopyAndFlag; |
||
72 | GLuint orflag = (IM->CopyOrFlag|IM->Evaluated); |
||
73 | GLuint state = IM->BeginState; |
||
74 | GLuint req = ~0; |
||
75 | |||
76 | _mesa_debug(NULL, "Cassette id %d, %u rows.\n", IM->id, |
||
77 | IM->Count - IM->CopyStart); |
||
78 | |||
79 | _tnl_print_vert_flags("Contains at least one", orflag); |
||
80 | |||
81 | if (IM->Count != IM->CopyStart) |
||
82 | { |
||
83 | _tnl_print_vert_flags("Contains a full complement of", andflag); |
||
84 | |||
85 | _mesa_debug(NULL, "Final begin/end state %s/%s, errors %s/%s\n", |
||
86 | (state & VERT_BEGIN_0) ? "in" : "out", |
||
87 | (state & VERT_BEGIN_1) ? "in" : "out", |
||
88 | (state & VERT_ERROR_0) ? "y" : "n", |
||
89 | (state & VERT_ERROR_1) ? "y" : "n"); |
||
90 | |||
91 | } |
||
92 | |||
93 | for (i = IM->CopyStart ; i <= IM->Count ; i++) { |
||
94 | _mesa_debug(NULL, "%u: ", i); |
||
95 | if (req & VERT_BITS_OBJ_234) { |
||
96 | if (flags[i] & VERT_BIT_EVAL_C1) |
||
97 | _mesa_debug(NULL, "EvalCoord %f ", |
||
98 | IM->Attrib[VERT_ATTRIB_POS][i][0]); |
||
99 | else if (flags[i] & VERT_BIT_EVAL_P1) |
||
100 | _mesa_debug(NULL, "EvalPoint %.0f ", |
||
101 | IM->Attrib[VERT_ATTRIB_POS][i][0]); |
||
102 | else if (flags[i] & VERT_BIT_EVAL_C2) |
||
103 | _mesa_debug(NULL, "EvalCoord %f %f ", |
||
104 | IM->Attrib[VERT_ATTRIB_POS][i][0], |
||
105 | IM->Attrib[VERT_ATTRIB_POS][i][1]); |
||
106 | else if (flags[i] & VERT_BIT_EVAL_P2) |
||
107 | _mesa_debug(NULL, "EvalPoint %.0f %.0f ", |
||
108 | IM->Attrib[VERT_ATTRIB_POS][i][0], |
||
109 | IM->Attrib[VERT_ATTRIB_POS][i][1]); |
||
110 | else if (i < IM->Count && (flags[i] & VERT_BITS_OBJ_234)) { |
||
111 | _mesa_debug(NULL, "Obj %f %f %f %f", |
||
112 | IM->Attrib[VERT_ATTRIB_POS][i][0], |
||
113 | IM->Attrib[VERT_ATTRIB_POS][i][1], |
||
114 | IM->Attrib[VERT_ATTRIB_POS][i][2], |
||
115 | IM->Attrib[VERT_ATTRIB_POS][i][3]); |
||
116 | } |
||
117 | } |
||
118 | |||
119 | if (req & flags[i] & VERT_BIT_ELT) |
||
120 | _mesa_debug(NULL, " Elt %u\t", IM->Elt[i]); |
||
121 | |||
122 | if (req & flags[i] & VERT_BIT_NORMAL) |
||
123 | _mesa_debug(NULL, " Norm %f %f %f ", |
||
124 | IM->Attrib[VERT_ATTRIB_NORMAL][i][0], |
||
125 | IM->Attrib[VERT_ATTRIB_NORMAL][i][1], |
||
126 | IM->Attrib[VERT_ATTRIB_NORMAL][i][2]); |
||
127 | |||
128 | if (req & flags[i] & VERT_BITS_TEX_ANY) { |
||
129 | GLuint j; |
||
130 | for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { |
||
131 | if (req & flags[i] & VERT_BIT_TEX(j)) { |
||
132 | _mesa_debug(NULL, "TC%d %f %f %f %f", j, |
||
133 | IM->Attrib[VERT_ATTRIB_TEX0 + j][i][0], |
||
134 | IM->Attrib[VERT_ATTRIB_TEX0 + j][i][1], |
||
135 | IM->Attrib[VERT_ATTRIB_TEX0 + j][i][2], |
||
136 | IM->Attrib[VERT_ATTRIB_TEX0 + j][i][3]); |
||
137 | } |
||
138 | } |
||
139 | } |
||
140 | |||
141 | if (req & flags[i] & VERT_BIT_COLOR0) |
||
142 | _mesa_debug(NULL, " Rgba %f %f %f %f ", |
||
143 | IM->Attrib[VERT_ATTRIB_COLOR0][i][0], |
||
144 | IM->Attrib[VERT_ATTRIB_COLOR0][i][1], |
||
145 | IM->Attrib[VERT_ATTRIB_COLOR0][i][2], |
||
146 | IM->Attrib[VERT_ATTRIB_COLOR0][i][3]); |
||
147 | |||
148 | if (req & flags[i] & VERT_BIT_COLOR1) |
||
149 | _mesa_debug(NULL, " Spec %f %f %f ", |
||
150 | IM->Attrib[VERT_ATTRIB_COLOR1][i][0], |
||
151 | IM->Attrib[VERT_ATTRIB_COLOR1][i][1], |
||
152 | IM->Attrib[VERT_ATTRIB_COLOR1][i][2]); |
||
153 | |||
154 | if (req & flags[i] & VERT_BIT_FOG) |
||
155 | _mesa_debug(NULL, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]); |
||
156 | |||
157 | if (req & flags[i] & VERT_BIT_INDEX) |
||
158 | _mesa_debug(NULL, " Index %u ", IM->Index[i]); |
||
159 | |||
160 | if (req & flags[i] & VERT_BIT_EDGEFLAG) |
||
161 | _mesa_debug(NULL, " Edgeflag %d ", IM->EdgeFlag[i]); |
||
162 | |||
163 | if (req & flags[i] & VERT_BIT_MATERIAL) |
||
164 | _mesa_debug(NULL, " Material "); |
||
165 | |||
166 | |||
167 | /* The order of these two is not easily knowable, but this is |
||
168 | * the usually correct way to look at them. |
||
169 | */ |
||
170 | if (req & flags[i] & VERT_BIT_END) |
||
171 | _mesa_debug(NULL, " END "); |
||
172 | |||
173 | if (req & flags[i] & VERT_BIT_BEGIN) |
||
174 | _mesa_debug(NULL, " BEGIN(%s) (%s%s%s%s)", |
||
175 | _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], |
||
176 | (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", |
||
177 | (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", |
||
178 | (IM->Primitive[i] & PRIM_END) ? "END," : "", |
||
179 | (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : ""); |
||
180 | |||
181 | _mesa_debug(NULL, "\n"); |
||
182 | } |
||
183 | } |