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.arb.core_45;
8 
9 import bindbc.loader;
10 import bindbc.opengl.config,
11        bindbc.opengl.context;
12 import bindbc.opengl.bind.types;
13 
14 static if(glSupport >= GLSupport.gl45) {
15     enum has45 = true;
16 }
17 else enum has45 = false;
18 
19 // ARB_clip_control
20 version(GL_ARB) enum useARBClipControl = true;
21 else version(GL_ARB_clip_control) enum useARBClipControl = true;
22 else enum useARBClipControl = has45;
23 
24 static if(useARBClipControl) {
25     private bool _hasARBClipControl;
26     @nogc nothrow bool hasARBClipControl() { return _hasARBClipControl; }
27 
28     enum : uint {
29         GL_NEGATIVE_ONE_TO_ONE            = 0x935E,
30         GL_ZERO_TO_ONE                    = 0x935F,
31         GL_CLIP_ORIGIN                    = 0x935C,
32         GL_CLIP_DEPTH_MODE                = 0x935D,
33     }
34 
35     extern(System) @nogc nothrow alias pglClipControl = void function(GLenum,GLenum);
36     __gshared pglClipControl glClipControl;
37 
38     private @nogc nothrow
39     bool loadARBClipControl(SharedLib lib, GLSupport contextVersion)
40     {
41         lib.bindGLSymbol(cast(void**)&glClipControl, "glClipControl");
42         return resetErrorCountGL;
43     }
44 }
45 else enum hasARBClipControl = false;
46 
47 // ARB_conditional_render_inverted
48 version(GL_ARB) enum useARBConditionalRenderInverted = true;
49 else version(GL_ARB_conditional_render_inverted) enum useARBConditionalRenderInverted = true;
50 else enum useARBConditionalRenderInverted = has45;
51 
52 static if(useARBConditionalRenderInverted) {
53     private bool _hasARBConditionalRenderInverted;
54     @nogc nothrow bool hasARBConditionalRenderInverted() { return _hasARBConditionalRenderInverted; }
55 
56     enum : uint {
57         GL_QUERY_WAIT_INVERTED            = 0x8E17,
58         GL_QUERY_NO_WAIT_INVERTED         = 0x8E18,
59         GL_QUERY_BY_REGION_WAIT_INVERTED  = 0x8E19,
60         GL_QUERY_BY_REGION_NO_WAIT_INVERTED = 0x8E1A,
61     }
62 }
63 else enum hasARBConditionalRenderInverted = false;
64 
65 // ARB_cull_distance
66 version(GL_ARB) enum useARBCullDistance = true;
67 else version(GL_ARB_cull_distance) enum useARBCullDistance = true;
68 else enum useARBCullDistance = has45;
69 
70 static if(useARBCullDistance) {
71     private bool _hasARBCullDistance;
72     @nogc nothrow bool hasARBCullDistance() { return _hasARBCullDistance; }
73 
74     enum : uint {
75         GL_MAX_CULL_DISTANCES = 0x82F9,
76         GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES = 0x82FA,
77     }
78 }
79 else enum hasARBCullDistance = false;
80 
81 // ARB_direct_state_access
82 version(GL_ARB) enum useARBDirectStateAccess = true;
83 else version(GL_ARB_direct_state_access) enum useARBDirectStateAccess = true;
84 else enum useARBDirectStateAccess = has45;
85 
86 static if(useARBDirectStateAccess) {
87     private bool _hasARBDirectStateAccess;
88     @nogc nothrow bool hasARBDirectStateAccess() { return _hasARBDirectStateAccess; }
89 
90     enum : uint {
91         GL_TEXTURE_TARGET = 0x1006,
92         GL_QUERY_TARGET = 0x82EA,
93     }
94 
95     extern(System) @nogc nothrow {
96         alias pglCreateTransformFeedbacks = void function(GLsizei,GLuint*);
97         alias pglTransformFeedbackBufferBase = void function(GLsizei,GLuint,GLuint);
98         alias pglTransformFeedbackBufferRange = void function(GLuint,GLuint,GLuint,GLintptr,GLsizei);
99         alias pglGetTransformFeedbackiv = void function(GLuint,GLenum,GLint*);
100         alias pglGetTransformFeedbacki_v = void function(GLuint,GLenum,GLuint,GLint*);
101         alias pglGetTransformFeedbacki64_v = void function(GLuint,GLenum,GLuint,GLint64*);
102         alias pglCreateBuffers = void function(GLsizei,GLuint*);
103         alias pglNamedBufferStorage = void function(GLuint,GLsizeiptr,const(void)*,GLbitfield);
104         alias pglNamedBufferData = void function(GLuint,GLsizeiptr,const(void)*,GLenum);
105         alias pglNamedBufferSubData = void function(GLuint,GLintptr,GLsizeiptr,const(void)*);
106         alias pglCopyNamedBufferSubData = void function(GLuint,GLuint,GLintptr,GLintptr,GLsizeiptr);
107         alias pglClearNamedBufferData = void function(GLuint,GLenum,GLenum,GLenum,const(void)*);
108         alias pglClearNamedBufferSubData = void function(GLuint,GLenum,GLintptr,GLsizeiptr,GLenum,GLenum,const(void)*);
109         alias pglMapNamedBuffer = void* function(GLuint,GLenum);
110         alias pglMapNamedBufferRange = void* function(GLuint,GLintptr,GLsizeiptr,GLbitfield);
111         alias pglUnmapNamedBuffer = GLboolean function(GLuint);
112         alias pglFlushMappedNamedBufferRange = void function(GLuint,GLintptr,GLsizeiptr);
113         alias pglGetNamedBufferParameteriv = void function(GLuint,GLenum,GLint*);
114         alias pglGetNamedBufferParameteri64v = void function(GLuint,GLenum,GLint64*);
115         alias pglGetNamedBufferPointerv = void function(GLuint,GLenum,void**);
116         alias pglGetNamedBufferSubData = void function(GLuint,GLintptr,GLsizeiptr,void*);
117         alias pglCreateFramebuffers = void function(GLsizei,GLuint*);
118         alias pglNamedFramebufferRenderbuffer = void function(GLuint,GLenum,GLenum,GLuint);
119         alias pglNamedFramebufferParameteri = void function(GLuint,GLenum,GLint);
120         alias pglNamedFramebufferTexture = void function(GLuint,GLenum,GLuint,GLint);
121         alias pglNamedFramebufferTextureLayer = void function(GLuint,GLenum,GLuint,GLint,GLint);
122         alias pglNamedFramebufferDrawBuffer = void function(GLuint,GLenum);
123         alias pglNamedFramebufferDrawBuffers = void function(GLuint,GLsizei,const(GLenum)*);
124         alias pglNamedFramebufferReadBuffer = void function(GLuint,GLenum);
125         alias pglInvalidateNamedFramebufferData = void function(GLuint,GLsizei,const(GLenum)*);
126         alias pglInvalidateNamedFramebufferSubData = void function(GLuint,GLsizei,const(GLenum)*,GLint,GLint,GLsizei,GLsizei);
127         alias pglClearNamedFramebufferiv = void function(GLuint,GLenum,GLint,const(GLint)*);
128         alias pglClearNamedFramebufferuiv = void function(GLuint,GLenum,GLint,const(GLuint)*);
129         alias pglClearNamedFramebufferfv = void function(GLuint,GLenum,GLint,const(GLfloat)*);
130         alias pglClearNamedFramebufferfi = void function(GLuint,GLenum,GLint,GLfloat,GLint);
131         alias pglBlitNamedFramebuffer = void function(GLuint,GLuint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum);
132         alias pglCheckNamedFramebufferStatus = GLenum function(GLuint,GLenum);
133         alias pglGetNamedFramebufferParameteriv = void function(GLuint,GLenum,GLint*);
134         alias pglGetNamedFramebufferAttachmentParameteriv = void function(GLuint,GLenum,GLenum,GLint*);
135         alias pglCreateRenderbuffers = void function(GLsizei,GLuint*);
136         alias pglNamedRenderbufferStorage = void function(GLuint,GLenum,GLsizei,GLsizei);
137         alias pglNamedRenderbufferStorageMultisample = void function(GLuint,GLsizei,GLenum,GLsizei,GLsizei);
138         alias pglGetNamedRenderbufferParameteriv = void function(GLuint,GLenum,GLint*);
139         alias pglCreateTextures = void function(GLenum,GLsizei,GLuint*);
140         alias pglTextureBuffer = void function(GLuint,GLenum,GLuint);
141         alias pglTextureBufferRange = void function(GLuint,GLenum,GLuint,GLintptr,GLsizeiptr);
142         alias pglTextureStorage1D = void function(GLuint,GLsizei,GLenum,GLsizei);
143         alias pglTextureStorage2D = void function(GLuint,GLsizei,GLenum,GLsizei,GLsizei);
144         alias pglTextureStorage3D = void function(GLuint,GLsizei,GLenum,GLsizei,GLsizei,GLsizei);
145         alias pglTextureStorage2DMultisample = void function(GLuint,GLsizei,GLenum,GLsizei,GLsizei,GLboolean);
146         alias pglTextureStorage3DMultisample = void function(GLuint,GLsizei,GLenum,GLsizei,GLsizei,GLsizei,GLboolean);
147         alias pglTextureSubImage1D = void function(GLuint,GLint,GLint,GLsizei,GLenum,GLenum,const(void)*);
148         alias pglTextureSubImage2D = void function(GLuint,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const(void)*);
149         alias pglTextureSubImage3D = void function(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const(void)*);
150         alias pglCompressedTextureSubImage1D = void function(GLuint,GLint,GLint,GLsizei,GLenum,GLsizei,const(void)*);
151         alias pglCompressedTextureSubImage2D = void function(GLuint,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const(void)*);
152         alias pglCompressedTextureSubImage3D = void function(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const(void)*);
153         alias pglCopyTextureSubImage1D = void function(GLuint,GLint,GLint,GLint,GLint,GLsizei);
154         alias pglCopyTextureSubImage2D = void function(GLuint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei);
155         alias pglCopyTextureSubImage3D = void function(GLuint,GLint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei);
156         alias pglTextureParameterf = void function(GLuint,GLenum,GLfloat);
157         alias pglTextureParameterfv = void function(GLuint,GLenum,const(GLfloat)*);
158         alias pglTextureParameteri = void function(GLuint,GLenum,GLint);
159         alias pglTextureParameterIiv = void function(GLuint,GLenum,const(GLint)*);
160         alias pglTextureParameterIuiv = void function(GLuint,GLenum,const(GLuint)*);
161         alias pglTextureParameteriv = void function(GLuint,GLenum,const(GLint)*);
162         alias pglGenerateTextureMipmap = void function(GLuint);
163         alias pglBindTextureUnit = void function(GLuint,GLuint);
164         alias pglGetTextureImage = void function(GLuint,GLint,GLenum,GLenum,GLsizei,void*);
165         alias pglGetCompressedTextureImage = void function(GLuint,GLint,GLsizei,void*);
166         alias pglGetTextureLevelParameterfv = void function(GLuint,GLint,GLenum,GLfloat*);
167         alias pglGetTextureLevelParameteriv = void function(GLuint,GLint,GLenum,GLint*);
168         alias pglGetTextureParameterfv = void function(GLuint,GLenum,GLfloat*);
169         alias pglGetTextureParameterIiv = void function(GLuint,GLenum,GLint*);
170         alias pglGetTextureParameterIuiv = void function(GLuint,GLenum,GLuint*);
171         alias pglGetTextureParameteriv = void function(GLuint,GLenum,GLint*);
172         alias pglCreateVertexArrays = void function(GLsizei,GLuint*);
173         alias pglDisableVertexArrayAttrib = void function(GLuint,GLuint);
174         alias pglEnableVertexArrayAttrib = void function(GLuint,GLuint);
175         alias pglVertexArrayElementBuffer = void function(GLuint,GLuint);
176         alias pglVertexArrayVertexBuffer = void function(GLuint,GLuint,GLuint,GLintptr,GLsizei);
177         alias pglVertexArrayVertexBuffers = void function(GLuint,GLuint,GLsizei,const(GLuint)*,const(GLintptr)*,const(GLsizei)*);
178         alias pglVertexArrayAttribFormat = void function(GLuint,GLuint,GLint,GLenum,GLboolean,GLuint);
179         alias pglVertexArrayAttribIFormat = void function(GLuint,GLuint,GLint,GLenum,GLuint);
180         alias pglVertexArrayAttribLFormat = void function(GLuint,GLuint,GLint,GLenum,GLuint);
181         alias pglVertexArrayAttribBinding = void function(GLuint,GLuint,GLuint);
182         alias pglVertexArrayBindingDivisor = void function(GLuint,GLuint,GLuint);
183         alias pglGetVertexArrayiv = void function(GLuint,GLenum,GLint*);
184         alias pglGetVertexArrayIndexediv = void function(GLuint,GLuint,GLenum,GLint*);
185         alias pglGetVertexArrayIndexed64iv = void function(GLuint,GLuint,GLenum,GLint64*);
186         alias pglCreateSamplers = void function(GLsizei,GLuint*);
187         alias pglCreateProgramPipelines = void function(GLsizei,GLuint*);
188         alias pglCreateQueries = void function(GLenum,GLsizei,GLuint*);
189         alias pglGetQueryBufferObjectiv = void function(GLuint,GLuint,GLenum,GLintptr);
190         alias pglGetQueryBufferObjectuiv = void function(GLuint,GLuint,GLenum,GLintptr);
191         alias pglGetQueryBufferObjecti64v = void function(GLuint,GLuint,GLenum,GLintptr);
192         alias pglGetQueryBufferObjectui64v = void function(GLuint,GLuint,GLenum,GLintptr);
193     }
194 
195     __gshared {
196         pglCreateTransformFeedbacks glCreateTransformFeedbacks;
197         pglTransformFeedbackBufferBase glTransformFeedbackBufferBase;
198         pglTransformFeedbackBufferRange glTransformFeedbackBufferRange;
199         pglGetTransformFeedbackiv glGetTransformFeedbackiv;
200         pglGetTransformFeedbacki_v glGetTransformFeedbacki_v;
201         pglGetTransformFeedbacki64_v glGetTransformFeedbacki64_v;
202         pglCreateBuffers glCreateBuffers;
203         pglNamedBufferStorage glNamedBufferStorage;
204         pglNamedBufferData glNamedBufferData;
205         pglNamedBufferSubData glNamedBufferSubData;
206         pglCopyNamedBufferSubData glCopyNamedBufferSubData;
207         pglClearNamedBufferData glClearNamedBufferData;
208         pglClearNamedBufferSubData glClearNamedBufferSubData;
209         pglMapNamedBuffer glMapNamedBuffer;
210         pglMapNamedBufferRange glMapNamedBufferRange;
211         pglUnmapNamedBuffer glUnmapNamedBuffer;
212         pglFlushMappedNamedBufferRange glFlushMappedNamedBufferRange;
213         pglGetNamedBufferParameteriv glGetNamedBufferParameteriv;
214         pglGetNamedBufferParameteri64v glGetNamedBufferParameteri64v;
215         pglGetNamedBufferPointerv glGetNamedBufferPointerv;
216         pglGetNamedBufferSubData glGetNamedBufferSubData;
217         pglCreateFramebuffers glCreateFramebuffers;
218         pglNamedFramebufferRenderbuffer glNamedFramebufferRenderbuffer;
219         pglNamedFramebufferParameteri glNamedFramebufferParameteri;
220         pglNamedFramebufferTexture glNamedFramebufferTexture;
221         pglNamedFramebufferTextureLayer glNamedFramebufferTextureLayer;
222         pglNamedFramebufferDrawBuffer glNamedFramebufferDrawBuffer;
223         pglNamedFramebufferDrawBuffers glNamedFramebufferDrawBuffers;
224         pglNamedFramebufferReadBuffer glNamedFramebufferReadBuffer;
225         pglInvalidateNamedFramebufferData glInvalidateNamedFramebufferData;
226         pglInvalidateNamedFramebufferSubData glInvalidateNamedFramebufferSubData;
227         pglClearNamedFramebufferiv glClearNamedFramebufferiv;
228         pglClearNamedFramebufferuiv glClearNamedFramebufferuiv;
229         pglClearNamedFramebufferfv glClearNamedFramebufferfv;
230         pglClearNamedFramebufferfi glClearNamedFramebufferfi;
231         pglBlitNamedFramebuffer glBlitNamedFramebuffer;
232         pglCheckNamedFramebufferStatus glCheckNamedFramebufferStatus;
233         pglGetNamedFramebufferParameteriv glGetNamedFramebufferParameteriv;
234         pglGetNamedFramebufferAttachmentParameteriv glGetNamedFramebufferAttachmentParameteriv;
235         pglCreateRenderbuffers glCreateRenderbuffers;
236         pglNamedRenderbufferStorage glNamedRenderbufferStorage;
237         pglNamedRenderbufferStorageMultisample glNamedRenderbufferStorageMultisample;
238         pglGetNamedRenderbufferParameteriv glGetNamedRenderbufferParameteriv;
239         pglCreateTextures glCreateTextures;
240         pglTextureBuffer glTextureBuffer;
241         pglTextureBufferRange glTextureBufferRange;
242         pglTextureStorage1D glTextureStorage1D;
243         pglTextureStorage2D glTextureStorage2D;
244         pglTextureStorage3D glTextureStorage3D;
245         pglTextureStorage2DMultisample glTextureStorage2DMultisample;
246         pglTextureStorage3DMultisample glTextureStorage3DMultisample;
247         pglTextureSubImage1D glTextureSubImage1D;
248         pglTextureSubImage2D glTextureSubImage2D;
249         pglTextureSubImage3D glTextureSubImage3D;
250         pglCompressedTextureSubImage1D glCompressedTextureSubImage1D;
251         pglCompressedTextureSubImage2D glCompressedTextureSubImage2D;
252         pglCompressedTextureSubImage3D glCompressedTextureSubImage3D;
253         pglCopyTextureSubImage1D glCopyTextureSubImage1D;
254         pglCopyTextureSubImage2D glCopyTextureSubImage2D;
255         pglCopyTextureSubImage3D glCopyTextureSubImage3D;
256         pglTextureParameterf glTextureParameterf;
257         pglTextureParameterfv glTextureParameterfv;
258         pglTextureParameteri glTextureParameteri;
259         pglTextureParameterIiv glTextureParameterIiv;
260         pglTextureParameterIuiv glTextureParameterIuiv;
261         pglTextureParameteriv glTextureParameteriv;
262         pglGenerateTextureMipmap glGenerateTextureMipmap;
263         pglBindTextureUnit glBindTextureUnit;
264         pglGetTextureImage glGetTextureImage;
265         pglGetCompressedTextureImage glGetCompressedTextureImage;
266         pglGetTextureLevelParameterfv glGetTextureLevelParameterfv;
267         pglGetTextureLevelParameteriv glGetTextureLevelParameteriv;
268         pglGetTextureParameterfv glGetTextureParameterfv;
269         pglGetTextureParameterIiv glGetTextureParameterIiv;
270         pglGetTextureParameterIuiv glGetTextureParameterIuiv;
271         pglGetTextureParameteriv glGetTextureParameteriv;
272         pglCreateVertexArrays glCreateVertexArrays;
273         pglDisableVertexArrayAttrib glDisableVertexArrayAttrib;
274         pglEnableVertexArrayAttrib glEnableVertexArrayAttrib;
275         pglVertexArrayElementBuffer glVertexArrayElementBuffer;
276         pglVertexArrayVertexBuffer glVertexArrayVertexBuffer;
277         pglVertexArrayVertexBuffers glVertexArrayVertexBuffers;
278         pglVertexArrayAttribBinding glVertexArrayAttribBinding;
279         pglVertexArrayAttribFormat glVertexArrayAttribFormat;
280         pglVertexArrayAttribIFormat glVertexArrayAttribIFormat;
281         pglVertexArrayAttribLFormat glVertexArrayAttribLFormat;
282         pglVertexArrayBindingDivisor glVertexArrayBindingDivisor;
283         pglGetVertexArrayiv glGetVertexArrayiv;
284         pglGetVertexArrayIndexediv glGetVertexArrayIndexediv;
285         pglGetVertexArrayIndexed64iv glGetVertexArrayIndexed64iv;
286         pglCreateSamplers glCreateSamplers;
287         pglCreateProgramPipelines glCreateProgramPipelines;
288         pglCreateQueries glCreateQueries;
289         pglGetQueryBufferObjecti64v glGetQueryBufferObjecti64v;
290         pglGetQueryBufferObjectiv glGetQueryBufferObjectiv;
291         pglGetQueryBufferObjectui64v glGetQueryBufferObjectui64v;
292         pglGetQueryBufferObjectuiv glGetQueryBufferObjectuiv;
293     }
294 
295     private @nogc nothrow
296     bool loadARBDirectStateAccess(SharedLib lib, GLSupport contextVersion)
297     {
298         lib.bindGLSymbol(cast(void**)&glCreateTransformFeedbacks, "glCreateTransformFeedbacks");
299         lib.bindGLSymbol(cast(void**)&glTransformFeedbackBufferBase, "glTransformFeedbackBufferBase");
300         lib.bindGLSymbol(cast(void**)&glTransformFeedbackBufferRange, "glTransformFeedbackBufferRange");
301         lib.bindGLSymbol(cast(void**)&glGetTransformFeedbackiv, "glGetTransformFeedbackiv");
302         lib.bindGLSymbol(cast(void**)&glGetTransformFeedbacki_v, "glGetTransformFeedbacki_v");
303         lib.bindGLSymbol(cast(void**)&glGetTransformFeedbacki64_v, "glGetTransformFeedbacki64_v");
304         lib.bindGLSymbol(cast(void**)&glCreateBuffers, "glCreateBuffers");
305         lib.bindGLSymbol(cast(void**)&glNamedBufferStorage, "glNamedBufferStorage");
306         lib.bindGLSymbol(cast(void**)&glNamedBufferData, "glNamedBufferData");
307         lib.bindGLSymbol(cast(void**)&glNamedBufferSubData, "glNamedBufferSubData");
308         lib.bindGLSymbol(cast(void**)&glCopyNamedBufferSubData, "glCopyNamedBufferSubData");
309         lib.bindGLSymbol(cast(void**)&glClearNamedBufferData, "glClearNamedBufferData");
310         lib.bindGLSymbol(cast(void**)&glClearNamedBufferSubData, "glClearNamedBufferSubData");
311         lib.bindGLSymbol(cast(void**)&glMapNamedBuffer, "glMapNamedBuffer");
312         lib.bindGLSymbol(cast(void**)&glMapNamedBufferRange, "glMapNamedBufferRange");
313         lib.bindGLSymbol(cast(void**)&glUnmapNamedBuffer, "glUnmapNamedBuffer");
314         lib.bindGLSymbol(cast(void**)&glFlushMappedNamedBufferRange, "glFlushMappedNamedBufferRange");
315         lib.bindGLSymbol(cast(void**)&glGetNamedBufferParameteriv, "glGetNamedBufferParameteriv");
316         lib.bindGLSymbol(cast(void**)&glGetNamedBufferParameteri64v, "glGetNamedBufferParameteri64v");
317         lib.bindGLSymbol(cast(void**)&glGetNamedBufferPointerv, "glGetNamedBufferPointerv");
318         lib.bindGLSymbol(cast(void**)&glGetNamedBufferSubData, "glGetNamedBufferSubData");
319         lib.bindGLSymbol(cast(void**)&glCreateFramebuffers, "glCreateFramebuffers");
320         lib.bindGLSymbol(cast(void**)&glNamedFramebufferRenderbuffer, "glNamedFramebufferRenderbuffer");
321         lib.bindGLSymbol(cast(void**)&glNamedFramebufferParameteri, "glNamedFramebufferParameteri");
322         lib.bindGLSymbol(cast(void**)&glNamedFramebufferTexture, "glNamedFramebufferTexture");
323         lib.bindGLSymbol(cast(void**)&glNamedFramebufferTextureLayer, "glNamedFramebufferTextureLayer");
324         lib.bindGLSymbol(cast(void**)&glNamedFramebufferDrawBuffer, "glNamedFramebufferDrawBuffer");
325         lib.bindGLSymbol(cast(void**)&glNamedFramebufferDrawBuffers, "glNamedFramebufferDrawBuffers");
326         lib.bindGLSymbol(cast(void**)&glNamedFramebufferReadBuffer, "glNamedFramebufferReadBuffer");
327         lib.bindGLSymbol(cast(void**)&glInvalidateNamedFramebufferData, "glInvalidateNamedFramebufferData");
328         lib.bindGLSymbol(cast(void**)&glInvalidateNamedFramebufferSubData, "glInvalidateNamedFramebufferSubData");
329         lib.bindGLSymbol(cast(void**)&glClearNamedFramebufferiv, "glClearNamedFramebufferiv");
330         lib.bindGLSymbol(cast(void**)&glClearNamedFramebufferuiv, "glClearNamedFramebufferuiv");
331         lib.bindGLSymbol(cast(void**)&glClearNamedFramebufferfv, "glClearNamedFramebufferfv");
332         lib.bindGLSymbol(cast(void**)&glClearNamedFramebufferfi, "glClearNamedFramebufferfi");
333         lib.bindGLSymbol(cast(void**)&glBlitNamedFramebuffer, "glBlitNamedFramebuffer");
334         lib.bindGLSymbol(cast(void**)&glCheckNamedFramebufferStatus, "glCheckNamedFramebufferStatus");
335         lib.bindGLSymbol(cast(void**)&glGetNamedFramebufferParameteriv, "glGetNamedFramebufferParameteriv");
336         lib.bindGLSymbol(cast(void**)&glGetNamedFramebufferAttachmentParameteriv, "glGetNamedFramebufferAttachmentParameteriv");
337         lib.bindGLSymbol(cast(void**)&glCreateRenderbuffers, "glCreateRenderbuffers");
338         lib.bindGLSymbol(cast(void**)&glNamedRenderbufferStorage, "glNamedRenderbufferStorage");
339         lib.bindGLSymbol(cast(void**)&glNamedRenderbufferStorageMultisample, "glNamedRenderbufferStorageMultisample");
340         lib.bindGLSymbol(cast(void**)&glGetNamedRenderbufferParameteriv, "glGetNamedRenderbufferParameteriv");
341         lib.bindGLSymbol(cast(void**)&glCreateTextures, "glCreateTextures");
342         lib.bindGLSymbol(cast(void**)&glTextureBuffer, "glTextureBuffer");
343         lib.bindGLSymbol(cast(void**)&glTextureBufferRange, "glTextureBufferRange");
344         lib.bindGLSymbol(cast(void**)&glTextureStorage1D, "glTextureStorage1D");
345         lib.bindGLSymbol(cast(void**)&glTextureStorage2D, "glTextureStorage2D");
346         lib.bindGLSymbol(cast(void**)&glTextureStorage3D, "glTextureStorage3D");
347         lib.bindGLSymbol(cast(void**)&glTextureStorage2DMultisample, "glTextureStorage2DMultisample");
348         lib.bindGLSymbol(cast(void**)&glTextureStorage3DMultisample, "glTextureStorage3DMultisample");
349         lib.bindGLSymbol(cast(void**)&glTextureSubImage1D, "glTextureSubImage1D");
350         lib.bindGLSymbol(cast(void**)&glTextureSubImage2D, "glTextureSubImage2D");
351         lib.bindGLSymbol(cast(void**)&glTextureSubImage3D, "glTextureSubImage3D");
352         lib.bindGLSymbol(cast(void**)&glCompressedTextureSubImage1D, "glCompressedTextureSubImage1D");
353         lib.bindGLSymbol(cast(void**)&glCompressedTextureSubImage2D, "glCompressedTextureSubImage2D");
354         lib.bindGLSymbol(cast(void**)&glCompressedTextureSubImage3D, "glCompressedTextureSubImage3D");
355         lib.bindGLSymbol(cast(void**)&glCopyTextureSubImage1D, "glCopyTextureSubImage1D");
356         lib.bindGLSymbol(cast(void**)&glCopyTextureSubImage2D, "glCopyTextureSubImage2D");
357         lib.bindGLSymbol(cast(void**)&glCopyTextureSubImage3D, "glCopyTextureSubImage3D");
358         lib.bindGLSymbol(cast(void**)&glTextureParameterf, "glTextureParameterf");
359         lib.bindGLSymbol(cast(void**)&glTextureParameterfv, "glTextureParameterfv");
360         lib.bindGLSymbol(cast(void**)&glTextureParameteri, "glTextureParameteri");
361         lib.bindGLSymbol(cast(void**)&glTextureParameterIiv, "glTextureParameterIiv");
362         lib.bindGLSymbol(cast(void**)&glTextureParameterIuiv, "glTextureParameterIuiv");
363         lib.bindGLSymbol(cast(void**)&glTextureParameteriv, "glTextureParameteriv");
364         lib.bindGLSymbol(cast(void**)&glGenerateTextureMipmap, "glGenerateTextureMipmap");
365         lib.bindGLSymbol(cast(void**)&glBindTextureUnit, "glBindTextureUnit");
366         lib.bindGLSymbol(cast(void**)&glGetTextureImage, "glGetTextureImage");
367         lib.bindGLSymbol(cast(void**)&glGetCompressedTextureImage, "glGetCompressedTextureImage");
368         lib.bindGLSymbol(cast(void**)&glGetTextureLevelParameterfv, "glGetTextureLevelParameterfv");
369         lib.bindGLSymbol(cast(void**)&glGetTextureLevelParameteriv, "glGetTextureLevelParameteriv");
370         lib.bindGLSymbol(cast(void**)&glGetTextureParameterfv, "glGetTextureParameterfv");
371         lib.bindGLSymbol(cast(void**)&glGetTextureParameterIiv, "glGetTextureParameterIiv");
372         lib.bindGLSymbol(cast(void**)&glGetTextureParameterIuiv, "glGetTextureParameterIuiv");
373         lib.bindGLSymbol(cast(void**)&glGetTextureParameteriv, "glGetTextureParameteriv");
374         lib.bindGLSymbol(cast(void**)&glCreateVertexArrays, "glCreateVertexArrays");
375         lib.bindGLSymbol(cast(void**)&glDisableVertexArrayAttrib, "glDisableVertexArrayAttrib");
376         lib.bindGLSymbol(cast(void**)&glEnableVertexArrayAttrib, "glEnableVertexArrayAttrib");
377         lib.bindGLSymbol(cast(void**)&glVertexArrayElementBuffer, "glVertexArrayElementBuffer");
378         lib.bindGLSymbol(cast(void**)&glVertexArrayVertexBuffer, "glVertexArrayVertexBuffer");
379         lib.bindGLSymbol(cast(void**)&glVertexArrayVertexBuffers, "glVertexArrayVertexBuffers");
380         lib.bindGLSymbol(cast(void**)&glVertexArrayAttribBinding, "glVertexArrayAttribBinding");
381         lib.bindGLSymbol(cast(void**)&glVertexArrayAttribFormat, "glVertexArrayAttribFormat");
382         lib.bindGLSymbol(cast(void**)&glVertexArrayAttribIFormat, "glVertexArrayAttribIFormat");
383         lib.bindGLSymbol(cast(void**)&glVertexArrayAttribLFormat, "glVertexArrayAttribLFormat");
384         lib.bindGLSymbol(cast(void**)&glVertexArrayBindingDivisor, "glVertexArrayBindingDivisor");
385         lib.bindGLSymbol(cast(void**)&glGetVertexArrayiv, "glGetVertexArrayiv");
386         lib.bindGLSymbol(cast(void**)&glGetVertexArrayIndexediv, "glGetVertexArrayIndexediv");
387         lib.bindGLSymbol(cast(void**)&glGetVertexArrayIndexed64iv, "glGetVertexArrayIndexed64iv");
388         lib.bindGLSymbol(cast(void**)&glCreateSamplers, "glCreateSamplers");
389         lib.bindGLSymbol(cast(void**)&glCreateProgramPipelines, "glCreateProgramPipelines");
390         lib.bindGLSymbol(cast(void**)&glCreateQueries, "glCreateQueries");
391         lib.bindGLSymbol(cast(void**)&glGetQueryBufferObjecti64v, "glGetQueryBufferObjecti64v");
392         lib.bindGLSymbol(cast(void**)&glGetQueryBufferObjectiv, "glGetQueryBufferObjectiv");
393         lib.bindGLSymbol(cast(void**)&glGetQueryBufferObjectui64v, "glGetQueryBufferObjectui64v");
394         lib.bindGLSymbol(cast(void**)&glGetQueryBufferObjectuiv, "glGetQueryBufferObjectuiv");
395 
396         return resetErrorCountGL();
397     }
398 }
399 else enum hasARBDirectStateAccess = false;
400 
401 // ARB_ES3_1_compatibility
402 version(GL_ARB) enum useARBES31Compatibility = true;
403 else version(GL_ARB_ES3_1_compatibility) enum useARBES31Compatibility = true;
404 else enum useARBES31Compatibility = has45;
405 
406 static if(useARBES31Compatibility) {
407     private bool _hasARBES31Compatibility;
408     @nogc nothrow bool hasARBES31Compatibility() { return _hasARBES31Compatibility; }
409 
410     extern(System) @nogc nothrow alias pglMemoryBarrierByRegion = void function(GLbitfield);
411     __gshared pglMemoryBarrierByRegion glMemoryBarrierByRegion;
412 
413     private @nogc nothrow
414     bool loadARBES31Compatibility(SharedLib lib, GLSupport contextVersion)
415     {
416         lib.bindGLSymbol(cast(void**)&glMemoryBarrierByRegion, "glMemoryBarrierByRegion");
417         return resetErrorCountGL;
418     }
419 }
420 else enum hasARBES31Compatibility = false;
421 
422 // ARB_get_texture_sub_image
423 version(GL_ARB) enum useARBGetTextureSubImage = true;
424 else version(GL_ARB_get_texture_sub_image) enum useARBGetTextureSubImage = true;
425 else enum useARBGetTextureSubImage = has45;
426 
427 static if(useARBGetTextureSubImage) {
428     private bool _hasARBGetTextureSubImage;
429     @nogc nothrow bool hasARBGetTextureSubImage() { return _hasARBGetTextureSubImage; }
430 
431     extern(System) @nogc nothrow {
432         alias pglGetTextureSubImage = void function(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,GLsizei,void*);
433         alias pglGetCompressedTextureSubImage = void function(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLsizei,void*);
434     }
435     __gshared {
436         pglGetTextureSubImage glGetTextureSubImage;
437         pglGetCompressedTextureSubImage glGetCompressedTextureSubImage;
438     }
439 
440     private @nogc nothrow
441     bool loadARBGetTextureSubImage(SharedLib lib, GLSupport contextVersion)
442     {
443         lib.bindGLSymbol(cast(void**)&glGetTextureSubImage,"glGetTextureSubImage");
444         lib.bindGLSymbol(cast(void**)&glGetCompressedTextureSubImage,"glGetCompressedTextureSubImage");
445         return resetErrorCountGL;
446     }
447 }
448 else enum hasARBGetTextureSubImage = false;
449 
450 // ARB_texture_barrier
451 version(GL_ARB) enum useARBTextureBarrier = true;
452 else version(GL_ARB_texture_barrier) enum useARBTextureBarrier = true;
453 else enum useARBTextureBarrier = has45;
454 
455 static if(useARBTextureBarrier) {
456     private bool _hasARBTextureBarrier;
457     @nogc nothrow bool hasARBTextureBarrier() { return _hasARBTextureBarrier; }
458 
459     extern(System) @nogc nothrow alias pglTextureBarrier = void function();
460     __gshared pglTextureBarrier glTextureBarrier;
461 
462     private @nogc nothrow
463     bool loadARBTextureBarrier(SharedLib lib, GLSupport contextVersion)
464     {
465         lib.bindGLSymbol(cast(void**)&glTextureBarrier, "glTextureBarrier");
466         return resetErrorCountGL;
467     }
468 }
469 else enum hasARBTextureBarrier = false;
470 
471 // KHR_context_flush_control
472 version(GL_ARB) enum useKHRContextFlushControl = true;
473 else version(GL_KHR_context_flush_control) enum useKHRContextFlushControl = true;
474 else enum useKHRContextFlushControl = has45;
475 
476 static if(useKHRContextFlushControl) {
477     private bool _hasKHRContextFlushControl;
478     @nogc nothrow bool hasKHRContextFlushControl() { return _hasKHRContextFlushControl; }
479 
480     enum : uint {
481         GL_CONTEXT_RELEASE_BEHAVIOR       = 0x82FB,
482         GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC,
483     }
484 }
485 else enum hasKHRContextFlushControl = false;
486 
487 // KHR_robustness
488 version(GL_ARB) enum useKHRRobustness = true;
489 else version(GL_KHR_robustness) enum useKHRRobustness = true;
490 else enum useKHRRobustness = has45;
491 
492 static if(useKHRRobustness) {
493     private bool _hasKHRRobustness;
494     @nogc nothrow bool hasKHRRobustness() { return _hasKHRRobustness; }
495 
496     enum : uint {
497         GL_GUILTY_CONTEXT_RESET           = 0x8253,
498         GL_INNOCENT_CONTEXT_RESET         = 0x8254,
499         GL_UNKNOWN_CONTEXT_RESET          = 0x8255,
500         GL_RESET_NOTIFICATION_STRATEGY    = 0x8256,
501         GL_LOSE_CONTEXT_ON_RESET          = 0x8252,
502         GL_NO_RESET_NOTIFICATION          = 0x8261,
503         GL_CONTEXT_LOST                   = 0x0507,
504         GL_CONTEXT_ROBUST_ACCESS          = 0x90F3,
505     }
506 
507     extern(System) @nogc nothrow {
508         alias pglGetGraphicsResetStatus = GLenum function();
509         alias pglReadnPixels = void function(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLsizei,void*);
510         alias pglGetnUniformfv = void function(GLuint,GLint,GLsizei,GLfloat*);
511         alias pglGetnUniformiv = void function(GLuint,GLint,GLsizei,GLint*);
512         alias pglGetnUniformuiv = void function(GLuint,GLint,GLsizei,GLuint*);
513     }
514     __gshared {
515         pglGetGraphicsResetStatus glGetGraphicsResetStatus;
516         pglReadnPixels glReadnPixels;
517         pglGetnUniformfv glGetnUniformfv;
518         pglGetnUniformiv glGetnUniformiv;
519         pglGetnUniformuiv glGetnUniformuiv;
520     }
521 
522     private @nogc nothrow
523     bool loadKHRRobustness(SharedLib lib, GLSupport contextVersion)
524     {
525         lib.bindGLSymbol(cast(void**)&glGetGraphicsResetStatus, "glGetGraphicsResetStatus");
526         lib.bindGLSymbol(cast(void**)&glReadnPixels, "glReadnPixels");
527         lib.bindGLSymbol(cast(void**)&glGetnUniformfv, "glGetnUniformfv");
528         lib.bindGLSymbol(cast(void**)&glGetnUniformiv, "glGetnUniformiv");
529         lib.bindGLSymbol(cast(void**)&glGetnUniformuiv, "glGetnUniformuiv");
530         return resetErrorCountGL;
531     }
532 }
533 else enum hasKHRRobustness = false;
534 
535 package(bindbc.opengl) @nogc nothrow
536 bool loadARB45(SharedLib lib, GLSupport contextVersion)
537 {
538     static if(has45) {
539         if(contextVersion >= GLSupport.gl45) {
540             _hasARBConditionalRenderInverted = true;
541             _hasARBCullDistance = true;
542             _hasKHRContextFlushControl = true;
543 
544             bool ret = true;
545             ret = _hasARBClipControl = lib.loadARBClipControl(contextVersion);
546             ret = _hasARBDirectStateAccess = lib.loadARBDirectStateAccess(contextVersion);
547             ret = _hasARBES31Compatibility = lib.loadARBES31Compatibility(contextVersion);
548             ret = _hasARBGetTextureSubImage = lib.loadARBGetTextureSubImage(contextVersion);
549             ret = _hasARBTextureBarrier = lib.loadARBTextureBarrier(contextVersion);
550             ret = _hasKHRRobustness = lib.loadKHRRobustness(contextVersion);
551             return ret;
552         }
553     }
554 
555     static if(useARBConditionalRenderInverted) _hasARBConditionalRenderInverted =
556             hasExtension(contextVersion, "GL_ARB_conditional_render_inverted");
557 
558     static if(useARBCullDistance) _hasARBCullDistance =
559             hasExtension(contextVersion, "GL_ARB_cull_distance");
560 
561     static if(useKHRContextFlushControl) _hasKHRContextFlushControl =
562             hasExtension(contextVersion, "GL_KHR_context_flush_control");
563 
564     static if(useARBClipControl) _hasARBClipControl =
565             hasExtension(contextVersion, "GL_ARB_clip_control") &&
566             lib.loadARBClipControl(contextVersion);
567 
568     static if(useARBDirectStateAccess) _hasARBDirectStateAccess =
569             hasExtension(contextVersion, "GL_ARB_direct_state_access") &&
570             lib.loadARBDirectStateAccess(contextVersion);
571 
572     static if(useARBES31Compatibility) _hasARBES31Compatibility =
573             hasExtension(contextVersion, "GL_ARB_ES3_1_compatibility") &&
574             lib.loadARBES31Compatibility(contextVersion);
575 
576     static if(useARBGetTextureSubImage) _hasARBGetTextureSubImage =
577             hasExtension(contextVersion, "GL_ARB_get_texture_sub_image") &&
578             lib.loadARBGetTextureSubImage(contextVersion);
579 
580     static if(useARBTextureBarrier) _hasARBTextureBarrier =
581             hasExtension(contextVersion, "GL_ARB_texture_barrier") &&
582             lib.loadARBTextureBarrier(contextVersion);
583 
584     static if(useKHRRobustness) _hasKHRRobustness =
585             hasExtension(contextVersion, "GL_KHR_robustness") &&
586             lib.loadKHRRobustness(contextVersion);
587 
588     return true;
589 }