1 /*
2  * Copyright (c) 2002-2008 LWJGL Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of 'LWJGL' nor the names of
17  *   its contributors may be used to endorse or promote products derived
18  *   from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 package org.lwjgl.opengl;
33 
34 import org.lwjgl.util.generator.*;
35 import org.lwjgl.util.generator.opengl.GLchar;
36 import org.lwjgl.util.generator.opengl.GLenum;
37 import org.lwjgl.util.generator.opengl.GLsizei;
38 import org.lwjgl.util.generator.opengl.GLuint;
39 
40 import java.nio.ByteBuffer;
41 import java.nio.IntBuffer;
42 
43 public interface ARB_debug_output {
44 
45 	/**
46 	 * Tokens accepted by the <target> parameters of Enable, Disable,
47 	 * and IsEnabled:
48 	 */
49 	int GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB = 0x8242;
50 
51 	/**
52 	 * Tokens accepted by the <value> parameters of GetBooleanv,
53 	 * GetIntegerv, GetFloatv, and GetDoublev:
54 	 */
55 	int GL_MAX_DEBUG_MESSAGE_LENGTH_ARB = 0x9143,
56 		GL_MAX_DEBUG_LOGGED_MESSAGES_ARB = 0x9144,
57 		GL_DEBUG_LOGGED_MESSAGES_ARB = 0x9145,
58 		GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB = 0x8243;
59 
60 	/** Tokens accepted by the <pname> parameter of GetPointerv: */
61 	int GL_DEBUG_CALLBACK_FUNCTION_ARB = 0x8244,
62 		GL_DEBUG_CALLBACK_USER_PARAM_ARB = 0x8245;
63 
64 	/**
65 	 * Tokens accepted or provided by the <source> parameters of
66 	 * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB,
67 	 * and the <sources> parameter of GetDebugMessageLogARB:
68 	 */
69 	int GL_DEBUG_SOURCE_API_ARB = 0x8246,
70 		GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB = 0x8247,
71 		GL_DEBUG_SOURCE_SHADER_COMPILER_ARB = 0x8248,
72 		GL_DEBUG_SOURCE_THIRD_PARTY_ARB = 0x8249,
73 		GL_DEBUG_SOURCE_APPLICATION_ARB = 0x824A,
74 		GL_DEBUG_SOURCE_OTHER_ARB = 0x824B;
75 
76 	/**
77 	 * Tokens accepted or provided by the <type> parameters of
78 	 * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB,
79 	 * and the <types> parameter of GetDebugMessageLogARB:
80 	 */
81 	int GL_DEBUG_TYPE_ERROR_ARB = 0x824C,
82 		GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB = 0x824D,
83 		GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB = 0x824E,
84 		GL_DEBUG_TYPE_PORTABILITY_ARB = 0x824F,
85 		GL_DEBUG_TYPE_PERFORMANCE_ARB = 0x8250,
86 		GL_DEBUG_TYPE_OTHER_ARB = 0x8251;
87 
88 	/**
89 	 * Tokens accepted or provided by the <severity> parameters of
90 	 * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB
91 	 * callback functions, and the <severities> parameter of
92 	 * GetDebugMessageLogARB:
93 	 */
94 	int GL_DEBUG_SEVERITY_HIGH_ARB = 0x9146,
95 		GL_DEBUG_SEVERITY_MEDIUM_ARB = 0x9147,
96 		GL_DEBUG_SEVERITY_LOW_ARB = 0x9148;
97 
glDebugMessageControlARB(@Lenum int source, @GLenum int type, @GLenum int severity, @AutoSize(value = R, canBeNull = true) @GLsizei int count, @Check(canBeNull = true) @Const @GLuint IntBuffer ids, boolean enabled)98 	void glDebugMessageControlARB(@GLenum int source,
99 	                              @GLenum int type,
100 	                              @GLenum int severity,
101 	                              @AutoSize(value = "ids", canBeNull = true) @GLsizei int count,
102 	                              @Check(canBeNull = true) @Const @GLuint IntBuffer ids,
103 	                              boolean enabled);
104 
glDebugMessageInsertARB(@Lenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @AutoSize(R) @GLsizei int length, @Const @GLchar ByteBuffer buf)105 	void glDebugMessageInsertARB(@GLenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @AutoSize("buf") @GLsizei int length, @Const @GLchar ByteBuffer buf);
106 
107 	@Alternate("glDebugMessageInsertARB")
glDebugMessageInsertARB(@Lenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @Constant(R) @GLsizei int length, CharSequence buf)108 	void glDebugMessageInsertARB(@GLenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @Constant("buf.length()") @GLsizei int length, CharSequence buf);
109 
110 	/**
111 	 * The {@code ARBDebugOutputCallback.Handler} implementation passed to this method will be used for
112 	 * ARB_debug_output messages. If callback is null, any previously registered handler for the current
113 	 * thread will be unregistered and stop receiving messages.
114 	 *
115 	 * @param callback the callback function to use
116 	 */
117 	@Code(
118 		// Create a GlobalRef to the callback object and register it with the current context.
119 		javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" +
120 		                   "\t\tCallbackUtil.registerContextCallbackARB(userParam);"
121 	)
glDebugMessageCallbackARB(@ointerWrappervalue = R, canBeNull = true) ARBDebugOutputCallback callback, @Constant(R) @PointerWrapper(R) long userParam)122 	void glDebugMessageCallbackARB(@PointerWrapper(value = "GLDEBUGPROCARB", canBeNull = true) ARBDebugOutputCallback callback,
123 	                               @Constant("userParam") @PointerWrapper("GLvoid *") long userParam);
124 
125 	@GLuint
glGetDebugMessageLogARB(@Luint int count, @AutoSize(value = R, canBeNull = true) @GLsizei int logSize, @Check(value = R, canBeNull = true) @GLenum IntBuffer sources, @Check(value = R, canBeNull = true) @GLenum IntBuffer types, @Check(value = R, canBeNull = true) @GLuint IntBuffer ids, @Check(value = R, canBeNull = true) @GLenum IntBuffer severities, @Check(value = R, canBeNull = true) @GLsizei IntBuffer lengths, @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog)126 	int glGetDebugMessageLogARB(@GLuint int count,
127 	                            @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int logSize,
128 	                            @Check(value = "count", canBeNull = true) @GLenum IntBuffer sources,
129 	                            @Check(value = "count", canBeNull = true) @GLenum IntBuffer types,
130 	                            @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids,
131 	                            @Check(value = "count", canBeNull = true) @GLenum IntBuffer severities,
132 	                            @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths,
133 	                            @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog);
134 
135 	// Not really useful and a pain to implement in Java
136 	//void glGetPointerv(@GLenum int pname, void**params);
137 
138 }