1/************************************************************************** 2 * 3 * Copyright 2008 VMware, Inc. 4 * Copyright (c) 2008 VMware, Inc. 5 * All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the 9 * "Software"), to deal in the Software without restriction, including 10 * without limitation the rights to use, copy, modify, merge, publish, 11 * distribute, sub license, and/or sell copies of the Software, and to 12 * permit persons to whom the Software is furnished to do so, subject to 13 * the following conditions: 14 * 15 * The above copyright notice and this permission notice (including the 16 * next paragraph) shall be included in all copies or substantial portions 17 * of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 * 27 **************************************************************************/ 28 29 30#include "util/u_debug.h" 31#include "u_debug_gallium.h" 32#include "u_dump.h" 33#include "u_format.h" 34 35#ifdef DEBUG 36 37void 38debug_print_format(const char *msg, unsigned fmt) 39{ 40 debug_printf("%s: %s\n", msg, util_format_name(fmt)); 41} 42 43 44/** 45 * Print PIPE_TRANSFER_x flags with a message. 46 */ 47void 48debug_print_transfer_flags(const char *msg, unsigned usage) 49{ 50 debug_printf("%s: ", msg); 51 util_dump_transfer_usage(stdout, usage); 52 printf("\n"); 53} 54 55 56/** 57 * Print PIPE_BIND_x flags with a message. 58 */ 59void 60debug_print_bind_flags(const char *msg, unsigned usage) 61{ 62 static const struct debug_named_value names[] = { 63 DEBUG_NAMED_VALUE(PIPE_BIND_DEPTH_STENCIL), 64 DEBUG_NAMED_VALUE(PIPE_BIND_RENDER_TARGET), 65 DEBUG_NAMED_VALUE(PIPE_BIND_BLENDABLE), 66 DEBUG_NAMED_VALUE(PIPE_BIND_SAMPLER_VIEW), 67 DEBUG_NAMED_VALUE(PIPE_BIND_VERTEX_BUFFER), 68 DEBUG_NAMED_VALUE(PIPE_BIND_INDEX_BUFFER), 69 DEBUG_NAMED_VALUE(PIPE_BIND_CONSTANT_BUFFER), 70 DEBUG_NAMED_VALUE(PIPE_BIND_DISPLAY_TARGET), 71 DEBUG_NAMED_VALUE(PIPE_BIND_STREAM_OUTPUT), 72 DEBUG_NAMED_VALUE(PIPE_BIND_CURSOR), 73 DEBUG_NAMED_VALUE(PIPE_BIND_CUSTOM), 74 DEBUG_NAMED_VALUE(PIPE_BIND_GLOBAL), 75 DEBUG_NAMED_VALUE(PIPE_BIND_SHADER_BUFFER), 76 DEBUG_NAMED_VALUE(PIPE_BIND_SHADER_IMAGE), 77 DEBUG_NAMED_VALUE(PIPE_BIND_COMPUTE_RESOURCE), 78 DEBUG_NAMED_VALUE(PIPE_BIND_COMMAND_ARGS_BUFFER), 79 DEBUG_NAMED_VALUE(PIPE_BIND_SCANOUT), 80 DEBUG_NAMED_VALUE(PIPE_BIND_SHARED), 81 DEBUG_NAMED_VALUE(PIPE_BIND_LINEAR), 82 DEBUG_NAMED_VALUE_END 83 }; 84 85 debug_printf("%s: %s\n", msg, debug_dump_flags(names, usage)); 86} 87 88 89/** 90 * Print PIPE_USAGE_x enum values with a message. 91 */ 92void 93debug_print_usage_enum(const char *msg, enum pipe_resource_usage usage) 94{ 95 static const struct debug_named_value names[] = { 96 DEBUG_NAMED_VALUE(PIPE_USAGE_DEFAULT), 97 DEBUG_NAMED_VALUE(PIPE_USAGE_IMMUTABLE), 98 DEBUG_NAMED_VALUE(PIPE_USAGE_DYNAMIC), 99 DEBUG_NAMED_VALUE(PIPE_USAGE_STREAM), 100 DEBUG_NAMED_VALUE(PIPE_USAGE_STAGING), 101 DEBUG_NAMED_VALUE_END 102 }; 103 104 debug_printf("%s: %s\n", msg, debug_dump_enum(names, usage)); 105} 106 107#endif 108