1#pragma once
2
3#include "DriverIncludes.h"
4#include "util/u_debug.h"
5
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11
12#define ST_DEBUG_OLD_TEX_OPS   (1 <<  0)
13#define ST_DEBUG_TGSI          (1 <<  1)
14
15
16#ifdef DEBUG
17extern unsigned st_debug;
18#else
19#define st_debug 0
20#endif
21
22
23#ifdef DEBUG
24void st_debug_parse(void);
25#else
26#define st_debug_parse() ((void)0)
27#endif
28
29
30void
31DebugPrintf(const char *format, ...);
32
33
34void
35CheckHResult(HRESULT hr, const char *function, unsigned line);
36
37
38#define CHECK_NTSTATUS(status) \
39   CheckNTStatus(status, __FUNCTION__, __LINE__)
40
41
42#define CHECK_HRESULT(hr) \
43   CheckHResult(hr, __FUNCTION__, __LINE__)
44
45
46void
47AssertFail(const char *expr, const char *file, unsigned line, const char *function);
48
49
50#ifndef NDEBUG
51#define ASSERT(expr) ((expr) ? (void)0 : AssertFail(#expr, __FILE__, __LINE__, __FUNCTION__))
52#else
53#define ASSERT(expr) do { } while (0 && (expr))
54#endif
55
56
57#if 0 && !defined(NDEBUG)
58#define LOG_ENTRYPOINT() DebugPrintf("%s\n", __FUNCTION__)
59#else
60#define LOG_ENTRYPOINT() (void)0
61#endif
62
63#define LOG_UNSUPPORTED_ENTRYPOINT() DebugPrintf("%s XXX\n", __FUNCTION__)
64
65#define LOG_UNSUPPORTED(expr) \
66   do { if (expr) DebugPrintf("%s:%d XXX %s\n", __FUNCTION__, __LINE__, #expr); } while(0)
67
68
69#ifdef __cplusplus
70}
71#endif
72
73