Commit d8479c7a authored by Zachary Cook's avatar Zachary Cook
Browse files

Reduce compile time up to 57%, reduce binary size up to 32%

Move pgxp and MaskEval_TA bools from templates to functions
to greatly reduce the number of generated functions
for the CTEntry commands

Reduced default binary size from 4789 KB to 3192 KB

'time make -j12' on Ryzen 2600 after make clean:

Before:

real	1m13.344s
user	2m23.634s
sys	0m5.178s

After:

real	0m31.265s
user	1m42.773s
sys	0m3.801s
parent a6fa9ddb
Pipeline #20856 passed with stage
in 2 minutes and 5 seconds
......@@ -85,7 +85,7 @@ static FastFIFO<uint32, 0x20> GPU_BlitterFIFO; // 0x10 on an actual PS1 GPU, 0x2
struct CTEntry
{
void (*func[4][8])(PS_GPU* g, const uint32 *cb);
void (*func[4][4])(PS_GPU* g, const uint32 *cb, bool MaskEval_TA);
uint8_t len;
uint8_t fifo_fb_len;
bool ss_cmd;
......@@ -141,24 +141,20 @@ static void SetTPage(PS_GPU *gpu, const uint32_t cmdw)
/* C-style function wrappers so our command table isn't so ginormous(in memory usage). */
template<int numvertices, bool shaded, bool textured,
int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
static void G_Command_DrawPolygon(PS_GPU* g, const uint32 *cb)
int BlendMode, bool TexMult, uint32 TexMode_TA>
static void G_Command_DrawPolygon(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
if (PGXP_enabled())
Command_DrawPolygon<numvertices, shaded, textured,
BlendMode, TexMult, TexMode_TA, MaskEval_TA, true>(g, cb);
else
Command_DrawPolygon<numvertices, shaded, textured,
BlendMode, TexMult, TexMode_TA, MaskEval_TA, false>(g, cb);
BlendMode, TexMult, TexMode_TA>(g, cb, PGXP_enabled(), MaskEval_TA);
}
static void Command_ClearCache(PS_GPU* g, const uint32 *cb)
static void Command_ClearCache(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
InvalidateCache(g);
}
static void Command_IRQ(PS_GPU* g, const uint32 *cb)
static void Command_IRQ(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
g->IRQPending = true;
IRQ_Assert(IRQ_GPU, g->IRQPending);
......@@ -166,7 +162,7 @@ static void Command_IRQ(PS_GPU* g, const uint32 *cb)
// Special RAM write mode(16 pixels at a time),
// does *not* appear to use mask drawing environment settings.
static void Command_FBFill(PS_GPU* gpu, const uint32 *cb)
static void Command_FBFill(PS_GPU* gpu, const uint32 *cb, bool MaskEval_TA)
{
unsigned y;
int32_t r = cb[0] & 0xFF;
......@@ -202,7 +198,7 @@ static void Command_FBFill(PS_GPU* gpu, const uint32 *cb)
rsx_intf_fill_rect(cb[0], destX, destY, width, height);
}
static void Command_FBCopy(PS_GPU* g, const uint32 *cb)
static void Command_FBCopy(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
unsigned y;
int32_t sourceX = (cb[1] >> 0) & 0x3FF;
......@@ -255,7 +251,7 @@ static void Command_FBCopy(PS_GPU* g, const uint32 *cb)
rsx_intf_copy_rect(sourceX, sourceY, destX, destY, width, height, g->MaskEvalAND, g->MaskSetOR);
}
static void Command_FBWrite(PS_GPU* g, const uint32 *cb)
static void Command_FBWrite(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
//assert(InCmd == INCMD_NONE);
......@@ -284,7 +280,7 @@ static void Command_FBWrite(PS_GPU* g, const uint32 *cb)
* raw_height == 0, or raw_height != 0x200 && (raw_height & 0x1FF) == 0
*/
static void Command_FBRead(PS_GPU* g, const uint32 *cb)
static void Command_FBRead(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
//assert(g->InCmd == INCMD_NONE);
......@@ -322,7 +318,7 @@ static void Command_FBRead(PS_GPU* g, const uint32 *cb)
}
}
static void Command_DrawMode(PS_GPU* g, const uint32 *cb)
static void Command_DrawMode(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
const uint32 cmdw = *cb;
......@@ -341,7 +337,7 @@ static void Command_DrawMode(PS_GPU* g, const uint32 *cb)
//printf("*******************DFE: %d -- scanline=%d\n", dfe, scanline);
}
static void Command_TexWindow(PS_GPU* g, const uint32 *cb)
static void Command_TexWindow(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
g->tww = (*cb & 0x1F);
g->twh = ((*cb >> 5) & 0x1F);
......@@ -352,7 +348,7 @@ static void Command_TexWindow(PS_GPU* g, const uint32 *cb)
rsx_intf_set_tex_window(g->tww, g->twh, g->twx, g->twy);
}
static void Command_Clip0(PS_GPU* g, const uint32 *cb)
static void Command_Clip0(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
g->ClipX0 = *cb & 1023;
g->ClipY0 = (*cb >> 10) & 1023;
......@@ -360,7 +356,7 @@ static void Command_Clip0(PS_GPU* g, const uint32 *cb)
g->ClipX1, g->ClipY1);
}
static void Command_Clip1(PS_GPU* g, const uint32 *cb)
static void Command_Clip1(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
g->ClipX1 = *cb & 1023;
g->ClipY1 = (*cb >> 10) & 1023;
......@@ -368,7 +364,7 @@ static void Command_Clip1(PS_GPU* g, const uint32 *cb)
g->ClipX1, g->ClipY1);
}
static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb)
static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
g->OffsX = sign_x_to_s32(11, (*cb & 2047));
g->OffsY = sign_x_to_s32(11, ((*cb >> 11) & 2047));
......@@ -376,7 +372,7 @@ static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb)
//fprintf(stderr, "[GPU] Drawing offset: %d(raw=%d) %d(raw=%d) -- %d\n", OffsX, *cb, OffsY, *cb >> 11, scanline);
}
static void Command_MaskSetting(PS_GPU* g, const uint32 *cb)
static void Command_MaskSetting(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
{
//printf("Mask setting: %08x\n", *cb);
g->MaskSetOR = (*cb & 1) ? 0x8000 : 0x0000;
......@@ -1089,15 +1085,15 @@ static void ProcessFIFO(uint32_t in_count)
}
if ((cc >= 0x80) && (cc <= 0x9F))
Command_FBCopy(&GPU, CB);
Command_FBCopy(&GPU, CB, GPU.MaskEvalAND);
else if ((cc >= 0xA0) && (cc <= 0xBF))
Command_FBWrite(&GPU, CB);
Command_FBWrite(&GPU, CB, GPU.MaskEvalAND);
else if ((cc >= 0xC0) && (cc <= 0xDF))
Command_FBRead(&GPU, CB);
Command_FBRead(&GPU, CB, GPU.MaskEvalAND);
else
{
if (command->func[GPU.abr][GPU.TexMode])
command->func[GPU.abr][GPU.TexMode | (GPU.MaskEvalAND ? 0x4 : 0x0)](&GPU, CB);
command->func[GPU.abr][GPU.TexMode](&GPU, CB, GPU.MaskEvalAND);
}
}
......
......@@ -68,8 +68,8 @@ static INLINE void PlotPixelBlend(uint16_t bg_pix, uint16_t *fore_pix)
}
template<int BlendMode, bool MaskEval_TA, bool textured>
static INLINE void PlotPixel(PS_GPU *gpu, int32_t x, int32_t y, uint16_t fore_pix)
template<int BlendMode, bool textured>
static INLINE void PlotPixel(PS_GPU *gpu, int32_t x, int32_t y, uint16_t fore_pix, bool MaskEval_TA)
{
// More Y precision bits than GPU RAM installed in (non-arcade, at least) Playstation hardware.
y &= (512 << gpu->upscale_shift) - 1;
......@@ -91,8 +91,8 @@ static INLINE void PlotPixel(PS_GPU *gpu, int32_t x, int32_t y, uint16_t fore_pi
}
/// Copy of PlotPixel without internal upscaling, used to draw lines and sprites
template<int BlendMode, bool MaskEval_TA, bool textured>
static INLINE void PlotNativePixel(PS_GPU *gpu, int32_t x, int32_t y, uint16_t fore_pix)
template<int BlendMode, bool textured>
static INLINE void PlotNativePixel(PS_GPU *gpu, int32_t x, int32_t y, uint16_t fore_pix, bool MaskEval_TA)
{
uint16_t output;
y &= 511; // More Y precision bits than GPU RAM installed in (non-arcade, at least) Playstation hardware.
......@@ -251,19 +251,15 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
//#define BM_HELPER(fg) { fg(0), fg(1), fg(2), fg(3) }
#define POLY_HELPER_SUB(bm, cv, tm, mam) \
G_Command_DrawPolygon<3 + ((cv & 0x8) >> 3), ((cv & 0x10) >> 4), ((cv & 0x4) >> 2), ((cv & 0x2) >> 1) ? bm : -1, ((cv & 1) ^ 1) & ((cv & 0x4) >> 2), tm, mam >
#define POLY_HELPER_SUB(bm, cv, tm) \
G_Command_DrawPolygon<3 + ((cv & 0x8) >> 3), ((cv & 0x10) >> 4), ((cv & 0x4) >> 2), ((cv & 0x2) >> 1) ? bm : -1, ((cv & 1) ^ 1) & ((cv & 0x4) >> 2), tm>
#define POLY_HELPER_FG(bm, cv) \
{ \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 0 : 0), 0), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 1 : 0), 0), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 0), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 0), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 0 : 0), 1), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 1 : 0), 1), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 1), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 1), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 0 : 0)), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 1 : 0)), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0)), \
POLY_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0)), \
}
#define POLY_HELPER(cv) \
......@@ -274,18 +270,14 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
false \
}
#define SPR_HELPER_SUB(bm, cv, tm, mam) Command_DrawSprite<(cv >> 3) & 0x3, ((cv & 0x4) >> 2), ((cv & 0x2) >> 1) ? bm : -1, ((cv & 1) ^ 1) & ((cv & 0x4) >> 2), tm, mam>
#define SPR_HELPER_SUB(bm, cv, tm) Command_DrawSprite<(cv >> 3) & 0x3, ((cv & 0x4) >> 2), ((cv & 0x2) >> 1) ? bm : -1, ((cv & 1) ^ 1) & ((cv & 0x4) >> 2), tm>
#define SPR_HELPER_FG(bm, cv) \
{ \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 0 : 0), 0), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 1 : 0), 0), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 0), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 0), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 0 : 0), 1), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 1 : 0), 1), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 1), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0), 1), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 0 : 0)), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 1 : 0)), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0)), \
SPR_HELPER_SUB(bm, cv, ((cv & 0x4) ? 2 : 0)), \
}
......@@ -297,18 +289,14 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
false \
}
#define LINE_HELPER_SUB(bm, cv, mam) Command_DrawLine<((cv & 0x08) >> 3), ((cv & 0x10) >> 4), ((cv & 0x2) >> 1) ? bm : -1, mam>
#define LINE_HELPER_SUB(bm, cv) Command_DrawLine<((cv & 0x08) >> 3), ((cv & 0x10) >> 4), ((cv & 0x2) >> 1) ? bm : -1>
#define LINE_HELPER_FG(bm, cv) \
{ \
LINE_HELPER_SUB(bm, cv, 0), \
LINE_HELPER_SUB(bm, cv, 0), \
LINE_HELPER_SUB(bm, cv, 0), \
LINE_HELPER_SUB(bm, cv, 0), \
LINE_HELPER_SUB(bm, cv, 1), \
LINE_HELPER_SUB(bm, cv, 1), \
LINE_HELPER_SUB(bm, cv, 1), \
LINE_HELPER_SUB(bm, cv, 1) \
LINE_HELPER_SUB(bm, cv), \
LINE_HELPER_SUB(bm, cv), \
LINE_HELPER_SUB(bm, cv), \
LINE_HELPER_SUB(bm, cv), \
}
#define LINE_HELPER(cv) \
......@@ -319,7 +307,7 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
false \
}
#define OTHER_HELPER_FG(bm, arg_ptr) { arg_ptr, arg_ptr, arg_ptr, arg_ptr, arg_ptr, arg_ptr, arg_ptr, arg_ptr }
#define OTHER_HELPER_FG(bm, arg_ptr) { arg_ptr, arg_ptr, arg_ptr, arg_ptr }
#define OTHER_HELPER(arg_cs, arg_fbcs, arg_ss, arg_ptr) { { OTHER_HELPER_FG(0, arg_ptr), OTHER_HELPER_FG(1, arg_ptr), OTHER_HELPER_FG(2, arg_ptr), OTHER_HELPER_FG(3, arg_ptr) }, arg_cs, arg_fbcs, arg_ss }
#define OTHER_HELPER_X2(arg_cs, arg_fbcs, arg_ss, arg_ptr) OTHER_HELPER(arg_cs, arg_fbcs, arg_ss, arg_ptr), OTHER_HELPER(arg_cs, arg_fbcs, arg_ss, arg_ptr)
#define OTHER_HELPER_X4(arg_cs, arg_fbcs, arg_ss, arg_ptr) OTHER_HELPER_X2(arg_cs, arg_fbcs, arg_ss, arg_ptr), OTHER_HELPER_X2(arg_cs, arg_fbcs, arg_ss, arg_ptr)
......@@ -327,5 +315,5 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
#define OTHER_HELPER_X16(arg_cs, arg_fbcs, arg_ss, arg_ptr) OTHER_HELPER_X8(arg_cs, arg_fbcs, arg_ss, arg_ptr), OTHER_HELPER_X8(arg_cs, arg_fbcs, arg_ss, arg_ptr)
#define OTHER_HELPER_X32(arg_cs, arg_fbcs, arg_ss, arg_ptr) OTHER_HELPER_X16(arg_cs, arg_fbcs, arg_ss, arg_ptr), OTHER_HELPER_X16(arg_cs, arg_fbcs, arg_ss, arg_ptr)
#define NULLCMD_FG(bm) { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
#define NULLCMD_FG(bm) { NULL, NULL, NULL, NULL }
#define NULLCMD() { { NULLCMD_FG(0), NULLCMD_FG(1), NULLCMD_FG(2), NULLCMD_FG(3) }, 1, 1, true }
......@@ -101,8 +101,8 @@ static INLINE void AddLineStep(line_fxp_coord *point, const line_fxp_step *step)
}
}
template<bool gouraud, int BlendMode, bool MaskEval_TA>
static void DrawLine(PS_GPU *gpu, line_point *points)
template<bool gouraud, int BlendMode>
static void DrawLine(PS_GPU *gpu, line_point *points, bool MaskEval_TA)
{
line_fxp_coord cur_point;
line_fxp_step step;
......@@ -155,15 +155,15 @@ static void DrawLine(PS_GPU *gpu, line_point *points)
// FIXME: There has to be a faster way than checking for being inside the drawing area for each pixel.
if(x >= gpu->ClipX0 && x <= gpu->ClipX1 && y >= gpu->ClipY0 && y <= gpu->ClipY1)
PlotNativePixel<BlendMode, MaskEval_TA, false>(gpu, x, y, pix);
PlotNativePixel<BlendMode, false>(gpu, x, y, pix, MaskEval_TA);
}
AddLineStep<gouraud>(&cur_point, &step);
}
}
template<bool polyline, bool gouraud, int BlendMode, bool MaskEval_TA>
static void Command_DrawLine(PS_GPU *gpu, const uint32_t *cb)
template<bool polyline, bool gouraud, int BlendMode>
static void Command_DrawLine(PS_GPU *gpu, const uint32_t *cb, bool MaskEval_TA)
{
line_point points[2];
const uint8_t cc = cb[0] >> 24; // For pline handling later.
......@@ -240,5 +240,5 @@ static void Command_DrawLine(PS_GPU *gpu, const uint32_t *cb)
#endif
if (rsx_intf_has_software_renderer())
DrawLine<gouraud, BlendMode, MaskEval_TA>(gpu, points);
DrawLine<gouraud, BlendMode>(gpu, points, MaskEval_TA);
}
......@@ -115,8 +115,8 @@ static INLINE void AddIDeltas_DY(i_group &ig, const i_deltas &idl, uint32_t coun
}
}
template<bool gouraud, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
static INLINE void DrawSpan(PS_GPU *gpu, int y, const int32 x_start, const int32 x_bound, i_group ig, const i_deltas &idl)
template<bool gouraud, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA>
static INLINE void DrawSpan(PS_GPU *gpu, int y, const int32 x_start, const int32 x_bound, i_group ig, const i_deltas &idl, bool MaskEval_TA)
{
if(LineSkipTest(gpu, y >> gpu->upscale_shift))
return;
......@@ -190,7 +190,7 @@ static INLINE void DrawSpan(PS_GPU *gpu, int y, const int32 x_start, const int32
uint8_t *dither_offset = gpu->DitherLUT[dither_y][dither_x];
fbw = ModTexel(dither_offset, fbw, r, g, b);
}
PlotPixel<BlendMode, MaskEval_TA, true>(gpu, x, y, fbw);
PlotPixel<BlendMode, true>(gpu, x, y, fbw, MaskEval_TA);
}
}
else
......@@ -210,7 +210,7 @@ static INLINE void DrawSpan(PS_GPU *gpu, int y, const int32 x_start, const int32
pix |= (b >> 3) << 10;
}
PlotPixel<BlendMode, MaskEval_TA, false>(gpu, x, y, pix);
PlotPixel<BlendMode, false>(gpu, x, y, pix, MaskEval_TA);
}
x++;
......@@ -218,8 +218,8 @@ static INLINE void DrawSpan(PS_GPU *gpu, int y, const int32 x_start, const int32
} while(MDFN_LIKELY(--w > 0));
}
template<bool gouraud, bool textured, int BlendMode, bool TexMult, uint32_t TexMode_TA, bool MaskEval_TA>
static INLINE void DrawTriangle(PS_GPU *gpu, tri_vertex *vertices)
template<bool gouraud, bool textured, int BlendMode, bool TexMult, uint32_t TexMode_TA>
static INLINE void DrawTriangle(PS_GPU *gpu, tri_vertex *vertices, bool MaskEval_TA)
{
i_deltas idl;
unsigned core_vertex;
......@@ -452,7 +452,7 @@ if(vertices[1].y == vertices[0].y)
continue;
}
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl, MaskEval_TA);
}
}
else
......@@ -470,7 +470,7 @@ if(vertices[1].y == vertices[0].y)
goto skipit;
}
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl, MaskEval_TA);
//
//
//
......@@ -501,8 +501,8 @@ bool Hack_ForceLine(PS_GPU *gpu, tri_vertex* vertices, tri_vertex* outVertices);
extern int psx_pgxp_2d_tol;
template<int numvertices, bool gouraud, bool textured, int BlendMode, bool TexMult, uint32_t TexMode_TA, bool MaskEval_TA, bool pgxp>
static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb)
template<int numvertices, bool gouraud, bool textured, int BlendMode, bool TexMult, uint32_t TexMode_TA>
static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb, bool pgxp, bool MaskEval_TA)
{
tri_vertex vertices[3];
const uint32_t* baseCB = cb;
......@@ -884,7 +884,7 @@ static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb)
}
if (rsx_intf_has_software_renderer())
DrawTriangle<gouraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(gpu, vertices);
DrawTriangle<gouraud, textured, BlendMode, TexMult, TexMode_TA>(gpu, vertices, MaskEval_TA);
// Line Render: Overwrite vertices with those of the second triangle
if ((lineFound) && (numvertices == 3) && (textured))
......
template<bool textured, int BlendMode, bool TexMult, uint32_t TexMode_TA,
bool MaskEval_TA, bool FlipX, bool FlipY>
bool FlipX, bool FlipY>
static void DrawSprite(PS_GPU *gpu, int32_t x_arg, int32_t y_arg, int32_t w, int32_t h,
uint8_t u_arg, uint8_t v_arg, uint32_t color, uint32_t clut_offset)
uint8_t u_arg, uint8_t v_arg, uint32_t color, uint32_t clut_offset, bool MaskEval_TA)
{
uint8_t u, v;
const int32_t r = color & 0xFF;
......@@ -100,11 +100,11 @@ static void DrawSprite(PS_GPU *gpu, int32_t x_arg, int32_t y_arg, int32_t w, int
uint8_t *dither_offset = gpu->DitherLUT[2][3];
fbw = ModTexel(dither_offset, fbw, r, g, b);
}
PlotNativePixel<BlendMode, MaskEval_TA, true>(gpu, x, y, fbw);
PlotNativePixel<BlendMode, true>(gpu, x, y, fbw, MaskEval_TA);
}
}
else
PlotNativePixel<BlendMode, MaskEval_TA, false>(gpu, x, y, fill_color);
PlotNativePixel<BlendMode, false>(gpu, x, y, fill_color, MaskEval_TA);
if(textured)
u_r += u_inc;
......@@ -116,8 +116,8 @@ static void DrawSprite(PS_GPU *gpu, int32_t x_arg, int32_t y_arg, int32_t w, int
}
template<uint8_t raw_size, bool textured, int BlendMode,
bool TexMult, uint32_t TexMode_TA, bool MaskEval_TA>
static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
bool TexMult, uint32_t TexMode_TA>
static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb, bool MaskEval_TA)
{
int32_t x, y;
int32_t w, h;
......@@ -230,7 +230,6 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
true);
}
#endif
#if 0
printf("SPRITE: %d %d %d -- %d %d\n", raw_size, x, y, w, h);
#endif
......@@ -242,30 +241,30 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
{
case 0x0000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, false, false>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, false, TexMode_TA, false, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, false, false>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, true, TexMode_TA, false, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
break;
case 0x1000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, true, false>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, false, TexMode_TA, true, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, true, false>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, true, TexMode_TA, true, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
break;
case 0x2000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, false, true>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, false, TexMode_TA, false, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, false, true>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, true, TexMode_TA, false, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
break;
case 0x3000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, true, true>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, false, TexMode_TA, true, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, true, true>(gpu, x, y, w, h, u, v, color, clut);
DrawSprite<textured, BlendMode, true, TexMode_TA, true, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
break;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment