Skip to content

Commit

Permalink
Add glBlitNamedFramebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Aug 9, 2024
1 parent ad84650 commit ec1f7d7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,22 @@ pub trait HasContext: __private::Sealed {
filter: u32,
);

unsafe fn blit_named_framebuffer(
&self,
read_buffer: Option<Self::Framebuffer>,
draw_buffer: Option<Self::Framebuffer>,
src_x0: i32,
src_y0: i32,
src_x1: i32,
src_y1: i32,
dst_x0: i32,
dst_y0: i32,
dst_x1: i32,
dst_y1: i32,
mask: u32,
filter: u32,
);

unsafe fn create_vertex_array(&self) -> Result<Self::VertexArray, String>;

unsafe fn delete_vertex_array(&self, vertex_array: Self::VertexArray);
Expand Down
32 changes: 32 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,38 @@ impl HasContext for Context {
);
}

unsafe fn blit_named_framebuffer(
&self,
read_buffer: Option<Self::Framebuffer>,
draw_buffer: Option<Self::Framebuffer>,
src_x0: i32,
src_y0: i32,
src_x1: i32,
src_y1: i32,
dst_x0: i32,
dst_y0: i32,
dst_x1: i32,
dst_y1: i32,
mask: u32,
filter: u32,
) {
let gl = &self.raw;
gl.BlitNamedFramebuffer(
read_buffer.map(|f| f.0.get()).unwrap_or(0),
draw_buffer.map(|f| f.0.get()).unwrap_or(0),
src_x0,
src_y0,
src_x1,
src_y1,
dst_x0,
dst_y0,
dst_x1,
dst_y1,
mask,
filter,
);
}

unsafe fn create_vertex_array(&self) -> Result<Self::VertexArray, String> {
let gl = &self.raw;
let mut vertex_array = 0;
Expand Down
18 changes: 18 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2431,6 +2431,24 @@ impl HasContext for Context {
}
}

unsafe fn blit_named_framebuffer(
&self,
_read_buffer: Option<Self::Framebuffer>,
_draw_buffer: Option<Self::Framebuffer>,
_src_x0: i32,
_src_y0: i32,
_src_x1: i32,
_src_y1: i32,
_dst_x0: i32,
_dst_y0: i32,
_dst_x1: i32,
_dst_y1: i32,
_mask: u32,
_filter: u32,
) {
panic!("Named framebuffers are not supported");
}

unsafe fn create_vertex_array(&self) -> Result<Self::VertexArray, String> {
let raw_vertex_array = match self.raw {
RawRenderingContext::WebGl1(ref _gl) => {
Expand Down

0 comments on commit ec1f7d7

Please sign in to comment.