Remove dc_destorg and ylookup

This commit is contained in:
Magnus Norddahl 2017-02-01 22:24:34 +01:00
parent ca93d7456a
commit d91e6ccece
11 changed files with 53 additions and 76 deletions

View File

@ -57,7 +57,6 @@ CVAR(Bool, r_dynlights, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
namespace swrenderer namespace swrenderer
{ {
int ylookup[MAXHEIGHT];
uint8_t shadetables[NUMCOLORMAPS * 16 * 256]; uint8_t shadetables[NUMCOLORMAPS * 16 * 256];
FDynamicColormap ShadeFakeColormap[16]; FDynamicColormap ShadeFakeColormap[16];
uint8_t identitymap[256]; uint8_t identitymap[256];

View File

@ -25,7 +25,6 @@ namespace swrenderer
class SpanDrawerArgs; class SpanDrawerArgs;
class SpriteDrawerArgs; class SpriteDrawerArgs;
extern int ylookup[MAXHEIGHT];
extern uint8_t shadetables[/*NUMCOLORMAPS*16*256*/]; extern uint8_t shadetables[/*NUMCOLORMAPS*16*256*/];
extern FDynamicColormap ShadeFakeColormap[16]; extern FDynamicColormap ShadeFakeColormap[16];
extern uint8_t identitymap[256]; extern uint8_t identitymap[256];

View File

@ -1767,7 +1767,7 @@ namespace swrenderer
_yl = args.dc_yl; _yl = args.dc_yl;
_yh = args.dc_yh; _yh = args.dc_yh;
_x = args.dc_x; _x = args.dc_x;
_destorg = RenderViewport::Instance()->dc_destorg; _destorg = RenderViewport::Instance()->GetDest(0, 0);
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_fuzzpos = fuzzpos; _fuzzpos = fuzzpos;
_fuzzviewheight = fuzzviewheight; _fuzzviewheight = fuzzviewheight;
@ -1786,7 +1786,7 @@ 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, ylookup[yl] + _x + _destorg); uint8_t *dest = thread->dest_for_thread(yl, _pitch, yl * _pitch + _x + _destorg);
int pitch = _pitch * thread->num_cores; int pitch = _pitch * thread->num_cores;
int fuzzstep = thread->num_cores; int fuzzstep = thread->num_cores;
@ -1858,7 +1858,7 @@ namespace swrenderer
_y = args.DestY(); _y = args.DestY();
_x1 = args.DestX1(); _x1 = args.DestX1();
_x2 = args.DestX2(); _x2 = args.DestX2();
_destorg = RenderViewport::Instance()->dc_destorg; _dest = RenderViewport::Instance()->GetDest(_x1, _y);
_xstep = args.TextureUStep(); _xstep = args.TextureUStep();
_ystep = args.TextureVStep(); _ystep = args.TextureVStep();
_xbits = args.TextureWidthBits(); _xbits = args.TextureWidthBits();
@ -1942,7 +1942,7 @@ namespace swrenderer
xfrac = _xfrac; xfrac = _xfrac;
yfrac = _yfrac; yfrac = _yfrac;
dest = ylookup[_y] + _x1 + _destorg; dest = _dest;
count = _x2 - _x1 + 1; count = _x2 - _x1 + 1;
@ -2030,7 +2030,7 @@ namespace swrenderer
xfrac = _xfrac; xfrac = _xfrac;
yfrac = _yfrac; yfrac = _yfrac;
dest = ylookup[_y] + _x1 + _destorg; dest = _dest;
count = _x2 - _x1 + 1; count = _x2 - _x1 + 1;
@ -2104,7 +2104,7 @@ namespace swrenderer
xfrac = _xfrac; xfrac = _xfrac;
yfrac = _yfrac; yfrac = _yfrac;
dest = ylookup[_y] + _x1 + _destorg; dest = _dest;
count = _x2 - _x1 + 1; count = _x2 - _x1 + 1;
@ -2227,7 +2227,7 @@ namespace swrenderer
xfrac = _xfrac; xfrac = _xfrac;
yfrac = _yfrac; yfrac = _yfrac;
dest = ylookup[_y] + _x1 + _destorg; dest = _dest;
count = _x2 - _x1 + 1; count = _x2 - _x1 + 1;
@ -2368,7 +2368,7 @@ namespace swrenderer
xfrac = _xfrac; xfrac = _xfrac;
yfrac = _yfrac; yfrac = _yfrac;
dest = ylookup[_y] + _x1 + _destorg; dest = _dest;
count = _x2 - _x1 + 1; count = _x2 - _x1 + 1;
@ -2491,7 +2491,7 @@ namespace swrenderer
xfrac = _xfrac; xfrac = _xfrac;
yfrac = _yfrac; yfrac = _yfrac;
dest = ylookup[_y] + _x1 + _destorg; dest = _dest;
count = _x2 - _x1 + 1; count = _x2 - _x1 + 1;
@ -2619,7 +2619,7 @@ namespace swrenderer
if (thread->line_skipped_by_thread(_y)) if (thread->line_skipped_by_thread(_y))
return; return;
memset(ylookup[_y] + _x1 + _destorg, _color, _x2 - _x1 + 1); memset(_dest, _color, _x2 - _x1 + 1);
} }
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
@ -2628,7 +2628,7 @@ namespace swrenderer
: y(y), x1(x1), x2(x2), plane_sz(plane_sz), plane_su(plane_su), plane_sv(plane_sv), plane_shade(plane_shade), planeshade(planeshade), planelightfloat(planelightfloat), pviewx(pviewx), pviewy(pviewy) : y(y), x1(x1), x2(x2), plane_sz(plane_sz), plane_su(plane_su), plane_sv(plane_sv), plane_shade(plane_shade), planeshade(planeshade), planelightfloat(planelightfloat), pviewx(pviewx), pviewy(pviewy)
{ {
_colormap = args.Colormap(); _colormap = args.Colormap();
_destorg = RenderViewport::Instance()->dc_destorg; _dest = RenderViewport::Instance()->GetDest(x1, y);
_ybits = args.TextureHeightBits(); _ybits = args.TextureHeightBits();
_xbits = args.TextureWidthBits(); _xbits = args.TextureWidthBits();
_source = args.TexturePixels(); _source = args.TexturePixels();
@ -2668,7 +2668,7 @@ namespace swrenderer
uz = plane_su[2] + plane_su[1] * (centery - y) + plane_su[0] * (x1 - centerx); uz = plane_su[2] + plane_su[1] * (centery - y) + plane_su[0] * (x1 - centerx);
vz = plane_sv[2] + plane_sv[1] * (centery - y) + plane_sv[0] * (x1 - centerx); vz = plane_sv[2] + plane_sv[1] * (centery - y) + plane_sv[0] * (x1 - centerx);
fb = ylookup[y] + x1 + _destorg; fb = _dest;
uint8_t vshift = 32 - _ybits; uint8_t vshift = 32 - _ybits;
uint8_t ushift = vshift - _xbits; uint8_t ushift = vshift - _xbits;
@ -2873,7 +2873,7 @@ namespace swrenderer
DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(const SpanDrawerArgs &args, int y, int x1, int x2) : PalSpanCommand(args), y(y), x1(x1), x2(x2) DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(const SpanDrawerArgs &args, int y, int x1, int x2) : PalSpanCommand(args), y(y), x1(x1), x2(x2)
{ {
color = args.SolidColor(); color = args.SolidColor();
destorg = RenderViewport::Instance()->dc_destorg; dest = RenderViewport::Instance()->GetDest(x1, y);
} }
void DrawColoredSpanPalCommand::Execute(DrawerThread *thread) void DrawColoredSpanPalCommand::Execute(DrawerThread *thread)
@ -2881,7 +2881,7 @@ namespace swrenderer
if (thread->line_skipped_by_thread(y)) if (thread->line_skipped_by_thread(y))
return; return;
memset(ylookup[y] + x1 + destorg, color, x2 - x1 + 1); memset(_dest, color, x2 - x1 + 1);
} }
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
@ -2889,7 +2889,7 @@ namespace swrenderer
DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(const SpanDrawerArgs &args, int y, int x1, int x2) : PalSpanCommand(args), y(y), x1(x1), x2(x2) DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(const SpanDrawerArgs &args, int y, int x1, int x2) : PalSpanCommand(args), y(y), x1(x1), x2(x2)
{ {
_colormap = args.Colormap(); _colormap = args.Colormap();
_destorg = RenderViewport::Instance()->dc_destorg; _dest = RenderViewport::Instance()->GetDest(x1, y);
} }
void DrawFogBoundaryLinePalCommand::Execute(DrawerThread *thread) void DrawFogBoundaryLinePalCommand::Execute(DrawerThread *thread)
@ -2898,7 +2898,7 @@ namespace swrenderer
return; return;
const uint8_t *colormap = _colormap; const uint8_t *colormap = _colormap;
uint8_t *dest = ylookup[y] + _destorg; uint8_t *dest = _dest;
int x = x1; int x = x1;
do do
{ {

View File

@ -140,7 +140,7 @@ namespace swrenderer
int _y; int _y;
int _x1; int _x1;
int _x2; int _x2;
uint8_t *_destorg; uint8_t *_dest;
dsfixed_t _xstep; dsfixed_t _xstep;
dsfixed_t _ystep; dsfixed_t _ystep;
int _xbits; int _xbits;
@ -187,7 +187,7 @@ namespace swrenderer
fixed_t pviewy; fixed_t pviewy;
const uint8_t *_colormap; const uint8_t *_colormap;
uint8_t *_destorg; uint8_t *_dest;
int _ybits; int _ybits;
int _xbits; int _xbits;
const uint8_t *_source; const uint8_t *_source;
@ -206,7 +206,7 @@ namespace swrenderer
int x1; int x1;
int x2; int x2;
int color; int color;
uint8_t *destorg; uint8_t *dest;
}; };
class DrawFogBoundaryLinePalCommand : public PalSpanCommand class DrawFogBoundaryLinePalCommand : public PalSpanCommand
@ -218,7 +218,7 @@ namespace swrenderer
private: private:
int y, x1, x2; int y, x1, x2;
const uint8_t *_colormap; const uint8_t *_colormap;
uint8_t *_destorg; uint8_t *_dest;
}; };
class DrawParticleColumnPalCommand : public DrawerCommand class DrawParticleColumnPalCommand : public DrawerCommand

