Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - update for wgpu 0.8 #1959

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ bevy_ci_testing = ["bevy_internal/bevy_ci_testing"]
bevy_dylib = {path = "crates/bevy_dylib", version = "0.5.0", default-features = false, optional = true}
bevy_internal = {path = "crates/bevy_internal", version = "0.5.0", default-features = false}

[target.'cfg(target_arch = "wasm32")'.dependencies]
syn = "=1.0.65"

[dev-dependencies]
anyhow = "1.0"
rand = "0.8.0"
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_gltf/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
28 changes: 15 additions & 13 deletions crates/bevy_pbr/src/render_graph/pbr_pipeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use bevy_asset::{Assets, HandleUntyped};
use bevy_reflect::TypeUuid;
use bevy_render::{
pipeline::{
BlendFactor, BlendOperation, BlendState, ColorTargetState, ColorWrite, CompareFunction,
DepthBiasState, DepthStencilState, PipelineDescriptor, StencilFaceState, StencilState,
BlendComponent, BlendFactor, BlendOperation, BlendState, ColorTargetState, ColorWrite,
CompareFunction, DepthBiasState, DepthStencilState, PipelineDescriptor, StencilFaceState,
StencilState,
},
shader::{Shader, ShaderStage, ShaderStages},
texture::TextureFormat,
Expand All @@ -29,20 +30,21 @@ pub(crate) fn build_pbr_pipeline(shaders: &mut Assets<Shader>) -> PipelineDescri
slope_scale: 0.0,
clamp: 0.0,
},
clamp_depth: false,
}),
color_target_states: vec![ColorTargetState {
format: TextureFormat::default(),
color_blend: BlendState {
src_factor: BlendFactor::SrcAlpha,
dst_factor: BlendFactor::OneMinusSrcAlpha,
operation: BlendOperation::Add,
},
alpha_blend: BlendState {
src_factor: BlendFactor::One,
dst_factor: BlendFactor::One,
operation: BlendOperation::Add,
},
blend: Some(BlendState {
color: BlendComponent {
src_factor: BlendFactor::SrcAlpha,
dst_factor: BlendFactor::OneMinusSrcAlpha,
operation: BlendOperation::Add,
},
alpha: BlendComponent {
src_factor: BlendFactor::One,
dst_factor: BlendFactor::One,
operation: BlendOperation::Add,
},
}),
write_mask: ColorWrite::ALL,
}],
..PipelineDescriptor::new(ShaderStages {
Expand Down
282 changes: 141 additions & 141 deletions crates/bevy_render/src/mesh/mesh.rs

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions crates/bevy_render/src/mesh/mesh/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,79 +50,79 @@ impl FromVertexAttributeError {

impl From<Vec<f32>> for VertexAttributeValues {
fn from(vec: Vec<f32>) -> Self {
VertexAttributeValues::Float(vec)
VertexAttributeValues::Float32(vec)
}
}

impl From<Vec<i32>> for VertexAttributeValues {
fn from(vec: Vec<i32>) -> Self {
VertexAttributeValues::Int(vec)
VertexAttributeValues::Sint32(vec)
}
}

impl From<Vec<u32>> for VertexAttributeValues {
fn from(vec: Vec<u32>) -> Self {
VertexAttributeValues::Uint(vec)
VertexAttributeValues::Uint32(vec)
}
}

impl From<Vec<[f32; 2]>> for VertexAttributeValues {
fn from(vec: Vec<[f32; 2]>) -> Self {
VertexAttributeValues::Float2(vec)
VertexAttributeValues::Float32x2(vec)
}
}

impl From<Vec<[i32; 2]>> for VertexAttributeValues {
fn from(vec: Vec<[i32; 2]>) -> Self {
VertexAttributeValues::Int2(vec)
VertexAttributeValues::Sint32x2(vec)
}
}

impl From<Vec<[u32; 2]>> for VertexAttributeValues {
fn from(vec: Vec<[u32; 2]>) -> Self {
VertexAttributeValues::Uint2(vec)
VertexAttributeValues::Uint32x2(vec)
}
}

impl From<Vec<[f32; 3]>> for VertexAttributeValues {
fn from(vec: Vec<[f32; 3]>) -> Self {
VertexAttributeValues::Float3(vec)
VertexAttributeValues::Float32x3(vec)
}
}

impl From<Vec<[i32; 3]>> for VertexAttributeValues {
fn from(vec: Vec<[i32; 3]>) -> Self {
VertexAttributeValues::Int3(vec)
VertexAttributeValues::Sint32x3(vec)
}
}

impl From<Vec<[u32; 3]>> for VertexAttributeValues {
fn from(vec: Vec<[u32; 3]>) -> Self {
VertexAttributeValues::Uint3(vec)
VertexAttributeValues::Uint32x3(vec)
}
}

impl From<Vec<[f32; 4]>> for VertexAttributeValues {
fn from(vec: Vec<[f32; 4]>) -> Self {
VertexAttributeValues::Float4(vec)
VertexAttributeValues::Float32x4(vec)
}
}

impl From<Vec<[i32; 4]>> for VertexAttributeValues {
fn from(vec: Vec<[i32; 4]>) -> Self {
VertexAttributeValues::Int4(vec)
VertexAttributeValues::Sint32x4(vec)
}
}

impl From<Vec<[u32; 4]>> for VertexAttributeValues {
fn from(vec: Vec<[u32; 4]>) -> Self {
VertexAttributeValues::Uint4(vec)
VertexAttributeValues::Uint32x4(vec)
}
}

impl From<Vec<[u8; 4]>> for VertexAttributeValues {
fn from(vec: Vec<[u8; 4]>) -> Self {
VertexAttributeValues::Uchar4Norm(vec)
VertexAttributeValues::Unorm8x4(vec)
}
}

Expand All @@ -131,8 +131,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[u8; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Uchar4(value) => Ok(value),
VertexAttributeValues::Uchar4Norm(value) => Ok(value),
VertexAttributeValues::Uint8x4(value) => Ok(value),
VertexAttributeValues::Unorm8x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -143,8 +143,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[i8; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Char4(value) => Ok(value),
VertexAttributeValues::Char4Norm(value) => Ok(value),
VertexAttributeValues::Sint8x4(value) => Ok(value),
VertexAttributeValues::Snorm8x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -155,8 +155,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[u8; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Uchar2(value) => Ok(value),
VertexAttributeValues::Uchar2Norm(value) => Ok(value),
VertexAttributeValues::Uint8x2(value) => Ok(value),
VertexAttributeValues::Unorm8x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -167,8 +167,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[i8; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Char2(value) => Ok(value),
VertexAttributeValues::Char2Norm(value) => Ok(value),
VertexAttributeValues::Sint8x2(value) => Ok(value),
VertexAttributeValues::Snorm8x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -179,8 +179,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[i16; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Short4(value) => Ok(value),
VertexAttributeValues::Short4Norm(value) => Ok(value),
VertexAttributeValues::Sint16x4(value) => Ok(value),
VertexAttributeValues::Snorm16x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -191,8 +191,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[u16; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Ushort4(value) => Ok(value),
VertexAttributeValues::Ushort4Norm(value) => Ok(value),
VertexAttributeValues::Uint16x4(value) => Ok(value),
VertexAttributeValues::Unorm16x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -203,8 +203,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[u16; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Ushort2(value) => Ok(value),
VertexAttributeValues::Ushort2Norm(value) => Ok(value),
VertexAttributeValues::Uint16x2(value) => Ok(value),
VertexAttributeValues::Unorm16x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -215,8 +215,8 @@ impl TryFrom<VertexAttributeValues> for Vec<[i16; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Short2(value) => Ok(value),
VertexAttributeValues::Short2Norm(value) => Ok(value),
VertexAttributeValues::Sint16x2(value) => Ok(value),
VertexAttributeValues::Snorm16x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -227,7 +227,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[u32; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Uint4(value) => Ok(value),
VertexAttributeValues::Uint32x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -238,7 +238,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[i32; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Int4(value) => Ok(value),
VertexAttributeValues::Sint32x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -249,7 +249,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[f32; 4]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Float4(value) => Ok(value),
VertexAttributeValues::Float32x4(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -260,7 +260,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[u32; 3]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Uint3(value) => Ok(value),
VertexAttributeValues::Uint32x3(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -271,7 +271,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[i32; 3]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Int3(value) => Ok(value),
VertexAttributeValues::Sint32x3(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -282,7 +282,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[f32; 3]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Float3(value) => Ok(value),
VertexAttributeValues::Float32x3(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -293,7 +293,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[u32; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Uint2(value) => Ok(value),
VertexAttributeValues::Uint32x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -304,7 +304,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[i32; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Int2(value) => Ok(value),
VertexAttributeValues::Sint32x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -315,7 +315,7 @@ impl TryFrom<VertexAttributeValues> for Vec<[f32; 2]> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Float2(value) => Ok(value),
VertexAttributeValues::Float32x2(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -326,7 +326,7 @@ impl TryFrom<VertexAttributeValues> for Vec<u32> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Uint(value) => Ok(value),
VertexAttributeValues::Uint32(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -337,7 +337,7 @@ impl TryFrom<VertexAttributeValues> for Vec<i32> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Int(value) => Ok(value),
VertexAttributeValues::Sint32(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand All @@ -348,7 +348,7 @@ impl TryFrom<VertexAttributeValues> for Vec<f32> {

fn try_from(value: VertexAttributeValues) -> Result<Self, Self::Error> {
match value {
VertexAttributeValues::Float(value) => Ok(value),
VertexAttributeValues::Float32(value) => Ok(value),
_ => Err(FromVertexAttributeError::new::<Self>(value)),
}
}
Expand Down Expand Up @@ -513,9 +513,9 @@ mod tests {
};
assert_eq!(
format!("{}", error),
"cannot convert VertexAttributeValues::Uint4 to alloc::vec::Vec<u32>"
"cannot convert VertexAttributeValues::Uint32x4 to alloc::vec::Vec<u32>"
);
assert_eq!(format!("{:?}", error),
"FromVertexAttributeError { from: Uint4([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]), variant: \"Uint4\", into: \"alloc::vec::Vec<u32>\" }");
"FromVertexAttributeError { from: Uint32x4([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]), variant: \"Uint32x4\", into: \"alloc::vec::Vec<u32>\" }");
}
}
Loading