gallium: expose a debug message callback settable by context owner
This will allow gallium drivers to send messages to KHR_debug endpoints Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
@@ -70,6 +70,20 @@ void _debug_vprintf(const char *format, va_list ap)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_pipe_debug_message(
|
||||
struct pipe_debug_callback *cb,
|
||||
unsigned *id,
|
||||
enum pipe_debug_type type,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
if (cb && cb->debug_message)
|
||||
cb->debug_message(cb->data, id, type, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
debug_disable_error_message_boxes(void)
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "os/os_misc.h"
|
||||
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_defines.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -262,6 +263,25 @@ void _debug_assert_fail(const char *expr,
|
||||
_debug_printf("error: %s\n", __msg)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Output a debug log message to the debug info callback.
|
||||
*/
|
||||
#define pipe_debug_message(cb, type, fmt, ...) do { \
|
||||
static unsigned id = 0; \
|
||||
_pipe_debug_message(cb, &id, \
|
||||
PIPE_DEBUG_TYPE_ ## type, \
|
||||
fmt, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
struct pipe_debug_callback;
|
||||
|
||||
void
|
||||
_pipe_debug_message(
|
||||
struct pipe_debug_callback *cb,
|
||||
unsigned *id,
|
||||
enum pipe_debug_type type,
|
||||
const char *fmt, ...) _util_printf_format(4, 5);
|
||||
|
||||
|
||||
/**
|
||||
* Used by debug_dump_enum and debug_dump_flags to describe symbols.
|
||||
|
@@ -84,6 +84,9 @@ objects. They all follow simple, one-method binding calls, e.g.
|
||||
levels. This corresponds to GL's ``PATCH_DEFAULT_OUTER_LEVEL``.
|
||||
* ``default_inner_level`` is the default value for the inner tessellation
|
||||
levels. This corresponds to GL's ``PATCH_DEFAULT_INNER_LEVEL``.
|
||||
* ``set_debug_callback`` sets the callback to be used for reporting
|
||||
various debug messages, eventually reported via KHR_debug and
|
||||
similar mechanisms.
|
||||
|
||||
|
||||
Sampler Views
|
||||
|
@@ -45,6 +45,7 @@ struct pipe_blit_info;
|
||||
struct pipe_box;
|
||||
struct pipe_clip_state;
|
||||
struct pipe_constant_buffer;
|
||||
struct pipe_debug_callback;
|
||||
struct pipe_depth_stencil_alpha_state;
|
||||
struct pipe_draw_info;
|
||||
struct pipe_fence_handle;
|
||||
@@ -238,6 +239,13 @@ struct pipe_context {
|
||||
const float default_outer_level[4],
|
||||
const float default_inner_level[2]);
|
||||
|
||||
/**
|
||||
* Sets the debug callback. If the pointer is null, then no callback is
|
||||
* set, otherwise a copy of the data should be made.
|
||||
*/
|
||||
void (*set_debug_callback)(struct pipe_context *,
|
||||
const struct pipe_debug_callback *);
|
||||
|
||||
/**
|
||||
* Bind an array of shader buffers that will be used by a shader.
|
||||
* Any buffers that were previously bound to the specified range
|
||||
|
@@ -868,6 +868,18 @@ struct pipe_driver_query_group_info
|
||||
unsigned num_queries;
|
||||
};
|
||||
|
||||
enum pipe_debug_type
|
||||
{
|
||||
PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1,
|
||||
PIPE_DEBUG_TYPE_ERROR,
|
||||
PIPE_DEBUG_TYPE_SHADER_INFO,
|
||||
PIPE_DEBUG_TYPE_PERF_INFO,
|
||||
PIPE_DEBUG_TYPE_INFO,
|
||||
PIPE_DEBUG_TYPE_FALLBACK,
|
||||
PIPE_DEBUG_TYPE_CONFORMANCE,
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -684,6 +684,31 @@ struct pipe_compute_state
|
||||
unsigned req_input_mem; /**< Required size of the INPUT resource. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure that contains a callback for debug messages from the driver back
|
||||
* to the state tracker.
|
||||
*/
|
||||
struct pipe_debug_callback
|
||||
{
|
||||
/**
|
||||
* Callback for the driver to report debug/performance/etc information back
|
||||
* to the state tracker.
|
||||
*
|
||||
* \param data user-supplied data pointer
|
||||
* \param id message type identifier, if pointed value is 0, then a
|
||||
* new id is assigned
|
||||
* \param type PIPE_DEBUG_TYPE_*
|
||||
* \param format printf-style format string
|
||||
* \param args args for format string
|
||||
*/
|
||||
void (*debug_message)(void *data,
|
||||
unsigned *id,
|
||||
enum pipe_debug_type type,
|
||||
const char *fmt,
|
||||
va_list args);
|
||||
void *data;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user