View File

@ -72,7 +72,7 @@ namespace swrenderer
args.y = drawerargs.DestY(); args.y = drawerargs.DestY();
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()->GetDest(0, 0);
args.destpitch = RenderViewport::Instance()->RenderTarget->GetPitch(); 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());
@ -331,7 +331,7 @@ namespace swrenderer
_x = drawerargs.dc_x; _x = drawerargs.dc_x;
_yl = drawerargs.dc_yl; _yl = drawerargs.dc_yl;
_yh = drawerargs.dc_yh; _yh = drawerargs.dc_yh;
_destorg = RenderViewport::Instance()->dc_destorg; _destorg = RenderViewport::Instance()->GetDest(0, 0);
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
_fuzzpos = fuzzpos; _fuzzpos = fuzzpos;
_fuzzviewheight = fuzzviewheight; _fuzzviewheight = fuzzviewheight;
@ -348,7 +348,7 @@ namespace swrenderer
if (count <= 0) if (count <= 0)
return; return;
uint32_t *dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + _x + (uint32_t*)_destorg); uint32_t *dest = thread->dest_for_thread(yl, _pitch, _pitch * yl + _x + (uint32_t*)_destorg);
int pitch = _pitch * thread->num_cores; int pitch = _pitch * thread->num_cores;
int fuzzstep = thread->num_cores; int fuzzstep = thread->num_cores;
@ -439,7 +439,7 @@ namespace swrenderer
_x1 = drawerargs.DestX1(); _x1 = drawerargs.DestX1();
_x2 = drawerargs.DestX2(); _x2 = drawerargs.DestX2();
_y = drawerargs.DestY(); _y = drawerargs.DestY();
_destorg = RenderViewport::Instance()->dc_destorg; _dest = RenderViewport::Instance()->GetDest(_x1, _y);
_light = drawerargs.Light(); _light = drawerargs.Light();
_color = drawerargs.SolidColor(); _color = drawerargs.SolidColor();
} }
@ -449,7 +449,7 @@ namespace swrenderer
if (thread->line_skipped_by_thread(_y)) if (thread->line_skipped_by_thread(_y))
return; return;
uint32_t *dest = ylookup[_y] + _x1 + (uint32_t*)_destorg; uint32_t *dest = (uint32_t*)_dest;
int count = (_x2 - _x1 + 1); int count = (_x2 - _x1 + 1);
uint32_t light = LightBgra::calc_light_multiplier(_light); uint32_t light = LightBgra::calc_light_multiplier(_light);
uint32_t color = LightBgra::shade_pal_index_simple(_color, light); uint32_t color = LightBgra::shade_pal_index_simple(_color, light);
@ -470,7 +470,7 @@ namespace swrenderer
_x = x; _x = x;
_x2 = x2; _x2 = x2;
_destorg = RenderViewport::Instance()->dc_destorg; _line = RenderViewport::Instance()->GetDest(0, y);
_light = drawerargs.Light(); _light = drawerargs.Light();
_shade_constants = drawerargs.ColormapConstants(); _shade_constants = drawerargs.ColormapConstants();
} }
@ -484,7 +484,7 @@ namespace swrenderer
int x = _x; int x = _x;
int x2 = _x2; int x2 = _x2;
uint32_t *dest = ylookup[y] + (uint32_t*)_destorg; uint32_t *dest = (uint32_t*)_line;
uint32_t light = LightBgra::calc_light_multiplier(_light); uint32_t light = LightBgra::calc_light_multiplier(_light);
ShadeConstants constants = _shade_constants; ShadeConstants constants = _shade_constants;
@ -537,7 +537,7 @@ namespace swrenderer
_x1 = x1; _x1 = x1;
_x2 = x2; _x2 = x2;
_y = y; _y = y;
_destorg = RenderViewport::Instance()->dc_destorg; _dest = RenderViewport::Instance()->GetDest(_x1, _y);
_light = drawerargs.Light(); _light = drawerargs.Light();
_shade_constants = drawerargs.ColormapConstants(); _shade_constants = drawerargs.ColormapConstants();
_plane_sz = plane_sz; _plane_sz = plane_sz;
@ -568,7 +568,7 @@ namespace swrenderer
int source_width = 1 << _xbits; int source_width = 1 << _xbits;
int source_height = 1 << _ybits; int source_height = 1 << _ybits;
uint32_t *dest = ylookup[_y] + _x1 + (uint32_t*)_destorg; uint32_t *dest = (uint32_t*)_dest;
int count = _x2 - _x1 + 1; int count = _x2 - _x1 + 1;
// Depth (Z) change across the span // Depth (Z) change across the span
@ -672,7 +672,7 @@ namespace swrenderer
_x1 = x1; _x1 = x1;
_x2 = x2; _x2 = x2;
_destorg = RenderViewport::Instance()->dc_destorg; _dest = RenderViewport::Instance()->GetDest(_x1, _y);
_light = drawerargs.Light(); _light = drawerargs.Light();
_color = drawerargs.SolidColor(); _color = drawerargs.SolidColor();
} }
@ -686,7 +686,7 @@ namespace swrenderer
int x1 = _x1; int x1 = _x1;
int x2 = _x2; int x2 = _x2;
uint32_t *dest = ylookup[y] + x1 + (uint32_t*)_destorg; uint32_t *dest = (uint32_t*)_dest;
int count = (x2 - x1 + 1); int count = (x2 - x1 + 1);
uint32_t light = LightBgra::calc_light_multiplier(_light); uint32_t light = LightBgra::calc_light_multiplier(_light);
uint32_t color = LightBgra::shade_pal_index_simple(_color, light); uint32_t color = LightBgra::shade_pal_index_simple(_color, light);
@ -709,7 +709,7 @@ namespace swrenderer
_color = color; _color = color;
_a = a; _a = a;
_destorg = RenderViewport::Instance()->dc_destorg; _destorg = RenderViewport::Instance()->GetDest(0, 0);
_pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); _pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
} }
@ -738,7 +738,7 @@ namespace swrenderer
fg_blue *= alpha; fg_blue *= alpha;
int spacing = _pitch * thread->num_cores; int spacing = _pitch * thread->num_cores;
uint32_t *dest = thread->dest_for_thread(y1, _pitch, ylookup[y1] + x + (uint32_t*)_destorg); uint32_t *dest = thread->dest_for_thread(y1, _pitch, _pitch * y1 + x + (uint32_t*)_destorg);
for (int y = 0; y < ycount; y++) for (int y = 0; y < ycount; y++)
{ {

View File

@ -211,7 +211,7 @@ namespace swrenderer
int _x1; int _x1;
int _x2; int _x2;
int _y; int _y;
uint8_t * RESTRICT _destorg; uint8_t * RESTRICT _dest;
fixed_t _light; fixed_t _light;
int _color; int _color;
@ -226,7 +226,7 @@ namespace swrenderer
int _y; int _y;
int _x; int _x;
int _x2; int _x2;
uint8_t * RESTRICT _destorg; uint8_t * RESTRICT _line;
fixed_t _light; fixed_t _light;
ShadeConstants _shade_constants; ShadeConstants _shade_constants;
@ -241,7 +241,7 @@ namespace swrenderer
int _x1; int _x1;
int _x2; int _x2;
int _y; int _y;
uint8_t * RESTRICT _destorg; uint8_t * RESTRICT _dest;
fixed_t _light; fixed_t _light;
ShadeConstants _shade_constants; ShadeConstants _shade_constants;
FVector3 _plane_sz; FVector3 _plane_sz;
@ -267,7 +267,7 @@ namespace swrenderer
int _y; int _y;
int _x1; int _x1;
int _x2; int _x2;
uint8_t * RESTRICT _destorg; uint8_t * RESTRICT _dest;
fixed_t _light; fixed_t _light;
int _color; int _color;

View File

@ -591,8 +591,7 @@ namespace swrenderer
void WallDrawerArgs::SetDest(int x, int y) void WallDrawerArgs::SetDest(int x, int y)
{ {
auto viewport = RenderViewport::Instance(); auto viewport = RenderViewport::Instance();
int pixelsize = viewport->RenderTarget->IsBgra() ? 4 : 1; dc_dest = viewport->GetDest(x, y);
dc_dest = viewport->dc_destorg + (ylookup[y] + x) * pixelsize;
dc_dest_y = y; dc_dest_y = y;
} }
@ -726,8 +725,7 @@ namespace swrenderer
void SkyDrawerArgs::SetDest(int x, int y) void SkyDrawerArgs::SetDest(int x, int y)
{ {
auto viewport = RenderViewport::Instance(); auto viewport = RenderViewport::Instance();
int pixelsize = viewport->RenderTarget->IsBgra() ? 4 : 1; dc_dest = viewport->GetDest(x, y);
dc_dest = viewport->dc_destorg + (ylookup[y] + x) * pixelsize;
dc_dest_y = y; dc_dest_y = y;
} }
@ -772,8 +770,7 @@ namespace swrenderer
void SpriteDrawerArgs::SetDest(int x, int y) void SpriteDrawerArgs::SetDest(int x, int y)
{ {
auto viewport = RenderViewport::Instance(); auto viewport = RenderViewport::Instance();
int pixelsize = viewport->RenderTarget->IsBgra() ? 4 : 1; dc_dest = viewport->GetDest(x, y);
dc_dest = viewport->dc_destorg + (ylookup[y] + x) * pixelsize;
dc_dest_y = y; dc_dest_y = y;
} }
} }

