Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,14 @@ 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
11 changes: 11 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,17 @@ 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
10 changes: 10 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2748,6 +2748,16 @@ 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