Skip to content

Commit

Permalink
Update wgpu with depth clamping API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Apr 6, 2021
1 parent 41f44da commit 729d9e2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions examples/shadow/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(),
});
Expand Down Expand Up @@ -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(),
});
Expand Down
2 changes: 0 additions & 2 deletions examples/skybox/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
Expand Down Expand Up @@ -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(),
});
Expand Down
2 changes: 0 additions & 2 deletions examples/water/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
});
Expand Down
3 changes: 2 additions & 1 deletion src/backend/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 729d9e2

Please sign in to comment.