aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/draw/draw_buffers.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commitc52a05e6d3977efce6bd4479aa312dc90e0452e5 (patch)
treec383c910c1467b406e332651906e081c599d6951 /stockton-render/src/draw/draw_buffers.rs
parentd5b9ccd3d4a6e5b35a0411688bfb7113f5c7d631 (diff)
feat(render): proper error handling
Diffstat (limited to 'stockton-render/src/draw/draw_buffers.rs')
-rw-r--r--stockton-render/src/draw/draw_buffers.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/stockton-render/src/draw/draw_buffers.rs b/stockton-render/src/draw/draw_buffers.rs
index 67687dd..fba3eed 100644
--- a/stockton-render/src/draw/draw_buffers.rs
+++ b/stockton-render/src/draw/draw_buffers.rs
@@ -1,4 +1,5 @@
-use crate::{draw::buffer::StagedBuffer, error::CreationError, types::*};
+use crate::{draw::buffer::StagedBuffer, types::*};
+use anyhow::{Context, Result};
use hal::buffer::Usage;
use std::mem::ManuallyDrop;
use stockton_types::{Vector2, Vector3};
@@ -20,12 +21,11 @@ pub struct DrawBuffers<'a, T: Sized> {
}
impl<'a, T> DrawBuffers<'a, T> {
- pub fn new(
- device: &mut DeviceT,
- adapter: &Adapter,
- ) -> Result<DrawBuffers<'a, T>, CreationError> {
- let vert = StagedBuffer::new(device, &adapter, Usage::VERTEX, INITIAL_VERT_SIZE)?;
- let index = StagedBuffer::new(device, &adapter, Usage::INDEX, INITIAL_INDEX_SIZE)?;
+ pub fn new(device: &mut DeviceT, adapter: &Adapter) -> Result<DrawBuffers<'a, T>> {
+ let vert = StagedBuffer::new(device, &adapter, Usage::VERTEX, INITIAL_VERT_SIZE)
+ .context("Error creating vertex buffer")?;
+ let index = StagedBuffer::new(device, &adapter, Usage::INDEX, INITIAL_INDEX_SIZE)
+ .context("Error creating index buffer")?;
Ok(DrawBuffers {
vertex_buffer: ManuallyDrop::new(vert),