mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Fix regression with blending in A Bug's Life, #1488
Hack alert: The problem blender is used in two cycles mode, but both cycles are the same: c_in*a_in + c_mem * 1ma I have no access to c_mem from shader. Therefore, I use c_in instead of c_mem in the first cycle. Result of the second cycle will be blended with c_mem by GL blender, as usual. This is pretty good approximation, no problems noticed.
This commit is contained in:
parent
aa2a12b32d
commit
3b9f16e8dd
|
@ -10,6 +10,8 @@
|
|||
|
||||
using namespace glsl;
|
||||
|
||||
u32 g_cycleType = G_CYC_1CYCLE;
|
||||
|
||||
/*---------------_compileCombiner-------------*/
|
||||
|
||||
static
|
||||
|
@ -468,6 +470,13 @@ public:
|
|||
m_part =
|
||||
" if (uForceBlendCycle1 != 0) { \n"
|
||||
" muxPM[0] = clampedColor; \n"
|
||||
;
|
||||
if (g_cycleType == G_CYC_2CYCLE) {
|
||||
m_part +=
|
||||
" muxPM[1] = clampedColor; \n"
|
||||
;
|
||||
}
|
||||
m_part +=
|
||||
" muxA[0] = clampedColor.a; \n"
|
||||
" lowp float muxa; \n"
|
||||
" if (uBlendMux1[1] == 0) \n"
|
||||
|
@ -514,6 +523,13 @@ public:
|
|||
m_part =
|
||||
" if (uForceBlendCycle1 != 0) { \n"
|
||||
" muxPM[0] = clampedColor; \n"
|
||||
;
|
||||
if (g_cycleType == G_CYC_2CYCLE) {
|
||||
m_part +=
|
||||
" muxPM[1] = clampedColor; \n"
|
||||
;
|
||||
}
|
||||
m_part +=
|
||||
" muxA[0] = clampedColor.a; \n"
|
||||
" muxB[0] = 1.0 - muxA[uBlendMux1[1]]; \n"
|
||||
" lowp vec4 blend1 = (muxPM[uBlendMux1[0]] * muxA[uBlendMux1[1]]) + (muxPM[uBlendMux1[2]] * muxB[uBlendMux1[3]]); \n"
|
||||
|
@ -534,6 +550,7 @@ public:
|
|||
m_part =
|
||||
" if (uForceBlendCycle2 != 0) { \n"
|
||||
" muxPM[0] = clampedColor; \n"
|
||||
" muxPM[1] = vec4(0.0); \n"
|
||||
" muxA[0] = clampedColor.a; \n"
|
||||
" lowp float muxa; \n"
|
||||
" if (uBlendMux2[1] == 0) \n"
|
||||
|
@ -581,6 +598,7 @@ public:
|
|||
m_part =
|
||||
" if (uForceBlendCycle2 != 0) { \n"
|
||||
" muxPM[0] = clampedColor; \n"
|
||||
" muxPM[1] = vec4(0.0); \n"
|
||||
" muxA[0] = clampedColor.a; \n"
|
||||
" muxB[0] = 1.0 - muxA[uBlendMux2[1]]; \n"
|
||||
" lowp vec4 blend2 = muxPM[uBlendMux2[0]] * muxA[uBlendMux2[1]] + muxPM[uBlendMux2[2]] * muxB[uBlendMux2[3]]; \n"
|
||||
|
@ -1685,8 +1703,6 @@ public:
|
|||
|
||||
/*---------------ShaderPartsEnd-------------*/
|
||||
|
||||
u32 g_cycleType = G_CYC_1CYCLE;
|
||||
|
||||
static
|
||||
bool needClampColor() {
|
||||
return g_cycleType <= G_CYC_2CYCLE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user