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 named framebuffer operations and named vertex arrays #299

Merged
merged 9 commits into from
Sep 3, 2024
124 changes: 124 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ pub trait HasContext: __private::Sealed {

unsafe fn create_framebuffer(&self) -> Result<Self::Framebuffer, String>;

unsafe fn create_named_framebuffer(&self) -> Result<Self::Framebuffer, String>;

unsafe fn is_framebuffer(&self, framebuffer: Self::Framebuffer) -> bool;

unsafe fn create_query(&self) -> Result<Self::Query, String>;
Expand Down Expand Up @@ -508,8 +510,26 @@ 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 create_named_vertex_array(&self) -> Result<Self::VertexArray, String>;

unsafe fn delete_vertex_array(&self, vertex_array: Self::VertexArray);

unsafe fn bind_vertex_array(&self, vertex_array: Option<Self::VertexArray>);
Expand Down Expand Up @@ -557,6 +577,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 All @@ -571,6 +597,39 @@ pub trait HasContext: __private::Sealed {
stencil: i32,
);

unsafe fn clear_named_framebuffer_i32_slice(
&self,
framebuffer: Option<Self::Framebuffer>,
target: u32,
draw_buffer: u32,
values: &[i32],
);

unsafe fn clear_named_framebuffer_u32_slice(
&self,
framebuffer: Option<Self::Framebuffer>,
target: u32,
draw_buffer: u32,
values: &[u32],
);

unsafe fn clear_named_framebuffer_f32_slice(
&self,
framebuffer: Option<Self::Framebuffer>,
target: u32,
draw_buffer: u32,
values: &[f32],
);

unsafe fn clear_named_framebuffer_depth_stencil(
&self,
framebuffer: Option<Self::Framebuffer>,
target: u32,
draw_buffer: u32,
depth: f32,
stencil: i32,
);

unsafe fn client_wait_sync(&self, fence: Self::Fence, flags: u32, timeout: i32) -> u32;
unsafe fn wait_sync(&self, fence: Self::Fence, flags: u32, timeout: u64);

Expand Down Expand Up @@ -680,6 +739,18 @@ pub trait HasContext: __private::Sealed {

unsafe fn draw_buffer(&self, buffer: u32);

unsafe fn named_framebuffer_draw_buffer(
&self,
framebuffer: Option<Self::Framebuffer>,
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 Expand Up @@ -781,6 +852,31 @@ pub trait HasContext: __private::Sealed {
layer: i32,
);

unsafe fn named_framebuffer_renderbuffer(
&self,
framebuffer: Option<Self::Framebuffer>,
attachment: u32,
renderbuffer_target: u32,
renderbuffer: Option<Self::Renderbuffer>,
);

unsafe fn named_framebuffer_texture(
&self,
framebuffer: Option<Self::Framebuffer>,
attachment: u32,
texture: Option<Self::Texture>,
level: i32,
);

unsafe fn named_framebuffer_texture_layer(
&self,
framebuffer: Option<Self::Framebuffer>,
attachment: u32,
texture: Option<Self::Texture>,
level: i32,
layer: i32,
);

unsafe fn front_face(&self, value: u32);

unsafe fn get_error(&self) -> u32;
Expand All @@ -803,6 +899,28 @@ pub trait HasContext: __private::Sealed {

unsafe fn get_parameter_string(&self, parameter: u32) -> String;

unsafe fn get_framebuffer_parameter_i32(&self, target: u32, parameter: u32) -> i32;

unsafe fn get_named_framebuffer_parameter_i32(
&self,
framebuffer: Option<Self::Framebuffer>,
parameter: u32,
) -> i32;

unsafe fn get_framebuffer_attachment_parameter_i32(
&self,
target: u32,
attachment: u32,
parameter: u32,
) -> i32;

unsafe fn get_named_framebuffer_attachment_parameter_i32(
&self,
framebuffer: Option<Self::Framebuffer>,
attachment: u32,
parameter: u32,
) -> i32;

unsafe fn get_active_uniform_block_parameter_i32(
&self,
program: Self::Program,
Expand Down Expand Up @@ -1559,6 +1677,12 @@ pub trait HasContext: __private::Sealed {

unsafe fn read_buffer(&self, src: u32);

unsafe fn named_framebuffer_read_buffer(
&self,
framebuffer: Option<Self::Framebuffer>,
src: u32,
);

unsafe fn read_pixels(
&self,
x: i32,
Expand Down
Loading
Loading