diff --git a/src/lib.rs b/src/lib.rs index ec6d1e5..1ecb599 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -638,6 +638,13 @@ pub trait HasContext: __private::Sealed { unsafe fn buffer_storage(&self, target: u32, size: i32, data: Option<&[u8]>, flags: u32); + unsafe fn named_buffer_storage(&self, + target: Self::Buffer, + size: i32, + data: Option<&[u8]>, + flags: u32, + ); + unsafe fn check_framebuffer_status(&self, target: u32) -> u32; unsafe fn check_named_framebuffer_status( diff --git a/src/native.rs b/src/native.rs index 1ac05a1..8907ae7 100644 --- a/src/native.rs +++ b/src/native.rs @@ -1496,6 +1496,11 @@ impl HasContext for Context { gl.BufferStorageEXT(target, size, data, flags); } } + unsafe fn named_buffer_storage(&self, buffer: Self::Buffer, size: i32, data: Option<&[u8]>, flags: u32) { + let gl = &self.raw; + let data = data.map(|p| p.as_ptr()).unwrap_or(std::ptr::null()) as *const std::ffi::c_void; + gl.NamedBufferStorage(buffer.0.get(), size as isize, data, flags); + } unsafe fn check_framebuffer_status(&self, target: u32) -> u32 { let gl = &self.raw; diff --git a/src/web_sys.rs b/src/web_sys.rs index 20b48fe..6829ef6 100644 --- a/src/web_sys.rs +++ b/src/web_sys.rs @@ -2748,6 +2748,10 @@ impl HasContext for Context { panic!("Buffer storage is not supported"); } + unsafe fn named_buffer_storage(&self, buffer: Self::Buffer, size: i32, data: Option<&[u8]>, flags: u32) { + panic!("Named buffer storage is not supported"); + } + unsafe fn check_framebuffer_status(&self, target: u32) -> u32 { match self.raw { RawRenderingContext::WebGl1(ref gl) => gl.check_framebuffer_status(target),