1 /* $Id: t_imm_debug.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 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.
28 #include "t_context.h"
29 #include "t_imm_debug.h"
31 void _tnl_print_vert_flags( const char *name
, GLuint flags
)
34 "%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",
37 (flags
& VERT_CLIP
) ? "clip/proj-clip/glend, " : "",
38 (flags
& VERT_EDGE
) ? "edgeflag, " : "",
39 (flags
& VERT_ELT
) ? "array-elt, " : "",
40 (flags
& VERT_END_VB
) ? "end-vb, " : "",
41 (flags
& VERT_EVAL_ANY
) ? "eval-coord, " : "",
42 (flags
& VERT_EYE
) ? "eye/glbegin, " : "",
43 (flags
& VERT_FOG_COORD
) ? "fog-coord, " : "",
44 (flags
& VERT_INDEX
) ? "index, " : "",
45 (flags
& VERT_MATERIAL
) ? "material, " : "",
46 (flags
& VERT_NORM
) ? "normals, " : "",
47 (flags
& VERT_OBJ
) ? "obj, " : "",
48 (flags
& VERT_OBJ_3
) ? "obj-3, " : "",
49 (flags
& VERT_OBJ_4
) ? "obj-4, " : "",
50 (flags
& VERT_POINT_SIZE
) ? "point-size, " : "",
51 (flags
& VERT_RGBA
) ? "colors, " : "",
52 (flags
& VERT_SPEC_RGB
) ? "specular, " : "",
53 (flags
& VERT_TEX0
) ? "texcoord0, " : "",
54 (flags
& VERT_TEX1
) ? "texcoord1, " : "",
55 (flags
& VERT_TEX2
) ? "texcoord2, " : "",
56 (flags
& VERT_TEX3
) ? "texcoord3, " : "",
57 (flags
& VERT_TEX4
) ? "texcoord4, " : "",
58 (flags
& VERT_TEX5
) ? "texcoord5, " : "",
59 (flags
& VERT_TEX6
) ? "texcoord6, " : "",
60 (flags
& VERT_TEX7
) ? "texcoord7, " : ""
64 void _tnl_print_cassette( struct immediate
*IM
)
67 GLuint
*flags
= IM
->Flag
;
68 GLuint andflag
= IM
->CopyAndFlag
;
69 GLuint orflag
= IM
->CopyOrFlag
;
70 GLuint state
= IM
->BeginState
;
73 fprintf(stderr
, "Cassette id %d, %u rows.\n", IM
->id
,
74 IM
->Count
- IM
->CopyStart
);
76 _tnl_print_vert_flags("Contains at least one", orflag
);
78 if (IM
->Count
!= IM
->CopyStart
)
80 _tnl_print_vert_flags("Contains a full complement of", andflag
);
82 fprintf(stderr
, "Final begin/end state %s/%s, errors %s/%s\n",
83 (state
& VERT_BEGIN_0
) ? "in" : "out",
84 (state
& VERT_BEGIN_1
) ? "in" : "out",
85 (state
& VERT_ERROR_0
) ? "y" : "n",
86 (state
& VERT_ERROR_1
) ? "y" : "n");
90 for (i
= IM
->CopyStart
; i
<= IM
->Count
; i
++) {
91 fprintf(stderr
, "%u: ", i
);
92 if (req
& VERT_OBJ_234
) {
93 if (flags
[i
] & VERT_EVAL_C1
)
94 fprintf(stderr
, "EvalCoord %f ", IM
->Obj
[i
][0]);
95 else if (flags
[i
] & VERT_EVAL_P1
)
96 fprintf(stderr
, "EvalPoint %.0f ", IM
->Obj
[i
][0]);
97 else if (flags
[i
] & VERT_EVAL_C2
)
98 fprintf(stderr
, "EvalCoord %f %f ", IM
->Obj
[i
][0], IM
->Obj
[i
][1]);
99 else if (flags
[i
] & VERT_EVAL_P2
)
100 fprintf(stderr
, "EvalPoint %.0f %.0f ", IM
->Obj
[i
][0], IM
->Obj
[i
][1]);
101 else if (i
< IM
->Count
&& (flags
[i
]&VERT_OBJ_234
)) {
102 fprintf(stderr
, "Obj %f %f %f %f",
103 IM
->Obj
[i
][0], IM
->Obj
[i
][1], IM
->Obj
[i
][2], IM
->Obj
[i
][3]);
107 if (req
& flags
[i
] & VERT_ELT
)
108 fprintf(stderr
, " Elt %u\t", IM
->Elt
[i
]);
110 if (req
& flags
[i
] & VERT_NORM
)
111 fprintf(stderr
, " Norm %f %f %f ",
112 IM
->Normal
[i
][0], IM
->Normal
[i
][1], IM
->Normal
[i
][2]);
114 if (req
& flags
[i
] & VERT_TEX_ANY
) {
116 for (j
= 0 ; j
< MAX_TEXTURE_UNITS
; j
++) {
117 if (req
& flags
[i
] & VERT_TEX(j
)) {
121 IM
->TexCoord
[j
][i
][0], IM
->TexCoord
[j
][i
][1],
122 IM
->TexCoord
[j
][i
][2], IM
->TexCoord
[j
][i
][2]);
127 if (req
& flags
[i
] & VERT_RGBA
)
128 fprintf(stderr
, " Rgba %d %d %d %d ",
129 IM
->Color
[i
][0], IM
->Color
[i
][1],
130 IM
->Color
[i
][2], IM
->Color
[i
][3]);
132 if (req
& flags
[i
] & VERT_SPEC_RGB
)
133 fprintf(stderr
, " Spec %d %d %d ",
134 IM
->SecondaryColor
[i
][0], IM
->SecondaryColor
[i
][1],
135 IM
->SecondaryColor
[i
][2]);
137 if (req
& flags
[i
] & VERT_FOG_COORD
)
138 fprintf(stderr
, " Fog %f ", IM
->FogCoord
[i
]);
140 if (req
& flags
[i
] & VERT_INDEX
)
141 fprintf(stderr
, " Index %u ", IM
->Index
[i
]);
143 if (req
& flags
[i
] & VERT_EDGE
)
144 fprintf(stderr
, " Edgeflag %d ", IM
->EdgeFlag
[i
]);
146 if (req
& flags
[i
] & VERT_MATERIAL
)
147 fprintf(stderr
, " Material ");
150 /* The order of these two is not easily knowable, but this is
151 * the usually correct way to look at them.
153 if (req
& flags
[i
] & VERT_END
)
154 fprintf(stderr
, " END ");
156 if (req
& flags
[i
] & VERT_BEGIN
)
157 fprintf(stderr
, " BEGIN(%s) (%s%s%s%s)",
158 _mesa_prim_name
[IM
->Primitive
[i
] & PRIM_MODE_MASK
],
159 (IM
->Primitive
[i
] & PRIM_LAST
) ? "LAST," : "",
160 (IM
->Primitive
[i
] & PRIM_BEGIN
) ? "BEGIN," : "",
161 (IM
->Primitive
[i
] & PRIM_END
) ? "END," : "",
162 (IM
->Primitive
[i
] & PRIM_PARITY
) ? "PARITY," : "");
164 fprintf(stderr
, "\n");