From f289e8485d8c066fe338e4f9da315e28814aa2b8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 16 Mar 2016 21:59:37 -0700 Subject: [PATCH] Vulkan: Make sure depth==stencil when clearing. We have to clear both at the same time. I think it makes sense to consider this part of the "separate alpha" flag, since alpha has to match both color and depth. --- GPU/Common/SoftwareTransformCommon.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index 1ba4bfc3de..669e4924d2 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -412,8 +412,10 @@ void SoftwareTransform( // Experiment: Disable on PowerVR (see issue #6290) // TODO: This bleeds outside the play area in non-buffered mode. Big deal? Probably not. if (maxIndex > 1 && gstate.isModeClear() && prim == GE_PRIM_RECTANGLES && IsReallyAClear(transformed, maxIndex) && gl_extensions.gpuVendor != GPU_VENDOR_POWERVR) { // && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE) { - bool separateAlphaClear = gstate.isClearModeColorMask() != gstate.isClearModeAlphaMask(); - if (params->allowSeparateAlphaClear || !separateAlphaClear) { + // If alpha is not allowed to be separate, it must match for both depth/stencil and color. Vulkan requires this. + bool alphaMatchesColor = gstate.isClearModeColorMask() == gstate.isClearModeAlphaMask(); + bool depthMatchesStencil = gstate.isClearModeAlphaMask() == gstate.isClearModeDepthMask(); + if (params->allowSeparateAlphaClear || (alphaMatchesColor && depthMatchesStencil)) { result->color = transformed[1].color0_32; // Need to rescale from a [0, 1] float. This is the final transformed value. result->depth = ToScaledDepth((s16)(int)(transformed[1].z * 65535.0f));