[rs] Update wgpu with depth clamping API changes

This commit is contained in:
Dzmitry Malyshau
2021-04-05 23:27:53 -04:00
parent 2448307a25
commit 756ea0e51f
5 changed files with 6 additions and 10 deletions

View File

@@ -28,20 +28,20 @@ cross = ["wgc/cross"]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "eef478fc5d4de9c114084a4f8a7a3d434697fdba"
rev = "e430cf4bcc10aea447f637067fe81c75c80f0e46"
features = ["raw-window-handle"]
[target.'cfg(target_arch = "wasm32")'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "eef478fc5d4de9c114084a4f8a7a3d434697fdba"
rev = "e430cf4bcc10aea447f637067fe81c75c80f0e46"
features = ["raw-window-handle"]
optional = true
[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "eef478fc5d4de9c114084a4f8a7a3d434697fdba"
rev = "e430cf4bcc10aea447f637067fe81c75c80f0e46"
[dependencies]
arrayvec = "0.5"

View File

@@ -507,6 +507,7 @@ impl framework::Example for Example {
topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Ccw,
cull_mode: Some(wgpu::Face::Back),
clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING),
..Default::default()
},
depth_stencil: Some(wgpu::DepthStencilState {
@@ -519,7 +520,6 @@ impl framework::Example for Example {
slope_scale: 2.0,
clamp: 0.0,
},
clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING),
}),
multisample: wgpu::MultisampleState::default(),
});
@@ -646,7 +646,6 @@ impl framework::Example for Example {
depth_compare: wgpu::CompareFunction::Less,
stencil: wgpu::StencilState::default(),
bias: wgpu::DepthBiasState::default(),
clamp_depth: false,
}),
multisample: wgpu::MultisampleState::default(),
});

View File

@@ -232,7 +232,6 @@ impl framework::Example for Skybox {
depth_compare: wgpu::CompareFunction::LessEqual,
stencil: wgpu::StencilState::default(),
bias: wgpu::DepthBiasState::default(),
clamp_depth: false,
}),
multisample: wgpu::MultisampleState::default(),
});
@@ -263,7 +262,6 @@ impl framework::Example for Skybox {
depth_compare: wgpu::CompareFunction::LessEqual,
stencil: wgpu::StencilState::default(),
bias: wgpu::DepthBiasState::default(),
clamp_depth: false,
}),
multisample: wgpu::MultisampleState::default(),
});

View File

@@ -570,7 +570,6 @@ impl framework::Example for Example {
depth_compare: wgpu::CompareFunction::Less,
stencil: wgpu::StencilState::default(),
bias: wgpu::DepthBiasState::default(),
clamp_depth: false,
}),
// No multisampling is used.
multisample: wgpu::MultisampleState::default(),
@@ -605,7 +604,6 @@ impl framework::Example for Example {
depth_compare: wgpu::CompareFunction::Less,
stencil: wgpu::StencilState::default(),
bias: wgpu::DepthBiasState::default(),
clamp_depth: false,
}),
multisample: wgpu::MultisampleState::default(),
});

View File

@@ -603,6 +603,8 @@ fn map_primitive_state(primitive: &wgt::PrimitiveState) -> web_sys::GpuPrimitive
PrimitiveTopology::TriangleStrip => pt::TriangleStrip,
});
//mapped.clamp_depth(primitive.clamp_depth);
mapped
}
@@ -647,7 +649,6 @@ fn map_stencil_state_face(desc: &wgt::StencilFaceState) -> web_sys::GpuStencilFa
fn map_depth_stencil_state(desc: &wgt::DepthStencilState) -> web_sys::GpuDepthStencilState {
let mut mapped = web_sys::GpuDepthStencilState::new(map_texture_format(desc.format));
mapped.clamp_depth(desc.clamp_depth);
mapped.depth_bias(desc.bias.constant);
mapped.depth_bias_clamp(desc.bias.clamp);
mapped.depth_bias_slope_scale(desc.bias.slope_scale);