#include "pipe/p_compiler.h"
#include "util/u_debug.h"
+#include "util/u_dump.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "util/u_inlines.h"
const char *str;
str = os_get_option(name);
- if (!str)
+ if (!str) {
result = dfault;
- else {
- long sign;
- char c;
- c = *str++;
- if (c == '-') {
- sign = -1;
- c = *str++;
- }
- else {
- sign = 1;
- }
- result = 0;
- while ('0' <= c && c <= '9') {
- result = result*10 + (c - '0');
- c = *str++;
+ } else {
+ char *endptr;
+
+ result = strtol(str, &endptr, 0);
+ if (str == endptr) {
+ /* Restore the default value when no digits were found. */
+ result = dfault;
}
- result *= sign;
}
if (debug_get_option_should_print())
/** Return string name of given primitive type */
const char *
-u_prim_name(unsigned prim)
+u_prim_name(enum pipe_prim_type prim)
{
static const struct debug_named_value names[] = {
DEBUG_NAMED_VALUE(PIPE_PRIM_POINTS),
const char* fl_function[1024];
int
-debug_funclog_enter(const char* f, const int line, const char* file)
+debug_funclog_enter(const char* f, UNUSED const int line,
+ UNUSED const char* file)
{
int i;
}
void
-debug_funclog_exit(const char* f, const int line, const char* file)
+debug_funclog_exit(const char* f, UNUSED const int line,
+ UNUSED const char* file)
{
--fl_indent;
assert(fl_indent >= 0);
}
void
-debug_funclog_enter_exit(const char* f, const int line, const char* file)
+debug_funclog_enter_exit(const char* f, UNUSED const int line,
+ UNUSED const char* file)
{
int i;
for (i = 0; i < fl_indent; i++)
void
debug_print_transfer_flags(const char *msg, unsigned usage)
{
- static const struct debug_named_value names[] = {
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_READ),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_WRITE),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_MAP_DIRECTLY),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_DISCARD_RANGE),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_DONTBLOCK),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_UNSYNCHRONIZED),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_FLUSH_EXPLICIT),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_PERSISTENT),
- DEBUG_NAMED_VALUE(PIPE_TRANSFER_COHERENT),
- DEBUG_NAMED_VALUE_END
- };
-
- debug_printf("%s: %s\n", msg, debug_dump_flags(names, usage));
+ debug_printf("%s: ", msg);
+ util_dump_transfer_usage(stdout, usage);
+ printf("\n");
}
DEBUG_NAMED_VALUE(PIPE_BIND_INDEX_BUFFER),
DEBUG_NAMED_VALUE(PIPE_BIND_CONSTANT_BUFFER),
DEBUG_NAMED_VALUE(PIPE_BIND_DISPLAY_TARGET),
- DEBUG_NAMED_VALUE(PIPE_BIND_TRANSFER_WRITE),
- DEBUG_NAMED_VALUE(PIPE_BIND_TRANSFER_READ),
DEBUG_NAMED_VALUE(PIPE_BIND_STREAM_OUTPUT),
DEBUG_NAMED_VALUE(PIPE_BIND_CURSOR),
DEBUG_NAMED_VALUE(PIPE_BIND_CUSTOM),
* Print PIPE_USAGE_x enum values with a message.
*/
void
-debug_print_usage_enum(const char *msg, unsigned usage)
+debug_print_usage_enum(const char *msg, enum pipe_resource_usage usage)
{
static const struct debug_named_value names[] = {
DEBUG_NAMED_VALUE(PIPE_USAGE_DEFAULT),