diff --git a/generate-native.sh b/generate-native.sh index c354660..84b3bcc 100755 --- a/generate-native.sh +++ b/generate-native.sh @@ -36,6 +36,8 @@ gl_extensions=( GL_ARB_sync GL_KHR_parallel_shader_compile GL_ARB_parallel_shader_compile + GL_OES_vertex_array_object + GL_APPLE_vertex_array_object GL_EXT_disjoint_timer_query ) printf -v gl_extensions_comma_joined '%s,' "${gl_extensions[@]}" diff --git a/src/gl46.rs b/src/gl46.rs index 0f9f1b8..1792d41 100644 --- a/src/gl46.rs +++ b/src/gl46.rs @@ -9,6 +9,7 @@ //! Generated by [phosphorus](https://docs.rs/phosphorus/0.0.22/phosphorus/). //! //! Included Extensions (activate via cargo feature): +//! * `GL_APPLE_vertex_array_object` //! * `GL_ARB_base_instance` //! * `GL_ARB_buffer_storage` //! * `GL_ARB_compute_shader` @@ -35,6 +36,7 @@ //! * `GL_KHR_debug` //! * `GL_KHR_parallel_shader_compile` //! * `GL_NV_copy_buffer` +//! * `GL_OES_vertex_array_object` //! //! Supported Features: //! * `global_loader`: Include all mechanisms necessary for calling GL using @@ -4357,6 +4359,10 @@ pub mod enums { #[doc = "`GL_VERTEX_ARRAY_BINDING: GLenum = 0x85B5`"] #[doc = "* **Group:** GetPName"] pub const GL_VERTEX_ARRAY_BINDING: GLenum = 0x85B5; + #[doc = "`GL_VERTEX_ARRAY_BINDING_APPLE: GLenum = 0x85B5`"] + pub const GL_VERTEX_ARRAY_BINDING_APPLE: GLenum = 0x85B5; + #[doc = "`GL_VERTEX_ARRAY_BINDING_OES: GLenum = 0x85B5`"] + pub const GL_VERTEX_ARRAY_BINDING_OES: GLenum = 0x85B5; #[doc = "`GL_VERTEX_ARRAY_KHR: GLenum = 0x8074`"] pub const GL_VERTEX_ARRAY_KHR: GLenum = 0x8074; #[doc = "`GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT: GLbitfield = 0x00000001`"] @@ -4896,6 +4902,12 @@ pub mod struct_commands { self.BindTextures_load_with_dyn(get_proc_address); self.BindTransformFeedback_load_with_dyn(get_proc_address); self.BindVertexArray_load_with_dyn(get_proc_address); + { + self.BindVertexArrayAPPLE_load_with_dyn(get_proc_address); + } + { + self.BindVertexArrayOES_load_with_dyn(get_proc_address); + } self.BindVertexBuffer_load_with_dyn(get_proc_address); self.BindVertexBuffers_load_with_dyn(get_proc_address); self.BlendBarrier_load_with_dyn(get_proc_address); @@ -5018,6 +5030,12 @@ pub mod struct_commands { self.DeleteTextures_load_with_dyn(get_proc_address); self.DeleteTransformFeedbacks_load_with_dyn(get_proc_address); self.DeleteVertexArrays_load_with_dyn(get_proc_address); + { + self.DeleteVertexArraysAPPLE_load_with_dyn(get_proc_address); + } + { + self.DeleteVertexArraysOES_load_with_dyn(get_proc_address); + } self.DepthFunc_load_with_dyn(get_proc_address); self.DepthMask_load_with_dyn(get_proc_address); self.DepthRange_load_with_dyn(get_proc_address); @@ -5098,6 +5116,12 @@ pub mod struct_commands { self.GenTextures_load_with_dyn(get_proc_address); self.GenTransformFeedbacks_load_with_dyn(get_proc_address); self.GenVertexArrays_load_with_dyn(get_proc_address); + { + self.GenVertexArraysAPPLE_load_with_dyn(get_proc_address); + } + { + self.GenVertexArraysOES_load_with_dyn(get_proc_address); + } self.GenerateMipmap_load_with_dyn(get_proc_address); self.GenerateTextureMipmap_load_with_dyn(get_proc_address); self.GetActiveAtomicCounterBufferiv_load_with_dyn(get_proc_address); @@ -5296,6 +5320,12 @@ pub mod struct_commands { self.IsTexture_load_with_dyn(get_proc_address); self.IsTransformFeedback_load_with_dyn(get_proc_address); self.IsVertexArray_load_with_dyn(get_proc_address); + { + self.IsVertexArrayAPPLE_load_with_dyn(get_proc_address); + } + { + self.IsVertexArrayOES_load_with_dyn(get_proc_address); + } self.LineWidth_load_with_dyn(get_proc_address); self.LinkProgram_load_with_dyn(get_proc_address); self.LogicOp_load_with_dyn(get_proc_address); @@ -6782,6 +6812,74 @@ pub mod struct_commands { pub fn BindVertexArray_is_loaded(&self) -> bool { !self.glBindVertexArray_p.load(RELAX).is_null() } + /// [glBindVertexArrayAPPLE](http://docs.gl/gl4/glBindVertexArrayAPPLE)(array) + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn BindVertexArrayAPPLE(&self, array: GLuint) { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.BindVertexArrayAPPLE({:?});", array); + } + let out = call_atomic_ptr_1arg( + "glBindVertexArrayAPPLE", + &self.glBindVertexArrayAPPLE_p, + array, + ); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glBindVertexArrayAPPLE"); + } + out + } + #[doc(hidden)] + pub unsafe fn BindVertexArrayAPPLE_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glBindVertexArrayAPPLE\0", + &self.glBindVertexArrayAPPLE_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn BindVertexArrayAPPLE_is_loaded(&self) -> bool { + !self.glBindVertexArrayAPPLE_p.load(RELAX).is_null() + } + /// [glBindVertexArrayOES](http://docs.gl/gl4/glBindVertexArrayOES)(array) + /// * alias of: [`glBindVertexArray`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn BindVertexArrayOES(&self, array: GLuint) { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.BindVertexArrayOES({:?});", array); + } + let out = + call_atomic_ptr_1arg("glBindVertexArrayOES", &self.glBindVertexArrayOES_p, array); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glBindVertexArrayOES"); + } + out + } + #[doc(hidden)] + pub unsafe fn BindVertexArrayOES_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glBindVertexArrayOES\0", + &self.glBindVertexArrayOES_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn BindVertexArrayOES_is_loaded(&self) -> bool { + !self.glBindVertexArrayOES_p.load(RELAX).is_null() + } /// [glBindVertexBuffer](http://docs.gl/gl4/glBindVertexBuffer)(bindingindex, buffer, offset, stride) /// * `offset` group: BufferOffset #[cfg_attr(feature = "inline", inline)] @@ -11579,6 +11677,82 @@ pub mod struct_commands { pub fn DeleteVertexArrays_is_loaded(&self) -> bool { !self.glDeleteVertexArrays_p.load(RELAX).is_null() } + /// [glDeleteVertexArraysAPPLE](http://docs.gl/gl4/glDeleteVertexArraysAPPLE)(n, arrays) + /// * `arrays` len: n + /// * alias of: [`glDeleteVertexArrays`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn DeleteVertexArraysAPPLE(&self, n: GLsizei, arrays: *const GLuint) { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.DeleteVertexArraysAPPLE({:?}, {:p});", n, arrays); + } + let out = call_atomic_ptr_2arg( + "glDeleteVertexArraysAPPLE", + &self.glDeleteVertexArraysAPPLE_p, + n, + arrays, + ); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glDeleteVertexArraysAPPLE"); + } + out + } + #[doc(hidden)] + pub unsafe fn DeleteVertexArraysAPPLE_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glDeleteVertexArraysAPPLE\0", + &self.glDeleteVertexArraysAPPLE_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn DeleteVertexArraysAPPLE_is_loaded(&self) -> bool { + !self.glDeleteVertexArraysAPPLE_p.load(RELAX).is_null() + } + /// [glDeleteVertexArraysOES](http://docs.gl/gl4/glDeleteVertexArraysOES)(n, arrays) + /// * `arrays` len: n + /// * alias of: [`glDeleteVertexArrays`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn DeleteVertexArraysOES(&self, n: GLsizei, arrays: *const GLuint) { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.DeleteVertexArraysOES({:?}, {:p});", n, arrays); + } + let out = call_atomic_ptr_2arg( + "glDeleteVertexArraysOES", + &self.glDeleteVertexArraysOES_p, + n, + arrays, + ); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glDeleteVertexArraysOES"); + } + out + } + #[doc(hidden)] + pub unsafe fn DeleteVertexArraysOES_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glDeleteVertexArraysOES\0", + &self.glDeleteVertexArraysOES_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn DeleteVertexArraysOES_is_loaded(&self) -> bool { + !self.glDeleteVertexArraysOES_p.load(RELAX).is_null() + } /// [glDepthFunc](http://docs.gl/gl4/glDepthFunc)(func) /// * `func` group: DepthFunction #[cfg_attr(feature = "inline", inline)] @@ -14321,6 +14495,82 @@ pub mod struct_commands { pub fn GenVertexArrays_is_loaded(&self) -> bool { !self.glGenVertexArrays_p.load(RELAX).is_null() } + /// [glGenVertexArraysAPPLE](http://docs.gl/gl4/glGenVertexArraysAPPLE)(n, arrays) + /// * `arrays` len: n + /// * alias of: [`glGenVertexArrays`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn GenVertexArraysAPPLE(&self, n: GLsizei, arrays: *mut GLuint) { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.GenVertexArraysAPPLE({:?}, {:p});", n, arrays); + } + let out = call_atomic_ptr_2arg( + "glGenVertexArraysAPPLE", + &self.glGenVertexArraysAPPLE_p, + n, + arrays, + ); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glGenVertexArraysAPPLE"); + } + out + } + #[doc(hidden)] + pub unsafe fn GenVertexArraysAPPLE_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glGenVertexArraysAPPLE\0", + &self.glGenVertexArraysAPPLE_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn GenVertexArraysAPPLE_is_loaded(&self) -> bool { + !self.glGenVertexArraysAPPLE_p.load(RELAX).is_null() + } + /// [glGenVertexArraysOES](http://docs.gl/gl4/glGenVertexArraysOES)(n, arrays) + /// * `arrays` len: n + /// * alias of: [`glGenVertexArrays`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn GenVertexArraysOES(&self, n: GLsizei, arrays: *mut GLuint) { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.GenVertexArraysOES({:?}, {:p});", n, arrays); + } + let out = call_atomic_ptr_2arg( + "glGenVertexArraysOES", + &self.glGenVertexArraysOES_p, + n, + arrays, + ); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glGenVertexArraysOES"); + } + out + } + #[doc(hidden)] + pub unsafe fn GenVertexArraysOES_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glGenVertexArraysOES\0", + &self.glGenVertexArraysOES_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn GenVertexArraysOES_is_loaded(&self) -> bool { + !self.glGenVertexArraysOES_p.load(RELAX).is_null() + } /// [glGenerateMipmap](http://docs.gl/gl4/glGenerateMipmap)(target) /// * `target` group: TextureTarget #[cfg_attr(feature = "inline", inline)] @@ -22076,6 +22326,71 @@ pub mod struct_commands { pub fn IsVertexArray_is_loaded(&self) -> bool { !self.glIsVertexArray_p.load(RELAX).is_null() } + /// [glIsVertexArrayAPPLE](http://docs.gl/gl4/glIsVertexArrayAPPLE)(array) + /// * alias of: [`glIsVertexArray`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn IsVertexArrayAPPLE(&self, array: GLuint) -> GLboolean { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.IsVertexArrayAPPLE({:?});", array); + } + let out = + call_atomic_ptr_1arg("glIsVertexArrayAPPLE", &self.glIsVertexArrayAPPLE_p, array); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glIsVertexArrayAPPLE"); + } + out + } + #[doc(hidden)] + pub unsafe fn IsVertexArrayAPPLE_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glIsVertexArrayAPPLE\0", + &self.glIsVertexArrayAPPLE_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn IsVertexArrayAPPLE_is_loaded(&self) -> bool { + !self.glIsVertexArrayAPPLE_p.load(RELAX).is_null() + } + /// [glIsVertexArrayOES](http://docs.gl/gl4/glIsVertexArrayOES)(array) + /// * alias of: [`glIsVertexArray`] + #[cfg_attr(feature = "inline", inline)] + #[cfg_attr(feature = "inline_always", inline(always))] + pub unsafe fn IsVertexArrayOES(&self, array: GLuint) -> GLboolean { + #[cfg(all(debug_assertions, feature = "debug_trace_calls"))] + { + trace!("calling gl.IsVertexArrayOES({:?});", array); + } + let out = call_atomic_ptr_1arg("glIsVertexArrayOES", &self.glIsVertexArrayOES_p, array); + #[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))] + { + self.automatic_glGetError("glIsVertexArrayOES"); + } + out + } + #[doc(hidden)] + pub unsafe fn IsVertexArrayOES_load_with_dyn( + &self, + get_proc_address: &mut dyn FnMut(*const c_char) -> *mut c_void, + ) -> bool { + load_dyn_name_atomic_ptr( + get_proc_address, + b"glIsVertexArrayOES\0", + &self.glIsVertexArrayOES_p, + ) + } + #[inline] + #[doc(hidden)] + pub fn IsVertexArrayOES_is_loaded(&self) -> bool { + !self.glIsVertexArrayOES_p.load(RELAX).is_null() + } /// [glLineWidth](http://docs.gl/gl4/glLineWidth)(width) /// * `width` group: CheckedFloat32 #[cfg_attr(feature = "inline", inline)] @@ -36796,6 +37111,8 @@ pub mod struct_commands { glBindTextures_p: APcv, glBindTransformFeedback_p: APcv, glBindVertexArray_p: APcv, + glBindVertexArrayAPPLE_p: APcv, + glBindVertexArrayOES_p: APcv, glBindVertexBuffer_p: APcv, glBindVertexBuffers_p: APcv, glBlendBarrier_p: APcv, @@ -36898,6 +37215,8 @@ pub mod struct_commands { glDeleteTextures_p: APcv, glDeleteTransformFeedbacks_p: APcv, glDeleteVertexArrays_p: APcv, + glDeleteVertexArraysAPPLE_p: APcv, + glDeleteVertexArraysOES_p: APcv, glDepthFunc_p: APcv, glDepthMask_p: APcv, glDepthRange_p: APcv, @@ -36966,6 +37285,8 @@ pub mod struct_commands { glGenTextures_p: APcv, glGenTransformFeedbacks_p: APcv, glGenVertexArrays_p: APcv, + glGenVertexArraysAPPLE_p: APcv, + glGenVertexArraysOES_p: APcv, glGenerateMipmap_p: APcv, glGenerateTextureMipmap_p: APcv, glGetActiveAtomicCounterBufferiv_p: APcv, @@ -37134,6 +37455,8 @@ pub mod struct_commands { glIsTexture_p: APcv, glIsTransformFeedback_p: APcv, glIsVertexArray_p: APcv, + glIsVertexArrayAPPLE_p: APcv, + glIsVertexArrayOES_p: APcv, glLineWidth_p: APcv, glLinkProgram_p: APcv, glLogicOp_p: APcv, diff --git a/src/native.rs b/src/native.rs index 373bbd1..832b100 100644 --- a/src/native.rs +++ b/src/native.rs @@ -1301,7 +1301,14 @@ impl HasContext for Context { unsafe fn create_vertex_array(&self) -> Result { let gl = &self.raw; let mut vertex_array = 0; - gl.GenVertexArrays(1, &mut vertex_array); + if gl.GenVertexArrays_is_loaded() { + gl.GenVertexArrays(1, &mut vertex_array); + } else { + #[cfg(not(target_vendor = "apple"))] + gl.GenVertexArraysOES(1, &mut vertex_array); + #[cfg(target_vendor = "apple")] + gl.GenVertexArraysAPPLE(1, &mut vertex_array); + } NonZeroU32::new(vertex_array) .map(NativeVertexArray) .ok_or_else(|| String::from("Unable to create VertexArray object")) @@ -1318,12 +1325,26 @@ impl HasContext for Context { unsafe fn delete_vertex_array(&self, vertex_array: Self::VertexArray) { let gl = &self.raw; - gl.DeleteVertexArrays(1, &vertex_array.0.get()); + if gl.DeleteVertexArrays_is_loaded() { + gl.DeleteVertexArrays(1, &vertex_array.0.get()); + } else { + #[cfg(not(target_vendor = "apple"))] + gl.DeleteVertexArraysOES(1, &vertex_array.0.get()); + #[cfg(target_vendor = "apple")] + gl.DeleteVertexArraysAPPLE(1, &vertex_array.0.get()); + } } unsafe fn bind_vertex_array(&self, vertex_array: Option) { let gl = &self.raw; - gl.BindVertexArray(vertex_array.map(|va| va.0.get()).unwrap_or(0)); + if gl.BindVertexArray_is_loaded() { + gl.BindVertexArray(vertex_array.map(|va| va.0.get()).unwrap_or(0)); + } else { + #[cfg(not(target_vendor = "apple"))] + gl.BindVertexArrayOES(vertex_array.map(|va| va.0.get()).unwrap_or(0)); + #[cfg(target_vendor = "apple")] + gl.BindVertexArrayAPPLE(vertex_array.map(|va| va.0.get()).unwrap_or(0)); + } } unsafe fn clear_color(&self, red: f32, green: f32, blue: f32, alpha: f32) {