Fix PPU blending with unoptimized change.

This commit is contained in:
Brandon Wright 2019-03-06 19:00:29 -06:00
parent 7dde81a77d
commit db8227fa42
2 changed files with 23 additions and 3 deletions

25
gfx.h
View File

@ -132,16 +132,36 @@ extern struct SGFX GFX;
#define V_FLIP 0x8000
#define BLANK_TILE 2
#include "ppu.h"
#define COLOR_ADD1_2(C1, C2) \
((((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
((C1) & (C2) & RGB_LOW_BITS_MASK)) | ALPHA_BITS_MASK)
#define COLOR_ADD(C1, C2) \
/*#define COLOR_ADD(C1, C2) \
(GFX.X2[((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
((C1) & (C2) & RGB_LOW_BITS_MASK)] | \
(((C1) ^ (C2)) & RGB_LOW_BITS_MASK))
(((C1) ^ (C2)) & RGB_LOW_BITS_MASK)) */
inline uint16 COLOR_ADD(uint16 C1, uint16 C2)
{
int r1, g1, b1, r2, g2, b2;
int cap = mul_brightness[PPU.Brightness][31];
DECOMPOSE_PIXEL(C1, r1, g1, b1);
DECOMPOSE_PIXEL(C2, r2, g2, b2);
r1 += r2;
if (r1 > cap)
r1 = cap;
g1 += g2;
if (g1 > cap)
g1 = cap;
b1 += b2;
if (b1 > cap)
b1 = cap;
return BUILD_PIXEL(r1, g1, b1);
}
#define COLOR_SUB1_2(C1, C2) \
GFX.ZERO[(((C1) | RGB_HI_BITS_MASKx2) - \
@ -168,7 +188,6 @@ inline uint16 COLOR_SUB (uint16 C1, uint16 C2)
void S9xStartScreenRefresh (void);
void S9xEndScreenRefresh (void);
void S9xUpdateScreen (void);
void S9xBuildDirectColourMaps (void);
void RenderLine (uint8);
void S9xComputeClipWindows (void);

1
ppu.h
View File

@ -228,6 +228,7 @@ extern SnesModel M2SNES;
#define MAX_5C78_VERSION 0x03
#define MAX_5A22_VERSION 0x02
void S9xUpdateScreen (void);
static inline void FLUSH_REDRAW (void)
{
if (IPPU.PreviousLine != IPPU.CurrentLine)