Merge remote-tracking branch 'origin/master' into vulkan2

This commit is contained in:
Magnus Norddahl 2019-03-05 03:07:30 +01:00
commit 319099fee9
57 changed files with 158 additions and 53 deletions

View file

@ -2635,6 +2635,7 @@ void D_DoomMain (void)
V_Init2();
UpdateJoystickMenu(NULL);
UpdateVRModes();
v = Args->CheckValue ("-loadgame");
if (v)

View file

@ -129,7 +129,7 @@ CUSTOM_CVAR(Float, teamdamage, 0.f, CVAR_SERVERINFO | CVAR_NOINITCALL)
}
}
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL)
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
{
SetLanguageIDs();
GStrings.UpdateLanguage();

View file

@ -108,6 +108,7 @@ CVAR (Bool, storesavepic, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, longsavemessages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, save_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
CVAR (Bool, cl_waitforsave, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR (Bool, enablescriptscreenshot, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
EXTERN_CVAR (Float, con_midtime);
//==========================================================================
@ -1715,7 +1716,7 @@ void G_DoPlayerPop(int playernum)
players[playernum].DestroyPSprites();
}
void G_ScreenShot (char *filename)
void G_ScreenShot (const char *filename)
{
shotfile = filename;
gameaction = ga_screenshot;
@ -2876,6 +2877,26 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, StartSlideshow)
return 0;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, MakeScreenShot)
{
if (enablescriptscreenshot)
{
G_ScreenShot("");
}
return 0;
}
void G_MakeAutoSave()
{
gameaction = ga_autosave;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, MakeAutoSave)
{
G_MakeAutoSave();
return 0;
}
DEFINE_GLOBAL(players)
DEFINE_GLOBAL(playeringame)
DEFINE_GLOBAL(PlayerClasses)

View file

@ -95,7 +95,7 @@ bool G_CheckDemoStatus (void);
void G_Ticker (void);
bool G_Responder (event_t* ev);
void G_ScreenShot (char *filename);
void G_ScreenShot (const char* filename);
void G_StartSlideshow(FLevelLocals *Level, FName whichone);
FString G_BuildSaveName (const char *prefix, int slot);

View file

@ -751,12 +751,24 @@ int FFont::GetCharCode(int code, bool needpic) const
}
}
code = originalcode;
if (myislower(code))
{
int upper = upperforlower[code];
// Stripping accents did not help - now try uppercase for lowercase
if (upper != code) return GetCharCode(upper, needpic);
}
// Same for the uppercase character. Since we restart at the accented version this must go through the entire thing again.
while ((newcode = stripaccent(code)) != code)
{
code = newcode;
if (code >= FirstChar && code <= LastChar && (!needpic || Chars[code - FirstChar].TranslatedPic != nullptr))
{
return code;
}
}
}
return -1;

View file

@ -837,10 +837,19 @@ int stripaccent(int code)
return 'P' + (code & 0x20); // well, it sort of looks like a 'P'
}
else if (code >= 0x100 && code < 0x180)
{
// For the double-accented Hungarian letters it makes more sense to first map them to the very similar looking Umlauts.
// (And screw the crappy specs here that do not allow UTF-8 multibyte characters here.)
if (code == 0x150) code = 0xd6;
else if (code == 0x151) code = 0xf6;
else if (code == 0x170) code = 0xdc;
else if (code == 0x171) code = 0xfc;
else
{
static const char accentless[] = "AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnnNnOoOoOoOoRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZz ";
return accentless[code - 0x100];
}
}
else if (code >= 0x200 && code < 0x21c)
{
// 0x200-0x217 are probably irrelevant but easy to map to other characters more likely to exist. 0x218-0x21b are relevant for Romanian but also have a fallback within ranges that are more likely to be supported.

View file

@ -33,6 +33,7 @@
**
*/
#include <ctype.h>
#include "resourcefile.h"
#include "v_text.h"
#include "w_wad.h"

View file

@ -354,7 +354,7 @@ void FStringTable::InsertString(int langid, FName label, const FString &string)
Printf("Bad macro in %s : %s\n", strlangid, label.GetChars());
break;
}
FString macroname(string.GetChars() + index + 2, endindex - index - 2);
FString macroname(te.strings[0].GetChars() + index + 2, endindex - index - 2);
FStringf lookupstr("%s/%s", strlangid, macroname.GetChars());
FStringf replacee("@[%s]", macroname.GetChars());
FName lookupname(lookupstr, true);

