1 
2 //          Copyright 2018 - 2021 Michael D. Parker
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.opengl.bind.gl30;
8 
9 import bindbc.opengl.config;
10 static if(glSupport >= GLSupport.gl30) {
11     import bindbc.loader : SharedLib;
12     import bindbc.opengl.context;
13     import bindbc.opengl.bind.types;
14 
15     version(GL_AllowDeprecated)
16         public import bindbc.opengl.bind.dep.dep30;
17 
18     enum : uint {
19         GL_COMPARE_REF_TO_TEXTURE         = 0x884E,
20         GL_CLIP_DISTANCE0                 = 0x3000,
21         GL_CLIP_DISTANCE1                 = 0x3001,
22         GL_CLIP_DISTANCE2                 = 0x3002,
23         GL_CLIP_DISTANCE3                 = 0x3003,
24         GL_CLIP_DISTANCE4                 = 0x3004,
25         GL_CLIP_DISTANCE5                 = 0x3005,
26         GL_CLIP_DISTANCE6                 = 0x3006,
27         GL_CLIP_DISTANCE7                 = 0x3007,
28         GL_MAX_CLIP_DISTANCES             = 0x0D32,
29         GL_MAJOR_VERSION                  = 0x821B,
30         GL_MINOR_VERSION                  = 0x821C,
31         GL_NUM_EXTENSIONS                 = 0x821D,
32         GL_CONTEXT_FLAGS                  = 0x821E,
33         GL_COMPRESSED_RED                 = 0x8225,
34         GL_COMPRESSED_RG                  = 0x8226,
35         GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001,
36         GL_RGBA32F                        = 0x8814,
37         GL_RGB32F                         = 0x8815,
38         GL_RGBA16F                        = 0x881A,
39         GL_RGB16F                         = 0x881B,
40         GL_VERTEX_ATTRIB_ARRAY_INTEGER    = 0x88FD,
41         GL_MAX_ARRAY_TEXTURE_LAYERS       = 0x88FF,
42         GL_MIN_PROGRAM_TEXEL_OFFSET       = 0x8904,
43         GL_MAX_PROGRAM_TEXEL_OFFSET       = 0x8905,
44         GL_CLAMP_READ_COLOR               = 0x891C,
45         GL_FIXED_ONLY                     = 0x891D,
46         GL_MAX_VARYING_COMPONENTS         = 0x8B4B,
47         GL_TEXTURE_1D_ARRAY               = 0x8C18,
48         GL_PROXY_TEXTURE_1D_ARRAY         = 0x8C19,
49         GL_TEXTURE_2D_ARRAY               = 0x8C1A,
50         GL_PROXY_TEXTURE_2D_ARRAY         = 0x8C1B,
51         GL_TEXTURE_BINDING_1D_ARRAY       = 0x8C1C,
52         GL_TEXTURE_BINDING_2D_ARRAY       = 0x8C1D,
53         GL_R11F_G11F_B10F                 = 0x8C3A,
54         GL_UNSIGNED_INT_10F_11F_11F_REV   = 0x8C3B,
55         GL_RGB9_E5                        = 0x8C3D,
56         GL_UNSIGNED_INT_5_9_9_9_REV       = 0x8C3E,
57         GL_TEXTURE_SHARED_SIZE            = 0x8C3F,
58         GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76,
59         GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F,
60         GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80,
61         GL_TRANSFORM_FEEDBACK_VARYINGS    = 0x8C83,
62         GL_TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84,
63         GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85,
64         GL_PRIMITIVES_GENERATED           = 0x8C87,
65         GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88,
66         GL_RASTERIZER_DISCARD             = 0x8C89,
67         GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A,
68         GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B,
69         GL_INTERLEAVED_ATTRIBS            = 0x8C8C,
70         GL_SEPARATE_ATTRIBS               = 0x8C8D,
71         GL_TRANSFORM_FEEDBACK_BUFFER      = 0x8C8E,
72         GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F,
73         GL_RGBA32UI                       = 0x8D70,
74         GL_RGB32UI                        = 0x8D71,
75         GL_RGBA16UI                       = 0x8D76,
76         GL_RGB16UI                        = 0x8D77,
77         GL_RGBA8UI                        = 0x8D7C,
78         GL_RGB8UI                         = 0x8D7D,
79         GL_RGBA32I                        = 0x8D82,
80         GL_RGB32I                         = 0x8D83,
81         GL_RGBA16I                        = 0x8D88,
82         GL_RGB16I                         = 0x8D89,
83         GL_RGBA8I                         = 0x8D8E,
84         GL_RGB8I                          = 0x8D8F,
85         GL_RED_INTEGER                    = 0x8D94,
86         GL_GREEN_INTEGER                  = 0x8D95,
87         GL_BLUE_INTEGER                   = 0x8D96,
88         GL_RGB_INTEGER                    = 0x8D98,
89         GL_RGBA_INTEGER                   = 0x8D99,
90         GL_BGR_INTEGER                    = 0x8D9A,
91         GL_BGRA_INTEGER                   = 0x8D9B,
92         GL_SAMPLER_1D_ARRAY               = 0x8DC0,
93         GL_SAMPLER_2D_ARRAY               = 0x8DC1,
94         GL_SAMPLER_1D_ARRAY_SHADOW        = 0x8DC3,
95         GL_SAMPLER_2D_ARRAY_SHADOW        = 0x8DC4,
96         GL_SAMPLER_CUBE_SHADOW            = 0x8DC5,
97         GL_UNSIGNED_INT_VEC2              = 0x8DC6,
98         GL_UNSIGNED_INT_VEC3              = 0x8DC7,
99         GL_UNSIGNED_INT_VEC4              = 0x8DC8,
100         GL_INT_SAMPLER_1D                 = 0x8DC9,
101         GL_INT_SAMPLER_2D                 = 0x8DCA,
102         GL_INT_SAMPLER_3D                 = 0x8DCB,
103         GL_INT_SAMPLER_CUBE               = 0x8DCC,
104         GL_INT_SAMPLER_1D_ARRAY           = 0x8DCE,
105         GL_INT_SAMPLER_2D_ARRAY           = 0x8DCF,
106         GL_UNSIGNED_INT_SAMPLER_1D        = 0x8DD1,
107         GL_UNSIGNED_INT_SAMPLER_2D        = 0x8DD2,
108         GL_UNSIGNED_INT_SAMPLER_3D        = 0x8DD3,
109         GL_UNSIGNED_INT_SAMPLER_CUBE      = 0x8DD4,
110         GL_UNSIGNED_INT_SAMPLER_1D_ARRAY  = 0x8DD6,
111         GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  = 0x8DD7,
112         GL_QUERY_WAIT                     = 0x8E13,
113         GL_QUERY_NO_WAIT                  = 0x8E14,
114         GL_QUERY_BY_REGION_WAIT           = 0x8E15,
115         GL_QUERY_BY_REGION_NO_WAIT        = 0x8E16,
116         GL_BUFFER_ACCESS_FLAGS            = 0x911F,
117         GL_BUFFER_MAP_LENGTH              = 0x9120,
118         GL_BUFFER_MAP_OFFSET              = 0x9121,
119     }
120 
121     extern(System) @nogc nothrow {
122         alias pglColorMaski = void function(GLuint,GLboolean,GLboolean,GLboolean,GLboolean);
123         alias pglGetBooleani_v = void function(GLenum,GLuint,GLboolean*);
124         alias pglGetIntegeri_v = void function(GLenum,GLuint,GLint*);
125         alias pglEnablei = void function(GLenum,GLuint);
126         alias pglDisablei = void function(GLenum,GLuint);
127         alias pglIsEnabledi = GLboolean function(GLenum,GLuint);
128         alias pglBeginTransformFeedback = void function(GLenum);
129         alias pglEndTransformFeedback = void function();
130         alias pglBindBufferRange = void function(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr);
131         alias pglBindBufferBase = void function(GLenum,GLuint,GLuint);
132         alias pglTransformFeedbackVaryings = void function(GLuint,GLsizei,const(GLchar*)*,GLenum);
133         alias pglGetTransformFeedbackVarying = void function(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*);
134         alias pglClampColor = void function(GLenum,GLenum);
135         alias pglBeginConditionalRender = void function(GLuint,GLenum);
136         alias pglEndConditionalRender = void function();
137         alias pglVertexAttribIPointer = void function(GLuint,GLint,GLenum,GLsizei,const(GLvoid)*);
138         alias pglGetVertexAttribIiv = void function(GLuint,GLenum,GLint*);
139         alias pglGetVertexAttribIuiv = void function(GLuint,GLenum,GLuint*);
140         alias pglVertexAttribI1i = void function(GLuint,GLint);
141         alias pglVertexAttribI2i = void function(GLuint,GLint,GLint);
142         alias pglVertexAttribI3i = void function(GLuint,GLint,GLint,GLint);
143         alias pglVertexAttribI4i = void function(GLuint,GLint,GLint,GLint,GLint);
144         alias pglVertexAttribI1ui = void function(GLuint,GLuint);
145         alias pglVertexAttribI2ui = void function(GLuint,GLuint,GLuint);
146         alias pglVertexAttribI3ui = void function(GLuint,GLuint,GLuint,GLuint);
147         alias pglVertexAttribI4ui = void function(GLuint,GLuint,GLuint,GLuint,GLuint);
148         alias pglVertexAttribI1iv = void function(GLuint,const(GLint)*);
149         alias pglVertexAttribI2iv = void function(GLuint,const(GLint)*);
150         alias pglVertexAttribI3iv = void function(GLuint,const(GLint)*);
151         alias pglVertexAttribI4iv = void function(GLuint,const(GLint)*);
152         alias pglVertexAttribI1uiv = void function(GLuint,const(GLuint)*);
153         alias pglVertexAttribI2uiv = void function(GLuint,const(GLuint)*);
154         alias pglVertexAttribI3uiv = void function(GLuint,const(GLuint)*);
155         alias pglVertexAttribI4uiv = void function(GLuint,const(GLuint)*);
156         alias pglVertexAttribI4bv = void function(GLuint,const(GLbyte)*);
157         alias pglVertexAttribI4sv = void function(GLuint,const(GLshort)*);
158         alias pglVertexAttribI4ubv = void function(GLuint,const(GLubyte)*);
159         alias pglVertexAttribI4usv = void function(GLuint,const(GLushort)*);
160         alias pglGetUniformuiv = void function(GLuint,GLint,GLuint*);
161         alias pglBindFragDataLocation = void function(GLuint,GLuint,const(GLchar)*);
162         alias pglGetFragDataLocation = GLint function(GLuint,const(GLchar)*);
163         alias pglUniform1ui = void function(GLint,GLuint);
164         alias pglUniform2ui = void function(GLint,GLuint,GLuint);
165         alias pglUniform3ui = void function(GLint,GLuint,GLuint,GLuint);
166         alias pglUniform4ui = void function(GLint,GLuint,GLuint,GLuint,GLuint);
167         alias pglUniform1uiv = void function(GLint,GLsizei,const(GLuint)*);
168         alias pglUniform2uiv = void function(GLint,GLsizei,const(GLuint)*);
169         alias pglUniform3uiv = void function(GLint,GLsizei,const(GLuint)*);
170         alias pglUniform4uiv = void function(GLint,GLsizei,const(GLuint)*);
171         alias pglTexParameterIiv = void function(GLenum,GLenum,const(GLint)*);
172         alias pglTexParameterIuiv = void function(GLenum,GLenum,const(GLuint)*);
173         alias pglGetTexParameterIiv = void function(GLenum,GLenum,GLint*);
174         alias pglGetTexParameterIuiv = void function(GLenum,GLenum,GLuint*);
175         alias pglClearBufferiv = void function(GLenum,GLint,const(GLint)*);
176         alias pglClearBufferuiv = void function(GLenum,GLint,const(GLuint)*);
177         alias pglClearBufferfv = void function(GLenum,GLint,const(GLfloat)*);
178         alias pglClearBufferfi = void function(GLenum,GLint,GLfloat,GLint);
179         alias pglGetStringi = const(char)* function(GLenum,GLuint);
180     }
181 
182     __gshared {
183         pglColorMaski glColorMaski;
184         pglGetBooleani_v glGetBooleani_v;
185         pglGetIntegeri_v glGetIntegeri_v;
186         pglEnablei glEnablei;
187         pglDisablei glDisablei;
188         pglIsEnabledi glIsEnabledi;
189         pglBeginTransformFeedback glBeginTransformFeedback;
190         pglEndTransformFeedback glEndTransformFeedback;
191         pglBindBufferRange glBindBufferRange;
192         pglBindBufferBase glBindBufferBase;
193         pglTransformFeedbackVaryings glTransformFeedbackVaryings;
194         pglGetTransformFeedbackVarying glGetTransformFeedbackVarying;
195         pglClampColor glClampColor;
196         pglBeginConditionalRender glBeginConditionalRender;
197         pglEndConditionalRender glEndConditionalRender;
198         pglVertexAttribIPointer glVertexAttribIPointer;
199         pglGetVertexAttribIiv glGetVertexAttribIiv;
200         pglGetVertexAttribIuiv glGetVertexAttribIuiv;
201         pglVertexAttribI1i glVertexAttribI1i;
202         pglVertexAttribI2i glVertexAttribI2i;
203         pglVertexAttribI3i glVertexAttribI3i;
204         pglVertexAttribI4i glVertexAttribI4i;
205         pglVertexAttribI1ui glVertexAttribI1ui;
206         pglVertexAttribI2ui glVertexAttribI2ui;
207         pglVertexAttribI3ui glVertexAttribI3ui;
208         pglVertexAttribI4ui glVertexAttribI4ui;
209         pglVertexAttribI1iv glVertexAttribI1iv;
210         pglVertexAttribI2iv glVertexAttribI2iv;
211         pglVertexAttribI3iv glVertexAttribI3iv;
212         pglVertexAttribI4iv glVertexAttribI4iv;
213         pglVertexAttribI1uiv glVertexAttribI1uiv;
214         pglVertexAttribI2uiv glVertexAttribI2uiv;
215         pglVertexAttribI3uiv glVertexAttribI3uiv;
216         pglVertexAttribI4uiv glVertexAttribI4uiv;
217         pglVertexAttribI4bv glVertexAttribI4bv;
218         pglVertexAttribI4sv glVertexAttribI4sv;
219         pglVertexAttribI4ubv glVertexAttribI4ubv;
220         pglVertexAttribI4usv glVertexAttribI4usv;
221         pglGetUniformuiv glGetUniformuiv;
222         pglBindFragDataLocation glBindFragDataLocation;
223         pglGetFragDataLocation glGetFragDataLocation;
224         pglUniform1ui glUniform1ui;
225         pglUniform2ui glUniform2ui;
226         pglUniform3ui glUniform3ui;
227         pglUniform4ui glUniform4ui;
228         pglUniform1uiv glUniform1uiv;
229         pglUniform2uiv glUniform2uiv;
230         pglUniform3uiv glUniform3uiv;
231         pglUniform4uiv glUniform4uiv;
232         pglTexParameterIiv glTexParameterIiv;
233         pglTexParameterIuiv glTexParameterIuiv;
234         pglGetTexParameterIiv glGetTexParameterIiv;
235         pglGetTexParameterIuiv glGetTexParameterIuiv;
236         pglClearBufferiv glClearBufferiv;
237         pglClearBufferuiv glClearBufferuiv;
238         pglClearBufferfv glClearBufferfv;
239         pglClearBufferfi glClearBufferfi;
240         pglGetStringi glGetStringi;
241     }
242 
243     package(bindbc.opengl) @nogc nothrow
244     bool loadGL30(SharedLib lib, GLSupport contextVersion)
245     {
246         import bindbc.opengl.bind.arb : loadARB30;
247 
248         if(contextVersion >= GLSupport.gl30) {
249             lib.bindGLSymbol(cast(void**)&glColorMaski, "glColorMaski");
250             lib.bindGLSymbol(cast(void**)&glGetBooleani_v, "glGetBooleani_v");
251             lib.bindGLSymbol(cast(void**)&glGetIntegeri_v, "glGetIntegeri_v");
252             lib.bindGLSymbol(cast(void**)&glEnablei, "glEnablei");
253             lib.bindGLSymbol(cast(void**)&glDisablei, "glDisablei");
254             lib.bindGLSymbol(cast(void**)&glIsEnabledi, "glIsEnabledi");
255             lib.bindGLSymbol(cast(void**)&glBeginTransformFeedback, "glBeginTransformFeedback");
256             lib.bindGLSymbol(cast(void**)&glEndTransformFeedback, "glEndTransformFeedback");
257             lib.bindGLSymbol(cast(void**)&glBindBufferRange, "glBindBufferRange");
258             lib.bindGLSymbol(cast(void**)&glBindBufferBase, "glBindBufferBase");
259             lib.bindGLSymbol(cast(void**)&glTransformFeedbackVaryings, "glTransformFeedbackVaryings");
260             lib.bindGLSymbol(cast(void**)&glGetTransformFeedbackVarying, "glGetTransformFeedbackVarying");
261             lib.bindGLSymbol(cast(void**)&glClampColor, "glClampColor");
262             lib.bindGLSymbol(cast(void**)&glBeginConditionalRender, "glBeginConditionalRender");
263             lib.bindGLSymbol(cast(void**)&glEndConditionalRender, "glEndConditionalRender");
264             lib.bindGLSymbol(cast(void**)&glVertexAttribIPointer, "glVertexAttribIPointer");
265             lib.bindGLSymbol(cast(void**)&glGetVertexAttribIiv, "glGetVertexAttribIiv");
266             lib.bindGLSymbol(cast(void**)&glGetVertexAttribIuiv, "glGetVertexAttribIuiv");
267             lib.bindGLSymbol(cast(void**)&glVertexAttribI1i, "glVertexAttribI1i");
268             lib.bindGLSymbol(cast(void**)&glVertexAttribI2i, "glVertexAttribI2i");
269             lib.bindGLSymbol(cast(void**)&glVertexAttribI3i, "glVertexAttribI3i");
270             lib.bindGLSymbol(cast(void**)&glVertexAttribI4i, "glVertexAttribI4i");
271             lib.bindGLSymbol(cast(void**)&glVertexAttribI1ui, "glVertexAttribI1ui");
272             lib.bindGLSymbol(cast(void**)&glVertexAttribI2ui, "glVertexAttribI2ui");
273             lib.bindGLSymbol(cast(void**)&glVertexAttribI3ui, "glVertexAttribI3ui");
274             lib.bindGLSymbol(cast(void**)&glVertexAttribI4ui, "glVertexAttribI4ui");
275             lib.bindGLSymbol(cast(void**)&glVertexAttribI1iv, "glVertexAttribI1iv");
276             lib.bindGLSymbol(cast(void**)&glVertexAttribI2iv, "glVertexAttribI2iv");
277             lib.bindGLSymbol(cast(void**)&glVertexAttribI3iv, "glVertexAttribI3iv");
278             lib.bindGLSymbol(cast(void**)&glVertexAttribI4iv, "glVertexAttribI4iv");
279             lib.bindGLSymbol(cast(void**)&glVertexAttribI1uiv, "glVertexAttribI1uiv");
280             lib.bindGLSymbol(cast(void**)&glVertexAttribI2uiv, "glVertexAttribI2uiv");
281             lib.bindGLSymbol(cast(void**)&glVertexAttribI3uiv, "glVertexAttribI3uiv");
282             lib.bindGLSymbol(cast(void**)&glVertexAttribI4uiv, "glVertexAttribI4uiv");
283             lib.bindGLSymbol(cast(void**)&glVertexAttribI4bv, "glVertexAttribI4bv");
284             lib.bindGLSymbol(cast(void**)&glVertexAttribI4sv, "glVertexAttribI4sv");
285             lib.bindGLSymbol(cast(void**)&glVertexAttribI4ubv, "glVertexAttribI4ubv");
286             lib.bindGLSymbol(cast(void**)&glVertexAttribI4usv, "glVertexAttribI4usv");
287             lib.bindGLSymbol(cast(void**)&glGetUniformuiv, "glGetUniformuiv");
288             lib.bindGLSymbol(cast(void**)&glBindFragDataLocation, "glBindFragDataLocation");
289             lib.bindGLSymbol(cast(void**)&glGetFragDataLocation, "glGetFragDataLocation");
290             lib.bindGLSymbol(cast(void**)&glUniform1ui, "glUniform1ui");
291             lib.bindGLSymbol(cast(void**)&glUniform2ui, "glUniform2ui");
292             lib.bindGLSymbol(cast(void**)&glUniform3ui, "glUniform3ui");
293             lib.bindGLSymbol(cast(void**)&glUniform4ui, "glUniform4ui");
294             lib.bindGLSymbol(cast(void**)&glUniform1uiv, "glUniform1uiv");
295             lib.bindGLSymbol(cast(void**)&glUniform2uiv, "glUniform2uiv");
296             lib.bindGLSymbol(cast(void**)&glUniform3uiv, "glUniform3uiv");
297             lib.bindGLSymbol(cast(void**)&glUniform4uiv, "glUniform4uiv");
298             lib.bindGLSymbol(cast(void**)&glTexParameterIiv, "glTexParameterIiv");
299             lib.bindGLSymbol(cast(void**)&glTexParameterIuiv, "glTexParameterIuiv");
300             lib.bindGLSymbol(cast(void**)&glGetTexParameterIiv, "glGetTexParameterIiv");
301             lib.bindGLSymbol(cast(void**)&glGetTexParameterIuiv, "glGetTexParameterIuiv");
302             lib.bindGLSymbol(cast(void**)&glClearBufferiv, "glClearBufferiv");
303             lib.bindGLSymbol(cast(void**)&glClearBufferuiv, "glClearBufferuiv");
304             lib.bindGLSymbol(cast(void**)&glClearBufferfv, "glClearBufferfv");
305             lib.bindGLSymbol(cast(void**)&glClearBufferfi, "glClearBufferfi");
306             lib.bindGLSymbol(cast(void**)&glGetStringi, "glGetStringi");
307 
308             if(errorCountGL() == 0 && loadARB30(lib, contextVersion)) return true;
309         }
310         return false;
311     }
312 }