From 7a31e4e333f05a5dd1735d98e760f1e89ba75894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsolt=20B=C3=B6l=C3=B6ny?= Date: Thu, 11 Feb 2021 12:59:33 +0100 Subject: [PATCH] [rs] Convert `PrimitiveState::cull_mode` to `Option` --- wgpu/Cargo.toml | 6 +++--- wgpu/examples/cube/main.rs | 4 ++-- wgpu/examples/mipmap/main.rs | 2 +- wgpu/examples/shadow/main.rs | 4 ++-- wgpu/examples/water/main.rs | 2 +- wgpu/src/backend/web.rs | 10 +++++----- wgpu/src/lib.rs | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index b26beb9b71..17f5588290 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -26,20 +26,20 @@ webgl = ["wgc"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "b1b44ca78c6a55e200f25da38f7b47b4c90928e9" +rev = "05a531191d4ce2927f2157e5dd54b7aa5d779406" features = ["raw-window-handle"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "b1b44ca78c6a55e200f25da38f7b47b4c90928e9" +rev = "05a531191d4ce2927f2157e5dd54b7aa5d779406" features = ["raw-window-handle"] optional = true [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "b1b44ca78c6a55e200f25da38f7b47b4c90928e9" +rev = "05a531191d4ce2927f2157e5dd54b7aa5d779406" [dependencies] arrayvec = "0.5" diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index e0e42c8572..a61d968cae 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -292,7 +292,7 @@ impl framework::Example for Example { targets: &[sc_desc.format.into()], }), primitive: wgpu::PrimitiveState { - cull_mode: wgpu::CullMode::Back, + cull_mode: Some(wgpu::Face::Back), ..Default::default() }, depth_stencil: None, @@ -327,7 +327,7 @@ impl framework::Example for Example { }), primitive: wgpu::PrimitiveState { front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Back, + cull_mode: Some(wgpu::Face::Back), polygon_mode: wgpu::PolygonMode::Line, ..Default::default() }, diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index 9a81e242d4..0071709e57 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -344,7 +344,7 @@ impl framework::Example for Example { primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleStrip, front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Back, + cull_mode: Some(wgpu::Face::Back), ..Default::default() }, depth_stencil: None, diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index e3d082e16a..73d6879ad8 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -485,7 +485,7 @@ impl framework::Example for Example { primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleList, front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Back, + cull_mode: Some(wgpu::Face::Back), ..Default::default() }, depth_stencil: Some(wgpu::DepthStencilState { @@ -616,7 +616,7 @@ impl framework::Example for Example { }), primitive: wgpu::PrimitiveState { front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Back, + cull_mode: Some(wgpu::Face::Back), ..Default::default() }, depth_stencil: Some(wgpu::DepthStencilState { diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index 720d04fc2e..d50a10c27b 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -585,7 +585,7 @@ impl framework::Example for Example { }), primitive: wgpu::PrimitiveState { front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Front, + cull_mode: Some(wgpu::Face::Front), ..Default::default() }, depth_stencil: Some(wgpu::DepthStencilState { diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 9c39d1b631..6ee0cdf2a7 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -507,13 +507,13 @@ fn map_texture_component_type( } } -fn map_cull_mode(cull_mode: wgt::CullMode) -> web_sys::GpuCullMode { +fn map_cull_mode(cull_mode: Option) -> web_sys::GpuCullMode { use web_sys::GpuCullMode as cm; - use wgt::CullMode; + use wgt::Face; match cull_mode { - CullMode::None => cm::None, - CullMode::Front => cm::Front, - CullMode::Back => cm::Back, + None => cm::None, + Some(Face::Front) => cm::Front, + Some(Face::Back) => cm::Back, } } diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index e078dfd2b2..75c68794cf 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -27,7 +27,7 @@ use parking_lot::Mutex; pub use wgt::{ AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType, BufferSize, BufferUsage, Color, - ColorTargetState, ColorWrite, CommandBufferDescriptor, CompareFunction, CullMode, + ColorTargetState, ColorWrite, CommandBufferDescriptor, CompareFunction, Face, DepthBiasState, DepthStencilState, DeviceType, DynamicOffset, Extent3d, Features, FilterMode, FrontFace, IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d, PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode, PrimitiveState,