View file

@ -34,6 +34,7 @@
*/
#include <ctype.h>
#include "intermission/intermission.h"
#include "g_level.h"
#include "w_wad.h"

View file

@ -363,4 +363,6 @@ DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotk
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered = false);
void UpdateVRModes(bool considerQuadBuffered=true);
#endif

View file

@ -1724,3 +1724,31 @@ fail:
}
}
}
#ifdef _WIN32
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
#endif
void UpdateVRModes(bool considerQuadBuffered)
{
FOptionValues ** pVRModes = OptionValues.CheckKey("VRMode");
if (pVRModes == nullptr) return;
TArray<FOptionValues::Pair> & vals = (*pVRModes)->mValues;
TArray<FOptionValues::Pair> filteredValues;
int cnt = vals.Size();
for (int i = 0; i < cnt; ++i) {
auto const & mode = vals[i];
if (mode.Value == 7) { // Quad-buffered stereo
#ifdef _WIN32
if (!vr_enable_quadbuffered) continue;
#else
continue; // Remove quad-buffered option on Mac and Linux
#endif
if (!considerQuadBuffered) continue; // Probably no compatible screen mode was found
}
filteredValues.Push(mode);
}
vals = filteredValues;
}

View file

@ -180,7 +180,7 @@ void I_Error (const char *error, ...)
va_start(argptr, error);
vsprintf (errortext, error, argptr);
myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr);
va_end (argptr);
throw CRecoverableError(errortext);
}

View file

@ -229,7 +229,7 @@ void I_Error (const char *error, ...)
va_start(argptr, error);
vsprintf (errortext, error, argptr);
myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr);
va_end (argptr);
throw CRecoverableError(errortext);
}

View file

@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <ctype.h>
#include "m_swap.h"
#include "m_argv.h"

View file

