Enable usage of R_DrawSpan_8_MMX if drawing a flat with powers-of-two dimensions

This commit is contained in:
Jaime Passos 2019-09-10 17:25:21 -03:00
parent aebff2a430
commit f1cc17ea02
3 changed files with 15 additions and 3 deletions

View file

@ -652,7 +652,13 @@ static void R_DrawSkyPlane(visplane_t *pl)
boolean R_CheckPowersOfTwo(void)
{
return (ds_powersoftwo = ((!((ds_flatwidth & (ds_flatwidth - 1)) || (ds_flatheight & (ds_flatheight - 1)))) && (ds_flatwidth == ds_flatheight)));
if (ds_flatwidth & (ds_flatwidth - 1))
ds_powersoftwo = false;
else if (ds_flatheight & (ds_flatheight - 1))
ds_powersoftwo = false;
else if (ds_flatwidth == ds_flatheight)
ds_powersoftwo = true;
return ds_powersoftwo;
}
void R_CheckFlatLength(size_t size)
@ -974,7 +980,11 @@ void R_DrawSinglePlane(visplane_t *pl)
// Check if the flat has dimensions that are powers-of-two numbers.
if (R_CheckPowersOfTwo())
{
R_CheckFlatLength(ds_flatwidth * ds_flatheight);
if (spanfunc == basespanfunc)
spanfunc = mmxspanfunc;
}
if (light >= LIGHTLEVELS)
light = LIGHTLEVELS-1;

View file

@ -49,6 +49,7 @@ void (*fuzzcolfunc)(void); // standard fuzzy effect column drawer
void (*transcolfunc)(void); // translation column drawer
void (*shadecolfunc)(void); // smokie test..
void (*spanfunc)(void); // span drawer, use a 64x64 tile
void (*mmxspanfunc)(void); // span drawer in MMX assembly
void (*splatfunc)(void); // span drawer w/ transparency
void (*basespanfunc)(void); // default span func for color mode
void (*transtransfunc)(void); // translucent translated column drawer
@ -112,7 +113,7 @@ void SCR_SetMode(void)
//
if (true)//vid.bpp == 1) //Always run in 8bpp. todo: remove all 16bpp code?
{
spanfunc = basespanfunc = R_DrawSpan_8;
spanfunc = basespanfunc = mmxspanfunc = R_DrawSpan_8;
splatfunc = R_DrawSplat_8;
transcolfunc = R_DrawTranslatedColumn_8;
transtransfunc = R_DrawTranslatedTranslucentColumn_8;
@ -133,7 +134,7 @@ void SCR_SetMode(void)
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
walldrawerfunc = R_DrawWallColumn_8_MMX;
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX;
//spanfunc = basespanfunc = R_DrawSpan_8_MMX;
mmxspanfunc = R_DrawSpan_8_MMX;
}
else
{

View file

@ -123,6 +123,7 @@ extern void (*transcolfunc)(void);
extern void (*shadecolfunc)(void);
extern void (*spanfunc)(void);
extern void (*basespanfunc)(void);
extern void (*mmxspanfunc)(void);
extern void (*splatfunc)(void);
extern void (*transtransfunc)(void);
extern void (*twosmultipatchfunc)(void);