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.gl46;
8 
9 import bindbc.opengl.config;
10 static if(glSupport >= GLSupport.gl46) {
11     import bindbc.loader : SharedLib;
12     import bindbc.opengl.context,
13            bindbc.opengl.bind.types;
14 
15     enum : uint {
16         GL_SHADER_BINARY_FORMAT_SPIR_V          = 0x9551,
17         GL_SPIR_V_BINARY                        = 0x9552,
18         GL_PARAMETER_BUFFER                     = 0x80EE,
19         GL_PARAMETER_BUFFER_BINDING             = 0x80EF,
20         GL_CONTEXT_FLAG_NO_ERROR_BIT            = 0x00000008,
21         GL_VERTICES_SUBMITTED                   = 0x82EE,
22         GL_PRIMITIVES_SUBMITTED                 = 0x82EF,
23         GL_VERTEX_SHADER_INVOCATIONS            = 0x82F0,
24         GL_TESS_CONTROL_SHADER_PATCHES          = 0x82F1,
25         GL_TESS_EVALUATION_SHADER_INVOCATIONS   = 0x82F2,
26         GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED   = 0x82F3,
27         GL_FRAGMENT_SHADER_INVOCATIONS          = 0x82F4,
28         GL_COMPUTE_SHADER_INVOCATIONS           = 0x82F5,
29         GL_CLIPPING_INPUT_PRIMITIVES            = 0x82F6,
30         GL_CLIPPING_OUTPUT_PRIMITIVES           = 0x82F7,
31         GL_SPIR_V_EXTENSIONS                    = 0x9553,
32         GL_NUM_SPIR_V_EXTENSIONS                = 0x9554,
33         GL_TRANSFORM_FEEDBACK_OVERFLOW          = 0x82EC,
34         GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW   = 0x82ED,
35     }
36 
37     extern(System) @nogc nothrow {
38         alias pglSpecializeShader = void function( GLuint,const(GLchar)*,GLuint,const(GLuint)*,const(GLuint)* );
39         alias pglMultiDrawArraysIndirectCount = void function( GLenum,const(void)*,GLintptr,GLsizei,GLsizei );
40         alias pglMultiDrawElementsIndirectCount = void function( GLenum,const(void)*,GLintptr,GLsizei,GLsizei );
41     }
42 
43     __gshared {
44         pglSpecializeShader glSpecializeShader;
45         pglMultiDrawArraysIndirectCount glMultiDrawArraysIndirectCount;
46         pglMultiDrawElementsIndirectCount glMultiDrawElementsIndirectCount;
47     }
48 
49     package(bindbc.opengl) @nogc nothrow
50     bool loadGL46(SharedLib lib, GLSupport contextVersion)
51     {
52         import bindbc.opengl.bind.arb : loadARB46;
53 
54         if(contextVersion >= GLSupport.gl46) {
55             lib.bindGLSymbol(cast(void**)&glSpecializeShader, "glSpecializeShader");
56             lib.bindGLSymbol(cast(void**)&glMultiDrawArraysIndirectCount, "glMultiDrawArraysIndirectCount");
57             lib.bindGLSymbol(cast(void**)&glMultiDrawElementsIndirectCount, "glMultiDrawElementsIndirectCount");
58 
59             if(errorCountGL() == 0 && loadARB46(lib, contextVersion)) return true;
60         }
61         return false;
62     }
63 }