Remove redundant dc_pitch

This commit is contained in:
Magnus Norddahl 2017-02-01 21:52:29 +01:00
parent 93166fa150
commit 7b578bbb53
4 changed files with 16 additions and 25 deletions

View file

@ -106,7 +106,7 @@ namespace swrenderer
_dest = args.Dest(); _dest = args.Dest();
_dest_y = args.DestY(); _dest_y = args.DestY();
_fracbits = args.dc_wall_fracbits; _fracbits = args.dc_wall_fracbits;
_pitch = RenderViewport::Instance()->dc_pitch; _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_srcblend = args.dc_srcblend; _srcblend = args.dc_srcblend;
_destblend = args.dc_destblend; _destblend = args.dc_destblend;
_dynlights = args.dc_lights; _dynlights = args.dc_lights;
@ -564,7 +564,7 @@ namespace swrenderer
_dest = args.Dest(); _dest = args.Dest();
_dest_y = args.DestY(); _dest_y = args.DestY();
_count = args.Count(); _count = args.Count();
_pitch = RenderViewport::Instance()->dc_pitch; _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_source = args.FrontTexturePixels(); _source = args.FrontTexturePixels();
_source2 = args.BackTexturePixels(); _source2 = args.BackTexturePixels();
_sourceheight[0] = args.FrontTextureHeight(); _sourceheight[0] = args.FrontTextureHeight();
@ -870,7 +870,7 @@ namespace swrenderer
_count = args.dc_count; _count = args.dc_count;
_dest = args.Dest(); _dest = args.Dest();
_dest_y = args.DestY(); _dest_y = args.DestY();
_pitch = RenderViewport::Instance()->dc_pitch; _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_iscale = args.dc_iscale; _iscale = args.dc_iscale;
_texturefrac = args.dc_texturefrac; _texturefrac = args.dc_texturefrac;
_colormap = args.Colormap(); _colormap = args.Colormap();
@ -1768,7 +1768,7 @@ namespace swrenderer
_yh = args.dc_yh; _yh = args.dc_yh;
_x = args.dc_x; _x = args.dc_x;
_destorg = RenderViewport::Instance()->dc_destorg; _destorg = RenderViewport::Instance()->dc_destorg;
_pitch = RenderViewport::Instance()->dc_pitch; _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_fuzzpos = fuzzpos; _fuzzpos = fuzzpos;
_fuzzviewheight = fuzzviewheight; _fuzzviewheight = fuzzviewheight;
} }

View file