View File

@ -126,19 +126,18 @@ namespace swrenderer
void RenderViewport::SetupBuffer() void RenderViewport::SetupBuffer()
{ {
int pitch = RenderTarget->GetPitch(); R_InitFuzzTable(RenderTarget->GetPitch());
int pixelsize = RenderTarget->IsBgra() ? 4 : 1; R_InitParticleTexture();
BYTE *lineptr = RenderTarget->GetBuffer() + (viewwindowy*pitch + viewwindowx) * pixelsize;
R_InitFuzzTable(pitch);
dc_destorg = lineptr;
for (int i = 0; i < RenderTarget->GetHeight(); i++)
{
ylookup[i] = i * pitch;
} }
R_InitParticleTexture(); uint8_t *RenderViewport::GetDest(int x, int y)
{
x += viewwindowx;
y += viewwindowy;
int pitch = RenderTarget->GetPitch();
int pixelsize = RenderTarget->IsBgra() ? 4 : 1;
return RenderTarget->GetBuffer() + (x + y * pitch) * pixelsize;
} }
void RenderViewport::InitTextureMapping() void RenderViewport::InitTextureMapping()

View File

@ -44,7 +44,7 @@ namespace swrenderer
// from clipangle to -clipangle. // from clipangle to -clipangle.
angle_t xtoviewangle[MAXWIDTH + 1]; angle_t xtoviewangle[MAXWIDTH + 1];
uint8_t *dc_destorg = nullptr; uint8_t *GetDest(int x, int y);
bool RenderingToCanvas() const { return RenderTarget != screen; } bool RenderingToCanvas() const { return RenderTarget != screen; }

