VERY experimental Nintendo Switch 2 emulator
C++
Enable depth test on stencil clear path
Kelebek1dd2d450e3fee
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cppindex 1032c9d122..182057575d 100644--- a/src/video_core/renderer_vulkan/blit_image.cpp+++ b/src/video_core/renderer_vulkan/blit_image.cpp@@ -609,6 +609,8 @@ void BlitImageHelper::ClearDepthStencil(const Framebuffer* dst_framebuffer, boolconst VkPipelineLayout layout = *clear_color_pipeline_layout;scheduler.RequestRenderpass(dst_framebuffer);scheduler.Record([pipeline, layout, clear_depth, dst_region](vk::CommandBuffer cmdbuf) {+ constexpr std::array blend_constants{0.0f, 0.0f, 0.0f, 0.0f};+ cmdbuf.SetBlendConstants(blend_constants.data());cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);BindBlitState(cmdbuf, dst_region);cmdbuf.PushConstants(layout, VK_SHADER_STAGE_FRAGMENT_BIT, clear_depth);@@ -865,7 +867,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceClearStencilPipeline(.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,.pNext = nullptr,.flags = 0,- .depthTestEnable = VK_FALSE,+ .depthTestEnable = key.depth_clear,.depthWriteEnable = key.depth_clear,.depthCompareOp = VK_COMPARE_OP_ALWAYS,.depthBoundsTestEnable = VK_FALSE,diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cppindex 01e76a82ca..2fbfc14cc3 100644--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp@@ -429,7 +429,8 @@ void RasterizerVulkan::Clear(u32 layer_count) {return;}- if (use_stencil && regs.stencil_front_mask != 0xFF && regs.stencil_front_mask != 0) {+ if (use_stencil && framebuffer->HasAspectStencilBit() && regs.stencil_front_mask != 0xFF &&+ regs.stencil_front_mask != 0) {Region2D dst_region = {Offset2D{.x = clear_rect.rect.offset.x, .y = clear_rect.rect.offset.y},Offset2D{.x = clear_rect.rect.offset.x + static_cast<s32>(clear_rect.rect.extent.width),