- merged vid_renderer, swtruecolor and r_polyrender into one CVAR to reduce menu clutter.

- with renderers freely switchable, some shortcuts in the 3D floor code had to be removed, because now the hardware renderer can get FF_THISINSIDE-flagged 3D floors.
- changed handling of attenuated lights in the legacy renderer to be adjusted when being rendered instead of when being spawned. For the software renderer the light needs to retain its original values.
This commit is contained in:
Christoph Oelckers 2018-04-07 23:30:28 +02:00
parent fde87c40d2
commit df4f435952
32 changed files with 95 additions and 213 deletions

View file

@ -2132,7 +2132,7 @@ void AM_drawSubsectors()
{ {
F3DFloor *rover = sec->e->XFloor.ffloors[i]; F3DFloor *rover = sec->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (rover->flags & FF_FOG) continue; if (rover->flags & (FF_FOG|FF_THISINSIDE)) continue;
if (!(rover->flags & FF_RENDERPLANES)) continue; if (!(rover->flags & FF_RENDERPLANES)) continue;
if (rover->alpha == 0) continue; if (rover->alpha == 0) continue;
double roverz = rover->top.plane->ZatPoint(secx, secy); double roverz = rover->top.plane->ZatPoint(secx, secy);
@ -2339,6 +2339,7 @@ bool AM_Check3DFloors(line_t *line)
for(unsigned i=0;i<ff_front.Size();i++) for(unsigned i=0;i<ff_front.Size();i++)
{ {
F3DFloor *rover = ff_front[i]; F3DFloor *rover = ff_front[i];
if (rover->flags & FF_THISINSIDE) continue;
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (rover->alpha == 0) continue; if (rover->alpha == 0) continue;
realfrontcount++; realfrontcount++;
@ -2347,6 +2348,7 @@ bool AM_Check3DFloors(line_t *line)
for(unsigned i=0;i<ff_back.Size();i++) for(unsigned i=0;i<ff_back.Size();i++)
{ {
F3DFloor *rover = ff_back[i]; F3DFloor *rover = ff_back[i];
if (rover->flags & FF_THISINSIDE) continue;
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (rover->alpha == 0) continue; if (rover->alpha == 0) continue;
realbackcount++; realbackcount++;
@ -2357,6 +2359,7 @@ bool AM_Check3DFloors(line_t *line)
for(unsigned i=0;i<ff_front.Size();i++) for(unsigned i=0;i<ff_front.Size();i++)
{ {
F3DFloor *rover = ff_front[i]; F3DFloor *rover = ff_front[i];
if (rover->flags & FF_THISINSIDE) continue; // only relevant for software rendering.
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (rover->alpha == 0) continue; if (rover->alpha == 0) continue;
@ -2364,6 +2367,7 @@ bool AM_Check3DFloors(line_t *line)
for(unsigned j=0;j<ff_back.Size();j++) for(unsigned j=0;j<ff_back.Size();j++)
{ {
F3DFloor *rover2 = ff_back[j]; F3DFloor *rover2 = ff_back[j];
if (rover2->flags & FF_THISINSIDE) continue; // only relevant for software rendering.
if (!(rover2->flags & FF_EXISTS)) continue; if (!(rover2->flags & FF_EXISTS)) continue;
if (rover2->alpha == 0) continue; if (rover2->alpha == 0) continue;
if (rover->model == rover2->model && rover->flags == rover2->flags) if (rover->model == rover2->model && rover->flags == rover2->flags)

View file

@ -703,13 +703,6 @@ void D_Display ()
// [RH] change the screen mode if needed // [RH] change the screen mode if needed
if (setmodeneeded) if (setmodeneeded)
{ {
int oldrenderer;
extern int currentrenderer;
EXTERN_CVAR(Int, vid_renderer)
oldrenderer = vid_renderer; // [SP] Save pending vid_renderer setting (hack)
if (currentrenderer != vid_renderer)
vid_renderer = currentrenderer;
// Change screen mode. // Change screen mode.
if (Video->SetResolution (NewWidth, NewHeight, NewBits)) if (Video->SetResolution (NewWidth, NewHeight, NewBits))
{ {
@ -728,7 +721,6 @@ void D_Display ()
// Reset the mouse cursor in case the bit depth changed // Reset the mouse cursor in case the bit depth changed
vid_cursor.Callback(); vid_cursor.Callback();
} }
vid_renderer = oldrenderer; // [SP] Restore pending vid_renderer setting
} }
// change the view size if needed // change the view size if needed

View file

@ -36,7 +36,6 @@ extern int sys_ostype;
#include "version.h" #include "version.h"
#include "v_video.h" #include "v_video.h"
extern int currentrenderer;
CVAR(Int, sys_statsenabled, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET) CVAR(Int, sys_statsenabled, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOSET)
CVAR(String, sys_statshost, "gzstats.drdteam.org", CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET) CVAR(String, sys_statshost, "gzstats.drdteam.org", CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET)
CVAR(Int, sys_statsport, 80, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET) CVAR(Int, sys_statsport, 80, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOSET)
@ -261,14 +260,7 @@ static void D_DoHTTPRequest(const char *request)
{ {
if (I_HTTPRequest(request)) if (I_HTTPRequest(request))
{ {
if (currentrenderer == 0) cvar_forceset("sentstats_hwr_done", CHECKVERSIONSTR);
{
cvar_forceset("sentstats_swr_done", CHECKVERSIONSTR);
}
else
{
cvar_forceset("sentstats_hwr_done", CHECKVERSIONSTR);
}
} }
} }
@ -284,12 +276,11 @@ void D_DoAnonStats()
done = true; done = true;
// Do not repeat if already sent. // Do not repeat if already sent.
if (currentrenderer == 0 && sentstats_swr_done >= CHECKVERSION) return; if (sentstats_hwr_done >= CHECKVERSION) return;
if (currentrenderer == 1 && sentstats_hwr_done >= CHECKVERSION) return;
static char requeststring[1024]; static char requeststring[1024];
mysnprintf(requeststring, sizeof requeststring, "GET /stats.py?render=%i&cores=%i&os=%i&renderconfig=%i HTTP/1.1\nHost: %s\nConnection: close\nUser-Agent: %s %s\n\n", mysnprintf(requeststring, sizeof requeststring, "GET /stats.py?render=%i&cores=%i&os=%i&renderconfig=%i HTTP/1.1\nHost: %s\nConnection: close\nUser-Agent: %s %s\n\n",
GetRenderInfo(), GetCoreInfo(), GetOSVersion(), currentrenderer, sys_statshost.GetHumanString(), GAMENAME, VERSIONSTR); GetRenderInfo(), GetCoreInfo(), GetOSVersion(), V_IsHardwareRenderer(), sys_statshost.GetHumanString(), GAMENAME, VERSIONSTR);
DPrintf(DMSG_NOTIFY, "Sending %s", requeststring); DPrintf(DMSG_NOTIFY, "Sending %s", requeststring);
std::thread t1(D_DoHTTPRequest, requeststring); std::thread t1(D_DoHTTPRequest, requeststring);
t1.detach(); t1.detach();

View file

@ -76,8 +76,6 @@
#include "gl/system//gl_interface.h" #include "gl/system//gl_interface.h"
#include "vm.h" #include "vm.h"
extern int currentrenderer;
CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{ {
@ -181,12 +179,6 @@ void ADynamicLight::BeginPlay()
specialf1 = DAngle(double(SpawnAngle)).Normalized360().Degrees; specialf1 = DAngle(double(SpawnAngle)).Normalized360().Degrees;
visibletoplayer = true; visibletoplayer = true;
if (currentrenderer == 1 && gl.legacyMode && (lightflags & LF_ATTENUATE))
{
args[LIGHT_INTENSITY] = args[LIGHT_INTENSITY] * 2 / 3;
args[LIGHT_SECONDARY_INTENSITY] = args[LIGHT_SECONDARY_INTENSITY] * 2 / 3;
}
} }
//========================================================================== //==========================================================================

View file

@ -406,6 +406,12 @@ bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, FVector3 & nearP
float dist = fabsf(p.DistToPoint(lpos.X, lpos.Z, lpos.Y)); float dist = fabsf(p.DistToPoint(lpos.X, lpos.Z, lpos.Y));
float radius = light->GetRadius(); float radius = light->GetRadius();
if (V_IsHardwareRenderer() && gl.legacyMode && (light->lightflags & LF_ATTENUATE))
{
radius *= 0.66f;
}
if (radius <= 0.f) return false; if (radius <= 0.f) return false;
if (dist > radius) return false; if (dist > radius) return false;
if (checkside && gl_lights_checkside && p.PointOnSide(lpos.X, lpos.Z, lpos.Y)) if (checkside && gl_lights_checkside && p.PointOnSide(lpos.X, lpos.Z, lpos.Y))

View file

@ -298,7 +298,7 @@ static F3DFloor *Find3DFloor(sector_t *target, sector_t *model)
for(unsigned i=0; i<target->e->XFloor.ffloors.Size(); i++) for(unsigned i=0; i<target->e->XFloor.ffloors.Size(); i++)
{ {
F3DFloor *ffloor = target->e->XFloor.ffloors[i]; F3DFloor *ffloor = target->e->XFloor.ffloors[i];
if (ffloor->model == model) return ffloor; if (ffloor->model == model && !(ffloor->flags & FF_THISINSIDE)) return ffloor;
} }
return NULL; return NULL;
} }

View file

@ -77,7 +77,6 @@
EXTERN_CVAR(Int, screenblocks) EXTERN_CVAR(Int, screenblocks)
EXTERN_CVAR(Bool, cl_capfps) EXTERN_CVAR(Bool, cl_capfps)
EXTERN_CVAR(Float, underwater_fade_scalar) EXTERN_CVAR(Float, underwater_fade_scalar)
EXTERN_CVAR(Bool, swtruecolor)
CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE);
extern bool NoInterpolateView; extern bool NoInterpolateView;
@ -427,14 +426,13 @@ void FGLRenderer::EndOffscreen()
// renders the view // renders the view
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern int currentrenderer;
void FGLRenderer::RenderView(player_t* player) void FGLRenderer::RenderView(player_t* player)
{ {
gl_RenderState.SetVertexBuffer(mVBO); gl_RenderState.SetVertexBuffer(mVBO);
mVBO->Reset(); mVBO->Reset();
if (currentrenderer == 0) if (!V_IsHardwareRenderer())
{ {
if (swdrawer == nullptr) swdrawer = new SWSceneDrawer; if (swdrawer == nullptr) swdrawer = new SWSceneDrawer;
swdrawer->RenderView(player); swdrawer->RenderView(player);

View file

@ -597,6 +597,7 @@ void GLSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
for (unsigned int i = 0; i < x.ffloors.Size(); i++) for (unsigned int i = 0; i < x.ffloors.Size(); i++)
{ {
F3DFloor * ff = x.ffloors[i]; F3DFloor * ff = x.ffloors[i];
if (ff->flags & FF_THISINSIDE) continue; // only relevant for software rendering.
float floorh = ff->top.plane->ZatPoint(thingpos); float floorh = ff->top.plane->ZatPoint(thingpos);
float ceilingh = ff->bottom.plane->ZatPoint(thingpos); float ceilingh = ff->bottom.plane->ZatPoint(thingpos);
if (floorh == thing->floorz) if (floorh == thing->floorz)

View file

@ -43,7 +43,6 @@
int BaseBlendR, BaseBlendG, BaseBlendB; int BaseBlendR, BaseBlendG, BaseBlendB;
float BaseBlendA; float BaseBlendA;
EXTERN_CVAR(Bool, swtruecolor)
// using FDummyTexture as base because that implements the required software renderer functions. // using FDummyTexture as base because that implements the required software renderer functions.
@ -103,13 +102,13 @@ SWSceneDrawer::~SWSceneDrawer()
void SWSceneDrawer::RenderView(player_t *player) void SWSceneDrawer::RenderView(player_t *player)
{ {
DCanvas buffer(screen->GetWidth(), screen->GetHeight(), swtruecolor); DCanvas buffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor());
if (FBTexture == nullptr || FBTexture->hwtex == nullptr || FBTexture->GetWidth() != screen->GetWidth() || FBTexture->GetHeight() != screen->GetHeight() || (swtruecolor? 1:0) != FBTexture->WidthBits) if (FBTexture == nullptr || FBTexture->hwtex == nullptr || FBTexture->GetWidth() != screen->GetWidth() || FBTexture->GetHeight() != screen->GetHeight() || (V_IsTrueColor() ? 1:0) != FBTexture->WidthBits)
{ {
// This manually constructs its own material here. // This manually constructs its own material here.
if (FBTexture != nullptr) delete FBTexture; if (FBTexture != nullptr) delete FBTexture;
FBTexture = new FSWSceneTexture(screen->GetWidth(), screen->GetHeight(), swtruecolor); FBTexture = new FSWSceneTexture(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor());
FBTexture->hwtex->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), swtruecolor ? 4 : 1); FBTexture->hwtex->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor() ? 4 : 1);
auto mat = FMaterial::ValidateTexture(FBTexture, false); auto mat = FMaterial::ValidateTexture(FBTexture, false);
mat->AddTextureLayer(PaletteTexture); mat->AddTextureLayer(PaletteTexture);
} }
@ -123,5 +122,5 @@ void SWSceneDrawer::RenderView(player_t *player)
screen->Begin2D(false); screen->Begin2D(false);
screen->DrawTexture(FBTexture, 0, 0, DTA_SpecialColormap, map, TAG_DONE); screen->DrawTexture(FBTexture, 0, 0, DTA_SpecialColormap, map, TAG_DONE);
SWRenderer->DrawRemainingPlayerSprites(); SWRenderer->DrawRemainingPlayerSprites();
GLRenderer->DrawBlend(r_viewpoint.sector, !!map, swtruecolor, true); GLRenderer->DrawBlend(r_viewpoint.sector, !!map, V_IsTrueColor(), true);
} }

View file

@ -1218,6 +1218,7 @@ void GLWall::InverseFloors(seg_t * seg, sector_t * frontsector,
for (unsigned int i = 0; i < frontffloors.Size(); i++) for (unsigned int i = 0; i < frontffloors.Size(); i++)
{ {
F3DFloor * rover = frontffloors[i]; F3DFloor * rover = frontffloors[i];
if (rover->flags & FF_THISINSIDE) continue; // only relevant for software rendering.
if (!(rover->flags&FF_EXISTS)) continue; if (!(rover->flags&FF_EXISTS)) continue;
if (!(rover->flags&FF_RENDERSIDES)) continue; if (!(rover->flags&FF_RENDERSIDES)) continue;
if (!(rover->flags&(FF_INVERTSIDES | FF_ALLSIDES))) continue; if (!(rover->flags&(FF_INVERTSIDES | FF_ALLSIDES))) continue;
@ -1270,6 +1271,7 @@ void GLWall::ClipFFloors(seg_t * seg, F3DFloor * ffloor, sector_t * frontsector,
for (unsigned int i = 0; i < frontffloors.Size(); i++) for (unsigned int i = 0; i < frontffloors.Size(); i++)
{ {
F3DFloor * rover = frontffloors[i]; F3DFloor * rover = frontffloors[i];
if (rover->flags & FF_THISINSIDE) continue; // only relevant for software rendering.
if (!(rover->flags&FF_EXISTS)) continue; if (!(rover->flags&FF_EXISTS)) continue;
if (!(rover->flags&FF_RENDERSIDES)) continue; if (!(rover->flags&FF_RENDERSIDES)) continue;
if ((rover->flags&(FF_SWIMMABLE | FF_TRANSLUCENT)) != flags) continue; if ((rover->flags&(FF_SWIMMABLE | FF_TRANSLUCENT)) != flags) continue;
@ -1369,6 +1371,7 @@ void GLWall::DoFFloorBlocks(seg_t * seg, sector_t * frontsector, sector_t * back
for (unsigned int i = 0; i < backffloors.Size(); i++) for (unsigned int i = 0; i < backffloors.Size(); i++)
{ {
F3DFloor * rover = backffloors[i]; F3DFloor * rover = backffloors[i];
if (rover->flags & FF_THISINSIDE) continue; // only relevant for software rendering.
if (!(rover->flags&FF_EXISTS)) continue; if (!(rover->flags&FF_EXISTS)) continue;
if (!(rover->flags&FF_RENDERSIDES) || (rover->flags&FF_INVERTSIDES)) continue; if (!(rover->flags&FF_RENDERSIDES) || (rover->flags&FF_INVERTSIDES)) continue;

View file

@ -195,13 +195,13 @@ void OpenGLFrameBuffer::Update()
// //
// //
//=========================================================================== //===========================================================================
extern int currentrenderer;
void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV) void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV)
{ {
if (currentrenderer == 0) if (!V_IsHardwareRenderer())
{
Super::RenderTextureView(tex, Viewpoint, FOV); Super::RenderTextureView(tex, Viewpoint, FOV);
}
else if (GLRenderer != nullptr) else if (GLRenderer != nullptr)
{ {
GLRenderer->RenderTextureView(tex, Viewpoint, FOV); GLRenderer->RenderTextureView(tex, Viewpoint, FOV);
@ -217,7 +217,7 @@ void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint
void OpenGLFrameBuffer::WriteSavePic(player_t *player, FileWriter *file, int width, int height) void OpenGLFrameBuffer::WriteSavePic(player_t *player, FileWriter *file, int width, int height)
{ {
if (currentrenderer == 0) if (!V_IsHardwareRenderer())
Super::WriteSavePic(player, file, width, height); Super::WriteSavePic(player, file, width, height);
if (GLRenderer != nullptr) if (GLRenderer != nullptr)
@ -249,7 +249,8 @@ EXTERN_CVAR(Int, gl_tonemap)
uint32_t OpenGLFrameBuffer::GetCaps() uint32_t OpenGLFrameBuffer::GetCaps()
{ {
if (currentrenderer == 0) return Super::GetCaps(); if (!V_IsHardwareRenderer())
return Super::GetCaps();
// describe our basic feature set // describe our basic feature set
ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS | ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |

View file

@ -44,7 +44,6 @@ RenderContext gl;
static double realglversion; // this is public so the statistics code can access it. static double realglversion; // this is public so the statistics code can access it.
EXTERN_CVAR(Bool, gl_legacy_mode) EXTERN_CVAR(Bool, gl_legacy_mode)
extern int currentrenderer;
CVAR(Bool, gl_riskymodernpath, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, gl_riskymodernpath, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
//========================================================================== //==========================================================================
@ -211,11 +210,7 @@ void gl_LoadExtensions()
// The minimum requirement for the modern render path is GL 3.3. // The minimum requirement for the modern render path is GL 3.3.
// Although some GL 3.1 or 3.2 solutions may theoretically work they are usually too broken or too slow. // Although some GL 3.1 or 3.2 solutions may theoretically work they are usually too broken or too slow.
// unless, of course, we're simply using this as a software backend... if (gl_version < 3.3f)
float minmodernpath = 3.3f;
if (gl_riskymodernpath)
minmodernpath = 3.1f;
if ((gl_version < minmodernpath && (currentrenderer==1)) || gl_version < 3.0f)
{ {
gl.legacyMode = true; gl.legacyMode = true;
gl.lightmethod = LM_LEGACY; gl.lightmethod = LM_LEGACY;

View file

@ -50,8 +50,6 @@
#include "g_levellocals.h" #include "g_levellocals.h"
#include "actorinlines.h" #include "actorinlines.h"
extern int currentrenderer;
//========================================================================== //==========================================================================
// //
// 3D Floors // 3D Floors
@ -197,7 +195,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
// kg3D - software renderer only hack // kg3D - software renderer only hack
// this is really required because of ceilingclip and floorclip // this is really required because of ceilingclip and floorclip
if((currentrenderer == 0) && (flags & FF_BOTHPLANES)) if(flags & FF_BOTHPLANES)
{ {
P_Add3DFloor(sec, sec2, master, FF_EXISTS | FF_THISINSIDE | FF_RENDERPLANES | FF_NOSHADE | FF_SEETHROUGH | FF_SHOOTTHROUGH | P_Add3DFloor(sec, sec2, master, FF_EXISTS | FF_THISINSIDE | FF_RENDERPLANES | FF_NOSHADE | FF_SEETHROUGH | FF_SHOOTTHROUGH |
(flags & (FF_INVERTSECTOR | FF_TRANSLUCENT | FF_ADDITIVETRANS)), alpha); (flags & (FF_INVERTSECTOR | FF_TRANSLUCENT | FF_ADDITIVETRANS)), alpha);

View file

@ -3427,7 +3427,6 @@ void P_GetPolySpots (MapData * map, TArray<FNodeBuilder::FPolyStart> &spots, TAr
// Preloads all relevant graphics for the level. // Preloads all relevant graphics for the level.
// //
//=========================================================================== //===========================================================================
extern int currentrenderer;
void gl_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitlist); void gl_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitlist);
static void P_PrecacheLevel() static void P_PrecacheLevel()
@ -3504,7 +3503,7 @@ static void P_PrecacheLevel()
} }
// This is just a temporary solution, until the hardware renderer's texture manager is in a better state. // This is just a temporary solution, until the hardware renderer's texture manager is in a better state.
if (currentrenderer == 0) if (!V_IsHardwareRenderer())
SWRenderer->Precache(hitlist, actorhitlist); SWRenderer->Precache(hitlist, actorhitlist);
else else
gl_PrecacheTexture(hitlist, actorhitlist); gl_PrecacheTexture(hitlist, actorhitlist);

View file

@ -731,9 +731,7 @@ bool player_t::GetPainFlash(FName type, PalEntry *color) const
//=========================================================================== //===========================================================================
EXTERN_CVAR(Float, maxviewpitch) EXTERN_CVAR(Float, maxviewpitch)
EXTERN_CVAR(Bool, r_polyrenderer)
EXTERN_CVAR(Bool, cl_oldfreelooklimit); EXTERN_CVAR(Bool, cl_oldfreelooklimit);
extern int currentrenderer;
static int GetSoftPitch(bool down) static int GetSoftPitch(bool down)
@ -749,7 +747,7 @@ void player_t::SendPitchLimits() const
{ {
int uppitch, downpitch; int uppitch, downpitch;
if (currentrenderer == 0 && !r_polyrenderer) if (V_IsSoftwareRenderer())
{ {
uppitch = GetSoftPitch(false); uppitch = GetSoftPitch(false);
downpitch = GetSoftPitch(true); downpitch = GetSoftPitch(true);

View file

@ -1071,11 +1071,10 @@ void TriangleBlock::DepthWrite(const TriDrawTriangleArgs *args)
#endif #endif
EXTERN_CVAR(Bool, r_polyrenderer)
void ScreenTriangle::Draw(const TriDrawTriangleArgs *args, WorkerThreadData *thread) void ScreenTriangle::Draw(const TriDrawTriangleArgs *args, WorkerThreadData *thread)
{ {
if (r_polyrenderer) if (V_IsPolyRenderer())
{ {
TriangleBlock block(args, thread); TriangleBlock block(args, thread);
block.Render(); block.Render();

View file

@ -102,26 +102,10 @@
DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen); DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen);
extern int currentrenderer;
EXTERN_CVAR(Bool, ticker ) EXTERN_CVAR(Bool, ticker )
EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Bool, vid_vsync)
EXTERN_CVAR(Bool, vid_hidpi) EXTERN_CVAR(Bool, vid_hidpi)
CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
if (currentrenderer == 0)
{
extern int NewWidth, NewHeight, NewBits, DisplayBits;
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
}
CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{ {
extern int NewWidth, NewHeight, NewBits, DisplayBits; extern int NewWidth, NewHeight, NewBits, DisplayBits;
@ -386,7 +370,7 @@ CocoaVideo::CocoaVideo()
// Create OpenGL pixel format // Create OpenGL pixel format
NSOpenGLPixelFormatAttribute defaultProfile = NSOpenGLProfileVersion3_2Core; NSOpenGLPixelFormatAttribute defaultProfile = NSOpenGLProfileVersion3_2Core;
if (1 == vid_renderer && NSAppKitVersionNumber < AppKit10_9) if (NSAppKitVersionNumber < AppKit10_9)
{ {
// There is no support for OpenGL 3.3 before Mavericks // There is no support for OpenGL 3.3 before Mavericks
defaultProfile = NSOpenGLProfileVersionLegacy; defaultProfile = NSOpenGLProfileVersionLegacy;
@ -821,7 +805,7 @@ void I_InitGraphics()
DFrameBuffer* I_SetMode(int &width, int &height, DFrameBuffer* old) DFrameBuffer* I_SetMode(int &width, int &height, DFrameBuffer* old)
{ {
return Video->CreateFrameBuffer(width, height, swtruecolor, fullscreen, old); return Video->CreateFrameBuffer(width, height, false, fullscreen, old);
} }
bool I_CheckResolution(const int width, const int height, const int bits) bool I_CheckResolution(const int width, const int height, const int bits)

View file

@ -52,7 +52,6 @@
EXTERN_CVAR (Bool, ticker) EXTERN_CVAR (Bool, ticker)
EXTERN_CVAR (Bool, fullscreen) EXTERN_CVAR (Bool, fullscreen)
EXTERN_CVAR (Bool, swtruecolor)
EXTERN_CVAR (Float, vid_winscale) EXTERN_CVAR (Float, vid_winscale)
IVideo *Video; IVideo *Video;
@ -91,7 +90,6 @@ void I_InitGraphics ()
val.Bool = !!Args->CheckParm ("-devparm"); val.Bool = !!Args->CheckParm ("-devparm");
ticker.SetGenericRepDefault (val, CVAR_Bool); ticker.SetGenericRepDefault (val, CVAR_Bool);
//currentrenderer = vid_renderer;
Video = new SDLGLVideo(0); Video = new SDLGLVideo(0);
if (Video == NULL) if (Video == NULL)
@ -121,7 +119,7 @@ DFrameBuffer *I_SetMode (int &width, int &height, DFrameBuffer *old)
fs = fullscreen; fs = fullscreen;
break; break;
} }
DFrameBuffer *res = Video->CreateFrameBuffer (width, height, swtruecolor, fs, old); DFrameBuffer *res = Video->CreateFrameBuffer (width, height, false, fs, old);
/* Right now, CreateFrameBuffer cannot return NULL /* Right now, CreateFrameBuffer cannot return NULL
if (res == NULL) if (res == NULL)
@ -259,19 +257,6 @@ void I_SetFPSLimit(int limit)
extern int NewWidth, NewHeight, NewBits, DisplayBits; extern int NewWidth, NewHeight, NewBits, DisplayBits;
CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
if (currentrenderer == 0)
{
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
}
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{ {
NewWidth = screen->VideoWidth; NewWidth = screen->VideoWidth;

View file

@ -67,12 +67,10 @@
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern IVideo *Video; extern IVideo *Video;
// extern int vid_renderer;
EXTERN_CVAR (Float, Gamma) EXTERN_CVAR (Float, Gamma)
EXTERN_CVAR (Int, vid_adapter) EXTERN_CVAR (Int, vid_adapter)
EXTERN_CVAR (Int, vid_displaybits) EXTERN_CVAR (Int, vid_displaybits)
EXTERN_CVAR (Int, vid_renderer)
EXTERN_CVAR (Int, vid_maxfps) EXTERN_CVAR (Int, vid_maxfps)
EXTERN_CVAR (Bool, cl_capfps) EXTERN_CVAR (Bool, cl_capfps)

View file

@ -154,13 +154,6 @@ void AddLightDefaults(FLightDefaults *defaults)
} }
} }
// If the current renderer cannot handle attenuated lights we need to reduce the radius here to account for the far more bright lights this would create.
if (/*!Renderer->CanAttenuate() &&*/ (defaults->GetAttenuate()))
{
defaults->SetArg(LIGHT_INTENSITY, defaults->GetArg(LIGHT_INTENSITY) * 2 / 3);
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, defaults->GetArg(LIGHT_SECONDARY_INTENSITY) * 2 / 3);
}
LightDefaults.Push(defaults); LightDefaults.Push(defaults);
} }

View file

@ -398,8 +398,6 @@ subsector_t *R_PointInSubsector (fixed_t x, fixed_t y)
// //
//========================================================================== //==========================================================================
extern int currentrenderer;
EXTERN_CVAR(Int, vid_renderer)
FRenderer *CreateSWRenderer(); FRenderer *CreateSWRenderer();
@ -417,12 +415,6 @@ void R_Init ()
R_InitTranslationTables (); R_InitTranslationTables ();
R_SetViewSize (screenblocks); R_SetViewSize (screenblocks);
currentrenderer = vid_renderer;
if (currentrenderer == 1)
Printf("Renderer: OpenGL\n");
else
Printf("Renderer: Software on OpenGL\n");
if (SWRenderer == NULL) if (SWRenderer == NULL)
{ {
SWRenderer = CreateSWRenderer(); SWRenderer = CreateSWRenderer();

View file

@ -193,7 +193,7 @@ namespace swrenderer
void R_UpdateFuzzPosFrameStart() void R_UpdateFuzzPosFrameStart()
{ {
if (r_fuzzscale || r_polyrenderer) if (r_fuzzscale || V_IsPolyRenderer())
{ {
static int next_random = 0; static int next_random = 0;
@ -207,7 +207,7 @@ namespace swrenderer
void R_UpdateFuzzPos(const SpriteDrawerArgs &args) void R_UpdateFuzzPos(const SpriteDrawerArgs &args)
{ {
if (!r_fuzzscale && !r_polyrenderer) if (!r_fuzzscale && !V_IsPolyRenderer())
{ {
int yl = MAX(args.FuzzY1(), 1); int yl = MAX(args.FuzzY1(), 1);
int yh = MIN(args.FuzzY2(), fuzzviewheight); int yh = MIN(args.FuzzY2(), fuzzviewheight);

View file

@ -52,8 +52,6 @@
#include "p_setup.h" #include "p_setup.h"
#include "g_levellocals.h" #include "g_levellocals.h"
extern int currentrenderer;
// [BB] Use ZDoom's freelook limit for the sotfware renderer. // [BB] Use ZDoom's freelook limit for the sotfware renderer.
// Note: ZDoom's limit is chosen such that the sky is rendered properly. // Note: ZDoom's limit is chosen such that the sky is rendered properly.
CUSTOM_CVAR (Bool, cl_oldfreelooklimit, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) CUSTOM_CVAR (Bool, cl_oldfreelooklimit, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
@ -65,20 +63,6 @@ CUSTOM_CVAR (Bool, cl_oldfreelooklimit, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG
EXTERN_CVAR(Float, maxviewpitch) // [SP] CVAR from OpenGL Renderer EXTERN_CVAR(Float, maxviewpitch) // [SP] CVAR from OpenGL Renderer
EXTERN_CVAR(Bool, r_drawvoxels) EXTERN_CVAR(Bool, r_drawvoxels)
CUSTOM_CVAR(Bool, r_polyrenderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
if (self == 1 && !hasglnodes)
{
Printf("No GL BSP detected. You must restart the map before rendering will be correct\n");
}
if (usergame)
{
// [SP] Update pitch limits to the netgame/gamesim.
players[consoleplayer].SendPitchLimits();
}
}
using namespace swrenderer; using namespace swrenderer;
FSoftwareRenderer::FSoftwareRenderer() FSoftwareRenderer::FSoftwareRenderer()
@ -96,11 +80,9 @@ FRenderer *CreateSWRenderer()
return new FSoftwareRenderer; return new FSoftwareRenderer;
} }
EXTERN_CVAR(Bool, swtruecolor)
void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache) void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache)
{ {
bool isbgra = swtruecolor; bool isbgra = V_IsTrueColor();
if (tex != NULL) if (tex != NULL)
{ {
@ -177,7 +159,7 @@ void FSoftwareRenderer::Precache(uint8_t *texhitlist, TMap<PClassActor*, bool> &
void FSoftwareRenderer::RenderView(player_t *player, DCanvas *target) void FSoftwareRenderer::RenderView(player_t *player, DCanvas *target)
{ {
if (r_polyrenderer) if (V_IsPolyRenderer())
{ {
PolyRenderer::Instance()->Viewpoint = r_viewpoint; PolyRenderer::Instance()->Viewpoint = r_viewpoint;
PolyRenderer::Instance()->Viewwindow = r_viewwindow; PolyRenderer::Instance()->Viewwindow = r_viewwindow;
@ -203,7 +185,7 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
PalEntry palette[256]; PalEntry palette[256];
// Take a snapshot of the player's view // Take a snapshot of the player's view
if (r_polyrenderer) if (V_IsPolyRenderer())
{ {
PolyRenderer::Instance()->Viewpoint = r_viewpoint; PolyRenderer::Instance()->Viewpoint = r_viewpoint;
PolyRenderer::Instance()->Viewwindow = r_viewwindow; PolyRenderer::Instance()->Viewwindow = r_viewwindow;
@ -226,7 +208,7 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
void FSoftwareRenderer::DrawRemainingPlayerSprites() void FSoftwareRenderer::DrawRemainingPlayerSprites()
{ {
if (!r_polyrenderer) if (!V_IsPolyRenderer())
{ {
mScene.MainThread()->Viewport->viewpoint = r_viewpoint; mScene.MainThread()->Viewport->viewpoint = r_viewpoint;
mScene.MainThread()->Viewport->viewwindow = r_viewwindow; mScene.MainThread()->Viewport->viewwindow = r_viewwindow;
@ -247,7 +229,7 @@ void FSoftwareRenderer::DrawRemainingPlayerSprites()
void FSoftwareRenderer::OnModeSet () void FSoftwareRenderer::OnModeSet ()
{ {
// This does not work if the SW renderer is not in use. // This does not work if the SW renderer is not in use.
if (currentrenderer == 0) if (!V_IsHardwareRenderer())
mScene.ScreenResized(); mScene.ScreenResized();
} }
@ -258,9 +240,9 @@ void FSoftwareRenderer::SetClearColor(int color)
void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, double fov) void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, double fov)
{ {
auto renderTarget = r_polyrenderer ? PolyRenderer::Instance()->RenderTarget : mScene.MainThread()->Viewport->RenderTarget; auto renderTarget = V_IsPolyRenderer() ? PolyRenderer::Instance()->RenderTarget : mScene.MainThread()->Viewport->RenderTarget;
auto &cameraViewpoint = r_polyrenderer ? PolyRenderer::Instance()->Viewpoint : mScene.MainThread()->Viewport->viewpoint; auto &cameraViewpoint = V_IsPolyRenderer() ? PolyRenderer::Instance()->Viewpoint : mScene.MainThread()->Viewport->viewpoint;
auto &cameraViewwindow = r_polyrenderer ? PolyRenderer::Instance()->Viewwindow : mScene.MainThread()->Viewport->viewwindow; auto &cameraViewwindow = V_IsPolyRenderer() ? PolyRenderer::Instance()->Viewwindow : mScene.MainThread()->Viewport->viewwindow;
// Grab global state shared with rest of zdoom // Grab global state shared with rest of zdoom
cameraViewpoint = r_viewpoint; cameraViewpoint = r_viewpoint;
@ -276,7 +258,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
DAngle savedfov = cameraViewpoint.FieldOfView; DAngle savedfov = cameraViewpoint.FieldOfView;
R_SetFOV (cameraViewpoint, fov); R_SetFOV (cameraViewpoint, fov);
if (r_polyrenderer) if (V_IsPolyRenderer())
PolyRenderer::Instance()->RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate); PolyRenderer::Instance()->RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
else else
mScene.RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate); mScene.RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);

View file

@ -64,7 +64,6 @@ void PeekThreadedErrorPane();
#endif #endif
EXTERN_CVAR(Int, r_clearbuffer) EXTERN_CVAR(Int, r_clearbuffer)
EXTERN_CVAR(Bool, swtruecolor)
CVAR(Bool, r_scene_multithreaded, false, 0); CVAR(Bool, r_scene_multithreaded, false, 0);
CVAR(Bool, r_models, false, 0); CVAR(Bool, r_models, false, 0);
@ -368,7 +367,7 @@ namespace swrenderer
auto viewport = MainThread()->Viewport.get(); auto viewport = MainThread()->Viewport.get();
int width = SCREENWIDTH; int width = SCREENWIDTH;
int height = SCREENHEIGHT; int height = SCREENHEIGHT;
viewport->RenderTarget = new DCanvas(width, height, swtruecolor); // Some code deeper down needs something valid here, so give it a dummy canvas. viewport->RenderTarget = new DCanvas(width, height, V_IsTrueColor()); // Some code deeper down needs something valid here, so give it a dummy canvas.
float trueratio; float trueratio;
ActiveRatio(width, height, &trueratio); ActiveRatio(width, height, &trueratio);
viewport->SetViewport(MainThread(), SCREENWIDTH, SCREENHEIGHT, trueratio); viewport->SetViewport(MainThread(), SCREENWIDTH, SCREENHEIGHT, trueratio);

View file

@ -104,41 +104,24 @@ CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
} }
} }
int currentrenderer = -1; CUSTOM_CVAR(Int, vid_rendermode, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
// [ZDoomGL]
CUSTOM_CVAR(Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{ {
// 0: Software renderer if (usergame)
// 1: OpenGL renderer
if (self != currentrenderer)
{ {
switch (self) // [SP] Update pitch limits to the netgame/gamesim.
{ players[consoleplayer].SendPitchLimits();
case 0:
Printf("Switching to software renderer...\n");
break;
case 1:
Printf("Switching to OpenGL renderer...\n");
break;
default:
Printf("Unknown renderer (%d). Falling back to software renderer...\n", (int)vid_renderer);
self = 0; // make sure to actually switch to the software renderer
break;
}
} }
currentrenderer = self; // No further checks needed. All this changes now is which scene drawer the render backend calls.
} }
EXTERN_CVAR(Bool, r_blendmethod) EXTERN_CVAR(Bool, r_blendmethod)
int active_con_scale(); int active_con_scale();
FRenderer *SWRenderer; FRenderer *SWRenderer;
EXTERN_CVAR (Bool, swtruecolor)
EXTERN_CVAR (Bool, fullscreen) EXTERN_CVAR (Bool, fullscreen)
#define DBGBREAK assert(0) #define DBGBREAK assert(0)
@ -964,14 +947,13 @@ void DFrameBuffer::GameRestart()
// //
//========================================================================== //==========================================================================
EXTERN_CVAR(Bool, r_polyrenderer)
EXTERN_CVAR(Bool, r_drawvoxels) EXTERN_CVAR(Bool, r_drawvoxels)
uint32_t DFrameBuffer::GetCaps() uint32_t DFrameBuffer::GetCaps()
{ {
ActorRenderFeatureFlags FlagSet = 0; ActorRenderFeatureFlags FlagSet = 0;
if (r_polyrenderer) if (V_IsPolyRenderer())
FlagSet |= RFF_POLYGONAL | RFF_TILTPITCH | RFF_SLOPE3DFLOORS; FlagSet |= RFF_POLYGONAL | RFF_TILTPITCH | RFF_SLOPE3DFLOORS;
else else
{ {
@ -980,7 +962,7 @@ uint32_t DFrameBuffer::GetCaps()
FlagSet |= RFF_VOXELS; FlagSet |= RFF_VOXELS;
} }
if (swtruecolor) if (V_IsTrueColor())
FlagSet |= RFF_TRUECOLOR; FlagSet |= RFF_TRUECOLOR;
else else
FlagSet |= RFF_COLORMAP; FlagSet |= RFF_COLORMAP;

View file

@ -53,6 +53,29 @@ void V_UpdateModeSize (int width, int height);
void V_OutputResized (int width, int height); void V_OutputResized (int width, int height);
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *cx1=NULL, int *cx2=NULL); void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *cx1=NULL, int *cx2=NULL);
EXTERN_CVAR(Int, vid_rendermode)
inline bool V_IsHardwareRenderer()
{
return vid_rendermode == 4;
}
inline bool V_IsSoftwareRenderer()
{
return vid_rendermode < 2;
}
inline bool V_IsPolyRenderer()
{
return vid_rendermode == 2 || vid_rendermode == 3;
}
inline bool V_IsTrueColor()
{
return vid_rendermode == 1 || vid_rendermode == 3;
}
class FTexture; class FTexture;
struct FColormap; struct FColormap;
class FileWriter; class FileWriter;

View file

@ -49,7 +49,6 @@
EXTERN_CVAR (Bool, ticker) EXTERN_CVAR (Bool, ticker)
EXTERN_CVAR (Bool, fullscreen) EXTERN_CVAR (Bool, fullscreen)
EXTERN_CVAR (Bool, swtruecolor)
EXTERN_CVAR (Float, vid_winscale) EXTERN_CVAR (Float, vid_winscale)
EXTERN_CVAR (Bool, win_borderless) EXTERN_CVAR (Bool, win_borderless)
@ -67,7 +66,6 @@ IVideo *Video;
IVideo *gl_CreateVideo(); IVideo *gl_CreateVideo();
void I_RestartRenderer(); void I_RestartRenderer();
extern int currentrenderer;
int currentcanvas = -1; int currentcanvas = -1;
int currentgpuswitch = -1; int currentgpuswitch = -1;
bool changerenderer; bool changerenderer;
@ -180,7 +178,7 @@ DFrameBuffer *I_SetMode (int &width, int &height, DFrameBuffer *old)
} }
break; break;
} }
DFrameBuffer *res = Video->CreateFrameBuffer (width, height, swtruecolor, fs, old); DFrameBuffer *res = Video->CreateFrameBuffer (width, height, false, fs, old);
//* Right now, CreateFrameBuffer cannot return NULL //* Right now, CreateFrameBuffer cannot return NULL
if (res == NULL) if (res == NULL)
@ -359,19 +357,6 @@ void I_RestoreWindowedPos ()
extern int NewWidth, NewHeight, NewBits, DisplayBits; extern int NewWidth, NewHeight, NewBits, DisplayBits;
CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
if (currentrenderer == 0)
{
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
}
CUSTOM_CVAR(Bool, win_borderless, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) CUSTOM_CVAR(Bool, win_borderless, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{ {
// Just reinit the window. Saves a lot of trouble. // Just reinit the window. Saves a lot of trouble.

View file

@ -129,7 +129,6 @@ static void DestroyCustomCursor();
EXTERN_CVAR(String, language); EXTERN_CVAR(String, language);
EXTERN_CVAR (Bool, queryiwad); EXTERN_CVAR (Bool, queryiwad);
// Used on welcome/IWAD screen. // Used on welcome/IWAD screen.
EXTERN_CVAR (Int, vid_renderer)
EXTERN_CVAR (Bool, fullscreen) EXTERN_CVAR (Bool, fullscreen)
EXTERN_CVAR (Bool, disableautoload) EXTERN_CVAR (Bool, disableautoload)
EXTERN_CVAR (Bool, autoloadlights) EXTERN_CVAR (Bool, autoloadlights)
@ -824,7 +823,7 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
char szString[256]; char szString[256];
// Check the current video settings. // Check the current video settings.
SendDlgItemMessage( hDlg, vid_renderer ? IDC_WELCOME_OPENGL : IDC_WELCOME_SOFTWARE, BM_SETCHECK, BST_CHECKED, 0 ); //SendDlgItemMessage( hDlg, vid_renderer ? IDC_WELCOME_OPENGL : IDC_WELCOME_SOFTWARE, BM_SETCHECK, BST_CHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_SETCHECK, fullscreen ? BST_CHECKED : BST_UNCHECKED, 0 ); SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_SETCHECK, fullscreen ? BST_CHECKED : BST_UNCHECKED, 0 );
// [SP] This is our's // [SP] This is our's
@ -870,7 +869,6 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
{ {
SetQueryIWad(hDlg); SetQueryIWad(hDlg);
// [SP] Upstreamed from Zandronum // [SP] Upstreamed from Zandronum
vid_renderer = SendDlgItemMessage( hDlg, IDC_WELCOME_OPENGL, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
fullscreen = SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_GETCHECK, 0, 0 ) == BST_CHECKED; fullscreen = SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
// [SP] This is our's. // [SP] This is our's.

View file

@ -1044,7 +1044,7 @@ Win32GLFrameBuffer::Win32GLFrameBuffer(void *hMonitor, int width, int height, in
if (!static_cast<Win32GLVideo *>(Video)->InitHardware(Window, 0)) if (!static_cast<Win32GLVideo *>(Video)->InitHardware(Window, 0))
{ {
vid_renderer = 0; I_FatalError("Unable to initialize OpenGL");
return; return;
} }
HDC hDC = GetDC(Window); HDC hDC = GetDC(Window);

View file

@ -14,7 +14,6 @@ EXTERN_CVAR (Color, dimcolor)
EXTERN_CVAR(Int, vid_defwidth); EXTERN_CVAR(Int, vid_defwidth);
EXTERN_CVAR(Int, vid_defheight); EXTERN_CVAR(Int, vid_defheight);
EXTERN_CVAR(Int, vid_renderer);
EXTERN_CVAR(Int, vid_adapter); EXTERN_CVAR(Int, vid_adapter);
extern IVideo *Video; extern IVideo *Video;

View file

@ -2211,6 +2211,7 @@ RNDMNU_CANVAS = "Software Canvas";
// Video Options // Video Options
VIDMNU_TITLE = "VIDEO MODE"; VIDMNU_TITLE = "VIDEO MODE";
VIDMNU_RENDERMODE = "Render Mode";
VIDMNU_FULLSCREEN = "Fullscreen"; VIDMNU_FULLSCREEN = "Fullscreen";
VIDMNU_HIDPI = "Retina/HiDPI support"; VIDMNU_HIDPI = "Retina/HiDPI support";
VIDMNU_BRDLSS = "Borderless Windowed Mode"; VIDMNU_BRDLSS = "Borderless Windowed Mode";
@ -2398,6 +2399,9 @@ OPTVAL_SDL = "SDL";
OPTVAL_COCOA = "Cocoa"; OPTVAL_COCOA = "Cocoa";
OPTVAL_HWPOLY = "OpenGL-Accelerated"; OPTVAL_HWPOLY = "OpenGL-Accelerated";
OPTVAL_SWDOOM = "Doom Software Renderer"; OPTVAL_SWDOOM = "Doom Software Renderer";
OPTVAL_SWDOOMTC = "True Color SW Renderer";
OPTVAL_SWPOLY = "Softpoly Renderer";
OPTVAL_SWPOLYTC = "True Color Softpoly";
OPTVAL_DEDICATED = "High-Performance"; OPTVAL_DEDICATED = "High-Performance";
OPTVAL_INTEGRATED = "Power-Saving"; OPTVAL_INTEGRATED = "Power-Saving";
OPTVAL_VANILLA = "Vanilla"; OPTVAL_VANILLA = "Vanilla";

View file

@ -352,7 +352,6 @@ OptionMenu "OptionsMenu" protected
Submenu "$OPTMNU_SOUND", "SoundOptions" Submenu "$OPTMNU_SOUND", "SoundOptions"
Submenu "$OPTMNU_DISPLAY", "VideoOptions" Submenu "$OPTMNU_DISPLAY", "VideoOptions"
Submenu "$OPTMNU_VIDEO", "VideoModeMenu" Submenu "$OPTMNU_VIDEO", "VideoModeMenu"
Submenu "$OPTMNU_CHANGERENDER", "RendererMenu"
StaticText " " StaticText " "
SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults" SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults"
SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved" SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved"
@ -710,7 +709,6 @@ OptionMenu "TrueColorOptions" protected
{ {
Title "$TCMNU_TITLE" Title "$TCMNU_TITLE"
StaticText " " StaticText " "
//Option "$TCMNU_TRUECOLOR", "swtruecolor", "OnOff"
Option "$TCMNU_MINFILTER", "r_minfilter", "OnOff" Option "$TCMNU_MINFILTER", "r_minfilter", "OnOff"
Option "$TCMNU_MAGFILTER", "r_magfilter", "OnOff" Option "$TCMNU_MAGFILTER", "r_magfilter", "OnOff"
Option "$TCMNU_MIPMAP", "r_mipmap", "OnOff" Option "$TCMNU_MIPMAP", "r_mipmap", "OnOff"
@ -1844,30 +1842,13 @@ OptionMenu ModReplayerOptions protected
* *
*=======================================*/ *=======================================*/
OptionValue "PolyDoom" OptionValue "RenderMode"
{ {
0, "$OPTVAL_SWDOOM" 0, "$OPTVAL_SWDOOM"
1, "$OPTVAL_HWPOLY" 1, "$OPTVAL_SWDOOMTC"
} 2, "$OPTVAL_SWPOLY"
3, "$OPTVAL_SWPOLYTC"
OptionValue "D3DGL" 4, "$OPTVAL_HWPOLY"
{
0, "$OPTVAL_GL"
1, "$OPTVAL_D3D"
}
OptionValue "GLD3D"
{
0, "$OPTVAL_D3D"
1, "$OPTVAL_GL"
}
OptionMenu RendererMenu protected
{
Title "$RNDMNU_TITLE"
Option "$RNDMNU_RENDERER", "vid_renderer", "PolyDoom"
Option "$RNDMNU_TRUECOLOR", "swtruecolor", "OnOff"
Option "$RNDMNU_POLY", "r_polyrenderer", "OnOff"
} }
/*======================================= /*=======================================
@ -1914,6 +1895,7 @@ OptionMenu VideoModeMenu protected
{ {
Title "$VIDMNU_TITLE" Title "$VIDMNU_TITLE"
Option "$VIDMNU_RENDERMODE", "vid_rendermode", "RenderMode"
Option "$VIDMNU_FULLSCREEN", "fullscreen", "YesNo" Option "$VIDMNU_FULLSCREEN", "fullscreen", "YesNo"
IfOption(Mac) IfOption(Mac)