1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "util/u_memory.h"
30 #include "util/u_debug.h"
31 #include "util/u_dump.h"
36 util_dump_strip_prefix(const char *name
,
44 if(*stripped
!= *prefix
)
55 util_dump_enum_continuous(unsigned value
,
59 if (value
>= num_names
)
60 return UTIL_DUMP_INVALID_NAME
;
65 #define DEFINE_UTIL_DUMP_CONTINUOUS(_name) \
67 util_dump_##_name(unsigned value, boolean shortened) \
70 return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \
72 return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \
77 util_dump_blend_factor_names
[] = {
78 UTIL_DUMP_INVALID_NAME
, /* 0x0 */
79 "PIPE_BLENDFACTOR_ONE",
80 "PIPE_BLENDFACTOR_SRC_COLOR",
81 "PIPE_BLENDFACTOR_SRC_ALPHA",
82 "PIPE_BLENDFACTOR_DST_ALPHA",
83 "PIPE_BLENDFACTOR_DST_COLOR",
84 "PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE",
85 "PIPE_BLENDFACTOR_CONST_COLOR",
86 "PIPE_BLENDFACTOR_CONST_ALPHA",
87 "PIPE_BLENDFACTOR_SRC1_COLOR",
88 "PIPE_BLENDFACTOR_SRC1_ALPHA",
89 UTIL_DUMP_INVALID_NAME
, /* 0x0b */
90 UTIL_DUMP_INVALID_NAME
, /* 0x0c */
91 UTIL_DUMP_INVALID_NAME
, /* 0x0d */
92 UTIL_DUMP_INVALID_NAME
, /* 0x0e */
93 UTIL_DUMP_INVALID_NAME
, /* 0x0f */
94 UTIL_DUMP_INVALID_NAME
, /* 0x10 */
95 "PIPE_BLENDFACTOR_ZERO",
96 "PIPE_BLENDFACTOR_INV_SRC_COLOR",
97 "PIPE_BLENDFACTOR_INV_SRC_ALPHA",
98 "PIPE_BLENDFACTOR_INV_DST_ALPHA",
99 "PIPE_BLENDFACTOR_INV_DST_COLOR",
100 UTIL_DUMP_INVALID_NAME
, /* 0x16 */
101 "PIPE_BLENDFACTOR_INV_CONST_COLOR",
102 "PIPE_BLENDFACTOR_INV_CONST_ALPHA",
103 "PIPE_BLENDFACTOR_INV_SRC1_COLOR",
104 "PIPE_BLENDFACTOR_INV_SRC1_ALPHA"
108 util_dump_blend_factor_short_names
[] = {
109 UTIL_DUMP_INVALID_NAME
, /* 0x0 */
115 "src_alpha_saturate",
120 UTIL_DUMP_INVALID_NAME
, /* 0x0b */
121 UTIL_DUMP_INVALID_NAME
, /* 0x0c */
122 UTIL_DUMP_INVALID_NAME
, /* 0x0d */
123 UTIL_DUMP_INVALID_NAME
, /* 0x0e */
124 UTIL_DUMP_INVALID_NAME
, /* 0x0f */
125 UTIL_DUMP_INVALID_NAME
, /* 0x10 */
131 UTIL_DUMP_INVALID_NAME
, /* 0x16 */
138 DEFINE_UTIL_DUMP_CONTINUOUS(blend_factor
)
142 util_dump_blend_func_names
[] = {
144 "PIPE_BLEND_SUBTRACT",
145 "PIPE_BLEND_REVERSE_SUBTRACT",
151 util_dump_blend_func_short_names
[] = {
159 DEFINE_UTIL_DUMP_CONTINUOUS(blend_func
)
163 util_dump_logicop_names
[] = {
164 "PIPE_LOGICOP_CLEAR",
166 "PIPE_LOGICOP_AND_INVERTED",
167 "PIPE_LOGICOP_COPY_INVERTED",
168 "PIPE_LOGICOP_AND_REVERSE",
169 "PIPE_LOGICOP_INVERT",
173 "PIPE_LOGICOP_EQUIV",
175 "PIPE_LOGICOP_OR_INVERTED",
177 "PIPE_LOGICOP_OR_REVERSE",
183 util_dump_logicop_short_names
[] = {
202 DEFINE_UTIL_DUMP_CONTINUOUS(logicop
)
206 util_dump_func_names
[] = {
212 "PIPE_FUNC_NOTEQUAL",
218 util_dump_func_short_names
[] = {
229 DEFINE_UTIL_DUMP_CONTINUOUS(func
)
233 util_dump_stencil_op_names
[] = {
234 "PIPE_STENCIL_OP_KEEP",
235 "PIPE_STENCIL_OP_ZERO",
236 "PIPE_STENCIL_OP_REPLACE",
237 "PIPE_STENCIL_OP_INCR",
238 "PIPE_STENCIL_OP_DECR",
239 "PIPE_STENCIL_OP_INCR_WRAP",
240 "PIPE_STENCIL_OP_DECR_WRAP",
241 "PIPE_STENCIL_OP_INVERT"
245 util_dump_stencil_op_short_names
[] = {
256 DEFINE_UTIL_DUMP_CONTINUOUS(stencil_op
)
260 util_dump_tex_target_names
[] = {
269 util_dump_tex_target_short_names
[] = {
277 DEFINE_UTIL_DUMP_CONTINUOUS(tex_target
)
281 util_dump_tex_wrap_names
[] = {
282 "PIPE_TEX_WRAP_REPEAT",
283 "PIPE_TEX_WRAP_CLAMP",
284 "PIPE_TEX_WRAP_CLAMP_TO_EDGE",
285 "PIPE_TEX_WRAP_CLAMP_TO_BORDER",
286 "PIPE_TEX_WRAP_MIRROR_REPEAT",
287 "PIPE_TEX_WRAP_MIRROR_CLAMP",
288 "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE",
289 "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER"
293 util_dump_tex_wrap_short_names
[] = {
300 "mirror_clamp_to_edge",
301 "mirror_clamp_to_border"
304 DEFINE_UTIL_DUMP_CONTINUOUS(tex_wrap
)
308 util_dump_tex_mipfilter_names
[] = {
309 "PIPE_TEX_MIPFILTER_NEAREST",
310 "PIPE_TEX_MIPFILTER_LINEAR",
311 "PIPE_TEX_MIPFILTER_NONE"
315 util_dump_tex_mipfilter_short_names
[] = {
321 DEFINE_UTIL_DUMP_CONTINUOUS(tex_mipfilter
)
325 util_dump_tex_filter_names
[] = {
326 "PIPE_TEX_FILTER_NEAREST",
327 "PIPE_TEX_FILTER_LINEAR"
331 util_dump_tex_filter_short_names
[] = {
336 DEFINE_UTIL_DUMP_CONTINUOUS(tex_filter
)