- with the new order of things we need the software renderer to be always available.

This commit is contained in:
Christoph Oelckers 2018-04-03 20:14:26 +02:00
parent 51bf2eb9fa
commit 9ba32cb994
12 changed files with 46 additions and 96 deletions

View file

@ -2274,6 +2274,39 @@ static void CheckCmdLine()
}
}
//==========================================================================
//
//
//
//==========================================================================
extern int currentrenderer;
EXTERN_CVAR(Int, vid_renderer)
FRenderer *gl_CreateInterface();
FRenderer *CreateSWRenderer();
static void DeleteRenderer()
{
if (Renderer != NULL) delete Renderer;
if (SWRenderer != NULL) delete SWRenderer;
}
void D_CreateRenderer()
{
currentrenderer = vid_renderer;
if (currentrenderer == 1)
Printf("Renderer: OpenGL\n");
else
Printf("Renderer: Software on OpenGL\n");
if (Renderer == NULL)
{
Renderer = gl_CreateInterface();
SWRenderer = CreateSWRenderer();
atterm(DeleteRenderer);
}
}
//==========================================================================
//
// D_DoomMain
@ -2458,7 +2491,7 @@ void D_DoomMain (void)
{
if (!batchrun) Printf ("I_Init: Setting up machine state.\n");
I_Init ();
I_CreateRenderer();
D_CreateRenderer();
}
if (!batchrun) Printf ("V_Init: allocate screen.\n");

View file

@ -36,9 +36,6 @@ extern int sys_ostype;
#include "version.h"
#include "v_video.h"
#ifdef _WIN32
EXTERN_CVAR(Bool, vid_glswfb)
#endif
extern int currentrenderer;
CVAR(Int, sys_statsenabled, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET)
CVAR(String, sys_statshost, "gzstats.drdteam.org", CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET)
@ -254,20 +251,10 @@ static int GetCoreInfo()
static int GetRenderInfo()
{
if (currentrenderer == 0)
{
#ifdef _WIN32
if (vid_glswfb) return 2;
#endif
return 1;
}
else
{
auto info = gl_getInfo();
if (info.first < 3.3) return 3; // Legacy OpenGL. Don't care about Intel HD 3000 on Windows being run in 'risky' mode.
if (!info.second) return 4;
return 5;
}
auto info = gl_getInfo();
if (info.first < 3.3) return 3; // Legacy OpenGL. Don't care about Intel HD 3000 on Windows being run in 'risky' mode.
if (!info.second) return 4;
return 5;
}
static void D_DoHTTPRequest(const char *request)

View file

@ -844,28 +844,6 @@ void I_InitGraphics()
}
static void I_DeleteRenderer()
{
delete Renderer;
Renderer = NULL;
}
void I_CreateRenderer()
{
currentrenderer = vid_renderer;
if (NULL == Renderer)
{
extern FRenderer* gl_CreateInterface();
Renderer = 1 == currentrenderer
? gl_CreateInterface()
: new FSoftwareRenderer;
atterm(I_DeleteRenderer);
}
}
DFrameBuffer* I_SetMode(int &width, int &height, DFrameBuffer* old)
{
return Video->CreateFrameBuffer(width, height, swtruecolor, fullscreen, old);

View file

@ -86,7 +86,6 @@ class IVideo
void I_InitGraphics ();
void I_ShutdownGraphics ();
void I_CreateRenderer();
extern Semaphore FPSLimitSemaphore;
void I_SetFPSLimit(int limit);

View file

@ -128,23 +128,6 @@ void I_InitGraphics ()
Video->SetWindowedScale (vid_winscale);
}
static void I_DeleteRenderer()
{
if (Renderer != NULL) delete Renderer;
}
void I_CreateRenderer()
{
currentrenderer = vid_renderer;
if (Renderer == NULL)
{
if (currentrenderer==1) Renderer = gl_CreateInterface();
else Renderer = new FSoftwareRenderer;
atterm(I_DeleteRenderer);
}
}
/** Remaining code is common to Win32 and Linux **/
// VIDEO WRAPPERS ---------------------------------------------------------

View file

@ -5,6 +5,8 @@
struct FRenderer;
extern FRenderer *Renderer;
extern FRenderer *SWRenderer;
class FSerializer;
class FTexture;
class AActor;
@ -15,16 +17,6 @@ class FileWriter;
struct FRenderer
{
FRenderer()
{
Renderer = this;
}
virtual ~FRenderer()
{
Renderer = NULL;
}
// precache one texture
virtual void Precache(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitlist) = 0;

View file

@ -85,10 +85,12 @@ FSoftwareRenderer::FSoftwareRenderer()
InitSWColorMaps();
}
FSoftwareRenderer::~FSoftwareRenderer()
FRenderer *CreateSWRenderer()
{
return new FSoftwareRenderer;
}
void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache)
{
bool isbgra = screen->IsBgra();

View file

@ -7,7 +7,6 @@
struct FSoftwareRenderer : public FRenderer
{
FSoftwareRenderer();
~FSoftwareRenderer();
// precache textures
void Precache(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitlist) override;
@ -34,3 +33,5 @@ private:
swrenderer::RenderScene mScene;
};
FRenderer *CreateSWRenderer();

View file

@ -109,6 +109,7 @@ EXTERN_CVAR(Bool, r_blendmethod)
int active_con_scale();
FRenderer *Renderer;
FRenderer *SWRenderer;
EXTERN_CVAR (Bool, swtruecolor)
EXTERN_CVAR (Bool, fullscreen)

View file

@ -180,27 +180,6 @@ void I_InitGraphics ()
Video->SetWindowedScale (vid_winscale);
}
static void I_DeleteRenderer()
{
if (Renderer != NULL) delete Renderer;
}
void I_CreateRenderer()
{
currentrenderer = vid_renderer;
if (currentrenderer == 1)
Printf("Renderer: OpenGL\n");
else
Printf("Renderer: Software on OpenGL\n");
if (Renderer == NULL)
{
if (currentrenderer==1) Renderer = gl_CreateInterface();
else Renderer = new FSoftwareRenderer;
atterm(I_DeleteRenderer);
}
}
/** Remaining code is common to Win32 and Linux **/
// VIDEO WRAPPERS ---------------------------------------------------------

View file

@ -57,7 +57,6 @@ class IVideo
void I_InitGraphics ();
void I_ShutdownGraphics ();
void I_CreateRenderer();
void I_SaveWindowedPos ();
void I_RestoreWindowedPos ();

View file

@ -1868,10 +1868,6 @@ OptionMenu RendererMenu protected
Option "$RNDMNU_RENDERER", "vid_renderer", "PolyDoom"
Option "$RNDMNU_TRUECOLOR", "swtruecolor", "OnOff"
Option "$RNDMNU_POLY", "r_polyrenderer", "OnOff"
IfOption(Windows)
{
Option "$RNDMNU_CANVAS", "vid_glswfb", "GLD3D"
}
}
/*=======================================