mirror of
https://github.com/guilhermewerner/wgpu-renderer
synced 2025-06-16 13:54:21 +00:00
Initial wgpu abstraction
This commit is contained in:
21
Source/Render/VertexAttribute.rs
Normal file
21
Source/Render/VertexAttribute.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use super::VertexFormat;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VertexAttribute {
|
||||
pub label: Cow<'static, str>,
|
||||
pub format: VertexFormat,
|
||||
pub offset: usize,
|
||||
pub shader_location: u32,
|
||||
}
|
||||
|
||||
impl From<VertexAttribute> for wgpu::VertexAttribute {
|
||||
fn from(attr: VertexAttribute) -> Self {
|
||||
wgpu::VertexAttribute {
|
||||
offset: attr.offset as wgpu::BufferAddress,
|
||||
shader_location: attr.shader_location,
|
||||
format: attr.format.into(),
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user