Added adaptive vsync support (selectable in preferences->graphics->hardware, provided the driver supports it). Also hide 16x fsaa on amd hardware, as it is not supported on said hardware (unsure about intel).
This commit is contained in:
@@ -442,6 +442,8 @@ LLGLManager::LLGLManager() :
|
|||||||
mHasCubeMap(FALSE),
|
mHasCubeMap(FALSE),
|
||||||
mHasDebugOutput(FALSE),
|
mHasDebugOutput(FALSE),
|
||||||
|
|
||||||
|
mHasAdaptiveVsync(FALSE),
|
||||||
|
|
||||||
mIsATI(FALSE),
|
mIsATI(FALSE),
|
||||||
mIsNVIDIA(FALSE),
|
mIsNVIDIA(FALSE),
|
||||||
mIsIntel(FALSE),
|
mIsIntel(FALSE),
|
||||||
@@ -956,6 +958,12 @@ void LLGLManager::initExtensions()
|
|||||||
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LL_WINDOWS
|
||||||
|
mHasAdaptiveVsync = ExtensionExists("WGL_EXT_swap_control_tear", gGLHExts.mSysExts);
|
||||||
|
#elif LL_LINUX
|
||||||
|
mHasAdaptiveVsync = ExtensionExists("GLX_EXT_swap_control_tear", gGLHExts.mSysExts);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX || LL_SOLARIS
|
||||||
llinfos << "initExtensions() checking shell variables to adjust features..." << llendl;
|
llinfos << "initExtensions() checking shell variables to adjust features..." << llendl;
|
||||||
// Our extension support for the Linux Client is very young with some
|
// Our extension support for the Linux Client is very young with some
|
||||||
@@ -980,6 +988,7 @@ void LLGLManager::initExtensions()
|
|||||||
mHasShaderObjects = FALSE;
|
mHasShaderObjects = FALSE;
|
||||||
mHasVertexShader = FALSE;
|
mHasVertexShader = FALSE;
|
||||||
mHasFragmentShader = FALSE;
|
mHasFragmentShader = FALSE;
|
||||||
|
mHasAdaptiveVsync = FALSE;
|
||||||
LL_WARNS("RenderInit") << "GL extension support DISABLED via LL_GL_NOEXT" << LL_ENDL;
|
LL_WARNS("RenderInit") << "GL extension support DISABLED via LL_GL_NOEXT" << LL_ENDL;
|
||||||
}
|
}
|
||||||
else if (getenv("LL_GL_BASICEXT")) /* Flawfinder: ignore */
|
else if (getenv("LL_GL_BASICEXT")) /* Flawfinder: ignore */
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ public:
|
|||||||
BOOL mHasCubeMap;
|
BOOL mHasCubeMap;
|
||||||
BOOL mHasDebugOutput;
|
BOOL mHasDebugOutput;
|
||||||
|
|
||||||
|
BOOL mHasAdaptiveVsync;
|
||||||
|
|
||||||
// Vendor-specific extensions
|
// Vendor-specific extensions
|
||||||
BOOL mIsATI;
|
BOOL mIsATI;
|
||||||
BOOL mIsNVIDIA;
|
BOOL mIsNVIDIA;
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ LLWindow* LLWindowManager::createWindow(
|
|||||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
|
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
|
||||||
BOOL fullscreen,
|
BOOL fullscreen,
|
||||||
BOOL clearBg,
|
BOOL clearBg,
|
||||||
BOOL disable_vsync,
|
const S32 vsync_mode,
|
||||||
BOOL use_gl,
|
BOOL use_gl,
|
||||||
BOOL ignore_pixel_depth,
|
BOOL ignore_pixel_depth,
|
||||||
U32 fsaa_samples)
|
U32 fsaa_samples)
|
||||||
@@ -400,26 +400,26 @@ LLWindow* LLWindowManager::createWindow(
|
|||||||
#if LL_MESA_HEADLESS
|
#if LL_MESA_HEADLESS
|
||||||
new_window = new LLWindowMesaHeadless(callbacks,
|
new_window = new LLWindowMesaHeadless(callbacks,
|
||||||
title, name, x, y, width, height, flags,
|
title, name, x, y, width, height, flags,
|
||||||
fullscreen, clearBg, disable_vsync, ignore_pixel_depth);
|
fullscreen, clearBg, vsync_mode, ignore_pixel_depth);
|
||||||
#elif LL_SDL
|
#elif LL_SDL
|
||||||
new_window = new LLWindowSDL(callbacks,
|
new_window = new LLWindowSDL(callbacks,
|
||||||
title, x, y, width, height, flags,
|
title, x, y, width, height, flags,
|
||||||
fullscreen, clearBg, disable_vsync, ignore_pixel_depth, fsaa_samples);
|
fullscreen, clearBg, vsync_mode, ignore_pixel_depth, fsaa_samples);
|
||||||
#elif LL_WINDOWS
|
#elif LL_WINDOWS
|
||||||
new_window = new LLWindowWin32(callbacks,
|
new_window = new LLWindowWin32(callbacks,
|
||||||
title, name, x, y, width, height, flags,
|
title, name, x, y, width, height, flags,
|
||||||
fullscreen, clearBg, disable_vsync, ignore_pixel_depth, fsaa_samples);
|
fullscreen, clearBg, vsync_mode, ignore_pixel_depth, fsaa_samples);
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
new_window = new LLWindowMacOSX(callbacks,
|
new_window = new LLWindowMacOSX(callbacks,
|
||||||
title, name, x, y, width, height, flags,
|
title, name, x, y, width, height, flags,
|
||||||
fullscreen, clearBg, disable_vsync, ignore_pixel_depth, fsaa_samples);
|
fullscreen, clearBg, vsync_mode, ignore_pixel_depth, fsaa_samples);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_window = new LLWindowHeadless(callbacks,
|
new_window = new LLWindowHeadless(callbacks,
|
||||||
title, name, x, y, width, height, flags,
|
title, name, x, y, width, height, flags,
|
||||||
fullscreen, clearBg, disable_vsync, ignore_pixel_depth);
|
fullscreen, clearBg, vsync_mode, ignore_pixel_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FALSE == new_window->isValid())
|
if (FALSE == new_window->isValid())
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
BOOL setSize(LLCoordScreen size);
|
BOOL setSize(LLCoordScreen size);
|
||||||
BOOL setSize(LLCoordWindow size);
|
BOOL setSize(LLCoordWindow size);
|
||||||
virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
|
virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
|
||||||
virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
|
virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp = NULL) = 0;
|
||||||
virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
|
virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
|
||||||
virtual BOOL getCursorPosition(LLCoordWindow *position) = 0;
|
virtual BOOL getCursorPosition(LLCoordWindow *position) = 0;
|
||||||
virtual void showCursor() = 0;
|
virtual void showCursor() = 0;
|
||||||
@@ -121,6 +121,8 @@ public:
|
|||||||
virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma
|
virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma
|
||||||
virtual void setFSAASamples(const U32 fsaa_samples) = 0; //set number of FSAA samples
|
virtual void setFSAASamples(const U32 fsaa_samples) = 0; //set number of FSAA samples
|
||||||
virtual U32 getFSAASamples() = 0;
|
virtual U32 getFSAASamples() = 0;
|
||||||
|
virtual void setVsyncMode(const S32 vsync_mode) = 0;
|
||||||
|
virtual S32 getVsyncMode() = 0;
|
||||||
virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma)
|
virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma)
|
||||||
virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
|
virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
|
||||||
virtual void processMiscNativeEvents();
|
virtual void processMiscNativeEvents();
|
||||||
@@ -274,7 +276,7 @@ public:
|
|||||||
U32 flags = 0,
|
U32 flags = 0,
|
||||||
BOOL fullscreen = FALSE,
|
BOOL fullscreen = FALSE,
|
||||||
BOOL clearBg = FALSE,
|
BOOL clearBg = FALSE,
|
||||||
BOOL disable_vsync = TRUE,
|
const S32 vsync_mode = 0,
|
||||||
BOOL use_gl = TRUE,
|
BOOL use_gl = TRUE,
|
||||||
BOOL ignore_pixel_depth = FALSE,
|
BOOL ignore_pixel_depth = FALSE,
|
||||||
U32 fsaa_samples = 0);
|
U32 fsaa_samples = 0);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
//
|
//
|
||||||
LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||||
U32 flags, BOOL fullscreen, BOOL clear_background,
|
U32 flags, BOOL fullscreen, BOOL clear_background,
|
||||||
BOOL disable_vsync, BOOL ignore_pixel_depth)
|
const S32 vsync_mode, BOOL ignore_pixel_depth)
|
||||||
: LLWindow(callbacks, fullscreen, flags)
|
: LLWindow(callbacks, fullscreen, flags)
|
||||||
{
|
{
|
||||||
// Initialize a headless keyboard.
|
// Initialize a headless keyboard.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
|
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
|
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
|
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
|
||||||
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
|
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp = NULL) {return FALSE;};
|
||||||
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
|
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
|
||||||
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
|
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
|
||||||
/*virtual*/ void showCursor() {};
|
/*virtual*/ void showCursor() {};
|
||||||
@@ -69,6 +69,8 @@ public:
|
|||||||
/*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
|
/*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
|
||||||
/*virtual*/ void setFSAASamples(const U32 fsaa_samples) { }
|
/*virtual*/ void setFSAASamples(const U32 fsaa_samples) { }
|
||||||
/*virtual*/ U32 getFSAASamples() { return 0; }
|
/*virtual*/ U32 getFSAASamples() { return 0; }
|
||||||
|
/*virtual*/ void setVsyncMode(const S32 vsync_mode) {}
|
||||||
|
/*virtual*/ S32 getVsyncMode() { return 0; }
|
||||||
/*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
|
/*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
|
||||||
//virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
|
//virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
|
||||||
/*virtual*/ void gatherInput() {};
|
/*virtual*/ void gatherInput() {};
|
||||||
@@ -96,7 +98,7 @@ public:
|
|||||||
S32 x, S32 y,
|
S32 x, S32 y,
|
||||||
S32 width, S32 height,
|
S32 width, S32 height,
|
||||||
U32 flags, BOOL fullscreen, BOOL clear_background,
|
U32 flags, BOOL fullscreen, BOOL clear_background,
|
||||||
BOOL disable_vsync, BOOL ignore_pixel_depth);
|
const S32 vsync_mode, BOOL ignore_pixel_depth);
|
||||||
virtual ~LLWindowHeadless();
|
virtual ~LLWindowHeadless();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
||||||
S32 height, U32 flags,
|
S32 height, U32 flags,
|
||||||
BOOL fullscreen, BOOL clearBg,
|
BOOL fullscreen, BOOL clearBg,
|
||||||
BOOL disable_vsync,
|
const S32 vsync_mode,
|
||||||
BOOL ignore_pixel_depth,
|
BOOL ignore_pixel_depth,
|
||||||
U32 fsaa_samples)
|
U32 fsaa_samples)
|
||||||
: LLWindow(NULL, fullscreen, flags)
|
: LLWindow(NULL, fullscreen, flags)
|
||||||
@@ -253,6 +253,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
mPreeditor = NULL;
|
mPreeditor = NULL;
|
||||||
mRawKeyEvent = NULL;
|
mRawKeyEvent = NULL;
|
||||||
mFSAASamples = fsaa_samples;
|
mFSAASamples = fsaa_samples;
|
||||||
|
mVsyncMode = vsync_mode;
|
||||||
mForceRebuild = FALSE;
|
mForceRebuild = FALSE;
|
||||||
|
|
||||||
// For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
|
// For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
|
||||||
@@ -283,7 +284,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
gWindowImplementation = this;
|
gWindowImplementation = this;
|
||||||
|
|
||||||
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
|
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
|
||||||
if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
|
if(createContext(x, y, width, height, 32, fullscreen, vsync_mode))
|
||||||
{
|
{
|
||||||
if(mWindow != NULL)
|
if(mWindow != NULL)
|
||||||
{
|
{
|
||||||
@@ -323,7 +324,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync)
|
BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, const S32 vsync_mode)
|
||||||
{
|
{
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
BOOL glNeedsInit = FALSE;
|
BOOL glNeedsInit = FALSE;
|
||||||
@@ -780,7 +781,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
|
|
||||||
// Disable vertical sync for swap
|
// Disable vertical sync for swap
|
||||||
GLint frames_per_swap = 0;
|
GLint frames_per_swap = 0;
|
||||||
if (disable_vsync)
|
if (vsync_mode != 1)
|
||||||
{
|
{
|
||||||
LL_DEBUGS("GLInit") << "Disabling vertical sync" << LL_ENDL;
|
LL_DEBUGS("GLInit") << "Disabling vertical sync" << LL_ENDL;
|
||||||
frames_per_swap = 0;
|
frames_per_swap = 0;
|
||||||
@@ -816,7 +817,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||||||
|
|
||||||
|
|
||||||
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
|
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
|
||||||
BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
|
BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp)
|
||||||
{
|
{
|
||||||
BOOL needsRebuild = FALSE;
|
BOOL needsRebuild = FALSE;
|
||||||
BOOL result = true;
|
BOOL result = true;
|
||||||
@@ -892,7 +893,7 @@ BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, B
|
|||||||
{
|
{
|
||||||
mForceRebuild = FALSE;
|
mForceRebuild = FALSE;
|
||||||
destroyContext();
|
destroyContext();
|
||||||
result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync);
|
result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, vsync_mode);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if(mWindow != NULL)
|
if(mWindow != NULL)
|
||||||
@@ -1341,6 +1342,16 @@ void LLWindowMacOSX::setFSAASamples(const U32 samples)
|
|||||||
mForceRebuild = TRUE;
|
mForceRebuild = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLWindowMacOSX::getVsyncMode()
|
||||||
|
{
|
||||||
|
return mVsyncMode;
|
||||||
|
}
|
||||||
|
void LLWindowMacOSX::setVsyncMode(const S32 vsync_mode)
|
||||||
|
{
|
||||||
|
mVsyncMode = vsync_mode
|
||||||
|
mForceRebuild = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL LLWindowMacOSX::restoreGamma()
|
BOOL LLWindowMacOSX::restoreGamma()
|
||||||
{
|
{
|
||||||
CGDisplayRestoreColorSyncSettings();
|
CGDisplayRestoreColorSyncSettings();
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
|
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
|
||||||
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
|
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp = NULL);
|
||||||
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
|
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
|
||||||
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
|
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
|
||||||
/*virtual*/ void showCursor();
|
/*virtual*/ void showCursor();
|
||||||
@@ -81,6 +81,8 @@ public:
|
|||||||
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
||||||
/*virtual*/ U32 getFSAASamples();
|
/*virtual*/ U32 getFSAASamples();
|
||||||
/*virtual*/ void setFSAASamples(const U32 fsaa_samples);
|
/*virtual*/ void setFSAASamples(const U32 fsaa_samples);
|
||||||
|
/*virtual*/ void setVsyncMode(const S32 vsync_mode);
|
||||||
|
/*virtual*/ S32 getVsyncMode();
|
||||||
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
|
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
|
||||||
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
|
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
|
||||||
/*virtual*/ void gatherInput();
|
/*virtual*/ void gatherInput();
|
||||||
@@ -124,7 +126,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
||||||
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
||||||
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
|
BOOL fullscreen, BOOL clearBg, const S32 vsync_mode,
|
||||||
BOOL ignore_pixel_depth,
|
BOOL ignore_pixel_depth,
|
||||||
U32 fsaa_samples);
|
U32 fsaa_samples);
|
||||||
~LLWindowMacOSX();
|
~LLWindowMacOSX();
|
||||||
@@ -152,7 +154,7 @@ protected:
|
|||||||
//
|
//
|
||||||
|
|
||||||
// create or re-create the GL context/window. Called from the constructor and switchContext().
|
// create or re-create the GL context/window. Called from the constructor and switchContext().
|
||||||
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
|
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, const S32 vsync_mode);
|
||||||
void destroyContext();
|
void destroyContext();
|
||||||
void setupFailure(const std::string& text, const std::string& caption, U32 type);
|
void setupFailure(const std::string& text, const std::string& caption, U32 type);
|
||||||
static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
|
static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
|
||||||
@@ -201,6 +203,7 @@ protected:
|
|||||||
BOOL mMaximized;
|
BOOL mMaximized;
|
||||||
BOOL mMinimized;
|
BOOL mMinimized;
|
||||||
U32 mFSAASamples;
|
U32 mFSAASamples;
|
||||||
|
S32 mVsyncMode;
|
||||||
BOOL mForceRebuild;
|
BOOL mForceRebuild;
|
||||||
|
|
||||||
S32 mDragOverrideCursor;
|
S32 mDragOverrideCursor;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ U16 *gMesaBuffer = NULL;
|
|||||||
LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
|
LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
|
||||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||||
U32 flags, BOOL fullscreen, BOOL clearBg,
|
U32 flags, BOOL fullscreen, BOOL clearBg,
|
||||||
BOOL disable_vsync, BOOL ignore_pixel_depth)
|
const S32 vsync_mode, BOOL ignore_pixel_depth)
|
||||||
: LLWindow(callbacks, fullscreen, flags)
|
: LLWindow(callbacks, fullscreen, flags)
|
||||||
{
|
{
|
||||||
llinfos << "MESA Init" << llendl;
|
llinfos << "MESA Init" << llendl;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
|
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
|
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
|
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
|
||||||
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
|
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp = NULL) {return FALSE;};
|
||||||
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
|
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
|
||||||
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
|
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
|
||||||
/*virtual*/ void showCursor() {};
|
/*virtual*/ void showCursor() {};
|
||||||
@@ -74,6 +74,8 @@ public:
|
|||||||
/*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
|
/*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
|
||||||
/*virtual*/ void setFSAASamples(const U32 fsaa_samples) { /* FSAA not supported yet on Mesa headless.*/ }
|
/*virtual*/ void setFSAASamples(const U32 fsaa_samples) { /* FSAA not supported yet on Mesa headless.*/ }
|
||||||
/*virtual*/ U32 getFSAASamples() { return 0; }
|
/*virtual*/ U32 getFSAASamples() { return 0; }
|
||||||
|
/*virtual*/ void setVsyncMode(const S32 vsync_mode) {}
|
||||||
|
/*virtual*/ S32 getVsyncMode() { return 0; }
|
||||||
//virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
|
//virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
|
||||||
/*virtual*/ void gatherInput() {};
|
/*virtual*/ void gatherInput() {};
|
||||||
/*virtual*/ void delayInputProcessing() {};
|
/*virtual*/ void delayInputProcessing() {};
|
||||||
@@ -98,7 +100,7 @@ public:
|
|||||||
LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
|
LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
|
||||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||||
U32 flags, BOOL fullscreen, BOOL clearBg,
|
U32 flags, BOOL fullscreen, BOOL clearBg,
|
||||||
BOOL disable_vsync, BOOL ignore_pixel_depth);
|
const S32 vsync_mode, BOOL ignore_pixel_depth);
|
||||||
~LLWindowMesaHeadless();
|
~LLWindowMesaHeadless();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
|
|||||||
const std::string& title, S32 x, S32 y, S32 width,
|
const std::string& title, S32 x, S32 y, S32 width,
|
||||||
S32 height, U32 flags,
|
S32 height, U32 flags,
|
||||||
BOOL fullscreen, BOOL clearBg,
|
BOOL fullscreen, BOOL clearBg,
|
||||||
BOOL disable_vsync,
|
const S32 vsync_mode,
|
||||||
BOOL ignore_pixel_depth, U32 fsaa_samples)
|
BOOL ignore_pixel_depth, U32 fsaa_samples)
|
||||||
: LLWindow(callbacks, fullscreen, flags),
|
: LLWindow(callbacks, fullscreen, flags),
|
||||||
Lock_Display(NULL),
|
Lock_Display(NULL),
|
||||||
@@ -233,7 +233,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
|
|||||||
mWindowTitle = title;
|
mWindowTitle = title;
|
||||||
|
|
||||||
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
|
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
|
||||||
if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
|
if(createContext(x, y, width, height, 32, fullscreen, vsync_mode))
|
||||||
{
|
{
|
||||||
gGLManager.initGL();
|
gGLManager.initGL();
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ static int x11_detect_VRAM_kb()
|
|||||||
}
|
}
|
||||||
#endif // LL_X11
|
#endif // LL_X11
|
||||||
|
|
||||||
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync)
|
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, const S32 vsync_mode, S32 vsync_mode)
|
||||||
{
|
{
|
||||||
//bool glneedsinit = false;
|
//bool glneedsinit = false;
|
||||||
|
|
||||||
@@ -721,6 +721,26 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
|
|||||||
}
|
}
|
||||||
#endif // LL_X11
|
#endif // LL_X11
|
||||||
|
|
||||||
|
// Disable vertical sync for swap
|
||||||
|
if (vsync_mode == 0)
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
|
||||||
|
SDL_GL_SetSwapInterval(0);
|
||||||
|
}
|
||||||
|
else if(vsync_mode == -1)
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Enabling adaptive vertical sync" << LL_ENDL;
|
||||||
|
if(SDL_GL_SetSwapInterval(-1) == -1)
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL;
|
||||||
|
SDL_GL_SetSwapInterval(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL;
|
||||||
|
SDL_GL_SetSwapInterval(1);
|
||||||
|
}
|
||||||
|
|
||||||
//make sure multisampling is disabled by default
|
//make sure multisampling is disabled by default
|
||||||
glDisable(GL_MULTISAMPLE_ARB);
|
glDisable(GL_MULTISAMPLE_ARB);
|
||||||
@@ -736,7 +756,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
|
|||||||
|
|
||||||
|
|
||||||
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
|
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
|
||||||
BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
|
BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp)
|
||||||
{
|
{
|
||||||
const BOOL needsRebuild = TRUE; // Just nuke the context and start over.
|
const BOOL needsRebuild = TRUE; // Just nuke the context and start over.
|
||||||
BOOL result = true;
|
BOOL result = true;
|
||||||
@@ -746,7 +766,7 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL
|
|||||||
if(needsRebuild)
|
if(needsRebuild)
|
||||||
{
|
{
|
||||||
destroyContext();
|
destroyContext();
|
||||||
result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync);
|
result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, vsync_mode);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
gGLManager.initGL();
|
gGLManager.initGL();
|
||||||
@@ -987,6 +1007,16 @@ void LLWindowSDL::setFSAASamples(const U32 samples)
|
|||||||
mFSAASamples = samples;
|
mFSAASamples = samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLWindowSDL::getVsyncMode()
|
||||||
|
{
|
||||||
|
return mVsyncMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWindowSDL::setVsyncMode(const S32 vsync_mode)
|
||||||
|
{
|
||||||
|
mVsyncMode = vsync_mode
|
||||||
|
}
|
||||||
|
|
||||||
F32 LLWindowSDL::getGamma()
|
F32 LLWindowSDL::getGamma()
|
||||||
{
|
{
|
||||||
return 1/mGamma;
|
return 1/mGamma;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
|
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
|
||||||
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
|
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp = NULL);
|
||||||
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
|
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
|
||||||
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
|
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
|
||||||
/*virtual*/ void showCursor();
|
/*virtual*/ void showCursor();
|
||||||
@@ -92,6 +92,8 @@ public:
|
|||||||
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
||||||
/*virtual*/ U32 getFSAASamples();
|
/*virtual*/ U32 getFSAASamples();
|
||||||
/*virtual*/ void setFSAASamples(const U32 samples);
|
/*virtual*/ void setFSAASamples(const U32 samples);
|
||||||
|
/*virtual*/ void setVsyncMode(const S32 vsync_mode);
|
||||||
|
/*virtual*/ S32 getVsyncMode();
|
||||||
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
|
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
|
||||||
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
|
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
|
||||||
/*virtual*/ void processMiscNativeEvents();
|
/*virtual*/ void processMiscNativeEvents();
|
||||||
@@ -149,7 +151,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
LLWindowSDL(LLWindowCallbacks* callbacks,
|
LLWindowSDL(LLWindowCallbacks* callbacks,
|
||||||
const std::string& title, int x, int y, int width, int height, U32 flags,
|
const std::string& title, int x, int y, int width, int height, U32 flags,
|
||||||
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
|
BOOL fullscreen, BOOL clearBg, const S32 vsync_mode,
|
||||||
BOOL ignore_pixel_depth, U32 fsaa_samples);
|
BOOL ignore_pixel_depth, U32 fsaa_samples);
|
||||||
~LLWindowSDL();
|
~LLWindowSDL();
|
||||||
|
|
||||||
@@ -174,7 +176,7 @@ protected:
|
|||||||
//
|
//
|
||||||
|
|
||||||
// create or re-create the GL context/window. Called from the constructor and switchContext().
|
// create or re-create the GL context/window. Called from the constructor and switchContext().
|
||||||
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
|
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, const S32 vsync_mode);
|
||||||
void destroyContext();
|
void destroyContext();
|
||||||
void setupFailure(const std::string& text, const std::string& caption, U32 type);
|
void setupFailure(const std::string& text, const std::string& caption, U32 type);
|
||||||
void fixWindowSize(void);
|
void fixWindowSize(void);
|
||||||
@@ -194,6 +196,7 @@ protected:
|
|||||||
F32 mOverrideAspectRatio;
|
F32 mOverrideAspectRatio;
|
||||||
F32 mGamma;
|
F32 mGamma;
|
||||||
U32 mFSAASamples;
|
U32 mFSAASamples;
|
||||||
|
S32 mVsyncMode;
|
||||||
|
|
||||||
int mSDLFlags;
|
int mSDLFlags;
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
|
|||||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
||||||
S32 height, U32 flags,
|
S32 height, U32 flags,
|
||||||
BOOL fullscreen, BOOL clearBg,
|
BOOL fullscreen, BOOL clearBg,
|
||||||
BOOL disable_vsync,
|
const S32 vsync_mode,
|
||||||
BOOL ignore_pixel_depth,
|
BOOL ignore_pixel_depth,
|
||||||
U32 fsaa_samples)
|
U32 fsaa_samples)
|
||||||
: LLWindow(callbacks, fullscreen, flags)
|
: LLWindow(callbacks, fullscreen, flags)
|
||||||
@@ -903,7 +903,7 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// changing fullscreen resolution
|
// changing fullscreen resolution
|
||||||
BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
|
BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp)
|
||||||
{
|
{
|
||||||
GLuint pixel_format;
|
GLuint pixel_format;
|
||||||
DEVMODE dev_mode;
|
DEVMODE dev_mode;
|
||||||
@@ -1650,14 +1650,27 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable vertical sync for swap
|
// Disable vertical sync for swap
|
||||||
if (disable_vsync && wglSwapIntervalEXT)
|
if(wglSwapIntervalEXT)
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
|
if (vsync_mode == 0)
|
||||||
wglSwapIntervalEXT(0);
|
{
|
||||||
}
|
LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
|
||||||
else
|
wglSwapIntervalEXT(0);
|
||||||
{
|
}
|
||||||
LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL;
|
else if(vsync_mode == -1)
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Enabling adaptive vertical sync" << LL_ENDL;
|
||||||
|
if(wglSwapIntervalEXT(-1) == 0)
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL;
|
||||||
|
wglSwapIntervalEXT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL;
|
||||||
|
wglSwapIntervalEXT(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, (LONG_PTR)this);
|
SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, (LONG_PTR)this);
|
||||||
@@ -3030,6 +3043,16 @@ U32 LLWindowWin32::getFSAASamples()
|
|||||||
return mFSAASamples;
|
return mFSAASamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLWindowWin32::getVsyncMode()
|
||||||
|
{
|
||||||
|
return mVsyncMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWindowWin32::setVsyncMode(const S32 vsync_mode)
|
||||||
|
{
|
||||||
|
mVsyncMode = vsync_mode;
|
||||||
|
}
|
||||||
|
|
||||||
LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_resolutions)
|
LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_resolutions)
|
||||||
{
|
{
|
||||||
if (!mSupportedResolutions)
|
if (!mSupportedResolutions)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
||||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
|
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
|
||||||
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
|
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, const S32 vsync_mode, const LLCoordScreen * const posp = NULL);
|
||||||
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
|
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
|
||||||
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
|
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
|
||||||
/*virtual*/ void showCursor();
|
/*virtual*/ void showCursor();
|
||||||
@@ -80,6 +80,8 @@ public:
|
|||||||
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
||||||
/*virtual*/ void setFSAASamples(const U32 fsaa_samples);
|
/*virtual*/ void setFSAASamples(const U32 fsaa_samples);
|
||||||
/*virtual*/ U32 getFSAASamples();
|
/*virtual*/ U32 getFSAASamples();
|
||||||
|
/*virtual*/ void setVsyncMode(const S32 vsync_mode);
|
||||||
|
/*virtual*/ S32 getVsyncMode();
|
||||||
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
|
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
|
||||||
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
|
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
|
||||||
/*virtual*/ void gatherInput();
|
/*virtual*/ void gatherInput();
|
||||||
@@ -121,7 +123,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
LLWindowWin32(LLWindowCallbacks* callbacks,
|
LLWindowWin32(LLWindowCallbacks* callbacks,
|
||||||
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
||||||
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
|
BOOL fullscreen, BOOL clearBg, const S32 vsync_mode,
|
||||||
BOOL ignore_pixel_depth, U32 fsaa_samples);
|
BOOL ignore_pixel_depth, U32 fsaa_samples);
|
||||||
~LLWindowWin32();
|
~LLWindowWin32();
|
||||||
|
|
||||||
@@ -186,6 +188,7 @@ protected:
|
|||||||
|
|
||||||
F32 mCurrentGamma;
|
F32 mCurrentGamma;
|
||||||
U32 mFSAASamples;
|
U32 mFSAASamples;
|
||||||
|
S32 mVsyncMode;
|
||||||
WORD mPrevGammaRamp[256*3];
|
WORD mPrevGammaRamp[256*3];
|
||||||
WORD mCurrentGammaRamp[256*3];
|
WORD mCurrentGammaRamp[256*3];
|
||||||
|
|
||||||
|
|||||||
@@ -251,5 +251,16 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>1</real>
|
<real>1</real>
|
||||||
</map>
|
</map>
|
||||||
|
<key>SHRenderVsyncMode</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Desired vertical sychronization method. (0 = Disabled, 1 = Standard [Double-buffered], -1 = Adaptive [if supported])</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>S32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<real>0</real>
|
||||||
|
</map>
|
||||||
</map>
|
</map>
|
||||||
</llsd>
|
</llsd>
|
||||||
|
|||||||
@@ -334,6 +334,16 @@ BOOL LLPanelDisplay::postBuild()
|
|||||||
|
|
||||||
mVBOStream = getChild<LLCheckBoxCtrl>("vbo_stream");
|
mVBOStream = getChild<LLCheckBoxCtrl>("vbo_stream");
|
||||||
|
|
||||||
|
if(gGLManager.mIsATI) //AMD gpus don't go beyond 8x fsaa.
|
||||||
|
{
|
||||||
|
LLComboBox* fsaa = getChild<LLComboBox>("fsaa");
|
||||||
|
fsaa->remove("16x");
|
||||||
|
}
|
||||||
|
if(!gGLManager.mHasAdaptiveVsync)
|
||||||
|
{
|
||||||
|
LLComboBox* vsync = getChild<LLComboBox>("vsync");
|
||||||
|
vsync->remove("VSyncAdaptive");
|
||||||
|
}
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
@@ -447,8 +457,10 @@ void LLPanelDisplay::refresh()
|
|||||||
mGamma = gSavedSettings.getF32("RenderGamma");
|
mGamma = gSavedSettings.getF32("RenderGamma");
|
||||||
mVideoCardMem = gSavedSettings.getS32("TextureMemory");
|
mVideoCardMem = gSavedSettings.getS32("TextureMemory");
|
||||||
mFogRatio = gSavedSettings.getF32("RenderFogRatio");
|
mFogRatio = gSavedSettings.getF32("RenderFogRatio");
|
||||||
|
mVsyncMode = gSavedSettings.getS32("SHRenderVsyncMode");
|
||||||
|
|
||||||
childSetValue("fsaa", (LLSD::Integer) mFSAASamples);
|
childSetValue("fsaa", (LLSD::Integer) mFSAASamples);
|
||||||
|
childSetValue("vsync", (LLSD::Integer) mVsyncMode);
|
||||||
|
|
||||||
refreshEnabledState();
|
refreshEnabledState();
|
||||||
}
|
}
|
||||||
@@ -846,13 +858,22 @@ void LLPanelDisplay::cancel()
|
|||||||
gSavedSettings.setF32("RenderGamma", mGamma);
|
gSavedSettings.setF32("RenderGamma", mGamma);
|
||||||
gSavedSettings.setS32("TextureMemory", mVideoCardMem);
|
gSavedSettings.setS32("TextureMemory", mVideoCardMem);
|
||||||
gSavedSettings.setF32("RenderFogRatio", mFogRatio);
|
gSavedSettings.setF32("RenderFogRatio", mFogRatio);
|
||||||
|
gSavedSettings.setS32("SHRenderVsyncMode", mVsyncMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelDisplay::apply()
|
void LLPanelDisplay::apply()
|
||||||
{
|
{
|
||||||
U32 fsaa_value = childGetValue("fsaa").asInteger();
|
U32 fsaa_value = childGetValue("fsaa").asInteger();
|
||||||
|
S32 vsync_value = childGetValue("vsync").asInteger();
|
||||||
|
|
||||||
|
if(vsync_value == -1 && !gGLManager.mHasAdaptiveVsync)
|
||||||
|
vsync_value = 0;
|
||||||
|
|
||||||
bool apply_fsaa_change = !gSavedSettings.getBOOL("RenderUseFBO") && (mFSAASamples != fsaa_value);
|
bool apply_fsaa_change = !gSavedSettings.getBOOL("RenderUseFBO") && (mFSAASamples != fsaa_value);
|
||||||
|
bool apply_vsync_change = vsync_value != mVsyncMode;
|
||||||
|
|
||||||
gSavedSettings.setU32("RenderFSAASamples", fsaa_value);
|
gSavedSettings.setU32("RenderFSAASamples", fsaa_value);
|
||||||
|
gSavedSettings.setS32("SHRenderVsyncMode", vsync_value);
|
||||||
|
|
||||||
applyResolution();
|
applyResolution();
|
||||||
|
|
||||||
@@ -865,7 +886,7 @@ void LLPanelDisplay::apply()
|
|||||||
// Hardware tab
|
// Hardware tab
|
||||||
//Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off.
|
//Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off.
|
||||||
//Let's not do that, and instead do pre-V2 FSAA change handling for that particular case
|
//Let's not do that, and instead do pre-V2 FSAA change handling for that particular case
|
||||||
if(apply_fsaa_change)
|
if(apply_fsaa_change || apply_vsync_change)
|
||||||
{
|
{
|
||||||
bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);
|
bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);
|
||||||
LLWindow* window = gViewerWindow->getWindow();
|
LLWindow* window = gViewerWindow->getWindow();
|
||||||
@@ -875,7 +896,7 @@ void LLPanelDisplay::apply()
|
|||||||
LLGLState::checkTextureChannels();
|
LLGLState::checkTextureChannels();
|
||||||
gViewerWindow->changeDisplaySettings(window->getFullscreen(),
|
gViewerWindow->changeDisplaySettings(window->getFullscreen(),
|
||||||
size,
|
size,
|
||||||
gSavedSettings.getBOOL("DisableVerticalSync"),
|
vsync_value,
|
||||||
logged_in);
|
logged_in);
|
||||||
LLGLState::checkStates();
|
LLGLState::checkStates();
|
||||||
LLGLState::checkTextureChannels();
|
LLGLState::checkTextureChannels();
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ protected:
|
|||||||
F32 mGamma;
|
F32 mGamma;
|
||||||
S32 mVideoCardMem;
|
S32 mVideoCardMem;
|
||||||
F32 mFogRatio;
|
F32 mFogRatio;
|
||||||
|
S32 mVsyncMode;
|
||||||
|
|
||||||
// if the quality radio buttons are changed
|
// if the quality radio buttons are changed
|
||||||
void onChangeQuality(LLUICtrl* caller);
|
void onChangeQuality(LLUICtrl* caller);
|
||||||
|
|||||||
@@ -1640,12 +1640,18 @@ LLViewerWindow::LLViewerWindow(
|
|||||||
LLViewerWindow::sMovieBaseName = "SLmovie";
|
LLViewerWindow::sMovieBaseName = "SLmovie";
|
||||||
resetSnapshotLoc();
|
resetSnapshotLoc();
|
||||||
|
|
||||||
|
S32 vsync_mode = gSavedSettings.getS32("SHRenderVsyncMode");
|
||||||
|
if(vsync_mode == -1 && !gGLManager.mHasAdaptiveVsync)
|
||||||
|
{
|
||||||
|
vsync_mode = 0; //Disable vsync if adaptive is desired yet isn't supported.
|
||||||
|
}
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
mWindow = LLWindowManager::createWindow(this,
|
mWindow = LLWindowManager::createWindow(this,
|
||||||
title, name, x, y, width, height, 0,
|
title, name, x, y, width, height, 0,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
gNoRender,
|
gNoRender,
|
||||||
gSavedSettings.getBOOL("DisableVerticalSync"),
|
vsync_mode,
|
||||||
!gNoRender,
|
!gNoRender,
|
||||||
ignore_pixel_depth,
|
ignore_pixel_depth,
|
||||||
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
|
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
|
||||||
@@ -4436,14 +4442,20 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
|
|||||||
BORDERHEIGHT = size.mY- y;
|
BORDERHEIGHT = size.mY- y;
|
||||||
LLCoordScreen new_size(new_width + BORDERWIDTH,
|
LLCoordScreen new_size(new_width + BORDERWIDTH,
|
||||||
new_height + BORDERHEIGHT);
|
new_height + BORDERHEIGHT);
|
||||||
BOOL disable_sync = gSavedSettings.getBOOL("DisableVerticalSync");
|
|
||||||
|
S32 vsync_mode = gSavedSettings.getS32("SHRenderVsyncMode");
|
||||||
|
if(vsync_mode == -1 && !gGLManager.mHasAdaptiveVsync)
|
||||||
|
{
|
||||||
|
vsync_mode = 0; //Disable vsync if adaptive is desired yet isn't supported.
|
||||||
|
}
|
||||||
|
|
||||||
if (gViewerWindow->getWindow()->getFullscreen())
|
if (gViewerWindow->getWindow()->getFullscreen())
|
||||||
{
|
{
|
||||||
LLGLState::checkStates();
|
LLGLState::checkStates();
|
||||||
LLGLState::checkTextureChannels();
|
LLGLState::checkTextureChannels();
|
||||||
gViewerWindow->changeDisplaySettings(FALSE,
|
gViewerWindow->changeDisplaySettings(FALSE,
|
||||||
new_size,
|
new_size,
|
||||||
disable_sync,
|
vsync_mode,
|
||||||
TRUE);
|
TRUE);
|
||||||
LLGLState::checkStates();
|
LLGLState::checkStates();
|
||||||
LLGLState::checkTextureChannels();
|
LLGLState::checkTextureChannels();
|
||||||
@@ -5429,9 +5441,16 @@ BOOL LLViewerWindow::checkSettings()
|
|||||||
|
|
||||||
LLGLState::checkStates();
|
LLGLState::checkStates();
|
||||||
LLGLState::checkTextureChannels();
|
LLGLState::checkTextureChannels();
|
||||||
|
|
||||||
|
S32 vsync_mode = gSavedSettings.getS32("SHRenderVsyncMode");
|
||||||
|
if(vsync_mode == -1 && !gGLManager.mHasAdaptiveVsync)
|
||||||
|
{
|
||||||
|
vsync_mode = 0; //Disable vsync if adaptive is desired yet isn't supported.
|
||||||
|
}
|
||||||
|
|
||||||
changeDisplaySettings(TRUE,
|
changeDisplaySettings(TRUE,
|
||||||
desired_screen_size,
|
desired_screen_size,
|
||||||
gSavedSettings.getBOOL("DisableVerticalSync"),
|
vsync_mode,
|
||||||
mShowFullscreenProgress);
|
mShowFullscreenProgress);
|
||||||
LLGLState::checkStates();
|
LLGLState::checkStates();
|
||||||
LLGLState::checkTextureChannels();
|
LLGLState::checkTextureChannels();
|
||||||
@@ -5472,7 +5491,7 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
|
BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, const S32 vsync_mode, BOOL show_progress_bar)
|
||||||
{
|
{
|
||||||
BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
|
BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
|
||||||
mWantFullscreen = fullscreen;
|
mWantFullscreen = fullscreen;
|
||||||
@@ -5491,6 +5510,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
|
|||||||
|
|
||||||
U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
|
U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
|
||||||
U32 old_fsaa = mWindow->getFSAASamples();
|
U32 old_fsaa = mWindow->getFSAASamples();
|
||||||
|
|
||||||
// going from windowed to windowed
|
// going from windowed to windowed
|
||||||
if (!old_fullscreen && !fullscreen)
|
if (!old_fullscreen && !fullscreen)
|
||||||
{
|
{
|
||||||
@@ -5500,7 +5520,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
|
|||||||
mWindow->setSize(size);
|
mWindow->setSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fsaa == old_fsaa)
|
if (fsaa == old_fsaa && vsync_mode == mWindow->getFSAASamples())
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -5539,13 +5559,14 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mWindow->setFSAASamples(fsaa);
|
mWindow->setFSAASamples(fsaa);
|
||||||
|
mWindow->setVsyncMode(vsync_mode);
|
||||||
|
|
||||||
result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync, &new_pos);
|
result_first_try = mWindow->switchContext(fullscreen, size, vsync_mode, &new_pos);
|
||||||
if (!result_first_try)
|
if (!result_first_try)
|
||||||
{
|
{
|
||||||
// try to switch back
|
// try to switch back
|
||||||
mWindow->setFSAASamples(old_fsaa);
|
mWindow->setFSAASamples(old_fsaa);
|
||||||
result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync, &new_pos);
|
result_second_try = mWindow->switchContext(old_fullscreen, old_size, vsync_mode, &new_pos);
|
||||||
|
|
||||||
if (!result_second_try)
|
if (!result_second_try)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ public:
|
|||||||
void requestResolutionUpdate(bool fullscreen_checked);
|
void requestResolutionUpdate(bool fullscreen_checked);
|
||||||
BOOL checkSettings();
|
BOOL checkSettings();
|
||||||
void restartDisplay(BOOL show_progress_bar);
|
void restartDisplay(BOOL show_progress_bar);
|
||||||
BOOL changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar);
|
BOOL changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, const S32 vsync_mode, BOOL show_progress_bar);
|
||||||
BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; }
|
BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; }
|
||||||
F32 getDisplayAspectRatio() const;
|
F32 getDisplayAspectRatio() const;
|
||||||
const LLVector2& getDisplayScale() const { return mDisplayScale; }
|
const LLVector2& getDisplayScale() const { return mDisplayScale; }
|
||||||
|
|||||||
@@ -118,6 +118,12 @@
|
|||||||
<combo_item name="4x" value="4">4x</combo_item>
|
<combo_item name="4x" value="4">4x</combo_item>
|
||||||
<combo_item name="8x" value="8">8x</combo_item>
|
<combo_item name="8x" value="8">8x</combo_item>
|
||||||
<combo_item name="16x" value="16">16x</combo_item>
|
<combo_item name="16x" value="16">16x</combo_item>
|
||||||
|
</combo_box>
|
||||||
|
<text bottom="-57" height="12" left="10" name="VSync:" width="128">VSync:</text>
|
||||||
|
<combo_box bottom="-61" height="16" initial_value="false" label="VSync" left="148" name="vsync" width="64">
|
||||||
|
<combo_item name="VSyncDisabled" value="0">Disabled</combo_item>
|
||||||
|
<combo_item name="VSyncStandard" value="1">Standard</combo_item>
|
||||||
|
<combo_item name="VSyncAdaptive" value="-1">Adaptive</combo_item>
|
||||||
</combo_box>
|
</combo_box>
|
||||||
<spinner bottom_delta="70" control_name="TextureMemory" decimal_digits="0" height="16" increment="16" initial_val="32" label="Texture Memory (MB):" label_width="138" left="10" max_val="4096" min_val="0" name="GrapicsCardTextureMemory" tool_tip="Amount of memory to allocate for textures. Defaults to Video Card Memory. Reducing this may improve performance but may also make textures blurry." width="202"/>
|
<spinner bottom_delta="70" control_name="TextureMemory" decimal_digits="0" height="16" increment="16" initial_val="32" label="Texture Memory (MB):" label_width="138" left="10" max_val="4096" min_val="0" name="GrapicsCardTextureMemory" tool_tip="Amount of memory to allocate for textures. Defaults to Video Card Memory. Reducing this may improve performance but may also make textures blurry." width="202"/>
|
||||||
<check_box bottom_delta="-25" control_name="RenderVBOEnable" height="16" initial_value="true" label="Enable OpenGL Vertex Buffer Objects" left="5" name="vbo"
|
<check_box bottom_delta="-25" control_name="RenderVBOEnable" height="16" initial_value="true" label="Enable OpenGL Vertex Buffer Objects" left="5" name="vbo"
|
||||||
@@ -126,7 +132,7 @@
|
|||||||
tool_tip="Disabling this may improve performance when VBOs are enabled. Disabling produced observable improvement on various AMD GPUs."/>
|
tool_tip="Disabling this may improve performance when VBOs are enabled. Disabling produced observable improvement on various AMD GPUs."/>
|
||||||
<check_box bottom_delta="-25" control_name="RenderUseFBO" height="16" initial_value="true" label="Enable OpenGL Frame Buffer Objects" left="5" name="fbo"
|
<check_box bottom_delta="-25" control_name="RenderUseFBO" height="16" initial_value="true" label="Enable OpenGL Frame Buffer Objects" left="5" name="fbo"
|
||||||
tool_tip="Enabling this on modern hardware can provide a performance gain. However, enabling this when combined with antialiasing on AMD GPUs may cause edge artifacts. This setting is required for deferred rendering."/>
|
tool_tip="Enabling this on modern hardware can provide a performance gain. However, enabling this when combined with antialiasing on AMD GPUs may cause edge artifacts. This setting is required for deferred rendering."/>
|
||||||
<spinner bottom="-42" control_name="RenderGamma" decimal_digits="2" height="16" increment="0.01" initial_val="1" label="Gamma:" label_width="138" left="250" max_val="2" min_val="0.0" name="gamma" width="202" tool_tip="(brightness, lower is brighter)"/>
|
<spinner bottom="-41" control_name="RenderGamma" decimal_digits="2" height="16" increment="0.01" initial_val="1" label="Gamma:" label_width="138" left="250" max_val="2" min_val="0.0" name="gamma" width="202" tool_tip="(brightness, lower is brighter)"/>
|
||||||
<spinner bottom_delta="70" control_name="RenderFogRatio" decimal_digits="1" height="16" increment="0.1" initial_val="4" label="Fog Distance Ratio:" label_width="138" max_val="10" min_val="0.5" name="fog" width="202"/>
|
<spinner bottom_delta="70" control_name="RenderFogRatio" decimal_digits="1" height="16" increment="0.1" initial_val="4" label="Fog Distance Ratio:" label_width="138" max_val="10" min_val="0.5" name="fog" width="202"/>
|
||||||
<text bottom_delta="-50" height="40" name="note">
|
<text bottom_delta="-50" height="40" name="note">
|
||||||
Note: The Gamma and Fog Distance Ratio
|
Note: The Gamma and Fog Distance Ratio
|
||||||
|
|||||||
Reference in New Issue
Block a user