1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2009 VMware, Inc. 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci#include "util/u_memory.h" 30bf215546Sopenharmony_ci#include "util/u_debug.h" 31bf215546Sopenharmony_ci#include "util/u_dump.h" 32bf215546Sopenharmony_ci#include "util/u_math.h" 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ci#if 0 36bf215546Sopenharmony_cistatic const char * 37bf215546Sopenharmony_ciutil_dump_strip_prefix(const char *name, 38bf215546Sopenharmony_ci const char *prefix) 39bf215546Sopenharmony_ci{ 40bf215546Sopenharmony_ci const char *stripped; 41bf215546Sopenharmony_ci assert(name); 42bf215546Sopenharmony_ci assert(prefix); 43bf215546Sopenharmony_ci stripped = name; 44bf215546Sopenharmony_ci while(*prefix) { 45bf215546Sopenharmony_ci if(*stripped != *prefix) 46bf215546Sopenharmony_ci return name; 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_ci ++stripped; 49bf215546Sopenharmony_ci ++prefix; 50bf215546Sopenharmony_ci } 51bf215546Sopenharmony_ci return stripped; 52bf215546Sopenharmony_ci} 53bf215546Sopenharmony_ci#endif 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_cistatic const char * 56bf215546Sopenharmony_ciutil_dump_enum_continuous(unsigned value, 57bf215546Sopenharmony_ci unsigned num_names, 58bf215546Sopenharmony_ci const char **names) 59bf215546Sopenharmony_ci{ 60bf215546Sopenharmony_ci if (value >= num_names) 61bf215546Sopenharmony_ci return UTIL_DUMP_INVALID_NAME; 62bf215546Sopenharmony_ci return names[value]; 63bf215546Sopenharmony_ci} 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_ci#define DEFINE_UTIL_STR_CONTINUOUS(_name) \ 67bf215546Sopenharmony_ci const char * \ 68bf215546Sopenharmony_ci util_str_##_name(unsigned value, boolean shortened) \ 69bf215546Sopenharmony_ci { \ 70bf215546Sopenharmony_ci if(shortened) \ 71bf215546Sopenharmony_ci return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_short_names), util_##_name##_short_names); \ 72bf215546Sopenharmony_ci else \ 73bf215546Sopenharmony_ci return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_names), util_##_name##_names); \ 74bf215546Sopenharmony_ci } 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci/** 78bf215546Sopenharmony_ci * Same as DEFINE_UTIL_STR_CONTINUOUS but with static assertions to detect 79bf215546Sopenharmony_ci * failures to update lists. 80bf215546Sopenharmony_ci */ 81bf215546Sopenharmony_ci#define DEFINE_UTIL_STR_CONTINUOUS_COUNT(_name, _count) \ 82bf215546Sopenharmony_ci const char * \ 83bf215546Sopenharmony_ci util_str_##_name(unsigned value, boolean shortened) \ 84bf215546Sopenharmony_ci { \ 85bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(util_##_name##_names) == _count); \ 86bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(util_##_name##_short_names) == _count); \ 87bf215546Sopenharmony_ci if(shortened) \ 88bf215546Sopenharmony_ci return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_short_names), util_##_name##_short_names); \ 89bf215546Sopenharmony_ci else \ 90bf215546Sopenharmony_ci return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_names), util_##_name##_names); \ 91bf215546Sopenharmony_ci } 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_cistatic void 94bf215546Sopenharmony_ciutil_dump_flags_continuous(FILE *stream, unsigned value, unsigned num_names, 95bf215546Sopenharmony_ci const char * const *names) 96bf215546Sopenharmony_ci{ 97bf215546Sopenharmony_ci unsigned unknown = 0; 98bf215546Sopenharmony_ci bool first = true; 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci while (value) { 101bf215546Sopenharmony_ci int i = u_bit_scan(&value); 102bf215546Sopenharmony_ci if (i >= (int)num_names || !names[i]) 103bf215546Sopenharmony_ci unknown |= 1u << i; 104bf215546Sopenharmony_ci if (!first) 105bf215546Sopenharmony_ci fputs("|", stream); 106bf215546Sopenharmony_ci fputs(names[i], stream); 107bf215546Sopenharmony_ci first = false; 108bf215546Sopenharmony_ci } 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_ci if (unknown) { 111bf215546Sopenharmony_ci if (!first) 112bf215546Sopenharmony_ci fputs("|", stream); 113bf215546Sopenharmony_ci fprintf(stream, "%x", unknown); 114bf215546Sopenharmony_ci first = false; 115bf215546Sopenharmony_ci } 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci if (first) 118bf215546Sopenharmony_ci fputs("0", stream); 119bf215546Sopenharmony_ci} 120bf215546Sopenharmony_ci 121bf215546Sopenharmony_ci#define DEFINE_UTIL_DUMP_FLAGS_CONTINUOUS(_name) \ 122bf215546Sopenharmony_civoid \ 123bf215546Sopenharmony_ciutil_dump_##_name(FILE *stream, unsigned value) \ 124bf215546Sopenharmony_ci{ \ 125bf215546Sopenharmony_ci util_dump_flags_continuous(stream, value, ARRAY_SIZE(util_##_name##_names), \ 126bf215546Sopenharmony_ci util_##_name##_names); \ 127bf215546Sopenharmony_ci} 128bf215546Sopenharmony_ci 129bf215546Sopenharmony_cistatic const char * 130bf215546Sopenharmony_ciutil_blend_factor_names[] = { 131bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0 */ 132bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_ONE", 133bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_SRC_COLOR", 134bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_SRC_ALPHA", 135bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_DST_ALPHA", 136bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_DST_COLOR", 137bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE", 138bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_CONST_COLOR", 139bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_CONST_ALPHA", 140bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_SRC1_COLOR", 141bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_SRC1_ALPHA", 142bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0b */ 143bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0c */ 144bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0d */ 145bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0e */ 146bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0f */ 147bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x10 */ 148bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_ZERO", 149bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_SRC_COLOR", 150bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_SRC_ALPHA", 151bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_DST_ALPHA", 152bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_DST_COLOR", 153bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x16 */ 154bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_CONST_COLOR", 155bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_CONST_ALPHA", 156bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_SRC1_COLOR", 157bf215546Sopenharmony_ci "PIPE_BLENDFACTOR_INV_SRC1_ALPHA" 158bf215546Sopenharmony_ci}; 159bf215546Sopenharmony_ci 160bf215546Sopenharmony_cistatic const char * 161bf215546Sopenharmony_ciutil_blend_factor_short_names[] = { 162bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0 */ 163bf215546Sopenharmony_ci "one", 164bf215546Sopenharmony_ci "src_color", 165bf215546Sopenharmony_ci "src_alpha", 166bf215546Sopenharmony_ci "dst_alpha", 167bf215546Sopenharmony_ci "dst_color", 168bf215546Sopenharmony_ci "src_alpha_saturate", 169bf215546Sopenharmony_ci "const_color", 170bf215546Sopenharmony_ci "const_alpha", 171bf215546Sopenharmony_ci "src1_color", 172bf215546Sopenharmony_ci "src1_alpha", 173bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0b */ 174bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0c */ 175bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0d */ 176bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0e */ 177bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x0f */ 178bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x10 */ 179bf215546Sopenharmony_ci "zero", 180bf215546Sopenharmony_ci "inv_src_color", 181bf215546Sopenharmony_ci "inv_src_alpha", 182bf215546Sopenharmony_ci "inv_dst_alpha", 183bf215546Sopenharmony_ci "inv_dst_color", 184bf215546Sopenharmony_ci UTIL_DUMP_INVALID_NAME, /* 0x16 */ 185bf215546Sopenharmony_ci "inv_const_color", 186bf215546Sopenharmony_ci "inv_const_alpha", 187bf215546Sopenharmony_ci "inv_src1_color", 188bf215546Sopenharmony_ci "inv_src1_alpha" 189bf215546Sopenharmony_ci}; 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(blend_factor) 192bf215546Sopenharmony_ci 193bf215546Sopenharmony_ci 194bf215546Sopenharmony_cistatic const char * 195bf215546Sopenharmony_ciutil_blend_func_names[] = { 196bf215546Sopenharmony_ci "PIPE_BLEND_ADD", 197bf215546Sopenharmony_ci "PIPE_BLEND_SUBTRACT", 198bf215546Sopenharmony_ci "PIPE_BLEND_REVERSE_SUBTRACT", 199bf215546Sopenharmony_ci "PIPE_BLEND_MIN", 200bf215546Sopenharmony_ci "PIPE_BLEND_MAX" 201bf215546Sopenharmony_ci}; 202bf215546Sopenharmony_ci 203bf215546Sopenharmony_cistatic const char * 204bf215546Sopenharmony_ciutil_blend_func_short_names[] = { 205bf215546Sopenharmony_ci "add", 206bf215546Sopenharmony_ci "sub", 207bf215546Sopenharmony_ci "rev_sub", 208bf215546Sopenharmony_ci "min", 209bf215546Sopenharmony_ci "max" 210bf215546Sopenharmony_ci}; 211bf215546Sopenharmony_ci 212bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(blend_func) 213bf215546Sopenharmony_ci 214bf215546Sopenharmony_ci 215bf215546Sopenharmony_cistatic const char * 216bf215546Sopenharmony_ciutil_logicop_names[] = { 217bf215546Sopenharmony_ci "PIPE_LOGICOP_CLEAR", 218bf215546Sopenharmony_ci "PIPE_LOGICOP_NOR", 219bf215546Sopenharmony_ci "PIPE_LOGICOP_AND_INVERTED", 220bf215546Sopenharmony_ci "PIPE_LOGICOP_COPY_INVERTED", 221bf215546Sopenharmony_ci "PIPE_LOGICOP_AND_REVERSE", 222bf215546Sopenharmony_ci "PIPE_LOGICOP_INVERT", 223bf215546Sopenharmony_ci "PIPE_LOGICOP_XOR", 224bf215546Sopenharmony_ci "PIPE_LOGICOP_NAND", 225bf215546Sopenharmony_ci "PIPE_LOGICOP_AND", 226bf215546Sopenharmony_ci "PIPE_LOGICOP_EQUIV", 227bf215546Sopenharmony_ci "PIPE_LOGICOP_NOOP", 228bf215546Sopenharmony_ci "PIPE_LOGICOP_OR_INVERTED", 229bf215546Sopenharmony_ci "PIPE_LOGICOP_COPY", 230bf215546Sopenharmony_ci "PIPE_LOGICOP_OR_REVERSE", 231bf215546Sopenharmony_ci "PIPE_LOGICOP_OR", 232bf215546Sopenharmony_ci "PIPE_LOGICOP_SET" 233bf215546Sopenharmony_ci}; 234bf215546Sopenharmony_ci 235bf215546Sopenharmony_cistatic const char * 236bf215546Sopenharmony_ciutil_logicop_short_names[] = { 237bf215546Sopenharmony_ci "clear", 238bf215546Sopenharmony_ci "nor", 239bf215546Sopenharmony_ci "and_inverted", 240bf215546Sopenharmony_ci "copy_inverted", 241bf215546Sopenharmony_ci "and_reverse", 242bf215546Sopenharmony_ci "invert", 243bf215546Sopenharmony_ci "xor", 244bf215546Sopenharmony_ci "nand", 245bf215546Sopenharmony_ci "and", 246bf215546Sopenharmony_ci "equiv", 247bf215546Sopenharmony_ci "noop", 248bf215546Sopenharmony_ci "or_inverted", 249bf215546Sopenharmony_ci "copy", 250bf215546Sopenharmony_ci "or_reverse", 251bf215546Sopenharmony_ci "or", 252bf215546Sopenharmony_ci "set" 253bf215546Sopenharmony_ci}; 254bf215546Sopenharmony_ci 255bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(logicop) 256bf215546Sopenharmony_ci 257bf215546Sopenharmony_ci 258bf215546Sopenharmony_cistatic const char * 259bf215546Sopenharmony_ciutil_func_names[] = { 260bf215546Sopenharmony_ci "PIPE_FUNC_NEVER", 261bf215546Sopenharmony_ci "PIPE_FUNC_LESS", 262bf215546Sopenharmony_ci "PIPE_FUNC_EQUAL", 263bf215546Sopenharmony_ci "PIPE_FUNC_LEQUAL", 264bf215546Sopenharmony_ci "PIPE_FUNC_GREATER", 265bf215546Sopenharmony_ci "PIPE_FUNC_NOTEQUAL", 266bf215546Sopenharmony_ci "PIPE_FUNC_GEQUAL", 267bf215546Sopenharmony_ci "PIPE_FUNC_ALWAYS" 268bf215546Sopenharmony_ci}; 269bf215546Sopenharmony_ci 270bf215546Sopenharmony_cistatic const char * 271bf215546Sopenharmony_ciutil_func_short_names[] = { 272bf215546Sopenharmony_ci "never", 273bf215546Sopenharmony_ci "less", 274bf215546Sopenharmony_ci "equal", 275bf215546Sopenharmony_ci "less_equal", 276bf215546Sopenharmony_ci "greater", 277bf215546Sopenharmony_ci "not_equal", 278bf215546Sopenharmony_ci "greater_equal", 279bf215546Sopenharmony_ci "always" 280bf215546Sopenharmony_ci}; 281bf215546Sopenharmony_ci 282bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(func) 283bf215546Sopenharmony_ci 284bf215546Sopenharmony_ci 285bf215546Sopenharmony_cistatic const char * 286bf215546Sopenharmony_ciutil_stencil_op_names[] = { 287bf215546Sopenharmony_ci "PIPE_STENCIL_OP_KEEP", 288bf215546Sopenharmony_ci "PIPE_STENCIL_OP_ZERO", 289bf215546Sopenharmony_ci "PIPE_STENCIL_OP_REPLACE", 290bf215546Sopenharmony_ci "PIPE_STENCIL_OP_INCR", 291bf215546Sopenharmony_ci "PIPE_STENCIL_OP_DECR", 292bf215546Sopenharmony_ci "PIPE_STENCIL_OP_INCR_WRAP", 293bf215546Sopenharmony_ci "PIPE_STENCIL_OP_DECR_WRAP", 294bf215546Sopenharmony_ci "PIPE_STENCIL_OP_INVERT" 295bf215546Sopenharmony_ci}; 296bf215546Sopenharmony_ci 297bf215546Sopenharmony_cistatic const char * 298bf215546Sopenharmony_ciutil_stencil_op_short_names[] = { 299bf215546Sopenharmony_ci "keep", 300bf215546Sopenharmony_ci "zero", 301bf215546Sopenharmony_ci "replace", 302bf215546Sopenharmony_ci "incr", 303bf215546Sopenharmony_ci "decr", 304bf215546Sopenharmony_ci "incr_wrap", 305bf215546Sopenharmony_ci "decr_wrap", 306bf215546Sopenharmony_ci "invert" 307bf215546Sopenharmony_ci}; 308bf215546Sopenharmony_ci 309bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(stencil_op) 310bf215546Sopenharmony_ci 311bf215546Sopenharmony_ci 312bf215546Sopenharmony_cistatic const char * 313bf215546Sopenharmony_ciutil_tex_target_names[] = { 314bf215546Sopenharmony_ci "PIPE_BUFFER", 315bf215546Sopenharmony_ci "PIPE_TEXTURE_1D", 316bf215546Sopenharmony_ci "PIPE_TEXTURE_2D", 317bf215546Sopenharmony_ci "PIPE_TEXTURE_3D", 318bf215546Sopenharmony_ci "PIPE_TEXTURE_CUBE", 319bf215546Sopenharmony_ci "PIPE_TEXTURE_RECT", 320bf215546Sopenharmony_ci "PIPE_TEXTURE_1D_ARRAY", 321bf215546Sopenharmony_ci "PIPE_TEXTURE_2D_ARRAY", 322bf215546Sopenharmony_ci "PIPE_TEXTURE_CUBE_ARRAY", 323bf215546Sopenharmony_ci}; 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_cistatic const char * 326bf215546Sopenharmony_ciutil_tex_target_short_names[] = { 327bf215546Sopenharmony_ci "buffer", 328bf215546Sopenharmony_ci "1d", 329bf215546Sopenharmony_ci "2d", 330bf215546Sopenharmony_ci "3d", 331bf215546Sopenharmony_ci "cube", 332bf215546Sopenharmony_ci "rect", 333bf215546Sopenharmony_ci "1d_array", 334bf215546Sopenharmony_ci "2d_array", 335bf215546Sopenharmony_ci "cube_array", 336bf215546Sopenharmony_ci}; 337bf215546Sopenharmony_ci 338bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS_COUNT(tex_target, PIPE_MAX_TEXTURE_TYPES) 339bf215546Sopenharmony_ci 340bf215546Sopenharmony_ci 341bf215546Sopenharmony_cistatic const char * 342bf215546Sopenharmony_ciutil_tex_wrap_names[] = { 343bf215546Sopenharmony_ci "PIPE_TEX_WRAP_REPEAT", 344bf215546Sopenharmony_ci "PIPE_TEX_WRAP_CLAMP", 345bf215546Sopenharmony_ci "PIPE_TEX_WRAP_CLAMP_TO_EDGE", 346bf215546Sopenharmony_ci "PIPE_TEX_WRAP_CLAMP_TO_BORDER", 347bf215546Sopenharmony_ci "PIPE_TEX_WRAP_MIRROR_REPEAT", 348bf215546Sopenharmony_ci "PIPE_TEX_WRAP_MIRROR_CLAMP", 349bf215546Sopenharmony_ci "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE", 350bf215546Sopenharmony_ci "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER" 351bf215546Sopenharmony_ci}; 352bf215546Sopenharmony_ci 353bf215546Sopenharmony_cistatic const char * 354bf215546Sopenharmony_ciutil_tex_wrap_short_names[] = { 355bf215546Sopenharmony_ci "repeat", 356bf215546Sopenharmony_ci "clamp", 357bf215546Sopenharmony_ci "clamp_to_edge", 358bf215546Sopenharmony_ci "clamp_to_border", 359bf215546Sopenharmony_ci "mirror_repeat", 360bf215546Sopenharmony_ci "mirror_clamp", 361bf215546Sopenharmony_ci "mirror_clamp_to_edge", 362bf215546Sopenharmony_ci "mirror_clamp_to_border" 363bf215546Sopenharmony_ci}; 364bf215546Sopenharmony_ci 365bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(tex_wrap) 366bf215546Sopenharmony_ci 367bf215546Sopenharmony_ci 368bf215546Sopenharmony_cistatic const char * 369bf215546Sopenharmony_ciutil_tex_mipfilter_names[] = { 370bf215546Sopenharmony_ci "PIPE_TEX_MIPFILTER_NEAREST", 371bf215546Sopenharmony_ci "PIPE_TEX_MIPFILTER_LINEAR", 372bf215546Sopenharmony_ci "PIPE_TEX_MIPFILTER_NONE" 373bf215546Sopenharmony_ci}; 374bf215546Sopenharmony_ci 375bf215546Sopenharmony_cistatic const char * 376bf215546Sopenharmony_ciutil_tex_mipfilter_short_names[] = { 377bf215546Sopenharmony_ci "nearest", 378bf215546Sopenharmony_ci "linear", 379bf215546Sopenharmony_ci "none" 380bf215546Sopenharmony_ci}; 381bf215546Sopenharmony_ci 382bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(tex_mipfilter) 383bf215546Sopenharmony_ci 384bf215546Sopenharmony_ci 385bf215546Sopenharmony_cistatic const char * 386bf215546Sopenharmony_ciutil_tex_filter_names[] = { 387bf215546Sopenharmony_ci "PIPE_TEX_FILTER_NEAREST", 388bf215546Sopenharmony_ci "PIPE_TEX_FILTER_LINEAR" 389bf215546Sopenharmony_ci}; 390bf215546Sopenharmony_ci 391bf215546Sopenharmony_cistatic const char * 392bf215546Sopenharmony_ciutil_tex_filter_short_names[] = { 393bf215546Sopenharmony_ci "nearest", 394bf215546Sopenharmony_ci "linear" 395bf215546Sopenharmony_ci}; 396bf215546Sopenharmony_ci 397bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(tex_filter) 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ci 400bf215546Sopenharmony_cistatic const char * 401bf215546Sopenharmony_ciutil_query_type_names[] = { 402bf215546Sopenharmony_ci "PIPE_QUERY_OCCLUSION_COUNTER", 403bf215546Sopenharmony_ci "PIPE_QUERY_OCCLUSION_PREDICATE", 404bf215546Sopenharmony_ci "PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE", 405bf215546Sopenharmony_ci "PIPE_QUERY_TIMESTAMP", 406bf215546Sopenharmony_ci "PIPE_QUERY_TIMESTAMP_DISJOINT", 407bf215546Sopenharmony_ci "PIPE_QUERY_TIME_ELAPSED", 408bf215546Sopenharmony_ci "PIPE_QUERY_PRIMITIVES_GENERATED", 409bf215546Sopenharmony_ci "PIPE_QUERY_PRIMITIVES_EMITTED", 410bf215546Sopenharmony_ci "PIPE_QUERY_SO_STATISTICS", 411bf215546Sopenharmony_ci "PIPE_QUERY_SO_OVERFLOW_PREDICATE", 412bf215546Sopenharmony_ci "PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE", 413bf215546Sopenharmony_ci "PIPE_QUERY_GPU_FINISHED", 414bf215546Sopenharmony_ci "PIPE_QUERY_PIPELINE_STATISTICS", 415bf215546Sopenharmony_ci}; 416bf215546Sopenharmony_ci 417bf215546Sopenharmony_cistatic const char * 418bf215546Sopenharmony_ciutil_query_type_short_names[] = { 419bf215546Sopenharmony_ci "occlusion_counter", 420bf215546Sopenharmony_ci "occlusion_predicate", 421bf215546Sopenharmony_ci "occlusion_predicate_conservative", 422bf215546Sopenharmony_ci "timestamp", 423bf215546Sopenharmony_ci "timestamp_disjoint", 424bf215546Sopenharmony_ci "time_elapsed", 425bf215546Sopenharmony_ci "primitives_generated", 426bf215546Sopenharmony_ci "primitives_emitted", 427bf215546Sopenharmony_ci "so_statistics", 428bf215546Sopenharmony_ci "so_overflow_predicate", 429bf215546Sopenharmony_ci "so_overflow_any_predicate", 430bf215546Sopenharmony_ci "gpu_finished", 431bf215546Sopenharmony_ci "pipeline_statistics", 432bf215546Sopenharmony_ci}; 433bf215546Sopenharmony_ci 434bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(query_type) 435bf215546Sopenharmony_ci 436bf215546Sopenharmony_ci 437bf215546Sopenharmony_cistatic const char * 438bf215546Sopenharmony_ciutil_query_value_type_names[] = { 439bf215546Sopenharmony_ci "PIPE_QUERY_TYPE_I32", 440bf215546Sopenharmony_ci "PIPE_QUERY_TYPE_U32", 441bf215546Sopenharmony_ci "PIPE_QUERY_TYPE_I64", 442bf215546Sopenharmony_ci "PIPE_QUERY_TYPE_U64", 443bf215546Sopenharmony_ci}; 444bf215546Sopenharmony_ci 445bf215546Sopenharmony_cistatic const char * 446bf215546Sopenharmony_ciutil_query_value_type_short_names[] = { 447bf215546Sopenharmony_ci "i32", 448bf215546Sopenharmony_ci "u32", 449bf215546Sopenharmony_ci "i64", 450bf215546Sopenharmony_ci "u64", 451bf215546Sopenharmony_ci}; 452bf215546Sopenharmony_ci 453bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(query_value_type) 454bf215546Sopenharmony_ci 455bf215546Sopenharmony_ci 456bf215546Sopenharmony_cistatic const char * 457bf215546Sopenharmony_ciutil_prim_mode_names[] = { 458bf215546Sopenharmony_ci "PIPE_PRIM_POINTS", 459bf215546Sopenharmony_ci "PIPE_PRIM_LINES", 460bf215546Sopenharmony_ci "PIPE_PRIM_LINE_LOOP", 461bf215546Sopenharmony_ci "PIPE_PRIM_LINE_STRIP", 462bf215546Sopenharmony_ci "PIPE_PRIM_TRIANGLES", 463bf215546Sopenharmony_ci "PIPE_PRIM_TRIANGLE_STRIP", 464bf215546Sopenharmony_ci "PIPE_PRIM_TRIANGLE_FAN", 465bf215546Sopenharmony_ci "PIPE_PRIM_QUADS", 466bf215546Sopenharmony_ci "PIPE_PRIM_QUAD_STRIP", 467bf215546Sopenharmony_ci "PIPE_PRIM_POLYGON", 468bf215546Sopenharmony_ci "PIPE_PRIM_LINES_ADJACENCY", 469bf215546Sopenharmony_ci "PIPE_PRIM_LINE_STRIP_ADJACENCY", 470bf215546Sopenharmony_ci "PIPE_PRIM_TRIANGLES_ADJACENCY", 471bf215546Sopenharmony_ci "PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY", 472bf215546Sopenharmony_ci "PIPE_PRIM_PATCHES", 473bf215546Sopenharmony_ci}; 474bf215546Sopenharmony_ci 475bf215546Sopenharmony_cistatic const char * 476bf215546Sopenharmony_ciutil_prim_mode_short_names[] = { 477bf215546Sopenharmony_ci "points", 478bf215546Sopenharmony_ci "lines", 479bf215546Sopenharmony_ci "line_loop", 480bf215546Sopenharmony_ci "line_strip", 481bf215546Sopenharmony_ci "triangles", 482bf215546Sopenharmony_ci "triangle_strip", 483bf215546Sopenharmony_ci "triangle_fan", 484bf215546Sopenharmony_ci "quads", 485bf215546Sopenharmony_ci "quad_strip", 486bf215546Sopenharmony_ci "polygon", 487bf215546Sopenharmony_ci "lines_adjacency", 488bf215546Sopenharmony_ci "line_strip_adjacency", 489bf215546Sopenharmony_ci "triangles_adjacency", 490bf215546Sopenharmony_ci "triangle_strip_adjacency", 491bf215546Sopenharmony_ci "patches", 492bf215546Sopenharmony_ci}; 493bf215546Sopenharmony_ci 494bf215546Sopenharmony_ciDEFINE_UTIL_STR_CONTINUOUS(prim_mode) 495bf215546Sopenharmony_ci 496bf215546Sopenharmony_civoid 497bf215546Sopenharmony_ciutil_dump_query_type(FILE *stream, unsigned value) 498bf215546Sopenharmony_ci{ 499bf215546Sopenharmony_ci if (value >= PIPE_QUERY_DRIVER_SPECIFIC) 500bf215546Sopenharmony_ci fprintf(stream, "PIPE_QUERY_DRIVER_SPECIFIC + %i", 501bf215546Sopenharmony_ci value - PIPE_QUERY_DRIVER_SPECIFIC); 502bf215546Sopenharmony_ci else 503bf215546Sopenharmony_ci fprintf(stream, "%s", util_str_query_type(value, false)); 504bf215546Sopenharmony_ci} 505bf215546Sopenharmony_ci 506bf215546Sopenharmony_civoid 507bf215546Sopenharmony_ciutil_dump_query_value_type(FILE *stream, unsigned value) 508bf215546Sopenharmony_ci{ 509bf215546Sopenharmony_ci fprintf(stream, "%s", util_str_query_value_type(value, false)); 510bf215546Sopenharmony_ci} 511bf215546Sopenharmony_ci 512bf215546Sopenharmony_civoid 513bf215546Sopenharmony_ciutil_dump_query_flags(FILE *stream, unsigned value) 514bf215546Sopenharmony_ci{ 515bf215546Sopenharmony_ci fprintf(stream, "%s", util_str_query_value_type(value, false)); 516bf215546Sopenharmony_ci} 517bf215546Sopenharmony_ci 518bf215546Sopenharmony_ci 519bf215546Sopenharmony_cistatic const char * const 520bf215546Sopenharmony_ciutil_transfer_usage_names[] = { 521bf215546Sopenharmony_ci "PIPE_MAP_READ", 522bf215546Sopenharmony_ci "PIPE_MAP_WRITE", 523bf215546Sopenharmony_ci "PIPE_MAP_DIRECTLY", 524bf215546Sopenharmony_ci "PIPE_MAP_DISCARD_RANGE", 525bf215546Sopenharmony_ci "PIPE_MAP_DONTBLOCK", 526bf215546Sopenharmony_ci "PIPE_MAP_UNSYNCHRONIZED", 527bf215546Sopenharmony_ci "PIPE_MAP_FLUSH_EXPLICIT", 528bf215546Sopenharmony_ci "PIPE_MAP_DISCARD_WHOLE_RESOURCE", 529bf215546Sopenharmony_ci "PIPE_MAP_PERSISTENT", 530bf215546Sopenharmony_ci "PIPE_MAP_COHERENT", 531bf215546Sopenharmony_ci}; 532bf215546Sopenharmony_ci 533bf215546Sopenharmony_ciDEFINE_UTIL_DUMP_FLAGS_CONTINUOUS(transfer_usage) 534