summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-07-06 08:09:31 +0800
committerErik Kundiman <erik@megapahit.org>2024-07-06 08:09:31 +0800
commit57f91acf044a3cf2c8a0175aab10fbb7b1e90a7f (patch)
tree805c3e55d83094fa2010ee66bcd2b6a204736f42 /indra/llwindow
parent29d68ecb229ecb19e6d0da4cf5fbd8e3bbdde2cf (diff)
parent8662083cf4130922732aa8fba655310664b80d8b (diff)
Merge branch 'main' into maint-b
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindow.h4
-rw-r--r--indra/llwindow/llwindowmacosx.cpp17
-rw-r--r--indra/llwindow/llwindowsdl.cpp12
3 files changed, 33 insertions, 0 deletions
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index aff9334cb6..5bb538f892 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -34,6 +34,8 @@
#include "llinstancetracker.h"
#include "llsd.h"
+#include "../llrender/llglheaders.h"
+
class LLSplashScreen;
class LLPreeditor;
class LLWindowCallbacks;
@@ -243,6 +245,8 @@ protected:
S32 mMinWindowHeight;
S32 mRefreshRate;
+ GLsync swapFense;
+
// Handle a UTF-16 encoding unit received from keyboard.
// Converting the series of UTF-16 encoding units to UTF-32 data,
// this method passes the resulting UTF-32 data to mCallback's
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 453905b19b..1b8ab27f23 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -38,6 +38,8 @@
#include "lldir.h"
#include "indra_constants.h"
+#include "../newview/llviewercontrol.h"
+
#include <OpenGL/OpenGL.h>
#include <Carbon/Carbon.h>
#include <CoreServices/CoreServices.h>
@@ -50,6 +52,8 @@
#include <IOKit/hid/IOHIDLib.h>
#include <IOKit/usb/IOUSBLib.h>
+
+
extern BOOL gDebugWindowProc;
BOOL gHiDPISupport = TRUE;
@@ -1009,6 +1013,19 @@ BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size)
void LLWindowMacOSX::swapBuffers()
{
CGLFlushDrawable(mContext);
+
+ U32 mode = gSavedSettings.getU32("MPVBufferOptiMode");
+ if (mode == 0)
+ {
+ if(gGLManager.mIsApple) mode = 2;
+ else mode = 1;
+ }
+ if (mode > 2)
+ {
+ glClientWaitSync(swapFense, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
+ glDeleteSync(swapFense);
+ swapFense = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ }
}
void LLWindowMacOSX::restoreGLContext()
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index eb689dc48c..cdd9cbd99a 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -1255,6 +1255,18 @@ void LLWindowSDL::swapBuffers()
if (mWindow)
{
SDL_GL_SwapWindow( mWindow );
+ U32 mode = gSavedSettings.getU32("MPVBuffMapMode");
+ if (mode == 0)
+ {
+ if(gGLManager.mIsApple) mode = 2;
+ else mode = 1;
+ }
+ if (mode > 2)
+ {
+ glClientWaitSync(swapFense, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
+ glDeleteSync(swapFense);
+ swapFense = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ }
}
}