From 134a13960831938514e444c84da323da37b443c0 Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 27 Oct 2025 02:48:36 -0400 Subject: Introduce SDL3 based windowing backend support and dir picker Signed-off-by: Rye --- indra/llwindow/llsdl.cpp | 146 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 indra/llwindow/llsdl.cpp (limited to 'indra/llwindow/llsdl.cpp') diff --git a/indra/llwindow/llsdl.cpp b/indra/llwindow/llsdl.cpp new file mode 100644 index 0000000000..c97356ee80 --- /dev/null +++ b/indra/llwindow/llsdl.cpp @@ -0,0 +1,146 @@ +/** + * @file llsdl.cpp + * @brief SDL2 initialization + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include +#include + +#include "SDL3/SDL.h" + +#ifndef LL_SDL_APP +#define SDL_MAIN_HANDLED 1 +#include "SDL3/SDL_main.h" +#endif + +#include "llerror.h" +#include "llwindow.h" + +bool gSDLMainHandled = false; + +void sdl_logger(void *userdata, int category, SDL_LogPriority priority, const char *message) +{ + switch (priority) + { + case SDL_LOG_PRIORITY_TRACE: + case SDL_LOG_PRIORITY_VERBOSE: + case SDL_LOG_PRIORITY_DEBUG: + LL_DEBUGS("SDL") << "log='" << message << "'" << LL_ENDL; + break; + case SDL_LOG_PRIORITY_INFO: + LL_INFOS("SDL") << "log='" << message << "'" << LL_ENDL; + break; + case SDL_LOG_PRIORITY_WARN: + case SDL_LOG_PRIORITY_ERROR: + case SDL_LOG_PRIORITY_CRITICAL: + LL_WARNS("SDL") << "log='" << message << "'" << LL_ENDL; + break; + case SDL_LOG_PRIORITY_INVALID: + default: + break; + } +} + +void init_sdl(const std::string& app_name) +{ + if (!gSDLMainHandled) + { + SDL_SetMainReady(); + } + + SDL_SetLogOutputFunction(&sdl_logger, nullptr); + + const int c_sdl_version = SDL_VERSION; + LL_INFOS() << "Compiled against SDL " + << SDL_VERSIONNUM_MAJOR(c_sdl_version) << "." + << SDL_VERSIONNUM_MINOR(c_sdl_version) << "." + << SDL_VERSIONNUM_MICRO(c_sdl_version) << LL_ENDL; + const int r_sdl_version = SDL_GetVersion(); + LL_INFOS() << "Running with SDL " + << SDL_VERSIONNUM_MAJOR(r_sdl_version) << "." + << SDL_VERSIONNUM_MINOR(r_sdl_version) << "." + << SDL_VERSIONNUM_MICRO(r_sdl_version) << LL_ENDL; + +#if LL_WINDOWS && defined(LL_SDL_WINDOW) + Uint32 style = 0; +#if defined(CS_BYTEALIGNCLIENT) && defined(CS_OWNDC) + style = (CS_BYTEALIGNCLIENT | CS_OWNDC); +#endif + SDL_RegisterApp(app_name.c_str(), style, nullptr); +#endif + +#if LL_SDL_WINDOW + // For linux we SDL_INIT_VIDEO and _AUDIO + std::initializer_list > hintList = + { + {SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR,"0"}, + {SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH,"1"}, + {SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE,"0"}, + {SDL_HINT_KEYCODE_OPTIONS,"french_numbers,latin_letters"} + }; + + for (auto hint: hintList) + { + SDL_SetHint(std::get<0>(hint), std::get<1>(hint)); + } + + std::initializer_list> initList= + { + {SDL_INIT_VIDEO,"SDL_INIT_VIDEO", true}, + {SDL_INIT_JOYSTICK,"SDL_INIT_JOYSTICK", true}, + {SDL_INIT_GAMEPAD,"SDL_INIT_GAMEPAD", true}, + }; +#else + // For non-linux platforms we still SDL_INIT_VIDEO because it is a pre-requisite + // for SDL_INIT_GAMECONTROLLER. + std::initializer_list> initList= + { + {SDL_INIT_VIDEO,"SDL_INIT_VIDEO", false}, + }; +#endif // LL_LINUX + // We SDL_INIT_GAMECONTROLLER later in the startup process to make it + // more likely we'll catch initial SDL_CONTROLLERDEVICEADDED events. + + for (auto subSystem : initList) + { + if (!SDL_InitSubSystem(std::get<0>(subSystem))) + { + LL_WARNS() << "SDL_InitSubSystem for " << std::get<1>(subSystem) << " failed " << SDL_GetError() << LL_ENDL; + + if (std::get<2>(subSystem)) + { + OSMessageBox("SDL_Init() failure", "error", OSMB_OK); + return; + } + } + } +} + +void quit_sdl() +{ +#if LL_WINDOWS && defined(LL_SDL_WINDOW) + SDL_UnregisterApp(); +#endif + SDL_Quit(); +} -- cgit v1.3 From 0c1cbf2d38cbd0db5c9cfb86559b4fc5e4acee0d Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 30 Oct 2025 17:22:09 -0400 Subject: Add support for GLX and EGL to GL extension loader Fix dullahan wayland support Fix shader GL_ERROR under GL Core profile in Mesa Signed-off-by: Rye --- indra/cmake/UI.cmake | 12 ++- indra/llrender/llgl.cpp | 114 ++++++++++++++++++++- indra/llrender/llgl.h | 10 +- indra/llrender/llglheaders.h | 30 ++++-- indra/llwindow/CMakeLists.txt | 2 +- indra/llwindow/llsdl.cpp | 2 + indra/llwindow/llwindowsdl.cpp | 57 ++++++++++- indra/llwindow/llwindowsdl.h | 33 ++++++ .../app_settings/shaders/class1/deferred/SMAA.glsl | 1 - 9 files changed, 245 insertions(+), 16 deletions(-) (limited to 'indra/llwindow/llsdl.cpp') diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake index afa1350ef0..8e6382ceeb 100644 --- a/indra/cmake/UI.cmake +++ b/indra/cmake/UI.cmake @@ -14,12 +14,20 @@ if (LINUX) find_package(PkgConfig REQUIRED) pkg_check_modules(WAYLAND_CLIENT wayland-client) - if( WAYLAND_CLIENT_FOUND ) - target_compile_definitions( ll::uilibraries INTERFACE LL_WAYLAND=1) + if(WAYLAND_CLIENT_FOUND) + target_compile_definitions(ll::uilibraries INTERFACE LL_WAYLAND=1) else() message("pkgconfig could not find wayland client, compiling without full wayland support") endif() + find_package(X11) + if(X11_FOUND) + target_compile_definitions(ll::uilibraries INTERFACE LL_X11=1) + else() + message("Could not find X11, compiling without full X11 support") + endif() + + target_link_libraries( ll::uilibraries INTERFACE ll::fontconfig ll::freetype diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 7b8eb7809e..c45ad70758 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -52,10 +52,11 @@ #include #include "glm/gtc/type_ptr.hpp" -#if LL_MESA +#if LL_MESA_HEADLESS # include "GL/osmesa.h" # define LL_GET_PROC_ADDRESS(func) OSMesaGetProcAddress(func) #elif LL_SDL_WINDOW +# include "llwindowsdl.h" # include "SDL3/SDL.h" # define LL_GET_PROC_ADDRESS(func) SDL_GL_GetProcAddress(func) #elif LL_WINDOWS @@ -247,6 +248,19 @@ PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr; PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr; #endif +#if LL_LINUX && LL_X11 && !LL_MESA_HEADLESS +// GLX_MESA_query_renderer +PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glXQueryCurrentRendererIntegerMESA = nullptr; +PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC glXQueryCurrentRendererStringMESA = nullptr; +PFNGLXQUERYRENDERERINTEGERMESAPROC glXQueryRendererIntegerMESA = nullptr; +PFNGLXQUERYRENDERERSTRINGMESAPROC glXQueryRendererStringMESA = nullptr; +#endif + +#if LL_LINUX && LL_WAYLAND &&!LL_MESA_HEADLESS +// EGL_VERSION_1_0 +PFNEGLQUERYSTRINGPROC eglQueryString = nullptr; +#endif + // GL_VERSION_1_0 PFNGLCLEARCOLORPROC glClearColor = nullptr; PFNGLCLEARPROC glClear = nullptr; @@ -1039,6 +1053,42 @@ void LLGLManager::initWGL() #endif } +void LLGLManager::initGLX() +{ +#if LL_LINUX && LL_X11 && !LL_MESA_HEADLESS + if (!mIsX11) + return; + + reloadExtensionsString(); + + mHasGLXMESAQueryRenderer = mGLExtensions.contains("GLX_MESA_query_renderer"); + if (mHasGLXMESAQueryRenderer) + { + glXQueryCurrentRendererIntegerMESA = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)LL_GET_PROC_ADDRESS("glXQueryCurrentRendererIntegerMESA"); + glXQueryCurrentRendererStringMESA = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)LL_GET_PROC_ADDRESS("glXQueryCurrentRendererStringMESA"); + glXQueryRendererIntegerMESA = (PFNGLXQUERYRENDERERINTEGERMESAPROC)LL_GET_PROC_ADDRESS("glXQueryRendererIntegerMESA"); + glXQueryRendererStringMESA = (PFNGLXQUERYRENDERERSTRINGMESAPROC)LL_GET_PROC_ADDRESS("glXQueryRendererStringMESA"); + } +#endif +} + +void LLGLManager::initEGL() +{ +#if LL_LINUX && LL_WAYLAND && !LL_MESA_HEADLESS + if (!mIsWayland) + return; + + reloadExtensionsString(); + + // EGL_VERSION_1_0 + eglQueryString = (PFNEGLQUERYSTRINGPROC)LL_GET_PROC_ADDRESS("eglQueryString"); + + LL_INFOS("RenderInit") << "EGL_VENDOR " << ll_safe_string((const char *)eglQueryString(SDL_EGL_GetCurrentDisplay(), EGL_VENDOR)) << LL_ENDL; + LL_INFOS("RenderInit") << "EGL_VERSION " << ll_safe_string((const char *)eglQueryString(SDL_EGL_GetCurrentDisplay(), EGL_VERSION)) << LL_ENDL; +#endif +} + + // return false if unable (or unwilling due to old drivers) to init GL bool LLGLManager::initGL() { @@ -1221,6 +1271,23 @@ bool LLGLManager::initGL() } } else #endif + +#if LL_LINUX && LL_X11 && !LL_MESA_HEADLESS + if(mHasGLXMESAQueryRenderer && mVRAM == 0) + { + unsigned int vram_val = 0; + if(glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &vram_val)) + { + gGLManager.mVRAM = vram_val; + + if (mVRAM != 0) + { + LL_WARNS("RenderInit") << "VRAM Detected (GLXMesaQueryRenderer):" << mVRAM << LL_ENDL; + } + } + } +#endif + #if LL_WINDOWS || LL_LINUX { if (mHasNVXGpuMemoryInfo && mVRAM == 0) @@ -1452,13 +1519,12 @@ void LLGLManager::reloadExtensionsString() } #endif - #if LL_WINDOWS { PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)LL_GET_PROC_ADDRESS("wglGetExtensionsStringARB"); if (wglGetExtensionsStringARB) { - std::string wgl_exts = ll_safe_string((const char*)wglGetExtensionsStringARB(wglGetCurrentDC()));; + std::string wgl_exts = ll_safe_string((const char*)wglGetExtensionsStringARB(wglGetCurrentDC())); boost::char_separator sep(" "); boost::tokenizer > tok(wgl_exts, sep); for (boost::tokenizer >::iterator i = tok.begin(); i != tok.end(); ++i) @@ -1468,6 +1534,48 @@ void LLGLManager::reloadExtensionsString() } } #endif + +#if LL_SDL_WINDOW && LL_LINUX && LL_X11 && !LL_MESA_HEADLESS + if (mIsX11) + { + if (LLWindowSDL::sX11Data.xdisplay && LLWindowSDL::sX11Data.xwindow) + { + typedef const char *(*PFNEGLXQUERYEXTENSIONSSTRINGPROC) (Display *dpy, int screen ); + PFNEGLXQUERYEXTENSIONSSTRINGPROC llglXQueryExtensionsString = (PFNEGLXQUERYEXTENSIONSSTRINGPROC)LL_GET_PROC_ADDRESS("glXQueryExtensionsString"); + if (llglXQueryExtensionsString) + { + std::string glx_exts = ll_safe_string((const char*)llglXQueryExtensionsString(LLWindowSDL::sX11Data.xdisplay, LLWindowSDL::sX11Data.xscreen)); + boost::char_separator sep(" "); + boost::tokenizer > tok(glx_exts, sep); + for (boost::tokenizer >::iterator i = tok.begin(); i != tok.end(); ++i) + { + mGLExtensions.insert(*i); + } + } + } + } +#endif + +#if LL_SDL_WINDOW && LL_LINUX && LL_WAYLAND && !LL_MESA_HEADLESS + if (mIsWayland) + { + SDL_EGLDisplay egl_display = SDL_EGL_GetCurrentDisplay(); + if (egl_display) + { + PFNEGLQUERYSTRINGPROC lleglQueryString = (PFNEGLQUERYSTRINGPROC)LL_GET_PROC_ADDRESS("eglQueryString"); + if (lleglQueryString) + { + std::string egl_exts = ll_safe_string((const char*)lleglQueryString((EGLDisplay)egl_display, EGL_EXTENSIONS)); + boost::char_separator sep(" "); + boost::tokenizer > tok(egl_exts, sep); + for (boost::tokenizer >::iterator i = tok.begin(); i != tok.end(); ++i) + { + mGLExtensions.insert(*i); + } + } + } + } +#endif } void LLGLManager::initExtensions() diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index b7cd3df3c8..3a311ad03b 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -70,7 +70,9 @@ public: bool initGL(); void shutdownGL(); - void initWGL(); // Initializes stupid WGL extensions + void initWGL(); // Initializes WGL extensions + void initGLX(); // Initializes GLX extensions + void initEGL(); // Initializes EGL extensions std::string getRawGLString(); // For sending to simulator @@ -103,6 +105,7 @@ public: bool mHasAMDAssociations = false; bool mHasNVXGpuMemoryInfo = false; bool mHasATIMemInfo = false; + bool mHasGLXMESAQueryRenderer = false; bool mIsAMD; bool mIsNVIDIA; @@ -147,6 +150,11 @@ public: // GL Extension String std::set mGLExtensions; +#if LL_LINUX + bool mIsX11 = false; + bool mIsWayland = false; +#endif + private: void reloadExtensionsString(); void initExtensions(); diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index fb9c339c62..9e4d1c5b3a 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -27,11 +27,11 @@ #ifndef LL_LLGLHEADERS_H #define LL_LLGLHEADERS_H -#if LL_WINDOWS || LL_MESA || LL_SDL_WINDOW || LL_LINUX +#if LL_WINDOWS || LL_MESA_HEADLESS || LL_SDL_WINDOW || LL_LINUX //---------------------------------------------------------------------------- - // LL_WINDOWS || LL_MESA || LL_SDL_WINDOW || LL_LINUX + // LL_WINDOWS || LL_MESA_HEADLESS || LL_SDL_WINDOW || LL_LINUX -#if LL_MESA +#if LL_MESA_HEADLESS #define GL_GLEXT_PROTOTYPES 1 #else #define LL_GL_FUNC_POINTER 1 @@ -43,16 +43,22 @@ // quotes so we get libraries/.../GL/ version #include "GL/glcorearb.h" -#if LL_WINDOWS && !LL_MESA +#if LL_WINDOWS && !LL_MESA_HEADLESS #include "GL/wglext.h" #endif -#if LL_LINUX && !LL_MESA +#if LL_LINUX && LL_X11 && !LL_MESA_HEADLESS +#define GLX_GLXEXT_LEGACY #define __gl_h_ 1 #include "GL/glx.h" #include "GL/glxext.h" #endif +#if LL_LINUX && LL_WAYLAND && !LL_MESA_HEADLESS +#define EGL_EGL_PROTOTYPES 0 +#include "EGL/egl.h" +#endif + #elif LL_DARWIN //---------------------------------------------------------------------------- // LL_DARWIN @@ -64,7 +70,7 @@ #define GL_GLEXT_PROTOTYPES 1 #include "GL/glext.h" -#endif // LL_MESA / LL_SDL_WINDOW // LL_LINUX / LL_WINDOWS / LL_DARWIN +#endif // LL_MESA_HEADLESS / LL_SDL_WINDOW // LL_LINUX / LL_WINDOWS / LL_DARWIN //GL_NVX_gpu_memory_info constants #ifndef GL_NVX_gpu_memory_info @@ -145,6 +151,18 @@ extern PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB; #endif // LL_WINDOWS +#if LL_LINUX && LL_X11 && !LL_MESA_HEADLESS +// GLX_MESA_query_renderer +extern PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glXQueryCurrentRendererIntegerMESA; +extern PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC glXQueryCurrentRendererStringMESA; +extern PFNGLXQUERYRENDERERINTEGERMESAPROC glXQueryRendererIntegerMESA; +extern PFNGLXQUERYRENDERERSTRINGMESAPROC glXQueryRendererStringMESA; +#endif + +#if LL_LINUX && LL_WAYLAND &&!LL_MESA_HEADLESS +extern PFNEGLQUERYSTRINGPROC eglQueryString; +#endif + // We get all functions via getProcAddress when using SDL // GL_VERSION_1_0 extern PFNGLCULLFACEPROC glCullFace; diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 1f846de35d..aacaef9257 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -160,7 +160,7 @@ if (BUILD_HEADLESS) ${llwindowheadless_HEADER_FILES} ) - target_compile_definitions( llwindowheadless PUBLIC LL_MESA=1 LL_MESA_HEADLESS=1 ) + target_compile_definitions( llwindowheadless PUBLIC LL_MESA_HEADLESS=1 ) target_link_libraries (llwindowheadless llcommon diff --git a/indra/llwindow/llsdl.cpp b/indra/llwindow/llsdl.cpp index c97356ee80..d0a7552647 100644 --- a/indra/llwindow/llsdl.cpp +++ b/indra/llwindow/llsdl.cpp @@ -64,10 +64,12 @@ void sdl_logger(void *userdata, int category, SDL_LogPriority priority, const ch void init_sdl(const std::string& app_name) { +#ifndef LL_SDL_APP if (!gSDLMainHandled) { SDL_SetMainReady(); } +#endif SDL_SetLogOutputFunction(&sdl_logger, nullptr); diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 57110f8634..1cfb0b2acb 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -40,11 +40,11 @@ #include "llpreeditor.h" #include "llsdl.h" +#if LL_LINUX #ifdef LL_GLIB #include #endif -#if LL_LINUX extern "C" { # include "fontconfig/fontconfig.h" } @@ -55,6 +55,13 @@ extern "C" { #include #include #include + +#if LL_X11 +LLWindowSDL::X11_DATA LLWindowSDL::sX11Data = {}; +#endif +#if LL_WAYLAND +LLWindowSDL::WAYLAND_DATA LLWindowSDL::sWaylandData = {}; +#endif #endif // LL_LINUX #if LL_DARWIN @@ -248,7 +255,7 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b if(mFullscreen) { - tryFindFullscreenSize( width, height ); + tryFindFullscreenSize(width, height); } SDL_PropertiesID props = SDL_CreateProperties(); @@ -322,6 +329,52 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b mRefreshRate = DEFAULT_REFRESH_RATE; } + /* Grab the window manager specific information */ +#if LL_LINUX + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) + { + LL_INFOS() << "Running under X11" << LL_ENDL; + mServerProtocol = X11; + + gGLManager.mIsX11 = true; + +#if LL_X11 + sX11Data.xdisplay = (Display *)SDL_GetPointerProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_X11_DISPLAY_POINTER, nullptr); + sX11Data.xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0); + sX11Data.xscreen = (int)SDL_GetNumberProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_X11_SCREEN_NUMBER, -1); + if (sX11Data.xdisplay && sX11Data.xwindow) + { + + } +#endif + + gGLManager.initGLX(); + } + else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) + { + LL_INFOS() << "Running under Wayland" << LL_ENDL; + mServerProtocol = Wayland; + + gGLManager.mIsWayland = true; + +#if LL_WAYLAND + sWaylandData.display = (struct wl_display *)SDL_GetPointerProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, nullptr); + sWaylandData.surface = (struct wl_surface *)SDL_GetPointerProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr); + if (sWaylandData.display && sWaylandData.surface) + { + } +#endif + + gGLManager.initEGL(); + + // If set (XWayland) remove DISPLAY, this will prompt dullahan to also use Wayland + if(getenv("DISPLAY")) + { + unsetenv("DISPLAY"); + } + } +#endif + SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits); SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenBits); SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueBits); diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 966999ac12..8a8e9dd1bf 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -35,6 +35,15 @@ #include "SDL3/SDL.h" #include "SDL3/SDL_endian.h" +#ifdef LL_WAYLAND +#include +#endif + +#if LL_X11 +#include +#include +#endif + class LLPreeditor; class LLWindowSDL final : public LLWindow @@ -217,6 +226,30 @@ private: U32 mKeyModifiers = SDL_KMOD_NONE; void tryFindFullscreenSize(int &aWidth, int &aHeight); + + enum EServerProtocol{ X11, Wayland, Unknown }; + EServerProtocol mServerProtocol = Unknown; +public: +#if LL_X11 + // X11 + struct X11_DATA + { + Display* xdisplay = nullptr; + Window xwindow = 0; + int xscreen = -1; + }; + static X11_DATA sX11Data; +#endif + +#if LL_WAYLAND + // Wayland + struct WAYLAND_DATA + { + struct wl_display* display = nullptr; + struct wl_surface* surface = nullptr; + }; + static WAYLAND_DATA sWaylandData; +#endif }; class LLSplashScreenSDL : public LLSplashScreen diff --git a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl index 5837308965..0fa4b32fda 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl @@ -25,7 +25,6 @@ #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_shader_texture_lod : enable -#extension GL_EXT_gpu_shader4 : enable /*[EXTRA_CODE_HERE]*/ -- cgit v1.3 From 5260f1e4a74d72ba10f9747d21cf2dbeb13cca5c Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 10 Nov 2025 08:31:12 -0500 Subject: Fix alt cam mouse motion stuttering in variance to framerate under wayland Signed-off-by: Rye --- indra/llwindow/llsdl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llwindow/llsdl.cpp') diff --git a/indra/llwindow/llsdl.cpp b/indra/llwindow/llsdl.cpp index d0a7552647..1df9f38a6d 100644 --- a/indra/llwindow/llsdl.cpp +++ b/indra/llwindow/llsdl.cpp @@ -99,6 +99,7 @@ void init_sdl(const std::string& app_name) {SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR,"0"}, {SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH,"1"}, {SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE,"0"}, + {SDL_HINT_MOUSE_RELATIVE_WARP_MOTION,"1"}, {SDL_HINT_KEYCODE_OPTIONS,"french_numbers,latin_letters"} }; -- cgit v1.3