From 4d0cc9e7bb94681d0520cb0c9158a4f1cade03af Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Dec 2016 07:25:11 +0100 Subject: [PATCH] Remove old voxel slab drawer --- src/swrenderer/drawers/r_draw.cpp | 31 ------- src/swrenderer/drawers/r_draw.h | 2 - src/swrenderer/drawers/r_draw_pal.cpp | 40 --------- src/swrenderer/drawers/r_draw_pal.h | 18 ---- src/swrenderer/drawers/r_draw_rgba.cpp | 110 ------------------------- src/swrenderer/drawers/r_draw_rgba.h | 20 ----- 6 files changed, 221 deletions(-) diff --git a/src/swrenderer/drawers/r_draw.cpp b/src/swrenderer/drawers/r_draw.cpp index b49427d982..181c4602f9 100644 --- a/src/swrenderer/drawers/r_draw.cpp +++ b/src/swrenderer/drawers/r_draw.cpp @@ -914,37 +914,6 @@ namespace swrenderer DrawerCommandQueue::QueueCommand(y, x1, x2); } - namespace - { - ShadeConstants slab_rgba_shade_constants; - const uint8_t *slab_rgba_colormap; - fixed_t slab_rgba_light; - } - - void R_SetupDrawSlab(FSWColormap *base_colormap, float light, int shade) - { - slab_rgba_shade_constants.light_red = base_colormap->Color.r * 256 / 255; - slab_rgba_shade_constants.light_green = base_colormap->Color.g * 256 / 255; - slab_rgba_shade_constants.light_blue = base_colormap->Color.b * 256 / 255; - slab_rgba_shade_constants.light_alpha = base_colormap->Color.a * 256 / 255; - slab_rgba_shade_constants.fade_red = base_colormap->Fade.r; - slab_rgba_shade_constants.fade_green = base_colormap->Fade.g; - slab_rgba_shade_constants.fade_blue = base_colormap->Fade.b; - slab_rgba_shade_constants.fade_alpha = base_colormap->Fade.a; - slab_rgba_shade_constants.desaturate = MIN(abs(base_colormap->Desaturate), 255) * 255 / 256; - slab_rgba_shade_constants.simple_shade = (base_colormap->Color.d == 0x00ffffff && base_colormap->Fade.d == 0x00000000 && base_colormap->Desaturate == 0); - slab_rgba_colormap = base_colormap->Maps; - slab_rgba_light = LIGHTSCALE(light, shade); - } - - void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p) - { - if (r_swtruecolor) - DrawerCommandQueue::QueueCommand(dx, v, dy, vi, vptr, p, slab_rgba_shade_constants, slab_rgba_colormap, slab_rgba_light); - else - DrawerCommandQueue::QueueCommand(dx, v, dy, vi, vptr, p, slab_rgba_colormap); - } - void R_DrawFogBoundarySection(int y, int y2, int x1) { for (; y < y2; ++y) diff --git a/src/swrenderer/drawers/r_draw.h b/src/swrenderer/drawers/r_draw.h index 580bcd2f9a..b168830223 100644 --- a/src/swrenderer/drawers/r_draw.h +++ b/src/swrenderer/drawers/r_draw.h @@ -160,8 +160,6 @@ namespace swrenderer void R_FillSpan(); void R_DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy); void R_DrawColoredSpan(int y, int x1, int x2); - void R_SetupDrawSlab(FSWColormap *base_colormap, float light, int shade); - void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p); void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip); void R_FillSpan(); diff --git a/src/swrenderer/drawers/r_draw_pal.cpp b/src/swrenderer/drawers/r_draw_pal.cpp index dd1fdcc528..94250ccd55 100644 --- a/src/swrenderer/drawers/r_draw_pal.cpp +++ b/src/swrenderer/drawers/r_draw_pal.cpp @@ -2713,46 +2713,6 @@ namespace swrenderer ///////////////////////////////////////////////////////////////////////// - DrawSlabPalCommand::DrawSlabPalCommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, const uint8_t *colormap) - : _dx(dx), _v(v), _dy(dy), _vi(vi), _vvptr(vptr), _p(p), _colormap(colormap) - { - using namespace drawerargs; - _pitch = dc_pitch; - _start_y = static_cast((p - dc_destorg) / dc_pitch); - } - - void DrawSlabPalCommand::Execute(DrawerThread *thread) - { - int count = _dy; - uint8_t *dest = _p; - int pitch = _pitch; - int width = _dx; - const uint8_t *colormap = _colormap; - const uint8_t *source = _vvptr; - fixed_t fracpos = _v; - fixed_t iscale = _vi; - - count = thread->count_for_thread(_start_y, count); - dest = thread->dest_for_thread(_start_y, pitch, dest); - fracpos += iscale * thread->skipped_by_thread(_start_y); - iscale *= thread->num_cores; - pitch *= thread->num_cores; - - while (count > 0) - { - uint8_t color = colormap[source[fracpos >> FRACBITS]]; - - for (int x = 0; x < width; x++) - dest[x] = color; - - dest += pitch; - fracpos += iscale; - count--; - } - } - - ///////////////////////////////////////////////////////////////////////// - DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(int y, int x1, int x2) : y(y), x1(x1), x2(x2) { using namespace drawerargs; diff --git a/src/swrenderer/drawers/r_draw_pal.h b/src/swrenderer/drawers/r_draw_pal.h index 539cf430d0..0d821b87c6 100644 --- a/src/swrenderer/drawers/r_draw_pal.h +++ b/src/swrenderer/drawers/r_draw_pal.h @@ -204,24 +204,6 @@ namespace swrenderer uint8_t *destorg; }; - class DrawSlabPalCommand : public PalSpanCommand - { - public: - DrawSlabPalCommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, const uint8_t *colormap); - void Execute(DrawerThread *thread) override; - - private: - int _dx; - fixed_t _v; - int _dy; - fixed_t _vi; - const uint8_t *_vvptr; - uint8_t *_p; - const uint8_t *_colormap; - int _pitch; - int _start_y; - }; - class DrawFogBoundaryLinePalCommand : public PalSpanCommand { public: diff --git a/src/swrenderer/drawers/r_draw_rgba.cpp b/src/swrenderer/drawers/r_draw_rgba.cpp index 5cdaea108b..4203bc8a98 100644 --- a/src/swrenderer/drawers/r_draw_rgba.cpp +++ b/src/swrenderer/drawers/r_draw_rgba.cpp @@ -489,116 +489,6 @@ namespace swrenderer ///////////////////////////////////////////////////////////////////////////// - DrawSlabRGBACommand::DrawSlabRGBACommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, ShadeConstants shade_constants, const uint8_t *colormap, fixed_t light) - { - using namespace drawerargs; - - _dx = dx; - _v = v; - _dy = dy; - _vi = vi; - _voxelptr = vptr; - _p = (uint32_t *)p; - _shade_constants = shade_constants; - _colormap = colormap; - _light = light; - _pitch = dc_pitch; - _start_y = static_cast((p - dc_destorg) / (dc_pitch * 4)); - assert(dx > 0); - } - - void DrawSlabRGBACommand::Execute(DrawerThread *thread) - { - int dx = _dx; - fixed_t v = _v; - int dy = _dy; - fixed_t vi = _vi; - const uint8_t *vptr = _voxelptr; - uint32_t *p = _p; - ShadeConstants shade_constants = _shade_constants; - const uint8_t *colormap = _colormap; - uint32_t light = LightBgra::calc_light_multiplier(_light); - int pitch = _pitch; - int x; - - dy = thread->count_for_thread(_start_y, dy); - p = thread->dest_for_thread(_start_y, pitch, p); - v += vi * thread->skipped_by_thread(_start_y); - vi *= thread->num_cores; - pitch *= thread->num_cores; - - if (dx == 1) - { - while (dy > 0) - { - *p = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants); - p += pitch; - v += vi; - dy--; - } - } - else if (dx == 2) - { - while (dy > 0) - { - uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants); - p[0] = color; - p[1] = color; - p += pitch; - v += vi; - dy--; - } - } - else if (dx == 3) - { - while (dy > 0) - { - uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants); - p[0] = color; - p[1] = color; - p[2] = color; - p += pitch; - v += vi; - dy--; - } - } - else if (dx == 4) - { - while (dy > 0) - { - uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants); - p[0] = color; - p[1] = color; - p[2] = color; - p[3] = color; - p += pitch; - v += vi; - dy--; - } - } - else while (dy > 0) - { - uint32_t color = LightBgra::shade_pal_index(colormap[vptr[v >> FRACBITS]], light, shade_constants); - // The optimizer will probably turn this into a memset call. - // Since dx is not likely to be large, I'm not sure that's a good thing, - // hence the alternatives above. - for (x = 0; x < dx; x++) - { - p[x] = color; - } - p += pitch; - v += vi; - dy--; - } - } - - FString DrawSlabRGBACommand::DebugInfo() - { - return "DrawSlab"; - } - - ///////////////////////////////////////////////////////////////////////////// - DrawFogBoundaryLineRGBACommand::DrawFogBoundaryLineRGBACommand(int y, int x, int x2) { using namespace drawerargs; diff --git a/src/swrenderer/drawers/r_draw_rgba.h b/src/swrenderer/drawers/r_draw_rgba.h index cd3bb7c1d2..bee96fd2fa 100644 --- a/src/swrenderer/drawers/r_draw_rgba.h +++ b/src/swrenderer/drawers/r_draw_rgba.h @@ -211,26 +211,6 @@ namespace swrenderer FString DebugInfo() override; }; - class DrawSlabRGBACommand : public DrawerCommand - { - int _dx; - fixed_t _v; - int _dy; - fixed_t _vi; - const uint8_t *_voxelptr; - uint32_t *_p; - ShadeConstants _shade_constants; - const uint8_t *_colormap; - fixed_t _light; - int _pitch; - int _start_y; - - public: - DrawSlabRGBACommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, ShadeConstants shade_constants, const uint8_t *colormap, fixed_t light); - void Execute(DrawerThread *thread) override; - FString DebugInfo() override; - }; - class DrawFogBoundaryLineRGBACommand : public DrawerCommand { int _y;