Turn DitherEnabled into macro

This commit is contained in:
twinaphex 2017-04-22 19:59:22 +02:00
parent 037adf7152
commit 3bd2230a29
5 changed files with 18 additions and 20 deletions

View File

@ -29,14 +29,13 @@ class PS_GPU;
#define DISP_RGB24 0x10
#define DISP_INTERLACED 0x20
enum dither_mode {
DITHER_NATIVE,
DITHER_UPSCALED,
DITHER_OFF,
enum dither_mode
{
DITHER_NATIVE = 0,
DITHER_UPSCALED,
DITHER_OFF,
};
extern enum dither_mode psx_gpu_dither_mode;
struct CTEntry
{
void (*func[4][8])(PS_GPU* g, const uint32 *cb);
@ -85,17 +84,11 @@ class PS_GPU
PS_GPU *Rescale(uint8 upscale_shift) MDFN_COLD;
INLINE bool DitherEnabled(void)
{
return psx_gpu_dither_mode != DITHER_OFF && dtd;
}
inline int32 GetScanlineNum(void)
{
return(scanline);
}
INLINE uint32 upscale() const
{
return 1U << upscale_shift;

View File

@ -1,3 +1,5 @@
extern enum dither_mode psx_gpu_dither_mode;
/* Return a pixel from VRAM */
#define vram_fetch(gpu, x, y) (gpu->vram[((y) << (10 + gpu->upscale_shift)) | (x)])
@ -7,6 +9,9 @@
/* Set a pixel in VRAM */
#define vram_put(gpu, x, y, v) gpu->vram[((y) << (10 + gpu->upscale_shift)) | (x)] = (v)
#define DitherEnabled(gpu) (psx_gpu_dither_mode != DITHER_OFF && gpu->dtd)
template<int BlendMode>
static INLINE void PlotPixelBlend(uint16_t bg_pix, uint16_t *fore_pix)
{

View File

@ -142,7 +142,7 @@ static void DrawLine(PS_GPU *gpu, line_point *points)
b = points[0].b;
}
if(gpu->DitherEnabled())
if(DitherEnabled(gpu))
{
uint8_t *dither_offset = gpu->DitherLUT[y & 3][x & 3];
pix = 0x8000 | (dither_offset[r] << 0) | (dither_offset[g] << 5) |
@ -229,7 +229,7 @@ static void Command_DrawLine(PS_GPU *gpu, const uint32_t *cb)
points[1].x, points[1].y,
((uint32_t)points[0].r) | ((uint32_t)points[0].g << 8) | ((uint32_t)points[0].b << 16),
((uint32_t)points[1].r) | ((uint32_t)points[1].g << 8) | ((uint32_t)points[1].b << 16),
gpu->DitherEnabled(),
DitherEnabled(gpu),
BlendMode,
MaskEval_TA,
gpu->MaskSetOR);

View File

@ -193,7 +193,7 @@ static INLINE void DrawSpan(PS_GPU *gpu, int y, uint32_t clut_offset, const int3
b = COORD_GET_INT(ig.b);
}
bool dither = gpu->DitherEnabled();
bool dither = DitherEnabled(gpu);
int32_t dither_x = x >> gpu->dither_upscale_shift;
int32_t dither_y = y >> gpu->dither_upscale_shift;
@ -637,7 +637,7 @@ static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
gpu->DitherEnabled(),
DitherEnabled(gpu),
BlendMode,
MaskEval_TA,
gpu->MaskSetOR != 0);
@ -670,7 +670,7 @@ static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
gpu->DitherEnabled(),
DitherEnabled(gpu),
BlendMode,
MaskEval_TA,
gpu->MaskSetOR != 0);

View File

@ -251,7 +251,7 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
clut_y,
blend_mode,
2 - TexMode_TA,
gpu->DitherEnabled(),
DitherEnabled(gpu),
BlendMode,
MaskEval_TA,
gpu->MaskSetOR != 0);
@ -273,7 +273,7 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
gpu->DitherEnabled(),
DitherEnabled(gpu),
BlendMode,
MaskEval_TA,
gpu->MaskSetOR != 0);
@ -292,7 +292,7 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
gpu->DitherEnabled(),
DitherEnabled(gpu),
BlendMode,
MaskEval_TA,
gpu->MaskSetOR != 0);