mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Merge #192
192: Explicitly declare vertex attribute descriptors in cube example r=kvark a=aloucks The new `vertex_attr_array!` macro is pretty wonderful, but it's nice to have at least one reference example of how `VertexAttributeDescriptor`s are constructed. Co-authored-by: Aaron Loucks <aloucks@cofront.net>
This commit is contained in:
@@ -3,8 +3,6 @@ mod framework;
|
||||
|
||||
use zerocopy::{AsBytes, FromBytes};
|
||||
|
||||
use wgpu::vertex_attr_array;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, AsBytes, FromBytes)]
|
||||
struct Vertex {
|
||||
@@ -277,7 +275,18 @@ impl framework::Example for Example {
|
||||
vertex_buffers: &[wgpu::VertexBufferDescriptor {
|
||||
stride: vertex_size as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
attributes: &vertex_attr_array![0 => Float4, 1 => Float2],
|
||||
attributes: &[
|
||||
wgpu::VertexAttributeDescriptor {
|
||||
format: wgpu::VertexFormat::Float4,
|
||||
offset: 0,
|
||||
shader_location: 0,
|
||||
},
|
||||
wgpu::VertexAttributeDescriptor {
|
||||
format: wgpu::VertexFormat::Float2,
|
||||
offset: 4 * 4,
|
||||
shader_location: 1,
|
||||
},
|
||||
],
|
||||
}],
|
||||
sample_count: 1,
|
||||
sample_mask: !0,
|
||||
|
||||
Reference in New Issue
Block a user