fmt(gl): cargo fmt

This commit is contained in:
chyyran 2024-09-23 23:55:50 -04:00
parent ef35e2a620
commit feaebc5f44
3 changed files with 16 additions and 28 deletions

View file

@ -17,10 +17,8 @@ impl DrawQuad for Gl3DrawQuad {
unsafe { unsafe {
vbo = [ vbo = [
ctx.create_buffer() ctx.create_buffer().map_err(FilterChainError::GlError)?,
.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])); ctx.bind_buffer(glow::ARRAY_BUFFER, Some(vbo[0]));

View file

@ -15,19 +15,14 @@ pub struct Gl3UboRing<const SIZE: usize> {
impl<const SIZE: usize> UboRing<SIZE> for Gl3UboRing<SIZE> { impl<const SIZE: usize> UboRing<SIZE> for Gl3UboRing<SIZE> {
fn new(ctx: &glow::Context, buffer_size: u32) -> error::Result<Self> { fn new(ctx: &glow::Context, buffer_size: u32) -> error::Result<Self> {
let items: [glow::Buffer; SIZE] = array_init::try_array_init(|_| unsafe { let items: [glow::Buffer; SIZE] = array_init::try_array_init(|_| unsafe {
ctx ctx.create_buffer().map(|buffer| {
.create_buffer()
.map(|buffer| {
ctx.bind_buffer(glow::UNIFORM_BUFFER, Some(buffer)); ctx.bind_buffer(glow::UNIFORM_BUFFER, Some(buffer));
ctx.buffer_data_size( ctx.buffer_data_size(glow::UNIFORM_BUFFER, buffer_size as i32, glow::STREAM_DRAW);
glow::UNIFORM_BUFFER,
buffer_size as i32,
glow::STREAM_DRAW,
);
ctx.bind_buffer(glow::UNIFORM_BUFFER, None); ctx.bind_buffer(glow::UNIFORM_BUFFER, None);
buffer buffer
}) })
}).map_err(FilterChainError::GlError)?; })
.map_err(FilterChainError::GlError)?;
let ring: InlineRingBuffer<glow::Buffer, SIZE> = InlineRingBuffer::from_array(items); let ring: InlineRingBuffer<glow::Buffer, SIZE> = InlineRingBuffer::from_array(items);
Ok(Gl3UboRing { ring }) Ok(Gl3UboRing { ring })

View file

@ -15,17 +15,12 @@ pub struct Gl46UboRing<const SIZE: usize> {
impl<const SIZE: usize> UboRing<SIZE> for Gl46UboRing<SIZE> { impl<const SIZE: usize> UboRing<SIZE> for Gl46UboRing<SIZE> {
fn new(context: &glow::Context, buffer_size: u32) -> error::Result<Self> { fn new(context: &glow::Context, buffer_size: u32) -> error::Result<Self> {
let items: [glow::Buffer; SIZE] = array_init::try_array_init(|_| unsafe { let items: [glow::Buffer; SIZE] = array_init::try_array_init(|_| unsafe {
context context.create_named_buffer().map(|buffer| {
.create_named_buffer() context.named_buffer_data_size(buffer, buffer_size as i32, glow::STREAM_DRAW);
.map(|buffer| {
context.named_buffer_data_size(
buffer,
buffer_size as i32,
glow::STREAM_DRAW,
);
buffer buffer
}) })
}).map_err(FilterChainError::GlError)?; })
.map_err(FilterChainError::GlError)?;
let ring: InlineRingBuffer<glow::Buffer, SIZE> = InlineRingBuffer::from_array(items); let ring: InlineRingBuffer<glow::Buffer, SIZE> = InlineRingBuffer::from_array(items);
Ok(Gl46UboRing { ring }) Ok(Gl46UboRing { ring })