diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c6aa0e2470..b8c2c269c2f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -137,7 +137,7 @@ jobs: libgl1-mesa-dev libglu1-mesa-dev libxinerama-dev \ libxcursor-dev libxfixes-dev libgstreamer1.0-dev \ libgstreamer-plugins-base1.0-dev ninja-build libxft-dev \ - llvm mold libpipewire-0.3-dev libdbus-1-dev + llvm mold libpipewire-0.3-dev libdbus-1-dev libvlc-dev sudo locale-gen en_US.UTF-8 sudo locale-gen en_GB.UTF-8 sudo locale-gen fr_FR.UTF-8 diff --git a/autobuild.xml b/autobuild.xml index 60a24535206..04838268e25 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -409,36 +409,6 @@ description Library for transferring data specified with URL syntax - dbus_glib - - platforms - - linux64 - - archive - - hash - 7ee7b9aed3c0c8c09e7bf26bba7af8e1 - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-dbus-glib/rev/314266/arch/Linux/installer/dbus_glib-0.76-linux64-314266.tar.bz2 - - name - linux64 - - - license - Academic Free License v. 2.1 - license_file - LICENSES/dbus-glib.txt - copyright - Copyright (C) Red Hat Inc. - version - 0.76 - name - dbus_glib - description - D-Bus bindings for glib - dictionaries platforms @@ -625,36 +595,6 @@ description Expat is an XML parser library written in C - fontconfig - - platforms - - linux64 - - archive - - hash - e2419d56960c160670051fbb055fb729 - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-fontconfig/rev/314281/arch/Linux/installer/fontconfig-2.11.0-linux64-314281.tar.bz2 - - name - linux64 - - - license - bsd - license_file - LICENSES/fontconfig.txt - copyright - Copyright (C) 2000,2001,2002,2003,2004,2006,2007 Keith Packard, 2005 Patrick Lam, 2009 Roozbeh Pournader, 2008,2009 Red Hat, Inc., 2008 Danilo Ĺ egan, 2012 Google, Inc. - version - 2.11.0 - name - fontconfig - description - Fontconfig is a library for configuring and customizing font access. - freetype copyright @@ -821,34 +761,6 @@ source_type git - gstreamer - - platforms - - linux64 - - archive - - hash - 7c9d7cc88add7831a6afeedc20cad2fe - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-gstreamer/rev/314267/arch/Linux/installer/gstreamer-0.10.6.314267-linux64-314267.tar.bz2 - - name - linux64 - - - license - LGPL - license_file - LICENSES/gstreamer.txt - copyright - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - version - 0.10.6.314267 - name - gstreamer - havok-source platforms @@ -1267,36 +1179,6 @@ description PNG Reference library - libuuid - - platforms - - linux64 - - archive - - hash - fb89f1281dd54d8b99b339fc5b712b27 - url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-libuuid/rev/314269/arch/Linux/installer/libuuid-1.6.2-linux64-314269.tar.bz2 - - name - linux64 - - - license - UUID - license_file - LICENSES/uuid.txt - copyright - Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/> - version - 1.6.2 - name - libuuid - description - OSSP uuid is a ISO-C:1999 application programming interface (API) and corresponding command line interface (CLI) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique Identifier (UUID). - libxml2 platforms diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 1b138eaeaa4..545b138bdf4 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -15,7 +15,6 @@ include_guard() include(Variables) -include(Linker) # We go to some trouble to set LL_BUILD to the set of relevant compiler flags. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}") @@ -70,9 +69,12 @@ if (WINDOWS) # http://www.cmake.org/pipermail/cmake/2009-September/032143.html string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - add_link_options(/LARGEADDRESSAWARE - /NODEFAULTLIB:LIBCMT - /IGNORE:4099) + add_link_options( + /LARGEADDRESSAWARE + /NODEFAULTLIB:LIBCMT + /IGNORE:4099 + /MANIFEST:NO + ) add_compile_definitions( WIN32_LEAN_AND_MEAN @@ -95,10 +97,10 @@ if (WINDOWS) /permissive- ) - # Nicky: x64 implies SSE2 - if( ADDRESS_SIZE EQUAL 32 ) - add_compile_options( /arch:SSE2 ) - endif() + # We want aggressive inlining on MSVC to better match clang/gcc at O3 + string(REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/Ob2" "/Ob3" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") # Are we using the crummy Visual Studio KDU build workaround? if (NOT VS_DISABLE_FATAL_WARNINGS) @@ -120,7 +122,6 @@ endif (WINDOWS) if (LINUX) set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE ) set( CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../lib ) - set(CMAKE_EXE_LINKER_FLAGS "-Wl,--exclude-libs,ALL") find_program(CCACHE_EXE ccache) if(CCACHE_EXE AND NOT DISABLE_CCACHE) @@ -139,43 +140,60 @@ if (LINUX) LL_IGNORE_SIGCHLD ) - if( ENABLE_ASAN ) - add_compile_options(-U_FORTIFY_SOURCE - -fsanitize=address - --param asan-stack=0 - ) - add_link_options(-fsanitize=address) - else() - add_compile_definitions( _FORTIFY_SOURCE=2 ) - endif() + if (USE_ASAN) + add_compile_options(-fsanitize=address -fsanitize-recover=address) + add_link_options(-fsanitize=address -fsanitize-recover=address) + elseif (USE_LEAKSAN) + add_compile_options(-fsanitize=leak) + add_link_options(-fsanitize=leak) + elseif (USE_UBSAN) + add_compile_options(-fsanitize=undefined -fno-sanitize=vptr) + add_link_options(-fsanitize=undefined -fno-sanitize=vptr) + elseif (USE_THREAD_SAN) + add_compile_options(-fsanitize=thread) + add_link_options(-fsanitize=thread) + else () + add_compile_definitions(_FORTIFY_SOURCE=2) + endif () add_compile_options( -fexceptions -fno-math-errno -fno-strict-aliasing + -fno-omit-frame-pointer -fsigned-char -msse2 -mfpmath=sse -pthread -fvisibility=hidden + -fstack-protector ) add_link_options( - -Wl,--no-keep-memory - -Wl,--build-id - -Wl,--no-undefined + "LINKER:--build-id" + "LINKER:--as-needed" + "LINKER:-z,relro" + "LINKER:-z,now" ) - # this stops us requiring a really recent glibc at runtime - add_compile_options(-fno-stack-protector) + if(LINK_WITH_MOLD) + find_program(MOLD_BIN mold) + if(MOLD_BIN) + message(STATUS "Mold linker found: ${MOLD_BIN}. Enabling mold as active linker.") + add_link_options(-fuse-ld=mold) + else() + set(LINK_WITH_MOLD OFF) + message(STATUS "Mold linker not found. Using default linker.") + endif() + endif() - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link - add_link_options( - -lstdc++ - -lm - ) + if(NOT LINK_WITH_MOLD) + # Use LLD for proper clang support under Linux + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_link_options(-fuse-ld=lld) # Use LLD for proper clang support + endif() endif() + endif (LINUX) if (DARWIN) @@ -183,32 +201,31 @@ if (DARWIN) set(CLANG_DISABLE_FATAL_WARNINGS OFF) set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - set(DARWIN_extra_cstar_flags "-Wno-deprecated-declarations") # Ensure that CMAKE_CXX_FLAGS has the correct -g debug information format -- # see Variables.cmake. string(REPLACE "-gdwarf-2" "-g${CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT}" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}") # NOTE: it's critical that the optimization flag is put in front. # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered. ## Really?? On developer machines too? ##set(ENABLE_SIGNING TRUE) ##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.") - - # required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function - # see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library - add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) endif(DARWIN) if(LINUX OR DARWIN) - add_compile_options(-Wall -Wno-sign-compare -Wno-trigraphs -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-local-typedef) + add_compile_options(-Wall -Wno-sign-compare -Wno-trigraphs -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable) + + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + # libstdc++ headers contain deprecated declarations that fail on clang + # macOS currently has many deprecated calls + add_compile_options(-Wno-unused-local-typedef -Wno-deprecated-declarations) + endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_compile_options(-Wno-stringop-truncation -Wno-parentheses -Wno-c++20-compat) + add_compile_options(-Wno-stringop-truncation -Wno-parentheses) endif() - if (NOT GCC_DISABLE_FATAL_WARNINGS) + if (NOT GCC_DISABLE_FATAL_WARNINGS AND NOT CLANG_DISABLE_FATAL_WARNINGS) add_compile_options(-Werror) endif () diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 1083d7f2c47..7c688c24be6 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -11,50 +11,63 @@ set(cmake_SOURCE_FILES Audio.cmake Boost.cmake bugsplat.cmake + BuildPackagesInfo.cmake BuildVersion.cmake CEFPlugin.cmake - CEFPlugin.cmake CMakeCopyIfDifferent.cmake - CURL.cmake Copy3rdPartyLibs.cmake - DBusGlib.cmake + CubemapToEquirectangularJS.cmake + CURL.cmake DeploySharedLibs.cmake DragDrop.cmake EXPAT.cmake FindAutobuild.cmake + FindPipeWire.cmake FreeType.cmake GLEXT.cmake GLH.cmake + GLIB.cmake GLM.cmake + GStreamer10Plugin.cmake Havok.cmake Hunspell.cmake + JPEG.cmake + JPEGEncoderBasic.cmake + LibVLCPlugin.cmake + Linking.cmake LLAddBuildTest.cmake LLAppearance.cmake + LLAppearanceUtility.cmake LLAudio.cmake LLCommon.cmake + LLCoreHttp.cmake LLImage.cmake LLKDU.cmake + LLMath.cmake LLPhysicsExtensions.cmake LLPrimitive.cmake LLSharedLibs.cmake LLTestCommand.cmake LLWindow.cmake - Linking.cmake Lualibs.cmake Meshoptimizer.cmake + Mikktspace.cmake NDOF.cmake NFDE.cmake + NGHTTP2.cmake + NVAPI.cmake OPENAL.cmake OpenGL.cmake OpenJPEG.cmake OpenSSL.cmake + OpenXR.cmake PNG.cmake PluginAPI.cmake Prebuilt.cmake - PulseAudio.cmake Python.cmake SDL2.cmake TemplateCheck.cmake + ThreeJS.cmake TinyEXR.cmake TinyGLTF.cmake Tracy.cmake @@ -62,9 +75,10 @@ set(cmake_SOURCE_FILES UI.cmake UnixInstall.cmake Variables.cmake + ViewerManager.cmake ViewerMiscLibs.cmake VisualLeakDetector.cmake - LibVLCPlugin.cmake + VulkanGltf.cmake WebRTC.cmake xxHash.cmake ZLIBNG.cmake diff --git a/indra/cmake/DBusGlib.cmake b/indra/cmake/DBusGlib.cmake deleted file mode 100644 index c9b727ca9df..00000000000 --- a/indra/cmake/DBusGlib.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -add_library( ll::dbus INTERFACE IMPORTED) - -if( LINUX ) - # Only define this when not using the prebuild 3ps, lls prebuild is broken - if( NOT USE_AUTOBUILD_3P ) - target_compile_definitions( ll::dbus INTERFACE LL_DBUS_ENABLED ) - endif() - use_system_binary(dbus) - - use_prebuilt_binary(dbus_glib) -endif() diff --git a/indra/cmake/FindSCP.cmake b/indra/cmake/FindSCP.cmake deleted file mode 100644 index ea02102908e..00000000000 --- a/indra/cmake/FindSCP.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# -*- cmake -*- -# -# Find the OpenSSH scp ("secure copy") or Putty pscp command. -# -# Input variables: -# SCP_FIND_REQUIRED - set this if configuration should fail without scp -# -# Output variables: -# -# SCP_FOUND - set if scp was found -# SCP_EXECUTABLE - path to scp or pscp executable -# SCP_BATCH_FLAG - how to put scp/pscp into batch mode - -SET(SCP_EXECUTABLE) -IF (WINDOWS) - FIND_PROGRAM(SCP_EXECUTABLE NAMES pscp pscp.exe) -ELSE (WINDOWS) - FIND_PROGRAM(SCP_EXECUTABLE NAMES scp scp.exe) -ENDIF (WINDOWS) - -IF (SCP_EXECUTABLE) - SET(SCP_FOUND ON) -ELSE (SCP_EXECUTABLE) - SET(SCP_FOUND OFF) -ENDIF (SCP_EXECUTABLE) - -IF (SCP_FOUND) - GET_FILENAME_COMPONENT(_scp_name ${SCP_EXECUTABLE} NAME_WE) - IF (_scp_name STREQUAL scp) - SET(SCP_BATCH_FLAG -B) - ELSE (_scp_name STREQUAL scp) - SET(SCP_BATCH_FLAG -batch) - ENDIF (_scp_name STREQUAL scp) -ELSE (SCP_FOUND) - IF (SCP_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find scp or pscp executable") - ENDIF (SCP_FIND_REQUIRED) -ENDIF (SCP_FOUND) - -MARK_AS_ADVANCED(SCP_EXECUTABLE SCP_FOUND SCP_BATCH_FLAG) diff --git a/indra/cmake/GStreamer010Plugin.cmake b/indra/cmake/GStreamer010Plugin.cmake deleted file mode 100644 index 61f6f740336..00000000000 --- a/indra/cmake/GStreamer010Plugin.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) -if (NOT LINUX) - return() -endif() - -add_library( ll::gstreamer INTERFACE IMPORTED ) -target_compile_definitions( ll::gstreamer INTERFACE LL_GSTREAMER010_ENABLED=1) -use_system_binary(gstreamer) - -use_prebuilt_binary(gstreamer) - diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index 5d96a4398f2..ee578a5a558 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -222,10 +222,7 @@ FUNCTION(LL_ADD_INTEGRATION_TEST # The following was copied to llcorehttp/CMakeLists.txt's texture_load target. # Any changes made here should be replicated there. if (WINDOWS) - set_target_properties(INTEGRATION_TEST_${testname} - PROPERTIES - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE" - ) + target_link_options(INTEGRATION_TEST_${testname} PRIVATE /debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE) endif () if (DARWIN) diff --git a/indra/cmake/LibVLCPlugin.cmake b/indra/cmake/LibVLCPlugin.cmake index 599ce028445..312fb81a731 100644 --- a/indra/cmake/LibVLCPlugin.cmake +++ b/indra/cmake/LibVLCPlugin.cmake @@ -5,6 +5,14 @@ include(Prebuilt) include_guard() add_library( ll::libvlc INTERFACE IMPORTED ) +if(LINUX) + find_package(PkgConfig REQUIRED) + + pkg_check_modules(libvlc REQUIRED IMPORTED_TARGET libvlc) + target_link_libraries( ll::libvlc INTERFACE PkgConfig::libvlc) + return() +endif() + use_prebuilt_binary(vlc-bin) set(LIBVLCPLUGIN ON CACHE BOOL "LIBVLCPLUGIN support for the llplugin/llmedia test apps.") diff --git a/indra/cmake/Linker.cmake b/indra/cmake/Linker.cmake deleted file mode 100644 index 8016842192f..00000000000 --- a/indra/cmake/Linker.cmake +++ /dev/null @@ -1,11 +0,0 @@ -include_guard(GLOBAL) - -if( LINK_WITH_MOLD ) - find_program(MOLD_BIN mold) - if(MOLD_BIN) - message(STATUS "Mold linker found: ${MOLD_BIN}. Enabling mold as active linker.") - add_link_options("-fuse-ld=${MOLD_BIN}") - else() - message(STATUS "Mold linker not found. Using default linker.") - endif() -endif() diff --git a/indra/cmake/PluginAPI.cmake b/indra/cmake/PluginAPI.cmake index 114415e514b..522bca37d25 100644 --- a/indra/cmake/PluginAPI.cmake +++ b/indra/cmake/PluginAPI.cmake @@ -13,4 +13,6 @@ if (WINDOWS) ) endif (WINDOWS) +target_include_directories( ll::pluginlibraries INTERFACE ${CMAKE_SOURCE_DIR}/llimage ${CMAKE_SOURCE_DIR}/llrender) + diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index c040090ea35..4a003f6140a 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -2,9 +2,6 @@ include_guard() include(FindAutobuild) -if(INSTALL_PROPRIETARY) - include(FindSCP) -endif(INSTALL_PROPRIETARY) set(PREBUILD_TRACKING_DIR ${AUTOBUILD_INSTALL_DIR}/cmake_tracking) # For the library installation process; diff --git a/indra/cmake/PulseAudio.cmake b/indra/cmake/PulseAudio.cmake deleted file mode 100644 index 303db97db6c..00000000000 --- a/indra/cmake/PulseAudio.cmake +++ /dev/null @@ -1,4 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -message( FATAL_ERROR "Pulseaudio cmake file is broken" ) diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake index 595f394af4c..0f76a728aa7 100644 --- a/indra/cmake/UI.cmake +++ b/indra/cmake/UI.cmake @@ -3,16 +3,15 @@ include(Prebuilt) include(FreeType) include(GLIB) +include_guard() add_library( ll::uilibraries INTERFACE IMPORTED ) if (LINUX) - target_compile_definitions(ll::uilibraries INTERFACE LL_X11=1 ) - if( USE_CONAN ) return() endif() - include(FindPkgConfig) + find_package(PkgConfig REQUIRED) pkg_check_modules(WAYLAND_CLIENT wayland-client) if( WAYLAND_CLIENT_FOUND ) @@ -22,13 +21,6 @@ if (LINUX) endif() target_link_libraries( ll::uilibraries INTERFACE - Xrender - Xcursor - Xfixes - Xext - Xft - Xinerama - X11 ll::fontconfig ll::freetype ll::SDL2 diff --git a/indra/linux_crash_logger/CMakeLists.txt b/indra/linux_crash_logger/CMakeLists.txt index 1793aa82b99..dbac7e7ddc4 100644 --- a/indra/linux_crash_logger/CMakeLists.txt +++ b/indra/linux_crash_logger/CMakeLists.txt @@ -49,8 +49,6 @@ list(APPEND linux_crash_logger_SOURCE_FILES ${linux_crash_logger_HEADER_FILES} ) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") - add_executable(linux-crash-logger ${linux_crash_logger_SOURCE_FILES}) # llcommon uses `clock_gettime' which is provided by librt on linux. diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h index 5617eaebde0..3a4e09a5989 100644 --- a/indra/llmath/llbbox.h +++ b/indra/llmath/llbbox.h @@ -95,6 +95,10 @@ class LLBBox bool mEmpty; // Nothing has been added to this bbox yet }; +static_assert(std::is_trivially_copyable::value, "LLBBox must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLBBox must be trivial move"); +static_assert(std::is_standard_layout::value, "LLBBox must be a standard layout type"); + //LLBBox operator*(const LLBBox &a, const LLMatrix4 &b); diff --git a/indra/llmath/llbboxlocal.h b/indra/llmath/llbboxlocal.h index e215e554608..afe757c8d52 100644 --- a/indra/llmath/llbboxlocal.h +++ b/indra/llmath/llbboxlocal.h @@ -34,7 +34,7 @@ class LLMatrix4; class LLBBoxLocal { public: - LLBBoxLocal() {} + LLBBoxLocal() = default; LLBBoxLocal( const LLVector3& min, const LLVector3& max ) : mMin( min ), mMax( max ) {} // Default copy constructor is OK. @@ -61,5 +61,8 @@ class LLBBoxLocal LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b); +static_assert(std::is_trivially_copyable::value, "LLBBoxLocal must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLBBoxLocal must be trivial move"); +static_assert(std::is_standard_layout::value, "LLBBoxLocal must be a standard layout type"); #endif // LL_BBOXLOCAL_H diff --git a/indra/llmath/llline.h b/indra/llmath/llline.h index e98e173d1f7..37e73e7600f 100644 --- a/indra/llmath/llline.h +++ b/indra/llmath/llline.h @@ -40,7 +40,6 @@ class LLLine public: LLLine(); LLLine( const LLVector3& first_point, const LLVector3& second_point ); - virtual ~LLLine() {}; void setPointDirection( const LLVector3& first_point, const LLVector3& second_point ); void setPoints( const LLVector3& first_point, const LLVector3& second_point ); @@ -76,5 +75,8 @@ class LLLine LLVector3 mDirection; }; +static_assert(std::is_trivially_copyable::value, "LLLine must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLLine must be trivial move"); +static_assert(std::is_standard_layout::value, "LLLine must be a standard layout type"); #endif diff --git a/indra/llmath/llmatrix3a.h b/indra/llmath/llmatrix3a.h index dff6604ae5b..3b9c6569af6 100644 --- a/indra/llmath/llmatrix3a.h +++ b/indra/llmath/llmatrix3a.h @@ -56,7 +56,7 @@ class LLMatrix3a ////////////////////////// // Ctor - LLMatrix3a() {} + LLMatrix3a() = default; // Ctor for setting by columns inline LLMatrix3a( const LLVector4a& c0, const LLVector4a& c1, const LLVector4a& c2 ); @@ -115,14 +115,19 @@ class LLMatrix3a }; +static_assert(std::is_trivial::value, "LLMatrix3a must be a trivial type"); + class LLRotation : public LLMatrix3a { public: - LLRotation() {} + LLRotation() = default; // Returns true if this rotation is orthonormal with det ~= 1 inline bool isOkRotation() const; }; +static_assert(std::is_trivial::value, "LLRotation must be a trivial type"); + + #endif diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index 3b423f783a0..377203098e2 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -36,10 +36,7 @@ class LLMatrix4a public: LL_ALIGN_16(LLVector4a mMatrix[4]); - LLMatrix4a() - { - - } + LLMatrix4a() = default; explicit LLMatrix4a(const LLMatrix4& val) { @@ -228,6 +225,8 @@ class LLMatrix4a const LLVector4a& getTranslation() const { return mMatrix[3]; } }; +static_assert(std::is_trivial::value, "LLMatrix4a must be a trivial type"); + inline LLVector4a rowMul(const LLVector4a &row, const LLMatrix4a &mat) { LLVector4a result; diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 4e8546e32b0..19bc0cebe9a 100644 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -43,7 +43,7 @@ class LLPlane public: // Constructors - LLPlane() {}; // no default constructor + LLPlane() = default; // no default constructor LLPlane(const LLVector3 &p0, F32 d) { setVec(p0, d); } LLPlane(const LLVector3 &p0, const LLVector3 &n) { setVec(p0, n); } inline void setVec(const LLVector3 &p0, F32 d) { mV.set(p0[0], p0[1], p0[2], d); } @@ -104,6 +104,7 @@ class LLPlane LLVector4a mV; } LL_ALIGN_POSTFIX(16); +static_assert(std::is_trivial::value, "LLPlane must be a trivial type"); #endif // LL_LLPLANE_H diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index 762d13eded7..472d7ca62dc 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -174,6 +174,10 @@ class LLQuaternion //static U32 mMultCount; }; +static_assert(std::is_trivially_copyable::value, "LLQuaternion must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLQuaternion must be trivial move"); +static_assert(std::is_standard_layout::value, "LLQuaternion must be a standard layout type"); + inline LLSD LLQuaternion::getValue() const { LLSD ret; diff --git a/indra/llmath/llquaternion2.h b/indra/llmath/llquaternion2.h index 902bfb71342..c9dcc4573fa 100644 --- a/indra/llmath/llquaternion2.h +++ b/indra/llmath/llquaternion2.h @@ -49,7 +49,7 @@ class LLQuaternion2 ////////////////////////// // Ctor - LLQuaternion2() {} + LLQuaternion2() = default; // Ctor from LLQuaternion explicit LLQuaternion2( const class LLQuaternion& quat ); @@ -102,4 +102,6 @@ class LLQuaternion2 }; +static_assert(std::is_trivial::value, "LLQuaternion2 must be a trivial type"); + #endif diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index 317578da06d..0a3da2fee0c 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -51,10 +51,6 @@ template class LLRectBase LLRectBase(): mLeft(0), mTop(0), mRight(0), mBottom(0) {} - LLRectBase(const LLRectBase &r): - mLeft(r.mLeft), mTop(r.mTop), mRight(r.mRight), mBottom(r.mBottom) - {} - LLRectBase(Type left, Type top, Type right, Type bottom): mLeft(left), mTop(top), mRight(right), mBottom(bottom) {} @@ -295,4 +291,8 @@ template LLRectBase LLRectBase::null(0,0,0,0); typedef LLRectBase LLRect; typedef LLRectBase LLRectf; +static_assert(std::is_trivially_copyable::value, "LLRect must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLRect must be trivial move"); +static_assert(std::is_standard_layout::value, "LLRect must be a standard layout type"); + #endif diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index a407f51029e..6c4f55b0c08 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -36,7 +36,7 @@ typedef __m128 LLQuad; class LLBool32 { public: - inline LLBool32() {} + inline LLBool32() = default; inline LLBool32(int rhs) : m_bool(rhs) {} inline LLBool32(unsigned int rhs) : m_bool(rhs) {} inline LLBool32(bool rhs) { m_bool = static_cast(rhs); } @@ -46,13 +46,15 @@ class LLBool32 inline operator bool() const { return static_cast(m_bool); } private: - int m_bool{ 0 }; + int m_bool; }; +static_assert(std::is_trivial::value, "LLBool32 must be a standard layout type"); + class LLSimdScalar { public: - inline LLSimdScalar() {} + inline LLSimdScalar() = default; inline LLSimdScalar(LLQuad q) { mQ = q; @@ -100,7 +102,9 @@ class LLSimdScalar } private: - LLQuad mQ{}; + LLQuad mQ; }; +static_assert(std::is_trivial::value, "LLSimdScalar must be a standard layout type"); + #endif //LL_SIMD_TYPES_H diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 8ef560dadf4..0fc55da12d0 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -92,10 +92,7 @@ class alignas(16) LLVector4a //////////////////////////////////// //LLVector4a is plain data which should never have a default constructor or destructor(malloc&free won't trigger it) - LLVector4a() - { //DO NOT INITIALIZE -- The overhead is completely unnecessary - ll_assert_aligned(this,16); - } + LLVector4a() = default; LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f) { @@ -358,16 +355,14 @@ class alignas(16) LLVector4a //////////////////////////////////// // Do NOT add aditional operators without consulting someone with SSE experience - inline const LLVector4a& operator= ( const LLVector4a& rhs ); - - inline const LLVector4a& operator= ( const LLQuad& rhs ); - inline operator LLQuad() const; private: - LLQuad mQ{}; + LLQuad mQ; }; +static_assert(std::is_trivial::value, "LLVector4a must be a trivial type"); + inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p) { min.setMin(min, p); diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl index 36dbec078cb..ddd7c72fb23 100644 --- a/indra/llmath/llvector4a.inl +++ b/indra/llmath/llvector4a.inl @@ -593,18 +593,6 @@ inline bool LLVector4a::equals3(const LLVector4a& rhs, F32 tolerance ) const //////////////////////////////////// // Do NOT add aditional operators without consulting someone with SSE experience -inline const LLVector4a& LLVector4a::operator= ( const LLVector4a& rhs ) -{ - mQ = rhs.mQ; - return *this; -} - -inline const LLVector4a& LLVector4a::operator= ( const LLQuad& rhs ) -{ - mQ = rhs; - return *this; -} - inline LLVector4a::operator LLQuad() const { return mQ; diff --git a/indra/llmath/llvector4logical.h b/indra/llmath/llvector4logical.h index 70759eef5c9..77cb5862e56 100644 --- a/indra/llmath/llvector4logical.h +++ b/indra/llmath/llvector4logical.h @@ -61,7 +61,7 @@ class LLVector4Logical }; // Empty default ctor - LLVector4Logical() {} + LLVector4Logical() = default; LLVector4Logical( const LLQuad& quad ) { @@ -120,7 +120,9 @@ class LLVector4Logical private: - LLQuad mQ{}; + LLQuad mQ; }; +static_assert(std::is_trivial::value, "LLVector4Logical must be a standard layout type"); + #endif //LL_VECTOR4ALOGICAL_H diff --git a/indra/llmath/m3math.h b/indra/llmath/m3math.h index 22b11d13b15..fba506510d6 100644 --- a/indra/llmath/m3math.h +++ b/indra/llmath/m3math.h @@ -141,6 +141,10 @@ class LLMatrix3 friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a }; +static_assert(std::is_trivially_copyable::value, "LLMatrix3 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLMatrix3 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLMatrix3 must be a standard layout type"); + inline LLMatrix3::LLMatrix3(void) { mMatrix[0][0] = 1.f; diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index a9853fe7e92..2a55ef5f869 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -113,12 +113,6 @@ LLMatrix4::LLMatrix4(const LLQuaternion &q) *this = initRotation(q); } -LLMatrix4::LLMatrix4(const LLMatrix4a& mat) - : LLMatrix4(mat.getF32ptr()) -{ - -} - LLMatrix4::LLMatrix4(const LLQuaternion &q, const LLVector4 &pos) { *this = initRotTrans(q, pos); @@ -156,10 +150,6 @@ LLMatrix4::LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw) mMatrix[3][3] = 1.f; } -LLMatrix4::~LLMatrix4(void) -{ -} - // Clear and Assignment Functions const LLMatrix4& LLMatrix4::setZero() diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h index b0f8c90cdfd..e1ca0bbdcb1 100644 --- a/indra/llmath/m4math.h +++ b/indra/llmath/m4math.h @@ -105,7 +105,6 @@ class LLMatrix4 explicit LLMatrix4(const F32 *mat); // Initializes Matrix to values in mat explicit LLMatrix4(const LLMatrix3 &mat); // Initializes Matrix to values in mat and sets position to (0,0,0) explicit LLMatrix4(const LLQuaternion &q); // Initializes Matrix with rotation q and sets position to (0,0,0) - explicit LLMatrix4(const LLMatrix4a& mat); LLMatrix4(const LLMatrix3 &mat, const LLVector4 &pos); // Initializes Matrix to values in mat and pos @@ -119,8 +118,6 @@ class LLMatrix4 const LLVector4 &pos); // Initializes Matrix with Euler angles LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw); // Initializes Matrix with Euler angles - ~LLMatrix4(void); // Destructor - LLSD getValue() const; void setValue(const LLSD&); @@ -242,6 +239,10 @@ class LLMatrix4 friend std::ostream& operator<<(std::ostream& s, const LLMatrix4 &a); // Stream a }; +static_assert(std::is_trivially_copyable::value, "LLMatrix4 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLMatrix4 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLMatrix4 must be a standard layout type"); + inline const LLMatrix4& LLMatrix4::setIdentity() { mMatrix[0][0] = 1.f; diff --git a/indra/llmath/tests/llquaternion_test.cpp b/indra/llmath/tests/llquaternion_test.cpp index aa3c0ad8431..ba18d54d559 100644 --- a/indra/llmath/tests/llquaternion_test.cpp +++ b/indra/llmath/tests/llquaternion_test.cpp @@ -349,9 +349,9 @@ namespace tut ensure( "2. LLVector4 operator*(const LLVector4 &a, const LLQuaternion &rot) failed", is_approx_equal(-58153.5390f, result.mV[0]) && - (183787.8125f == result.mV[1]) && - (116864.164063f == result.mV[2]) && - (78.099998f == result.mV[3])); + is_approx_equal(183787.8125f, result.mV[1]) && + is_approx_equal(116864.164063f, result.mV[2]) && + is_approx_equal(78.099998f, result.mV[3])); } //test case for LLVector3 operator*(const LLVector3 &a, const LLQuaternion &rot) fn. diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index a0ba3ec5051..0d243698239 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -110,6 +110,9 @@ class LLVector2 friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a }; +static_assert(std::is_trivially_copyable::value, "LLVector2 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLVector2 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLVector2 must be a standard layout type"); // Non-member functions diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index 3763fc67258..122aaf6e7d4 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -144,6 +144,10 @@ class LLColor3 inline void exp(); // Do an exponential on the color }; +static_assert(std::is_trivially_copyable::value, "LLColor3 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLColor3 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLColor3 must be a standard layout type"); + LLColor3 lerp(const LLColor3& a, const LLColor3& b, F32 u); void LLColor3::clamp() diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index 7c94ebdf9be..2906be92949 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -130,6 +130,10 @@ class LLVector3d }; +static_assert(std::is_trivially_copyable::value, "LLVector3d must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLVector3d must be trivial move"); +static_assert(std::is_standard_layout::value, "LLVector3d must be a standard layout type"); + typedef LLVector3d LLGlobalVec; inline const LLVector3d &LLVector3d::set(const LLVector3 &vec) diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 53491533c21..bc08a382f77 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -152,6 +152,10 @@ class LLVector3 static bool parseVector3(const std::string& buf, LLVector3* value); }; +static_assert(std::is_trivially_copyable::value, "LLVector3 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLVector3 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLVector3 must be a standard layout type"); + typedef LLVector3 LLSimLocalVec; // Non-member functions diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index a26db0428b2..e127cf83375 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -231,6 +231,10 @@ class LLColor4 inline void clamp(); }; +static_assert(std::is_trivially_copyable::value, "LLColor4 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLColor4 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLColor4 must be a standard layout type"); + // Non-member functions F32 distVec(const LLColor4& a, const LLColor4& b); // Returns distance between a and b F32 distVec_squared(const LLColor4& a, const LLColor4& b); // Returns distance squared between a and b diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index e1a02064614..1d19994dd6e 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -123,6 +123,10 @@ class LLColor4U static LLColor4U blue; }; +static_assert(std::is_trivially_copyable::value, "LLColor4U must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLColor4U must be trivial move"); +static_assert(std::is_standard_layout::value, "LLColor4U must be a standard layout type"); + // Non-member functions F32 distVec(const LLColor4U& a, const LLColor4U& b); // Returns distance between a and b F32 distVec_squared(const LLColor4U& a, const LLColor4U& b); // Returns distance squared between a and b diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index e2092d12773..cfa737f1dca 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -135,6 +135,10 @@ class LLVector4 friend LLVector4 operator-(const LLVector4 &a); // Return vector -a }; +static_assert(std::is_trivially_copyable::value, "LLVector4 must be trivial copy"); +static_assert(std::is_trivially_move_assignable::value, "LLVector4 must be trivial move"); +static_assert(std::is_standard_layout::value, "LLVector4 must be a standard layout type"); + // Non-member functions F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 005426acdee..bdfeca61d8e 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -35,6 +35,6 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES}) add_library (llplugin ${llplugin_SOURCE_FILES}) target_include_directories( llplugin INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries( llplugin llcommon llmath llrender llmessage ) +target_link_libraries( llplugin llcommon llmath llmessage llxml) add_subdirectory(slplugin) diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 5d2f3bbb798..0374906405a 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -29,7 +29,6 @@ #ifndef LL_LLPLUGINCLASSMEDIA_H #define LL_LLPLUGINCLASSMEDIA_H -#include "llgltypes.h" #include "llpluginprocessparent.h" #include "llrect.h" #include "llpluginclassmediaowner.h" @@ -355,9 +354,9 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner bool mTextureParamsReceived; // the mRequestedTexture* fields are only valid when this is true S32 mRequestedTextureDepth; - LLGLenum mRequestedTextureInternalFormat; - LLGLenum mRequestedTextureFormat; - LLGLenum mRequestedTextureType; + U32 mRequestedTextureInternalFormat; + U32 mRequestedTextureFormat; + U32 mRequestedTextureType; bool mRequestedTextureSwapBytes; bool mRequestedTextureCoordsOpenGL; diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index 3d8e02cb16f..856330c6aa7 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -81,6 +81,6 @@ if (LL_TESTS) llgltfmaterial.cpp ) - set_property(SOURCE llprimitive.cpp PROPERTY LL_TEST_ADDITIONAL_LIBRARIES llmessage) + set_property(SOURCE llprimitive.cpp PROPERTY LL_TEST_ADDITIONAL_LIBRARIES llmessage llfilesystem) LL_ADD_PROJECT_UNIT_TESTS(llprimitive "${llprimitive_TEST_SOURCE_FILES}") endif (LL_TESTS) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 37791c5c6ef..82bf4d22447 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -71,15 +71,6 @@ bool LLRender::sGLCoreProfile = false; bool LLRender::sNsightDebugSupport = false; LLVector2 LLRender::sUIGLScaleFactor = LLVector2(1.f, 1.f); -struct LLVBCache -{ - LLPointer vb; - std::chrono::steady_clock::time_point touched; -}; - -static std::unordered_map sVBCache; -static thread_local std::list *sBufferDataList = nullptr; - static const GLenum sGLTextureType[] = { GL_TEXTURE_2D, @@ -117,7 +108,7 @@ static const GLenum sGLBlendFactor[] = LLTexUnit::LLTexUnit(S32 index) : mCurrTexType(TT_NONE), - mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), + mCurrTexture(0), mHasMipMaps(false), mIndex(index) { @@ -615,26 +606,6 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) } } -void LLTexUnit::setColorScale(S32 scale) -{ - if (mCurrColorScale != scale || gGL.mDirty) - { - mCurrColorScale = scale; - gGL.flush(); - glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, scale); - } -} - -void LLTexUnit::setAlphaScale(S32 scale) -{ - if (mCurrAlphaScale != scale || gGL.mDirty) - { - mCurrAlphaScale = scale; - gGL.flush(); - glTexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale); - } -} - // Useful for debugging that you've manually assigned a texture operation to the correct // texture unit based on the currently set active texture in opengl. void LLTexUnit::debugTextureUnit(void) @@ -810,7 +781,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction) ++gGL.mLightHash; //transform direction by current modelview matrix - glm::vec3 dir(glm::make_vec3(direction.mV)); + glm::vec3 dir(direction.mV[VX], direction.mV[VY], direction.mV[VZ]); const glm::mat3 mat(gGL.getModelviewMatrix()); dir = mat * dir; @@ -921,7 +892,9 @@ void LLRender::initVertexBuffer() void LLRender::resetVertexBuffer() { - mBuffer = NULL; + mBuffer = nullptr; + mBufferDataList = nullptr; + mVBCache.clear(); } void LLRender::shutdown() @@ -1504,22 +1477,22 @@ void LLRender::clearErrors() void LLRender::beginList(std::list *list) { - if (sBufferDataList) + if (mBufferDataList) { LL_ERRS() << "beginList called while another list is open." << LL_ENDL; } llassert(LLGLSLShader::sCurBoundShaderPtr == &gUIProgram); flush(); - sBufferDataList = list; + mBufferDataList = list; } void LLRender::endList() { - if (sBufferDataList) + if (mBufferDataList) { flush(); - sBufferDataList = nullptr; + mBufferDataList = nullptr; } else { @@ -1606,10 +1579,10 @@ void LLRender::flush() U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask; - if (sBufferDataList) + if (mBufferDataList) { vb = genBuffer(attribute_mask, count); - sBufferDataList->emplace_back( + mBufferDataList->emplace_back( vb, mMode, count, @@ -1669,9 +1642,9 @@ LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count) // To leverage this, we maintain a running hash of the vertex stream being // built up before a flush, and then check that hash against a VB // cache just before creating a vertex buffer in VRAM - std::unordered_map::iterator cache = sVBCache.find(vhash); + std::unordered_map::iterator cache = mVBCache.find(vhash); - if (cache != sVBCache.end()) + if (cache != mVBCache.end()) { LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache hit"); // cache hit, just use the cached buffer @@ -1683,7 +1656,7 @@ LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count) LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache miss"); vb = genBuffer(attribute_mask, count); - sVBCache[vhash] = { vb , std::chrono::steady_clock::now() }; + mVBCache[vhash] = { vb , std::chrono::steady_clock::now() }; static U32 miss_count = 0; miss_count++; @@ -1695,11 +1668,11 @@ LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count) using namespace std::chrono_literals; // every 1024 misses, clean the cache of any VBs that haven't been touched in the last second - for (std::unordered_map::iterator iter = sVBCache.begin(); iter != sVBCache.end(); ) + for (std::unordered_map::iterator iter = mVBCache.begin(); iter != mVBCache.end(); ) { if (now - iter->second.touched > 1s) { - iter = sVBCache.erase(iter); + iter = mVBCache.erase(iter); } else { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 8c7126420e1..5a77465fdd3 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -45,6 +45,7 @@ #include "glm/mat4x4.hpp" #include +#include #include #include @@ -228,13 +229,9 @@ class LLTexUnit S32 mIndex; U32 mCurrTexture; eTextureType mCurrTexType; - S32 mCurrColorScale; - S32 mCurrAlphaScale; bool mHasMipMaps; void debugTextureUnit(void); - void setColorScale(S32 scale); - void setAlphaScale(S32 scale); GLint getTextureSource(eTextureBlendSrc src); GLint getTextureSourceType(eTextureBlendSrc src, bool isAlpha = false); }; @@ -535,6 +532,15 @@ class LLRender std::vector mUIOffset; std::vector mUIScale; + + struct LLVBCache + { + LLPointer vb; + std::chrono::steady_clock::time_point touched; + }; + + std::unordered_map mVBCache; + std::list* mBufferDataList = nullptr; }; extern F32 gGLModelView[16]; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index cd01eb79da8..cf37db7ee8f 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -79,7 +79,7 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) ////////////////////////////////////// // NOTE order of shader object attaching is VERY IMPORTANT!!! - if (features->calculatesAtmospherics) + if (features->calculatesAtmospherics || features->hasGamma || features->isDeferred) { if (!shader->attachVertexObject("windlight/atmosphericsVarsV.glsl")) { diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index e86ef2d5784..606d71a3164 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -141,15 +141,6 @@ if (WINDOWS) ) endif (WINDOWS) -if (SOLARIS) - list(APPEND llwindow_SOURCE_FILES - llwindowsolaris.cpp - ) - list(APPEND llwindow_HEADER_FILES - llwindowsolaris.h - ) -endif (SOLARIS) - if (BUILD_HEADLESS) set(llwindowheadless_SOURCE_FILES llwindowmesaheadless.cpp diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 68704e65bbc..b9ea7a16f64 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -64,41 +64,12 @@ const S32 MAX_NUM_RESOLUTIONS = 200; // LLWindowSDL // -#include - // TOFU HACK -- (*exactly* the same hack as LLWindowMacOSX for a similar // set of reasons): Stash a pointer to the LLWindowSDL object here and // maintain in the constructor and destructor. This assumes that there will // be only one object of this class at any time. Currently this is true. static LLWindowSDL *gWindowImplementation = nullptr; -void maybe_lock_display(void) -{ - if (gWindowImplementation && gWindowImplementation->Lock_Display) - gWindowImplementation->Lock_Display(); -} - -void maybe_unlock_display(void) -{ - if (gWindowImplementation && gWindowImplementation->Unlock_Display) - gWindowImplementation->Unlock_Display(); -} - - -Window LLWindowSDL::get_SDL_XWindowID(void) -{ - if (gWindowImplementation) - return gWindowImplementation->mX11Data.mXWindowID; - return None; -} - -Display* LLWindowSDL::get_SDL_Display(void) -{ - if (gWindowImplementation) - return gWindowImplementation->mX11Data.mDisplay; - return nullptr; -} - /* * In wayland a window does not have a state of "minimized" or gets messages that it got minimized [1] * There's two ways to approach this challenge: @@ -238,8 +209,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, bool enable_vsync, bool use_gl, bool ignore_pixel_depth, U32 fsaa_samples) : LLWindow(callbacks, fullscreen, flags), - Lock_Display(nullptr), - Unlock_Display(nullptr), mGamma(1.0f) + mGamma(1.0f) { // Initialize the keyboard gKeyboard = new LLKeyboardSDL(); @@ -377,6 +347,14 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if(LLRender::sGLCoreProfile) + { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); + + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); + } + U32 context_flags = 0; if (gDebugGL) { @@ -416,36 +394,18 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b setupFailure("GL Context failed to set current failure", "Error", OSMB_OK); } - mSurface = SDL_GetWindowSurface(mWindow); if(mFullscreen) { - if (mSurface) - { - mFullscreen = true; - mFullscreenWidth = mSurface->w; - mFullscreenHeight = mSurface->h; - mFullscreenBits = mSurface->format->BitsPerPixel; - mFullscreenRefresh = -1; - - LL_INFOS() << "Running at " << mFullscreenWidth - << "x" << mFullscreenHeight - << "x" << mFullscreenBits - << " @ " << mFullscreenRefresh - << LL_ENDL; - } - else - { - LL_WARNS() << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << LL_ENDL; - - mFullscreen = false; - mFullscreenWidth = -1; - mFullscreenHeight = -1; - mFullscreenBits = -1; - mFullscreenRefresh = -1; + mFullscreen = true; + SDL_GetWindowSize(mWindow, &mFullscreenWidth, &mFullscreenHeight); + mFullscreenBits = 32; + mFullscreenRefresh = -1; - std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); - setupFailure( error, "Error", OSMB_OK ); - } + LL_INFOS() << "Running at " << mFullscreenWidth + << "x" << mFullscreenHeight + << "x" << mFullscreenBits + << " @ " << mFullscreenRefresh + << LL_ENDL; } SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits); @@ -499,25 +459,23 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b /* Save the information for later use */ if (info.subsystem == SDL_SYSWM_X11) { - mX11Data.mDisplay = info.info.x11.display; - mX11Data.mXWindowID = info.info.x11.window; mServerProtocol = X11; LL_INFOS() << "Running under X11" << LL_ENDL; } else if (info.subsystem == SDL_SYSWM_WAYLAND) { + mServerProtocol = Wayland; + #ifdef LL_WAYLAND + mWaylandData.mSurface = info.info.wl.surface; mWaylandLoaded = loadWaylandClient(); if(!mWaylandLoaded) { LL_WARNS() << "Failed to load wayland-client.so or grab required functions" << LL_ENDL; } -#endif - - mWaylandData.mSurface = info.info.wl.surface; - mServerProtocol = Wayland; setupWaylandFrameCallback(); +#endif // If set (XWayland) remove DISPLAY, this will prompt dullahan to also use Wayland if( getenv("DISPLAY") ) @@ -537,8 +495,6 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b } SDL_StartTextInput(); - //make sure multisampling is disabled by default - glDisable(GL_MULTISAMPLE_ARB); // Don't need to get the current gamma, since there's a call that restores it to the system defaults. return true; @@ -620,10 +576,9 @@ void LLWindowSDL::destroyContext() LL_INFOS() << "shutdownGL begins" << LL_ENDL; gGLManager.shutdownGL(); - mX11Data.mDisplay = nullptr; - mX11Data.mXWindowID = None; - Lock_Display = nullptr; - Unlock_Display = nullptr; +#ifdef LL_WAYLAND + mWaylandData.mSurface = nullptr; +#endif mServerProtocol = Unknown; LL_INFOS() << "Destroying SDL cursors" << LL_ENDL; @@ -651,9 +606,6 @@ void LLWindowSDL::destroyContext() LL_INFOS() << "SDL Window already destroyed" << LL_ENDL; } LL_INFOS() << "destroyContext end" << LL_ENDL; - - LL_INFOS() << "SDL_QuitSS/VID begins" << LL_ENDL; - SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... } LLWindowSDL::~LLWindowSDL() @@ -730,8 +682,10 @@ bool LLWindowSDL::getVisible() const bool LLWindowSDL::getMinimized() const { +#if LL_WAYLAND if( isWaylandWindowNotDrawing() ) return true; +#endif bool result = false; if (mWindow) @@ -782,10 +736,9 @@ bool LLWindowSDL::getPosition(LLCoordScreen *position) const bool LLWindowSDL::getSize(LLCoordScreen *size) const { - if (mSurface) + if (mWindow) { - size->mX = mSurface->w; - size->mY = mSurface->h; + SDL_GetWindowSize(mWindow, &size->mX, &size->mY); return true; } @@ -794,10 +747,9 @@ bool LLWindowSDL::getSize(LLCoordScreen *size) const bool LLWindowSDL::getSize(LLCoordWindow *size) const { - if (mSurface) + if (mWindow) { - size->mX = mSurface->w; - size->mY = mSurface->h; + SDL_GetWindowSize(mWindow, &size->mX, &size->mY); return true; } @@ -1001,25 +953,12 @@ void LLWindowSDL::beforeDialog() if (mFullscreen && mWindow ) SDL_SetWindowFullscreen( mWindow, 0 ); } - - if (mServerProtocol == X11 && mX11Data.mDisplay) - { - // Everything that we/SDL asked for should happen before we - // potentially hand control over to GTK. - maybe_lock_display(); - XSync(mX11Data.mDisplay, False); - maybe_unlock_display(); - } - - maybe_lock_display(); } void LLWindowSDL::afterDialog() { LL_INFOS() << "LLWindowSDL::afterDialog()" << LL_ENDL; - maybe_unlock_display(); - if (mFullscreen && mWindow ) SDL_SetWindowFullscreen( mWindow, 0 ); } @@ -1106,7 +1045,6 @@ LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_reso mSupportedResolutions = new LLWindowResolution[MAX_NUM_RESOLUTIONS]; mNumSupportedResolutions = 0; - // Use display no from mWindow/mSurface here? int max = SDL_GetNumDisplayModes(0); max = llclamp( max, 0, MAX_NUM_RESOLUTIONS ); @@ -1142,8 +1080,13 @@ bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordWindow *to) const if (!to) return false; + if (!mWindow) + return false; + S32 height; + SDL_GetWindowSize(mWindow, nullptr, &height); + to->mX = from.mX; - to->mY = mSurface->h - from.mY - 1; + to->mY = height - from.mY - 1; return true; } @@ -1153,8 +1096,13 @@ bool LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordGL* to) const if (!to) return false; + if (!mWindow) + return false; + S32 height; + SDL_GetWindowSize(mWindow, nullptr, &height); + to->mX = from.mX; - to->mY = mSurface->h - from.mY - 1; + to->mY = height - from.mY - 1; return true; } @@ -1520,7 +1468,6 @@ void LLWindowSDL::gatherInput(bool app_has_focus) S32 width = llmax(event.window.data1, (S32)mMinWindowWidth); S32 height = llmax(event.window.data2, (S32)mMinWindowHeight); - mSurface = SDL_GetWindowSurface(mWindow); mCallbacks->handleResize(this, width, height); break; } diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 88e2221f161..f3a5a752a52 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -38,12 +38,6 @@ // get X11-specific headers for use in low-level stuff like copy-and-paste support #include "SDL2/SDL_syswm.h" -// AssertMacros.h does bad things. -#include "fix_macros.h" -#undef verify -#undef require - - class LLWindowSDL : public LLWindow { public: void show() override; @@ -162,12 +156,6 @@ class LLWindowSDL : public LLWindow { static std::vector getDynamicFallbackFontList(); - void (*Lock_Display)(void) = nullptr; - void (*Unlock_Display)(void) = nullptr; - - static Window get_SDL_XWindowID(void); - static Display *get_SDL_Display(void); - void *createSharedContext() override; void makeContextCurrent(void *context) override; void destroySharedContext(void *context) override; @@ -190,14 +178,6 @@ class LLWindowSDL : public LLWindow { void moveWindow(const LLCoordScreen &position, const LLCoordScreen &size); - // Changes display resolution. Returns true if successful - bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); - - // Go back to last fullscreen display resolution. - bool setFullscreenResolution(); - - bool shouldPostQuit() { return mPostQuit; } - protected: // // Platform specific methods @@ -219,20 +199,15 @@ class LLWindowSDL : public LLWindow { U32 mGrabbyKeyFlags = 0; SDL_Window *mWindow = nullptr; - SDL_Surface *mSurface; SDL_GLContext mContext; SDL_Cursor *mSDLCursors[UI_CURSOR_COUNT]; std::string mWindowTitle; double mOriginalAspectRatio = 1.0f; - bool mNeedsResize = false; // Constructor figured out the window is too big, it needs a resize. - LLCoordScreen mNeedsResizeSize; F32 mOverrideAspectRatio = 0.0f; F32 mGamma = 0.0f; U32 mFSAASamples = 0; - int mHaveInputFocus = -1; /* 0=no, 1=yes, else unknown */ - friend class LLWindowManager; private: @@ -244,11 +219,7 @@ class LLWindowSDL : public LLWindow { enum EServerProtocol{ X11, Wayland, Unknown }; EServerProtocol mServerProtocol = Unknown; - struct { - Window mXWindowID = None; - Display *mDisplay = nullptr; - } mX11Data; - +#if LL_WAYLAND // Wayland struct { wl_surface *mSurface = nullptr; @@ -261,7 +232,7 @@ class LLWindowSDL : public LLWindow { void setupWaylandFrameCallback(); static void waylandFrameDoneCB(void *data, struct wl_callback *cb, uint32_t time); - // +#endif private: void tryFindFullscreenSize(int &aWidth, int &aHeight); diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt index 86c46cb4766..600db532d26 100644 --- a/indra/media_plugins/CMakeLists.txt +++ b/indra/media_plugins/CMakeLists.txt @@ -1,21 +1,10 @@ # -*- cmake -*- add_subdirectory(base) +add_subdirectory(cef) +add_subdirectory(libvlc) +add_subdirectory(example) if (LINUX) - add_subdirectory(cef) - add_subdirectory(example) add_subdirectory(gstreamer10) endif (LINUX) - -if (DARWIN) - add_subdirectory(cef) - add_subdirectory(libvlc) - add_subdirectory(example) -endif (DARWIN) - -if (WINDOWS) - add_subdirectory(cef) - add_subdirectory(libvlc) - add_subdirectory(example) -endif (WINDOWS) diff --git a/indra/media_plugins/base/CMakeLists.txt b/indra/media_plugins/base/CMakeLists.txt index 5e635c6ca33..b6748abd476 100644 --- a/indra/media_plugins/base/CMakeLists.txt +++ b/indra/media_plugins/base/CMakeLists.txt @@ -27,5 +27,5 @@ add_library(media_plugin_base ${media_plugin_base_SOURCE_FILES} ) -target_link_libraries( media_plugin_base llplugin ) +target_link_libraries( media_plugin_base llplugin ll::pluginlibraries) target_include_directories( media_plugin_base INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt index 28e5f64132e..09b7a805032 100644 --- a/indra/media_plugins/cef/CMakeLists.txt +++ b/indra/media_plugins/cef/CMakeLists.txt @@ -50,16 +50,8 @@ if (LINUX) ) list(APPEND media_plugin_cef_SOURCE_FILES ${LINUX_VOLUME_CATCHER}) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id -Wl,-rpath,'$ORIGIN:$ORIGIN/../../lib'") - list(APPEND media_plugin_cef_LINK_LIBRARIES llwindow ) elseif (DARWIN) list(APPEND media_plugin_cef_SOURCE_FILES volume_catcher_null.cpp) - find_library(CORESERVICES_LIBRARY CoreServices) - find_library(AUDIOUNIT_LIBRARY AudioUnit) - set( media_plugin_cef_LINK_LIBRARIES - ${CORESERVICES_LIBRARY} # for Component Manager calls - ${AUDIOUNIT_LIBRARY} # for AudioUnit calls - ) elseif (WINDOWS) list(APPEND media_plugin_cef_SOURCE_FILES windows_volume_catcher.cpp) endif (LINUX) @@ -81,15 +73,15 @@ target_link_libraries(media_plugin_cef ll::glib_headers ) -if (WINDOWS) - set_target_properties( - media_plugin_cef - PROPERTIES - LINK_FLAGS "/MANIFEST:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099" +if (DARWIN) + find_library(CORESERVICES_LIBRARY CoreServices) + find_library(AUDIOUNIT_LIBRARY AudioUnit) + + target_link_libraries(media_plugin_cef + ${CORESERVICES_LIBRARY} # for Component Manager calls + ${AUDIOUNIT_LIBRARY} # for AudioUnit calls ) -endif (WINDOWS) -if (DARWIN) # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name set_target_properties( media_plugin_cef @@ -107,5 +99,6 @@ if (DARWIN) VERBATIM COMMENT "Fixing path to CEF Framework" ) - -endif (DARWIN) +elseif (LINUX) + target_link_options(media_plugin_cef PRIVATE "LINKER:--build-id" "LINKER:-rpath,'$ORIGIN:$ORIGIN/../../lib'") +endif () diff --git a/indra/media_plugins/example/CMakeLists.txt b/indra/media_plugins/example/CMakeLists.txt index 71343d5f852..62bc9de028e 100644 --- a/indra/media_plugins/example/CMakeLists.txt +++ b/indra/media_plugins/example/CMakeLists.txt @@ -24,14 +24,6 @@ add_library(media_plugin_example target_link_libraries(media_plugin_example media_plugin_base ) -if (WINDOWS) - set_target_properties( - media_plugin_example - PROPERTIES - LINK_FLAGS "/MANIFEST:NO /NODEFAULTLIB:LIBCMT" - ) -endif (WINDOWS) - if (DARWIN) # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name set_target_properties( diff --git a/indra/media_plugins/gstreamer10/CMakeLists.txt b/indra/media_plugins/gstreamer10/CMakeLists.txt index 14ce5bfaa11..279e07b2260 100644 --- a/indra/media_plugins/gstreamer10/CMakeLists.txt +++ b/indra/media_plugins/gstreamer10/CMakeLists.txt @@ -22,7 +22,6 @@ set(media_plugin_gstreamer10_SOURCE_FILES set(media_plugin_gstreamer10_HEADER_FILES llmediaimplgstreamer_syms.h - llmediaimplgstreamertriviallogging.h ) add_library(media_plugin_gstreamer10 diff --git a/indra/media_plugins/gstreamer10/llmediaimplgstreamer.h b/indra/media_plugins/gstreamer10/llmediaimplgstreamer.h deleted file mode 100644 index cae11a5cb31..00000000000 --- a/indra/media_plugins/gstreamer10/llmediaimplgstreamer.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file llmediaimplgstreamer.h - * @author Tofu Linden - * @brief implementation that supports media playback via GStreamer. - * - * @cond - * $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$ - * @endcond - */ - -// header guard -#ifndef llmediaimplgstreamer_h -#define llmediaimplgstreamer_h - -#if LL_GSTREAMER010_ENABLED - -extern "C" { -#include -#include - -#include "apr_pools.h" -#include "apr_dso.h" -} - - -extern "C" { -gboolean llmediaimplgstreamer_bus_callback (GstBus *bus, - GstMessage *message, - gpointer data); -} - -#endif // LL_GSTREAMER010_ENABLED - -#endif // llmediaimplgstreamer_h diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt index 863b4617e92..384ebff235e 100644 --- a/indra/media_plugins/libvlc/CMakeLists.txt +++ b/indra/media_plugins/libvlc/CMakeLists.txt @@ -28,14 +28,6 @@ target_link_libraries(media_plugin_libvlc ll::libvlc ) -if (WINDOWS) - set_target_properties( - media_plugin_libvlc - PROPERTIES - LINK_FLAGS "/MANIFEST:NO /NODEFAULTLIB:LIBCMT" - ) -endif (WINDOWS) - if (DARWIN) # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name set_target_properties( diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d5b864ca88d..234b3c6b5f0 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -13,7 +13,6 @@ include(BuildPackagesInfo) include(BuildVersion) include(CMakeCopyIfDifferent) include(CubemapToEquirectangularJS) -include(DBusGlib) include(DragDrop) include(EXPAT) include(Hunspell) @@ -1491,8 +1490,6 @@ if (LINUX) PROPERTIES COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" ) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") - endif (LINUX) if (WINDOWS) @@ -2043,8 +2040,9 @@ if (LINUX) set(COPY_INPUT_DEPENDENCIES ${VIEWER_BINARY_NAME} SLPlugin - #media_plugin_gstreamer010 - llcommon + media_plugin_gstreamer10 + media_plugin_libvlc + llwebrtc ) #if (NOT USE_BUGSPLAT) diff --git a/indra/newview/ViewerInstall.cmake b/indra/newview/ViewerInstall.cmake index ac2247c8156..7fd146bbc84 100644 --- a/indra/newview/ViewerInstall.cmake +++ b/indra/newview/ViewerInstall.cmake @@ -19,7 +19,7 @@ else (IS_ARTWORK_PRESENT) message(STATUS "WARNING: Artwork is not present, and will not be installed") endif (IS_ARTWORK_PRESENT) -install(FILES featuretable_linux.txt featuretable_solaris.txt +install(FILES featuretable_linux.txt DESTINATION ${APP_SHARE_DIR} ) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 586196fb25c..ff2500d24f6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -139,9 +139,7 @@ #include "llcoros.h" #include "llexception.h" #include "cef/dullahan_version.h" -#if !LL_LINUX #include "vlc/libvlc_version.h" -#endif // LL_LINUX #if LL_DARWIN #include "llwindowmacosx.h" @@ -3537,7 +3535,6 @@ LLSD LLAppViewer::getViewerInfo() const info["LIBCEF_VERSION"] = cef_ver_codec.str(); -#if !LL_LINUX std::ostringstream vlc_ver_codec; vlc_ver_codec << LIBVLC_VERSION_MAJOR; vlc_ver_codec << "."; @@ -3545,9 +3542,6 @@ LLSD LLAppViewer::getViewerInfo() const vlc_ver_codec << "."; vlc_ver_codec << LIBVLC_VERSION_REVISION; info["LIBVLC_VERSION"] = vlc_ver_codec.str(); -#else - info["LIBVLC_VERSION"] = "Undefined"; -#endif S32 packets_in = (S32)LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN); if (packets_in > 0) diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 92012418569..4b7cbfb4402 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -232,7 +232,7 @@ void LLControlAvatar::matchVolumeTransform() if (skin_info) { LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL; - bind_rot = LLSkinningUtil::getUnscaledQuaternion(LLMatrix4(skin_info->mBindShapeMatrix)); + bind_rot = LLSkinningUtil::getUnscaledQuaternion(LLMatrix4(skin_info->mBindShapeMatrix.getF32ptr())); } #endif setRotation(bind_rot*obj_rot); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 308dd17473d..96829ed0cec 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -761,9 +761,6 @@ static void xform4a(LLVector4a &tex_coord, const LLVector4a& trans, const LLVect // Texture transforms are done about the center of the face. st.setAdd(tex_coord, trans); - // Handle rotation - LLVector4a rot_st; - // LLVector4a s0; s0.splat(st, 0); @@ -2233,8 +2230,6 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) if (joint) { - LLVector4a jointPos; - LLMatrix4a worldMat; worldMat.loadu((F32*)&joint->getWorldMatrix().mMatrix[0][0]); diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 2255eb236f8..760d2f3bda7 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -109,7 +109,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight()); - glm::vec3 win_coord = glm::project(glm::make_vec3(LLVector4(render_pos).mV), get_current_modelview(), get_current_projection(), viewport); + glm::vec3 win_coord = glm::project(glm::vec3(render_pos.mV[VX], render_pos.mV[VY], render_pos.mV[VZ]), get_current_modelview(), get_current_projection(), viewport); //fonts all render orthographically, set up projection`` gGL.matrixMode(LLRender::MM_PROJECTION); diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index b6cfdef5988..6c844cd745e 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -520,7 +520,7 @@ void LLModelPreview::rebuildUploadData() bool upload_skinweights = fmp && fmp->childGetValue("upload_skin").asBoolean(); if (upload_skinweights && high_lod_model->mSkinInfo.mJointNames.size() > 0) { - LLQuaternion bind_rot = LLSkinningUtil::getUnscaledQuaternion(LLMatrix4(high_lod_model->mSkinInfo.mBindShapeMatrix)); + LLQuaternion bind_rot = LLSkinningUtil::getUnscaledQuaternion(LLMatrix4(high_lod_model->mSkinInfo.mBindShapeMatrix.getF32ptr())); LLQuaternion identity; if (!bind_rot.isEqualEps(identity, 0.01)) { diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 955b5e77305..799c6e7a4b5 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -660,7 +660,7 @@ void LLPanelPrimMediaControls::updateShape() for(; vert_it != vert_end; ++vert_it) { // project silhouette vertices into screen space - glm::vec3 screen_vert(glm::make_vec3(vert_it->mV)); + glm::vec3 screen_vert(vert_it->mV[VX], vert_it->mV[VY], vert_it->mV[VZ]); screen_vert = mul_mat4_vec3(mat, screen_vert); // add to screenspace bounding box diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 07e2c39379c..96fea13f9e0 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -256,7 +256,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box) glm::mat4 mv(get_current_modelview()); LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); mRadius = s.magVec(); - glm::mat4 scale = glm::scale(glm::make_vec3(LLVector4(s).mV)); + glm::mat4 scale = glm::scale(glm::vec3(s.mV[VX], s.mV[VY], s.mV[VZ])); if (mViewerObject->mDrawable != nullptr) { // object to agent space (no scale) diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index c33d5ef7ccb..511f6abd37e 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -1091,8 +1091,8 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force) LLVector4 waterPlane(enorm.x, enorm.y, enorm.z, -glm::dot(ep, enorm)); - norm = glm::make_vec3(gPipeline.mHeroProbeManager.mMirrorNormal.mV); - p = glm::make_vec3(gPipeline.mHeroProbeManager.mMirrorPosition.mV); + norm = glm::vec3(gPipeline.mHeroProbeManager.mMirrorNormal.mV[VZ], gPipeline.mHeroProbeManager.mMirrorNormal.mV[VY], gPipeline.mHeroProbeManager.mMirrorNormal.mV[VZ]); + p = glm::vec3(gPipeline.mHeroProbeManager.mMirrorPosition.mV[VX], gPipeline.mHeroProbeManager.mMirrorPosition.mV[VY], gPipeline.mHeroProbeManager.mMirrorPosition.mV[VZ]); enorm = mul_mat4_vec3(invtrans, norm); enorm = glm::normalize(enorm); ep = mul_mat4_vec3(mat, p); diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index aa43b2dbad0..170d7f5c4af 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -420,7 +420,7 @@ bool LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight()); - glm::vec3 win_coord = glm::project(glm::make_vec3(pos_agent.mV), get_current_modelview(), get_current_projection(), viewport); + glm::vec3 win_coord = glm::project(glm::vec3(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]), get_current_modelview(), get_current_projection(), viewport); { // convert screen coordinates to virtual UI coordinates @@ -514,7 +514,7 @@ bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight()); - glm::vec3 win_coord = glm::project(glm::make_vec3(pos_agent.mV), get_current_modelview(), get_current_projection(), viewport); + glm::vec3 win_coord = glm::project(glm::vec3(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]), get_current_modelview(), get_current_projection(), viewport); { win_coord.x /= gViewerWindow->getDisplayScale().mV[VX]; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 31be509b0bd..d2b82937c9d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1939,10 +1939,10 @@ bool LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& if (linesegment_sphere(LLVector3(glm::value_ptr(p1)), LLVector3(glm::value_ptr(p2)), LLVector3(0,0,0), 1.f, position, norm)) { - glm::vec3 res_pos(glm::make_vec3(LLVector4(position).mV)); + glm::vec3 res_pos(position.mV[VX], position.mV[VY], position.mV[VZ]); res_pos = mul_mat4_vec3(mat, res_pos); - glm::vec3 res_norm(glm::make_vec3(LLVector4(norm).mV)); + glm::vec3 res_norm(norm.mV[VX], norm.mV[VY], norm.mV[VZ]); res_norm = glm::normalize(res_norm); res_norm = glm::mat3(norm_mat) * res_norm; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 40cb32f6116..ed6298c108c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8699,7 +8699,7 @@ void LLPipeline::renderDeferredLighting() sVisibleLightCount++; - glm::vec3 tc(glm::make_vec3(LLVector4(center).mV)); + glm::vec3 tc(center.mV[VX], center.mV[VY], center.mV[VZ]); tc = mul_mat4_vec3(mat, tc); setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); @@ -9832,7 +9832,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLVector3 lightDir = -caster_dir; lightDir.normVec(); - glm::vec3 light_dir(glm::make_vec3(lightDir.mV)); + glm::vec3 light_dir(lightDir.mV[VX], lightDir.mV[VY], lightDir.mV[VZ]); //create light space camera matrix @@ -9887,7 +9887,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) //get good split distances for frustum for (U32 i = 0; i < fp.size(); ++i) { - glm::vec3 v(glm::make_vec3(fp[i].mV)); + glm::vec3 v(fp[i].mV[VX], fp[i].mV[VY], fp[i].mV[VZ]); v = mul_mat4_vec3(saved_view, v); fp[i].setVec(glm::value_ptr(v)); } @@ -10038,7 +10038,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) for (U32 i = 0; i < fp.size(); i++) { - glm::vec3 p = glm::make_vec3(fp[i].mV); + glm::vec3 p(fp[i].mV[VX], fp[i].mV[VY], fp[i].mV[VZ]); p = mul_mat4_vec3(view[j], p); wpf.push_back(LLVector3(glm::value_ptr(p))); } @@ -10241,7 +10241,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) view[j] = glm::inverse(view[j]); //llassert(origin.isFinite()); - glm::vec3 origin_agent(glm::make_vec3(LLVector4(origin).mV)); + glm::vec3 origin_agent(origin.mV[VX], origin.mV[VY], origin.mV[VZ]); //translate view to origin origin_agent = mul_mat4_vec3(view[j], origin_agent); diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 6acd0ae3e1a..40fc002ae7f 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1036,12 +1036,6 @@ def path_optional(src, dst): ): dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) - # SDL2 - for libfile in ( - 'libSDL2-2.0.dylib', - ): - dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) - # our apps executable_path = {} embedded_apps = [ (os.path.join("llplugin", "slplugin"), "SLPlugin.app") ] @@ -1254,12 +1248,11 @@ def construct(self): # plugins with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins'), dst="bin/llplugin"): self.path("gstreamer10/libmedia_plugin_gstreamer10.so", "libmedia_plugin_gstreamer.so") - - with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins'), dst="bin/llplugin"): + self.path("libvlc/libmedia_plugin_libvlc.so", "libmedia_plugin_libvlc.so") self.path("cef/libmedia_plugin_cef.so", "libmedia_plugin_cef.so" ) + with self.prefix(src=os.path.join(pkgdir, 'lib', 'release'), dst="lib"): self.path( "libcef.so" ) - self.path( "libEGL*" ) self.path( "libvulkan*" ) self.path( "libvk_swiftshader*" ) @@ -1408,6 +1401,7 @@ def strip_binaries(self): '!', '-name', '*.crt', '!', '-name', '*.dll', '!', '-name', '*.lib', + '!', '-name', '*.json', '!', '-name', 'update_install', '-exec', 'strip', '-S', '{}', ';']) class Linux_x86_64_Manifest(LinuxManifest): diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index 745c0eedf81..a0aceda9900 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -68,7 +68,7 @@ target_link_libraries(lltest if (WINDOWS) set_target_properties(lltest - PROPERTIES + PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT" LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\"" RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}" @@ -86,10 +86,10 @@ set(TEST_EXE $) SET_TEST_PATH(LD_LIBRARY_PATH) -LL_TEST_COMMAND(command +LL_TEST_COMMAND(command "${LD_LIBRARY_PATH}" "${TEST_EXE}" - "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt" + "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt" "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt") ADD_CUSTOM_COMMAND( @@ -102,11 +102,11 @@ ADD_CUSTOM_COMMAND( set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt) -# This should cause the test executable to be built, but not +# This should cause the test executable to be built, but not # run if LL_TESTS is disabled. This will hopefully keep the -# tests up to date with any code changes changes even if +# tests up to date with any code changes changes even if # developers choose to disable LL_TESTS. -if (LL_TESTS) +if (LL_TESTS) add_custom_target(tests_ok ALL DEPENDS ${test_results}) if(DARWIN) # Support our "@executable_path/../Resources" load path for our test @@ -114,7 +114,7 @@ if (LL_TESTS) # but the CMake $ generator expression isn't evaluated by # CREATE_LINK, so fudge it. add_custom_command( TARGET lltest POST_BUILD - COMMAND cmake -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/test/Resources + COMMAND ${CMAKE_COMMAND} -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/test/Resources ) endif() endif (LL_TESTS)