[rs] Convert PrimitiveState::cull_mode to Option<Face>

This commit is contained in:
Zsolt Bölöny 2021-02-11 12:59:33 +01:00
parent f719dc0752
commit 7a31e4e333
7 changed files with 15 additions and 15 deletions

View File

@ -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"

View File

@ -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()
},

View File

@ -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,

View File

@ -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 {

View File

@ -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 {

View File

@ -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<wgt::Face>) -> 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,
}
}

View File

@ -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,