From 80f9c81e366caa227b84d0f9016d8e5301990b86 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 15 Mar 2017 02:59:33 +0100 Subject: [PATCH] - move PrepareTexture out of the inner drawer loops --- src/swrenderer/line/r_renderdrawsegment.cpp | 1 + src/swrenderer/plane/r_skyplane.cpp | 3 +++ src/swrenderer/things/r_decal.cpp | 1 + src/swrenderer/things/r_playersprite.cpp | 1 + src/swrenderer/things/r_sprite.cpp | 1 + src/swrenderer/things/r_wallsprite.cpp | 1 + src/swrenderer/viewport/r_skydrawer.cpp | 2 -- src/swrenderer/viewport/r_spritedrawer.cpp | 4 ---- 8 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/swrenderer/line/r_renderdrawsegment.cpp b/src/swrenderer/line/r_renderdrawsegment.cpp index b84568b2de..f1dc2973ea 100644 --- a/src/swrenderer/line/r_renderdrawsegment.cpp +++ b/src/swrenderer/line/r_renderdrawsegment.cpp @@ -292,6 +292,7 @@ namespace swrenderer // draw the columns one at a time if (visible) { + Thread->PrepareTexture(tex); for (int x = x1; x < x2; ++x) { if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0) diff --git a/src/swrenderer/plane/r_skyplane.cpp b/src/swrenderer/plane/r_skyplane.cpp index 40115a07df..613c1fbea8 100644 --- a/src/swrenderer/plane/r_skyplane.cpp +++ b/src/swrenderer/plane/r_skyplane.cpp @@ -163,6 +163,9 @@ namespace swrenderer drawerargs.SetLight(&NormalLight, 0, 0); } + Thread->PrepareTexture(frontskytex); + Thread->PrepareTexture(backskytex); + DrawSky(pl); } diff --git a/src/swrenderer/things/r_decal.cpp b/src/swrenderer/things/r_decal.cpp index 1dd37c55c1..50ef96f096 100644 --- a/src/swrenderer/things/r_decal.cpp +++ b/src/swrenderer/things/r_decal.cpp @@ -301,6 +301,7 @@ namespace swrenderer if (visible) { + thread->PrepareTexture(WallSpriteTile); while (x < x2) { if (calclighting) diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index daa8e7ea45..daa4ef5166 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -628,6 +628,7 @@ namespace swrenderer short *mceilingclip = zeroarray; fixed_t frac = startfrac; + thread->PrepareTexture(pic); for (int x = x1; x < x2; x++) { drawerargs.DrawMaskedColumn(thread, x, iscale, pic, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false); diff --git a/src/swrenderer/things/r_sprite.cpp b/src/swrenderer/things/r_sprite.cpp index ca68803e11..b18df3b693 100644 --- a/src/swrenderer/things/r_sprite.cpp +++ b/src/swrenderer/things/r_sprite.cpp @@ -343,6 +343,7 @@ namespace swrenderer { RenderTranslucentPass *translucentPass = thread->TranslucentPass.get(); + thread->PrepareTexture(tex); while (x < x2) { if (!translucentPass->ClipSpriteColumnWithPortals(x, vis)) diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index 15757bc862..67c66ede99 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -232,6 +232,7 @@ namespace swrenderer { RenderTranslucentPass *translucentPass = thread->TranslucentPass.get(); + thread->PrepareTexture(WallSpriteTile); while (x < x2) { if (calclighting) diff --git a/src/swrenderer/viewport/r_skydrawer.cpp b/src/swrenderer/viewport/r_skydrawer.cpp index e2ce020e07..3fd6bb3ff2 100644 --- a/src/swrenderer/viewport/r_skydrawer.cpp +++ b/src/swrenderer/viewport/r_skydrawer.cpp @@ -36,7 +36,6 @@ namespace swrenderer void SkyDrawerArgs::SetFrontTexture(RenderThread *thread, FTexture *texture, uint32_t column) { - thread->PrepareTexture(texture); if (thread->Viewport->RenderTarget->IsBgra()) { dc_source = (const uint8_t *)texture->GetColumnBgra(column, nullptr); @@ -51,7 +50,6 @@ namespace swrenderer void SkyDrawerArgs::SetBackTexture(RenderThread *thread, FTexture *texture, uint32_t column) { - thread->PrepareTexture(texture); if (texture == nullptr) { dc_source2 = nullptr; diff --git a/src/swrenderer/viewport/r_spritedrawer.cpp b/src/swrenderer/viewport/r_spritedrawer.cpp index 6226c9696a..67f203a3c2 100644 --- a/src/swrenderer/viewport/r_spritedrawer.cpp +++ b/src/swrenderer/viewport/r_spritedrawer.cpp @@ -62,8 +62,6 @@ namespace swrenderer dc_iscale = iscale; dc_textureheight = tex->GetHeight(); - thread->PrepareTexture(tex); - const FTexture::Span *span; const uint8_t *column; if (viewport->RenderTarget->IsBgra() && !drawer_needs_pal_input) @@ -134,8 +132,6 @@ namespace swrenderer dc_x = x; dc_iscale = iscale; - thread->PrepareTexture(tex); - // Normalize to 0-1 range: double uv_stepd = FIXED2DBL(dc_iscale); double v_step = uv_stepd / tex->GetHeight();