@@ -7,8 +7,122 @@ use std::path::Path;
7
7
fn main ( ) {
8
8
let dest = env:: var ( "OUT_DIR" ) . unwrap ( ) ;
9
9
let mut file = File :: create ( & Path :: new ( & dest) . join ( "gl_bindings.rs" ) ) . unwrap ( ) ;
10
+
11
+ println ! ( "cargo::rerun-if-changed=build.rs" ) ;
10
12
11
- Registry :: new ( Api :: Gl , ( 4 , 5 ) , Profile :: Core , Fallbacks :: All , [ ] )
12
- . write_bindings ( gl_generator:: StructGenerator , & mut file)
13
- . unwrap ( ) ;
13
+ let mut registry = Registry :: new ( Api :: Gl , ( 4 , 6 ) , Profile :: Core , Fallbacks :: All , & [ "GL_ARB_parallel_shader_compile" ] ) ;
14
+
15
+ registry. cmds . retain ( should_keep_cmd) ;
16
+
17
+ registry. write_bindings ( gl_generator:: StructGenerator , & mut file) . unwrap ( ) ;
18
+ }
19
+
20
+ static ALLOWED_GET_FUNCTIONS : & [ & str ] = & [
21
+ "GetIntegerv" ,
22
+ "GetInternalformativ" ,
23
+ "GetObjectLabel" ,
24
+ "GetProgramBinary" ,
25
+ "GetProgramInfoLog" ,
26
+ "GetProgramInterfaceiv" ,
27
+ "GetProgramiv" ,
28
+ "GetProgramPipelineInfoLog" ,
29
+ "GetProgramPipelineiv" ,
30
+ "GetProgramResourceIndex" ,
31
+ "GetProgramResourceiv" ,
32
+ "GetProgramResourceLocation" ,
33
+ "GetProgramResourceLocationIndex" ,
34
+ "GetProgramResourceName" ,
35
+ "GetProgramStageiv" ,
36
+ "GetQueryBufferObjecti64v" ,
37
+ "GetQueryBufferObjectiv" ,
38
+ "GetQueryBufferObjectui64v" ,
39
+ "GetQueryBufferObjectuiv" ,
40
+ "GetQueryIndexediv" ,
41
+ "GetQueryiv" ,
42
+ "GetQueryObjecti64v" ,
43
+ "GetQueryObjectiv" ,
44
+ "GetQueryObjectui64v" ,
45
+ "GetQueryObjectuiv" ,
46
+ "GetString" ,
47
+ "GetStringi" ,
48
+ "GetSynciv" ,
49
+ "GetTextureSubImage" ,
50
+ ] ;
51
+
52
+ static BANNED_PREFIXES : & [ & str ] = & [
53
+ "Buffer" ,
54
+ "ClearBuffer" ,
55
+ "ColorP" ,
56
+ "CompressedTexImage" ,
57
+ "CompressedTexSub" ,
58
+ "CopyTexImage" ,
59
+ "CopyTexSub" ,
60
+ "Framebuffer" ,
61
+ "MapBuffer" ,
62
+ "MultiTexCoord" ,
63
+ "NormalP" ,
64
+ "SecondaryColorP" ,
65
+ "TexBuffer" ,
66
+ "TexCoord" ,
67
+ "TexImage" ,
68
+ "TexParameter" ,
69
+ "TexStorage" ,
70
+ "TexSub" ,
71
+ "Uniform1" ,
72
+ "Uniform2" ,
73
+ "Uniform3" ,
74
+ "Uniform4" ,
75
+ "UniformMatrix" ,
76
+ "VertexAttrib" ,
77
+ "VertexP" ,
78
+ ] ;
79
+
80
+ static BANNED_FUNCTIONS : & [ & str ] = & [
81
+ "ActiveShaderProgram" ,
82
+ "ActiveTexture" ,
83
+ "BindRenderbuffer" ,
84
+ "BindTexture" ,
85
+ "BindTextures" ,
86
+ "BindVertexBuffer" ,
87
+ "BindVertexBuffers" ,
88
+ "BlitFramebuffer" ,
89
+ "CheckFramebufferStatus" ,
90
+ "CopyBufferSubData" ,
91
+ "DisableVertexAttribArray" ,
92
+ "DrawBuffer" ,
93
+ "DrawBuffers" ,
94
+ "EnableVertexAttribArray" ,
95
+ "FlushMappedBufferRange" ,
96
+ "GenBuffers" ,
97
+ "GenerateMipmap" ,
98
+ "GenFramebuffers" ,
99
+ "GenProgramPipelines" ,
100
+ "GenQueries" ,
101
+ "GenRenderbuffers" ,
102
+ "GenSamplers" ,
103
+ "GenTransformFeedbacks" ,
104
+ "GenVertexArrays" ,
105
+ "InvalidateFramebuffer" ,
106
+ "ReadBuffer" ,
107
+ "RenderbufferStorage" ,
108
+ "RenderbufferStorageMultisample" ,
109
+ "UnmapBuffer" ,
110
+ "VertexBindingDivisor" ,
111
+ ] ;
112
+
113
+
114
+ fn should_keep_cmd ( cmd : & gl_generator:: Cmd ) -> bool {
115
+ let ident = cmd. proto . ident . as_str ( ) ;
116
+
117
+ if ident. starts_with ( "Get" ) {
118
+ return ALLOWED_GET_FUNCTIONS . contains ( & ident) ;
119
+ }
120
+
121
+ for prefix in BANNED_PREFIXES {
122
+ if ident. starts_with ( prefix) {
123
+ return false
124
+ }
125
+ }
126
+
127
+ !BANNED_FUNCTIONS . contains ( & ident)
14
128
}
0 commit comments