Skip to content

Commit

Permalink
Add glCheckNamedFramebufferStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran authored and grovesNL committed Sep 3, 2024
1 parent b8c5f35 commit 825b006
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ pub trait HasContext: __private::Sealed {

unsafe fn check_framebuffer_status(&self, target: u32) -> u32;

unsafe fn check_named_framebuffer_status(
&self,
framebuffer: Option<Self::Framebuffer>,
target: u32,
) -> u32;

unsafe fn clear_buffer_i32_slice(&self, target: u32, draw_buffer: u32, values: &[i32]);

unsafe fn clear_buffer_u32_slice(&self, target: u32, draw_buffer: u32, values: &[u32]);
Expand Down
9 changes: 9 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,15 @@ impl HasContext for Context {
gl.CheckFramebufferStatus(target)
}

unsafe fn check_named_framebuffer_status(
&self,
framebuffer: Option<Self::Framebuffer>,
target: u32,
) -> u32 {
let gl = &self.raw;
gl.CheckNamedFramebufferStatus(framebuffer.map(|f| f.0.get()).unwrap_or(0), target)
}

unsafe fn clear_buffer_i32_slice(&self, target: u32, draw_buffer: u32, values: &[i32]) {
let gl = &self.raw;
gl.ClearBufferiv(target, draw_buffer as i32, values.as_ptr());
Expand Down
8 changes: 8 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2614,6 +2614,14 @@ impl HasContext for Context {
}
}

unsafe fn check_named_framebuffer_status(
&self,
_framebuffer: Option<Self::Framebuffer>,
_target: u32,
) -> u32 {
panic!("Named framebuffers are not supported");
}

unsafe fn clear_buffer_i32_slice(&self, target: u32, draw_buffer: u32, values: &[i32]) {
match self.raw {
RawRenderingContext::WebGl1(ref _gl) => {
Expand Down

0 comments on commit 825b006

Please sign in to comment.