Merge branch 'Saturn-Next' into Saturn-Testing
This commit is contained in:
commit
6a43f0a09d
3 files changed
+68
-82
No files matched your search
@@ -142,9 +142,6 @@ boolean I_UseNativeKeyboard(void);
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
#endif
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
void I_DownSample(void);
|
||||
|
||||
+48
-61
@@ -130,6 +130,10 @@ consvar_t cv_keyboardlayout = {"keyboardlayout", "Default US", CV_SAVE|CV_CALL,
|
||||
|
||||
static void Impl_SetVsync(void);
|
||||
|
||||
static INT32 desktopwidth = 0, desktopheight = 0;
|
||||
|
||||
static void I_CheckDesktopRes(void);
|
||||
|
||||
// synchronize page flipping with screen refresh
|
||||
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Impl_SetVsync, 0, NULL, NULL, 0, 0, NULL};
|
||||
static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -219,10 +223,6 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
|
||||
static void Impl_SetWindowIcon(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
static void I_FixXwaylandNvidia(void);
|
||||
boolean xwaylandcrap = false;
|
||||
#endif
|
||||
boolean downsample = false;
|
||||
void RefreshOGLSDLSurface(void)
|
||||
{
|
||||
@@ -280,10 +280,8 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
I_CheckDesktopRes();
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
I_FixXwaylandNvidia();
|
||||
#endif
|
||||
I_DownSample();
|
||||
#endif
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
@@ -704,96 +702,86 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
return raxis;
|
||||
}
|
||||
|
||||
boolean I_CheckNativeRes(void)
|
||||
static void I_CheckDesktopRes(void)
|
||||
{
|
||||
static int oldwidth = 0, oldheight = 0;
|
||||
static boolean resstate = false;
|
||||
int currentDisplayIndex = 0;
|
||||
int currentDisplayIndex = -1;
|
||||
SDL_DisplayMode curmode;
|
||||
|
||||
if (oldwidth == vid.width && oldheight == vid.height)
|
||||
if (desktopwidth == vid.width && desktopheight == vid.height)
|
||||
{
|
||||
return resstate;
|
||||
return;
|
||||
}
|
||||
|
||||
desktopwidth = 0;
|
||||
desktopheight = 0;
|
||||
|
||||
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
// No valid index
|
||||
if (currentDisplayIndex < 0)
|
||||
{
|
||||
return resstate;
|
||||
return;
|
||||
}
|
||||
|
||||
resstate = ((vid.width == curmode.w) && (vid.height == curmode.h));
|
||||
oldwidth = vid.width;
|
||||
oldheight = vid.height;
|
||||
return resstate;
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
desktopwidth = curmode.w;
|
||||
desktopheight = curmode.h;
|
||||
}
|
||||
|
||||
boolean I_CheckNativeRes(void)
|
||||
{
|
||||
return (vid.width == desktopwidth && vid.height == desktopheight);
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void I_DownSample(void)
|
||||
{
|
||||
if (!cv_glframebuffer.value || !supportFBO || I_CheckNativeRes()) //no sense to do this crap if we cant benefit from it
|
||||
boolean needrefresh = false;
|
||||
|
||||
if (!cv_glframebuffer.value || !supportFBO || (cv_glscreentextures.value == 0)) // no sense to do this crap if we cant benefit from it
|
||||
{
|
||||
downsample = false;
|
||||
return;
|
||||
}
|
||||
|
||||
int currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
SDL_DisplayMode curmode;
|
||||
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
if (I_CheckNativeRes() && (downsample == true))
|
||||
{
|
||||
downsample = false; // couldnt get display info so turn the thing off
|
||||
downsample = false;
|
||||
RefreshOGLSDLSurface();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((vid.width > curmode.w) || (vid.height > curmode.h)) //check if current resolution is higher than current display resolution
|
||||
if ((vid.width > desktopwidth) || (vid.height > desktopheight)) //check if current resolution is higher than current display resolution
|
||||
{
|
||||
downsample = true;
|
||||
needrefresh = true;
|
||||
}
|
||||
else if (downsample == true)
|
||||
{
|
||||
downsample = false;
|
||||
needrefresh = true;
|
||||
}
|
||||
|
||||
if (needrefresh)
|
||||
{
|
||||
RefreshOGLSDLSurface();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (downsample == true)
|
||||
{
|
||||
downsample = false; // its not so no need to do crap
|
||||
RefreshOGLSDLSurface();
|
||||
}
|
||||
needrefresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (__unix__)
|
||||
static void I_FixXwaylandNvidia(void) //dumbass crap, fix ur shit nvidia
|
||||
{
|
||||
if (!supportFBO)
|
||||
{
|
||||
xwaylandcrap = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// enable fbo resize shit, update the ogl surface and turn crap back off lol
|
||||
xwaylandcrap = true;
|
||||
RefreshOGLSDLSurface();
|
||||
xwaylandcrap = false;
|
||||
RefreshOGLSDLSurface();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
{
|
||||
#ifdef USE_FBO_OGL
|
||||
#define FOCUSUNION (mousefocus | (kbfocus << 1) | (windowmoved << 2))
|
||||
#else
|
||||
#define FOCUSUNION (mousefocus | (kbfocus << 1))
|
||||
#endif
|
||||
|
||||
static SDL_bool firsttimeonmouse = SDL_TRUE;
|
||||
static SDL_bool mousefocus = SDL_TRUE;
|
||||
static SDL_bool kbfocus = SDL_TRUE;
|
||||
#ifdef USE_FBO_OGL
|
||||
static SDL_bool windowmoved = SDL_FALSE;
|
||||
#endif
|
||||
|
||||
const unsigned int oldfocus = FOCUSUNION;
|
||||
|
||||
@@ -815,11 +803,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
break;
|
||||
#ifdef USE_FBO_OGL
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
windowmoved = SDL_TRUE;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (FOCUSUNION == oldfocus) // No state change
|
||||
@@ -827,12 +813,13 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (windowmoved && rendermode == render_opengl)
|
||||
{
|
||||
I_CheckDesktopRes();
|
||||
#ifdef USE_FBO_OGL
|
||||
I_DownSample();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mousefocus && kbfocus)
|
||||
{
|
||||
|
||||
+20
-18
@@ -71,15 +71,16 @@ PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
#if defined (__unix__)
|
||||
static boolean isnvidiagpu = false;
|
||||
static boolean xwaylandcrap = false;
|
||||
#endif
|
||||
|
||||
boolean UseScreenFBO(void)
|
||||
{
|
||||
return ((supportFBO && cv_glframebuffer.value && downsample)
|
||||
#if defined (__unix__)
|
||||
|| (supportFBO && isnvidiagpu && xwaylandcrap)
|
||||
|| (supportFBO && xwaylandcrap)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
@@ -189,8 +190,8 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
|
||||
#if defined (__unix__)
|
||||
#ifdef USE_FBO_OGL
|
||||
if (strstr((const char*)gl_renderer, "NVIDIA"))
|
||||
isnvidiagpu = true;
|
||||
if (supportFBO && strstr((const char*)gl_renderer, "NVIDIA"))
|
||||
xwaylandcrap = true;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -215,13 +216,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
if (!supportFBO)
|
||||
{
|
||||
if (cv_glframebuffer.value)
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
}
|
||||
|
||||
if (UseScreenFBO())
|
||||
GL_Framebuffer_Enable();
|
||||
else
|
||||
@@ -247,6 +241,9 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
{
|
||||
static boolean oldwaitvbl = false;
|
||||
int sdlw, sdlh;
|
||||
|
||||
const boolean usefbo = UseScreenFBO();
|
||||
|
||||
if (oldwaitvbl != waitvbl)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
|
||||
@@ -258,7 +255,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
HWR_MakeScreenFinalTexture();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
if (usefbo)
|
||||
{
|
||||
GL_Framebuffer_Unbind();
|
||||
}
|
||||
@@ -267,7 +264,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
if (usefbo)
|
||||
{
|
||||
GL_Framebuffer_Enable();
|
||||
}
|
||||
@@ -279,14 +276,19 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
if ((!I_CheckNativeRes()) // well we dont need it on native res it seems
|
||||
// well we dont need it on native res it seems
|
||||
#ifdef USE_FBO_OGL
|
||||
&& (!UseScreenFBO())
|
||||
if (!I_CheckNativeRes() && !usefbo)
|
||||
#else
|
||||
if (!I_CheckNativeRes())
|
||||
#endif
|
||||
|| WipeInAction
|
||||
)
|
||||
//HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, realwidth, realheight, false);
|
||||
|
||||
#if defined (__unix__)
|
||||
#ifdef USE_FBO_OGL
|
||||
xwaylandcrap = false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
||||
Reference in new issue
Block a user