Work around the Mali stencil discard bug the same way as the Adreno one.

This commit is contained in:
Henrik Rydgård 2022-05-09 01:15:56 +02:00
parent 78ad81db9e
commit d0ea3b3284
2 changed files with 9 additions and 0 deletions

View file

@ -823,6 +823,11 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
// corrupt the depth buffer. This is easily worked around by simply scaling Z down a tiny bit when this case
// is detected. See: https://github.com/hrydgard/ppsspp/issues/11937
bugs_.Infest(Bugs::EQUAL_WZ_CORRUPTS_DEPTH);
if (IsHashMaliDriverVersion(deviceProps) || VK_VERSION_MAJOR(deviceProps.driverVersion) <= 16) {
// At least one driver at the upper end of the range is known to be likely to suffer from the bug causing issue #13833 (Midnight Club map broken).
bugs_.Infest(Bugs::MALI_STENCIL_DISCARD_BUG);
}
}
caps_.deviceID = deviceProps.deviceID;

View file

@ -341,6 +341,10 @@ void ComputeFragmentShaderID(FShaderID *id_out, const Draw::Bugs &bugs) {
if (g_Config.bVendorBugChecksEnabled) {
if (bugs.Has(Draw::Bugs::NO_DEPTH_CANNOT_DISCARD_STENCIL)) {
id.SetBit(FS_BIT_NO_DEPTH_CANNOT_DISCARD_STENCIL, !IsStencilTestOutputDisabled() && !gstate.isDepthWriteEnabled());
} else if (bugs.Has(Draw::Bugs::MALI_STENCIL_DISCARD_BUG)) {
// Very similar driver bug to the Adreno one, with the same workaround (though might look into if there are cheaper ones!)
// Keeping the conditions separate since it can probably be made tighter.
id.SetBit(FS_BIT_NO_DEPTH_CANNOT_DISCARD_STENCIL, !IsStencilTestOutputDisabled() && !gstate.isDepthWriteEnabled());
}
}
}