Fix bug in the new color writemask code, failing to limit it to Outrun properly. Fixes #13650.

This commit is contained in:
Henrik Rydgård 2020-11-10 22:07:20 +01:00
parent d99cba7308
commit c61f9bfd09
2 changed files with 5 additions and 2 deletions

View File

@ -958,6 +958,7 @@ void ApplyStencilReplaceAndLogicOpIgnoreBlend(ReplaceAlphaType replaceAlphaWithS
bool IsColorWriteMaskComplex(bool allowFramebufferRead) { bool IsColorWriteMaskComplex(bool allowFramebufferRead) {
// Restrict to Outrun temporarily (by uglily reusing the ReinterpretFramebuffers flag) // Restrict to Outrun temporarily (by uglily reusing the ReinterpretFramebuffers flag)
// This check must match the one in ConvertMaskState.
if (!allowFramebufferRead || !PSP_CoreParameter().compat.flags().ReinterpretFramebuffers) { if (!allowFramebufferRead || !PSP_CoreParameter().compat.flags().ReinterpretFramebuffers) {
// Don't have a choice - we'll make do but it won't always be right. // Don't have a choice - we'll make do but it won't always be right.
return false; return false;
@ -998,7 +999,9 @@ void ConvertMaskState(GenericMaskState &maskState, bool allowFramebufferRead) {
break; break;
default: default:
if (allowFramebufferRead) { if (allowFramebufferRead) {
maskState.applyFramebufferRead = true; // Instead of just 'true', restrict shader bitmasks to Outrun temporarily (by uglily reusing the ReinterpretFramebuffers flag)
// TODO: This check must match the one in IsColorWriteMaskComplex.
maskState.applyFramebufferRead = PSP_CoreParameter().compat.flags().ReinterpretFramebuffers;
maskState.rgba[i] = true; maskState.rgba[i] = true;
} else { } else {
// Use the old heuristic. // Use the old heuristic.

View File

@ -162,7 +162,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
GenericMaskState maskState; GenericMaskState maskState;
ConvertMaskState(maskState, gstate_c.allowFramebufferRead); ConvertMaskState(maskState, gstate_c.allowFramebufferRead);
if (blendState.applyFramebufferRead) { if (blendState.applyFramebufferRead || maskState.applyFramebufferRead) {
if (ApplyFramebufferRead(&fboTexNeedsBind_)) { if (ApplyFramebufferRead(&fboTexNeedsBind_)) {
// The shader takes over the responsibility for blending, so recompute. // The shader takes over the responsibility for blending, so recompute.
ApplyStencilReplaceAndLogicOpIgnoreBlend(blendState.replaceAlphaWithStencil, blendState); ApplyStencilReplaceAndLogicOpIgnoreBlend(blendState.replaceAlphaWithStencil, blendState);