22
33mod enums;
44
5- use core:: ffi:: { c_void, CStr } ;
65use crate :: utils:: * ;
6+ use core:: ffi:: { c_void, CStr } ;
77
88pub use crate :: types:: * ;
99pub use enums:: * ;
@@ -12,7 +12,12 @@ pub unsafe fn glCreateShader(ty: GLenum) -> GLuint {
1212 call_ptr_1arg ( CREATE_SHADER_PTR , ty)
1313}
1414
15- pub unsafe fn glShaderSource ( shader : GLuint , count : GLsizei , string : * const * const GLchar , length : * const GLint ) {
15+ pub unsafe fn glShaderSource (
16+ shader : GLuint ,
17+ count : GLsizei ,
18+ string : * const * const GLchar ,
19+ length : * const GLint ,
20+ ) {
1621 call_ptr_4arg ( SHADER_SOURCE_PTR , shader, count, string, length)
1722}
1823
@@ -28,8 +33,19 @@ pub unsafe fn glGetShaderiv(shader: GLuint, pname: GLenum, params: *mut GLint) {
2833 call_ptr_3arg ( GET_SHADER_IV_PTR , shader, pname, params)
2934}
3035
31- pub unsafe fn glGetShaderInfoLog ( shader : GLuint , max_length : GLsizei , length : * mut GLsizei , info_log : * mut GLchar ) {
32- call_ptr_4arg ( GET_SHADER_INFO_LOG_PTR , shader, max_length, length, info_log)
36+ pub unsafe fn glGetShaderInfoLog (
37+ shader : GLuint ,
38+ max_length : GLsizei ,
39+ length : * mut GLsizei ,
40+ info_log : * mut GLchar ,
41+ ) {
42+ call_ptr_4arg (
43+ GET_SHADER_INFO_LOG_PTR ,
44+ shader,
45+ max_length,
46+ length,
47+ info_log,
48+ )
3349}
3450
3551pub unsafe fn glCreateProgram ( ) -> GLuint {
@@ -48,8 +64,19 @@ pub unsafe fn glGetProgramiv(program: GLuint, pname: GLenum, params: *mut GLint)
4864 call_ptr_3arg ( GET_PROGRAM_IV_PTR , program, pname, params)
4965}
5066
51- pub unsafe fn glGetProgramInfoLog ( program : GLuint , max_length : GLsizei , length : * mut GLsizei , info_log : * mut GLchar ) {
52- call_ptr_4arg ( GET_PROGRAM_INFO_LOG_PTR , program, max_length, length, info_log)
67+ pub unsafe fn glGetProgramInfoLog (
68+ program : GLuint ,
69+ max_length : GLsizei ,
70+ length : * mut GLsizei ,
71+ info_log : * mut GLchar ,
72+ ) {
73+ call_ptr_4arg (
74+ GET_PROGRAM_INFO_LOG_PTR ,
75+ program,
76+ max_length,
77+ length,
78+ info_log,
79+ )
5380}
5481
5582pub unsafe fn glDeleteProgram ( program : GLuint ) {
@@ -64,7 +91,12 @@ pub unsafe fn glCreateBuffers(n: GLsizei, buffers: *mut GLuint) {
6491 call_ptr_2arg ( CREATE_BUFFERS_PTR , n, buffers)
6592}
6693
67- pub unsafe fn glNamedBufferData ( buffer : GLuint , size : GLsizeiptr , data : * const c_void , usage : GLenum ) {
94+ pub unsafe fn glNamedBufferData (
95+ buffer : GLuint ,
96+ size : GLsizeiptr ,
97+ data : * const c_void ,
98+ usage : GLenum ,
99+ ) {
68100 call_ptr_4arg ( NAMED_BUFFER_DATA_PTR , buffer, size, data, usage)
69101}
70102
@@ -76,8 +108,21 @@ pub unsafe fn glCreateVertexArrays(n: GLsizei, arrays: *mut GLuint) {
76108 call_ptr_2arg ( CREATE_VERTEX_ARRAYS_PTR , n, arrays)
77109}
78110
79- pub unsafe fn glVertexArrayVertexBuffer ( vaobj : GLuint , bindingindex : GLuint , buffer : GLuint , offset : GLintptr , stride : GLsizei ) {
80- call_ptr_5arg ( VERTEX_ARRAY_VERTEX_BUFFER_PTR , vaobj, bindingindex, buffer, offset, stride)
111+ pub unsafe fn glVertexArrayVertexBuffer (
112+ vaobj : GLuint ,
113+ bindingindex : GLuint ,
114+ buffer : GLuint ,
115+ offset : GLintptr ,
116+ stride : GLsizei ,
117+ ) {
118+ call_ptr_5arg (
119+ VERTEX_ARRAY_VERTEX_BUFFER_PTR ,
120+ vaobj,
121+ bindingindex,
122+ buffer,
123+ offset,
124+ stride,
125+ )
81126}
82127
83128pub unsafe fn glVertexArrayElementBuffer ( vaobj : GLuint , buffer : GLuint ) {
@@ -88,19 +133,44 @@ pub unsafe fn glEnableVertexArrayAttrib(vaobj: GLuint, index: GLuint) {
88133 call_ptr_2arg ( ENABLE_VERTEX_ARRAY_ATTRIB_PTR , vaobj, index)
89134}
90135
91- pub unsafe fn glVertexArrayAttribFormat ( vaobj : GLuint , attribindex : GLuint , size : GLint , ty : GLenum , normalized : GLboolean , relativeoffset : GLuint ) {
92- call_ptr_6arg ( VERTEX_ARRAY_ATTRIB_FORMAT_PTR , vaobj, attribindex, size, ty, normalized, relativeoffset)
136+ pub unsafe fn glVertexArrayAttribFormat (
137+ vaobj : GLuint ,
138+ attribindex : GLuint ,
139+ size : GLint ,
140+ ty : GLenum ,
141+ normalized : GLboolean ,
142+ relativeoffset : GLuint ,
143+ ) {
144+ call_ptr_6arg (
145+ VERTEX_ARRAY_ATTRIB_FORMAT_PTR ,
146+ vaobj,
147+ attribindex,
148+ size,
149+ ty,
150+ normalized,
151+ relativeoffset,
152+ )
93153}
94154
95155pub unsafe fn glVertexArrayAttribBinding ( vaobj : GLuint , attribindex : GLuint , bindingindex : GLuint ) {
96- call_ptr_3arg ( VERTEX_ARRAY_ATTRIB_BINDING_PTR , vaobj, attribindex, bindingindex)
156+ call_ptr_3arg (
157+ VERTEX_ARRAY_ATTRIB_BINDING_PTR ,
158+ vaobj,
159+ attribindex,
160+ bindingindex,
161+ )
97162}
98163
99164pub unsafe fn glDeleteVertexArrays ( n : GLsizei , arrays : * const GLuint ) {
100165 call_ptr_2arg ( DELETE_VERTEX_ARRAYS_PTR , n, arrays)
101166}
102167
103- pub unsafe fn glNamedBufferStorage ( buffer : GLuint , size : GLsizeiptr , data : * const c_void , flags : GLbitfield ) {
168+ pub unsafe fn glNamedBufferStorage (
169+ buffer : GLuint ,
170+ size : GLsizeiptr ,
171+ data : * const c_void ,
172+ flags : GLbitfield ,
173+ ) {
104174 call_ptr_4arg ( NAMED_BUFFER_STORAGE_PTR , buffer, size, data, flags)
105175}
106176
@@ -112,8 +182,21 @@ pub unsafe fn glDeleteTextures(n: GLsizei, textures: *const GLuint) {
112182 call_ptr_2arg ( DELETE_TEXTURES_PTR , n, textures)
113183}
114184
115- pub unsafe fn glTextureStorage2D ( texture : GLuint , levels : GLsizei , internalformat : GLenum , width : GLsizei , height : GLsizei ) {
116- call_ptr_5arg ( TEXTURE_STORAGE_2D_PTR , texture, levels, internalformat, width, height)
185+ pub unsafe fn glTextureStorage2D (
186+ texture : GLuint ,
187+ levels : GLsizei ,
188+ internalformat : GLenum ,
189+ width : GLsizei ,
190+ height : GLsizei ,
191+ ) {
192+ call_ptr_5arg (
193+ TEXTURE_STORAGE_2D_PTR ,
194+ texture,
195+ levels,
196+ internalformat,
197+ width,
198+ height,
199+ )
117200}
118201
119202pub unsafe fn glCreateFramebuffers ( n : GLsizei , framebuffers : * mut GLuint ) {
@@ -124,8 +207,19 @@ pub unsafe fn glDeleteFramebuffers(n: GLsizei, framebuffers: *const GLuint) {
124207 call_ptr_2arg ( DELETE_FRAMEBUFFERS_PTR , n, framebuffers)
125208}
126209
127- pub unsafe fn glNamedFramebufferTexture ( framebuffer : GLuint , attachment : GLenum , texture : GLuint , level : GLint ) {
128- call_ptr_4arg ( NAMED_FRAMEBUFFER_TEXTURE_PTR , framebuffer, attachment, texture, level)
210+ pub unsafe fn glNamedFramebufferTexture (
211+ framebuffer : GLuint ,
212+ attachment : GLenum ,
213+ texture : GLuint ,
214+ level : GLint ,
215+ ) {
216+ call_ptr_4arg (
217+ NAMED_FRAMEBUFFER_TEXTURE_PTR ,
218+ framebuffer,
219+ attachment,
220+ texture,
221+ level,
222+ )
129223}
130224
131225pub unsafe fn glUseProgram ( program : GLuint ) {
@@ -152,6 +246,23 @@ pub unsafe fn glProgramUniform1f(program: GLuint, location: GLint, v0: GLfloat)
152246 call_ptr_3arg ( PROGRAM_UNIFORM_1F_PTR , program, location, v0)
153247}
154248
249+ pub unsafe fn glProgramUniformMatrix4fv (
250+ program : GLuint ,
251+ location : GLint ,
252+ count : GLsizei ,
253+ transpose : GLboolean ,
254+ value : * const GLfloat ,
255+ ) {
256+ call_ptr_5arg (
257+ PROGRAM_UNIFORM_MATRIX_5FV_PTR ,
258+ program,
259+ location,
260+ count,
261+ transpose,
262+ value,
263+ )
264+ }
265+
155266pub unsafe fn glViewport ( x : GLint , y : GLint , width : GLsizei , height : GLsizei ) {
156267 call_ptr_4arg ( VIEWPORT_PTR , x, y, width, height)
157268}
@@ -196,6 +307,7 @@ static mut CLEAR_PTR: *const c_void = core::ptr::null();
196307static mut CLEAR_COLOR_PTR : * const c_void = core:: ptr:: null ( ) ;
197308static mut GET_UNIFORM_LOCATION_PTR : * const c_void = core:: ptr:: null ( ) ;
198309static mut PROGRAM_UNIFORM_1F_PTR : * const c_void = core:: ptr:: null ( ) ;
310+ static mut PROGRAM_UNIFORM_MATRIX_5FV_PTR : * const c_void = core:: ptr:: null ( ) ;
199311static mut VIEWPORT_PTR : * const c_void = core:: ptr:: null ( ) ;
200312static mut BIND_FRAMEBUFFER_PTR : * const c_void = core:: ptr:: null ( ) ;
201313
@@ -213,7 +325,7 @@ static mut BIND_FRAMEBUFFER_PTR: *const c_void = core::ptr::null();
213325//TODO Others:
214326// glGetError
215327
216- pub unsafe fn load ( get_proc_address : impl Fn ( & CStr ) -> * const c_void ) {
328+ pub unsafe fn load ( get_proc_address : impl Fn ( & CStr ) -> * const c_void ) {
217329 CREATE_SHADER_PTR = get_proc_address ( c"glCreateShader" ) ;
218330 SHADER_SOURCE_PTR = get_proc_address ( c"glShaderSource" ) ;
219331 COMPILE_SHADER_PTR = get_proc_address ( c"glCompileShader" ) ;
@@ -250,6 +362,7 @@ pub unsafe fn load(get_proc_address: impl Fn(&CStr)-> *const c_void) {
250362 CLEAR_COLOR_PTR = get_proc_address ( c"glClearColor" ) ;
251363 GET_UNIFORM_LOCATION_PTR = get_proc_address ( c"glGetUniformLocation" ) ;
252364 PROGRAM_UNIFORM_1F_PTR = get_proc_address ( c"glProgramUniform1f" ) ;
365+ PROGRAM_UNIFORM_MATRIX_5FV_PTR = get_proc_address ( c"glProgramUniformMatrix4fv" ) ;
253366 VIEWPORT_PTR = get_proc_address ( c"glViewport" ) ;
254367 BIND_FRAMEBUFFER_PTR = get_proc_address ( c"glBindFramebuffer" ) ;
255- }
368+ }
0 commit comments