From d8a3174330b080b8b8bc2502d63ff300c79b95d7 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 5 Dec 2016 12:47:43 +0100 Subject: [PATCH] Thread awareness to the span drawers --- src/r_draw_pal.cpp | 21 +++++++++++++++++++++ src/r_thread.h | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/r_draw_pal.cpp b/src/r_draw_pal.cpp index ea1ae96b8..66b5dce06 100644 --- a/src/r_draw_pal.cpp +++ b/src/r_draw_pal.cpp @@ -1569,6 +1569,9 @@ namespace swrenderer void DrawSpanPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_dest_y)) + return; + dsfixed_t xfrac; dsfixed_t yfrac; dsfixed_t xstep; @@ -1630,6 +1633,9 @@ namespace swrenderer void DrawSpanMaskedPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_dest_y)) + return; + dsfixed_t xfrac; dsfixed_t yfrac; dsfixed_t xstep; @@ -1692,6 +1698,9 @@ namespace swrenderer void DrawSpanTranslucentPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_dest_y)) + return; + dsfixed_t xfrac; dsfixed_t yfrac; dsfixed_t xstep; @@ -1752,6 +1761,9 @@ namespace swrenderer void DrawSpanMaskedTranslucentPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_dest_y)) + return; + dsfixed_t xfrac; dsfixed_t yfrac; dsfixed_t xstep; @@ -1826,6 +1838,9 @@ namespace swrenderer void DrawSpanAddClampPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_dest_y)) + return; + dsfixed_t xfrac; dsfixed_t yfrac; dsfixed_t xstep; @@ -1892,6 +1907,9 @@ namespace swrenderer void DrawSpanMaskedAddClampPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_dest_y)) + return; + dsfixed_t xfrac; dsfixed_t yfrac; dsfixed_t xstep; @@ -1972,6 +1990,9 @@ namespace swrenderer void FillSpanPalCommand::Execute(DrawerThread *thread) { + if (thread->skipped_by_thread(_y)) + return; + memset(ylookup[_y] + _x1 + _destorg, _color, _x2 - _x1 + 1); } diff --git a/src/r_thread.h b/src/r_thread.h index 3077a095f..3217e1904 100644 --- a/src/r_thread.h +++ b/src/r_thread.h @@ -123,7 +123,10 @@ protected: public: DrawerCommand() { - _dest_y = static_cast((swrenderer::drawerargs::dc_dest - swrenderer::drawerargs::dc_destorg) / (swrenderer::drawerargs::dc_pitch * 4)); + if (swrenderer::r_swtruecolor) + _dest_y = static_cast((swrenderer::drawerargs::dc_dest - swrenderer::drawerargs::dc_destorg) / (swrenderer::drawerargs::dc_pitch * 4)); + else + _dest_y = static_cast((swrenderer::drawerargs::dc_dest - swrenderer::drawerargs::dc_destorg) / (swrenderer::drawerargs::dc_pitch)); } virtual ~DrawerCommand() { }