From 6369047dcb74323b248de59bc8187db0d315548a Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Fri, 5 Jul 2024 20:24:10 +0800 Subject: Temporary Cocoa U16 vs. SDL2 U32 key types Even when maint-b is merged to main, webrtc-voice will very likely still have to wait until it's merged with main to get maint-b's changes. I'll worry about the conflicts later, just so any branch would build on SDL2 or not without any patches. --- indra/llwindow/llkeyboard.cpp | 12 ++++++++++++ indra/llwindow/llkeyboard.h | 15 +++++++++++++++ indra/llwindow/llkeyboardheadless.cpp | 8 ++++++++ indra/llwindow/llkeyboardheadless.h | 5 +++++ 4 files changed, 40 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index b3dcac6222..e93ad28fdf 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -195,9 +195,15 @@ void LLKeyboard::resetKeys() } +#if LL_SDL +BOOL LLKeyboard::translateKey(const U32 os_key, KEY *out_key) +{ + std::map::iterator iter; +#else BOOL LLKeyboard::translateKey(const U16 os_key, KEY *out_key) { std::map::iterator iter; +#endif // Only translate keys in the map, ignore all other keys for now iter = mTranslateKeyMap.find(os_key); @@ -215,9 +221,15 @@ BOOL LLKeyboard::translateKey(const U16 os_key, KEY *out_key) } +#if LL_SDL +U32 LLKeyboard::inverseTranslateKey(const KEY translated_key) +{ + std::map::iterator iter; +#else U16 LLKeyboard::inverseTranslateKey(const KEY translated_key) { std::map::iterator iter; +#endif iter = mInvTranslateKeyMap.find(translated_key); if (iter == mInvTranslateKeyMap.end()) { diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index e406de347c..89fa840e42 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -67,14 +67,24 @@ public: BOOL getKeyDown(const KEY key) { return mKeyLevel[key]; } BOOL getKeyRepeated(const KEY key) { return mKeyRepeated[key]; } +#if LL_SDL + BOOL translateKey(const U32 os_key, KEY *translated_key); + U32 inverseTranslateKey(const KEY translated_key); +#else BOOL translateKey(const U16 os_key, KEY *translated_key); U16 inverseTranslateKey(const KEY translated_key); +#endif BOOL handleTranslatedKeyUp(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes BOOL handleTranslatedKeyDown(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes +#if LL_SDL + virtual BOOL handleKeyUp(const U32 key, MASK mask) = 0; + virtual BOOL handleKeyDown(const U32 key, MASK mask) = 0; +#else virtual BOOL handleKeyUp(const U16 key, MASK mask) = 0; virtual BOOL handleKeyDown(const U16 key, MASK mask) = 0; +#endif #if defined(LL_DARWIN) && !defined(LL_SDL) // We only actually use this for OS X. @@ -111,8 +121,13 @@ protected: void addKeyName(KEY key, const std::string& name); protected: +#if LL_SDL + std::map mTranslateKeyMap; // Map of translations from OS keys to Linden KEYs + std::map mInvTranslateKeyMap; // Map of translations from Linden KEYs to OS keys +#else std::map mTranslateKeyMap; // Map of translations from OS keys to Linden KEYs std::map mInvTranslateKeyMap; // Map of translations from Linden KEYs to OS keys +#endif LLWindowCallbacks *mCallbacks; LLTimer mKeyLevelTimer[KEY_COUNT]; // Time since level was set diff --git a/indra/llwindow/llkeyboardheadless.cpp b/indra/llwindow/llkeyboardheadless.cpp index 01ac26261b..a3c86fde2b 100644 --- a/indra/llwindow/llkeyboardheadless.cpp +++ b/indra/llwindow/llkeyboardheadless.cpp @@ -35,11 +35,19 @@ void LLKeyboardHeadless::resetMaskKeys() { } +#if LL_SDL +BOOL LLKeyboardHeadless::handleKeyDown(const U32 key, const U32 mask) +#else BOOL LLKeyboardHeadless::handleKeyDown(const U16 key, const U32 mask) +#endif { return FALSE; } +#if LL_SDL +BOOL LLKeyboardHeadless::handleKeyUp(const U32 key, const U32 mask) +#else BOOL LLKeyboardHeadless::handleKeyUp(const U16 key, const U32 mask) +#endif { return FALSE; } MASK LLKeyboardHeadless::currentMask(BOOL for_mouse_event) diff --git a/indra/llwindow/llkeyboardheadless.h b/indra/llwindow/llkeyboardheadless.h index 8e067e6108..2bb670a53d 100644 --- a/indra/llwindow/llkeyboardheadless.h +++ b/indra/llwindow/llkeyboardheadless.h @@ -35,8 +35,13 @@ public: LLKeyboardHeadless(); /*virtual*/ ~LLKeyboardHeadless() {}; +#if LL_SDL + /*virtual*/ BOOL handleKeyUp(const U32 key, MASK mask); + /*virtual*/ BOOL handleKeyDown(const U32 key, MASK mask); +#else /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask); /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask); +#endif /*virtual*/ void resetMaskKeys(); /*virtual*/ MASK currentMask(BOOL for_mouse_event); /*virtual*/ void scanKeyboard(); -- cgit v1.2.3 From 9f62ef6cb34ebc91aa82715ce8b036c0af7affef Mon Sep 17 00:00:00 2001 From: mobserveur Date: Fri, 5 Jul 2024 20:13:59 +0200 Subject: Tuning floater and buffer mapping improvements This commit adds the tuning floater accessible via the fps button, and improvements to the buffer mapping optimisation modes. --- indra/llwindow/llwindow.h | 4 ++++ indra/llwindow/llwindowmacosx.cpp | 17 +++++++++++++++++ indra/llwindow/llwindowsdl.cpp | 12 ++++++++++++ 3 files changed, 33 insertions(+) (limited to 'indra/llwindow') 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 #include #include @@ -50,6 +52,8 @@ #include #include + + 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 98484419f9..110a28ca48 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1098,6 +1098,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); + } } } -- cgit v1.2.3