- minor, but very effective optimization for R_DrawSpanMasked: Do not store the texel value in a byte. Store it in a local int variable. This allows the compiler to read it with a zero extending instruction instead of using a byte reading instruction and then later having it to convert to an int anyway. This removes one instruction from the loop which results in a 10% performance increase on 32 bit.

This commit is contained in:
Christoph Oelckers 2016-12-04 19:32:54 +01:00
parent c9caaf08c8
commit f4454d2e00

View file

@ -1037,7 +1037,7 @@ void R_SetupSpanBits(FTexture *tex)
{ {
ds_xbits--; ds_xbits--;
} }
if ((1 << ds_ybits) > tex->GetHeight()) if ((1 << ds_ybits) > tex->GetHeight())
{ {
ds_ybits--; ds_ybits--;
} }
@ -1048,7 +1048,7 @@ void R_SetupSpanBits(FTexture *tex)
// //
// Draws the actual span. // Draws the actual span.
#ifndef X86_ASM //#ifndef X86_ASM
void R_DrawSpanP_C (void) void R_DrawSpanP_C (void)
{ {
dsfixed_t xfrac; dsfixed_t xfrac;
@ -1147,7 +1147,7 @@ void R_DrawSpanMaskedP_C (void)
// 64x64 is the most common case by far, so special case it. // 64x64 is the most common case by far, so special case it.
do do
{ {
BYTE texdata; int texdata;
spot = ((xfrac>>(32-6-6))&(63*64)) + (yfrac>>(32-6)); spot = ((xfrac>>(32-6-6))&(63*64)) + (yfrac>>(32-6));
texdata = source[spot]; texdata = source[spot];
@ -1167,7 +1167,7 @@ void R_DrawSpanMaskedP_C (void)
int xmask = ((1 << ds_xbits) - 1) << ds_ybits; int xmask = ((1 << ds_xbits) - 1) << ds_ybits;
do do
{ {
BYTE texdata; int texdata;
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift); spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
texdata = source[spot]; texdata = source[spot];
@ -1181,7 +1181,7 @@ void R_DrawSpanMaskedP_C (void)
} while (--count); } while (--count);
} }
} }
#endif //#endif
void R_DrawSpanTranslucent (void) void R_DrawSpanTranslucent (void)
{ {