@ -73,7 +73,7 @@ namespace swrenderer
args.xbits = drawerargs.TextureWidthBits(); args.xbits = drawerargs.TextureWidthBits();
args.ybits = drawerargs.TextureHeightBits(); args.ybits = drawerargs.TextureHeightBits();
args.destorg = (uint32_t*)RenderViewport::Instance()->dc_destorg; args.destorg = (uint32_t*)RenderViewport::Instance()->dc_destorg;
args.destpitch = RenderViewport::Instance()->dc_pitch; args.destpitch = RenderViewport::Instance()->RenderTarget->GetPitch();
args.source = (const uint32_t*)drawerargs.TexturePixels(); args.source = (const uint32_t*)drawerargs.TexturePixels();
args.light = LightBgra::calc_light_multiplier(drawerargs.Light()); args.light = LightBgra::calc_light_multiplier(drawerargs.Light());
args.light_red = shade_constants.light_red; args.light_red = shade_constants.light_red;
@ -186,7 +186,7 @@ namespace swrenderer
auto shade_constants = drawerargs.ColormapConstants(); auto shade_constants = drawerargs.ColormapConstants();
args.dest = (uint32_t*)drawerargs.Dest(); args.dest = (uint32_t*)drawerargs.Dest();
args.dest_y = drawerargs.DestY(); args.dest_y = drawerargs.DestY();
args.pitch = RenderViewport::Instance()->dc_pitch; args.pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
args.count = drawerargs.dc_count; args.count = drawerargs.dc_count;
args.texturefrac[0] = drawerargs.dc_texturefrac; args.texturefrac[0] = drawerargs.dc_texturefrac;
args.texturefracx[0] = drawerargs.dc_texturefracx; args.texturefracx[0] = drawerargs.dc_texturefracx;
@ -256,7 +256,7 @@ namespace swrenderer
args.colormap = drawerargs.Colormap(); args.colormap = drawerargs.Colormap();
args.translation = drawerargs.TranslationMap(); args.translation = drawerargs.TranslationMap();
args.basecolors = (const uint32_t *)GPalette.BaseColors; args.basecolors = (const uint32_t *)GPalette.BaseColors;
args.pitch = RenderViewport::Instance()->dc_pitch; args.pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
args.count = drawerargs.dc_count; args.count = drawerargs.dc_count;
args.dest_y = drawerargs.DestY(); args.dest_y = drawerargs.DestY();
args.iscale = drawerargs.dc_iscale; args.iscale = drawerargs.dc_iscale;
@ -307,7 +307,7 @@ namespace swrenderer
args.dest = (uint32_t*)drawerargs.Dest(); args.dest = (uint32_t*)drawerargs.Dest();
args.dest_y = drawerargs.DestY(); args.dest_y = drawerargs.DestY();
args.count = drawerargs.Count(); args.count = drawerargs.Count();
args.pitch = RenderViewport::Instance()->dc_pitch; args.pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
args.texturefrac[0] = drawerargs.TextureVPos(); args.texturefrac[0] = drawerargs.TextureVPos();
args.iscale[0] = drawerargs.TextureVStep(); args.iscale[0] = drawerargs.TextureVStep();
args.source0[0] = (const uint32_t *)drawerargs.FrontTexturePixels(); args.source0[0] = (const uint32_t *)drawerargs.FrontTexturePixels();
@ -332,7 +332,7 @@ namespace swrenderer
_yl = drawerargs.dc_yl; _yl = drawerargs.dc_yl;
_yh = drawerargs.dc_yh; _yh = drawerargs.dc_yh;
_destorg = RenderViewport::Instance()->dc_destorg; _destorg = RenderViewport::Instance()->dc_destorg;
_pitch = RenderViewport::Instance()->dc_pitch; _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_fuzzpos = fuzzpos; _fuzzpos = fuzzpos;
_fuzzviewheight = fuzzviewheight; _fuzzviewheight = fuzzviewheight;
} }
@ -710,7 +710,7 @@ namespace swrenderer
_a = a; _a = a;
_destorg = RenderViewport::Instance()->dc_destorg; _destorg = RenderViewport::Instance()->dc_destorg;
_pitch = RenderViewport::Instance()->dc_pitch; _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
} }
void FillTransColumnRGBACommand::Execute(DrawerThread *thread) void FillTransColumnRGBACommand::Execute(DrawerThread *thread)

View file

@ -126,25 +126,17 @@ namespace swrenderer
void RenderViewport::SetupBuffer() void RenderViewport::SetupBuffer()
{ {
static BYTE *lastbuff = NULL;
int pitch = RenderTarget->GetPitch(); int pitch = RenderTarget->GetPitch();
int pixelsize = RenderTarget->IsBgra() ? 4 : 1; int pixelsize = RenderTarget->IsBgra() ? 4 : 1;
BYTE *lineptr = RenderTarget->GetBuffer() + (viewwindowy*pitch + viewwindowx) * pixelsize; BYTE *lineptr = RenderTarget->GetBuffer() + (viewwindowy*pitch + viewwindowx) * pixelsize;
if (dc_pitch != pitch || lineptr != lastbuff) R_InitFuzzTable(pitch);
dc_destorg = lineptr;
dc_destheight = RenderTarget->GetHeight() - viewwindowy;
for (int i = 0; i < RenderTarget->GetHeight(); i++)
{ {
if (dc_pitch != pitch) ylookup[i] = i * pitch;
{
dc_pitch = pitch;
R_InitFuzzTable(pitch);
}
dc_destorg = lineptr;
dc_destheight = RenderTarget->GetHeight() - viewwindowy;
for (int i = 0; i < RenderTarget->GetHeight(); i++)
{
ylookup[i] = i * pitch;
}
} }
R_InitParticleTexture(); R_InitParticleTexture();

View file

@ -47,7 +47,6 @@ namespace swrenderer
uint8_t *dc_destorg = nullptr; uint8_t *dc_destorg = nullptr;
int dc_destheight = 0; int dc_destheight = 0;
int dc_pitch = 0;
private: private:
void InitTextureMapping(); void InitTextureMapping();