Logic op fix, min filter fix. Also remove some unnecessary indentation. Fixes the water on Adreno (no logic)

This commit is contained in:
Henrik Rydgård 2022-09-16 12:34:27 +02:00
parent ca2962beab
commit 9ec35d1464
2 changed files with 65 additions and 59 deletions

View file

@ -859,8 +859,7 @@ static inline bool blendColorSimilar(uint32_t a, uint32_t b, int margin = 25) {
static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend, BlendEq &blendEq) { static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend, BlendEq &blendEq) {
// Note: our shader solution applies logic ops BEFORE blending, not correctly after. // Note: our shader solution applies logic ops BEFORE blending, not correctly after.
// This is however fine for the most common ones, like CLEAR/NOOP/SET, etc. // This is however fine for the most common ones, like CLEAR/NOOP/SET, etc.
if (!gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP)) { if (!gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP) && gstate.isLogicOpEnabled()) {
if (gstate.isLogicOpEnabled()) {
switch (gstate.getLogicOp()) { switch (gstate.getLogicOp()) {
case GE_LOGIC_CLEAR: case GE_LOGIC_CLEAR:
srcBlend = BlendFactor::ZERO; srcBlend = BlendFactor::ZERO;
@ -917,8 +916,6 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend
return true; return true;
} }
} }
}
return false; return false;
} }
@ -1080,6 +1077,12 @@ static void ConvertBlendState(GenericBlendState &blendState, bool forceReplaceBl
case REPLACE_BLEND_NO: case REPLACE_BLEND_NO:
// We may still want to do something about stencil -> alpha. // We may still want to do something about stencil -> alpha.
ApplyStencilReplaceAndLogicOpIgnoreBlend(replaceAlphaWithStencil, blendState); ApplyStencilReplaceAndLogicOpIgnoreBlend(replaceAlphaWithStencil, blendState);
if (forceReplaceBlend) {
// If this is true, the logic and mask replacements will be applied, at least. In that case,
// we should not apply any logic op simulation.
blendState.simulateLogicOpType = LOGICOPTYPE_NORMAL;
}
return; return;
case REPLACE_BLEND_BLUE_TO_ALPHA: case REPLACE_BLEND_BLUE_TO_ALPHA:

View file

@ -292,11 +292,14 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac
SamplerCacheKey TextureCacheCommon::GetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight) { SamplerCacheKey TextureCacheCommon::GetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight) {
SamplerCacheKey key = GetSamplingParams(0, nullptr); SamplerCacheKey key = GetSamplingParams(0, nullptr);
// Kill any mipmapping settings. // Kill any mipmapping settings, and reset min filtering.
int minFilt = gstate.texfilter & 0x7;
key.minFilt = minFilt & 1;
key.mipEnable = false; key.mipEnable = false;
key.mipFilt = false; key.mipFilt = false;
key.aniso = 0.0; key.aniso = 0.0;
key.maxLevel = 0.0f; key.maxLevel = 0.0f;
key.lodBias = 0.0f;
// Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case. // Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case.
int w = gstate.getTextureWidth(0); int w = gstate.getTextureWidth(0);