diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e62f4d4125..d026730480 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1046,6 +1046,8 @@ set( FASTMATH_PCH_SOURCES r_3dfloors.cpp r_bsp.cpp r_draw_tc.cpp + r_draw_pal.cpp + r_drawt_pal.cpp r_draw_rgba.cpp r_drawt_rgba.cpp r_drawers.cpp diff --git a/src/r_draw_pal.cpp b/src/r_draw_pal.cpp new file mode 100644 index 0000000000..b3ed97dfb0 --- /dev/null +++ b/src/r_draw_pal.cpp @@ -0,0 +1,221 @@ + +#include "templates.h" +#include "doomtype.h" +#include "doomdef.h" +#include "r_defs.h" +#include "r_draw.h" +#include "r_main.h" +#include "r_things.h" +#include "v_video.h" +#include "r_draw_pal.h" + +namespace swrenderer +{ + PalWall1Command::PalWall1Command() + { + } + + PalWall4Command::PalWall4Command() + { + } + + void DrawWall1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWall4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallMasked1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallMasked4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallAdd1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallAdd4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallAddClamp1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallAddClamp4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallSubClamp1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallSubClamp4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallRevSubClamp1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawWallRevSubClamp4PalCommand::Execute(DrawerThread *thread) + { + } + + PalSkyCommand::PalSkyCommand(uint32_t solid_top, uint32_t solid_bottom) + { + } + + void DrawSingleSky1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSingleSky4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawDoubleSky1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawDoubleSky4PalCommand::Execute(DrawerThread *thread) + { + } + + PalColumnCommand::PalColumnCommand() + { + } + + void DrawColumnPalCommand::Execute(DrawerThread *thread) + { + } + + void FillColumnPalCommand::Execute(DrawerThread *thread) + { + } + + void FillColumnAddPalCommand::Execute(DrawerThread *thread) + { + } + + void FillColumnAddClampPalCommand::Execute(DrawerThread *thread) + { + } + + void FillColumnSubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void FillColumnRevSubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnAddPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnTlatedAddPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnShadedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnAddClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnAddClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnSubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnSubClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRevSubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRevSubClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawFuzzColumnPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSpanPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSpanMaskedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSpanTranslucentPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSpanMaskedTranslucentPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSpanAddClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawSpanMaskedAddClampPalCommand::Execute(DrawerThread *thread) + { + } + + void FillSpanPalCommand::Execute(DrawerThread *thread) + { + } + + DrawTiltedSpanPalCommand::DrawTiltedSpanPalCommand(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 DrawTiltedSpanPalCommand::Execute(DrawerThread *thread) + { + } + + DrawColoredSpanPalCommand::DrawColoredSpanPalCommand(int y, int x1, int x2) + { + } + + void DrawColoredSpanPalCommand::Execute(DrawerThread *thread) + { + } + + DrawSlabPalCommand::DrawSlabPalCommand(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p, const uint8_t *colormap) + { + } + + void DrawSlabPalCommand::Execute(DrawerThread *thread) + { + } + + DrawFogBoundaryLinePalCommand::DrawFogBoundaryLinePalCommand(int y, int y2, int x1) + { + } + + void DrawFogBoundaryLinePalCommand::Execute(DrawerThread *thread) + { + } +} diff --git a/src/r_draw_pal.h b/src/r_draw_pal.h new file mode 100644 index 0000000000..3d540f8c60 --- /dev/null +++ b/src/r_draw_pal.h @@ -0,0 +1,163 @@ + +#pragma once + +#include "r_draw.h" +#include "v_palette.h" +#include "r_thread.h" + +namespace swrenderer +{ + class PalWall1Command : public DrawerCommand + { + public: + PalWall1Command(); + FString DebugInfo() override { return "PalWallCommand"; } + }; + + class PalWall4Command : public DrawerCommand + { + public: + PalWall4Command(); + FString DebugInfo() override { return "PalWallCommand"; } + }; + + class DrawWall1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWall4PalCommand : public PalWall4Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallMasked1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallMasked4PalCommand : public PalWall4Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallAdd1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallAdd4PalCommand : public PalWall4Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallAddClamp1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallAddClamp4PalCommand : public PalWall4Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallSubClamp1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallSubClamp4PalCommand : public PalWall4Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallRevSubClamp1PalCommand : public PalWall1Command { public: void Execute(DrawerThread *thread) override; }; + class DrawWallRevSubClamp4PalCommand : public PalWall4Command { public: void Execute(DrawerThread *thread) override; }; + + class PalSkyCommand : public DrawerCommand + { + public: + PalSkyCommand(uint32_t solid_top, uint32_t solid_bottom); + FString DebugInfo() override { return "PalSkyCommand"; } + }; + + class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; }; + class DrawSingleSky4PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; }; + class DrawDoubleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; }; + class DrawDoubleSky4PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; }; + + class PalColumnCommand : public DrawerCommand + { + public: + PalColumnCommand(); + FString DebugInfo() override { return "PalColumnCommand"; } + }; + + class DrawColumnPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class FillColumnPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class FillColumnAddPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class FillColumnAddClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class FillColumnSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class FillColumnRevSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnAddPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnTlatedAddPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnShadedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnAddClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnAddClampTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnSubClampTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnRevSubClampPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawColumnRevSubClampTranslatedPalCommand : public PalColumnCommand { public: void Execute(DrawerThread *thread) override; }; + + class DrawFuzzColumnPalCommand : public DrawerCommand + { + public: + void Execute(DrawerThread *thread) override; + FString DebugInfo() override { return "DrawFuzzColumnPalCommand"; } + }; + + class PalSpanCommand : public DrawerCommand + { + public: + FString DebugInfo() override { return "PalSpanCommand"; } + }; + + class DrawSpanPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawSpanMaskedPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawSpanTranslucentPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawSpanMaskedTranslucentPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawSpanAddClampPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + class DrawSpanMaskedAddClampPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + class FillSpanPalCommand : public PalSpanCommand { public: void Execute(DrawerThread *thread) override; }; + + class DrawTiltedSpanPalCommand : public DrawerCommand + { + public: + DrawTiltedSpanPalCommand(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 Execute(DrawerThread *thread) override; + FString DebugInfo() override { return "DrawTiltedSpanPalCommand"; } + }; + + class DrawColoredSpanPalCommand : public PalSpanCommand + { + public: + DrawColoredSpanPalCommand(int y, int x1, int x2); + void Execute(DrawerThread *thread) override; + FString DebugInfo() override { return "DrawColoredSpanPalCommand"; } + }; + + 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; + }; + + class DrawFogBoundaryLinePalCommand : public PalSpanCommand + { + public: + DrawFogBoundaryLinePalCommand(int y, int y2, int x1); + void Execute(DrawerThread *thread) override; + }; + + //class RtInitColsPalCommand : public DrawerCommand { public: void Execute(DrawerThread *thread) override; }; + //class DrawColumnHorizPalCommand : public DrawerCommand { public: void Execute(DrawerThread *thread) override; }; + class FillColumnHorizPalCommand : public DrawerCommand + { + public: + void Execute(DrawerThread *thread) override; + FString DebugInfo() override { return "FillColumnHorizPalCommand"; } + }; + + class PalRtCommand : public DrawerCommand + { + public: + PalRtCommand(int hx, int sx, int yl, int yh); + FString DebugInfo() override { return "PalRtCommand"; } + }; + + class DrawColumnRt1CopyPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1PalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4PalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1TranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4TranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1AddPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4AddPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1AddTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4AddTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1ShadedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4ShadedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1AddClampPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4AddClampPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1AddClampTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4AddClampTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1SubClampPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4SubClampPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1SubClampTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4SubClampTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1RevSubClampPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4RevSubClampPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt1RevSubClampTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; + class DrawColumnRt4RevSubClampTranslatedPalCommand : public PalRtCommand { public: using PalRtCommand::PalRtCommand; void Execute(DrawerThread *thread) override; }; +} diff --git a/src/r_draw_tc.cpp b/src/r_draw_tc.cpp index a531d4aa9c..2326cab91e 100644 --- a/src/r_draw_tc.cpp +++ b/src/r_draw_tc.cpp @@ -17,6 +17,7 @@ #include "r_plane.h" #include "r_draw_tc.h" #include "r_draw_rgba.h" +#include "r_draw_pal.h" #include "r_thread.h" namespace swrenderer @@ -841,7 +842,10 @@ namespace swrenderer (*span)[1] = dc_yh; *span += 2; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawColumnHoriz() @@ -857,7 +861,7 @@ namespace swrenderer (*span)[1] = dc_yh; *span += 2; - if (drawer_needs_pal_input) + if (drawer_needs_pal_input || !r_swtruecolor) DrawerCommandQueue::QueueCommand>(); else DrawerCommandQueue::QueueCommand>(); @@ -866,7 +870,10 @@ namespace swrenderer // Copies one span at hx to the screen at sx. void rt_copy1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Copies all four spans to the screen starting at sx. @@ -882,140 +889,210 @@ namespace swrenderer // Maps one span at hx to the screen at sx. void rt_map1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Maps all four spans to the screen starting at sx. void rt_map4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Translates one span at hx to the screen at sx. void rt_tlate1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Translates all four spans to the screen starting at sx. void rt_tlate4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Adds one span at hx to the screen at sx without clamping. void rt_add1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Adds all four spans to the screen starting at sx without clamping. void rt_add4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Translates and adds one span at hx to the screen at sx without clamping. void rt_tlateadd1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Translates and adds all four spans to the screen starting at sx without clamping. void rt_tlateadd4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Shades one span at hx to the screen at sx. void rt_shaded1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Shades all four spans to the screen starting at sx. void rt_shaded4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Adds one span at hx to the screen at sx with clamping. void rt_addclamp1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Adds all four spans to the screen starting at sx with clamping. void rt_addclamp4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Translates and adds one span at hx to the screen at sx with clamping. void rt_tlateaddclamp1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Translates and adds all four spans to the screen starting at sx with clamping. void rt_tlateaddclamp4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Subtracts one span at hx to the screen at sx with clamping. void rt_subclamp1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Subtracts all four spans to the screen starting at sx with clamping. void rt_subclamp4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Translates and subtracts one span at hx to the screen at sx with clamping. void rt_tlatesubclamp1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Translates and subtracts all four spans to the screen starting at sx with clamping. void rt_tlatesubclamp4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Subtracts one span at hx from the screen at sx with clamping. void rt_revsubclamp1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Subtracts all four spans from the screen starting at sx with clamping. void rt_revsubclamp4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } // Translates and subtracts one span at hx from the screen at sx with clamping. void rt_tlaterevsubclamp1col(int hx, int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(hx, sx, yl, yh); } // Translates and subtracts all four spans from the screen starting at sx with clamping. void rt_tlaterevsubclamp4cols(int sx, int yl, int yh) { - DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); + else + DrawerCommandQueue::QueueCommand(0, sx, yl, yh); } uint32_t vlinec1() { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + return dc_texturefrac + dc_count * dc_iscale; } @@ -1023,7 +1100,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + for (int i = 0; i < 4; i++) vplce[i] += vince[i] * dc_count; } @@ -1032,7 +1113,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + return dc_texturefrac + dc_count * dc_iscale; } @@ -1040,7 +1125,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + for (int i = 0; i < 4; i++) vplce[i] += vince[i] * dc_count; } @@ -1049,7 +1138,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + return dc_texturefrac + dc_count * dc_iscale; } @@ -1057,7 +1150,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + for (int i = 0; i < 4; i++) vplce[i] += vince[i] * dc_count; } @@ -1066,7 +1163,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + return dc_texturefrac + dc_count * dc_iscale; } @@ -1074,7 +1175,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + for (int i = 0; i < 4; i++) vplce[i] += vince[i] * dc_count; } @@ -1083,7 +1188,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + return dc_texturefrac + dc_count * dc_iscale; } @@ -1091,7 +1200,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + for (int i = 0; i < 4; i++) vplce[i] += vince[i] * dc_count; } @@ -1100,7 +1213,11 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + return dc_texturefrac + dc_count * dc_iscale; } @@ -1108,66 +1225,103 @@ namespace swrenderer { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); + for (int i = 0; i < 4; i++) vplce[i] += vince[i] * dc_count; } void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom) { - DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + else + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); } void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom) { - DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + else + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); } void R_DrawDoubleSkyCol1(uint32_t solid_top, uint32_t solid_bottom) { - DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + else + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); } void R_DrawDoubleSkyCol4(uint32_t solid_top, uint32_t solid_bottom) { - DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); + else + DrawerCommandQueue::QueueCommand(solid_top, solid_bottom); } void R_DrawColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_FillColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_FillAddColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_FillAddClampColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_FillSubClampColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_FillRevSubClampColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawFuzzColumn() { using namespace drawerargs; - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); dc_yl = MAX(dc_yl, 1); dc_yh = MIN(dc_yh, fuzzviewheight); @@ -1177,97 +1331,154 @@ namespace swrenderer void R_DrawAddColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawTranslatedColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawTlatedAddColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawShadedColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawAddClampColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawAddClampTranslatedColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSubClampColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSubClampTranslatedColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawRevSubClampColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawRevSubClampTranslatedColumn() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSpan() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSpanMasked() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSpanTranslucent() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSpanMaskedTranslucent() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSpanAddClamp() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_DrawSpanMaskedAddClamp() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } void R_FillSpan() { - DrawerCommandQueue::QueueCommand(); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(); + else + DrawerCommandQueue::QueueCommand(); } 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) { - DrawerCommandQueue::QueueCommand(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy); + else + DrawerCommandQueue::QueueCommand(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy); } void R_DrawColoredSpan(int y, int x1, int x2) { - DrawerCommandQueue::QueueCommand(y, x1, x2); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(y, x1, x2); + else + DrawerCommandQueue::QueueCommand(y, x1, x2); } namespace @@ -1295,7 +1506,10 @@ namespace swrenderer void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p) { - DrawerCommandQueue::QueueCommand(dx, v, dy, vi, vptr, p, slab_rgba_shade_constants, slab_rgba_colormap, slab_rgba_light); + 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) @@ -1303,7 +1517,10 @@ namespace swrenderer for (; y < y2; ++y) { int x2 = spanend[y]; - DrawerCommandQueue::QueueCommand(y, x1, x2); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(y, x1, x2); + else + DrawerCommandQueue::QueueCommand(y, x1, x2); } } @@ -1365,13 +1582,19 @@ namespace swrenderer while (t2 < stop) { int y = t2++; - DrawerCommandQueue::QueueCommand(y, xr, spanend[y]); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(y, xr, spanend[y]); + else + DrawerCommandQueue::QueueCommand(y, xr, spanend[y]); } stop = MAX(b1, t2); while (b2 > stop) { int y = --b2; - DrawerCommandQueue::QueueCommand(y, xr, spanend[y]); + if (r_swtruecolor) + DrawerCommandQueue::QueueCommand(y, xr, spanend[y]); + else + DrawerCommandQueue::QueueCommand(y, xr, spanend[y]); } } else diff --git a/src/r_drawt_pal.cpp b/src/r_drawt_pal.cpp new file mode 100644 index 0000000000..b35046285f --- /dev/null +++ b/src/r_drawt_pal.cpp @@ -0,0 +1,113 @@ + +#include "templates.h" +#include "doomtype.h" +#include "doomdef.h" +#include "r_defs.h" +#include "r_draw.h" +#include "r_main.h" +#include "r_things.h" +#include "v_video.h" +#include "r_draw_pal.h" + +namespace swrenderer +{ + PalRtCommand::PalRtCommand(int hx, int sx, int yl, int yh) + { + } + + void FillColumnHorizPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1CopyPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4PalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1TranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4TranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1AddPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4AddPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1AddTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4AddTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1ShadedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4ShadedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1AddClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4AddClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1AddClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4AddClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1SubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4SubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1SubClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4SubClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1RevSubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4RevSubClampPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt1RevSubClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } + + void DrawColumnRt4RevSubClampTranslatedPalCommand::Execute(DrawerThread *thread) + { + } +} diff --git a/src/r_things.cpp b/src/r_things.cpp index 6869e83415..57e101feb2 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -2800,6 +2800,8 @@ void R_DrawParticle_C (vissprite_t *vis) R_DrawMaskedSegsBehindParticle (vis); + DrawerCommandQueue::WaitForWorkers(); + // vis->renderflags holds translucency level (0-255) { fixed_t fglevel, bglevel;