@ -121,20 +121,11 @@ void FGLRenderer::BlurScene(float gameinfobluramount)
mBuffers->UpdateEffectTextures();
auto vrmode = VRMode::GetVRMode(true);
if (vrmode->mEyeCount == 1)
int eyeCount = vrmode->mEyeCount;
for (int i = 0; i < eyeCount; ++i)
{
mBuffers->RenderEffect("BlurScene");
}
else
{
for (int eye_ix = 0; eye_ix < vrmode->mEyeCount; ++eye_ix)
{
FGLDebug::PushGroup("EyeBlur");
mBuffers->BlitFromEyeTexture(eye_ix);
mBuffers->RenderEffect("BlurScene");
mBuffers->BlitToEyeTexture(eye_ix);
FGLDebug::PopGroup();
}
if (eyeCount - i > 1) mBuffers->NextEye(eyeCount);
}
}
@ -159,13 +150,12 @@ void FGLRenderer::Flush()
else
{
// Render 2D to eye textures
for (int eye_ix = 0; eye_ix < vrmode->mEyeCount; ++eye_ix)
int eyeCount = vrmode->mEyeCount;
for (int eye_ix = 0; eye_ix < eyeCount; ++eye_ix)
{
FGLDebug::PushGroup("Eye2D");
mBuffers->BlitFromEyeTexture(eye_ix);
screen->Draw2D();
mBuffers->BlitToEyeTexture(eye_ix);
FGLDebug::PopGroup();
if (eyeCount - eye_ix > 1)
mBuffers->NextEye(eyeCount);
}
screen->Clear2D();

View file

@ -532,7 +532,7 @@ void FGLRenderBuffers::BlitSceneToTexture()
//
//==========================================================================
void FGLRenderBuffers::BlitToEyeTexture(int eye)
void FGLRenderBuffers::BlitToEyeTexture(int eye, bool allowInvalidate)
{
CreateEyeBuffers(eye);
@ -540,7 +540,7 @@ void FGLRenderBuffers::BlitToEyeTexture(int eye)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mEyeFBs[eye].handle);
glBlitFramebuffer(0, 0, mWidth, mHeight, 0, 0, mWidth, mHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
if ((gl.flags & RFL_INVALIDATE_BUFFER) != 0)
if ((gl.flags & RFL_INVALIDATE_BUFFER) != 0 && allowInvalidate)
{
GLenum attachments[2] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_STENCIL_ATTACHMENT };
glInvalidateFramebuffer(GL_READ_FRAMEBUFFER, 2, attachments);
@ -552,7 +552,7 @@ void FGLRenderBuffers::BlitToEyeTexture(int eye)
void FGLRenderBuffers::BlitFromEyeTexture(int eye)
{
CreateEyeBuffers(eye);
if (mEyeFBs.Size() <= unsigned(eye)) return;
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mPipelineFB[mCurrentPipelineTexture].handle);
glBindFramebuffer(GL_READ_FRAMEBUFFER, mEyeFBs[eye].handle);
@ -1002,4 +1002,17 @@ void FGLRenderBuffers::RenderEffect(const FString &name)
FGLDebug::PopGroup();
}
// Store the current stereo 3D eye buffer, and Load the next one
int FGLRenderBuffers::NextEye(int eyeCount)
{
int nextEye = (mCurrentEye + 1) % eyeCount;
if (nextEye == mCurrentEye) return mCurrentEye;
BlitToEyeTexture(mCurrentEye);
mCurrentEye = nextEye;
BlitFromEyeTexture(mCurrentEye);
return mCurrentEye;
}
} // namespace OpenGLRenderer

View file

@ -87,9 +87,11 @@ public:
void BindOutputFB();
void BlitToEyeTexture(int eye);
void BlitToEyeTexture(int eye, bool allowInvalidate=true);
void BlitFromEyeTexture(int eye);
void BindEyeTexture(int eye, int texunit);
int NextEye(int eyeCount);
int & CurrentEye() { return mCurrentEye; }
void BindDitherTexture(int texunit);
@ -156,6 +158,7 @@ private:
// Eye buffers
TArray<PPGLTexture> mEyeTextures;
TArray<PPGLFrameBuffer> mEyeFBs;
int mCurrentEye = 0;
// Shadow map texture
PPGLTexture mShadowMapTexture;

View file

@ -163,9 +163,11 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came
// Render (potentially) multiple views for stereo 3d
// Fixme. The view offsetting should be done with a static table and not require setup of the entire render state for the mode.
auto vrmode = VRMode::GetVRMode(mainview && toscreen);
for (int eye_ix = 0; eye_ix < vrmode->mEyeCount; ++eye_ix)
const int eyeCount = vrmode->mEyeCount;
mBuffers->CurrentEye() = 0; // always begin at zero, in case eye count changed
for (int eye_ix = 0; eye_ix < eyeCount; ++eye_ix)
{
const auto &eye = vrmode->mEyes[eye_ix];
const auto &eye = vrmode->mEyes[mBuffers->CurrentEye()];
screen->SetViewportRects(bounds);
if (mainview) // Bind the scene frame buffer and turn on draw buffers used by ssao
@ -218,8 +220,8 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came
PostProcess.Unclock();
}
di->EndDrawInfo();
if (vrmode->mEyeCount > 1)
mBuffers->BlitToEyeTexture(eye_ix);
if (eyeCount - eye_ix > 1)
mBuffers->NextEye(eyeCount);
}
return mainvp.sector;

View file

