From a18ac672b0be4d4872c4e1848af745434c11f571 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:52:56 +0100 Subject: [PATCH 1/2] Add and use GL_OES_vertex_array_object as fallback Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- generate-native.sh | 1 + src/gl46.rs | 160 +++++++++++++++++++++++++++++++++++++++++++++ src/native.rs | 18 ++++- 3 files changed, 176 insertions(+), 3 deletions(-) diff --git a/generate-native.sh b/generate-native.sh index 7e24f8e..df7c0dc 100755 --- a/generate-native.sh +++ b/generate-native.sh @@ -36,6 +36,7 @@ gl_extensions=( GL_ARB_sync GL_KHR_parallel_shader_compile GL_ARB_parallel_shader_compile + GL_OES_vertex_array_object ) printf -v gl_extensions_comma_joined '%s,' "${gl_extensions[@]}" diff --git a/src/gl46.rs b/src/gl46.rs index 77757b8..2b10448 100644 --- a/src/gl46.rs +++ b/src/gl46.rs @@ -34,6 +34,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 @@ -4342,6 +4343,8 @@ 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_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`"] @@ -4878,6 +4881,9 @@ 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.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); @@ -4997,6 +5003,9 @@ 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.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); @@ -5071,6 +5080,9 @@ 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.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); @@ -5248,6 +5260,9 @@ 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.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); @@ -6699,6 +6714,39 @@ pub mod struct_commands { pub fn BindVertexArray_is_loaded(&self) -> bool { !self.glBindVertexArray_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)] @@ -11463,6 +11511,44 @@ pub mod struct_commands { pub fn DeleteVertexArrays_is_loaded(&self) -> bool { !self.glDeleteVertexArrays_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)] @@ -14145,6 +14231,44 @@ pub mod struct_commands { pub fn GenVertexArrays_is_loaded(&self) -> bool { !self.glGenVertexArrays_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)] @@ -21600,6 +21724,38 @@ pub mod struct_commands { pub fn IsVertexArray_is_loaded(&self) -> bool { !self.glIsVertexArray_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)] @@ -36285,6 +36441,7 @@ pub mod struct_commands { glBindTextures_p: APcv, glBindTransformFeedback_p: APcv, glBindVertexArray_p: APcv, + glBindVertexArrayOES_p: APcv, glBindVertexBuffer_p: APcv, glBindVertexBuffers_p: APcv, glBlendBarrier_p: APcv, @@ -36386,6 +36543,7 @@ pub mod struct_commands { glDeleteTextures_p: APcv, glDeleteTransformFeedbacks_p: APcv, glDeleteVertexArrays_p: APcv, + glDeleteVertexArraysOES_p: APcv, glDepthFunc_p: APcv, glDepthMask_p: APcv, glDepthRange_p: APcv, @@ -36452,6 +36610,7 @@ pub mod struct_commands { glGenTextures_p: APcv, glGenTransformFeedbacks_p: APcv, glGenVertexArrays_p: APcv, + glGenVertexArraysOES_p: APcv, glGenerateMipmap_p: APcv, glGenerateTextureMipmap_p: APcv, glGetActiveAtomicCounterBufferiv_p: APcv, @@ -36613,6 +36772,7 @@ pub mod struct_commands { glIsTexture_p: APcv, glIsTransformFeedback_p: APcv, glIsVertexArray_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 967e311..25b6ffd 100644 --- a/src/native.rs +++ b/src/native.rs @@ -1267,7 +1267,11 @@ 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 { + gl.GenVertexArraysOES(1, &mut vertex_array); + } NonZeroU32::new(vertex_array) .map(NativeVertexArray) .ok_or_else(|| String::from("Unable to create VertexArray object")) @@ -1284,12 +1288,20 @@ 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 { + gl.DeleteVertexArraysOES(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 { + gl.BindVertexArrayOES(vertex_array.map(|va| va.0.get()).unwrap_or(0)); + } } unsafe fn clear_color(&self, red: f32, green: f32, blue: f32, alpha: f32) { From 0d1e3ac6986351af81a7be019f66cefa95e03802 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:25:25 +0100 Subject: [PATCH 2/2] Add and use GL_APPLE_vertex_array_object as fallback on apple devices Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- generate-native.sh | 1 + src/gl46.rs | 163 +++++++++++++++++++++++++++++++++++++++++++++ src/native.rs | 9 +++ 3 files changed, 173 insertions(+) diff --git a/generate-native.sh b/generate-native.sh index df7c0dc..b0e92c0 100755 --- a/generate-native.sh +++ b/generate-native.sh @@ -37,6 +37,7 @@ gl_extensions=( GL_KHR_parallel_shader_compile GL_ARB_parallel_shader_compile GL_OES_vertex_array_object + GL_APPLE_vertex_array_object ) printf -v gl_extensions_comma_joined '%s,' "${gl_extensions[@]}" diff --git a/src/gl46.rs b/src/gl46.rs index 2b10448..0593b53 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` @@ -4343,6 +4344,8 @@ 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`"] @@ -4881,6 +4884,9 @@ 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); } @@ -5003,6 +5009,9 @@ 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); } @@ -5080,6 +5089,9 @@ 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); } @@ -5260,6 +5272,9 @@ 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); } @@ -6714,6 +6729,41 @@ 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)] @@ -11511,6 +11561,44 @@ 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`] @@ -14231,6 +14319,44 @@ 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`] @@ -21724,6 +21850,39 @@ 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)] @@ -36441,6 +36600,7 @@ 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, @@ -36543,6 +36703,7 @@ 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, @@ -36610,6 +36771,7 @@ 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, @@ -36772,6 +36934,7 @@ 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, diff --git a/src/native.rs b/src/native.rs index 25b6ffd..a9d52aa 100644 --- a/src/native.rs +++ b/src/native.rs @@ -1270,7 +1270,10 @@ impl HasContext for Context { 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) @@ -1291,7 +1294,10 @@ impl HasContext for Context { 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()); } } @@ -1300,7 +1306,10 @@ impl HasContext for Context { 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)); } }