in a stroke of genius (total luck) I have gotten a stencil buffer which culls pixels

master
mitchellhansen 5 years ago
parent 54fff9a4e9
commit 5462566396

@ -486,7 +486,7 @@ impl CanvasState {
// Specify the color to clear the framebuffer with i.e. blue // Specify the color to clear the framebuffer with i.e. blue
let clear_values = vec!( let clear_values = vec!(
ClearValue::Float([0.0, 0.0, 1.0, 1.0]), ClearValue::Float([0.0, 0.0, 1.0, 1.0]),
ClearValue::DepthStencil((1.0, 1)), ClearValue::DepthStencil((1.0, 0)),
); );
let mut command_buffer = command_buffer.begin_render_pass( let mut command_buffer = command_buffer.begin_render_pass(

@ -118,13 +118,13 @@ impl CanvasShader {
depth_write: true, depth_write: true,
depth_bounds_test: DepthBounds::Disabled, depth_bounds_test: DepthBounds::Disabled,
stencil_front: Stencil { stencil_front: Stencil {
compare: Compare::Always, compare: Compare::Equal,
pass_op: StencilOp::Invert, pass_op: StencilOp::Invert,
fail_op: StencilOp::Invert, fail_op: StencilOp::Invert,
depth_fail_op: StencilOp::Invert, depth_fail_op: StencilOp::Keep,
compare_mask: Some(u32::max_value()), compare_mask: Some(0x01),
write_mask: Some(u32::max_value()), write_mask: Some(0xFF),
reference: Some(u32::max_value()), reference: Some(0x01),
}, },
stencil_back: Default::default() stencil_back: Default::default()
}; };

Loading…
Cancel
Save