Commit 9981f11a authored by Zachary Cook's avatar Zachary Cook
Browse files

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

This reverts commit d8479c7a.
parent aa1806e1
Pipeline #47971 passed with stage
in 11 minutes and 7 seconds
......@@ -85,7 +85,7 @@ static FastFIFO<uint32, 0x20> GPU_BlitterFIFO; // 0x10 on an actual PS1 GPU, 0x2
struct CTEntry
{
void (*func[4][4])(PS_GPU* g, const uint32 *cb, bool MaskEval_TA);
void (*func[4][8])(PS_GPU* g, const uint32 *cb);
uint8_t len;
uint8_t fifo_fb_len;
bool ss_cmd;
......@@ -141,20 +141,24 @@ 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>
static void G_Command_DrawPolygon(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
static void G_Command_DrawPolygon(PS_GPU* g, const uint32 *cb)
{
Command_DrawPolygon<numvertices, shaded, textured,
BlendMode, TexMult, TexMode_TA>(g, cb, PGXP_enabled(), 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);
}
static void Command_ClearCache(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_ClearCache(PS_GPU* g, const uint32 *cb)
{
InvalidateCache(g);
}
static void Command_IRQ(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_IRQ(PS_GPU* g, const uint32 *cb)
{
g->IRQPending = true;
IRQ_Assert(IRQ_GPU, g->IRQPending);
......@@ -162,7 +166,7 @@ static void Command_IRQ(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
// 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, bool MaskEval_TA)
static void Command_FBFill(PS_GPU* gpu, const uint32 *cb)
{
unsigned y;
int32_t r = cb[0] & 0xFF;
......@@ -198,7 +202,7 @@ static void Command_FBFill(PS_GPU* gpu, const uint32 *cb, bool MaskEval_TA)
rsx_intf_fill_rect(cb[0], destX, destY, width, height);
}
static void Command_FBCopy(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_FBCopy(PS_GPU* g, const uint32 *cb)
{
unsigned y;
int32_t sourceX = (cb[1] >> 0) & 0x3FF;
......@@ -251,7 +255,7 @@ static void Command_FBCopy(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
rsx_intf_copy_rect(sourceX, sourceY, destX, destY, width, height, g->MaskEvalAND, g->MaskSetOR);
}
static void Command_FBWrite(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_FBWrite(PS_GPU* g, const uint32 *cb)
{
//assert(InCmd == INCMD_NONE);
......@@ -280,7 +284,7 @@ static void Command_FBWrite(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
* raw_height == 0, or raw_height != 0x200 && (raw_height & 0x1FF) == 0
*/
static void Command_FBRead(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_FBRead(PS_GPU* g, const uint32 *cb)
{
//assert(g->InCmd == INCMD_NONE);
......@@ -318,7 +322,7 @@ static void Command_FBRead(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
}
}
static void Command_DrawMode(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_DrawMode(PS_GPU* g, const uint32 *cb)
{
const uint32 cmdw = *cb;
......@@ -337,7 +341,7 @@ static void Command_DrawMode(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
//printf("*******************DFE: %d -- scanline=%d\n", dfe, scanline);
}
static void Command_TexWindow(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_TexWindow(PS_GPU* g, const uint32 *cb)
{
g->tww = (*cb & 0x1F);
g->twh = ((*cb >> 5) & 0x1F);
......@@ -348,7 +352,7 @@ static void Command_TexWindow(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
rsx_intf_set_tex_window(g->tww, g->twh, g->twx, g->twy);
}
static void Command_Clip0(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_Clip0(PS_GPU* g, const uint32 *cb)
{
g->ClipX0 = *cb & 1023;
g->ClipY0 = (*cb >> 10) & 1023;
......@@ -356,7 +360,7 @@ static void Command_Clip0(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
g->ClipX1, g->ClipY1);
}
static void Command_Clip1(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_Clip1(PS_GPU* g, const uint32 *cb)
{
g->ClipX1 = *cb & 1023;
g->ClipY1 = (*cb >> 10) & 1023;
......@@ -364,7 +368,7 @@ static void Command_Clip1(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
g->ClipX1, g->ClipY1);
}
static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb)
{
g->OffsX = sign_x_to_s32(11, (*cb & 2047));
g->OffsY = sign_x_to_s32(11, ((*cb >> 11) & 2047));
......@@ -372,7 +376,7 @@ static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb, bool MaskEval_TA)
//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, bool MaskEval_TA)
static void Command_MaskSetting(PS_GPU* g, const uint32 *cb)
{
//printf("Mask setting: %08x\n", *cb);
g->MaskSetOR = (*cb & 1) ? 0x8000 : 0x0000;
......@@ -1085,15 +1089,15 @@ static void ProcessFIFO(uint32_t in_count)
}
if ((cc >= 0x80) && (cc <= 0x9F))
Command_FBCopy(&GPU, CB, GPU.MaskEvalAND);
Command_FBCopy(&GPU, CB);
else if ((cc >= 0xA0) && (cc <= 0xBF))
Command_FBWrite(&GPU, CB, GPU.MaskEvalAND);
Command_FBWrite(&GPU, CB);
else if ((cc >= 0xC0) && (cc <= 0xDF))
Command_FBRead(&GPU, CB, GPU.MaskEvalAND);
Command_FBRead(&GPU, CB);
else
{
if (command->func[GPU.abr][GPU.TexMode])
command->func[GPU.abr][GPU.TexMode](&GPU, CB, GPU.MaskEvalAND);
command->func[GPU.abr][GPU.TexMode | (GPU.MaskEvalAND ? 0x4 : 0x0)](&GPU, CB);
}
}
......
......@@ -68,8 +68,8 @@ static INLINE void PlotPixelBlend(uint16_t bg_pix, 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)
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)
{
// 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 textured>
static INLINE void PlotNativePixel(PS_GPU *gpu, int32_t x, int32_t y, uint16_t fore_pix, bool MaskEval_TA)
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)
{
uint16_t output;
y &= 511; // More Y precision bits than GPU RAM installed in (non-arcade, at least) Playstation hardware.
......@@ -251,15 +251,19 @@ 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) \
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)), \
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_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_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), \
}
#define POLY_HELPER(cv) \
......@@ -270,14 +274,18 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
false \
}
#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)), \
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)), \
#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_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), \
}
......@@ -289,14 +297,18 @@ static INLINE bool LineSkipTest(PS_GPU* g, unsigned y)
false \
}
#define LINE_HELPER_SUB(bm, cv) Command_DrawLine<((cv & 0x08) >> 3), ((cv & 0x10) >> 4), ((cv & 0x2) >> 1) ? bm : -1>
#define LINE_HELPER_SUB(bm, cv, mam) Command_DrawLine<((cv & 0x08) >> 3), ((cv & 0x10) >> 4), ((cv & 0x2) >> 1) ? bm : -1, mam>
#define LINE_HELPER_FG(bm, cv) \
{ \
LINE_HELPER_SUB(bm, cv), \
LINE_HELPER_SUB(bm, cv), \
LINE_HELPER_SUB(bm, cv), \
LINE_HELPER_SUB(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) \
}
#define LINE_HELPER(cv) \
......@@ -307,7 +319,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 }
#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(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)
......@@ -315,5 +327,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 }
#define NULLCMD_FG(bm) { NULL, NULL, NULL, NULL, 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>
static void DrawLine(PS_GPU *gpu, line_point *points, bool MaskEval_TA)
template<bool gouraud, int BlendMode, bool MaskEval_TA>
static void DrawLine(PS_GPU *gpu, line_point *points)
{
line_fxp_coord cur_point;
line_fxp_step step;
......@@ -155,15 +155,15 @@ static void DrawLine(PS_GPU *gpu, line_point *points, bool MaskEval_TA)
// 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, false>(gpu, x, y, pix, MaskEval_TA);
PlotNativePixel<BlendMode, MaskEval_TA, false>(gpu, x, y, pix);
}
AddLineStep<gouraud>(&cur_point, &step);
}
}
template<bool polyline, bool gouraud, int BlendMode>
static void Command_DrawLine(PS_GPU *gpu, const uint32_t *cb, bool MaskEval_TA)
template<bool polyline, bool gouraud, int BlendMode, bool MaskEval_TA>
static void Command_DrawLine(PS_GPU *gpu, const uint32_t *cb)
{
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, bool MaskEval_TA)
#endif
if (rsx_intf_has_software_renderer())
DrawLine<gouraud, BlendMode>(gpu, points, MaskEval_TA);
DrawLine<gouraud, BlendMode, MaskEval_TA>(gpu, points);
}
......@@ -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>
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)
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)
{
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, true>(gpu, x, y, fbw, MaskEval_TA);
PlotPixel<BlendMode, MaskEval_TA, true>(gpu, x, y, fbw);
}
}
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, false>(gpu, x, y, pix, MaskEval_TA);
PlotPixel<BlendMode, MaskEval_TA, false>(gpu, x, y, pix);
}
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>
static INLINE void DrawTriangle(PS_GPU *gpu, tri_vertex *vertices, bool MaskEval_TA)
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)
{
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>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl, MaskEval_TA);
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
}
}
else
......@@ -470,7 +470,7 @@ if(vertices[1].y == vertices[0].y)
goto skipit;
}
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl, MaskEval_TA);
DrawSpan<gouraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(gpu, yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
//
//
//
......@@ -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>
static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb, bool pgxp, bool MaskEval_TA)
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)
{
tri_vertex vertices[3];
const uint32_t* baseCB = cb;
......@@ -884,7 +884,7 @@ static void Command_DrawPolygon(PS_GPU *gpu, const uint32_t *cb, bool pgxp, bool
}
if (rsx_intf_has_software_renderer())
DrawTriangle<gouraud, textured, BlendMode, TexMult, TexMode_TA>(gpu, vertices, MaskEval_TA);
DrawTriangle<gouraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(gpu, vertices);
// 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 FlipX, bool FlipY>
bool MaskEval_TA, 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, bool MaskEval_TA)
uint8_t u_arg, uint8_t v_arg, uint32_t color, uint32_t clut_offset)
{
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, true>(gpu, x, y, fbw, MaskEval_TA);
PlotNativePixel<BlendMode, MaskEval_TA, true>(gpu, x, y, fbw);
}
}
else
PlotNativePixel<BlendMode, false>(gpu, x, y, fill_color, MaskEval_TA);
PlotNativePixel<BlendMode, MaskEval_TA, false>(gpu, x, y, fill_color);
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>
static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb, bool MaskEval_TA)
bool TexMult, uint32_t TexMode_TA, bool MaskEval_TA>
static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb)
{
int32_t x, y;
int32_t w, h;
......@@ -230,6 +230,7 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb, bool MaskEval_TA
true);
}
#endif
#if 0
printf("SPRITE: %d %d %d -- %d %d\n", raw_size, x, y, w, h);
#endif
......@@ -241,30 +242,30 @@ static void Command_DrawSprite(PS_GPU *gpu, const uint32_t *cb, bool MaskEval_TA
{
case 0x0000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, false, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, false, false>(gpu, x, y, w, h, u, v, color, clut);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, false, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, false, false>(gpu, x, y, w, h, u, v, color, clut);
break;
case 0x1000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, true, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, true, false>(gpu, x, y, w, h, u, v, color, clut);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, true, false>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, true, false>(gpu, x, y, w, h, u, v, color, clut);
break;
case 0x2000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, false, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, false, true>(gpu, x, y, w, h, u, v, color, clut);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, false, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, false, true>(gpu, x, y, w, h, u, v, color, clut);
break;
case 0x3000:
if(!TexMult || color == 0x808080)
DrawSprite<textured, BlendMode, false, TexMode_TA, true, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, false, TexMode_TA, MaskEval_TA, true, true>(gpu, x, y, w, h, u, v, color, clut);
else
DrawSprite<textured, BlendMode, true, TexMode_TA, true, true>(gpu, x, y, w, h, u, v, color, clut, MaskEval_TA);
DrawSprite<textured, BlendMode, true, TexMode_TA, MaskEval_TA, true, true>(gpu, x, y, w, h, u, v, color, clut);
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