Skip to content

Commit

Permalink
Add glNamedFramebufferDrawBuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Aug 26, 2024
1 parent 2150914 commit c9f51bd
Show file tree
Hide file tree
Showing 3 changed files with 27 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 @@ -745,6 +745,12 @@ pub trait HasContext: __private::Sealed {
draw_buffer: u32,
);

unsafe fn named_framebuffer_draw_buffers(
&self,
framebuffer: Option<Self::Framebuffer>,
buffers: &[u32],
);

unsafe fn draw_buffers(&self, buffers: &[u32]);

unsafe fn draw_elements(&self, mode: u32, count: i32, element_type: u32, offset: i32);
Expand Down
13 changes: 13 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,19 @@ impl HasContext for Context {
gl.DrawBuffers(buffers.len() as i32, buffers.as_ptr());
}

unsafe fn named_framebuffer_draw_buffers(
&self,
framebuffer: Option<Self::Framebuffer>,
buffers: &[u32],
) {
let gl = &self.raw;
gl.NamedFramebufferDrawBuffers(
framebuffer.map(|f| f.0.get()).unwrap_or(0),
buffers.len() as i32,
buffers.as_ptr(),
);
}

unsafe fn draw_elements(&self, mode: u32, count: i32, element_type: u32, offset: i32) {
let gl = &self.raw;
gl.DrawElements(
Expand Down
8 changes: 8 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3042,6 +3042,14 @@ impl HasContext for Context {
}
}

unsafe fn named_framebuffer_draw_buffers(
&self,
_framebuffer: Option<Self::Framebuffer>,
_draw_buffers: &[u32],
) {
panic!("Named framebuffers are not supported");
}

unsafe fn draw_elements(&self, mode: u32, count: i32, element_type: u32, offset: i32) {
match self.raw {
RawRenderingContext::WebGl1(ref gl) => {
Expand Down

0 comments on commit c9f51bd

Please sign in to comment.