View File

@ -245,7 +245,7 @@ namespace swrenderer
{ {
if (translucentPass->ClipSpriteColumnWithPortals(x, vis)) if (translucentPass->ClipSpriteColumnWithPortals(x, vis))
continue; continue;
uint32_t *dest = ylookup[yl] + x + (uint32_t*)viewport->dc_destorg; uint32_t *dest = (uint32_t*)viewport->GetDest(x, yl);
DrawerCommandQueue::QueueCommand<DrawParticleColumnRGBACommand>(dest, yl, spacing, ycount, fg, alpha, fracposx); DrawerCommandQueue::QueueCommand<DrawParticleColumnRGBACommand>(dest, yl, spacing, ycount, fg, alpha, fracposx);
} }
} }
@ -255,7 +255,7 @@ namespace swrenderer
{ {
if (translucentPass->ClipSpriteColumnWithPortals(x, vis)) if (translucentPass->ClipSpriteColumnWithPortals(x, vis))
continue; continue;
uint8_t *dest = ylookup[yl] + x + viewport->dc_destorg; uint8_t *dest = viewport->GetDest(x, yl);
DrawerCommandQueue::QueueCommand<DrawParticleColumnPalCommand>(dest, yl, spacing, ycount, fg, alpha, fracposx); DrawerCommandQueue::QueueCommand<DrawParticleColumnPalCommand>(dest, yl, spacing, ycount, fg, alpha, fracposx);
} }
} }

