Don't copy the WallDrawerArgs members now that drawer args are grouped by drawer family

This commit is contained in:
Magnus Norddahl 2017-02-24 02:37:13 +01:00
parent 8bd0df1ace
commit f76a039a76
2 changed files with 132 additions and 165 deletions

View file

@ -96,23 +96,8 @@ CVAR(Bool, r_blendmethod, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
namespace swrenderer namespace swrenderer
{ {
PalWall1Command::PalWall1Command(const WallDrawerArgs &args) PalWall1Command::PalWall1Command(const WallDrawerArgs &args) : args(args)
{ {
_iscale = args.TextureVStep();
_texturefrac = args.TextureVPos();
_colormap = args.Colormap();
_count = args.Count();
_source = args.TexturePixels();
_dest = args.Dest();
_dest_y = args.DestY();
_fracbits = args.TextureFracBits();
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_srcblend = args.SrcBlend();
_destblend = args.DestBlend();
_dynlights = args.dc_lights;
_num_dynlights = args.dc_num_lights;
_viewpos_z = args.dc_viewpos.Z;
_step_viewpos_z = args.dc_viewpos_step.Z;
} }
uint8_t PalWall1Command::AddLights(const DrawerLight *lights, int num_lights, float viewpos_z, uint8_t fg, uint8_t material) uint8_t PalWall1Command::AddLights(const DrawerLight *lights, int num_lights, float viewpos_z, uint8_t fg, uint8_t material)
@ -170,25 +155,25 @@ namespace swrenderer
void DrawWall1PalCommand::Execute(DrawerThread *thread) void DrawWall1PalCommand::Execute(DrawerThread *thread)
{ {
uint32_t fracstep = _iscale; uint32_t fracstep = args.TextureVStep();
uint32_t frac = _texturefrac; uint32_t frac = args.TextureVPos();
uint8_t *colormap = _colormap; uint8_t *colormap = args.Colormap();
int count = _count; int count = args.Count();
const uint8_t *source = _source; const uint8_t *source = args.TexturePixels();
uint8_t *dest = _dest; uint8_t *dest = args.Dest();
int bits = _fracbits; int bits = args.TextureFracBits();
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
DrawerLight *dynlights = _dynlights; DrawerLight *dynlights = args.dc_lights;
int num_dynlights = _num_dynlights; int num_dynlights = args.dc_num_lights;
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(args.DestY(), count);
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(args.DestY());
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -203,10 +188,10 @@ namespace swrenderer
} }
else else
{ {
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
viewpos_z += step_viewpos_z * thread->skipped_by_thread(_dest_y); viewpos_z += step_viewpos_z * thread->skipped_by_thread(args.DestY());
step_viewpos_z *= thread->num_cores; step_viewpos_z *= thread->num_cores;
do do
@ -221,25 +206,25 @@ namespace swrenderer
void DrawWallMasked1PalCommand::Execute(DrawerThread *thread) void DrawWallMasked1PalCommand::Execute(DrawerThread *thread)
{ {
uint32_t fracstep = _iscale; uint32_t fracstep = args.TextureVStep();
uint32_t frac = _texturefrac; uint32_t frac = args.TextureVPos();
uint8_t *colormap = _colormap; uint8_t *colormap = args.Colormap();
int count = _count; int count = args.Count();
const uint8_t *source = _source; const uint8_t *source = args.TexturePixels();
uint8_t *dest = _dest; uint8_t *dest = args.Dest();
int bits = _fracbits; int bits = args.TextureFracBits();
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
DrawerLight *dynlights = _dynlights; DrawerLight *dynlights = args.dc_lights;
int num_dynlights = _num_dynlights; int num_dynlights = args.dc_num_lights;
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(args.DestY(), count);
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(args.DestY());
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -258,10 +243,10 @@ namespace swrenderer
} }
else else
{ {
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
viewpos_z += step_viewpos_z * thread->skipped_by_thread(_dest_y); viewpos_z += step_viewpos_z * thread->skipped_by_thread(args.DestY());
step_viewpos_z *= thread->num_cores; step_viewpos_z *= thread->num_cores;
do do
@ -280,24 +265,24 @@ namespace swrenderer
void DrawWallAdd1PalCommand::Execute(DrawerThread *thread) void DrawWallAdd1PalCommand::Execute(DrawerThread *thread)
{ {
uint32_t fracstep = _iscale; uint32_t fracstep = args.TextureVStep();
uint32_t frac = _texturefrac; uint32_t frac = args.TextureVPos();
uint8_t *colormap = _colormap; uint8_t *colormap = args.Colormap();
int count = _count; int count = args.Count();
const uint8_t *source = _source; const uint8_t *source = args.TexturePixels();
uint8_t *dest = _dest; uint8_t *dest = args.Dest();
int bits = _fracbits; int bits = args.TextureFracBits();
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
uint32_t *fg2rgb = _srcblend; uint32_t *fg2rgb = args.SrcBlend();
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = args.DestBlend();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(args.DestY(), count);
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(args.DestY());
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -342,31 +327,31 @@ namespace swrenderer
void DrawWallAddClamp1PalCommand::Execute(DrawerThread *thread) void DrawWallAddClamp1PalCommand::Execute(DrawerThread *thread)
{ {
uint32_t fracstep = _iscale; uint32_t fracstep = args.TextureVStep();
uint32_t frac = _texturefrac; uint32_t frac = args.TextureVPos();
uint8_t *colormap = _colormap; uint8_t *colormap = args.Colormap();
int count = _count; int count = args.Count();
const uint8_t *source = _source; const uint8_t *source = args.TexturePixels();
uint8_t *dest = _dest; uint8_t *dest = args.Dest();
int bits = _fracbits; int bits = args.TextureFracBits();
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
DrawerLight *dynlights = _dynlights; DrawerLight *dynlights = args.dc_lights;
int num_dynlights = _num_dynlights; int num_dynlights = args.dc_num_lights;
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
uint32_t *fg2rgb = _srcblend; uint32_t *fg2rgb = args.SrcBlend();
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = args.DestBlend();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(args.DestY(), count);
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(args.DestY());
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
viewpos_z += step_viewpos_z * thread->skipped_by_thread(_dest_y); viewpos_z += step_viewpos_z * thread->skipped_by_thread(args.DestY());
step_viewpos_z *= thread->num_cores; step_viewpos_z *= thread->num_cores;
if (!r_blendmethod) if (!r_blendmethod)
@ -416,31 +401,31 @@ namespace swrenderer
void DrawWallSubClamp1PalCommand::Execute(DrawerThread *thread) void DrawWallSubClamp1PalCommand::Execute(DrawerThread *thread)
{ {
uint32_t fracstep = _iscale; uint32_t fracstep = args.TextureVStep();
uint32_t frac = _texturefrac; uint32_t frac = args.TextureVPos();
uint8_t *colormap = _colormap; uint8_t *colormap = args.Colormap();
int count = _count; int count = args.Count();
const uint8_t *source = _source; const uint8_t *source = args.TexturePixels();
uint8_t *dest = _dest; uint8_t *dest = args.Dest();
int bits = _fracbits; int bits = args.TextureFracBits();
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
DrawerLight *dynlights = _dynlights; DrawerLight *dynlights = args.dc_lights;
int num_dynlights = _num_dynlights; int num_dynlights = args.dc_num_lights;
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
uint32_t *fg2rgb = _srcblend; uint32_t *fg2rgb = args.SrcBlend();
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = args.DestBlend();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(args.DestY(), count);
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(args.DestY());
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
viewpos_z += step_viewpos_z * thread->skipped_by_thread(_dest_y); viewpos_z += step_viewpos_z * thread->skipped_by_thread(args.DestY());
step_viewpos_z *= thread->num_cores; step_viewpos_z *= thread->num_cores;
if (!r_blendmethod) if (!r_blendmethod)
@ -489,31 +474,31 @@ namespace swrenderer
void DrawWallRevSubClamp1PalCommand::Execute(DrawerThread *thread) void DrawWallRevSubClamp1PalCommand::Execute(DrawerThread *thread)
{ {
uint32_t fracstep = _iscale; uint32_t fracstep = args.TextureVStep();
uint32_t frac = _texturefrac; uint32_t frac = args.TextureVPos();
uint8_t *colormap = _colormap; uint8_t *colormap = args.Colormap();
int count = _count; int count = args.Count();
const uint8_t *source = _source; const uint8_t *source = args.TexturePixels();
uint8_t *dest = _dest; uint8_t *dest = args.Dest();
int bits = _fracbits; int bits = args.TextureFracBits();
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
DrawerLight *dynlights = _dynlights; DrawerLight *dynlights = args.dc_lights;
int num_dynlights = _num_dynlights; int num_dynlights = args.dc_num_lights;
float viewpos_z = _viewpos_z; float viewpos_z = args.dc_viewpos.Z;
float step_viewpos_z = _step_viewpos_z; float step_viewpos_z = args.dc_viewpos_step.Z;
uint32_t *fg2rgb = _srcblend; uint32_t *fg2rgb = args.SrcBlend();
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = args.DestBlend();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(args.DestY(), count);
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(args.DestY());
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
viewpos_z += step_viewpos_z * thread->skipped_by_thread(_dest_y); viewpos_z += step_viewpos_z * thread->skipped_by_thread(args.DestY());
step_viewpos_z *= thread->num_cores; step_viewpos_z *= thread->num_cores;
if (!r_blendmethod) if (!r_blendmethod)
@ -567,7 +552,6 @@ 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()->RenderTarget->GetPitch();
_source = args.FrontTexturePixels(); _source = args.FrontTexturePixels();
_source2 = args.BackTexturePixels(); _source2 = args.BackTexturePixels();
_sourceheight[0] = args.FrontTextureHeight(); _sourceheight[0] = args.FrontTextureHeight();
@ -583,7 +567,7 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
const uint8_t *source0 = _source; const uint8_t *source0 = _source;
int textureheight0 = _sourceheight[0]; int textureheight0 = _sourceheight[0];
@ -714,7 +698,7 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
const uint8_t *source0 = _source; const uint8_t *source0 = _source;
const uint8_t *source1 = _source2; const uint8_t *source1 = _source2;
int textureheight0 = _sourceheight[0]; int textureheight0 = _sourceheight[0];
@ -873,7 +857,6 @@ namespace swrenderer
_count = args.Count(); _count = args.Count();
_dest = args.Dest(); _dest = args.Dest();
_dest_y = args.DestY(); _dest_y = args.DestY();
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_iscale = args.TextureVStep(); _iscale = args.TextureVStep();
_texturefrac = args.TextureVPos(); _texturefrac = args.TextureVPos();
_colormap = args.Colormap(); _colormap = args.Colormap();
@ -926,7 +909,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -986,7 +969,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -1010,7 +993,7 @@ namespace swrenderer
bg2rgb = _destblend; bg2rgb = _destblend;
fg = _srccolor; fg = _srccolor;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -1060,7 +1043,7 @@ namespace swrenderer
bg2rgb = _destblend; bg2rgb = _destblend;
fg = _srccolor; fg = _srccolor;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -1114,7 +1097,7 @@ namespace swrenderer
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = _destblend;
uint32_t fg = _srccolor; uint32_t fg = _srccolor;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -1171,7 +1154,7 @@ namespace swrenderer
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = _destblend;
uint32_t fg = _srccolor; uint32_t fg = _srccolor;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -1232,7 +1215,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1293,7 +1276,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1330,7 +1313,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1391,7 +1374,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1449,7 +1432,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1511,7 +1494,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1574,7 +1557,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1635,7 +1618,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1697,7 +1680,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1758,7 +1741,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
int pitch = _pitch; int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
@ -1811,7 +1794,6 @@ namespace swrenderer
_yh = args.FuzzY2(); _yh = args.FuzzY2();
_x = args.FuzzX(); _x = args.FuzzX();
_destorg = RenderViewport::Instance()->GetDest(0, 0); _destorg = RenderViewport::Instance()->GetDest(0, 0);
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_fuzzpos = fuzzpos; _fuzzpos = fuzzpos;
_fuzzviewheight = fuzzviewheight; _fuzzviewheight = fuzzviewheight;
} }
@ -1829,9 +1811,10 @@ namespace swrenderer
uint8_t *map = &NormalLight.Maps[6 * 256]; uint8_t *map = &NormalLight.Maps[6 * 256];
uint8_t *dest = thread->dest_for_thread(yl, _pitch, yl * _pitch + _x + _destorg); int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
uint8_t *dest = thread->dest_for_thread(yl, pitch, yl * pitch + _x + _destorg);
int pitch = _pitch * thread->num_cores; pitch = pitch * thread->num_cores;
int fuzzstep = thread->num_cores; int fuzzstep = thread->num_cores;
int fuzz = (_fuzzpos + thread->skipped_by_thread(yl)) % FUZZTABLE; int fuzz = (_fuzzpos + thread->skipped_by_thread(yl)) % FUZZTABLE;
@ -1841,7 +1824,7 @@ namespace swrenderer
if (yl < fuzzstep) if (yl < fuzzstep)
{ {
uint8_t *srcdest = dest + fuzzoffset[fuzz] * fuzzstep + pitch; uint8_t *srcdest = dest + fuzzoffset[fuzz] * fuzzstep + pitch;
//assert(static_cast<int>((srcdest - (uint8_t*)dc_destorg) / (_pitch)) < viewheight); //assert(static_cast<int>((srcdest - (uint8_t*)dc_destorg) / (pitch)) < viewheight);
*dest = map[*srcdest]; *dest = map[*srcdest];
dest += pitch; dest += pitch;
@ -1870,7 +1853,7 @@ namespace swrenderer
do do
{ {
uint8_t *srcdest = dest + fuzzoffset[fuzz] * fuzzstep; uint8_t *srcdest = dest + fuzzoffset[fuzz] * fuzzstep;
//assert(static_cast<int>((srcdest - (uint8_t*)dc_destorg) / (_pitch)) < viewheight); //assert(static_cast<int>((srcdest - (uint8_t*)dc_destorg) / (pitch)) < viewheight);
*dest = map[*srcdest]; *dest = map[*srcdest];
dest += pitch; dest += pitch;
@ -1884,7 +1867,7 @@ namespace swrenderer
if (lowerbounds) if (lowerbounds)
{ {
uint8_t *srcdest = dest + fuzzoffset[fuzz] * fuzzstep - pitch; uint8_t *srcdest = dest + fuzzoffset[fuzz] * fuzzstep - pitch;
//assert(static_cast<int>((srcdest - (uint8_t*)dc_destorg) / (_pitch)) < viewheight); //assert(static_cast<int>((srcdest - (uint8_t*)dc_destorg) / (pitch)) < viewheight);
*dest = map[*srcdest]; *dest = map[*srcdest];
} }
@ -2901,8 +2884,9 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
uint8_t *dest = thread->dest_for_thread(_dest_y, _pitch, _dest); int pitch = _pitch;
int pitch = _pitch * thread->num_cores; uint8_t *dest = thread->dest_for_thread(_dest_y, pitch, _dest);
pitch = pitch * thread->num_cores;
const uint32_t *source = &particle_texture[(_fracposx >> FRACBITS) * PARTICLE_TEXTURE_SIZE]; const uint32_t *source = &particle_texture[(_fracposx >> FRACBITS) * PARTICLE_TEXTURE_SIZE];
uint32_t particle_alpha = _alpha; uint32_t particle_alpha = _alpha;

View file

@ -20,21 +20,7 @@ namespace swrenderer
protected: protected:
inline static uint8_t AddLights(const DrawerLight *lights, int num_lights, float viewpos_z, uint8_t fg, uint8_t material); inline static uint8_t AddLights(const DrawerLight *lights, int num_lights, float viewpos_z, uint8_t fg, uint8_t material);
uint32_t _iscale; WallDrawerArgs args;
uint32_t _texturefrac;
uint8_t *_colormap;
int _count;
const uint8_t *_source;
uint8_t *_dest;
int _dest_y;
int _fracbits;
int _pitch;
uint32_t *_srcblend;
uint32_t *_destblend;
DrawerLight *_dynlights;
int _num_dynlights;
float _viewpos_z;
float _step_viewpos_z;
}; };
class DrawWall1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; }; class DrawWall1PalCommand : public PalWall1Command { public: using PalWall1Command::PalWall1Command; void Execute(DrawerThread *thread) override; };
@ -58,7 +44,6 @@ namespace swrenderer
uint8_t *_dest; uint8_t *_dest;
int _dest_y; int _dest_y;
int _count; int _count;
int _pitch;
const uint8_t *_source; const uint8_t *_source;
const uint8_t *_source2; const uint8_t *_source2;
int _sourceheight[2]; int _sourceheight[2];
@ -81,7 +66,6 @@ namespace swrenderer
int _count; int _count;
uint8_t *_dest; uint8_t *_dest;
int _dest_y; int _dest_y;
int _pitch;
fixed_t _iscale; fixed_t _iscale;
fixed_t _texturefrac; fixed_t _texturefrac;
const uint8_t *_colormap; const uint8_t *_colormap;
@ -126,7 +110,6 @@ namespace swrenderer
int _yh; int _yh;
int _x; int _x;
uint8_t *_destorg; uint8_t *_destorg;
int _pitch;
int _fuzzpos; int _fuzzpos;
int _fuzzviewheight; int _fuzzviewheight;
}; };