@ -34,6 +34,7 @@
#include "gl/system/gl_framebuffer.h"
#include "hwrenderer/postprocessing/hw_presentshader.h"
#include "hwrenderer/postprocessing/hw_present3dRowshader.h"
#include "menu/menu.h"
EXTERN_CVAR(Int, vr_mode)
EXTERN_CVAR(Float, vid_saturation)
@ -283,6 +284,8 @@ bool FGLRenderer::QuadStereoCheckInitialRenderContextState()
// Now check whether this context supports hardware stereo
glGetBooleanv(GL_STEREO, &supportsStereo);
bQuadStereoSupported = supportsStereo && supportsBuffered;
if (! bQuadStereoSupported)
UpdateVRModes(false);
}
}
return bQuadStereoSupported;
@ -324,6 +327,12 @@ void FGLRenderer::PresentQuadStereo()
void FGLRenderer::PresentStereo()
{
auto vrmode = VRMode::GetVRMode(true);
const int eyeCount = vrmode->mEyeCount;
// Don't invalidate the bound framebuffer (..., false)
if (eyeCount > 1)
mBuffers->BlitToEyeTexture(mBuffers->CurrentEye(), false);
switch (vr_mode)
{
default:

View file

@ -828,7 +828,7 @@ void cmsg(int type, int verbosity_level, const char *fmt, ...)
char buf[1024];
va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args);
myvsnprintf(buf, sizeof buf, fmt, args);
va_end(args);
I_DebugPrint(buf);
#endif

View file

@ -361,7 +361,6 @@ public:
float glslversion = 0; // This is here so that the differences between old OpenGL and new OpenGL/Vulkan can be handled by platform independent code.
int instack[2] = { 0,0 }; // this is globally maintained state for portal recursion avoidance.
int stencilValue = 0; // Global stencil test value
bool enable_quadbuffered = false; // Quad-buffered stereo available?
unsigned int uniformblockalignment = 256; // Hardware dependent uniform buffer alignment.
unsigned int maxuniformblock = 65536;
const char *gl_vendorstring; // On OpenGL (not Vulkan) we have to account for some issues with Intel.

View file

@ -56,14 +56,6 @@ extern HWND Window;
PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode.
// Setting vr_enable_quadbuffered_stereo does not automatically invoke quad-buffered stereo,
// but makes it possible for subsequent "vr_mode 7" to invoke quad-buffered stereo
CUSTOM_CVAR(Bool, vr_enable_quadbuffered, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
Printf("You must restart " GAMENAME " to switch quad stereo mode\n");
}
//==========================================================================
//
// Windows framebuffer
@ -111,7 +103,6 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool fullscreen) : Syst
}
}
ReleaseDC(Window, hDC);
enable_quadbuffered = vr_enable_quadbuffered;
}
//==========================================================================

View file

@ -433,7 +433,7 @@ void Writef (HANDLE file, const char *format, ...)
DWORD len;
va_start (args, format);
len = vsprintf (buffer, format, args);
len = myvsnprintf (buffer, sizeof buffer, format, args);
va_end (args);
WriteFile (file, buffer, len, &len, NULL);
}

View file

@ -55,8 +55,6 @@
CVAR(Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
//==========================================================================
//
//

View file

@ -54,7 +54,6 @@
#include "gl/system/gl_framebuffer.h"
EXTERN_CVAR(Int, vid_adapter)
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
EXTERN_CVAR(Bool, vid_hdr)
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
@ -62,6 +61,14 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
Printf("This won't take effect until " GAMENAME " is restarted.\n");
}
// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode.
// Setting vr_enable_quadbuffered_stereo does not automatically invoke quad-buffered stereo,
// but makes it possible for subsequent "vr_mode 7" to invoke quad-buffered stereo
CUSTOM_CVAR(Bool, vr_enable_quadbuffered, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
Printf("You must restart " GAMENAME " to switch quad stereo mode\n");
}
extern bool vid_hdr_active;
// these get used before GLEW is initialized so we have to use separate pointers with different names

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -1986,6 +1986,7 @@ MISCMNU_ALLCHEATS = "Enable cheats from all games";
MISCMNU_ENABLEAUTOSAVES = "Enable autosaves";
MISCMNU_AUTOSAVECOUNT = "Number of autosaves";
MISCMNU_SAVELOADCONFIRMATION = "Save/Load confirmation";
MISCMNU_ENABLESCRIPTSCREENSHOTS = "Enable making screenshots by scripts";
MISCMNU_DEHLOAD = "Load *.deh/*.bex lumps";
MISCMNU_CACHENODES = "Cache nodes";
MISCMNU_CACHETIME = "Time threshold for node caching";

