1 //          Copyright 2018 - 2021 Michael D. Parker
2 // Distributed under the Boost Software License, Version 1.0.
3 //    (See accompanying file LICENSE_1_0.txt or copy at
4 //          http://www.boost.org/LICENSE_1_0.txt)
5 
6 module bindbc.opengl.bind.nv.nv_44;
7 
8 import bindbc.loader;
9 import bindbc.opengl.config,
10        bindbc.opengl.context;
11 import bindbc.opengl.bind.types;
12 
13 // NV_command_list
14 version (GL_NV) enum useNVCommandList = true;
15 else version (GL_NV_command_list) enum useNVCommandList = true;
16 else enum useNVCommandList = false;
17 
18 static if (useNVCommandList) {
19     private bool _hasNVCommandList;
20     bool hasNVCommandList() { return _hasNVCommandList; }
21 
22     enum uint GL_TERMINATE_SEQUENCE_COMMAND_NV = 0x0000;
23     enum uint GL_NOP_COMMAND_NV = 0x0001;
24     enum uint GL_DRAW_ELEMENTS_COMMAND_NV = 0x0002;
25     enum uint GL_DRAW_ARRAYS_COMMAND_NV = 0x0003;
26     enum uint GL_DRAW_ELEMENTS_STRIP_COMMAND_NV = 0x0004;
27     enum uint GL_DRAW_ARRAYS_STRIP_COMMAND_NV = 0x0005;
28     enum uint GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV = 0x0006;
29     enum uint GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV = 0x0007;
30     enum uint GL_ELEMENT_ADDRESS_COMMAND_NV = 0x0008;
31     enum uint GL_ATTRIBUTE_ADDRESS_COMMAND_NV = 0x0009;
32     enum uint GL_UNIFORM_ADDRESS_COMMAND_NV = 0x000a;
33     enum uint GL_BLEND_COLOR_COMMAND_NV = 0x000b;
34     enum uint GL_STENCIL_REF_COMMAND_NV = 0x000c;
35     enum uint GL_LINE_WIDTH_COMMAND_NV = 0x000d;
36     enum uint GL_POLYGON_OFFSET_COMMAND_NV = 0x000e;
37     enum uint GL_ALPHA_REF_COMMAND_NV = 0x000f;
38     enum uint GL_VIEWPORT_COMMAND_NV = 0x0010;
39     enum uint GL_SCISSOR_COMMAND_NV = 0x0011;
40     enum uint GL_FRONT_FACE_COMMAND_NV = 0x0012;
41 
42     extern (System) @nogc nothrow {
43         alias pglCreateStatesNV = void function(GLsizei,GLuint*);
44         alias pglDeleteStatesNV = void function(GLsizei,const uint*);
45         alias pglIsStateNV = GLboolean function(GLuint);
46         alias pglStateCaptureNV = void function(GLuint,GLenum mode);
47         alias pglGetCommandHeaderNV = GLuint function(GLenum,GLuint);
48         alias pglGetStageIndexNV = GLushort function(GLenum);
49         alias pglDrawCommandsNV = void function(GLenum,GLuint,const GLintptr*,const GLsizei*,GLuint);
50         alias pglDrawCommandsAddressNV = void function(GLenum,const GLuint64*,const GLsizei*,GLuint);
51         alias pglDrawCommandsStatesNV = void function(GLuint,const GLintptr*,const GLsizei*,const GLuint*,const GLuint*,GLuint);
52         alias pglDrawCommandsStatesAddressNV = void function(const GLuint64*,const GLsizei*,const GLuint*,const GLuint*,GLuint);
53         alias pglCreateCommandListsNV = void function(GLsizei,GLuint*);
54         alias pglDeleteCommandListsNV = void function(GLsizei,const GLuint*);
55         alias pglIsCommandListNV = GLboolean function(GLuint);
56         alias pglListDrawCommandsStatesClientNV = void function(GLuint,GLuint,const GLvoid**,const GLsizei*,const GLuint*,const GLuint*,GLuint);
57         alias pglCommandListSegmentsNV = void function(GLuint,GLuint);
58         alias pglCompileCommandListNV = void function(GLuint);
59         alias pglCallCommandListNV = void function(GLuint);
60     }
61 
62     __gshared {
63         pglCreateStatesNV glCreateStatesNV;
64         pglDeleteStatesNV glDeleteStatesNV;
65         pglIsStateNV glIsStateNV;
66         pglStateCaptureNV glStateCaptureNV;
67         pglGetCommandHeaderNV glGetCommandHeaderNV;
68         pglGetStageIndexNV glGetStageIndexNV;
69         pglDrawCommandsNV glDrawCommandsNV;
70         pglDrawCommandsAddressNV glDrawCommandsAddressNV;
71         pglDrawCommandsStatesNV glDrawCommandsStatesNV;
72         pglDrawCommandsStatesAddressNV glDrawCommandsStatesAddressNV;
73         pglCreateCommandListsNV glCreateCommandListsNV;
74         pglDeleteCommandListsNV glDeleteCommandListsNV;
75         pglIsCommandListNV glIsCommandListNV;
76         pglListDrawCommandsStatesClientNV glListDrawCommandsStatesClientNV;
77         pglCommandListSegmentsNV glCommandListSegmentsNV;
78         pglCompileCommandListNV glCompileCommandListNV;
79         pglCallCommandListNV glCallCommandListNV;
80     }
81 
82     private @nogc nothrow
83     bool loadNVCommandList(SharedLib lib, GLSupport contextVersion)
84     {
85         lib.bindGLSymbol(cast(void**)&glCreateStatesNV, "glCreateStatesNV");
86         lib.bindGLSymbol(cast(void**)&glDeleteStatesNV, "glDeleteStatesNV");
87         lib.bindGLSymbol(cast(void**)&glIsStateNV, "glIsStateNV");
88         lib.bindGLSymbol(cast(void**)&glStateCaptureNV, "glStateCaptureNV");
89         lib.bindGLSymbol(cast(void**)&glGetCommandHeaderNV, "glGetCommandHeaderNV");
90         lib.bindGLSymbol(cast(void**)&glGetStageIndexNV, "glGetStageIndexNV");
91         lib.bindGLSymbol(cast(void**)&glDrawCommandsNV, "glDrawCommandsNV");
92         lib.bindGLSymbol(cast(void**)&glDrawCommandsAddressNV, "glDrawCommandsAddressNV");
93         lib.bindGLSymbol(cast(void**)&glDrawCommandsStatesNV, "glDrawCommandsStatesNV");
94         lib.bindGLSymbol(cast(void**)&glDrawCommandsStatesAddressNV, "glDrawCommandsStatesAddressNV");
95         lib.bindGLSymbol(cast(void**)&glCreateCommandListsNV, "glCreateCommandListsNV");
96         lib.bindGLSymbol(cast(void**)&glDeleteCommandListsNV, "glDeleteCommandListsNV");
97         lib.bindGLSymbol(cast(void**)&glIsCommandListNV, "glIsCommandListNV");
98         lib.bindGLSymbol(cast(void**)&glListDrawCommandsStatesClientNV, "glListDrawCommandsStatesClientNV");
99         lib.bindGLSymbol(cast(void**)&glCommandListSegmentsNV, "glCommandListSegmentsNV");
100         lib.bindGLSymbol(cast(void**)&glCompileCommandListNV, "glCompileCommandListNV");
101         lib.bindGLSymbol(cast(void**)&glCallCommandListNV, "glCallCommandListNV");
102         return resetErrorCountGL();
103     }
104 } else enum hasNVCommandList = false;
105 
106 package @nogc nothrow
107 void loadNV_44(SharedLib lib, GLSupport contextVersion)
108 {
109     static if(useNVCommandList) _hasNVCommandList =
110             hasExtension(contextVersion, "GL_NV_command_list") &&
111             lib.loadNVCommandList(contextVersion);
112 }