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
commitfb996488aa651cb2e7f46abc083c4318b47e77cd (patch)
treed1513d479b6069abca290e271f439cd1ef553383 /stockton-render/src/draw/draw_buffers.rs
parenta82e16c92a026b2fbe3a40a21d7e690242e32ba6 (diff)
wip refactor(render): more work on draw passes
Diffstat (limited to 'stockton-render/src/draw/draw_buffers.rs')
-rw-r--r--stockton-render/src/draw/draw_buffers.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/stockton-render/src/draw/draw_buffers.rs b/stockton-render/src/draw/draw_buffers.rs
deleted file mode 100644
index 2d2fce4..0000000
--- a/stockton-render/src/draw/draw_buffers.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-use crate::{draw::buffer::StagedBuffer, types::*};
-use anyhow::{Context, Result};
-use hal::buffer::Usage;
-use std::mem::ManuallyDrop;
-use stockton_types::{Vector2, Vector3};
-
-/// Represents a point of a triangle, including UV and texture information.
-#[derive(Debug, Clone, Copy)]
-pub struct UvPoint(pub Vector3, pub i32, pub Vector2);
-
-/// Initial size of vertex buffer. TODO: Way of overriding this
-pub const INITIAL_VERT_SIZE: u64 = 3 * 3000;
-
-/// Initial size of index buffer. TODO: Way of overriding this
-pub const INITIAL_INDEX_SIZE: u64 = 3000;
-
-/// The buffers used for drawing, ie index and vertex buffer
-pub struct DrawBuffers<'a, T: Sized> {
- pub vertex_buffer: ManuallyDrop<StagedBuffer<'a, T>>,
- pub index_buffer: ManuallyDrop<StagedBuffer<'a, (u16, u16, u16)>>,
-}
-
-impl<'a, T> DrawBuffers<'a, T> {
- 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),
- index_buffer: ManuallyDrop::new(index),
- })
- }
-
- pub fn deactivate(self, device: &mut DeviceT) {
- unsafe {
- use core::ptr::read;
-
- ManuallyDrop::into_inner(read(&self.vertex_buffer)).deactivate(device);
- ManuallyDrop::into_inner(read(&self.index_buffer)).deactivate(device);
- }
- }
-}