View file

@ -1131,6 +1131,7 @@ OptionMenu "MiscOptions" protected
Option "$MISCMNU_SAVELOADCONFIRMATION", "saveloadconfirmation", "OnOff"
Slider "$MISCMNU_AUTOSAVECOUNT", "autosavecount", 1, 20, 1, 0
Option "$MISCMNU_DEHLOAD", "dehload", "dehopt"
Option "$MISCMNU_ENABLESCRIPTSCREENSHOTS", "enablescriptscreenshot", "OnOff"
Option "$MISCMNU_INTERSCROLL", "nointerscrollabort", "OffOn"
StaticText " "
Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff"
@ -1755,7 +1756,7 @@ OptionString SpeakerModes
OptionString Resamplers
{
"NoInterp", "$OPTSTR_NOINTERPOLATION"
"Linear", "$OPTVAL_LINEAR"
"Linear", "$OPTVAL_LINEAR_1"
"Cubic", "$OPTVAL_CUBIC"
"Spline", "$OPTSTR_SPLINE"
}
@ -1893,7 +1894,7 @@ OptionValue ModReplayers
OptionValue ModQuality
{
0.0, "$OPTVAL_ALIASING"
1.0, "$OPTVAL_LINEAR"
1.0, "$OPTVAL_LINEAR_1"
2.0, "$OPTVAL_CUBIC"
3.0, "$OPTVAL_BLEP" // Band-limited step
4.0, "$OPTVAL_LINEARSLOW"
@ -2224,7 +2225,7 @@ OptionValue "FilterModes"
1, "$OPTVAL_NONENEARESTMIPMAP"
5, "$OPTVAL_NONELINEARMIPMAP"
6, "$OPTVAL_NONETRILINEAR"
2, "$OPTVAL_LINEAR"
2, "$OPTVAL_LINEAR_2"
3, "$OPTVAL_BILINEAR"
4, "$OPTVAL_TRILINEAR"
}
@ -2235,7 +2236,7 @@ OptionValue "TonemapModes"
1, "$OPTVAL_UNCHARTED2"
2, "$OPTVAL_HEJLDAWSON"
3, "$OPTVAL_REINHARD"
4, "$OPTVAL_LINEAR"
4, "$OPTVAL_LINEAR_3"
5, "$OPTVAL_PALETTE"
}

View file

@ -460,6 +460,15 @@ class Actor : Thinker native
native void Substitute(Actor replacement);
native ui void DisplayNameTag();
// Called by inventory items to see if this actor is capable of touching them.
// If true, the item will attempt to be picked up. Useful for things like
// allowing morphs to pick up limited items such as keys while preventing
// them from picking other items up.
virtual bool CanTouchItem(Inventory item)
{
return true;
}
// Called by PIT_CheckThing to check if two actors actually can collide.
virtual bool CanCollideWith(Actor other, bool passive)
{

View file

@ -768,6 +768,9 @@ class Inventory : Actor
bool localview = toucher.CheckLocalView();
if (!toucher.CanTouchItem(self))
return;
bool res;
[res, toucher] = CallTryPickup(toucher);
if (!res) return;

View file

@ -711,6 +711,8 @@ struct LevelLocals native
native play int ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
native void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
native void StartSlideshow(Name whichone = 'none');
native static void MakeScreenShot();
native static void MakeAutoSave();
native void WorldDone();
deprecated("3.8") static void RemoveAllBots(bool fromlist) { /* intentionally left as no-op. */ }
native ui Vector2 GetAutomapPosition();

View file

@ -0,0 +1 @@
Kerning -1