aboutsummaryrefslogtreecommitdiff
path: root/src/GPU3D_Soft.cpp
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-05-26 03:16:23 +0200
committerStapleButter <thetotalworm@gmail.com>2017-05-26 03:16:23 +0200
commit911888f1e09bf05d45393cfb3d830c50153579f9 (patch)
treefe0cc8476c321abce160005e81ed554773b04a2b /src/GPU3D_Soft.cpp
parent8558eff8aa1365bdd89fca002965ded9c80e9de8 (diff)
fix alpha equation when blending is disabled
Diffstat (limited to 'src/GPU3D_Soft.cpp')
-rw-r--r--src/GPU3D_Soft.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index d306a53..d022e8a 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -1025,25 +1025,29 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y)
u32 dstcolor = ColorBuffer[pixeladdr];
u32 dstalpha = dstcolor >> 24;
- if ((dstalpha > 0) && (RenderDispCnt & (1<<3)))
+ if (dstalpha > 0)
{
u32 srcR = color & 0x3F;
u32 srcG = (color >> 8) & 0x3F;
u32 srcB = (color >> 16) & 0x3F;
- u32 dstR = dstcolor & 0x3F;
- u32 dstG = (dstcolor >> 8) & 0x3F;
- u32 dstB = (dstcolor >> 16) & 0x3F;
-
- alpha++;
- dstR = ((srcR * alpha) + (dstR * (32-alpha))) >> 5;
- dstG = ((srcG * alpha) + (dstG * (32-alpha))) >> 5;
- dstB = ((srcB * alpha) + (dstB * (32-alpha))) >> 5;
+ if (RenderDispCnt & (1<<3))
+ {
+ u32 dstR = dstcolor & 0x3F;
+ u32 dstG = (dstcolor >> 8) & 0x3F;
+ u32 dstB = (dstcolor >> 16) & 0x3F;
+
+ alpha++;
+ srcR = ((srcR * alpha) + (dstR * (32-alpha))) >> 5;
+ srcG = ((srcG * alpha) + (dstG * (32-alpha))) >> 5;
+ srcB = ((srcB * alpha) + (dstB * (32-alpha))) >> 5;
+ alpha--;
+ }
- alpha--;
- if (alpha > dstalpha) dstalpha = alpha;
+ if (alpha > dstalpha)
+ dstalpha = alpha;
- color = dstR | (dstG << 8) | (dstB << 16) | (dstalpha << 24);
+ color = srcR | (srcG << 8) | (srcB << 16) | (dstalpha << 24);
}
if (polygon->Attr & (1<<11))