473: Update wgpu, use defaults for rasterizer states, use depth-clamping r=straightforward a=kvark

Includes https://github.com/gfx-rs/wgpu/pull/833 last

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot]
2020-07-24 02:36:24 +00:00
committed by GitHub
11 changed files with 21 additions and 34 deletions

View File

@@ -27,14 +27,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"]
package = "wgpu-core"
version = "0.5"
git = "https://github.com/gfx-rs/wgpu"
rev = "4ed2c0a313deb48a99f15e8fe0558ad3d095ca01"
rev = "0591c48fd234b4faa4c60346454568548ecbe507"
features = ["raw-window-handle"]
[dependencies.wgt]
package = "wgpu-types"
version = "0.5"
git = "https://github.com/gfx-rs/wgpu"
rev = "4ed2c0a313deb48a99f15e8fe0558ad3d095ca01"
rev = "0591c48fd234b4faa4c60346454568548ecbe507"
[dependencies]
arrayvec = "0.5"

View File

@@ -33,6 +33,7 @@ All framework-based examples render to the window.
| optional extensions | | | | | | | :star: | |
| - binding indexing | | | | | | | :star: | |
| - push constants | | | | | | | :star: | |
| - depth clamping | | | | | :star | | | |
| WGSL shaders | | | | | | | | |
## Hacking

View File

@@ -116,9 +116,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::None,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -252,9 +252,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::Back,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -121,9 +121,7 @@ impl Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::None,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleStrip,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {
@@ -351,9 +349,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::Back,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleStrip,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -62,9 +62,7 @@ impl Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::None,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::LineList,
color_states: Cow::Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -203,6 +203,10 @@ impl Example {
}
impl framework::Example for Example {
fn needed_features() -> wgpu::Features {
wgpu::Features::DEPTH_CLAMPING
}
fn init(
sc_desc: &wgpu::SwapChainDescriptor,
device: &wgpu::Device,
@@ -483,6 +487,7 @@ impl framework::Example for Example {
depth_bias: 2, // corresponds to bilinear filtering
depth_bias_slope_scale: 2.0,
depth_bias_clamp: 0.0,
clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING),
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[]),
@@ -609,9 +614,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::Back,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -102,9 +102,7 @@ impl framework::Example for Skybox {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Cw,
cull_mode: wgpu::CullMode::None,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -269,9 +269,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::None,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -504,9 +504,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Cw,
cull_mode: wgpu::CullMode::None,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
// What kind of data are we passing in?
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
@@ -577,9 +575,7 @@ impl framework::Example for Example {
rasterization_state: Some(wgpu::RasterizationStateDescriptor {
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::Front,
depth_bias: 0,
depth_bias_slope_scale: 0.0,
depth_bias_clamp: 0.0,
..Default::default()
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: Borrowed(&[wgpu::ColorStateDescriptor {

View File

@@ -586,11 +586,12 @@ impl crate::Context for Context {
source: ShaderModuleSource,
) -> Self::ShaderModuleId {
let desc = match source {
ShaderModuleSource::SpirV(ref spv) => wgc::pipeline::ShaderModuleSource::SpirV(spv),
ShaderModuleSource::Wgsl(ref code) => wgc::pipeline::ShaderModuleSource::Wgsl(code),
ShaderModuleSource::SpirV(spv) => wgc::pipeline::ShaderModuleSource::SpirV(spv),
ShaderModuleSource::Wgsl(code) => wgc::pipeline::ShaderModuleSource::Wgsl(code),
};
let global = &self.0;
wgc::gfx_select!(*device => global.device_create_shader_module(*device, desc, PhantomData))
.unwrap()
}
fn device_create_bind_group_layout(