diff options
384 files changed, 4583 insertions, 13495 deletions
diff --git a/autobuild.xml b/autobuild.xml index 916a2d06e8..64de949e31 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -52,9 +52,9 @@ <key>archive</key> <map> <key>hash</key> - <string>b6357ef3a0ec37877a5831820f25094e</string> + <string>178b16ee9ff67986c8c14413ee68218e</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/80557/759704/apr_suite-1.4.5.558565-darwin64-558565.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107593/938535/apr_suite-1.4.5.576669-darwin64-576669.tar.bz2</string> </map> <key>name</key> <string>darwin64</string> @@ -76,9 +76,9 @@ <key>archive</key> <map> <key>hash</key> - <string>cb48ac069440f6dcd564cfa9fd02a4c2</string> + <string>d2997cad03dbd0d70a060276b5671480</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/80556/759710/apr_suite-1.4.5.558565-windows-558565.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107594/938548/apr_suite-1.4.5.576669-windows-576669.tar.bz2</string> </map> <key>name</key> <string>windows</string> @@ -88,16 +88,16 @@ <key>archive</key> <map> <key>hash</key> - <string>646dc3828d9c39fb1e77c4eec44ed739</string> + <string>ec24f5945faa8f13807b83eeaeb994f8</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/80555/759709/apr_suite-1.4.5.558565-windows64-558565.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107592/938547/apr_suite-1.4.5.576669-windows64-576669.tar.bz2</string> </map> <key>name</key> <string>windows64</string> </map> </map> <key>version</key> - <string>1.4.5.558565</string> + <string>1.4.5.576669</string> </map> <key>boost</key> <map> @@ -1382,9 +1382,9 @@ <key>archive</key> <map> <key>hash</key> - <string>c1c9e32e21f3c34d91ed045b2ca91f24</string> + <string>7a0059748d0b8733f2f9ce434cf604b8</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/87781/805801/libpng-1.6.8.563850-darwin64-563850.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107514/937867/libpng-1.6.38.576621-darwin64-576621.tar.bz2</string> </map> <key>name</key> <string>darwin64</string> @@ -1406,9 +1406,9 @@ <key>archive</key> <map> <key>hash</key> - <string>642e9cf95c8ccd0eb34f6d7a40df585a</string> + <string>3112013186ad60b0fc270a398d4dd499</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/87782/805831/libpng-1.6.8.563850-windows-563850.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107513/937823/libpng-1.6.38.576621-windows-576621.tar.bz2</string> </map> <key>name</key> <string>windows</string> @@ -1418,16 +1418,16 @@ <key>archive</key> <map> <key>hash</key> - <string>ce46aa0f171d97626c4a3940347cecd7</string> + <string>7c6bfcdb0d6162587cdbc436f595dd02</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/87780/805832/libpng-1.6.8.563850-windows64-563850.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107512/937822/libpng-1.6.38.576621-windows64-576621.tar.bz2</string> </map> <key>name</key> <string>windows64</string> </map> </map> <key>version</key> - <string>1.6.8.563850</string> + <string>1.6.38.576621</string> </map> <key>libuuid</key> <map> @@ -2215,9 +2215,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>5abf2d9c0b250821c59cc60cd94fd8af</string> + <string>8114c6a7e499ea20d325db0de08ce30a</string> <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54840/510064/openjpeg-1.5.1.538970-darwin64-538970.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/105469/923024/openjpeg-2.5.0.575496-darwin64-575496.tar.bz2</string> </map> <key>name</key> <string>darwin64</string> @@ -2239,9 +2239,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>222a406ecb4071a9cc9635353afa337e</string> + <string>edc9388870d951632a6d595792293e05</string> <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54977/511775/openjpeg-1.5.1.538970-windows-538970.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/105472/923036/openjpeg-2.5.0.575496-windows-575496.tar.bz2</string> </map> <key>name</key> <string>windows</string> @@ -2251,16 +2251,16 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>5b5c80807fa8161f3480be3d89fe9516</string> + <string>b95f0732f2388ebb0ddf33d4a30e0ff1</string> <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54974/511767/openjpeg-1.5.1.538970-windows64-538970.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/105471/923037/openjpeg-2.5.0.575496-windows64-575496.tar.bz2</string> </map> <key>name</key> <string>windows64</string> </map> </map> <key>version</key> - <string>1.5.1.538970</string> + <string>2.5.0.575496</string> </map> <key>openssl</key> <map> @@ -2553,7 +2553,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>canonical_repo</key> <string>https://bitbucket.org/lindenlab/3p-tracy</string> <key>copyright</key> - <string>Copyright (c) 2017-2021, Bartosz Taudul (wolf@nereid.pl)</string> + <string>Copyright (c) 2017-2022, Bartosz Taudul (wolf@nereid.pl)</string> <key>description</key> <string>Tracy Profiler Library</string> <key>license</key> @@ -2569,9 +2569,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>da7317e4a81609f624f84780f28b07de</string> + <string>9b6e1a1f4b0969d38a1ca8ee00aeb548</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/86972/801630/tracy-v0.7.8.563351-darwin64-563351.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/110584/960613/tracy-v0.8.1.578241-darwin64-578241.tar.bz2</string> </map> <key>name</key> <string>darwin64</string> @@ -2581,11 +2581,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>47c696cd2966c5cc3c8ba6115dd1f886</string> + <string>9e6975565d7337442259324e68bcf59c</string> <key>hash_algorithm</key> <string>md5</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/86973/801641/tracy-v0.7.8.563351-windows-563351.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/110585/960636/tracy-v0.8.1.578241-windows-578241.tar.bz2</string> </map> <key>name</key> <string>windows</string> @@ -2595,11 +2595,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>dff3dd1db6a4cb0b73f60a5db3ee0de2</string> + <string>05b72ae5d733aed7d3bf142287601cc6</string> <key>hash_algorithm</key> <string>md5</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/100101/882119/tracy-v0.8.1.571983-windows64-571983.tar.bz2</string> + <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/110586/960637/tracy-v0.8.1.578241-windows64-578241.tar.bz2</string> </map> <key>name</key> <string>windows64</string> @@ -2610,7 +2610,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>source_type</key> <string>git</string> <key>version</key> - <string>v0.7.8.563351</string> + <string>v0.8.1.578241</string> </map> <key>tut</key> <map> diff --git a/doc/contributions.txt b/doc/contributions.txt index 4975039241..5b5ca64d37 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -282,6 +282,7 @@ Beq Janus SL-11300 SL-15709 SL-16021 + SL-18592 SL-18637 Beth Walcher Bezilon Kasei @@ -373,6 +374,7 @@ Charlie Sazaland Chaser Zaks BUG-225599 BUG-227485 + SL-16874 Cherry Cheevers ChickyBabes Zuzu Chorazin Allen @@ -1383,6 +1385,7 @@ Sovereign Engineer OPEN-343 SL-11625 BUG-229030 + SL-14696 SL-14705 SL-14706 SL-14707 @@ -1390,6 +1393,12 @@ Sovereign Engineer SL-14732 SL-15096 SL-16127 + SL-18249 + SL-18394 + SL-18412 + SL-18497 + SL-18525 + SL-18534 SpacedOut Frye VWR-34 VWR-45 @@ -1652,6 +1661,8 @@ Zi Ree VWR-25588 STORM-1790 STORM-1842 + SL-18348 + SL-18593 Zipherius Turas VWR-76 VWR-77 diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index ff705101de..04b4202ca3 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -52,7 +52,7 @@ if(WINDOWS) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(release_files - openjpeg.dll + openjp2.dll libapr-1.dll libaprutil-1.dll libapriconv-1.dll @@ -220,7 +220,7 @@ elseif(LINUX) libgobject-2.0.so libhunspell-1.3.so.0.0.0 libopenal.so - libopenjpeg.so + libopenjp2.so libuuid.so.16 libuuid.so.16.0.22 libfontconfig.so.1.8.0 diff --git a/indra/cmake/FindOpenJPEG.cmake b/indra/cmake/FindOpenJPEG.cmake index 949384eec4..2d4353b54f 100644 --- a/indra/cmake/FindOpenJPEG.cmake +++ b/indra/cmake/FindOpenJPEG.cmake @@ -14,9 +14,10 @@ FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h /usr/local/include /usr/include/openjpeg /usr/include +include/openjpeg ) -SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjpeg) +SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjp2) FIND_LIBRARY(OPENJPEG_LIBRARY NAMES ${OPENJPEG_NAMES} PATHS /usr/lib /usr/local/lib diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake index 528b43c3fc..0d73270d63 100644 --- a/indra/cmake/LLCommon.cmake +++ b/indra/cmake/LLCommon.cmake @@ -34,6 +34,7 @@ else (LINUX) ${BOOST_CONTEXT_LIBRARY} ${BOOST_THREAD_LIBRARY} ${BOOST_SYSTEM_LIBRARY} + ${TRACY_LIBRARY} ) endif (LINUX) diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake index bf0bde2ba7..a078c97cb8 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -8,15 +8,7 @@ if (USESYSTEMLIBS) include(FindOpenJPEG) else (USESYSTEMLIBS) use_prebuilt_binary(openjpeg) - - if(WINDOWS) - # Windows has differently named release and debug openjpeg(d) libs. - set(OPENJPEG_LIBRARIES - debug openjpegd - optimized openjpeg) - else(WINDOWS) - set(OPENJPEG_LIBRARIES openjpeg) - endif(WINDOWS) - - set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg) + + set(OPENJPEG_LIBRARIES openjp2) + set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg) endif (USESYSTEMLIBS) diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake index dba57eb920..a29d4021a3 100644 --- a/indra/cmake/Tracy.cmake +++ b/indra/cmake/Tracy.cmake @@ -17,10 +17,12 @@ if (USE_TRACY) if (DARWIN) MESSAGE(STATUS "Including Tracy for Darwin: '${TRACY_INCLUDE_DIR}'") + set(TRACY_LIBRARY "TracyClient") endif (DARWIN) if (LINUX) MESSAGE(STATUS "Including Tracy for Linux: '${TRACY_INCLUDE_DIR}'") + set(TRACY_LIBRARY "TracyClient") endif (LINUX) else (USE_TRACY) # Tracy.cmake should not set LLCOMMON_INCLUDE_DIRS, let LLCommon.cmake do that diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt index d7706e73b2..3957ede77f 100644 --- a/indra/integration_tests/llui_libtest/CMakeLists.txt +++ b/indra/integration_tests/llui_libtest/CMakeLists.txt @@ -99,14 +99,14 @@ if (WINDOWS) # Copy over OpenJPEG.dll # *NOTE: On Windows with VS2005, only the first comment prints set(OPENJPEG_RELEASE - "${ARCH_PREBUILT_DIRS_RELEASE}/openjpeg.dll") + "${ARCH_PREBUILT_DIRS_RELEASE}/openjp2.dll") add_custom_command( TARGET llui_libtest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OPENJPEG_RELEASE} ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Copying OpenJPEG DLLs to binary directory" ) set(OPENJPEG_DEBUG - "${ARCH_PREBUILT_DIRS_DEBUG}/openjpegd.dll") + "${ARCH_PREBUILT_DIRS_DEBUG}/openjp2.dll") add_custom_command( TARGET llui_libtest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OPENJPEG_DEBUG} ${CMAKE_CURRENT_BINARY_DIR} diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index f0df3e1474..c1336fd612 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -305,7 +305,12 @@ LLAvatarAppearance::~LLAvatarAppearance() } } - if (mRoot) mRoot->removeAllChildren(); + if (mRoot) + { + mRoot->removeAllChildren(); + delete mRoot; + mRoot = nullptr; + } mJointMap.clear(); clearSkeleton(); diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 3f564ec3de..0481326e9e 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -76,6 +76,7 @@ LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) : LLLocalTextureObject::~LLLocalTextureObject() { + delete_and_clear(mTexLayers); } LLGLTexture* LLLocalTextureObject::getImage() const diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index ebf7454a61..403d5bcf49 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1229,7 +1229,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints) { BOOL old_version = FALSE; - mJointMotionList = new LLKeyframeMotion::JointMotionList; + std::unique_ptr<LLKeyframeMotion::JointMotionList> joint_motion_list(new LLKeyframeMotion::JointMotionList); //------------------------------------------------------------------------- // get base priority @@ -1272,16 +1272,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo << " for animation " << asset_id << LL_ENDL; return FALSE; } - mJointMotionList->mBasePriority = (LLJoint::JointPriority) temp_priority; + joint_motion_list->mBasePriority = (LLJoint::JointPriority) temp_priority; - if (mJointMotionList->mBasePriority >= LLJoint::ADDITIVE_PRIORITY) + if (joint_motion_list->mBasePriority >= LLJoint::ADDITIVE_PRIORITY) { - mJointMotionList->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1); - mJointMotionList->mMaxPriority = mJointMotionList->mBasePriority; + joint_motion_list->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1); + joint_motion_list->mMaxPriority = joint_motion_list->mBasePriority; } - else if (mJointMotionList->mBasePriority < LLJoint::USE_MOTION_PRIORITY) + else if (joint_motion_list->mBasePriority < LLJoint::USE_MOTION_PRIORITY) { - LL_WARNS() << "bad animation base_priority " << mJointMotionList->mBasePriority + LL_WARNS() << "bad animation base_priority " << joint_motion_list->mBasePriority << " for animation " << asset_id << LL_ENDL; return FALSE; } @@ -1289,15 +1289,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo //------------------------------------------------------------------------- // get duration //------------------------------------------------------------------------- - if (!dp.unpackF32(mJointMotionList->mDuration, "duration")) + if (!dp.unpackF32(joint_motion_list->mDuration, "duration")) { LL_WARNS() << "can't read duration" << " for animation " << asset_id << LL_ENDL; return FALSE; } - if (mJointMotionList->mDuration > MAX_ANIM_DURATION || - !llfinite(mJointMotionList->mDuration)) + if (joint_motion_list->mDuration > MAX_ANIM_DURATION || + !llfinite(joint_motion_list->mDuration)) { LL_WARNS() << "invalid animation duration" << " for animation " << asset_id << LL_ENDL; @@ -1307,14 +1307,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo //------------------------------------------------------------------------- // get emote (optional) //------------------------------------------------------------------------- - if (!dp.unpackString(mJointMotionList->mEmoteName, "emote_name")) + if (!dp.unpackString(joint_motion_list->mEmoteName, "emote_name")) { LL_WARNS() << "can't read optional_emote_animation" << " for animation " << asset_id << LL_ENDL; return FALSE; } - if(mJointMotionList->mEmoteName==mID.asString()) + if(joint_motion_list->mEmoteName==mID.asString()) { LL_WARNS() << "Malformed animation mEmoteName==mID" << " for animation " << asset_id << LL_ENDL; @@ -1324,23 +1324,23 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo //------------------------------------------------------------------------- // get loop //------------------------------------------------------------------------- - if (!dp.unpackF32(mJointMotionList->mLoopInPoint, "loop_in_point") || - !llfinite(mJointMotionList->mLoopInPoint)) + if (!dp.unpackF32(joint_motion_list->mLoopInPoint, "loop_in_point") || + !llfinite(joint_motion_list->mLoopInPoint)) { LL_WARNS() << "can't read loop point" << " for animation " << asset_id << LL_ENDL; return FALSE; } - if (!dp.unpackF32(mJointMotionList->mLoopOutPoint, "loop_out_point") || - !llfinite(mJointMotionList->mLoopOutPoint)) + if (!dp.unpackF32(joint_motion_list->mLoopOutPoint, "loop_out_point") || + !llfinite(joint_motion_list->mLoopOutPoint)) { LL_WARNS() << "can't read loop point" << " for animation " << asset_id << LL_ENDL; return FALSE; } - if (!dp.unpackS32(mJointMotionList->mLoop, "loop")) + if (!dp.unpackS32(joint_motion_list->mLoop, "loop")) { LL_WARNS() << "can't read loop" << " for animation " << asset_id << LL_ENDL; @@ -1353,22 +1353,22 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (female_land_anim == asset_id || formal_female_land_anim == asset_id) { LL_WARNS() << "Animation(" << asset_id << ") won't be looped." << LL_ENDL; - mJointMotionList->mLoop = FALSE; + joint_motion_list->mLoop = FALSE; } //------------------------------------------------------------------------- // get easeIn and easeOut //------------------------------------------------------------------------- - if (!dp.unpackF32(mJointMotionList->mEaseInDuration, "ease_in_duration") || - !llfinite(mJointMotionList->mEaseInDuration)) + if (!dp.unpackF32(joint_motion_list->mEaseInDuration, "ease_in_duration") || + !llfinite(joint_motion_list->mEaseInDuration)) { LL_WARNS() << "can't read easeIn" << " for animation " << asset_id << LL_ENDL; return FALSE; } - if (!dp.unpackF32(mJointMotionList->mEaseOutDuration, "ease_out_duration") || - !llfinite(mJointMotionList->mEaseOutDuration)) + if (!dp.unpackF32(joint_motion_list->mEaseOutDuration, "ease_out_duration") || + !llfinite(joint_motion_list->mEaseOutDuration)) { LL_WARNS() << "can't read easeOut" << " for animation " << asset_id << LL_ENDL; @@ -1393,7 +1393,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo return FALSE; } - mJointMotionList->mHandPose = (LLHandMotion::eHandPose)word; + joint_motion_list->mHandPose = (LLHandMotion::eHandPose)word; //------------------------------------------------------------------------- // get number of joint motions @@ -1419,8 +1419,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo return FALSE; } - mJointMotionList->mJointMotionArray.clear(); - mJointMotionList->mJointMotionArray.reserve(num_motions); + joint_motion_list->mJointMotionArray.clear(); + joint_motion_list->mJointMotionArray.reserve(num_motions); mJointStates.clear(); mJointStates.reserve(num_motions); @@ -1431,7 +1431,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo for(U32 i=0; i<num_motions; ++i) { JointMotion* joint_motion = new JointMotion; - mJointMotionList->mJointMotionArray.push_back(joint_motion); + joint_motion_list->mJointMotionArray.push_back(joint_motion); std::string joint_name; if (!dp.unpackString(joint_name, "joint_name")) @@ -1503,9 +1503,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo joint_motion->mPriority = (LLJoint::JointPriority)joint_priority; if (joint_priority != LLJoint::USE_MOTION_PRIORITY && - joint_priority > mJointMotionList->mMaxPriority) + joint_priority > joint_motion_list->mMaxPriority) { - mJointMotionList->mMaxPriority = (LLJoint::JointPriority)joint_priority; + joint_motion_list->mMaxPriority = (LLJoint::JointPriority)joint_priority; } joint_state->setPriority((LLJoint::JointPriority)joint_priority); @@ -1556,9 +1556,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo return FALSE; } - time = U16_to_F32(time_short, 0.f, mJointMotionList->mDuration); + time = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration); - if (time < 0 || time > mJointMotionList->mDuration) + if (time < 0 || time > joint_motion_list->mDuration) { LL_WARNS() << "invalid frame time" << " for animation " << asset_id << LL_ENDL; @@ -1571,38 +1571,57 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo LLVector3 rot_angles; U16 x, y, z; - BOOL success = TRUE; - if (old_version) { - success = dp.unpackVector3(rot_angles, "rot_angles") && rot_angles.isFinite(); + if (!dp.unpackVector3(rot_angles, "rot_angles")) + { + LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" << LL_ENDL; + return FALSE; + } + if (!rot_angles.isFinite()) + { + LL_WARNS() << "non-finite angle in rotation key (" << k << ")" << LL_ENDL; + return FALSE; + } LLQuaternion::Order ro = StringToOrder("ZYX"); rot_key.mRotation = mayaQ(rot_angles.mV[VX], rot_angles.mV[VY], rot_angles.mV[VZ], ro); } else { - success &= dp.unpackU16(x, "rot_angle_x"); - success &= dp.unpackU16(y, "rot_angle_y"); - success &= dp.unpackU16(z, "rot_angle_z"); + if (!dp.unpackU16(x, "rot_angle_x")) + { + LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" << LL_ENDL; + return FALSE; + } + if (!dp.unpackU16(y, "rot_angle_y")) + { + LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" << LL_ENDL; + return FALSE; + } + if (!dp.unpackU16(z, "rot_angle_z")) + { + LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" << LL_ENDL; + return FALSE; + } LLVector3 rot_vec; rot_vec.mV[VX] = U16_to_F32(x, -1.f, 1.f); rot_vec.mV[VY] = U16_to_F32(y, -1.f, 1.f); rot_vec.mV[VZ] = U16_to_F32(z, -1.f, 1.f); + + if(!rot_vec.isFinite()) + { + LL_WARNS() << "non-finite angle in rotation key (" << k << ")" + << " for animation " << asset_id << LL_ENDL; + return FALSE; + } rot_key.mRotation.unpackFromVector3(rot_vec); } - if( !(rot_key.mRotation.isFinite()) ) - { - LL_WARNS() << "non-finite angle in rotation key" - << " for animation " << asset_id << LL_ENDL; - success = FALSE; - } - - if (!success) + if(!rot_key.mRotation.isFinite()) { - LL_WARNS() << "can't read rotation key (" << k << ")" + LL_WARNS() << "non-finite angle in rotation key (" << k << ")" << " for animation " << asset_id << LL_ENDL; return FALSE; } @@ -1655,14 +1674,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo return FALSE; } - pos_key.mTime = U16_to_F32(time_short, 0.f, mJointMotionList->mDuration); + pos_key.mTime = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration); } - BOOL success = TRUE; - if (old_version) { - success = dp.unpackVector3(pos_key.mPosition, "pos"); + if (!dp.unpackVector3(pos_key.mPosition, "pos")) + { + LL_WARNS() << "can't read pos in position key (" << k << ")" << LL_ENDL; + return FALSE; + } //MAINT-6162 pos_key.mPosition.mV[VX] = llclamp( pos_key.mPosition.mV[VX], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); @@ -1674,26 +1695,31 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { U16 x, y, z; - success &= dp.unpackU16(x, "pos_x"); - success &= dp.unpackU16(y, "pos_y"); - success &= dp.unpackU16(z, "pos_z"); + if (!dp.unpackU16(x, "pos_x")) + { + LL_WARNS() << "can't read pos_x in position key (" << k << ")" << LL_ENDL; + return FALSE; + } + if (!dp.unpackU16(y, "pos_y")) + { + LL_WARNS() << "can't read pos_y in position key (" << k << ")" << LL_ENDL; + return FALSE; + } + if (!dp.unpackU16(z, "pos_z")) + { + LL_WARNS() << "can't read pos_z in position key (" << k << ")" << LL_ENDL; + return FALSE; + } pos_key.mPosition.mV[VX] = U16_to_F32(x, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); pos_key.mPosition.mV[VY] = U16_to_F32(y, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); pos_key.mPosition.mV[VZ] = U16_to_F32(z, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); } - if( !(pos_key.mPosition.isFinite()) ) + if(!pos_key.mPosition.isFinite()) { LL_WARNS() << "non-finite position in key" << " for animation " << asset_id << LL_ENDL; - success = FALSE; - } - - if (!success) - { - LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; return FALSE; } @@ -1701,7 +1727,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (is_pelvis) { - mJointMotionList->mPelvisBBox.addPoint(pos_key.mPosition); + joint_motion_list->mPelvisBBox.addPoint(pos_key.mPosition); } } @@ -1733,23 +1759,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo for(S32 i = 0; i < num_constraints; ++i) { // read in constraint data - JointConstraintSharedData* constraintp = new JointConstraintSharedData; + std::unique_ptr<JointConstraintSharedData> constraintp(new JointConstraintSharedData); U8 byte = 0; if (!dp.unpackU8(byte, "chain_length")) { LL_WARNS() << "can't read constraint chain length" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } constraintp->mChainLength = (S32) byte; - if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions()) + if((U32)constraintp->mChainLength > joint_motion_list->getNumJointMotions()) { LL_WARNS() << "invalid constraint chain length" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1757,7 +1781,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint type" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1765,7 +1788,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "invalid constraint type" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } constraintp->mConstraintType = (EConstraintType)byte; @@ -1776,7 +1798,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read source volume name" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1787,7 +1808,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "not a valid source constraint volume " << str << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1795,7 +1815,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint source offset" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1803,7 +1822,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "non-finite constraint source offset" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1811,7 +1829,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read target volume name" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1830,7 +1847,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "not a valid target constraint volume " << str << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } } @@ -1839,7 +1855,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint target offset" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1847,7 +1862,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "non-finite constraint target offset" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1855,7 +1869,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint target direction" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1863,7 +1876,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "non-finite constraint target direction" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1877,7 +1889,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint ease in start time" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1885,7 +1896,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint ease in stop time" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1893,7 +1903,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint ease out start time" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } @@ -1901,33 +1910,31 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "can't read constraint ease out stop time" << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } - mJointMotionList->mConstraints.push_front(constraintp); - - constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte - LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume); // get joint to which this collision volume is attached if (!joint) { return FALSE; } + + constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte + for (S32 i = 0; i < constraintp->mChainLength + 1; i++) { LLJoint* parent = joint->getParent(); if (!parent) { LL_WARNS() << "Joint with no parent: " << joint->getName() - << " Emote: " << mJointMotionList->mEmoteName + << " Emote: " << joint_motion_list->mEmoteName << " for animation " << asset_id << LL_ENDL; return FALSE; } joint = parent; constraintp->mJointStateIndices[i] = -1; - for (U32 j = 0; j < mJointMotionList->getNumJointMotions(); j++) + for (U32 j = 0; j < joint_motion_list->getNumJointMotions(); j++) { LLJoint* constraint_joint = getJoint(j); @@ -1948,14 +1955,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "No joint index for constraint " << i << " for animation " << asset_id << LL_ENDL; - delete constraintp; return FALSE; } } + + joint_motion_list->mConstraints.push_front(constraintp.release()); } } // *FIX: support cleanup of old keyframe data + mJointMotionList = joint_motion_list.release(); // release from unique_ptr to member; LLKeyframeDataCache::addKeyframeData(getID(), mJointMotionList); mAssetStatus = ASSET_LOADED; diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 14bfb98629..70d8dfc8b9 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -288,25 +288,15 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl return name; } +namespace +{ + #if LL_WINDOWS static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific -U32 cpp_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop, const std::string& name) +U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop) { - // C++ exceptions were logged in toplevelTryWrapper, but not SEH - // log SEH exceptions here, to make sure it gets into bugsplat's - // report and because __try won't allow std::string operations - if (code != STATUS_MSC_EXCEPTION) - { - LL_WARNS() << "SEH crash in " << name << ", code: " << code << LL_ENDL; - } - // Handle bugsplat here, since GetExceptionInformation() can only be - // called from within filter for __except(filter), not from __except's {} - // Bugsplat should get all exceptions, C++ and SEH - LLApp::instance()->reportCrashToBugsplat(exception_infop); - - // Only convert non C++ exceptions. if (code == STATUS_MSC_EXCEPTION) { // C++ exception, go on @@ -319,28 +309,38 @@ U32 cpp_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop, } } -void LLCoros::sehHandle(const std::string& name, const LLCoros::callable_t& callable) +void sehandle(const LLCoros::callable_t& callable) { __try { - LLCoros::toplevelTryWrapper(name, callable); + callable(); } - __except (cpp_exception_filter(GetExceptionCode(), GetExceptionInformation(), name)) + __except (exception_filter(GetExceptionCode(), GetExceptionInformation())) { - // convert to C++ styled exception for handlers other than bugsplat + // convert to C++ styled exception // Note: it might be better to use _se_set_translator // if you want exception to inherit full callstack - // - // in case of bugsplat this will get to exceptionTerminateHandler and - // looks like fiber will terminate application after that char integer_string[512]; - sprintf(integer_string, "SEH crash in %s, code: %lu\n", name.c_str(), GetExceptionCode()); + sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode()); throw std::exception(integer_string); } } -#endif -void LLCoros::toplevelTryWrapper(const std::string& name, const callable_t& callable) +#else // ! LL_WINDOWS + +inline void sehandle(const LLCoros::callable_t& callable) +{ + callable(); +} + +#endif // ! LL_WINDOWS + +} // anonymous namespace + +// Top-level wrapper around caller's coroutine callable. +// Normally we like to pass strings and such by const reference -- but in this +// case, we WANT to copy both the name and the callable to our local stack! +void LLCoros::toplevel(std::string name, callable_t callable) { // keep the CoroData on this top-level function's stack frame CoroData corodata(name); @@ -350,12 +350,12 @@ void LLCoros::toplevelTryWrapper(const std::string& name, const callable_t& call // run the code the caller actually wants in the coroutine try { - callable(); + sehandle(callable); } catch (const Stop& exc) { LL_INFOS("LLCoros") << "coroutine " << name << " terminating because " - << exc.what() << LL_ENDL; + << exc.what() << LL_ENDL; } catch (const LLContinueError&) { @@ -366,36 +366,14 @@ void LLCoros::toplevelTryWrapper(const std::string& name, const callable_t& call } catch (...) { -#if LL_WINDOWS - // Any OTHER kind of uncaught exception will cause the viewer to - // crash, SEH handling should catch it and report to bugsplat. - LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << name)); - // to not modify callstack - throw; -#else // Stash any OTHER kind of uncaught exception in the rethrow() queue // to be rethrown by the main fiber. LL_WARNS("LLCoros") << "Capturing uncaught exception in coroutine " << name << LL_ENDL; LLCoros::instance().saveException(name, std::current_exception()); -#endif } } -// Top-level wrapper around caller's coroutine callable. -// Normally we like to pass strings and such by const reference -- but in this -// case, we WANT to copy both the name and the callable to our local stack! -void LLCoros::toplevel(std::string name, callable_t callable) -{ -#if LL_WINDOWS - // Because SEH can's have unwinding, need to call a wrapper - // 'try' is inside SEH handling to not catch LLContinue - sehHandle(name, callable); -#else - toplevelTryWrapper(name, callable); -#endif -} - //static void LLCoros::checkStop() { diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index dbff921f16..966ce03296 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -307,11 +307,7 @@ public: private: std::string generateDistinctName(const std::string& prefix) const; - void toplevelTryWrapper(const std::string& name, const callable_t& callable); -#if LL_WINDOWS - void sehHandle(const std::string& name, const callable_t& callable); // calls toplevelTryWrapper -#endif - void toplevel(std::string name, callable_t callable); // calls sehHandle or toplevelTryWrapper + void toplevel(std::string name, callable_t callable); struct CoroData; static CoroData& get_CoroData(const std::string& caller); void saveException(const std::string& name, std::exception_ptr exc); diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 919d2dabc4..56fb7c21ca 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -943,7 +943,7 @@ namespace LLError for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a) { const LLSD& entry = *a; - if (entry.isMap() && !entry.emptyMap()) + if (entry.isMap() && entry.size() != 0) { ELevel level = decodeLevel(entry["level"]); diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 8b4a0ee6d8..a510b73096 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -34,6 +34,9 @@ #include <iostream> #include "apr_base64.h" +#include <boost/iostreams/device/array.hpp> +#include <boost/iostreams/stream.hpp> + #ifdef LL_USESYSTEMLIBS # include <zlib.h> #else @@ -2128,7 +2131,9 @@ std::string zip_llsd(LLSD& data) { //copy result into output if (strm.avail_out >= CHUNK) { - free(output); + deflateEnd(&strm); + if(output) + free(output); LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL; return std::string(); } @@ -2151,7 +2156,9 @@ std::string zip_llsd(LLSD& data) } else { - free(output); + deflateEnd(&strm); + if(output) + free(output); LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL; return std::string(); } @@ -2162,7 +2169,8 @@ std::string zip_llsd(LLSD& data) std::string result((char*) output, size); deflateEnd(&strm); - free(output); + if(output) + free(output); return result; } @@ -2172,53 +2180,66 @@ std::string zip_llsd(LLSD& data) // and deserializes from that copy using LLSDSerialize LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size) { + std::unique_ptr<U8[]> in = std::unique_ptr<U8[]>(new(std::nothrow) U8[size]); + if (!in) + { + return ZR_MEM_ERROR; + } + is.read((char*) in.get(), size); + + return unzip_llsd(data, in.get(), size); +} + +LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32 size) +{ U8* result = NULL; U32 cur_size = 0; z_stream strm; - const U32 CHUNK = 65536; + constexpr U32 CHUNK = 1024 * 512; - U8 *in = new(std::nothrow) U8[size]; - if (!in) + static thread_local std::unique_ptr<U8[]> out; + if (!out) { - return ZR_MEM_ERROR; + out = std::unique_ptr<U8[]>(new(std::nothrow) U8[CHUNK]); } - is.read((char*) in, size); - - U8 out[CHUNK]; strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; strm.avail_in = size; - strm.next_in = in; + strm.next_in = const_cast<U8*>(in); S32 ret = inflateInit(&strm); do { strm.avail_out = CHUNK; - strm.next_out = out; + strm.next_out = out.get(); ret = inflate(&strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR) + switch (ret) + { + case Z_NEED_DICT: + case Z_DATA_ERROR: { inflateEnd(&strm); free(result); - delete [] in; return ZR_DATA_ERROR; } - - switch (ret) + case Z_STREAM_ERROR: + case Z_BUF_ERROR: { - case Z_NEED_DICT: - ret = Z_DATA_ERROR; - case Z_DATA_ERROR: + inflateEnd(&strm); + free(result); + return ZR_BUFFER_ERROR; + } + case Z_MEM_ERROR: + { inflateEnd(&strm); free(result); - delete [] in; return ZR_MEM_ERROR; - break; + } } U32 have = CHUNK-strm.avail_out; @@ -2231,17 +2252,15 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, { free(result); } - delete[] in; return ZR_MEM_ERROR; } result = new_result; - memcpy(result+cur_size, out, have); + memcpy(result+cur_size, out.get(), have); cur_size += have; - } while (ret == Z_OK); + } while (ret == Z_OK && ret != Z_STREAM_END); inflateEnd(&strm); - delete [] in; if (ret != Z_STREAM_END) { @@ -2251,37 +2270,11 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, //result now points to the decompressed LLSD block { - std::istringstream istr; - // Since we are using this for meshes, data we are dealing with tend to be large. - // So string can potentially fail to allocate, make sure this won't cause problems - try - { - std::string res_str((char*)result, cur_size); - - std::string deprecated_header("<? LLSD/Binary ?>"); - - if (res_str.substr(0, deprecated_header.size()) == deprecated_header) - { - res_str = res_str.substr(deprecated_header.size() + 1, cur_size); - } - cur_size = res_str.size(); - - istr.str(res_str); - } -#ifdef LL_WINDOWS - catch (std::length_error) - { - free(result); - return ZR_SIZE_ERROR; - } -#endif - catch (std::bad_alloc&) - { - free(result); - return ZR_MEM_ERROR; - } + char* result_ptr = strip_deprecated_header((char*)result, cur_size); - if (!LLSDSerialize::fromBinary(data, istr, cur_size, UNZIP_LLSD_MAX_DEPTH)) + boost::iostreams::stream<boost::iostreams::array_source> istrm(result_ptr, cur_size); + + if (!LLSDSerialize::fromBinary(data, istrm, cur_size, UNZIP_LLSD_MAX_DEPTH)) { free(result); return ZR_PARSE_ERROR; @@ -2395,4 +2388,22 @@ U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 return result; } +char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size) +{ + const char* deprecated_header = "<? LLSD/Binary ?>"; + constexpr size_t deprecated_header_size = 17; + + if (cur_size > deprecated_header_size + && memcmp(in, deprecated_header, deprecated_header_size) == 0) + { + in = in + deprecated_header_size; + cur_size = cur_size - deprecated_header_size; + if (header_size) + { + *header_size = deprecated_header_size + 1; + } + } + + return in; +} diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index d6079fd9fa..d33d2b6f34 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -858,9 +858,12 @@ public: ZR_SIZE_ERROR, ZR_DATA_ERROR, ZR_PARSE_ERROR, + ZR_BUFFER_ERROR, + ZR_VERSION_ERROR } EZipRresult; // return OK or reason for failure static EZipRresult unzip_llsd(LLSD& data, std::istream& is, S32 size); + static EZipRresult unzip_llsd(LLSD& data, const U8* in, S32 size); }; //dirty little zip functions -- yell at davep @@ -868,4 +871,7 @@ LL_COMMON_API std::string zip_llsd(LLSD& data); LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size); + +// returns a pointer to the array or past the array if the deprecated header exists +LL_COMMON_API char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size = nullptr); #endif // LL_LLSDSERIALIZE_H diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 8ff6c45760..fc04dca08d 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -44,6 +44,7 @@ #include "lltimer.h" #include "llthread.h" #include "llmutex.h" +#include "llmd5.h" #include "hbxxh.h" const LLUUID LLUUID::null; @@ -400,11 +401,16 @@ LLUUID LLUUID::operator^(const LLUUID& rhs) const return id; } +// WARNING: this algorithm SHALL NOT be changed. It is also used by the server +// and plays a role in some assets validation (e.g. clothing items). Changing +// it would cause invalid assets. void LLUUID::combine(const LLUUID& other, LLUUID& result) const { - HBXXH128 hash((const void*)mData, 16, false); // false = do not finalize - hash.update((const void*)other.mData, 16); - hash.digest(result); + LLMD5 md5_uuid; + md5_uuid.update((unsigned char*)mData, 16); + md5_uuid.update((unsigned char*)other.mData, 16); + md5_uuid.finalize(); + md5_uuid.raw_digest(result.mData); } LLUUID LLUUID::combine(const LLUUID &other) const @@ -997,36 +1003,6 @@ LLUUID::LLUUID() return !(word[0] | word[1] | word[2] | word[3]); } -// Copy constructor - LLUUID::LLUUID(const LLUUID& rhs) -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; -} - - LLUUID::~LLUUID() -{ -} - -// Assignment - LLUUID& LLUUID::operator=(const LLUUID& rhs) -{ - // No need to check the case where this==&rhs. The branch is slower than the write. - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; - - return *this; -} - - LLUUID::LLUUID(const char *in_string) { if (!in_string || in_string[0] == 0) diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 86a396ab06..c139c4eb4e 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -55,10 +55,7 @@ public: LLUUID(); explicit LLUUID(const char *in_string); // Convert from string. explicit LLUUID(const std::string& in_string); // Convert from string. - LLUUID(const LLUUID &in); - LLUUID &operator=(const LLUUID &rhs); - - ~LLUUID(); + ~LLUUID() = default; // // MANIPULATORS @@ -131,6 +128,9 @@ public: U8 mData[UUID_BYTES]; }; +static_assert(std::is_trivially_copyable<LLUUID>::value, "LLUUID must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLUUID>::value, "LLUUID must be trivial move"); +static_assert(std::is_standard_layout<LLUUID>::value, "LLUUID must be a standard layout type"); typedef std::vector<LLUUID> uuid_vec_t; typedef std::set<LLUUID> uuid_set_t; diff --git a/indra/llcommon/threadsafeschedule.h b/indra/llcommon/threadsafeschedule.h index 3e0da94c02..0c3a541196 100644 --- a/indra/llcommon/threadsafeschedule.h +++ b/indra/llcommon/threadsafeschedule.h @@ -248,7 +248,7 @@ namespace LL TimePoint until = TimePoint::clock::now() + std::chrono::hours(24); pop_result popped = tryPopUntil_(lock, until, tt); if (popped == POPPED) - return std::move(tt); + return tt; // DONE: throw, just as super::pop() does if (popped == DONE) diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp index 3bc4ee844e..9ad8e274b6 100644 --- a/indra/llfilesystem/lldir_mac.cpp +++ b/indra/llfilesystem/lldir_mac.cpp @@ -66,16 +66,16 @@ LLDir_Mac::LLDir_Mac() const std::string secondLifeString = "SecondLife"; - std::string *executablepathstr = getSystemExecutableFolder(); + std::string executablepathstr = getSystemExecutableFolder(); //NOTE: LLINFOS/LLERRS will not output to log here. The streams are not initialized. - if (executablepathstr) + if (!executablepathstr.empty()) { // mExecutablePathAndName - mExecutablePathAndName = *executablepathstr; + mExecutablePathAndName = executablepathstr; - boost::filesystem::path executablepath(*executablepathstr); + boost::filesystem::path executablepath(executablepathstr); # ifndef BOOST_SYSTEM_NO_DEPRECATED #endif @@ -83,8 +83,8 @@ LLDir_Mac::LLDir_Mac() mExecutableDir = executablepath.parent_path().string(); // mAppRODataDir - std::string *resourcepath = getSystemResourceFolder(); - mAppRODataDir = *resourcepath; + std::string resourcepath = getSystemResourceFolder(); + mAppRODataDir = resourcepath; // *NOTE: When running in a dev tree, use the copy of // skins in indra/newview/ rather than in the application bundle. This @@ -110,11 +110,11 @@ LLDir_Mac::LLDir_Mac() } // mOSUserDir - std::string *appdir = getSystemApplicationSupportFolder(); + std::string appdir = getSystemApplicationSupportFolder(); std::string rootdir; //Create root directory - if (CreateDirectory(*appdir, secondLifeString, &rootdir)) + if (CreateDirectory(appdir, secondLifeString, &rootdir)) { // Save the full path to the folder @@ -128,12 +128,10 @@ LLDir_Mac::LLDir_Mac() } //mOSCacheDir - std::string *cachedir = getSystemCacheFolder(); - - if (cachedir) - + std::string cachedir = getSystemCacheFolder(); + if (!cachedir.empty()) { - mOSCacheDir = *cachedir; + mOSCacheDir = cachedir; //TODO: This changes from ~/Library/Cache/Secondlife to ~/Library/Cache/com.app.secondlife/Secondlife. Last dir level could go away. CreateDirectory(mOSCacheDir, secondLifeString, NULL); } @@ -143,12 +141,10 @@ LLDir_Mac::LLDir_Mac() // mTempDir //Aura 120920 boost::filesystem::temp_directory_path() not yet implemented on mac. :( - std::string *tmpdir = getSystemTempFolder(); - if (tmpdir) + std::string tmpdir = getSystemTempFolder(); + if (!tmpdir.empty()) { - - CreateDirectory(*tmpdir, secondLifeString, &mTempDir); - if (tmpdir) delete tmpdir; + CreateDirectory(tmpdir, secondLifeString, &mTempDir); } mWorkingDir = getCurPath(); diff --git a/indra/llfilesystem/lldir_utils_objc.h b/indra/llfilesystem/lldir_utils_objc.h index 12019c4284..59dbeb4aec 100644 --- a/indra/llfilesystem/lldir_utils_objc.h +++ b/indra/llfilesystem/lldir_utils_objc.h @@ -33,11 +33,11 @@ #include <iostream> -std::string* getSystemTempFolder(); -std::string* getSystemCacheFolder(); -std::string* getSystemApplicationSupportFolder(); -std::string* getSystemResourceFolder(); -std::string* getSystemExecutableFolder(); +std::string getSystemTempFolder(); +std::string getSystemCacheFolder(); +std::string getSystemApplicationSupportFolder(); +std::string getSystemResourceFolder(); +std::string getSystemExecutableFolder(); #endif // LL_LLDIR_UTILS_OBJC_H diff --git a/indra/llfilesystem/lldir_utils_objc.mm b/indra/llfilesystem/lldir_utils_objc.mm index da55a2f897..20540fb93c 100644 --- a/indra/llfilesystem/lldir_utils_objc.mm +++ b/indra/llfilesystem/lldir_utils_objc.mm @@ -30,75 +30,75 @@ #include "lldir_utils_objc.h" #import <Cocoa/Cocoa.h> -std::string* getSystemTempFolder() +std::string getSystemTempFolder() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSString * tempDir = NSTemporaryDirectory(); - if (tempDir == nil) - tempDir = @"/tmp"; - std::string *result = ( new std::string([tempDir UTF8String]) ); - [pool release]; + std::string result; + @autoreleasepool { + NSString * tempDir = NSTemporaryDirectory(); + if (tempDir == nil) + tempDir = @"/tmp"; + result = std::string([tempDir UTF8String]); + } return result; } //findSystemDirectory scoped exclusively to this file. -std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory, +std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory, NSSearchPathDomainMask domainMask) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - std::string *result = nil; - NSString *path = nil; - - // Search for the path - NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory, - domainMask, - YES); - if ([paths count]) - { - path = [paths objectAtIndex:0]; - //HACK: Always attempt to create directory, ignore errors. - NSError *error = nil; - - [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]; - + std::string result; + @autoreleasepool { + NSString *path = nil; - result = new std::string([path UTF8String]); + // Search for the path + NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory, + domainMask, + YES); + if ([paths count]) + { + path = [paths objectAtIndex:0]; + //HACK: Always attempt to create directory, ignore errors. + NSError *error = nil; + + [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]; + + + result = std::string([path UTF8String]); + } } - [pool release]; return result; } -std::string* getSystemExecutableFolder() +std::string getSystemExecutableFolder() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSString *bundlePath = [[NSBundle mainBundle] executablePath]; - std::string *result = (new std::string([bundlePath UTF8String])); - [pool release]; + std::string result; + @autoreleasepool { + NSString *bundlePath = [[NSBundle mainBundle] executablePath]; + result = std::string([bundlePath UTF8String]); + } return result; } -std::string* getSystemResourceFolder() +std::string getSystemResourceFolder() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; - std::string *result = (new std::string([bundlePath UTF8String])); - [pool release]; + std::string result; + @autoreleasepool { + NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; + result = std::string([bundlePath UTF8String]); + } return result; } -std::string* getSystemCacheFolder() +std::string getSystemCacheFolder() { return findSystemDirectory (NSCachesDirectory, NSUserDomainMask); } -std::string* getSystemApplicationSupportFolder() +std::string getSystemApplicationSupportFolder() { return findSystemDirectory (NSApplicationSupportDirectory, NSUserDomainMask); diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index f7dc6272cf..cad7c00042 100644 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -257,12 +257,7 @@ void LLPngWrapper::normalizeImage() png_set_strip_16(mReadPngPtr); } -#if LL_DARWIN - const F64 SCREEN_GAMMA = 1.8; -#else const F64 SCREEN_GAMMA = 2.2; -#endif - if (png_get_gAMA(mReadPngPtr, mReadInfoPtr, &mGamma)) { png_set_gamma(mReadPngPtr, SCREEN_GAMMA, mGamma); diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 8a641617fa..6c06c6de38 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -29,40 +29,41 @@ // this is defined so that we get static linking. #include "openjpeg.h" +#include "event.h" +#include "cio.h" -#include "lltimer.h" -//#include "llmemory.h" +#define MAX_ENCODED_DISCARD_LEVELS 5 // Factory function: see declaration in llimagej2c.cpp LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl() { - return new LLImageJ2COJ(); + return new LLImageJ2COJ(); } std::string LLImageJ2COJ::getEngineInfo() const { #ifdef OPENJPEG_VERSION - return std::string("OpenJPEG: " OPENJPEG_VERSION ", Runtime: ") - + opj_version(); + return std::string("OpenJPEG: " OPENJPEG_VERSION ", Runtime: ") + + opj_version(); #else - return std::string("OpenJPEG runtime: ") + opj_version(); + return std::string("OpenJPEG runtime: ") + opj_version(); #endif } // Return string from message, eliminating final \n if present static std::string chomp(const char* msg) { - // stomp trailing \n - std::string message = msg; - if (!message.empty()) - { - size_t last = message.size() - 1; - if (message[last] == '\n') - { - message.resize( last ); - } - } - return message; + // stomp trailing \n + std::string message = msg; + if (!message.empty()) + { + size_t last = message.size() - 1; + if (message[last] == '\n') + { + message.resize(last); + } +} + return message; } /** @@ -70,420 +71,771 @@ sample error callback expecting a LLFILE* client object */ void error_callback(const char* msg, void*) { - LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; + LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; } /** sample warning callback expecting a LLFILE* client object */ void warning_callback(const char* msg, void*) { - LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; + LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; } /** sample debug callback expecting no client object */ void info_callback(const char* msg, void*) { - LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; + LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; } // Divide a by 2 to the power of b and round upwards int ceildivpow2(int a, int b) { - return (a + (1 << b) - 1) >> b; + return (a + (1 << b) - 1) >> b; } - -LLImageJ2COJ::LLImageJ2COJ() - : LLImageJ2CImpl() +class JPEG2KBase { -} +public: + JPEG2KBase() {} + U8* buffer = nullptr; + OPJ_SIZE_T size = 0; + OPJ_OFF_T offset = 0; +}; -LLImageJ2COJ::~LLImageJ2COJ() +#define WANT_VERBOSE_OPJ_SPAM LL_DEBUG + +static void opj_info(const char* msg, void* user_data) { + llassert(user_data); +#if WANT_VERBOSE_OPJ_SPAM + LL_INFOS("OpenJPEG") << msg << LL_ENDL; +#endif } -bool LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +static void opj_warn(const char* msg, void* user_data) { - // No specific implementation for this method in the OpenJpeg case - return false; + llassert(user_data); +#if WANT_VERBOSE_OPJ_SPAM + LL_WARNS("OpenJPEG") << msg << LL_ENDL; +#endif } -bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +static void opj_error(const char* msg, void* user_data) { - // No specific implementation for this method in the OpenJpeg case - return false; + llassert(user_data); +#if WANT_VERBOSE_OPJ_SPAM + LL_WARNS("OpenJPEG") << msg << LL_ENDL; +#endif } -bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +static OPJ_SIZE_T opj_read(void * buffer, OPJ_SIZE_T bytes, void* user_data) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - // - // FIXME: Get the comment field out of the texture - // - - LLTimer decode_timer; - - opj_dparameters_t parameters; /* decompression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *image = NULL; - - opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */ - opj_cio_t *cio = NULL; - - - /* configure the event callbacks (not required) */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* set decoding parameters to default values */ - opj_set_default_decoder_parameters(¶meters); - - parameters.cp_reduce = base.getRawDiscardLevel(); - - /* decode the code-stream */ - /* ---------------------- */ - - /* JPEG-2000 codestream */ - - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_J2K); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, base.getData(), base.getDataSize()); - - /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio); - - /* close the byte stream */ - opj_cio_close(cio); - - /* free remaining structures */ - if(dinfo) - { - opj_destroy_decompress(dinfo); - } - - // The image decode failed if the return was NULL or the component - // count was zero. The latter is just a sanity check before we - // dereference the array. - if(!image || !image->numcomps) - { - LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image!" << LL_ENDL; - if (image) - { - opj_image_destroy(image); - } - - return true; // done - } - - // sometimes we get bad data out of the cache - check to see if the decode succeeded - for (S32 i = 0; i < image->numcomps; i++) - { - if (image->comps[i].factor != base.getRawDiscardLevel()) - { - // if we didn't get the discard level we're expecting, fail - opj_image_destroy(image); - base.mDecoding = false; - return true; - } - } - - if(image->numcomps <= first_channel) - { - LL_WARNS() << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << LL_ENDL; - if (image) - { - opj_image_destroy(image); - } - - return true; - } - - // Copy image data into our raw image format (instead of the separate channel format - - S32 img_components = image->numcomps; - S32 channels = img_components - first_channel; - if( channels > max_channel_count ) - channels = max_channel_count; - - // Component buffers are allocated in an image width by height buffer. - // The image placed in that buffer is ceil(width/2^factor) by - // ceil(height/2^factor) and if the factor isn't zero it will be at the - // top left of the buffer with black filled in the rest of the pixels. - // It is integer math so the formula is written in ceildivpo2. - // (Assuming all the components have the same width, height and - // factor.) - S32 comp_width = image->comps[0].w; - S32 f=image->comps[0].factor; - S32 width = ceildivpow2(image->x1 - image->x0, f); - S32 height = ceildivpow2(image->y1 - image->y0, f); - raw_image.resize(width, height, channels); - U8 *rawp = raw_image.getData(); - - // first_channel is what channel to start copying from - // dest is what channel to copy to. first_channel comes from the - // argument, dest always starts writing at channel zero. - for (S32 comp = first_channel, dest=0; comp < first_channel + channels; - comp++, dest++) - { - if (image->comps[comp].data) - { - S32 offset = dest; - for (S32 y = (height - 1); y >= 0; y--) - { - for (S32 x = 0; x < width; x++) - { - rawp[offset] = image->comps[comp].data[y*comp_width + x]; - offset += channels; - } - } - } - else // Some rare OpenJPEG versions have this bug. - { - LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << LL_ENDL; - opj_image_destroy(image); - - return true; // done - } - } - - /* free image data structure */ - opj_image_destroy(image); - - return true; // done + llassert(user_data); + JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); + OPJ_SIZE_T remainder = (jpeg_codec->size - jpeg_codec->offset); + if (remainder <= 0) + { + jpeg_codec->offset = jpeg_codec->size; + // Indicate end of stream (hacky?) + return (OPJ_OFF_T)-1; + } + OPJ_SIZE_T to_read = llclamp(U32(bytes), U32(0), U32(remainder)); + memcpy(buffer, jpeg_codec->buffer + jpeg_codec->offset, to_read); + jpeg_codec->offset += to_read; + return to_read; } - -bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) +static OPJ_SIZE_T opj_write(void * buffer, OPJ_SIZE_T bytes, void* user_data) { - const S32 MAX_COMPS = 5; - opj_cparameters_t parameters; /* compression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - - - /* - configure the event callbacks (not required) - setting of each callback is optional - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* set encoding parameters to default values */ - opj_set_default_encoder_parameters(¶meters); - parameters.cod_format = 0; - parameters.cp_disto_alloc = 1; - - if (reversible) - { - parameters.tcp_numlayers = 1; - parameters.tcp_rates[0] = 0.0f; - } - else - { - parameters.tcp_numlayers = 5; - parameters.tcp_rates[0] = 1920.0f; - parameters.tcp_rates[1] = 480.0f; - parameters.tcp_rates[2] = 120.0f; - parameters.tcp_rates[3] = 30.0f; - parameters.tcp_rates[4] = 10.0f; - parameters.irreversible = 1; - if (raw_image.getComponents() >= 3) - { - parameters.tcp_mct = 1; - } - } - - if (!comment_text) - { - parameters.cp_comment = (char *) ""; - } - else - { - // Awful hacky cast, too lazy to copy right now. - parameters.cp_comment = (char *) comment_text; - } - - // - // Fill in the source image from our raw image - // - OPJ_COLOR_SPACE color_space = CLRSPC_SRGB; - opj_image_cmptparm_t cmptparm[MAX_COMPS]; - opj_image_t * image = NULL; - S32 numcomps = raw_image.getComponents(); - S32 width = raw_image.getWidth(); - S32 height = raw_image.getHeight(); - - memset(&cmptparm[0], 0, MAX_COMPS * sizeof(opj_image_cmptparm_t)); - for(S32 c = 0; c < numcomps; c++) { - cmptparm[c].prec = 8; - cmptparm[c].bpp = 8; - cmptparm[c].sgnd = 0; - cmptparm[c].dx = parameters.subsampling_dx; - cmptparm[c].dy = parameters.subsampling_dy; - cmptparm[c].w = width; - cmptparm[c].h = height; - } - - /* create the image */ - image = opj_image_create(numcomps, &cmptparm[0], color_space); - - image->x1 = width; - image->y1 = height; - - S32 i = 0; - const U8 *src_datap = raw_image.getData(); - for (S32 y = height - 1; y >= 0; y--) - { - for (S32 x = 0; x < width; x++) - { - const U8 *pixel = src_datap + (y*width + x) * numcomps; - for (S32 c = 0; c < numcomps; c++) - { - image->comps[c].data[i] = *pixel; - pixel++; - } - i++; - } - } - - - - /* encode the destination image */ - /* ---------------------------- */ - - int codestream_length; - opj_cio_t *cio = NULL; - - /* get a J2K compressor handle */ - opj_cinfo_t* cinfo = opj_create_compress(CODEC_J2K); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); - - /* setup the encoder parameters using the current image and using user parameters */ - opj_setup_encoder(cinfo, ¶meters, image); - - /* open a byte stream for writing */ - /* allocate memory for all tiles */ - cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0); - - /* encode the image */ - bool bSuccess = opj_encode(cinfo, cio, image, NULL); - if (!bSuccess) - { - opj_cio_close(cio); - LL_DEBUGS("Texture") << "Failed to encode image." << LL_ENDL; - return false; - } - codestream_length = cio_tell(cio); - - base.copyData(cio->buffer, codestream_length); - base.updateData(); // set width, height - - /* close and free the byte stream */ - opj_cio_close(cio); - - /* free remaining compression structures */ - opj_destroy_compress(cinfo); - - - /* free user parameters structure */ - if(parameters.cp_matrice) free(parameters.cp_matrice); - - /* free image data */ - opj_image_destroy(image); - return true; + llassert(user_data); + JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); + OPJ_SIZE_T remainder = jpeg_codec->size - jpeg_codec->offset; + if (remainder < bytes) + { + OPJ_SIZE_T new_size = jpeg_codec->size + (bytes - remainder); + U8* new_buffer = (U8*)ll_aligned_malloc_16(new_size); + memcpy(new_buffer, jpeg_codec->buffer, jpeg_codec->offset); + U8* old_buffer = jpeg_codec->buffer; + jpeg_codec->buffer = new_buffer; + ll_aligned_free_16(old_buffer); + jpeg_codec->size = new_size; + } + memcpy(jpeg_codec->buffer + jpeg_codec->offset, buffer, bytes); + jpeg_codec->offset += bytes; + return bytes; } -bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) +static OPJ_OFF_T opj_skip(OPJ_OFF_T bytes, void* user_data) { - // - // FIXME: We get metadata by decoding the ENTIRE image. - // - - // Update the raw discard level - base.updateRawDiscardLevel(); - - opj_dparameters_t parameters; /* decompression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *image = NULL; - - opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */ - opj_cio_t *cio = NULL; - - - /* configure the event callbacks (not required) */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* set decoding parameters to default values */ - opj_set_default_decoder_parameters(¶meters); - - // Only decode what's required to get the size data. - parameters.cp_limit_decoding=LIMIT_TO_MAIN_HEADER; + JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); + jpeg_codec->offset += bytes; + + if (jpeg_codec->offset > jpeg_codec->size) + { + jpeg_codec->offset = jpeg_codec->size; + // Indicate end of stream + return (OPJ_OFF_T)-1; + } + + if (jpeg_codec->offset < 0) + { + // Shouldn't be possible? + jpeg_codec->offset = 0; + return (OPJ_OFF_T)-1; + } + + return bytes; +} - //parameters.cp_reduce = mRawDiscardLevel; +static OPJ_BOOL opj_seek(OPJ_OFF_T bytes, void * user_data) +{ + JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); + jpeg_codec->offset = bytes; + jpeg_codec->offset = llclamp(U32(jpeg_codec->offset), U32(0), U32(jpeg_codec->size)); + return OPJ_TRUE; +} - /* decode the code-stream */ - /* ---------------------- */ +static void opj_free_user_data(void * user_data) +{ + JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); + // Don't free, data is managed externally + jpeg_codec->buffer = nullptr; + jpeg_codec->size = 0; + jpeg_codec->offset = 0; +} - /* JPEG-2000 codestream */ +static void opj_free_user_data_write(void * user_data) +{ + JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); + // Free, data was allocated here + ll_aligned_free_16(jpeg_codec->buffer); + jpeg_codec->buffer = nullptr; + jpeg_codec->size = 0; + jpeg_codec->offset = 0; +} - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_J2K); +class JPEG2KDecode : public JPEG2KBase +{ +public: + + JPEG2KDecode(S8 discardLevel) + { + memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); + memset(¶meters, 0, sizeof(opj_dparameters_t)); + event_mgr.error_handler = error_callback; + event_mgr.warning_handler = warning_callback; + event_mgr.info_handler = info_callback; + opj_set_default_decoder_parameters(¶meters); + parameters.cp_reduce = discardLevel; + } + + ~JPEG2KDecode() + { + if (decoder) + { + opj_destroy_codec(decoder); + } + decoder = nullptr; + + if (image) + { + opj_image_destroy(image); + } + image = nullptr; + + if (stream) + { + opj_stream_destroy(stream); + } + stream = nullptr; + + if (codestream_info) + { + opj_destroy_cstr_info(&codestream_info); + } + codestream_info = nullptr; + } + + bool readHeader( + U8* data, + U32 dataSize, + S32& widthOut, + S32& heightOut, + S32& components, + S32& discard_level) + { + parameters.flags |= OPJ_DPARAMETERS_DUMP_FLAG; + + decoder = opj_create_decompress(OPJ_CODEC_J2K); + + if (!opj_setup_decoder(decoder, ¶meters)) + { + return false; + } + + if (stream) + { + opj_stream_destroy(stream); + } + + stream = opj_stream_create(dataSize, true); + if (!stream) + { + return false; + } + + opj_stream_set_user_data(stream, this, opj_free_user_data); + opj_stream_set_user_data_length(stream, dataSize); + opj_stream_set_read_function(stream, opj_read); + opj_stream_set_write_function(stream, opj_write); + opj_stream_set_skip_function(stream, opj_skip); + opj_stream_set_seek_function(stream, opj_seek); + + buffer = data; + size = dataSize; + offset = 0; + + // enable decoding partially loaded images + opj_decoder_set_strict_mode(decoder, OPJ_FALSE); + + /* Read the main header of the codestream and if necessary the JP2 boxes*/ + if (!opj_read_header((opj_stream_t*)stream, decoder, &image)) + { + return false; + } + + codestream_info = opj_get_cstr_info(decoder); + + if (!codestream_info) + { + return false; + } + + U32 tileDimX = codestream_info->tdx; + U32 tileDimY = codestream_info->tdy; + U32 tilesW = codestream_info->tw; + U32 tilesH = codestream_info->th; + + widthOut = S32(tilesW * tileDimX); + heightOut = S32(tilesH * tileDimY); + components = codestream_info->nbcomps; + + discard_level = 0; + while (tilesW > 1 && tilesH > 1 && discard_level < MAX_DISCARD_LEVEL) + { + discard_level++; + tilesW >>= 1; + tilesH >>= 1; + } + + return true; + } + + bool decode(U8* data, U32 dataSize, U32* channels, U8 discard_level) + { + parameters.flags &= ~OPJ_DPARAMETERS_DUMP_FLAG; + + decoder = opj_create_decompress(OPJ_CODEC_J2K); + opj_setup_decoder(decoder, ¶meters); + + opj_set_info_handler(decoder, opj_info, this); + opj_set_warning_handler(decoder, opj_warn, this); + opj_set_error_handler(decoder, opj_error, this); + + if (stream) + { + opj_stream_destroy(stream); + } + + stream = opj_stream_create(dataSize, true); + if (!stream) + { + return false; + } + + opj_stream_set_user_data(stream, this, opj_free_user_data); + opj_stream_set_user_data_length(stream, dataSize); + opj_stream_set_read_function(stream, opj_read); + opj_stream_set_write_function(stream, opj_write); + opj_stream_set_skip_function(stream, opj_skip); + opj_stream_set_seek_function(stream, opj_seek); + + buffer = data; + size = dataSize; + offset = 0; + + if (image) + { + opj_image_destroy(image); + image = nullptr; + } + + // needs to happen before opj_read_header and opj_decode... + opj_set_decoded_resolution_factor(decoder, discard_level); + + // enable decoding partially loaded images + opj_decoder_set_strict_mode(decoder, OPJ_FALSE); + + if (!opj_read_header(stream, decoder, &image)) + { + return false; + } + + // needs to happen before decode which may fail + if (channels) + { + *channels = image->numcomps; + } + + OPJ_BOOL decoded = opj_decode(decoder, stream, image); + + // count was zero. The latter is just a sanity check before we + // dereference the array. + if (!decoded || !image || !image->numcomps) + { + opj_end_decompress(decoder, stream); + return false; + } + + opj_end_decompress(decoder, stream); + + return true; + } + + opj_image_t* getImage() { return image; } + +private: + opj_dparameters_t parameters; + opj_event_mgr_t event_mgr; + opj_image_t* image = nullptr; + opj_codec_t* decoder = nullptr; + opj_stream_t* stream = nullptr; + opj_codestream_info_v2_t* codestream_info = nullptr; +}; + +class JPEG2KEncode : public JPEG2KBase +{ +public: + const OPJ_UINT32 TILE_SIZE = 64 * 64 * 3; + + JPEG2KEncode(const char* comment_text_in, bool reversible) + { + memset(¶meters, 0, sizeof(opj_cparameters_t)); + memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); + event_mgr.error_handler = error_callback; + event_mgr.warning_handler = warning_callback; + event_mgr.info_handler = info_callback; + + opj_set_default_encoder_parameters(¶meters); + parameters.cod_format = OPJ_CODEC_J2K; + parameters.cp_disto_alloc = 1; + parameters.max_cs_size = (1 << 15); + + if (reversible) + { + parameters.tcp_numlayers = 1; + parameters.tcp_rates[0] = 1.0f; + } + else + { + parameters.tcp_numlayers = 5; + parameters.tcp_rates[0] = 1920.0f; + parameters.tcp_rates[1] = 960.0f; + parameters.tcp_rates[2] = 480.0f; + parameters.tcp_rates[3] = 120.0f; + parameters.tcp_rates[4] = 30.0f; + parameters.irreversible = 1; + parameters.tcp_mct = 1; + } + + if (comment_text) + { + free(comment_text); + } + comment_text = comment_text_in ? strdup(comment_text_in) : nullptr; + + parameters.cp_comment = comment_text ? comment_text : (char*)"no comment"; + llassert(parameters.cp_comment); + } + + ~JPEG2KEncode() + { + if (encoder) + { + opj_destroy_codec(encoder); + } + encoder = nullptr; + + if (image) + { + opj_image_destroy(image); + } + image = nullptr; + + if (stream) + { + opj_stream_destroy(stream); + } + stream = nullptr; + + if (comment_text) + { + free(comment_text); + } + comment_text = nullptr; + } + + bool encode(const LLImageRaw& rawImageIn, LLImageJ2C &compressedImageOut) + { + setImage(rawImageIn); + + encoder = opj_create_compress(OPJ_CODEC_J2K); + + parameters.tcp_mct = (image->numcomps >= 3) ? 1 : 0; + parameters.cod_format = OPJ_CODEC_J2K; + parameters.prog_order = OPJ_RLCP; + parameters.cp_disto_alloc = 1; + + if (!opj_setup_encoder(encoder, ¶meters, image)) + { + return false; + } + + opj_set_info_handler(encoder, opj_info, this); + opj_set_warning_handler(encoder, opj_warn, this); + opj_set_error_handler(encoder, opj_error, this); + + U32 tile_count = (rawImageIn.getWidth() >> 6) * (rawImageIn.getHeight() >> 6); + U32 data_size_guess = tile_count * TILE_SIZE; + + // will be freed in opj_free_user_data_write + buffer = (U8*)ll_aligned_malloc_16(data_size_guess); + size = data_size_guess; + offset = 0; + + memset(buffer, 0, data_size_guess); + + if (stream) + { + opj_stream_destroy(stream); + } + + stream = opj_stream_create(data_size_guess, false); + if (!stream) + { + return false; + } + + opj_stream_set_user_data(stream, this, opj_free_user_data_write); + opj_stream_set_user_data_length(stream, data_size_guess); + opj_stream_set_read_function(stream, opj_read); + opj_stream_set_write_function(stream, opj_write); + opj_stream_set_skip_function(stream, opj_skip); + opj_stream_set_seek_function(stream, opj_seek); + + OPJ_BOOL started = opj_start_compress(encoder, image, stream); + + if (!started) + { + return false; + } + + if (!opj_encode(encoder, stream)) + { + return false; + } + + OPJ_BOOL encoded = opj_end_compress(encoder, stream); + + // if we successfully encoded, then stream out the compressed data... + if (encoded) + { + // "append" (set) the data we "streamed" (memcopied) for writing to the formatted image + // with side-effect of setting the actually encoded size to same + compressedImageOut.allocateData(offset); + memcpy(compressedImageOut.getData(), buffer, offset); + compressedImageOut.updateData(); // update width, height etc from header + } + return encoded; + } + + void setImage(const LLImageRaw& raw) + { + opj_image_cmptparm_t cmptparm[MAX_ENCODED_DISCARD_LEVELS]; + memset(&cmptparm[0], 0, MAX_ENCODED_DISCARD_LEVELS * sizeof(opj_image_cmptparm_t)); + + S32 numcomps = raw.getComponents(); + S32 width = raw.getWidth(); + S32 height = raw.getHeight(); + + for (S32 c = 0; c < numcomps; c++) + { + cmptparm[c].prec = 8; + cmptparm[c].bpp = 8; + cmptparm[c].sgnd = 0; + cmptparm[c].dx = parameters.subsampling_dx; + cmptparm[c].dy = parameters.subsampling_dy; + cmptparm[c].w = width; + cmptparm[c].h = height; + } + + image = opj_image_create(numcomps, &cmptparm[0], OPJ_CLRSPC_SRGB); + + image->x1 = width; + image->y1 = height; + + const U8 *src_datap = raw.getData(); + + S32 i = 0; + for (S32 y = height - 1; y >= 0; y--) + { + for (S32 x = 0; x < width; x++) + { + const U8 *pixel = src_datap + (y*width + x) * numcomps; + for (S32 c = 0; c < numcomps; c++) + { + image->comps[c].data[i] = *pixel; + pixel++; + } + i++; + } + } + + // This likely works, but there seems to be an issue openjpeg side + // check over after gixing that. + + // De-interleave to component plane data + /* + switch (numcomps) + { + case 0: + default: + break; + + case 1: + { + U32 rBitDepth = image->comps[0].bpp; + U32 bytesPerPixel = rBitDepth >> 3; + memcpy(image->comps[0].data, src, width * height * bytesPerPixel); + } + break; + + case 2: + { + U32 rBitDepth = image->comps[0].bpp; + U32 gBitDepth = image->comps[1].bpp; + U32 totalBitDepth = rBitDepth + gBitDepth; + U32 bytesPerPixel = totalBitDepth >> 3; + U32 stride = width * bytesPerPixel; + U32 offset = 0; + for (S32 y = height - 1; y >= 0; y--) + { + const U8* component = src + (y * stride); + for (S32 x = 0; x < width; x++) + { + image->comps[0].data[offset] = *component++; + image->comps[1].data[offset] = *component++; + offset++; + } + } + } + break; + + case 3: + { + U32 rBitDepth = image->comps[0].bpp; + U32 gBitDepth = image->comps[1].bpp; + U32 bBitDepth = image->comps[2].bpp; + U32 totalBitDepth = rBitDepth + gBitDepth + bBitDepth; + U32 bytesPerPixel = totalBitDepth >> 3; + U32 stride = width * bytesPerPixel; + U32 offset = 0; + for (S32 y = height - 1; y >= 0; y--) + { + const U8* component = src + (y * stride); + for (S32 x = 0; x < width; x++) + { + image->comps[0].data[offset] = *component++; + image->comps[1].data[offset] = *component++; + image->comps[2].data[offset] = *component++; + offset++; + } + } + } + break; + + + case 4: + { + U32 rBitDepth = image->comps[0].bpp; + U32 gBitDepth = image->comps[1].bpp; + U32 bBitDepth = image->comps[2].bpp; + U32 aBitDepth = image->comps[3].bpp; + + U32 totalBitDepth = rBitDepth + gBitDepth + bBitDepth + aBitDepth; + U32 bytesPerPixel = totalBitDepth >> 3; + + U32 stride = width * bytesPerPixel; + U32 offset = 0; + for (S32 y = height - 1; y >= 0; y--) + { + const U8* component = src + (y * stride); + for (S32 x = 0; x < width; x++) + { + image->comps[0].data[offset] = *component++; + image->comps[1].data[offset] = *component++; + image->comps[2].data[offset] = *component++; + image->comps[3].data[offset] = *component++; + offset++; + } + } + } + break; + }*/ + } + + opj_image_t* getImage() { return image; } + +private: + opj_cparameters_t parameters; + opj_event_mgr_t event_mgr; + opj_image_t* image = nullptr; + opj_codec_t* encoder = nullptr; + opj_stream_t* stream = nullptr; + char* comment_text = nullptr; +}; - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); +LLImageJ2COJ::LLImageJ2COJ() + : LLImageJ2CImpl() +{ +} - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, base.getData(), base.getDataSize()); - /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio); +LLImageJ2COJ::~LLImageJ2COJ() +{ +} - /* close the byte stream */ - opj_cio_close(cio); +bool LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +{ + base.mDiscardLevel = discard_level; + return false; +} - /* free remaining structures */ - if(dinfo) - { - opj_destroy_decompress(dinfo); - } +bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + // No specific implementation for this method in the OpenJpeg case + return false; +} - if(!image) - { - LL_WARNS() << "ERROR -> getMetadata: failed to decode image!" << LL_ENDL; - return false; - } +bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +{ + JPEG2KDecode decoder(0); + + U32 image_channels = 0; + S32 data_size = base.getDataSize(); + S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); + bool decoded = decoder.decode(base.getData(), max_bytes, &image_channels, base.mDiscardLevel); + + // set correct channel count early so failed decodes don't miss it... + S32 channels = (S32)image_channels - first_channel; + channels = llmin(channels, max_channel_count); + + if (!decoded) + { + // reset the channel count if necessary + if (raw_image.getComponents() != channels) + { + raw_image.resize(raw_image.getWidth(), raw_image.getHeight(), S8(channels)); + } + + LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image!" << LL_ENDL; + return true; // done + } + + opj_image_t *image = decoder.getImage(); + + // Component buffers are allocated in an image width by height buffer. + // The image placed in that buffer is ceil(width/2^factor) by + // ceil(height/2^factor) and if the factor isn't zero it will be at the + // top left of the buffer with black filled in the rest of the pixels. + // It is integer math so the formula is written in ceildivpo2. + // (Assuming all the components have the same width, height and + // factor.) + U32 comp_width = image->comps[0].w; // leave this unshifted by 'f' discard factor, the strides are always for the full buffer width + U32 f = image->comps[0].factor; + + // do size the texture to the mem we'll acrually use... + U32 width = image->comps[0].w; + U32 height = image->comps[0].h; + + raw_image.resize(U16(width), U16(height), S8(channels)); + + U8 *rawp = raw_image.getData(); + + // first_channel is what channel to start copying from + // dest is what channel to copy to. first_channel comes from the + // argument, dest always starts writing at channel zero. + for (S32 comp = first_channel, dest = 0; comp < first_channel + channels; comp++, dest++) + { + llassert(image->comps[comp].data); + if (image->comps[comp].data) + { + S32 offset = dest; + for (S32 y = (height - 1); y >= 0; y--) + { + for (S32 x = 0; x < width; x++) + { + rawp[offset] = image->comps[comp].data[y*comp_width + x]; + offset += channels; + } + } + } + else // Some rare OpenJPEG versions have this bug. + { + LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed! (OpenJPEG bug)" << LL_ENDL; + } + } + + base.setDiscardLevel(f); + + return true; // done +} - // Copy image data into our raw image format (instead of the separate channel format - S32 width = 0; - S32 height = 0; - S32 img_components = image->numcomps; - width = image->x1 - image->x0; - height = image->y1 - image->y0; - base.setSize(width, height, img_components); +bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) +{ + JPEG2KEncode encode(comment_text, reversible); + bool encoded = encode.encode(raw_image, base); + if (encoded) + { + LL_WARNS() << "Openjpeg encoding implementation isn't complete, returning false" << LL_ENDL; + } + return encoded; + //return false; +} - /* free image data structure */ - opj_image_destroy(image); - return true; +bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) +{ + JPEG2KDecode decode(0); + + S32 width = 0; + S32 height = 0; + S32 components = 0; + S32 discard_level = 0; + + U32 dataSize = base.getDataSize(); + U8* data = base.getData(); + bool header_read = decode.readHeader(data, dataSize, width, height, components, discard_level); + if (!header_read) + { + return false; + } + + base.mDiscardLevel = discard_level; + base.setSize(width, height, components); + return true; } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4004793ffd..c976307936 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1437,12 +1437,13 @@ F32 LLSettingsSky::getReflectionProbeAmbiance() const return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal(); } -F32 LLSettingsSky::getTotalReflectionProbeAmbiance() const +F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const { // feed cloud shadow back into reflection probe ambiance to mimic pre-reflection-probe behavior // without brightening dark/interior spaces F32 probe_ambiance = getReflectionProbeAmbiance(); - probe_ambiance += (1.f - probe_ambiance) * getCloudShadow()*0.5f; + + probe_ambiance += (1.f - probe_ambiance) * getCloudShadow()*cloud_shadow_scale; return probe_ambiance; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index b17b32ebb1..7ae569dd4c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -137,7 +137,7 @@ public: F32 getReflectionProbeAmbiance() const; // get the probe ambiance setting to use for rendering (adjusted by cloud shadow, aka cloud coverage) - F32 getTotalReflectionProbeAmbiance() const; + F32 getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const; // Return first (only) profile layer represented in LLSD LLSD getRayleighConfig() const; diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 33659e6b81..9919af5368 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2394,7 +2394,25 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD with code " << uzip_result << " , will probably fetch from sim again." << LL_ENDL; return false; } - + return unpackVolumeFacesInternal(mdl); +} + +bool LLVolume::unpackVolumeFaces(U8* in_data, S32 size) +{ + //input data is now pointing at a zlib compressed block of LLSD + //decompress block + LLSD mdl; + U32 uzip_result = LLUZipHelper::unzip_llsd(mdl, in_data, size); + if (uzip_result != LLUZipHelper::ZR_OK) + { + LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD with code " << uzip_result << " , will probably fetch from sim again." << LL_ENDL; + return false; + } + return unpackVolumeFacesInternal(mdl); +} + +bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) +{ { U32 face_count = mdl.size(); diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index e8faf549f4..ad6a669531 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -1105,8 +1105,12 @@ protected: BOOL generate(); void createVolumeFaces(); public: - virtual bool unpackVolumeFaces(std::istream& is, S32 size); + bool unpackVolumeFaces(std::istream& is, S32 size); + bool unpackVolumeFaces(U8* in_data, S32 size); +private: + bool unpackVolumeFacesInternal(const LLSD& mdl); +public: virtual void setMeshAssetLoaded(BOOL loaded); virtual BOOL isMeshAssetLoaded(); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index b6adc102d2..9f7768f78e 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -116,9 +116,8 @@ BOOL LLDataPacker::packFixed(const F32 value, const char *name, BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, const BOOL is_signed, const U32 int_bits, const U32 frac_bits) { - //BOOL success = TRUE; + BOOL success = TRUE; //LL_INFOS() << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << LL_ENDL; - BOOL ok = FALSE; S32 unsigned_bits = int_bits + frac_bits; S32 total_bits = unsigned_bits; @@ -134,19 +133,19 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, if (total_bits <= 8) { U8 fixed_8; - ok = unpackU8(fixed_8, name); + success = unpackU8(fixed_8, name); fixed_val = (F32)fixed_8; } else if (total_bits <= 16) { U16 fixed_16; - ok = unpackU16(fixed_16, name); + success = unpackU16(fixed_16, name); fixed_val = (F32)fixed_16; } else if (total_bits <= 31) { U32 fixed_32; - ok = unpackU32(fixed_32, name); + success = unpackU32(fixed_32, name); fixed_val = (F32)fixed_32; } else @@ -164,7 +163,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, } value = fixed_val; //LL_INFOS() << "Value: " << value << LL_ENDL; - return ok; + return success; } BOOL LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name) @@ -238,37 +237,43 @@ BOOL LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) { - BOOL success = TRUE; S32 length = value.length()+1; - success &= verifyLength(length, name); + if (!verifyLength(length, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length); } mCurBufferp += length; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name) { - BOOL success = TRUE; S32 length = (S32)strlen((char *)mCurBufferp) + 1; /*Flawfinder: ignore*/ - success &= verifyLength(length, name); + if (!verifyLength(length, name)) + { + return FALSE; + } value = std::string((char*)mCurBufferp); // We already assume NULL termination calling strlen() mCurBufferp += length; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; - success &= verifyLength(size + 4, name); + if (!verifyLength(size + 4, name)) + { + return FALSE; + } if (mWriteEnabled) { @@ -280,102 +285,117 @@ BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const c htolememcpy(mCurBufferp, value, MVT_VARIABLE, size); } mCurBufferp += size; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) { - BOOL success = TRUE; - success &= verifyLength(4, name); - htolememcpy(&size, mCurBufferp, MVT_S32, 4); - mCurBufferp += 4; - success &= verifyLength(size, name); - if (success) + if (!verifyLength(4, name)) { - htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); - mCurBufferp += size; + LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; + return FALSE; } - else + + htolememcpy(&size, mCurBufferp, MVT_S32, 4); + mCurBufferp += 4; + + if (!verifyLength(size, name)) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; - success = FALSE; + return FALSE; } - return success; + + htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); + mCurBufferp += size; + + return TRUE; } BOOL LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; - success &= verifyLength(size, name); + if (!verifyLength(size, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value, MVT_VARIABLE, size); } mCurBufferp += size; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { - BOOL success = TRUE; - success &= verifyLength(size, name); + if (!verifyLength(size, name)) + { + return FALSE; + } htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); mCurBufferp += size; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(U8), name); + if (!verifyLength(sizeof(U8), name)) + { + return FALSE; + } if (mWriteEnabled) { *mCurBufferp = value; } mCurBufferp++; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackU8(U8 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(U8), name); + if (!verifyLength(sizeof(U8), name)) + { + return FALSE; + } value = *mCurBufferp; mCurBufferp++; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(U16), name); + if (!verifyLength(sizeof(U16), name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, &value, MVT_U16, 2); } mCurBufferp += 2; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(U16), name); + if (!verifyLength(sizeof(U16), name)) + { + return FALSE; + } htolememcpy(&value, mCurBufferp, MVT_U16, 2); mCurBufferp += 2; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) @@ -404,134 +424,156 @@ BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(U32), name); + if (!verifyLength(sizeof(U32), name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, &value, MVT_U32, 4); } mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackU32(U32 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(U32), name); + if (!verifyLength(sizeof(U32), name)) + { + return FALSE; + } htolememcpy(&value, mCurBufferp, MVT_U32, 4); mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(S32), name); + if (!verifyLength(sizeof(S32), name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, &value, MVT_S32, 4); } mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackS32(S32 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(S32), name); + if(!verifyLength(sizeof(S32), name)) + { + return FALSE; + } htolememcpy(&value, mCurBufferp, MVT_S32, 4); mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(F32), name); + if (!verifyLength(sizeof(F32), name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, &value, MVT_F32, 4); } mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackF32(F32 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(sizeof(F32), name); + if (!verifyLength(sizeof(F32), name)) + { + return FALSE; + } htolememcpy(&value, mCurBufferp, MVT_F32, 4); mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(16, name); + if (!verifyLength(16, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16); } mCurBufferp += 16; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackColor4(LLColor4 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(16, name); + if (!verifyLength(16, name)) + { + return FALSE; + } htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16); mCurBufferp += 16; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(4, name); + if (!verifyLength(4, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value.mV, MVT_VARIABLE, 4); } mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackColor4U(LLColor4U &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(4, name); + if (!verifyLength(4, name)) + { + return FALSE; + } htolememcpy(value.mV, mCurBufferp, MVT_VARIABLE, 4); mCurBufferp += 4; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(8, name); + if (!verifyLength(8, name)) + { + return FALSE; + } if (mWriteEnabled) { @@ -539,92 +581,106 @@ BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *n htolememcpy(mCurBufferp+4, &value.mV[1], MVT_F32, 4); } mCurBufferp += 8; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackVector2(LLVector2 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(8, name); + if (!verifyLength(8, name)) + { + return FALSE; + } htolememcpy(&value.mV[0], mCurBufferp, MVT_F32, 4); htolememcpy(&value.mV[1], mCurBufferp+4, MVT_F32, 4); mCurBufferp += 8; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(12, name); + if (!verifyLength(12, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value.mV, MVT_LLVector3, 12); } mCurBufferp += 12; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackVector3(LLVector3 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(12, name); + if (!verifyLength(12, name)) + { + return FALSE; + } htolememcpy(value.mV, mCurBufferp, MVT_LLVector3, 12); mCurBufferp += 12; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(16, name); + if (!verifyLength(16, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16); } mCurBufferp += 16; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackVector4(LLVector4 &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(16, name); + if (!verifyLength(16, name)) + { + return FALSE; + } htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16); mCurBufferp += 16; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(16, name); + if (!verifyLength(16, name)) + { + return FALSE; + } if (mWriteEnabled) { htolememcpy(mCurBufferp, value.mData, MVT_LLUUID, 16); } mCurBufferp += 16; - return success; + return TRUE; } BOOL LLDataPackerBinaryBuffer::unpackUUID(LLUUID &value, const char *name) { - BOOL success = TRUE; - success &= verifyLength(16, name); + if (!verifyLength(16, name)) + { + return FALSE; + } htolememcpy(value.mData, mCurBufferp, MVT_LLUUID, 16); mCurBufferp += 16; - return success; + return TRUE; } const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLDataPackerBinaryBuffer &a) @@ -698,15 +754,13 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n BOOL LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name) { - BOOL success = TRUE; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ - BOOL res = getValueStr(name, valuestr, DP_BUFSIZE); // NULL terminated - if (!res) // + if (!getValueStr(name, valuestr, DP_BUFSIZE)) // NULL terminated { return FALSE; } value = valuestr; - return success; + return TRUE; } diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp index 78424a28c8..d6481d4eea 100644 --- a/indra/llmessage/tests/llcoproceduremanager_test.cpp +++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp @@ -92,7 +92,7 @@ namespace tut Sync sync; int foo = 0; LLCoprocedureManager::instance().initializePool("PoolName"); - LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName", + LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName", [&foo, &sync] (LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t & ptr, const LLUUID & id) { sync.bump(); foo = 1; diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 6041c9c273..fd304f7bc9 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -167,7 +167,7 @@ bool LLGLTFLoader::parseMeshes() bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const tinygltf::Mesh &mesh) { pModel->mLabel = mesh.name; - int pos_idx, norm_idx, tan_idx, uv0_idx, uv1_idx, color0_idx, color1_idx; + int pos_idx; tinygltf::Accessor indices_a, positions_a, normals_a, uv0_a, color0_a; auto prims = mesh.primitives; @@ -187,12 +187,15 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const tinygltf::Mesh & //if (positions_buf.name } +#if 0 + int norm_idx, tan_idx, uv0_idx, uv1_idx, color0_idx, color1_idx; norm_idx = (prim.attributes.count("NORMAL") > 0) ? prim.attributes.at("NORMAL") : -1; tan_idx = (prim.attributes.count("TANGENT") > 0) ? prim.attributes.at("TANGENT") : -1; uv0_idx = (prim.attributes.count("TEXCOORDS_0") > 0) ? prim.attributes.at("TEXCOORDS_0") : -1; uv1_idx = (prim.attributes.count("TEXCOORDS_1") > 0) ? prim.attributes.at("TEXCOORDS_1") : -1; color0_idx = (prim.attributes.count("COLOR_0") > 0) ? prim.attributes.at("COLOR_0") : -1; color1_idx = (prim.attributes.count("COLOR_1") > 0) ? prim.attributes.at("COLOR_1") : -1; +#endif if (prim.mode == TINYGLTF_MODE_TRIANGLES) { diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 89c7f75c44..a3e0c0d9ca 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -33,7 +33,7 @@ #include "v3color.h" #include "v2math.h" #include "lluuid.h" -#include "llmd5.h" +#include "hbxxh.h" #include <string> @@ -118,12 +118,10 @@ public: LLUUID getHash() const { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - LLMD5 md5; - md5.update((unsigned char*)this, sizeof(this)); - md5.finalize(); - LLUUID id; - md5.raw_digest(id.mData); - return id; + // HACK - hash the bytes of this object but don't include the ref count + LLUUID hash; + HBXXH128::digest(hash, (unsigned char*)this + sizeof(S32), sizeof(this) - sizeof(S32)); + return hash; } //setters for various members (will clamp to acceptable ranges) diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index 0ab97a0df3..a694a666c6 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -27,7 +27,7 @@ #include "linden_common.h" #include "llmaterial.h" -#include "llmd5.h" +#include "hbxxh.h" /** * Materials cap parameters @@ -479,13 +479,9 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode) LLUUID LLMaterial::getHash() const { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - LLMD5 md5; // HACK - hash the bytes of this LLMaterial, but trim off the S32 in LLRefCount - md5.update((unsigned char*)this + sizeof(S32), sizeof(this) - sizeof(S32)); - md5.finalize(); LLUUID id; - md5.raw_digest(id.mData); - // *TODO: Hash the overrides + HBXXH128::digest(id, (unsigned char*)this + sizeof(S32), sizeof(this) - sizeof(S32)); return id; } diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 52fb8e3802..dba4bee6e2 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1429,6 +1429,16 @@ LLMeshSkinInfo::LLMeshSkinInfo(LLSD& skin): fromLLSD(skin); } +LLMeshSkinInfo::LLMeshSkinInfo(const LLUUID& mesh_id, LLSD& skin) : + mMeshID(mesh_id), + mPelvisOffset(0.0), + mLockScaleIfJointPosition(false), + mInvalidJointsScrubbed(false), + mJointNumsInitialized(false) +{ + fromLLSD(skin); +} + void LLMeshSkinInfo::fromLLSD(LLSD& skin) { if (skin.has("joint_names")) diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 2aaaa4e8c1..4505d6b3b9 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -41,12 +41,13 @@ class domMesh; #define MAX_MODEL_FACES 8 LL_ALIGN_PREFIX(16) -class LLMeshSkinInfo +class LLMeshSkinInfo : public LLRefCount { LL_ALIGN_NEW public: LLMeshSkinInfo(); LLMeshSkinInfo(LLSD& data); + LLMeshSkinInfo(const LLUUID& mesh_id, LLSD& data); void fromLLSD(LLSD& data); LLSD asLLSD(bool include_joints, bool lock_scale_if_joint_position) const; void updateHash(); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index faa45d59b9..59e8e86fbb 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -82,13 +82,10 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) } LLShaderFeatures::LLShaderFeatures() - : atmosphericHelpers(false) - , calculatesLighting(false) + : calculatesLighting(false) , calculatesAtmospherics(false) , hasLighting(false) , isAlphaLighting(false) - , isShiny(false) - , isFullbright(false) , isSpecular(false) , hasWaterFog(false) , hasTransport(false) @@ -100,7 +97,6 @@ LLShaderFeatures::LLShaderFeatures() , encodesNormal(false) , isDeferred(false) , hasScreenSpaceReflections(false) - , hasIndirect(false) , hasShadows(false) , hasAmbientOcclusion(false) , mIndexedTextureChannels(0) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 6c18282fec..b0d5f308f3 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -35,13 +35,10 @@ class LLShaderFeatures { public: - bool atmosphericHelpers; bool calculatesLighting; bool calculatesAtmospherics; bool hasLighting; // implies no transport (it's possible to have neither though) bool isAlphaLighting; // indicates lighting shaders need not be linked in (lighting performed directly in alpha shader to match deferred lighting functions) - bool isShiny; - bool isFullbright; // implies no lighting bool isSpecular; bool hasWaterFog; // implies no gamma bool hasTransport; // implies no lighting (it's possible to have neither though) @@ -55,7 +52,6 @@ public: bool encodesNormal; // include: shaders\class1\environment\encodeNormF.glsl bool isDeferred; bool hasScreenSpaceReflections; - bool hasIndirect; S32 mIndexedTextureChannels; bool disableTextureIndex; bool hasAlphaMask; diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index f1e5b71207..0f8655132b 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -230,35 +230,7 @@ void LLPostProcess::applyShaders(void) void LLPostProcess::applyColorFilterShader(void) { - /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. - gPostColorFilterProgram.bind(); - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); - - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture); - - getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject); - glUniform1i(colorFilterUniforms["RenderTexture"], 0); - glUniform1f(colorFilterUniforms["brightness"], tweaks.getBrightness()); - glUniform1f(colorFilterUniforms["contrast"], tweaks.getContrast()); - float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f; - baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI); - float baseR = tweaks.getContrastBaseR() * baseI; - float baseG = tweaks.getContrastBaseG() * baseI; - float baseB = tweaks.getContrastBaseB() * baseI; - glUniform3f(colorFilterUniforms["contrastBase"], baseR, baseG, baseB); - glUniform1f(colorFilterUniforms["saturation"], tweaks.getSaturation()); - glUniform3f(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); - LLGLEnable blend(GL_BLEND); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - LLGLDepthTest depth(GL_FALSE); - - /// Draw a screen space quad - drawOrthoQuad(screenW, screenH, QUAD_NORMAL); - gPostColorFilterProgram.unbind(); - */ } void LLPostProcess::createColorFilterShader(void) @@ -274,40 +246,7 @@ void LLPostProcess::createColorFilterShader(void) void LLPostProcess::applyNightVisionShader(void) { - /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. - gPostNightVisionProgram.bind(); - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); - - getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject); - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture); - glUniform1i(nightVisionUniforms["RenderTexture"], 0); - - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - - gGL.getTexUnit(1)->bindManual(LLTexUnit::TT_TEXTURE, noiseTexture); - glUniform1i(nightVisionUniforms["NoiseTexture"], 1); - - - glUniform1f(nightVisionUniforms["brightMult"], tweaks.getBrightMult()); - glUniform1f(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength()); - noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f); - noiseTextureScale *= (screenH / NOISE_SIZE); - - - glUniform3f(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); - LLGLEnable blend(GL_BLEND); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - LLGLDepthTest depth(GL_FALSE); - - /// Draw a screen space quad - drawOrthoQuad(screenW, screenH, QUAD_NOISE); - gPostNightVisionProgram.unbind(); - gGL.getTexUnit(0)->activate(); - */ } void LLPostProcess::createNightVisionShader(void) @@ -396,78 +335,7 @@ void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) { -#if 0 - float noiseX = 0.f; - float noiseY = 0.f; - float screenRatio = 1.0f; - - if (type == QUAD_NOISE){ - noiseX = ((float) rand() / (float) RAND_MAX); - noiseY = ((float) rand() / (float) RAND_MAX); - screenRatio = (float) width / (float) height; - } - - - glBegin(GL_QUADS); - if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height); - } else { - glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height * 2.0f); - } - if (type == QUAD_NOISE){ - glMultiTexCoord2f(GL_TEXTURE1, - noiseX, - noiseTextureScale + noiseY); - } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2f(GL_TEXTURE1, 0.f, (GLfloat) height * 0.5f); - } - glVertex2f(0.f, (GLfloat) screenH - height); - - if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f); - } else { - glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f); - } - if (type == QUAD_NOISE){ - glMultiTexCoord2f(GL_TEXTURE1, - noiseX, - noiseY); - } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2f(GL_TEXTURE1, 0.f, 0.f); - } - glVertex2f(0.f, (GLfloat) height + (screenH - height)); - - if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, 0.f); - } else { - glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, 0.f); - } - if (type == QUAD_NOISE){ - glMultiTexCoord2f(GL_TEXTURE1, - screenRatio * noiseTextureScale + noiseX, - noiseY); - } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, 0.f); - } - glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height)); - - - if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, (GLfloat) height); - } else { - glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f); - } - if (type == QUAD_NOISE){ - glMultiTexCoord2f(GL_TEXTURE1, - screenRatio * noiseTextureScale + noiseX, - noiseTextureScale + noiseY); - } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f); - } - glVertex2f((GLfloat) width, (GLfloat) screenH - height); - glEnd(); -#endif } void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height) diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 3d32d3ca31..2d6f3c9469 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -117,7 +117,6 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) { - stop_glerror(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Counterclockwise quad will face the viewer @@ -142,7 +141,6 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) gGL.vertex2i(left, top); gGL.end(); } - stop_glerror(); } void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 6e3d89eedc..6cada320fa 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -28,6 +28,7 @@ #include "llshadermgr.h" #include "llrender.h" #include "llfile.h" +#include "lldir.h" #if LL_DARWIN #include "OpenGL/OpenGL.h" @@ -254,14 +255,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } - if (features->hasIndirect) - { - if (!shader->attachFragmentObject("deferred/indirect.glsl")) - { - return FALSE; - } - } - if (features->hasGamma || features->isDeferred) { if (!shader->attachFragmentObject("windlight/gammaF.glsl")) @@ -296,9 +289,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - - // Test hasFullbright and hasShiny and attach fullbright and - // fullbright shiny atmos transport if we split them out. } // NOTE order of shader object attaching is VERY IMPORTANT!!! @@ -391,164 +381,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } - // NOTE order of shader object attaching is VERY IMPORTANT!!! - else if (features->isFullbright) - { - - if (features->isShiny && features->hasWaterFog) - { - if (features->disableTextureIndex) - { - if (!shader->attachFragmentObject("lighting/lightFullbrightShinyWaterNonIndexedF.glsl")) - { - return FALSE; - } - } - else - { - if (!shader->attachFragmentObject("lighting/lightFullbrightShinyWaterF.glsl")) - { - return FALSE; - } - shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); - } - } - else if (features->hasWaterFog) - { - if (features->disableTextureIndex) - { - if (features->hasAlphaMask) - { - if (!shader->attachFragmentObject("lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl")) - { - return FALSE; - } - } - else if (!shader->attachFragmentObject("lighting/lightFullbrightWaterNonIndexedF.glsl")) - { - return FALSE; - } - } - else - { - if (features->hasAlphaMask) - { - if (!shader->attachFragmentObject("lighting/lightFullbrightWaterAlphaMaskF.glsl")) - { - return FALSE; - } - } - else if (!shader->attachFragmentObject("lighting/lightFullbrightWaterF.glsl")) - { - return FALSE; - } - shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); - } - } - - else if (features->isShiny) - { - if (features->disableTextureIndex) - { - if (!shader->attachFragmentObject("lighting/lightFullbrightShinyNonIndexedF.glsl")) - { - return FALSE; - } - } - else - { - if (!shader->attachFragmentObject("lighting/lightFullbrightShinyF.glsl")) - { - return FALSE; - } - shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); - } - } - - else - { - if (features->disableTextureIndex) - { - - if (features->hasAlphaMask) - { - if (!shader->attachFragmentObject("lighting/lightFullbrightNonIndexedAlphaMaskF.glsl")) - { - return FALSE; - } - } - else - { - if (!shader->attachFragmentObject("lighting/lightFullbrightNonIndexedF.glsl")) - { - return FALSE; - } - } - } - else - { - if (features->hasAlphaMask) - { - if (!shader->attachFragmentObject("lighting/lightFullbrightAlphaMaskF.glsl")) - { - return FALSE; - } - } - else - { - if (!shader->attachFragmentObject("lighting/lightFullbrightF.glsl")) - { - return FALSE; - } - } - shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); - } - } - } - - // NOTE order of shader object attaching is VERY IMPORTANT!!! - else if (features->isShiny) - { - - if (features->hasWaterFog) - { - if (features->disableTextureIndex) - { - if (!shader->attachFragmentObject("lighting/lightShinyWaterNonIndexedF.glsl")) - { - return FALSE; - } - } - else - { - if (!shader->attachFragmentObject("lighting/lightShinyWaterF.glsl")) - { - return FALSE; - } - shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); - } - } - - else - { - if (features->disableTextureIndex) - { - if (!shader->attachFragmentObject("lighting/lightShinyNonIndexedF.glsl")) - { - return FALSE; - } - } - else - { - if (!shader->attachFragmentObject("lighting/lightShinyF.glsl")) - { - return FALSE; - } - shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); - } - } - } - if (features->mIndexedTextureChannels <= 1) { if (!shader->attachVertexObject("objects/nonindexedTextureV.glsl")) @@ -687,36 +519,57 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev S32 gpu_class; std::string open_file_name; - //find the most relevant file - for (gpu_class = try_gpu_class; gpu_class > 0; gpu_class--) - { //search from the current gpu class down to class 1 to find the most relevant shader - std::stringstream fname; - fname << getShaderDirPrefix(); - fname << gpu_class << "/" << filename; - - open_file_name = fname.str(); - - /* - Would be awesome, if we didn't have shaders that re-use files - with different environments to say, add skinning, etc - can't depend on cached version to have evaluate ifdefs identically... - if we can define a deterministic hash for the shader based on - all the inputs, maybe we can save some time here. - if (mShaderObjects.count(filename) > 0) + +#if 0 // WIP -- try to come up with a way to fallback to an error shader without needing debug stubs all over the place in the shader tree + if (shader_level == -1) + { + // use "error" fallback + if (type == GL_VERTEX_SHADER) { - return mShaderObjects[filename]; + open_file_name = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/errorV.glsl"); + } + else + { + llassert(type == GL_FRAGMENT_SHADER); // type must be vertex or fragment shader + open_file_name = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/errorF.glsl"); } - */ + file = LLFile::fopen(open_file_name, "r"); + } + else +#endif + { + //find the most relevant file + for (gpu_class = try_gpu_class; gpu_class > 0; gpu_class--) + { //search from the current gpu class down to class 1 to find the most relevant shader + std::stringstream fname; + fname << getShaderDirPrefix(); + fname << gpu_class << "/" << filename; + + open_file_name = fname.str(); + + /* + Would be awesome, if we didn't have shaders that re-use files + with different environments to say, add skinning, etc + can't depend on cached version to have evaluate ifdefs identically... + if we can define a deterministic hash for the shader based on + all the inputs, maybe we can save some time here. + if (mShaderObjects.count(filename) > 0) + { + return mShaderObjects[filename]; + } - LL_DEBUGS("ShaderLoading") << "Looking in " << open_file_name << LL_ENDL; - file = LLFile::fopen(open_file_name, "r"); /* Flawfinder: ignore */ - if (file) - { - LL_DEBUGS("ShaderLoading") << "Loading file: " << open_file_name << " (Want class " << gpu_class << ")" << LL_ENDL; - break; // done - } - } + */ + + LL_DEBUGS("ShaderLoading") << "Looking in " << open_file_name << LL_ENDL; + file = LLFile::fopen(open_file_name, "r"); /* Flawfinder: ignore */ + if (file) + { + LL_DEBUGS("ShaderLoading") << "Loading file: " << open_file_name << " (Want class " << gpu_class << ")" << LL_ENDL; + break; // done + } + } + } if (file == NULL) { @@ -826,7 +679,6 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev extra_code_text[extra_code_count++] = strdup("#define texture2D texture\n"); extra_code_text[extra_code_count++] = strdup("#define textureCube texture\n"); extra_code_text[extra_code_count++] = strdup("#define texture2DLod textureLod\n"); - extra_code_text[extra_code_count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n"); if (major_version > 1 || minor_version >= 40) { //GLSL 1.40 replaces texture2DRect et al with texture @@ -961,6 +813,13 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev GLuint out_of_extra_block_counter = 0, start_shader_code = shader_code_count, file_lines_count = 0; +#define TOUCH_SHADERS 0 + +#if TOUCH_SHADERS + const char* marker = "// touched"; + bool touched = false; +#endif + while(NULL != fgets((char *)buff, 1024, file) && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text))) { @@ -968,6 +827,13 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev bool extra_block_area_found = NULL != strstr((const char*)buff, "[EXTRA_CODE_HERE]"); +#if TOUCH_SHADERS + if (NULL != strstr((const char*)buff, marker)) + { + touched = true; + } +#endif + if(extra_block_area_found && !(flag_extra_block_marker_was_found & flags)) { if(!(flag_write_to_out_of_extra_block_area & flags)) @@ -1030,6 +896,13 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev extra_code_count = 0; } +#if TOUCH_SHADERS + if (!touched) + { + fprintf(file, "\n%s\n", marker); + } +#endif + fclose(file); //create shader object @@ -1422,7 +1295,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("single_mie_scattering_texture"); mReservedUniforms.push_back("irradiance_texture"); mReservedUniforms.push_back("blend_factor"); - mReservedUniforms.push_back("no_atmo"); mReservedUniforms.push_back("moisture_level"); mReservedUniforms.push_back("droplet_radius"); mReservedUniforms.push_back("ice_level"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index a224b2a19b..3c8bef635a 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -255,7 +255,6 @@ public: ILLUMINANCE_TEX, // "irradiance_texture" BLEND_FACTOR, // "blend_factor" - NO_ATMO, // "no_atmo" MOISTURE_LEVEL, // "moisture_level" DROPLET_RADIUS, // "droplet_radius" ICE_LEVEL, // "ice_level" diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 5e00bf7f45..b13e7389cc 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -505,6 +505,17 @@ LLFlatListView::LLFlatListView(const LLFlatListView::Params& p) } }; +LLFlatListView::~LLFlatListView() +{ + for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it) + { + mItemsPanel->removeChild((*it)->first); + (*it)->first->die(); + delete *it; + } + mItemPairs.clear(); +} + // virtual void LLFlatListView::draw() { diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 230ea200d8..d47c1cf333 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -299,6 +299,7 @@ public: virtual S32 notify(const LLSD& info) ; + virtual ~LLFlatListView(); protected: /** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */ diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index ea2ca68e47..e1869e8125 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -163,6 +163,7 @@ LLFolderView::LLFolderView(const Params& p) : LLFolderViewFolder(p), mScrollContainer( NULL ), mPopupMenuHandle(), + mMenuFileName(p.options_menu), mAllowMultiSelect(p.allow_multiselect), mAllowDrag(p.allow_drag), mShowEmptyMessage(p.show_empty_message), @@ -182,6 +183,7 @@ LLFolderView::LLFolderView(const Params& p) mMinWidth(0), mDragAndDropThisFrame(FALSE), mCallbackRegistrar(NULL), + mEnableRegistrar(NULL), mUseEllipses(p.use_ellipses), mDraggingOverItem(NULL), mStatusTextBox(NULL), @@ -244,17 +246,6 @@ LLFolderView::LLFolderView(const Params& p) mStatusTextBox->setFollowsTop(); addChild(mStatusTextBox); - - // make the popup menu available - llassert(LLMenuGL::sMenuContainer != NULL); - LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(p.options_menu, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); - if (!menu) - { - menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu"); - } - menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); - mPopupMenuHandle = menu->getHandle(); - mViewModelItem->openItem(); mAreChildrenInited = true; // root folder is a special case due to not being loaded normally, assume that it's inited. @@ -276,6 +267,7 @@ LLFolderView::~LLFolderView( void ) mStatusTextBox = NULL; if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); + mPopupMenuHandle.markDead(); mAutoOpenItems.removeAllNodes(); clearSelection(); @@ -1438,22 +1430,56 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + LLMenuGL* menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (!menu) + { + if (mCallbackRegistrar) + { + mCallbackRegistrar->pushScope(); + } + if (mEnableRegistrar) + { + mEnableRegistrar->pushScope(); + } + llassert(LLMenuGL::sMenuContainer != NULL); + menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(mMenuFileName, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); + if (!menu) + { + menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu"); + } + menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); + mPopupMenuHandle = menu->getHandle(); + if (mEnableRegistrar) + { + mEnableRegistrar->popScope(); + } + if (mCallbackRegistrar) + { + mCallbackRegistrar->popScope(); + } + } bool hide_folder_menu = mSuppressFolderMenu && isFolderSelected(); - if ((handled - && ( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible - && menu ) && + if (menu && (handled + && ( count > 0 && (hasVisibleChildren()) )) && // show menu only if selected items are visible !hide_folder_menu) { if (mCallbackRegistrar) { mCallbackRegistrar->pushScope(); } + if (mEnableRegistrar) + { + mEnableRegistrar->pushScope(); + } updateMenuOptions(menu); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); + if (mEnableRegistrar) + { + mEnableRegistrar->popScope(); + } if (mCallbackRegistrar) { mCallbackRegistrar->popScope(); @@ -1531,7 +1557,7 @@ void LLFolderView::deleteAllChildren() { closeRenamer(); if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); - mPopupMenuHandle = LLHandle<LLView>(); + mPopupMenuHandle.markDead(); mScrollContainer = NULL; mRenameItem = NULL; mRenamer = NULL; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 6bb5e6c02e..7dfa04828a 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -235,6 +235,7 @@ public: bool showItemLinkOverlays() { return mShowItemLinkOverlays; } void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } + void setEnableRegistrar(LLUICtrl::EnableCallbackRegistry::ScopedRegistrar* registrar) { mEnableRegistrar = registrar; } LLPanel* getParentPanel() { return mParentPanel.get(); } // DEBUG only @@ -272,6 +273,7 @@ protected: protected: LLHandle<LLView> mPopupMenuHandle; + std::string mMenuFileName; selected_items_t mSelectedItems; bool mKeyboardSelection, @@ -327,6 +329,7 @@ protected: LLFolderViewItem* mDraggingOverItem; // See EXT-719 LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* mCallbackRegistrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar* mEnableRegistrar; public: static F32 sAutoOpenTime; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 618169a8fe..c5e027d314 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -419,21 +419,15 @@ public: mFilter(filter) {} - virtual ~LLFolderViewModel() - { - delete mSorter; - mSorter = NULL; - delete mFilter; - mFilter = NULL; - } + virtual ~LLFolderViewModel() {} virtual SortType& getSorter() { return *mSorter; } virtual const SortType& getSorter() const { return *mSorter; } - virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); } + virtual void setSorter(const SortType& sorter) { mSorter.reset(new SortType(sorter)); requestSortAll(); } virtual FilterType& getFilter() { return *mFilter; } virtual const FilterType& getFilter() const { return *mFilter; } - virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); } + virtual void setFilter(const FilterType& filter) { mFilter.reset(new FilterType(filter)); } // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, // this method needs to be overloaded and return the relevant fetch status. @@ -471,8 +465,8 @@ public: } protected: - SortType* mSorter; - FilterType* mFilter; + std::unique_ptr<SortType> mSorter; + std::unique_ptr<FilterType> mFilter; }; #endif // LLFOLDERVIEWMODEL_H diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 33037b5001..940cf398c0 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -209,13 +209,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) setPrevalidateInput(p.prevalidate_input_callback()); setPrevalidate(p.prevalidate_callback()); - - llassert(LLMenuGL::sMenuContainer != NULL); - LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu> - ("menu_text_editor.xml", - LLMenuGL::sMenuContainer, - LLMenuHolderGL::child_registry_t::instance()); - setContextMenu(menu); } LLLineEditor::~LLLineEditor() @@ -1567,7 +1560,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) KEY_SHIFT != key && KEY_CONTROL != key && KEY_ALT != key && - KEY_CAPSLOCK ) + KEY_CAPSLOCK != key) { deselect(); } @@ -2637,6 +2630,15 @@ LLWString LLLineEditor::getConvertedText() const void LLLineEditor::showContextMenu(S32 x, S32 y) { LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); + if (!menu) + { + llassert(LLMenuGL::sMenuContainer != NULL); + menu = LLUICtrlFactory::createFromFile<LLContextMenu> + ("menu_text_editor.xml", + LLMenuGL::sMenuContainer, + LLMenuHolderGL::child_registry_t::instance()); + setContextMenu(menu); + } if (menu) { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 4264028338..5cb840fd61 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -4087,25 +4087,39 @@ void LLTearOffMenu::closeTearOff() } LLContextMenuBranch::LLContextMenuBranch(const LLContextMenuBranch::Params& p) -: LLMenuItemGL(p), - mBranch( p.branch()->getHandle() ) +: LLMenuItemGL(p) { - mBranch.get()->hide(); - mBranch.get()->setParentMenuItem(this); + LLContextMenu* branch = static_cast<LLContextMenu*>(p.branch); + if (branch) + { + mBranch = branch->getHandle(); + branch->hide(); + branch->setParentMenuItem(this); + } +} + +LLContextMenuBranch::~LLContextMenuBranch() +{ + if (mBranch.get()) + { + mBranch.get()->die(); + } } // called to rebuild the draw label void LLContextMenuBranch::buildDrawLabel( void ) { + auto menu = getBranch(); + if (menu) { // default enablement is this -- if any of the subitems are // enabled, this item is enabled. JC - U32 sub_count = mBranch.get()->getItemCount(); + U32 sub_count = menu->getItemCount(); U32 i; BOOL any_enabled = FALSE; for (i = 0; i < sub_count; i++) { - LLMenuItemGL* item = mBranch.get()->getItem(i); + LLMenuItemGL* item = menu->getItem(i); item->buildDrawLabel(); if (item->getEnabled() && !item->getDrawTextDisabled() ) { @@ -4127,13 +4141,17 @@ void LLContextMenuBranch::buildDrawLabel( void ) void LLContextMenuBranch::showSubMenu() { - LLMenuItemGL* menu_item = mBranch.get()->getParentMenuItem(); - if (menu_item != NULL && menu_item->getVisible()) + auto menu = getBranch(); + if(menu) { - S32 center_x; - S32 center_y; - localPointToScreen(getRect().getWidth(), getRect().getHeight() , ¢er_x, ¢er_y); - mBranch.get()->show(center_x, center_y); + LLMenuItemGL* menu_item = menu->getParentMenuItem(); + if (menu_item != NULL && menu_item->getVisible()) + { + S32 center_x; + S32 center_y; + localPointToScreen(getRect().getWidth(), getRect().getHeight(), ¢er_x, ¢er_y); + menu->show(center_x, center_y); + } } } @@ -4147,13 +4165,17 @@ void LLContextMenuBranch::setHighlight( BOOL highlight ) { if (highlight == getHighlight()) return; LLMenuItemGL::setHighlight(highlight); - if( highlight ) - { - showSubMenu(); - } - else + auto menu = getBranch(); + if (menu) { - mBranch.get()->hide(); + if (highlight) + { + showSubMenu(); + } + else + { + menu->hide(); + } } } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index abbfd9a24a..f84c4d41eb 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -745,8 +745,7 @@ public: LLContextMenuBranch(const Params&); - virtual ~LLContextMenuBranch() - {} + virtual ~LLContextMenuBranch(); // called to rebuild the draw label virtual void buildDrawLabel( void ); diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index f89064d59a..604d246f12 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -92,7 +92,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) mMouseDownSignal(NULL), mMouseUpSignal(NULL) { - mValue.emptyMap(); + mValue = LLSD::emptyMap(); mCurSlider = LLStringUtil::null; if (mOrientation == HORIZONTAL) diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 88c1bdc0d5..219667f766 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -196,7 +196,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mHighlightedItem(-1), mBorder(NULL), mSortCallback(NULL), - mPopupMenu(NULL), mCommentTextView(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), @@ -348,6 +347,13 @@ LLScrollListCtrl::~LLScrollListCtrl() mItemList.clear(); clearColumns(); //clears columns and deletes headers delete mIsFriendSignal; + + auto menu = mPopupMenuHandle.get(); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } } @@ -1307,14 +1313,14 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOO } -BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive) +BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive, S32 column) { - return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive); + return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive, column); } // Selects first enabled item that has a name where the name's first part matched the target string. // Returns false if item not found. -BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sensitive) +BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sensitive, S32 column) { BOOL found = FALSE; @@ -1329,7 +1335,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen { LLScrollListItem* item = *iter; // Only select enabled items with matching names - LLScrollListCell* cellp = item->getColumn(getSearchColumn()); + LLScrollListCell* cellp = item->getColumn(column == -1 ? getSearchColumn() : column); BOOL select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : FALSE; if (select) { @@ -1352,7 +1358,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen LLScrollListItem* item = *iter; // Only select enabled items with matching names - LLScrollListCell* cellp = item->getColumn(getSearchColumn()); + LLScrollListCell* cellp = item->getColumn(column == -1 ? getSearchColumn() : column); if (!cellp) { continue; @@ -1997,17 +2003,23 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) // create the context menu from the XUI file and display it std::string menu_name = is_group ? "menu_url_group.xml" : "menu_url_agent.xml"; - delete mPopupMenu; + auto menu = mPopupMenuHandle.get(); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } llassert(LLMenuGL::sMenuContainer != NULL); - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( + menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( menu_name, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); - if (mPopupMenu) + if (menu) { + mPopupMenuHandle = menu->getHandle(); if (mIsFriendSignal) { bool isFriend = *(*mIsFriendSignal)(uuid); - LLView* addFriendButton = mPopupMenu->getChild<LLView>("add_friend"); - LLView* removeFriendButton = mPopupMenu->getChild<LLView>("remove_friend"); + LLView* addFriendButton = menu->getChild<LLView>("add_friend"); + LLView* removeFriendButton = menu->getChild<LLView>("remove_friend"); if (addFriendButton && removeFriendButton) { @@ -2016,8 +2028,8 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } } - mPopupMenu->show(x, y); - LLMenuGL::showPopup(this, mPopupMenu, x, y); + menu->show(x, y); + LLMenuGL::showPopup(this, menu, x, y); return TRUE; } } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 11ee012185..73b4fb036a 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -261,8 +261,8 @@ public: virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); // FALSE if item not found - BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE); - BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE); + BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE, S32 column = -1); + BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE, S32 column = -1); LLScrollListItem* getItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); const std::string getSelectedItemLabel(S32 column = 0) const; LLSD getSelectedValue(); @@ -528,7 +528,7 @@ private: S32 mHighlightedItem; class LLViewBorder* mBorder; - LLContextMenu *mPopupMenu; + LLHandle<LLContextMenu> mPopupMenuHandle; LLView *mCommentTextView; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 0aa7a2d217..8c841540a5 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1442,6 +1442,11 @@ void LLTabContainer::selectLastTab() void LLTabContainer::selectNextTab() { + if (mTabList.size() == 0) + { + return; + } + BOOL tab_has_focus = FALSE; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 8effd866e0..82a3c01c6d 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -273,6 +273,12 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) LLTextBase::~LLTextBase() { mSegments.clear(); + LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get()); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } delete mURLClickSignal; delete mIsFriendSignal; delete mIsObjectBlockedSignal; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index b1f8b00cab..3d2a426913 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -257,7 +257,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mMouseDownY(0), mTabsToNextField(p.ignore_tab), mPrevalidateFunc(p.prevalidate_callback()), - mContextMenu(NULL), mShowContextMenu(p.show_context_menu), mEnableTooltipPaste(p.enable_tooltip_paste), mPassDelete(FALSE), @@ -301,8 +300,13 @@ LLTextEditor::~LLTextEditor() // Scrollbar is deleted by LLView std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); mUndoStack.clear(); - // context menu is owned by menu holder, not us - //delete mContextMenu; + // Mark the menu as dead or its retained in memory till shutdown. + LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); + if(menu) + { + menu->die(); + mContextMenuHandle.markDead(); + } } //////////////////////////////////////////////////////////// @@ -2051,12 +2055,19 @@ void LLTextEditor::setEnabled(BOOL enabled) void LLTextEditor::showContextMenu(S32 x, S32 y) { - if (!mContextMenu) + LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); + if (!menu) { llassert(LLMenuGL::sMenuContainer != NULL); - mContextMenu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_text_editor.xml", + menu = LLUICtrlFactory::createFromFile<LLContextMenu>("menu_text_editor.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); + if(!menu) + { + LL_WARNS() << "Failed to create menu for LLTextEditor: " << getName() << LL_ENDL; + return; + } + mContextMenuHandle = menu->getHandle(); } // Route menu to this class @@ -2102,11 +2113,11 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) } } - mContextMenu->setItemVisible("Suggestion Separator", (use_spellcheck) && (!mSuggestionList.empty())); - mContextMenu->setItemVisible("Add to Dictionary", (use_spellcheck) && (is_misspelled)); - mContextMenu->setItemVisible("Add to Ignore", (use_spellcheck) && (is_misspelled)); - mContextMenu->setItemVisible("Spellcheck Separator", (use_spellcheck) && (is_misspelled)); - mContextMenu->show(screen_x, screen_y, this); + menu->setItemVisible("Suggestion Separator", (use_spellcheck) && (!mSuggestionList.empty())); + menu->setItemVisible("Add to Dictionary", (use_spellcheck) && (is_misspelled)); + menu->setItemVisible("Add to Ignore", (use_spellcheck) && (is_misspelled)); + menu->setItemVisible("Spellcheck Separator", (use_spellcheck) && (is_misspelled)); + menu->show(screen_x, screen_y, this); } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 1a10d2fd1e..f3939248c2 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -329,7 +329,7 @@ private: keystroke_signal_t mKeystrokeSignal; LLTextValidate::validate_func_t mPrevalidateFunc; - LLContextMenu* mContextMenu; + LLHandle<LLContextMenu> mContextMenuHandle; }; // end class LLTextEditor // Build time optimization, generate once in .cpp file diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 5150df25f2..2707f7a15c 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -127,7 +127,12 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) LLToolBar::~LLToolBar() { - delete mPopupMenuHandle.get(); + auto menu = mPopupMenuHandle.get(); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } delete mButtonAddSignal; delete mButtonEnterSignal; delete mButtonLeaveSignal; diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 81e938edbe..391a377280 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -1098,7 +1098,7 @@ LLSD LLDXHardware::getDisplayInfo() } LCleanup: - if (ret.emptyMap()) + if (!ret.isMap() || (ret.size() == 0)) { LL_INFOS() << "Failed to get data, cleaning up" << LL_ENDL; } diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 9fed57ba53..9d497691d8 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -501,7 +501,12 @@ attributedStringInfo getSegments(NSAttributedString *str) // e.g. OS Window for upload something or Input Window... // mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit) mModifiers = [theEvent modifierFlags]; - unichar ch = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; + NSString *str_no_modifiers = [theEvent charactersIgnoringModifiers]; + unichar ch = 0; + if (str_no_modifiers.length) + { + ch = [str_no_modifiers characterAtIndex:0]; + } bool acceptsText = mHasMarkedText ? false : callKeyDown(&eventData, keycode, mModifiers, ch); if (acceptsText && diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 43edc0110d..77024d3a9c 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -83,7 +83,7 @@ int createNSApp(int argc, const char **argv); void setupCocoa(); bool pasteBoardAvailable(); bool copyToPBoard(const unsigned short *str, unsigned int len); -const unsigned short *copyFromPBoard(); +unsigned short *copyFromPBoard(); CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); short releaseImageCursor(CursorRef ref); short setImageCursor(CursorRef ref); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 5ec9b017cf..57c3d86295 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -49,14 +49,12 @@ void setupCocoa() if(!inited) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. - // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' - // when init'ing the Cocoa App window. - [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; - - [pool release]; + @autoreleasepool { + // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. + // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' + // when init'ing the Cocoa App window. + [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; + } inited = true; } @@ -64,13 +62,13 @@ void setupCocoa() bool copyToPBoard(const unsigned short *str, unsigned int len) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; - NSPasteboard *pboard = [NSPasteboard generalPasteboard]; - [pboard clearContents]; - - NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil]; - [pool release]; - return [pboard writeObjects:contentsToPaste]; + @autoreleasepool { + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + [pboard clearContents]; + + NSArray *contentsToPaste = [[[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil] autorelease]; + return [pboard writeObjects:contentsToPaste]; + } } bool pasteBoardAvailable() @@ -79,39 +77,39 @@ bool pasteBoardAvailable() return [[NSPasteboard generalPasteboard] canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; } -const unsigned short *copyFromPBoard() +unsigned short *copyFromPBoard() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; - NSPasteboard *pboard = [NSPasteboard generalPasteboard]; - NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; - NSString *str = NULL; - BOOL ok = [pboard canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; - if (ok) - { - NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]]; - str = [objToPaste objectAtIndex:0]; - } - unichar* temp = (unichar*)calloc([str length]+1, sizeof(unichar)); - [str getCharacters:temp]; - [pool release]; - return temp; + @autoreleasepool { + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; + NSString *str = NULL; + BOOL ok = [pboard canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; + if (ok) + { + NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]]; + str = [objToPaste objectAtIndex:0]; + } + NSUInteger str_len = [str length]; + unichar* temp = (unichar*)calloc(str_len+1, sizeof(unichar)); + [str getCharacters:temp range:NSMakeRange(0, str_len)]; + return temp; + } } CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // extra retain on the NSCursor since we want it to live for the lifetime of the app. - NSCursor *cursor = - [[[NSCursor alloc] - initWithImage: - [[[NSImage alloc] initWithContentsOfFile: - [NSString stringWithUTF8String:fullpath] - ]autorelease] - hotSpot:NSMakePoint(hotspotX, hotspotY) - ]retain]; - - [pool release]; + NSCursor *cursor = nil; + @autoreleasepool { + // extra retain on the NSCursor since we want it to live for the lifetime of the app. + cursor = + [[[NSCursor alloc] + initWithImage: + [[[NSImage alloc] initWithContentsOfFile: + [NSString stringWithUTF8String:fullpath] + ] autorelease] + hotSpot:NSMakePoint(hotspotX, hotspotY) + ] retain]; + } return (CursorRef)cursor; } @@ -178,10 +176,10 @@ OSErr releaseImageCursor(CursorRef ref) { if( ref != NULL ) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSCursor *cursor = (NSCursor*)ref; - [cursor release]; - [pool release]; + @autoreleasepool { + NSCursor *cursor = (NSCursor*)ref; + [cursor autorelease]; + } } else { @@ -195,10 +193,10 @@ OSErr setImageCursor(CursorRef ref) { if( ref != NULL ) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSCursor *cursor = (NSCursor*)ref; - [cursor set]; - [pool release]; + @autoreleasepool { + NSCursor *cursor = (NSCursor*)ref; + [cursor set]; + } } else { @@ -419,24 +417,26 @@ void requestUserAttention() long showAlert(std::string text, std::string title, int type) { - NSAlert *alert = [[NSAlert alloc] init]; - - [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; - [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; - if (type == 0) - { - [alert addButtonWithTitle:@"Okay"]; - } else if (type == 1) - { - [alert addButtonWithTitle:@"Okay"]; - [alert addButtonWithTitle:@"Cancel"]; - } else if (type == 2) - { - [alert addButtonWithTitle:@"Yes"]; - [alert addButtonWithTitle:@"No"]; + long ret = 0; + @autoreleasepool { + NSAlert *alert = [[[NSAlert alloc] init] autorelease]; + + [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; + [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; + if (type == 0) + { + [alert addButtonWithTitle:@"Okay"]; + } else if (type == 1) + { + [alert addButtonWithTitle:@"Okay"]; + [alert addButtonWithTitle:@"Cancel"]; + } else if (type == 2) + { + [alert addButtonWithTitle:@"Yes"]; + [alert addButtonWithTitle:@"No"]; + } + ret = [alert runModal]; } - long ret = [alert runModal]; - [alert dealloc]; if (ret == NSAlertFirstButtonReturn) { diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 02941f2a3e..3d9963897c 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -668,11 +668,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits if (cgl_err != kCGLNoError ) { - LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; + LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; } else { - LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; + LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; } } makeFirstResponder(mWindow, mGLView); @@ -1256,8 +1256,11 @@ BOOL LLWindowMacOSX::isClipboardTextAvailable() } BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) -{ - llutf16string str(copyFromPBoard()); +{ + unsigned short* pboard_data = copyFromPBoard(); // must free returned data + llutf16string str(pboard_data); + free(pboard_data); + dst = utf16str_to_wstring(str); if (dst != L"") { @@ -1290,7 +1293,7 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r { if (!mSupportedResolutions) { - CFArrayRef modes = CGDisplayAvailableModes(mDisplay); + CFArrayRef modes = CGDisplayCopyAllDisplayModes(mDisplay, nullptr); if(modes != NULL) { @@ -1329,6 +1332,7 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r } } } + CFRelease(modes); } } diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 0f316f1ddf..7614167213 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -231,6 +231,7 @@ protected: BOOL mLanguageTextInputAllowed; LLPreeditor* mPreeditor; +public: static BOOL sUseMultGL; friend class LLWindowManager; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index a195964bb1..10cf7513b5 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1403,14 +1403,6 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO LL_INFOS("Window") << "pfd.dwDamageMask: " << pfd.dwDamageMask << LL_ENDL ; LL_INFOS("Window") << "--- end pixel format dump ---" << LL_ENDL ; - if (pfd.cColorBits < 32) - { - OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), - mCallbacks->translateString("MBError"), OSMB_OK); - close(); - return FALSE; - } - if (!SetPixelFormat(mhDC, pixel_format, &pfd)) { OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), @@ -1692,14 +1684,6 @@ const S32 max_format = (S32)num_formats - 1; << " Depth Bits " << S32(pfd.cDepthBits) << LL_ENDL; - // make sure we have 32 bits per pixel - if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32) - { - OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK); - close(); - return FALSE; - } - mhRC = 0; if (wglCreateContextAttribsARB) { //attempt to create a specific versioned context diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 4dc8eaedaf..1588f16f07 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -186,7 +186,6 @@ set(viewer_SOURCE_FILES lldrawpoolalpha.cpp lldrawpoolavatar.cpp lldrawpoolbump.cpp - lldrawpoolground.cpp lldrawpoolmaterials.cpp lldrawpoolpbropaque.cpp lldrawpoolsimple.cpp @@ -718,7 +717,6 @@ set(viewer_SOURCE_FILES llvoavatarself.cpp llvocache.cpp llvograss.cpp - llvoground.cpp llvoicecallhandler.cpp llvoicechannel.cpp llvoiceclient.cpp @@ -834,7 +832,6 @@ set(viewer_HEADER_FILES lldrawpoolbump.h lldrawpoolmaterials.h lldrawpoolpbropaque.h - lldrawpoolground.h lldrawpoolsimple.h lldrawpoolsky.h lldrawpoolterrain.h @@ -1358,7 +1355,6 @@ set(viewer_HEADER_FILES llvoavatarself.h llvocache.h llvograss.h - llvoground.h llvoicechannel.h llvoiceclient.h llvoicevisualizer.h @@ -1844,9 +1840,9 @@ if (WINDOWS) ${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll - ${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll - ${SHARED_LIB_STAGING_DIR}/Debug/openjpegd.dll + ${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll + ${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 333d764866..304932dd1a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8828,6 +8828,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderCloudShadowAmbianceFactor</key> + <map> + <key>Comment</key> + <string>Amount that cloud shadow (aka cloud coverage) contributes to reflection probe ambiance</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.1</real> + </map> <key>RenderComplexityColorMin</key> <map> <key>Comment</key> @@ -10073,17 +10084,6 @@ <key>Value</key> <real>1.3</real> </map> - <key>RenderGround</key> - <map> - <key>Comment</key> - <string>Determines whether we can render the ground pool or not</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>1</integer> - </map> <key>DisableAllRenderTypes</key> <map> <key>Comment</key> @@ -16978,5 +16978,16 @@ <key>Value</key> <integer>0</integer> </map> + <key>DebugSettingsHideDefault</key> + <map> + <key>Comment</key> + <string>Show non-default settings only in Debug Settings list</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl deleted file mode 100644 index 7a35905280..0000000000 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file pickAvatarF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -uniform sampler2D diffuseMap; - -void main() -{ - frag_color = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a); -} diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl deleted file mode 100644 index 78b5328c9a..0000000000 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file pickAvatarV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -mat4 getSkinnedTransform(); - -void main() -{ - vec4 pos; - vec4 pos_in = vec4(position, 1.0); - mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], pos_in); - pos.y = dot(trans[1], pos_in); - pos.z = dot(trans[2], pos_in); - pos.w = 1.0; - - vertex_color = diffuse_color; - vary_texcoord0 = texcoord0; - gl_Position = projection_matrix * pos; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index b45dfcd550..cf9ce646d1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -125,7 +125,5 @@ void main() frag_data[0] = vec4(color.rgb, alpha1); frag_data[1] = vec4(0.0,0.0,0.0,0.0); frag_data[2] = vec4(0,0,0,GBUFFER_FLAG_SKIP_ATMOS); - - gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 Stars and Clouds need same depth } diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index c87e754eca..e71d080fc5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -531,7 +531,7 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0); - color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness); + color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, 0.2); color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 2.75 * scol; color += colorEmissive*0.5; @@ -551,14 +551,14 @@ void waterClip(vec3 pos) // TODO: make this less branchy if (waterSign > 0) { - if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < -0.1) + if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < 0.0) { discard; } } else { - if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) > -0.1) + if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) > 0.0) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 73e5b401c0..afe504743d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -27,19 +27,15 @@ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif #if !defined(HAS_DIFFUSE_LOOKUP) uniform sampler2D diffuseMap; #endif -VARYING vec3 vary_position; -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; +in vec3 vary_position; +in vec4 vertex_color; +in vec2 vary_texcoord0; #ifdef WATER_FOG vec4 applyWaterFogView(vec3 pos, vec4 color); @@ -68,7 +64,7 @@ void main() #ifdef HAS_DIFFUSE_LOOKUP vec4 color = diffuseLookup(vary_texcoord0.xy); #else - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 color = texture(diffuseMap, vary_texcoord0.xy); #endif float final_alpha = color.a * vertex_color.a; @@ -91,7 +87,10 @@ void main() color.a = final_alpha; #endif - frag_color.rgb = srgb_to_linear(color.rgb); +#ifndef IS_HUD + color.rgb = srgb_to_linear(color.rgb); +#endif + frag_color.rgb = color.rgb; frag_color.a = color.a; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl deleted file mode 100644 index f693323d45..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @file fullbrightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -#ifndef HAS_DIFFUSE_LOOKUP -uniform sampler2D diffuseMap; -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; -VARYING vec3 vary_position; - -uniform samplerCube environmentMap; - -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() -uniform int no_atmo; - -vec3 fullbrightShinyAtmosTransport(vec3 light); -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); - -vec3 linear_to_srgb(vec3 c); -vec3 srgb_to_linear(vec3 c); - -// See: -// class1\deferred\fullbrightShinyF.glsl -// class1\lighting\lightFullbrightShinyF.glsl -void main() -{ -#ifdef HAS_DIFFUSE_LOOKUP - vec4 color = diffuseLookup(vary_texcoord0.xy); -#else - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); -#endif - - color.rgb *= vertex_color.rgb; - - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - vec3 pos = vary_position.xyz; - - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; - - //color.rgb = srgb_to_linear(color.rgb); - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); - } - -/* - // NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects. - else - { - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - } -*/ - - color.a = 1.0; - - //color.rgb = linear_to_srgb(color.rgb); - - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/indirect.glsl b/indra/newview/app_settings/shaders/class1/deferred/indirect.glsl deleted file mode 100644 index 49bfa660f8..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/indirect.glsl +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file class1/deferred/indirect.glsl - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -vec3 getIndirect(vec3 ambient, vec3 norm, vec3 pos, vec2 pos_screen) -{ - return ambient; -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl deleted file mode 100644 index 185c1150ef..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file luminanceF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; -VARYING vec2 vary_fragcoord; - -void main() -{ - frag_color = texture2D(diffuseMap, vary_fragcoord.xy); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl deleted file mode 100644 index 5488a63c6a..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file giV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; - -VARYING vec2 vary_fragcoord; -VARYING vec4 vertex_color; - -uniform vec2 screen_res; - -void main() -{ - //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_Position = pos; - - vary_fragcoord = (pos.xy * 0.5 + 0.5); - - vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl deleted file mode 100644 index 51a36935f2..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @file materialF.glsl -* -* $LicenseInfo:firstyear=2007&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2007, 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$ -*/ - - -/*[EXTRA_CODE_HERE]*/ - -//class1/deferred/materialF.glsl - -// Debug stub for non-pbr material - -#define DIFFUSE_ALPHA_MODE_BLEND 1 - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) -out vec4 frag_color; -#else -out vec4 frag_data[4]; -#endif - -void main() -{ -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - frag_color = vec4(1, 0, 0, 0.5); -#else - // emissive red PBR material - frag_data[0] = vec4(0, 0, 0, 0); - frag_data[1] = vec4(0, 0, 0, 0); - frag_data[2] = vec4(1, 0, 0, GBUFFER_FLAG_HAS_PBR); - frag_data[3] = vec4(1, 0, 0, 0); -#endif -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 7032c45603..41dd485fae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -72,7 +72,5 @@ void main() frag_data[0] = vec4(c.rgb, c.a); frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_HAS_ATMOS); - - gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 } diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl index c4922afd7d..032245a01c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl @@ -27,18 +27,20 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; +in vec3 position; +in vec2 texcoord0; -VARYING vec2 vary_texcoord0; +out vec2 vary_texcoord0; void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); - vec4 pos = (modelview_matrix * vert); + vec4 pos = (modelview_projection_matrix * vert); - gl_Position = modelview_projection_matrix*vert; + // smash to *almost* far clip plane -- stars are still behind + pos.z = pos.w*0.999999; + gl_Position = pos; vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl deleted file mode 100644 index 8fdb5e7154..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file class1/deferred/multiPointLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - // debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.5, 0.5, 0.0, 0.0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl deleted file mode 100644 index d71dc76423..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file multiPointLightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -VARYING vec4 vary_fragcoord; - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - vary_fragcoord = pos; - - gl_Position = pos; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl deleted file mode 100644 index e9dac711c3..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ /dev/null @@ -1,283 +0,0 @@ -/** - * @file multiSpotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -//class 1 -- no shadows - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform sampler2D noiseMap; -uniform sampler2D projectionMap; -uniform sampler2D lightFunc; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; - -uniform vec3 center; -uniform vec3 color; -uniform float falloff; -uniform float size; - -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; -vec3 getNorm(vec2 pos_screen); -vec3 srgb_to_linear(vec3 c); -float getDepth(vec2 tc); - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - d *= min(1, d * (proj_lod - lod)); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 col = vec3(0,0,0); - -#if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = center.xyz-pos.xyz; - float dist = length(lv); - dist /= size; - if (dist > 1.0) - { - discard; - } - - float envIntensity = texture2D(normalMap, frag.xy).z; - vec3 norm = getNorm(frag.xy); - - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z < 0.0) - { - discard; - } - - proj_tc.xyz /= proj_tc.w; - - float fa = falloff+1.0; - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - - - if (dist_atten <= 0.0) - { - discard; - } - - float noise = texture2D(noiseMap, frag.xy).b; - dist_atten *= noise; - - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - - vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; - - vec3 dlit = vec3(0, 0, 0); - - - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float lit = 0.0; - float amb_da = proj_ambiance; - - if (da > 0.0) - { - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - - dlit = color.rgb * plcol.rgb * plcol.a; - - lit = da * dist_atten; - - col = dlit*lit*diff_tex; - amb_da += (da*0.5)*proj_ambiance; - } - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5)*proj_ambiance; - - amb_da *= dist_atten * noise; - - amb_da = min(amb_da, 1.0-lit); - col += amb_da*color.rgb*diff_tex*amb_plcol.rgb*amb_plcol.a; - } - - - vec4 spec = texture2D(specularRect, frag.xy); - - if (spec.a > 0.0) - { - dlit *= min(da*6.0, 1.0) * dist_atten; - - vec3 npos = -normalize(pos); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += dlit*scol*spec.rgb; - //col += spec.rgb; - } - } - - if (envIntensity > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc /= stc.w; - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity; - } - } - } - } -#endif - - //output linear, sum of lights will be gamma corrected later - frag_color.rgb = col; - frag_color.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl deleted file mode 100644 index fc1024f4f1..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file class1\deferred\pbralphaF.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2022, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0,1,0,0.5); -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl index a2ad1b70fb..da27be6e7f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl @@ -23,10 +23,10 @@ * $/LicenseInfo$ */ -#define DIFFUSE_ALPHA_MODE_IGNORE 0 -#define DIFFUSE_ALPHA_MODE_BLEND 1 -#define DIFFUSE_ALPHA_MODE_MASK 2 -#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 + +#ifndef IS_HUD + +// default alpha implementation #ifdef HAS_SKIN uniform mat4 modelview_matrix; @@ -38,13 +38,12 @@ uniform mat4 modelview_projection_matrix; #endif uniform mat4 texture_matrix0; -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - #if !defined(HAS_SKIN) - uniform mat4 modelview_matrix; - #endif - VARYING vec3 vary_position; +#if !defined(HAS_SKIN) +uniform mat4 modelview_matrix; #endif +out vec3 vary_position; + uniform mat3 texture_basecolor_matrix; uniform mat3 texture_normal_matrix; uniform mat3 texture_metallic_roughness_matrix; @@ -79,9 +78,7 @@ void main() mat4 mat = getObjectSkinnedTransform(); mat = modelview_matrix * mat; vec3 pos = (mat*vec4(position.xyz,1.0)).xyz; -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) vary_position = pos; -#endif vec4 vert = projection_matrix * vec4(pos,1.0); #else //transform vertex @@ -112,9 +109,46 @@ void main() vertex_color = diffuse_color; -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - #if !defined(HAS_SKIN) +#if !defined(HAS_SKIN) vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz; - #endif #endif } + +#else + +// fullbright HUD alpha implementation + +uniform mat4 modelview_projection_matrix; + +uniform mat4 texture_matrix0; + +uniform mat4 modelview_matrix; + +out vec3 vary_position; + +uniform mat3 texture_basecolor_matrix; +uniform mat3 texture_emissive_matrix; + +in vec3 position; +in vec4 diffuse_color; +in vec2 texcoord0; + +out vec2 basecolor_texcoord; +out vec2 emissive_texcoord; + +out vec4 vertex_color; + +void main() +{ + //transform vertex + vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_Position = vert; + vary_position = vert.xyz; + + basecolor_texcoord = (texture_matrix0 * vec4(texture_basecolor_matrix * vec3(texcoord0,1), 1)).xy; + emissive_texcoord = (texture_matrix0 * vec4(texture_emissive_matrix * vec3(texcoord0,1), 1)).xy; + + vertex_color = diffuse_color; +} + +#endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl new file mode 100644 index 0000000000..8dc9e02f7a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl @@ -0,0 +1,67 @@ +/** + * @file pbrglowF.glsl + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2023, 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$ + */ + +/*[EXTRA_CODE_HERE]*/ + +// forward fullbright implementation for HUDs + +uniform sampler2D diffuseMap; //always in sRGB space + +uniform vec3 emissiveColor; +uniform sampler2D emissiveMap; + +out vec4 frag_color; + +in vec3 vary_position; +in vec4 vertex_emissive; + +in vec2 basecolor_texcoord; +in vec2 emissive_texcoord; + +uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff() + +vec3 linear_to_srgb(vec3 c); +vec3 srgb_to_linear(vec3 c); + +void main() +{ + vec4 basecolor = texture2D(diffuseMap, basecolor_texcoord.xy).rgba; + + if (basecolor.a < minimum_alpha) + { + discard; + } + + vec3 emissive = emissiveColor; + emissive *= srgb_to_linear(texture2D(emissiveMap, emissive_texcoord.xy).rgb); + + float lum = max(max(emissive.r, emissive.g), emissive.b); + lum *= vertex_emissive.a; + + // HUDs are rendered after gamma correction, output in sRGB space + frag_color.rgb = vec3(0); + frag_color.a = lum; +} + diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl index d762239e51..75b24336c5 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl @@ -1,9 +1,9 @@ -/** - * @file emissiveV.glsl +/** + * @file pbgglowV.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2023, 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 @@ -23,44 +23,48 @@ * $/LicenseInfo$ */ -uniform mat4 texture_matrix0; + +#ifdef HAS_SKIN uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; +mat4 getObjectSkinnedTransform(); +#else uniform mat4 modelview_projection_matrix; +#endif -ATTRIBUTE vec3 position; -void passTextureIndex(); -ATTRIBUTE vec4 emissive; -ATTRIBUTE vec2 texcoord0; +uniform mat4 texture_matrix0; -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; +uniform mat3 texture_basecolor_matrix; +uniform mat3 texture_emissive_matrix; -void calcAtmospherics(vec3 inPositionEye); +in vec3 position; +in vec4 emissive; -#ifdef HAS_SKIN -mat4 getObjectSkinnedTransform(); -uniform mat4 projection_matrix; -#endif +in vec2 texcoord0; + +out vec2 basecolor_texcoord; +out vec2 emissive_texcoord; + +out vec4 vertex_emissive; void main() { - //transform vertex - passTextureIndex(); - #ifdef HAS_SKIN mat4 mat = getObjectSkinnedTransform(); + mat = modelview_matrix * mat; - vec4 pos = mat * vec4(position.xyz, 1.0); - gl_Position = projection_matrix * pos; + vec3 pos = (mat*vec4(position.xyz,1.0)).xyz; + + gl_Position = projection_matrix*vec4(pos,1.0); #else - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); + //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); #endif - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - - calcAtmospherics(pos.xyz); - vertex_color = emissive; + basecolor_texcoord = (texture_matrix0 * vec4(texture_basecolor_matrix * vec3(texcoord0,1), 1)).xy; + emissive_texcoord = (texture_matrix0 * vec4(texture_emissive_matrix * vec3(texcoord0,1), 1)).xy; + + vertex_emissive = emissive; } + diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index 39419e9d78..c4c5a7872b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -25,6 +25,11 @@ /*[EXTRA_CODE_HERE]*/ + +#ifndef IS_HUD + +// deferred opaque implementation + uniform sampler2D diffuseMap; //always in sRGB space uniform float metallicFactor; @@ -101,3 +106,48 @@ void main() frag_data[2] = vec4(encode_normal(tnorm), vertex_color.a, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags frag_data[3] = vec4(emissive,0); // PBR sRGB Emissive } + +#else + +// forward fullbright implementation for HUDs + +uniform sampler2D diffuseMap; //always in sRGB space + +uniform vec3 emissiveColor; +uniform sampler2D emissiveMap; + +out vec4 frag_color; + +in vec3 vary_position; +in vec4 vertex_color; + +in vec2 basecolor_texcoord; +in vec2 emissive_texcoord; + +uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff() + +vec3 linear_to_srgb(vec3 c); +vec3 srgb_to_linear(vec3 c); + +void main() +{ + vec4 basecolor = texture2D(diffuseMap, basecolor_texcoord.xy).rgba; + if (basecolor.a < minimum_alpha) + { + discard; + } + + vec3 col = vertex_color.rgb * srgb_to_linear(basecolor.rgb); + + vec3 emissive = emissiveColor; + emissive *= srgb_to_linear(texture2D(emissiveMap, emissive_texcoord.xy).rgb); + + col += emissive; + + // HUDs are rendered after gamma correction, output in sRGB space + frag_color.rgb = linear_to_srgb(col); + frag_color.a = 0.0; +} + +#endif + diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl index 5a69da641a..8320640e42 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl @@ -23,10 +23,10 @@ * $/LicenseInfo$ */ -#define DIFFUSE_ALPHA_MODE_IGNORE 0 -#define DIFFUSE_ALPHA_MODE_BLEND 1 -#define DIFFUSE_ALPHA_MODE_MASK 2 -#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 + +#ifndef IS_HUD + +//deferred opaque implementation #ifdef HAS_SKIN uniform mat4 modelview_matrix; @@ -95,3 +95,40 @@ void main() vertex_color = diffuse_color; } + +#else + +// fullbright HUD implementation + +uniform mat4 modelview_projection_matrix; + +uniform mat4 texture_matrix0; + +uniform mat3 texture_basecolor_matrix; +uniform mat3 texture_normal_matrix; +uniform mat3 texture_metallic_roughness_matrix; +uniform mat3 texture_emissive_matrix; + +in vec3 position; +in vec4 diffuse_color; +in vec2 texcoord0; + +out vec2 basecolor_texcoord; +out vec2 emissive_texcoord; + +out vec4 vertex_color; + +void main() +{ + //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + basecolor_texcoord = (texture_matrix0 * vec4(texture_basecolor_matrix * vec3(texcoord0,1), 1)).xy; + emissive_texcoord = (texture_matrix0 * vec4(texture_emissive_matrix * vec3(texcoord0,1), 1)).xy; + + vertex_color = diffuse_color; +} + +#endif + + diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl deleted file mode 100644 index a025c4a1b4..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file class1\deferred\pointLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -// debug stub -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.0, 0.5, 0.5, 0.0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl deleted file mode 100644 index 3da8531442..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file pointLightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; -uniform mat4 modelview_matrix; - -ATTRIBUTE vec3 position; - -uniform vec3 center; -uniform float size; - -VARYING vec4 vary_fragcoord; -VARYING vec3 trans_center; - -void main() -{ - //transform vertex - vec3 p = position*size+center; - vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0); - vary_fragcoord = pos; - trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz; - gl_Position = pos; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl deleted file mode 100644 index 8111f43c28..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @file postgiF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - - #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform sampler2D giLightMap; -uniform sampler2D noiseMap; - -uniform vec2 kern[32]; -uniform float dist_factor; -uniform float blur_size; -uniform vec2 delta; -uniform int kern_length; -uniform float kern_scale; -uniform vec3 blur_quad; - -VARYING vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 norm = texture2D(normalMap, vary_fragcoord.xy).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - vec3 pos = getPosition(vary_fragcoord.xy).xyz; - - vec3 ccol = texture2D(giLightMap, vary_fragcoord.xy).rgb; - vec2 dlt = kern_scale * delta/(1.0+norm.xy*norm.xy); - dlt /= max(-pos.z*dist_factor, 1.0); - float defined_weight = kern[0].x; - vec3 col = vec3(0.0); - - for (int i = 0; i < kern_length; i++) - { - vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; - vec3 sampNorm = texture2D(normalMap, tc.xy).xyz; - sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm - - float d = dot(norm.xyz, sampNorm); - - if (d > 0.8) - { - vec3 samppos = getPosition(tc.xy).xyz; - samppos -= pos; - if (dot(samppos,samppos) < -0.05*pos.z) - { - col += texture2D(giLightMap, tc).rgb*kern[i].x; - defined_weight += kern[i].x; - } - } - } - - col /= defined_weight; - - //col = ccol; - - col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z; - - frag_color.rgb = col; - -#ifdef IS_AMD_CARD - // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. - vec2 dummy1 = kern[0]; - vec2 dummy2 = kern[31]; -#endif -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl deleted file mode 100644 index 2ffe688524..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file class1/deferred/reflectionProbeF.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2022, 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$ - */ - -// fallback stub -- will be used if actual reflection probe shader failed to load (output pink so it's obvious) -void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool errorCorrect) -{ - ambenv = vec3(1,0,1); - glossenv = vec3(1,0,1); -} - -void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness) -{ - sampleReflectionProbes(ambenv, glossenv, - pos, norm, glossiness, false); -} - -vec4 sampleReflectionProbesDebug(vec3 pos) -{ - //output green to debug display - return vec4(0, 1, 0, 0.5); -} - -void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec3 pos, vec3 norm, float glossiness, float envIntensity) -{ - ambenv = vec3(1,0,1); - glossenv = vec3(1,0,1); - legacyenv = vec3(1,0,1); -} - -void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm) -{ - -} - -void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity) -{ - -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl deleted file mode 100644 index df16e7f0e7..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file class3/deferred/screenSpaceReflPostF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - // debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.5, 0.4, 0.1, 0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl deleted file mode 100644 index 966e7e1cbb..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file class3/deferred/screenSpaceReflPostV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -uniform vec2 screen_res; - -VARYING vec2 vary_fragcoord; - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - - vary_fragcoord = pos.xy * 0.5 + 0.5; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl index cd49202f89..fffbdb913e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl @@ -59,12 +59,12 @@ float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, stc.xyz /= stc.w; stc.z += offset * 2.0; stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*shadow_res.y))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here - float cs = shadow2D(shadowMap, stc.xyz).x; + float cs = texture(shadowMap, stc.xyz).x; float shadow = cs * 4.0; - shadow += shadow2D(shadowMap, stc.xyz+vec3( 1.5/shadow_res.x, 0.5/shadow_res.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3( 0.5/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.5/shadow_res.x, -0.5/shadow_res.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(-0.5/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3( 1.5/shadow_res.x, 0.5/shadow_res.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3( 0.5/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3(-1.5/shadow_res.x, -0.5/shadow_res.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3(-0.5/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; return clamp(shadow * 0.125, 0.0, 1.0); #else return 1.0; @@ -78,16 +78,16 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 stc.z += spot_shadow_bias * bias_scale; stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap - float cs = shadow2D(shadowMap, stc.xyz).x; + float cs = texture(shadowMap, stc.xyz).x; float shadow = cs; vec2 off = 1.0/proj_shadow_res; off.y *= 1.5; - shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, -off.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x; + shadow += texture(shadowMap, stc.xyz+vec3(-off.x*2.0, -off.y, 0.0)).x; return shadow*0.2; #else return 1.0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index adc2db60b6..930338cefb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -25,6 +25,17 @@ /*[EXTRA_CODE_HERE]*/ +// Inputs +VARYING vec3 vary_HazeColor; +VARYING float vary_LightNormPosDot; + +uniform sampler2D rainbow_map; +uniform sampler2D halo_map; + +uniform float moisture_level; +uniform float droplet_radius; +uniform float ice_level; + #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[3]; #else @@ -35,11 +46,35 @@ out vec4 frag_data[3]; // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -VARYING vec3 vary_HazeColor; + +vec3 rainbow(float d) +{ + // 'Interesting' values of d are -0.75 .. -0.825, i.e. when view vec nearly opposite of sun vec + // Rainbox tex is mapped with REPEAT, so -.75 as tex coord is same as 0.25. -0.825 -> 0.175. etc. + // SL-13629 + // Unfortunately the texture is inverted, so we need to invert the y coord, but keep the 'interesting' + // part within the same 0.175..0.250 range, i.e. d = (1 - d) - 1.575 + d = clamp(-0.575 - d, 0.0, 1.0); + + // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. + // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate + // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 + float interior_coord = max(0.0, d - 0.25) * 4.2857; + d = clamp(d, 0.0, 0.25) + interior_coord; + + float rad = (droplet_radius - 5.0f) / 1024.0f; + return pow(texture2D(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level; +} + +vec3 halo22(float d) +{ + d = clamp(d, 0.1, 1.0); + float v = sqrt(clamp(1 - (d * d), 0, 1)); + return texture2D(halo_map, vec2(0, v)).rgb * ice_level; +} /// Soft clips the light with a gamma correction vec3 scaleSoftClip(vec3 light); -vec3 srgb_to_linear(vec3 c); void main() { @@ -48,17 +83,19 @@ void main() // the fragment) if the sky wouldn't show up because the clouds // are fully opaque. - vec3 color; - color = vary_HazeColor; + vec3 color = vary_HazeColor; + float rel_pos_lightnorm = vary_LightNormPosDot; + float optic_d = rel_pos_lightnorm; + vec3 halo_22 = halo22(optic_d); + color.rgb += rainbow(optic_d); + color.rgb += halo_22; color.rgb *= 2.; color.rgb = scaleSoftClip(color.rgb); - /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, 0.0); + // Gamma correct for WL (soft clip effect). + frag_data[0] = vec4(color.rgb, 1.0); frag_data[1] = vec4(0.0,0.0,0.0,0.0); frag_data[2] = vec4(0.0,0.0,0.0,GBUFFER_FLAG_SKIP_ATMOS); //1.0 in norm.w masks off fog - - gl_FragDepth = 0.99999f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index ff53646fd4..1424b57d6f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -33,6 +33,7 @@ ATTRIBUTE vec3 position; // Output parameters VARYING vec3 vary_HazeColor; +VARYING float vary_LightNormPosDot; // Inputs uniform vec3 camPosLocal; @@ -70,30 +71,32 @@ void main() vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); // Adj position vector to clamp altitude - if (rel_pos.y > 0) + if (rel_pos.y > 0.) { rel_pos *= (max_y / rel_pos.y); } - if (rel_pos.y < 0) + if (rel_pos.y < 0.) { rel_pos *= (-32000. / rel_pos.y); } - // Can normalize then - vec3 rel_pos_norm = normalize(rel_pos); + // Normalized + vec3 rel_pos_norm = normalize(rel_pos); + float rel_pos_len = length(rel_pos); - float rel_pos_len = length(rel_pos); + // Grab this value and pass to frag shader for rainbows + float rel_pos_lightnorm_dot = dot(rel_pos_norm, lightnorm.xyz); + vary_LightNormPosDot = rel_pos_lightnorm_dot; // Initialize temp variables vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color; - vec3 light_atten; // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); + vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); // Calculate relative weights - vec3 combined_haze = abs(blue_density) + vec4(abs(haze_density)); + vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); vec3 blue_weight = blue_density / combined_haze; vec3 haze_weight = haze_density / combined_haze; @@ -110,7 +113,7 @@ void main() combined_haze = exp(-combined_haze * density_dist); // Compute haze glow - float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); + float haze_glow = 1.0 - rel_pos_lightnorm_dot; // haze_glow is 0 at the sun and increases away from sun haze_glow = max(haze_glow, .001); // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) @@ -121,30 +124,30 @@ void main() // Add "minimum anti-solar illumination" // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); + haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (sun_moon_glow_factor * (haze_glow + 0.25)); - vec3 color = - (blue_horizon * blue_weight * (sunlight + ambient_color) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color)); + // Haze color above cloud + vec3 color = (blue_horizon * blue_weight * (sunlight + ambient_color) + + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color)); // Final atmosphere additive color *= (1. - combined_haze); // Increase ambient when there are more clouds - vec3 tmpAmbient = ambient_color; - tmpAmbient += max(vec3(0), (1. - ambient_color)) * cloud_shadow * 0.5; + vec3 ambient = ambient_color + max(vec3(0), (1. - ambient_color)) * cloud_shadow * 0.5; // Dim sunlight by cloud shadow percentage sunlight *= max(0.0, (1. - cloud_shadow)); // Haze color below cloud - vec3 additiveColorBelowCloud = - (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); + vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) + + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient)); // Attenuate cloud color by atmosphere combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds // At horizon, blend high altitude sky color towards the darker color below the clouds - color += (additiveColorBelowCloud - color) * (1. - sqrt(combined_haze)); + color += (add_below_cloud - color) * (1. - sqrt(combined_haze)); // Haze color above cloud vary_HazeColor = color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl deleted file mode 100644 index 152402907b..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @file class1/deferred/softenLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D normalMap; -uniform sampler2D lightMap; -uniform sampler2D depthMap; -uniform samplerCube environmentMap; -uniform sampler2D lightFunc; - -uniform float blur_size; -uniform float blur_fidelity; - -// Inputs -uniform mat3 env_mat; - -uniform vec3 sun_dir; -uniform vec3 moon_dir; -uniform int sun_up_factor; -VARYING vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec3 getNorm(vec2 pos_screen); -vec4 getPositionWithDepth(vec2 pos_screen, float depth); -float getDepth(vec2 pos_screen); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); -float getAmbientClamp(); -vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleSoftClipFrag(vec3 l); -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); - -vec3 linear_to_srgb(vec3 c); -vec3 srgb_to_linear(vec3 c); - -#ifdef WATER_FOG -vec4 applyWaterFogView(vec3 pos, vec4 color); -#endif - -void main() -{ - vec2 tc = vary_fragcoord.xy; - float depth = getDepth(tc); - vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2D(normalMap, tc); - float envIntensity = norm.z; - norm.xyz = getNorm(tc); - - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); - float light_gamma = 1.0/1.3; - da = pow(da, light_gamma); - - vec4 diffuse = texture2D(diffuseRect, tc); - - //convert to gamma space - diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 - - vec4 spec = texture2D(specularRect, vary_fragcoord.xy); - vec3 color = vec3(0); - float bloom = 0.0; - { - float ambocc = 1.0; // no AO... - - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - - calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, false); - - color.rgb = amblit; - - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - color.rgb *= ambient; - - vec3 sun_contrib = da * sunlit; - - color.rgb += sun_contrib; - - color.rgb *= diffuse.rgb; - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - - if (spec.a > 0.0) // specular reflection - { - float sa = dot(refnormpersp, light_dir.xyz); - vec3 dumbshiny = sunlit * (texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - color.rgb += spec_contrib; - } - - color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); - - if (envIntensity > 0.0) - { //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; - color = mix(color.rgb, reflected_color, envIntensity); - } - - if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS)) - { - color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a); - color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a); - } - - #ifdef WATER_FOG - vec4 fogged = applyWaterFogView(pos.xyz,vec4(color, bloom)); - color = fogged.rgb; - bloom = fogged.a; - #endif - - } - - // convert to linear as fullscreen lights need to sum in linear colorspace - // and will be gamma (re)corrected downstream... - - frag_color.rgb = srgb_to_linear(color.rgb); - frag_color.a = bloom; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl deleted file mode 100644 index 23ad332db4..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file softenLightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -uniform vec2 screen_res; - -void setAtmosAttenuation(vec3 c); -void setAdditiveColor(vec3 c); - -VARYING vec2 vary_fragcoord; -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - // appease OSX GLSL compiler/linker by touching all the varyings we said we would - setAtmosAttenuation(vec3(1)); - setAdditiveColor(vec3(0)); - vary_fragcoord = (pos.xy*0.5+0.5); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl deleted file mode 100644 index 0376f42319..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ /dev/null @@ -1,278 +0,0 @@ -/** - * @file spotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -//class 1 -- no shadows - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform samplerCube environmentMap; -uniform sampler2D noiseMap; -uniform sampler2D projectionMap; -uniform sampler2D lightFunc; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; - -uniform float size; -uniform vec3 color; -uniform float falloff; - -VARYING vec3 trans_center; -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; - -vec3 getNorm(vec2 pos_screen); -vec3 srgb_to_linear(vec3 c); - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - d *= min(1, d * (proj_lod - lod)); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 col = vec3(0,0,0); - -#if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = trans_center.xyz-pos.xyz; - float dist = length(lv); - dist /= size; - if (dist > 1.0) - { - discard; - } - - vec3 norm = texture2D(normalMap, frag.xy).xyz; - float envIntensity = norm.z; - norm = getNorm(frag.xy); - norm = normalize(norm); - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z < 0.0) - { - discard; - } - - proj_tc.xyz /= proj_tc.w; - - float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - - if (dist_atten <= 0.0) - { - discard; - } - - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; - //light shaders output linear and are gamma corrected later in postDeferredGammaCorrectF.glsl - diff_tex.rgb = srgb_to_linear(diff_tex.rgb); - - vec4 spec = texture2D(specularRect, frag.xy); - - float noise = texture2D(noiseMap, frag.xy).b; - vec3 dlit = vec3(0, 0, 0); - - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float amb_da = proj_ambiance; - float lit = 0.0; - - if (da > 0.0) - { - lit = da * dist_atten * noise; - - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - dlit = color.rgb * plcol.rgb * plcol.a; - - col = dlit*lit*diff_tex; - //amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; - } - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5)*proj_ambiance; - - amb_da *= dist_atten * noise; - - amb_da = min(amb_da, 1.0-lit); - col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a*diff_tex.rgb; - } - - if (spec.a > 0.0) - { - dlit *= min(da*6.0, 1.0) * dist_atten; - vec3 npos = -normalize(pos); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += dlit*scol*spec.rgb; - //col += spec.rgb; - } - } - - if (envIntensity > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc /= stc.w; - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity; - } - } - } - } -#endif - - //col.r = 1.0; - frag_color.rgb = col; - frag_color.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index 152316c117..cdafdba15c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -65,7 +65,5 @@ void main() frag_data[0] = col; frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); - - gl_FragDepth = LL_SHADER_CONST_STAR_DEPTH; // SL-14113 Moon Haze -- Stars need to depth test behind the moon } diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl index bb2a2ee72b..37d1630252 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -40,8 +40,10 @@ void main() //transform vertex vec4 pos = modelview_projection_matrix * vec4(position, 1.0); -// bias z to fix SL-9806 and get stars to depth test against clouds - pos.z += 0.001f; + + // smash to far clip plane to + // avoid rendering on top of moon (do NOT write to gl_FragDepth, it's slow) + pos.z = pos.w; gl_Position = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 4ab8747629..e35ea83f0a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -58,7 +58,5 @@ void main() frag_data[0] = c; frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); - - gl_FragDepth = 0.999988f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl index 0d117c6bc7..d3dfa882f0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl @@ -44,6 +44,8 @@ void main() sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f); + // smash to *almost* far clip plane -- behind clouds but in front of stars + pos.z = pos.w*0.999999; gl_Position = pos; calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl deleted file mode 100644 index 7329efe3f7..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file sunLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -//class 1, no shadow, no SSAO, should never be called - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -void main() -{ - frag_color = vec4(0,0,0,0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl deleted file mode 100644 index d9a0b6c702..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file sunLightSSAOF.glsl - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -//class 1 -- no shadow, SSAO only - -uniform sampler2D normalMap; - -// Inputs -VARYING vec2 vary_fragcoord; - -vec3 getNorm(vec2 pos_screen); -vec4 getPosition(vec2 pos_screen); - -//calculate decreases in ambient lighting when crowded out (SSAO) -float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen); - -void main() -{ - vec2 pos_screen = vary_fragcoord.xy; - - //try doing an unproject here - - vec4 pos = getPosition(pos_screen); - vec3 norm = getNorm(pos_screen); - - frag_color[0] = 1.0; - frag_color[1] = calcAmbientOcclusion(pos, norm, pos_screen); - frag_color[2] = 1.0; - frag_color[3] = 1.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl deleted file mode 100644 index 9d70b9d98d..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file sunLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -VARYING vec2 vary_fragcoord; - -uniform vec2 screen_res; - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - - vary_fragcoord = (pos.xy * 0.5 + 0.5); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl deleted file mode 100644 index 14c337e608..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file underWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif - -uniform sampler2D diffuseMap; -uniform sampler2D bumpMap; -uniform sampler2D screenTex; -uniform sampler2D refTex; -uniform sampler2D screenDepth; - -uniform vec4 fogCol; -uniform vec3 lightDir; -uniform vec3 specular; -uniform float lightExp; -uniform vec2 fbScale; -uniform float refScale; -uniform float znear; -uniform float zfar; -uniform float kd; -uniform vec4 waterPlane; -uniform vec3 eyeVec; -uniform vec4 waterFogColor; -uniform float waterFogDensity; -uniform float waterFogKS; -uniform vec2 screenRes; - -//bigWave is (refCoord.w, view.w); -VARYING vec4 refCoord; -VARYING vec4 littleWave; -VARYING vec4 view; - -vec2 encode_normal(vec3 n); - -void main() -{ - vec4 color; - - //get detail normals - vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; - vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; - vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; - vec3 wavef = normalize(wave1+wave2+wave3); - - //figure out distortion vector (ripply) - vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; - distort = distort+wavef.xy*refScale; - - vec4 fb = texture2D(screenTex, distort); - - frag_data[0] = vec4(fb.rgb, 1.0); // diffuse - frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec - frag_data[2] = vec4(encode_normal(wavef), 0.0, GBUFFER_FLAG_HAS_ATMOS); // normalxyz, env intens, flags (atmo kill) -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl deleted file mode 100644 index 876422f86b..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file class1/deferred/waterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -// debug stub -out vec4 frag_data[4]; - -void main() -{ - // emissive blue PBR material - frag_data[0] = vec4(0, 0, 0, 0); - frag_data[1] = vec4(0, 0, 0, 0); - frag_data[2] = vec4(1, 0, 0, GBUFFER_FLAG_HAS_PBR); - frag_data[3] = vec4(0, 0, 1, 0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl deleted file mode 100644 index 38276859a0..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @file waterV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; - - -void calcAtmospherics(vec3 inPositionEye); - -uniform vec2 waveDir1; -uniform vec2 waveDir2; -uniform float time; -uniform vec3 eyeVec; -uniform float waterHeight; - -VARYING vec4 refCoord; -VARYING vec4 littleWave; -VARYING vec4 view; - -VARYING vec4 vary_position; - -float wave(vec2 v, float t, float f, vec2 d, float s) -{ - return (dot(d, v)*f + t*s)*f; -} - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - mat4 modelViewProj = modelview_projection_matrix; - - vec4 oPosition; - - //get view vector - vec3 oEyeVec; - oEyeVec.xyz = pos.xyz-eyeVec; - - float d = length(oEyeVec.xy); - float ld = min(d, 2560.0); - - pos.xy = eyeVec.xy + oEyeVec.xy/d*ld; - view.xyz = oEyeVec; - - d = clamp(ld/1536.0-0.5, 0.0, 1.0); - d *= d; - - oPosition = vec4(position, 1.0); -// oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon - vary_position = modelview_matrix * oPosition; - oPosition = modelViewProj * oPosition; - - refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); - - //get wave position parameter (create sweeping horizontal waves) - vec3 v = pos.xyz; - v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; - - //push position for further horizon effect. - pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); - pos.w = 1.0; - pos = modelview_matrix*pos; - - calcAtmospherics(pos.xyz); - - //pass wave parameters to pixel shader - vec2 bigWave = (v.xy) * vec2(0.04,0.04) + waveDir1 * time * 0.055; - //get two normal map (detail map) texture coordinates - littleWave.xy = (v.xy) * vec2(0.45, 0.9) + waveDir2 * time * 0.13; - littleWave.zw = (v.xy) * vec2(0.1, 0.2) + waveDir1 * time * 0.1; - view.w = bigWave.y; - refCoord.w = bigWave.x; - - gl_Position = oPosition; -} diff --git a/indra/newview/app_settings/shaders/class1/environment/moonF.glsl b/indra/newview/app_settings/shaders/class1/environment/moonF.glsl deleted file mode 100644 index a220971f06..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/moonF.glsl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file class1/environment/moonF.glsl - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2021, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D tex0; - -VARYING vec2 vary_texcoord0; - -// See: -// AS off: class1/environment/moonF.glsl -// ALM off: class1/windlight/moonF.glsl -// ALM on : class1/deferred/moonF.glsl -void main() -{ - vec4 color = texture2D(tex0, vary_texcoord0.xy); - - // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible - // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> - if (color.a <= 2./255.) // 0.00784 - discard; - - frag_color = color; - gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 Moon is infront of stars -} diff --git a/indra/newview/app_settings/shaders/class1/environment/moonV.glsl b/indra/newview/app_settings/shaders/class1/environment/moonV.glsl deleted file mode 100644 index c00f202c23..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/moonV.glsl +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file class1\environment\moonV.glsl - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2021, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -VARYING vec2 vary_texcoord0; - -void main() -{ - gl_Position = modelview_projection_matrix * vec4(position, 1); - vary_texcoord0 = texcoord0; -} - diff --git a/indra/newview/app_settings/shaders/class1/environment/starsF.glsl b/indra/newview/app_settings/shaders/class1/environment/starsF.glsl deleted file mode 100644 index e1a9cc6387..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/starsF.glsl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file class1/environment/starsF.glsl - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2021, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; - -uniform float custom_alpha; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -// See: -// ALM off: class1/environment/starsF.glsl -// ALM on : class1/deferred/starsF.glsl -void main() -{ - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); - color.rgb = pow(color.rgb, vec3(0.45)); - color.rgb *= vertex_color.rgb; - color.a *= max(custom_alpha, vertex_color.a); - - frag_color = color; - gl_FragDepth = LL_SHADER_CONST_STAR_DEPTH; // SL-14113 Moon Haze -- Stars need to depth test behind the moon -} diff --git a/indra/newview/app_settings/shaders/class1/environment/starsV.glsl b/indra/newview/app_settings/shaders/class1/environment/starsV.glsl deleted file mode 100644 index 6fcfec6b6a..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/starsV.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file class1/environment/starsV.glsl - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2021, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void main() -{ - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = texcoord0; - vertex_color = diffuse_color; -} - diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl deleted file mode 100644 index 6b68ed4169..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file class1\environment\terrainF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec4 vary_texcoord0; -VARYING vec4 vary_texcoord1; - -uniform sampler2D detail_0; -uniform sampler2D detail_1; -uniform sampler2D detail_2; -uniform sampler2D detail_3; -uniform sampler2D alpha_ramp; - -vec3 atmosLighting(vec3 light); - -vec3 scaleSoftClip(vec3 color); - -void main() -{ - /// Note: This should duplicate the blending functionality currently used for the terrain rendering. - - /// TODO Confirm tex coords and bind them appropriately in vert shader. - vec4 color0 = texture2D(detail_0, vary_texcoord0.xy); - vec4 color1 = texture2D(detail_1, vary_texcoord0.xy); - vec4 color2 = texture2D(detail_2, vary_texcoord0.xy); - vec4 color3 = texture2D(detail_3, vary_texcoord0.xy); - - float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a; - float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a; - float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; - vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); - - /// Add WL Components - outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); - - frag_color = vec4(scaleSoftClip(outColor.rgb), 1.0); -} - diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl deleted file mode 100644 index ef27848d37..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @file class1\environment\terrainV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -uniform vec4 object_plane_t; -uniform vec4 object_plane_s; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec2 texcoord1; -ATTRIBUTE vec4 diffuse_color; - -VARYING vec4 vertex_color; -VARYING vec4 vary_texcoord0; -VARYING vec4 vary_texcoord1; - -void calcAtmospherics(vec3 inPositionEye); - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); - -vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) -{ - vec4 tcoord; - - tcoord.x = dot(vpos, tp0); - tcoord.y = dot(vpos, tp1); - tcoord.z = tc.z; - tcoord.w = tc.w; - - tcoord = mat * tcoord; - - return tcoord; -} - -void main() -{ - //transform vertex - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - - vec4 pos = modelview_matrix * vec4(position.xyz, 1.0); - vec3 norm = normalize(normal_matrix * normal); - - calcAtmospherics(pos.xyz); - - /// Potentially better without it for water. - pos /= pos.w; - - vec4 color = calcLighting(pos.xyz, norm, /*diffuse_color*/vec4(1)); - - vertex_color = color; - - // Transform and pass tex coords - vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy; - - vec4 t = vec4(texcoord1,0,1); - - vary_texcoord0.zw = t.xy; - vary_texcoord1.xy = t.xy-vec2(2.0, 0.0); - vary_texcoord1.zw = t.xy-vec2(1.0, 0.0); -} - diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl deleted file mode 100644 index e53bb46177..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file class1\environment\terrainWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec4 vary_texcoord0; -VARYING vec4 vary_texcoord1; - -uniform sampler2D detail_0; -uniform sampler2D detail_1; -uniform sampler2D detail_2; -uniform sampler2D detail_3; -uniform sampler2D alpha_ramp; - -vec3 atmosLighting(vec3 light); - -vec4 applyWaterFog(vec4 color); - -void main() -{ - /// Note: This should duplicate the blending functionality currently used for the terrain rendering. - - /// TODO Confirm tex coords and bind them appropriately in vert shader. - vec4 color0 = texture2D(detail_0, vary_texcoord0.xy); - vec4 color1 = texture2D(detail_1, vary_texcoord0.xy); - vec4 color2 = texture2D(detail_2, vary_texcoord0.xy); - vec4 color3 = texture2D(detail_3, vary_texcoord0.xy); - - float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a; - float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a; - float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; - vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); - - /// Add WL Components - outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); - - outColor = applyWaterFog(outColor); - frag_color = outColor; -} diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterV.glsl deleted file mode 100644 index a075cfeef2..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterV.glsl +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file class1\environment\terrainV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -uniform vec4 object_plane_t; -uniform vec4 object_plane_s; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec2 texcoord1; -ATTRIBUTE vec4 diffuse_color; - -VARYING vec4 vertex_color; -VARYING vec4 vary_texcoord0; -VARYING vec4 vary_texcoord1; - -void calcAtmospherics(vec3 inPositionEye); -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); - -vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) -{ - vec4 tcoord; - - tcoord.x = dot(vpos, tp0); - tcoord.y = dot(vpos, tp1); - tcoord.z = tc.z; - tcoord.w = tc.w; - - tcoord = mat * tcoord; - - return tcoord; -} - -void main() -{ - //transform vertex - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - - vec4 pos = modelview_matrix * vec4(position.xyz, 1.0); - vec3 norm = normalize(normal_matrix * normal); - - calcAtmospherics(pos.xyz); - - vec4 color = calcLighting(pos.xyz, norm, vec4(1.0)); - - vertex_color.rgb = color.rgb; - - // Transform and pass tex coords - vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy; - - vec4 t = vec4(texcoord1,0,1); - - vary_texcoord0.zw = t.xy; - vary_texcoord1.xy = t.xy-vec2(2.0, 0.0); - vary_texcoord1.zw = t.xy-vec2(1.0, 0.0); -} - diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl deleted file mode 100644 index ad105c616c..0000000000 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file class1\environment\underWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -out vec4 frag_color; - -// debug stub -void main() -{ - frag_color = vec4(0, 1, 1, 0); -} diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 46a6c2021d..075397d96c 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -1,9 +1,9 @@ /** * @file waterF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2023, 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 @@ -22,10 +22,13 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + + // error fallback on compilation failure + out vec4 frag_color; void main() { - frag_color = vec4(0, 0, 1, 0); + frag_color = vec4(1,0,1,1); } + diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index e1cdeddcea..16651dcdbc 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -72,13 +72,8 @@ vec4 applyWaterFogView(vec3 pos, vec4 color) return color; } -vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit) +vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit) { - if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0) - { - return color; - } - vec3 view = normalize(pos); //normalize view vector float es = -(dot(view, waterPlane.xyz)); @@ -97,7 +92,7 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit) //get "thickness" of water float l = max(depth, 0.1); - float kd = waterFogDensity; + float kd = waterFogDensity*1.3; float ks = waterFogKS; vec4 kc = waterFogColor; kc.rgb = srgb_to_linear(kc.rgb); // TODO -- pass in waterFogColor linear @@ -118,6 +113,16 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit) return color; } +vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit) +{ + if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0) + { + return color; + } + + return applyWaterFogViewLinearNoClip(pos, color, sunlit); +} + vec4 applyWaterFogViewLinear(vec3 pos, vec4 color) { return applyWaterFogViewLinear(pos, color, vec3(1)); diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl deleted file mode 100644 index f6b31a5956..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file customalphaF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; - -uniform float custom_alpha; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void main() -{ - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); - color.rgb = pow(color.rgb, vec3(0.45)); - color.rgb *= vertex_color.rgb; - color.a *= max(custom_alpha, vertex_color.a); - frag_color = color; -} diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl deleted file mode 100644 index 890474d6d8..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file customalphaV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void main() -{ - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = texcoord0; - vertex_color = diffuse_color; -} - diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl deleted file mode 100644 index f8efd7cb4a..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file debugF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D depthMap; - -VARYING vec2 tc0; -VARYING vec2 tc1; -VARYING vec2 tc2; -VARYING vec2 tc3; -VARYING vec2 tc4; -VARYING vec2 tc5; -VARYING vec2 tc6; -VARYING vec2 tc7; -VARYING vec2 tc8; - -void main() -{ - vec4 depth1 = - vec4(texture2D(depthMap, tc0).r, - texture2D(depthMap, tc1).r, - texture2D(depthMap, tc2).r, - texture2D(depthMap, tc3).r); - - vec4 depth2 = - vec4(texture2D(depthMap, tc4).r, - texture2D(depthMap, tc5).r, - texture2D(depthMap, tc6).r, - texture2D(depthMap, tc7).r); - - depth1 = min(depth1, depth2); - float depth = min(depth1.x, depth1.y); - depth = min(depth, depth1.z); - depth = min(depth, depth1.w); - depth = min(depth, texture2D(depthMap, tc8).r); - - gl_FragDepth = depth; -} diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl deleted file mode 100644 index 99662097bb..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @file debugF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D depthMap; - -VARYING vec2 tc0; -VARYING vec2 tc1; -VARYING vec2 tc2; -VARYING vec2 tc3; -VARYING vec2 tc4; -VARYING vec2 tc5; -VARYING vec2 tc6; -VARYING vec2 tc7; -VARYING vec2 tc8; - -void main() -{ - vec4 depth1 = - vec4(texture2D(depthMap, tc0).r, - texture2D(depthMap, tc1).r, - texture2D(depthMap, tc2).r, - texture2D(depthMap, tc3).r); - - vec4 depth2 = - vec4(texture2D(depthMap, tc4).r, - texture2D(depthMap, tc5).r, - texture2D(depthMap, tc6).r, - texture2D(depthMap, tc7).r); - - depth1 = min(depth1, depth2); - float depth = min(depth1.x, depth1.y); - depth = min(depth, depth1.z); - depth = min(depth, depth1.w); - depth = min(depth, texture2D(depthMap, tc8).r); - - gl_FragDepth = depth; -} diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl deleted file mode 100644 index e104377037..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file debugV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; - -uniform vec2 screen_res; - -uniform vec2 delta; - -VARYING vec2 tc0; -VARYING vec2 tc1; -VARYING vec2 tc2; -VARYING vec2 tc3; -VARYING vec2 tc4; -VARYING vec2 tc5; -VARYING vec2 tc6; -VARYING vec2 tc7; -VARYING vec2 tc8; - -void main() -{ - gl_Position = vec4(position, 1.0); - - vec2 tc = (position.xy*0.5+0.5); - tc0 = tc+vec2(-delta.x,-delta.y); - tc1 = tc+vec2(0,-delta.y); - tc2 = tc+vec2(delta.x,-delta.y); - tc3 = tc+vec2(-delta.x,0); - tc4 = tc+vec2(0,0); - tc5 = tc+vec2(delta.x,0); - tc6 = tc+vec2(-delta.x,delta.y); - tc7 = tc+vec2(0,delta.y); - tc8 = tc+vec2(delta.x,delta.y); -} - diff --git a/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl deleted file mode 100644 index 2b1e794b52..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file irradianceGenF.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2022, 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$ - */ - -// debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.5, 0, 0.5, 0); -} diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl deleted file mode 100644 index 415181126b..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file onetexturenocolorF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D tex0; - -VARYING vec2 vary_texcoord0; - -void main() -{ - frag_color = texture2D(tex0, vary_texcoord0.xy); -} diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl deleted file mode 100644 index 6b9986c8d7..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file onetexturenocolorV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -VARYING vec2 vary_texcoord0; - -void main() -{ - gl_Position = modelview_projection_matrix * vec4(position, 1); - vary_texcoord0 = texcoord0; -} - diff --git a/indra/newview/app_settings/shaders/class1/interface/reflectionprobeF.glsl b/indra/newview/app_settings/shaders/class1/interface/reflectionprobeF.glsl deleted file mode 100644 index e2e0a2002b..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/reflectionprobeF.glsl +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file reflectionprobeF.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2022, 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$ - */ - -// debug stub -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0,1,0,0.5); -} diff --git a/indra/newview/app_settings/shaders/class1/interface/reflectionprobeV.glsl b/indra/newview/app_settings/shaders/class1/interface/reflectionprobeV.glsl deleted file mode 100644 index 0efbd63944..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/reflectionprobeV.glsl +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file reflectionprobeV.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - - // Debug stub - -ATTRIBUTE vec3 position; - -void main() -{ - gl_Position = vec4(position, 1.0); -} - diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl deleted file mode 100644 index bf6c1b355c..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file splattexturerectF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D screenMap; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void main() -{ - frag_color = texture2D(screenMap, vary_texcoord0.xy) * vertex_color; -} diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl deleted file mode 100644 index 95679e93e7..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file twotextureaddF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D tex0; -uniform sampler2D tex1; - -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; - -void main() -{ - frag_color = texture2D(tex0, vary_texcoord0.xy)+texture2D(tex1, vary_texcoord1.xy); -} diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl deleted file mode 100644 index 3c2f297f7f..0000000000 --- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file twotextureaddV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec2 texcoord1; - -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; - -void main() -{ - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = texcoord0; - vary_texcoord1 = texcoord1; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl index 0bb48061e0..b2c83a0f44 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl @@ -31,9 +31,6 @@ out vec4 frag_color; uniform float minimum_alpha; -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; -uniform int no_atmo; - vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); @@ -51,12 +48,8 @@ void default_lighting() color *= vertex_color; - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - color.rgb = atmosLighting(color.rgb); - color.rgb = scaleSoftClip(color.rgb); - } + color.rgb = atmosLighting(color.rgb); + color.rgb = scaleSoftClip(color.rgb); frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl deleted file mode 100644 index ad2170bbd3..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightAlphaMaskF.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform float minimum_alpha; -uniform float texture_gamma; // either 1.0 or 2.2; see: "::TEXTURE_GAMMA" - -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() -uniform int no_atmo; - -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void fullbright_lighting() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy); - - if (color.a < minimum_alpha) - { - discard; - } - - color *= vertex_color; - - color.rgb = pow(color.rgb, vec3(texture_gamma)); - - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - color.rgb = fullbrightAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); - } - - //*TODO: Are we missing an inverse pow() here? - // class1\lighting\lightFullbrightF.glsl has: - // color.rgb = pow(color.rgb, vec3(1.0/texture_gamma)); - - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl deleted file mode 100644 index 89be8195f0..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -uniform float texture_gamma; - -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; -uniform int no_atmo; - -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -void fullbright_lighting() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - - color.rgb = pow(color.rgb, vec3(texture_gamma)); - - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - color.rgb = fullbrightAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); - } - - color.rgb = pow(color.rgb, vec3(1.0/texture_gamma)); - - frag_color = color; - -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl deleted file mode 100644 index e8e71beb44..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightNonIndexedAlphaMaskF.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform float minimum_alpha; -uniform float texture_gamma; - -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -uniform sampler2D diffuseMap; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void fullbright_lighting() -{ - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); - - if (color.a < minimum_alpha) - { - discard; - } - - color.rgb *= vertex_color.rgb; - - color.rgb = pow(color.rgb, vec3(texture_gamma)); - color.rgb = fullbrightAtmosTransport(color.rgb); - - color.rgb = fullbrightScaleSoftClip(color.rgb); - - color.rgb = pow(color.rgb, vec3(1.0/texture_gamma)); - - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl deleted file mode 100644 index 11a0919086..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -uniform sampler2D diffuseMap; - -void fullbright_lighting() -{ - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; - - color.rgb = fullbrightAtmosTransport(color.rgb); - - color.rgb = fullbrightScaleSoftClip(color.rgb); - - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl deleted file mode 100644 index 5e966293c6..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; - -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() -uniform int no_atmo; - -vec3 fullbrightShinyAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -// See: -// class1\deferred\fullbrightShinyF.glsl -// class1\lighting\lightFullbrightShinyF.glsl -void fullbright_shiny_lighting() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low - - color.rgb = fullbrightShinyAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); - } -/* - // NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects. - else - { - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low - } -*/ - - color.a = 1.0; - - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl deleted file mode 100644 index 3118453342..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; -uniform sampler2D diffuseMap; - -vec3 fullbrightShinyAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -void fullbright_shiny_lighting() -{ - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); - - color.rgb = fullbrightShinyAtmosTransport(color.rgb); - - color.rgb = fullbrightScaleSoftClip(color.rgb); - - color.a = 1.0; - - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl deleted file mode 100644 index f78e5e0e8a..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightShinyWaterF.glsl - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; - -vec3 fullbrightShinyAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); -vec4 applyWaterFog(vec4 color); - -void fullbright_shiny_lighting_water() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); - - color.rgb = fullbrightShinyAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = 1.0; - - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl deleted file mode 100644 index 90668bd2b6..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightShinyWaterF.glsl - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; -uniform sampler2D diffuseMap; - -vec3 fullbrightShinyAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); -vec4 applyWaterFog(vec4 color); - -void fullbright_shiny_lighting_water() -{ - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); - - color.rgb = fullbrightShinyAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = 1.0; - - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl deleted file mode 100644 index 37cac5f437..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightWaterAlphaMaskF.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform float minimum_alpha; - -/* vec4 diffuseLookup(vec2 texcoord); */ - -vec3 fullbrightAtmosTransport(vec3 light); -vec4 applyWaterFog(vec4 color); - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void fullbright_lighting_water() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy); - - if (color.a < minimum_alpha) - { - discard; - } - - color.rgb *= vertex_color.rgb; - - color.rgb = fullbrightAtmosTransport(color.rgb); - - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl deleted file mode 100644 index 27880b720c..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -/* vec4 diffuseLookup(vec2 texcoord); */ - -vec3 fullbrightAtmosTransport(vec3 light); -vec4 applyWaterFog(vec4 color); - -void fullbright_lighting_water() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - - color.rgb = fullbrightAtmosTransport(color.rgb); - - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl deleted file mode 100644 index c98db4795c..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightWaterNonIndexedAlphaMaskF.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform float minimum_alpha; - -uniform sampler2D diffuseMap; - -vec3 fullbrightAtmosTransport(vec3 light); -vec4 applyWaterFog(vec4 color); - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void fullbright_lighting_water() -{ - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); - - if (color.a < minimum_alpha) - { - discard; - } - - color.rgb *= vertex_color.rgb; - - color.rgb = fullbrightAtmosTransport(color.rgb); - - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl deleted file mode 100644 index e9fd8ac820..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file class1\lighting\lightFullbrightWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -uniform sampler2D diffuseMap; - -vec3 fullbrightAtmosTransport(vec3 light); -vec4 applyWaterFog(vec4 color); - -void fullbright_lighting_water() -{ - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; - - color.rgb = fullbrightAtmosTransport(color.rgb); - - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl deleted file mode 100644 index f621a00785..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file class1\lighting\lightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; - -vec3 scaleSoftClip(vec3 light); -vec3 atmosLighting(vec3 light); -vec4 applyWaterFog(vec4 color); - -void shiny_lighting() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low - - color.rgb = atmosLighting(color.rgb); - - color.rgb = scaleSoftClip(color.rgb); - color.a = 1.0; - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl deleted file mode 100644 index 2b6f414005..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file class1\lighting\lightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; -uniform sampler2D diffuseMap; - -vec3 scaleSoftClip(vec3 light); -vec3 atmosLighting(vec3 light); -vec4 applyWaterFog(vec4 color); - -void shiny_lighting() -{ - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); - - color.rgb = atmosLighting(color.rgb); - - color.rgb = scaleSoftClip(color.rgb); - color.a = 1.0; - frag_color = color; -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl deleted file mode 100644 index 0f3371eba9..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file class1\lighting\lightShinyWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform samplerCube environmentMap; - -vec3 atmosLighting(vec3 light); -vec4 applyWaterFog(vec4 color); - -void shiny_lighting_water() -{ - vec4 color = diffuseLookup(vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); - - color.rgb = atmosLighting(color.rgb); - color.a = 1.0; - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl deleted file mode 100644 index c607fa64cb..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file class1\lighting\lightShinyWaterNonIndexedF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -uniform sampler2D diffuseMap; -uniform samplerCube environmentMap; - -vec3 atmosLighting(vec3 light); -vec4 applyWaterFog(vec4 color); - -void shiny_lighting_water() -{ - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); - color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); - - color.rgb = atmosLighting(color.rgb); - color.a = 1.0; - frag_color = applyWaterFog(color); -} - diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl deleted file mode 100644 index 5e39d1629d..0000000000 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file class1\lighting\lightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -// All lights, no specular highlights -vec3 atmosAmbient(); -vec4 sumLights(vec3 pos, vec3 norm, vec4 color); -float getAmbientClamp(); - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color) -{ - vec4 c = sumLights(pos, norm, color); - -#if !defined(AMBIENT_KILL) - c.rgb += atmosAmbient() * color.rgb * 0.5 * getAmbientClamp(); -#endif - - return c; -} - diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl deleted file mode 100644 index 31a262f1db..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file objects/fullbrightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$F - */ - - - -void fullbright_lighting(); - -void main() -{ - fullbright_lighting(); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl deleted file mode 100644 index 5d6f14230c..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file fullbrightNoColorV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - - -void calcAtmospherics(vec3 inPositionEye); - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - calcAtmospherics(pos.xyz); - - vertex_color = vec4(1,1,1,1); - - -} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl deleted file mode 100644 index b312665032..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file fullbrightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -void fullbright_shiny_lighting(); - -void main() -{ - fullbright_shiny_lighting(); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl deleted file mode 100644 index 891515ab1e..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file fullbrightShinyV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 texture_matrix1; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - - -void calcAtmospherics(vec3 inPositionEye); - -uniform vec4 origin; - - - -ATTRIBUTE vec3 position; -void passTextureIndex(); -ATTRIBUTE vec3 normal; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -#ifdef HAS_SKIN -mat4 getObjectSkinnedTransform(); -uniform mat4 projection_matrix; -#endif - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - passTextureIndex(); - -#ifdef HAS_SKIN - mat4 mat = getObjectSkinnedTransform(); - mat = modelview_matrix * mat; - vec4 pos = mat * vert; - gl_Position = projection_matrix * pos; - vec3 norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz); -#else - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - vec3 norm = normalize(normal_matrix * normal); -#endif - vec3 ref = reflect(pos.xyz, -norm); - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vary_texcoord1 = (texture_matrix1 * vec4(ref,1.0)).xyz; - - calcAtmospherics(pos.xyz); - - vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl deleted file mode 100644 index e1f3919907..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyWaterF.glsl +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file fullbrightShinyWaterF.glsl - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -void fullbright_shiny_lighting_water(); - -void main() -{ - fullbright_shiny_lighting_water(); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl deleted file mode 100644 index 5af42f1fcf..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file fullbrightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -void passTextureIndex(); -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec4 diffuse_color; - -void calcAtmospherics(vec3 inPositionEye); - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -#ifdef HAS_SKIN -mat4 getObjectSkinnedTransform(); -uniform mat4 projection_matrix; -#endif - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - passTextureIndex(); -#ifdef HAS_SKIN - mat4 mat = getObjectSkinnedTransform(); - mat = modelview_matrix * mat; - vec4 pos = mat * vert; - gl_Position = projection_matrix * pos; -#else - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); -#endif - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - calcAtmospherics(pos.xyz); - - vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl deleted file mode 100644 index 5d0ea0a8dd..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file fullbrightWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -void fullbright_lighting_water(); - -void main() -{ - fullbright_lighting_water(); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl deleted file mode 100644 index f8f88e2577..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file shinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -void shiny_lighting(); - -void main() -{ - shiny_lighting(); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl deleted file mode 100644 index 3ad7bcaa50..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file shinyV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 texture_matrix1; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -void passTextureIndex(); -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec4 diffuse_color; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); - -void calcAtmospherics(vec3 inPositionEye); - -uniform vec4 origin; - -#ifdef HAS_SKIN -mat4 getObjectSkinnedTransform(); -uniform mat4 projection_matrix; -#endif - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - passTextureIndex(); - -#ifdef HAS_SKIN - mat4 mat = getObjectSkinnedTransform(); - mat = modelview_matrix * mat; - vec4 pos = mat * vert; - gl_Position = projection_matrix * pos; - vec3 norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz); -#else - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - vec3 norm = normalize(normal_matrix * normal); -#endif - vec3 ref = reflect(pos.xyz, -norm); - - vary_texcoord0 = (texture_matrix0*vec4(texcoord0,0,1)).xy; - vary_texcoord1 = (texture_matrix1 * vec4(ref,1.0)).xyz; - - calcAtmospherics(pos.xyz); - - vertex_color = calcLighting(pos.xyz, norm, diffuse_color); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl deleted file mode 100644 index 1e72e23eef..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file shinyWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -void shiny_lighting_water(); - -void main() -{ - shiny_lighting_water(); -} diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl deleted file mode 100644 index e605676819..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file simpleNonIndexedV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec4 diffuse_color; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); -void calcAtmospherics(vec3 inPositionEye); - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - - gl_Position = modelview_projection_matrix*vert; - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; - - vec4 pos = (modelview_matrix * vert); - - vec3 norm = normalize(normal_matrix * normal); - - calcAtmospherics(pos.xyz); - - vec4 color = calcLighting(pos.xyz, norm, diffuse_color); - vertex_color = color; - - -} diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl deleted file mode 100644 index 945f80f31e..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file simpleV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -void passTextureIndex(); -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; - -uniform vec4 color; -uniform vec4 object_plane_t; -uniform vec4 object_plane_s; - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); -void calcAtmospherics(vec3 inPositionEye); - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) -{ - vec4 tcoord; - - tcoord.x = dot(vpos, tp0); - tcoord.y = dot(vpos, tp1); - tcoord.z = tc.z; - tcoord.w = tc.w; - - tcoord = mat * tcoord; - - return tcoord; -} - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - passTextureIndex(); - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy; - - vec3 norm = normalize(normal_matrix * normal); - - calcAtmospherics(pos.xyz); - - vec4 color = calcLighting(pos.xyz, norm, color); - vertex_color = color; - - -} diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl deleted file mode 100644 index 2025174f7d..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file simpleV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() -uniform int no_atmo; - -ATTRIBUTE vec3 position; -void passTextureIndex(); -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec4 diffuse_color; - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); -void calcAtmospherics(vec3 inPositionEye); - - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -#ifdef HAS_SKIN -mat4 getObjectSkinnedTransform(); -uniform mat4 projection_matrix; -#endif - - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - - passTextureIndex(); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; - - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 1) - { - vertex_color = diffuse_color; - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - } - else - { -#ifdef HAS_SKIN - mat4 mat = getObjectSkinnedTransform(); - mat = modelview_matrix * mat; - - vec4 pos = mat * vert; - vec3 norm = normalize((mat*vec4(normal.xyz+vert.xyz,1.0)).xyz-pos.xyz); - - gl_Position = projection_matrix * pos; -#else - vec4 pos = (modelview_matrix * vert); - vec3 norm = normalize(normal_matrix * normal); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); -#endif - - calcAtmospherics(pos.xyz); - - vertex_color = calcLighting(pos.xyz, norm, diffuse_color); - } -} diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl deleted file mode 100644 index 0227e6e3b8..0000000000 --- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file treeV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec4 diffuse_color; - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); -void calcAtmospherics(vec3 inPositionEye); - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - - gl_Position = modelview_projection_matrix*vert; - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; - - vec4 pos = (modelview_matrix * vert); - - vec3 norm = normalize(normal_matrix * normal); - - calcAtmospherics(pos.xyz); - - vec4 color = calcLighting(pos.xyz, norm, diffuse_color); - vertex_color = color; -} diff --git a/indra/newview/app_settings/shaders/class1/transform/binormalV.glsl b/indra/newview/app_settings/shaders/class1/transform/binormalV.glsl deleted file mode 100644 index 449d8d8b4e..0000000000 --- a/indra/newview/app_settings/shaders/class1/transform/binormalV.glsl +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file binormalV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; - -ATTRIBUTE vec4 tangent; - -VARYING vec4 tangent_out; - -void main() -{ - tangent_out = vec4(normal_matrix * tangent.xyz), tangent.w); -} - diff --git a/indra/newview/app_settings/shaders/class1/transform/colorV.glsl b/indra/newview/app_settings/shaders/class1/transform/colorV.glsl deleted file mode 100644 index 59c4a7d895..0000000000 --- a/indra/newview/app_settings/shaders/class1/transform/colorV.glsl +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file colorV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform int color_in; - -ATTRIBUTE vec3 position; - -VARYING int color_out; - -void main() -{ - color_out = color_in; -} - diff --git a/indra/newview/app_settings/shaders/class1/transform/normalV.glsl b/indra/newview/app_settings/shaders/class1/transform/normalV.glsl deleted file mode 100644 index a213aa0ae8..0000000000 --- a/indra/newview/app_settings/shaders/class1/transform/normalV.glsl +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file normalV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; - -ATTRIBUTE vec3 normal; - -VARYING vec4 normal_out; - -void main() -{ - normal_out = vec4(normalize(normal_matrix * normal), 0.0); -} - diff --git a/indra/newview/app_settings/shaders/class1/transform/positionV.glsl b/indra/newview/app_settings/shaders/class1/transform/positionV.glsl deleted file mode 100644 index 01eed18de4..0000000000 --- a/indra/newview/app_settings/shaders/class1/transform/positionV.glsl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file positionV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_matrix; - -uniform int texture_index_in; - -ATTRIBUTE vec3 position; - -VARYING vec3 position_out; -VARYING int texture_index_out; - -void main() -{ - texture_index_out = texture_index_in; - position_out = (modelview_matrix*vec4(position, 1.0)).xyz; -} - diff --git a/indra/newview/app_settings/shaders/class1/transform/texcoordV.glsl b/indra/newview/app_settings/shaders/class1/transform/texcoordV.glsl deleted file mode 100644 index 0e074f3cec..0000000000 --- a/indra/newview/app_settings/shaders/class1/transform/texcoordV.glsl +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file texcoordV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - -ATTRIBUTE vec2 texcoord0; - -VARYING vec2 texcoord_out; - -void main() -{ - texcoord_out = texcoord0; -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl deleted file mode 100644 index 4e0618e276..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file class1\windlight\atmosphericsF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -vec3 atmosFragAmbient(vec3 light, vec3 sunlit) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit) -{ - return light * sunlit; -} - -vec3 atmosLighting(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl deleted file mode 100644 index 12f500e224..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file class1\windlight\atmosphericsFuncs.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2019, 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$ - */ - -// debug stub - -float getAmbientClamp() { return 1.0f; } - -// Returns colors in sRGB -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, - out vec3 atten, bool use_ao) -{ - amblit = vec3(0.2, 0, 0.2); - sunlit = vec3(1,0,1); - additive = vec3(0.5,0.5,0.5); - atten = vec3(1,0,1); -} - -void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 additive, - out vec3 atten) -{ - amblit = vec3(0.2, 0, 0.2); - sunlit = vec3(1,0,1); - additive = vec3(0.5,0.5,0.5); - atten = vec3(1,0,1); -} diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl deleted file mode 100644 index 206a51db27..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file class1\windlight\atmosphericsHelpersF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform vec4 sunlight_color; -uniform vec4 light_ambient; -uniform int no_atmo; - -vec3 atmosAmbient() -{ - if (no_atmo == 1) return vec3(0.16); - return light_ambient.rgb; -} - -vec3 atmosAffectDirectionalLight(float lightIntensity) -{ - return sunlight_color.rgb * lightIntensity; -} - -vec3 atmosGetDiffuseSunlightColor() -{ - return sunlight_color.rgb; -} - -vec3 scaleDownLight(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl deleted file mode 100644 index c266f9732f..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file class1\windlight\atmosphericsHelpersV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform vec4 sunlight_color; -uniform vec4 light_ambient; -uniform int no_atmo; - -vec3 atmosAmbient() -{ - if (no_atmo == 1) return vec3(0.66); - return light_ambient.rgb; -} - -vec3 atmosAffectDirectionalLight(float lightIntensity) -{ - return sunlight_color.rgb * lightIntensity; -} - -vec3 atmosGetDiffuseSunlightColor() -{ - return sunlight_color.rgb; -} - -vec3 scaleDownLight(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 scaleUpLight(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl deleted file mode 100644 index 20457ad125..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file class1\windlight\atmosphericsV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - - - -void setPositionEye(vec3 v); - -void calcAtmospherics(vec3 inPositionEye) -{ - /* stub function for fallback compatibility on class1 hardware */ - setPositionEye(inPositionEye); -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl deleted file mode 100644 index 3b4d358cfa..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file class1\windlight\atmosphericVarsF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 getAmblitColor() { return vec3(0, 0, 0); } - -vec3 getAdditiveColor() { return vary_AdditiveColor; } - -vec3 getAtmosAttenuation() { return vec3(vary_AtmosAttenuation); } - -vec3 getSunlitColor() { return vec3(0, 0, 0); } - -vec3 getPositionEye() { return vec3(0, 0, 0); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl deleted file mode 100644 index 1fea2c3628..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file class1\windlight\atmosphericVarsV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 additive_color; -vec3 atmos_attenuation; -vec3 sunlit_color; -vec3 amblit_color; -vec3 position_eye; - -vec3 getSunlitColor() { return sunlit_color; } -void setSunlitColor(vec3 v) { sunlit_color = v; } - -vec3 getAdditiveColor() { return additive_color; } -void setAdditiveColor(vec3 v) -{ - additive_color = v; - vary_AdditiveColor = v; -} - -vec3 getAmblitColor() { return amblit_color; } -void setAmblitColor(vec3 v) { amblit_color = v; } - -vec3 getAtmosAttenuation() { return atmos_attenuation; } -void setAtmosAttenuation(vec3 v) -{ - atmos_attenuation = v; - vary_AtmosAttenuation = v; -} - -vec3 getPositionEye() { return position_eye; } -void setPositionEye(vec3 v) { position_eye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl deleted file mode 100644 index f83434b7ec..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file class1\windlight\atmosphericVarsWaterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -VARYING vec3 vary_PositionEye; -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 getSunlitColor() { return vec3(0, 0, 0); } - -vec3 getAmblitColor() { return vec3(0, 0, 0); } - -vec3 getAdditiveColor() { return vary_AdditiveColor; } - -vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; } - -vec3 getPositionEye() { return vary_PositionEye; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl deleted file mode 100644 index 65d1176777..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file class1\windlight\atmosphericVarsWaterV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -VARYING vec3 vary_PositionEye; -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 atmos_attenuation; -vec3 sunlit_color; -vec3 amblit_color; - -vec3 getSunlitColor() { return sunlit_color; } -void setSunlitColor(vec3 v) { sunlit_color = v; } - -vec3 getAmblitColor() { return amblit_color; } -void setAmblitColor(vec3 v) { amblit_color = v; } - -vec3 getAdditiveColor() { return vary_AdditiveColor; } -void setAdditiveColor(vec3 v) { vary_AdditiveColor = v; } - -vec3 getAtmosAttenuation() { return atmos_attenuation; } -void setAtmosAttenuation(vec3 v) -{ - atmos_attenuation = v; - vary_AtmosAttenuation = v; -} - -vec3 getPositionEye() { return vary_PositionEye; } -void setPositionEye(vec3 v) { vary_PositionEye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl deleted file mode 100644 index fc51e81177..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file class1\windlight\gammaF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform int no_atmo; - -vec3 scaleSoftClipFrag(vec3 light) -{ - // For compatibility with lower cards. Do nothing. - return light; -} - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) -{ - // For compatibility with lower cards. Do nothing - return light; -} - -vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 additive, vec3 atten) -{ - // For compatibility with lower cards. Do nothing - return light; -} - -vec3 fullbrightScaleSoftClip(vec3 light) -{ - // For compatibility with lower cards. Do nothing - return light; -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl deleted file mode 100644 index c4ab0c95dc..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file class1\wl\moonF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 2020 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$ - */ - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform vec4 color; -uniform vec3 moonlight_color; -uniform vec3 moon_dir; -uniform float moon_brightness; -uniform sampler2D diffuseMap; - -VARYING vec2 vary_texcoord0; - -vec3 scaleSoftClip(vec3 light); - -void main() -{ - // Restore Pre-EEP alpha fade moon near horizon - float fade = 1.0; - if( moon_dir.z > 0 ) - fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 ); - - vec4 c = texture2D(diffuseMap, vary_texcoord0.xy); - - // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible - // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> - if (c.a <= 2./255.) // 0.00784 - discard; - -// c.rgb = pow(c.rgb, vec3(0.7f)); // can't use "srgb_to_linear(color.rgb)" as that is a deferred only function - c.rgb *= moonlight_color.rgb; - c.rgb *= moon_brightness; - - c.rgb *= fade; - c.a *= fade; - - c.rgb = scaleSoftClip(c.rgb); - - frag_color = vec4(c.rgb, c.a); - gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl deleted file mode 100644 index 2fceb5f743..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file class1\wl\moonV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 2020 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -VARYING vec2 vary_texcoord0; - -void main() -{ - //transform vertex - vec4 vert = vec4(position.xyz, 1.0); - vec4 pos = (modelview_matrix * vert); - - gl_Position = modelview_projection_matrix*vert; - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; -} diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl deleted file mode 100644 index 5a41dc644a..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @file class1\wl\sunDiscF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -uniform sampler2D diffuseMap; -uniform sampler2D altDiffuseMap; -uniform float blend_factor; // interp factor between sun A/B -VARYING vec2 vary_texcoord0; -VARYING float sun_fade; - -void main() -{ - vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); - vec4 c = mix(sunA, sunB, blend_factor); - -// SL-9806 stars poke through -// c.a *= sun_fade; - - c.rgb = fullbrightAtmosTransport(c.rgb); - c.rgb = fullbrightScaleSoftClip(c.rgb); - frag_color = c; -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl deleted file mode 100644 index 6c0e795f6b..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file class1\wl\sunDiscV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -VARYING vec2 vary_texcoord0; -VARYING float sun_fade; - -void calcAtmospherics(vec3 eye_pos); - -void main() -{ - //transform vertex - vec3 offset = vec3(0, 0, 50); - vec4 vert = vec4(position.xyz - offset, 1.0); - vec4 pos = modelview_projection_matrix*vert; - - sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f); - gl_Position = pos; - - calcAtmospherics(pos.xyz); - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; -} diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl deleted file mode 100644 index a937d9fa99..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file class1/windlight/transportF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform int no_atmo; - -vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 atmosTransport(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 fullbrightAtmosTransport(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 fullbrightShinyAtmosTransport(vec3 light) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl deleted file mode 100644 index 563c5f562b..0000000000 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file eyeballV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat3 normal_matrix; -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - - -vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor); -void calcAtmospherics(vec3 inPositionEye); - -void main() -{ - //transform vertex - vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz; - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - vec3 norm = normalize(normal_matrix * normal); - - calcAtmospherics(pos.xyz); - - // vec4 specular = specularColor; - vec4 specular = vec4(1.0); - vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular); - - vertex_color = color; - - -} - diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 7435f1c0e1..e2694e060e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -300,6 +300,9 @@ void main() #endif // #else // FOR_IMPOSTOR +#ifdef IS_HUD + color.rgb = linear_to_srgb(color.rgb); +#endif frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/indirect.glsl b/indra/newview/app_settings/shaders/class2/deferred/indirect.glsl deleted file mode 100644 index 67b98e0fb1..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/indirect.glsl +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file class2/deferred/indirect.glsl - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen); - -vec3 getIndirect(vec3 ambient, vec3 norm, vec4 pos, vec2 pos_screen) -{ - return ambient * calcAmbientOcclusion(pos, norm, pos_screen); -} - diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl deleted file mode 100644 index ba419e7a65..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ /dev/null @@ -1,298 +0,0 @@ -/** - * @file multiSpotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform samplerCube environmentMap; -uniform sampler2D lightMap; -uniform sampler2D noiseMap; -uniform sampler2D projectionMap; -uniform sampler2D lightFunc; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; -uniform int proj_shadow_idx; -uniform float shadow_fade; - -uniform vec3 center; -uniform float size; -uniform vec3 color; -uniform float falloff; - -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; - -vec3 srgb_to_linear(vec3 cs); -vec3 getNorm(vec2 pos_screen); - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - d *= min(1, d * (proj_lod - lod)); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - - vec3 col = vec3(0,0,0); - -#if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = center.xyz-pos.xyz; - float dist = length(lv); - - if (dist >= size) - { - discard; - } - dist /= size; - - float shadow = 1.0; - - if (proj_shadow_idx >= 0) - { - vec4 shd = texture2D(lightMap, frag.xy); - shadow = (proj_shadow_idx==0)?shd.b:shd.a; - shadow += shadow_fade; - shadow = clamp(shadow, 0.0, 1.0); - } - - vec3 norm = texture2D(normalMap, frag.xy).xyz; - - float envIntensity = norm.z; - - norm = getNorm(frag.xy); - - norm = normalize(norm); - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z < 0.0) - { - discard; - } - - proj_tc.xyz /= proj_tc.w; - - float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - if (dist_atten <= 0.0) - { - discard; - } - - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; - - vec4 spec = texture2D(specularRect, frag.xy); - - vec3 dlit = vec3(0, 0, 0); - - float noise = texture2D(noiseMap, frag.xy).b; - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float amb_da = proj_ambiance; - float lit = 0.0; - - if (da > 0.0) - { - lit = da * dist_atten * noise; - - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - - dlit = color.rgb * plcol.rgb * plcol.a; - - col = dlit*lit*diff_tex*shadow; - - // unshadowed for consistency between forward and deferred? - amb_da += (da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; - } - - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - // use unshadowed for consistency between forward and deferred? - amb_da += (da*da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; - amb_da *= dist_atten * noise; - amb_da = min(amb_da, 1.0-lit); - - col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; - } - - - if (spec.a > 0.0) - { - vec3 npos = -normalize(pos); - dlit *= min(da*6.0, 1.0) * dist_atten; - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 speccol = dlit*scol*spec.rgb*shadow; - speccol = clamp(speccol, vec3(0), vec3(1)); - col += speccol; - } - } - - if (envIntensity > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc /= stc.w; - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity; - } - } - } - } -#endif - - //not sure why, but this line prevents MATBUG-194 - col = max(col, vec3(0.0)); - - //output linear - frag_color.rgb = col; - frag_color.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index ccf20942e3..35ccc65a8e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -25,6 +25,8 @@ /*[EXTRA_CODE_HERE]*/ +#ifndef IS_HUD + uniform sampler2D diffuseMap; //always in sRGB space uniform sampler2D bumpMap; uniform sampler2D emissiveMap; @@ -113,6 +115,8 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, vec3 v, // surface point to camera vec3 l); //surface point to light +vec2 BRDF(float NoV, float roughness); + vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, float perceptualRoughness, float metallic, @@ -217,8 +221,12 @@ void main() calcDiffuseSpecular(col.rgb, metallic, diffuseColor, specularColor); vec3 v = -normalize(pos.xyz); + color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit, scol, radiance, irradiance, colorEmissive, ao, additive, atten); + float nv = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0); + vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRoughness); + vec3 light = vec3(0); // Punctual lights @@ -235,5 +243,67 @@ void main() color.rgb += light.rgb; - frag_color = vec4(color.rgb,basecolor.a * vertex_color.a); + float a = basecolor.a*vertex_color.a; + vec3 spec = radiance; // *specularColor; + float lum = max(max(spec.r, spec.g), spec.b); + + float f = brdf.y; + a += f; + frag_color = vec4(color.rgb,a); +} + +#else + +uniform sampler2D diffuseMap; //always in sRGB space +uniform sampler2D emissiveMap; + +uniform vec3 emissiveColor; + +out vec4 frag_color; + +in vec3 vary_position; + +in vec2 basecolor_texcoord; +in vec2 emissive_texcoord; + +in vec4 vertex_color; + +#ifdef HAS_ALPHA_MASK +uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff() +#endif + +vec3 srgb_to_linear(vec3 c); +vec3 linear_to_srgb(vec3 c); + + +void main() +{ + vec3 color = vec3(0,0,0); + + vec3 pos = vary_position; + + vec4 basecolor = texture(diffuseMap, basecolor_texcoord.xy).rgba; + basecolor.rgb = srgb_to_linear(basecolor.rgb); +#ifdef HAS_ALPHA_MASK + if (basecolor.a < minimum_alpha) + { + discard; + } +#endif + + color = vertex_color.rgb * basecolor.rgb; + + // emissiveColor is the emissive color factor from GLTF and is already in linear space + vec3 colorEmissive = emissiveColor; + // emissiveMap here is a vanilla RGB texture encoded as sRGB, manually convert to linear + colorEmissive *= srgb_to_linear(texture2D(emissiveMap, emissive_texcoord.xy).rgb); + + + float a = basecolor.a*vertex_color.a; + a = 1.0; + color += colorEmissive; + color = linear_to_srgb(color); + frag_color = vec4(color.rgb,a); } + +#endif diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl deleted file mode 100644 index 668f70c3ab..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ /dev/null @@ -1,199 +0,0 @@ -/** - * @file class2/deferred/skyF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -// SKY //////////////////////////////////////////////////////////////////////// -// The vertex shader for creating the atmospheric sky -/////////////////////////////////////////////////////////////////////////////// - -// Inputs -uniform vec3 camPosLocal; - -uniform vec3 lightnorm; -uniform vec3 sunlight_color; -uniform vec3 moonlight_color; -uniform int sun_up_factor; -uniform vec3 ambient_color; -uniform vec3 blue_horizon; -uniform vec3 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float distance_multiplier; -uniform float max_y; - -uniform vec3 glow; -uniform float sun_moon_glow_factor; - -uniform vec3 cloud_color; - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif - -VARYING vec3 pos; - -///////////////////////////////////////////////////////////////////////// -// The fragment shader for the sky -///////////////////////////////////////////////////////////////////////// - -uniform sampler2D rainbow_map; -uniform sampler2D halo_map; - -uniform float moisture_level; -uniform float droplet_radius; -uniform float ice_level; - -vec3 rainbow(float d) -{ - // d is the dot product of view and sun directions, so ranging -1.0..1.0 - // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec - // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. - - // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. - // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the - // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 - d = clamp(-0.575 - d, 0.0, 1.0); - - // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. - // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate - // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 - float interior_coord = max(0.0, d - 0.25) * 4.2857; - d = clamp(d, 0.0, 0.25) + interior_coord; - - float rad = (droplet_radius - 5.0f) / 1024.0f; - return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; -} - -vec3 halo22(float d) -{ - d = clamp(d, 0.1, 1.0); - float v = sqrt(clamp(1 - (d * d), 0, 1)); - return texture2D(halo_map, vec2(0, v)).rgb * ice_level; -} - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - -void main() -{ - // World / view / projection - // Get relative position (offset why?) - vec3 rel_pos = pos.xyz - camPosLocal.xyz + vec3(0, 50, 0); - - // Adj position vector to clamp altitude - if (rel_pos.y > 0.) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0.) - { - rel_pos *= (-32000. / rel_pos.y); - } - - // Normalized - vec3 rel_pos_norm = normalize(rel_pos); - float rel_pos_len = length(rel_pos); - - // Initialize temp variables - vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color; - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); - vec3 blue_weight = blue_density / combined_haze; - vec3 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0, rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = dot(rel_pos_norm, lightnorm.xyz); - haze_glow = 1. - haze_glow; - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (sun_moon_glow_factor * (haze_glow + 0.25)); - - // Haze color above cloud - vec3 color = blue_horizon * blue_weight * (sunlight + ambient_color) - + haze_horizon * haze_weight * (sunlight * haze_glow + ambient_color); - - // Final atmosphere additive - color *= (1. - combined_haze); - - // Increase ambient when there are more clouds - // TODO 9/20: DJH what does this do? max(0,(1-ambient)) will change the color - vec3 ambient = ambient_color + max(vec3(0), (1. - ambient_color)) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= max(0.0, (1. - cloud_shadow)); - - // Haze color below cloud - vec3 add_below_cloud = blue_horizon * blue_weight * (sunlight + ambient) - + haze_horizon * haze_weight * (sunlight * haze_glow + ambient); - - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - - // At horizon, blend high altitude sky color towards the darker color below the clouds - color += (add_below_cloud - color) * (1. - sqrt(combined_haze)); - - float optic_d = dot(rel_pos_norm, lightnorm.xyz); - vec3 halo_22 = halo22(optic_d); - color.rgb += rainbow(optic_d); - color.rgb += halo_22; - color.rgb *= 2.; - color.rgb = scaleSoftClip(color.rgb); - - // Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, 1.0); - frag_data[1] = vec4(0.0, 0.0, 0.0, 0.0); - frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); // 1.0 in norm.w masks off fog -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyV.glsl deleted file mode 100644 index bcf775577a..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/skyV.glsl +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file WLSkyV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; - -// SKY //////////////////////////////////////////////////////////////////////// -// The vertex shader for creating the atmospheric sky -/////////////////////////////////////////////////////////////////////////////// - -VARYING vec3 pos; - -void main() -{ - - // World / view / projection - pos = position.xyz; - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl deleted file mode 100644 index fab227f5a4..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file class2/deferred/softenLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D normalMap; -uniform sampler2D lightMap; -uniform sampler2D depthMap; -uniform samplerCube environmentMap; -uniform sampler2D lightFunc; - -uniform float blur_size; -uniform float blur_fidelity; - -// Inputs -uniform mat3 env_mat; - -uniform vec3 sun_dir; -uniform vec3 moon_dir; -uniform int sun_up_factor; -VARYING vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec3 getNorm(vec2 pos_screen); -vec4 getPositionWithDepth(vec2 pos_screen, float depth); -float getDepth(vec2 pos_screen); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); -float getAmbientClamp(); -vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleSoftClipFrag(vec3 l); -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); - -vec3 linear_to_srgb(vec3 c); -vec3 srgb_to_linear(vec3 c); - -#ifdef WATER_FOG -vec4 applyWaterFogView(vec3 pos, vec4 color); -#endif - -void main() -{ - vec2 tc = vary_fragcoord.xy; - float depth = getDepth(tc.xy); - vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2D(normalMap, tc); - float envIntensity = norm.z; - norm.xyz = getNorm(tc); - - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); - float light_gamma = 1.0 / 1.3; - da = pow(da, light_gamma); - - vec4 diffuse = texture2D(diffuseRect, tc); - diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 - vec4 spec = texture2D(specularRect, vary_fragcoord.xy); - - vec2 scol_ambocc = texture2D(lightMap, vary_fragcoord.xy).rg; - scol_ambocc = pow(scol_ambocc, vec2(light_gamma)); - float scol = max(scol_ambocc.r, diffuse.a); - float ambocc = scol_ambocc.g; - - vec3 color = vec3(0); - float bloom = 0.0; - - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - - color.rgb = amblit; - - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - color.rgb *= ambient; - - vec3 sun_contrib = min(da, scol) * sunlit; - color.rgb += sun_contrib; - color.rgb *= diffuse.rgb; - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - - if (spec.a > 0.0) // specular reflection - { - float sa = dot(refnormpersp, light_dir.xyz); - vec3 dumbshiny = sunlit * scol * (texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - color.rgb += spec_contrib; - } - - color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); - - if (envIntensity > 0.0) - { // add environmentmap - vec3 env_vec = env_mat * refnormpersp; - vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; - color = mix(color.rgb, reflected_color, envIntensity); - } - - if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS)) - { - color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a); - color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a); - } - -#ifdef WATER_FOG - vec4 fogged = applyWaterFogView(pos.xyz, vec4(color, bloom)); - color = fogged.rgb; - bloom = fogged.a; -#endif - - // convert to linear as fullscreen lights need to sum in linear colorspace - // and will be gamma (re)corrected downstream... - frag_color.rgb = pos.xyz;// srgb_to_linear(color.rgb); - frag_color.a = bloom; -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl deleted file mode 100644 index e6a627fbf7..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ /dev/null @@ -1,292 +0,0 @@ -/** - * @file spotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform samplerCube environmentMap; -uniform sampler2D lightMap; -uniform sampler2D noiseMap; -uniform sampler2D projectionMap; -uniform sampler2D lightFunc; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; -uniform int proj_shadow_idx; -uniform float shadow_fade; - -uniform float size; -uniform vec3 color; -uniform float falloff; - -VARYING vec3 trans_center; -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; - -vec3 getNorm(vec2 pos_screen); -vec3 srgb_to_linear(vec3 c); - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - d *= min(1, d * (proj_lod - lod)); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 col = vec3(0,0,0); - -#if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = trans_center.xyz-pos.xyz; - float dist = length(lv); - - if (dist >= size) - { - discard; - } - dist /= size; - - float shadow = 1.0; - - if (proj_shadow_idx >= 0) - { - vec4 shd = texture2D(lightMap, frag.xy); - shadow = (proj_shadow_idx == 0) ? shd.b : shd.a; - shadow += shadow_fade; - shadow = clamp(shadow, 0.0, 1.0); - } - - vec3 norm = texture2D(normalMap, frag.xy).xyz; - float envIntensity = norm.z; - norm = getNorm(frag.xy); - - norm = normalize(norm); - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z < 0.0) - { - discard; - } - - proj_tc.xyz /= proj_tc.w; - - float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - - if (dist_atten <= 0.0) - { - discard; - } - - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; - vec4 spec = texture2D(specularRect, frag.xy); - vec3 dlit = vec3(0, 0, 0); - - float noise = texture2D(noiseMap, frag.xy).b; - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float amb_da = proj_ambiance; - float lit = 0.0; - - if (da > 0.0) - { - lit = da * dist_atten * noise; - - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - - dlit = color.rgb * plcol.rgb * plcol.a; - - col = dlit*lit*diff_tex*shadow; - - amb_da += (da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; - } - - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; - amb_da *= dist_atten * noise; - amb_da = min(amb_da, 1.0-lit); - - col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; - } - - if (spec.a > 0.0) - { - dlit *= min(da*6.0, 1.0) * dist_atten; - vec3 npos = -normalize(pos); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 speccol = dlit*scol*spec.rgb*shadow; - speccol = clamp(speccol, vec3(0), vec3(1)); - col += speccol; - } - } - - if (envIntensity > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc /= stc.w; - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity; - } - } - } - } -#endif - - //not sure why, but this line prevents MATBUG-194 - col = max(col, vec3(0.0)); - - //output linear colors as gamma correction happens down stream - frag_color.rgb = col; - frag_color.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl deleted file mode 100644 index 96739d91d7..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl +++ /dev/null @@ -1,192 +0,0 @@ -/** - * @file class1/deferred/waterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[4]; -#else -#define frag_data gl_FragData -#endif - -vec3 scaleSoftClip(vec3 inColor); -vec3 atmosTransport(vec3 inColor); - -uniform sampler2D bumpMap; -uniform sampler2D bumpMap2; -uniform float blend_factor; -uniform sampler2D screenTex; -uniform sampler2D refTex; -uniform float sunAngle; -uniform float sunAngle2; -uniform vec3 lightDir; -uniform vec3 specular; -uniform float lightExp; -uniform float refScale; -uniform float kd; -uniform vec2 screenRes; -uniform vec3 normScale; -uniform float fresnelScale; -uniform float fresnelOffset; -uniform float blurMultiplier; -uniform vec2 screen_res; -uniform mat4 norm_mat; //region space to screen space -uniform int water_edge; - -//bigWave is (refCoord.w, view.w); -VARYING vec4 refCoord; -VARYING vec4 littleWave; -VARYING vec4 view; -VARYING vec4 vary_position; - -vec2 encode_normal(vec3 n); -vec3 scaleSoftClip(vec3 l); -vec3 srgb_to_linear(vec3 c); -vec3 linear_to_srgb(vec3 c); - -vec3 BlendNormal(vec3 bump1, vec3 bump2) -{ - vec3 n = mix(bump1, bump2, blend_factor); - return n; -} - -void main() -{ - vec4 color; - float dist = length(view.xyz); - - //normalize view vector - vec3 viewVec = normalize(view.xyz); - - //get wave normals - vec3 wave1_a = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; - vec3 wave2_a = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; - vec3 wave3_a = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; - - - vec3 wave1_b = texture2D(bumpMap2, vec2(refCoord.w, view.w)).xyz*2.0-1.0; - vec3 wave2_b = texture2D(bumpMap2, littleWave.xy).xyz*2.0-1.0; - vec3 wave3_b = texture2D(bumpMap2, littleWave.zw).xyz*2.0-1.0; - - vec3 wave1 = BlendNormal(wave1_a, wave1_b); - vec3 wave2 = BlendNormal(wave2_a, wave2_b); - vec3 wave3 = BlendNormal(wave3_a, wave3_b); - - //get base fresnel components - - vec3 df = vec3( - dot(viewVec, wave1), - dot(viewVec, (wave2 + wave3) * 0.5), - dot(viewVec, wave3) - ) * fresnelScale + fresnelOffset; - df *= df; - - vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; - - float dist2 = dist; - dist = max(dist, 5.0); - - float dmod = sqrt(dist); - - vec2 dmod_scale = vec2(dmod*dmod, dmod); - - //get reflected color - vec2 refdistort1 = wave1.xy*normScale.x; - vec2 refvec1 = distort+refdistort1/dmod_scale; - vec4 refcol1 = texture2D(refTex, refvec1); - - vec2 refdistort2 = wave2.xy*normScale.y; - vec2 refvec2 = distort+refdistort2/dmod_scale; - vec4 refcol2 = texture2D(refTex, refvec2); - - vec2 refdistort3 = wave3.xy*normScale.z; - vec2 refvec3 = distort+refdistort3/dmod_scale; - vec4 refcol3 = texture2D(refTex, refvec3); - - vec4 refcol = refcol1 + refcol2 + refcol3; - float df1 = df.x + df.y + df.z; - refcol *= df1 * 0.333; - - vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; - wavef.z *= max(-viewVec.z, 0.1); - wavef = normalize(wavef); - - float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset; - - vec2 refdistort4 = wavef.xy*0.125; - refdistort4.y -= abs(refdistort4.y); - vec2 refvec4 = distort+refdistort4/dmod; - float dweight = min(dist2*blurMultiplier, 1.0); - vec4 baseCol = texture2D(refTex, refvec4); - - refcol = mix(baseCol*df2, refcol, dweight); - - //get specular component - float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); - - //harden specular - spec = pow(spec, 128.0); - - //figure out distortion vector (ripply) - vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0); - - vec4 fb = texture2D(screenTex, distort2); - - //mix with reflection - // Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug - color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999f); - - vec4 pos = vary_position; - - //color.rgb += spec * specular; - - //color.rgb = atmosTransport(color.rgb); - //color.rgb = scaleSoftClip(color.rgb); - - //color.rgb = refcol.rgb; - color.rgb = vec3(0.0); - color.a = spec * sunAngle2; - - vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); - - //frag_data[0] = color; - - // TODO: The non-obvious assignment below is copied from the pre-EEP WL shader code - // Unfortunately, fixing it causes a mismatch for EEP, and so it remains... for now - // SL-12975 (unfix pre-EEP broken alpha) - frag_data[0] = vec4(srgb_to_linear(color.rgb), 0.0); - - frag_data[1] = vec4(1.0, 0.1, 0.0, 0.0); // occlusion, roughness, metalness - frag_data[2] = vec4(encode_normal(screenspacewavef.xyz), 0.0, GBUFFER_FLAG_HAS_PBR);// normalxy, env intens, flags (atmo kill) - //frag_data[3] = vec4(srgb_to_linear(refcol.rgb),0); - frag_data[3] = vec4(0, 0, 0, 0); - - - //frag_data[0] = vec4(0.0,0,0,0); - //frag_data[1] = vec4(0, 1.0, 0.0, 0.0); - //frag_data[3] = vec4(0); -} diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl deleted file mode 100644 index d485379a56..0000000000 --- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl +++ /dev/null @@ -1,170 +0,0 @@ -/** - * @file waterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -//class2/environment/waterF.glsl - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -vec3 scaleSoftClip(vec3 inColor); -vec3 atmosTransport(vec3 inColor); - -uniform sampler2D bumpMap; -uniform sampler2D bumpMap2; -uniform float blend_factor; -uniform sampler2D screenTex; -uniform sampler2D refTex; - -uniform float sunAngle; -uniform float sunAngle2; -uniform vec3 lightDir; -uniform vec3 specular; -uniform float lightExp; -uniform float refScale; -uniform float kd; -uniform vec2 screenRes; -uniform vec3 normScale; -uniform float fresnelScale; -uniform float fresnelOffset; -uniform float blurMultiplier; - - -//bigWave is (refCoord.w, view.w); -VARYING vec4 refCoord; -VARYING vec4 littleWave; -VARYING vec4 view; - -vec3 BlendNormal(vec3 bump1, vec3 bump2) -{ - vec3 n = mix(bump1, bump2, blend_factor); - return n; -} - - -void main() -{ - vec4 color; - - float dist = length(view.xy); - - //normalize view vector - vec3 viewVec = normalize(view.xyz); - - //get wave normals - vec2 bigwave = vec2(refCoord.w, view.w); - vec3 wave1_a = texture2D(bumpMap, bigwave ).xyz*2.0-1.0; - vec3 wave2_a = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; - vec3 wave3_a = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; - - - vec3 wave1_b = texture2D(bumpMap2, bigwave ).xyz*2.0-1.0; - vec3 wave2_b = texture2D(bumpMap2, littleWave.xy).xyz*2.0-1.0; - vec3 wave3_b = texture2D(bumpMap2, littleWave.zw).xyz*2.0-1.0; - - vec3 wave1 = BlendNormal(wave1_a, wave1_b); - vec3 wave2 = BlendNormal(wave2_a, wave2_b); - vec3 wave3 = BlendNormal(wave3_a, wave3_b); - - - //get base fresnel components - - vec3 df = vec3( - dot(viewVec, wave1), - dot(viewVec, (wave2 + wave3) * 0.5), - dot(viewVec, wave3) - ) * fresnelScale + fresnelOffset; - df *= df; - - vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; - - float dist2 = dist; - dist = max(dist, 5.0); - - float dmod = sqrt(dist); - - vec2 dmod_scale = vec2(dmod*dmod, dmod); - - //get reflected color - vec2 refdistort1 = wave1.xy*normScale.x; - vec2 refvec1 = distort+refdistort1/dmod_scale; - vec4 refcol1 = texture2D(refTex, refvec1); - - vec2 refdistort2 = wave2.xy*normScale.y; - vec2 refvec2 = distort+refdistort2/dmod_scale; - vec4 refcol2 = texture2D(refTex, refvec2); - - vec2 refdistort3 = wave3.xy*normScale.z; - vec2 refvec3 = distort+refdistort3/dmod_scale; - vec4 refcol3 = texture2D(refTex, refvec3); - - vec4 refcol = refcol1 + refcol2 + refcol3; - float df1 = df.x + df.y + df.z; - refcol *= df1 * 0.333; - - vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; - - wavef.z *= max(-viewVec.z, 0.1); - wavef = normalize(wavef); - - float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset; - - vec2 refdistort4 = wavef.xy*0.125; - refdistort4.y -= abs(refdistort4.y); - vec2 refvec4 = distort+refdistort4/dmod; - float dweight = min(dist2*blurMultiplier, 1.0); - vec4 baseCol = texture2D(refTex, refvec4); - refcol = mix(baseCol*df2, refcol, dweight); - - //get specular component - float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); - - //harden specular - spec = pow(spec, 128.0); - - //figure out distortion vector (ripply) - vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0); - - vec4 fb = texture2D(screenTex, distort2); - - //mix with reflection - // Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug - color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999); - color.rgb += spec * specular; - - color.rgb = atmosTransport(color.rgb); - color.rgb = scaleSoftClip(color.rgb); - color.a = spec * sunAngle2; - - frag_color = color; - -#if defined(WATER_EDGE) - gl_FragDepth = 0.9999847f; -#endif - -} - diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl deleted file mode 100644 index 89d9d1bde3..0000000000 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file class2\lighting\sumLightsSpecularV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - - - -float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); -vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); - -vec3 atmosAmbient(); -vec3 atmosAffectDirectionalLight(float lightIntensity); -vec3 atmosGetDiffuseSunlightColor(); -vec3 scaleDownLight(vec3 light); - -uniform vec4 light_position[8]; -uniform vec4 light_attenuation[8]; -uniform vec3 light_diffuse[8]; - -vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor) -{ - vec4 col = vec4(0.0, 0.0, 0.0, color.a); - - vec3 view = normalize(pos); - - /// collect all the specular values from each calcXXXLightSpecular() function - vec4 specularSum = vec4(0.0); - - // Collect normal lights (need to be divided by two, as we later multiply by 2) - col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0); - col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb); - col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb); - col.rgb = scaleDownLight(col.rgb); - - // Add windlight lights - col.rgb += atmosAmbient(); - col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz, atmosGetDiffuseSunlightColor(), 1.0)); - - col.rgb = min(col.rgb*color.rgb, 1.0); - specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0); - col.rgb += specularColor.rgb; - - return col; -} diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl deleted file mode 100644 index 30ca88afd2..0000000000 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @file class2\lighting\sumLightsV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight); - -vec3 atmosAffectDirectionalLight(float lightIntensity); -vec3 scaleDownLight(vec3 light); - -uniform vec4 light_position[8]; -uniform vec3 light_direction[8]; -uniform vec3 light_attenuation[8]; -uniform vec3 light_diffuse[8]; - -vec4 sumLights(vec3 pos, vec3 norm, vec4 color) -{ - vec4 col = vec4(0.0, 0.0, 0.0, color.a); - - // Collect normal lights (need to be divided by two, as we later multiply by 2) - col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); - col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z); - col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z); - col.rgb = scaleDownLight(col.rgb); - -#if defined(LOCAL_LIGHT_KILL) - col.rgb = vec3(0); -i#endif - - // Add windlight lights - col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); - -#if !defined(SUNLIGHT_KILL) - col.rgb = min(col.rgb*color.rgb, 1.0); -#endif - - return col; -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 1463d507bc..6668a00841 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -27,17 +27,11 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); vec3 scaleSoftClipFrag(vec3 light); -uniform int no_atmo; - vec3 srgb_to_linear(vec3 col); vec3 linear_to_srgb(vec3 col); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { - if (no_atmo == 1) - { - return light; - } light *= atten.r; light += additive; return light * 2.0; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl index ba02070e45..f9f625ecdb 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl @@ -45,7 +45,6 @@ uniform float max_y; uniform vec3 glow; uniform float scene_light_strength; uniform mat3 ssao_effect_mat; -uniform int no_atmo; uniform float sun_moon_glow_factor; float getAmbientClamp() { return 1.0f; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl index 5788871744..800d08047a 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl @@ -26,11 +26,9 @@ // Output variables uniform float scene_light_strength; -uniform int no_atmo; vec3 atmosFragAmbient(vec3 light, vec3 amblit) { - if (no_atmo == 1) return light; return amblit + light / 2.0; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index 9c42b84eca..257a76c663 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -33,11 +33,9 @@ vec3 getAtmosAttenuation(); vec3 getPositionEye(); uniform float scene_light_strength; -uniform int no_atmo; vec3 atmosAmbient() { - if (no_atmo == 1) return vec3(0.16); return getAmblitColor(); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl deleted file mode 100644 index 6f4bdbde28..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ /dev/null @@ -1,137 +0,0 @@ -/** - * @file class2\wl\cloudsF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -///////////////////////////////////////////////////////////////////////// -// The fragment shader for the sky -///////////////////////////////////////////////////////////////////////// - -VARYING vec3 vary_CloudColorSun; -VARYING vec3 vary_CloudColorAmbient; -VARYING float vary_CloudDensity; - -uniform sampler2D cloud_noise_texture; -uniform sampler2D cloud_noise_texture_next; -uniform float blend_factor; -uniform vec3 cloud_pos_density1; -uniform vec3 cloud_pos_density2; -uniform float cloud_scale; -uniform float cloud_variance; - -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; -VARYING float altitude_blend_factor; - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - -vec4 cloudNoise(vec2 uv) -{ - vec4 a = texture2D(cloud_noise_texture, uv); - vec4 b = texture2D(cloud_noise_texture_next, uv); - vec4 cloud_noise_sample = mix(a, b, blend_factor); - return cloud_noise_sample; -} - -void main() -{ - // Set variables - vec2 uv1 = vary_texcoord0.xy; - vec2 uv2 = vary_texcoord1.xy; - - vec3 cloudColorSun = vary_CloudColorSun; - vec3 cloudColorAmbient = vary_CloudColorAmbient; - float cloudDensity = vary_CloudDensity; - vec2 uv3 = vary_texcoord2.xy; - vec2 uv4 = vary_texcoord3.xy; - - if (cloud_scale < 0.001) - { - discard; - } - - vec2 disturbance = vec2(cloudNoise(uv1 / 8.0f).x, cloudNoise((uv3 + uv1) / 16.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); - vec2 disturbance2 = vec2(cloudNoise((uv1 + uv3) / 4.0f).x, cloudNoise((uv4 + uv2) / 8.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); - - // Offset texture coords - uv1 += cloud_pos_density1.xy + (disturbance * 0.2); //large texture, visible density - uv2 += cloud_pos_density1.xy; //large texture, self shadow - uv3 += cloud_pos_density2.xy; //small texture, visible density - uv4 += cloud_pos_density2.xy; //small texture, self shadow - - float density_variance = min(1.0, (disturbance.x* 2.0 + disturbance.y* 2.0 + disturbance2.x + disturbance2.y) * 4.0); - - cloudDensity *= 1.0 - (density_variance * density_variance); - - // Compute alpha1, the main cloud opacity - - float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; - alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10 * cloud_pos_density1.z, 1.); - - // And smooth - alpha1 = 1. - alpha1 * alpha1; - alpha1 = 1. - alpha1 * alpha1; - - alpha1 *= altitude_blend_factor; - - //if (alpha1 < 0.001f) - //{ - // discard; - //} - - // Compute alpha2, for self shadowing effect - // (1 - alpha2) will later be used as percentage of incoming sunlight - float alpha2 = (cloudNoise(uv2).x - 0.5); - alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); - - // And smooth - alpha2 = 1. - alpha2; - alpha2 = 1. - alpha2 * alpha2; - - // Combine - vec3 color; - color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); - color.rgb *= 2.; - color.rgb = scaleSoftClip(color.rgb); - - /// Gamma correct for WL (soft clip effect). - frag_color = vec4(color.rgb, alpha1); - - // SL-14113 Moon Haze -- When the camera is underwater fix clouds clipping into moon - // camera above water: class1\deferred\cloudsF.glsl - // camera below water: class2\windlight\coudsV.glsl - // See: starsV.glsl, cloudsV.glsl, moonF.glsl - gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl deleted file mode 100644 index 650009d393..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @file class2\wl\cloudsV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -////////////////////////////////////////////////////////////////////////// -// The vertex shader for creating the atmospheric sky -/////////////////////////////////////////////////////////////////////////////// - -// Output parameters -VARYING vec3 vary_CloudColorSun; -VARYING vec3 vary_CloudColorAmbient; -VARYING float vary_CloudDensity; - -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; -VARYING float altitude_blend_factor; - -// Inputs -uniform vec3 camPosLocal; - -uniform vec3 lightnorm; -uniform vec3 sunlight_color; -uniform vec3 moonlight_color; -uniform int sun_up_factor; -uniform vec3 ambient_color; -uniform vec3 blue_horizon; -uniform vec3 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float max_y; - -uniform vec3 glow; -uniform float sun_moon_glow_factor; - -uniform vec3 cloud_color; - -uniform float cloud_scale; - -// NOTE: Keep these in sync! -// indra\newview\app_settings\shaders\class1\deferred\skyV.glsl -// indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl -// indra\newview\app-settings\shaders\class2\windlight\cloudsV.glsl -// indra\newview\lllegacyatmospherics.cpp -// indra\newview\llsettingsvo.cpp -void main() -{ - // World / view / projection - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - - // Texture coords - // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll - vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial - - vary_texcoord0.xy -= 0.5; - vary_texcoord0.xy /= cloud_scale; - vary_texcoord0.xy += 0.5; - - vary_texcoord1 = vary_texcoord0; - vary_texcoord1.x += lightnorm.x * 0.0125; - vary_texcoord1.y += lightnorm.z * 0.0125; - - vary_texcoord2 = vary_texcoord0 * 16.; - vary_texcoord3 = vary_texcoord1 * 16.; - - // Get relative position - vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - - // fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude - altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); - - // Adj position vector to clamp altitude - if (rel_pos.y > 0.) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0.) - { - rel_pos *= (-32000. / rel_pos.y); - } - - // Can normalize then - vec3 rel_pos_norm = normalize(rel_pos); - float rel_pos_len = length(rel_pos); - - // Initialize temp variables - vec3 sunlight = sunlight_color; - vec3 light_atten; - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); - vec3 blue_weight = blue_density / combined_haze; - vec3 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - haze_glow *= sun_moon_glow_factor; - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - - // Increase ambient when there are more clouds - vec3 tmpAmbient = ambient_color; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow); - - // Haze color below cloud - vec3 additiveColorBelowCloud = - (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - - // CLOUDS - sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP - off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); - sunlight *= exp(-light_atten * off_axis); - - // Cloud color out - vary_CloudColorSun = (sunlight * haze_glow) * cloud_color; - vary_CloudColorAmbient = tmpAmbient * cloud_color; - - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - vary_CloudColorSun *= combined_haze; - vary_CloudColorAmbient *= combined_haze; - vec3 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); - - // Make a nice cloud density based on the cloud_shadow value that was passed in. - vary_CloudDensity = 2. * (cloud_shadow - 0.25); - - // Combine these to minimize register use - vary_CloudColorAmbient += oHazeColorBelowCloud; - - // needs this to compile on mac - //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); - - // END CLOUDS -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index a32a572461..9a9b179e6a 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -23,7 +23,6 @@ * $/LicenseInfo$ */ uniform float gamma; -uniform int no_atmo; vec3 getAtmosAttenuation(); vec3 getAdditiveColor(); @@ -33,10 +32,6 @@ vec3 linear_to_srgb(vec3 col); vec3 scaleSoftClipFragLinear(vec3 light) { // identical to non-linear version and that's probably close enough - if (no_atmo == 1) - { - return light; - } //soft clip effect: light = 1. - clamp(light, vec3(0.), vec3(1.)); light = 1. - pow(light, vec3(gamma)); // s/b inverted already CPU-side @@ -45,10 +40,6 @@ vec3 scaleSoftClipFragLinear(vec3 light) vec3 scaleSoftClipFrag(vec3 light) { - if (no_atmo == 1) - { - return light; - } //soft clip effect: light = 1. - clamp(light, vec3(0.), vec3(1.)); light = 1. - pow(light, vec3(gamma)); // s/b inverted already CPU-side diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl deleted file mode 100644 index 7a229e0f5e..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file class2/windlight/skyF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -///////////////////////////////////////////////////////////////////////// -// The fragment shader for the sky -///////////////////////////////////////////////////////////////////////// - -VARYING vec3 vary_HazeColor; - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - -void main() -{ - // Potential Fill-rate optimization. Add cloud calculation - // back in and output alpha of 0 (so that alpha culling kills - // the fragment) if the sky wouldn't show up because the clouds - // are fully opaque. - - vec3 color; - color = vary_HazeColor; - color.rgb *= 2.; - /// Gamma correct for WL (soft clip effect). - frag_color.rgb = scaleSoftClip(color.rgb); - frag_color.a = 1.0; -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl deleted file mode 100644 index 8f7726bb0b..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ /dev/null @@ -1,147 +0,0 @@ -/** - * @file class2\wl\skyV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; - -// SKY //////////////////////////////////////////////////////////////////////// -// The vertex shader for creating the atmospheric sky -/////////////////////////////////////////////////////////////////////////////// - -// Output parameters -VARYING vec3 vary_HazeColor; - -// Inputs -uniform vec3 camPosLocal; - -uniform vec3 lightnorm; -uniform vec3 sunlight_color; -uniform vec3 moonlight_color; -uniform int sun_up_factor; -uniform vec3 ambient_color; -uniform vec3 blue_horizon; -uniform vec3 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float distance_multiplier; -uniform float max_y; - -uniform vec3 glow; -uniform float sun_moon_glow_factor; - -void main() -{ - // World / view / projection - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - - gl_Position = pos; - - // Get relative position - vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - - // Adj position vector to clamp altitude - if (rel_pos.y > 0.) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0.) - { - rel_pos *= (-32000. / rel_pos.y); - } - - // Can normalize then - vec3 rel_pos_norm = normalize(rel_pos); - - float rel_pos_len = length(rel_pos); - - // Initialize temp variables - vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color; - vec3 light_atten; - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); - vec3 blue_weight = blue_density / combined_haze; - vec3 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - - vec3 color = - (blue_horizon * blue_weight * (sunlight + ambient_color) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color)); - - // Final atmosphere additive - color *= (1. - combined_haze); - - // Increase ambient when there are more clouds - vec3 tmpAmbient = ambient_color; - tmpAmbient += max(vec3(0), (1. - ambient_color)) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= max(0.0, (1. - cloud_shadow)); - - // Haze color below cloud - vec3 additiveColorBelowCloud = - (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - - // At horizon, blend high altitude sky color towards the darker color below the clouds - color += (additiveColorBelowCloud - color) * (1. - sqrt(combined_haze)); - - // Haze color above cloud - vary_HazeColor = color; -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index ecf0430a88..c509d865ba 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -30,8 +30,6 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); -uniform int no_atmo; - vec3 srgb_to_linear(vec3 col); vec3 linear_to_srgb(vec3 col); diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 160d360256..b90de7609b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -43,9 +43,6 @@ VARYING vec3 vary_position; uniform samplerCube environmentMap; -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() -uniform int no_atmo; - vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); vec3 fullbrightScaleSoftClip(vec3 light); @@ -59,12 +56,8 @@ vec3 srgb_to_linear(vec3 c); void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity); -void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm); void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); -// See: -// class1\deferred\fullbrightShinyF.glsl -// class1\lighting\lightFullbrightShinyF.glsl void main() { #ifdef HAS_DIFFUSE_LOOKUP @@ -76,32 +69,32 @@ void main() color.rgb *= vertex_color.rgb; // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - vec3 pos = vary_position; - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - float env_intensity = vertex_color.a; - - vec3 ambenv; - vec3 glossenv; - vec3 legacyenv; - vec3 norm = normalize(vary_texcoord1.xyz); - vec4 spec = vec4(0,0,0,0); - sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity); - applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); - - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); - } +#ifndef IS_HUD + + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + vec3 pos = vary_position; + calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); + + float env_intensity = vertex_color.a; + + vec3 ambenv; + vec3 glossenv; + vec3 legacyenv; + vec3 norm = normalize(vary_texcoord1.xyz); + vec4 spec = vec4(0,0,0,0); + sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity); + applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); + + color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = fullbrightScaleSoftClip(color.rgb); + color.rgb = srgb_to_linear(color.rgb); +#endif color.a = 1.0; - - color.rgb = srgb_to_linear(color.rgb); + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index bb3be7260b..8b1d41776f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -643,7 +643,7 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, glossenv = sampleProbes(pos, normalize(refnormpersp), lod, errorCorrect); #if defined(SSR) - if (cube_snapshot != 1) + if (cube_snapshot != 1 && glossiness >= 0.9) { vec4 ssr = vec4(0); //float w = tapScreenSpaceReflection(errorCorrect ? 1 : 4, tc, pos, norm, ssr, sceneMap); diff --git a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl index a5e0adf8fa..83454631d4 100644 --- a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl @@ -55,7 +55,7 @@ VARYING vec4 littleWave; VARYING vec4 view; in vec3 vary_position; -vec4 applyWaterFogViewLinear(vec3 pos, vec4 color); +vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit); void main() { @@ -77,5 +77,5 @@ void main() vec4 fb = vec4(waterFogColorLinear, 0.0); #endif - frag_color = applyWaterFogViewLinear(vary_position, fb); + frag_color = applyWaterFogViewLinearNoClip(vary_position, fb, vec3(1)); } diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index b792feee2a..3d721cd048 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -37,6 +37,10 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit); // PBR interface +vec2 BRDF(float NoV, float roughness); + +void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor); + vec3 pbrIbl(vec3 diffuseColor, vec3 specularColor, vec3 radiance, // radiance map sample @@ -52,6 +56,22 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, vec3 v, // surface point to camera vec3 l); //surface point to light +vec3 pbrBaseLight(vec3 diffuseColor, + vec3 specularColor, + float metallic, + vec3 pos, + vec3 norm, + float perceptualRoughness, + vec3 light_dir, + vec3 sunlit, + float scol, + vec3 radiance, + vec3 irradiance, + vec3 colorEmissive, + float ao, + vec3 additive, + vec3 atten); + uniform sampler2D bumpMap; uniform sampler2D bumpMap2; uniform float blend_factor; @@ -112,8 +132,6 @@ vec3 getPositionWithNDC(vec3 ndc); void main() { - vec4 color; - vN = vary_normal; vT = vary_tangent; vB = cross(vN, vT); @@ -151,30 +169,28 @@ void main() vec3 waver = wavef*3; - wavef = transform_normal(wavef); + vec3 up = transform_normal(vec3(0,0,1)); + float vdu = -dot(viewVec, up)*2; + + vec3 wave_ibl = wavef; + wave_ibl.z *= 2.0; + wave_ibl = transform_normal(normalize(wave_ibl)); - //wavef.z *= max(-viewVec.z, 0.1); + vec3 norm = transform_normal(normalize(wavef)); + + vdu = clamp(vdu, 0, 1); + wavef.z *= max(vdu*vdu*vdu, 0.1); wavef = normalize(wavef); - //get base fresnel components - - vec3 df = vec3( - dot(viewVec, wave1), - dot(viewVec, (wave2 + wave3) * 0.5), - dot(viewVec, wave3) - ) * fresnelScale + fresnelOffset; - + //wavef = vec3(0, 0, 1); + wavef = transform_normal(wavef); + float dist2 = dist; dist = max(dist, 5.0); float dmod = sqrt(dist); - float df1 = df.x + df.y + df.z; - - - - //figure out distortion vector (ripply) vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0); @@ -203,66 +219,58 @@ void main() fb = applyWaterFogViewLinear(refPos, fb, sunlit); #else - vec4 fb = vec4(waterFogColorLinear.rgb, 0.0); + vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(0.5), sunlit); #endif - vec3 v = -viewVec; - float NdotV = clamp(abs(dot(wavef.xyz, v)), 0.001, 1.0); - - float metallic = fresnelOffset * 0.1; // fudge -- use fresnelOffset as metalness - float roughness = 0.1; - float gloss = 1.0 - roughness; + float metallic = 0.0; + float perceptualRoughness = 0.1; + float gloss = 1.0 - perceptualRoughness; + + vec3 irradiance = vec3(0); + vec3 radiance = vec3(0); + sampleReflectionProbes(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss); - vec3 baseColor = vec3(0.25); - vec3 f0 = vec3(0.04); - vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0); - diffuseColor *= gloss; + irradiance = vec3(0); - vec3 specularColor = mix(f0, baseColor.rgb, metallic); + vec3 diffuseColor; + vec3 specularColor; + calcDiffuseSpecular(vec3(1), metallic, diffuseColor, specularColor); - vec3 refnorm = normalize(wavef + vary_normal); - //vec3 refnorm = wavef; - - vec3 irradiance = vec3(0); - vec3 radiance = vec3(0); - sampleReflectionProbes(irradiance, radiance, distort, pos, refnorm, gloss, true); - radiance *= 0.5; - irradiance = fb.rgb; + vec3 v = -normalize(pos.xyz); - color.rgb = pbrIbl(diffuseColor, specularColor, radiance, irradiance, gloss, NdotV, 0.0); + float scol = 1.0; + vec3 colorEmissive = vec3(0); + float ao = 1.0; + vec3 light_dir = transform_normal(lightDir); - // fudge -- for punctual lighting, pretend water is metallic - diffuseColor = vec3(0); - specularColor = vec3(1); - roughness = 0.1; - float scol = 1.0; // TODO -- incorporate shadow map + perceptualRoughness = 0.0; + metallic = 1.0; - //color.rgb += pbrPunctual(diffuseColor, specularColor, roughness, metallic, wavef, v, vary_light_dir) * sunlit * 2.75 * scol; + float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0); - //get specular component - float spec = clamp(dot(vary_light_dir, (reflect(viewVec, wavef))), 0.0, 1.0); + vec3 punctual = pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir)); - //harden specular - spec = pow(spec, 128.0); + vec3 color = punctual * sunlit * 2.75 * scol; - color.rgb += spec * specular; + color = atmosFragLightingLinear(color, additive, atten); + color = scaleSoftClipFragLinear(color); - color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); - color.rgb = scaleSoftClipFragLinear(color.rgb); + vec3 ibl = pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0); - color.a = 0.f; - //color.rgb = fb.rgb; - //color.rgb = vec3(depth*depth*depth*depth); - //color.rgb = srgb_to_linear(normalize(refPos) * 0.5 + 0.5); - //color.rgb = srgb_to_linear(normalize(pos) * 0.5 + 0.5); - //color.rgb = srgb_to_linear(wavef * 0.5 + 0.5); + color += ibl; - //color.rgb = radiance; - frag_color = color; + float nv = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0); + vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0); + float f = 1.0-brdf.y; //1.0 - (brdf.x+brdf.y); + f *= 0.9; + f *= f; -#if defined(WATER_EDGE) - gl_FragDepth = 0.9999847f; -#endif - + f = clamp(f, 0, 1); + //fb.rgb *= 1.; + + color = mix(color, fb.rgb, f); + float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05); + + frag_color = vec4(color, spec); //*sunAngle2); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/errorF.glsl index f4ec1ec532..573bb5887b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/errorF.glsl @@ -1,9 +1,9 @@ /** - * @file alphaF.glsl + * @file errorF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2023, 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 @@ -23,13 +23,12 @@ * $/LicenseInfo$ */ -//class1/deferred/alphaF.glsl - + // error fallback on compilation failure out vec4 frag_color; void main() { - frag_color = vec4(1,0,1,0.5); + frag_color = vec4(1,0,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl b/indra/newview/app_settings/shaders/errorV.glsl index 47e9d15fbc..e4b362c8c8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl +++ b/indra/newview/app_settings/shaders/errorV.glsl @@ -1,9 +1,9 @@ /** - * @file sunLightF.glsl + * @file errorV.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2023, 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 @@ -23,15 +23,13 @@ * $/LicenseInfo$ */ + // fallback shader for whenever there is a compilation error uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -uniform vec2 screen_res; +in vec3 position; void main() { - //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_Position = pos; + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); } + diff --git a/indra/newview/app_settings/shaders/shader_hierarchy.txt b/indra/newview/app_settings/shaders/shader_hierarchy.txt deleted file mode 100644 index 81e1327178..0000000000 --- a/indra/newview/app_settings/shaders/shader_hierarchy.txt +++ /dev/null @@ -1,15 +0,0 @@ -Second Life shader variants are referred to as "classes." - -When a shader of a particular class is loaded, a lower class may -be loaded if the class requested doesn't exist or fails to load -for any reason. In general, shaders that require more resources -or later hardware capabilities should be higher class and -lower classes can be used for fallback implementations or lower -detail settings. - -Which class is chosen will generally depend on graphics preferences. - -Previously, someone tried to enumerate the shaders here, but don't do -that. It messes with searches and the shader hierarchy changes often. - - diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 360f4d5fc4..0f8dcf7f73 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -41,7 +41,6 @@ RenderFlexTimeFactor 1 1.0 RenderFogRatio 1 4.0 RenderGamma 1 0 RenderGlowResolutionPow 1 9 -RenderGround 1 1 RenderMaxPartCount 1 8192 RenderObjectBump 1 1 RenderLocalLights 1 1 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 40e4436763..afe95c86d9 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -41,7 +41,6 @@ RenderFlexTimeFactor 1 1.0 RenderFogRatio 1 4.0 RenderGamma 1 0 RenderGlowResolutionPow 1 9 -RenderGround 1 1 RenderMaxPartCount 1 8192 RenderObjectBump 1 1 RenderLocalLights 1 1 diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp index e09527a34b..d3f988d715 100644 --- a/indra/newview/llaccountingcostmanager.cpp +++ b/indra/newview/llaccountingcostmanager.cpp @@ -96,11 +96,7 @@ void LLAccountingCostManager::accountingCostCoro(std::string url, LLSD dataToPost = LLSD::emptyMap(); dataToPost[keystr.c_str()] = objectList; - LLAccountingCostObserver* observer = observerHandle.get(); - LLUUID transactionId = observer->getTransactionID(); - observer = NULL; - - + LLAccountingCostObserver* observer = NULL; LLSD results = httpAdapter->postAndSuspend(httpRequest, url, dataToPost); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 9018a5f168..af4c68e41f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -940,11 +940,7 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { gSky.mVOSkyp->setRegion(regionp); } - if (gSky.mVOGroundp) - { - gSky.mVOGroundp->setRegion(regionp); - } - + if (regionp->capabilitiesReceived()) { regionp->requestSimulatorFeatures(); diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index 5214f4b838..1090888c1c 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -46,6 +46,7 @@ - (void)dealloc { + [currentInputLanguage release]; [super dealloc]; } @@ -199,12 +200,14 @@ - (bool) romanScript { - // How to add support for new languages with the input window: - // Simply append this array with the language code (ja for japanese, ko for korean, zh for chinese, etc.) - NSArray *nonRomanScript = [[NSArray alloc] initWithObjects:@"ja", @"ko", @"zh-Hant", @"zh-Hans", nil]; - if ([nonRomanScript containsObject:currentInputLanguage]) - { - return false; + @autoreleasepool { + // How to add support for new languages with the input window: + // Simply append this array with the language code (ja for japanese, ko for korean, zh for chinese, etc.) + NSArray* nonRomanScript = @[@"ja", @"ko", @"zh-Hant", @"zh-Hans"]; + if ([nonRomanScript containsObject:currentInputLanguage]) + { + return false; + } } return true; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 909f32cd21..3c93a9df7e 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3987,7 +3987,7 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // existence of AIS as an indicator the fix is present. Does // not actually use AIS to create the category. inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); - LLUUID folder_id = gInventory.createNewCategory( + gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, new_folder_name, diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index dd4363d2a4..061feba0a4 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -135,6 +135,10 @@ #include "vlc/libvlc_version.h" #endif // LL_LINUX +#if LL_DARWIN +#include "llwindowmacosx.h" +#endif + // Third party library includes #include <boost/bind.hpp> #include <boost/foreach.hpp> @@ -560,6 +564,7 @@ static void settings_to_globals() LLWorldMapView::setScaleSetting(gSavedSettings.getF32("MapScale")); #if LL_DARWIN + LLWindowMacOSX::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL"); gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI"); #endif } @@ -1697,7 +1702,8 @@ bool LLAppViewer::cleanup() { if (!isSecondInstance()) { - LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); + std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv"); + LLSceneMonitor::instance().dumpToFile(dump_path); } LLSceneMonitor::deleteSingleton(); } diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 275f17b02a..293c9d60a1 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -364,11 +364,10 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi } } -// static // Called every frame - send render weight requests to every region void LLAvatarRenderInfoAccountant::idle() { - if (mRenderInfoScanTimer.hasExpired()) + if (mRenderInfoScanTimer.hasExpired() && !LLApp::isExiting()) { LL_DEBUGS("AvatarRenderInfo") << "Scanning regions for render info updates" << LL_ENDL; diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp index 1c69dadb12..7ad06f8eaa 100644 --- a/indra/newview/llbuycurrencyhtml.cpp +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -41,7 +41,7 @@ class LLBuyCurrencyHTMLHandler : { public: // requests will be throttled from a non-trusted browser - LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_ALLOW ) {} + LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_THROTTLE) {} bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 1ad2157df0..df79043b00 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -650,8 +650,7 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) { if(mBuddyInfo.find(agent_id) != mBuddyInfo.end()) { - if (((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS) - && !gAgent.isDoNotDisturb()) + if (((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS)) { LLSD args; args["NAME"] = LLSLURL("agent", agent_id, "displayname").getSLURLString(); @@ -719,11 +718,12 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) // we were tracking someone who went offline deleteTrackingData(); } - } - if(chat_notify) - { - // Look up the name of this agent for the notification - LLAvatarNameCache::get(agent_id,boost::bind(&on_avatar_name_cache_notify,_1, _2, online, payload)); + + if(chat_notify) + { + // Look up the name of this agent for the notification + LLAvatarNameCache::get(agent_id,boost::bind(&on_avatar_name_cache_notify,_1, _2, online, payload)); + } } mModifyMask |= LLFriendObserver::ONLINE; diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 7188b9136c..9a608fba8e 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -141,6 +141,18 @@ public: { mAvatarNameCacheConnection.disconnect(); } + auto menu = mPopupMenuHandleAvatar.get(); + if (menu) + { + menu->die(); + mPopupMenuHandleAvatar.markDead(); + } + menu = mPopupMenuHandleObject.get(); + if (menu) + { + menu->die(); + mPopupMenuHandleObject.markDead(); + } } BOOL handleMouseUp(S32 x, S32 y, MASK mask) @@ -567,36 +579,6 @@ public: BOOL postBuild() { - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable; - - registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2)); - registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2)); - registrar_enable.add("AvatarIcon.Enable", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemEnabled, this, _2)); - registrar_enable.add("AvatarIcon.Visible", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemVisible, this, _2)); - registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2)); - registrar_enable.add("ObjectIcon.Visible", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2)); - - LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if (menu) - { - mPopupMenuHandleAvatar = menu->getHandle(); - } - else - { - LL_WARNS() << " Failed to create menu_avatar_icon.xml" << LL_ENDL; - } - - menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_object_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if (menu) - { - mPopupMenuHandleObject = menu->getHandle(); - } - else - { - LL_WARNS() << " Failed to create menu_object_icon.xml" << LL_ENDL; - } - setDoubleClickCallback(boost::bind(&LLChatHistoryHeader::showInspector, this)); setMouseEnterCallback(boost::bind(&LLChatHistoryHeader::showInfoCtrl, this)); @@ -884,13 +866,53 @@ protected: void showObjectContextMenu(S32 x,S32 y) { LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandleObject.get(); - if(menu) + if (!menu) + { + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable; + registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2)); + registrar_enable.add("ObjectIcon.Visible", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2)); + + menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_object_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mPopupMenuHandleObject = menu->getHandle(); + menu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, menu, x, y); + } + else + { + LL_WARNS() << " Failed to create menu_object_icon.xml" << LL_ENDL; + } + } + else + { LLMenuGL::showPopup(this, menu, x, y); + } } void showAvatarContextMenu(S32 x,S32 y) { LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandleAvatar.get(); + if (!menu) + { + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable; + registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2)); + registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2)); + registrar_enable.add("AvatarIcon.Enable", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemEnabled, this, _2)); + registrar_enable.add("AvatarIcon.Visible", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemVisible, this, _2)); + + menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mPopupMenuHandleAvatar = menu->getHandle(); + } + else + { + LL_WARNS() << " Failed to create menu_avatar_icon.xml" << LL_ENDL; + } + } if(menu) { @@ -1082,10 +1104,7 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p) LLSD LLChatHistory::getValue() const { - LLSD* text=new LLSD(); - text->assign(mEditor->getText()); - return *text; - + return LLSD(mEditor->getText()); } LLChatHistory::~LLChatHistory() diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 0f187b0ecf..cc4f4536a4 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -67,7 +67,6 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p) , mMaxDisplayedCount(p.max_displayed_count) , mIsNewMessagesState(false) , mFlashToLitTimer(NULL) - , mContextMenu(NULL) { LLButton::Params button_params = p.button; mButton = LLUICtrlFactory::create<LLButton>(button_params); @@ -79,6 +78,12 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p) LLSysWellChiclet::~LLSysWellChiclet() { mFlashToLitTimer->unset(); + LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); + if (menu) + { + menu->die(); + mContextMenuHandle.markDead(); + } } void LLSysWellChiclet::setCounter(S32 counter) @@ -145,14 +150,16 @@ void LLSysWellChiclet::updateWidget(bool is_window_empty) // virtual BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if(!mContextMenu) + LLContextMenu* menu_avatar = mContextMenuHandle.get(); + if(!menu_avatar) { createMenu(); + menu_avatar = mContextMenuHandle.get(); } - if (mContextMenu) + if (menu_avatar) { - mContextMenu->show(x, y); - LLMenuGL::showPopup(this, mContextMenu, x, y); + menu_avatar->show(x, y); + LLMenuGL::showPopup(this, menu_avatar, x, y); } return TRUE; } @@ -192,7 +199,7 @@ bool LLNotificationChiclet::enableMenuItem(const LLSD& user_data) void LLNotificationChiclet::createMenu() { - if(mContextMenu) + if(mContextMenuHandle.get()) { LL_WARNS() << "Menu already exists" << LL_ENDL; return; @@ -207,10 +214,14 @@ void LLNotificationChiclet::createMenu() boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2)); llassert(LLMenuGL::sMenuContainer != NULL); - mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu> + LLContextMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu> ("menu_notification_well_button.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mContextMenuHandle = menu->getHandle(); + } } /*virtual*/ @@ -309,10 +320,19 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p) , mDefaultWidth(p.rect().getWidth()) , mNewMessagesIcon(NULL) , mChicletButton(NULL) -, mPopupMenu(NULL) { } +LLIMChiclet::~LLIMChiclet() +{ + auto menu = mPopupMenuHandle.get(); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } +} + /* virtual*/ BOOL LLIMChiclet::postBuild() { @@ -364,16 +384,18 @@ void LLIMChiclet::setToggleState(bool toggle) BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if(!mPopupMenu) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if(!menu) { createPopupMenu(); + menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); } - if (mPopupMenu) + if (menu) { updateMenuItems(); - mPopupMenu->arrangeAndClear(); - LLMenuGL::showPopup(this, mPopupMenu, x, y); + menu->arrangeAndClear(); + LLMenuGL::showPopup(this, menu, x, y); } return TRUE; @@ -381,15 +403,16 @@ BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) void LLIMChiclet::hidePopupMenu() { - if (mPopupMenu) + auto menu = mPopupMenuHandle.get(); + if (menu) { - mPopupMenu->setVisible(FALSE); + menu->setVisible(FALSE); } } bool LLIMChiclet::canCreateMenu() { - if(mPopupMenu) + if(mPopupMenuHandle.get()) { LL_WARNS() << "Menu already exists" << LL_ENDL; return false; @@ -1107,8 +1130,13 @@ void LLScriptChiclet::createPopupMenu() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("ScriptChiclet.Action", boost::bind(&LLScriptChiclet::onMenuItemClicked, this, _2)); - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL> + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL> ("menu_script_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mPopupMenuHandle = menu->getHandle(); + } + } ////////////////////////////////////////////////////////////////////////// @@ -1185,8 +1213,12 @@ void LLInvOfferChiclet::createPopupMenu() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("InvOfferChiclet.Action", boost::bind(&LLInvOfferChiclet::onMenuItemClicked, this, _2)); - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL> + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL> ("menu_inv_offer_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mPopupMenuHandle = menu->getHandle(); + } } // EOF diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index aceedda07e..58a797218f 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -252,7 +252,7 @@ public: {}; - virtual ~LLIMChiclet() {}; + virtual ~LLIMChiclet(); /** * It is used for default setting up of chicklet:click handler, etc. @@ -325,7 +325,7 @@ protected: bool canCreateMenu(); - LLMenuGL* mPopupMenu; + LLHandle<LLUICtrl> mPopupMenuHandle; bool mShowSpeaker; bool mCounterEnabled; @@ -519,7 +519,7 @@ protected: bool mIsNewMessagesState; LLFlashTimer* mFlashToLitTimer; - LLContextMenu* mContextMenu; + LLHandle<LLContextMenu> mContextMenuHandle; }; class LLNotificationChiclet : public LLSysWellChiclet diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp index 23e2271eae..74f37961c7 100644 --- a/indra/newview/llcommandhandler.cpp +++ b/indra/newview/llcommandhandler.cpp @@ -39,6 +39,7 @@ #define THROTTLE_PERIOD 5 // required seconds between throttled commands static LLCommandDispatcherListener sCommandDispatcherListener; +const std::string LLCommandHandler::NAV_TYPE_CLICKED = "clicked"; //--------------------------------------------------------------------------- // Underlying registry for command handlers, not directly accessible. @@ -64,6 +65,9 @@ public: bool trusted_browser); private: + void notifySlurlBlocked(); + void notifySlurlThrottled(); + friend LLSD LLCommandDispatcher::enumerate(); std::map<std::string, LLCommandHandlerInfo> mMap; }; @@ -96,8 +100,6 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, const std::string& nav_type, bool trusted_browser) { - static bool slurl_blocked = false; - static bool slurl_throttled = false; static F64 last_throttle_time = 0.0; F64 cur_time = 0.0; std::map<std::string, LLCommandHandlerInfo>::iterator it = mMap.find(cmd); @@ -115,44 +117,45 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, // block request from external browser, but report as // "handled" because it was well formatted. LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL; - if (! slurl_blocked) - { - if (LLStartUp::getStartupState() >= STATE_BROWSER_INIT) - { - // Note: commands can arrive before we initialize everything we need for Notification. - LLNotificationsUtil::add("BlockedSLURL"); - } - slurl_blocked = true; - } + notifySlurlBlocked(); return true; + case LLCommandHandler::UNTRUSTED_CLICK_ONLY: + if (nav_type == LLCommandHandler::NAV_TYPE_CLICKED + && info.mHandler->canHandleUntrusted(params, query_map, web, nav_type)) + { + break; + } + LL_WARNS_ONCE("SLURL") << "Blocked SLURL click-only command " << cmd << " from untrusted browser" << LL_ENDL; + notifySlurlBlocked(); + return true; + case LLCommandHandler::UNTRUSTED_THROTTLE: + //skip initial request from external browser before STATE_BROWSER_INIT + if (LLStartUp::getStartupState() == STATE_FIRST) + { + return true; + } + if (!info.mHandler->canHandleUntrusted(params, query_map, web, nav_type)) + { + LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL; + notifySlurlBlocked(); + return true; + } // if users actually click on a link, we don't need to throttle it // (throttling mechanism is used to prevent an avalanche of clicks via // javascript - if ( nav_type == "clicked" ) + if (nav_type == LLCommandHandler::NAV_TYPE_CLICKED) { break; } - //skip initial request from external browser before STATE_BROWSER_INIT - if (LLStartUp::getStartupState() == STATE_FIRST) - { - return true; - } cur_time = LLTimer::getElapsedSeconds(); if (cur_time < last_throttle_time + THROTTLE_PERIOD) { // block request from external browser if it happened // within THROTTLE_PERIOD seconds of the last command LL_WARNS_ONCE("SLURL") << "Throttled SLURL command from untrusted browser" << LL_ENDL; - if (! slurl_throttled) - { - if (LLStartUp::getStartupState() >= STATE_BROWSER_INIT) - { - LLNotificationsUtil::add("ThrottledSLURL"); - } - slurl_throttled = true; - } + notifySlurlThrottled(); return true; } last_throttle_time = cur_time; @@ -163,6 +166,34 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, return info.mHandler->handle(params, query_map, web); } +void LLCommandHandlerRegistry::notifySlurlBlocked() +{ + static bool slurl_blocked = false; + if (!slurl_blocked) + { + if (LLStartUp::getStartupState() >= STATE_BROWSER_INIT) + { + // Note: commands can arrive before we initialize everything we need for Notification. + LLNotificationsUtil::add("BlockedSLURL"); + } + slurl_blocked = true; + } +} + +void LLCommandHandlerRegistry::notifySlurlThrottled() +{ + static bool slurl_throttled = false; + if (!slurl_throttled) + { + if (LLStartUp::getStartupState() >= STATE_BROWSER_INIT) + { + // Note: commands can arrive before we initialize everything we need for Notification. + LLNotificationsUtil::add("ThrottledSLURL"); + } + slurl_throttled = true; + } +} + //--------------------------------------------------------------------------- // Automatic registration of commands, runs before main() //--------------------------------------------------------------------------- @@ -230,6 +261,7 @@ symbol_info symbols[] = { ent(LLCommandHandler::UNTRUSTED_ALLOW), // allow commands from untrusted browsers ent(LLCommandHandler::UNTRUSTED_BLOCK), // ignore commands from untrusted browsers + ent(LLCommandHandler::UNTRUSTED_CLICK_ONLY), // allow untrusted, but only if clicked ent(LLCommandHandler::UNTRUSTED_THROTTLE) // allow untrusted, but only a few per min. }; diff --git a/indra/newview/llcommandhandler.h b/indra/newview/llcommandhandler.h index 1e0895565a..763e3ee51f 100644 --- a/indra/newview/llcommandhandler.h +++ b/indra/newview/llcommandhandler.h @@ -65,9 +65,12 @@ public: { UNTRUSTED_ALLOW, // allow commands from untrusted browsers UNTRUSTED_BLOCK, // ignore commands from untrusted browsers + UNTRUSTED_CLICK_ONLY, // allow untrusted, but only if clicked UNTRUSTED_THROTTLE // allow untrusted, but only a few per min. }; + static const std::string NAV_TYPE_CLICKED; + LLCommandHandler(const char* command, EUntrustedAccess untrusted_access); // Automatically registers object to get called when // command is executed. All commands can be processed @@ -76,6 +79,13 @@ public: virtual ~LLCommandHandler(); + virtual bool canHandleUntrusted( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web, + const std::string& nav_type) + { return true; } + virtual bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) = 0; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 7d869562ca..45df4d0eee 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -499,7 +499,6 @@ void LLDrawable::makeActive() pcode == LLViewerObject::LL_VO_SURFACE_PATCH || pcode == LLViewerObject::LL_VO_PART_GROUP || pcode == LLViewerObject::LL_VO_HUD_PART_GROUP || - pcode == LLViewerObject::LL_VO_GROUND || pcode == LLViewerObject::LL_VO_SKY) { LL_ERRS() << "Static viewer object has active drawable!" << LL_ENDL; @@ -984,8 +983,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) bool rebuild = (!volume && getRenderType() != LLPipeline::RENDER_TYPE_TREE && getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN && - getRenderType() != LLPipeline::RENDER_TYPE_SKY && - getRenderType() != LLPipeline::RENDER_TYPE_GROUND); + getRenderType() != LLPipeline::RENDER_TYPE_SKY); if (rebuild) { diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index a5990492b1..7fe8b02cc5 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -36,7 +36,6 @@ #include "lldrawpoolavatar.h" #include "lldrawpoolbump.h" #include "lldrawpoolmaterials.h" -#include "lldrawpoolground.h" #include "lldrawpoolpbropaque.h" #include "lldrawpoolsimple.h" #include "lldrawpoolsky.h" @@ -80,9 +79,6 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0) case POOL_FULLBRIGHT: poolp = new LLDrawPoolFullbright(); break; - case POOL_INVISIBLE: - poolp = new LLDrawPoolInvisible(); - break; case POOL_GLOW: poolp = new LLDrawPoolGlow(); break; @@ -109,9 +105,6 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0) case POOL_WATER: poolp = new LLDrawPoolWater(); break; - case POOL_GROUND: - poolp = new LLDrawPoolGround(); - break; case POOL_BUMP: poolp = new LLDrawPoolBump(); break; @@ -458,7 +451,7 @@ void LLRenderPass::pushGLTFBatches(U32 type) auto& mat = params.mGLTFMaterial; - mat->bind(); + mat->bind(params.mTexture); LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); @@ -489,7 +482,7 @@ void LLRenderPass::pushRiggedGLTFBatches(U32 type) auto& mat = params.mGLTFMaterial; - mat->bind(); + mat->bind(params.mTexture); LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 7050723116..2c5e31f579 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -54,7 +54,6 @@ public: // based on fill rate and likelihood to occlude future passes (faster, large occluders first). // POOL_SIMPLE = 1, - POOL_GROUND, POOL_FULLBRIGHT, POOL_BUMP, POOL_TERRAIN, @@ -66,7 +65,6 @@ public: POOL_FULLBRIGHT_ALPHA_MASK, POOL_SKY, POOL_WL_SKY, - POOL_INVISIBLE, // see below * POOL_AVATAR, POOL_CONTROL_AV, // Animesh POOL_GLOW, @@ -76,11 +74,6 @@ public: POOL_ALPHA_POST_WATER, POOL_ALPHA, // note there is no actual "POOL_ALPHA" but pre-water and post-water pools consume POOL_ALPHA faces NUM_POOL_TYPES, - // * invisiprims work by rendering to the depth buffer but not the color buffer, occluding anything rendered after them - // - and the LLDrawPool types enum controls what order things are rendered in - // - so, it has absolute control over what invisprims block - // ...invisiprims being rendered in pool_invisible - // ...shiny/bump mapped objects in rendered in POOL_BUMP }; LLDrawPool(const U32 type); @@ -191,6 +184,8 @@ public: PASS_NORMSPEC_EMISSIVE_RIGGED, PASS_GLOW, PASS_GLOW_RIGGED, + PASS_GLTF_GLOW, + PASS_GLTF_GLOW_RIGGED, PASS_ALPHA, PASS_ALPHA_RIGGED, PASS_ALPHA_MASK, diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 4c8d32fad2..f4b426c5ab 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -113,7 +113,6 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d { shader->bind(); } - shader->uniform1i(LLShaderMgr::NO_ATMO, (LLPipeline::sRenderingHUDs) ? 1 : 0); shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f / 2.2f)); if (LLPipeline::sRenderingHUDs) @@ -173,16 +172,28 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) } // prepare shaders - emissive_shader = (LLPipeline::sRenderDeferred) ? &gDeferredEmissiveProgram : - (LLPipeline::sUnderWaterRender) ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram; + llassert(LLPipeline::sRenderDeferred); + + emissive_shader = &gDeferredEmissiveProgram; prepare_alpha_shader(emissive_shader, true, false, water_sign); - fullbright_shader = (LLPipeline::sImpostorRender) ? &gDeferredFullbrightAlphaMaskProgram : - (LLPipeline::sUnderWaterRender) ? &gDeferredFullbrightWaterAlphaProgram : &gDeferredFullbrightAlphaMaskAlphaProgram; + pbr_emissive_shader = &gPBRGlowProgram; + prepare_alpha_shader(pbr_emissive_shader, true, false, water_sign); + + + fullbright_shader = + (LLPipeline::sImpostorRender) ? &gDeferredFullbrightAlphaMaskProgram : + (LLPipeline::sUnderWaterRender) ? &gDeferredFullbrightWaterAlphaProgram : + (LLPipeline::sRenderingHUDs) ? &gHUDFullbrightAlphaMaskAlphaProgram : + &gDeferredFullbrightAlphaMaskAlphaProgram; prepare_alpha_shader(fullbright_shader, true, true, water_sign); - simple_shader = (LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram : - (LLPipeline::sUnderWaterRender) ? &gDeferredAlphaWaterProgram : &gDeferredAlphaProgram; + simple_shader = + (LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram : + (LLPipeline::sUnderWaterRender) ? &gDeferredAlphaWaterProgram : + (LLPipeline::sRenderingHUDs) ? &gHUDAlphaProgram : + &gDeferredAlphaProgram; + prepare_alpha_shader(simple_shader, false, true, water_sign); //prime simple shader (loads shadow relevant uniforms) LLGLSLShader* materialShader = LLPipeline::sUnderWaterRender ? gDeferredMaterialWaterProgram : gDeferredMaterialProgram; @@ -191,19 +202,24 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) prepare_alpha_shader(&materialShader[i], false, true, water_sign); } - prepare_alpha_shader(&gDeferredPBRAlphaProgram, false, true, water_sign); + pbr_shader = LLPipeline::sRenderingHUDs ? &gHUDPBRAlphaProgram : &gDeferredPBRAlphaProgram; - // first pass, render rigged objects only and render to depth buffer - forwardRender(true); + prepare_alpha_shader(pbr_shader, false, true, water_sign); + + if (!LLPipeline::sRenderingHUDs) + { + // first pass, render rigged objects only and render to depth buffer + forwardRender(true); + } // second pass, regular forward alpha rendering forwardRender(); // final pass, render to depth for depth of field effects - if (!LLPipeline::sImpostorRender && gSavedSettings.getBOOL("RenderDepthOfField") && !gCubeSnapshot) + if (!LLPipeline::sImpostorRender && gSavedSettings.getBOOL("RenderDepthOfField") && !gCubeSnapshot && !LLPipeline::sRenderingHUDs) { //update depth buffer sampler - simple_shader = fullbright_shader = &gObjectFullbrightAlphaMaskProgram; + simple_shader = fullbright_shader = &gDeferredFullbrightAlphaMaskProgram; simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); @@ -222,54 +238,6 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) deferred_render = FALSE; } -//set some generic parameters for forward (non-deferred) rendering -static void prepare_forward_shader(LLGLSLShader* shader, F32 minimum_alpha) -{ - shader->bind(); - shader->setMinimumAlpha(minimum_alpha); - shader->uniform1i(LLShaderMgr::NO_ATMO, LLPipeline::sRenderingHUDs ? 1 : 0); - - //also prepare rigged variant - if (shader->mRiggedVariant && shader->mRiggedVariant != shader) - { - prepare_forward_shader(shader->mRiggedVariant, minimum_alpha); - } -} - -void LLDrawPoolAlpha::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; - - simple_shader = (LLPipeline::sImpostorRender) ? &gObjectSimpleImpostorProgram : - (LLPipeline::sUnderWaterRender) ? &gObjectSimpleWaterProgram : &gObjectSimpleAlphaMaskProgram; - - fullbright_shader = (LLPipeline::sImpostorRender) ? &gObjectFullbrightAlphaMaskProgram : - (LLPipeline::sUnderWaterRender) ? &gObjectFullbrightWaterProgram : &gObjectFullbrightAlphaMaskProgram; - - emissive_shader = (LLPipeline::sImpostorRender) ? &gObjectEmissiveProgram : - (LLPipeline::sUnderWaterRender) ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram; - - F32 minimum_alpha = MINIMUM_ALPHA; - if (LLPipeline::sImpostorRender) - { - minimum_alpha = MINIMUM_IMPOSTOR_ALPHA; - } - - prepare_forward_shader(fullbright_shader, minimum_alpha); - prepare_forward_shader(simple_shader, minimum_alpha); - - for (int i = 0; i < LLMaterial::SHADER_COUNT; ++i) - { - prepare_forward_shader(LLPipeline::sUnderWaterRender ? &gDeferredMaterialWaterProgram[i] : &gDeferredMaterialProgram[i], minimum_alpha); - } - - //first pass -- rigged only and drawn to depth buffer - forwardRender(true); - - //second pass -- non-rigged, no depth buffer writes - forwardRender(); -} - void LLDrawPoolAlpha::forwardRender(bool rigged) { gPipeline.enableLightsDynamic(); @@ -517,7 +485,7 @@ void LLDrawPoolAlpha::RestoreTexSetup(bool tex_setup) } } -void LLDrawPoolAlpha::drawEmissive(U32 mask, LLDrawInfo* draw) +void LLDrawPoolAlpha::drawEmissive(LLDrawInfo* draw) { LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.f); draw->mVertexBuffer->setBuffer(); @@ -525,7 +493,7 @@ void LLDrawPoolAlpha::drawEmissive(U32 mask, LLDrawInfo* draw) } -void LLDrawPoolAlpha::renderEmissives(U32 mask, std::vector<LLDrawInfo*>& emissives) +void LLDrawPoolAlpha::renderEmissives(std::vector<LLDrawInfo*>& emissives) { emissive_shader->bind(); emissive_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.f); @@ -533,12 +501,25 @@ void LLDrawPoolAlpha::renderEmissives(U32 mask, std::vector<LLDrawInfo*>& emissi for (LLDrawInfo* draw : emissives) { bool tex_setup = TexSetup(draw, false); - drawEmissive(mask, draw); + drawEmissive(draw); RestoreTexSetup(tex_setup); } } -void LLDrawPoolAlpha::renderRiggedEmissives(U32 mask, std::vector<LLDrawInfo*>& emissives) +void LLDrawPoolAlpha::renderPbrEmissives(std::vector<LLDrawInfo*>& emissives) +{ + pbr_emissive_shader->bind(); + + for (LLDrawInfo* draw : emissives) + { + llassert(draw->mGLTFMaterial); + draw->mGLTFMaterial->bind(draw->mTexture); + draw->mVertexBuffer->setBuffer(); + draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset); + } +} + +void LLDrawPoolAlpha::renderRiggedEmissives(std::vector<LLDrawInfo*>& emissives) { LLGLDepthTest depth(GL_TRUE, GL_FALSE); //disable depth writes since "emissive" is additive so sorting doesn't matter LLGLSLShader* shader = emissive_shader->mRiggedVariant; @@ -548,8 +529,6 @@ void LLDrawPoolAlpha::renderRiggedEmissives(U32 mask, std::vector<LLDrawInfo*>& LLVOAvatar* lastAvatar = nullptr; U64 lastMeshId = 0; - mask |= LLVertexBuffer::MAP_WEIGHT4; - for (LLDrawInfo* draw : emissives) { bool tex_setup = TexSetup(draw, false); @@ -562,11 +541,37 @@ void LLDrawPoolAlpha::renderRiggedEmissives(U32 mask, std::vector<LLDrawInfo*>& lastAvatar = draw->mAvatar; lastMeshId = draw->mSkinInfo->mHash; } - drawEmissive(mask, draw); + drawEmissive(draw); RestoreTexSetup(tex_setup); } } +void LLDrawPoolAlpha::renderRiggedPbrEmissives(std::vector<LLDrawInfo*>& emissives) +{ + LLGLDepthTest depth(GL_TRUE, GL_FALSE); //disable depth writes since "emissive" is additive so sorting doesn't matter + pbr_emissive_shader->bind(true); + + LLVOAvatar* lastAvatar = nullptr; + U64 lastMeshId = 0; + + for (LLDrawInfo* draw : emissives) + { + if (lastAvatar != draw->mAvatar || lastMeshId != draw->mSkinInfo->mHash) + { + if (!uploadMatrixPalette(*draw)) + { // failed to upload matrix palette, skip rendering + continue; + } + lastAvatar = draw->mAvatar; + lastMeshId = draw->mSkinInfo->mHash; + } + + draw->mGLTFMaterial->bind(draw->mTexture); + draw->mVertexBuffer->setBuffer(); + draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset); + } +} + void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; @@ -635,8 +640,13 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) static std::vector<LLDrawInfo*> emissives; static std::vector<LLDrawInfo*> rigged_emissives; + static std::vector<LLDrawInfo*> pbr_emissives; + static std::vector<LLDrawInfo*> pbr_rigged_emissives; + emissives.resize(0); rigged_emissives.resize(0); + pbr_emissives.resize(0); + pbr_rigged_emissives.resize(0); bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE; @@ -667,7 +677,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) if (gltf_mat && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND) { - target_shader = &gDeferredPBRAlphaProgram; + target_shader = pbr_shader; if (params.mAvatar != nullptr) { target_shader = target_shader->mRiggedVariant; @@ -679,7 +689,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) gPipeline.bindDeferredShaderFast(*target_shader); } - params.mGLTFMaterial->bind(); + params.mGLTFMaterial->bind(params.mTexture); } else { @@ -707,7 +717,11 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) light_enabled = TRUE; } - if (deferred_render && mat) + if (LLPipeline::sRenderingHUDs) + { + target_shader = fullbright_shader; + } + else if (deferred_render && mat) { U32 mask = params.mShaderMask; @@ -818,11 +832,25 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) { if (params.mAvatar != nullptr) { - rigged_emissives.push_back(¶ms); + if (params.mGLTFMaterial.isNull()) + { + rigged_emissives.push_back(¶ms); + } + else + { + pbr_rigged_emissives.push_back(¶ms); + } } else { - emissives.push_back(¶ms); + if (params.mGLTFMaterial.isNull()) + { + emissives.push_back(¶ms); + } + else + { + pbr_emissives.push_back(¶ms); + } } } @@ -849,14 +877,28 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) if (!emissives.empty()) { light_enabled = true; - renderEmissives(mask, emissives); + renderEmissives(emissives); + rebind = true; + } + + if (!pbr_emissives.empty()) + { + light_enabled = true; + renderPbrEmissives(pbr_emissives); rebind = true; } if (!rigged_emissives.empty()) { light_enabled = true; - renderRiggedEmissives(mask, rigged_emissives); + renderRiggedEmissives(rigged_emissives); + rebind = true; + } + + if (!pbr_rigged_emissives.empty()) + { + light_enabled = true; + renderRiggedPbrEmissives(pbr_rigged_emissives); rebind = true; } diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h index 2c1ec30958..f2f802d85e 100644 --- a/indra/newview/lldrawpoolalpha.h +++ b/indra/newview/lldrawpoolalpha.h @@ -58,7 +58,6 @@ public: /*virtual*/ void renderPostDeferred(S32 pass); /*virtual*/ S32 getNumPasses() { return 1; } - virtual void render(S32 pass = 0); void forwardRender(bool write_depth = false); /*virtual*/ void prerender(); @@ -78,10 +77,14 @@ private: LLGLSLShader* simple_shader = nullptr; LLGLSLShader* fullbright_shader = nullptr; LLGLSLShader* emissive_shader = nullptr; - - void drawEmissive(U32 mask, LLDrawInfo* draw); - void renderEmissives(U32 mask, std::vector<LLDrawInfo*>& emissives); - void renderRiggedEmissives(U32 mask, std::vector<LLDrawInfo*>& emissives); + LLGLSLShader* pbr_emissive_shader = nullptr; + LLGLSLShader* pbr_shader = nullptr; + + void drawEmissive(LLDrawInfo* draw); + void renderEmissives(std::vector<LLDrawInfo*>& emissives); + void renderRiggedEmissives(std::vector<LLDrawInfo*>& emissives); + void renderPbrEmissives(std::vector<LLDrawInfo*>& emissives); + void renderRiggedPbrEmissives(std::vector<LLDrawInfo*>& emissives); bool TexSetup(LLDrawInfo* draw, bool use_material); void RestoreTexSetup(bool tex_setup); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 8a3ab20ab4..9820202f9b 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -520,14 +520,6 @@ void LLDrawPoolAvatar::beginRigid() { //eyeballs render with the specular shader sVertexProgram->bind(); sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); - if (LLPipeline::sRenderingHUDs) - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } } else @@ -586,14 +578,6 @@ void LLDrawPoolAvatar::beginDeferredRigid() sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); sVertexProgram->bind(); sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); - if (LLPipeline::sRenderingHUDs) - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } void LLDrawPoolAvatar::endDeferredRigid() @@ -641,14 +625,6 @@ void LLDrawPoolAvatar::beginSkinned() sVertexProgram->bind(); sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP); - if (LLPipeline::sRenderingHUDs) - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); - } gGL.getTexUnit(0)->activate(); } else @@ -658,14 +634,6 @@ void LLDrawPoolAvatar::beginSkinned() // software skinning, use a basic shader for windlight. // TODO: find a better fallback method for software skinning. sVertexProgram->bind(); - if (LLPipeline::sRenderingHUDs) - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } } @@ -708,15 +676,6 @@ void LLDrawPoolAvatar::beginDeferredSkinned() sVertexProgram->bind(); sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); - if (LLPipeline::sRenderingHUDs) - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gGL.getTexUnit(0)->activate(); } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index f5d0412993..965aa39338 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -210,90 +210,6 @@ S32 LLDrawPoolBump::numBumpPasses() return 1; } -S32 LLDrawPoolBump::getNumPasses() -{ - return numBumpPasses(); -} - -void LLDrawPoolBump::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); - - if (!gPipeline.hasRenderType(LLDrawPool::POOL_SIMPLE)) - { - return; - } - - for (int i = 0; i < 2; ++i) - { - mRigged = i == 1; - - // first pass -- shiny - beginShiny(); - renderShiny(); - endShiny(); - - //second pass -- fullbright shiny - if (mShaderLevel > 1) - { - beginFullbrightShiny(); - renderFullbrightShiny(); - endFullbrightShiny(); - } - - //third pass -- bump - beginBump(); - renderBump(LLRenderPass::PASS_BUMP); - endBump(); - } -} - - -//static -void LLDrawPoolBump::beginShiny() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); - - mShiny = TRUE; - sVertexMask = VERTEX_MASK_SHINY; - // Second pass: environment map - if (mShaderLevel > 1) - { - sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0; - } - - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectShinyWaterProgram; - } - else - { - shader = &gObjectShinyProgram; - } - - if (mRigged) - { - llassert(shader->mRiggedVariant); - shader = shader->mRiggedVariant; - } - - shader->bind(); - if (LLPipeline::sRenderingHUDs) - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - - bindCubeMap(shader, mShaderLevel, diffuse_channel, cube_channel); - - if (mShaderLevel > 1) - { //indexed texture rendering, channel 0 is always diffuse - diffuse_channel = 0; - } -} //static void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel) @@ -342,38 +258,6 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di } } -void LLDrawPoolBump::renderShiny() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); - - if( gSky.mVOSkyp->getCubeMap() && !LLPipeline::sReflectionProbesEnabled ) - { - LLGLEnable blend_enable(GL_BLEND); - if (mShaderLevel > 1) - { - if (mRigged) - { - LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_SHINY_RIGGED, true, true); - } - else - { - LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, true, true); - } - } - else - { - if (mRigged) - { - gPipeline.renderRiggedGroups(this, LLRenderPass::PASS_SHINY_RIGGED, true); - } - else - { - gPipeline.renderGroups(this, LLRenderPass::PASS_SHINY, true); - } - } - } -} - //static void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel) { @@ -399,21 +283,6 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& } } -void LLDrawPoolBump::endShiny() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); - - unbindCubeMap(shader, mShaderLevel, diffuse_channel, cube_channel); - if (shader) - { - shader->unbind(); - } - - diffuse_channel = -1; - cube_channel = 0; - mShiny = FALSE; -} - void LLDrawPoolBump::beginFullbrightShiny() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); @@ -421,22 +290,11 @@ void LLDrawPoolBump::beginFullbrightShiny() sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0; // Second pass: environment map - - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectFullbrightShinyWaterProgram; - } - else - { - if (LLPipeline::sRenderDeferred) - { - shader = &gDeferredFullbrightShinyProgram; - } - else - { - shader = &gObjectFullbrightShinyProgram; - } - } + shader = &gDeferredFullbrightShinyProgram; + if (LLPipeline::sRenderingHUDs) + { + shader = &gHUDFullbrightShinyProgram; + } if (mRigged) { @@ -466,15 +324,7 @@ void LLDrawPoolBump::beginFullbrightShiny() LLVector4(gGLModelView+8), LLVector4(gGLModelView+12)); shader->bind(); - if (LLPipeline::sRenderingHUDs) - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - + LLVector3 vec = LLVector3(gShinyOrigin) * mat; LLVector4 vec4(vec, gShinyOrigin.mV[3]); shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV); @@ -682,18 +532,7 @@ void LLDrawPoolBump::endBump(U32 pass) S32 LLDrawPoolBump::getNumDeferredPasses() { -#if 0 //DEPRECATED -- RenderObjectBump should always be TRUE - if (gSavedSettings.getBOOL("RenderObjectBump")) - { - return 1; - } - else - { - return 0; - } -#else return 1; -#endif } void LLDrawPoolBump::renderDeferred(S32 pass) @@ -754,8 +593,11 @@ void LLDrawPoolBump::renderDeferred(S32 pass) void LLDrawPoolBump::renderPostDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL - for (int i = 0; i < 2; ++i) + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + + S32 num_passes = LLPipeline::sRenderingHUDs ? 1 : 2; // skip rigged pass when rendering HUDs + + for (int i = 0; i < num_passes; ++i) { // two passes -- static and rigged mRigged = (i == 1); @@ -1446,24 +1288,3 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, bool texture, bool batch_text } } -void LLDrawPoolInvisible::render(S32 pass) -{ //render invisiprims - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_INVISIBLE); - - if (gPipeline.shadersLoaded()) - { - gOcclusionProgram.bind(); - } - - U32 invisi_mask = LLVertexBuffer::MAP_VERTEX; - //glStencilMask(0); //deprecated - gGL.setColorMask(false, false); - pushBatches(LLRenderPass::PASS_INVISIBLE, invisi_mask, FALSE); - gGL.setColorMask(true, false); - //glStencilMask(0xFFFFFFFF); //deprecated - - if (gPipeline.shadersLoaded()) - { - gOcclusionProgram.unbind(); - } -} diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index 4400308451..840af0c99d 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -52,8 +52,6 @@ public: LLDrawPoolBump(); - virtual void render(S32 pass = 0) override; - virtual S32 getNumPasses() override; /*virtual*/ void prerender() override; void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false) override; @@ -62,10 +60,6 @@ public: S32 numBumpPasses(); - void beginShiny(); - void renderShiny(); - void endShiny(); - void beginFullbrightShiny(); void renderFullbrightShiny(); void endFullbrightShiny(); @@ -167,25 +161,4 @@ private: extern LLBumpImageList gBumpImageList; -class LLDrawPoolInvisible : public LLRenderPass -{ -public: - LLDrawPoolInvisible() : LLRenderPass(LLDrawPool::POOL_INVISIBLE) { } - - enum - { - VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX - }; - - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } - - virtual void prerender() { } - - virtual void render(S32 pass = 0); - virtual void beginRenderPass( S32 pass ) { } - virtual void endRenderPass( S32 pass ) { } - virtual S32 getNumPasses() {return 1;} -}; - - #endif // LL_LLDRAWPOOLBUMP_H diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp deleted file mode 100644 index 5b74264dab..0000000000 --- a/indra/newview/lldrawpoolground.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file lldrawpoolground.cpp - * @brief LLDrawPoolGround class implementation - * - * $LicenseInfo:firstyear=2002&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 "llviewerprecompiledheaders.h" - -#include "lldrawpoolground.h" - -#include "llviewercontrol.h" - -#include "lldrawable.h" -#include "llface.h" -#include "llsky.h" -#include "llviewercamera.h" -#include "llviewerwindow.h" -#include "llworld.h" -#include "pipeline.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llviewershadermgr.h" - -LLDrawPoolGround::LLDrawPoolGround() : - LLFacePool(POOL_GROUND) -{ -} - -void LLDrawPoolGround::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); -} - -void LLDrawPoolGround::render(S32 pass) -{ - if (mDrawFace.empty() || !gSavedSettings.getBOOL("RenderGround")) - { - return; - } - - LLGLSPipelineDepthTestSkyBox gls_skybox(true, false); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - F32 water_height = gAgent.getRegion()->getWaterHeight(); - gGL.pushMatrix(); - LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); - gGL.translatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height)); - - LLFace *facep = mDrawFace[0]; - - LLOverrideFaceColor col(this, gSky.mVOSkyp->getGLFogColor()); - facep->renderIndexed(); - - gGL.popMatrix(); -} - diff --git a/indra/newview/lldrawpoolground.h b/indra/newview/lldrawpoolground.h deleted file mode 100644 index 15b1dc60a2..0000000000 --- a/indra/newview/lldrawpoolground.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file lldrawpoolground.h - * @brief LLDrawPoolGround class definition - * - * $LicenseInfo:firstyear=2002&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$ - */ - -#ifndef LL_LLDRAWPOOLGROUND_H -#define LL_LLDRAWPOOLGROUND_H - -#include "lldrawpool.h" - - -class LLDrawPoolGround : public LLFacePool -{ -public: - enum - { - VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | - LLVertexBuffer::MAP_TEXCOORD0 - }; - - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } - - LLDrawPoolGround(); - - /*virtual*/ void prerender(); - /*virtual*/ void render(S32 pass = 0); -}; - -#endif // LL_LLDRAWPOOLGROUND_H diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 735f32ddbb..6a7e05ac74 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -98,15 +98,6 @@ void LLDrawPoolMaterials::beginDeferredPass(S32 pass) } gPipeline.bindDeferredShader(*mShader); - - if (LLPipeline::sRenderingHUDs) - { - mShader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - mShader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } void LLDrawPoolMaterials::endDeferredPass(S32 pass) diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 9dd1bc0ba2..d30fc22393 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -31,22 +31,57 @@ #include "llviewershadermgr.h" #include "pipeline.h" +static const U32 gltf_render_types[] = { LLPipeline::RENDER_TYPE_PASS_GLTF_PBR, LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK }; + LLDrawPoolGLTFPBR::LLDrawPoolGLTFPBR() : LLRenderPass(POOL_GLTF_PBR) { } +S32 LLDrawPoolGLTFPBR::getNumDeferredPasses() +{ + return 1; +} + void LLDrawPoolGLTFPBR::renderDeferred(S32 pass) { - const U32 types[] = { LLPipeline::RENDER_TYPE_PASS_GLTF_PBR, LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK }; + llassert(!LLPipeline::sRenderingHUDs); - for (U32 type : types) + for (U32 type : gltf_render_types) { gDeferredPBROpaqueProgram.bind(); pushGLTFBatches(type); - + gDeferredPBROpaqueProgram.bind(true); - pushRiggedGLTFBatches(type+1); + pushRiggedGLTFBatches(type + 1); + } +} + +S32 LLDrawPoolGLTFPBR::getNumPostDeferredPasses() +{ + return 1; +} + +void LLDrawPoolGLTFPBR::renderPostDeferred(S32 pass) +{ + if (LLPipeline::sRenderingHUDs) + { + gHUDPBROpaqueProgram.bind(); + for (U32 type : gltf_render_types) + { + pushGLTFBatches(type); + } + } + else + { + gGL.setColorMask(false, true); + gPBRGlowProgram.bind(); + pushGLTFBatches(LLRenderPass::PASS_GLTF_GLOW); + + gPBRGlowProgram.bind(true); + pushRiggedGLTFBatches(LLRenderPass::PASS_GLTF_GLOW_RIGGED); + + gGL.setColorMask(true, false); } } diff --git a/indra/newview/lldrawpoolpbropaque.h b/indra/newview/lldrawpoolpbropaque.h index 2fe0695c69..69e063b322 100644 --- a/indra/newview/lldrawpoolpbropaque.h +++ b/indra/newview/lldrawpoolpbropaque.h @@ -48,8 +48,11 @@ public: LLDrawPoolGLTFPBR(); - S32 getNumDeferredPasses() override { return 1; } + S32 getNumDeferredPasses() override; void renderDeferred(S32 pass) override; + + S32 getNumPostDeferredPasses() override; + void renderPostDeferred(S32 pass) override; }; #endif // LL_LLDRAWPOOLPBROPAQUE_H diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 7a8b2b4b35..c956af97a5 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -37,8 +37,6 @@ #include "llviewershadermgr.h" #include "llrender.h" -static LLGLSLShader* simple_shader = NULL; - static LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE_DEFERRED("Deferred Simple"); static LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); @@ -46,15 +44,6 @@ static LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS_DEFERRED("Deferred Grass") static void setup_simple_shader(LLGLSLShader* shader) { shader->bind(); - - if (LLPipeline::sRenderingHUDs) - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } static void setup_glow_shader(LLGLSLShader* shader) @@ -79,13 +68,9 @@ static void setup_fullbright_shader(LLGLSLShader* shader) void LLDrawPoolGlow::renderPostDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GLOW); - render(&gDeferredEmissiveProgram); -} + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + LLGLSLShader* shader = &gDeferredEmissiveProgram; -void LLDrawPoolGlow::render(LLGLSLShader* shader) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GLOW); LLGLEnable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); gGL.flush(); @@ -110,93 +95,11 @@ void LLDrawPoolGlow::render(LLGLSLShader* shader) gGL.setSceneBlendType(LLRender::BT_ALPHA); } -S32 LLDrawPoolGlow::getNumPasses() -{ - return 1; -} - -void LLDrawPoolGlow::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; - LLGLSLShader* shader = LLPipeline::sUnderWaterRender ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram; - render(shader); -} - LLDrawPoolSimple::LLDrawPoolSimple() : LLRenderPass(POOL_SIMPLE) { } -void LLDrawPoolSimple::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - -S32 LLDrawPoolSimple::getNumPasses() -{ - return 1; -} - -void LLDrawPoolSimple::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE); - - LLGLDisable blend(GL_BLEND); - - LLGLSLShader* shader = nullptr; - if (LLPipeline::sImpostorRender) - { - shader = &gObjectSimpleImpostorProgram; - } - else if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectSimpleWaterProgram; - } - else - { - shader = &gObjectSimpleProgram; - } - - { //render simple - - gPipeline.enableLightsDynamic(); - - // first pass -- static objects - { - setup_simple_shader(shader); - pushBatches(LLRenderPass::PASS_SIMPLE, true, true); - - if (LLPipeline::sRenderDeferred) - { //if deferred rendering is enabled, bump faces aren't registered as simple - //render bump faces here as simple so bump faces will appear under water - pushBatches(LLRenderPass::PASS_BUMP, true, true); - pushBatches(LLRenderPass::PASS_MATERIAL, true, true); - pushBatches(LLRenderPass::PASS_SPECMAP, true, true); - pushBatches(LLRenderPass::PASS_NORMMAP, true, true); - pushBatches(LLRenderPass::PASS_NORMSPEC, true, true); - } - } - - //second pass, rigged - { - shader = shader->mRiggedVariant; - setup_simple_shader(shader); - pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, true, true); - - if (LLPipeline::sRenderDeferred) - { //if deferred rendering is enabled, bump faces aren't registered as simple - //render bump faces here as simple so bump faces will appear under water - pushRiggedBatches(LLRenderPass::PASS_BUMP_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_MATERIAL_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_SPECMAP_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_NORMMAP_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_RIGGED, true, true); - } - } - } -} - - static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK("Alpha Mask"); LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() : @@ -204,76 +107,11 @@ LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() : { } -void LLDrawPoolAlphaMask::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - -void LLDrawPoolAlphaMask::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; - LLGLDisable blend(GL_BLEND); - - LLGLSLShader* shader = nullptr; - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectSimpleWaterAlphaMaskProgram; - } - else - { - shader = &gObjectSimpleAlphaMaskProgram; - } - - // render static - setup_simple_shader(shader); - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, true, true); - pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, true, true); - pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, true, true); - pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, true, true); - pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, true, true); - - // render rigged - setup_simple_shader(shader->mRiggedVariant); - pushRiggedMaskBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, true, true); - pushRiggedMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK_RIGGED, true, true); - pushRiggedMaskBatches(LLRenderPass::PASS_SPECMAP_MASK_RIGGED, true, true); - pushRiggedMaskBatches(LLRenderPass::PASS_NORMMAP_MASK_RIGGED, true, true); - pushRiggedMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK_RIGGED, true, true); -} - LLDrawPoolFullbrightAlphaMask::LLDrawPoolFullbrightAlphaMask() : LLRenderPass(POOL_FULLBRIGHT_ALPHA_MASK) { } -void LLDrawPoolFullbrightAlphaMask::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - -void LLDrawPoolFullbrightAlphaMask::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); - - LLGLSLShader* shader = nullptr; - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectFullbrightWaterAlphaMaskProgram; - } - else - { - shader = &gObjectFullbrightAlphaMaskProgram; - } - - // render static - setup_fullbright_shader(shader); - pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true); - - // render rigged - setup_fullbright_shader(shader->mRiggedVariant); - pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, true, true); -} - //=============================== //DEFERRED IMPLEMENTATION //=============================== @@ -322,102 +160,13 @@ LLDrawPoolGrass::LLDrawPoolGrass() : } -void LLDrawPoolGrass::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - - -void LLDrawPoolGrass::beginRenderPass(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); - stop_glerror(); - - if (LLPipeline::sUnderWaterRender) - { - simple_shader = &gObjectAlphaMaskNonIndexedWaterProgram; - } - else - { - simple_shader = &gObjectAlphaMaskNonIndexedProgram; - } - - if (mShaderLevel > 0) - { - simple_shader->bind(); - simple_shader->setMinimumAlpha(0.5f); - if (LLPipeline::sRenderingHUDs) - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - } - else - { - gGL.flush(); - LLGLSLShader::unbind(); - } -} - -void LLDrawPoolGrass::endRenderPass(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); - LLRenderPass::endRenderPass(pass); - - if (mShaderLevel > 0) - { - simple_shader->unbind(); - } - else - { - gGL.flush(); - } -} - -void LLDrawPoolGrass::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; - LLGLDisable blend(GL_BLEND); - - { - //LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); - LLGLEnable test(GL_ALPHA_TEST); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - //render grass - LLRenderPass::pushBatches(LLRenderPass::PASS_GRASS, getVertexDataMask()); - } -} - -void LLDrawPoolGrass::beginDeferredPass(S32 pass) -{ - -} - -void LLDrawPoolGrass::endDeferredPass(S32 pass) -{ - -} - void LLDrawPoolGrass::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; { - //LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS_DEFERRED); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f); - if (LLPipeline::sRenderingHUDs) - { - gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); - } - //render grass LLRenderPass::pushBatches(LLRenderPass::PASS_GRASS, getVertexDataMask()); } @@ -430,18 +179,16 @@ LLDrawPoolFullbright::LLDrawPoolFullbright() : { } -void LLDrawPoolFullbright::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - - void LLDrawPoolFullbright::renderPostDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); LLGLSLShader* shader = nullptr; - if (LLPipeline::sUnderWaterRender) + if (LLPipeline::sRenderingHUDs) + { + shader = &gHUDFullbrightProgram; + } + else if (LLPipeline::sUnderWaterRender) { shader = &gDeferredFullbrightWaterProgram; } @@ -456,47 +203,12 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass) setup_fullbright_shader(shader); pushBatches(LLRenderPass::PASS_FULLBRIGHT, true, true); - // render rigged - setup_fullbright_shader(shader->mRiggedVariant); - pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, true, true); -} - -void LLDrawPoolFullbright::render(S32 pass) -{ //render fullbright - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - stop_glerror(); - LLGLSLShader* shader = nullptr; - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectFullbrightWaterProgram; - } - else + if (!LLPipeline::sRenderingHUDs) { - shader = &gObjectFullbrightProgram; + // render rigged + setup_fullbright_shader(shader->mRiggedVariant); + pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, true, true); } - - // render static - setup_fullbright_shader(shader); - pushBatches(LLRenderPass::PASS_FULLBRIGHT, true, true); - pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, true, true); - pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, true, true); - pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, true, true); - pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, true, true); - - // render rigged - setup_fullbright_shader(shader->mRiggedVariant); - pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE_RIGGED, true, true); - pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE_RIGGED, true, true); -} - -S32 LLDrawPoolFullbright::getNumPasses() -{ - return 1; } void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) @@ -506,32 +218,28 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) LLGLSLShader* shader = nullptr; if (LLPipeline::sRenderingHUDs) { - shader = &gDeferredFullbrightAlphaMaskProgram; + shader = &gHUDFullbrightAlphaMaskProgram; } - else if (LLPipeline::sRenderDeferred) + else if (LLPipeline::sUnderWaterRender) { - if (LLPipeline::sUnderWaterRender) - { - shader = &gDeferredFullbrightAlphaMaskWaterProgram; - } - else - { - shader = &gDeferredFullbrightAlphaMaskProgram; - } + shader = &gDeferredFullbrightAlphaMaskWaterProgram; } else { - shader = &gObjectFullbrightAlphaMaskProgram; + shader = &gDeferredFullbrightAlphaMaskProgram; } - LLGLDisable blend(GL_BLEND); + LLGLDisable blend(GL_BLEND); // render static setup_fullbright_shader(shader); pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true); - // render rigged - setup_fullbright_shader(shader->mRiggedVariant); - pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, true, true); + if (!LLPipeline::sRenderingHUDs) + { + // render rigged + setup_fullbright_shader(shader->mRiggedVariant); + pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, true, true); + } } diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h index cccbe5e495..a3b93c237e 100644 --- a/indra/newview/lldrawpoolsimple.h +++ b/indra/newview/lldrawpoolsimple.h @@ -31,7 +31,7 @@ class LLGLSLShader; -class LLDrawPoolSimple : public LLRenderPass +class LLDrawPoolSimple final : public LLRenderPass { public: enum @@ -41,20 +41,15 @@ public: LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR }; - virtual U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } LLDrawPoolSimple(); S32 getNumDeferredPasses() override; void renderDeferred(S32 pass) override; - - /// We need two passes so we can handle emissive materials separately. - S32 getNumPasses() override; - void render(S32 pass = 0) override; - void prerender() override; }; -class LLDrawPoolGrass : public LLRenderPass +class LLDrawPoolGrass final : public LLRenderPass { public: enum @@ -64,24 +59,15 @@ public: LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR }; - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } LLDrawPoolGrass(); - /*virtual*/ S32 getNumDeferredPasses() { return 1; } - /*virtual*/ void beginDeferredPass(S32 pass); - /*virtual*/ void endDeferredPass(S32 pass); - /*virtual*/ void renderDeferred(S32 pass); - - /*virtual*/ void beginRenderPass(S32 pass); - /*virtual*/ void endRenderPass(S32 pass); - /// We need two passes so we can handle emissive materials separately. - /*virtual*/ S32 getNumPasses() { return 1; } - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void prerender(); + S32 getNumDeferredPasses() override { return 1; } + void renderDeferred(S32 pass) override; }; -class LLDrawPoolAlphaMask : public LLRenderPass +class LLDrawPoolAlphaMask final : public LLRenderPass { public: enum @@ -91,20 +77,15 @@ public: LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR }; - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } LLDrawPoolAlphaMask(); - /*virtual*/ S32 getNumDeferredPasses() { return 1; } - /*virtual*/ void renderDeferred(S32 pass); - - /*virtual*/ S32 getNumPasses() { return 1; } - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void prerender(); - + S32 getNumDeferredPasses() override { return 1; } + void renderDeferred(S32 pass) override; }; -class LLDrawPoolFullbrightAlphaMask : public LLRenderPass +class LLDrawPoolFullbrightAlphaMask final : public LLRenderPass { public: enum @@ -113,20 +94,16 @@ public: LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR }; - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } LLDrawPoolFullbrightAlphaMask(); - /*virtual*/ S32 getNumPostDeferredPasses() { return 1; } - /*virtual*/ void renderPostDeferred(S32 pass); - - /*virtual*/ S32 getNumPasses() { return 1; } - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void prerender(); + S32 getNumPostDeferredPasses() override { return 1; } + void renderPostDeferred(S32 pass) override; }; -class LLDrawPoolFullbright : public LLRenderPass +class LLDrawPoolFullbright final : public LLRenderPass { public: enum @@ -135,20 +112,15 @@ public: LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR }; - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } LLDrawPoolFullbright(); - /*virtual*/ S32 getNumPostDeferredPasses() { return 1; } - /*virtual*/ void renderPostDeferred(S32 pass); - - /*virtual*/ S32 getNumPasses(); - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void prerender(); - + S32 getNumPostDeferredPasses() override { return 1; } + void renderPostDeferred(S32 pass) override; }; -class LLDrawPoolGlow : public LLRenderPass +class LLDrawPoolGlow final : public LLRenderPass { public: LLDrawPoolGlow(): LLRenderPass(LLDrawPool::POOL_GLOW) { } @@ -160,19 +132,10 @@ public: LLVertexBuffer::MAP_EMISSIVE }; - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } - - virtual void prerender() { } - - /*virtual*/ S32 getNumPostDeferredPasses() { return 1; } - /*virtual*/ void renderPostDeferred(S32 pass); - - void render(LLGLSLShader* shader); - - /*virtual*/ S32 getNumPasses(); - - void render(S32 pass = 0); + U32 getVertexDataMask() override { return VERTEX_DATA_MASK; } + S32 getNumPostDeferredPasses() override { return 1; } + void renderPostDeferred(S32 pass) override; }; #endif // LL_LLDRAWPOOLSIMPLE_H diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index c39d728c95..3c5bfe4a1c 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -28,21 +28,10 @@ #include "lldrawpoolsky.h" -#include "llagent.h" -#include "lldrawable.h" -#include "llface.h" -#include "llsky.h" -#include "llviewercamera.h" -#include "llviewertexturelist.h" -#include "llviewerregion.h" -#include "llvosky.h" -#include "llworld.h" // To get water height -#include "pipeline.h" -#include "llviewershadermgr.h" +// DEPRECATED LLDrawPoolSky::LLDrawPoolSky() : LLFacePool(POOL_SKY), - mSkyTex(NULL), mShader(NULL) { @@ -50,103 +39,16 @@ LLDrawPoolSky::LLDrawPoolSky() void LLDrawPoolSky::prerender() { - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); - if (gSky.mVOSkyp && gSky.mVOSkyp->mDrawable) - { - gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable); - } } void LLDrawPoolSky::render(S32 pass) { - gGL.flush(); - if (mDrawFace.empty()) - { - return; - } - - // Don't draw the sky box if we can and are rendering the WL sky dome. - if (gPipeline.canUseWindLightShaders()) - { - return; - } - - // don't render sky under water (background just gets cleared to fog color) - if(mShaderLevel > 0 && LLPipeline::sUnderWaterRender) - { - return; - } - - - //just use the UI shader (generic single texture no lighting) - gOneTextureNoColorProgram.bind(); - - LLGLSPipelineDepthTestSkyBox gls_skybox(true, false); - - gGL.pushMatrix(); - LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); - gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); - - S32 face_count = (S32)mDrawFace.size(); - - LLVertexBuffer::unbind(); - gGL.diffuseColor4f(1,1,1,1); - - for (S32 i = 0; i < face_count; ++i) - { - renderSkyFace(i); - } - - gGL.popMatrix(); } void LLDrawPoolSky::renderSkyFace(U8 index) { - LLFace* face = mDrawFace[index]; - - if (!face || !face->getGeomCount()) - { - return; - } - - if (index < LLVOSky::FACE_SUN) // sky tex...interp - { - llassert(mSkyTex); - mSkyTex[index].bindTexture(true); // bind the current tex - - face->renderIndexed(); - } - else // Moon - if (index == LLVOSky::FACE_MOON) - { - LLGLSPipelineDepthTestSkyBox gls_skybox(true, true); // SL-14113 Write depth for moon so stars can test if behind it - - LLGLEnable blend(GL_BLEND); - - // if (LLGLSLShader::sNoFixedFunction) // TODO: Necessary? is this always true? We already bailed on gPipeline.canUseWindLightShaders ... above - LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP); - if (tex) - { - gMoonProgram.bind(); // SL-14113 was gOneTextureNoColorProgram - gGL.getTexUnit(0)->bind(tex, true); - face->renderIndexed(); - } - } - else // heavenly body faces, no interp... - { - LLGLSPipelineDepthTestSkyBox gls_skybox(true, false); // reset to previous - - LLGLEnable blend(GL_BLEND); - LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP); - if (tex) - { - gOneTextureNoColorProgram.bind(); - gGL.getTexUnit(0)->bind(tex, true); - face->renderIndexed(); - } - } } void LLDrawPoolSky::endRenderPass( S32 pass ) diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 64178f0a59..77189dceae 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -105,35 +105,9 @@ U32 LLDrawPoolTerrain::getVertexDataMask() void LLDrawPoolTerrain::prerender() { - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); } -void LLDrawPoolTerrain::beginRenderPass( S32 pass ) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); - LLFacePool::beginRenderPass(pass); - - sShader = LLPipeline::sUnderWaterRender ? - &gTerrainWaterProgram : - &gTerrainProgram; - - if (mShaderLevel > 1 && sShader->mShaderLevel > 0) - { - sShader->bind(); - } -} - -void LLDrawPoolTerrain::endRenderPass( S32 pass ) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); - //LLFacePool::endRenderPass(pass); - - if (mShaderLevel > 1 && sShader->mShaderLevel > 0) { - sShader->unbind(); - } -} - //static S32 LLDrawPoolTerrain::getDetailMode() { @@ -152,54 +126,12 @@ void LLDrawPoolTerrain::boostTerrainDetailTextures() } } -void LLDrawPoolTerrain::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); - - if (mDrawFace.empty()) - { - return; - } - - boostTerrainDetailTextures(); - - LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f); - - LLGLSPipeline gls; - - if (mShaderLevel > 1 && sShader->mShaderLevel > 0) - { - gPipeline.enableLightsDynamic(); - - renderFullShader(); - } - else - { - gPipeline.enableLightsStatic(); - - if (sDetailMode == 0) - { - renderSimple(); - } - else - { - renderFull4TU(); - } - } - - // Special-case for land ownership feedback - if (gSavedSettings.getBOOL("ShowParcelOwners")) - { - hilightParcelOwners(false); - } -} - void LLDrawPoolTerrain::beginDeferredPass(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); LLFacePool::beginRenderPass(pass); - sShader = LLPipeline::sUnderWaterRender ? &gDeferredTerrainWaterProgram : &gDeferredTerrainProgram; + sShader = &gDeferredTerrainProgram; sShader->bind(); } @@ -226,7 +158,7 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass) // Special-case for land ownership feedback if (gSavedSettings.getBOOL("ShowParcelOwners")) { - hilightParcelOwners(true); + hilightParcelOwners(); } } @@ -390,13 +322,12 @@ void LLDrawPoolTerrain::renderFullShader() gGL.getTexUnit(detail0)->activate(); } -void LLDrawPoolTerrain::hilightParcelOwners(bool deferred) +void LLDrawPoolTerrain::hilightParcelOwners() { - if (mShaderLevel > 1) { //use fullbright shader for highlighting LLGLSLShader* old_shader = sShader; sShader->unbind(); - sShader = deferred ? &gDeferredHighlightProgram : &gHighlightProgram; + sShader = &gDeferredHighlightProgram; sShader->bind(); gGL.diffuseColor4f(1, 1, 1, 1); LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); @@ -405,11 +336,7 @@ void LLDrawPoolTerrain::hilightParcelOwners(bool deferred) sShader = old_shader; sShader->bind(); } - else - { - gPipeline.disableLights(); - renderOwnership(); - } + } void LLDrawPoolTerrain::renderFull4TU() diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index e00e0c4720..03bef31541 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -57,10 +57,7 @@ public: /*virtual*/ void endShadowPass(S32 pass); /*virtual*/ void renderShadow(S32 pass); - /*virtual*/ void render(S32 pass = 0); /*virtual*/ void prerender(); - /*virtual*/ void beginRenderPass( S32 pass ); - /*virtual*/ void endRenderPass( S32 pass ); /*virtual*/ void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures); /*virtual*/ LLViewerTexture *getTexture(); /*virtual*/ LLViewerTexture *getDebugTexture(); @@ -85,7 +82,7 @@ protected: void drawLoop(); private: - void hilightParcelOwners(bool deferred); + void hilightParcelOwners(); }; #endif // LL_LLDRAWPOOLSIMPLE_H diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 61a8e20b54..57146c432a 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -50,94 +50,6 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) : mTexturep->setAddressMode(LLTexUnit::TAM_WRAP); } -void LLDrawPoolTree::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - -void LLDrawPoolTree::beginRenderPass(S32 pass) -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); - - if (LLPipeline::sUnderWaterRender) - { - shader = &gTreeWaterProgram; - } - else - { - shader = &gTreeProgram; - } - - if (gPipeline.shadersLoaded()) - { - shader->bind(); - shader->setMinimumAlpha(0.5f); - gGL.diffuseColor4f(1,1,1,1); - } - else - { - gPipeline.enableLightsDynamic(); - gGL.flush(); - } -} - -void LLDrawPoolTree::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED; - - if (mDrawFace.empty()) - { - return; - } - - LLGLState test(GL_ALPHA_TEST, 0); - - gGL.getTexUnit(sDiffTex)->bindFast(mTexturep); - mTexturep->addTextureStats(1024.f * 1024.f); // <=== keep Linden tree textures at full res - - for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - LLVertexBuffer* buff = face->getVertexBuffer(); - - if(buff) - { - LLMatrix4* model_matrix = &(face->getDrawable()->getRegion()->mRenderMatrix); - - if (model_matrix != gGLLastMatrix) - { - gGLLastMatrix = model_matrix; - gGL.loadMatrix(gGLModelView); - if (model_matrix) - { - llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); - gGL.multMatrix((GLfloat*) model_matrix->mMatrix); - } - gPipeline.mMatrixOpCount++; - } - - buff->setBuffer(); - buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); - } - } -} - -void LLDrawPoolTree::endRenderPass(S32 pass) -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); - - if (gPipeline.canUseWindLightShadersOnObjects()) - { - shader->unbind(); - } - - if (mShaderLevel <= 0) - { - gGL.flush(); - } -} - //============================================ // deferred implementation //============================================ @@ -153,7 +65,43 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass) void LLDrawPoolTree::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED; - render(pass); + + if (mDrawFace.empty()) + { + return; + } + + LLGLState test(GL_ALPHA_TEST, 0); + + gGL.getTexUnit(sDiffTex)->bindFast(mTexturep); + mTexturep->addTextureStats(1024.f * 1024.f); // <=== keep Linden tree textures at full res + + for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace* face = *iter; + LLVertexBuffer* buff = face->getVertexBuffer(); + + if (buff) + { + LLMatrix4* model_matrix = &(face->getDrawable()->getRegion()->mRenderMatrix); + + if (model_matrix != gGLLastMatrix) + { + gGLLastMatrix = model_matrix; + gGL.loadMatrix(gGLModelView); + if (model_matrix) + { + llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); + gGL.multMatrix((GLfloat*)model_matrix->mMatrix); + } + gPipeline.mMatrixOpCount++; + } + + buff->setBuffer(); + buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts() - 1, buff->getNumIndices(), 0); + } + } } void LLDrawPoolTree::endDeferredPass(S32 pass) @@ -182,7 +130,7 @@ void LLDrawPoolTree::beginShadowPass(S32 pass) void LLDrawPoolTree::renderShadow(S32 pass) { - render(pass); + renderDeferred(pass); } void LLDrawPoolTree::endShadowPass(S32 pass) @@ -196,14 +144,6 @@ void LLDrawPoolTree::endShadowPass(S32 pass) BOOL LLDrawPoolTree::verify() const { -/* BOOL ok = TRUE; - - if (!ok) - { - printDebugInfo(); - } - return ok;*/ - return TRUE; } diff --git a/indra/newview/lldrawpooltree.h b/indra/newview/lldrawpooltree.h index 13f9ec8dce..496445692c 100644 --- a/indra/newview/lldrawpooltree.h +++ b/indra/newview/lldrawpooltree.h @@ -45,8 +45,6 @@ public: LLDrawPoolTree(LLViewerTexture *texturep); - /*virtual*/ void prerender(); - /*virtual*/ S32 getNumDeferredPasses() { return 1; } /*virtual*/ void beginDeferredPass(S32 pass); /*virtual*/ void endDeferredPass(S32 pass); @@ -57,10 +55,6 @@ public: /*virtual*/ void endShadowPass(S32 pass); /*virtual*/ void renderShadow(S32 pass); - /*virtual*/ void beginRenderPass( S32 pass ); - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void endRenderPass( S32 pass ); - /*virtual*/ S32 getNumPasses() { return 1; } /*virtual*/ BOOL verify() const; /*virtual*/ LLViewerTexture *getTexture(); /*virtual*/ LLViewerTexture *getDebugTexture(); diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index cb3ef55edd..14f3142e1b 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -41,7 +41,6 @@ #include "llsky.h" #include "llviewertexturelist.h" #include "llviewerregion.h" -#include "llvosky.h" #include "llvowater.h" #include "llworld.h" #include "pipeline.h" diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 9fe1b64d3d..59ed62f995 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -69,51 +69,14 @@ LLViewerTexture *LLDrawPoolWLSky::getDebugTexture() return NULL; } -void LLDrawPoolWLSky::beginRenderPass( S32 pass ) -{ - sky_shader = - LLPipeline::sUnderWaterRender ? - &gObjectFullbrightNoColorWaterProgram : - &gWLSkyProgram; - - cloud_shader = - LLPipeline::sUnderWaterRender ? - &gObjectFullbrightNoColorWaterProgram : - &gWLCloudProgram; - - sun_shader = - LLPipeline::sUnderWaterRender ? - &gObjectFullbrightNoColorWaterProgram : - &gWLSunProgram; - - moon_shader = - LLPipeline::sUnderWaterRender ? - &gObjectFullbrightNoColorWaterProgram : - &gWLMoonProgram; -} - -void LLDrawPoolWLSky::endRenderPass( S32 pass ) -{ - sky_shader = nullptr; - cloud_shader = nullptr; - sun_shader = nullptr; - moon_shader = nullptr; -} - void LLDrawPoolWLSky::beginDeferredPass(S32 pass) { sky_shader = &gDeferredWLSkyProgram; cloud_shader = &gDeferredWLCloudProgram; - sun_shader = - LLPipeline::sUnderWaterRender ? - &gObjectFullbrightNoColorWaterProgram : - &gDeferredWLSunProgram; + sun_shader = &gDeferredWLSunProgram; - moon_shader = - LLPipeline::sUnderWaterRender ? - &gObjectFullbrightNoColorWaterProgram : - &gDeferredWLMoonProgram; + moon_shader = &gDeferredWLMoonProgram; } void LLDrawPoolWLSky::endDeferredPass(S32 pass) @@ -124,11 +87,6 @@ void LLDrawPoolWLSky::endDeferredPass(S32 pass) moon_shader = nullptr; } -void LLDrawPoolWLSky::renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const -{ - gSky.mVOWLSkyp->drawFsSky(); -} - void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const { llassert_always(NULL != shader); @@ -213,74 +171,6 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca } } -void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightLocal) const -{ - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) - { - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLGLSPipelineDepthTestSkyBox sky(true, false); - sky_shader->bind(); - sky_shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, 1); - sky_shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, psky->getSunMoonGlowFactor()); - renderDome(origin, camHeightLocal, sky_shader); - sky_shader->unbind(); - } -} - -void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const -{ - LLGLSPipelineBlendSkyBox gls_skybox(true, false); - - // *NOTE: have to have bound the cloud noise texture already since register - // combiners blending below requires something to be bound - // and we might as well only bind once. - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - - // *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid - // clamping and allow the star_alpha param to brighten the stars. - LLColor4 star_alpha(LLColor4::black); - - star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 512.f; - - // If star brightness is not set, exit - if( star_alpha.mV[3] < 0.001 ) - { - LL_DEBUGS("SKY") << "star_brightness below threshold." << LL_ENDL; - return; - } - - LLViewerTexture* tex_a = gSky.mVOSkyp->getBloomTex(); - LLViewerTexture* tex_b = gSky.mVOSkyp->getBloomTexNext(); - - if (tex_a && (!tex_b || (tex_a == tex_b))) - { - // Bind current and next sun textures - gGL.getTexUnit(0)->bind(tex_a); - } - else if (tex_b && !tex_a) - { - gGL.getTexUnit(0)->bind(tex_b); - } - else if (tex_b != tex_a) - { - gGL.getTexUnit(0)->bind(tex_a); - } - - gGL.pushMatrix(); - gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); - gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); - gStarsProgram.bind(); - gStarsProgram.uniform1f(sCustomAlpha, star_alpha.mV[3]); - - gSky.mVOWLSkyp->drawStars(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.popMatrix(); - gStarsProgram.unbind(); // SL-14113 was gCustomAlphaProgram - } - void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const { if (!gSky.mVOSkyp) @@ -406,65 +296,10 @@ void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 } } -void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const -{ - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex()) - { - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - - LLGLSPipelineBlendSkyBox pipeline(true, true); - - cloudshader->bind(); - - LLPointer<LLViewerTexture> cloud_noise = gSky.mVOSkyp->getCloudNoiseTex(); - LLPointer<LLViewerTexture> cloud_noise_next = gSky.mVOSkyp->getCloudNoiseTexNext(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - - F32 cloud_variance = psky ? psky->getCloudVariance() : 0.0f; - F32 blend_factor = psky ? psky->getBlendFactor() : 0.0f; - - // if we even have sun disc textures to work with... - if (cloud_noise || cloud_noise_next) - { - if (cloud_noise && (!cloud_noise_next || (cloud_noise == cloud_noise_next))) - { - // Bind current and next sun textures - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (cloud_noise_next && !cloud_noise) - { - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise_next, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (cloud_noise_next != cloud_noise) - { - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise, LLTexUnit::TT_TEXTURE); - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP_NEXT, cloud_noise_next, LLTexUnit::TT_TEXTURE); - } - } - - cloudshader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); - cloudshader->uniform1f(LLShaderMgr::CLOUD_VARIANCE, cloud_variance); - cloudshader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, psky->getSunMoonGlowFactor()); - - /// Render the skydome - renderDome(camPosLocal, camHeightLocal, cloudshader); - - cloudshader->unbind(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - } -} - void LLDrawPoolWLSky::renderHeavenlyBodies() { if (!gSky.mVOSkyp) return; - //LLGLSPipelineBlendSkyBox gls_skybox(true, false); LLGLSPipelineBlendSkyBox gls_skybox(true, true); // SL-14113 we need moon to write to depth to clip stars behind LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); @@ -581,11 +416,14 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() void LLDrawPoolWLSky::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY); - if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) + if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY) || gSky.mVOSkyp.isNull()) { return; } + // TODO: remove gSky.mVOSkyp and fold sun/moon into LLVOWLSky + gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable); + const F32 camHeightLocal = LLEnvironment::instance().getCamHeight(); gGL.setColorMask(true, false); @@ -602,29 +440,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) gGL.setColorMask(true, true); } -void LLDrawPoolWLSky::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY); - if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) - { - return; - } - const F32 camHeightLocal = LLEnvironment::instance().getCamHeight(); - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - - renderSkyHaze(origin, camHeightLocal); - renderHeavenlyBodies(); - renderStars(origin); - renderSkyClouds(origin, camHeightLocal, cloud_shader); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -} - -void LLDrawPoolWLSky::prerender() -{ - //LL_INFOS() << "wlsky prerendering pass." << LL_ENDL; -} LLViewerTexture* LLDrawPoolWLSky::getTexture() { diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index 324886ed42..c26d0a1e23 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -51,11 +51,6 @@ public: /*virtual*/ void renderDeferred(S32 pass); /*virtual*/ LLViewerTexture *getDebugTexture(); - /*virtual*/ void beginRenderPass( S32 pass ); - /*virtual*/ void endRenderPass( S32 pass ); - /*virtual*/ S32 getNumPasses() { return 1; } - /*virtual*/ void render(S32 pass = 0); - /*virtual*/ void prerender(); /*virtual*/ U32 getVertexDataMask() { return SKY_VERTEX_DATA_MASK; } /*virtual*/ BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct! /*virtual*/ S32 getShaderLevel() const { return mShaderLevel; } @@ -69,17 +64,12 @@ public: static void cleanupGL(); static void restoreGL(); private: - void renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const; void renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const; - void renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightLocal) const; - void renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; - void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const; void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; void renderStarsDeferred(const LLVector3& camPosLocal) const; - void renderStars(const LLVector3& camPosLocal) const; void renderHeavenlyBodies(); }; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 6d600efe37..d88f0f9847 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -684,7 +684,6 @@ namespace if (!injection->mBlendIn) mix = 1.0 - mix; stringset_t dummy; - LLUUID cloud_noise_id = getCloudNoiseTextureId(); F64 value = this->mSettings[injection->mKeyName].asReal(); if (this->getCloudNoiseTextureId().isNull()) { @@ -3129,7 +3128,7 @@ bool LLEnvironment::loadFromSettings() LL_INFOS("ENVIRONMENT") << "Unable to open previous session environment file " << user_filepath << LL_ENDL; } - if (!env_data.isMap() || env_data.emptyMap()) + if (!env_data.isMap() || (env_data.size() == 0)) { LL_DEBUGS("ENVIRONMENT") << "Empty map loaded from: " << user_filepath << LL_ENDL; return false; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 811f475705..a74950dad2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -47,7 +47,6 @@ #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llvopartgroup.h" -#include "llvosky.h" #include "llvovolume.h" #include "pipeline.h" #include "llviewerregion.h" @@ -362,7 +361,7 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) if (ch == LLRender::DIFFUSE_MAP) { - getViewerObject()->changeTEImage(mTEOffset, new_texture) ; + getViewerObject()->changeTEImage(mTEOffset, new_texture) ; } setTexture(ch, new_texture) ; diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 047f1a4965..f3583daa0a 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -46,7 +46,7 @@ LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial() } -void LLFetchedGLTFMaterial::bind() +void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) { // glTF 2.0 Specification 3.9.4. Alpha Coverage // mAlphaCutoff is only valid for LLGLTFMaterial::ALPHA_MODE_MASK @@ -54,15 +54,21 @@ void LLFetchedGLTFMaterial::bind() LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + // override emissive and base color textures with media tex if present + LLViewerTexture* baseColorTex = media_tex ? media_tex : mBaseColorTexture; + LLViewerTexture* emissiveTex = media_tex ? media_tex : mEmissiveTexture; + if (mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK) { - min_alpha = mAlphaCutoff; + // dividing the alpha cutoff by transparency here allows the shader to compare against + // the alpha value of the texture without needing the transparency value + min_alpha = mAlphaCutoff/mBaseColor.mV[3]; } shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha); - if (mBaseColorTexture.notNull()) + if (baseColorTex != nullptr) { - gGL.getTexUnit(0)->bindFast(mBaseColorTexture); + gGL.getTexUnit(0)->bindFast(baseColorTex); } else { @@ -89,9 +95,9 @@ void LLFetchedGLTFMaterial::bind() shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); } - if (mEmissiveTexture.notNull()) + if (emissiveTex != nullptr) { - shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, mEmissiveTexture); // PBR sRGB Emissive + shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, emissiveTex); // PBR sRGB Emissive } else { diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index f784f19c4f..96f7fbea8e 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -43,7 +43,8 @@ public: void onMaterialComplete(std::function<void()> material_complete); // bind this material for rendering - void bind(); + // media_tex - optional media texture that may override the base color texture + void bind(LLViewerTexture* media_tex = nullptr); // Textures used for fetching/rendering LLPointer<LLViewerFetchedTexture> mBaseColorTexture; diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 39bac89864..29e8210d8e 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -593,9 +593,9 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, #elif LL_DARWIN -std::vector<std::string>* LLFilePicker::navOpenFilterProc(ELoadFilter filter) //(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode) +std::unique_ptr<std::vector<std::string>> LLFilePicker::navOpenFilterProc(ELoadFilter filter) //(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode) { - std::vector<std::string> *allowedv = new std::vector< std::string >; + std::unique_ptr<std::vector<std::string>> allowedv(new std::vector< std::string >); switch(filter) { case FFLOAD_ALL: @@ -669,9 +669,9 @@ bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) gViewerWindow->getWindow()->beforeDialog(); - std::vector<std::string> *allowed_types=navOpenFilterProc(filter); + std::unique_ptr<std::vector<std::string>> allowed_types = navOpenFilterProc(filter); - std::vector<std::string> *filev = doLoadDialog(allowed_types, + std::unique_ptr<std::vector<std::string>> filev = doLoadDialog(allowed_types.get(), mPickOptions); gViewerWindow->getWindow()->afterDialog(); @@ -786,7 +786,7 @@ bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filena gViewerWindow->getWindow()->beforeDialog(); // Run the dialog - std::string* filev = doSaveDialog(&namestring, + std::unique_ptr<std::string> filev = doSaveDialog(&namestring, &type, &creator, &extension, diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index a03f3f6711..f510d93dff 100644 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -165,7 +165,7 @@ private: bool doNavChooseDialog(ELoadFilter filter); bool doNavSaveDialog(ESaveFilter filter, const std::string& filename); - std::vector<std::string>* navOpenFilterProc(ELoadFilter filter); + std::unique_ptr<std::vector<std::string>> navOpenFilterProc(ELoadFilter filter); #endif #if LL_GTK diff --git a/indra/newview/llfilepicker_mac.h b/indra/newview/llfilepicker_mac.h index e0b7e2e8ce..b2fb371afe 100644 --- a/indra/newview/llfilepicker_mac.h +++ b/indra/newview/llfilepicker_mac.h @@ -39,9 +39,9 @@ #include <vector> //void modelessPicker(); -std::vector<std::string>* doLoadDialog(const std::vector<std::string>* allowed_types, +std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types, unsigned int flags); -std::string* doSaveDialog(const std::string* file, +std::unique_ptr<std::string> doSaveDialog(const std::string* file, const std::string* type, const std::string* creator, const std::string* extension, diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm index 1438e4dc0a..0ae5fc3f77 100644 --- a/indra/newview/llfilepicker_mac.mm +++ b/indra/newview/llfilepicker_mac.mm @@ -29,104 +29,107 @@ #include <iostream> #include "llfilepicker_mac.h" -std::vector<std::string>* doLoadDialog(const std::vector<std::string>* allowed_types, +std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types, unsigned int flags) { - int i, result; - - //Aura TODO: We could init a small window and release it at the end of this routine - //for a modeless interface. - - NSOpenPanel *panel = [NSOpenPanel openPanel]; - //NSString *fileName = nil; - NSMutableArray *fileTypes = nil; - - - if ( allowed_types && !allowed_types->empty()) - { - fileTypes = [[NSMutableArray alloc] init]; + std::unique_ptr<std::vector<std::string>> outfiles; + + @autoreleasepool { + int i, result; + //Aura TODO: We could init a small window and release it at the end of this routine + //for a modeless interface. + + NSOpenPanel *panel = [NSOpenPanel openPanel]; + //NSString *fileName = nil; + NSMutableArray *fileTypes = nil; - for (i=0;i<allowed_types->size();++i) + if ( allowed_types && !allowed_types->empty()) { - [fileTypes addObject: - [NSString stringWithCString:(*allowed_types)[i].c_str() - encoding:[NSString defaultCStringEncoding]]]; + fileTypes = [[[NSMutableArray alloc] init] autorelease]; + + for (i=0;i<allowed_types->size();++i) + { + [fileTypes addObject: + [NSString stringWithCString:(*allowed_types)[i].c_str() + encoding:[NSString defaultCStringEncoding]]]; + } } - } - //[panel setMessage:@"Import one or more files or directories."]; - [panel setAllowsMultipleSelection: ( (flags & F_MULTIPLE)?true:false ) ]; - [panel setCanChooseDirectories: ( (flags & F_DIRECTORY)?true:false ) ]; - [panel setCanCreateDirectories: true]; - [panel setResolvesAliases: true]; - [panel setCanChooseFiles: ( (flags & F_FILE)?true:false )]; - [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; - - std::vector<std::string>* outfiles = NULL; - - if (fileTypes) - { - [panel setAllowedFileTypes:fileTypes]; - result = [panel runModal]; - } - else - { - // I suggest it's better to open the last path and let this default to home dir as necessary - // for consistency with other OS X apps - // - //[panel setDirectoryURL: fileURLWithPath(NSHomeDirectory()) ]; - result = [panel runModal]; - } - - if (result == NSOKButton) - { - NSArray *filesToOpen = [panel URLs]; - int i, count = [filesToOpen count]; + //[panel setMessage:@"Import one or more files or directories."]; + [panel setAllowsMultipleSelection: ( (flags & F_MULTIPLE)?true:false ) ]; + [panel setCanChooseDirectories: ( (flags & F_DIRECTORY)?true:false ) ]; + [panel setCanCreateDirectories: true]; + [panel setResolvesAliases: true]; + [panel setCanChooseFiles: ( (flags & F_FILE)?true:false )]; + [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; - if (count > 0) + if (fileTypes) + { + [panel setAllowedFileTypes:fileTypes]; + result = [panel runModal]; + } + else { - outfiles = new std::vector<std::string>; + // I suggest it's better to open the last path and let this default to home dir as necessary + // for consistency with other OS X apps + // + //[panel setDirectoryURL: fileURLWithPath(NSHomeDirectory()) ]; + result = [panel runModal]; } - for (i=0; i<count; i++) { - NSString *aFile = [[filesToOpen objectAtIndex:i] path]; - std::string *afilestr = new std::string([aFile UTF8String]); - outfiles->push_back(*afilestr); + if (result == NSOKButton) + { + NSArray *filesToOpen = [panel URLs]; + int i, count = [filesToOpen count]; + + if (count > 0) + { + outfiles.reset(new std::vector<std::string>); + } + + for (i=0; i<count; i++) { + NSString *aFile = [[filesToOpen objectAtIndex:i] path]; + std::string afilestr = std::string([aFile UTF8String]); + outfiles->push_back(afilestr); + } } } + return outfiles; } -std::string* doSaveDialog(const std::string* file, +std::unique_ptr<std::string> doSaveDialog(const std::string* file, const std::string* type, const std::string* creator, const std::string* extension, unsigned int flags) { - NSSavePanel *panel = [NSSavePanel savePanel]; - - NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]]; - NSArray *fileType = [extensionns componentsSeparatedByString:@","]; - - //[panel setMessage:@"Save Image File"]; - [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; - [panel setCanSelectHiddenExtension:true]; - [panel setAllowedFileTypes:fileType]; - NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]]; - - std::string *outfile = NULL; - NSURL* url = [NSURL fileURLWithPath:fileName]; - [panel setNameFieldStringValue: fileName]; - [panel setDirectoryURL: url]; - if([panel runModal] == - NSFileHandlingPanelOKButton) - { - NSURL* url = [panel URL]; - NSString* p = [url path]; - outfile = new std::string( [p UTF8String] ); - // write the file - } + std::unique_ptr<std::string> outfile; + @autoreleasepool { + NSSavePanel *panel = [NSSavePanel savePanel]; + + NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]]; + NSArray *fileType = [extensionns componentsSeparatedByString:@","]; + + //[panel setMessage:@"Save Image File"]; + [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; + [panel setCanSelectHiddenExtension:true]; + [panel setAllowedFileTypes:fileType]; + NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]]; + + NSURL* url = [NSURL fileURLWithPath:fileName]; + [panel setNameFieldStringValue: fileName]; + [panel setDirectoryURL: url]; + if([panel runModal] == + NSFileHandlingPanelOKButton) + { + NSURL* url = [panel URL]; + NSString* p = [url path]; + outfile.reset(new std::string([p UTF8String])); + // write the file + } + } return outfile; } diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index 62a1e0af94..eff94bd195 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -537,7 +537,8 @@ void LLFloater360Capture::capture360Images() // We need to convert from the angle getYaw() gives us into something // the XMP data field wants (N=0, E=90, S=180, W= 270 etc.) mInitialHeadingDeg = (360 + 90 - (int)(camera->getYaw() * RAD_TO_DEG)) % 360; - LL_INFOS("360Capture") << "Recording a heading of " << (int)(mInitialHeadingDeg) << LL_ENDL; + LL_INFOS("360Capture") << "Recording a heading of " << (int)(mInitialHeadingDeg) + << " Image size: " << (S32)mSourceImageSize << LL_ENDL; // camera constants for the square, cube map capture image camera->setAspect(1.0); // must set aspect ratio first to avoid undesirable clamping of vertical FoV @@ -587,6 +588,9 @@ void LLFloater360Capture::capture360Images() // for each of the 6 directions we shoot... for (int i = 0; i < 6; i++) { + LLAppViewer::instance()->pauseMainloopTimeout(); + LLViewerStats::instance().getRecording().stop(); + // these buffers are where the raw, captured pixels are stored and // the first time we use them, we have to make a new one if (mRawImages[i] == nullptr) @@ -624,8 +628,10 @@ void LLFloater360Capture::capture360Images() auto duration = std::chrono::duration_cast<std::chrono::duration<double>>(t_end - t_start); encode_time_total += duration.count(); - // ping the main loop in case the snapshot process takes a really long - // time and we get disconnected + LLViewerStats::instance().getRecording().resume(); + LLAppViewer::instance()->resumeMainloopTimeout(); + + // update main loop timeout state LLAppViewer::instance()->pingMainloopTimeout("LLFloater360Capture::capture360Images"); } diff --git a/indra/newview/llfloateravatar.cpp b/indra/newview/llfloateravatar.cpp index 31adf5b61e..f888d032ae 100644 --- a/indra/newview/llfloateravatar.cpp +++ b/indra/newview/llfloateravatar.cpp @@ -44,17 +44,21 @@ LLFloaterAvatar::LLFloaterAvatar(const LLSD& key) LLFloaterAvatar::~LLFloaterAvatar() { - LLMediaCtrl* avatar_picker = findChild<LLMediaCtrl>("avatar_picker_contents"); - if (avatar_picker) + if (mAvatarPicker) { - avatar_picker->navigateStop(); - avatar_picker->clearCache(); //images are reloading each time already - avatar_picker->unloadMediaSource(); + mAvatarPicker->navigateStop(); + mAvatarPicker->clearCache(); //images are reloading each time already + mAvatarPicker->unloadMediaSource(); } } BOOL LLFloaterAvatar::postBuild() { + mAvatarPicker = findChild<LLMediaCtrl>("avatar_picker_contents"); + if (mAvatarPicker) + { + mAvatarPicker->clearCache(); + } enableResizeCtrls(true, true, false); return TRUE; } diff --git a/indra/newview/llfloateravatar.h b/indra/newview/llfloateravatar.h index cadc5e4028..76e9372709 100644 --- a/indra/newview/llfloateravatar.h +++ b/indra/newview/llfloateravatar.h @@ -29,6 +29,7 @@ #define LL_FLOATER_AVATAR_H #include "llfloater.h" +class LLMediaCtrl; class LLFloaterAvatar: public LLFloater @@ -38,6 +39,8 @@ private: LLFloaterAvatar(const LLSD& key); /*virtual*/ ~LLFloaterAvatar(); /*virtual*/ BOOL postBuild(); + + LLMediaCtrl* mAvatarPicker; }; #endif diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 33e4c7cd5f..307ab8c4d1 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -69,6 +69,12 @@ LLFloaterBump::LLFloaterBump(const LLSD& key) // Destroys the object LLFloaterBump::~LLFloaterBump() { + auto menu = mPopupMenuHandle.get(); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } } BOOL LLFloaterBump::postBuild() @@ -77,11 +83,15 @@ BOOL LLFloaterBump::postBuild() mList->setAllowMultipleSelection(false); mList->setRightMouseDownCallback(boost::bind(&LLFloaterBump::onScrollListRightClicked, this, _1, _2, _3)); - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_avatar_other.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mPopupMenu->setItemVisible(std::string("Normal"), false); - mPopupMenu->setItemVisible(std::string("Always use impostor"), false); - mPopupMenu->setItemVisible(std::string("Never use impostor"), false); - mPopupMenu->setItemVisible(std::string("Impostor seperator"), false); + LLContextMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_avatar_other.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mPopupMenuHandle = menu->getHandle(); + menu->setItemVisible(std::string("Normal"), false); + menu->setItemVisible(std::string("Always use impostor"), false); + menu->setItemVisible(std::string("Never use impostor"), false); + menu->setItemVisible(std::string("Impostor seperator"), false); + } return TRUE; } @@ -176,18 +186,19 @@ void LLFloaterBump::onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y) if (!gMeanCollisionList.empty()) { LLScrollListItem* item = mList->hitItem(x, y); - if (item && mPopupMenu) + auto menu = mPopupMenuHandle.get(); + if (item && menu) { mItemUUID = item->getUUID(); - mPopupMenu->buildDrawLabels(); - mPopupMenu->updateParent(LLMenuGL::sMenuContainer); + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); std::string mute_msg = (LLMuteList::getInstance()->isMuted(mItemUUID, mNames[mItemUUID])) ? "UnmuteAvatar" : "MuteAvatar"; - mPopupMenu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg)); - mPopupMenu->setItemEnabled(std::string("Zoom In"), bool(gObjectList.findObject(mItemUUID))); + menu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg)); + menu->setItemEnabled(std::string("Zoom In"), bool(gObjectList.findObject(mItemUUID))); - ((LLContextMenu*)mPopupMenu)->show(x, y); - LLMenuGL::showPopup(ctrl, mPopupMenu, x, y); + menu->show(x, y); + LLMenuGL::showPopup(ctrl, menu, x, y); } } } diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h index ce52c75255..d2f9fabdd3 100644 --- a/indra/newview/llfloaterbump.h +++ b/indra/newview/llfloaterbump.h @@ -68,7 +68,7 @@ private: virtual ~LLFloaterBump(); LLScrollListCtrl* mList; - LLMenuGL* mPopupMenu; + LLHandle<LLContextMenu> mPopupMenuHandle; LLUUID mItemUUID; typedef std::map<LLUUID, std::string> uuid_map_t; diff --git a/indra/newview/llfloatercreatelandmark.cpp b/indra/newview/llfloatercreatelandmark.cpp index 7def855d83..b82d8a29ba 100644 --- a/indra/newview/llfloatercreatelandmark.cpp +++ b/indra/newview/llfloatercreatelandmark.cpp @@ -316,7 +316,6 @@ void LLFloaterCreateLandmark::onSaveClicked() LLStringUtil::trim(current_title_value); LLStringUtil::trim(current_notes_value); - LLUUID item_id = mItem->getUUID(); LLUUID folder_id = mFolderCombo->getValue().asUUID(); bool change_parent = folder_id != mItem->getParentUUID(); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 703b5d0011..2720b7fcf7 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -211,6 +211,7 @@ BOOL LLFloaterIMContainer::postBuild() p.options_menu = "menu_conversation.xml"; mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p); mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); + mConversationsRoot->setEnableRegistrar(&mEnableCallbackRegistrar); // Add listener to conversation model events mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLFloaterIMContainer::onConversationModelEvent, this, _1)); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 204cd03b09..78271369d2 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -316,6 +316,7 @@ BOOL LLFloaterIMSessionTab::postBuild() p.name = "root"; mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p); mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); + mConversationsRoot->setEnableRegistrar(&mEnableCallbackRegistrar); // Attach that root to the scroller mScroller->addChild(mConversationsRoot); mConversationsRoot->setScrollContainer(mScroller); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index cba074b380..c37d8fae53 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1740,7 +1740,7 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) childSetTextArg("download_weight", "[ST]", tbd); childSetTextArg("server_weight", "[SIM]", tbd); childSetTextArg("physics_weight", "[PH]", tbd); - if (!mModelPhysicsFee.isMap() || mModelPhysicsFee.emptyMap()) + if (!mModelPhysicsFee.isMap() || (mModelPhysicsFee.size() == 0)) { childSetTextArg("upload_fee", "[FEE]", tbd); } diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 2a1749bd42..a682064dad 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -56,8 +56,6 @@ LLFloaterOpenObject::LLFloaterOpenObject(const LLSD& key) mDirty(TRUE) { mCommitCallbackRegistrar.add("OpenObject.MoveToInventory", boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this)); - mCommitCallbackRegistrar.add("OpenObject.MoveAndWear", boost::bind(&LLFloaterOpenObject::onClickMoveAndWear, this)); - mCommitCallbackRegistrar.add("OpenObject.ReplaceOutfit", boost::bind(&LLFloaterOpenObject::onClickReplace, this)); mCommitCallbackRegistrar.add("OpenObject.Cancel", boost::bind(&LLFloaterOpenObject::onClickCancel, this)); } @@ -243,18 +241,6 @@ void LLFloaterOpenObject::onClickMoveToInventory() closeFloater(); } -void LLFloaterOpenObject::onClickMoveAndWear() -{ - moveToInventory(true, false); - closeFloater(); -} - -void LLFloaterOpenObject::onClickReplace() -{ - moveToInventory(true, true); - closeFloater(); -} - void LLFloaterOpenObject::onClickCancel() { closeFloater(); diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h index 2e761f99bf..745753316b 100644 --- a/indra/newview/llfloateropenobject.h +++ b/indra/newview/llfloateropenobject.h @@ -63,8 +63,6 @@ protected: void moveToInventory(bool wear, bool replace = false); void onClickMoveToInventory(); - void onClickMoveAndWear(); - void onClickReplace(); void onClickCancel(); static void callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear, bool replace = false); static void callbackMoveInventory(S32 result, void* data); diff --git a/indra/newview/llfloateroutfitphotopreview.cpp b/indra/newview/llfloateroutfitphotopreview.cpp index 6c39db730c..ade258aef7 100644 --- a/indra/newview/llfloateroutfitphotopreview.cpp +++ b/indra/newview/llfloateroutfitphotopreview.cpp @@ -234,7 +234,6 @@ void LLFloaterOutfitPhotoPreview::updateImageID() if(item) { mImageID = item->getAssetUUID(); - LLPermissions perm(item->getPermissions()); } else { diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 1e46d7a402..03aede94c6 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -44,6 +44,7 @@ #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" #include "llpathfindingmanager.h" +#include "llsearcheditor.h" #include "llscrolllistitem.h" #include "llsd.h" #include "lltextbase.h" @@ -114,17 +115,13 @@ BOOL LLFloaterPathfindingLinksets::postBuild() { mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingLinksetBeaconColor"); - mFilterByName = findChild<LLLineEditor>("filter_by_name"); - llassert(mFilterByName != NULL); - mFilterByName->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); - mFilterByName->setSelectAllonFocusReceived(true); - mFilterByName->setCommitOnFocusLost(true); - - mFilterByDescription = findChild<LLLineEditor>("filter_by_description"); - llassert(mFilterByDescription != NULL); - mFilterByDescription->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); - mFilterByDescription->setSelectAllonFocusReceived(true); - mFilterByDescription->setCommitOnFocusLost(true); + mFilterByName = getChild<LLSearchEditor>("filter_by_name"); + mFilterByName->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); + mFilterByName->setCommitOnFocusLost(true); + + mFilterByDescription = getChild<LLSearchEditor>("filter_by_description"); + mFilterByDescription->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this)); + mFilterByDescription->setCommitOnFocusLost(true); mFilterByLinksetUse = findChild<LLComboBox>("filter_by_linkset_use"); llassert(mFilterByLinksetUse != NULL); diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 7149da9215..a954d8a8ec 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -42,6 +42,7 @@ class LLSD; class LLTextBase; class LLUICtrl; class LLVector3; +class LLSearchEditor; class LLFloaterPathfindingLinksets : public LLFloaterPathfindingObjects { @@ -105,8 +106,8 @@ private: LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const; LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; - LLLineEditor *mFilterByName; - LLLineEditor *mFilterByDescription; + LLSearchEditor *mFilterByName; + LLSearchEditor *mFilterByDescription; LLComboBox *mFilterByLinksetUse; LLComboBox *mEditLinksetUse; LLScrollListItem *mEditLinksetUseUnset; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 0aa2462ddd..7487c1c9f9 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -78,7 +78,6 @@ #include "llviewerthrottle.h" #include "llvoavatarself.h" #include "llvotree.h" -#include "llvosky.h" #include "llfloaterpathfindingconsole.h" // linden library includes #include "llavatarnamecache.h" diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 3746b9b6c2..40fe11b309 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -421,7 +421,6 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) for(S32 i = 0; i < number_parcels; i++) { std::string parcel_name = content["parcels"][i]["name"].asString(); - LLUUID parcel_id = content["parcels"][i]["id"].asUUID(); S32 number_objects = content["parcels"][i]["objects"].size(); S32 local_id = 0; diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index bb3ed77772..7e6af45515 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -45,7 +45,7 @@ class LLSearchHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_THROTTLE) { } + LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_CLICK_ONLY) { } bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) { if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableSearch")) diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 186994c857..3c7f341613 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -2,9 +2,9 @@ * @file llfloatersettingsdebug.cpp * @brief floater for debugging internal viewer settings * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2022, 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 @@ -27,8 +27,8 @@ #include "llviewerprecompiledheaders.h" #include "llfloatersettingsdebug.h" #include "llfloater.h" +#include "llfiltereditor.h" #include "lluictrlfactory.h" -//#include "llfirstuse.h" #include "llcombobox.h" #include "llspinctrl.h" #include "llcolorswatch.h" @@ -37,12 +37,11 @@ LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key) -: LLFloater(key) +: LLFloater(key), + mSettingList(NULL) { - mCommitCallbackRegistrar.add("SettingSelect", boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this,_1)); mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsDebug::onClickDefault, this)); - } LLFloaterSettingsDebug::~LLFloaterSettingsDebug() @@ -50,59 +49,43 @@ LLFloaterSettingsDebug::~LLFloaterSettingsDebug() BOOL LLFloaterSettingsDebug::postBuild() { - LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); + enableResizeCtrls(true, false, true); - struct f : public LLControlGroup::ApplyFunctor - { - LLComboBox* combo; - f(LLComboBox* c) : combo(c) {} - virtual void apply(const std::string& name, LLControlVariable* control) - { - if (!control->isHiddenFromSettingsEditor()) - { - combo->add(name, (void*)control); - } - } - } func(settings_combo); + mComment = getChild<LLTextEditor>("comment_text"); - std::string key = getKey().asString(); - if (key == "all" || key == "base") - { - gSavedSettings.applyToAll(&func); - } - if (key == "all" || key == "account") - { - gSavedPerAccountSettings.applyToAll(&func); - } + getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::setSearchFilter, this, _2)); + + mSettingList = getChild<LLScrollListCtrl>("setting_list"); + mSettingList->setCommitOnSelectionChange(TRUE); + mSettingList->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); + + updateList(); + + gSavedSettings.getControl("DebugSettingsHideDefault")->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsDebug::updateList, this, false)); - settings_combo->sortByName(); - settings_combo->updateSelection(); - mComment = getChild<LLTextEditor>("comment_text"); return TRUE; } void LLFloaterSettingsDebug::draw() { - LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); - LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); - updateControl(controlp); + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + LLControlVariable* controlp = (LLControlVariable*)first_selected->getUserdata(); + updateControl(controlp); + } LLFloater::draw(); } -//static -void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl) -{ - LLComboBox* combo_box = (LLComboBox*)ctrl; - LLControlVariable* controlp = (LLControlVariable*)combo_box->getCurrentUserdata(); - - updateControl(controlp); -} - void LLFloaterSettingsDebug::onCommitSettings() { - LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); - LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (!first_selected) + { + return; + } + LLControlVariable* controlp = (LLControlVariable*)first_selected->getUserdata(); if (!controlp) { @@ -176,19 +159,23 @@ void LLFloaterSettingsDebug::onCommitSettings() default: break; } + updateDefaultColumn(controlp); } // static void LLFloaterSettingsDebug::onClickDefault() { - LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); - LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); - - if (controlp) - { - controlp->resetToDefault(true); - updateControl(controlp); - } + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + LLControlVariable* controlp = (LLControlVariable*)first_selected->getUserdata(); + if (controlp) + { + controlp->resetToDefault(true); + updateDefaultColumn(controlp); + updateControl(controlp); + } + } } // we've switched controls, or doing per-frame update, so update spinners, etc. @@ -207,23 +194,30 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) return; } - spinner1->setVisible(FALSE); - spinner2->setVisible(FALSE); - spinner3->setVisible(FALSE); - spinner4->setVisible(FALSE); - color_swatch->setVisible(FALSE); - getChildView("val_text")->setVisible( FALSE); - mComment->setText(LLStringUtil::null); + hideUIControls(); - if (controlp) + if (controlp && !isSettingHidden(controlp)) { eControlType type = controlp->type(); //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame getChildView("boolean_combo")->setVisible( type == TYPE_BOOLEAN); - + getChildView("default_btn")->setVisible(true); + getChildView("setting_name_txt")->setVisible(true); + getChild<LLTextBox>("setting_name_txt")->setText(controlp->getName()); + getChild<LLTextBox>("setting_name_txt")->setToolTip(controlp->getName()); + mComment->setVisible(true); + + std::string old_text = mComment->getText(); + std::string new_text = controlp->getComment(); + // Don't setText if not nessesary, it will reset scroll + // This is a debug UI that reads from xml, there might + // be use cases where comment changes, but not the name + if (old_text != new_text) + { + mComment->setText(controlp->getComment()); + } - mComment->setText(controlp->getComment()); spinner1->setMaxValue(F32_MAX); spinner2->setMaxValue(F32_MAX); spinner3->setMaxValue(F32_MAX); @@ -479,3 +473,166 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } } + +void LLFloaterSettingsDebug::updateList(bool skip_selection) +{ + std::string last_selected; + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(1); + if (cell) + { + last_selected = cell->getValue().asString(); + } + } + + mSettingList->deleteAllItems(); + struct f : public LLControlGroup::ApplyFunctor + { + LLScrollListCtrl* setting_list; + LLFloaterSettingsDebug* floater; + std::string selected_setting; + bool skip_selection; + f(LLScrollListCtrl* list, LLFloaterSettingsDebug* floater, std::string setting, bool skip_selection) + : setting_list(list), floater(floater), selected_setting(setting), skip_selection(skip_selection) {} + virtual void apply(const std::string& name, LLControlVariable* control) + { + if (!control->isHiddenFromSettingsEditor() && floater->matchesSearchFilter(name) && !floater->isSettingHidden(control)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_setting"; + row["columns"][0]["value"] = control->isDefault() ? "" : "*"; + + row["columns"][1]["column"] = "setting"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = setting_list->addElement(row, ADD_BOTTOM, (void*)control); + if (!floater->mSearchFilter.empty() && (selected_setting == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, floater->mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + } func(mSettingList, this, last_selected, skip_selection); + + std::string key = getKey().asString(); + if (key == "all" || key == "base") + { + gSavedSettings.applyToAll(&func); + } + if (key == "all" || key == "account") + { + gSavedPerAccountSettings.applyToAll(&func); + } + + + if (!mSettingList->isEmpty()) + { + if (mSettingList->hasSelectedItem()) + { + mSettingList->scrollToShowSelected(); + } + else if (!mSettingList->hasSelectedItem() && !mSearchFilter.empty() && !skip_selection) + { + if (!mSettingList->selectItemByPrefix(mSearchFilter, false, 1)) + { + mSettingList->selectFirstItem(); + } + mSettingList->scrollToShowSelected(); + } + } + else + { + LLSD row; + + row["columns"][0]["column"] = "changed_setting"; + row["columns"][0]["value"] = ""; + row["columns"][1]["column"] = "setting"; + row["columns"][1]["value"] = "No matching settings."; + + mSettingList->addElement(row); + hideUIControls(); + } +} + +void LLFloaterSettingsDebug::onSettingSelect() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + LLControlVariable* controlp = (LLControlVariable*)first_selected->getUserdata(); + if (controlp) + { + updateControl(controlp); + } + } +} + +void LLFloaterSettingsDebug::setSearchFilter(const std::string& filter) +{ + if(mSearchFilter == filter) + return; + mSearchFilter = filter; + LLStringUtil::toLower(mSearchFilter); + updateList(); +} + +bool LLFloaterSettingsDebug::matchesSearchFilter(std::string setting_name) +{ + // If the search filter is empty, everything passes. + if (mSearchFilter.empty()) return true; + + LLStringUtil::toLower(setting_name); + std::string::size_type match_name = setting_name.find(mSearchFilter); + + return (std::string::npos != match_name); +} + +bool LLFloaterSettingsDebug::isSettingHidden(LLControlVariable* control) +{ + static LLCachedControl<bool> hide_default(gSavedSettings, "DebugSettingsHideDefault", false); + return hide_default && control->isDefault(); +} + +void LLFloaterSettingsDebug::updateDefaultColumn(LLControlVariable* control) +{ + if (isSettingHidden(control)) + { + hideUIControls(); + updateList(true); + return; + } + + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(0); + if (cell) + { + std::string is_default = control->isDefault() ? "" : "*"; + cell->setValue(is_default); + } + } +} + +void LLFloaterSettingsDebug::hideUIControls() +{ + getChildView("val_spinner_1")->setVisible(false); + getChildView("val_spinner_2")->setVisible(false); + getChildView("val_spinner_3")->setVisible(false); + getChildView("val_spinner_4")->setVisible(false); + getChildView("val_color_swatch")->setVisible(false); + getChildView("val_text")->setVisible(false); + getChildView("default_btn")->setVisible(false); + getChildView("boolean_combo")->setVisible(false); + getChildView("setting_name_txt")->setVisible(false); + mComment->setVisible(false); +} + diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index f07e0557e3..888eaadcbd 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -2,9 +2,9 @@ * @file llfloatersettingsdebug.h * @brief floater for debugging internal viewer settings * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2022, 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 @@ -30,6 +30,8 @@ #include "llcontrol.h" #include "llfloater.h" +class LLScrollListCtrl; + class LLFloaterSettingsDebug : public LLFloater { @@ -42,18 +44,31 @@ public: void updateControl(LLControlVariable* control); - void onSettingSelect(LLUICtrl* ctrl); void onCommitSettings(); void onClickDefault(); + bool matchesSearchFilter(std::string setting_name); + bool isSettingHidden(LLControlVariable* control); + private: // key - selects which settings to show, one of: // "all", "base", "account", "skin" LLFloaterSettingsDebug(const LLSD& key); virtual ~LLFloaterSettingsDebug(); + + void updateList(bool skip_selection = false); + void onSettingSelect(); + void setSearchFilter(const std::string& filter); + + void updateDefaultColumn(LLControlVariable* control); + void hideUIControls(); + + LLScrollListCtrl* mSettingList; protected: class LLTextEditor* mComment; + + std::string mSearchFilter; }; #endif //LLFLOATERDEBUGSETTINGS_H diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 01bfae8934..704abd269f 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -122,7 +122,7 @@ class LLWorldMapHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_THROTTLE ) { } + LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_CLICK_ONLY ) { } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) @@ -159,7 +159,7 @@ class LLMapTrackAvatarHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLMapTrackAvatarHandler() : LLCommandHandler("maptrackavatar", UNTRUSTED_THROTTLE) + LLMapTrackAvatarHandler() : LLCommandHandler("maptrackavatar", UNTRUSTED_CLICK_ONLY) { } diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index dbeb157323..be52e280e1 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -52,7 +52,32 @@ class LLGroupHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_THROTTLE) { } + LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_CLICK_ONLY) { } + + virtual bool canHandleUntrusted( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web, + const std::string& nav_type) + { + if (params.size() < 1) + { + return true; // don't block, will fail later + } + + if (nav_type == NAV_TYPE_CLICKED) + { + return true; + } + + const std::string verb = params[0].asString(); + if (verb == "create") + { + return false; + } + return true; + } + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) { diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index e6845127e3..af2d168aef 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -1568,7 +1568,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) return; } - if (messages.emptyArray()) + if (messages.size() == 0) { // Nothing to process return; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index bf9e226244..3607e49b4a 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2115,8 +2115,6 @@ void LLOutgoingCallDialog::show(const LLSD& key) std::string callee_name = mPayload["session_name"].asString(); - LLUUID session_id = mPayload["session_id"].asUUID(); - if (callee_name == "anonymous") // obsolete? Likely was part of avaline support { callee_name = getString("anonymous"); @@ -2500,7 +2498,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload } } - LLUUID new_session_id = gIMMgr->addSession(correct_session_name, type, session_id, true); + gIMMgr->addSession(correct_session_name, type, session_id, true); std::string url = gAgent.getRegion()->getCapability( "ChatSessionRequest"); @@ -2586,7 +2584,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) } else { - LLUUID new_session_id = gIMMgr->addSession( + gIMMgr->addSession( payload["session_name"].asString(), type, session_id, true); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 141dc20d92..2665cb1b92 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -834,6 +834,12 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { disabled_items.push_back(std::string("Find Original")); } + + items.push_back(std::string("Cut")); + if (!isItemMovable() || !isItemRemovable()) + { + disabled_items.push_back(std::string("Cut")); + } } else { @@ -2154,6 +2160,7 @@ bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true); return (can_copy_as_link && inventory_linking) + || (mIsLink && inventory_linking) || item->getPermissions().allowCopyBy(gAgent.getID()); } @@ -2360,6 +2367,12 @@ BOOL LLFolderBridge::isUpToDate() const bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const { + if (can_copy_as_link && !LLFolderType::lookupIsProtectedType(getPreferredType())) + { + // Can copy and paste unprotected folders as links + return true; + } + // Folders are copyable if items in them are, recursively, copyable. // Get the content of the folder diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index f7dc493109..374790b917 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -437,7 +437,6 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const { LLInventoryType::EType object_type = item->getInventoryType(); - const LLUUID object_id = item->getUUID(); const U32 filterTypes = mFilterOps.mFilterTypes; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 5755bc692e..af1c93f383 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1406,9 +1406,6 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol LLNotificationsUtil::add("MerchantPasteFailed", subs); return false; } - - // Get the parent folder of the moved item : we may have to update it - LLUUID src_folder = viewer_inv_item->getParentUUID(); if (copy) { diff --git a/indra/newview/llinventorylistitem.h b/indra/newview/llinventorylistitem.h index d4dd212cc3..cf713a6930 100644 --- a/indra/newview/llinventorylistitem.h +++ b/indra/newview/llinventorylistitem.h @@ -197,6 +197,7 @@ protected: virtual BOOL handleToolTip( S32 x, S32 y, MASK mask); const LLUUID mInventoryItemUUID; + bool mHovered; private: @@ -221,7 +222,6 @@ private: LLUIImagePtr mSelectedImage; LLUIImagePtr mSeparatorImage; - bool mHovered; bool mSelected; bool mSeparatorVisible; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index e5c9ec927a..75dda5557d 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1694,11 +1694,11 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo // Can't have links to links, so there's no need for this update // if the item removed is a link. Can also skip if source of the // update is getting broken link info separately. - obj = NULL; // delete obj if (fix_broken_links && !is_link_type) { updateLinkedObjectsFromPurge(id); } + obj = nullptr; // delete obj if (do_notify_observers) { notifyObservers(); @@ -2718,7 +2718,6 @@ void LLInventoryModel::buildParentChildMap() // some accounts has pbroken inventory root folders std::string name = "My Inventory"; - LLUUID prev_root_id = mRootFolderID; for (parent_cat_map_t::const_iterator it = mParentChildCategoryTree.begin(), it_end = mParentChildCategoryTree.end(); it != it_end; ++it) { diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index bc035fc2f6..7e5a2b3950 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -211,7 +211,11 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) p.allow_drop = mParams.allow_drop_on_root; p.options_menu = "menu_inventory.xml"; - return LLUICtrlFactory::create<LLFolderView>(p); + LLFolderView* fv = LLUICtrlFactory::create<LLFolderView>(p); + fv->setCallbackRegistrar(&mCommitCallbackRegistrar); + fv->setEnableRegistrar(&mEnableCallbackRegistrar); + + return fv; } void LLInventoryPanel::clearFolderRoot() @@ -264,6 +268,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) } mCommitCallbackRegistrar.popScope(); mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar); + mFolderRoot.get()->setEnableRegistrar(&mEnableCallbackRegistrar); // Scroller LLRect scroller_view_rect = getRect(); diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index d3ba18525b..60f8aca94c 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -171,8 +171,9 @@ bool LLKeyConflictHandler::isReservedByMenu(const KEY &key, const MASK &mask) { return false; } - return (gMenuBarView && gMenuBarView->hasAccelerator(key, mask)) - || (gLoginMenuBarView && gLoginMenuBarView->hasAccelerator(key, mask)); + // At the moment controls are only applicable inworld, + // ignore gLoginMenuBarView + return gMenuBarView && gMenuBarView->hasAccelerator(key, mask); } // static @@ -182,8 +183,7 @@ bool LLKeyConflictHandler::isReservedByMenu(const LLKeyData &data) { return false; } - return (gMenuBarView && gMenuBarView->hasAccelerator(data.mKey, data.mMask)) - || (gLoginMenuBarView && gLoginMenuBarView->hasAccelerator(data.mKey, data.mMask)); + return gMenuBarView && gMenuBarView->hasAccelerator(data.mKey, data.mMask); } bool LLKeyConflictHandler::registerControl(const std::string &control_name, U32 index, EMouseClickType mouse, KEY key, MASK mask, bool ignore_mask) diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp index 6bda8b1d0d..77185411c5 100644 --- a/indra/newview/lllistcontextmenu.cpp +++ b/indra/newview/lllistcontextmenu.cpp @@ -51,6 +51,7 @@ LLListContextMenu::~LLListContextMenu() if (!mMenuHandle.isDead()) { mMenuHandle.get()->die(); + mMenuHandle.markDead(); } } @@ -59,13 +60,8 @@ void LLListContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 LLContextMenu* menup = mMenuHandle.get(); if (menup) { - //preventing parent (menu holder) from deleting already "dead" context menus on exit - LLView* parent = menup->getParent(); - if (parent) - { - parent->removeChild(menup); - } - delete menup; + menup->die(); + mMenuHandle.markDead(); mUUIDs.clear(); } diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 173f5620c6..41085afb3d 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -770,7 +770,7 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) const LLInventoryItem* item = getItem(); if (item) { - LLPermissions perm(item->getPermissions()); + //LLPermissions perm(item->getPermissions()); bool allow_modify = canModify(mObjectUUID, item); bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); bool source_notecard = mNotecardInventoryID.notNull(); @@ -1226,7 +1226,6 @@ bool LLMaterialEditor::updateInventoryItem(const std::string &buffer, const LLUU } else if (!task_id.isNull() && !task_url.empty()) { - LLUUID object_uuid(task_id); uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(task_id, item_id, LLAssetType::AT_MATERIAL, buffer, [](LLUUID itemId, LLUUID task_id, LLUUID newAssetId, LLSD) { @@ -1277,7 +1276,6 @@ void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std: // gen a new uuid for this asset LLTransactionID tid; tid.generate(); // timestamp-based randomization + uniquification - LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); U32 next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Materials"); LLUUID parent = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL); const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ? diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 27a9758ec3..3b59b2f05e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -428,12 +428,10 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); - LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); - std::string content_string(reinterpret_cast<const char*>(content_binary.data()), content_binary.size()); - std::istringstream content_stream(content_string); + const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -471,12 +469,10 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); - LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); - std::string content_string(reinterpret_cast<const char*>(content_binary.data()), content_binary.size()); - std::istringstream content_stream(content_string); + const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -540,12 +536,10 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) llassert(content.has(MATERIALS_CAP_ZIP_FIELD)); llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary()); - LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); - std::string content_string(reinterpret_cast<const char*>(content_binary.data()), content_binary.size()); - std::istringstream content_stream(content_string); + const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -665,8 +659,8 @@ void LLMaterialMgr::processGetQueue() { material_queue_t::iterator itMaterial = loopMaterial++; materialsData.append((*itMaterial).asLLSD()); - materials.erase(itMaterial); markGetPending(region_id, *itMaterial); + materials.erase(itMaterial); } if (materials.empty()) { diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 9142aadab9..36ac1bdf97 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -106,7 +106,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mTrusted(p.trusted_content), mWindowShade(NULL), mHoverTextChanged(false), - mContextMenu(NULL), mAllowFileDownload(false) { { @@ -151,6 +150,13 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : LLMediaCtrl::~LLMediaCtrl() { + auto menu = mContextMenuHandle.get(); + if (menu) + { + menu->die(); + mContextMenuHandle.markDead(); + } + if (mMediaSource) { mMediaSource->remObserver( this ); @@ -336,15 +342,33 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) setFocus( TRUE ); } - if (mContextMenu) + auto menu = mContextMenuHandle.get(); + if (!menu) + { + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; + registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this)); + + // stinson 05/05/2014 : use this as the parent of the context menu if the static menu + // container has yet to be created + LLPanel* menuParent = (LLMenuGL::sMenuContainer != NULL) ? dynamic_cast<LLPanel*>(LLMenuGL::sMenuContainer) : dynamic_cast<LLPanel*>(this); + llassert(menuParent != NULL); + menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( + "menu_media_ctrl.xml", menuParent, LLViewerMenuHolderGL::child_registry_t::instance()); + if (menu) + { + mContextMenuHandle = menu->getHandle(); + } + } + + if (menu) { // hide/show debugging options bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); - mContextMenu->setItemVisible("open_webinspector", media_plugin_debugging_enabled ); - mContextMenu->setItemVisible("debug_separator", media_plugin_debugging_enabled ); + menu->setItemVisible("open_webinspector", media_plugin_debugging_enabled ); + menu->setItemVisible("debug_separator", media_plugin_debugging_enabled ); - mContextMenu->show(x, y); - LLMenuGL::showPopup(this, mContextMenu, x, y); + menu->show(x, y); + LLMenuGL::showPopup(this, menu, x, y); } return TRUE; @@ -409,15 +433,6 @@ void LLMediaCtrl::onFocusLost() // BOOL LLMediaCtrl::postBuild () { - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; - registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this)); - - // stinson 05/05/2014 : use this as the parent of the context menu if the static menu - // container has yet to be created - LLPanel* menuParent = (LLMenuGL::sMenuContainer != NULL) ? dynamic_cast<LLPanel*>(LLMenuGL::sMenuContainer) : dynamic_cast<LLPanel*>(this); - llassert(menuParent != NULL); - mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( - "menu_media_ctrl.xml", menuParent, LLViewerMenuHolderGL::child_registry_t::instance()); setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2)); return TRUE; @@ -1230,11 +1245,6 @@ void LLMediaCtrl::setTrustedContent(bool trusted) } } -void LLMediaCtrl::updateContextMenuParent(LLView* pNewParent) -{ - mContextMenu->updateParent(pNewParent); -} - bool LLMediaCtrl::wantsKeyUpKeyDown() const { return true; diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index bc4cbaae68..487c654adc 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -174,8 +174,6 @@ public: LLUUID getTextureID() {return mMediaTextureID;} - void updateContextMenuParent(LLView* pNewParent); - // The Browser windows want keyup and keydown events. Overridden from LLFocusableElement to return true. virtual bool wantsKeyUpKeyDown() const; virtual bool wantsReturnKey() const; @@ -220,7 +218,7 @@ public: mTextureHeight; class LLWindowShade* mWindowShade; - LLContextMenu* mContextMenu; + LLHandle<LLContextMenu> mContextMenuHandle; }; #endif // LL_LLMediaCtrl_H diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 5a6010d5e4..e8411dd573 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -77,6 +77,8 @@ #include "lluploaddialog.h" #include "llfloaterreg.h" +#include "boost/iostreams/device/array.hpp" +#include "boost/iostreams/stream.hpp" #include "boost/lexical_cast.hpp" #ifndef LL_WINDOWS @@ -138,7 +140,7 @@ // data copied // headerReceived() invoked // LLSD parsed -// mMeshHeader, mMeshHeaderSize updated +// mMeshHeader updated // scan mPendingLOD for LOD request // push LODRequest to mLODReqQ // ... @@ -246,7 +248,6 @@ // sActiveLODRequests mMutex rw.any.mMutex, ro.repo.none [1] // sMaxConcurrentRequests mMutex wo.main.none, ro.repo.none, ro.main.mMutex // mMeshHeader mHeaderMutex rw.repo.mHeaderMutex, ro.main.mHeaderMutex, ro.main.none [0] -// mMeshHeaderSize mHeaderMutex rw.repo.mHeaderMutex // mSkinRequests mMutex rw.repo.mMutex, ro.repo.none [5] // mSkinInfoQ mMutex rw.repo.mMutex, rw.main.mMutex [5] (was: [0]) // mDecompositionRequests mMutex rw.repo.mMutex, ro.repo.none [5] @@ -857,6 +858,12 @@ LLMeshRepoThread::~LLMeshRepoThread() mHttpRequestSet.clear(); mHttpHeaders.reset(); + while (!mSkinInfoQ.empty()) + { + delete mSkinInfoQ.front(); + mSkinInfoQ.pop_front(); + } + while (!mDecompositionQ.empty()) { delete mDecompositionQ.front(); @@ -946,7 +953,8 @@ void LLMeshRepoThread::run() else { // too many fails - mUnavailableQ.push(req); + LLMutexLock lock(mMutex); + mUnavailableQ.push_back(req); LL_WARNS() << "Failed to load " << req.mMeshParams << " , skip" << LL_ENDL; } } @@ -1022,37 +1030,42 @@ void LLMeshRepoThread::run() if (!mSkinRequests.empty()) { - std::set<UUIDBasedRequest> incomplete; - while (!mSkinRequests.empty() && mHttpRequestSet.size() < sRequestHighWater) - { - mMutex->lock(); - std::set<UUIDBasedRequest>::iterator iter = mSkinRequests.begin(); - UUIDBasedRequest req = *iter; - mSkinRequests.erase(iter); - mMutex->unlock(); - if (req.isDelayed()) - { - incomplete.insert(req); - } - else if (!fetchMeshSkinInfo(req.mId)) - { - if (req.canRetry()) - { - req.updateTime(); - incomplete.insert(req); - } - else - { - LL_DEBUGS() << "mSkinRequests failed: " << req.mId << LL_ENDL; - } - } - } + std::list<UUIDBasedRequest> incomplete; + while (!mSkinRequests.empty() && mHttpRequestSet.size() < sRequestHighWater) + { - if (!incomplete.empty()) - { - LLMutexLock locker(mMutex); - mSkinRequests.insert(incomplete.begin(), incomplete.end()); - } + mMutex->lock(); + auto req = mSkinRequests.front(); + mSkinRequests.pop_front(); + mMutex->unlock(); + if (req.isDelayed()) + { + incomplete.emplace_back(req); + } + else if (!fetchMeshSkinInfo(req.mId, req.canRetry())) + { + if (req.canRetry()) + { + req.updateTime(); + incomplete.emplace_back(req); + } + else + { + LLMutexLock locker(mMutex); + mSkinUnavailableQ.push_back(req); + LL_DEBUGS() << "mSkinReqQ failed: " << req.mId << LL_ENDL; + } + } + } + + if (!incomplete.empty()) + { + LLMutexLock locker(mMutex); + for (const auto& req : incomplete) + { + mSkinRequests.push_back(req); + } + } } // holding lock, try next list @@ -1151,7 +1164,7 @@ void LLMeshRepoThread::run() // Mutex: LLMeshRepoThread::mMutex must be held on entry void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id) { - mSkinRequests.insert(UUIDBasedRequest(mesh_id)); + mSkinRequests.push_back(UUIDBasedRequest(mesh_id)); } // Mutex: LLMeshRepoThread::mMutex must be held on entry @@ -1177,10 +1190,13 @@ void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) { //could be called from any thread + const LLUUID& mesh_id = mesh_params.getSculptID(); LLMutexLock lock(mMutex); - mesh_header_map::iterator iter = mMeshHeader.find(mesh_params.getSculptID()); + LLMutexLock header_lock(mHeaderMutex); + mesh_header_map::iterator iter = mMeshHeader.find(mesh_id); if (iter != mMeshHeader.end()) { //if we have the header, request LOD byte range + LODRequest req(mesh_params, lod); { mLODReqQ.push(req); @@ -1190,8 +1206,7 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) else { HeaderRequest req(mesh_params); - - pending_lod_map::iterator pending = mPendingLOD.find(mesh_params); + pending_lod_map::iterator pending = mPendingLOD.find(mesh_id); if (pending != mPendingLOD.end()) { //append this lod request to existing header request @@ -1201,7 +1216,7 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) else { //if no header request is pending, fetch header mHeaderReqQ.push(req); - mPendingLOD[mesh_params].push_back(lod); + mPendingLOD[mesh_id].push_back(lod); } } } @@ -1304,7 +1319,7 @@ LLCore::HttpHandle LLMeshRepoThread::getByteRange(const std::string & url, } -bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) +bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) { if (!mHeaderMutex) @@ -1314,7 +1329,8 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) mHeaderMutex->lock(); - if (mMeshHeader.find(mesh_id) == mMeshHeader.end()) + auto header_it = mMeshHeader.find(mesh_id); + if (header_it == mMeshHeader.end()) { //we have no header info for this mesh, do nothing mHeaderMutex->unlock(); return false; @@ -1322,13 +1338,14 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) ++LLMeshRepository::sMeshRequestCount; bool ret = true; - U32 header_size = mMeshHeaderSize[mesh_id]; + U32 header_size = header_it->second.first; if (header_size > 0) { - S32 version = mMeshHeader[mesh_id]["version"].asInteger(); - S32 offset = header_size + mMeshHeader[mesh_id]["skin"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["skin"]["size"].asInteger(); + const LLSD& header = header_it->second.second; + S32 version = header["version"].asInteger(); + S32 offset = header_size + header["skin"]["offset"].asInteger(); + S32 size = header["skin"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -1384,12 +1401,27 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) << LL_ENDL; ret = false; } - else + else if(can_retry) { handler->mHttpHandle = handle; mHttpRequestSet.insert(handler); } + else + { + LLMutexLock locker(mMutex); + mSkinUnavailableQ.emplace_back(mesh_id); + } } + else + { + LLMutexLock locker(mMutex); + mSkinUnavailableQ.emplace_back(mesh_id); + } + } + else + { + LLMutexLock locker(mMutex); + mSkinUnavailableQ.emplace_back(mesh_id); } } else @@ -1410,21 +1442,23 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) mHeaderMutex->lock(); - if (mMeshHeader.find(mesh_id) == mMeshHeader.end()) + auto header_it = mMeshHeader.find(mesh_id); + if (header_it == mMeshHeader.end()) { //we have no header info for this mesh, do nothing mHeaderMutex->unlock(); return false; } ++LLMeshRepository::sMeshRequestCount; - U32 header_size = mMeshHeaderSize[mesh_id]; + U32 header_size = header_it->second.first; bool ret = true; if (header_size > 0) { - S32 version = mMeshHeader[mesh_id]["version"].asInteger(); - S32 offset = header_size + mMeshHeader[mesh_id]["physics_convex"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["physics_convex"]["size"].asInteger(); + const auto& header = header_it->second.second; + S32 version = header["version"].asInteger(); + S32 offset = header_size + header["physics_convex"]["offset"].asInteger(); + S32 size = header["physics_convex"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -1507,21 +1541,23 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) mHeaderMutex->lock(); - if (mMeshHeader.find(mesh_id) == mMeshHeader.end()) + auto header_it = mMeshHeader.find(mesh_id); + if (header_it == mMeshHeader.end()) { //we have no header info for this mesh, do nothing mHeaderMutex->unlock(); return false; } ++LLMeshRepository::sMeshRequestCount; - U32 header_size = mMeshHeaderSize[mesh_id]; + U32 header_size = header_it->second.first; bool ret = true; if (header_size > 0) { - S32 version = mMeshHeader[mesh_id]["version"].asInteger(); - S32 offset = header_size + mMeshHeader[mesh_id]["physics_mesh"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["physics_mesh"]["size"].asInteger(); + const auto& header = header_it->second.second; + S32 version = header["version"].asInteger(); + S32 offset = header_size + header["physics_mesh"]["offset"].asInteger(); + S32 size = header["physics_mesh"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -1701,20 +1737,25 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, return false; } - mHeaderMutex->lock(); + const LLUUID& mesh_id = mesh_params.getSculptID(); + mHeaderMutex->lock(); + auto header_it = mMeshHeader.find(mesh_id); + if (header_it == mMeshHeader.end()) + { //we have no header info for this mesh, do nothing + mHeaderMutex->unlock(); + return false; + } ++LLMeshRepository::sMeshRequestCount; bool retval = true; - - LLUUID mesh_id = mesh_params.getSculptID(); - U32 header_size = mMeshHeaderSize[mesh_id]; - + U32 header_size = header_it->second.first; if (header_size > 0) { - S32 version = mMeshHeader[mesh_id]["version"].asInteger(); - S32 offset = header_size + mMeshHeader[mesh_id][header_lod[lod]]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id][header_lod[lod]]["size"].asInteger(); + const auto& header = header_it->second.second; + S32 version = header["version"].asInteger(); + S32 offset = header_size + header[header_lod[lod]]["offset"].asInteger(); + S32 size = header[header_lod[lod]]["size"].asInteger(); mHeaderMutex->unlock(); if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0) @@ -1789,17 +1830,20 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, } else { - mUnavailableQ.push(LODRequest(mesh_params, lod)); + LLMutexLock lock(mMutex); + mUnavailableQ.push_back(LODRequest(mesh_params, lod)); } } else { - mUnavailableQ.push(LODRequest(mesh_params, lod)); + LLMutexLock lock(mMutex); + mUnavailableQ.push_back(LODRequest(mesh_params, lod)); } } else { - mUnavailableQ.push(LODRequest(mesh_params, lod)); + LLMutexLock lock(mMutex); + mUnavailableQ.push_back(LODRequest(mesh_params, lod)); } } else @@ -1818,27 +1862,12 @@ EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mes U32 header_size = 0; if (data_size > 0) { - std::istringstream stream; - try - { - std::string res_str((char*)data, data_size); + U32 dsize = data_size; + char* result_ptr = strip_deprecated_header((char*)data, dsize, &header_size); - std::string deprecated_header("<? LLSD/Binary ?>"); + data_size = dsize; - if (res_str.substr(0, deprecated_header.size()) == deprecated_header) - { - res_str = res_str.substr(deprecated_header.size() + 1, data_size); - header_size = deprecated_header.size() + 1; - } - data_size = res_str.size(); - - stream.str(res_str); - } - catch (std::bad_alloc&) - { - // out of memory, we won't be able to process this mesh - return MESH_OUT_OF_MEMORY; - } + boost::iostreams::stream<boost::iostreams::array_source> stream(result_ptr, data_size); if (!LLSDSerialize::fromBinary(header, stream, data_size)) { @@ -1875,8 +1904,7 @@ EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mes { LLMutexLock lock(mHeaderMutex); - mMeshHeaderSize[mesh_id] = header_size; - mMeshHeader[mesh_id] = header; + mMeshHeader[mesh_id] = { header_size, header }; LLMeshRepository::sCacheBytesHeaders += header_size; } @@ -1884,7 +1912,7 @@ EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mes LLMutexLock lock(mMutex); // make sure only one thread access mPendingLOD at the same time. //check for pending requests - pending_lod_map::iterator iter = mPendingLOD.find(mesh_params); + pending_lod_map::iterator iter = mPendingLOD.find(mesh_id); if (iter != mPendingLOD.end()) { for (U32 i = 0; i < iter->second.size(); ++i) @@ -1908,26 +1936,14 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p } LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod)); - std::istringstream stream; - try - { - std::string mesh_string((char*)data, data_size); - stream.str(mesh_string); - } - catch (std::bad_alloc&) - { - // out of memory, we won't be able to process this mesh - return MESH_OUT_OF_MEMORY; - } - - if (volume->unpackVolumeFaces(stream, data_size)) + if (volume->unpackVolumeFaces(data, data_size)) { if (volume->getNumFaces() > 0) { LoadedMesh mesh(volume, mesh_params, lod); { LLMutexLock lock(mMutex); - mLoadedQ.push(mesh); + mLoadedQ.push_back(mesh); // LLPointer is not thread safe, since we added this pointer into // threaded list, make sure counter gets decreased inside mutex lock // and won't affect mLoadedQ processing @@ -1950,10 +1966,7 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat { try { - std::string res_str((char*)data, data_size); - std::istringstream stream(res_str); - - U32 uzip_result = LLUZipHelper::unzip_llsd(skin, stream, data_size); + U32 uzip_result = LLUZipHelper::unzip_llsd(skin, data, data_size); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS(LOG_MESH) << "Mesh skin info parse error. Not a valid mesh asset! ID: " << mesh_id @@ -1970,8 +1983,16 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat } { - LLMeshSkinInfo info(skin); - info.mMeshID = mesh_id; + LLMeshSkinInfo* info = nullptr; + try + { + info = new LLMeshSkinInfo(mesh_id, skin); + } + catch (const std::bad_alloc& ex) + { + LL_WARNS() << "Failed to allocate skin info with exception: " << ex.what() << LL_ENDL; + return false; + } // LL_DEBUGS(LOG_MESH) << "info pelvis offset" << info.mPelvisOffset << LL_ENDL; { @@ -1991,10 +2012,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3 { try { - std::string res_str((char*)data, data_size); - std::istringstream stream(res_str); - - U32 uzip_result = LLUZipHelper::unzip_llsd(decomp, stream, data_size); + U32 uzip_result = LLUZipHelper::unzip_llsd(decomp, data, data_size); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS(LOG_MESH) << "Mesh decomposition parse error. Not a valid mesh asset! ID: " << mesh_id @@ -2003,7 +2021,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3 return false; } } - catch (std::bad_alloc&) + catch (const std::bad_alloc&) { LL_WARNS(LOG_MESH) << "Out of memory for mesh ID " << mesh_id << " of size: " << data_size << LL_ENDL; return false; @@ -2040,20 +2058,7 @@ EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_ volume_params.setSculptID(mesh_id, LL_SCULPT_TYPE_MESH); LLPointer<LLVolume> volume = new LLVolume(volume_params,0); - std::istringstream stream; - try - { - std::string mesh_string((char*)data, data_size); - stream.str(mesh_string); - } - catch (std::bad_alloc&) - { - // out of memory, we won't be able to process this mesh - delete d; - return MESH_OUT_OF_MEMORY; - } - - if (volume->unpackVolumeFaces(stream, data_size)) + if (volume->unpackVolumeFaces(data, data_size)) { d->mPhysicsShapeMesh.clear(); @@ -2864,58 +2869,72 @@ void LLMeshRepoThread::notifyLoadedMeshes() return; } - while (!mLoadedQ.empty()) + if (!mLoadedQ.empty()) { + std::deque<LoadedMesh> loaded_queue; + mMutex->lock(); - if (mLoadedQ.empty()) + if (!mLoadedQ.empty()) { + loaded_queue.swap(mLoadedQ); mMutex->unlock(); - break; - } - LoadedMesh mesh = mLoadedQ.front(); // make sure nothing else owns volume pointer by this point - mLoadedQ.pop(); - mMutex->unlock(); - - update_metrics = true; - if (mesh.mVolume->getNumVolumeFaces() > 0) - { - gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume); - } - else - { - gMeshRepo.notifyMeshUnavailable(mesh.mMeshParams, - LLVolumeLODGroup::getVolumeDetailFromScale(mesh.mVolume->getDetail())); + + update_metrics = true; + + // Process the elements free of the lock + for (const auto& mesh : loaded_queue) + { + if (mesh.mVolume->getNumVolumeFaces() > 0) + { + gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume); + } + else + { + gMeshRepo.notifyMeshUnavailable(mesh.mMeshParams, + LLVolumeLODGroup::getVolumeDetailFromScale(mesh.mVolume->getDetail())); + } + } } } - while (!mUnavailableQ.empty()) + if (!mUnavailableQ.empty()) { + std::deque<LODRequest> unavil_queue; + mMutex->lock(); - if (mUnavailableQ.empty()) + if (!mUnavailableQ.empty()) { + unavil_queue.swap(mUnavailableQ); mMutex->unlock(); - break; - } - - LODRequest req = mUnavailableQ.front(); - mUnavailableQ.pop(); - mMutex->unlock(); - update_metrics = true; - gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD); + update_metrics = true; + + // Process the elements free of the lock + for (const auto& req : unavil_queue) + { + gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD); + } + } } - if (! mSkinInfoQ.empty() || ! mDecompositionQ.empty()) + if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || ! mDecompositionQ.empty()) { if (mMutex->trylock()) { - std::list<LLMeshSkinInfo> skin_info_q; + std::deque<LLMeshSkinInfo*> skin_info_q; + std::deque<UUIDBasedRequest> skin_info_unavail_q; std::list<LLModel::Decomposition*> decomp_q; if (! mSkinInfoQ.empty()) { skin_info_q.swap(mSkinInfoQ); } + + if (! mSkinUnavailableQ.empty()) + { + skin_info_unavail_q.swap(mSkinUnavailableQ); + } + if (! mDecompositionQ.empty()) { decomp_q.swap(mDecompositionQ); @@ -2929,6 +2948,11 @@ void LLMeshRepoThread::notifyLoadedMeshes() gMeshRepo.notifySkinInfoReceived(skin_info_q.front()); skin_info_q.pop_front(); } + while (! skin_info_unavail_q.empty()) + { + gMeshRepo.notifySkinInfoUnavailable(skin_info_unavail_q.front().mId); + skin_info_unavail_q.pop_front(); + } while (! decomp_q.empty()) { @@ -2953,7 +2977,7 @@ S32 LLMeshRepoThread::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lo if (iter != mMeshHeader.end()) { - LLSD& header = iter->second; + LLSD& header = iter->second.second; return LLMeshRepository::getActualMeshLOD(header, lod); } @@ -3156,7 +3180,7 @@ void LLMeshHeaderHandler::processFailure(LLCore::HttpStatus status) LLMutexLock lock(gMeshRepo.mThread->mMutex); for (int i(0); i < 4; ++i) { - gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, i)); + gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i)); } } @@ -3185,7 +3209,7 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b LLMutexLock lock(gMeshRepo.mThread->mMutex); for (int i(0); i < 4; ++i) { - gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, i)); + gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i)); } } else if (data && data_size > 0) @@ -3198,8 +3222,8 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b LLMeshRepoThread::mesh_header_map::iterator iter = gMeshRepo.mThread->mMeshHeader.find(mesh_id); if (iter != gMeshRepo.mThread->mMeshHeader.end()) { - header_bytes = (S32)gMeshRepo.mThread->mMeshHeaderSize[mesh_id]; - header = iter->second; + header_bytes = (S32)iter->second.first; + header = iter->second.second; } if (header_bytes > 0 @@ -3267,7 +3291,7 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b LLMutexLock lock(gMeshRepo.mThread->mMutex); for (int i(0); i < 4; ++i) { - gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, i)); + gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i)); } } } @@ -3294,7 +3318,7 @@ void LLMeshLODHandler::processFailure(LLCore::HttpStatus status) << LL_ENDL; LLMutexLock lock(gMeshRepo.mThread->mMutex); - gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, mLOD)); + gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD)); } void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */, @@ -3331,7 +3355,7 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body << " Not retrying." << LL_ENDL; LLMutexLock lock(gMeshRepo.mThread->mMutex); - gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, mLOD)); + gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD)); } } else @@ -3342,7 +3366,7 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body << " Data size: " << data_size << LL_ENDL; LLMutexLock lock(gMeshRepo.mThread->mMutex); - gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, mLOD)); + gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD)); } } @@ -3360,9 +3384,8 @@ void LLMeshSkinInfoHandler::processFailure(LLCore::HttpStatus status) << ", Reason: " << status.toString() << " (" << status.toTerseString() << "). Not retrying." << LL_ENDL; - - // *TODO: Mark mesh unavailable on error. For now, simply leave - // request unfulfilled rather than retry forever. + LLMutexLock lock(gMeshRepo.mThread->mMutex); + gMeshRepo.mThread->mSkinUnavailableQ.emplace_back(mMeshID); } void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */, @@ -3393,7 +3416,8 @@ void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* LL_WARNS(LOG_MESH) << "Error during mesh skin info processing. ID: " << mMeshID << ", Unknown reason. Not retrying." << LL_ENDL; - // *TODO: Mark mesh unavailable on error + LLMutexLock lock(gMeshRepo.mThread->mMutex); + gMeshRepo.mThread->mSkinUnavailableQ.emplace_back(mMeshID); } } @@ -3502,7 +3526,7 @@ LLMeshRepository::LLMeshRepository() mMeshThreadCount(0), mThread(NULL) { - + mSkinInfoCullTimer.resetWithExpiry(10.f); } void LLMeshRepository::init() @@ -3603,6 +3627,22 @@ S32 LLMeshRepository::update() return size ; } +void LLMeshRepository::unregisterMesh(LLVOVolume* vobj) +{ + for (auto& lod : mLoadingMeshes) + { + for (auto& param : lod) + { + vector_replace_with_last(param.second, vobj); + } + } + + for (auto& skin_pair : mLoadingSkins) + { + vector_replace_with_last(skin_pair.second, vobj); + } +} + S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail, S32 last_lod) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); @@ -3618,15 +3658,19 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para { LLMutexLock lock(mMeshMutex); //add volume to list of loading meshes - mesh_load_map::iterator iter = mLoadingMeshes[detail].find(mesh_params); + const auto& mesh_id = mesh_params.getSculptID(); + mesh_load_map::iterator iter = mLoadingMeshes[detail].find(mesh_id); if (iter != mLoadingMeshes[detail].end()) { //request pending for this mesh, append volume id to list - iter->second.insert(vobj->getID()); + auto it = std::find(iter->second.begin(), iter->second.end(), vobj); + if (it == iter->second.end()) { + iter->second.push_back(vobj); + } } else { //first request for this mesh - mLoadingMeshes[detail][mesh_params].insert(vobj->getID()); + mLoadingMeshes[detail][mesh_id].push_back(vobj); mPendingRequests.push_back(LLMeshRepoThread::LODRequest(mesh_params, detail)); LLMeshRepository::sLODPending++; } @@ -3783,6 +3827,28 @@ void LLMeshRepository::notifyLoadedMeshes() //call completed callbacks on finished decompositions mDecompThread->notifyCompleted(); + if (mSkinInfoCullTimer.checkExpirationAndReset(10.f)) + { + //// Clean up dead skin info + //U64Bytes skinbytes(0); + for (auto iter = mSkinMap.begin(), ender = mSkinMap.end(); iter != ender;) + { + auto copy_iter = iter++; + + //skinbytes += U64Bytes(sizeof(LLMeshSkinInfo)); + //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(std::string)); + //skinbytes += U64Bytes(copy_iter->second->mJointNums.size() * sizeof(S32)); + //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(LLMatrix4a)); + //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(LLMatrix4)); + + if (copy_iter->second->getNumRefs() == 1) + { + mSkinMap.erase(copy_iter); + } + } + //LL_INFOS() << "Skin info cache elements:" << mSkinMap.size() << " Memory: " << U64Kilobytes(skinbytes) << LL_ENDL; + } + // For major operations, attempt to get the required locks // without blocking and punt if they're not available. The // longest run of holdoffs is kept in sMaxLockHoldoffs just @@ -3853,10 +3919,9 @@ void LLMeshRepository::notifyLoadedMeshes() for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin(); iter != mLoadingMeshes[i].end(); ++iter) { F32 max_score = 0.f; - for (std::set<LLUUID>::iterator obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter) + for (auto obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter) { - LLViewerObject* object = gObjectList.findObject(*obj_iter); - + LLVOVolume* object = *obj_iter; if (object) { LLDrawable* drawable = object->mDrawable; @@ -3868,7 +3933,7 @@ void LLMeshRepository::notifyLoadedMeshes() } } - score_map[iter->first.getSculptID()] = max_score; + score_map[iter->first] = max_score; } } @@ -3920,24 +3985,39 @@ void LLMeshRepository::notifyLoadedMeshes() mThread->mSignal->signal(); } -void LLMeshRepository::notifySkinInfoReceived(LLMeshSkinInfo& info) +void LLMeshRepository::notifySkinInfoReceived(LLMeshSkinInfo* info) { - mSkinMap[info.mMeshID] = info; + mSkinMap[info->mMeshID] = info; // Cache into LLPointer // Alternative: We can get skin size from header - sCacheBytesSkins += info.sizeBytes(); + sCacheBytesSkins += info->sizeBytes(); - skin_load_map::iterator iter = mLoadingSkins.find(info.mMeshID); + skin_load_map::iterator iter = mLoadingSkins.find(info->mMeshID); if (iter != mLoadingSkins.end()) { - for (std::set<LLUUID>::iterator obj_id = iter->second.begin(); obj_id != iter->second.end(); ++obj_id) + for (LLVOVolume* vobj : iter->second) { - LLVOVolume* vobj = (LLVOVolume*) gObjectList.findObject(*obj_id); if (vobj) { - vobj->notifyMeshLoaded(); + vobj->notifySkinInfoLoaded(info); } } - mLoadingSkins.erase(info.mMeshID); + mLoadingSkins.erase(iter); + } +} + +void LLMeshRepository::notifySkinInfoUnavailable(const LLUUID& mesh_id) +{ + skin_load_map::iterator iter = mLoadingSkins.find(mesh_id); + if (iter != mLoadingSkins.end()) + { + for (LLVOVolume* vobj : iter->second) + { + if (vobj) + { + vobj->notifySkinInfoUnavailable(); + } + } + mLoadingSkins.erase(iter); } } @@ -3966,14 +4046,15 @@ void LLMeshRepository::notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVol S32 detail = LLVolumeLODGroup::getVolumeDetailFromScale(volume->getDetail()); //get list of objects waiting to be notified this mesh is loaded - mesh_load_map::iterator obj_iter = mLoadingMeshes[detail].find(mesh_params); + const auto& mesh_id = mesh_params.getSculptID(); + mesh_load_map::iterator obj_iter = mLoadingMeshes[detail].find(mesh_id); if (volume && obj_iter != mLoadingMeshes[detail].end()) { //make sure target volume is still valid if (volume->getNumVolumeFaces() <= 0) { - LL_WARNS(LOG_MESH) << "Mesh loading returned empty volume. ID: " << mesh_params.getSculptID() + LL_WARNS(LOG_MESH) << "Mesh loading returned empty volume. ID: " << mesh_id << LL_ENDL; } @@ -3987,37 +4068,35 @@ void LLMeshRepository::notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVol } else { - LL_WARNS(LOG_MESH) << "Couldn't find system volume for mesh " << mesh_params.getSculptID() + LL_WARNS(LOG_MESH) << "Couldn't find system volume for mesh " << mesh_id << LL_ENDL; } } //notify waiting LLVOVolume instances that their requested mesh is available - for (std::set<LLUUID>::iterator vobj_iter = obj_iter->second.begin(); vobj_iter != obj_iter->second.end(); ++vobj_iter) + for (LLVOVolume* vobj : obj_iter->second) { - LLVOVolume* vobj = (LLVOVolume*) gObjectList.findObject(*vobj_iter); if (vobj) { vobj->notifyMeshLoaded(); } } - mLoadingMeshes[detail].erase(mesh_params); + mLoadingMeshes[detail].erase(obj_iter); } } void LLMeshRepository::notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 lod) { //called from main thread //get list of objects waiting to be notified this mesh is loaded - mesh_load_map::iterator obj_iter = mLoadingMeshes[lod].find(mesh_params); - - F32 detail = LLVolumeLODGroup::getVolumeScaleFromDetail(lod); - + const auto& mesh_id = mesh_params.getSculptID(); + mesh_load_map::iterator obj_iter = mLoadingMeshes[lod].find(mesh_id); if (obj_iter != mLoadingMeshes[lod].end()) { - for (std::set<LLUUID>::iterator vobj_iter = obj_iter->second.begin(); vobj_iter != obj_iter->second.end(); ++vobj_iter) + F32 detail = LLVolumeLODGroup::getVolumeScaleFromDetail(lod); + + for (LLVOVolume* vobj : obj_iter->second) { - LLVOVolume* vobj = (LLVOVolume*) gObjectList.findObject(*vobj_iter); if (vobj) { LLVolume* obj_volume = vobj->getVolume(); @@ -4031,7 +4110,7 @@ void LLMeshRepository::notifyMeshUnavailable(const LLVolumeParams& mesh_params, } } - mLoadingMeshes[lod].erase(mesh_params); + mLoadingMeshes[lod].erase(obj_iter); } } @@ -4040,7 +4119,7 @@ S32 LLMeshRepository::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lo return mThread->getActualMeshLOD(mesh_params, lod); } -const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const LLVOVolume* requesting_obj) +const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; if (mesh_id.notNull()) @@ -4048,7 +4127,7 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const skin_map::iterator iter = mSkinMap.find(mesh_id); if (iter != mSkinMap.end()) { - return &(iter->second); + return iter->second; } //no skin info known about given mesh, try to fetch it @@ -4057,14 +4136,22 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const LLMutexLock lock(mMeshMutex); //add volume to list of loading meshes skin_load_map::iterator iter = mLoadingSkins.find(mesh_id); - if (iter == mLoadingSkins.end()) - { //no request pending for this skin info + if (iter != mLoadingSkins.end()) + { //request pending for this mesh, append volume id to list + auto it = std::find(iter->second.begin(), iter->second.end(), requesting_obj); + if (it == iter->second.end()) { + iter->second.push_back(requesting_obj); + } + } + else + { + //first request for this mesh + mLoadingSkins[mesh_id].push_back(requesting_obj); mPendingSkinRequests.push(mesh_id); } - mLoadingSkins[mesh_id].insert(requesting_obj->getID()); } } - return NULL; + return nullptr; } void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id) @@ -4167,16 +4254,13 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) bool LLMeshRepoThread::hasPhysicsShapeInHeader(const LLUUID& mesh_id) { LLMutexLock lock(mHeaderMutex); - if (mMeshHeaderSize[mesh_id] > 0) + mesh_header_map::iterator iter = mMeshHeader.find(mesh_id); + if (iter != mMeshHeader.end() && iter->second.first > 0) { - mesh_header_map::iterator iter = mMeshHeader.find(mesh_id); - if (iter != mMeshHeader.end()) + LLSD &mesh = iter->second.second; + if (mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0)) { - LLSD &mesh = iter->second; - if (mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0)) - { - return true; - } + return true; } } @@ -4201,9 +4285,9 @@ S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod) { LLMutexLock lock(mThread->mHeaderMutex); LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id); - if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0) + if (iter != mThread->mMeshHeader.end() && iter->second.first > 0) { - LLSD& header = iter->second; + const LLSD& header = iter->second.second; if (header.has("404")) { @@ -4307,9 +4391,9 @@ F32 LLMeshRepository::getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* by { LLMutexLock lock(mThread->mHeaderMutex); LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id); - if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0) + if (iter != mThread->mMeshHeader.end() && iter->second.first > 0) { - result = getStreamingCostLegacy(iter->second, radius, bytes, bytes_visible, lod, unscaled_value); + result = getStreamingCostLegacy(iter->second.second, radius, bytes, bytes_visible, lod, unscaled_value); } } if (result > 0.f) @@ -4622,9 +4706,9 @@ bool LLMeshRepository::getCostData(LLUUID mesh_id, LLMeshCostData& data) { LLMutexLock lock(mThread->mHeaderMutex); LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id); - if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0) + if (iter != mThread->mMeshHeader.end() && iter->second.first > 0) { - LLSD& header = iter->second; + LLSD& header = iter->second.second; bool header_invalid = (header.has("404") || !header.has("lowest_lod") diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 6fe4ea5514..6922367ff7 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -210,10 +210,8 @@ public: LLCondition* mSignal; //map of known mesh headers - typedef std::map<LLUUID, LLSD> mesh_header_map; + typedef boost::unordered_map<LLUUID, std::pair<U32, LLSD>> mesh_header_map; // pair is header_size and data mesh_header_map mMeshHeader; - - std::map<LLUUID, U32> mMeshHeaderSize; class HeaderRequest : public RequestStats { @@ -283,10 +281,13 @@ public: }; //set of requested skin info - std::set<UUIDBasedRequest> mSkinRequests; + std::deque<UUIDBasedRequest> mSkinRequests; // list of completed skin info requests - std::list<LLMeshSkinInfo> mSkinInfoQ; + std::deque<LLMeshSkinInfo*> mSkinInfoQ; + + // list of skin info requests that have failed or are unavailaibe + std::deque<UUIDBasedRequest> mSkinUnavailableQ; //set of requested decompositions std::set<UUIDBasedRequest> mDecompositionRequests; @@ -304,13 +305,13 @@ public: std::queue<LODRequest> mLODReqQ; //queue of unavailable LODs (either asset doesn't exist or asset doesn't have desired LOD) - std::queue<LODRequest> mUnavailableQ; + std::deque<LODRequest> mUnavailableQ; //queue of successfully loaded meshes - std::queue<LoadedMesh> mLoadedQ; + std::deque<LoadedMesh> mLoadedQ; //map of pending header requests and currently desired LODs - typedef std::map<LLVolumeParams, std::vector<S32> > pending_lod_map; + typedef boost::unordered_map<LLUUID, std::vector<S32> > pending_lod_map; pending_lod_map mPendingLOD; // llcorehttp library interface objects. @@ -353,7 +354,7 @@ public: //send request for skin info, returns true if header info exists // (should hold onto mesh_id and try again later if header info does not exist) - bool fetchMeshSkinInfo(const LLUUID& mesh_id); + bool fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry = true); //send request for decomposition, returns true if header info exists // (should hold onto mesh_id and try again later if header info does not exist) @@ -575,18 +576,20 @@ public: void shutdown(); S32 update(); + void unregisterMesh(LLVOVolume* volume); //mesh management functions S32 loadMesh(LLVOVolume* volume, const LLVolumeParams& mesh_params, S32 detail = 0, S32 last_lod = -1); void notifyLoadedMeshes(); void notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume); void notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 lod); - void notifySkinInfoReceived(LLMeshSkinInfo& info); + void notifySkinInfoReceived(LLMeshSkinInfo* info); + void notifySkinInfoUnavailable(const LLUUID& info); void notifyDecompositionReceived(LLModel::Decomposition* info); S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod); static S32 getActualMeshLOD(LLSD& header, S32 lod); - const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, const LLVOVolume* requesting_obj = nullptr); + const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj = nullptr); LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id); void fetchPhysicsShape(const LLUUID& mesh_id); bool hasPhysicsShape(const LLUUID& mesh_id); @@ -611,10 +614,10 @@ public: static void metricsProgress(unsigned int count); static void metricsUpdate(); - typedef std::map<LLVolumeParams, std::set<LLUUID> > mesh_load_map; + typedef boost::unordered_map<LLUUID, std::vector<LLVOVolume*> > mesh_load_map; mesh_load_map mLoadingMeshes[4]; - typedef std::unordered_map<LLUUID, LLMeshSkinInfo> skin_map; + typedef std::unordered_map<LLUUID, LLPointer<LLMeshSkinInfo>> skin_map; skin_map mSkinMap; typedef std::map<LLUUID, LLModel::Decomposition*> decomposition_map; @@ -625,7 +628,7 @@ public: std::vector<LLMeshRepoThread::LODRequest> mPendingRequests; //list of mesh ids awaiting skin info - typedef std::map<LLUUID, std::set<LLUUID> > skin_load_map; + typedef boost::unordered_map<LLUUID, std::vector<LLVOVolume*> > skin_load_map; skin_load_map mLoadingSkins; //list of mesh ids that need to send skin info fetch requests @@ -650,6 +653,8 @@ public: std::vector<LLMeshUploadThread*> mUploadWaitList; LLPhysicsDecomp* mDecompThread; + + LLFrameTimer mSkinInfoCullTimer; class inventory_data { diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 66d14df1f4..56a48cb74d 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1956,32 +1956,16 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d if (sloppy_ratio < 0) { // Sloppy method didn't work, try with smaller decimation values - S32 size_vertices = 0; - - for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) - { - const LLVolumeFace &face = base->getVolumeFace(face_idx); - size_vertices += face.mNumVertices; - } - - // Complex models aren't supposed to get here, they are supposed - // to work on a first try of sloppy due to having more viggle room. - // If they didn't, something is likely wrong, no point locking the - // thread in a long calculation that will fail. - const U32 too_many_vertices = 27000; - if (size_vertices > too_many_vertices) - { - LL_WARNS() << "Sloppy optimization method failed for a complex model " << target_model->getName() << LL_ENDL; - } - else { // Find a decimator that does work F32 sloppy_decimation_step = sqrt((F32)decimation); // example: 27->15->9->5->3 F32 sloppy_decimator = indices_decimator / sloppy_decimation_step; + U64Microseconds end_time = LLTimer::getTotalTime() + U64Seconds(5); while (sloppy_ratio < 0 && sloppy_decimator > precise_ratio - && sloppy_decimator > 1)// precise_ratio isn't supposed to be below 1, but check just in case + && sloppy_decimator > 1 // precise_ratio isn't supposed to be below 1, but check just in case + && end_time > LLTimer::getTotalTime()) { sloppy_ratio = genMeshOptimizerPerModel(base, target_model, sloppy_decimator, lod_error_threshold, MESH_OPTIMIZER_NO_TOPOLOGY); sloppy_decimator = sloppy_decimator / sloppy_decimation_step; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index b34be80b07..0ba3c3d691 100755..100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -102,8 +102,7 @@ LLNetMap::LLNetMap (const Params & p) mObjectImagep(), mClosestAgentToCursor(), mClosestAgentAtLastRightClick(), - mToolTipMsg(), - mPopupMenu(NULL) + mToolTipMsg() { mScale = gSavedSettings.getF32("MiniMapScale"); if (gAgent.isFirstLogin()) @@ -119,6 +118,12 @@ LLNetMap::LLNetMap (const Params & p) LLNetMap::~LLNetMap() { + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } } BOOL LLNetMap::postBuild() @@ -134,11 +139,10 @@ BOOL LLNetMap::postBuild() commitRegistrar.add("Minimap.MapOrientation.Set", boost::bind(&LLNetMap::setMapOrientation, this, _2)); commitRegistrar.add("Minimap.AboutLand", boost::bind(&LLNetMap::popupShowAboutLand, this, _2)); - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, - LLViewerMenuHolderGL::child_registry_t::instance()); - mPopupMenu->setItemEnabled("Re-center map", false); - - return true; + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + mPopupMenuHandle = menu->getHandle(); + menu->setItemEnabled("Re-center map", false); + return TRUE; } void LLNetMap::setScale( F32 scale ) @@ -206,8 +210,12 @@ void LLNetMap::draw() mCentering = false; } - bool can_recenter_map = !(centered || mCentering || auto_centering); - mPopupMenu->setItemEnabled("Re-center map", can_recenter_map); + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) + { + bool can_recenter_map = !(centered || mCentering || auto_centering); + menu->setItemEnabled("Re-center map", can_recenter_map); + } updateAboutLandPopupButton(); // Prepare a scissor region @@ -595,14 +603,15 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, bool LLNetMap::isMouseOnPopupMenu() { - if (!mPopupMenu->isOpen()) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (!menu || !menu->isOpen()) { return false; } S32 popup_x; S32 popup_y; - LLUI::getInstance()->getMousePositionLocal(mPopupMenu, &popup_x, &popup_y); + LLUI::getInstance()->getMousePositionLocal(menu, &popup_x, &popup_y); // *NOTE: Tolerance is larger than it needs to be because the context menu is offset from the mouse when the menu is opened from certain // directions. This may be a quirk of LLMenuGL::showPopup. -Cosmic,2022-03-22 constexpr S32 tolerance = 10; @@ -613,7 +622,7 @@ bool LLNetMap::isMouseOnPopupMenu() { for (S32 sign_y = -1; sign_y <= 1; sign_y += 2) { - if (mPopupMenu->pointInView(popup_x + (sign_x * tolerance), popup_y + (sign_y * tolerance))) + if (menu->pointInView(popup_x + (sign_x * tolerance), popup_y + (sign_y * tolerance))) { return true; } @@ -624,7 +633,8 @@ bool LLNetMap::isMouseOnPopupMenu() void LLNetMap::updateAboutLandPopupButton() { - if (!mPopupMenu->isOpen()) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (!menu || !menu->isOpen()) { return; } @@ -632,7 +642,7 @@ void LLNetMap::updateAboutLandPopupButton() LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal(mPopupWorldPos); if (!region) { - mPopupMenu->setItemEnabled("About Land", false); + menu->setItemEnabled("About Land", false); } else { @@ -647,7 +657,7 @@ void LLNetMap::updateAboutLandPopupButton() { valid_parcel = hover_parcel->getOwnerID().notNull(); } - mPopupMenu->setItemEnabled("About Land", valid_parcel); + menu->setItemEnabled("About Land", valid_parcel); } } } @@ -1043,13 +1053,14 @@ BOOL LLNetMap::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if (mPopupMenu) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) { - mPopupWorldPos = viewPosToGlobal(x, y); - mPopupMenu->buildDrawLabels(); - mPopupMenu->updateParent(LLMenuGL::sMenuContainer); - mPopupMenu->setItemEnabled("Stop tracking", LLTracker::isTracking(0)); - LLMenuGL::showPopup(this, mPopupMenu, x, y); + mPopupWorldPos = viewPosToGlobal(x, y); + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + menu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0)); + LLMenuGL::showPopup(this, menu, x, y); } return TRUE; } @@ -1182,9 +1193,10 @@ void LLNetMap::setZoom(const LLSD &userdata) void LLNetMap::handleStopTracking (const LLSD& userdata) { - if (mPopupMenu) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) { - mPopupMenu->setItemEnabled ("Stop tracking", false); + menu->setItemEnabled ("Stop Tracking", false); LLTracker::stopTracking (LLTracker::isTracking(NULL)); } } diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index fe1aca65a9..75c1abc4ed 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -162,7 +162,7 @@ private: void setMapOrientation(const LLSD& userdata); void popupShowAboutLand(const LLSD& userdata); - LLMenuGL* mPopupMenu; + LLHandle<LLView> mPopupMenuHandle; uuid_vec_t gmSelected; }; diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 6a79a0c68c..f86edfd0cf 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -521,8 +521,6 @@ void LLGroupNoticeNotificationListItem::close() void LLGroupNoticeNotificationListItem::onClickAttachment() { if (mInventoryOffer != NULL) { - mInventoryOffer->forceResponse(IOR_ACCEPT); - static const LLUIColor textColor = LLUIColorTable::instance().getColor( "GroupNotifyDimmedTextColor"); mAttachmentTextBox->setColor(textColor); @@ -532,7 +530,7 @@ void LLGroupNoticeNotificationListItem::onClickAttachment() if (!isAttachmentOpenable(mInventoryOffer->mType)) { LLNotifications::instance().add("AttachmentSaved", LLSD(), LLSD()); } - + mInventoryOffer->forceResponse(IOR_ACCEPT); mInventoryOffer = NULL; } } diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 5aaa80a7ef..92a742466e 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1226,7 +1226,7 @@ void LLOutfitGallery::uploadOutfitImage(const std::vector<std::string>& filename checkRemovePhoto(outfit_id); std::string upload_pending_name = outfit_id.asString(); std::string upload_pending_desc = ""; - LLUUID photo_id = upload_new_resource(filename, // file + upload_new_resource(filename, // file upload_pending_name, upload_pending_desc, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 7270580032..4171fd8822 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -823,8 +823,7 @@ void LLOutfitListBase::onOpen(const LLSD& info) mCategoriesObserver->addCategory(outfits, boost::bind(&LLOutfitListBase::refreshList, this, outfits)); - const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - + //const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); // Start observing changes in Current Outfit category. //mCategoriesObserver->addCategory(cof, boost::bind(&LLOutfitsList::onCOFChanged, this)); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 69998e8be4..5c209bc4c6 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1662,7 +1662,7 @@ void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLAvatarAppearanceDefine class LLMetricSystemHandler : public LLCommandHandler { public: - LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_THROTTLE) { } + LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_CLICK_ONLY) { } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp index 44b4728df7..e5c637938f 100644 --- a/indra/newview/llpanelexperiencelog.cpp +++ b/indra/newview/llpanelexperiencelog.cpp @@ -112,7 +112,7 @@ void LLPanelExperienceLog::refresh() int items = 0; bool moreItems = false; LLSD events_to_save = events; - if (!events.emptyMap()) + if (events.isMap() && events.size() != 0) { LLSD::map_const_iterator day = events.endMap(); do diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb09ec9fbf..ce086f2520 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1829,6 +1829,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + const bool new_state = show_texture_info && has_pbr_capabilities && has_pbr_material; LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); @@ -1836,13 +1837,15 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV"); - gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureScaleU->setEnabled(new_state); + gltfCtrlTextureScaleV->setEnabled(new_state); + gltfCtrlTextureRotation->setEnabled(new_state); + gltfCtrlTextureOffsetU->setEnabled(new_state); + gltfCtrlTextureOffsetV->setEnabled(new_state); - // Control values are set in setMaterialOverridesFromSelection + // Control values will be set once per frame in + // setMaterialOverridesFromSelection + sMaterialOverrideSelection.setDirty(); } } @@ -2821,7 +2824,6 @@ void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) // and generally reflecting old state when switching tabs or objects // self->updateUI(); - self->setMaterialOverridesFromSelection(); } // static @@ -4768,17 +4770,7 @@ void LLPanelFace::Selection::connect() bool LLPanelFace::Selection::update() { - const bool selection_changed = compareSelection(); - if (selection_changed) - { - clearObjectUpdatePending(); - } - else if (isObjectUpdatePending()) - { - return false; - } - - const bool changed = mChanged; + const bool changed = mChanged || compareSelection(); mChanged = false; return changed; } @@ -4794,16 +4786,9 @@ void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S3 if (object_id == mSelectedObjectID && side == mSelectedSide) { mChanged = true; - clearObjectUpdatePending(); } } -void LLPanelFace::Selection::clearObjectUpdatePending() -{ - mPendingObjectID = LLUUID::null; - mPendingSide = -1; -} - bool LLPanelFace::Selection::compareSelection() { if (!mNeedsSelectionCheck) diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 707d693672..106259b84a 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -484,15 +484,13 @@ private: // updated. Necessary to prevent controls updating when the mouse is // held down. void setObjectUpdatePending(const LLUUID &object_id, S32 side); + void setDirty() { mChanged = true; }; // Callbacks void onSelectionChanged() { mNeedsSelectionCheck = true; } void onSelectedObjectUpdated(const LLUUID &object_id, S32 side); protected: - void clearObjectUpdatePending(); - bool isObjectUpdatePending() { return mPendingSide != -1; } - bool compareSelection(); bool mChanged = false; diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 213a66f005..ca252d1455 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -178,7 +178,6 @@ void LLPanelLandMedia::refresh() // enable/disable for text label for completeness mMediaSizeCtrlLabel->setEnabled( can_change_media && allow_resize ); - LLUUID tmp = parcel->getMediaID(); mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() ); mMediaTextureCtrl->setEnabled( can_change_media ); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 8b78ee843f..f38357c5da 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -308,6 +308,13 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) gInventory.removeObserver(this); delete mSavedFolderState; + + auto menu = mMenuAddHandle.get(); + if(menu) + { + menu->die(); + mMenuAddHandle.markDead(); + } } LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel() @@ -1187,13 +1194,12 @@ void LLPanelMainInventory::initListCommandsHandlers() mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2)); mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2)); mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mGearMenuButton->setMenu(mMenuGearDefault); + mGearMenuButton->setMenu(mMenuGearDefault, LLMenuButton::MP_TOP_LEFT, true); LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mMenuAddHandle = menu->getHandle(); mMenuVisibility = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_search_visibility.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mVisibilityMenuButton->setMenu(mMenuVisibility); - mVisibilityMenuButton->setMenuPosition(LLMenuButton::MP_BOTTOM_LEFT); + mVisibilityMenuButton->setMenu(mMenuVisibility, LLMenuButton::MP_BOTTOM_LEFT, true); // Update the trash button when selected item(s) get worn or taken off. LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLPanelMainInventory::updateListCommands, this)); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 0ec26e9efc..0704fc881d 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2129,7 +2129,7 @@ bool LLPanelObject::menuEnableItem(const LLSD& userdata) } else if (command == "params_paste") { - return mClipboardParams.isMap() && !mClipboardParams.emptyMap(); + return mClipboardParams.isMap() && (mClipboardParams.size() != 0); } // copy options else if (command == "psr_copy") diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 38f7883b82..2db8620d2d 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1334,7 +1334,8 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par mHaveInventory(FALSE), mIsInventoryEmpty(TRUE), mInventoryNeedsUpdate(FALSE), - mInventoryViewModel(p.name) + mInventoryViewModel(p.name), + mShowRootFolder(p.show_root_folder) { // Setup context menu callbacks mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelObjectInventory::doToSelected, this, _2)); @@ -1419,6 +1420,7 @@ void LLPanelObjectInventory::reset() mFolders = LLUICtrlFactory::create<LLFolderView>(p); mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); + mFolders->setEnableRegistrar(&mEnableCallbackRegistrar); if (hasFocus()) { @@ -1585,15 +1587,23 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root p.font_highlight_color = item_color; LLFolderViewFolder* new_folder = LLUICtrlFactory::create<LLFolderViewFolder>(p); - new_folder->addToFolder(mFolders); - new_folder->toggleOpen(); + + if (mShowRootFolder) + { + new_folder->addToFolder(mFolders); + new_folder->toggleOpen(); + } if (!contents.empty()) { - createViewsForCategory(&contents, inventory_root, new_folder); + createViewsForCategory(&contents, inventory_root, mShowRootFolder ? new_folder : mFolders); } - // Refresh for label to add item count - new_folder->refresh(); + + if (mShowRootFolder) + { + // Refresh for label to add item count + new_folder->refresh(); + } } } diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index 7b9ecfb8f3..0e450d8ce9 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -48,8 +48,14 @@ class LLViewerObject; class LLPanelObjectInventory : public LLPanel, public LLVOInventoryListener { public: - // dummy param block for template registration purposes - struct Params : public LLPanel::Params {}; + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + { + Optional<bool> show_root_folder; + + Params() + : show_root_folder("show_root_folder", true) + {} + }; LLPanelObjectInventory(const Params&); virtual ~LLPanelObjectInventory(); @@ -110,6 +116,7 @@ private: BOOL mIsInventoryEmpty; // 'Empty' label BOOL mInventoryNeedsUpdate; // for idle, set on changed callback LLFolderViewModelInventory mInventoryViewModel; + bool mShowRootFolder; }; #endif // LL_LLPANELOBJECTINVENTORY_H diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 74ec576554..0f00231643 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -800,7 +800,6 @@ void LLPanelPlaces::onSaveButtonClicked() LLStringUtil::trim(current_title_value); LLStringUtil::trim(current_notes_value); - LLUUID item_id = mItem->getUUID(); LLUUID folder_id = mLandmarkInfo->getLandmarkFolder(); bool change_parent = folder_id != mItem->getParentUUID(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index d9a8d496d1..816633b545 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -484,6 +484,30 @@ public: // requires trusted browser to trigger LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { } + virtual bool canHandleUntrusted( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web, + const std::string& nav_type) + { + if (params.size() < 2) + { + return true; // don't block, will fail later + } + + if (nav_type == NAV_TYPE_CLICKED) + { + return true; + } + + const std::string verb = params[1].asString(); + if (verb == "about" || verb == "inspect" || verb == "reportAbuse") + { + return true; + } + return false; + } + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { @@ -1031,7 +1055,6 @@ void LLPanelProfileSecondLife::resetData() void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avatar_data) { - LLUUID avatar_id = getAvatarId(); const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); if ((relationship != NULL || gAgent.isGodlike()) && !getSelfProfile()) { @@ -1280,6 +1303,8 @@ void LLPanelProfileSecondLife::fillRightsData() void LLPanelProfileSecondLife::fillAgeData(const LLDate &born_on) { + // Date from server comes already converted to stl timezone, + // so display it as an UTC + 0 std::string name_and_date = getString("date_format"); LLSD args_name; args_name["datetime"] = (S32)born_on.secondsSinceEpoch(); diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index a3913ddc49..1ff12b4f37 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -81,6 +81,30 @@ public: std::set<LLUUID> mClassifiedIds; std::string mRequestVerb; + + virtual bool canHandleUntrusted( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web, + const std::string& nav_type) + { + if (params.size() < 1) + { + return true; // don't block, will fail later + } + + if (nav_type == NAV_TYPE_CLICKED) + { + return true; + } + + const std::string verb = params[0].asString(); + if (verb == "create") + { + return false; + } + return true; + } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index 774119f169..45d0252e4f 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -63,6 +63,30 @@ public: // requires trusted browser to trigger LLPickHandler() : LLCommandHandler("pick", UNTRUSTED_THROTTLE) { } + virtual bool canHandleUntrusted( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web, + const std::string& nav_type) + { + if (params.size() < 1) + { + return true; // don't block, will fail later + } + + if (nav_type == NAV_TYPE_CLICKED) + { + return true; + } + + const std::string verb = params[0].asString(); + if (verb == "create") + { + return false; + } + return true; + } + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 2eccc0474f..20b821f895 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -255,7 +255,7 @@ void LLPreviewNotecard::loadAsset() else { LLHost source_sim = LLHost(); - LLSD* user_data = new LLSD(); + LLSD* user_data = nullptr; if (mObjectUUID.notNull()) { LLViewerObject *objectp = gObjectList.findObject(mObjectUUID); @@ -274,6 +274,7 @@ void LLPreviewNotecard::loadAsset() mAssetStatus = PREVIEW_ASSET_LOADED; return; } + user_data = new LLSD(); user_data->with("taskid", mObjectUUID).with("itemid", mItemUUID); } else diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index f346531bfd..ce749a96c7 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -30,6 +30,7 @@ #include "pipeline.h" #include "llviewerwindow.h" #include "llviewerregion.h" +#include "llworld.h" extern F32SecondsImplicit gFrameTimeSeconds; @@ -123,6 +124,12 @@ void LLReflectionMap::autoAdjustOrigin() mOrigin.mul(0.5f); } + // make sure origin isn't under ground + F32* fp = mOrigin.getF32ptr(); + LLVector3 origin(fp); + F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f; + fp[2] = llmax(fp[2], height); + // make sure radius encompasses all objects LLSimdScalar r2 = 0.0; for (int i = 0; i < 8; ++i) diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index e622f54756..fd2906fa37 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -206,11 +206,21 @@ void LLReflectionMapManager::update() { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("rmmu - realtime"); // update the closest dynamic probe realtime + // should do a full irradiance pass on "odd" frames and a radiance pass on "even" frames closestDynamic->autoAdjustOrigin(); + + // store and override the value of "isRadiancePass" -- parts of the render pipe rely on "isRadiancePass" to set + // lighting values etc + bool radiance_pass = isRadiancePass(); + mRadiancePass = mRealtimeRadiancePass; for (U32 i = 0; i < 6; ++i) { updateProbeFace(closestDynamic, i); } + mRealtimeRadiancePass = !mRealtimeRadiancePass; + + // restore "isRadiancePass" + mRadiancePass = radiance_pass; } // switch to updating the next oldest probe @@ -582,7 +592,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) gRadianceGenProgram.uniform1f(sRoughness, (F32)i / (F32)(mMipChain.size() - 1)); gRadianceGenProgram.uniform1f(sMipLevel, i); - gRadianceGenProgram.uniform1i(sWidth, mMipChain[i].getWidth()); + gRadianceGenProgram.uniform1i(sWidth, mProbeResolution); for (int cf = 0; cf < 6; ++cf) { // for each cube face @@ -770,7 +780,9 @@ void LLReflectionMapManager::updateUniforms() LLEnvironment& environment = LLEnvironment::instance(); LLSettingsSky::ptr_t psky = environment.getCurrentSky(); - F32 minimum_ambiance = psky->getTotalReflectionProbeAmbiance(); + static LLCachedControl<F32> cloud_shadow_scale(gSavedSettings, "RenderCloudShadowAmbianceFactor", 0.125f); + F32 minimum_ambiance = psky->getTotalReflectionProbeAmbiance(cloud_shadow_scale); + F32 ambscale = gCubeSnapshot && !isRadiancePass() ? 0.f : 1.f; diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 5936b26b88..85f428d75b 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -169,6 +169,11 @@ private: // This should avoid feedback loops and ensure that the colors in the radiance maps match the colors in the environment. bool mRadiancePass = false; + // same as above, but for the realtime probe. + // Realtime probes should update all six sides of the irradiance map on "odd" frames and all six sides of the + // radiance map on "even" frames. + bool mRealtimeRadiancePass = false; + LLPointer<LLReflectionMap> mDefaultProbe; // default reflection probe to fall back to for pixels with no probe influences (should always be at cube index 0) // number of reflection probes to use for rendering (based on saved setting RenderReflectionProbeCount) diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index fb2577e00e..8d86e2de4c 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -515,7 +515,7 @@ void LLSceneMonitor::fetchQueryResult() } //dump results to a file _scene_xmonitor_results.csv -void LLSceneMonitor::dumpToFile(std::string file_name) +void LLSceneMonitor::dumpToFile(const std::string &file_name) { if (!hasResults()) return; diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 7cd531bd34..f2e1ef69b9 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -61,7 +61,7 @@ public: bool needsUpdate() const; const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;} - void dumpToFile(std::string file_name); + void dumpToFile(const std::string &file_name); bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != S32Seconds(0);} void reset(); diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index da912ef3d4..6a27ff3047 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -460,10 +460,11 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) if(it != mNotifications.end()) { + LLUUID old_id = it->first; // copy LLUUID to prevent use after free when it is erased below LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); if (NULL != chiclet_panelp) { - LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(it->first); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(old_id); if (NULL != chicletp) { // Pass the new_message icon state further. @@ -472,14 +473,14 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) } } - LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", it->first); + LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", old_id); if (floater) { // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142. set_new_message |= !floater->hasFocus(); } - removeNotification(it->first); + removeNotification(old_id); } } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index fd27c83270..1752b2494f 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -733,7 +733,8 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) shader->uniform3fv(LLShaderMgr::SUNLIGHT_LINEAR, linearColor3v(sunDiffuse)); shader->uniform3fv(LLShaderMgr::MOONLIGHT_LINEAR,linearColor3v(moonDiffuse)); - shader->uniform1f(LLShaderMgr::REFLECTION_PROBE_AMBIANCE, getTotalReflectionProbeAmbiance()); + static LLCachedControl<F32> cloud_shadow_scale(gSavedSettings, "RenderCloudShadowAmbianceFactor", 0.125f); + shader->uniform1f(LLShaderMgr::REFLECTION_PROBE_AMBIANCE, getTotalReflectionProbeAmbiance(cloud_shadow_scale)); shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, getIsSunUp() ? 1 : 0); shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor()); @@ -949,7 +950,7 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force) //transform water plane to eye space glh::vec3f norm(0.f, 0.f, 1.f); - glh::vec3f p(0.f, 0.f, water_height + 0.1f); + glh::vec3f p(0.f, 0.f, water_height); F32 modelView[16]; for (U32 i = 0; i < 16; i++) diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index ac7dbcacaa..c5d49a81f1 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -85,7 +85,6 @@ void LLSky::cleanup() { mVOSkyp = NULL; mVOWLSkyp = NULL; - mVOGroundp = NULL; } void LLSky::destroyGL() @@ -114,12 +113,10 @@ void LLSky::restoreGL() void LLSky::resetVertexBuffers() { - if (gSky.mVOSkyp.notNull() && gSky.mVOGroundp.notNull()) + if (gSky.mVOSkyp.notNull()) { gPipeline.resetVertexBuffers(gSky.mVOSkyp->mDrawable); - gPipeline.resetVertexBuffers(gSky.mVOGroundp->mDrawable); gPipeline.markRebuild(gSky.mVOSkyp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); } if (gSky.mVOWLSkyp.notNull()) { @@ -208,9 +205,6 @@ void LLSky::init() mVOSkyp->init(); gPipeline.createObject(mVOSkyp.get()); - mVOGroundp = (LLVOGround*)gObjectList.createObjectViewer(LLViewerObject::LL_VO_GROUND, NULL); - gPipeline.createObject(mVOGroundp.get()); - gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio")); mUpdatedThisFrame = TRUE; diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index ec0de1fbfd..cce645e2be 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -34,7 +34,6 @@ #include "v4color.h" #include "v4coloru.h" #include "llvosky.h" -#include "llvoground.h" class LLViewerCamera; @@ -88,7 +87,6 @@ public: public: LLPointer<LLVOSky> mVOSkyp; // Pointer to the LLVOSky object (only one, ever!) - LLPointer<LLVOGround> mVOGroundp; LLPointer<LLVOWLSky> mVOWLSkyp; protected: diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 32d76e690d..764131ab79 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1699,8 +1699,6 @@ void renderOctree(LLSpatialGroup* group) } face->getVertexBuffer()->setBuffer(); - //drawBox((face->mExtents[0] + face->mExtents[1])*0.5f, - // (face->mExtents[1]-face->mExtents[0])*0.5f); face->getVertexBuffer()->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart()); } } @@ -1725,145 +1723,20 @@ void renderOctree(LLSpatialGroup* group) LLVector4a fudge; fudge.splat(0.001f); - //LLVector4a size = group->mObjectBounds[1]; - //size.mul(1.01f); - //size.add(fudge); - - //{ - // LLGLDepthTest depth(GL_TRUE, GL_FALSE); - // drawBox(group->mObjectBounds[0], fudge); - //} - gGL.setSceneBlendType(LLRender::BT_ALPHA); - //if (group->mBuilt <= 0.f) { //draw opaque outline - //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], 1.f); - //drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); - gGL.diffuseColor4f(0,1,1,1); const LLVector4a* bounds = group->getBounds(); drawBoxOutline(bounds[0], bounds[1]); - - //draw bounding box for draw info - /*if (group->getSpatialPartition()->mRenderByGroup) - { - gGL.diffuseColor4f(1.0f, 0.75f, 0.25f, 0.6f); - for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) - { - for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j) - { - LLDrawInfo* draw_info = *j; - LLVector4a center; - center.setAdd(draw_info->mExtents[1], draw_info->mExtents[0]); - center.mul(0.5f); - LLVector4a size; - size.setSub(draw_info->mExtents[1], draw_info->mExtents[0]); - size.mul(0.5f); - drawBoxOutline(center, size); - } - } - }*/ } - -// LLSpatialGroup::OctreeNode* node = group->mOctreeNode; -// gGL.diffuseColor4f(0,1,0,1); -// drawBoxOutline(LLVector3(node->getCenter()), LLVector3(node->getSize())); } std::set<LLSpatialGroup*> visible_selected_groups; -void renderVisibility(LLSpatialGroup* group, LLCamera* camera) -{ - /*LLGLEnable blend(GL_BLEND); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - LLGLEnable cull(GL_CULL_FACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);*/ - - /*BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && - !group->isEmpty(); - - - if (render_objects) - { - LLGLDepthTest depth(GL_TRUE, GL_FALSE); - - LLGLDisable blend(GL_BLEND); - gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f); - pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glLineWidth(4.f); - gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f); - pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false); - glLineWidth(1.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - bool selected = false; - - for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter) - { - LLDrawable* drawable = *iter; - if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected()) - { - selected = true; - break; - } - } - - if (selected) - { //store for rendering occlusion volume as overlay - visible_selected_groups.insert(group); - } - }*/ - - /*if (render_objects) - { - LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER); - gGL.diffuseColor4f(0, 0.5f, 0, 0.5f); - gGL.diffuseColor4f(0, 0.5f, 0, 0.5f); - pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); - } - - { - LLGLDepthTest depth_over(GL_TRUE, GL_FALSE, GL_LEQUAL); - - if (render_objects) - { - gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f); - gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f); - pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); - } - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - if (render_objects) - { - gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f); - gGL.diffuseColor4f(0.f, 0.75f, 0.f, 0.5f); - pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); - - bool selected = false; - - for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter) - { - LLDrawable* drawable = *iter; - if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected()) - { - selected = true; - break; - } - } - - if (selected) - { //store for rendering occlusion volume as overlay - visible_selected_groups.insert(group); - } - } - }*/ -} void renderXRay(LLSpatialGroup* group, LLCamera* camera) { @@ -2845,8 +2718,7 @@ void renderTexelDensity(LLDrawable* drawable) } LLGLEnable _(GL_BLEND); - //gObjectFullbrightProgram.bind(); - + LLMatrix4 checkerboard_matrix; S32 discard_level = -1; @@ -3254,23 +3126,6 @@ public: renderOctree(group); stop_glerror(); } - - //render visibility wireframe - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION)) - { - group->rebuildGeom(); - group->rebuildMesh(); - - gGL.flush(); - gGL.pushMatrix(); - gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); - renderVisibility(group, mCamera); - stop_glerror(); - gGLLastMatrix = NULL; - gGL.popMatrix(); - gGL.diffuseColor4f(1,1,1,1); - } } } diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index ea671a130e..60bada8f58 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -982,7 +982,6 @@ void LLActiveSpeakerMgr::updateSpeakerList() // clean up text only speakers for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it) { - LLUUID speaker_id = speaker_it->first; LLSpeaker* speakerp = speaker_it->second; if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) { diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index 5ca1d4b4a5..0111d8869c 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -51,6 +51,10 @@ class SpeakingIndicatorManager : public LLSingleton<SpeakingIndicatorManager>, L LLSINGLETON(SpeakingIndicatorManager); ~SpeakingIndicatorManager(); LOG_CLASS(SpeakingIndicatorManager); + +protected: + void cleanupSingleton(); + public: /** @@ -183,12 +187,16 @@ SpeakingIndicatorManager::SpeakingIndicatorManager() SpeakingIndicatorManager::~SpeakingIndicatorManager() { - // Don't use LLVoiceClient::getInstance() here without check - // singleton MAY have already been destroyed. - if(LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver(this); - } +} + +void SpeakingIndicatorManager::cleanupSingleton() +{ + // Don't use LLVoiceClient::getInstance() here without a check, + // singleton MAY have already been destroyed. + if (LLVoiceClient::instanceExists()) + { + LLVoiceClient::getInstance()->removeObserver(this); + } } void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0019038c76..0dc4746123 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -273,12 +273,10 @@ void show_first_run_dialog(); bool first_run_dialog_callback(const LLSD& notification, const LLSD& response); void set_startup_status(const F32 frac, const std::string& string, const std::string& msg); bool login_alert_status(const LLSD& notification, const LLSD& response); -void login_packet_failed(void**, S32 result); void use_circuit_callback(void**, S32 result); void register_viewer_callbacks(LLMessageSystem* msg); void asset_callback_nothing(const LLUUID&, LLAssetType::EType, void*, S32); bool callback_choose_gender(const LLSD& notification, const LLSD& response); -void init_start_screen(S32 location_id); void release_start_screen(); void reset_login(); LLSD transform_cert_args(LLPointer<LLCertificate> cert); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 024f25bc98..bf3f4c1e88 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -89,6 +89,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt const LLFontGL* font = make_small_btn ? sFontSmall: sFont; // for block and ignore buttons in script dialog p.name = form_element["name"].asString(); p.label = form_element["text"].asString(); + p.tool_tip = form_element["text"].asString(); p.font = font; p.rect.height = BTN_HEIGHT; p.click_callback.function(boost::bind(&LLToastNotifyPanel::onClickButton, userdata)); diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 752fc6f3f3..01d799dcd5 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -44,7 +44,6 @@ #include "llagent.h" // HACK for destinations guide on startup #include "llfloaterreg.h" // HACK for destinations guide on startup #include "llviewercontrol.h" // HACK for destinations guide on startup -#include "llinventorymodel.h" // HACK to disable starter avatars button for NUX #include <boost/foreach.hpp> @@ -320,22 +319,6 @@ bool LLToolBarView::loadToolbars(bool force_default) } } } - - // SL-18581: Don't show the starter avatar toolbar button for NUX users - LLViewerInventoryCategory* my_outfits_cat = gInventory.getCategory(gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS)); - if (gAgent.isFirstLogin() - && my_outfits_cat != NULL - && my_outfits_cat->getDescendentCount() > 0) - { - for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++) - { - if (mToolbars[i]) - { - mToolbars[i]->removeCommand(LLCommandId("avatar")); - } - } - } - mToolbarsLoaded = true; return true; } diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 53bc77daa9..1b19ba33a3 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -2045,11 +2045,6 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject( { return ACCEPT_NO_LOCKED; } - //If texture !copyable don't texture or you'll never get it back. - if(!item->getPermissions().allowCopyBy(gAgent.getID())) - { - return ACCEPT_NO; - } if (cargo_type == DAD_TEXTURE) { diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 80ba54ab6c..dcc528e887 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -642,7 +642,6 @@ bool LLToolPie::walkToClickedLocation() mPick = saved_pick; return false; } - return true; } bool LLToolPie::teleportToClickedLocation() @@ -746,18 +745,8 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) parent = object->getRootEdit(); } - // Show screen-space highlight glow effect - bool show_highlight = false; - - if (handleMediaHover(mHoverPick)) - { - // *NOTE: If you think the hover glow conflicts with the media outline, you - // could disable it here. - show_highlight = true; - // cursor set by media object - LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; - } - else if (!mMouseOutsideSlop + if (!handleMediaHover(mHoverPick) + && !mMouseOutsideSlop && mMouseButtonDown // disable camera steering if click on land is not used for moving && gViewerInput.isMouseBindUsed(CLICK_LEFT, MASK_NONE, MODE_THIRD_PERSON)) @@ -790,7 +779,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit())) { - show_highlight = true; ECursorType cursor = cursorFromObject(click_action_object); gViewerWindow->setCursor(cursor); LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; @@ -799,7 +787,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) else if ((object && !object->isAvatar() && object->flagUsePhysics()) || (parent && !parent->isAvatar() && parent->flagUsePhysics())) { - show_highlight = true; gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } @@ -807,7 +794,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) && ((object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) && (!object || !object->isAvatar())) { - show_highlight = true; gViewerWindow->setCursor(UI_CURSOR_HAND); LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index a1670351f4..7c92e7ef98 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -263,7 +263,7 @@ public: // inside the app, otherwise a malicious web page could // cause a constant teleport loop. JC LLTeleportHandler() : - LLCommandHandler("teleport", UNTRUSTED_THROTTLE), + LLCommandHandler("teleport", UNTRUSTED_CLICK_ONLY), LLEventAPI("LLTeleportHandler", "Low-level teleport API") { LLEventAPI::add("teleport", diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 5ddd8c78f7..341f94241a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -51,7 +51,6 @@ #include "llviewerwindow.h" #include "llvoavatarself.h" #include "llvoiceclient.h" -#include "llvosky.h" #include "llvotree.h" #include "llvovolume.h" #include "llworld.h" @@ -171,8 +170,7 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue) if (!status) { gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_TERRAIN, + LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::RENDER_TYPE_GRASS, LLPipeline::RENDER_TYPE_TREE, LLPipeline::RENDER_TYPE_WATER, @@ -186,7 +184,6 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue) else { gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::RENDER_TYPE_GROUND, LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::RENDER_TYPE_GRASS, LLPipeline::RENDER_TYPE_TREE, diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 2e20d61b15..62144b2d31 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1161,6 +1161,7 @@ void render_hud_attachments() gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA_MASK); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT); + gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_GLTF_PBR); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_BUMP); @@ -1171,6 +1172,8 @@ void render_hud_attachments() gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_SHINY); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISIBLE); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY); + gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_GLTF_PBR); + gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK); gPipeline.stateSort(hud_cam, result); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index f30c2195d3..14d5a7c276 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -174,11 +174,103 @@ const std::string FLOATER_PROFILE("profile"); class LLFloaterOpenHandler : public LLCommandHandler { public: - // requires trusted browser to trigger + // requires trusted browser to trigger or an explicit click LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { } - bool handle(const LLSD& params, const LLSD& query_map, - LLMediaCtrl* web) + bool canHandleUntrusted( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web, + const std::string& nav_type) override + { + if (params.size() != 1) + { + return true; // will fail silently + } + + std::string fl_name = params[0].asString(); + + if (nav_type == NAV_TYPE_CLICKED) + { + const std::list<std::string> blacklist_clicked = { + "camera_presets", + "delete_pref_preset", + "forget_username", + "god_tools", + "group_picker", + "hud", + "incoming_call", + "linkreplace", + "message_critical", // Modal!!! Login specific. + "message_tos", // Modal!!! Login specific. + "save_pref_preset", + "save_camera_preset", + "region_restarting", + "outfit_snapshot", + "upload_anim_bvh", + "upload_anim_anim", + "upload_image", + "upload_model", + "upload_script", + "upload_sound" + }; + return std::find(blacklist_clicked.begin(), blacklist_clicked.end(), fl_name) == blacklist_clicked.end(); + } + else + { + const std::list<std::string> blacklist_untrusted = { + "360capture", + "block_timers", + "add_payment_method", + "appearance", + "associate_listing", + "avatar_picker", + "camera", + "camera_presets", + "classified", + "add_landmark", + "delete_pref_preset", + "env_fixed_environmentent_water", + "env_fixed_environmentent_sky", + "env_edit_extdaycycle", + "font_test", + "forget_username", + "god_tools", + "group_picker", + "hud", + "incoming_call", + "linkreplace", + "mem_leaking", + "marketplace_validation", + "message_critical", // Modal!!! Login specific. If this is in use elsewhere, better to create a non modal variant + "message_tos", // Modal!!! Login specific. + "mute_object_by_name", + "publish_classified", + "save_pref_preset", + "save_camera_preset", + "region_restarting", + "script_debug", + "script_debug_output", + "sell_land", + "outfit_snapshot", + "upload_anim_bvh", + "upload_anim_anim", + "upload_image", + "upload_model", + "upload_script", + "upload_sound" + }; + return std::find(blacklist_untrusted.begin(), blacklist_untrusted.end(), fl_name) == blacklist_untrusted.end(); + } + + + return true; + } + + bool handle( + const LLSD& params, + const LLSD& query_map, + LLMediaCtrl* web) override { if (params.size() != 1) { diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 43b9cd90bd..6bab2c2100 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -1614,12 +1614,22 @@ BOOL LLViewerInput::handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask, clicktype = CLICK_DOUBLELEFT; } + // If the first LMB click is handled by the menu, skip the following double click + static bool skip_double_click = false; + if (clicktype == CLICK_LEFT && down ) + { + skip_double_click = handled; + } if (double_click_sp && down) { // Consume click. // Due to handling, double click that is not handled will be immediately followed by LMB click } + else if (clicktype == CLICK_DOUBLELEFT && skip_double_click) + { + handled = true; + } // If UI handled 'down', it should handle 'up' as well // If we handle 'down' not by UI, then we should handle 'up'/'level' regardless of UI else if (handled) diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b4feafb7ff..518967709d 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -233,7 +233,7 @@ class LLInventoryHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLInventoryHandler() : LLCommandHandler("inventory", UNTRUSTED_THROTTLE) { } + LLInventoryHandler() : LLCommandHandler("inventory", UNTRUSTED_CLICK_ONLY) { } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4ba4c5f935..5a3f2f22b8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -764,10 +764,6 @@ U32 render_type_from_string(std::string render_type) { return LLPipeline::RENDER_TYPE_WATER; } - else if ("ground" == render_type) - { - return LLPipeline::RENDER_TYPE_GROUND; - } else if ("volume" == render_type) { return LLPipeline::RENDER_TYPE_VOLUME; @@ -2711,14 +2707,15 @@ void handle_object_show_original() } -static void init_default_item_label(const std::string& item_name) +static void init_default_item_label(LLUICtrl* ctrl) { + const std::string& item_name = ctrl->getName(); boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name); if (it == sDefaultItemLabels.end()) { // *NOTE: This will not work for items of type LLMenuItemCheckGL because they return boolean value // (doesn't seem to matter much ATM). - LLStringExplicit default_label = gMenuHolder->childGetValue(item_name).asString(); + LLStringExplicit default_label = ctrl->getValue().asString(); if (!default_label.empty()) { sDefaultItemLabels.insert(std::pair<std::string, LLStringExplicit>(item_name, default_label)); @@ -2749,18 +2746,17 @@ bool enable_object_touch(LLUICtrl* ctrl) new_value = obj->flagHandleTouch() || (parent && parent->flagHandleTouch()); } - std::string item_name = ctrl->getName(); - init_default_item_label(item_name); + init_default_item_label(ctrl); // Update label based on the node touch name if available. LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { - gMenuHolder->childSetValue(item_name, node->mTouchName); + ctrl->setValue(node->mTouchName); } else { - gMenuHolder->childSetValue(item_name, get_default_item_label(item_name)); + ctrl->setValue(get_default_item_label(ctrl->getName())); } return new_value; @@ -5612,6 +5608,7 @@ class LLToolsSelectNextPartFace : public view_listener_t } } LLSelectMgr::getInstance()->selectObjectOnly(to_select, new_te); + LLSelectMgr::getInstance()->addAsIndividual(to_select, new_te, false); } else { @@ -6575,20 +6572,18 @@ bool enable_object_sit(LLUICtrl* ctrl) bool sitting_on_sel = sitting_on_selection(); if (!sitting_on_sel) { - std::string item_name = ctrl->getName(); - // init default labels - init_default_item_label(item_name); + init_default_item_label(ctrl); // Update label LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mSitName.empty()) { - gMenuHolder->childSetValue(item_name, node->mSitName); + ctrl->setValue(node->mSitName); } else { - gMenuHolder->childSetValue(item_name, get_default_item_label(item_name)); + ctrl->setValue(get_default_item_label(ctrl->getName())); } } return !sitting_on_sel && is_object_sittable(); @@ -7634,7 +7629,6 @@ void handle_selected_texture_info(void*) map_t::iterator it; for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it) { - LLUUID image_id = it->first; U8 te = it->second[0]; LLViewerTexture* img = node->getObject()->getTEImage(te); S32 height = img->getHeight(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 88d5d50845..2d9614d5c3 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -84,11 +84,10 @@ #include "llvoavatar.h" #include "llvoavatarself.h" #include "llvograss.h" -#include "llvoground.h" +#include "llvosky.h" #include "llvolume.h" #include "llvolumemessage.h" #include "llvopartgroup.h" -#include "llvosky.h" #include "llvosurfacepatch.h" #include "llvotree.h" #include "llvovolume.h" @@ -163,7 +162,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco && pcode != LL_VO_VOID_WATER && pcode != LL_VO_WL_SKY && pcode != LL_VO_SKY - && pcode != LL_VO_GROUND && pcode != LL_VO_PART_GROUP ) { @@ -235,8 +233,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco res = new LLVOVoidWater(id, pcode, regionp); break; case LL_VO_WATER: res = new LLVOWater(id, pcode, regionp); break; - case LL_VO_GROUND: - res = new LLVOGround(id, pcode, regionp); break; case LL_VO_PART_GROUP: res = new LLVOPartGroup(id, pcode, regionp); break; case LL_VO_HUD_PART_GROUP: @@ -3248,36 +3244,39 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) return; } - LLFilenameAndTask* ft = new LLFilenameAndTask; - ft->mTaskID = task_id; // we can receive multiple task updates simultaneously, make sure we will not rewrite newer with older update - msg->getS16Fast(_PREHASH_InventoryData, _PREHASH_Serial, ft->mSerial); + S16 serial = 0; + msg->getS16Fast(_PREHASH_InventoryData, _PREHASH_Serial, serial); - if (ft->mSerial == object->mInventorySerialNum - && ft->mSerial < object->mExpectedInventorySerialNum) + if (serial == object->mInventorySerialNum + && serial < object->mExpectedInventorySerialNum) { // Loop Protection. // We received same serial twice. // Viewer did some changes to inventory that couldn't be saved server side // or something went wrong to cause serial to be out of sync. // Drop xfer and restart after some time, assign server's value as expected - LL_WARNS() << "Task inventory serial might be out of sync, server serial: " << ft->mSerial << " client expected serial: " << object->mExpectedInventorySerialNum << LL_ENDL; - object->mExpectedInventorySerialNum = ft->mSerial; + LL_WARNS() << "Task inventory serial might be out of sync, server serial: " << serial << " client expected serial: " << object->mExpectedInventorySerialNum << LL_ENDL; + object->mExpectedInventorySerialNum = serial; object->fetchInventoryDelayed(INVENTORY_UPDATE_WAIT_TIME_DESYNC); } - else if (ft->mSerial < object->mExpectedInventorySerialNum) + else if (serial < object->mExpectedInventorySerialNum) { // Out of date message, record to current serial for loop protection, but do not load it // Drop xfer and restart after some time - if (ft->mSerial < object->mInventorySerialNum) + if (serial < object->mInventorySerialNum) { LL_WARNS() << "Task serial decreased. Potentially out of order packet or desync." << LL_ENDL; } - object->mInventorySerialNum = ft->mSerial; + object->mInventorySerialNum = serial; object->fetchInventoryDelayed(INVENTORY_UPDATE_WAIT_TIME_OUTDATED); } - else if (ft->mSerial >= object->mExpectedInventorySerialNum) + else if (serial >= object->mExpectedInventorySerialNum) { + LLFilenameAndTask* ft = new LLFilenameAndTask; + ft->mTaskID = task_id; + ft->mSerial = serial; + // We received version we expected or newer. Load it. object->mInventorySerialNum = ft->mSerial; object->mExpectedInventorySerialNum = ft->mSerial; @@ -3312,7 +3311,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) object->mRegionp->getHost(), TRUE, &LLViewerObject::processTaskInvFile, - (void**)ft, + (void**)ft, // This takes ownership of ft LLXferManager::HIGH_PRIORITY); if (object->mInvRequestState == INVENTORY_XFER) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 93b17361ab..560c51139b 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -672,7 +672,6 @@ public: LL_VO_SKY = LL_PCODE_APP | 0x60, LL_VO_VOID_WATER = LL_PCODE_APP | 0x70, LL_VO_WATER = LL_PCODE_APP | 0x80, - LL_VO_GROUND = LL_PCODE_APP | 0x90, LL_VO_PART_GROUP = LL_PCODE_APP | 0xa0, LL_VO_TRIANGLE_TORUS = LL_PCODE_APP | 0xb0, LL_VO_HUD_PART_GROUP = LL_PCODE_APP | 0xc0, diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index f042040e98..1751ee1ebb 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -793,7 +793,7 @@ void LLViewerPartSourceBeam::update(const F32 dt) } LLViewerPart* part = new LLViewerPart(); - part->init(this, mImagep, NULL); + part->init(this, mImagep, updatePart); part->mFlags = LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 90b06fa133..5d3da55499 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -38,7 +38,6 @@ #include "llatmosphere.h" #include "llworld.h" #include "llsky.h" -#include "llvosky.h" #include "pipeline.h" @@ -49,8 +48,6 @@ #include "lljoint.h" #include "llskinningutil.h" -//#pragma optimize("", off) - static LLStaticHashedString sTexture0("texture0"); static LLStaticHashedString sTexture1("texture1"); static LLStaticHashedString sTex0("tex0"); @@ -74,22 +71,16 @@ LLVector4 gShinyOrigin; LLGLSLShader gOcclusionProgram; LLGLSLShader gSkinnedOcclusionProgram; LLGLSLShader gOcclusionCubeProgram; -LLGLSLShader gCustomAlphaProgram; // SL-14113 This used to be used for the stars with Atmospheric Shaders: OFF LLGLSLShader gGlowCombineProgram; -LLGLSLShader gSplatTextureRectProgram; LLGLSLShader gReflectionMipProgram; LLGLSLShader gRadianceGenProgram; LLGLSLShader gIrradianceGenProgram; LLGLSLShader gGlowCombineFXAAProgram; -LLGLSLShader gTwoTextureAddProgram; LLGLSLShader gTwoTextureCompareProgram; LLGLSLShader gOneTextureFilterProgram; -LLGLSLShader gOneTextureNoColorProgram; LLGLSLShader gDebugProgram; LLGLSLShader gSkinnedDebugProgram; LLGLSLShader gClipProgram; -LLGLSLShader gDownsampleDepthProgram; -LLGLSLShader gDownsampleDepthRectProgram; LLGLSLShader gAlphaMaskProgram; LLGLSLShader gBenchmarkProgram; LLGLSLShader gReflectionProbeDisplayProgram; @@ -97,57 +88,16 @@ LLGLSLShader gCopyProgram; LLGLSLShader gCopyDepthProgram; //object shaders -LLGLSLShader gObjectSimpleProgram; -LLGLSLShader gSkinnedObjectSimpleProgram; -LLGLSLShader gObjectSimpleImpostorProgram; -LLGLSLShader gSkinnedObjectSimpleImpostorProgram; LLGLSLShader gObjectPreviewProgram; LLGLSLShader gPhysicsPreviewProgram; -LLGLSLShader gObjectSimpleWaterProgram; -LLGLSLShader gSkinnedObjectSimpleWaterProgram; -LLGLSLShader gObjectSimpleAlphaMaskProgram; -LLGLSLShader gSkinnedObjectSimpleAlphaMaskProgram; -LLGLSLShader gObjectSimpleWaterAlphaMaskProgram; -LLGLSLShader gSkinnedObjectSimpleWaterAlphaMaskProgram; -LLGLSLShader gObjectFullbrightProgram; -LLGLSLShader gSkinnedObjectFullbrightProgram; -LLGLSLShader gObjectFullbrightWaterProgram; -LLGLSLShader gSkinnedObjectFullbrightWaterProgram; -LLGLSLShader gObjectEmissiveProgram; -LLGLSLShader gSkinnedObjectEmissiveProgram; -LLGLSLShader gObjectEmissiveWaterProgram; -LLGLSLShader gSkinnedObjectEmissiveWaterProgram; LLGLSLShader gObjectFullbrightAlphaMaskProgram; LLGLSLShader gSkinnedObjectFullbrightAlphaMaskProgram; -LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram; -LLGLSLShader gSkinnedObjectFullbrightWaterAlphaMaskProgram; -LLGLSLShader gObjectFullbrightShinyProgram; -LLGLSLShader gSkinnedObjectFullbrightShinyProgram; -LLGLSLShader gObjectFullbrightShinyWaterProgram; -LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram; -LLGLSLShader gObjectShinyProgram; -LLGLSLShader gSkinnedObjectShinyProgram; -LLGLSLShader gObjectShinyWaterProgram; -LLGLSLShader gSkinnedObjectShinyWaterProgram; LLGLSLShader gObjectBumpProgram; LLGLSLShader gSkinnedObjectBumpProgram; -LLGLSLShader gTreeProgram; -LLGLSLShader gTreeWaterProgram; -LLGLSLShader gObjectFullbrightNoColorProgram; -LLGLSLShader gObjectFullbrightNoColorWaterProgram; - -LLGLSLShader gObjectSimpleNonIndexedTexGenProgram; -LLGLSLShader gObjectSimpleNonIndexedTexGenWaterProgram; -LLGLSLShader gObjectAlphaMaskNonIndexedProgram; -LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram; LLGLSLShader gObjectAlphaMaskNoColorProgram; LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; //environment shaders -LLGLSLShader gMoonProgram; -LLGLSLShader gStarsProgram; -LLGLSLShader gTerrainProgram; -LLGLSLShader gTerrainWaterProgram; LLGLSLShader gWaterProgram; LLGLSLShader gWaterEdgeProgram; LLGLSLShader gUnderWaterProgram; @@ -159,8 +109,6 @@ LLGLSLShader gHighlightNormalProgram; LLGLSLShader gHighlightSpecularProgram; LLGLSLShader gDeferredHighlightProgram; -LLGLSLShader gDeferredHighlightNormalProgram; -LLGLSLShader gDeferredHighlightSpecularProgram; LLGLSLShader gPathfindingProgram; LLGLSLShader gPathfindingNoNormalsProgram; @@ -169,26 +117,15 @@ LLGLSLShader gPathfindingNoNormalsProgram; LLGLSLShader gAvatarProgram; LLGLSLShader gAvatarWaterProgram; LLGLSLShader gAvatarEyeballProgram; -LLGLSLShader gAvatarPickProgram; LLGLSLShader gImpostorProgram; -// WindLight shader handles -LLGLSLShader gWLSkyProgram; -LLGLSLShader gWLCloudProgram; -LLGLSLShader gWLSunProgram; -LLGLSLShader gWLMoonProgram; - // Effects Shaders LLGLSLShader gGlowProgram; LLGLSLShader gGlowExtractProgram; -LLGLSLShader gPostColorFilterProgram; -LLGLSLShader gPostNightVisionProgram; LLGLSLShader gPostScreenSpaceReflectionProgram; // Deferred rendering shaders LLGLSLShader gDeferredImpostorProgram; -LLGLSLShader gDeferredWaterProgram; -LLGLSLShader gDeferredUnderWaterProgram; LLGLSLShader gDeferredDiffuseProgram; LLGLSLShader gDeferredDiffuseAlphaMaskProgram; LLGLSLShader gDeferredSkinnedDiffuseAlphaMaskProgram; @@ -224,6 +161,7 @@ LLGLSLShader gDeferredAvatarShadowProgram; LLGLSLShader gDeferredAvatarAlphaShadowProgram; LLGLSLShader gDeferredAvatarAlphaMaskShadowProgram; LLGLSLShader gDeferredAlphaProgram; +LLGLSLShader gHUDAlphaProgram; LLGLSLShader gDeferredSkinnedAlphaProgram; LLGLSLShader gDeferredAlphaImpostorProgram; LLGLSLShader gDeferredSkinnedAlphaImpostorProgram; @@ -231,8 +169,11 @@ LLGLSLShader gDeferredAlphaWaterProgram; LLGLSLShader gDeferredSkinnedAlphaWaterProgram; LLGLSLShader gDeferredAvatarEyesProgram; LLGLSLShader gDeferredFullbrightProgram; +LLGLSLShader gHUDFullbrightProgram; LLGLSLShader gDeferredFullbrightAlphaMaskProgram; +LLGLSLShader gHUDFullbrightAlphaMaskProgram; LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram; +LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram; LLGLSLShader gDeferredFullbrightWaterProgram; LLGLSLShader gDeferredSkinnedFullbrightWaterProgram; LLGLSLShader gDeferredFullbrightWaterAlphaProgram; @@ -253,6 +194,7 @@ LLGLSLShader gDeferredWLSunProgram; LLGLSLShader gDeferredWLMoonProgram; LLGLSLShader gDeferredStarProgram; LLGLSLShader gDeferredFullbrightShinyProgram; +LLGLSLShader gHUDFullbrightShinyProgram; LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; LLGLSLShader gDeferredSkinnedFullbrightProgram; LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskProgram; @@ -263,8 +205,12 @@ LLGLSLShader gDeferredGenBrdfLutProgram; // Deferred materials shaders LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2]; +LLGLSLShader gHUDPBROpaqueProgram; +LLGLSLShader gPBRGlowProgram; +LLGLSLShader gPBRGlowSkinnedProgram; LLGLSLShader gDeferredPBROpaqueProgram; LLGLSLShader gDeferredSkinnedPBROpaqueProgram; +LLGLSLShader gHUDPBRAlphaProgram; LLGLSLShader gDeferredPBRAlphaProgram; LLGLSLShader gDeferredSkinnedPBRAlphaProgram; @@ -290,74 +236,36 @@ LLViewerShaderMgr::LLViewerShaderMgr() : { /// Make sure WL Sky is the first program //ONLY shaders that need WL Param management should be added here - mShaderList.push_back(&gWLSkyProgram); - mShaderList.push_back(&gWLCloudProgram); - mShaderList.push_back(&gWLSunProgram); - mShaderList.push_back(&gWLMoonProgram); mShaderList.push_back(&gAvatarProgram); - mShaderList.push_back(&gObjectShinyProgram); - mShaderList.push_back(&gSkinnedObjectShinyProgram); mShaderList.push_back(&gWaterProgram); mShaderList.push_back(&gWaterEdgeProgram); mShaderList.push_back(&gAvatarEyeballProgram); - mShaderList.push_back(&gObjectSimpleProgram); - mShaderList.push_back(&gSkinnedObjectSimpleProgram); - mShaderList.push_back(&gObjectSimpleImpostorProgram); - mShaderList.push_back(&gSkinnedObjectSimpleImpostorProgram); mShaderList.push_back(&gObjectPreviewProgram); mShaderList.push_back(&gImpostorProgram); - mShaderList.push_back(&gObjectFullbrightNoColorProgram); - mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram); - mShaderList.push_back(&gObjectSimpleAlphaMaskProgram); - mShaderList.push_back(&gSkinnedObjectSimpleAlphaMaskProgram); mShaderList.push_back(&gObjectBumpProgram); mShaderList.push_back(&gSkinnedObjectBumpProgram); - mShaderList.push_back(&gObjectEmissiveProgram); - mShaderList.push_back(&gSkinnedObjectEmissiveProgram); - mShaderList.push_back(&gObjectEmissiveWaterProgram); - mShaderList.push_back(&gSkinnedObjectEmissiveWaterProgram); - mShaderList.push_back(&gObjectFullbrightProgram); - mShaderList.push_back(&gSkinnedObjectFullbrightProgram); mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram); mShaderList.push_back(&gSkinnedObjectFullbrightAlphaMaskProgram); - mShaderList.push_back(&gObjectFullbrightShinyProgram); - mShaderList.push_back(&gSkinnedObjectFullbrightShinyProgram); - mShaderList.push_back(&gObjectFullbrightShinyWaterProgram); - mShaderList.push_back(&gSkinnedObjectFullbrightShinyWaterProgram); - mShaderList.push_back(&gObjectSimpleNonIndexedTexGenProgram); - mShaderList.push_back(&gObjectSimpleNonIndexedTexGenWaterProgram); - mShaderList.push_back(&gObjectAlphaMaskNonIndexedProgram); - mShaderList.push_back(&gObjectAlphaMaskNonIndexedWaterProgram); mShaderList.push_back(&gObjectAlphaMaskNoColorProgram); mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram); - mShaderList.push_back(&gTreeProgram); - mShaderList.push_back(&gTreeWaterProgram); - mShaderList.push_back(&gTerrainProgram); - mShaderList.push_back(&gTerrainWaterProgram); - mShaderList.push_back(&gObjectSimpleWaterProgram); - mShaderList.push_back(&gSkinnedObjectSimpleWaterProgram); - mShaderList.push_back(&gObjectFullbrightWaterProgram); - mShaderList.push_back(&gSkinnedObjectFullbrightWaterProgram); - mShaderList.push_back(&gObjectSimpleWaterAlphaMaskProgram); - mShaderList.push_back(&gSkinnedObjectSimpleWaterAlphaMaskProgram); - mShaderList.push_back(&gObjectFullbrightWaterAlphaMaskProgram); - mShaderList.push_back(&gSkinnedObjectFullbrightWaterAlphaMaskProgram); mShaderList.push_back(&gAvatarWaterProgram); - mShaderList.push_back(&gObjectShinyWaterProgram); - mShaderList.push_back(&gSkinnedObjectShinyWaterProgram); mShaderList.push_back(&gUnderWaterProgram); mShaderList.push_back(&gDeferredSunProgram); mShaderList.push_back(&gDeferredSoftenProgram); mShaderList.push_back(&gDeferredSoftenWaterProgram); mShaderList.push_back(&gDeferredAlphaProgram); + mShaderList.push_back(&gHUDAlphaProgram); mShaderList.push_back(&gDeferredSkinnedAlphaProgram); mShaderList.push_back(&gDeferredAlphaImpostorProgram); mShaderList.push_back(&gDeferredSkinnedAlphaImpostorProgram); mShaderList.push_back(&gDeferredAlphaWaterProgram); mShaderList.push_back(&gDeferredSkinnedAlphaWaterProgram); mShaderList.push_back(&gDeferredFullbrightProgram); + mShaderList.push_back(&gHUDFullbrightProgram); mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram); + mShaderList.push_back(&gHUDFullbrightAlphaMaskProgram); mShaderList.push_back(&gDeferredFullbrightAlphaMaskAlphaProgram); + mShaderList.push_back(&gHUDFullbrightAlphaMaskAlphaProgram); mShaderList.push_back(&gDeferredFullbrightWaterProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightWaterProgram); mShaderList.push_back(&gDeferredFullbrightWaterAlphaProgram); @@ -365,6 +273,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredFullbrightAlphaMaskWaterProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskWaterProgram); mShaderList.push_back(&gDeferredFullbrightShinyProgram); + mShaderList.push_back(&gHUDFullbrightShinyProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightShinyProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightProgram); mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskProgram); @@ -372,8 +281,6 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredEmissiveProgram); mShaderList.push_back(&gDeferredSkinnedEmissiveProgram); mShaderList.push_back(&gDeferredAvatarEyesProgram); - mShaderList.push_back(&gDeferredWaterProgram); - mShaderList.push_back(&gDeferredUnderWaterProgram); mShaderList.push_back(&gDeferredTerrainWaterProgram); mShaderList.push_back(&gDeferredAvatarAlphaProgram); mShaderList.push_back(&gDeferredWLSkyProgram); @@ -381,6 +288,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredWLMoonProgram); mShaderList.push_back(&gDeferredWLSunProgram); mShaderList.push_back(&gDeferredPBRAlphaProgram); + mShaderList.push_back(&gHUDPBRAlphaProgram); mShaderList.push_back(&gDeferredSkinnedPBRAlphaProgram); } @@ -548,49 +456,20 @@ void LLViewerShaderMgr::setShaders() gPipeline.mShadersLoaded = true; - // Load all shaders to set max levels - BOOL loaded = loadShadersEnvironment(); + BOOL loaded = loadShadersWater(); if (loaded) { - LL_INFOS() << "Loaded environment shaders." << LL_ENDL; + LL_INFOS() << "Loaded water shaders." << LL_ENDL; } else { - LL_WARNS() << "Failed to load environment shaders." << LL_ENDL; + LL_WARNS() << "Failed to load water shaders." << LL_ENDL; llassert(loaded); } if (loaded) { - loaded = loadShadersWater(); - if (loaded) - { - LL_INFOS() << "Loaded water shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load water shaders." << LL_ENDL; - llassert(loaded); - } - } - - if (loaded) - { - loaded = loadShadersWindLight(); - if (loaded) - { - LL_INFOS() << "Loaded windlight shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load windlight shaders." << LL_ENDL; - llassert(loaded); - } - } - - if (loaded) - { loaded = loadShadersEffects(); if (loaded) { @@ -661,102 +540,46 @@ void LLViewerShaderMgr::unloadShaders() gDebugProgram.unload(); gSkinnedDebugProgram.unload(); gClipProgram.unload(); - gDownsampleDepthProgram.unload(); - gDownsampleDepthRectProgram.unload(); gBenchmarkProgram.unload(); gReflectionProbeDisplayProgram.unload(); gAlphaMaskProgram.unload(); gUIProgram.unload(); gPathfindingProgram.unload(); gPathfindingNoNormalsProgram.unload(); - gCustomAlphaProgram.unload(); gGlowCombineProgram.unload(); - gSplatTextureRectProgram.unload(); - gReflectionMipProgram.unload(); + gReflectionMipProgram.unload(); gRadianceGenProgram.unload(); gIrradianceGenProgram.unload(); gGlowCombineFXAAProgram.unload(); - gTwoTextureAddProgram.unload(); gTwoTextureCompareProgram.unload(); gOneTextureFilterProgram.unload(); - gOneTextureNoColorProgram.unload(); gSolidColorProgram.unload(); - gObjectFullbrightNoColorProgram.unload(); - gObjectFullbrightNoColorWaterProgram.unload(); - gObjectSimpleProgram.unload(); - gSkinnedObjectSimpleProgram.unload(); - gObjectSimpleImpostorProgram.unload(); - gSkinnedObjectSimpleImpostorProgram.unload(); gObjectPreviewProgram.unload(); gPhysicsPreviewProgram.unload(); gImpostorProgram.unload(); - gObjectSimpleAlphaMaskProgram.unload(); - gSkinnedObjectSimpleAlphaMaskProgram.unload(); gObjectBumpProgram.unload(); gSkinnedObjectBumpProgram.unload(); - gObjectSimpleWaterProgram.unload(); - gSkinnedObjectSimpleWaterProgram.unload(); - gObjectSimpleWaterAlphaMaskProgram.unload(); - gSkinnedObjectSimpleWaterAlphaMaskProgram.unload(); - gObjectFullbrightProgram.unload(); - gSkinnedObjectFullbrightProgram.unload(); - gObjectFullbrightWaterProgram.unload(); - gSkinnedObjectFullbrightWaterProgram.unload(); - gObjectEmissiveProgram.unload(); - gSkinnedObjectEmissiveProgram.unload(); - gObjectEmissiveWaterProgram.unload(); - gSkinnedObjectEmissiveWaterProgram.unload(); - gObjectFullbrightAlphaMaskProgram.unload(); gSkinnedObjectFullbrightAlphaMaskProgram.unload(); - gObjectFullbrightWaterAlphaMaskProgram.unload(); - gSkinnedObjectFullbrightWaterAlphaMaskProgram.unload(); - - gObjectShinyProgram.unload(); - gSkinnedObjectShinyProgram.unload(); - gObjectFullbrightShinyProgram.unload(); - gSkinnedObjectFullbrightShinyProgram.unload(); - gObjectFullbrightShinyWaterProgram.unload(); - gSkinnedObjectFullbrightShinyWaterProgram.unload(); - gObjectShinyWaterProgram.unload(); - gSkinnedObjectShinyWaterProgram.unload(); - - gObjectSimpleNonIndexedTexGenProgram.unload(); - gObjectSimpleNonIndexedTexGenWaterProgram.unload(); - gObjectAlphaMaskNonIndexedProgram.unload(); - gObjectAlphaMaskNonIndexedWaterProgram.unload(); + gObjectAlphaMaskNoColorProgram.unload(); gObjectAlphaMaskNoColorWaterProgram.unload(); - gTreeProgram.unload(); - gTreeWaterProgram.unload(); - + gWaterProgram.unload(); gWaterEdgeProgram.unload(); gUnderWaterProgram.unload(); - gMoonProgram.unload(); - gStarsProgram.unload(); - gTerrainProgram.unload(); - gTerrainWaterProgram.unload(); gGlowProgram.unload(); gGlowExtractProgram.unload(); gAvatarProgram.unload(); gAvatarWaterProgram.unload(); gAvatarEyeballProgram.unload(); - gAvatarPickProgram.unload(); gHighlightProgram.unload(); gSkinnedHighlightProgram.unload(); gHighlightNormalProgram.unload(); gHighlightSpecularProgram.unload(); - gWLSkyProgram.unload(); - gWLCloudProgram.unload(); - gWLSunProgram.unload(); - gWLMoonProgram.unload(); - - gPostColorFilterProgram.unload(); - gPostNightVisionProgram.unload(); - gPostScreenSpaceReflectionProgram.unload(); + gPostScreenSpaceReflectionProgram.unload(); gDeferredDiffuseProgram.unload(); gDeferredDiffuseAlphaMaskProgram.unload(); @@ -919,29 +742,13 @@ std::string LLViewerShaderMgr::loadBasicShaders() index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/screenSpaceReflUtil.glsl", ssr ? 3 : 1) ); index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightShinyNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightShinyNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightShinyWaterNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightWaterF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightWaterAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterF.glsl", mShaderLevel[SHADER_LIGHTING] ) ); - + for (U32 i = 0; i < shaders.size(); i++) { // Note usage of GL_FRAGMENT_SHADER @@ -955,77 +762,6 @@ std::string LLViewerShaderMgr::loadBasicShaders() return std::string(); } -BOOL LLViewerShaderMgr::loadShadersEnvironment() -{ - LL_PROFILE_ZONE_SCOPED; -#if 1 // DEPRECATED -- forward rendering is deprecated - BOOL success = TRUE; - - if (mShaderLevel[SHADER_ENVIRONMENT] == 0) - { - gTerrainProgram.unload(); - return TRUE; - } - - if (success) - { - gTerrainProgram.mName = "Terrain Shader"; - gTerrainProgram.mFeatures.calculatesLighting = true; - gTerrainProgram.mFeatures.calculatesAtmospherics = true; - gTerrainProgram.mFeatures.hasAtmospherics = true; - gTerrainProgram.mFeatures.hasTransport = true; - gTerrainProgram.mFeatures.hasGamma = true; - gTerrainProgram.mFeatures.hasSrgb = true; - gTerrainProgram.mFeatures.mIndexedTextureChannels = 0; - gTerrainProgram.mFeatures.disableTextureIndex = true; - gTerrainProgram.mFeatures.hasGamma = true; - gTerrainProgram.mShaderFiles.clear(); - gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER)); - gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainF.glsl", GL_FRAGMENT_SHADER)); - gTerrainProgram.mShaderLevel = mShaderLevel[SHADER_ENVIRONMENT]; - success = gTerrainProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) - { - gStarsProgram.mName = "Environment Stars Shader"; - gStarsProgram.mShaderFiles.clear(); - gStarsProgram.mShaderFiles.push_back(make_pair("environment/starsV.glsl", GL_VERTEX_SHADER_ARB)); - gStarsProgram.mShaderFiles.push_back(make_pair("environment/starsF.glsl", GL_FRAGMENT_SHADER_ARB)); - gStarsProgram.mShaderLevel = mShaderLevel[SHADER_ENVIRONMENT]; - gStarsProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113 - success = gStarsProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) - { - gMoonProgram.mName = "Environment Moon Shader"; - gMoonProgram.mShaderFiles.clear(); - gMoonProgram.mShaderFiles.push_back(make_pair("environment/moonV.glsl", GL_VERTEX_SHADER_ARB)); - gMoonProgram.mShaderFiles.push_back(make_pair("environment/moonF.glsl", GL_FRAGMENT_SHADER_ARB)); - gMoonProgram.mShaderLevel = mShaderLevel[SHADER_ENVIRONMENT]; - gMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 - success = gMoonProgram.createShader(NULL, NULL); - if (success) - { - gMoonProgram.bind(); - gMoonProgram.uniform1i(sTex0, 0); - } - } - - if (!success) - { - mShaderLevel[SHADER_ENVIRONMENT] = 0; - return FALSE; - } - - LLWorld::getInstance()->updateWaterObjects(); -#endif - return TRUE; -} - BOOL LLViewerShaderMgr::loadShadersWater() { LL_PROFILE_ZONE_SCOPED; @@ -1038,7 +774,6 @@ BOOL LLViewerShaderMgr::loadShadersWater() gWaterProgram.unload(); gWaterEdgeProgram.unload(); gUnderWaterProgram.unload(); - gTerrainWaterProgram.unload(); return TRUE; } @@ -1113,33 +848,6 @@ BOOL LLViewerShaderMgr::loadShadersWater() llassert(success); } - if (success) - { - //load terrain water shader - gTerrainWaterProgram.mName = "Terrain Water Shader"; - gTerrainWaterProgram.mFeatures.calculatesLighting = true; - gTerrainWaterProgram.mFeatures.calculatesAtmospherics = true; - gTerrainWaterProgram.mFeatures.hasAtmospherics = true; - gTerrainWaterProgram.mFeatures.hasWaterFog = true; - gTerrainWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gTerrainWaterProgram.mFeatures.disableTextureIndex = true; - gTerrainWaterProgram.mShaderFiles.clear(); - gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterV.glsl", GL_VERTEX_SHADER)); - gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterF.glsl", GL_FRAGMENT_SHADER)); - gTerrainWaterProgram.mShaderLevel = mShaderLevel[SHADER_ENVIRONMENT]; - gTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - - gTerrainWaterProgram.clearPermutations(); - - if (LLPipeline::RenderDeferred) - { - gTerrainWaterProgram.addPermutation("ALM", "1"); - } - - terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, NULL); - llassert(terrainWaterSuccess); - } - /// Keep track of water shader levels if (gWaterProgram.mShaderLevel != mShaderLevel[SHADER_WATER] || gUnderWaterProgram.mShaderLevel != mShaderLevel[SHADER_WATER]) @@ -1176,8 +884,6 @@ BOOL LLViewerShaderMgr::loadShadersEffects() { gGlowProgram.unload(); gGlowExtractProgram.unload(); - gPostColorFilterProgram.unload(); - gPostNightVisionProgram.unload(); return TRUE; } @@ -1264,12 +970,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarProgram.unload(); gDeferredAvatarAlphaProgram.unload(); gDeferredAlphaProgram.unload(); + gHUDAlphaProgram.unload(); gDeferredSkinnedAlphaProgram.unload(); gDeferredAlphaWaterProgram.unload(); gDeferredSkinnedAlphaWaterProgram.unload(); gDeferredFullbrightProgram.unload(); + gHUDFullbrightProgram.unload(); gDeferredFullbrightAlphaMaskProgram.unload(); + gHUDFullbrightAlphaMaskProgram.unload(); gDeferredFullbrightAlphaMaskAlphaProgram.unload(); + gHUDFullbrightAlphaMaskAlphaProgram.unload(); gDeferredFullbrightWaterProgram.unload(); gDeferredSkinnedFullbrightWaterProgram.unload(); gDeferredFullbrightWaterAlphaProgram.unload(); @@ -1284,23 +994,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDoFCombineProgram.unload(); gDeferredPostGammaCorrectProgram.unload(); gFXAAProgram.unload(); - gDeferredWaterProgram.unload(); - gDeferredUnderWaterProgram.unload(); gDeferredWLSkyProgram.unload(); gDeferredWLCloudProgram.unload(); gDeferredWLSunProgram.unload(); gDeferredWLMoonProgram.unload(); gDeferredStarProgram.unload(); gDeferredFullbrightShinyProgram.unload(); + gHUDFullbrightShinyProgram.unload(); gDeferredSkinnedFullbrightShinyProgram.unload(); gDeferredSkinnedFullbrightProgram.unload(); gDeferredSkinnedFullbrightAlphaMaskProgram.unload(); gDeferredSkinnedFullbrightAlphaMaskAlphaProgram.unload(); gDeferredHighlightProgram.unload(); - gDeferredHighlightNormalProgram.unload(); - gDeferredHighlightSpecularProgram.unload(); - + gNormalMapGenProgram.unload(); gDeferredGenBrdfLutProgram.unload(); @@ -1310,6 +1017,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialWaterProgram[i].unload(); } + gHUDPBROpaqueProgram.unload(); + gPBRGlowProgram.unload(); gDeferredPBROpaqueProgram.unload(); gDeferredSkinnedPBROpaqueProgram.unload(); gDeferredPBRAlphaProgram.unload(); @@ -1332,26 +1041,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { - gDeferredHighlightNormalProgram.mName = "Deferred Highlight Normals Shader"; - gDeferredHighlightNormalProgram.mShaderFiles.clear(); - gDeferredHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER)); - gDeferredHighlightNormalProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER)); - gDeferredHighlightNormalProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gHighlightNormalProgram.createShader(NULL, NULL); - } - - if (success) - { - gDeferredHighlightSpecularProgram.mName = "Deferred Highlight Spec Shader"; - gDeferredHighlightSpecularProgram.mShaderFiles.clear(); - gDeferredHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER)); - gDeferredHighlightSpecularProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER)); - gDeferredHighlightSpecularProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gDeferredHighlightSpecularProgram.createShader(NULL, NULL); - } - - if (success) - { gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader"; gDeferredDiffuseProgram.mFeatures.encodesNormal = true; gDeferredDiffuseProgram.mFeatures.hasSrgb = true; @@ -1630,11 +1319,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueV.glsl", GL_VERTEX_SHADER)); gDeferredPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueF.glsl", GL_FRAGMENT_SHADER)); gDeferredPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - gDeferredPBROpaqueProgram.addPermutation("HAS_NORMAL_MAP", "1"); - gDeferredPBROpaqueProgram.addPermutation("HAS_SPECULAR_MAP", "1"); - gDeferredPBROpaqueProgram.addPermutation("HAS_EMISSIVE_MAP", "1"); - gDeferredPBROpaqueProgram.addPermutation("DIFFUSE_ALPHA_MODE", "0"); - + success = make_rigged_variant(gDeferredPBROpaqueProgram, gDeferredSkinnedPBROpaqueProgram); if (success) { @@ -1643,6 +1328,41 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gPBRGlowProgram.mName = " PBR Glow Shader"; + gPBRGlowProgram.mFeatures.hasSrgb = true; + gPBRGlowProgram.mShaderFiles.clear(); + gPBRGlowProgram.mShaderFiles.push_back(make_pair("deferred/pbrglowV.glsl", GL_VERTEX_SHADER)); + gPBRGlowProgram.mShaderFiles.push_back(make_pair("deferred/pbrglowF.glsl", GL_FRAGMENT_SHADER)); + gPBRGlowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + success = make_rigged_variant(gPBRGlowProgram, gPBRGlowSkinnedProgram); + if (success) + { + success = gPBRGlowProgram.createShader(NULL, NULL); + } + llassert(success); + } + + if (success) + { + gHUDPBROpaqueProgram.mName = "HUD PBR Opaque Shader"; + gHUDPBROpaqueProgram.mFeatures.hasSrgb = true; + gHUDPBROpaqueProgram.mShaderFiles.clear(); + gHUDPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueV.glsl", GL_VERTEX_SHADER)); + gHUDPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueF.glsl", GL_FRAGMENT_SHADER)); + gHUDPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gHUDPBROpaqueProgram.clearPermutations(); + gHUDPBROpaqueProgram.addPermutation("IS_HUD", "1"); + + success = gHUDPBROpaqueProgram.createShader(NULL, NULL); + + llassert(success); + } + + + if (success) { LLGLSLShader* shader = &gDeferredPBRAlphaProgram; @@ -1679,21 +1399,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("HAS_SUN_SHADOW", "1"); } - if (ambient_kill) - { - shader->addPermutation("AMBIENT_KILL", "1"); - } - - if (sunlight_kill) - { - shader->addPermutation("SUNLIGHT_KILL", "1"); - } - - if (local_light_kill) - { - shader->addPermutation("LOCAL_LIGHT_KILL", "1"); - } - shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(*shader, gDeferredSkinnedPBRAlphaProgram); if (success) @@ -1711,6 +1416,25 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() shader->mRiggedVariant->mFeatures.hasLighting = true; } + if (success) + { + LLGLSLShader* shader = &gHUDPBRAlphaProgram; + shader->mName = "HUD PBR Alpha Shader"; + + shader->mFeatures.hasSrgb = true; + + shader->mShaderFiles.clear(); + shader->mShaderFiles.push_back(make_pair("deferred/pbralphaV.glsl", GL_VERTEX_SHADER)); + shader->mShaderFiles.push_back(make_pair("deferred/pbralphaF.glsl", GL_FRAGMENT_SHADER)); + + shader->clearPermutations(); + + shader->addPermutation("IS_HUD", "1"); + + shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = shader->createShader(NULL, NULL); + llassert(success); + } if (success) { @@ -1909,8 +1633,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSunProgram.mFeatures.hasShadows = true; gDeferredSunProgram.mFeatures.hasAmbientOcclusion = use_ao; - gDeferredSunProgram.mName = "Deferred Sun Shader"; - gDeferredSunProgram.mShaderFiles.clear(); + gDeferredSunProgram.mShaderFiles.clear(); gDeferredSunProgram.mShaderFiles.push_back(make_pair(vertex, GL_VERTEX_SHADER)); gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER)); gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; @@ -1935,11 +1658,18 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { - for (int i = 0; i < 2 && success; ++i) + for (int i = 0; i < 3 && success; ++i) { LLGLSLShader* shader = nullptr; - bool rigged = i == 1; - if (!rigged) + bool rigged = (i == 1); + bool hud = (i == 2); + + if (hud) + { + shader = &gHUDAlphaProgram; + shader->mName = "HUD Alpha Shader"; + } + else if (!rigged) { shader = &gDeferredAlphaProgram; shader->mName = "Deferred Alpha Shader"; @@ -2000,6 +1730,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("HAS_SKIN", "1"); } + if (hud) + { + shader->addPermutation("IS_HUD", "1"); + } + shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = shader->createShader(NULL, NULL); @@ -2185,6 +1920,24 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gHUDFullbrightProgram.mName = "HUD Fullbright Shader"; + gHUDFullbrightProgram.mFeatures.calculatesAtmospherics = true; + gHUDFullbrightProgram.mFeatures.hasGamma = true; + gHUDFullbrightProgram.mFeatures.hasTransport = true; + gHUDFullbrightProgram.mFeatures.hasSrgb = true; + gHUDFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; + gHUDFullbrightProgram.mShaderFiles.clear(); + gHUDFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); + gHUDFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); + gHUDFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gHUDFullbrightProgram.clearPermutations(); + gHUDFullbrightProgram.addPermutation("IS_HUD", "1"); + success = gHUDFullbrightProgram.createShader(NULL, NULL); + llassert(success); + } + if (success) { gDeferredFullbrightAlphaMaskProgram.mName = "Deferred Fullbright Alpha Masking Shader"; @@ -2206,6 +1959,25 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { + gHUDFullbrightAlphaMaskProgram.mName = "HUD Fullbright Alpha Masking Shader"; + gHUDFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; + gHUDFullbrightAlphaMaskProgram.mFeatures.hasGamma = true; + gHUDFullbrightAlphaMaskProgram.mFeatures.hasTransport = true; + gHUDFullbrightAlphaMaskProgram.mFeatures.hasSrgb = true; + gHUDFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; + gHUDFullbrightAlphaMaskProgram.mShaderFiles.clear(); + gHUDFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); + gHUDFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); + gHUDFullbrightAlphaMaskProgram.clearPermutations(); + gHUDFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK", "1"); + gHUDFullbrightAlphaMaskProgram.addPermutation("IS_HUD", "1"); + gHUDFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gHUDFullbrightAlphaMaskProgram.createShader(NULL, NULL); + llassert(success); + } + + if (success) + { gDeferredFullbrightAlphaMaskAlphaProgram.mName = "Deferred Fullbright Alpha Masking Alpha Shader"; gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.calculatesAtmospherics = true; gDeferredFullbrightAlphaMaskAlphaProgram.mFeatures.hasGamma = true; @@ -2225,6 +1997,27 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gHUDFullbrightAlphaMaskAlphaProgram.mName = "HUD Fullbright Alpha Masking Alpha Shader"; + gHUDFullbrightAlphaMaskAlphaProgram.mFeatures.calculatesAtmospherics = true; + gHUDFullbrightAlphaMaskAlphaProgram.mFeatures.hasGamma = true; + gHUDFullbrightAlphaMaskAlphaProgram.mFeatures.hasTransport = true; + gHUDFullbrightAlphaMaskAlphaProgram.mFeatures.hasSrgb = true; + gHUDFullbrightAlphaMaskAlphaProgram.mFeatures.isDeferred = true; + gHUDFullbrightAlphaMaskAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; + gHUDFullbrightAlphaMaskAlphaProgram.mShaderFiles.clear(); + gHUDFullbrightAlphaMaskAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); + gHUDFullbrightAlphaMaskAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); + gHUDFullbrightAlphaMaskAlphaProgram.clearPermutations(); + gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1"); + gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1"); + gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_HUD", "1"); + gHUDFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = success && gHUDFullbrightAlphaMaskAlphaProgram.createShader(NULL, NULL); + llassert(success); + } + if (success) { gDeferredFullbrightWaterProgram.mName = "Deferred Fullbright Underwater Shader"; @@ -2308,6 +2101,26 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gHUDFullbrightShinyProgram.mName = "Deferred FullbrightShiny Shader"; + gHUDFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true; + gHUDFullbrightShinyProgram.mFeatures.hasAtmospherics = true; + gHUDFullbrightShinyProgram.mFeatures.hasGamma = true; + gHUDFullbrightShinyProgram.mFeatures.hasTransport = true; + gHUDFullbrightShinyProgram.mFeatures.hasSrgb = true; + gHUDFullbrightShinyProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; + gHUDFullbrightShinyProgram.mShaderFiles.clear(); + gHUDFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyV.glsl", GL_VERTEX_SHADER)); + gHUDFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER)); + gHUDFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gHUDFullbrightShinyProgram.mFeatures.hasReflectionProbes = true; + gHUDFullbrightShinyProgram.clearPermutations(); + gHUDFullbrightShinyProgram.addPermutation("IS_HUD", "1"); + success = gHUDFullbrightShinyProgram.createShader(NULL, NULL); + llassert(success); + } + if (success) { gDeferredEmissiveProgram.mName = "Deferred Emissive Shader"; @@ -2326,46 +2139,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { - // load water shader - gDeferredWaterProgram.mName = "Deferred Water Shader"; - gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true; - gDeferredWaterProgram.mFeatures.hasGamma = true; - gDeferredWaterProgram.mFeatures.hasTransport = true; - gDeferredWaterProgram.mFeatures.encodesNormal = true; - gDeferredWaterProgram.mFeatures.hasSrgb = true; - - gDeferredWaterProgram.mShaderFiles.clear(); - gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER)); - gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterF.glsl", GL_FRAGMENT_SHADER)); - gDeferredWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - gDeferredWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gDeferredWaterProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) - { - // load water shader - gDeferredUnderWaterProgram.mName = "Deferred Under Water Shader"; - gDeferredUnderWaterProgram.mFeatures.calculatesAtmospherics = true; - gDeferredUnderWaterProgram.mFeatures.hasWaterFog = true; - gDeferredUnderWaterProgram.mFeatures.hasGamma = true; - gDeferredUnderWaterProgram.mFeatures.hasTransport = true; - gDeferredUnderWaterProgram.mFeatures.hasSrgb = true; - gDeferredUnderWaterProgram.mFeatures.encodesNormal = true; - //gDeferredUnderWaterProgram.mFeatures.hasShadows = true; - - gDeferredUnderWaterProgram.mShaderFiles.clear(); - gDeferredUnderWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER)); - gDeferredUnderWaterProgram.mShaderFiles.push_back(make_pair("deferred/underWaterF.glsl", GL_FRAGMENT_SHADER)); - gDeferredUnderWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - gDeferredUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gDeferredUnderWaterProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) - { gDeferredSoftenProgram.mName = "Deferred Soften Shader"; gDeferredSoftenProgram.mShaderFiles.clear(); gDeferredSoftenProgram.mFeatures.hasSrgb = true; @@ -2852,7 +2625,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSunProgram.mFeatures.hasTransport = true; gDeferredWLSunProgram.mFeatures.hasGamma = true; gDeferredWLSunProgram.mFeatures.hasAtmospherics = true; - gDeferredWLSunProgram.mFeatures.isFullbright = true; gDeferredWLSunProgram.mFeatures.disableTextureIndex = true; gDeferredWLSunProgram.mFeatures.hasSrgb = true; gDeferredWLSunProgram.mShaderFiles.clear(); @@ -2872,7 +2644,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLMoonProgram.mFeatures.hasGamma = true; gDeferredWLMoonProgram.mFeatures.hasAtmospherics = true; gDeferredWLMoonProgram.mFeatures.hasSrgb = true; - gDeferredWLMoonProgram.mFeatures.isFullbright = true; gDeferredWLMoonProgram.mFeatures.disableTextureIndex = true; gDeferredWLMoonProgram.mShaderFiles.clear(); @@ -2961,129 +2732,6 @@ BOOL LLViewerShaderMgr::loadShadersObject() } } - if (success) - { - gObjectSimpleProgram.mName = "Simple Shader"; - gObjectSimpleProgram.mFeatures.calculatesLighting = true; - gObjectSimpleProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleProgram.mFeatures.hasGamma = true; - gObjectSimpleProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleProgram.mFeatures.hasLighting = true; - gObjectSimpleProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectSimpleProgram.mShaderFiles.clear(); - gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectSimpleProgram, gSkinnedObjectSimpleProgram); - success = success && gObjectSimpleProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightProgram.mName = "Fullbright Shader"; - gObjectFullbrightProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightProgram.mFeatures.hasGamma = true; - gObjectFullbrightProgram.mFeatures.hasTransport = true; - gObjectFullbrightProgram.mFeatures.isFullbright = true; - gObjectFullbrightProgram.mFeatures.hasSrgb = true; - gObjectFullbrightProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectFullbrightProgram.mShaderFiles.clear(); - gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectFullbrightProgram, gSkinnedObjectFullbrightProgram); - success = success && gObjectFullbrightProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightShinyWaterProgram.mName = "Fullbright Shiny Water Shader"; - gObjectFullbrightShinyWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightShinyWaterProgram.mFeatures.isFullbright = true; - gObjectFullbrightShinyWaterProgram.mFeatures.isShiny = true; - gObjectFullbrightShinyWaterProgram.mFeatures.hasGamma = true; - gObjectFullbrightShinyWaterProgram.mFeatures.hasTransport = true; - gObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true; - gObjectFullbrightShinyWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectFullbrightShinyWaterProgram.mShaderFiles.clear(); - gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightShinyWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = make_rigged_variant(gObjectFullbrightShinyWaterProgram, gSkinnedObjectFullbrightShinyWaterProgram); - success = success && gObjectFullbrightShinyWaterProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectSimpleNonIndexedTexGenProgram.mName = "Non indexed tex-gen Shader"; - gObjectSimpleNonIndexedTexGenProgram.mFeatures.calculatesLighting = true; - gObjectSimpleNonIndexedTexGenProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleNonIndexedTexGenProgram.mFeatures.hasGamma = true; - gObjectSimpleNonIndexedTexGenProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleNonIndexedTexGenProgram.mFeatures.hasLighting = true; - gObjectSimpleNonIndexedTexGenProgram.mFeatures.disableTextureIndex = true; - gObjectSimpleNonIndexedTexGenProgram.mShaderFiles.clear(); - gObjectSimpleNonIndexedTexGenProgram.mShaderFiles.push_back(make_pair("objects/simpleTexGenV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleNonIndexedTexGenProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleNonIndexedTexGenProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gObjectSimpleNonIndexedTexGenProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectSimpleNonIndexedTexGenWaterProgram.mName = "Non indexed tex-gen Water Shader"; - gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.calculatesLighting = true; - gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.hasWaterFog = true; - gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.hasLighting = true; - gObjectSimpleNonIndexedTexGenWaterProgram.mFeatures.disableTextureIndex = true; - gObjectSimpleNonIndexedTexGenWaterProgram.mShaderFiles.clear(); - gObjectSimpleNonIndexedTexGenWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleTexGenV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleNonIndexedTexGenWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleNonIndexedTexGenWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectSimpleNonIndexedTexGenWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectSimpleNonIndexedTexGenWaterProgram.createShader(NULL, NULL); - } - -#if 1 // DEPRECATED -- forward rendering is deprecated - - if (success) - { - gObjectAlphaMaskNonIndexedProgram.mName = "Non indexed alpha mask Shader"; - gObjectAlphaMaskNonIndexedProgram.mFeatures.calculatesLighting = true; - gObjectAlphaMaskNonIndexedProgram.mFeatures.calculatesAtmospherics = true; - gObjectAlphaMaskNonIndexedProgram.mFeatures.hasGamma = true; - gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAtmospherics = true; - gObjectAlphaMaskNonIndexedProgram.mFeatures.hasLighting = true; - gObjectAlphaMaskNonIndexedProgram.mFeatures.disableTextureIndex = true; - gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAlphaMask = true; - gObjectAlphaMaskNonIndexedProgram.mShaderFiles.clear(); - gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER)); - gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); - gObjectAlphaMaskNonIndexedProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gObjectAlphaMaskNonIndexedProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectAlphaMaskNonIndexedWaterProgram.mName = "Non indexed alpha mask Water Shader"; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.calculatesLighting = true; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasWaterFog = true; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAtmospherics = true; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasLighting = true; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; - gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAlphaMask = true; - gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.clear(); - gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER)); - gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectAlphaMaskNonIndexedWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectAlphaMaskNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectAlphaMaskNonIndexedWaterProgram.createShader(NULL, NULL); - } - if (success) { gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader"; @@ -3121,73 +2769,6 @@ BOOL LLViewerShaderMgr::loadShadersObject() if (success) { - gTreeProgram.mName = "Tree Shader"; - gTreeProgram.mFeatures.calculatesLighting = true; - gTreeProgram.mFeatures.calculatesAtmospherics = true; - gTreeProgram.mFeatures.hasGamma = true; - gTreeProgram.mFeatures.hasAtmospherics = true; - gTreeProgram.mFeatures.hasLighting = true; - gTreeProgram.mFeatures.disableTextureIndex = true; - gTreeProgram.mFeatures.hasAlphaMask = true; - gTreeProgram.mShaderFiles.clear(); - gTreeProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER)); - gTreeProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); - gTreeProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gTreeProgram.createShader(NULL, NULL); - } - - if (success) - { - gTreeWaterProgram.mName = "Tree Water Shader"; - gTreeWaterProgram.mFeatures.calculatesLighting = true; - gTreeWaterProgram.mFeatures.calculatesAtmospherics = true; - gTreeWaterProgram.mFeatures.hasWaterFog = true; - gTreeWaterProgram.mFeatures.hasAtmospherics = true; - gTreeWaterProgram.mFeatures.hasLighting = true; - gTreeWaterProgram.mFeatures.disableTextureIndex = true; - gTreeWaterProgram.mFeatures.hasAlphaMask = true; - gTreeWaterProgram.mShaderFiles.clear(); - gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER)); - gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER)); - gTreeWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gTreeWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gTreeWaterProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightNoColorProgram.mName = "Non Indexed no color Fullbright Shader"; - gObjectFullbrightNoColorProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightNoColorProgram.mFeatures.hasGamma = true; - gObjectFullbrightNoColorProgram.mFeatures.hasTransport = true; - gObjectFullbrightNoColorProgram.mFeatures.isFullbright = true; - gObjectFullbrightNoColorProgram.mFeatures.hasSrgb = true; - gObjectFullbrightNoColorProgram.mFeatures.disableTextureIndex = true; - gObjectFullbrightNoColorProgram.mShaderFiles.clear(); - gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightNoColorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = gObjectFullbrightNoColorProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightNoColorWaterProgram.mName = "Non Indexed no color Fullbright Water Shader"; - gObjectFullbrightNoColorWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightNoColorWaterProgram.mFeatures.isFullbright = true; - gObjectFullbrightNoColorWaterProgram.mFeatures.hasWaterFog = true; - gObjectFullbrightNoColorWaterProgram.mFeatures.hasTransport = true; - gObjectFullbrightNoColorWaterProgram.mFeatures.disableTextureIndex = true; - gObjectFullbrightNoColorWaterProgram.mShaderFiles.clear(); - gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightNoColorWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectFullbrightNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectFullbrightNoColorWaterProgram.createShader(NULL, NULL); - } - - if (success) - { gImpostorProgram.mName = "Impostor Shader"; gImpostorProgram.mFeatures.disableTextureIndex = true; gImpostorProgram.mFeatures.hasSrgb = true; @@ -3234,223 +2815,6 @@ BOOL LLViewerShaderMgr::loadShadersObject() gPhysicsPreviewProgram.mFeatures.hasLighting = false; } - if (success) - { - gObjectSimpleImpostorProgram.mName = "Simple Impostor Shader"; - gObjectSimpleImpostorProgram.mFeatures.calculatesLighting = true; - gObjectSimpleImpostorProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleImpostorProgram.mFeatures.hasGamma = true; - gObjectSimpleImpostorProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleImpostorProgram.mFeatures.hasLighting = true; - gObjectSimpleImpostorProgram.mFeatures.mIndexedTextureChannels = 0; - // force alpha mask version of lighting so we can weed out - // transparent pixels from impostor temp buffer - // - gObjectSimpleImpostorProgram.mFeatures.hasAlphaMask = true; - gObjectSimpleImpostorProgram.mShaderFiles.clear(); - gObjectSimpleImpostorProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleImpostorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleImpostorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectSimpleImpostorProgram, gSkinnedObjectSimpleImpostorProgram); - success = success && gObjectSimpleImpostorProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectSimpleWaterProgram.mName = "Simple Water Shader"; - gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true; - gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true; - gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleWaterProgram.mFeatures.hasLighting = true; - gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectSimpleWaterProgram.mShaderFiles.clear(); - gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - make_rigged_variant(gObjectSimpleWaterProgram, gSkinnedObjectSimpleWaterProgram); - success = gObjectSimpleWaterProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader"; - gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true; - gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true; - gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectSimpleAlphaMaskProgram.mShaderFiles.clear(); - gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectSimpleAlphaMaskProgram, gSkinnedObjectSimpleAlphaMaskProgram); - success = success && gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectSimpleWaterAlphaMaskProgram.mName = "Simple Water Alpha Mask Shader"; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.calculatesLighting = true; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasWaterFog = true; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasLighting = true; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasAlphaMask = true; - gObjectSimpleWaterAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectSimpleWaterAlphaMaskProgram.mShaderFiles.clear(); - gObjectSimpleWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER)); - gObjectSimpleWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectSimpleWaterAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectSimpleWaterAlphaMaskProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = make_rigged_variant(gObjectSimpleWaterAlphaMaskProgram, gSkinnedObjectSimpleWaterAlphaMaskProgram); - success = success && gObjectSimpleWaterAlphaMaskProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightWaterProgram.mName = "Fullbright Water Shader"; - gObjectFullbrightWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightWaterProgram.mFeatures.isFullbright = true; - gObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true; - gObjectFullbrightWaterProgram.mFeatures.hasTransport = true; - gObjectFullbrightWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectFullbrightWaterProgram.mShaderFiles.clear(); - gObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = make_rigged_variant(gObjectFullbrightWaterProgram, gSkinnedObjectFullbrightWaterProgram); - success = success && gObjectFullbrightWaterProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectEmissiveProgram.mName = "Emissive Shader"; - gObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true; - gObjectEmissiveProgram.mFeatures.hasGamma = true; - gObjectEmissiveProgram.mFeatures.hasTransport = true; - gObjectEmissiveProgram.mFeatures.isFullbright = true; - gObjectEmissiveProgram.mFeatures.hasSrgb = true; - gObjectEmissiveProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectEmissiveProgram.mShaderFiles.clear(); - gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER)); - gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER)); - gObjectEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectEmissiveProgram, gSkinnedObjectEmissiveProgram); - success = success && gObjectEmissiveProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectEmissiveWaterProgram.mName = "Emissive Water Shader"; - gObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectEmissiveWaterProgram.mFeatures.isFullbright = true; - gObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true; - gObjectEmissiveWaterProgram.mFeatures.hasTransport = true; - gObjectEmissiveWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectEmissiveWaterProgram.mShaderFiles.clear(); - gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER)); - gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectEmissiveWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectEmissiveWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = make_rigged_variant(gObjectEmissiveWaterProgram, gSkinnedObjectEmissiveWaterProgram); - success = success && gObjectEmissiveWaterProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightAlphaMaskProgram.mName = "Fullbright Alpha Mask Shader"; - gObjectFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightAlphaMaskProgram.mFeatures.hasGamma = true; - gObjectFullbrightAlphaMaskProgram.mFeatures.hasTransport = true; - gObjectFullbrightAlphaMaskProgram.mFeatures.isFullbright = true; - gObjectFullbrightAlphaMaskProgram.mFeatures.hasAlphaMask = true; - gObjectFullbrightAlphaMaskProgram.mFeatures.hasSrgb = true; - gObjectFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectFullbrightAlphaMaskProgram.mShaderFiles.clear(); - gObjectFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectFullbrightAlphaMaskProgram, gSkinnedObjectFullbrightAlphaMaskProgram); - success = success && gObjectFullbrightAlphaMaskProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightWaterAlphaMaskProgram.mName = "Fullbright Water Alpha Mask Shader"; - gObjectFullbrightWaterAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightWaterAlphaMaskProgram.mFeatures.isFullbright = true; - gObjectFullbrightWaterAlphaMaskProgram.mFeatures.hasWaterFog = true; - gObjectFullbrightWaterAlphaMaskProgram.mFeatures.hasTransport = true; - gObjectFullbrightWaterAlphaMaskProgram.mFeatures.hasAlphaMask = true; - gObjectFullbrightWaterAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectFullbrightWaterAlphaMaskProgram.mShaderFiles.clear(); - gObjectFullbrightWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightWaterAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectFullbrightWaterAlphaMaskProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = make_rigged_variant(gObjectFullbrightWaterAlphaMaskProgram, gSkinnedObjectFullbrightWaterAlphaMaskProgram); - success = success && gObjectFullbrightWaterAlphaMaskProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectShinyProgram.mName = "Shiny Shader"; - gObjectShinyProgram.mFeatures.calculatesAtmospherics = true; - gObjectShinyProgram.mFeatures.calculatesLighting = true; - gObjectShinyProgram.mFeatures.hasGamma = true; - gObjectShinyProgram.mFeatures.hasAtmospherics = true; - gObjectShinyProgram.mFeatures.isShiny = true; - gObjectShinyProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectShinyProgram.mShaderFiles.clear(); - gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER)); - gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER)); - gObjectShinyProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectShinyProgram, gSkinnedObjectShinyProgram); - success = success && gObjectShinyProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectShinyWaterProgram.mName = "Shiny Water Shader"; - gObjectShinyWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectShinyWaterProgram.mFeatures.calculatesLighting = true; - gObjectShinyWaterProgram.mFeatures.isShiny = true; - gObjectShinyWaterProgram.mFeatures.hasWaterFog = true; - gObjectShinyWaterProgram.mFeatures.hasAtmospherics = true; - gObjectShinyWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectShinyWaterProgram.mShaderFiles.clear(); - gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER)); - gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER)); - gObjectShinyWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = make_rigged_variant(gObjectShinyWaterProgram, gSkinnedObjectShinyWaterProgram); - success = success && gObjectShinyWaterProgram.createShader(NULL, NULL); - } - - if (success) - { - gObjectFullbrightShinyProgram.mName = "Fullbright Shiny Shader"; - gObjectFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true; - gObjectFullbrightShinyProgram.mFeatures.isFullbright = true; - gObjectFullbrightShinyProgram.mFeatures.isShiny = true; - gObjectFullbrightShinyProgram.mFeatures.hasGamma = true; - gObjectFullbrightShinyProgram.mFeatures.hasTransport = true; - gObjectFullbrightShinyProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectFullbrightShinyProgram.mShaderFiles.clear(); - gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER)); - gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER)); - gObjectFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; - success = make_rigged_variant(gObjectFullbrightShinyProgram, gSkinnedObjectFullbrightShinyProgram); - success = success && gObjectFullbrightShinyProgram.createShader(NULL, NULL); - } - -#endif - if (!success) { mShaderLevel[SHADER_OBJECT] = 0; @@ -3471,7 +2835,6 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarProgram.unload(); gAvatarWaterProgram.unload(); gAvatarEyeballProgram.unload(); - gAvatarPickProgram.unload(); return TRUE; } @@ -3521,18 +2884,6 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() if (success) { - gAvatarPickProgram.mName = "Avatar Pick Shader"; - gAvatarPickProgram.mFeatures.hasSkinning = true; - gAvatarPickProgram.mFeatures.disableTextureIndex = true; - gAvatarPickProgram.mShaderFiles.clear(); - gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER)); - gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER)); - gAvatarPickProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR]; - success = gAvatarPickProgram.createShader(NULL, NULL); - } - - if (success) - { gAvatarEyeballProgram.mName = "Avatar Eyeball Program"; gAvatarEyeballProgram.mFeatures.calculatesLighting = true; gAvatarEyeballProgram.mFeatures.isSpecular = true; @@ -3627,32 +2978,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { - gCustomAlphaProgram.mName = "Custom Alpha Shader"; - gCustomAlphaProgram.mShaderFiles.clear(); - gCustomAlphaProgram.mShaderFiles.push_back(make_pair("interface/customalphaV.glsl", GL_VERTEX_SHADER)); - gCustomAlphaProgram.mShaderFiles.push_back(make_pair("interface/customalphaF.glsl", GL_FRAGMENT_SHADER)); - gCustomAlphaProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gCustomAlphaProgram.createShader(NULL, NULL); - } - - if (success) - { - gSplatTextureRectProgram.mName = "Splat Texture Rect Shader"; - gSplatTextureRectProgram.mShaderFiles.clear(); - gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER)); - gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectF.glsl", GL_FRAGMENT_SHADER)); - gSplatTextureRectProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gSplatTextureRectProgram.createShader(NULL, NULL); - if (success) - { - gSplatTextureRectProgram.bind(); - gSplatTextureRectProgram.uniform1i(sScreenMap, 0); - gSplatTextureRectProgram.unbind(); - } - } - - if (success) - { gGlowCombineProgram.mName = "Glow Combine Shader"; gGlowCombineProgram.mShaderFiles.clear(); gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineV.glsl", GL_VERTEX_SHADER)); @@ -3685,22 +3010,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() } } - if (success) - { - gTwoTextureAddProgram.mName = "Two Texture Add Shader"; - gTwoTextureAddProgram.mShaderFiles.clear(); - gTwoTextureAddProgram.mShaderFiles.push_back(make_pair("interface/twotextureaddV.glsl", GL_VERTEX_SHADER)); - gTwoTextureAddProgram.mShaderFiles.push_back(make_pair("interface/twotextureaddF.glsl", GL_FRAGMENT_SHADER)); - gTwoTextureAddProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gTwoTextureAddProgram.createShader(NULL, NULL); - if (success) - { - gTwoTextureAddProgram.bind(); - gTwoTextureAddProgram.uniform1i(sTex0, 0); - gTwoTextureAddProgram.uniform1i(sTex1, 1); - } - } - #ifdef LL_WINDOWS if (success) { @@ -3737,21 +3046,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { - gOneTextureNoColorProgram.mName = "One Texture No Color Shader"; - gOneTextureNoColorProgram.mShaderFiles.clear(); - gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER)); - gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorF.glsl", GL_FRAGMENT_SHADER)); - gOneTextureNoColorProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gOneTextureNoColorProgram.createShader(NULL, NULL); - if (success) - { - gOneTextureNoColorProgram.bind(); - gOneTextureNoColorProgram.uniform1i(sTex0, 0); - } - } - - if (success) - { gSolidColorProgram.mName = "Solid Color Shader"; gSolidColorProgram.mShaderFiles.clear(); gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER)); @@ -3822,16 +3116,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { - gDownsampleDepthProgram.mName = "DownsampleDepth Shader"; - gDownsampleDepthProgram.mShaderFiles.clear(); - gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER)); - gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthF.glsl", GL_FRAGMENT_SHADER)); - gDownsampleDepthProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gDownsampleDepthProgram.createShader(NULL, NULL); - } - - if (success) - { gBenchmarkProgram.mName = "Benchmark Shader"; gBenchmarkProgram.mShaderFiles.clear(); gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER)); @@ -3881,16 +3165,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { - gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader"; - gDownsampleDepthRectProgram.mShaderFiles.clear(); - gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER)); - gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER)); - gDownsampleDepthRectProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; - success = gDownsampleDepthRectProgram.createShader(NULL, NULL); - } - - if (success) - { gAlphaMaskProgram.mName = "Alpha Mask Shader"; gAlphaMaskProgram.mShaderFiles.clear(); gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER)); @@ -3948,90 +3222,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() return TRUE; } -BOOL LLViewerShaderMgr::loadShadersWindLight() -{ - LL_PROFILE_ZONE_SCOPED; - BOOL success = TRUE; -#if 1 // DEPRECATED -- forward rendering is deprecated - if (mShaderLevel[SHADER_WINDLIGHT] < 2) - { - gWLSkyProgram.unload(); - gWLCloudProgram.unload(); - gWLSunProgram.unload(); - gWLMoonProgram.unload(); - return TRUE; - } - - if (success) - { - gWLSkyProgram.mName = "Windlight Sky Shader"; - gWLSkyProgram.mShaderFiles.clear(); - gWLSkyProgram.mFeatures.calculatesAtmospherics = true; - gWLSkyProgram.mFeatures.hasTransport = true; - gWLSkyProgram.mFeatures.hasGamma = true; - gWLSkyProgram.mFeatures.hasSrgb = true; - gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyV.glsl", GL_VERTEX_SHADER)); - gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER)); - gWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; - gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gWLSkyProgram.createShader(NULL, NULL); - } - - if (success) - { - gWLCloudProgram.mName = "Windlight Cloud Program"; - gWLCloudProgram.mShaderFiles.clear(); - gWLCloudProgram.mFeatures.calculatesAtmospherics = true; - gWLCloudProgram.mFeatures.hasTransport = true; - gWLCloudProgram.mFeatures.hasGamma = true; - gWLCloudProgram.mFeatures.hasSrgb = true; - gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsV.glsl", GL_VERTEX_SHADER)); - gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER)); - gWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; - gWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; - gWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 - success = gWLCloudProgram.createShader(NULL, NULL); - } - - if (success) - { - gWLSunProgram.mName = "Windlight Sun Program"; - gWLSunProgram.mShaderFiles.clear(); - gWLSunProgram.mFeatures.calculatesAtmospherics = true; - gWLSunProgram.mFeatures.hasTransport = true; - gWLSunProgram.mFeatures.hasGamma = true; - gWLSunProgram.mFeatures.hasAtmospherics = true; - gWLSunProgram.mFeatures.isFullbright = true; - gWLSunProgram.mFeatures.disableTextureIndex = true; - gWLSunProgram.mShaderGroup = LLGLSLShader::SG_SKY; - gWLSunProgram.mShaderFiles.push_back(make_pair("windlight/sunDiscV.glsl", GL_VERTEX_SHADER)); - gWLSunProgram.mShaderFiles.push_back(make_pair("windlight/sunDiscF.glsl", GL_FRAGMENT_SHADER)); - gWLSunProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; - gWLSunProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gWLSunProgram.createShader(NULL, NULL); - } - - if (success) - { - gWLMoonProgram.mName = "Windlight Moon Program"; - gWLMoonProgram.mShaderFiles.clear(); - gWLMoonProgram.mFeatures.calculatesAtmospherics = true; - gWLMoonProgram.mFeatures.hasTransport = true; - gWLMoonProgram.mFeatures.hasGamma = true; - gWLMoonProgram.mFeatures.hasAtmospherics = true; - gWLMoonProgram.mFeatures.isFullbright = true; - gWLMoonProgram.mFeatures.disableTextureIndex = true; - gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY; - gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonV.glsl", GL_VERTEX_SHADER)); - gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonF.glsl", GL_FRAGMENT_SHADER)); - gWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; - gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY; - gWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 - success = gWLMoonProgram.createShader(NULL, NULL); - } -#endif - return success; -} std::string LLViewerShaderMgr::getShaderDirPrefix(void) { diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 593a8c14f3..9bd01dbdf5 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -58,10 +58,8 @@ public: BOOL loadShadersDeferred(); BOOL loadShadersObject(); BOOL loadShadersAvatar(); - BOOL loadShadersEnvironment(); BOOL loadShadersWater(); BOOL loadShadersInterface(); - BOOL loadShadersWindLight(); std::vector<S32> mShaderLevel; S32 mMaxAvatarShaderLevel; @@ -151,73 +149,34 @@ extern LLVector4 gShinyOrigin; //utility shaders extern LLGLSLShader gOcclusionProgram; extern LLGLSLShader gOcclusionCubeProgram; -extern LLGLSLShader gCustomAlphaProgram; extern LLGLSLShader gGlowCombineProgram; -extern LLGLSLShader gSplatTextureRectProgram; extern LLGLSLShader gReflectionMipProgram; extern LLGLSLShader gRadianceGenProgram; extern LLGLSLShader gIrradianceGenProgram; extern LLGLSLShader gGlowCombineFXAAProgram; extern LLGLSLShader gDebugProgram; extern LLGLSLShader gClipProgram; -extern LLGLSLShader gDownsampleDepthProgram; -extern LLGLSLShader gDownsampleDepthRectProgram; extern LLGLSLShader gBenchmarkProgram; extern LLGLSLShader gReflectionProbeDisplayProgram; extern LLGLSLShader gCopyProgram; extern LLGLSLShader gCopyDepthProgram; -//output tex0[tc0] + tex1[tc1] -extern LLGLSLShader gTwoTextureAddProgram; //output tex0[tc0] - tex1[tc1] extern LLGLSLShader gTwoTextureCompareProgram; //discard some fragments based on user-set color tolerance extern LLGLSLShader gOneTextureFilterProgram; -extern LLGLSLShader gOneTextureNoColorProgram; //object shaders -extern LLGLSLShader gObjectSimpleProgram; -extern LLGLSLShader gObjectSimpleImpostorProgram; -extern LLGLSLShader gObjectPreviewProgram; -extern LLGLSLShader gPhysicsPreviewProgram; -extern LLGLSLShader gObjectSimpleAlphaMaskProgram; -extern LLGLSLShader gObjectSimpleWaterProgram; -extern LLGLSLShader gObjectSimpleWaterAlphaMaskProgram; -extern LLGLSLShader gObjectSimpleNonIndexedTexGenProgram; -extern LLGLSLShader gObjectSimpleNonIndexedTexGenWaterProgram; -extern LLGLSLShader gObjectAlphaMaskNonIndexedProgram; -extern LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram; -extern LLGLSLShader gObjectAlphaMaskNoColorProgram; -extern LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; -extern LLGLSLShader gObjectFullbrightProgram; -extern LLGLSLShader gObjectFullbrightWaterProgram; -extern LLGLSLShader gObjectFullbrightNoColorProgram; -extern LLGLSLShader gObjectFullbrightNoColorWaterProgram; -extern LLGLSLShader gObjectEmissiveProgram; -extern LLGLSLShader gObjectEmissiveWaterProgram; -extern LLGLSLShader gObjectFullbrightAlphaMaskProgram; -extern LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram; -extern LLGLSLShader gObjectEmissiveNonIndexedProgram; -extern LLGLSLShader gObjectEmissiveNonIndexedWaterProgram; -extern LLGLSLShader gObjectBumpProgram; -extern LLGLSLShader gTreeProgram; -extern LLGLSLShader gTreeWaterProgram; - -extern LLGLSLShader gObjectSimpleLODProgram; -extern LLGLSLShader gObjectFullbrightLODProgram; - -extern LLGLSLShader gObjectFullbrightShinyProgram; -extern LLGLSLShader gObjectFullbrightShinyWaterProgram; - -extern LLGLSLShader gObjectShinyProgram; -extern LLGLSLShader gObjectShinyWaterProgram; +extern LLGLSLShader gObjectPreviewProgram; +extern LLGLSLShader gPhysicsPreviewProgram; +extern LLGLSLShader gSkinnedObjectFullbrightAlphaMaskProgram; +extern LLGLSLShader gObjectBumpProgram; +extern LLGLSLShader gSkinnedObjectBumpProgram; +extern LLGLSLShader gObjectAlphaMaskNoColorProgram; +extern LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; //environment shaders -extern LLGLSLShader gMoonProgram; -extern LLGLSLShader gStarsProgram; -extern LLGLSLShader gTerrainProgram; -extern LLGLSLShader gTerrainWaterProgram; extern LLGLSLShader gWaterProgram; extern LLGLSLShader gWaterEdgeProgram; extern LLGLSLShader gUnderWaterProgram; @@ -230,8 +189,6 @@ extern LLGLSLShader gHighlightNormalProgram; extern LLGLSLShader gHighlightSpecularProgram; extern LLGLSLShader gDeferredHighlightProgram; -extern LLGLSLShader gDeferredHighlightNormalProgram; -extern LLGLSLShader gDeferredHighlightSpecularProgram; extern LLGLSLShader gPathfindingProgram; extern LLGLSLShader gPathfindingNoNormalsProgram; @@ -240,24 +197,13 @@ extern LLGLSLShader gPathfindingNoNormalsProgram; extern LLGLSLShader gAvatarProgram; extern LLGLSLShader gAvatarWaterProgram; extern LLGLSLShader gAvatarEyeballProgram; -extern LLGLSLShader gAvatarPickProgram; extern LLGLSLShader gImpostorProgram; -// WindLight shader handles -extern LLGLSLShader gWLSkyProgram; -extern LLGLSLShader gWLCloudProgram; -extern LLGLSLShader gWLSunProgram; -extern LLGLSLShader gWLMoonProgram; - // Post Process Shaders -extern LLGLSLShader gPostColorFilterProgram; -extern LLGLSLShader gPostNightVisionProgram; extern LLGLSLShader gPostScreenSpaceReflectionProgram; // Deferred rendering shaders extern LLGLSLShader gDeferredImpostorProgram; -extern LLGLSLShader gDeferredWaterProgram; -extern LLGLSLShader gDeferredUnderWaterProgram; extern LLGLSLShader gDeferredDiffuseProgram; extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram; extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram; @@ -292,10 +238,14 @@ extern LLGLSLShader gDeferredAvatarShadowProgram; extern LLGLSLShader gDeferredAvatarAlphaShadowProgram; extern LLGLSLShader gDeferredAvatarAlphaMaskShadowProgram; extern LLGLSLShader gDeferredAlphaProgram; +extern LLGLSLShader gHUDAlphaProgram; extern LLGLSLShader gDeferredAlphaImpostorProgram; extern LLGLSLShader gDeferredFullbrightProgram; +extern LLGLSLShader gHUDFullbrightProgram; extern LLGLSLShader gDeferredFullbrightAlphaMaskProgram; +extern LLGLSLShader gHUDFullbrightAlphaMaskProgram; extern LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram; +extern LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram; extern LLGLSLShader gDeferredAlphaWaterProgram; extern LLGLSLShader gDeferredFullbrightWaterProgram; extern LLGLSLShader gDeferredFullbrightWaterAlphaProgram; @@ -309,6 +259,7 @@ extern LLGLSLShader gDeferredWLSunProgram; extern LLGLSLShader gDeferredWLMoonProgram; extern LLGLSLShader gDeferredStarProgram; extern LLGLSLShader gDeferredFullbrightShinyProgram; +extern LLGLSLShader gHUDFullbrightShinyProgram; extern LLGLSLShader gNormalMapGenProgram; extern LLGLSLShader gDeferredGenBrdfLutProgram; @@ -316,6 +267,9 @@ extern LLGLSLShader gDeferredGenBrdfLutProgram; extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; extern LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2]; +extern LLGLSLShader gHUDPBROpaqueProgram; +extern LLGLSLShader gPBRGlowProgram; extern LLGLSLShader gDeferredPBROpaqueProgram; extern LLGLSLShader gDeferredPBRAlphaProgram; +extern LLGLSLShader gHUDPBRAlphaProgram; #endif diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 3f302d4f45..1353eea2f2 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1278,7 +1278,6 @@ bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD& S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if( 0 == option ) { - LLUUID item_id = notification["payload"]["item_id"].asUUID(); llwchar wc = llwchar(notification["payload"]["item_wc"].asInteger()); LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItemPtr(wc); if (itemp) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 721498572f..578deb8b3f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1904,18 +1904,12 @@ bool LLViewerFetchedTexture::updateFetch() { mIsFetching = FALSE; mLastFetchState = -1; - setDebugText(""); mLastPacketTimer.reset(); } else { mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP); - /*if (mFetchState != mLastFetchState) - { - setDebugText(LLTextureFetch::getStateString(mFetchState)); - mLastFetchState = mFetchState; - }*/ } // We may have data ready regardless of whether or not we are finished (e.g. waiting on write) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 20b5f7f394..5c1467f28f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1255,7 +1255,6 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi TRUE /* pick_transparent */, FALSE /* pick_rigged */); - LLUUID object_id = pick_info.getObjectID(); S32 object_face = pick_info.mObjectFace; std::string url = data; @@ -3380,6 +3379,59 @@ void LLViewerWindow::updateUI() root_view = mRootView; } + static LLCachedControl<bool> dump_menu_holder(gSavedSettings, "DumpMenuHolderSize", false); + if (dump_menu_holder) + { + static bool init = false; + static LLFrameTimer child_count_timer; + static std::vector <std::string> child_vec; + if (!init) + { + child_count_timer.resetWithExpiry(5.f); + init = true; + } + if (child_count_timer.hasExpired()) + { + LL_INFOS() << "gMenuHolder child count: " << gMenuHolder->getChildCount() << LL_ENDL; + std::vector<std::string> local_child_vec; + LLView::child_list_t child_list = *gMenuHolder->getChildList(); + for (auto child : child_list) + { + local_child_vec.emplace_back(child->getName()); + } + if (!local_child_vec.empty() && local_child_vec != child_vec) + { + std::vector<std::string> out_vec; + std::sort(local_child_vec.begin(), local_child_vec.end()); + std::sort(child_vec.begin(), child_vec.end()); + std::set_difference(child_vec.begin(), child_vec.end(), local_child_vec.begin(), local_child_vec.end(), std::inserter(out_vec, out_vec.begin())); + if (!out_vec.empty()) + { + LL_INFOS() << "gMenuHolder removal diff size: '"<<out_vec.size() <<"' begin_child_diff"; + for (auto str : out_vec) + { + LL_CONT << " : " << str; + } + LL_CONT << " : end_child_diff" << LL_ENDL; + } + + out_vec.clear(); + std::set_difference(local_child_vec.begin(), local_child_vec.end(), child_vec.begin(), child_vec.end(), std::inserter(out_vec, out_vec.begin())); + if (!out_vec.empty()) + { + LL_INFOS() << "gMenuHolder addition diff size: '" << out_vec.size() << "' begin_child_diff"; + for (auto str : out_vec) + { + LL_CONT << " : " << str; + } + LL_CONT << " : end_child_diff" << LL_ENDL; + } + child_vec.swap(local_child_vec); + } + child_count_timer.resetWithExpiry(5.f); + } + } + // only update mouse hover set when UI is visible (since we shouldn't send hover events to invisible UI if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 56faab92c5..0bbf47e5e0 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -38,7 +38,6 @@ #include "llsky.h" #include "llsurface.h" #include "llsurfacepatch.h" -#include "llvosky.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewerregion.h" diff --git a/indra/newview/llvoground.cpp b/indra/newview/llvoground.cpp deleted file mode 100644 index c2f7d4fef6..0000000000 --- a/indra/newview/llvoground.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @file llvoground.cpp - * @brief LLVOGround class implementation - * - * $LicenseInfo:firstyear=2001&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 "llviewerprecompiledheaders.h" - -#include "llvoground.h" -#include "lldrawpoolground.h" - -#include "llviewercontrol.h" - -#include "lldrawable.h" -#include "llface.h" -#include "llsky.h" -#include "llviewercamera.h" -#include "llviewerregion.h" -#include "pipeline.h" - -LLVOGround::LLVOGround(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) -: LLStaticViewerObject(id, pcode, regionp, TRUE) -{ - mbCanSelect = FALSE; -} - - -LLVOGround::~LLVOGround() -{ -} - -void LLVOGround::idleUpdate(LLAgent &agent, const F64 &time) -{ -} - - -void LLVOGround::updateTextures() -{ -} - - -LLDrawable *LLVOGround::createDrawable(LLPipeline *pipeline) -{ - pipeline->allocDrawable(this); - mDrawable->setLit(FALSE); - - mDrawable->setRenderType(LLPipeline::RENDER_TYPE_GROUND); - LLDrawPoolGround *poolp = (LLDrawPoolGround*) gPipeline.getPool(LLDrawPool::POOL_GROUND); - - mDrawable->addFace(poolp, NULL); - - return mDrawable; -} - -// TO DO - this always returns TRUE, -BOOL LLVOGround::updateGeometry(LLDrawable *drawable) -{ - LLStrider<LLVector3> verticesp; - LLStrider<LLVector3> normalsp; - LLStrider<LLVector2> texCoordsp; - LLStrider<U16> indicesp; - S32 index_offset; - LLFace *face; - - LLDrawPoolGround *poolp = (LLDrawPoolGround*) gPipeline.getPool(LLDrawPool::POOL_GROUND); - - if (drawable->getNumFaces() < 1) - drawable->addFace(poolp, NULL); - face = drawable->getFace(0); - if (!face) - return TRUE; - - if (!face->getVertexBuffer()) - { - face->setSize(5, 12); - LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK); - if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount())) - { - LL_WARNS() << "Failed to allocate Vertex Buffer for VOGround to " - << face->getGeomCount() << " vertices and " - << face->getIndicesCount() << " indices" << LL_ENDL; - } - face->setGeomIndex(0); - face->setIndicesIndex(0); - face->setVertexBuffer(buff); - } - - index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); - if (-1 == index_offset) - { - return TRUE; - } - - /////////////////////////////////////// - // - // - // - LLVector3 at_dir = LLViewerCamera::getInstance()->getAtAxis(); - at_dir.mV[VZ] = 0.f; - if (at_dir.normVec() < 0.01) - { - // We really don't care, as we're not looking anywhere near the horizon. - } - LLVector3 left_dir = LLViewerCamera::getInstance()->getLeftAxis(); - left_dir.mV[VZ] = 0.f; - left_dir.normVec(); - - // Our center top point - LLColor4 ground_color = gSky.getSkyFogColor(); - ground_color.mV[3] = 1.f; - face->setFaceColor(ground_color); - - *(verticesp++) = LLVector3(64, 64, 0); - *(verticesp++) = LLVector3(-64, 64, 0); - *(verticesp++) = LLVector3(-64, -64, 0); - *(verticesp++) = LLVector3(64, -64, 0); - *(verticesp++) = LLVector3(0, 0, -1024); - - - // Triangles for each side - *indicesp++ = index_offset + 0; - *indicesp++ = index_offset + 1; - *indicesp++ = index_offset + 4; - - *indicesp++ = index_offset + 1; - *indicesp++ = index_offset + 2; - *indicesp++ = index_offset + 4; - - *indicesp++ = index_offset + 2; - *indicesp++ = index_offset + 3; - *indicesp++ = index_offset + 4; - - *indicesp++ = index_offset + 3; - *indicesp++ = index_offset + 0; - *indicesp++ = index_offset + 4; - - *(texCoordsp++) = LLVector2(0.f, 0.f); - *(texCoordsp++) = LLVector2(1.f, 0.f); - *(texCoordsp++) = LLVector2(1.f, 1.f); - *(texCoordsp++) = LLVector2(0.f, 1.f); - *(texCoordsp++) = LLVector2(0.5f, 0.5f); - - face->getVertexBuffer()->unmapBuffer(); - LLPipeline::sCompiles++; - return TRUE; -} diff --git a/indra/newview/llvoground.h b/indra/newview/llvoground.h deleted file mode 100644 index e7033290c7..0000000000 --- a/indra/newview/llvoground.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file llvoground.h - * @brief LLVOGround class header file - * - * $LicenseInfo:firstyear=2001&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$ - */ - -#ifndef LL_LLVOGROUND_H -#define LL_LLVOGROUND_H - -#include "stdtypes.h" -#include "v3color.h" -#include "v4coloru.h" -#include "llviewertexture.h" -#include "llviewerobject.h" - -class LLVOGround : public LLStaticViewerObject -{ -protected: - ~LLVOGround(); - -public: - LLVOGround(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - - /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); - - // Graphical stuff for objects - maybe broken out into render class - // later? - /*virtual*/ void updateTextures(); - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - -}; - -#endif // LL_LLVOGROUND_H diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 2ef2d66f18..6bb987ede4 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -797,7 +797,10 @@ void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer) void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer) { - if (mVoiceModule && mVoiceModule->singletoneInstanceExists()) mVoiceModule->removeObserver(observer); + if (mVoiceModule) + { + mVoiceModule->removeObserver(observer); + } } void LLVoiceClient::addObserver(LLFriendObserver* observer) @@ -807,7 +810,10 @@ void LLVoiceClient::addObserver(LLFriendObserver* observer) void LLVoiceClient::removeObserver(LLFriendObserver* observer) { - if (mVoiceModule && mVoiceModule->singletoneInstanceExists()) mVoiceModule->removeObserver(observer); + if (mVoiceModule) + { + mVoiceModule->removeObserver(observer); + } } void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer) @@ -817,7 +823,10 @@ void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer) void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) { - if (mVoiceModule && mVoiceModule->singletoneInstanceExists()) mVoiceModule->removeObserver(observer); + if (mVoiceModule) + { + mVoiceModule->removeObserver(observer); + } } std::string LLVoiceClient::sipURIFromID(const LLUUID &id) diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 246883b611..aa67502908 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -122,8 +122,6 @@ public: virtual const LLVoiceVersionInfo& getVersion()=0; - virtual bool singletoneInstanceExists()=0; - ///////////////////// /// @name Tuning //@{ diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index ab90f2e482..8f0938d01e 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -5215,11 +5215,6 @@ void LLVivoxVoiceClient::declineInvite(std::string &sessionHandle) } } -bool LLVivoxVoiceClient::singletoneInstanceExists() -{ - return LLVivoxVoiceClient::instanceExists(); -} - void LLVivoxVoiceClient::leaveNonSpatialChannel() { LL_DEBUGS("Voice") << "Request to leave spacial channel." << LL_ENDL; diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index ebc3a62c35..0a785401c1 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -73,8 +73,6 @@ public: // Returns true if vivox has successfully logged in and is not in error state virtual bool isVoiceWorking() const; - - virtual bool singletoneInstanceExists(); ///////////////////// /// @name Tuning diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 59fcacf914..273eeb930c 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -100,8 +100,8 @@ LLSkyTex::LLSkyTex() : void LLSkyTex::init(bool isShiny) { mIsShiny = isShiny; - mSkyData = new LLColor4[SKYTEX_RESOLUTION * SKYTEX_RESOLUTION]; - mSkyDirs = new LLVector3[SKYTEX_RESOLUTION * SKYTEX_RESOLUTION]; + mSkyData = new LLColor4[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)]; + mSkyDirs = new LLVector3[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)]; for (S32 i = 0; i < 2; ++i) { @@ -767,7 +767,6 @@ bool LLVOSky::updateSky() mForceUpdate = FALSE; mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY); - gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 02d1654878..fec9f1cdd1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -230,6 +230,9 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mColorChanged = FALSE; mSpotLightPriority = 0.f; + mSkinInfoFailed = false; + mSkinInfo = NULL; + mMediaImplList.resize(getNumTEs()); mLastFetchedMediaVersion = -1; mServerDrawableUpdateCount = 0; @@ -246,6 +249,8 @@ LLVOVolume::~LLVOVolume() delete mVolumeImpl; mVolumeImpl = NULL; + gMeshRepo.unregisterMesh(this); + if(!mMediaImplList.empty()) { for(U32 i = 0 ; i < mMediaImplList.size() ; i++) @@ -869,10 +874,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) if (isSculpted()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); - LLUUID id = sculpt_params->getSculptTexture(); - - updateSculptTexture(); + updateSculptTexture(); @@ -1116,10 +1118,15 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo // if it's a mesh if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH) { + if (mSkinInfo && mSkinInfo->mMeshID != volume_params.getSculptID()) + { + mSkinInfo = NULL; + mSkinInfoFailed = false; + } + if (!getVolume()->isMeshAssetLoaded()) { //load request not yet issued, request pipeline load this mesh - LLUUID asset_id = volume_params.getSculptID(); S32 available_lod = gMeshRepo.loadMesh(this, volume_params, lod, last_lod); if (available_lod != lod) { @@ -1127,6 +1134,14 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo } } + if (!mSkinInfo && !mSkinInfoFailed) + { + const LLMeshSkinInfo* skin_info = gMeshRepo.getSkinInfo(volume_params.getSculptID(), this); + if (skin_info) + { + notifySkinInfoLoaded(skin_info); + } + } } else // otherwise is sculptie { @@ -1159,6 +1174,9 @@ void LLVOVolume::updateSculptTexture() { mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } + + mSkinInfoFailed = false; + mSkinInfo = NULL; } else { @@ -1213,6 +1231,20 @@ void LLVOVolume::notifyMeshLoaded() updateVisualComplexity(); } +void LLVOVolume::notifySkinInfoLoaded(const LLMeshSkinInfo* skin) +{ + mSkinInfoFailed = false; + mSkinInfo = skin; + + notifyMeshLoaded(); +} + +void LLVOVolume::notifySkinInfoUnavailable() +{ + mSkinInfoFailed = true; + mSkinInfo = nullptr; +} + // sculpt replaces generate() for sculpted surfaces void LLVOVolume::sculpt() { @@ -3586,7 +3618,7 @@ const LLMeshSkinInfo* LLVOVolume::getSkinInfo() const { if (getVolume()) { - return gMeshRepo.getSkinInfo(getMeshID(), this); + return mSkinInfo; } else { @@ -5169,8 +5201,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) || (facep->getTextureEntry()->getFullbright()); - if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL)) + if (!fullbright && + type != LLRenderPass::PASS_GLOW && + !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL)) { + llassert(false); LL_WARNS() << "Non fullbright face has no normals!" << LL_ENDL; return; } @@ -5220,13 +5255,16 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (gltf_mat != nullptr) { mat_id = gltf_mat->getHash(); // TODO: cache this hash + if (!facep->hasMedia()) + { // no media texture, face texture will be unused + tex = nullptr; + } } else { mat = facep->getTextureEntry()->getMaterialParams().get(); if (mat) { - //mat_id = facep->getTextureEntry()->getMaterialID().asUUID(); mat_id = facep->getTextureEntry()->getMaterialParams()->getHash(); } } @@ -5271,33 +5309,35 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } } - if (idx >= 0 && - draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() && - draw_vec[idx]->mEnd == facep->getGeomIndex()-1 && + LLDrawInfo* info = idx >= 0 ? draw_vec[idx] : nullptr; + + if (info && + info->mVertexBuffer == facep->getVertexBuffer() && + info->mEnd == facep->getGeomIndex()-1 && (LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex || batchable) && #if LL_DARWIN - draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange && - draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange && + info->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange && + info->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange && #endif - draw_vec[idx]->mMaterialID == mat_id && - draw_vec[idx]->mFullbright == fullbright && - draw_vec[idx]->mBump == bump && - (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different - draw_vec[idx]->mTextureMatrix == tex_mat && - draw_vec[idx]->mModelMatrix == model_mat && - draw_vec[idx]->mShaderMask == shader_mask && - draw_vec[idx]->mAvatar == facep->mAvatar && - draw_vec[idx]->getSkinHash() == facep->getSkinHash()) + info->mMaterialID == mat_id && + info->mFullbright == fullbright && + info->mBump == bump && + (!mat || (info->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different + info->mTextureMatrix == tex_mat && + info->mModelMatrix == model_mat && + info->mShaderMask == shader_mask && + info->mAvatar == facep->mAvatar && + info->getSkinHash() == facep->getSkinHash()) { - draw_vec[idx]->mCount += facep->getIndicesCount(); - draw_vec[idx]->mEnd += facep->getGeomCount(); + info->mCount += facep->getIndicesCount(); + info->mEnd += facep->getGeomCount(); - if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= draw_vec[idx]->mTextureList.size()) + if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= info->mTextureList.size()) { - draw_vec[idx]->mTextureList.resize(index+1); - draw_vec[idx]->mTextureList[index] = tex; + info->mTextureList.resize(index+1); + info->mTextureList[index] = tex; } - draw_vec[idx]->validate(); + info->validate(); } else { @@ -5307,6 +5347,9 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 count = facep->getIndicesCount(); LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex, facep->getVertexBuffer(), fullbright, bump); + + info = draw_info; + draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; @@ -5382,6 +5425,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } draw_info->validate(); } + + llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR || info->mGLTFMaterial != nullptr); + llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_RIGGED || info->mGLTFMaterial != nullptr); + llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK || info->mGLTFMaterial != nullptr); + llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK_RIGGED || info->mGLTFMaterial != nullptr); + + llassert(type != LLRenderPass::PASS_NORMSPEC || info->mNormalMap.notNull()); } void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group) @@ -5755,7 +5805,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } facep->setPoolType(type); - if (vobj->isHUDAttachment()) + if (vobj->isHUDAttachment() && !is_pbr) { facep->setState(LLFace::FULLBRIGHT); } @@ -6452,17 +6502,17 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace fullbright = TRUE; } - if (hud_group) + const LLTextureEntry* te = facep->getTextureEntry(); + LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial(); + + if (hud_group && gltf_mat == nullptr) { //all hud attachments are fullbright fullbright = TRUE; } - - const LLTextureEntry* te = facep->getTextureEntry(); + tex = facep->getTexture(); BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE; - - LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial(); LLMaterial* mat = nullptr; bool can_be_shiny = false; @@ -6488,7 +6538,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace is_alpha = (is_alpha || transparent) ? TRUE : FALSE; - if ((gltf_mat || mat) && LLPipeline::sRenderDeferred && !hud_group) + if (gltf_mat || (mat && !hud_group)) { bool material_pass = false; @@ -6631,7 +6681,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace { //100% transparent, don't render unless we're highlighting transparent registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE); } - else if (facep->canRenderAsMask()) + else if (facep->canRenderAsMask() && !hud_group) { if (te->getFullbright() || LLPipeline::sNoAlpha) { @@ -6657,7 +6707,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY); registerFace(group, facep, LLRenderPass::PASS_INVISIBLE); } - else if (LLPipeline::sRenderDeferred && !hud_group) + else if (!hud_group) { //deferred rendering if (te->getFullbright()) { //register in post deferred fullbright shiny pass @@ -6702,7 +6752,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace { registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); } - if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && use_legacy_bump) + if (!hud_group && LLPipeline::sRenderBump && use_legacy_bump) { //if this is the deferred render and a bump map is present, register in post deferred bump registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); } @@ -6738,7 +6788,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } //not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010 - if (!is_alpha && (hud_group || !LLPipeline::sRenderDeferred)) + if (!is_alpha && hud_group) { llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); @@ -6751,7 +6801,14 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace if (!is_alpha && LLPipeline::sRenderGlow && te->getGlow() > 0.f) { - registerFace(group, facep, LLRenderPass::PASS_GLOW); + if (gltf_mat) + { + registerFace(group, facep, LLRenderPass::PASS_GLTF_GLOW); + } + else + { + registerFace(group, facep, LLRenderPass::PASS_GLOW); + } } ++face_iter; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 1c44ddfc5d..9cfd90a940 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -376,6 +376,8 @@ public: void updateVisualComplexity(); void notifyMeshLoaded(); + void notifySkinInfoLoaded(const LLMeshSkinInfo* skin); + void notifySkinInfoUnavailable(); // Returns 'true' iff the media data for this object is in flight bool isMediaDataBeingFetched() const; @@ -463,6 +465,8 @@ private: LLPointer<LLRiggedVolume> mRiggedVolume; + bool mSkinInfoFailed; + LLConstPointer<LLMeshSkinInfo> mSkinInfo; // statics public: static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 2356e72aab..608d2cb799 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -35,7 +35,6 @@ #include "llface.h" #include "llsky.h" #include "llsurface.h" -#include "llvosky.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewerregion.h" diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index bf4db81475..89b74ae962 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -92,17 +92,77 @@ LLPanelWearableListItem::LLPanelWearableListItem(LLViewerInventoryItem* item, co ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelWearableOutfitItem(&typeid(LLPanelWearableOutfitItem::Params), "wearable_outfit_list_item"); + +LLPanelWearableOutfitItem::Params::Params() +: add_btn("add_btn"), + remove_btn("remove_btn") +{ +} + +BOOL LLPanelWearableOutfitItem::postBuild() +{ + LLPanelWearableListItem::postBuild(); + + LLViewerInventoryItem* inv_item = getItem(); + mShowWidgets &= (inv_item->getType() != LLAssetType::AT_BODYPART); + if(mShowWidgets) + { + addWidgetToRightSide("add_wearable"); + addWidgetToRightSide("remove_wearable"); + + childSetAction("add_wearable", boost::bind(&LLPanelWearableOutfitItem::onAddWearable, this)); + childSetAction("remove_wearable", boost::bind(&LLPanelWearableOutfitItem::onRemoveWearable, this)); + + setWidgetsVisible(false); + reshapeWidgets(); + } + return TRUE; +} + +BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + if(!mShowWidgets) + { + return LLPanelWearableListItem::handleDoubleClick(x, y, mask); + } + + if(LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID)) + { + onRemoveWearable(); + } + else + { + onAddWearable(); + } + return TRUE; +} + +void LLPanelWearableOutfitItem::onAddWearable() +{ + setWidgetsVisible(false); + reshapeWidgets(); + LLAppearanceMgr::instance().wearItemOnAvatar(mInventoryItemUUID, true, false); +} + +void LLPanelWearableOutfitItem::onRemoveWearable() +{ + setWidgetsVisible(false); + reshapeWidgets(); + LLAppearanceMgr::instance().removeItemFromAvatar(mInventoryItemUUID); +} // static LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryItem* item, - bool worn_indication_enabled) + bool worn_indication_enabled, + bool show_widgets) { LLPanelWearableOutfitItem* list_item = NULL; if (item) { - const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>(); + const LLPanelWearableOutfitItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelWearableOutfitItem>(); - list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params); + list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params, show_widgets); list_item->initFromParams(params); list_item->postBuild(); } @@ -110,11 +170,23 @@ LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryIt } LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item, - bool worn_indication_enabled, - const LLPanelWearableOutfitItem::Params& params) -: LLPanelInventoryListItemBase(item, params) + bool worn_indication_enabled, + const LLPanelWearableOutfitItem::Params& params, + bool show_widgets) +: LLPanelWearableListItem(item, params) , mWornIndicationEnabled(worn_indication_enabled) +, mShowWidgets(show_widgets) { + if(mShowWidgets) + { + LLButton::Params button_params = params.add_btn; + applyXUILayout(button_params, this); + addChild(LLUICtrlFactory::create<LLButton>(button_params)); + + button_params = params.remove_btn; + applyXUILayout(button_params, this); + addChild(LLUICtrlFactory::create<LLButton>(button_params)); + } } // virtual @@ -127,11 +199,22 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name, // We don't use get_is_item_worn() here because this update is triggered by // an inventory observer upon link in COF beind added or removed so actual // worn status of a linked item may still remain unchanged. - if (mWornIndicationEnabled && LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID)) + bool is_worn = LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID); + if (mWornIndicationEnabled && is_worn) { search_label += LLTrans::getString("worn"); item_state = IS_WORN; } + if(mShowWidgets) + { + setShowWidget("add_wearable", !is_worn); + setShowWidget("remove_wearable", is_worn); + if(mHovered) + { + setWidgetsVisible(true); + reshapeWidgets(); + } + } LLPanelInventoryListItemBase::updateItem(search_label, item_state); } @@ -634,6 +717,7 @@ static const LLDefaultChildRegistry::Register<LLWearableItemsList> r("wearable_i LLWearableItemsList::Params::Params() : standalone("standalone", true) , worn_indication_enabled("worn_indication_enabled", true) +, show_item_widgets("show_item_widgets", false) {} LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p) @@ -649,6 +733,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p) } mWornIndicationEnabled = p.worn_indication_enabled; setNoItemsCommentText(LLTrans::getString("LoadingData")); + mShowItemWidgets = p.show_item_widgets; } // virtual @@ -665,7 +750,7 @@ LLPanel* LLWearableItemsList::createNewItem(LLViewerInventoryItem* item) return NULL; } - return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled); + return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled, mShowItemWidgets); } void LLWearableItemsList::updateList(const LLUUID& category_id) diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index ba8488b237..f7774a7086 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -72,12 +72,23 @@ protected: * Extends LLPanelInventoryListItemBase with handling * double click to wear the item. */ -class LLPanelWearableOutfitItem : public LLPanelInventoryListItemBase +class LLPanelWearableOutfitItem : public LLPanelWearableListItem { LOG_CLASS(LLPanelWearableOutfitItem); public: + struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params> + { + Optional<LLButton::Params> add_btn, remove_btn; + + Params(); + }; + + BOOL postBuild(); + BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item, - bool worn_indication_enabled); + bool worn_indication_enabled, + bool show_widgets); /** * Updates item name and (worn) suffix. @@ -85,12 +96,16 @@ public: /*virtual*/ void updateItem(const std::string& name, EItemState item_state = IS_DEFAULT); + void onAddWearable(); + void onRemoveWearable(); + protected: LLPanelWearableOutfitItem(LLViewerInventoryItem* item, - bool worn_indication_enabled, const Params& params); + bool worn_indication_enabled, const Params& params, bool show_widgets = false); private: bool mWornIndicationEnabled; + bool mShowWidgets; }; class LLPanelDeletableWearableListItem : public LLPanelWearableListItem @@ -442,6 +457,7 @@ public: { Optional<bool> standalone; Optional<bool> worn_indication_enabled; + Optional<bool> show_item_widgets; Params(); }; @@ -482,6 +498,7 @@ protected: bool mIsStandalone; bool mWornIndicationEnabled; + bool mShowItemWidgets; ESortOrder mSortOrder; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 5b91e26785..bba5f6dca6 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -295,13 +295,13 @@ void LLWorld::removeRegion(const LLHost &host) mRegionRemovedSignal(regionp); - delete regionp; - updateWaterObjects(); //double check all objects of this region are removed. gObjectList.clearAllMapObjectsInRegion(regionp) ; //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ; + + delete regionp; // Delete last to prevent use after free } diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 6e994b4e68..0b1082b540 100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -398,28 +398,17 @@ void LLWorldMapView::draw() S32 level = LLWorldMipmap::scaleToLevel(mMapScale); LLLocalClipRect clip(getLocalRect()); - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - // Clear the background alpha to 0 - gGL.flush(); - gGL.setColorMask(false, true); - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - gGL.color4f(0.0f, 0.0f, 0.0f, 0.0f); - gl_rect_2d(0, height, width, 0); - } + gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.flush(); - gGL.setColorMask(true, true); + // Draw background rectangle + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.color4fv(mBackgroundColor.mV); + gl_rect_2d(0, height, width, 0); // Draw the image tiles drawMipmap(width, height); - gGL.flush(); - - gGL.setColorMask(true, true); // Draw per sim overlayed information (names, mature, offline...) for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); @@ -464,7 +453,6 @@ void LLWorldMapView::draw() if (info->isDown()) { // Draw a transparent red square over down sims - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_SOURCE_ALPHA); gGL.color4f(0.2f, 0.0f, 0.0f, 0.4f); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -475,26 +463,7 @@ void LLWorldMapView::draw() gGL.vertex2f(right, top); gGL.end(); } - // As part of the AO project, we no longer want to draw access indicators; - // it's too complicated to get all the rules straight and will only - // cause confusion. - /********************** - else if (!info->isPG() && gAgent.isTeen()) - { - // If this is a mature region, and you are not, draw a line across it - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color3f(1.f, 0.f, 0.f); - gGL.begin(LLRender::LINES); - gGL.vertex2f(left, top); - gGL.vertex2f(right, bottom); - gGL.vertex2f(left, bottom); - gGL.vertex2f(right, top); - gGL.end(); - } - **********************/ - else if (gSavedSettings.getBOOL("MapShowLandForSale") && (level <= DRAW_LANDFORSALE_THRESHOLD)) + else if (gSavedSettings.getBOOL("MapShowLandForSale") && (level <= DRAW_LANDFORSALE_THRESHOLD)) { // Draw the overlay image "Land for Sale / Land for Auction" LLViewerFetchedTexture* overlayimage = info->getLandForSaleImage(); @@ -506,7 +475,6 @@ void LLWorldMapView::draw() // Draw something whenever we have enough info if (overlayimage->hasGLTexture()) { - gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); gGL.getTexUnit(0)->bind(overlayimage); gGL.color4f(1.f, 1.f, 1.f, 1.f); gGL.begin(LLRender::QUADS); @@ -556,21 +524,6 @@ void LLWorldMapView::draw() } } - - - // Draw background rectangle - LLGLSUIDefault gls_ui; - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.flush(); - gGL.blendFunc(LLRender::BF_ONE_MINUS_DEST_ALPHA, LLRender::BF_DEST_ALPHA); - gGL.color4fv( mBackgroundColor.mV ); - gl_rect_2d(0, height, width, 0); - } - - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - // Draw item infos if we're not zoomed out too much and there's something to draw if ((level <= DRAW_SIMINFO_THRESHOLD) && (gSavedSettings.getBOOL("MapShowInfohubs") || gSavedSettings.getBOOL("MapShowTelehubs") || @@ -771,7 +724,6 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load gGL.getTexUnit(0)->bind(simimage.get()); simimage->setAddressMode(LLTexUnit::TAM_CLAMP); - gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.color4f(1.f, 1.0f, 1.0f, 1.0f); gGL.begin(LLRender::QUADS); @@ -810,8 +762,6 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load // Used for debug only void LLWorldMapView::drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right) { - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); if (level == 1) gGL.color3f(1.f, 0.f, 0.f); // red diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 325d01ff1b..388dee00db 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -55,7 +55,6 @@ #include "lldrawable.h" #include "lldrawpoolalpha.h" #include "lldrawpoolavatar.h" -#include "lldrawpoolground.h" #include "lldrawpoolbump.h" #include "lldrawpooltree.h" #include "lldrawpoolwater.h" @@ -86,7 +85,6 @@ #include "llviewerwindow.h" // For getSpinAxis #include "llvoavatarself.h" #include "llvocache.h" -#include "llvoground.h" #include "llvosky.h" #include "llvowlsky.h" #include "llvotree.h" @@ -430,7 +428,6 @@ void LLPipeline::init() getPool(LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK); getPool(LLDrawPool::POOL_GRASS); getPool(LLDrawPool::POOL_FULLBRIGHT); - getPool(LLDrawPool::POOL_INVISIBLE); getPool(LLDrawPool::POOL_BUMP); getPool(LLDrawPool::POOL_MATERIALS); getPool(LLDrawPool::POOL_GLOW); @@ -459,12 +456,6 @@ void LLPipeline::init() else { setAllRenderTypes(); // By default, all rendering types start enabled - // Don't turn on ground when this is set - // Mac Books with intel 950s need this - if(!gSavedSettings.getBOOL("RenderGround")) - { - toggleRenderType(RENDER_TYPE_GROUND); - } } // make sure RenderPerformanceTest persists (hackity hack hack) @@ -649,14 +640,10 @@ void LLPipeline::cleanup() mTerrainPool = NULL; delete mWaterPool; mWaterPool = NULL; - delete mGroundPool; - mGroundPool = NULL; delete mSimplePool; mSimplePool = NULL; delete mFullbrightPool; mFullbrightPool = NULL; - delete mInvisiblePool; - mInvisiblePool = NULL; delete mGlowPool; mGlowPool = NULL; delete mBumpPool; @@ -832,6 +819,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) resY /= res_mod; } + if (LLPipeline::sRenderTransparentWater) + { //water reflection texture + mWaterDis.allocate(resX, resY, GL_RGBA, true); + } + if (RenderUIBuffer) { if (!mRT->uiScreen.allocate(resX,resY, GL_RGBA)) @@ -1112,7 +1104,6 @@ void LLPipeline::releaseGLBuffers() releaseLUTBuffers(); - mWaterRef.release(); mWaterDis.release(); mBake.release(); @@ -1186,12 +1177,6 @@ void LLPipeline::createGLBuffers() stop_glerror(); assertInitialized(); - if (LLPipeline::sRenderTransparentWater) - { //water reflection texture - U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512); - mWaterDis.allocate(res,res,GL_RGBA,true); - } - // Use FBO for bake tex mBake.allocate(512, 512, GL_RGBA, true); // SL-12781 Build > Upload > Model; 3D Preview @@ -1356,14 +1341,12 @@ bool LLPipeline::shadersLoaded() bool LLPipeline::canUseWindLightShaders() const { - return (gWLSkyProgram.mProgramObject != 0 && - LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1); + return true; } bool LLPipeline::canUseWindLightShadersOnObjects() const { - return (canUseWindLightShaders() - && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0); + return true; } bool LLPipeline::canUseAntiAliasing() const @@ -1518,10 +1501,6 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) poolp = mFullbrightPool; break; - case LLDrawPool::POOL_INVISIBLE: - poolp = mInvisiblePool; - break; - case LLDrawPool::POOL_GLOW: poolp = mGlowPool; break; @@ -1559,10 +1538,6 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) poolp = mWaterPool; break; - case LLDrawPool::POOL_GROUND: - poolp = mGroundPool; - break; - case LLDrawPool::POOL_WL_SKY: poolp = mWLSkyPool; break; @@ -2297,7 +2272,6 @@ bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& } LLViewerCamera::sCurCameraID = saved_camera_id; - return res; } @@ -2452,64 +2426,6 @@ void LLPipeline::markOccluder(LLSpatialGroup* group) } } -void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - LL_PROFILE_GPU_ZONE("downsampleDepthBuffer"); - - LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; - - LLGLSLShader* shader = NULL; - - if (scratch_space) - { -#if 0 // TODO -- restore occlusion culling functionality - GLint bits = 0; - bits = GL_DEPTH_BUFFER_BIT; - scratch_space->copyContents(source, - 0, 0, source.getWidth(), source.getHeight(), - 0, 0, scratch_space->getWidth(), scratch_space->getHeight(), bits, GL_NEAREST); -#endif - } - - dest.bindTarget(); - dest.clear(GL_DEPTH_BUFFER_BIT); - - if (source.getUsage() == LLTexUnit::TT_TEXTURE) - { - shader = &gDownsampleDepthRectProgram; - shader->bind(); - shader->uniform2f(sDelta, 1.f, 1.f); - shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight()); - } - else - { - shader = &gDownsampleDepthProgram; - shader->bind(); - shader->uniform2f(sDelta, 1.f/source.getWidth(), 1.f/source.getHeight()); - shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f); - } - - gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE); - - { - LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); - mScreenTriangleVB->setBuffer(); - mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); - } - - dest.flush(); - - if (last_shader) - { - last_shader->bind(); - } - else - { - shader->unbind(); - } -} - void LLPipeline::doOcclusion(LLCamera& camera) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; @@ -2521,14 +2437,8 @@ void LLPipeline::doOcclusion(LLCamera& camera) { LLVertexBuffer::unbind(); - if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION)) - { - gGL.setColorMask(true, false, false, false); - } - else - { - gGL.setColorMask(false, false); - } + gGL.setColorMask(false, false); + LLGLDisable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -3168,7 +3078,6 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, - LLPipeline::RENDER_TYPE_GROUND, LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::RENDER_TYPE_TREE, LLPipeline::RENDER_TYPE_SKY, @@ -4018,6 +3927,8 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY); LL_PROFILE_GPU_ZONE("renderGeomDeferred"); + llassert(!sRenderingHUDs); + if (gUseWireframe) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -4044,7 +3955,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) bool occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion; - setupHWLights(nullptr); + setupHWLights(); { LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools"); @@ -4171,7 +4082,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0); calcNearbyLights(camera); - setupHWLights(NULL); + setupHWLights(); gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setColorMask(true, false); @@ -5164,18 +5075,6 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) } break; - case LLDrawPool::POOL_INVISIBLE: - if (mInvisiblePool) - { - llassert(0); - LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL; - } - else - { - mInvisiblePool = (LLRenderPass*) new_poolp; - } - break; - case LLDrawPool::POOL_GLOW: if (mGlowPool) { @@ -5269,18 +5168,6 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) } break; - case LLDrawPool::POOL_GROUND: - if( mGroundPool ) - { - llassert(0); - LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Ground Pool" << LL_ENDL; - } - else - { - mGroundPool = new_poolp; - } - break; - case LLDrawPool::POOL_WL_SKY: if( mWLSkyPool ) { @@ -5350,11 +5237,6 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) mFullbrightPool = NULL; break; - case LLDrawPool::POOL_INVISIBLE: - llassert(mInvisiblePool == poolp); - mInvisiblePool = NULL; - break; - case LLDrawPool::POOL_WL_SKY: llassert(mWLSkyPool == poolp); mWLSkyPool = NULL; @@ -5421,11 +5303,6 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) mWaterPool = NULL; break; - case LLDrawPool::POOL_GROUND: - llassert( poolp == mGroundPool ); - mGroundPool = NULL; - break; - case LLDrawPool::POOL_GLTF_PBR: llassert( poolp == mPBROpaquePool ); mPBROpaquePool = NULL; @@ -5574,7 +5451,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; assertInitialized(); - if (LLPipeline::sReflectionRender || gCubeSnapshot) + if (LLPipeline::sReflectionRender || gCubeSnapshot || LLPipeline::sRenderingHUDs) { return; } @@ -5755,11 +5632,16 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) } } -void LLPipeline::setupHWLights(LLDrawPool* pool) +void LLPipeline::setupHWLights() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; assertInitialized(); + if (LLPipeline::sRenderingHUDs) + { + return; + } + LLEnvironment& environment = LLEnvironment::instance(); LLSettingsSky::ptr_t psky = environment.getCurrentSky(); @@ -8116,6 +7998,8 @@ void LLPipeline::renderDeferredLighting() return; } + llassert(!sRenderingHUDs); + static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f); F32 light_scale = 1.f; @@ -8149,7 +8033,7 @@ void LLPipeline::renderDeferredLighting() glh::matrix4f mat = copy_matrix(gGLModelView); - setupHWLights(NULL); // to set mSun/MoonDir; + setupHWLights(); // to set mSun/MoonDir; glh::vec4f tc(mSunDir.mV); mat.mult_matrix_vec(tc); @@ -8557,6 +8441,7 @@ void LLPipeline::renderDeferredLighting() LLPipeline::RENDER_TYPE_VOLUME, LLPipeline::RENDER_TYPE_GLOW, LLPipeline::RENDER_TYPE_BUMP, + LLPipeline::RENDER_TYPE_GLTF_PBR, LLPipeline::RENDER_TYPE_PASS_SIMPLE, LLPipeline::RENDER_TYPE_PASS_ALPHA, LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK, @@ -8566,6 +8451,7 @@ void LLPipeline::renderDeferredLighting() LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK, LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY, LLPipeline::RENDER_TYPE_PASS_GLOW, + LLPipeline::RENDER_TYPE_PASS_GLTF_GLOW, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_PASS_SHINY, LLPipeline::RENDER_TYPE_PASS_INVISIBLE, @@ -9354,6 +9240,24 @@ LLRenderTarget* LLPipeline::getSpotShadowTarget(U32 i) static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_SPOT_RENDER("Spot Shadow Render"); +// helper class for disabling occlusion culling for the current stack frame +class LLDisableOcclusionCulling +{ +public: + S32 mUseOcclusion; + + LLDisableOcclusionCulling() + { + mUseOcclusion = LLPipeline::sUseOcclusion; + LLPipeline::sUseOcclusion = 0; + } + + ~LLDisableOcclusionCulling() + { + LLPipeline::sUseOcclusion = mUseOcclusion; + } +}; + void LLPipeline::generateSunShadow(LLCamera& camera) { if (!sRenderDeferred || RenderShadowDetail <= 0) @@ -9364,6 +9268,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW); LL_PROFILE_GPU_ZONE("generateSunShadow"); + LLDisableOcclusionCulling no_occlusion; + bool skip_avatar_update = false; if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) { @@ -9529,7 +9435,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) if (fp.empty()) { - if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA)) + if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowCamera[0] = main_camera; mShadowExtents[0][0] = min; @@ -9597,7 +9503,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] }; if (mSunDiffuse == LLColor4::black) - { //sun diffuse is totally shadows don't matter + { //sun diffuse is totally black shadows don't matter LLGLDepthTest depth(GL_TRUE); for (S32 j = 0; j < 4; j++) @@ -9609,23 +9515,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } else { - /*if (gCubeSnapshot) - { - // do one shadow split for cube snapshots, clear the rest - mSunClipPlanes.set(64.f, 64.f, 64.f); - dist[1] = dist[2] = dist[3] = dist[4] = 64.f; - for (S32 j = 1; j < 4; j++) - { - mRT->shadow[j].bindTarget(); - mRT->shadow[j].clear(); - mRT->shadow[j].flush(); - } - }*/ - - //for (S32 j = 0; j < (gCubeSnapshot ? 1 : 4); j++) for (S32 j = 0; j < 4; j++) { - if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA)) + if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowFrustPoints[j].clear(); } @@ -9667,7 +9559,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) shadow_cam.calcAgentFrustumPlanes(frust); shadow_cam.mFrustumCornerDist = 0.f; - if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowCamera[j] = shadow_cam; } @@ -9677,7 +9569,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)) { //no possible shadow receivers - if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowExtents[j][0] = LLVector3(); mShadowExtents[j][1] = LLVector3(); @@ -9697,7 +9589,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) continue; } - if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowExtents[j][0] = min; mShadowExtents[j][1] = max; @@ -9924,7 +9816,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) eye = LLVector3(origin_agent.v); - if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowFrustOrigin[j] = eye; } @@ -9987,7 +9879,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mRT->shadow[j].flush(); - if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { mShadowCamera[j+4] = shadow_cam; } @@ -10121,8 +10013,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); - stop_glerror(); - // mSpotShadow[i].bindTarget(); @@ -10255,7 +10145,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) clearRenderTypeMask( RENDER_TYPE_SKY, RENDER_TYPE_WL_SKY, - RENDER_TYPE_GROUND, RENDER_TYPE_TERRAIN, RENDER_TYPE_GRASS, RENDER_TYPE_CONTROL_AV, // Animesh diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 5b80ae5696..85878dd21d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -169,10 +169,6 @@ public: void markVisible(LLDrawable *drawablep, LLCamera& camera); void markOccluder(LLSpatialGroup* group); - //downsample source to dest, taking the maximum depth value per pixel in source and writing to dest - // if source's depth buffer cannot be bound for reading, a scratch space depth buffer must be provided - void downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); - void doOcclusion(LLCamera& camera); void markNotCulled(LLSpatialGroup* group, LLCamera &camera); void markMoved(LLDrawable *drawablep, bool damped_motion = false); @@ -331,7 +327,7 @@ public: S32 getLightCount() const { return mLights.size(); } void calcNearbyLights(LLCamera& camera); - void setupHWLights(LLDrawPool* pool); + void setupHWLights(); void setupAvatarLights(bool for_edit = false); void enableLights(U32 mask); void enableLightsStatic(); @@ -459,7 +455,6 @@ public: // Following are pool types (some are also object types) RENDER_TYPE_SKY = LLDrawPool::POOL_SKY, RENDER_TYPE_WL_SKY = LLDrawPool::POOL_WL_SKY, - RENDER_TYPE_GROUND = LLDrawPool::POOL_GROUND, RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN, RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE, RENDER_TYPE_GRASS = LLDrawPool::POOL_GRASS, @@ -471,7 +466,6 @@ public: RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR, RENDER_TYPE_CONTROL_AV = LLDrawPool::POOL_CONTROL_AV, // Animesh RENDER_TYPE_TREE = LLDrawPool::POOL_TREE, - RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER, RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, RENDER_TYPE_GLTF_PBR = LLDrawPool::POOL_GLTF_PBR, @@ -498,6 +492,8 @@ public: RENDER_TYPE_PASS_POST_BUMP_RIGGED = LLRenderPass::PASS_POST_BUMP_RIGGED, RENDER_TYPE_PASS_GLOW = LLRenderPass::PASS_GLOW, RENDER_TYPE_PASS_GLOW_RIGGED = LLRenderPass::PASS_GLOW_RIGGED, + RENDER_TYPE_PASS_GLTF_GLOW = LLRenderPass::PASS_GLTF_GLOW, + RENDER_TYPE_PASS_GLTF_GLOW_RIGGED = LLRenderPass::PASS_GLTF_GLOW_RIGGED, RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA, RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK, RENDER_TYPE_PASS_ALPHA_MASK_RIGGED = LLRenderPass::PASS_ALPHA_MASK_RIGGED, @@ -724,9 +720,6 @@ public: LLVector4 mSunOrthoClipPlanes; LLVector2 mScreenScale; - //water reflection texture - LLRenderTarget mWaterRef; - //water distortion texture (refraction) LLRenderTarget mWaterDis; @@ -892,13 +885,11 @@ protected: LLDrawPool* mSkyPool = nullptr; LLDrawPool* mTerrainPool = nullptr; LLDrawPool* mWaterPool = nullptr; - LLDrawPool* mGroundPool = nullptr; LLRenderPass* mSimplePool = nullptr; LLRenderPass* mGrassPool = nullptr; LLRenderPass* mAlphaMaskPool = nullptr; LLRenderPass* mFullbrightAlphaMaskPool = nullptr; LLRenderPass* mFullbrightPool = nullptr; - LLDrawPool* mInvisiblePool = nullptr; LLDrawPool* mGlowPool = nullptr; LLDrawPool* mBumpPool = nullptr; LLDrawPool* mMaterialsPool = nullptr; diff --git a/indra/newview/skins/default/textures/icons/add_icon.png b/indra/newview/skins/default/textures/icons/add_icon.png Binary files differnew file mode 100644 index 0000000000..cb68ee8e16 --- /dev/null +++ b/indra/newview/skins/default/textures/icons/add_icon.png diff --git a/indra/newview/skins/default/textures/icons/remove_icon.png b/indra/newview/skins/default/textures/icons/remove_icon.png Binary files differnew file mode 100644 index 0000000000..6e62ee33f4 --- /dev/null +++ b/indra/newview/skins/default/textures/icons/remove_icon.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 5bf27bb64d..bdf12d73fc 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -744,6 +744,9 @@ with the same filename but different name <texture name="Wearables_Divider" file_name="windows/Wearables_Divider.png" preload="false" /> + <texture name="Add_Icon" file_name="icons/add_icon.png" preload="false" /> + <texture name="Remove_Icon" file_name="icons/remove_icon.png" preload="false" /> + <texture name="Web_Profile_Off" file_name="icons/Web_Profile_Off.png" preload="false" /> <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> diff --git a/indra/newview/skins/default/xui/en/floater_object_weights.xml b/indra/newview/skins/default/xui/en/floater_object_weights.xml index eb283a1043..889efa061c 100644 --- a/indra/newview/skins/default/xui/en/floater_object_weights.xml +++ b/indra/newview/skins/default/xui/en/floater_object_weights.xml @@ -2,7 +2,7 @@ <floater can_close="true" can_tear_off="false" - height="315" + height="289" help_topic="object_weights" layout="topleft" name="object_weights" @@ -320,23 +320,4 @@ top_delta="0" value="Total capacity" width="130" /> - <view_border - bevel_style="none" - follows="top|left" - height="0" - layout="topleft" - left="10" - name="land_impacts_text_border" - top_pad="5" - width="180"/> - - <text - follows="left|top" - height="16" - layout="topleft" - left="10" - name="help_SLURL" - top_pad="10" - value="[secondlife:///app/help/object_weights What is all this?...]" - width="180" /> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_openobject.xml b/indra/newview/skins/default/xui/en/floater_openobject.xml index 912db80bcc..ec03d7d32c 100644 --- a/indra/newview/skins/default/xui/en/floater_openobject.xml +++ b/indra/newview/skins/default/xui/en/floater_openobject.xml @@ -3,7 +3,7 @@ legacy_header_height="18" can_resize="true" default_tab_group="1" - height="370" + height="350" layout="topleft" min_height="190" min_width="285" @@ -31,62 +31,18 @@ background_visible="false" draw_border="false" follows="all" - height="240" + height="265" layout="topleft" + show_root_folder="false" left="10" name="object_contents" top_pad="0" width="284" /> - <view_border - bevel_style="none" - follows="bottom|left" - height="50" - highlight_light_color="0.6 0.6 0.6" - layout="topleft" - left="10" - name="border" - top_pad="5" - width="270"/> - <text - follows="bottom|left" - height="15" - layout="topleft" - left="15" - name="border_note" - text_color="White" - top_delta="5"> - Copy to inventory and wear - </text> - <button - follows="bottom|left" - height="23" - label="Add to outfit" - label_selected="Add to outfit" - layout="topleft" - left="15" - name="copy_and_wear_button" - top_pad="3" - width="135"> - <button.commit_callback - function="OpenObject.MoveAndWear" /> - </button> - <button - follows="bottom|left" - height="23" - label="Replace outfit" - label_selected="Replace outfit" - layout="topleft" - left_pad="5" - name="copy_and_replace_button" - width="120"> - <button.commit_callback - function="OpenObject.ReplaceOutfit" /> - </button> <button follows="bottom|left" height="23" label="Only copy to inventory" - label_selected="Only copy to inventory" + label_selected="Copy to inventory" layout="topleft" left="15" name="copy_to_inventory_button" diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index 41384a77b8..59117c0178 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -82,17 +82,20 @@ width="62"> Name </text> - <line_editor - border_style="line" - border_thickness="1" - follows="left|top" - height="20" - layout="topleft" - left_pad="0" - top_pad="-18" - max_length_chars="255" - name="filter_by_name" - width="161" /> + + <search_editor + follows="left|top" + search_button_visible="false" + height="20" + text_readonly_color="DkGray" + label="Objects by Name" + layout="topleft" + left_pad="0" + top_pad="-18" + name="filter_by_name" + select_on_focus="true" + width="161"> + </search_editor> <text name="linksets_desc_label" height="13" @@ -108,17 +111,19 @@ width="88"> Description </text> - <line_editor - border_style="line" - border_thickness="1" - follows="left|top" - height="20" - layout="topleft" - left_pad="0" - top_pad="-17" - max_length_chars="255" - name="filter_by_description" - width="162" /> + <search_editor + follows="left|top" + search_button_visible="false" + height="20" + text_readonly_color="DkGray" + label="Objects by Description" + layout="topleft" + left_pad="0" + top_pad="-17" + name="filter_by_description" + select_on_focus="true" + width="162"> + </search_editor> <combo_box height="20" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_settings_debug.xml b/indra/newview/skins/default/xui/en/floater_settings_debug.xml index 3ed2bd7206..e4fda5cd10 100644 --- a/indra/newview/skins/default/xui/en/floater_settings_debug.xml +++ b/indra/newview/skins/default/xui/en/floater_settings_debug.xml @@ -2,41 +2,79 @@ <floater legacy_header_height="18" can_minimize="false" - height="215" + height="360" + min_height="367" layout="topleft" name="settings_debug" help_topic="settings_debug" title="DEBUG SETTINGS" - width="350"> - <combo_box - allow_text_entry="true" - follows="top|left" - height="22" - layout="topleft" - left="15" - max_chars="255" - name="settings_combo" - top="30" - width="320"> - <combo_box.commit_callback - function="SettingSelect" /> - </combo_box> - <text_editor - enabled="false" - height="60" - layout="topleft" - left_delta="0" - name="comment_text" - top_pad="10" - width="320" - word_wrap="true" /> + reuse_instance="true" + can_resize="true" + min_width="550" + width="570"> + <filter_editor + follows="left|top|right" + height="23" + layout="topleft" + left="10" + right="-10" + label="Enter search text" + max_length_chars="300" + name="filter_input" + text_pad_left="10" + top="30" /> + <scroll_list + column_padding="0" + draw_heading="true" + draw_stripes="false" + heading_height="23" + height="266" + layout="topleft" + search_column="1" + left="10" + follows="left|top|bottom" + name="setting_list" + top_pad="2" + width="300"> + <scroll_list.columns + name="changed_setting" + relative_width="0.05" /> + <scroll_list.columns + label="Setting" + name="setting" /> + </scroll_list> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + name="setting_name_txt" + font="SansSerifSmallBold" + top_delta="8" + left_pad="10" + visible="false" + use_ellipses="true" + text_color="White" + width="240"> + Debug setting name + </text> + <text_editor + enabled="false" + height="75" + layout="topleft" + visible="false" + name="comment_text" + follows="left|top" + width="240" + top_delta="20" + word_wrap="true" /> <radio_group follows="top|left" height="30" layout="topleft" - left_delta="0" name="boolean_combo" - top_pad="10" + top_pad="15" visible="false" tab_stop="true" width="100"> @@ -55,21 +93,25 @@ </radio_group> <line_editor height="20" + follows="top|left" layout="topleft" left_delta="0" name="val_text" top_delta="0" visible="false" - width="300" > + width="220" > <line_editor.commit_callback function="CommitSettings" /> </line_editor> <color_swatch - bottom="185" + top_delta="0" + left_delta="0" + follows="top|left" can_apply_immediately="true" height="55" name="val_color_swatch" label="Color" + visible="false" layout="topleft" width="37" > <color_swatch.commit_callback @@ -79,10 +121,11 @@ height="20" label="x" layout="topleft" + follows="top|left" left_delta="0" max_val="1e+007" name="val_spinner_1" - top_delta="10" + top_delta="5" visible="false" width="120" > <spinner.commit_callback @@ -92,10 +135,11 @@ height="20" label="x" layout="topleft" - left_pad="15" + follows="top|left" + left_delta="0" max_val="1e+007" name="val_spinner_2" - top_delta="0" + top_pad="10" visible="false" width="120"> <spinner.commit_callback @@ -105,10 +149,11 @@ height="20" label="x" layout="topleft" - left="15" + follows="top|left" + left_delta="0" max_val="1e+007" name="val_spinner_3" - top="160" + top_pad="10" visible="false" width="120"> <spinner.commit_callback @@ -118,10 +163,11 @@ height="20" label="x" layout="topleft" - left_pad="15" + follows="top|left" + left_delta="0" max_val="1e+007" name="val_spinner_4" - top_delta="0" + top_pad="10" visible="false" width="120" > <spinner.commit_callback @@ -130,12 +176,26 @@ <button height="22" label="Reset to default" + follows="left|top" layout="topleft" - left="15" + left_delta="0" name="default_btn" - top="186" + visible="false" + top_pad="10" width="150" > <button.commit_callback function="ClickDefault" /> </button> + <check_box + control_name="DebugSettingsHideDefault" + height="16" + initial_value="true" + label="Show changed settings only" + layout="topleft" + top_pad="10" + left="10" + follows="left|bottom" + name="hide_default" + width="330"> + </check_box> </floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 2512fadec7..b8515cb096 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2047,17 +2047,6 @@ function="World.EnvPreset" parameter="water" /> </menu_item_check> <menu_item_check - label="Ground" - name="Rendering Type Ground" - shortcut="control|alt|shift|8"> - <menu_item_check.on_check - function="Advanced.CheckRenderType" - parameter="ground" /> - <menu_item_check.on_click - function="Advanced.ToggleRenderType" - parameter="ground" /> - </menu_item_check> - <menu_item_check label="Volume" name="Rendering Type Volume" shortcut="control|alt|shift|9"> diff --git a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml index 2a24c74feb..d74dca8b95 100644 --- a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml +++ b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml @@ -18,6 +18,7 @@ follows="all" keep_one_selected="true" multi_select="true" + show_item_widgets="true" name="wearable_items_list" translate="false" standalone="false" diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml index 42a7974316..b2dc975c6e 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml @@ -36,6 +36,7 @@ left="3" multi_select="true" name="cof_items_list" + show_item_widgets="true" standalone="false" top="0" width="309" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml index 2ec5cef640..ef08fdf7c4 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml @@ -19,7 +19,7 @@ follows="left|top" height="23" label="Clear History" - tool_tip="Clear login image, last location, teleport history, web and texture cache" + tool_tip="Clear search and teleport history, web and texture cache" layout="topleft" left="30" name="clear_cache" diff --git a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml index 551b477876..777b37d666 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -9,9 +9,13 @@ follows="all" layout="topleft" > + <!-- + Date from server comes already converted to stl timezone, + so display it as an UTC+0 + --> <string name="date_format" - value="SL birthdate: [mth,datetime,slt] [day,datetime,slt], [year,datetime,slt]" /> + value="SL birthdate: [mth,datetime,utc] [day,datetime,utc], [year,datetime,utc]" /> <string name="age_format" value="[AGE]" /> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 847a1b6df1..67ea085c55 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3005,16 +3005,6 @@ Running in window. <string name="MBDevContextErr">Can't make GL device context</string> <string name="MBPixelFmtErr">Can't find suitable pixel format</string> <string name="MBPixelFmtDescErr">Can't get pixel format description</string> - <string name="MBTrueColorWindow"> - [APP_NAME] requires True Color (32-bit) to run. -Please go to your computer's display settings and set the color mode to 32-bit. - </string> - <string name="MBAlpha"> - [APP_NAME] is unable to run because it can't get an 8 bit alpha channel. Usually this is due to video card driver issues. -Please make sure you have the latest video card drivers installed. -Also be sure your monitor is set to True Color (32-bit) in Control Panels > Display > Settings. -If you continue to receive this message, contact the [SUPPORT_SITE]. - </string> <string name="MBPixelFmtSetErr">Can't set pixel format</string> <string name="MBGLContextErr">Can't create GL rendering context</string> <string name="MBGLContextActErr">Can't activate GL rendering context</string> @@ -3994,7 +3984,7 @@ Please check http://status.secondlifegrid.net to see if there is a known problem <string name="Premium_PlusMembership">Premium Plus</string> <string name="InternalMembership">Internal</string> <!-- No need to translate --> - <string name="MembershipUpgradeText">Upgrade to Premium</string> + <string name="MembershipUpgradeText">Change membership plan...</string> <string name="MembershipPremiumText">My Premium membership</string> <!-- Question strings for delete items notifications --> diff --git a/indra/newview/skins/default/xui/en/widgets/filter_editor.xml b/indra/newview/skins/default/xui/en/widgets/filter_editor.xml index 1c4822b8d5..9c80deeafc 100644 --- a/indra/newview/skins/default/xui/en/widgets/filter_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/filter_editor.xml @@ -6,7 +6,7 @@ text_pad_left="7" select_on_focus="true" text_tentative_color="TextFgTentativeColor" - highlight_text_field="false" + highlight_text_field="true" background_image="TextField_Search_Off" background_image_disabled="TextField_Search_Disabled" background_image_focused="TextField_Search_Active" diff --git a/indra/newview/skins/default/xui/en/widgets/search_editor.xml b/indra/newview/skins/default/xui/en/widgets/search_editor.xml index dc5a07bf4f..18d99f1ed1 100644 --- a/indra/newview/skins/default/xui/en/widgets/search_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/search_editor.xml @@ -7,7 +7,7 @@ text_pad_right="6" select_on_focus="true" text_tentative_color="TextFgTentativeColor" - highlight_text_field="false" + highlight_text_field="true" background_image="TextField_Search_Off" background_image_disabled="TextField_Search_Disabled" background_image_focused="TextField_Search_Active" diff --git a/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml b/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml new file mode 100644 index 0000000000..cd84b91b1f --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<inventory_list_item + follows="top|right|left" + height="20" + name="inventory_item" + tab_stop="false" + hover_image="ListItem_Over" + selected_image="ListItem_Select" + separator_image="Wearables_Divider" + width="380"> + <!-- DEFAULT style for inventory list item --> + <default_style + font="SansSerifSmall" + font.style="NORMAL" /> + + <!-- style for inventory list item WORN on avatar --> + <worn_style + font="SansSerifSmall" + font.style="BOLD" + color="EmphasisColor" /> + <item_icon + height="16" + follows="top|left" + image_name="Inv_Object" + layout="topleft" + left="0" + name="item_icon" + top="0" + width="16" /> + <item_name + follows="left|right" + height="20" + layout="topleft" + left="21" + parse_urls="false" + use_ellipses="true" + name="item_name" + text_color="white" + top="4" + value="..." + width="359" /> + <add_btn + name="add_wearable" + layout="topleft" + follows="top|right" + image_unselected="Add_Icon" + image_selected="Add_Icon" + top="1" + left="0" + height="16" + width="16" + tab_stop="false" /> + <remove_btn + name="remove_wearable" + layout="topleft" + follows="top|right" + image_unselected="Remove_Icon" + image_selected="Remove_Icon" + top="1" + left="26" + height="16" + width="16" + tab_stop="false" /> +</inventory_list_item> diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 59eb18b734..6d68fd5453 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -518,7 +518,7 @@ class WindowsManifest(ViewerManifest): self.path("alut.dll") # For textures - self.path("openjpeg.dll") + self.path("openjp2.dll") # Uriparser self.path("uriparser.dll") @@ -1501,7 +1501,7 @@ class Linux_i686_Manifest(LinuxManifest): self.path("libdirectfb-1.*.so.*") self.path("libfusion-1.*.so.*") self.path("libdirect-1.*.so.*") - self.path("libopenjpeg.so*") + self.path("libopenjp2.so*") self.path("libdirectfb-1.4.so.5") self.path("libfusion-1.4.so.5") self.path("libdirect-1.4.so.5*") |