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.gl31;
8 
9 import bindbc.opengl.config;
10 static if(glSupport >= GLSupport.gl31) {
11     import bindbc.loader : SharedLib;
12     import bindbc.opengl.context;
13     import bindbc.opengl.bind.types;
14 
15     enum : uint {
16         GL_SAMPLER_2D_RECT                = 0x8B63,
17         GL_SAMPLER_2D_RECT_SHADOW         = 0x8B64,
18         GL_SAMPLER_BUFFER                 = 0x8DC2,
19         GL_INT_SAMPLER_2D_RECT            = 0x8DCD,
20         GL_INT_SAMPLER_BUFFER             = 0x8DD0,
21         GL_UNSIGNED_INT_SAMPLER_2D_RECT   = 0x8DD5,
22         GL_UNSIGNED_INT_SAMPLER_BUFFER    = 0x8DD8,
23         GL_TEXTURE_BUFFER                 = 0x8C2A,
24         GL_MAX_TEXTURE_BUFFER_SIZE        = 0x8C2B,
25         GL_TEXTURE_BINDING_BUFFER         = 0x8C2C,
26         GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D,
27         GL_TEXTURE_BUFFER_FORMAT          = 0x8C2E,
28         GL_TEXTURE_RECTANGLE              = 0x84F5,
29         GL_TEXTURE_BINDING_RECTANGLE      = 0x84F6,
30         GL_PROXY_TEXTURE_RECTANGLE        = 0x84F7,
31         GL_MAX_RECTANGLE_TEXTURE_SIZE     = 0x84F8,
32         GL_RED_SNORM                      = 0x8F90,
33         GL_RG_SNORM                       = 0x8F91,
34         GL_RGB_SNORM                      = 0x8F92,
35         GL_RGBA_SNORM                     = 0x8F93,
36         GL_R8_SNORM                       = 0x8F94,
37         GL_RG8_SNORM                      = 0x8F95,
38         GL_RGB8_SNORM                     = 0x8F96,
39         GL_RGBA8_SNORM                    = 0x8F97,
40         GL_R16_SNORM                      = 0x8F98,
41         GL_RG16_SNORM                     = 0x8F99,
42         GL_RGB16_SNORM                    = 0x8F9A,
43         GL_RGBA16_SNORM                   = 0x8F9B,
44         GL_SIGNED_NORMALIZED              = 0x8F9C,
45         GL_PRIMITIVE_RESTART              = 0x8F9D,
46         GL_PRIMITIVE_RESTART_INDEX        = 0x8F9E,
47     }
48 
49     extern(System) @nogc nothrow {
50         alias pglDrawArraysInstanced = void function(GLenum,GLint,GLsizei,GLsizei);
51         alias pglDrawElementsInstanced = void function(GLenum,GLsizei,GLenum,const(GLvoid)*,GLsizei);
52         alias pglTexBuffer = void function(GLenum,GLenum,GLuint);
53         alias pglPrimitiveRestartIndex = void function(GLuint);
54     }
55 
56     __gshared {
57         pglDrawArraysInstanced glDrawArraysInstanced;
58         pglDrawElementsInstanced glDrawElementsInstanced;
59         pglTexBuffer glTexBuffer;
60         pglPrimitiveRestartIndex glPrimitiveRestartIndex;
61     }
62 
63     package(bindbc.opengl) @nogc nothrow
64     bool loadGL31(SharedLib lib, GLSupport contextVersion)
65     {
66         import bindbc.opengl.bind.arb : loadARB31;
67 
68         if(contextVersion >= GLSupport.gl31) {
69             lib.bindGLSymbol(cast(void**)&glDrawArraysInstanced, "glDrawArraysInstanced");
70             lib.bindGLSymbol(cast(void**)&glDrawElementsInstanced, "glDrawElementsInstanced");
71             lib.bindGLSymbol(cast(void**)&glTexBuffer, "glTexBuffer");
72             lib.bindGLSymbol(cast(void**)&glPrimitiveRestartIndex, "glPrimitiveRestartIndex");
73 
74             if(errorCountGL() == 0 && loadARB31(lib, contextVersion)) return true;
75         }
76         return false;
77     }
78 }