main: Cosmetic changes for Texture Buffers.
[mesa.git] / src / mesa / main / errors.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * \file errors.h
28 * Mesa debugging and error handling functions.
29 *
30 * This file provides functions to record errors, warnings, and miscellaneous
31 * debug information.
32 */
33
34
35 #ifndef ERRORS_H
36 #define ERRORS_H
37
38
39 #include "compiler.h"
40 #include "glheader.h"
41 #include "mtypes.h"
42
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 struct _glapi_table;
49
50 extern void
51 _mesa_init_errors( struct gl_context *ctx );
52
53 extern void
54 _mesa_free_errors_data( struct gl_context *ctx );
55
56 extern void
57 _mesa_warning( struct gl_context *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3);
58
59 extern void
60 _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
61
62 extern void
63 _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4);
64
65 extern void
66 _mesa_error_no_memory(const char *caller);
67
68 extern void
69 _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
70
71 extern void
72 _mesa_gl_debug(struct gl_context *ctx,
73 GLuint *id,
74 enum mesa_debug_source source,
75 enum mesa_debug_type type,
76 enum mesa_debug_severity severity,
77 const char *fmtString, ...) PRINTFLIKE(6, 7);
78
79 #define _mesa_perf_debug(ctx, sev, ...) do { \
80 static GLuint msg_id = 0; \
81 if (unlikely(ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) { \
82 _mesa_gl_debug(ctx, &msg_id, \
83 MESA_DEBUG_SOURCE_API, \
84 MESA_DEBUG_TYPE_PERFORMANCE, \
85 sev, \
86 __VA_ARGS__); \
87 } \
88 } while (0)
89
90 bool
91 _mesa_set_debug_state_int(struct gl_context *ctx, GLenum pname, GLint val);
92
93 GLint
94 _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname);
95
96 void *
97 _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname);
98
99 extern void
100 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
101 const char *msg, int len);
102
103 void GLAPIENTRY
104 _mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id,
105 GLenum severity, GLint length,
106 const GLchar* buf);
107 GLuint GLAPIENTRY
108 _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum* sources,
109 GLenum* types, GLenum* ids, GLenum* severities,
110 GLsizei* lengths, GLchar* messageLog);
111 void GLAPIENTRY
112 _mesa_DebugMessageControl(GLenum source, GLenum type, GLenum severity,
113 GLsizei count, const GLuint *ids,
114 GLboolean enabled);
115 void GLAPIENTRY
116 _mesa_DebugMessageCallback(GLDEBUGPROC callback,
117 const void *userParam);
118 void GLAPIENTRY
119 _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
120 const GLchar *message);
121 void GLAPIENTRY
122 _mesa_PopDebugGroup(void);
123
124 #ifdef __cplusplus
125 }
126 #endif
127
128
129 #endif /* ERRORS_H */