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_debug_dump.h"
34 #define DEBUG_DUMP_INVALID_NAME "<invalid>"
39 debug_dump_strip_prefix(const char *name
,
47 if(*stripped
!= *prefix
)
58 debug_dump_enum_continuous(unsigned value
,
62 if (value
>= num_names
)
63 return DEBUG_DUMP_INVALID_NAME
;
68 #define DEFINE_DEBUG_DUMP_CONTINUOUS(_name) \
70 debug_dump_##_name(unsigned value, boolean shortened) \
73 return debug_dump_enum_continuous(value, Elements(debug_dump_##_name##_short_names), debug_dump_##_name##_short_names); \
75 return debug_dump_enum_continuous(value, Elements(debug_dump_##_name##_names), debug_dump_##_name##_names); \
80 debug_dump_blend_factor_names
[] = {
81 DEBUG_DUMP_INVALID_NAME
, /* 0x0 */
82 "PIPE_BLENDFACTOR_ONE",
83 "PIPE_BLENDFACTOR_SRC_COLOR",
84 "PIPE_BLENDFACTOR_SRC_ALPHA",
85 "PIPE_BLENDFACTOR_DST_ALPHA",
86 "PIPE_BLENDFACTOR_DST_COLOR",
87 "PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE",
88 "PIPE_BLENDFACTOR_CONST_COLOR",
89 "PIPE_BLENDFACTOR_CONST_ALPHA",
90 "PIPE_BLENDFACTOR_SRC1_COLOR",
91 "PIPE_BLENDFACTOR_SRC1_ALPHA",
92 DEBUG_DUMP_INVALID_NAME
, /* 0x0b */
93 DEBUG_DUMP_INVALID_NAME
, /* 0x0c */
94 DEBUG_DUMP_INVALID_NAME
, /* 0x0d */
95 DEBUG_DUMP_INVALID_NAME
, /* 0x0e */
96 DEBUG_DUMP_INVALID_NAME
, /* 0x0f */
97 DEBUG_DUMP_INVALID_NAME
, /* 0x10 */
98 "PIPE_BLENDFACTOR_ZERO",
99 "PIPE_BLENDFACTOR_INV_SRC_COLOR",
100 "PIPE_BLENDFACTOR_INV_SRC_ALPHA",
101 "PIPE_BLENDFACTOR_INV_DST_ALPHA",
102 "PIPE_BLENDFACTOR_INV_DST_COLOR",
103 DEBUG_DUMP_INVALID_NAME
, /* 0x16 */
104 "PIPE_BLENDFACTOR_INV_CONST_COLOR",
105 "PIPE_BLENDFACTOR_INV_CONST_ALPHA",
106 "PIPE_BLENDFACTOR_INV_SRC1_COLOR",
107 "PIPE_BLENDFACTOR_INV_SRC1_ALPHA"
111 debug_dump_blend_factor_short_names
[] = {
112 DEBUG_DUMP_INVALID_NAME
, /* 0x0 */
118 "src_alpha_saturate",
123 DEBUG_DUMP_INVALID_NAME
, /* 0x0b */
124 DEBUG_DUMP_INVALID_NAME
, /* 0x0c */
125 DEBUG_DUMP_INVALID_NAME
, /* 0x0d */
126 DEBUG_DUMP_INVALID_NAME
, /* 0x0e */
127 DEBUG_DUMP_INVALID_NAME
, /* 0x0f */
128 DEBUG_DUMP_INVALID_NAME
, /* 0x10 */
134 DEBUG_DUMP_INVALID_NAME
, /* 0x16 */
141 DEFINE_DEBUG_DUMP_CONTINUOUS(blend_factor
)
145 debug_dump_blend_func_names
[] = {
147 "PIPE_BLEND_SUBTRACT",
148 "PIPE_BLEND_REVERSE_SUBTRACT",
154 debug_dump_blend_func_short_names
[] = {
162 DEFINE_DEBUG_DUMP_CONTINUOUS(blend_func
)
166 debug_dump_func_names
[] = {
172 "PIPE_FUNC_NOTEQUAL",
178 debug_dump_func_short_names
[] = {
189 DEFINE_DEBUG_DUMP_CONTINUOUS(func
)
193 debug_dump_tex_target_names
[] = {
201 debug_dump_tex_target_short_names
[] = {
208 DEFINE_DEBUG_DUMP_CONTINUOUS(tex_target
)
212 debug_dump_tex_wrap_names
[] = {
213 "PIPE_TEX_WRAP_REPEAT",
214 "PIPE_TEX_WRAP_CLAMP",
215 "PIPE_TEX_WRAP_CLAMP_TO_EDGE",
216 "PIPE_TEX_WRAP_CLAMP_TO_BORDER",
217 "PIPE_TEX_WRAP_MIRROR_REPEAT",
218 "PIPE_TEX_WRAP_MIRROR_CLAMP",
219 "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE",
220 "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER"
224 debug_dump_tex_wrap_short_names
[] = {
231 "mirror_clamp_to_edge",
232 "mirror_clamp_to_border"
235 DEFINE_DEBUG_DUMP_CONTINUOUS(tex_wrap
)
239 debug_dump_tex_mipfilter_names
[] = {
240 "PIPE_TEX_MIPFILTER_NEAREST",
241 "PIPE_TEX_MIPFILTER_LINEAR",
242 "PIPE_TEX_MIPFILTER_NONE"
246 debug_dump_tex_mipfilter_short_names
[] = {
252 DEFINE_DEBUG_DUMP_CONTINUOUS(tex_mipfilter
)
256 debug_dump_tex_filter_names
[] = {
257 "PIPE_TEX_FILTER_NEAREST",
258 "PIPE_TEX_FILTER_LINEAR"
262 debug_dump_tex_filter_short_names
[] = {
267 DEFINE_DEBUG_DUMP_CONTINUOUS(tex_filter
)