mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 12:50:44 +00:00
R_DrawVisSprite adjustments
* Backport the fix to an interp-based crash caused by using a combination of interpolated and uninterpolated scale in renderer calculations. * Between this and the last commit, I attempted a refactor of this and associated functions in order to find the cause of the above crash. Committed are the changes which resulted in increased performance.
This commit is contained in:
parent
a93f7ff7db
commit
9e3b89c54f
2 changed files with 12 additions and 29 deletions
|
@ -697,19 +697,6 @@ void R_DrawMaskedColumn(column_t *column)
|
||||||
// quick fix... something more proper should be done!!!
|
// quick fix... something more proper should be done!!!
|
||||||
if (ylookup[dc_yl])
|
if (ylookup[dc_yl])
|
||||||
colfunc();
|
colfunc();
|
||||||
else if (colfunc == R_DrawColumn_8
|
|
||||||
#ifdef USEASM
|
|
||||||
|| colfunc == R_DrawColumn_8_ASM || colfunc == R_DrawColumn_8_MMX
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
static INT32 first = 1;
|
|
||||||
if (first)
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_RENDER, "WARNING: avoiding a crash in %s %d\n", __FILE__, __LINE__);
|
|
||||||
first = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
column = (column_t *)((UINT8 *)column + column->length + 4);
|
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||||
}
|
}
|
||||||
|
@ -768,19 +755,6 @@ static void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight)
|
||||||
// Still drawn by R_DrawColumn.
|
// Still drawn by R_DrawColumn.
|
||||||
if (ylookup[dc_yl])
|
if (ylookup[dc_yl])
|
||||||
colfunc();
|
colfunc();
|
||||||
else if (colfunc == R_DrawColumn_8
|
|
||||||
#ifdef USEASM
|
|
||||||
|| colfunc == R_DrawColumn_8_ASM || colfunc == R_DrawColumn_8_MMX
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
static INT32 first = 1;
|
|
||||||
if (first)
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_RENDER, "WARNING: avoiding a crash in %s %d\n", __FILE__, __LINE__);
|
|
||||||
first = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Z_Free(dc_source);
|
Z_Free(dc_source);
|
||||||
}
|
}
|
||||||
column = (column_t *)((UINT8 *)column + column->length + 4);
|
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||||
|
@ -801,7 +775,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
#endif
|
#endif
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
patch_t *patch = W_CacheLumpNum(vis->patch, PU_CACHE);
|
patch_t *patch = W_CacheLumpNum(vis->patch, PU_CACHE);
|
||||||
fixed_t this_scale = vis->mobj->scale;
|
fixed_t this_scale = vis->thingscale;
|
||||||
INT32 x1, x2;
|
INT32 x1, x2;
|
||||||
INT64 overflow_test;
|
INT64 overflow_test;
|
||||||
|
|
||||||
|
@ -932,8 +906,11 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
#if 1
|
#if 1
|
||||||
// Something is occasionally setting 1px-wide sprites whose frac is exactly the width of the sprite, causing crashes due to
|
// Something is occasionally setting 1px-wide sprites whose frac is exactly the width of the sprite, causing crashes due to
|
||||||
// accessing invalid column info. Until the cause is found, let's try to correct those manually...
|
// accessing invalid column info. Until the cause is found, let's try to correct those manually...
|
||||||
while (frac + vis->xiscale*(vis->x2-vis->x1) > SHORT(patch->width)<<FRACBITS && vis->x2 >= vis->x1)
|
{
|
||||||
vis->x2--;
|
fixed_t temp = ((frac + vis->xiscale*(vis->x2-vis->x1))>>FRACBITS) - SHORT(patch->width);
|
||||||
|
if (temp > 0)
|
||||||
|
vis->x2 -= temp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale)
|
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale)
|
||||||
|
@ -1482,6 +1459,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
vis->scale += scalestep*(vis->x1 - x1);
|
vis->scale += scalestep*(vis->x1 - x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vis->thingscale = interp.scale;
|
||||||
|
|
||||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||||
vis->patch = sprframe->lumppat[rot];
|
vis->patch = sprframe->lumppat[rot];
|
||||||
|
@ -1697,6 +1676,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
vis->startfrac = 0;
|
vis->startfrac = 0;
|
||||||
vis->xiscale = iscale;
|
vis->xiscale = iscale;
|
||||||
|
|
||||||
|
vis->thingscale = interp.scale;
|
||||||
|
|
||||||
if (vis->x1 > x1)
|
if (vis->x1 > x1)
|
||||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,8 @@ typedef struct vissprite_s
|
||||||
boolean vflip; // Flip vertically
|
boolean vflip; // Flip vertically
|
||||||
boolean isScaled;
|
boolean isScaled;
|
||||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||||
|
|
||||||
|
fixed_t thingscale;
|
||||||
} vissprite_t;
|
} vissprite_t;
|
||||||
|
|
||||||
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
||||||
|
|
Loading…
Reference in a new issue