mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 00:41:07 +01:00
Merge #442
442: replace vertex_format_size macro with VertexFormat size function r=kvark a=bootra-dev This pull request depends on https://github.com/gfx-rs/wgpu/pull/802 I'm not sure if multiple pull requests is the right way to handle this - let me know if I need to use another workflow. Co-authored-by: bootra-dev <bootragames@gmail.com>
This commit is contained in:
1 file changed
+1
-98
+1
-98
@@ -24,109 +24,12 @@ macro_rules! vertex_attr_array {
|
||||
offset: $off,
|
||||
shader_location: $loc,
|
||||
},];
|
||||
$off + $crate::vertex_format_size!($item);
|
||||
$off + $crate::VertexFormat :: $item.size();
|
||||
$($ll => $ii ,)*
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/// Helper macro which turns a vertex attribute type into a size.
|
||||
///
|
||||
/// Mainly used as a helper for [`vertex_attr_array`] but might be externally useful.
|
||||
#[macro_export]
|
||||
macro_rules! vertex_format_size {
|
||||
(Uchar2) => {
|
||||
2
|
||||
};
|
||||
(Uchar4) => {
|
||||
4
|
||||
};
|
||||
(Char2) => {
|
||||
2
|
||||
};
|
||||
(Char4) => {
|
||||
4
|
||||
};
|
||||
(Uchar2Norm) => {
|
||||
2
|
||||
};
|
||||
(Uchar4Norm) => {
|
||||
4
|
||||
};
|
||||
(Char2Norm) => {
|
||||
2
|
||||
};
|
||||
(Char4Norm) => {
|
||||
4
|
||||
};
|
||||
(Ushort2) => {
|
||||
4
|
||||
};
|
||||
(Ushort4) => {
|
||||
8
|
||||
};
|
||||
(Short2) => {
|
||||
4
|
||||
};
|
||||
(Short4) => {
|
||||
8
|
||||
};
|
||||
(Ushort2Norm) => {
|
||||
4
|
||||
};
|
||||
(Ushort4Norm) => {
|
||||
8
|
||||
};
|
||||
(Short2Norm) => {
|
||||
4
|
||||
};
|
||||
(Short4Norm) => {
|
||||
8
|
||||
};
|
||||
(Half2) => {
|
||||
4
|
||||
};
|
||||
(Half4) => {
|
||||
8
|
||||
};
|
||||
(Float) => {
|
||||
4
|
||||
};
|
||||
(Float2) => {
|
||||
8
|
||||
};
|
||||
(Float3) => {
|
||||
12
|
||||
};
|
||||
(Float4) => {
|
||||
16
|
||||
};
|
||||
(Uint) => {
|
||||
4
|
||||
};
|
||||
(Uint2) => {
|
||||
8
|
||||
};
|
||||
(Uint3) => {
|
||||
12
|
||||
};
|
||||
(Uint4) => {
|
||||
16
|
||||
};
|
||||
(Int) => {
|
||||
4
|
||||
};
|
||||
(Int2) => {
|
||||
8
|
||||
};
|
||||
(Int3) => {
|
||||
12
|
||||
};
|
||||
(Int4) => {
|
||||
16
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vertex_attr_array() {
|
||||
let attrs = vertex_attr_array![0 => Float2, 3 => Ushort4];
|
||||
|
||||
Reference in new issue
Block a user