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.Alternate;
36 import org.lwjgl.util.generator.opengl.*;
37 
38 import java.nio.ByteBuffer;
39 import java.nio.IntBuffer;
40 
41 @Extension(postfix = "")
42 public interface ARB_uniform_buffer_object {
43 
44 	/**
45 	 * Accepted by the <target> parameters of BindBuffer, BufferData,
46 	 * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and
47 	 * GetBufferPointerv:
48 	 */
49 	int GL_UNIFORM_BUFFER = 0x8A11;
50 
51 	/**
52 	 * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleanv,
53 	 * GetIntegerv, GetFloatv, and GetDoublev:
54 	 */
55 	int GL_UNIFORM_BUFFER_BINDING = 0x8A28;
56 
57 	/** Accepted by the <pname> parameter of GetIntegeri_v: */
58 	int GL_UNIFORM_BUFFER_START = 0x8A29;
59 	int GL_UNIFORM_BUFFER_SIZE = 0x8A2A;
60 
61 	/**
62 	 * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
63 	 * GetFloatv, and GetDoublev:
64 	 */
65 	int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B;
66 	int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C;
67 	int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D;
68 	int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E;
69 	int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F;
70 	int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30;
71 	int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31;
72 	int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32;
73 	int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33;
74 	int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34;
75 
76 	/** Accepted by the <pname> parameter of GetProgramiv: */
77 	int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35;
78 	int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36;
79 
80 	/** Accepted by the <pname> parameter of GetActiveUniformsivARB: */
81 	int GL_UNIFORM_TYPE = 0x8A37;
82 	int GL_UNIFORM_SIZE = 0x8A38;
83 	int GL_UNIFORM_NAME_LENGTH = 0x8A39;
84 	int GL_UNIFORM_BLOCK_INDEX = 0x8A3A;
85 	int GL_UNIFORM_OFFSET = 0x8A3B;
86 	int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C;
87 	int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D;
88 	int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E;
89 
90 	/** Accepted by the <pname> parameter of GetActiveUniformBlockivARB: */
91 	int GL_UNIFORM_BLOCK_BINDING = 0x8A3F;
92 	int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40;
93 	int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41;
94 	int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42;
95 	int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43;
96 	int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44;
97 	int GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 0x8A45;
98 	int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46;
99 
100 	/** Returned by GetActiveUniformsivARB and GetUniformBlockIndexARB */
101 	int GL_INVALID_INDEX = 0xFFFFFFFF;
102 
103 	@Reuse("GL31")
glGetUniformIndices(@Luint int program, @AutoSize(R) @GLsizei int uniformCount, @Const @NullTerminated(R) @GLchar @PointerArray(R) ByteBuffer uniformNames, @OutParameter @GLuint IntBuffer uniformIndices)104 	void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
105 	                         @Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames,
106 	                         @OutParameter @GLuint IntBuffer uniformIndices);
107 
108 	@Reuse("GL31")
109 	@Alternate(value = "glGetUniformIndices")
glGetUniformIndices(@Luint int program, @Constant(R) @GLsizei int uniformCount, @Const @NullTerminated @PointerArray(R) CharSequence[] uniformNames, @OutParameter @Check(R) @GLuint IntBuffer uniformIndices)110 	void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount,
111 	                         @Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames,
112 	                         @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices);
113 
114 	@Reuse("GL31")
115 	@StripPostfix("params")
glGetActiveUniformsiv(@Luint int program, @AutoSize(R) @GLsizei int uniformCount, @Const @GLuint IntBuffer uniformIndices, @GLenum int pname, @OutParameter @Check(R) @GLint IntBuffer params)116 	void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
117 	                           @Const @GLuint IntBuffer uniformIndices,
118 	                           @GLenum int pname,
119 	                           @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params);
120 
121 	/** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformsi} instead. */
122 	@Alternate("glGetActiveUniformsiv")
123 	@GLreturn("params")
124 	@StripPostfix("params")
125 	@Reuse(value = "GL31", method = "glGetActiveUniformsi")
126 	@Deprecated
glGetActiveUniformsiv(@Luint int program, @Constant(R) @GLsizei int uniformCount, @Constant(value = R, keepParam = true) int uniformIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)127 	void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
128 	                           @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer
129 	                           @GLenum int pname,
130 	                           @OutParameter @GLint IntBuffer params);
131 
132 	@Reuse("GL31")
133 	@Alternate("glGetActiveUniformsiv")
134 	@GLreturn("params")
135 	@StripPostfix(value = "params", hasPostfix = false)
glGetActiveUniformsiv2(@Luint int program, @Constant(R) @GLsizei int uniformCount, @Constant(value = R, keepParam = true) int uniformIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)136 	void glGetActiveUniformsiv2(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
137 	                            @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer
138 	                            @GLenum int pname,
139 	                            @OutParameter @GLint IntBuffer params);
140 
141 	@Reuse("GL31")
glGetActiveUniformName(@Luint int program, @GLuint int uniformIndex, @AutoSize(R) @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = R, canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName)142 	void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize,
143 	                            @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
144 	                            @OutParameter @GLchar ByteBuffer uniformName);
145 
146 	@Reuse("GL31")
147 	@Alternate("glGetActiveUniformName")
148 	@GLreturn(value = "uniformName", maxLength = "bufSize")
glGetActiveUniformName2(@Luint int program, @GLuint int uniformIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant(R) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName)149 	void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize,
150 	                             @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformName_length)") IntBuffer length,
151 	                             @OutParameter @GLchar ByteBuffer uniformName);
152 
153 	@Reuse("GL31")
154 	@GLuint
glGetUniformBlockIndex(@Luint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName)155 	int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName);
156 
157 	@Reuse("GL31")
158 	@Alternate("glGetUniformBlockIndex")
159 	@GLuint
glGetUniformBlockIndex(@Luint int program, @NullTerminated CharSequence uniformBlockName)160 	int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName);
161 
162 	@Reuse("GL31")
163 	@StripPostfix("params")
glGetActiveUniformBlockiv(@Luint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = R) @GLint IntBuffer params)164 	void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
165 	                               @OutParameter @Check(value = "16") @GLint IntBuffer params);
166 
167 	/** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformBlocki} instead. */
168 	@Alternate("glGetActiveUniformBlockiv")
169 	@GLreturn("params")
170 	@StripPostfix("params")
171 	@Reuse(value = "GL31", method = "glGetActiveUniformBlocki")
172 	@Deprecated
glGetActiveUniformBlockiv2(@Luint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)173 	void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
174 	                                @OutParameter @GLint IntBuffer params);
175 
176 	@Reuse("GL31")
177 	@Alternate("glGetActiveUniformBlockiv")
178 	@GLreturn("params")
179 	@StripPostfix(value = "params", hasPostfix = false)
glGetActiveUniformBlockiv3(@Luint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)180 	void glGetActiveUniformBlockiv3(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
181 	                                @OutParameter @GLint IntBuffer params);
182 
183 	@Reuse("GL31")
glGetActiveUniformBlockName(@Luint int program, @GLuint int uniformBlockIndex, @AutoSize(R) @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = R, canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName)184 	void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize,
185 	                                 @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
186 	                                 @OutParameter @GLchar ByteBuffer uniformBlockName);
187 
188 	@Reuse("GL31")
189 	@Alternate("glGetActiveUniformBlockName")
190 	@GLreturn(value = "uniformBlockName", maxLength = "bufSize")
glGetActiveUniformBlockName2(@Luint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant(R) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName)191 	void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize,
192 	                                  @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformBlockName_length)") IntBuffer length,
193 	                                  @OutParameter @GLchar ByteBuffer uniformBlockName);
194 
195 	@Reuse("GL30")
glBindBufferRange(@Lenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size)196 	void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size);
197 
198 	@Reuse("GL30")
glBindBufferBase(@Lenum int target, @GLuint int index, @GLuint int buffer)199 	void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer);
200 
201 	@Reuse("GL30")
202 	@StripPostfix(value = "data", extension = "")
glGetIntegeri_v(@Lenum int value, @GLuint int index, @OutParameter @Check(R) IntBuffer data)203 	void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") IntBuffer data);
204 
205 	@Reuse("GL30")
206 	@Alternate("glGetIntegeri_v")
207 	@GLreturn("data")
208 	@StripPostfix("data")
glGetIntegeri_v2(@Lenum int value, @GLuint int index, @OutParameter IntBuffer data)209 	void glGetIntegeri_v2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data);
210 
211 	@Reuse("GL31")
glUniformBlockBinding(@Luint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding)212 	void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding);
213 
214 }