From 86a66cd554e2e8f68f048f46f22354b73ad7cf6b Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 10 Sep 2017 09:40:30 -0400 Subject: [PATCH 1/8] - refactored r_videoscale.cpp to use a table. - reordered vid_scalemode modes to be a little neater, having static modes and scalar modes separate, with a buffer in between so new modes can be added in the future without disrupting the current order. --- src/r_videoscale.cpp | 74 +++++++++++++++++++-------------------- wadsrc/static/menudef.txt | 8 ++--- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index c666f08cc56..230006ed8d4 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -25,9 +25,38 @@ #include "c_dispatch.h" #include "c_cvars.h" -CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +#define NUMSCALEMODES 11 + +namespace vidscale +{ + struct v_ScaleTable + { + bool isValid; + bool isLinear; + uint32_t(*GetScaledWidth)(uint32_t Width); + uint32_t(*GetScaledHeight)(uint32_t Height); + bool isScaled43; + }; + v_ScaleTable vScaleTable[NUMSCALEMODES] = + { + // isValid, isLinear, GetScaledWidth(), GetScaledHeight(), isScaled43 + { true, false, [](uint32_t Width)->uint32_t { return Width; }, [](uint32_t Height)->uint32_t { return Height; }, false }, // 0 - Native + { true, false, [](uint32_t Width)->uint32_t { return 320; }, [](uint32_t Height)->uint32_t { return 200; }, true }, // 1 - 320x200 + { true, true, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 2 - 640x400 + { true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 3 - 1280x800 + { false, false, nullptr, nullptr, false }, // 4 + { false, false, nullptr, nullptr, false }, // 5 + { false, false, nullptr, nullptr, false }, // 6 + { false, false, nullptr, nullptr, false }, // 7 + { true, false, [](uint32_t Width)->uint32_t { return Width / 2; }, [](uint32_t Height)->uint32_t { return Height / 2; }, false }, // 8 - Half-Res + { true, true, [](uint32_t Width)->uint32_t { return Width * 0.75; }, [](uint32_t Height)->uint32_t { return Height * 0.75; }, false }, // 9 - Res * 0.75 + { true, true, [](uint32_t Width)->uint32_t { return Width * 2; }, [](uint32_t Height)->uint32_t { return Height * 2; }, false }, // 10 - SSAAx2 + }; +} + +CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (self < 0 || self > 6) + if (self < 0 || self >= NUMSCALEMODES || vidscale::vScaleTable[self].isValid == false) { self = 0; } @@ -35,53 +64,22 @@ CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) bool ViewportLinearScale() { - switch(vid_scalemode) - { - default: return false; - case 4: - case 5: - case 6: return true; - } + return vidscale::vScaleTable[vid_scalemode].isLinear; } int ViewportScaledWidth(int width) { - switch (vid_scalemode) - { - default: - case 0: return width; - case 1: return 320; - case 2: return 640; - case 3: return (int)roundf(width * 0.5f); - case 4: return (int)roundf(width * 0.75f); - case 5: return width * 2; - case 6: return 1280; - } + return vidscale::vScaleTable[vid_scalemode].GetScaledWidth(width); } int ViewportScaledHeight(int height) { - switch (vid_scalemode) - { - default: - case 0: return height; - case 1: return 200; - case 2: return 400; - case 3: return (int)roundf(height * 0.5f); - case 4: return (int)roundf(height * 0.75f); - case 5: return height * 2; - case 6: return 800; - } + return vidscale::vScaleTable[vid_scalemode].GetScaledHeight(height); } bool ViewportIsScaled43() { - switch (vid_scalemode) - { - default: return false; - case 1: - case 2: - case 6: return true; - } + return vidscale::vScaleTable[vid_scalemode].isScaled43; } + diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index b95d538524c..59c7946cb3a 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1861,10 +1861,10 @@ OptionValue ScaleModes 0, "$OPTVAL_OFF" 1, "320x200" 2, "640x400" - 3, "0.5x" - 4, "0.75x" - 5, "2x SSAA" - 6, "1280x800" + 3, "1280x800" + 8, "0.5x" + 9, "0.75x" + 10, "2x SSAA" } OptionMenu VideoModeMenu protected From 432afd9edffbbbf0587bc505923576c75eab0ea8 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 10 Sep 2017 09:50:49 -0400 Subject: [PATCH 2/8] - privatized the namespace in r_videoscale.cpp completely --- src/r_videoscale.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index 230006ed8d4..7add7450d5e 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -27,7 +27,7 @@ #define NUMSCALEMODES 11 -namespace vidscale +namespace { struct v_ScaleTable { @@ -56,7 +56,7 @@ namespace vidscale CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (self < 0 || self >= NUMSCALEMODES || vidscale::vScaleTable[self].isValid == false) + if (self < 0 || self >= NUMSCALEMODES || vScaleTable[self].isValid == false) { self = 0; } @@ -64,22 +64,22 @@ CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) bool ViewportLinearScale() { - return vidscale::vScaleTable[vid_scalemode].isLinear; + return vScaleTable[vid_scalemode].isLinear; } int ViewportScaledWidth(int width) { - return vidscale::vScaleTable[vid_scalemode].GetScaledWidth(width); + return vScaleTable[vid_scalemode].GetScaledWidth(width); } int ViewportScaledHeight(int height) { - return vidscale::vScaleTable[vid_scalemode].GetScaledHeight(height); + return vScaleTable[vid_scalemode].GetScaledHeight(height); } bool ViewportIsScaled43() { - return vidscale::vScaleTable[vid_scalemode].isScaled43; + return vScaleTable[vid_scalemode].isScaled43; } From 4d671fb6184bbe83aa51977ac67756a5ed17d694 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 10 Sep 2017 16:29:57 +0200 Subject: [PATCH 3/8] - Improve softpoly culling performance --- src/polyrenderer/scene/poly_cull.cpp | 33 +++++++++++++++++++-------- src/polyrenderer/scene/poly_cull.h | 6 +++-- src/polyrenderer/scene/poly_scene.cpp | 10 ++++---- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/polyrenderer/scene/poly_cull.cpp b/src/polyrenderer/scene/poly_cull.cpp index 93041650d72..c39eb66cc55 100644 --- a/src/polyrenderer/scene/poly_cull.cpp +++ b/src/polyrenderer/scene/poly_cull.cpp @@ -33,11 +33,21 @@ void PolyCull::CullScene(const TriMatrix &worldToClip, const PolyClipPlane &port ClearSolidSegments(); MarkViewFrustum(); + for (const auto &sub : PvsSectors) + SubsectorDepths[sub->Index()] = 0xffffffff; + SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff); + + for (const auto §or : SeenSectors) + SectorSeen[sector->Index()] = false; + SectorSeen.resize(level.sectors.Size()); + PvsSectors.clear(); - PvsLineStart.clear(); - PvsLineVisible.clear(); SeenSectors.clear(); - SubsectorDepths.clear(); + + NextPvsLineStart = 0; + PvsLineStart.clear(); + PvsLineVisible.resize(level.segs.Size()); + PortalClipPlane = portalClipPlane; // Cull front to back @@ -108,7 +118,7 @@ void PolyCull::CullSubsector(subsector_t *sub) // Mark that we need to render this PvsSectors.push_back(sub); - PvsLineStart.push_back((uint32_t)PvsLineVisible.size()); + PvsLineStart.push_back(NextPvsLineStart); DVector3 viewpos = PolyRenderer::Instance()->Viewpoint.Pos; @@ -122,7 +132,7 @@ void PolyCull::CullSubsector(subsector_t *sub) DVector2 pt2 = line->v2->fPos() - viewpos; if (pt1.Y * (pt1.X - pt2.X) + pt1.X * (pt2.Y - pt1.Y) >= 0) { - PvsLineVisible.push_back(false); + PvsLineVisible[NextPvsLineStart++] = false; continue; } @@ -130,7 +140,7 @@ void PolyCull::CullSubsector(subsector_t *sub) if ((PortalClipPlane.A * line->v1->fX() + PortalClipPlane.B * line->v1->fY() + PortalClipPlane.D <= 0.0) || (PortalClipPlane.A * line->v2->fX() + PortalClipPlane.B * line->v2->fY() + PortalClipPlane.D <= 0.0)) { - PvsLineVisible.push_back(false); + PvsLineVisible[NextPvsLineStart++] = false; continue; } @@ -142,11 +152,16 @@ void PolyCull::CullSubsector(subsector_t *sub) } // Mark if this line was visible - PvsLineVisible.push_back(lineVisible); + PvsLineVisible[NextPvsLineStart++] = lineVisible; + } + + if (!SectorSeen[sub->sector->Index()]) + { + SectorSeen[sub->sector->Index()] = true; + SeenSectors.push_back(sub->sector); } - SeenSectors.insert(sub->sector); - SubsectorDepths[sub] = subsectorDepth; + SubsectorDepths[sub->Index()] = subsectorDepth; } void PolyCull::ClearSolidSegments() diff --git a/src/polyrenderer/scene/poly_cull.h b/src/polyrenderer/scene/poly_cull.h index 29c47134d21..549f4c37530 100644 --- a/src/polyrenderer/scene/poly_cull.h +++ b/src/polyrenderer/scene/poly_cull.h @@ -40,8 +40,9 @@ class PolyCull double MaxCeilingHeight = 0.0; double MinFloorHeight = 0.0; - std::set SeenSectors; - std::unordered_map SubsectorDepths; + std::vector SeenSectors; + std::vector SectorSeen; + std::vector SubsectorDepths; static angle_t PointToPseudoAngle(double x, double y); @@ -78,6 +79,7 @@ class PolyCull std::vector PvsLineStart; std::vector PvsLineVisible; + uint32_t NextPvsLineStart = 0; static angle_t AngleToPseudo(angle_t ang); }; diff --git a/src/polyrenderer/scene/poly_scene.cpp b/src/polyrenderer/scene/poly_scene.cpp index d315a02e5b3..6f84c2d4f56 100644 --- a/src/polyrenderer/scene/poly_scene.cpp +++ b/src/polyrenderer/scene/poly_scene.cpp @@ -213,9 +213,8 @@ void RenderPolyScene::RenderSprite(PolyRenderThread *thread, AActor *thing, doub if (level.nodes.Size() == 0) { subsector_t *sub = &level.subsectors[0]; - auto it = Cull.SubsectorDepths.find(sub); - if (it != Cull.SubsectorDepths.end()) - TranslucentObjects[thread->ThreadIndex].push_back(thread->FrameMemory->NewObject(thing, sub, it->second, sortDistance, 0.0f, 1.0f, StencilValue)); + if (Cull.SubsectorDepths[sub->Index()] != 0xffffffff) + TranslucentObjects[thread->ThreadIndex].push_back(thread->FrameMemory->NewObject(thing, sub, Cull.SubsectorDepths[sub->Index()], sortDistance, 0.0f, 1.0f, StencilValue)); } else { @@ -254,9 +253,8 @@ void RenderPolyScene::RenderSprite(PolyRenderThread *thread, AActor *thing, doub subsector_t *sub = (subsector_t *)((uint8_t *)node - 1); - auto it = Cull.SubsectorDepths.find(sub); - if (it != Cull.SubsectorDepths.end()) - TranslucentObjects[thread->ThreadIndex].push_back(thread->FrameMemory->NewObject(thing, sub, it->second, sortDistance, (float)t1, (float)t2, StencilValue)); + if (Cull.SubsectorDepths[sub->Index()] != 0xffffffff) + TranslucentObjects[thread->ThreadIndex].push_back(thread->FrameMemory->NewObject(thing, sub, Cull.SubsectorDepths[sub->Index()], sortDistance, (float)t1, (float)t2, StencilValue)); } void RenderPolyScene::RenderLine(PolyRenderThread *thread, subsector_t *sub, seg_t *line, sector_t *frontsector, uint32_t subsectorDepth) From 0924cc3f0fe6f392394cde52a302e5bca1bf5d1e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 10 Sep 2017 17:11:17 +0200 Subject: [PATCH 4/8] - Fix crash when switching levels --- src/polyrenderer/scene/poly_cull.cpp | 23 +++++++++++++++++------ src/polyrenderer/scene/poly_cull.h | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/polyrenderer/scene/poly_cull.cpp b/src/polyrenderer/scene/poly_cull.cpp index c39eb66cc55..e759bdda434 100644 --- a/src/polyrenderer/scene/poly_cull.cpp +++ b/src/polyrenderer/scene/poly_cull.cpp @@ -33,13 +33,24 @@ void PolyCull::CullScene(const TriMatrix &worldToClip, const PolyClipPlane &port ClearSolidSegments(); MarkViewFrustum(); - for (const auto &sub : PvsSectors) - SubsectorDepths[sub->Index()] = 0xffffffff; - SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff); + if (level.LevelName != lastLevelName) // Is this the best way to detect a level change? + { + lastLevelName = level.LevelName; + SubsectorDepths.clear(); + SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff); + SectorSeen.clear(); + SectorSeen.resize(level.sectors.Size()); + } + else + { + for (const auto &sub : PvsSectors) + SubsectorDepths[sub->Index()] = 0xffffffff; + SubsectorDepths.resize(level.subsectors.Size(), 0xffffffff); - for (const auto §or : SeenSectors) - SectorSeen[sector->Index()] = false; - SectorSeen.resize(level.sectors.Size()); + for (const auto §or : SeenSectors) + SectorSeen[sector->Index()] = false; + SectorSeen.resize(level.sectors.Size()); + } PvsSectors.clear(); SeenSectors.clear(); diff --git a/src/polyrenderer/scene/poly_cull.h b/src/polyrenderer/scene/poly_cull.h index 549f4c37530..fe80005012f 100644 --- a/src/polyrenderer/scene/poly_cull.h +++ b/src/polyrenderer/scene/poly_cull.h @@ -70,6 +70,8 @@ class PolyCull void MarkSegmentCulled(angle_t angle1, angle_t angle2); + FString lastLevelName; + std::vector SolidSegments; std::vector TempInvertSolidSegments; const int SolidCullScale = 3000; From 4b82bb50dffb1e384d0c9708bcf331dfc8094fb3 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 10 Sep 2017 12:12:31 -0400 Subject: [PATCH 5/8] - removed scale resolutions and added vid_scalefactor to replace them. --- src/r_videoscale.cpp | 29 +++++++++++++++-------------- wadsrc/static/language.enu | 3 +++ wadsrc/static/menudef.txt | 13 ++++++------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index 7add7450d5e..f8ec6ab8575 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -25,7 +25,7 @@ #include "c_dispatch.h" #include "c_cvars.h" -#define NUMSCALEMODES 11 +#define NUMSCALEMODES 5 namespace { @@ -41,19 +41,19 @@ namespace { // isValid, isLinear, GetScaledWidth(), GetScaledHeight(), isScaled43 { true, false, [](uint32_t Width)->uint32_t { return Width; }, [](uint32_t Height)->uint32_t { return Height; }, false }, // 0 - Native - { true, false, [](uint32_t Width)->uint32_t { return 320; }, [](uint32_t Height)->uint32_t { return 200; }, true }, // 1 - 320x200 - { true, true, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 2 - 640x400 - { true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 3 - 1280x800 - { false, false, nullptr, nullptr, false }, // 4 - { false, false, nullptr, nullptr, false }, // 5 - { false, false, nullptr, nullptr, false }, // 6 - { false, false, nullptr, nullptr, false }, // 7 - { true, false, [](uint32_t Width)->uint32_t { return Width / 2; }, [](uint32_t Height)->uint32_t { return Height / 2; }, false }, // 8 - Half-Res - { true, true, [](uint32_t Width)->uint32_t { return Width * 0.75; }, [](uint32_t Height)->uint32_t { return Height * 0.75; }, false }, // 9 - Res * 0.75 - { true, true, [](uint32_t Width)->uint32_t { return Width * 2; }, [](uint32_t Height)->uint32_t { return Height * 2; }, false }, // 10 - SSAAx2 + { true, true, [](uint32_t Width)->uint32_t { return Width; }, [](uint32_t Height)->uint32_t { return Height; }, false }, // 1 - Native (Linear) + { true, false, [](uint32_t Width)->uint32_t { return 320; }, [](uint32_t Height)->uint32_t { return 200; }, true }, // 2 - 320x200 + { true, false, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 3 - 640x400 + { true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 4 - 1280x800 }; } +CUSTOM_CVAR(Float, vid_scalefactor, 1.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +{ + if (self <= 0.0 || self > 2.0) + self = 1.0; +} + CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (self < 0 || self >= NUMSCALEMODES || vScaleTable[self].isValid == false) @@ -64,17 +64,18 @@ CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) bool ViewportLinearScale() { - return vScaleTable[vid_scalemode].isLinear; + // vid_scalefactor > 1 == forced linear scale + return (vid_scalefactor > 1.0) ? true : vScaleTable[vid_scalemode].isLinear; } int ViewportScaledWidth(int width) { - return vScaleTable[vid_scalemode].GetScaledWidth(width); + return vScaleTable[vid_scalemode].GetScaledWidth((int)((float)width * vid_scalefactor)); } int ViewportScaledHeight(int height) { - return vScaleTable[vid_scalemode].GetScaledHeight(height); + return vScaleTable[vid_scalemode].GetScaledHeight((int)((float)height * vid_scalefactor)); } bool ViewportIsScaled43() diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 3c20a7bfd84..95a13e513a6 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2193,6 +2193,7 @@ VIDMNU_ASPECTRATIO = "Aspect ratio"; VIDMNU_FORCEASPECT = "Force aspect ratio"; VIDMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio"; VIDMNU_SCALEMODE = "Resolution scale"; +VIDMNU_SCALEFACTOR = "Scale Factor"; VIDMNU_ENTERTEXT = "Press ENTER to set mode"; VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds"; VIDMNU_TESTTEXT2 = "Please wait 5 seconds..."; @@ -2378,6 +2379,8 @@ OPTVAL_VTFZDOOM = "ZDoom (Forced)"; OPTVAL_VTFVANILLA = "Vanilla (Forced)"; OPTVAL_VTAZDOOM = "Auto (ZDoom Preferred)"; OPTVAL_VTAVANILLA = "Auto (Vanilla Preferred)"; +OPTVAL_SCALENEAREST = "Scaled (Nearest)"; +OPTVAL_SCALELINEAR = "Scaled (Linear)"; // Colors C_BRICK = "\cabrick"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 59c7946cb3a..38b447d4450 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1858,13 +1858,11 @@ OptionValue RatiosTFT } OptionValue ScaleModes { - 0, "$OPTVAL_OFF" - 1, "320x200" - 2, "640x400" - 3, "1280x800" - 8, "0.5x" - 9, "0.75x" - 10, "2x SSAA" + 0, "$OPTVAL_SCALENEAREST" + 1, "$OPTVAL_SCALELINEAR" + 2, "320x200" + 3, "640x400" + 4, "1280x800" } OptionMenu VideoModeMenu protected @@ -1880,6 +1878,7 @@ OptionMenu VideoModeMenu protected Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios" Option "$VIDMNU_5X4ASPECTRATIO", "vid_tft", "YesNo" Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes" + Slider "$VIDMNU_SCALEFACTOR", "vid_scalefactor", 0.25, 2.0, 0.25, 2 StaticText " " ScreenResolution "res_0" ScreenResolution "res_1" From ea5cffdc819d80bd97fdfb771d7acc92739d01d5 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Wed, 30 Aug 2017 09:22:01 +0800 Subject: [PATCH 6/8] Added shadowmap quality setting to the dynamic light options menu. --- wadsrc/static/language.enu | 15 ++++++++------- wadsrc/static/menudef.txt | 25 ++++++++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 95a13e513a6..8448665db3d 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2688,13 +2688,14 @@ GLTEXMNU_TRIMSPREDGE = "Trim sprite edges"; GLTEXMNU_SORTDRAWLIST = "Sort draw lists by texture"; // Dynamic Light Options -GLLIGHTMNU_TITLE = "DYNAMIC LIGHTS"; -GLLIGHTMNU_LIGHTSENABLED = "Dynamic Lights (OpenGL)"; -GLLIGHTMNU_LIGHTDEFS = "Enable light definitions"; -GLLIGHTMNU_CLIPLIGHTS = "Clip lights"; -GLLIGHTMNU_LIGHTSPRITES = "Lights affect sprites"; -GLLIGHTMNU_LIGHTPARTICLES = "Lights affect particles"; -GLLIGHTMNU_LIGHTSHADOWMAP = "Light shadowmaps"; +GLLIGHTMNU_TITLE = "DYNAMIC LIGHTS"; +GLLIGHTMNU_LIGHTSENABLED = "Dynamic Lights (OpenGL)"; +GLLIGHTMNU_LIGHTDEFS = "Enable light definitions"; +GLLIGHTMNU_CLIPLIGHTS = "Clip lights"; +GLLIGHTMNU_LIGHTSPRITES = "Lights affect sprites"; +GLLIGHTMNU_LIGHTPARTICLES = "Lights affect particles"; +GLLIGHTMNU_LIGHTSHADOWMAP = "Light shadowmaps"; +GLLIGHTMNU_LIGHTSHADOWMAPQUALITY = "Shadowmap quality"; // OpenGL Preferences GLPREFMNU_TITLE = "OPENGL PREFERENCES"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 38b447d4450..f9627516a8a 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -2127,6 +2127,16 @@ OptionValue VRMode 7, "$OPTVAL_QUADBUFFERED" } +OptionValue ShadowMapQuality +{ + 32, "32" + 64, "64" + 128, "128" + 256, "256" + 512, "512" + 1024, "1024" +} + OptionMenu "GLTextureGLOptions" protected { Title "$GLTEXMNU_TITLE" @@ -2147,13 +2157,14 @@ OptionMenu "GLTextureGLOptions" protected OptionMenu "GLLightOptions" protected { Title "$GLLIGHTMNU_TITLE" - Option "$TCMNU_DYNLIGHTS", "r_dynlights", "OnOff" - Option "$GLLIGHTMNU_LIGHTSENABLED", gl_lights, "OnOff" - Option "$GLLIGHTMNU_LIGHTDEFS", gl_attachedlights, "YesNo" - Option "$GLLIGHTMNU_CLIPLIGHTS", gl_lights_checkside, "YesNo" - Option "$GLLIGHTMNU_LIGHTSPRITES", gl_light_sprites, "YesNo" - Option "$GLLIGHTMNU_LIGHTPARTICLES", gl_light_particles, "YesNo" - Option "$GLLIGHTMNU_LIGHTSHADOWMAP", gl_light_shadowmap, "YesNo" + Option "$TCMNU_DYNLIGHTS", "r_dynlights", "OnOff" + Option "$GLLIGHTMNU_LIGHTSENABLED", gl_lights, "OnOff" + Option "$GLLIGHTMNU_LIGHTDEFS", gl_attachedlights, "YesNo" + Option "$GLLIGHTMNU_CLIPLIGHTS", gl_lights_checkside, "YesNo" + Option "$GLLIGHTMNU_LIGHTSPRITES", gl_light_sprites, "YesNo" + Option "$GLLIGHTMNU_LIGHTPARTICLES", gl_light_particles, "YesNo" + Option "$GLLIGHTMNU_LIGHTSHADOWMAP", gl_light_shadowmap, "YesNo" + Option "$GLLIGHTMNU_LIGHTSHADOWMAPQUALITY", gl_shadowmap_quality, "ShadowMapQuality" } OptionMenu "OpenGLOptions" protected From 3ff15976405b53d052007af96e4a134b98fca1a4 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Thu, 31 Aug 2017 09:46:52 +0800 Subject: [PATCH 7/8] Change minimum shadowmap quality to 128. --- src/gl/dynlights/gl_shadowmap.cpp | 2 -- wadsrc/static/menudef.txt | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/gl/dynlights/gl_shadowmap.cpp b/src/gl/dynlights/gl_shadowmap.cpp index 0f493b7517e..e472635fd28 100644 --- a/src/gl/dynlights/gl_shadowmap.cpp +++ b/src/gl/dynlights/gl_shadowmap.cpp @@ -86,8 +86,6 @@ CUSTOM_CVAR(Int, gl_shadowmap_quality, 128, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { switch (self) { - case 32: - case 64: case 128: case 256: case 512: diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index f9627516a8a..729a914eb6f 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -2129,8 +2129,6 @@ OptionValue VRMode OptionValue ShadowMapQuality { - 32, "32" - 64, "64" 128, "128" 256, "256" 512, "512" From d80f9634e3973339c6d26ea3bbed12fc859c5477 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Thu, 31 Aug 2017 09:48:10 +0800 Subject: [PATCH 8/8] Change default shadowmap quality to 512 at dpJudas's advice (https://forum.zdoom.org/viewtopic.php?p=1016143#p1016143) --- src/gl/dynlights/gl_shadowmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gl/dynlights/gl_shadowmap.cpp b/src/gl/dynlights/gl_shadowmap.cpp index e472635fd28..4ef06efa3c4 100644 --- a/src/gl/dynlights/gl_shadowmap.cpp +++ b/src/gl/dynlights/gl_shadowmap.cpp @@ -82,7 +82,7 @@ ADD_STAT(shadowmap) return out; } -CUSTOM_CVAR(Int, gl_shadowmap_quality, 128, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Int, gl_shadowmap_quality, 512, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { switch (self) {