hal/vk: use stencil read/write masks

This commit is contained in:
Dzmitry Malyshau committed 2022-01-21 09:16:59 -05:00
1 parent 673b4a760a
commit 55571c8501
2 files changed
+10 -5

No files matched your search

+7 -3
View File
@@ -698,14 +698,18 @@ pub fn map_stencil_op(op: wgt::StencilOperation) -> vk::StencilOp {
}
}
pub fn map_stencil_face(face: &wgt::StencilFaceState) -> vk::StencilOpState {
pub fn map_stencil_face(
face: &wgt::StencilFaceState,
compare_mask: u32,
write_mask: u32,
) -> vk::StencilOpState {
vk::StencilOpState {
fail_op: map_stencil_op(face.fail_op),
pass_op: map_stencil_op(face.pass_op),
depth_fail_op: map_stencil_op(face.depth_fail_op),
compare_op: map_comparison(face.compare),
compare_mask: !0,
write_mask: !0,
compare_mask,
write_mask,
reference: 0,
}
}
+3 -2
View File
@@ -1462,8 +1462,9 @@ impl crate::Device<super::Api> for super::Device {
.depth_compare_op(conv::map_comparison(ds.depth_compare));
}
if ds.stencil.is_enabled() {
let front = conv::map_stencil_face(&ds.stencil.front);
let back = conv::map_stencil_face(&ds.stencil.back);
let s = &ds.stencil;
let front = conv::map_stencil_face(&s.front, s.read_mask, s.write_mask);
let back = conv::map_stencil_face(&s.back, s.read_mask, s.write_mask);
vk_depth_stencil = vk_depth_stencil
.stencil_test_enable(true)
.front(front)