View File

@ -203,13 +203,6 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
else else
visible = drawerargs.SetPatchStyle(parms.style, parms.Alpha, 0, parms.fillcolor, basecolormap); visible = drawerargs.SetPatchStyle(parms.style, parms.Alpha, 0, parms.fillcolor, basecolormap);
BYTE *destorgsave = viewport->dc_destorg;
viewport->dc_destorg = screen->GetBuffer();
if (viewport->dc_destorg == NULL)
{
I_FatalError("Attempt to write to buffer of hardware canvas");
}
double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth; double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth;
double y0 = parms.y - parms.top * parms.destheight / parms.texheight; double y0 = parms.y - parms.top * parms.destheight / parms.texheight;
@ -295,8 +288,6 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
viewport->CenterY = centeryback; viewport->CenterY = centeryback;
} }
viewport->dc_destorg = destorgsave;
if (ticdup != 0 && menuactive == MENU_Off) if (ticdup != 0 && menuactive == MENU_Off)
{ {
NetUpdate(); NetUpdate();
@ -1369,13 +1360,6 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
auto viewport = RenderViewport::Instance(); auto viewport = RenderViewport::Instance();
BYTE *destorgsave = viewport->dc_destorg;
viewport->dc_destorg = screen->GetBuffer();
if (viewport->dc_destorg == NULL)
{
I_FatalError("Attempt to write to buffer of hardware canvas");
}
scalex /= tex->Scale.X; scalex /= tex->Scale.X;
scaley /= tex->Scale.Y; scaley /= tex->Scale.Y;
@ -1498,7 +1482,6 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
pt1 = pt2; pt1 = pt2;
pt2--; if (pt2 < 0) pt2 = npoints; pt2--; if (pt2 < 0) pt2 = npoints;
} while (pt1 != botpt); } while (pt1 != botpt);
viewport->dc_destorg = destorgsave;
#endif #endif
} }