1 /* $Id: t_imm_debug.c,v 1.8 2002/06/29 19:48:17 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
29 #include "t_context.h"
30 #include "t_imm_debug.h"
32 void _tnl_print_vert_flags( const char *name
, GLuint flags
)
35 "%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 (flags
& VERT_BIT_CLIP
) ? "clip/proj-clip/glend, " : "",
39 (flags
& VERT_BIT_EDGEFLAG
) ? "edgeflag, " : "",
40 (flags
& VERT_BIT_ELT
) ? "array-elt, " : "",
41 (flags
& VERT_BIT_END_VB
) ? "end-vb, " : "",
42 (flags
& VERT_BITS_EVAL_ANY
) ? "eval-coord, " : "",
43 (flags
& VERT_BIT_EYE
) ? "eye/glbegin, " : "",
44 (flags
& VERT_BIT_FOG
) ? "fog-coord, " : "",
45 (flags
& VERT_BIT_INDEX
) ? "index, " : "",
46 (flags
& VERT_BIT_MATERIAL
) ? "material, " : "",
47 (flags
& VERT_BIT_NORMAL
) ? "normals, " : "",
48 (flags
& VERT_BIT_POS
) ? "obj, " : "",
49 (flags
& VERT_BIT_OBJ_3
) ? "obj-3, " : "",
50 (flags
& VERT_BIT_OBJ_4
) ? "obj-4, " : "",
51 (flags
& VERT_BIT_POINT_SIZE
) ? "point-size, " : "",
52 (flags
& VERT_BIT_COLOR0
) ? "colors, " : "",
53 (flags
& VERT_BIT_COLOR1
) ? "specular, " : "",
54 (flags
& VERT_BIT_TEX0
) ? "texcoord0, " : "",
55 (flags
& VERT_BIT_TEX1
) ? "texcoord1, " : "",
56 (flags
& VERT_BIT_TEX2
) ? "texcoord2, " : "",
57 (flags
& VERT_BIT_TEX3
) ? "texcoord3, " : "",
58 (flags
& VERT_BIT_TEX4
) ? "texcoord4, " : "",
59 (flags
& VERT_BIT_TEX5
) ? "texcoord5, " : "",
60 (flags
& VERT_BIT_TEX6
) ? "texcoord6, " : "",
61 (flags
& VERT_BIT_TEX7
) ? "texcoord7, " : ""
65 void _tnl_print_cassette( struct immediate
*IM
)
68 GLuint
*flags
= IM
->Flag
;
69 GLuint andflag
= IM
->CopyAndFlag
;
70 GLuint orflag
= (IM
->CopyOrFlag
|IM
->Evaluated
);
71 GLuint state
= IM
->BeginState
;
74 _mesa_debug(NULL
, "Cassette id %d, %u rows.\n", IM
->id
,
75 IM
->Count
- IM
->CopyStart
);
77 _tnl_print_vert_flags("Contains at least one", orflag
);
79 if (IM
->Count
!= IM
->CopyStart
)
81 _tnl_print_vert_flags("Contains a full complement of", andflag
);
83 _mesa_debug(NULL
, "Final begin/end state %s/%s, errors %s/%s\n",
84 (state
& VERT_BEGIN_0
) ? "in" : "out",
85 (state
& VERT_BEGIN_1
) ? "in" : "out",
86 (state
& VERT_ERROR_0
) ? "y" : "n",
87 (state
& VERT_ERROR_1
) ? "y" : "n");
91 for (i
= IM
->CopyStart
; i
<= IM
->Count
; i
++) {
92 _mesa_debug(NULL
, "%u: ", i
);
93 if (req
& VERT_BITS_OBJ_234
) {
94 if (flags
[i
] & VERT_BIT_EVAL_C1
)
95 _mesa_debug(NULL
, "EvalCoord %f ",
96 IM
->Attrib
[VERT_ATTRIB_POS
][i
][0]);
97 else if (flags
[i
] & VERT_BIT_EVAL_P1
)
98 _mesa_debug(NULL
, "EvalPoint %.0f ",
99 IM
->Attrib
[VERT_ATTRIB_POS
][i
][0]);
100 else if (flags
[i
] & VERT_BIT_EVAL_C2
)
101 _mesa_debug(NULL
, "EvalCoord %f %f ",
102 IM
->Attrib
[VERT_ATTRIB_POS
][i
][0],
103 IM
->Attrib
[VERT_ATTRIB_POS
][i
][1]);
104 else if (flags
[i
] & VERT_BIT_EVAL_P2
)
105 _mesa_debug(NULL
, "EvalPoint %.0f %.0f ",
106 IM
->Attrib
[VERT_ATTRIB_POS
][i
][0],
107 IM
->Attrib
[VERT_ATTRIB_POS
][i
][1]);
108 else if (i
< IM
->Count
&& (flags
[i
] & VERT_BITS_OBJ_234
)) {
109 _mesa_debug(NULL
, "Obj %f %f %f %f",
110 IM
->Attrib
[VERT_ATTRIB_POS
][i
][0],
111 IM
->Attrib
[VERT_ATTRIB_POS
][i
][1],
112 IM
->Attrib
[VERT_ATTRIB_POS
][i
][2],
113 IM
->Attrib
[VERT_ATTRIB_POS
][i
][3]);
117 if (req
& flags
[i
] & VERT_BIT_ELT
)
118 _mesa_debug(NULL
, " Elt %u\t", IM
->Elt
[i
]);
120 if (req
& flags
[i
] & VERT_BIT_NORMAL
)
121 _mesa_debug(NULL
, " Norm %f %f %f ",
122 IM
->Attrib
[VERT_ATTRIB_NORMAL
][i
][0],
123 IM
->Attrib
[VERT_ATTRIB_NORMAL
][i
][1],
124 IM
->Attrib
[VERT_ATTRIB_NORMAL
][i
][2]);
126 if (req
& flags
[i
] & VERT_BITS_TEX_ANY
) {
128 for (j
= 0 ; j
< MAX_TEXTURE_UNITS
; j
++) {
129 if (req
& flags
[i
] & VERT_BIT_TEX(j
)) {
130 _mesa_debug(NULL
, "TC%d %f %f %f %f", j
,
131 IM
->Attrib
[VERT_ATTRIB_TEX0
+ j
][i
][0],
132 IM
->Attrib
[VERT_ATTRIB_TEX0
+ j
][i
][1],
133 IM
->Attrib
[VERT_ATTRIB_TEX0
+ j
][i
][2],
134 IM
->Attrib
[VERT_ATTRIB_TEX0
+ j
][i
][3]);
139 if (req
& flags
[i
] & VERT_BIT_COLOR0
)
140 _mesa_debug(NULL
, " Rgba %f %f %f %f ",
141 IM
->Attrib
[VERT_ATTRIB_COLOR0
][i
][0],
142 IM
->Attrib
[VERT_ATTRIB_COLOR0
][i
][1],
143 IM
->Attrib
[VERT_ATTRIB_COLOR0
][i
][2],
144 IM
->Attrib
[VERT_ATTRIB_COLOR0
][i
][3]);
146 if (req
& flags
[i
] & VERT_BIT_COLOR1
)
147 _mesa_debug(NULL
, " Spec %f %f %f ",
148 IM
->Attrib
[VERT_ATTRIB_COLOR1
][i
][0],
149 IM
->Attrib
[VERT_ATTRIB_COLOR1
][i
][1],
150 IM
->Attrib
[VERT_ATTRIB_COLOR1
][i
][2]);
152 if (req
& flags
[i
] & VERT_BIT_FOG
)
153 _mesa_debug(NULL
, " Fog %f ", IM
->Attrib
[VERT_ATTRIB_FOG
][i
][0]);
155 if (req
& flags
[i
] & VERT_BIT_INDEX
)
156 _mesa_debug(NULL
, " Index %u ", IM
->Index
[i
]);
158 if (req
& flags
[i
] & VERT_BIT_EDGEFLAG
)
159 _mesa_debug(NULL
, " Edgeflag %d ", IM
->EdgeFlag
[i
]);
161 if (req
& flags
[i
] & VERT_BIT_MATERIAL
)
162 _mesa_debug(NULL
, " Material ");
165 /* The order of these two is not easily knowable, but this is
166 * the usually correct way to look at them.
168 if (req
& flags
[i
] & VERT_BIT_END
)
169 _mesa_debug(NULL
, " END ");
171 if (req
& flags
[i
] & VERT_BIT_BEGIN
)
172 _mesa_debug(NULL
, " BEGIN(%s) (%s%s%s%s)",
173 _mesa_prim_name
[IM
->Primitive
[i
] & PRIM_MODE_MASK
],
174 (IM
->Primitive
[i
] & PRIM_LAST
) ? "LAST," : "",
175 (IM
->Primitive
[i
] & PRIM_BEGIN
) ? "BEGIN," : "",
176 (IM
->Primitive
[i
] & PRIM_END
) ? "END," : "",
177 (IM
->Primitive
[i
] & PRIM_PARITY
) ? "PARITY," : "");
179 _mesa_debug(NULL
, "\n");