rsx/gl/vk: Invert default stencil values

- Fixes stencil volume shadows in a few games. This is part of the surface invalidation workarounds
This commit is contained in:
kd-11 2017-06-14 21:51:53 +03:00
parent 30f276a49b
commit 86adc42739
3 changed files with 8 additions and 4 deletions

View File

@ -236,7 +236,8 @@ void GLGSRender::begin()
__glcheck glStencilOp(stencil_op(rsx::method_registers.stencil_op_fail()), stencil_op(rsx::method_registers.stencil_op_zfail()),
stencil_op(rsx::method_registers.stencil_op_zpass()));
if (rsx::method_registers.two_sided_stencil_test_enabled()) {
if (rsx::method_registers.two_sided_stencil_test_enabled())
{
__glcheck glStencilMaskSeparate(GL_BACK, rsx::method_registers.back_stencil_mask());
__glcheck glStencilFuncSeparate(GL_BACK, comparison_op(rsx::method_registers.back_stencil_func()),
rsx::method_registers.back_stencil_func_ref(), rsx::method_registers.back_stencil_func_mask());
@ -353,7 +354,7 @@ void GLGSRender::end()
glDepthMask(GL_TRUE);
glClearDepth(1.0);
glClearStencil(0);
glClearStencil(255);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

View File

@ -1434,6 +1434,9 @@ bool VKGSRender::load_program()
if (rsx::method_registers.two_sided_stencil_test_enabled())
{
properties.ds.back.writeMask = rsx::method_registers.back_stencil_mask();
properties.ds.back.compareMask = rsx::method_registers.back_stencil_func_mask();
properties.ds.back.reference = rsx::method_registers.back_stencil_func_ref();
properties.ds.back.failOp = vk::get_stencil_op(rsx::method_registers.back_stencil_op_fail());
properties.ds.back.passOp = vk::get_stencil_op(rsx::method_registers.back_stencil_op_zpass());
properties.ds.back.depthFailOp = vk::get_stencil_op(rsx::method_registers.back_stencil_op_zfail());

View File

@ -103,7 +103,7 @@ namespace rsx
VkClearDepthStencilValue clear_depth = {};
clear_depth.depth = 1.f;
clear_depth.stencil = 0;
clear_depth.stencil = 255;
vkCmdClearDepthStencilImage(*cmd, ds->value, VK_IMAGE_LAYOUT_GENERAL, &clear_depth, 1, &range);
change_image_layout(*cmd, ds.get(), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, range);
@ -152,7 +152,7 @@ namespace rsx
//Clear the surface before drawing on it
VkClearDepthStencilValue clear_depth = {};
clear_depth.depth = 1.f;
clear_depth.stencil = 0;
clear_depth.stencil = 255;
vkCmdClearDepthStencilImage(*pcmd, ds->value, VK_IMAGE_LAYOUT_GENERAL, &clear_depth, 1, &range);
change_image_layout(*pcmd, ds, old_layout, range);