Skip to content

Commit a7b0d5a

Browse files
bors[bot]aloucks
andauthored
Merge gfx-rs#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 <[email protected]>
2 parents 8df9577 + d93293f commit a7b0d5a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

examples/cube/main.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ mod framework;
33

44
use zerocopy::{AsBytes, FromBytes};
55

6-
use wgpu::vertex_attr_array;
7-
86
#[repr(C)]
97
#[derive(Clone, Copy, AsBytes, FromBytes)]
108
struct Vertex {
@@ -277,7 +275,18 @@ impl framework::Example for Example {
277275
vertex_buffers: &[wgpu::VertexBufferDescriptor {
278276
stride: vertex_size as wgpu::BufferAddress,
279277
step_mode: wgpu::InputStepMode::Vertex,
280-
attributes: &vertex_attr_array![0 => Float4, 1 => Float2],
278+
attributes: &[
279+
wgpu::VertexAttributeDescriptor {
280+
format: wgpu::VertexFormat::Float4,
281+
offset: 0,
282+
shader_location: 0,
283+
},
284+
wgpu::VertexAttributeDescriptor {
285+
format: wgpu::VertexFormat::Float2,
286+
offset: 4 * 4,
287+
shader_location: 1,
288+
},
289+
],
281290
}],
282291
sample_count: 1,
283292
sample_mask: !0,

0 commit comments

Comments
 (0)