Fix warp texture crash in software renderer true color mode

This commit is contained in:
Magnus Norddahl 2017-03-13 18:02:44 +01:00
parent a408ea312f
commit 22d3599ea1
2 changed files with 6 additions and 2 deletions

View File

@ -570,6 +570,7 @@ public:
FTexture *GetRedirect(bool wantwarped);
uint32_t GenTime;
uint32_t GenTimeBgra;
float Speed;
int WidthOffsetMultiplier, HeightOffsetMultiplier; // [mxd]
protected:

View File

@ -43,7 +43,7 @@
FWarpTexture::FWarpTexture (FTexture *source, int warptype)
: GenTime (0), Speed (1.f), SourcePic (source), Pixels (0), Spans (0)
: GenTime (0), GenTimeBgra(0), Speed (1.f), SourcePic (source), Pixels (0), Spans (0)
{
CopyInfo(source);
if (warptype == 2) SetupMultipliers(256, 128);
@ -98,8 +98,10 @@ const uint32_t *FWarpTexture::GetPixelsBgra()
{
uint32_t time = r_viewpoint.FrameTime;
if (Pixels == NULL || time != GenTime)
{
MakeTexture(time);
if (PixelsBgra.empty() || time != GenTimeBgra)
{
CreatePixelsBgraWithMipmaps();
for (int i = 0; i < Width * Height; i++)
{
@ -109,6 +111,7 @@ const uint32_t *FWarpTexture::GetPixelsBgra()
PixelsBgra[i] = 0;
}
GenerateBgraMipmapsFast();
GenTimeBgra = time;
}
return PixelsBgra.data();
}