ef22cac2c3190a0b156c55d81baf36e29cfc11c9
[mesa.git] / src / gallium / auxiliary / target-helpers / inline_debug_helper.h
1
2 #ifndef INLINE_DEBUG_HELPER_H
3 #define INLINE_DEBUG_HELPER_H
4
5 #include "pipe/p_compiler.h"
6 #include "util/u_debug.h"
7 #include "util/u_tests.h"
8
9
10 /* Helper function to wrap a screen with
11 * one or more debug drivers.
12 */
13
14 #include "driver_ddebug/dd_public.h"
15 #include "driver_trace/tr_public.h"
16 #include "driver_rbug/rbug_public.h"
17 #include "driver_noop/noop_public.h"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /*
24 * TODO: Audit the following *screen_create() - all of
25 * them should return the original screen on failuire.
26 */
27 static inline struct pipe_screen *
28 debug_screen_wrap(struct pipe_screen *screen)
29 {
30 screen = ddebug_screen_create(screen);
31 screen = rbug_screen_create(screen);
32 screen = trace_screen_create(screen);
33 screen = noop_screen_create(screen);
34
35 if (debug_get_bool_option("GALLIUM_TESTS", FALSE))
36 util_run_tests(screen);
37
38 return screen;
39 }
40
41 #endif
42
43 #ifdef __cplusplus
44 }
45 #endif