diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:24 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:24 +0100 |
commit | b86e97f67a07368877bd18501aebcbe80cf93118 (patch) | |
tree | 97b72b4339da6400b481170eab11fd89ab5dfa80 /stockton-skeleton/src/builders/pipeline.rs | |
parent | e1cc0e9a9d191bcd3a634be46fd3555d430b07a8 (diff) |
feat(skeleton): add memory pools
added stock memory pools behind a feature gate
refactored buffers to use them and to have better APIs.
moved some util code out of builders::pipeline
updated stockton-render for the changes
deactivation is a WIP
breaks UI drawing, fix WIP
Diffstat (limited to 'stockton-skeleton/src/builders/pipeline.rs')
-rw-r--r-- | stockton-skeleton/src/builders/pipeline.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/stockton-skeleton/src/builders/pipeline.rs b/stockton-skeleton/src/builders/pipeline.rs index f68d9d6..9f4937f 100644 --- a/stockton-skeleton/src/builders/pipeline.rs +++ b/stockton-skeleton/src/builders/pipeline.rs @@ -1,5 +1,7 @@ use super::{renderpass::RenderpassSpec, shader::ShaderDesc}; -use crate::{error::EnvironmentError, target::SwapchainProperties, types::*}; +use crate::{ + error::EnvironmentError, target::SwapchainProperties, types::*, utils::get_pixel_size, +}; use std::{mem::ManuallyDrop, ops::Range}; @@ -33,23 +35,15 @@ impl VertexBufferSpec { format: *format, }, }); - offset += get_size(*format); + offset += get_pixel_size(*format); } v } pub fn stride(&self) -> ElemStride { - self.attributes.iter().fold(0, |x, f| x + get_size(*f)) - } -} - -fn get_size(f: Format) -> u32 { - match f { - Format::Rgb32Sfloat => 4 * 3, - Format::R32Sint => 4, - Format::Rg32Sfloat => 4 * 2, - Format::Rgba32Sfloat => 4 * 4, - _ => unimplemented!("dont know size of format {:?}", f), + self.attributes + .iter() + .fold(0, |x, f| x + get_pixel_size(*f)) } } |