Skip to content

Commit

Permalink
update for wgpu 0.8 (#1959)
Browse files Browse the repository at this point in the history
Changes to get Bevy to compile with wgpu master.

With this, on a Mac:
* 2d examples look fine
* ~~3d examples crash with an error specific to metal about a compilation error~~
* 3d examples work fine after enabling feature `wgpu/cross`


Feature `wgpu/cross` seems to be needed only on some platforms, not sure how to know which. It was introduced in gfx-rs/wgpu-rs#826
  • Loading branch information
mockersf committed May 2, 2021
1 parent e706679 commit bb39848
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,35 @@ async fn load_gltf<'a, 'b>(

if let Some(vertex_attribute) = reader
.read_positions()
.map(|v| VertexAttributeValues::Float3(v.collect()))
.map(|v| VertexAttributeValues::Float32x3(v.collect()))
{
mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, vertex_attribute);
}

if let Some(vertex_attribute) = reader
.read_normals()
.map(|v| VertexAttributeValues::Float3(v.collect()))
.map(|v| VertexAttributeValues::Float32x3(v.collect()))
{
mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, vertex_attribute);
}

if let Some(vertex_attribute) = reader
.read_tangents()
.map(|v| VertexAttributeValues::Float4(v.collect()))
.map(|v| VertexAttributeValues::Float32x4(v.collect()))
{
mesh.set_attribute(Mesh::ATTRIBUTE_TANGENT, vertex_attribute);
}

if let Some(vertex_attribute) = reader
.read_tex_coords(0)
.map(|v| VertexAttributeValues::Float2(v.into_f32().collect()))
.map(|v| VertexAttributeValues::Float32x2(v.into_f32().collect()))
{
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vertex_attribute);
}

if let Some(vertex_attribute) = reader
.read_colors(0)
.map(|v| VertexAttributeValues::Float4(v.into_rgba_f32().collect()))
.map(|v| VertexAttributeValues::Float32x4(v.into_rgba_f32().collect()))
{
mesh.set_attribute(Mesh::ATTRIBUTE_COLOR, vertex_attribute);
}
Expand Down

0 comments on commit bb39848

Please sign in to comment.