From 54c4f5ba0d4a9eda6a2f4ffecbdd79aae97f46f8 Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 7 Mar 2023 22:17:27 +0000 Subject: [PATCH 01/11] Clean up as we go to allow Linux bloat monster to build. clean up ~25G wasted space on Linux build server Linux only Try gcc=10 Add swap space back --- .github/workflows/build_viewer.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_viewer.yml b/.github/workflows/build_viewer.yml index 1671216199..08872166db 100644 --- a/.github/workflows/build_viewer.yml +++ b/.github/workflows/build_viewer.yml @@ -5,6 +5,7 @@ env: EXTRA_ARGS: -DFMODSTUDIO=ON -DUSE_KDU=ON --crashreporting build_secrets_checkout: ${{github.workspace}}/signing + jobs: build_matrix: strategy: @@ -31,6 +32,18 @@ jobs: - name: Check python version run: python -V + - name: Free Disk Space (Ubuntu) + if: runner.os == 'Linux' + uses: jlumbroso/free-disk-space@main + with: + swap-storage: false + + - name: Set gcc version on Linux + if: runner.os == 'Linux' + run: | + echo "CC=gcc-10" >> $GITHUB_ENV + echo "CXX=g++-10" >> $GITHUB_ENV + - name: Install Bash 4 and GNU sed on Mac if: runner.os == 'macOS' run: | @@ -117,12 +130,14 @@ jobs: security set-key-partition-list -S apple-tool:,apple:, -s -k "$FS_KEYCHAIN_PASS" -t private ~/Library/Keychains/viewer.keychain security list-keychain -d user -s ~/Library/Keychains/viewer.keychain - - name: Install required Ubuntu packages + - name: Install required Ubuntu packages and release some space. if: runner.os == 'Linux' run: | dependencies=("python3-setuptools" "mesa-common-dev" "libgl1-mesa-dev" "libxinerama-dev" "libxrandr-dev" "libpulse-dev" "libglu1-mesa-dev" "libfreetype6-dev" "libfontconfig1") sudo apt-get update sudo apt-get install -y "${dependencies[@]}" + sudo apt-get autoremove --purge + sudo apt-get clean - name: test macOS bundles are present if: runner.os == 'MacOS' @@ -168,7 +183,9 @@ jobs: fi done shell: bash - + - name: Clean up packages to give more space + run: rm *${{ env.fallback_platform }}*bz2 + shell: bash - name: Configure run: autobuild configure --debug -c ReleaseFS -A${{matrix.addrsize}} -- --package --chan ${{env.FS_RELEASE_CHAN}} ${{env.EXTRA_ARGS}} ${{env.FS_GRID}} shell: bash From 19d37d0c18bd9d7b7038445ded28e110e1ada52f Mon Sep 17 00:00:00 2001 From: Pork Chop Date: Tue, 21 Mar 2023 22:05:36 +1100 Subject: [PATCH 02/11] Linux: GCC 13 -- Supress the massive amount of warnings pertaining to C++20 compatibility, the viewer likely wont be C++20 compliant anywhere in the near future --- indra/cmake/00-Common.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 1045a6efae..205005b954 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -257,7 +257,11 @@ if (LINUX OR DARWIN) if(LINUX) set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder -Wno-non-virtual-dtor -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pragmas -Wno-deprecated") endif() - + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) + set(GCC_CXX_WARNINGS "${GCC_CXX_WARNINGS} -Wno-c++20-compat") + endif() + set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}") From 2c581cb994f5937cef1ab5b3c919fcee97f0e7b5 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 27 Mar 2023 11:50:32 +0200 Subject: [PATCH 03/11] Update FMOD Studio to 2.02.13 on Windows --- autobuild.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index c696a68f4c..cae363799a 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1112,11 +1112,11 @@ archive hash - 8b2fff1a0a7e057da99fdade1f9e82ff + 99c928b18a0d2f08b0ee33fca90c4118 hash_algorithm md5 url - file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.11-windows-230181802.tar.bz2 + file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.13-windows-230860911.tar.bz2 name windows @@ -1126,18 +1126,18 @@ archive hash - 6cf457e2268ed83326c6d77f3475e8f5 + 01946a6427d126570607c02b75560f02 hash_algorithm md5 url - file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.11-windows64-230181820.tar.bz2 + file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.13-windows64-230860913.tar.bz2 name windows64 version - 2.02.11 + 2.02.13 fontconfig From b3d9c81370336d52631df8404bd8f1aaee792cf4 Mon Sep 17 00:00:00 2001 From: Pork Chop Date: Mon, 27 Mar 2023 22:40:02 +1100 Subject: [PATCH 04/11] Linux: Update FMOD Studio to 2.02.13 --- autobuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index cae363799a..51d9f2aa5e 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1098,11 +1098,11 @@ archive hash - e610f49fa7ed5b10b0cc6409b9bf4afc + 5fee0f9587f50531211ff9e1e860692f hash_algorithm md5 url - file:///opt/firestorm/fmodstudio-2.02.11-linux64-230190114.tar.bz2 + file:///opt/firestorm/fmodstudio-2.02.13-linux64-230861132.tar.bz2 name linux64 From 98b5ca069081c296dec5123b563701de5d30249e Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 27 Mar 2023 16:01:51 +0200 Subject: [PATCH 05/11] Remove Python 2 compatibility hack --- indra/newview/viewer_manifest.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 063064119f..97cbc299b6 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -26,11 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA $/LicenseInfo$ """ -# Remove this line if Python 2 compatibility is not needed. -# Note that, as is, the script works under both versions, so no -# matter what version "/usr/bin/env python" returns, it'll run. -from __future__ import print_function, division - import errno import glob import itertools From 9f6fff9af450ebb4d4907c9378f32fa4b0fb202d Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Mon, 27 Mar 2023 22:00:14 +0200 Subject: [PATCH 06/11] Add detection of empty/almost empty alpha layers in image uploads and strip those layers by default, unless instructed otherwise. --- indra/newview/llfloaterimagepreview.cpp | 91 ++++++++++++++++++- indra/newview/llfloaterimagepreview.h | 10 ++ .../default/xui/en/floater_image_preview.xml | 36 +++++++- .../skins/default/xui/en/notifications.xml | 22 +++++ 4 files changed, 156 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 6976035249..4d9af5bc84 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -65,6 +65,8 @@ #include "llcheckboxctrl.h" #include "llagentbenefits.h" +#include "llnotificationsutil.h" // detect and strip empty alpha layers from images on upload + const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; @@ -72,6 +74,10 @@ const S32 PREVIEW_VPAD = -24 + 35; // yuk, hard coded const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16 + 35; const S32 PREVIEW_TEXTURE_HEIGHT = 320; +// detect and strip empty alpha layers from images on upload +const U8 ALPHA_EMPTY_THRESHOLD = 253; +const F32 ALPHA_EMPTY_THRESHOLD_RATIO = 0.999f; +// //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- @@ -168,16 +174,99 @@ BOOL LLFloaterImagePreview::postBuild() } } - getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + // detect and strip empty alpha layers from images on upload + // getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterImagePreview::onBtnUpload, this)); + if (mRawImagep->getComponents() != 4) + { + return TRUE; + } + + U32 imageBytes = mRawImagep->getWidth() * mRawImagep->getHeight() * 4; + + U32 emptyAlphaCount = 0; + U8* data = mRawImagep->getData(); + for (U32 i = 3; i < imageBytes; i += 4) + { + if (data[i] > ALPHA_EMPTY_THRESHOLD) + { + emptyAlphaCount++; + } + } + + mEmptyAlphaCheck = getChild("strip_alpha_check"); + + if (emptyAlphaCount > (imageBytes / 4 * ALPHA_EMPTY_THRESHOLD_RATIO)) + { + getChild("image_alpha_warning")->setVisible(true); + + mEmptyAlphaCheck->setCommitCallback(boost::bind(&LLFloaterImagePreview::emptyAlphaCheckboxCallback, this)); + mEmptyAlphaCheck->setValue(true); + } + else + { + getChild("image_alpha_warning")->setVisible(false); + mEmptyAlphaCheck->setValue(false); + } + // return TRUE; } +// detect and strip empty alpha layers from images on upload +void LLFloaterImagePreview::emptyAlphaCheckboxCallback() +{ + if (!mEmptyAlphaCheck->getValue()) + { + LLNotificationsUtil::add("ImageEmptyAlphaLayer", LLSD(), LLSD(), boost::bind(&LLFloaterImagePreview::imageEmptyAlphaCallback, this, _1, _2)); + } +} + +bool LLFloaterImagePreview::imageEmptyAlphaCallback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + // 0 = strip alpha + if (option == 0) + { + mEmptyAlphaCheck->setValue(true); + } + + return true; +} + +void LLFloaterImagePreview::onBtnUpload() +{ + if(mEmptyAlphaCheck->getValue()) + { + LLPointer stripped_image = new LLImageRaw(mRawImagep->getWidth(), mRawImagep->getHeight(), 3); + stripped_image->copyUnscaled4onto3(mRawImagep); + + LLPointer stripped_png = new LLImagePNG; + + // 0.0 = encode time, apparently not used in the encode() function + stripped_png->encode(stripped_image, 0.0f); + + mFilenameAndPath = gDirUtilp->getTempFilename() + "." + stripped_png->getExtension(); + stripped_png->save(mFilenameAndPath); + + mDeleteTempFile = mFilenameAndPath; + } + + onBtnOK(); +} +// //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- LLFloaterImagePreview::~LLFloaterImagePreview() { + // detect and strip empty alpha layers from images on upload + if (!mDeleteTempFile.empty()) + { + LLFile::remove(mDeleteTempFile); + } + // clearAllPreviewTextures(); mRawImagep = NULL; diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index d034622c35..6a6f2f1c7c 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -39,6 +39,7 @@ class LLVOAvatar; class LLTextBox; class LLVertexBuffer; class LLVolume; +class LLCheckBoxCtrl; // detect and strip empty alpha layers from images on upload class LLImagePreviewSculpted : public LLViewerDynamicTexture { @@ -129,6 +130,11 @@ protected: void draw(); bool loadImage(const std::string& filename); + // detect and strip empty alpha layers from images on upload + void onBtnUpload(); + void emptyAlphaCheckboxCallback(); + bool imageEmptyAlphaCallback(const LLSD& notification, const LLSD& response); + // LLPointer mRawImagep; LLPointer mAvatarPreview; LLPointer mSculptedPreview; @@ -139,6 +145,10 @@ protected: LLPointer mImagep ; std::string mImageLoadError; + // detect and strip empty alpha layers from images on upload + std::string mDeleteTempFile; + LLCheckBoxCtrl* mEmptyAlphaCheck; + // }; #endif // LL_LLFLOATERIMAGEPREVIEW_H diff --git a/indra/newview/skins/default/xui/en/floater_image_preview.xml b/indra/newview/skins/default/xui/en/floater_image_preview.xml index d7d4aa91cc..7d1f01b6ac 100644 --- a/indra/newview/skins/default/xui/en/floater_image_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_image_preview.xml @@ -47,9 +47,9 @@ + + + + + + + + + + + + The image you are trying to upload contains an empty, or almost empty alpha channel (transparency information). This is almost always not desired and should be stripped off. Adding an alpha channel to an image will lead to textures flipping on top of each other at different camera angles, and it makes rendering slower. So, unless you really need this texture to have an empty / almost empty alpha channel, consider stripping it out. + confirm_strip +
+