Move swrenderer into a namespace, add multithreading framework, and move drawers to commands

This commit is contained in:
Magnus Norddahl 2016-12-07 09:34:49 +01:00
commit 3ff91807b8
25 changed files with 5709 additions and 3226 deletions

View file

@ -58,6 +58,38 @@
#include "v_font.h"
#include "r_data/colormaps.h"
#include "p_maputl.h"
#include "r_thread.h"
CVAR (String, r_viewsize, "", CVAR_NOSET)
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
CUSTOM_CVAR (Int, r_columnmethod, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self != 0 && self != 1)
{
self = 1;
}
else
{ // Trigger the change
setsizeneeded = true;
}
}
CVAR(Int, r_portal_recursions, 4, CVAR_ARCHIVE)
CVAR(Bool, r_highlight_portals, false, CVAR_ARCHIVE)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
extern cycle_t FrameCycles;
extern bool r_showviewer;
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
namespace swrenderer
{
using namespace drawerargs;
// MACROS ------------------------------------------------------------------
@ -88,7 +120,6 @@ extern short *openings;
extern bool r_fakingunderwater;
extern "C" int fuzzviewheight;
extern subsector_t *InSubsector;
extern bool r_showviewer;
// PRIVATE DATA DECLARATIONS -----------------------------------------------
@ -100,9 +131,6 @@ bool r_dontmaplines;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
CVAR (String, r_viewsize, "", CVAR_NOSET)
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
double r_BaseVisibility;
double r_WallVisibility;
double r_FloorVisibility;
@ -157,8 +185,6 @@ void (*hcolfunc_post1) (int hx, int sx, int yl, int yh);
void (*hcolfunc_post2) (int hx, int sx, int yl, int yh);
void (*hcolfunc_post4) (int sx, int yl, int yh);
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
static int lastcenteryfrac;
@ -361,26 +387,6 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
R_SetVisibility(R_GetVisibility());
}
//==========================================================================
//
// CVAR r_columnmethod
//
// Selects which version of the seg renderers to use.
//
//==========================================================================
CUSTOM_CVAR (Int, r_columnmethod, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self != 0 && self != 1)
{
self = 1;
}
else
{ // Trigger the change
setsizeneeded = true;
}
}
//==========================================================================
//
// R_Init
@ -455,8 +461,6 @@ void R_CopyStackedViewParameters()
//
//==========================================================================
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
void R_SetupColormap(player_t *player)
{
realfixedcolormap = NULL;
@ -574,9 +578,6 @@ void R_SetupFreelook()
//
//==========================================================================
CVAR(Int, r_portal_recursions, 4, CVAR_ARCHIVE)
CVAR(Bool, r_highlight_portals, false, CVAR_ARCHIVE)
void R_HighlightPortal (PortalDrawseg* pds)
{
// [ZZ] NO OVERFLOW CHECKS HERE
@ -853,10 +854,10 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
// [RH] Show off segs if r_drawflat is 1
if (r_drawflat)
{
hcolfunc_pre = R_FillColumnHorizP;
hcolfunc_pre = R_FillColumnHoriz;
hcolfunc_post1 = rt_copy1col;
hcolfunc_post4 = rt_copy4cols;
colfunc = R_FillColumnP;
colfunc = R_FillColumn;
spanfunc = R_FillSpan;
}
else
@ -950,6 +951,8 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
{
const bool savedviewactive = viewactive;
R_BeginDrawerCommands();
viewwidth = width;
RenderTarget = canvas;
bRenderingToCanvas = true;
@ -961,6 +964,8 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
R_RenderActorView (actor, dontmaplines);
R_EndDrawerCommands();
RenderTarget = screen;
bRenderingToCanvas = false;
R_ExecuteSetViewSize ();
@ -991,8 +996,6 @@ void R_MultiresInit ()
// Displays statistics about rendering times
//
//==========================================================================
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
extern cycle_t FrameCycles;
ADD_STAT (fps)
{
@ -1072,3 +1075,5 @@ CCMD (clearscancycles)
bestscancycles = HUGE_VAL;
}
#endif
}