Skip to content

Commit

Permalink
fmt(gl): cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Sep 24, 2024
1 parent ef35e2a commit feaebc5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
6 changes: 2 additions & 4 deletions librashader-runtime-gl/src/gl/gl3/draw_quad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ impl DrawQuad for Gl3DrawQuad {

unsafe {
vbo = [
ctx.create_buffer()
.map_err(FilterChainError::GlError)?,
ctx.create_buffer()
.map_err(FilterChainError::GlError)?,
ctx.create_buffer().map_err(FilterChainError::GlError)?,
ctx.create_buffer().map_err(FilterChainError::GlError)?,
];

ctx.bind_buffer(glow::ARRAY_BUFFER, Some(vbo[0]));
Expand Down
21 changes: 8 additions & 13 deletions librashader-runtime-gl/src/gl/gl3/ubo_ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ pub struct Gl3UboRing<const SIZE: usize> {
impl<const SIZE: usize> UboRing<SIZE> for Gl3UboRing<SIZE> {
fn new(ctx: &glow::Context, buffer_size: u32) -> error::Result<Self> {
let items: [glow::Buffer; SIZE] = array_init::try_array_init(|_| unsafe {
ctx
.create_buffer()
.map(|buffer| {
ctx.bind_buffer(glow::UNIFORM_BUFFER, Some(buffer));
ctx.buffer_data_size(
glow::UNIFORM_BUFFER,
buffer_size as i32,
glow::STREAM_DRAW,
);
ctx.bind_buffer(glow::UNIFORM_BUFFER, None);
buffer
})
}).map_err(FilterChainError::GlError)?;
ctx.create_buffer().map(|buffer| {
ctx.bind_buffer(glow::UNIFORM_BUFFER, Some(buffer));
ctx.buffer_data_size(glow::UNIFORM_BUFFER, buffer_size as i32, glow::STREAM_DRAW);
ctx.bind_buffer(glow::UNIFORM_BUFFER, None);
buffer
})
})
.map_err(FilterChainError::GlError)?;

let ring: InlineRingBuffer<glow::Buffer, SIZE> = InlineRingBuffer::from_array(items);
Ok(Gl3UboRing { ring })
Expand Down
17 changes: 6 additions & 11 deletions librashader-runtime-gl/src/gl/gl46/ubo_ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ pub struct Gl46UboRing<const SIZE: usize> {
impl<const SIZE: usize> UboRing<SIZE> for Gl46UboRing<SIZE> {
fn new(context: &glow::Context, buffer_size: u32) -> error::Result<Self> {
let items: [glow::Buffer; SIZE] = array_init::try_array_init(|_| unsafe {
context
.create_named_buffer()
.map(|buffer| {
context.named_buffer_data_size(
buffer,
buffer_size as i32,
glow::STREAM_DRAW,
);
buffer
})
}).map_err(FilterChainError::GlError)?;
context.create_named_buffer().map(|buffer| {
context.named_buffer_data_size(buffer, buffer_size as i32, glow::STREAM_DRAW);
buffer
})
})
.map_err(FilterChainError::GlError)?;

let ring: InlineRingBuffer<glow::Buffer, SIZE> = InlineRingBuffer::from_array(items);
Ok(Gl46UboRing { ring })
Expand Down

0 comments on commit feaebc5

Please sign in to comment.