From 218708571e053cd98931c20738a58b385f96d7d0 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 24 Feb 2017 04:03:27 +0100 Subject: [PATCH] Don't copy the SkyDrawerArgs members now that drawer args are grouped by drawer family --- src/swrenderer/drawers/r_draw_pal.cpp | 64 ++++++++++++--------------- src/swrenderer/drawers/r_draw_pal.h | 13 +----- 2 files changed, 30 insertions(+), 47 deletions(-) diff --git a/src/swrenderer/drawers/r_draw_pal.cpp b/src/swrenderer/drawers/r_draw_pal.cpp index 18a87b5e6..369876a98 100644 --- a/src/swrenderer/drawers/r_draw_pal.cpp +++ b/src/swrenderer/drawers/r_draw_pal.cpp @@ -547,32 +547,20 @@ namespace swrenderer ///////////////////////////////////////////////////////////////////////// - PalSkyCommand::PalSkyCommand(const SkyDrawerArgs &args) + PalSkyCommand::PalSkyCommand(const SkyDrawerArgs &args) : args(args) { - _dest = args.Dest(); - _dest_y = args.DestY(); - _count = args.Count(); - _source = args.FrontTexturePixels(); - _source2 = args.BackTexturePixels(); - _sourceheight[0] = args.FrontTextureHeight(); - _sourceheight[1] = args.BackTextureHeight(); - _iscale = args.TextureVStep(); - _texturefrac = args.TextureVPos(); - solid_top = args.SolidTopColor(); - solid_bottom = args.SolidBottomColor(); - fadeSky = args.FadeSky(); } void DrawSingleSky1PalCommand::Execute(DrawerThread *thread) { - uint8_t *dest = _dest; - int count = _count; + uint8_t *dest = args.Dest(); + int count = args.Count(); int pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); - const uint8_t *source0 = _source; - int textureheight0 = _sourceheight[0]; + const uint8_t *source0 = args.FrontTexturePixels(); + int textureheight0 = args.FrontTextureHeight(); - int32_t frac = _texturefrac; - int32_t fracstep = _iscale; + int32_t frac = args.TextureVPos(); + int32_t fracstep = args.TextureVStep(); // Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color: int start_fade = 2; // How fast it should fade out @@ -587,15 +575,15 @@ namespace swrenderer end_fadebottom_y = clamp(end_fadebottom_y, 0, count); int num_cores = thread->num_cores; - int skipped = thread->skipped_by_thread(_dest_y); - dest = thread->dest_for_thread(_dest_y, pitch, dest); + int skipped = thread->skipped_by_thread(args.DestY()); + dest = thread->dest_for_thread(args.DestY(), pitch, dest); frac += fracstep * skipped; fracstep *= num_cores; pitch *= num_cores; - if (!fadeSky) + if (!args.FadeSky()) { - count = thread->count_for_thread(_dest_y, count); + count = thread->count_for_thread(args.DestY(), count); for (int index = 0; index < count; index++) { @@ -608,6 +596,9 @@ namespace swrenderer return; } + uint32_t solid_top = args.SolidTopColor(); + uint32_t solid_bottom = args.SolidBottomColor(); + int solid_top_r = RPART(solid_top); int solid_top_g = GPART(solid_top); int solid_top_b = BPART(solid_top); @@ -696,16 +687,16 @@ namespace swrenderer void DrawDoubleSky1PalCommand::Execute(DrawerThread *thread) { - uint8_t *dest = _dest; - int count = _count; + uint8_t *dest = args.Dest(); + int count = args.Count(); int pitch = RenderViewport::Instance()->RenderTarget->GetPitch(); - const uint8_t *source0 = _source; - const uint8_t *source1 = _source2; - int textureheight0 = _sourceheight[0]; - uint32_t maxtextureheight1 = _sourceheight[1] - 1; + const uint8_t *source0 = args.FrontTexturePixels(); + const uint8_t *source1 = args.BackTexturePixels(); + int textureheight0 = args.FrontTextureHeight(); + uint32_t maxtextureheight1 = args.BackTextureHeight() - 1; - int32_t frac = _texturefrac; - int32_t fracstep = _iscale; + int32_t frac = args.TextureVPos(); + int32_t fracstep = args.TextureVStep(); // Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color: int start_fade = 2; // How fast it should fade out @@ -720,15 +711,15 @@ namespace swrenderer end_fadebottom_y = clamp(end_fadebottom_y, 0, count); int num_cores = thread->num_cores; - int skipped = thread->skipped_by_thread(_dest_y); - dest = thread->dest_for_thread(_dest_y, pitch, dest); + int skipped = thread->skipped_by_thread(args.DestY()); + dest = thread->dest_for_thread(args.DestY(), pitch, dest); frac += fracstep * skipped; fracstep *= num_cores; pitch *= num_cores; - if (!fadeSky) + if (!args.FadeSky()) { - count = thread->count_for_thread(_dest_y, count); + count = thread->count_for_thread(args.DestY(), count); for (int index = 0; index < count; index++) { @@ -748,6 +739,9 @@ namespace swrenderer return; } + uint32_t solid_top = args.SolidTopColor(); + uint32_t solid_bottom = args.SolidBottomColor(); + int solid_top_r = RPART(solid_top); int solid_top_g = GPART(solid_top); int solid_top_b = BPART(solid_top); diff --git a/src/swrenderer/drawers/r_draw_pal.h b/src/swrenderer/drawers/r_draw_pal.h index 4acbc8dbe..ed5bbff90 100644 --- a/src/swrenderer/drawers/r_draw_pal.h +++ b/src/swrenderer/drawers/r_draw_pal.h @@ -37,18 +37,7 @@ namespace swrenderer FString DebugInfo() override { return "PalSkyCommand"; } protected: - uint32_t solid_top; - uint32_t solid_bottom; - bool fadeSky; - - uint8_t *_dest; - int _dest_y; - int _count; - const uint8_t *_source; - const uint8_t *_source2; - int _sourceheight[2]; - uint32_t _iscale; - uint32_t _texturefrac; + SkyDrawerArgs args; }; class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; };