Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function call for NamedBufferStorage #330

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Loading