1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Disable dual blending in Texrect Drawer Mode.

This commit is contained in:
Sergey Lipskiy 2020-06-13 14:53:54 +07:00
parent c48841cfeb
commit ed1648c438
3 changed files with 26 additions and 21 deletions

View File

@ -585,7 +585,7 @@ public:
" srcColor1 = muxp; \n"
" dstFactor1 = muxaf; \n"
" } \n"
;
;
if (_glinfo.dual_source_blending) {
m_part +=
" fragColor = srcColor1; \n"
@ -648,7 +648,7 @@ public:
" fragColor = vec4(srcColor2.rgb, clampedColor.a); \n"
;
}
#else
// Keep old code for reference
m_part =
@ -672,13 +672,15 @@ public:
{
if (_glinfo.dual_source_blending)
m_part +=
"lowp float cvg = clampedColor.a; \n"
"lowp vec4 srcAlpha = vec4(cvg, cvg, 1.0, 0.0); \n"
"lowp vec4 dstFactorAlpha = vec4(1.0, 1.0, 0.0, 1.0); \n"
"if (uForceBlendAlpha == 0) \n"
" dstFactorAlpha[0] = 0.0; \n"
"fragColor.a = srcAlpha[uCvgDest]; \n"
"fragColor1.a = dstFactorAlpha[uCvgDest]; \n"
"if (uBlendAlphaMode != 2) { \n"
" lowp float cvg = clampedColor.a; \n"
" lowp vec4 srcAlpha = vec4(cvg, cvg, 1.0, 0.0); \n"
" lowp vec4 dstFactorAlpha = vec4(1.0, 1.0, 0.0, 1.0); \n"
" if (uBlendAlphaMode == 0) \n"
" dstFactorAlpha[0] = 0.0; \n"
" fragColor.a = srcAlpha[uCvgDest]; \n"
" fragColor1.a = dstFactorAlpha[uCvgDest]; \n"
"} else fragColor.a = clampedColor.a; \n"
;
}
};
@ -933,7 +935,7 @@ public:
"highp vec2 tcData0[5]; \n"
"highp vec2 tcData1[5]; \n"
"uniform lowp int uCvgDest; \n"
"uniform lowp int uForceBlendAlpha; \n"
"uniform lowp int uBlendAlphaMode; \n"
;
if (config.generalEmulation.enableLegacyBlending != 0) {
@ -1034,7 +1036,7 @@ public:
"uniform mediump vec2 uScreenScale; \n"
"uniform lowp int uScreenSpaceTriangle; \n"
"uniform lowp int uCvgDest; \n"
"uniform lowp int uForceBlendAlpha; \n"
"uniform lowp int uBlendAlphaMode; \n"
;
@ -1094,7 +1096,7 @@ public:
"layout(location = 1) inout highp vec4 depthZ; \n"
"layout(location = 2) inout highp vec4 depthDeltaZ; \n"
;
}
}
}
};
@ -1320,7 +1322,7 @@ public:
" lowp vec4 c0 = c00 + tcData[4].s * (c10-c00); \\\n"
" lowp vec4 c1 = c01 + tcData[4].s * (c11-c01); \\\n"
" name = c0 + tcData[4].t * (c1-c0); \\\n"
" if(uEnableAlphaTest == 1) name.rgb /= name.a; \\\n"
" if(uEnableAlphaTest == 1) name.rgb /= name.a; \\\n"
"} \n"
;
break;

View File

@ -369,7 +369,7 @@ public:
const int forceBlend2 = gDP.otherMode.forceBlender;
uForceBlendCycle2.set(forceBlend2, _force);
if (!graphics::Context::DualSourceBlending) {
if (!graphics::Context::DualSourceBlending || dwnd().getDrawer().isTexrectDrawerMode()) {
// Modes, which shader blender can't emulate
const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16);
switch (mode) {
@ -410,17 +410,20 @@ class UBlendCvg : public UniformGroup
public:
UBlendCvg(GLuint _program) {
LocateUniform(uCvgDest);
LocateUniform(uForceBlendAlpha);
LocateUniform(uBlendAlphaMode);
}
void update(bool _force) override
void update(bool _force) override
{
uCvgDest.set(gDP.otherMode.cvgDest, _force);
uForceBlendAlpha.set(gDP.otherMode.forceBlender, _force);
if (dwnd().getDrawer().isTexrectDrawerMode())
uBlendAlphaMode.set(2, _force); // No alpha blend in texrect drawing mode
else
uBlendAlphaMode.set(gDP.otherMode.forceBlender, _force);
}
private:
iUniform uCvgDest;
iUniform uForceBlendAlpha;
iUniform uBlendAlphaMode;
};
class UDitherMode : public UniformGroup
@ -1000,7 +1003,7 @@ public:
CachedTexture * pTexture = cache.current[tile];
if (pTile == nullptr || pTexture == nullptr)
continue;
aTexSize[t][0] = pTexture->width * pTexture->hdRatioS;
aTexSize[t][1] = pTexture->height * pTexture->hdRatioT;
@ -1045,7 +1048,7 @@ public:
uTexMirrorEn1.set(aTexMirrorEn[1][0], aTexMirrorEn[1][1], _force);
uTexSize0.set(aTexSize[0][0], aTexSize[0][1], _force);
uTexSize1.set(aTexSize[1][0], aTexSize[1][1], _force);
}
private:

View File

@ -670,7 +670,7 @@ void GraphicsDrawer::setBlendMode(bool _forceLegacyBlending) const
return;
}
if (Context::DualSourceBlending) {
if (Context::DualSourceBlending && !isTexrectDrawerMode()) {
_dualSourceBlending();
return;
}