diff options
| author | Oz Linden <oz@lindenlab.com> | 2012-11-19 11:09:58 -0500 | 
|---|---|---|
| committer | Oz Linden <oz@lindenlab.com> | 2012-11-19 11:09:58 -0500 | 
| commit | b7f8a2479249646c7fb38ead195d5197ab733c94 (patch) | |
| tree | c1bf4a2b0ecac69a4705827a042ea7f0224ebc54 | |
| parent | c94756d92c7353cb91bfddb5e342f825457e1a7e (diff) | |
| parent | f8749ec9bd03072cc5b50f4cb1a61289b2989c72 (diff) | |
merge up to 3.4.1-release
112 files changed, 2142 insertions, 1114 deletions
| @@ -69,37 +69,38 @@ b53a0576eec80614d7767ed72b40ed67aeff27c9 DRTVWR-38_2.5.2-release  4e9eec6a347f89b2b3f295beb72f1cf7837dff66 2.6.0-start  9283d6d1d7eb71dfe4c330e7c9144857e7356bde 2.6.0-beta1  9283d6d1d7eb71dfe4c330e7c9144857e7356bde DRTVWR-40_2.6.0-beta1 +461c8c65b5c799ddfe365422f9be9c0095d91e7d 2.6.0-beta1-tip  9e4641f4a7870c0f565a25a2971368d5a29516a1 2.6.0-beta2  9e4641f4a7870c0f565a25a2971368d5a29516a1 DRTVWR-41_2.6.0-beta2 -42f32494bac475d0737799346f6831558ae8bf5d 2.6.0-release -42f32494bac475d0737799346f6831558ae8bf5d DRTVWR-39_2.6.0-release  c5bdef3aaa2744626aef3c217ce29e1900d357b3 2.6.1-beta1  c5bdef3aaa2744626aef3c217ce29e1900d357b3 2.6.1-start  c5bdef3aaa2744626aef3c217ce29e1900d357b3 DRTVWR-43_2.6.1-beta1 -c9182ed77d427c759cfacf49a7b71a2e20d522aa 2.6.1-release -c9182ed77d427c759cfacf49a7b71a2e20d522aa DRTVWR-42_2.6.1-release  56b2778c743c2a964d82e1caf11084d76a87de2c 2.6.2-start  d1203046bb653b763f835b04d184646949d8dd5c 2.6.2-beta1  d1203046bb653b763f835b04d184646949d8dd5c DRTVWR-45_2.6.2-beta1 -214180ad5714ce8392b82bbebcc92f4babd98300 2.6.2-release -214180ad5714ce8392b82bbebcc92f4babd98300 DRTVWR-44_2.6.2-release +42f32494bac475d0737799346f6831558ae8bf5d 2.6.0-release +42f32494bac475d0737799346f6831558ae8bf5d DRTVWR-39_2.6.0-release +c9182ed77d427c759cfacf49a7b71a2e20d522aa 2.6.1-release +c9182ed77d427c759cfacf49a7b71a2e20d522aa DRTVWR-42_2.6.1-release  52b2263ab28f0976c689fd0b76c55a9eb027cdbf end-of-develop.py  ec32f1045e7c2644015245df3a9933620aa194b8 2.6.3-start  d7fcefabdf32bb61a9ea6d6037c1bb26190a85bc 2.6.3-beta1  d7fcefabdf32bb61a9ea6d6037c1bb26190a85bc DRTVWR-47_2.6.3-beta1  0630e977504af5ea320c58d33cae4e1ddee793e9 2.6.3-beta2  0630e977504af5ea320c58d33cae4e1ddee793e9 DRTVWR-48_2.6.3-beta2 -8f2da1701c81a62352df2b8d413d27fb2cade9a6 2.6.3-release -8f2da1701c81a62352df2b8d413d27fb2cade9a6 DRTVWR-46_2.6.3-release  3178e311da3a8739a85363665006ea3c4610cad4 dons-headless-hackathon-work +214180ad5714ce8392b82bbebcc92f4babd98300 2.6.2-release +214180ad5714ce8392b82bbebcc92f4babd98300 DRTVWR-44_2.6.2-release  7db558aaa7c176f2022b3e9cfe38ac72f6d1fccd 2.6.5-beta1  7db558aaa7c176f2022b3e9cfe38ac72f6d1fccd DRTVWR-50_2.6.5-beta1 +8f2da1701c81a62352df2b8d413d27fb2cade9a6 2.6.3-release +8f2da1701c81a62352df2b8d413d27fb2cade9a6 DRTVWR-46_2.6.3-release  800cefce8d364ffdd2f383cbecb91294da3ea424 2.6.6-start  bb1075286b3b147b1dae2e3d6b2d56f04ff03f35 2.6.6-beta1  bb1075286b3b147b1dae2e3d6b2d56f04ff03f35 DRTVWR-52_2.6.6-beta1 +5e349dbe9cc84ea5795af8aeb6d473a0af9d4953 2.6.8-start  dac76a711da5f1489a01c1fa62ec97d99c25736d 2.6.6-release  dac76a711da5f1489a01c1fa62ec97d99c25736d DRTVWR-51_2.6.6-release -5e349dbe9cc84ea5795af8aeb6d473a0af9d4953 2.6.8-start  beafa8a9bd1d1b670b7523d865204dc4a4b38eef 2.6.8-beta1  beafa8a9bd1d1b670b7523d865204dc4a4b38eef DRTVWR-55_2.6.8-beta1  be2000b946f8cb3de5f44b2d419287d4c48ec4eb 2.6.8-release @@ -118,50 +119,50 @@ e67da2c6e3125966dd49eef98b36317afac1fcfe 2.6.9-start  9f79a6ed8fdcd2f3dac33ea6b3236eeb278dccfe 2.7.2-start  e0dc8b741eaa27dcdfbc9e956bb2579b954d15eb 2.7.2-beta1  e0dc8b741eaa27dcdfbc9e956bb2579b954d15eb DRTVWR-63_2.7.2-beta1 +6a3e7e403bd19e45fdfc2fcc716867af3ab80861 2.7.3-start  fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.1-release  fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.2-release  fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-60_2.7.1-release  fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-62_2.7.2-release -6a3e7e403bd19e45fdfc2fcc716867af3ab80861 2.7.3-start  6af10678de4736222b2c3f7e010e984fb5b327de 2.7.4-start  be963a4eef635542f9617d7f5fd22ba48fb71958 2.7.4-beta1  be963a4eef635542f9617d7f5fd22ba48fb71958 DRTVWR-67_2.7.4-beta1 -057f319dd8eccdf63a54d99686c68cdcb31b6abc 2.7.4-release -057f319dd8eccdf63a54d99686c68cdcb31b6abc DRTVWR-66_2.7.4-release  19a498fa62570f352d7d246f17e3c81cc1d82d8b 2.7.5-start  09984bfa6cae17e0f72d02b75c1b7393c65eecfc 2.7.5-beta1  09984bfa6cae17e0f72d02b75c1b7393c65eecfc DRTVWR-69_2.7.5-beta1 -6866d9df6efbd441c66451debd376d21211de39c 2.7.5-release -6866d9df6efbd441c66451debd376d21211de39c DRTVWR-68_2.7.5-release  e1ed60913230dd64269a7f7fc52cbc6004f6d52c 2.8.0-beta1  e1ed60913230dd64269a7f7fc52cbc6004f6d52c 2.8.0-start  e1ed60913230dd64269a7f7fc52cbc6004f6d52c DRTVWR-71_2.8.0-beta1 -493d9127ee50e84ba08a736a65a23ca86f7a5b01 2.8.0-release -493d9127ee50e84ba08a736a65a23ca86f7a5b01 DRTVWR-70_2.8.0-release +057f319dd8eccdf63a54d99686c68cdcb31b6abc 2.7.4-release +057f319dd8eccdf63a54d99686c68cdcb31b6abc DRTVWR-66_2.7.4-release +6866d9df6efbd441c66451debd376d21211de39c 2.7.5-release +6866d9df6efbd441c66451debd376d21211de39c DRTVWR-68_2.7.5-release  502f6a5deca9365ddae57db4f1e30172668e171e 2.8.1-start  2c7e459e0c883f8e406b932e41e60097e9ee077e 2.8.1-beta1  2c7e459e0c883f8e406b932e41e60097e9ee077e DRTVWR-73_2.8.1-beta1 +493d9127ee50e84ba08a736a65a23ca86f7a5b01 2.8.0-release +493d9127ee50e84ba08a736a65a23ca86f7a5b01 DRTVWR-70_2.8.0-release +54bc7823ad4e3a436fef79710f685a7372bbf795 2.8.2-start +ac0f1a132d35c02a58861d37cca75b0429ac9137 2.8.3-start  29e93d7e19991011bd12b5748142b11a5dcb4370 2.8.1-release  29e93d7e19991011bd12b5748142b11a5dcb4370 DRTVWR-72_2.8.1-release  4780e3bd2b3042f91be3426151f28c30d199bb3b 2.8.1-hotfix  4780e3bd2b3042f91be3426151f28c30d199bb3b DRTVWR-76_2.8.1-hotfix -54bc7823ad4e3a436fef79710f685a7372bbf795 2.8.2-start -ac0f1a132d35c02a58861d37cca75b0429ac9137 2.8.3-start  599677276b227357140dda35bea4a2c18e2e67b5 2.8.3-beta1  599677276b227357140dda35bea4a2c18e2e67b5 DRTVWR-75_2.8.3-beta1 -fb85792b84bf28428889c4cc966469d92e5dac4c 2.8.3-release -fb85792b84bf28428889c4cc966469d92e5dac4c DRTVWR-74_2.8.3-release  6b678ea52f90d5c14181661dcd2546e25bde483e 3.0.0-start  b0be6ce3adfef3a014a2389d360539f8a86c5439 3.0.0-beta1  b0be6ce3adfef3a014a2389d360539f8a86c5439 DRTVWR-78_3.0.0-beta1 -1778f26b6d0ae762dec3ca37140f66620f2485d9 3.0.0-release -1778f26b6d0ae762dec3ca37140f66620f2485d9 DRTVWR-77_3.0.0-release +fb85792b84bf28428889c4cc966469d92e5dac4c 2.8.3-release +fb85792b84bf28428889c4cc966469d92e5dac4c DRTVWR-74_2.8.3-release  82a2079ffcb57ecb1b3849cb41376b443e1eb912 3.0.1-start  364fd63517fbacbbcb9129d096187171ba8c9e48 3.0.1-beta1  364fd63517fbacbbcb9129d096187171ba8c9e48 DRTVWR-81_3.0.1-beta1  f2412ecd6740803ea9452f1d17fd872e263a0df7 3.0.2-start  42784bf50fa01974bada2a1af3892ee09c93fcda 3.0.2-beta1  42784bf50fa01974bada2a1af3892ee09c93fcda DRTVWR-83_3.0.2-beta1 +1778f26b6d0ae762dec3ca37140f66620f2485d9 3.0.0-release +1778f26b6d0ae762dec3ca37140f66620f2485d9 DRTVWR-77_3.0.0-release  e5c9af2d7980a99a71650be3a0cf7b2b3c3b897e 3.0.2-beta2  e5c9af2d7980a99a71650be3a0cf7b2b3c3b897e DRTVWR-86_3.0.2-beta2  b95ddac176ac944efdc85cbee94ac2e1eab44c79 3.0.3-start @@ -169,9 +170,9 @@ b95ddac176ac944efdc85cbee94ac2e1eab44c79 3.0.3-start  6694f3f062aa45f64ab391d25a3eb3d5eb1b0871 DRTVWR-85_3.0.3-beta1  61aa7974df089e8621fe9a4c69bcdefdb3cc208a 3.0.3-beta2  61aa7974df089e8621fe9a4c69bcdefdb3cc208a DRTVWR-89_3.0.3-beta2 +586907287be581817b2422b5137971b22d54ea48 3.0.4-start  0496d2f74043cf4e6058e76ac3db03d44cff42ce 3.0.3-release  0496d2f74043cf4e6058e76ac3db03d44cff42ce DRTVWR-84_3.0.3-release -586907287be581817b2422b5137971b22d54ea48 3.0.4-start  92a3aa04775438226399b19deee12ac3b5a62838 3.0.5-start  c7282e59f374ee904bd793c3c444455e3399b0c5 3.1.0-start  2657fa785bbfac115852c41bd0adaff74c2ad5da 3.1.0-beta1 @@ -192,11 +193,11 @@ e440cd1dfbd128d7d5467019e497f7f803640ad6 DRTVWR-95_3.2.0-beta1  c4911ec8cd81e676dfd2af438b3e065407a94a7a 3.2.1-start  9e390d76807fa70d356b8716fb83b8ce42a629ef 3.2.1-beta1  9e390d76807fa70d356b8716fb83b8ce42a629ef DRTVWR-100_3.2.1-beta1 -a8c7030d6845186fac7c188be4323a0e887b4184 3.2.1-release -a8c7030d6845186fac7c188be4323a0e887b4184 DRTVWR-99_3.2.1-release  40b46edba007d15d0059c80864b708b99c1da368 3.2.2-start  523df3e67378541498d516d52af4402176a26bac 3.2.2-beta1  523df3e67378541498d516d52af4402176a26bac DRTVWR-102_3.2.2-beta1 +a8c7030d6845186fac7c188be4323a0e887b4184 3.2.1-release +a8c7030d6845186fac7c188be4323a0e887b4184 DRTVWR-99_3.2.1-release  80f3e30d8aa4d8f674a48bd742aaa6d8e9eae0b5 3.2.3-start  3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-beta1  3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-start @@ -278,13 +279,8 @@ a8057e1b9a1246b434a27405be35e030f7d28b0c 3.3.4-beta3  9cd174d3a54d93d409a7c346a15b8bfb40fc58f4 DRTVWR-184  ab2ffc547c8a8950ff187c4f6c95e5334fab597b 3.3.4-beta5  28e100d0379a2b0710c57647a28fc5239d3d7b99 3.3.4-release -6dfb0fba782c9233dd95f24ec48146db0d3f210b DRTVWR-199 -7c9102fb998885621919f2474a002c35b583539b 3.3.4-release2 -8c9085066c78ed5f6c9379dc054c82a6fcdb1851 DRTVWR-207 -351eea5f9dc192fc5ddea3b02958de97677a0a12 3.3.4-release3  005dfe5c4c377207d065fb27858d2eb0b53b143a DRTVWR-167  888768f162d2c0a8de1dcc5fb9a08bd8bd120a6b DRTVWR-175 -4ad8a3afe40e0200309e3ada68932c4295ac2795 DRTVWR-179  a8b3eca451a9eaab59987efb0ab1c4217e3f2dcc DRTVWR-182  1f27cdfdc54246484f8afbbe42ce48e954175cbd 3.4.0-beta1  9ee9387789701d597130f879d9011a4958753862 DRTVWR-189 @@ -298,14 +294,46 @@ ae5c83dd61d2d37c45f1d5b8bf2b036d87599f1b DRTVWR-198  b1dbb1a83f48f93f6f878cff9e52d2cb635e145c 3.4.0-beta2  37402e2b19af970d51b0a814d79892cc5647532b DRTVWR-200  182a9bf30e81070361bb020a78003b1cf398e79c 3.4.0-beta3 +6dfb0fba782c9233dd95f24ec48146db0d3f210b DRTVWR-199 +7c9102fb998885621919f2474a002c35b583539b 3.3.4-release2  7649a3dff5ec22d3727377e5f02efd0f421e4cb5 DRTVWR-201  84fb70dfe3444e75a44fb4bee43e2fc8221cebdd 3.4.0-beta4  573e863be2f26d3687161def4b9fea9b7038dda8 3.4.0-beta5 +8c9085066c78ed5f6c9379dc054c82a6fcdb1851 DRTVWR-207 +351eea5f9dc192fc5ddea3b02958de97677a0a12 3.3.4-release3  af7b28e75bd5a629cd9e0dc46fb3f1757626f493 DRTVWR-212  015012c2b740ccdec8a8c3d6e5f898449ecfe0b8 DRTVWR-213  62b07aa81b1957897c3846292bb9412977b0af6c 3.3.4-beta6 -d02759655d6b36d60f4a927e4bfce82844a82ef5 3.4.0-release  ceed0b65a69f1eac20d523e0203320a32f9a3f3c DRTVWR-215  733ceac77583874f3626ef7a15c105b83ef0f5bb 3.4.0-beta7 -d02759655d6b36d60f4a927e4bfce82844a82ef5 3.4.0-release  97977c67245f52db20eb15f1918cc0f24778cabc 3.4.0-release +5adb2b8f96c3cac88ad7c7d996d707f1b29df336 3.4.1-beta1 +b3f74858a1c8720c82d0978f3877a3fc8ba459ec 3.4.1-beta1a +2b779f233ee6f38c89cb921650c773a96e63da92 DRTVWR-220 +0b9d95f4bfb6867cbf56eaec51633b0da2f1262d DRTVWR-221 +e6e553761829dc0270eaaa712b7cb0622535b076 3.4.1-beta3 +f00068a66a2e2f72acbe3f690b98b323e740b289 DRTVWR-222 +305950187c628a5d6743ee9ea711cc5b9177a18e 3.4.1-beta4 +dd23d4da3bcb2ffda58569e759feb7c119982973 DRTVWR-224 +0bd3744ff060452aa13ff4992eafb381df7b1012 3.4.1-beta5 +29075f8c1abed53dcf195a59f61744e27a91108f DRTVWR-226 +fba99f381b8d4ad1b7b42fa4993b29998d95be18 DRTVWR-179 +49ed253c80bed7410e238eeab35a9f14cb034364 3.4.1-beta6 +468ca3268229011a59df99229b24315844b33d34 DRTVWR-227 +524da902713e8b60322640b9825101add4a7c497 3.4.1-beta7 +173c2809f9873499c4b9d6bc044ec941c954d3fb DRTVWR-228 +1dc94555582f52718834081e7659e973ae4521f7 3.4.1-beta8 +52c164c8023a5e65f3dc1b0bbb7fa1dd0c631b6b DRTVWR-231 +464cf7a63a9a2f95bc4972dc022ca765e93de7d3 DRTVWR-233 +637fe8bbee5e24940448198c221d5ee0fa3247b4 3.4.1-beta9 +4e0d84e92132e9e95a1d52a1e49bad69c278ea05 3.4.1-beta10 +f7cbd60a3f57ff1101157eeb79ea21e8898bedae DRTVWR-235 +baf97f06ae17223614c5e31aa42e71d87cff07fe DRTVWR-236 +18498afcdb835d6fc4d36ed935347d3b65307bad 3.4.1-beta11 +b2f21e3442542283a80e7eaebae9f833e5a927b6 DRTVWR-237 +853a202426398cb0b7676aa498603a25d8ad20fb 3.4.1-beta12 +853a202426398cb0b7676aa498603a25d8ad20fb 3.4.1-beta12 +b6b68f3c2c6dd04ad88bd0575aad67bf87a9c108 3.4.1-beta12 +b6b68f3c2c6dd04ad88bd0575aad67bf87a9c108 3.4.1-beta12 +3f9be82de642d468c5fc272cb9d96b46b5498402 3.4.1-beta12 +e59ffd3fe0838ae6b09b242a6e9df71761b88f41 3.4.1-release diff --git a/BuildParams b/BuildParams index 7601414d20..ecf15f3f2a 100644 --- a/BuildParams +++ b/BuildParams @@ -3,6 +3,7 @@  # Please refer to:  #  https://wiki.secondlife.com/wiki/Automated_Build_System +  # Global setting for now...  Darwin.symbolfiles = "newview/Release/secondlife-symbols-darwin.tar.bz2"  CYGWIN.symbolfiles = "newview/Release/secondlife-symbols-windows.tar.bz2" @@ -20,8 +21,13 @@ email_status_this_is_os = true  # Limit extent of codeticket updates to revisions after...  codeticket_since = 3.3.0-release +clean_on_success = false +run_tests = false +build_Darwin_Debug = false +build_Darwin_RelWithDebInfo = false +      # ======================================== -# Viewer Development +# Viewer Development --  # ========================================  # Report changes since... diff --git a/autobuild.xml b/autobuild.xml index f986610a88..286e4e28de 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1770,9 +1770,9 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>dde928cb24d22a267004a8c17669ba65</string> +              <string>8aedfdcf670348c18a9991ae1b384a61</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/226426/arch/Linux/installer/google_perftools-1.7-linux-20110412.tar.bz2</string> +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/Linux/installer/gperftools-2.0-linux-20120727.tar.bz2</string>              </map>              <key>name</key>              <string>linux</string> @@ -1782,9 +1782,9 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>8308f7bd68bb7083655753b7abe7225f</string> +              <string>f62841804acb91e1309603a84f3f0ce8</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/226287/arch/CYGWIN/installer/google_perftools-1.7-windows-20110411.tar.bz2</string> +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/CYGWIN/installer/gperftools-2.0-windows-20120727.tar.bz2</string>              </map>              <key>name</key>              <string>windows</string> diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 98eeed09b3..666c94af86 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -69,6 +69,7 @@ if (WINDOWS)        /Oy-        /Zc:wchar_t-        /arch:SSE2 +      /fp:fast        )    # Are we using the crummy Visual Studio KDU build workaround? @@ -198,7 +199,7 @@ if (DARWIN)    add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)    set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}") -  set(DARWIN_extra_cstar_flags "-mlong-branch") +  set(DARWIN_extra_cstar_flags "-mlong-branch -g")    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  ${DARWIN_extra_cstar_flags}")    # NOTE: it's critical that the optimization flag is put in front. diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 224e0a8b51..9f05c4cff2 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -57,10 +57,10 @@ if(WINDOWS)          libhunspell.dll          ) -    if(USE_GOOGLE_PERFTOOLS) +    if(USE_TCMALLOC)        set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll)        set(release_files ${release_files} libtcmalloc_minimal.dll) -    endif(USE_GOOGLE_PERFTOOLS) +    endif(USE_TCMALLOC)      if (FMOD)        set(debug_files ${debug_files} fmod.dll) @@ -272,13 +272,16 @@ elseif(LINUX)          libopenal.so          libopenjpeg.so          libssl.so -        libtcmalloc_minimal.so          libuuid.so.16          libuuid.so.16.0.22          libssl.so.1.0.0          libfontconfig.so.1.4.4         ) +    if (USE_TCMALLOC) +      set(release_files ${release_files} "libtcmalloc_minimal.so") +    endif (USE_TCMALLOC) +      if (FMOD)        set(release_files ${release_files} "libfmod-3.75.so")      endif (FMOD) diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index d9f91193be..09501e0406 100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake @@ -1,20 +1,34 @@  # -*- cmake -*-  include(Prebuilt) +# If you want to enable or disable TCMALLOC in viewer builds, this is the place. +# set ON or OFF as desired. +set (USE_TCMALLOC ON) +  if (STANDALONE)    include(FindGooglePerfTools)  else (STANDALONE)    if (WINDOWS) -    use_prebuilt_binary(tcmalloc) -    set(TCMALLOC_LIBRARIES  -        debug libtcmalloc_minimal-debug -        optimized libtcmalloc_minimal) +    if (USE_TCMALLOC) +       use_prebuilt_binary(tcmalloc) +       set(TCMALLOC_LIBRARIES  +         debug libtcmalloc_minimal-debug +         optimized libtcmalloc_minimal) +       set(TCMALLOC_LINK_FLAGS  "/INCLUDE:__tcmalloc") +    else (USE_TCMALLOC) +      set(TCMALLOC_LIBRARIES) +      set(TCMALLOC_LINK_FLAGS) +    endif (USE_TCMALLOC)      set(GOOGLE_PERFTOOLS_FOUND "YES")    endif (WINDOWS)    if (LINUX) -    use_prebuilt_binary(tcmalloc) -    set(TCMALLOC_LIBRARIES  -    tcmalloc) +    if (USE_TCMALLOC) +      use_prebuilt_binary(tcmalloc) +      set(TCMALLOC_LIBRARIES  +        tcmalloc) +    else (USE_TCMALLOC) +      set(TCMALLOC_LIBRARIES) +    endif (USE_TCMALLOC)      set(PROFILER_LIBRARIES profiler)      set(GOOGLE_PERFTOOLS_INCLUDE_DIR          ${LIBS_PREBUILT_DIR}/include) @@ -29,13 +43,19 @@ if (GOOGLE_PERFTOOLS_FOUND)  endif (GOOGLE_PERFTOOLS_FOUND)  if (WINDOWS) -    set(USE_GOOGLE_PERFTOOLS ON) +   set(USE_GOOGLE_PERFTOOLS ON)  endif (WINDOWS)  if (USE_GOOGLE_PERFTOOLS) -  set(TCMALLOC_FLAG -ULL_USE_TCMALLOC=1) +  if (USE_TCMALLOC) +    set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1) +  else (USE_TCMALLOC) +    set(TCMALLOC_FLAG -ULL_USE_TCMALLOC) +  endif (USE_TCMALLOC) +endif (USE_GOOGLE_PERFTOOLS) + +if (USE_GOOGLE_PERFTOOLS)    include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})    set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES})  else (USE_GOOGLE_PERFTOOLS) -  set(TCMALLOC_FLAG -ULL_USE_TCMALLOC)  endif (USE_GOOGLE_PERFTOOLS) diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index 03ce46781c..543075db5b 100755 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -214,6 +214,15 @@ FUNCTION(LL_ADD_INTEGRATION_TEST      SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}")    endif(STANDALONE) +  if (WINDOWS) +    SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} +        PROPERTIES +        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS ${TCMALLOC_LINK_FLAGS}" +        LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" +        LINK_FLAGS_RELEASE "" +        ) +  endif (WINDOWS) +    # Add link deps to the executable    if(TEST_DEBUG)      message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index c9fb8534f1..0a6a8f9fa6 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -189,6 +189,7 @@ void LLCharacter::requestStopMotion( LLMotion* motion)  //-----------------------------------------------------------------------------  static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation");  static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); +static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions");  void LLCharacter::updateMotions(e_update_t update_type)  { @@ -206,7 +207,10 @@ void LLCharacter::updateMotions(e_update_t update_type)  			mMotionController.unpauseAllMotions();  		}  		bool force_update = (update_type == FORCE_UPDATE); -		mMotionController.updateMotions(force_update); +		{ +			LLFastTimer t(FTM_UPDATE_MOTIONS); +			mMotionController.updateMotions(force_update); +		}  	}  } diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index bb892f4a7f..4f6351709e 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -542,6 +542,8 @@ void LLMotionController::updateIdleActiveMotions()  //-----------------------------------------------------------------------------  // updateMotionsByType()  //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_MOTION_ON_UPDATE("Motion onUpdate"); +  void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)  {  	BOOL update_result = TRUE; @@ -699,7 +701,10 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty  			}  			// perform motion update -			update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); +			{ +				LLFastTimer t(FTM_MOTION_ON_UPDATE); +				update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); +			}  		}  		//********************** @@ -810,7 +815,7 @@ void LLMotionController::updateMotions(bool force_update)  	// Always cap the number of loaded motions  	purgeExcessMotions(); -	 +		  	// Update timing info for this time step.  	if (!mPaused)  	{ @@ -832,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update)  				}  				updateLoadingMotions(); +				  				return;  			} @@ -850,7 +856,7 @@ void LLMotionController::updateMotions(bool force_update)  	}  	updateLoadingMotions(); - +	  	resetJointSignatures();  	if (mPaused && !force_update) @@ -861,11 +867,12 @@ void LLMotionController::updateMotions(bool force_update)  	{  		// update additive motions  		updateAdditiveMotions(); +				  		resetJointSignatures(); - +		  		// update all regular motions  		updateRegularMotions(); - +		  		if (use_quantum)  		{  			mPoseBlender.blendAndCache(TRUE); diff --git a/indra/llcommon/llallocator.cpp b/indra/llcommon/llallocator.cpp index 6f6abefc67..87654b5b97 100644 --- a/indra/llcommon/llallocator.cpp +++ b/indra/llcommon/llallocator.cpp @@ -27,7 +27,7 @@  #include "linden_common.h"  #include "llallocator.h" -#if LL_USE_TCMALLOC +#if (LL_USE_TCMALLOC && LL_USE_HEAP_PROFILER)  #include "google/heap-profiler.h"  #include "google/commandlineflags_public.h" diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index ed192a9975..ca258900c7 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -289,6 +289,7 @@ void LLApp::setupErrorHandling()  	// occasionally checks to see if the app is in an error state, and sees if it needs to be run.  #if LL_WINDOWS +#if LL_SEND_CRASH_REPORTS  	// This sets a callback to handle w32 signals to the console window.  	// The viewer shouldn't be affected, sicne its a windowed app.  	SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ConsoleCtrlHandler, TRUE); @@ -300,7 +301,7 @@ void LLApp::setupErrorHandling()  		mExceptionHandler = new google_breakpad::ExceptionHandler(  			L"C:\\Temp\\", 0, windows_post_minidump_callback, 0, google_breakpad::ExceptionHandler::HANDLER_ALL);  	} - +#endif  #else  	//  	// Start up signal handling. diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 3b9758f996..70ad10ad55 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -61,6 +61,18 @@ BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;  LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sMemAllocationTracker;  #endif +void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) +{ +#ifdef SHOW_ASSERT +	// Redundant, place to set breakpoints. +	if (ptr%alignment!=0) +	{ +		llwarns << "alignment check failed" << llendl; +	} +	llassert(ptr%alignment==0); +#endif +} +  //static  void LLMemory::initClass()  { @@ -240,21 +252,6 @@ U32 LLMemory::getAllocatedMemKB()  	return sAllocatedMemInKB ;  } -void* ll_allocate (size_t size) -{ -	if (size == 0) -	{ -		llwarns << "Null allocation" << llendl; -	} -	void *p = malloc(size); -	if (p == NULL) -	{ -		LLMemory::freeReserve(); -		llerrs << "Out of memory Error" << llendl; -	} -	return p; -} -  //----------------------------------------------------------------------------  #if defined(LL_WINDOWS) @@ -1353,7 +1350,7 @@ char* LLPrivateMemoryPool::allocate(U32 size)  	//if the asked size larger than MAX_BLOCK_SIZE, fetch from heap directly, the pool does not manage it  	if(size >= CHUNK_SIZE)  	{ -		return (char*)malloc(size) ; +		return (char*)ll_aligned_malloc_16(size) ;  	}  	char* p = NULL ; @@ -1410,7 +1407,7 @@ char* LLPrivateMemoryPool::allocate(U32 size)  			to_log = false ;  		} -		return (char*)malloc(size) ; +		return (char*)ll_aligned_malloc_16(size) ;  	}  	return p ; @@ -1429,7 +1426,7 @@ void LLPrivateMemoryPool::freeMem(void* addr)  	if(!chunk)  	{ -		free(addr) ; //release from heap +		ll_aligned_free_16(addr) ; //release from heap  	}  	else  	{ @@ -1553,7 +1550,7 @@ LLPrivateMemoryPool::LLMemoryChunk* LLPrivateMemoryPool::addChunk(S32 chunk_inde  	mReservedPoolSize += preferred_size + overhead ; -	char* buffer = (char*)malloc(preferred_size + overhead) ; +	char* buffer = (char*)ll_aligned_malloc_16(preferred_size + overhead) ;  	if(!buffer)  	{  		return NULL ; @@ -1621,7 +1618,7 @@ void LLPrivateMemoryPool::removeChunk(LLMemoryChunk* chunk)  	mReservedPoolSize -= chunk->getBufferSize() ;  	//release memory -	free(chunk->getBuffer()) ; +	ll_aligned_free_16(chunk->getBuffer()) ;  }  U16 LLPrivateMemoryPool::findHashKey(const char* addr) @@ -1965,7 +1962,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size,  	if(!poolp)  	{ -		p = (char*)malloc(size) ; +		p = (char*)ll_aligned_malloc_16(size) ;  	}  	else  	{ @@ -1994,7 +1991,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size)  	}  	else  	{ -		return (char*)malloc(size) ; +		return (char*)ll_aligned_malloc_16(size) ;  	}  }  #endif @@ -2019,7 +2016,7 @@ void  LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr  	{  		if(!sPrivatePoolEnabled)  		{ -			free(addr) ; //private pool is disabled. +			ll_aligned_free_16(addr) ; //private pool is disabled.  		}  		else if(!sInstance) //the private memory manager is destroyed, try the dangling list  		{ diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index bbbdaa6497..10013e0f92 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -27,7 +27,13 @@  #define LLMEMORY_H  #include "llmemtype.h" -#if LL_DEBUG + +#if LL_WINDOWS && LL_DEBUG +#define LL_CHECK_MEMORY llassert(_CrtCheckMemory()); +#else +#define LL_CHECK_MEMORY +#endif +  inline void* ll_aligned_malloc( size_t size, int align )  {  	void* mem = malloc( size + (align - 1) + sizeof(void*) ); @@ -43,10 +49,11 @@ inline void ll_aligned_free( void* ptr )  	free( ((void**)ptr)[-1] );  } +#if !LL_USE_TCMALLOC  inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().  {  #if defined(LL_WINDOWS) -	return _mm_malloc(size, 16); +	return _aligned_malloc(size, 16);  #elif defined(LL_DARWIN)  	return malloc(size); // default osx malloc is 16 byte aligned.  #else @@ -61,7 +68,7 @@ inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed wi  inline void ll_aligned_free_16(void *p)  {  #if defined(LL_WINDOWS) -	_mm_free(p); +	_aligned_free(p);  #elif defined(LL_DARWIN)  	return free(p);  #else @@ -69,10 +76,39 @@ inline void ll_aligned_free_16(void *p)  #endif  } +inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // returned hunk MUST be freed with ll_aligned_free_16(). +{ +#if defined(LL_WINDOWS) +	return _aligned_realloc(ptr, size, 16); +#elif defined(LL_DARWIN) +	return realloc(ptr,size); // default osx malloc is 16 byte aligned. +#else +	//FIXME: memcpy is SLOW +	void* ret = ll_aligned_malloc_16(size); +	if (ptr) +	{ +		if (ret) +		{ +			// Only copy the size of the smallest memory block to avoid memory corruption. +			memcpy(ret, ptr, llmin(old_size, size)); +		} +		ll_aligned_free_16(ptr); +	} +	return ret; +#endif +} + +#else // USE_TCMALLOC +// ll_aligned_foo_16 are not needed with tcmalloc +#define ll_aligned_malloc_16 malloc +#define ll_aligned_realloc_16(a,b,c) realloc(a,b) +#define ll_aligned_free_16 free +#endif // USE_TCMALLOC +  inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed with ll_aligned_free_32().  {  #if defined(LL_WINDOWS) -	return _mm_malloc(size, 32); +	return _aligned_malloc(size, 32);  #elif defined(LL_DARWIN)  	return ll_aligned_malloc( size, 32 );  #else @@ -87,22 +123,13 @@ inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed wi  inline void ll_aligned_free_32(void *p)  {  #if defined(LL_WINDOWS) -	_mm_free(p); +	_aligned_free(p);  #elif defined(LL_DARWIN)  	ll_aligned_free( p );  #else  	free(p); // posix_memalign() is compatible with heap deallocator  #endif  } -#else // LL_DEBUG -// ll_aligned_foo are noops now that we use tcmalloc everywhere (tcmalloc aligns automatically at appropriate intervals) -#define ll_aligned_malloc( size, align ) malloc(size) -#define ll_aligned_free( ptr ) free(ptr) -#define ll_aligned_malloc_16 malloc -#define ll_aligned_free_16 free -#define ll_aligned_malloc_32 malloc -#define ll_aligned_free_32 free -#endif // LL_DEBUG  #ifndef __DEBUG_PRIVATE_MEM__  #define __DEBUG_PRIVATE_MEM__  0 @@ -512,4 +539,13 @@ void  LLPrivateMemoryPoolTester::operator delete[](void* addr)  // LLSingleton moved to llsingleton.h +LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); + +#ifdef SHOW_ASSERT +#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment)) +#else +#define ll_assert_aligned(ptr,alignment) +#endif + +  #endif diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 1738c16dea..abf47a0f57 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -134,8 +134,8 @@ S32 LLQueuedThread::updateQueue(F32 max_time_ms)  		pending = getPending();  		if(pending > 0)  		{ -		unpause(); -	} +			unpause(); +		}  	}  	else  	{ diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index a6ad6b125c..c2fbb544a8 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -114,7 +114,7 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :  		apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread  	}  	mRunCondition = new LLCondition(mAPRPoolp); - +	mDataLock = new LLMutex(mAPRPoolp);  	mLocalAPRFilePoolp = NULL ;  } @@ -173,7 +173,10 @@ void LLThread::shutdown()  	}  	delete mRunCondition; -	mRunCondition = 0; +	mRunCondition = NULL; + +	delete mDataLock; +	mDataLock = NULL;  	if (mIsLocalPool && mAPRPoolp)  	{ @@ -242,28 +245,30 @@ bool LLThread::runCondition(void)  // Stop thread execution if requested until unpaused.  void LLThread::checkPause()  { -	mRunCondition->lock(); +	mDataLock->lock();  	// This is in a while loop because the pthread API allows for spurious wakeups.  	while(shouldSleep())  	{ +		mDataLock->unlock();  		mRunCondition->wait(); // unlocks mRunCondition +		mDataLock->lock();  		// mRunCondition is locked when the thread wakes up  	} - 	mRunCondition->unlock(); + 	mDataLock->unlock();  }  //============================================================================  void LLThread::setQuitting()  { -	mRunCondition->lock(); +	mDataLock->lock();  	if (mStatus == RUNNING)  	{  		mStatus = QUITTING;  	} -	mRunCondition->unlock(); +	mDataLock->unlock();  	wake();  } @@ -285,12 +290,12 @@ void LLThread::yield()  void LLThread::wake()  { -	mRunCondition->lock(); +	mDataLock->lock();  	if(!shouldSleep())  	{  		mRunCondition->signal();  	} -	mRunCondition->unlock(); +	mDataLock->unlock();  }  void LLThread::wakeLocked() @@ -481,6 +486,19 @@ LLThreadSafeRefCount::LLThreadSafeRefCount() :  {  } +LLThreadSafeRefCount::LLThreadSafeRefCount(const LLThreadSafeRefCount& src) +{ +	if (sMutex) +	{ +		sMutex->lock(); +	} +	mRef = 0; +	if (sMutex) +	{ +		sMutex->unlock(); +	} +} +  LLThreadSafeRefCount::~LLThreadSafeRefCount()  {   	if (mRef != 0) @@ -489,6 +507,7 @@ LLThreadSafeRefCount::~LLThreadSafeRefCount()  	}  } +  //============================================================================  LLResponder::~LLResponder() diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index b52e70ab2e..115bf47553 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -97,6 +97,7 @@ private:  protected:  	std::string			mName;  	LLCondition*		mRunCondition; +	LLMutex*			mDataLock;  	apr_thread_t		*mAPRThreadp;  	apr_pool_t			*mAPRPoolp; @@ -122,15 +123,15 @@ protected:  	inline void unlockData();  	// This is the predicate that decides whether the thread should sleep.   -	// It should only be called with mRunCondition locked, since the virtual runCondition() function may need to access +	// It should only be called with mDataLock locked, since the virtual runCondition() function may need to access  	// data structures that are thread-unsafe.  	bool shouldSleep(void) { return (mStatus == RUNNING) && (isPaused() || (!runCondition())); }  	// To avoid spurious signals (and the associated context switches) when the condition may or may not have changed, you can do the following: -	// mRunCondition->lock(); +	// mDataLock->lock();  	// if(!shouldSleep())  	//     mRunCondition->signal(); -	// mRunCondition->unlock(); +	// mDataLock->unlock();  };  //============================================================================ @@ -205,12 +206,12 @@ private:  void LLThread::lockData()  { -	mRunCondition->lock(); +	mDataLock->lock();  }  void LLThread::unlockData()  { -	mRunCondition->unlock(); +	mDataLock->unlock();  } @@ -227,15 +228,27 @@ public:  private:  	static LLMutex* sMutex; -private: -	LLThreadSafeRefCount(const LLThreadSafeRefCount&); // not implemented -	LLThreadSafeRefCount&operator=(const LLThreadSafeRefCount&); // not implemented -  protected:  	virtual ~LLThreadSafeRefCount(); // use unref()  public:  	LLThreadSafeRefCount(); +	LLThreadSafeRefCount(const LLThreadSafeRefCount&); +	LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)  +	{ +		if (sMutex) +		{ +			sMutex->lock(); +		} +		mRef = 0; +		if (sMutex) +		{ +			sMutex->unlock(); +		} +		return *this; +	} + +  	void ref()  	{ diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 2038681905..bcc661a920 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@  const S32 LL_VERSION_MAJOR = 3;  const S32 LL_VERSION_MINOR = 4; -const S32 LL_VERSION_PATCH = 0; +const S32 LL_VERSION_PATCH = 1;  const S32 LL_VERSION_BUILD = 0;  const char * const LL_CHANNEL = "Second Life Developer"; diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 6775b005f4..825878c5ef 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -1660,6 +1660,12 @@ static void avg4_colors2(const U8* a, const U8* b, const U8* c, const U8* d, U8*  	dst[1] = (U8)(((U32)(a[1]) + b[1] + c[1] + d[1])>>2);  } +void LLImageBase::setDataAndSize(U8 *data, S32 size) +{  +	ll_assert_aligned(data, 16); +	mData = data; mDataSize = size;  +}	 +  //static  void LLImageBase::generateMip(const U8* indata, U8* mipdata, S32 width, S32 height, S32 nchannels)  { diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 46e6d1a901..9ce77a0d01 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -148,7 +148,7 @@ public:  protected:  	// special accessor to allow direct setting of mData and mDataSize by LLImageFormatted -	void setDataAndSize(U8 *data, S32 size) { mData = data; mDataSize = size; }	 +	void setDataAndSize(U8 *data, S32 size);  public:  	static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index b5e59c1ca3..5865ae030c 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -117,6 +117,7 @@ if (LL_TESTS)    # INTEGRATION TESTS    set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})    # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. +  LL_ADD_INTEGRATION_TEST(alignment "" "${test_libs}")    LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}")    LL_ADD_INTEGRATION_TEST(llquaternion llquaternion.cpp "${test_libs}")    LL_ADD_INTEGRATION_TEST(mathmisc "" "${test_libs}") diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index ec67b91d05..0b591be622 100644 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -60,7 +60,7 @@ static const F32 MAX_FIELD_OF_VIEW = 175.f * DEG_TO_RAD;  // roll(), pitch(), yaw()  // etc... - +LL_ALIGN_PREFIX(16)  class LLCamera  : 	public LLCoordFrame  { @@ -108,7 +108,7 @@ public:  	};  private: -	LLPlane mAgentPlanes[7];  //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP +	LL_ALIGN_16(LLPlane mAgentPlanes[7]);  //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP  	U8 mPlaneMask[8];         // 8 for alignment	  	F32 mView;					// angle between top and bottom frustum planes in radians. @@ -116,13 +116,13 @@ private:  	S32 mViewHeightInPixels;	// for ViewHeightInPixels() only  	F32 mNearPlane;  	F32 mFarPlane; -	LLPlane mLocalPlanes[4]; +	LL_ALIGN_16(LLPlane mLocalPlanes[4]);  	F32 mFixedDistance;			// Always return this distance, unless < 0  	LLVector3 mFrustCenter;		// center of frustum and radius squared for ultra-quick exclusion test  	F32 mFrustRadiusSquared; -	LLPlane mWorldPlanes[PLANE_NUM]; -	LLPlane mHorizPlanes[HORIZ_PLANE_NUM]; +	LL_ALIGN_16(LLPlane mWorldPlanes[PLANE_NUM]); +	LL_ALIGN_16(LLPlane mHorizPlanes[HORIZ_PLANE_NUM]);  	U32 mPlaneCount;  //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in @@ -208,7 +208,7 @@ protected:  	void calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom);  	void calculateFrustumPlanesFromWindow(F32 x1, F32 y1, F32 x2, F32 y2);  	void calculateWorldFrustumPlanes(); -}; +} LL_ALIGN_POSTFIX(16);  #endif diff --git a/indra/llmath/llmatrix3a.h b/indra/llmath/llmatrix3a.h index adb7e3389d..9916cfd2da 100644 --- a/indra/llmath/llmatrix3a.h +++ b/indra/llmath/llmatrix3a.h @@ -111,7 +111,7 @@ public:  protected: -	LLVector4a mColumns[3]; +	LL_ALIGN_16(LLVector4a mColumns[3]);  }; diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index 27cf5b79f6..c4cefdb4fa 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -34,7 +34,7 @@  class LLMatrix4a  {  public: -	LLVector4a mMatrix[4]; +	LL_ALIGN_16(LLVector4a mMatrix[4]);  	inline void clear()  	{ diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 1b11e83b4a..4ac1e55cfc 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -31,7 +31,6 @@  #include "v3math.h"  #include "llvector4a.h"  #include <vector> -#include <set>  #define OCT_ERRS LL_WARNS("OctreeErrors") @@ -79,16 +78,18 @@ public:  	typedef LLOctreeTraveler<T>									oct_traveler;  	typedef LLTreeTraveler<T>									tree_traveler; -	typedef typename std::set<LLPointer<T> >					element_list; -	typedef typename element_list::iterator						element_iter; -	typedef typename element_list::const_iterator	const_element_iter; +	typedef std::vector<LLPointer<T> >							element_list; +	typedef LLPointer<T>*										element_iter; +	typedef const LLPointer<T>*									const_element_iter;  	typedef typename std::vector<LLTreeListener<T>*>::iterator	tree_listener_iter; -	typedef typename std::vector<LLOctreeNode<T>* >				child_list; +	typedef LLOctreeNode<T>**									child_list; +	typedef LLOctreeNode<T>**									child_iter; +  	typedef LLTreeNode<T>		BaseType;  	typedef LLOctreeNode<T>		oct_node;  	typedef LLOctreeListener<T>	oct_listener; -	/*void* operator new(size_t size) +	void* operator new(size_t size)  	{  		return ll_aligned_malloc_16(size);  	} @@ -96,7 +97,7 @@ public:  	void operator delete(void* ptr)  	{  		ll_aligned_free_16(ptr); -	}*/ +	}  	LLOctreeNode(	const LLVector4a& center,   					const LLVector4a& size,  @@ -105,6 +106,10 @@ public:  	:	mParent((oct_node*)parent),   		mOctant(octant)   	{  +		//always keep a NULL terminated list to avoid out of bounds exceptions in debug builds +		mData.push_back(NULL); +		mDataEnd = &mData[0]; +  		mCenter = center;  		mSize = size; @@ -123,6 +128,16 @@ public:  	{   		BaseType::destroyListeners();  +		for (U32 i = 0; i < mElementCount; ++i) +		{ +			mData[i]->setBinIndex(-1); +			mData[i] = NULL; +		} + +		mData.clear(); +		mData.push_back(NULL); +		mDataEnd = &mData[0]; +  		for (U32 i = 0; i < getChildCount(); i++)  		{  			delete getChild(i); @@ -219,12 +234,17 @@ public:  	}  	void accept(oct_traveler* visitor)				{ visitor->visit(this); } -	virtual bool isLeaf() const						{ return mChild.empty(); } +	virtual bool isLeaf() const						{ return mChildCount == 0; }  	U32 getElementCount() const						{ return mElementCount; } +	bool isEmpty() const							{ return mElementCount == 0; }  	element_list& getData()							{ return mData; }  	const element_list& getData() const				{ return mData; } -	 +	element_iter getDataBegin()						{ return &mData[0]; } +	element_iter getDataEnd()						{ return mDataEnd; } +	const_element_iter getDataBegin() const			{ return &mData[0]; } +	const_element_iter getDataEnd() const			{ return mDataEnd; } +		  	U32 getChildCount()	const						{ return mChildCount; }  	oct_node* getChild(U32 index)					{ return mChild[index]; }  	const oct_node* getChild(U32 index) const		{ return mChild[index]; } @@ -289,7 +309,7 @@ public:  	virtual bool insert(T* data)  	{ -		if (data == NULL) +		if (data == NULL || data->getBinIndex() != -1)  		{  			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl;  			return false; @@ -302,13 +322,12 @@ public:  			if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||  				(data->getBinRadius() > getSize()[0] &&	parent && parent->getElementCount() >= gOctreeMaxCapacity)))   			{ //it belongs here -				//if this is a redundant insertion, error out (should never happen) -				llassert(mData.find(data) == mData.end()); - -				mData.insert(data); +				mData.push_back(NULL); +				mData[mElementCount] = data; +				mElementCount++; +				mDataEnd = &mData[mElementCount]; +				data->setBinIndex(mElementCount-1);  				BaseType::insert(data); - -				mElementCount = mData.size();  				return true;  			}  			else @@ -342,10 +361,12 @@ public:  				if( lt == 0x7 )  				{ -					mData.insert(data); +					mData.push_back(NULL); +					mData[mElementCount] = data; +					mElementCount++; +					mDataEnd = &mData[mElementCount]; +					data->setBinIndex(mElementCount-1);  					BaseType::insert(data); - -					mElementCount = mData.size();  					return true;  				} @@ -394,23 +415,58 @@ public:  		return false;  	} +	void _remove(T* data, S32 i) +	{ //precondition -- mElementCount > 0, idx is in range [0, mElementCount) + +		mElementCount--; +		data->setBinIndex(-1);  +		 +		if (mElementCount > 0) +		{ +			if (mElementCount != i) +			{ +				mData[i] = mData[mElementCount]; //might unref data, do not access data after this point +				mData[i]->setBinIndex(i); +			} + +			mData[mElementCount] = NULL; +			mData.pop_back(); +			mDataEnd = &mData[mElementCount]; +		} +		else +		{ +			mData.clear(); +			mData.push_back(NULL); +			mDataEnd = &mData[0]; +		} + +		notifyRemoval(data); +		checkAlive(); +	} +  	bool remove(T* data)  	{ -		if (mData.find(data) != mData.end()) -		{	//we have data -			mData.erase(data); -			mElementCount = mData.size(); -			notifyRemoval(data); -			checkAlive(); -			return true; -		} -		else if (isInside(data)) +		S32 i = data->getBinIndex(); + +		if (i >= 0 && i < mElementCount) +		{ +			if (mData[i] == data) +			{ //found it +				_remove(data, i); +				llassert(data->getBinIndex() == -1); +				return true; +			} +		} +		 +		if (isInside(data))  		{  			oct_node* dest = getNodeAt(data);  			if (dest != this)  			{ -				return dest->remove(data); +				bool ret = dest->remove(data); +				llassert(data->getBinIndex() == -1); +				return ret;  			}  		} @@ -427,21 +483,22 @@ public:  		}  		//node is now root -		llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl; +		llwarns << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl;  		node->removeByAddress(data); +		llassert(data->getBinIndex() == -1);  		return true;  	}  	void removeByAddress(T* data)  	{ -        if (mData.find(data) != mData.end()) +        for (U32 i = 0; i < mElementCount; ++i)  		{ -			mData.erase(data); -			mElementCount = mData.size(); -			notifyRemoval(data); -			llwarns << "FOUND!" << llendl; -			checkAlive(); -			return; +			if (mData[i] == data) +			{ //we have data +				_remove(data, i); +				llwarns << "FOUND!" << llendl; +				return; +			}  		}  		for (U32 i = 0; i < getChildCount(); i++) @@ -453,8 +510,8 @@ public:  	void clearChildren()  	{ -		mChild.clear();  		mChildCount = 0; +  		U32* foo = (U32*) mChildMap;  		foo[0] = foo[1] = 0xFFFFFFFF;  	} @@ -516,7 +573,7 @@ public:  		mChildMap[child->getOctant()] = mChildCount; -		mChild.push_back(child); +		mChild[mChildCount] = child;  		++mChildCount;  		child->setParent(this); @@ -543,9 +600,12 @@ public:  			mChild[index]->destroy();  			delete mChild[index];  		} -		mChild.erase(mChild.begin() + index); +  		--mChildCount; +		mChild[index] = mChild[mChildCount]; +		 +  		//rebuild child map  		U32* foo = (U32*) mChildMap;  		foo[0] = foo[1] = 0xFFFFFFFF; @@ -601,11 +661,12 @@ protected:  	oct_node* mParent;  	U8 mOctant; -	child_list mChild; +	LLOctreeNode<T>* mChild[8];  	U8 mChildMap[8];  	U32 mChildCount;  	element_list mData; +	element_iter mDataEnd;  	U32 mElementCount;  };  diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index a611894721..3c32441b11 100644 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -36,6 +36,8 @@  // The plane normal = [A, B, C]  // The closest approach = D / sqrt(A*A + B*B + C*C) + +LL_ALIGN_PREFIX(16)  class LLPlane  {  public: @@ -94,7 +96,7 @@ public:  private:  	LLVector4a mV; -}; +} LL_ALIGN_POSTFIX(16); diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h index c7cdf7b32c..01458521ec 100644 --- a/indra/llmath/llsimdmath.h +++ b/indra/llmath/llsimdmath.h @@ -67,11 +67,10 @@ template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address)  #define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16) - -  #include <xmmintrin.h>  #include <emmintrin.h> +#include "llmemory.h"  #include "llsimdtypes.h"  #include "llsimdtypes.inl" diff --git a/indra/llmath/llsimdtypes.inl b/indra/llmath/llsimdtypes.inl index 712239e425..e905c84954 100644 --- a/indra/llmath/llsimdtypes.inl +++ b/indra/llmath/llsimdtypes.inl @@ -62,6 +62,7 @@ inline LLSimdScalar operator/(const LLSimdScalar& a, const LLSimdScalar& b)  inline LLSimdScalar operator-(const LLSimdScalar& a)  {  	static LL_ALIGN_16(const U32 signMask[4]) = {0x80000000, 0x80000000, 0x80000000, 0x80000000 }; +	ll_assert_aligned(signMask,16);  	return _mm_xor_ps(*reinterpret_cast<const LLQuad*>(signMask), a);  } @@ -146,6 +147,7 @@ inline LLSimdScalar& LLSimdScalar::operator/=(const LLSimdScalar& rhs)  inline LLSimdScalar LLSimdScalar::getAbs() const  {  	static const LL_ALIGN_16(U32 F_ABS_MASK_4A[4]) = { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }; +	ll_assert_aligned(F_ABS_MASK_4A,16);  	return _mm_and_ps( mQ, *reinterpret_cast<const LLQuad*>(F_ABS_MASK_4A));  } diff --git a/indra/llmath/llvector4a.cpp b/indra/llmath/llvector4a.cpp index b66b7a7076..6edeb0fefe 100644 --- a/indra/llmath/llvector4a.cpp +++ b/indra/llmath/llvector4a.cpp @@ -24,6 +24,7 @@   * $/LicenseInfo$   */ +#include "llmemory.h"  #include "llmath.h"  #include "llquantize.h" @@ -44,7 +45,10 @@ extern const LLVector4a LL_V4A_EPSILON = reinterpret_cast<const LLVector4a&> ( F  	assert(dst != NULL);  	assert(bytes > 0);  	assert((bytes % sizeof(F32))== 0);  -	 +	ll_assert_aligned(src,16); +	ll_assert_aligned(dst,16); +	assert(bytes%16==0); +  	F32* end = dst + (bytes / sizeof(F32) );  	if (bytes > 64) @@ -189,6 +193,8 @@ void LLVector4a::quantize16( const LLVector4a& low, const LLVector4a& high )  		LLVector4a oneOverDelta;  		{  			static LL_ALIGN_16( const F32 F_TWO_4A[4] ) = { 2.f, 2.f, 2.f, 2.f }; +			ll_assert_aligned(F_TWO_4A,16); +			  			LLVector4a two; two.load4a( F_TWO_4A );  			// Here we use _mm_rcp_ps plus one round of newton-raphson diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 596082509d..0526793d3a 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -32,6 +32,7 @@ class LLRotation;  #include <assert.h>  #include "llpreprocessor.h" +#include "llmemory.h"  ///////////////////////////////////  // FIRST TIME USERS PLEASE READ @@ -46,6 +47,7 @@ class LLRotation;  // LLVector3/LLVector4.   ///////////////////////////////// +LL_ALIGN_PREFIX(16)  class LLVector4a  {  public: @@ -82,6 +84,7 @@ public:  	}  	// Copy words 16-byte blocks from src to dst. Source and destination must not overlap.  +	// Source and dest must be 16-byte aligned and size must be multiple of 16.  	static void memcpyNonAliased16(F32* __restrict dst, const F32* __restrict src, size_t bytes);  	//////////////////////////////////// @@ -90,6 +93,7 @@ public:  	LLVector4a()  	{ //DO NOT INITIALIZE -- The overhead is completely unnecessary +		ll_assert_aligned(this,16);  	}  	LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f) @@ -313,7 +317,7 @@ public:  private:  	LLQuad mQ; -}; +} LL_ALIGN_POSTFIX(16);  inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p)  { diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl index 7ad22a5631..7c52ffef21 100644 --- a/indra/llmath/llvector4a.inl +++ b/indra/llmath/llvector4a.inl @@ -475,6 +475,7 @@ inline void LLVector4a::setLerp(const LLVector4a& lhs, const LLVector4a& rhs, F3  inline LLBool32 LLVector4a::isFinite3() const  {  	static LL_ALIGN_16(const U32 nanOrInfMask[4]) = { 0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000 }; +	ll_assert_aligned(nanOrInfMask,16);  	const __m128i nanOrInfMaskV = *reinterpret_cast<const __m128i*> (nanOrInfMask);  	const __m128i maskResult = _mm_and_si128( _mm_castps_si128(mQ), nanOrInfMaskV );  	const LLVector4Logical equalityCheck = _mm_castsi128_ps(_mm_cmpeq_epi32( maskResult, nanOrInfMaskV )); diff --git a/indra/llmath/llvector4logical.h b/indra/llmath/llvector4logical.h index dd66b09d43..c5698f7cea 100644 --- a/indra/llmath/llvector4logical.h +++ b/indra/llmath/llvector4logical.h @@ -27,6 +27,7 @@  #ifndef	LL_VECTOR4LOGICAL_H  #define	LL_VECTOR4LOGICAL_H +#include "llmemory.h"  ////////////////////////////  // LLVector4Logical @@ -77,6 +78,7 @@ public:  	inline LLVector4Logical& invert()  	{  		static const LL_ALIGN_16(U32 allOnes[4]) = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; +		ll_assert_aligned(allOnes,16);  		mQ = _mm_andnot_ps( mQ, *(LLQuad*)(allOnes) );  		return *this;  	} diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index cc9744756f..85ea14f9bc 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -95,17 +95,6 @@ const S32 SCULPT_MIN_AREA_DETAIL = 1;  extern BOOL gDebugGL; -void assert_aligned(void* ptr, uintptr_t alignment) -{ -#if 0 -	uintptr_t t = (uintptr_t) ptr; -	if (t%alignment != 0) -	{ -		llerrs << "Alignment check failed." << llendl; -	} -#endif -} -  BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm)  {      	LLVector3 test = (pt2-pt1)%(pt3-pt2); @@ -328,16 +317,16 @@ public:  		LLVector4a& min = node->mExtents[0];  		LLVector4a& max = node->mExtents[1]; -		if (!branch->getData().empty()) +		if (!branch->isEmpty())  		{ //node has data, find AABB that binds data set -			const LLVolumeTriangle* tri = *(branch->getData().begin()); +			const LLVolumeTriangle* tri = *(branch->getDataBegin());  			//initialize min/max to first available vertex  			min = *(tri->mV[0]);  			max = *(tri->mV[0]);  			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =  -				branch->getData().begin(); iter != branch->getData().end(); ++iter) +				branch->getDataBegin(); iter != branch->getDataEnd(); ++iter)  			{ //for each triangle in node  				//stretch by triangles in node @@ -352,7 +341,7 @@ public:  				max.setMax(max, *tri->mV[2]);  			}  		} -		else if (!branch->getChildren().empty()) +		else if (!branch->isLeaf())  		{ //no data, but child nodes exist  			LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(0)->getListener(0); @@ -6962,14 +6951,14 @@ void LLVolumeFace::resizeVertices(S32 num_verts)  	if (num_verts)  	{  		mPositions = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts); -		assert_aligned(mPositions, 16); +		ll_assert_aligned(mPositions, 16);  		mNormals = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts); -		assert_aligned(mNormals, 16); +		ll_assert_aligned(mNormals, 16);  		//pad texture coordinate block end to allow for QWORD reads  		S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF;  		mTexCoords = (LLVector2*) ll_aligned_malloc_16(size); -		assert_aligned(mTexCoords, 16); +		ll_assert_aligned(mTexCoords, 16);  	}  	else  	{ @@ -6990,17 +6979,21 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con  {  	S32 new_verts = mNumVertices+1;  	S32 new_size = new_verts*16; -//	S32 old_size = mNumVertices*16; +	S32 old_size = mNumVertices*16;  	//positions -	mPositions = (LLVector4a*) realloc(mPositions, new_size); +	mPositions = (LLVector4a*) ll_aligned_realloc_16(mPositions, new_size, old_size); +	ll_assert_aligned(mPositions,16);  	//normals -	mNormals = (LLVector4a*) realloc(mNormals, new_size); -	 +	mNormals = (LLVector4a*) ll_aligned_realloc_16(mNormals, new_size, old_size); +	ll_assert_aligned(mNormals,16); +  	//tex coords  	new_size = ((new_verts*8)+0xF) & ~0xF; -	mTexCoords = (LLVector2*) realloc(mTexCoords, new_size); +	old_size = ((mNumVertices*8)+0xF) & ~0xF; +	mTexCoords = (LLVector2*) ll_aligned_realloc_16(mTexCoords, new_size, old_size); +	ll_assert_aligned(mTexCoords,16);  	//just clear binormals @@ -7053,7 +7046,8 @@ void LLVolumeFace::pushIndex(const U16& idx)  	S32 old_size = ((mNumIndices*2)+0xF) & ~0xF;  	if (new_size != old_size)  	{ -		mIndices = (U16*) realloc(mIndices, new_size); +		mIndices = (U16*) ll_aligned_realloc_16(mIndices, new_size, old_size); +		ll_assert_aligned(mIndices,16);  	}  	mIndices[mNumIndices++] = idx; @@ -7094,12 +7088,12 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat  	}  	//allocate new buffer space -	mPositions = (LLVector4a*) realloc(mPositions, new_count*sizeof(LLVector4a)); -	assert_aligned(mPositions, 16); -	mNormals = (LLVector4a*) realloc(mNormals, new_count*sizeof(LLVector4a)); -	assert_aligned(mNormals, 16); -	mTexCoords = (LLVector2*) realloc(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF); -	assert_aligned(mTexCoords, 16); +	mPositions = (LLVector4a*) ll_aligned_realloc_16(mPositions, new_count*sizeof(LLVector4a), mNumVertices*sizeof(LLVector4a)); +	ll_assert_aligned(mPositions, 16); +	mNormals = (LLVector4a*) ll_aligned_realloc_16(mNormals, new_count*sizeof(LLVector4a), mNumVertices*sizeof(LLVector4a)); +	ll_assert_aligned(mNormals, 16); +	mTexCoords = (LLVector2*) ll_aligned_realloc_16(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF, (mNumVertices*sizeof(LLVector2)+0xF) & ~0xF); +	ll_assert_aligned(mTexCoords, 16);  	mNumVertices = new_count; @@ -7145,7 +7139,7 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat  	new_count = mNumIndices + face.mNumIndices;  	//allocate new index buffer -	mIndices = (U16*) realloc(mIndices, (new_count*sizeof(U16)+0xF) & ~0xF); +	mIndices = (U16*) ll_aligned_realloc_16(mIndices, (new_count*sizeof(U16)+0xF) & ~0xF, (mNumIndices*sizeof(U16)+0xF) & ~0xF);  	//get destination address into new index buffer  	U16* dst_idx = mIndices+mNumIndices; diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index b5a935c2b5..cc83cb7235 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -131,7 +131,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>  void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle>* node)  {  	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =  -			node->getData().begin(); iter != node->getData().end(); ++iter) +			node->getDataBegin(); iter != node->getDataEnd(); ++iter)  	{  		const LLVolumeTriangle* tri = *iter; @@ -236,8 +236,8 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)  	}  	//children fit, check data -	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();  -			iter != branch->getData().end(); ++iter) +	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();  +			iter != branch->getDataEnd(); ++iter)  	{  		const LLVolumeTriangle* tri = *iter; diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 688d91dc40..9ae34a0c4e 100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -37,9 +37,19 @@  class LLVolumeTriangle : public LLRefCount  {  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	LLVolumeTriangle()  	{ -		 +		mBinIndex = -1;	  	}  	LLVolumeTriangle(const LLVolumeTriangle& rhs) @@ -58,21 +68,38 @@ public:  	} -	LLVector4a mPositionGroup; +	LL_ALIGN_16(LLVector4a mPositionGroup);  	const LLVector4a* mV[3];  	U16 mIndex[3];  	F32 mRadius; +	mutable S32 mBinIndex; +  	virtual const LLVector4a& getPositionGroup() const;  	virtual const F32& getBinRadius() const; +	 +	S32 getBinIndex() const { return mBinIndex; } +	void setBinIndex(S32 idx) const { mBinIndex = idx; } + +  };  class LLVolumeOctreeListener : public LLOctreeListener<LLVolumeTriangle>  {  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle>* node);  	~LLVolumeOctreeListener(); @@ -99,8 +126,8 @@ public:  public: -	LLVector4a mBounds[2]; // bounding box (center, size) of this node and all its children (tight fit to objects) -	LLVector4a mExtents[2]; // extents (min, max) of this node and all its children +	LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) +	LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children  };  class LLOctreeTriangleRayIntersect : public LLOctreeTraveler<LLVolumeTriangle> diff --git a/indra/llmath/tests/alignment_test.cpp b/indra/llmath/tests/alignment_test.cpp index ac0c45ae6f..9105b1c1fd 100644 --- a/indra/llmath/tests/alignment_test.cpp +++ b/indra/llmath/tests/alignment_test.cpp @@ -34,16 +34,6 @@  #include "../llsimdmath.h"  #include "../llvector4a.h" -void* operator new(size_t size) -{ -	return ll_aligned_malloc_16(size); -} - -void operator delete(void *p) -{ -	ll_aligned_free_16(p); -} -  namespace tut  { @@ -59,6 +49,27 @@ tut::alignment_test_t tut_alignment_test("LLAlignment");  LL_ALIGN_PREFIX(16)  class MyVector4a  { +public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void *p) +	{ +		ll_aligned_free_16(p); +	} + +	void* operator new[](size_t count) +	{	// try to allocate count bytes for an array +		return ll_aligned_malloc_16(count); +	} + +	void operator delete[](void *p) +	{ +		ll_aligned_free_16(p); +	} +  	LLQuad mQ;  } LL_ALIGN_POSTFIX(16); @@ -78,7 +89,7 @@ void alignment_test_object_t::test<1>()  		align_ptr = ll_aligned_malloc_16(sizeof(MyVector4a));  		ensure("ll_aligned_malloc_16 failed", is_aligned(align_ptr,16)); -		align_ptr = ll_aligned_realloc_16(align_ptr,2*sizeof(MyVector4a)); +		align_ptr = ll_aligned_realloc_16(align_ptr,2*sizeof(MyVector4a), sizeof(MyVector4a));  		ensure("ll_aligned_realloc_16 failed", is_aligned(align_ptr,16));  		ll_aligned_free_16(align_ptr); diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 5ea9b58300..10c83e6572 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -133,12 +133,12 @@ std::string LLCurl::getVersionString()  //////////////////////////////////////////////////////////////////////////////  LLCurl::Responder::Responder() -	: mReferenceCount(0)  {  }  LLCurl::Responder::~Responder()  { +	LL_CHECK_MEMORY  }  // virtual @@ -202,23 +202,6 @@ void LLCurl::Responder::completedHeader(U32 status, const std::string& reason, c  } -namespace boost -{ -	void intrusive_ptr_add_ref(LLCurl::Responder* p) -	{ -		++p->mReferenceCount; -	} -	 -	void intrusive_ptr_release(LLCurl::Responder* p) -	{ -		if (p && 0 == --p->mReferenceCount) -		{ -			delete p; -		} -	} -}; - -  //////////////////////////////////////////////////////////////////////////////  std::set<CURL*> LLCurl::Easy::sFreeHandles; @@ -267,15 +250,18 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle)  	LLMutexLock lock(sHandleMutexp) ;  	if (sActiveHandles.find(handle) != sActiveHandles.end())  	{ +		LL_CHECK_MEMORY  		sActiveHandles.erase(handle); - +		LL_CHECK_MEMORY  		if(sFreeHandles.size() < MAX_NUM_FREE_HANDLES)  		{ -		sFreeHandles.insert(handle); -	} -	else -	{ +			sFreeHandles.insert(handle); +			LL_CHECK_MEMORY +		} +		else +		{  			LLCurl::deleteEasyHandle(handle) ; +			LL_CHECK_MEMORY  		}  	}  	else @@ -318,13 +304,15 @@ LLCurl::Easy::~Easy()  	releaseEasyHandle(mCurlEasyHandle);  	--gCurlEasyCount;  	curl_slist_free_all(mHeaders); +	LL_CHECK_MEMORY  	for_each(mStrings.begin(), mStrings.end(), DeletePointerArray()); - +	LL_CHECK_MEMORY  	if (mResponder && LLCurl::sNotQuitting) //aborted  	{	  		std::string reason("Request timeout, aborted.") ;  		mResponder->completedRaw(408, //HTTP_REQUEST_TIME_OUT, timeout, abort  			reason, mChannels, mOutput);		 +		LL_CHECK_MEMORY  	}  	mResponder = NULL;  } @@ -599,35 +587,50 @@ void LLCurl::Multi::cleanup(bool deleted)  	llassert_always(deleted || !mValid) ;  	LLMutexLock lock(mDeletionMutexp); -	 + +  	// Clean up active  	for(easy_active_list_t::iterator iter = mEasyActiveList.begin();  		iter != mEasyActiveList.end(); ++iter)  	{  		Easy* easy = *iter; +		LL_CHECK_MEMORY  		check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle())); - +		LL_CHECK_MEMORY  		if(deleted)  		{  			easy->mResponder = NULL ; //avoid triggering mResponder. +			LL_CHECK_MEMORY  		}  		delete easy; +		LL_CHECK_MEMORY  	}  	mEasyActiveList.clear();  	mEasyActiveMap.clear(); -	// Clean up freed +	LL_CHECK_MEMORY +	 +		// Clean up freed  	for_each(mEasyFreeList.begin(), mEasyFreeList.end(), DeletePointer());	  	mEasyFreeList.clear(); - +	 +	LL_CHECK_MEMORY +		  	check_curl_multi_code(LLCurl::deleteMultiHandle(mCurlMultiHandle));  	mCurlMultiHandle = NULL ; + +	LL_CHECK_MEMORY  	delete mMutexp ;  	mMutexp = NULL ; + +	LL_CHECK_MEMORY +  	delete mEasyMutexp ;  	mEasyMutexp = NULL ; +	LL_CHECK_MEMORY +  	mQueued = 0 ;  	mState = STATE_COMPLETED; @@ -1101,6 +1104,7 @@ bool LLCurlRequest::getByteRange(const std::string& url,  								 S32 offset, S32 length,  								 LLCurl::ResponderPtr responder)  { +	llassert(LLCurl::sNotQuitting);  	LLCurl::Easy* easy = allocEasy();  	if (!easy)  	{ @@ -1123,6 +1127,7 @@ bool LLCurlRequest::post(const std::string& url,  						 const LLSD& data,  						 LLCurl::ResponderPtr responder, S32 time_out)  { +	llassert(LLCurl::sNotQuitting);  	LLCurl::Easy* easy = allocEasy();  	if (!easy)  	{ @@ -1150,6 +1155,7 @@ bool LLCurlRequest::post(const std::string& url,  						 const std::string& data,  						 LLCurl::ResponderPtr responder, S32 time_out)  { +	llassert(LLCurl::sNotQuitting);  	LLCurl::Easy* easy = allocEasy();  	if (!easy)  	{ @@ -1504,29 +1510,42 @@ void LLCurl::cleanupClass()  			break ;  		}  	} +	LL_CHECK_MEMORY  	sCurlThread->shutdown() ; +	LL_CHECK_MEMORY  	delete sCurlThread ;  	sCurlThread = NULL ; +	LL_CHECK_MEMORY  #if SAFE_SSL  	CRYPTO_set_locking_callback(NULL);  	for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer());  #endif +	 +	LL_CHECK_MEMORY  	for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter)  	{  		CURL* curl = *iter;  		LLCurl::deleteEasyHandle(curl);  	} +	 +	LL_CHECK_MEMORY  	Easy::sFreeHandles.clear(); +	LL_CHECK_MEMORY +  	delete Easy::sHandleMutexp ;  	Easy::sHandleMutexp = NULL ; +	LL_CHECK_MEMORY +  	delete sHandleMutexp ;  	sHandleMutexp = NULL ; +	LL_CHECK_MEMORY +  	// removed as per https://jira.secondlife.com/browse/SH-3115  	//llassert(Easy::sActiveHandles.empty());  } @@ -1534,6 +1553,8 @@ void LLCurl::cleanupClass()  //static   CURLM* LLCurl::newMultiHandle()  { +	llassert(sNotQuitting); +  	LLMutexLock lock(sHandleMutexp) ;  	if(sTotalHandles + 1 > sMaxHandles) @@ -1567,6 +1588,7 @@ CURLMcode  LLCurl::deleteMultiHandle(CURLM* handle)  //static   CURL*  LLCurl::newEasyHandle()  { +	llassert(sNotQuitting);  	LLMutexLock lock(sHandleMutexp) ;  	if(sTotalHandles + 1 > sMaxHandles) @@ -1591,7 +1613,9 @@ void  LLCurl::deleteEasyHandle(CURL* handle)  	if(handle)  	{  		LLMutexLock lock(sHandleMutexp) ; +		LL_CHECK_MEMORY  		curl_easy_cleanup(handle) ; +		LL_CHECK_MEMORY  		sTotalHandles-- ;  	}  } diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index d6a7714d4c..62947bdb9d 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -44,6 +44,8 @@  #include "llthread.h"  #include "llqueuedthread.h"  #include "llframetimer.h" +#include "llpointer.h" +  class LLMutex;  class LLCurlThread; @@ -67,7 +69,7 @@ public:  		F64 mSpeedDownload;  	}; -	class Responder +	class Responder : public LLThreadSafeRefCount  	{  	//LOG_CLASS(Responder);  	public: @@ -126,13 +128,10 @@ public:  				return false;  			} -	public: /* but not really -- don't touch this */ -		U32 mReferenceCount; -  	private:  		std::string mURL;  	}; -	typedef boost::intrusive_ptr<Responder>	ResponderPtr; +	typedef LLPointer<Responder>	ResponderPtr;  	/** @@ -378,12 +377,6 @@ private:  	void cleanupMulti(LLCurl::Multi* multi) ;  } ; -namespace boost -{ -	void intrusive_ptr_add_ref(LLCurl::Responder* p); -	void intrusive_ptr_release(LLCurl::Responder* p); -}; -  class LLCurlRequest  { diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index a16f5c7bf0..f3f0007205 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -289,6 +289,8 @@ LLIOPipe::EStatus LLURLRequest::handleError(  }  static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST("URL Request"); +static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result"); +static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");  // virtual  LLIOPipe::EStatus LLURLRequest::process_impl( @@ -358,7 +360,6 @@ LLIOPipe::EStatus LLURLRequest::process_impl(  	{  		PUMP_DEBUG;  		LLIOPipe::EStatus status = STATUS_BREAK; -		static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");  		{  			LLFastTimer t(FTM_URL_PERFORM);  			if(!mDetail->mCurlRequest->wait()) @@ -371,8 +372,6 @@ LLIOPipe::EStatus LLURLRequest::process_impl(  		{  			CURLcode result; -			static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result"); -  			bool newmsg = false;  			{  				LLFastTimer t(FTM_PROCESS_URL_REQUEST_GET_RESULT); diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp index d84fe0a49f..9b298d0c04 100644 --- a/indra/llmessage/tests/llcurl_stub.cpp +++ b/indra/llmessage/tests/llcurl_stub.cpp @@ -28,7 +28,6 @@  #include "llcurl.h"  LLCurl::Responder::Responder() -	: mReferenceCount(0)  {  } @@ -77,19 +76,3 @@ void LLCurl::Responder::result(LLSD const&)  {  } -namespace boost -{ -	void intrusive_ptr_add_ref(LLCurl::Responder* p) -	{ -		++p->mReferenceCount; -	} - -	void intrusive_ptr_release(LLCurl::Responder* p) -	{ -		if(p && 0 == --p->mReferenceCount) -		{ -			delete p; -		} -	} -}; - diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 843c3bcc4b..a2be307cc8 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -189,9 +189,9 @@ namespace tut  			}  		public: -			static boost::intrusive_ptr<Result> build(HTTPClientTestData& client) +			static Result* build(HTTPClientTestData& client)  			{ -				return boost::intrusive_ptr<Result>(new Result(client)); +				return new Result(client);  			}  			~Result() diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index cb32a510b8..28ed051c55 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1026,7 +1026,8 @@ void LLModel::setVolumeFaceData(  	if (tc.get())  	{ -		LLVector4a::memcpyNonAliased16((F32*) face.mTexCoords, (F32*) tc.get(), num_verts*2*sizeof(F32)); +		U32 tex_size = (num_verts*2*sizeof(F32)+0xF)&~0xF; +		LLVector4a::memcpyNonAliased16((F32*) face.mTexCoords, (F32*) tc.get(), tex_size);  	}  	else  	{ diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 659d3ca409..a842211764 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -237,9 +237,11 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat)  //---------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_STATS("Image Stats");  // static  void LLImageGL::updateStats(F32 current_time)  { +	LLFastTimer t(FTM_IMAGE_UPDATE_STATS);  	sLastFrameTime = current_time;  	sBoundTextureMemoryInBytes = sCurBoundTextureMemory;  	sCurBoundTextureMemory = 0; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 99f0da330c..cc5c232380 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -69,6 +69,42 @@ LLRenderTarget::~LLRenderTarget()  	release();  } +void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt) +{  +	//for accounting, get the number of pixels added/subtracted +	S32 pix_diff = (resx*resy)-(mResX*mResY); +		 +	mResX = resx; +	mResY = resy; + +	for (U32 i = 0; i < mTex.size(); ++i) +	{ //resize color attachments +		gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]); +		LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); +		sBytesAllocated += pix_diff*4; +	} + +	if (mDepth) +	{ //resize depth attachment +		if (mStencil) +		{ +			//use render buffers where stencil buffers are in play +			glBindRenderbuffer(GL_RENDERBUFFER, mDepth); +			glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, mResX, mResY); +			glBindRenderbuffer(GL_RENDERBUFFER, 0); +		} +		else +		{ +			gGL.getTexUnit(0)->bindManual(mUsage, mDepth); +			U32 internal_type = LLTexUnit::getInternalType(mUsage); +			LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); +		} + +		sBytesAllocated += pix_diff*4; +	} +} +	 +  bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples)  {  	stop_glerror(); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 8360458840..e1a51304f1 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -57,8 +57,6 @@  */ -class LLMultisampleBuffer; -  class LLRenderTarget  {  public: @@ -74,6 +72,12 @@ public:  	//multiple calls will release previously allocated resources  	bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, bool use_fbo = false, S32 samples = 0); +	//resize existing attachments to use new resolution and color format +	// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined +	// DO NOT use for screen space buffers or for scratch space for an image that might be uploaded +	// DO use for render targets that resize often and aren't likely to ruin someone's day if they break +	void resize(U32 resx, U32 resy, U32 color_fmt); +  	//add color buffer attachment  	//limit of 4 color attachments per render target  	bool addColorAttachment(U32 color_fmt); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c0a252637f..a8a7e05fd5 100644..100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1565,8 +1565,7 @@ if (WINDOWS)      set_target_properties(${VIEWER_BINARY_NAME}          PROPERTIES          # *TODO -reenable this once we get server usage sorted out -        #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\"" -        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc " +        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS ${TCMALLOC_LINK_FLAGS}"          LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO"          LINK_FLAGS_RELEASE "/FORCE:MULTIPLE /MAP\"secondlife-bin.MAP\" /OPT:REF"          ) @@ -1585,7 +1584,7 @@ if (WINDOWS)      # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py      # and have the build deps get tracked *please* tell me about it. -    if(USE_GOOGLE_PERFTOOLS) +    if(USE_TCMALLOC)        # Configure a var for tcmalloc location, if used.        # Note the need to specify multiple names explicitly.        set(GOOGLE_PERF_TOOLS_SOURCE @@ -1593,7 +1592,7 @@ if (WINDOWS)          ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll          ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll          ) -     endif(USE_GOOGLE_PERFTOOLS) +     endif(USE_TCMALLOC)      set(COPY_INPUT_DEPENDENCIES @@ -1987,8 +1986,9 @@ if (INSTALL)  endif (INSTALL)  if (PACKAGE) +  set(SYMBOL_SEARCH_DIRS "")    if (WINDOWS) -    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")      set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-windows.tar.bz2")      # slplugin.exe failing symbols dump - need to debug, might have to do with updated version of google breakpad      # set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX} slplugin.exe") @@ -1997,13 +1997,20 @@ if (PACKAGE)      set(VIEWER_COPY_MANIFEST copy_w_viewer_manifest)    endif (WINDOWS)    if (DARWIN) -    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") +    # *TODO: Generate these search dirs in the cmake files related to each binary. +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/llplugin/slplugin/${CMAKE_CFG_INTDIR}") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_crash_logger/${CMAKE_CFG_INTDIR}") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_updater/${CMAKE_CFG_INTDIR}") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/gstreamer010/${CMAKE_CFG_INTDIR}") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}")      set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2") -    set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin") +    set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin mac-updater mac-crash-logger")      set(VIEWER_LIB_GLOB "*.dylib")    endif (DARWIN)    if (LINUX) -    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/packaged") +    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/packaged")      set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-linux.tar.bz2")      set(VIEWER_EXE_GLOBS "do-not-directly-run-secondlife-bin SLPlugin")      set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}*") @@ -2023,7 +2030,7 @@ if (PACKAGE)      ARGS        "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py"        "${LLBUILD_CONFIG}" -      "${VIEWER_DIST_DIR}" +      "${SYMBOL_SEARCH_DIRS}"        "${VIEWER_EXE_GLOBS}"        "${VIEWER_LIB_GLOB}"        "${AUTOBUILD_INSTALL_DIR}/bin/dump_syms" diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index 5ebec1563e..4181e4ebb3 100644 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -39,17 +39,20 @@ import shlex  import subprocess  import tarfile  import StringIO +import pprint + +DEBUG=False  def usage(): -    print >>sys.stderr, "usage: %s viewer_dir viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0] +    print >>sys.stderr, "usage: %s search_dirs viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0]  class MissingModuleError(Exception):      def __init__(self, modules):          Exception.__init__(self, "Failed to find required modules: %r" % modules)          self.modules = modules -def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): -    print "generate_breakpad_symbols run with args: %s" % str((configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file)) +def main(configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): +    print "generate_breakpad_symbols run with args: %s" % str((configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file))      if not re.match("release", configuration, re.IGNORECASE):          print "skipping breakpad symbol generation for non-release build." @@ -67,21 +70,49 @@ def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, vi              return True          return fnmatch.fnmatch(f, libs_suffix) +    search_dirs = search_dirs.split(";") +      def list_files(): -        for (dirname, subdirs, filenames) in os.walk(viewer_dir): -            #print "scanning '%s' for modules..." % dirname -            for f in itertools.ifilter(matches, filenames): -                yield os.path.join(dirname, f) +        for search_dir in search_dirs: +            for (dirname, subdirs, filenames) in os.walk(search_dir): +                if DEBUG: +                    print "scanning '%s' for modules..." % dirname +                for f in itertools.ifilter(matches, filenames): +                    yield os.path.join(dirname, f)      def dump_module(m):          print "dumping module '%s' with '%s'..." % (m, dump_syms_tool) -        child = subprocess.Popen([dump_syms_tool, m] , stdout=subprocess.PIPE) +        dsym_full_path = m +        child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE)          out, err = child.communicate()          return (m,child.returncode, out, err) -    out = tarfile.open(viewer_symbol_file, 'w:bz2') +     +    modules = {} +         +    for m in list_files(): +        if DEBUG: +            print "examining module '%s' ... " % m, +        filename=os.path.basename(m) +        if -1 != m.find("DWARF"): +            # Just use this module; it has the symbols we want. +            modules[filename] = m +            if DEBUG: +                print "found dSYM entry" +        elif filename not in modules: +            # Only use this if we don't already have a (possibly better) entry. +            modules[filename] = m +            if DEBUG: +                print "found new entry" +        elif DEBUG: +            print "ignoring entry" + + +    print "Found these following modules:" +    pprint.pprint( modules ) -    for (filename,status,symbols,err) in itertools.imap(dump_module, list_files()): +    out = tarfile.open(viewer_symbol_file, 'w:bz2') +    for (filename,status,symbols,err) in itertools.imap(dump_module, modules.values()):          if status == 0:              module_line = symbols[:symbols.index('\n')]              module_line = module_line.split() diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e8934d9a9e..4de80037ed 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -89,6 +89,7 @@  #include "lllogininstance.h"  #include "llprogressview.h"  #include "llvocache.h" +#include "llvopartgroup.h"  #include "llweb.h"  #include "llsecondlifeurls.h"  #include "llupdaterservice.h" @@ -679,6 +680,9 @@ bool LLAppViewer::init()  	// initialize SSE options  	LLVector4a::initClass(); +	//initialize particle index pool +	LLVOPartGroup::initClass(); +  	// Need to do this initialization before we do anything else, since anything  	// that touches files should really go through the lldir API  	gDirUtilp->initAppDirs("SecondLife"); @@ -1884,8 +1888,17 @@ bool LLAppViewer::cleanup()  	sTextureFetch->shutDownTextureCacheThread() ;  	sTextureFetch->shutDownImageDecodeThread() ; +	llinfos << "Shutting down message system" << llendflush; +	end_messaging_system(); + +	// *NOTE:Mani - The following call is not thread safe.  +	LL_CHECK_MEMORY +	LLCurl::cleanupClass(); +	LL_CHECK_MEMORY +  	LLFilePickerThread::cleanupClass(); +	//MUST happen AFTER LLCurl::cleanupClass  	delete sTextureCache;      sTextureCache = NULL;  	delete sTextureFetch; @@ -1954,12 +1967,6 @@ bool LLAppViewer::cleanup()  	LLViewerAssetStatsFF::cleanup(); -	llinfos << "Shutting down message system" << llendflush; -	end_messaging_system(); - -	// *NOTE:Mani - The following call is not thread safe.  -	LLCurl::cleanupClass(); -  	// If we're exiting to launch an URL, do that here so the screen  	// is at the right resolution before we launch IE.  	if (!gLaunchFileOnQuit.empty()) diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index bad60a9757..e0ca1232b0 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -130,6 +130,10 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,  	// This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations)  	// Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 +	// Enable to get mem debugging within visual studio. +#if LL_DEBUG +	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#else  	_CrtSetDbgFlag(0); // default, just making explicit  	ULONG ulEnableLFH = 2; @@ -144,6 +148,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,  			heap_enable_lfh_error[i] = GetLastError();  	}  #endif +#endif  	// *FIX: global  	gIconResource = MAKEINTRESOURCE(IDI_LL_ICON); diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 65bfc990d1..7b2c536f5a 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -919,7 +919,7 @@ public:  	bool uploadConfirmationCallback(  		const LLSD& notification,  		const LLSD& response, -		boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder> responder) +		LLPointer<LLNewAgentInventoryVariablePriceResponder> responder)  	{  		S32 option;  		std::string confirmation_url; @@ -949,7 +949,7 @@ public:  	void confirmUpload(  		const std::string& confirmation_url, -		boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder> responder) +		LLPointer<LLNewAgentInventoryVariablePriceResponder> responder)  	{  		if ( getFilename().empty() )  		{ @@ -1124,7 +1124,7 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog(  		// and cause sadness.  		mImpl->confirmUpload(  			confirmation_url, -			boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder>(this)); +			LLPointer<LLNewAgentInventoryVariablePriceResponder>(this));  	}  	else  	{ @@ -1157,7 +1157,7 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog(  				mImpl,  				_1,  				_2, -				boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder>(this))); +				LLPointer<LLNewAgentInventoryVariablePriceResponder>(this)));  	}  } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 108ec92f6d..a0289cd2af 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -57,6 +57,8 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f;  static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); +extern bool gShiftFrame; +  ////////////////////////  // @@ -108,6 +110,8 @@ void LLDrawable::init()  	mGeneration = -1;  	mBinRadius = 1.f; +	mBinIndex = -1; +  	mSpatialBridge = NULL;  } @@ -714,6 +718,11 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)  		return;  	} +	if (gShiftFrame) +	{ +		return; +	} +  	//switch LOD with the spatial group to avoid artifacts  	//LLSpatialGroup* sg = getSpatialGroup(); @@ -811,14 +820,19 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)  		mXform.setPosition(mVObjp->getPositionAgent());  	} -	mXform.setRotation(mVObjp->getRotation()); -	mXform.setScale(1,1,1);  	mXform.updateMatrix();  	if (isStatic())  	{  		LLVOVolume* volume = getVOVolume(); -		if (!volume) + +		bool rebuild = (!volume &&  +						getRenderType() != LLPipeline::RENDER_TYPE_TREE && +						getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN && +						getRenderType() != LLPipeline::RENDER_TYPE_SKY && +						getRenderType() != LLPipeline::RENDER_TYPE_GROUND); + +		if (rebuild)  		{  			gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);  		} @@ -832,7 +846,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)  				facep->mExtents[0].add(shift_vector);  				facep->mExtents[1].add(shift_vector); -				if (!volume && facep->hasGeometry()) +				if (rebuild && facep->hasGeometry())  				{  					facep->clearVertexBuffer();  				} @@ -943,8 +957,20 @@ void LLDrawable::updateUVMinMax()  {  } +LLSpatialGroup* LLDrawable::getSpatialGroup() const +{  +	llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); +	return mSpatialGroupp;  +} +  void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)  { +	//precondition: mSpatialGroupp MUST be null or DEAD or mSpatialGroupp MUST NOT contain this +	llassert(!mSpatialGroupp || mSpatialGroupp->isDead() || !mSpatialGroupp->hasElement(this)); + +	//precondition: groupp MUST be null or groupp MUST contain this +	llassert(!groupp || groupp->hasElement(this)); +  /*if (mSpatialGroupp && (groupp != mSpatialGroupp))  	{  		mSpatialGroupp->setState(LLSpatialGroup::GEOM_DIRTY); @@ -964,6 +990,11 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)  		}  	} +	//postcondition: if next group is NULL, previous group must be dead OR NULL OR binIndex must be -1 +	//postcondition: if next group is NOT NULL, binIndex must not be -1 +	llassert(groupp == NULL ? (mSpatialGroupp == NULL || mSpatialGroupp->isDead()) || getBinIndex() == -1 : +							getBinIndex() != -1); +  	mSpatialGroupp = groupp;  } @@ -1087,6 +1118,8 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat  	mDrawable = root;  	root->setSpatialBridge(this); +	mBinIndex = -1; +  	mRenderType = mDrawable->mRenderType;  	mDrawableType = mDrawable->mRenderType; @@ -1391,6 +1424,11 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)  		return;  	} +	if (gShiftFrame) +	{ +		return; +	} +  	if (mDrawable->getVObj())  	{  		if (mDrawable->getVObj()->isAttachment()) @@ -1468,6 +1506,10 @@ void LLSpatialBridge::cleanupReferences()  	LLDrawable::cleanupReferences();  	if (mDrawable)  	{ +		/* +		 +		DON'T DO THIS -- this should happen through octree destruction +  		mDrawable->setSpatialGroup(NULL);  		if (mDrawable->getVObj())  		{ @@ -1482,7 +1524,7 @@ void LLSpatialBridge::cleanupReferences()  					drawable->setSpatialGroup(NULL);  				}  			} -		} +		}*/  		LLDrawable* drawablep = mDrawable;  		mDrawable = NULL; diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index e2064b79f8..960c64fa9e 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -59,6 +59,7 @@ class LLViewerTexture;  const U32 SILHOUETTE_HIGHLIGHT = 0;  // All data for new renderer goes into this class. +LL_ALIGN_PREFIX(16)  class LLDrawable : public LLRefCount  {  public: @@ -75,6 +76,16 @@ public:  	static void initClass(); +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	LLDrawable()				{ init(); }  	MEM_TYPE_NEW(LLMemType::MTYPE_DRAWABLE); @@ -109,6 +120,9 @@ public:  	F32			          getIntensity() const			{ return llmin(mXform.getScale().mV[0], 4.f); }  	S32					  getLOD() const				{ return mVObjp ? mVObjp->getLOD() : 1; }  	F32					  getBinRadius() const			{ return mBinRadius; } +	S32					  getBinIndex() const			{ return mBinIndex; } +	void				  setBinIndex(S32 index) const	{ mBinIndex = index; } +  	void  getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }  	LLXformMatrix*		getXform() { return &mXform; } @@ -194,7 +208,7 @@ public:  	S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators...  	void setSpatialGroup(LLSpatialGroup *groupp); -	LLSpatialGroup *getSpatialGroup() const			{ return mSpatialGroupp; } +	LLSpatialGroup *getSpatialGroup() const;  	LLSpatialPartition* getSpatialPartition();  	// Statics @@ -281,8 +295,8 @@ public:  	} EDrawableFlags;  private: //aligned members -	LLVector4a		mExtents[2]; -	LLVector4a		mPositionGroup; +	LL_ALIGN_16(LLVector4a		mExtents[2]); +	LL_ALIGN_16(LLVector4a		mPositionGroup);  public:  	LLXformMatrix       mXform; @@ -315,6 +329,7 @@ private:  	mutable U32		mVisible;  	F32				mRadius;  	F32				mBinRadius; +	mutable S32		mBinIndex;  	S32				mGeneration;  	LLVector3		mCurrentScale; @@ -323,7 +338,7 @@ private:  	static U32 sNumZombieDrawables;  	static LLDynamicArrayPtr<LLPointer<LLDrawable> > sDeadList; -}; +} LL_ALIGN_POSTFIX(16);  inline LLFace* LLDrawable::getFace(const S32 i) const diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 81f4e3d48f..013c698445 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -254,48 +254,6 @@ void LLFacePool::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures  {  } -// static -S32 LLFacePool::drawLoop(face_array_t& face_list) -{ -	S32 res = 0; -	if (!face_list.empty()) -	{ -		for (std::vector<LLFace*>::iterator iter = face_list.begin(); -			 iter != face_list.end(); iter++) -		{ -			LLFace *facep = *iter; -			res += facep->renderIndexed(); -		} -	} -	return res; -} - -// static -S32 LLFacePool::drawLoopSetTex(face_array_t& face_list, S32 stage) -{ -	S32 res = 0; -	if (!face_list.empty()) -	{ -		for (std::vector<LLFace*>::iterator iter = face_list.begin(); -			 iter != face_list.end(); iter++) -		{ -			LLFace *facep = *iter; -			gGL.getTexUnit(stage)->bind(facep->getTexture(), TRUE) ; -			gGL.getTexUnit(0)->activate(); -			res += facep->renderIndexed(); -		} -	} -	return res; -} - -void LLFacePool::drawLoop() -{ -	if (!mDrawFace.empty()) -	{ -		drawLoop(mDrawFace); -	} -} -  void LLFacePool::enqueue(LLFace* facep)  {  	mDrawFace.push_back(facep); @@ -443,7 +401,7 @@ void LLRenderPass::renderTexture(U32 type, U32 mask)  void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)  { -	for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)	 +	for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)	  	{  		LLDrawInfo* pparams = *i;  		if (pparams)  diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 977acf7aec..ab9bb9e611 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -190,10 +190,6 @@ public:  	void buildEdges(); -	static S32 drawLoop(face_array_t& face_list); -	static S32 drawLoopSetTex(face_array_t& face_list, S32 stage); -	void drawLoop(); -  	void addFaceReference(LLFace *facep);  	void removeFaceReference(LLFace *facep); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 5f2a982ed3..313b310e1e 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -348,7 +348,7 @@ void LLDrawPoolAlpha::render(S32 pass)  void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)  { -	for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) +	for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (group->mSpatialPartition->mRenderByGroup && @@ -385,7 +385,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)  	BOOL use_shaders = gPipeline.canUseVertexShaders(); -	for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) +	for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		llassert(group); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index ace3a20bbb..730ad1a364 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1036,9 +1036,13 @@ void LLDrawPoolAvatar::endDeferredSkinned()  	gGL.getTexUnit(0)->activate();  } +static LLFastTimer::DeclareTimer FTM_RENDER_AVATARS("renderAvatars"); +  void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  { +	LLFastTimer t(FTM_RENDER_AVATARS); +  	if (pass == -1)  	{  		for (S32 i = 1; i < getNumPasses(); i++) @@ -1195,15 +1199,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  	if (pass >= 7 && pass < 9)  	{ -		LLGLEnable blend(GL_BLEND); - -		gGL.setColorMask(true, true); -		gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, -					  LLRender::BF_ONE_MINUS_SOURCE_ALPHA, -					  LLRender::BF_ZERO, -					  LLRender::BF_ONE_MINUS_SOURCE_ALPHA); - -		  		if (pass == 7)  		{  			renderRiggedAlpha(avatarp); @@ -1219,20 +1214,8 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  	if (pass == 9)  	{ -		LLGLEnable blend(GL_BLEND); -		LLGLDisable test(GL_ALPHA_TEST); -		gGL.flush(); - -		LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); -		glPolygonOffset(-1.0f, -1.0f); -		gGL.setSceneBlendType(LLRender::BT_ADD); - -		LLGLDepthTest depth(GL_TRUE, GL_FALSE); -		gGL.setColorMask(false, true); -  		renderRiggedGlow(avatarp); -		gGL.setColorMask(true, false); -		gGL.setSceneBlendType(LLRender::BT_ALPHA); +		  		return;  	} @@ -1430,7 +1413,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*  void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)  { -	if (avatar->isSelf() && !gAgent.needsRenderAvatar() || !gMeshRepo.meshRezEnabled()) +	if (avatar->isSelf() && !gAgent.needsRenderAvatar())  	{  		return;  	} @@ -1559,8 +1542,12 @@ void LLDrawPoolAvatar::renderDeferredRiggedBump(LLVOAvatar* avatar)  	renderRigged(avatar, RIGGED_DEFERRED_BUMP);  } +static LLFastTimer::DeclareTimer FTM_RIGGED_VBO("Rigged VBO"); +  void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)  { +	LLFastTimer t(FTM_RIGGED_VBO); +  	//update rigged vertex buffers  	for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)  	{ @@ -1632,17 +1619,56 @@ void LLDrawPoolAvatar::renderRiggedFullbrightShiny(LLVOAvatar* avatar)  void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar)  { -	renderRigged(avatar, RIGGED_ALPHA); +	if (!mRiggedFace[RIGGED_ALPHA].empty()) +	{ +		LLGLEnable blend(GL_BLEND); + +		gGL.setColorMask(true, true); +		gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA, +						LLRender::BF_ZERO, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + +		renderRigged(avatar, RIGGED_ALPHA); +	}  }  void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar)  { -	renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); +	if (!mRiggedFace[RIGGED_FULLBRIGHT_ALPHA].empty()) +	{ +		LLGLEnable blend(GL_BLEND); + +		gGL.setColorMask(true, true); +		gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA, +						LLRender::BF_ZERO, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + +		renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); +	}  }  void LLDrawPoolAvatar::renderRiggedGlow(LLVOAvatar* avatar)  { -	renderRigged(avatar, RIGGED_GLOW, true); +	if (!mRiggedFace[RIGGED_GLOW].empty()) +	{ +		LLGLEnable blend(GL_BLEND); +		LLGLDisable test(GL_ALPHA_TEST); +		gGL.flush(); + +		LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); +		glPolygonOffset(-1.0f, -1.0f); +		gGL.setSceneBlendType(LLRender::BT_ADD); + +		LLGLDepthTest depth(GL_TRUE, GL_FALSE); +		gGL.setColorMask(false, true); + +		renderRigged(avatar, RIGGED_GLOW, true); + +		gGL.setColorMask(true, false); +		gGL.setSceneBlendType(LLRender::BT_ALPHA); +	}  } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 6f71e6ebc8..a264eae302 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -847,12 +847,12 @@ void LLDrawPoolBump::renderDeferred(S32 pass)  	LLFastTimer ftm(FTM_RENDER_BUMP);  	U32 type = LLRenderPass::PASS_BUMP; -	LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); -	LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); +	LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); +	LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);  	U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; -	for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i)	 +	for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)	  	{  		LLDrawInfo& params = **i; @@ -1448,10 +1448,10 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI  void LLDrawPoolBump::renderBump(U32 type, U32 mask)  {	 -	LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); -	LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); +	LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); +	LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); -	for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i)	 +	for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)	  	{  		LLDrawInfo& params = **i; diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index b95d8296fa..7fc78fb382 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -294,6 +294,34 @@ void LLDrawPoolTerrain::renderShadow(S32 pass)  	//glCullFace(GL_BACK);  } + +void LLDrawPoolTerrain::drawLoop() +{ +	if (!mDrawFace.empty()) +	{ +		for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); +			 iter != mDrawFace.end(); iter++) +		{ +			LLFace *facep = *iter; + +			LLMatrix4* model_matrix = &(facep->getDrawable()->getRegion()->mRenderMatrix); + +			if (model_matrix != gGLLastMatrix) +			{ +				gGLLastMatrix = model_matrix; +				gGL.loadMatrix(gGLModelView); +				if (model_matrix) +				{ +					gGL.multMatrix((GLfloat*) model_matrix->mMatrix); +				} +				gPipeline.mMatrixOpCount++; +			} + +			facep->renderIndexed(); +		} +	} +} +  void LLDrawPoolTerrain::renderFullShader()  {  	// Hack! Get the region that this draw pool is rendering from! diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 283ed87f1a..2163d087e1 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -83,6 +83,7 @@ protected:  	void renderFull2TU();  	void renderFull4TU();  	void renderFullShader(); +	void drawLoop();  };  #endif // LL_LLDRAWPOOLSIMPLE_H diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 3165a3516c..83f04e45a8 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -37,6 +37,7 @@  #include "llviewershadermgr.h"  #include "llrender.h"  #include "llviewercontrol.h" +#include "llviewerregion.h"  S32 LLDrawPoolTree::sDiffTex = 0;  static LLGLSLShader* shader = NULL; @@ -104,8 +105,22 @@ void LLDrawPoolTree::render(S32 pass)  	{  		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) +				{ +					gGL.multMatrix((GLfloat*) model_matrix->mMatrix); +				} +				gPipeline.mMatrixOpCount++; +			} +  			buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);  			buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0);   			gPipeline.addTrianglesDrawn(buff->getNumIndices()); diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 64eb11fc9b..885cae1737 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -155,6 +155,7 @@ LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) :  	mAvatarp(avatarp),   	mWearablep(NULL)  { +	mDefaultVec.clear();  }  LLDriverParam::LLDriverParam(LLWearable *wearablep) :  @@ -162,6 +163,7 @@ LLDriverParam::LLDriverParam(LLWearable *wearablep) :  	mAvatarp(NULL),   	mWearablep(wearablep)  { +	mDefaultVec.clear();  }  LLDriverParam::~LLDriverParam() @@ -341,18 +343,19 @@ F32	LLDriverParam::getTotalDistortion()  	return sum;   } -const LLVector3	&LLDriverParam::getAvgDistortion()	 +const LLVector4a	&LLDriverParam::getAvgDistortion()	  {  	// It's not actually correct to take the average of averages, but it good enough here. -	LLVector3 sum; +	LLVector4a sum; +	sum.clear();  	S32 count = 0;  	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )  	{  		LLDrivenEntry* driven = &(*iter); -		sum += driven->mParam->getAvgDistortion(); +		sum.add(driven->mParam->getAvgDistortion());  		count++;  	} -	sum /= (F32)count; +	sum.mul( 1.f/(F32)count);  	mDefaultVec = sum;  	return mDefaultVec;  @@ -375,21 +378,22 @@ F32	LLDriverParam::getMaxDistortion()  } -LLVector3	LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) +LLVector4a	LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)  { -	LLVector3 sum; +	LLVector4a sum; +	sum.clear();  	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )  	{  		LLDrivenEntry* driven = &(*iter); -		sum += driven->mParam->getVertexDistortion( index, poly_mesh ); +		sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));  	}  	return sum;  } -const LLVector3*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)  {  	mCurrentDistortionParam = NULL; -	const LLVector3* v = NULL; +	const LLVector4a* v = NULL;  	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )  	{  		LLDrivenEntry* driven = &(*iter); @@ -404,7 +408,7 @@ const LLVector3*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly  	return v;  }; -const LLVector3*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)  {  	llassert( mCurrentDistortionParam );  	if( !mCurrentDistortionParam ) @@ -432,7 +436,7 @@ const LLVector3*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_  	}  	// We're already in the middle of a param's distortions, so get the next one. -	const LLVector3* v = driven->mParam->getNextDistortion( index, poly_mesh ); +	const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh );  	if( (!v) && (iter != mDriven.end()) )  	{  		// This param is finished, so start the next param.  It might not have any diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h index fb1b44458c..c0976d1d43 100644 --- a/indra/newview/lldriverparam.h +++ b/indra/newview/lldriverparam.h @@ -83,6 +83,16 @@ public:  	LLDriverParam(LLWearable *wearablep);  	~LLDriverParam(); +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	// Special: These functions are overridden by child classes  	LLDriverParamInfo*		getInfo() const { return (LLDriverParamInfo*)mInfo; }  	//   This sets mInfo and calls initialization functions @@ -105,18 +115,18 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion(); -	/*virtual*/ const LLVector3&	getAvgDistortion(); +	/*virtual*/ const LLVector4a&	getAvgDistortion();  	/*virtual*/ F32					getMaxDistortion(); -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);  protected:  	F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);  	void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake); -	LLVector3	mDefaultVec; // temp holder +	LLVector4a	mDefaultVec; // temp holder  	typedef std::vector<LLDrivenEntry> entry_list_t;  	entry_list_t mDriven;  	LLViewerVisualParam* mCurrentDistortionParam; diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index e18090545d..c51e7d1e1a 100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -36,6 +36,16 @@  class LLViewerDynamicTexture : public LLViewerTexture  {  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	enum  	{  		LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE, @@ -85,7 +95,7 @@ protected:  protected:  	BOOL mClamp;  	LLCoordGL mOrigin; -	LLCamera mCamera; +	LL_ALIGN_16(LLCamera mCamera);  	typedef std::set<LLViewerDynamicTexture*> instance_list_t;  	static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ]; diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 4f4d9a40b4..2c786b7f8b 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -86,7 +86,7 @@ namespace  	class LLEventPollEventTimer : public LLEventTimer  	{ -		typedef boost::intrusive_ptr<LLEventPollResponder> EventPollResponderPtr; +		typedef LLPointer<LLEventPollResponder> EventPollResponderPtr;  	public:  		LLEventPollEventTimer(F32 period, EventPollResponderPtr responder) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 373b1930f5..582f06eeb0 100644..100755 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -163,15 +163,10 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)  	mGeomCount		= 0;  	mGeomIndex		= 0;  	mIndicesCount	= 0; -	if (drawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || -		drawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES) -	{ //indicate to LLParticlePartition that this particle is uninitialized -		mIndicesIndex = 0xFFFFFFFF; -	} -	else -	{ -		mIndicesIndex	= 0; -	} + +	//special value to indicate uninitialized position +	mIndicesIndex	= 0xFFFFFFFF; +	  	mIndexInTex = 0;  	mTexture		= NULL;  	mTEOffset		= -1; @@ -207,13 +202,10 @@ void LLFace::destroy()  		mTexture->removeFace(this) ;  	} -	if (mDrawablep.notNull() && -		(mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || -		mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES) && -		mIndicesIndex != 0xFFFFFFFF) +	if (isState(LLFace::PARTICLE))  	{  		LLVOPartGroup::freeVBSlot(getGeomIndex()/4); -		mIndicesIndex = 0xFFFFFFFF; +		clearState(LLFace::PARTICLE);  	}  	if (mDrawPoolp) @@ -1207,19 +1199,25 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,  	{  		if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())  		{ -			llwarns	<< "Index buffer overflow!" << llendl; -			llwarns << "Indices Count: " << mIndicesCount -					<< " VF Num Indices: " << num_indices -					<< " Indices Index: " << mIndicesIndex -					<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; -			llwarns	<< " Face Index: " << f -					<< " Pool Type: " << mPoolType << llendl; +			if (gDebugGL) +			{ +				llwarns	<< "Index buffer overflow!" << llendl; +				llwarns << "Indices Count: " << mIndicesCount +						<< " VF Num Indices: " << num_indices +						<< " Indices Index: " << mIndicesIndex +						<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; +				llwarns	<< " Face Index: " << f +						<< " Pool Type: " << mPoolType << llendl; +			}  			return FALSE;  		}  		if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts())  		{ -			llwarns << "Vertex buffer overflow!" << llendl; +			if (gDebugGL) +			{ +				llwarns << "Vertex buffer overflow!" << llendl; +			}  			return FALSE;  		}  	} @@ -1651,7 +1649,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,  						if (!do_xform)  						{  							LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM); -							LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32)); +							S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; +							LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, tc_size);  						}  						else  						{ diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 76ea5c853a..efc3424858 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -59,6 +59,17 @@ class LLFace  {  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} + +  	LLFace(const LLFace& rhs)  	{  		*this = rhs; @@ -79,6 +90,7 @@ public:  		USE_FACE_COLOR	= 0x0010,  		TEXTURE_ANIM	= 0x0020,   		RIGGED			= 0x0040, +		PARTICLE		= 0x0080,  	};  	static void initClass(); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 3d64ceb71d..9745bb6d64 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -65,7 +65,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD  	mFrameNum = 0;  	mCollisionSphereRadius = 0.f;  	mRenderRes = 1; - +	  	if(mVO->mDrawable.notNull())  	{  		mVO->mDrawable->makeActive() ; @@ -255,50 +255,28 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons  {  } -//--------------------------------------------------------------------------------- -// This calculates the physics of the flexible object. Note that it has to be 0 -// updated every time step. In the future, perhaps there could be an  -// optimization similar to what Havok does for objects that are stationary.  -//--------------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); -BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) -{ -	if (mVO->mDrawable.isNull()) -	{ -		// Don't do anything until we have a drawable -		return FALSE; // (we are not initialized or updated) -	} - -	BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE; -	//flexible objects never go static -	mVO->mDrawable->mQuietCount = 0; -	if (!mVO->mDrawable->isRoot()) -	{ -		LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); -		parent->mDrawable->mQuietCount = 0; -	} +void LLVolumeImplFlexible::updateRenderRes() +{ +	LLDrawable* drawablep = mVO->mDrawable; -	LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); -		  	S32 new_res = mAttributes->getSimulateLOD(); -	//number of segments only cares about z axis -	F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, mVO->mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); +#if 1 //optimal approximation of previous behavior that doesn't rely on atan2 +	F32 app_angle = mVO->getScale().mV[2]/drawablep->mDistanceWRTCamera;  	// Rendering sections increases with visible angle on the screen -	mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); -	if (mRenderRes > FLEXIBLE_OBJECT_MAX_SECTIONS) -	{ -		mRenderRes = FLEXIBLE_OBJECT_MAX_SECTIONS; -	} - +	mRenderRes = (S32) (12.f*app_angle); +#else //legacy behavior +	//number of segments only cares about z axis +	F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); -	// Bottom cap at 1/4 the original number of sections -	if (mRenderRes < mAttributes->getSimulateLOD()-1) -	{ -		mRenderRes = mAttributes->getSimulateLOD()-1; -	} + 	// Rendering sections increases with visible angle on the screen +	mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); +#endif +		 +	mRenderRes = llclamp(mRenderRes, new_res-1, (S32) FLEXIBLE_OBJECT_MAX_SECTIONS); +		  	// Throttle back simulation of segments we're not rendering  	if (mRenderRes < new_res)  	{ @@ -311,43 +289,65 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6  		setAttributesOfAllSections();  		mInitialized = TRUE;  	} -	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) -	{ -		return FALSE; // (we are not initialized or updated) -	} - -	bool visible = mVO->mDrawable->isVisible(); +} +//--------------------------------------------------------------------------------- +// This calculates the physics of the flexible object. Note that it has to be 0 +// updated every time step. In the future, perhaps there could be an  +// optimization similar to what Havok does for objects that are stationary.  +//--------------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); +void LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) +{ +	LLDrawable* drawablep = mVO->mDrawable; -	if (force_update && visible) -	{ -		gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE); -	} -	else if	(visible && -		!mVO->mDrawable->isState(LLDrawable::IN_REBUILD_Q1) && -		mVO->getPixelArea() > 256.f) +	if (drawablep)  	{ -		U32 id; -		F32 pixel_area = mVO->getPixelArea(); +		//LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); -		if (mVO->isRootEdit()) +		//flexible objects never go static +		drawablep->mQuietCount = 0; +		if (!drawablep->isRoot())  		{ -			id = mID; +			LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); +			parent->mDrawable->mQuietCount = 0;  		} -		else + +		if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))  		{ -			LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); -			id = parent->getVolumeInterfaceID(); -		} +			bool visible = drawablep->isVisible(); -		U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; +			if ((mSimulateRes == 0) && visible) +			{ +				updateRenderRes(); +				gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); +			} +			else if	(visible && +				!drawablep->isState(LLDrawable::IN_REBUILD_Q1) && +				mVO->getPixelArea() > 256.f) +			{ +				U32 id; +				F32 pixel_area = mVO->getPixelArea(); -		if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) -		{ -			gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE); +				if (mVO->isRootEdit()) +				{ +					id = mID; +				} +				else +				{ +					LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); +					id = parent->getVolumeInterfaceID(); +				} + +				U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; + +				if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) +				{ +					updateRenderRes(); +					gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); +				} +			}  		}  	} -	 -	return force_update;  }  inline S32 log2(S32 x) diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index 371d6a0773..56d579d86f 100644 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -78,7 +78,8 @@ class LLVolumeImplFlexible : public LLVolumeInterface  		LLVector3 getFramePosition() const;  		LLQuaternion getFrameRotation() const;  		LLVolumeInterfaceType getInterfaceType() const		{ return INTERFACE_FLEXIBLE; } -		BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); +		void updateRenderRes(); +		void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);  		BOOL doUpdateGeometry(LLDrawable *drawable);  		LLVector3 getPivotPosition() const;  		void onSetVolume(const LLVolumeParams &volume_params, const S32 detail); @@ -128,7 +129,7 @@ class LLVolumeImplFlexible : public LLVolumeInterface  		LLVector3					mCollisionSpherePosition;  		F32							mCollisionSphereRadius;  		U32							mID; - +		  		//--------------------------------------  		// private methods  		//-------------------------------------- diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 61da99fe3a..df8ecb6fd9 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2212,8 +2212,8 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)  	BOOL allow_damage		= !self->mCheckSafe->get();  	BOOL allow_fly			= self->mCheckFly->get();  	BOOL allow_landmark		= TRUE; // cannot restrict landmark creation -	BOOL allow_group_scripts	= self->mCheckGroupScripts->get() || self->mCheckOtherScripts->get();  	BOOL allow_other_scripts	= self->mCheckOtherScripts->get(); +	BOOL allow_group_scripts	= self->mCheckGroupScripts->get() || allow_other_scripts;  	BOOL allow_publish		= FALSE;  	BOOL mature_publish		= self->mMatureCtrl->get();  	BOOL push_restriction	= self->mPushRestrictionCtrl->get(); @@ -2226,11 +2226,16 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)  	LLViewerRegion* region;  	region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); -	if (!allow_other_scripts && region && region->getAllowDamage()) -	{ - -		LLNotificationsUtil::add("UnableToDisableOutsideScripts"); -		return; +	if (region && region->getAllowDamage()) +	{	// Damage is allowed on the region - server will always allow scripts +		if ( (!allow_other_scripts && parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS)) || +			 (!allow_group_scripts && parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS)) ) +		{	// Don't allow turning off "Run Scripts" if damage is allowed in the region +			self->mCheckOtherScripts->set(parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS));	// Restore UI to actual settings +			self->mCheckGroupScripts->set(parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS)); +			LLNotificationsUtil::add("UnableToDisableOutsideScripts"); +			return; +		}  	}  	// Push data into current parcel diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3fe535cbe8..a071f338ba 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4774,7 +4774,8 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)  			if (vf.mTexCoords)  			{  				vb->getTexCoord0Strider(tc_strider); -				LLVector4a::memcpyNonAliased16((F32*) tc_strider.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32)); +				S32 tex_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; +				LLVector4a::memcpyNonAliased16((F32*) tc_strider.get(), (F32*) vf.mTexCoords, tex_size);  			}  			if (vf.mNormals) diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index c5df7e16e9..a242b224cd 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -71,9 +71,9 @@ class LLIamHere : public LLHTTPClient::Responder  	public: -		static boost::intrusive_ptr< LLIamHere > build( LLFloaterTOS* parent ) +		static LLIamHere* build( LLFloaterTOS* parent )  		{ -			return boost::intrusive_ptr< LLIamHere >( new LLIamHere( parent ) ); +			return new LLIamHere( parent );  		};  		virtual void  setParent( LLFloaterTOS* parentIn ) @@ -102,7 +102,7 @@ class LLIamHere : public LLHTTPClient::Responder  // this is global and not a class member to keep crud out of the header file  namespace { -	boost::intrusive_ptr< LLIamHere > gResponsePtr = 0; +	LLPointer< LLIamHere > gResponsePtr = 0;  };  BOOL LLFloaterTOS::postBuild() diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index e124916c48..cb6989c9dd 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -67,6 +67,19 @@ inline F64 llsgn(const F64 a)  class LLPhysicsMotion  {  public: +	typedef enum +	{ +		SMOOTHING = 0, +		MASS, +		GRAVITY, +		SPRING, +		GAIN, +		DAMPING, +		DRAG, +		MAX_EFFECT, +		NUM_PARAMS +	} eParamName; +          /*            param_driver_name: The param that controls the params that are being affected by the physics.            joint_name: The joint that the body part is attached to.  The joint is @@ -98,6 +111,11 @@ public:                  mPositionLastUpdate_local(0)          {                  mJointState = new LLJointState; + +				for (U32 i = 0; i < NUM_PARAMS; ++i) +				{ +					mParamCache[i] = NULL; +				}          }          BOOL initialize(); @@ -111,16 +129,43 @@ public:                  return mJointState;          }  protected: -        F32 getParamValue(const std::string& controller_key) -        { -                const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key); + +		F32 getParamValue(eParamName param) +		{ +			static std::string controller_key[] =  +			{ +				"Smoothing", +				"Mass", +				"Gravity", +				"Spring", +				"Gain", +				"Damping", +				"Drag", +				"MaxEffect" +			}; + +			if (!mParamCache[param]) +			{ +				const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key[param]);                  if (entry == mParamControllers.end())                  { -                        return sDefaultController[controller_key]; +                        return sDefaultController[controller_key[param]];                  }                  const std::string& param_name = (*entry).second.c_str(); -                return mCharacter->getVisualParamWeight(param_name.c_str()); -        } +                mParamCache[param] = mCharacter->getVisualParam(param_name.c_str()); +			} +				 +			if (mParamCache[param]) +			{ +				return mParamCache[param]->getWeight(); +			} +			else +			{ +				return sDefaultController[controller_key[param]]; +			} +		} + +                  void setParamValue(LLViewerVisualParam *param,                             const F32 new_value_local,                                                     F32 behavior_maxeffect); @@ -150,6 +195,8 @@ private:          F32 mLastTime; +		LLVisualParam* mParamCache[NUM_PARAMS]; +          static default_controller_map_t sDefaultController;  }; @@ -427,7 +474,6 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)          return TRUE;  } -  // Return TRUE if character has to update visual params.  BOOL LLPhysicsMotion::onUpdate(F32 time)  { @@ -471,15 +517,16 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)          LLJoint *joint = mJointState->getJoint(); -        const F32 behavior_mass = getParamValue("Mass"); -        const F32 behavior_gravity = getParamValue("Gravity"); -        const F32 behavior_spring = getParamValue("Spring"); -        const F32 behavior_gain = getParamValue("Gain"); -        const F32 behavior_damping = getParamValue("Damping"); -        const F32 behavior_drag = getParamValue("Drag"); -        const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. +		const F32 behavior_mass = getParamValue(MASS); +		const F32 behavior_gravity = getParamValue(GRAVITY); +		const F32 behavior_spring = getParamValue(SPRING); +		const F32 behavior_gain = getParamValue(GAIN); +		const F32 behavior_damping = getParamValue(DAMPING); +		const F32 behavior_drag = getParamValue(DRAG); +		F32 behavior_maxeffect = getParamValue(MAX_EFFECT); +		 +		const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. -        F32 behavior_maxeffect = getParamValue("MaxEffect");          if (physics_test)                  behavior_maxeffect = 1.0f; diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 450f9b2be7..c6b9aaae4b 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -129,22 +129,22 @@ void LLPolyMeshSharedData::freeMeshData()          {                  mNumVertices = 0; -                delete [] mBaseCoords; +                ll_aligned_free_16(mBaseCoords);                  mBaseCoords = NULL; -                delete [] mBaseNormals; +                ll_aligned_free_16(mBaseNormals);                  mBaseNormals = NULL; -                delete [] mBaseBinormals; +                ll_aligned_free_16(mBaseBinormals);                  mBaseBinormals = NULL; -                delete [] mTexCoords; +                ll_aligned_free_16(mTexCoords);                  mTexCoords = NULL; -                delete [] mDetailTexCoords; +                ll_aligned_free_16(mDetailTexCoords);                  mDetailTexCoords = NULL; -                delete [] mWeights; +                ll_aligned_free_16(mWeights);                  mWeights = NULL;          } @@ -229,15 +229,18 @@ U32 LLPolyMeshSharedData::getNumKB()  BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )  {          U32 i; -        mBaseCoords = new LLVector3[ numVertices ]; -        mBaseNormals = new LLVector3[ numVertices ]; -        mBaseBinormals = new LLVector3[ numVertices ]; -        mTexCoords = new LLVector2[ numVertices ]; -        mDetailTexCoords = new LLVector2[ numVertices ]; -        mWeights = new F32[ numVertices ]; +        mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); +        mBaseNormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); +        mBaseBinormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); +        mTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2)); +        mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2)); +        mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32));          for (i = 0; i < numVertices; i++)          { -                mWeights[i] = 0.f; +			mBaseCoords[i].clear(); +			mBaseNormals[i].clear(); +			mBaseBinormals[i].clear(); +			mWeights[i] = 0.f;          }          mNumVertices = numVertices;          return TRUE; @@ -408,39 +411,47 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )                          allocateVertexData( numVertices );       -                        //---------------------------------------------------------------- -                        // Coords -                        //---------------------------------------------------------------- -                        numRead = fread(mBaseCoords, 3*sizeof(float), numVertices, fp); -                        llendianswizzle(mBaseCoords, sizeof(float), 3*numVertices); -                        if (numRead != numVertices) -                        { -                                llerrs << "can't read Coordinates from " << fileName << llendl; -                                return FALSE; -                        } - -                        //---------------------------------------------------------------- -                        // Normals -                        //---------------------------------------------------------------- -                        numRead = fread(mBaseNormals, 3*sizeof(float), numVertices, fp); -                        llendianswizzle(mBaseNormals, sizeof(float), 3*numVertices); -                        if (numRead != numVertices) -                        { -                                llerrs << " can't read Normals from " << fileName << llendl; -                                return FALSE; -                        } - -                        //---------------------------------------------------------------- -                        // Binormals -                        //---------------------------------------------------------------- -                        numRead = fread(mBaseBinormals, 3*sizeof(float), numVertices, fp); -                        llendianswizzle(mBaseBinormals, sizeof(float), 3*numVertices); -                        if (numRead != numVertices) -                        { -                                llerrs << " can't read Binormals from " << fileName << llendl; -                                return FALSE; -                        } - +						for (U16 i = 0; i < numVertices; ++i) +						{ +							//---------------------------------------------------------------- +							// Coords +							//---------------------------------------------------------------- +							numRead = fread(&mBaseCoords[i], sizeof(float), 3, fp); +							llendianswizzle(&mBaseCoords[i], sizeof(float), 3); +							if (numRead != 3) +							{ +									llerrs << "can't read Coordinates from " << fileName << llendl; +									return FALSE; +							} +						} + +						for (U16 i = 0; i < numVertices; ++i) +						{ +							//---------------------------------------------------------------- +							// Normals +							//---------------------------------------------------------------- +							numRead = fread(&mBaseNormals[i], sizeof(float), 3, fp); +							llendianswizzle(&mBaseNormals[i], sizeof(float), 3); +							if (numRead != 3) +							{ +									llerrs << " can't read Normals from " << fileName << llendl; +									return FALSE; +							} +						} + +						for (U16 i = 0; i < numVertices; ++i) +						{ +							//---------------------------------------------------------------- +							// Binormals +							//---------------------------------------------------------------- +							numRead = fread(&mBaseBinormals[i], sizeof(float), 3, fp); +							llendianswizzle(&mBaseBinormals[i], sizeof(float), 3); +							if (numRead != 3) +							{ +									llerrs << " can't read Binormals from " << fileName << llendl; +									return FALSE; +							} +						}                          //----------------------------------------------------------------                          // TexCoords @@ -767,21 +778,28 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_  	{  		// Allocate memory without initializing every vector  		// NOTE: This makes asusmptions about the size of LLVector[234] -		int nverts = mSharedData->mNumVertices; -		int nfloats = nverts * (2*4 + 3*3 + 2 + 4); +		S32 nverts = mSharedData->mNumVertices; +		//make sure it's an even number of verts for alignment +		nverts += nverts%2; +		S32 nfloats = nverts * ( +					4 + //coords +					4 + //normals +					4 + //weights +					2 + //coords +					4 + //scaled normals +					4 + //binormals +					4); //scaled binormals +  		//use 16 byte aligned vertex data to make LLPolyMesh SSE friendly  		mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4); -		int offset = 0; -		mCoords				= 	(LLVector4*)(mVertexData + offset); offset += 4*nverts; -		mNormals			=	(LLVector4*)(mVertexData + offset); offset += 4*nverts; -		mClothingWeights	= 	(LLVector4*)(mVertexData + offset); offset += 4*nverts; -		mTexCoords			= 	(LLVector2*)(mVertexData + offset); offset += 2*nverts; - -		// these members don't need to be 16-byte aligned, but the first one might be -		// read during an aligned memcpy of mTexCoords -		mScaledNormals =                (LLVector3*)(mVertexData + offset); offset += 3*nverts; -		mBinormals =                    (LLVector3*)(mVertexData + offset); offset += 3*nverts; -		mScaledBinormals =              (LLVector3*)(mVertexData + offset); offset += 3*nverts;  +		S32 offset = 0; +		mCoords				= 	(LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mNormals			=	(LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mClothingWeights	= 	(LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mTexCoords			= 	(LLVector2*)(mVertexData + offset);  offset += 2*nverts; +		mScaledNormals		=   (LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mBinormals			=   (LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mScaledBinormals	=   (LLVector4a*)(mVertexData + offset); offset += 4*nverts;   		initializeForMorph();  	}  } @@ -906,7 +924,7 @@ void LLPolyMesh::dumpDiagInfo()  //-----------------------------------------------------------------------------  // getWritableCoords()  //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableCoords() +LLVector4a *LLPolyMesh::getWritableCoords()  {          return mCoords;  } @@ -914,7 +932,7 @@ LLVector4 *LLPolyMesh::getWritableCoords()  //-----------------------------------------------------------------------------  // getWritableNormals()  //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableNormals() +LLVector4a *LLPolyMesh::getWritableNormals()  {          return mNormals;  } @@ -922,7 +940,7 @@ LLVector4 *LLPolyMesh::getWritableNormals()  //-----------------------------------------------------------------------------  // getWritableBinormals()  //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getWritableBinormals() +LLVector4a *LLPolyMesh::getWritableBinormals()  {          return mBinormals;  } @@ -931,7 +949,7 @@ LLVector3 *LLPolyMesh::getWritableBinormals()  //-----------------------------------------------------------------------------  // getWritableClothingWeights()  //----------------------------------------------------------------------------- -LLVector4       *LLPolyMesh::getWritableClothingWeights() +LLVector4a       *LLPolyMesh::getWritableClothingWeights()  {          return mClothingWeights;  } @@ -947,7 +965,7 @@ LLVector2       *LLPolyMesh::getWritableTexCoords()  //-----------------------------------------------------------------------------  // getScaledNormals()  //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getScaledNormals() +LLVector4a *LLPolyMesh::getScaledNormals()  {          return mScaledNormals;  } @@ -955,7 +973,7 @@ LLVector3 *LLPolyMesh::getScaledNormals()  //-----------------------------------------------------------------------------  // getScaledBinormals()  //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getScaledBinormals() +LLVector4a *LLPolyMesh::getScaledBinormals()  {          return mScaledBinormals;  } @@ -966,17 +984,17 @@ LLVector3 *LLPolyMesh::getScaledBinormals()  //-----------------------------------------------------------------------------  void LLPolyMesh::initializeForMorph()  { -    for (U32 i = 0; i < mSharedData->mNumVertices; ++i) +    LLVector4a::memcpyNonAliased16((F32*) mCoords, (F32*) mSharedData->mBaseCoords, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2)); + +	for (U32 i = 0; i < mSharedData->mNumVertices; ++i)  	{ -		mCoords[i] = LLVector4(mSharedData->mBaseCoords[i]); -		mNormals[i] = LLVector4(mSharedData->mBaseNormals[i]); +		mClothingWeights[i].clear();  	} - -	memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/ -	memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/ -	memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);		/*Flawfinder: ignore*/ -	memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices);		/*Flawfinder: ignore*/ -	memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);  }  //----------------------------------------------------------------------------- @@ -1098,7 +1116,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)  LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp)  {          mAvatar = avatarp; -        mDefaultVec.setVec(0.001f, 0.001f, 0.001f); +        mDefaultVec.splat(0.001f);  }  //----------------------------------------------------------------------------- @@ -1171,8 +1189,12 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)  //-----------------------------------------------------------------------------  // apply()  //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion"); +  void LLPolySkeletalDistortion::apply( ESex avatar_sex )  { +	LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY); +          F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();          LLJoint* joint; @@ -1228,11 +1250,14 @@ LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,  {          LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);          cloned_morph_data->mName = name; +		LLVector4a dir; +		dir.load3(direction.mV); +          for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)          { -                cloned_morph_data->mCoords[v] = direction; -                cloned_morph_data->mNormals[v] = LLVector3(0,0,0); -                cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); +                cloned_morph_data->mCoords[v] = dir; +                cloned_morph_data->mNormals[v].clear(); +                cloned_morph_data->mBinormals[v].clear();          }          return cloned_morph_data;  } @@ -1243,17 +1268,27 @@ LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,  {          LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);          cloned_morph_data->mName = name; + +		LLVector4a sc; +		sc.splat(scale); + +		LLVector4a nsc; +		nsc.set(scale, -scale, scale, scale); +          for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)          { -                cloned_morph_data->mCoords[v] = src_data->mCoords[v]*scale; -                cloned_morph_data->mNormals[v] = src_data->mNormals[v]*scale; -                cloned_morph_data->mBinormals[v] = src_data->mBinormals[v]*scale; -                if (cloned_morph_data->mCoords[v][1] < 0) -                { -                        cloned_morph_data->mCoords[v][1] *= -1; -                        cloned_morph_data->mNormals[v][1] *= -1; -                        cloned_morph_data->mBinormals[v][1] *= -1; -                } +            if (cloned_morph_data->mCoords[v][1] < 0) +            { +                cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc); +				cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc); +				cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc); +			} +			else +			{ +				cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc); +				cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc); +				cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc); +			}          }          return cloned_morph_data;  } diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h index ba2bf85570..850171d169 100644 --- a/indra/newview/llpolymesh.h +++ b/indra/newview/llpolymesh.h @@ -73,9 +73,9 @@ private:  	// vertex data			  	S32						mNumVertices; -	LLVector3				*mBaseCoords; -	LLVector3				*mBaseNormals; -	LLVector3				*mBaseBinormals; +	LLVector4a				*mBaseCoords; +	LLVector4a				*mBaseNormals; +	LLVector4a				*mBaseBinormals;  	LLVector2				*mTexCoords;  	LLVector2				*mDetailTexCoords;  	F32						*mWeights; @@ -217,41 +217,41 @@ public:  	}  	// Get coords -	const LLVector4	*getCoords() const{ +	const LLVector4a	*getCoords() const{  		return mCoords;  	}  	// non const version -	LLVector4 *getWritableCoords(); +	LLVector4a *getWritableCoords();  	// Get normals -	const LLVector4	*getNormals() const{  +	const LLVector4a	*getNormals() const{   		return mNormals;   	}  	// Get normals -	const LLVector3	*getBinormals() const{  +	const LLVector4a	*getBinormals() const{   		return mBinormals;   	}  	// Get base mesh normals -	const LLVector3 *getBaseNormals() const{ +	const LLVector4a *getBaseNormals() const{  		llassert(mSharedData);  		return mSharedData->mBaseNormals;  	}  	// Get base mesh normals -	const LLVector3 *getBaseBinormals() const{ +	const LLVector4a *getBaseBinormals() const{  		llassert(mSharedData);  		return mSharedData->mBaseBinormals;  	}  	// intermediate morphed normals and output normals -	LLVector4 *getWritableNormals(); -	LLVector3 *getScaledNormals(); +	LLVector4a *getWritableNormals(); +	LLVector4a *getScaledNormals(); -	LLVector3 *getWritableBinormals(); -	LLVector3 *getScaledBinormals(); +	LLVector4a *getWritableBinormals(); +	LLVector4a *getScaledBinormals();  	// Get texCoords  	const LLVector2	*getTexCoords() const {  @@ -275,9 +275,9 @@ public:  	F32			*getWritableWeights() const; -	LLVector4	*getWritableClothingWeights(); +	LLVector4a	*getWritableClothingWeights(); -	const LLVector4		*getClothingWeights() +	const LLVector4a		*getClothingWeights()  	{  		return mClothingWeights;	  	} @@ -341,17 +341,17 @@ protected:  	// Single array of floats for allocation / deletion  	F32						*mVertexData;  	// deformed vertices (resulting from application of morph targets) -	LLVector4				*mCoords; +	LLVector4a				*mCoords;  	// deformed normals (resulting from application of morph targets) -	LLVector3				*mScaledNormals; +	LLVector4a				*mScaledNormals;  	// output normals (after normalization) -	LLVector4				*mNormals; +	LLVector4a				*mNormals;  	// deformed binormals (resulting from application of morph targets) -	LLVector3				*mScaledBinormals; +	LLVector4a				*mScaledBinormals;  	// output binormals (after normalization) -	LLVector3				*mBinormals; +	LLVector4a				*mBinormals;  	// weight values that mark verts as clothing/skin -	LLVector4				*mClothingWeights; +	LLVector4a				*mClothingWeights;  	// output texture coordinates  	LLVector2				*mTexCoords; @@ -406,6 +406,16 @@ public:  	LLPolySkeletalDistortion(LLVOAvatar *avatarp);  	~LLPolySkeletalDistortion(); +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	// Special: These functions are overridden by child classes  	LLPolySkeletalDistortionInfo*	getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }  	//   This sets mInfo and calls initialization functions @@ -419,17 +429,17 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion() { return 0.1f; } -	/*virtual*/ const LLVector3&	getAvgDistortion()	{ return mDefaultVec; } +	/*virtual*/ const LLVector4a&	getAvgDistortion()	{ return mDefaultVec; }  	/*virtual*/ F32					getMaxDistortion() { return 0.1f; } -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector3(0.001f, 0.001f, 0.001f);} -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);} +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};  protected:  	typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;  	joint_vec_map_t mJointScales;  	joint_vec_map_t mJointOffsets; -	LLVector3	mDefaultVec; +	LLVector4a	mDefaultVec;  	// Backlink only; don't make this an LLPointer.  	LLVOAvatar *mAvatar;  }; diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index cefd7df3fe..bd96608641 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -48,7 +48,7 @@ LLPolyMorphData::LLPolyMorphData(const std::string& morph_name)  	mNumIndices = 0;  	mCurrentIndex = 0;  	mTotalDistortion = 0.f; -	mAvgDistortion.zeroVec(); +	mAvgDistortion.clear();  	mMaxDistortion = 0.f;  	mVertexIndices = NULL;  	mCoords = NULL; @@ -73,9 +73,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :  {  	const S32 numVertices = mNumIndices; -	mCoords = new LLVector3[numVertices]; -	mNormals = new LLVector3[numVertices]; -	mBinormals = new LLVector3[numVertices]; +	mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a))); +	mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a))); +	mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));  	mTexCoords = new LLVector2[numVertices];  	mVertexIndices = new U32[numVertices]; @@ -89,17 +89,12 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :  	}  } -  //-----------------------------------------------------------------------------  // ~LLPolyMorphData()  //-----------------------------------------------------------------------------  LLPolyMorphData::~LLPolyMorphData()  { -	delete [] mVertexIndices; -	delete [] mCoords; -	delete [] mNormals; -	delete [] mBinormals; -	delete [] mTexCoords; +	freeData();  }  //----------------------------------------------------------------------------- @@ -119,18 +114,23 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)  	}  	//------------------------------------------------------------------------- +	// free any existing data +	//------------------------------------------------------------------------- +	freeData(); + +	//-------------------------------------------------------------------------  	// allocate vertices  	//------------------------------------------------------------------------- -	mCoords = new LLVector3[numVertices]; -	mNormals = new LLVector3[numVertices]; -	mBinormals = new LLVector3[numVertices]; +	mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a))); +	mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a))); +	mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));  	mTexCoords = new LLVector2[numVertices];  	// Actually, we are allocating more space than we need for the skiplist  	mVertexIndices = new U32[numVertices];  	mNumIndices = 0;  	mTotalDistortion = 0.f;  	mMaxDistortion = 0.f; -	mAvgDistortion.zeroVec(); +	mAvgDistortion.clear();  	mMesh = mesh;  	//------------------------------------------------------------------------- @@ -152,36 +152,36 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)  		} -		numRead = fread(&mCoords[v].mV, sizeof(F32), 3, fp); -		llendianswizzle(&mCoords[v].mV, sizeof(F32), 3); +		numRead = fread(&mCoords[v], sizeof(F32), 3, fp); +		llendianswizzle(&mCoords[v], sizeof(F32), 3);  		if (numRead != 3)  		{  			llwarns << "Can't read morph target vertex coordinates" << llendl;  			return FALSE;  		} -		F32 magnitude = mCoords[v].magVec(); +		F32 magnitude = mCoords[v].getLength3().getF32();  		mTotalDistortion += magnitude; -		mAvgDistortion.mV[VX] += fabs(mCoords[v].mV[VX]); -		mAvgDistortion.mV[VY] += fabs(mCoords[v].mV[VY]); -		mAvgDistortion.mV[VZ] += fabs(mCoords[v].mV[VZ]); +		LLVector4a t; +		t.setAbs(mCoords[v]); +		mAvgDistortion.add(t);  		if (magnitude > mMaxDistortion)  		{  			mMaxDistortion = magnitude;  		} -		numRead = fread(&mNormals[v].mV, sizeof(F32), 3, fp); -		llendianswizzle(&mNormals[v].mV, sizeof(F32), 3); +		numRead = fread(&mNormals[v], sizeof(F32), 3, fp); +		llendianswizzle(&mNormals[v], sizeof(F32), 3);  		if (numRead != 3)  		{  			llwarns << "Can't read morph target normal" << llendl;  			return FALSE;  		} -		numRead = fread(&mBinormals[v].mV, sizeof(F32), 3, fp); -		llendianswizzle(&mBinormals[v].mV, sizeof(F32), 3); +		numRead = fread(&mBinormals[v], sizeof(F32), 3, fp); +		llendianswizzle(&mBinormals[v], sizeof(F32), 3);  		if (numRead != 3)  		{  			llwarns << "Can't read morph target binormal" << llendl; @@ -200,13 +200,49 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)  		mNumIndices++;  	} -	mAvgDistortion = mAvgDistortion * (1.f/(F32)mNumIndices); -	mAvgDistortion.normVec(); +	mAvgDistortion.mul(1.f/(F32)mNumIndices); +	mAvgDistortion.normalize3fast();  	return TRUE;  }  //----------------------------------------------------------------------------- +// freeData() +//----------------------------------------------------------------------------- +void LLPolyMorphData::freeData() +{ +	if (mCoords != NULL) +	{ +		ll_aligned_free_16(mCoords); +		mCoords = NULL; +	} + +	if (mNormals != NULL) +	{ +		ll_aligned_free_16(mNormals); +		mNormals = NULL; +	} + +	if (mBinormals != NULL) +	{ +		ll_aligned_free_16(mBinormals); +		mBinormals = NULL; +	} + +	if (mTexCoords != NULL) +	{ +		delete [] mTexCoords; +		mTexCoords = NULL; +	} + +	if (mVertexIndices != NULL) +	{ +		delete [] mVertexIndices; +		mVertexIndices = NULL; +	} +} + +//-----------------------------------------------------------------------------  // LLPolyMorphTargetInfo()  //-----------------------------------------------------------------------------  LLPolyMorphTargetInfo::LLPolyMorphTargetInfo() @@ -367,9 +403,9 @@ BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node)  //-----------------------------------------------------------------------------  // getVertexDistortion()  //----------------------------------------------------------------------------- -LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh) +LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh)  { -	if (!mMorphData || mMesh != mesh) return LLVector3::zero; +	if (!mMorphData || mMesh != mesh) return LLVector4a::getZero();  	for(U32 index = 0; index < mMorphData->mNumIndices; index++)  	{ @@ -379,17 +415,17 @@ LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh  		}  	} -	return LLVector3::zero; +	return LLVector4a::getZero();  }  //-----------------------------------------------------------------------------  // getFirstDistortion()  //----------------------------------------------------------------------------- -const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)  { -	if (!mMorphData) return &LLVector3::zero; +	if (!mMorphData) return &LLVector4a::getZero(); -	LLVector3* resultVec; +	LLVector4a* resultVec;  	mMorphData->mCurrentIndex = 0;  	if (mMorphData->mNumIndices)  	{ @@ -411,11 +447,11 @@ const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **  //-----------------------------------------------------------------------------  // getNextDistortion()  //----------------------------------------------------------------------------- -const LLVector3 *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)  { -	if (!mMorphData) return &LLVector3::zero; +	if (!mMorphData) return &LLVector4a::getZero(); -	LLVector3* resultVec; +	LLVector4a* resultVec;  	mMorphData->mCurrentIndex++;  	if (mMorphData->mCurrentIndex < mMorphData->mNumIndices)  	{ @@ -451,7 +487,7 @@ F32	LLPolyMorphTarget::getTotalDistortion()  //-----------------------------------------------------------------------------  // getAvgDistortion()  //----------------------------------------------------------------------------- -const LLVector3& LLPolyMorphTarget::getAvgDistortion()	 +const LLVector4a& LLPolyMorphTarget::getAvgDistortion()	  {  	if (mMorphData)   	{ @@ -459,7 +495,7 @@ const LLVector3& LLPolyMorphTarget::getAvgDistortion()  	}  	else   	{ -		return LLVector3::zero; +		return LLVector4a::getZero();  	}  } @@ -481,6 +517,8 @@ F32	LLPolyMorphTarget::getMaxDistortion()  //-----------------------------------------------------------------------------  // apply()  //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_APPLY_MORPH_TARGET("Apply Morph"); +  void LLPolyMorphTarget::apply( ESex avatar_sex )  {  	if (!mMorphData || mNumMorphMasksPending > 0) @@ -488,6 +526,8 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  		return;  	} +	LLFastTimer t(FTM_APPLY_MORPH_TARGET); +  	mLastSex = avatar_sex;  	// Check for NaN condition (NaN is detected if a variable doesn't equal itself. @@ -508,15 +548,15 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  	if (delta_weight != 0.f)  	{  		llassert(!mMesh->isLOD()); -		LLVector4 *coords = mMesh->getWritableCoords(); +		LLVector4a *coords = mMesh->getWritableCoords(); -		LLVector3 *scaled_normals = mMesh->getScaledNormals(); -		LLVector4 *normals = mMesh->getWritableNormals(); +		LLVector4a *scaled_normals = mMesh->getScaledNormals(); +		LLVector4a *normals = mMesh->getWritableNormals(); -		LLVector3 *scaled_binormals = mMesh->getScaledBinormals(); -		LLVector3 *binormals = mMesh->getWritableBinormals(); +		LLVector4a *scaled_binormals = mMesh->getScaledBinormals(); +		LLVector4a *binormals = mMesh->getWritableBinormals(); -		LLVector4 *clothing_weights = mMesh->getWritableClothingWeights(); +		LLVector4a *clothing_weights = mMesh->getWritableClothingWeights();  		LLVector2 *tex_coords = mMesh->getWritableTexCoords();  		F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; @@ -531,31 +571,38 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  				maskWeight = maskWeightArray[vert_index_morph];  			} -			coords[vert_index_mesh] += LLVector4(mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight); + +			LLVector4a pos = mMorphData->mCoords[vert_index_morph]; +			pos.mul(delta_weight*maskWeight); +			coords[vert_index_mesh].add(pos);  			if (getInfo()->mIsClothingMorph && clothing_weights)  			{ -				LLVector3 clothing_offset = mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight; -				LLVector4* clothing_weight = &clothing_weights[vert_index_mesh]; -				clothing_weight->mV[VX] += clothing_offset.mV[VX]; -				clothing_weight->mV[VY] += clothing_offset.mV[VY]; -				clothing_weight->mV[VZ] += clothing_offset.mV[VZ]; -				clothing_weight->mV[VW] = maskWeight; +				LLVector4a clothing_offset = mMorphData->mCoords[vert_index_morph]; +				clothing_offset.mul(delta_weight * maskWeight); +				LLVector4a* clothing_weight = &clothing_weights[vert_index_mesh]; +				clothing_weight->add(clothing_offset); +				clothing_weight->getF32ptr()[VW] = maskWeight;  			}  			// calculate new normals based on half angles -			scaled_normals[vert_index_mesh] += mMorphData->mNormals[vert_index_morph] * delta_weight * maskWeight * NORMAL_SOFTEN_FACTOR; -			LLVector3 normalized_normal = scaled_normals[vert_index_mesh]; -			normalized_normal.normVec(); -			normals[vert_index_mesh] = LLVector4(normalized_normal); +			LLVector4a norm = mMorphData->mNormals[vert_index_morph]; +			norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); +			scaled_normals[vert_index_mesh].add(norm); +			norm = scaled_normals[vert_index_mesh]; +			norm.normalize3fast(); +			normals[vert_index_mesh] = norm;  			// calculate new binormals -			scaled_binormals[vert_index_mesh] += mMorphData->mBinormals[vert_index_morph] * delta_weight * maskWeight * NORMAL_SOFTEN_FACTOR; -			LLVector3 tangent = scaled_binormals[vert_index_mesh] % normalized_normal; -			LLVector3 normalized_binormal = normalized_normal % tangent;  -			normalized_binormal.normVec(); -			binormals[vert_index_mesh] = normalized_binormal; - +			LLVector4a binorm = mMorphData->mBinormals[vert_index_morph]; +			binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); +			scaled_binormals[vert_index_mesh].add(binorm); +			LLVector4a tangent; +			tangent.setCross3(scaled_binormals[vert_index_mesh], norm); +			LLVector4a& normalized_binormal = binormals[vert_index_mesh]; +			normalized_binormal.setCross3(norm, tangent);  +			normalized_binormal.normalize3fast(); +			  			tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight;  		} @@ -582,7 +629,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  //-----------------------------------------------------------------------------  void	LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert)  { -	LLVector4 *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; +	LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL;  	if (!mVertMask)  	{ @@ -596,29 +643,47 @@ void	LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3  		if (maskWeights)  		{ -			LLVector4 *coords = mMesh->getWritableCoords(); -			LLVector3 *scaled_normals = mMesh->getScaledNormals(); -			LLVector3 *scaled_binormals = mMesh->getScaledBinormals(); +			LLVector4a *coords = mMesh->getWritableCoords(); +			LLVector4a *scaled_normals = mMesh->getScaledNormals(); +			LLVector4a *scaled_binormals = mMesh->getScaledBinormals();  			LLVector2 *tex_coords = mMesh->getWritableTexCoords(); +			LLVector4Logical clothing_mask; +			clothing_mask.clear(); +			clothing_mask.setElement<0>(); +			clothing_mask.setElement<1>(); +			clothing_mask.setElement<2>(); + +  			for(U32 vert = 0; vert < mMorphData->mNumIndices; vert++)  			{  				F32 lastMaskWeight = mLastWeight * maskWeights[vert];  				S32 out_vert = mMorphData->mVertexIndices[vert];  				// remove effect of existing masked morph -				coords[out_vert] -= LLVector4(mMorphData->mCoords[vert]) * lastMaskWeight; -				scaled_normals[out_vert] -= mMorphData->mNormals[vert] * lastMaskWeight * NORMAL_SOFTEN_FACTOR; -				scaled_binormals[out_vert] -= mMorphData->mBinormals[vert] * lastMaskWeight * NORMAL_SOFTEN_FACTOR; +				LLVector4a t; +				t = mMorphData->mCoords[vert]; +				t.mul(lastMaskWeight); +				coords[out_vert].sub(t); + +				t = mMorphData->mNormals[vert]; +				t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); +				scaled_normals[out_vert].sub(t); + +				t = mMorphData->mBinormals[vert]; +				t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); +				scaled_binormals[out_vert].sub(t); +  				tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight;  				if (clothing_weights)  				{ -					LLVector3 clothing_offset = mMorphData->mCoords[vert] * lastMaskWeight; -					LLVector4* clothing_weight = &clothing_weights[out_vert]; -					clothing_weight->mV[VX] -= clothing_offset.mV[VX]; -					clothing_weight->mV[VY] -= clothing_offset.mV[VY]; -					clothing_weight->mV[VZ] -= clothing_offset.mV[VZ]; +					LLVector4a clothing_offset = mMorphData->mCoords[vert]; +					clothing_offset.mul(lastMaskWeight); +					LLVector4a* clothing_weight = &clothing_weights[out_vert]; +					LLVector4a t; +					t.setSub(*clothing_weight, clothing_offset); +					clothing_weight->setSelectWithMask(clothing_mask, t, *clothing_weight);  				}  			}  		} @@ -654,7 +719,7 @@ LLPolyVertexMask::~LLPolyVertexMask()  //-----------------------------------------------------------------------------  // generateMask()  //----------------------------------------------------------------------------- -void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights) +void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights)  {  // RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/)  //	BOOL debugImg = FALSE;  @@ -698,7 +763,7 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height,  		if (clothing_weights)  		{ -			clothing_weights[vertIndex].mV[VW] = mWeights[index]; +			clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index];  		}  	}  	mWeightsGenerated = TRUE; diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h index 8a024f2e9e..678599d7e1 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/newview/llpolymorph.h @@ -48,6 +48,16 @@ public:  	~LLPolyMorphData();  	LLPolyMorphData(const LLPolyMorphData &rhs); +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	BOOL			loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);  	const std::string& getName() { return mName; } @@ -58,15 +68,18 @@ public:  	U32					mNumIndices;  	U32*				mVertexIndices;  	U32					mCurrentIndex; -	LLVector3*			mCoords; -	LLVector3*			mNormals; -	LLVector3*			mBinormals; +	LLVector4a*			mCoords; +	LLVector4a*			mNormals; +	LLVector4a*			mBinormals;  	LLVector2*			mTexCoords;  	F32					mTotalDistortion;	// vertex distortion summed over entire morph  	F32					mMaxDistortion;		// maximum single vertex distortion in a given morph -	LLVector3			mAvgDistortion;		// average vertex distortion, to infer directionality of the morph +	LLVector4a			mAvgDistortion;		// average vertex distortion, to infer directionality of the morph  	LLPolyMeshSharedData*	mMesh; + +private: +	void freeData();  };  //----------------------------------------------------------------------------- @@ -78,7 +91,7 @@ public:  	LLPolyVertexMask(LLPolyMorphData* morph_data);  	~LLPolyVertexMask(); -	void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights); +	void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights);  	F32* getMorphMaskWeights(); @@ -157,11 +170,11 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion(); -	/*virtual*/ const LLVector3&	getAvgDistortion(); +	/*virtual*/ const LLVector4a&	getAvgDistortion();  	/*virtual*/ F32					getMaxDistortion(); -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);  	void	applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);  	void	addPendingMorphMask() { mNumMorphMasksPending++; } diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 1ce05da849..92c2863ffd 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -352,7 +352,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)  		getChildView("BtnCreator")->setEnabled(FALSE);  		getChildView("LabelCreatorTitle")->setEnabled(FALSE);  		getChildView("LabelCreatorName")->setEnabled(FALSE); -		getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown")); +		getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown_multiple"));  	}  	//////////////// diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 325a2d3004..3bb8e60787 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -68,6 +68,7 @@ const F32 SG_OCCLUSION_FUDGE = 0.25f;  #define assert_states_valid(x)  #endif +extern bool gShiftFrame;  static U32 sZombieGroups = 0;  U32 LLSpatialGroup::sNodeCount = 0; @@ -529,6 +530,7 @@ void LLSpatialGroup::setVisible()  void LLSpatialGroup::validate()  { +	ll_assert_aligned(this,64);  #if LL_OCTREE_PARANOIA_CHECK  	sg_assert(!isState(DIRTY)); @@ -541,7 +543,7 @@ void LLSpatialGroup::validate()  	validateDrawMap(); -	for (element_iter i = getData().begin(); i != getData().end(); ++i) +	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		sg_assert(drawable->getSpatialGroup() == this); @@ -758,7 +760,7 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma  {	  	const OctreeNode* node = mOctreeNode; -	if (node->getData().empty()) +	if (node->isEmpty())  	{	//don't do anything if there are no objects  		if (empty && mOctreeNode->getParent())  		{	//only root is allowed to be empty @@ -775,14 +777,14 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma  		clearState(OBJECT_DIRTY);  		//initialize bounding box to first element -		OctreeNode::const_element_iter i = node->getData().begin(); +		OctreeNode::const_element_iter i = node->getDataBegin();  		LLDrawable* drawablep = *i;  		const LLVector4a* minMax = drawablep->getSpatialExtents();  		newMin = minMax[0];  		newMax = minMax[1]; -		for (++i; i != node->getData().end(); ++i) +		for (++i; i != node->getDataEnd(); ++i)  		{  			drawablep = *i;  			minMax = drawablep->getSpatialExtents(); @@ -923,7 +925,10 @@ void LLSpatialGroup::shift(const LLVector4a &offset)  	mObjectExtents[0].add(offset);  	mObjectExtents[1].add(offset); -	//if (!mSpatialPartition->mRenderByGroup) +	if (!mSpatialPartition->mRenderByGroup &&  +		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TREE && +		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TERRAIN && +		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_BRIDGE)  	{  		setState(GEOM_DIRTY);  		gPipeline.markRebuild(this, TRUE); @@ -1195,6 +1200,8 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) :  	mCurUpdatingSlotp(NULL),  	mCurUpdatingTexture (NULL)  { +	ll_assert_aligned(this,16); +	  	sNodeCount++;  	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); @@ -1238,13 +1245,18 @@ void LLSpatialGroup::updateDistance(LLCamera &camera)  		return;  	} +	if (gShiftFrame) +	{ +		return; +	} +  #if !LL_RELEASE_FOR_DOWNLOAD  	if (isState(LLSpatialGroup::OBJECT_DIRTY))  	{  		llerrs << "Spatial group dirty on distance update." << llendl;  	}  #endif -	if (!getData().empty()) +	if (!isEmpty())  	{  		mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :  						(F32) mOctreeNode->getSize().getLength3().getF32(); @@ -1395,7 +1407,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)  	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);  	setState(DEAD); -	for (element_iter i = getData().begin(); i != getData().end(); ++i) +	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		if (drawable->getSpatialGroup() == this) @@ -1482,7 +1494,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)  	} -	for (LLSpatialGroup::element_iter i = getData().begin(); i != getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		for (S32 j = 0; j < drawable->getNumFaces(); j++) @@ -1838,12 +1850,16 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp)  {  	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); -	drawablep->setSpatialGroup(NULL); -  	if (!curp->removeObject(drawablep))  	{  		OCT_ERRS << "Failed to remove drawable from octree!" << llendl;  	} +	else +	{ +		drawablep->setSpatialGroup(NULL); +	} + +	drawablep->setSpatialGroup(NULL);  	assert_octree_valid(mOctree); @@ -2114,7 +2130,7 @@ public:  	virtual void processGroup(LLSpatialGroup* group)  	{ -		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->getData().empty()) +		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->isEmpty())  		if (mRes < 2)  		{ @@ -2181,7 +2197,7 @@ public:  	{  		LLSpatialGroup::OctreeNode* branch = group->mOctreeNode; -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -2305,7 +2321,7 @@ public:  		LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);  		group->destroyGL(); -		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i;  			if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup) @@ -2615,7 +2631,7 @@ void renderOctree(LLSpatialGroup* group)  			gGL.flush();  			glLineWidth(1.f);  			gGL.flush(); -			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  			{  				LLDrawable* drawable = *i;  				if (!group->mSpatialPartition->isBridge()) @@ -2661,7 +2677,7 @@ void renderOctree(LLSpatialGroup* group)  	}  	else  	{ -		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty()  +		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty()   			&& group->mSpatialPartition->mRenderByGroup)  		{  			col.setVec(0.8f, 0.4f, 0.1f, 0.1f); @@ -2729,7 +2745,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)  	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);  	BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && -							!group->getData().empty(); +							!group->isEmpty();  	if (render_objects)  	{ @@ -3460,7 +3476,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)  void renderPhysicsShapes(LLSpatialGroup* group)  { -	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		LLVOVolume* volume = drawable->getVOVolume(); @@ -3809,7 +3825,7 @@ public:  		LLVector3 center, size; -		if (branch->getData().empty()) +		if (branch->isEmpty())  		{  			gGL.diffuseColor3f(1.f,0.2f,0.f);  			center.set(branch->getCenter().getF32ptr()); @@ -3845,8 +3861,8 @@ public:  			}  			gGL.begin(LLRender::TRIANGLES); -			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin(); -					iter != branch->getData().end(); +			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin(); +					iter != branch->getDataEnd();  					++iter)  			{  				const LLVolumeTriangle* tri = *iter; @@ -4083,7 +4099,7 @@ public:  		if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))  		{ -			if (!group->getData().empty()) +			if (!group->isEmpty())  			{  				gGL.diffuseColor3f(0,0,1);  				drawBoxOutline(group->mObjectBounds[0], @@ -4091,7 +4107,7 @@ public:  			}  		} -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -4280,7 +4296,7 @@ public:  			return;  		} -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -4504,7 +4520,7 @@ public:  	virtual void visit(const LLSpatialGroup::OctreeNode* branch)   	{	 -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			check(*i);  		} @@ -4690,28 +4706,70 @@ LLVertexBuffer* LLGeometryManager::createVertexBuffer(U32 type_mask, U32 usage)  LLCullResult::LLCullResult()   { +	mVisibleGroupsAllocated = 0; +	mAlphaGroupsAllocated = 0; +	mOcclusionGroupsAllocated = 0; +	mDrawableGroupsAllocated = 0; +	mVisibleListAllocated = 0; +	mVisibleBridgeAllocated = 0; + +	mVisibleGroups.clear(); +	mVisibleGroups.push_back(NULL); +	mVisibleGroupsEnd = &mVisibleGroups[0]; +	mAlphaGroups.clear(); +	mAlphaGroups.push_back(NULL); +	mAlphaGroupsEnd = &mAlphaGroups[0]; +	mOcclusionGroups.clear(); +	mOcclusionGroups.push_back(NULL); +	mOcclusionGroupsEnd = &mOcclusionGroups[0]; +	mDrawableGroups.clear(); +	mDrawableGroups.push_back(NULL); +	mDrawableGroupsEnd = &mDrawableGroups[0]; +	mVisibleList.clear(); +	mVisibleList.push_back(NULL); +	mVisibleListEnd = &mVisibleList[0]; +	mVisibleBridge.clear(); +	mVisibleBridge.push_back(NULL); +	mVisibleBridgeEnd = &mVisibleBridge[0]; + +	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) +	{ +		mRenderMap[i].clear(); +		mRenderMap[i].push_back(NULL); +		mRenderMapEnd[i] = &mRenderMap[i][0]; +		mRenderMapAllocated[i] = 0; +	} +  	clear();  } +template <class T, class V>  +void LLCullResult::pushBack(T& head, U32& count, V* val) +{ +	head[count] = val; +	head.push_back(NULL); +	count++; +} +  void LLCullResult::clear()  {  	mVisibleGroupsSize = 0; -	mVisibleGroupsEnd = mVisibleGroups.begin(); +	mVisibleGroupsEnd = &mVisibleGroups[0];  	mAlphaGroupsSize = 0; -	mAlphaGroupsEnd = mAlphaGroups.begin(); +	mAlphaGroupsEnd = &mAlphaGroups[0];  	mOcclusionGroupsSize = 0; -	mOcclusionGroupsEnd = mOcclusionGroups.begin(); +	mOcclusionGroupsEnd = &mOcclusionGroups[0];  	mDrawableGroupsSize = 0; -	mDrawableGroupsEnd = mDrawableGroups.begin(); +	mDrawableGroupsEnd = &mDrawableGroups[0];  	mVisibleListSize = 0; -	mVisibleListEnd = mVisibleList.begin(); +	mVisibleListEnd = &mVisibleList[0];  	mVisibleBridgeSize = 0; -	mVisibleBridgeEnd = mVisibleBridge.begin(); +	mVisibleBridgeEnd = &mVisibleBridge[0];  	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) @@ -4721,176 +4779,176 @@ void LLCullResult::clear()  			mRenderMap[i][j] = 0;  		}  		mRenderMapSize[i] = 0; -		mRenderMapEnd[i] = mRenderMap[i].begin(); +		mRenderMapEnd[i] = &(mRenderMap[i][0]);  	}  } -LLCullResult::sg_list_t::iterator LLCullResult::beginVisibleGroups() +LLCullResult::sg_iterator LLCullResult::beginVisibleGroups()  { -	return mVisibleGroups.begin(); +	return &mVisibleGroups[0];  } -LLCullResult::sg_list_t::iterator LLCullResult::endVisibleGroups() +LLCullResult::sg_iterator LLCullResult::endVisibleGroups()  {  	return mVisibleGroupsEnd;  } -LLCullResult::sg_list_t::iterator LLCullResult::beginAlphaGroups() +LLCullResult::sg_iterator LLCullResult::beginAlphaGroups()  { -	return mAlphaGroups.begin(); +	return &mAlphaGroups[0];  } -LLCullResult::sg_list_t::iterator LLCullResult::endAlphaGroups() +LLCullResult::sg_iterator LLCullResult::endAlphaGroups()  {  	return mAlphaGroupsEnd;  } -LLCullResult::sg_list_t::iterator LLCullResult::beginOcclusionGroups() +LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups()  { -	return mOcclusionGroups.begin(); +	return &mOcclusionGroups[0];  } -LLCullResult::sg_list_t::iterator LLCullResult::endOcclusionGroups() +LLCullResult::sg_iterator LLCullResult::endOcclusionGroups()  {  	return mOcclusionGroupsEnd;  } -LLCullResult::sg_list_t::iterator LLCullResult::beginDrawableGroups() +LLCullResult::sg_iterator LLCullResult::beginDrawableGroups()  { -	return mDrawableGroups.begin(); +	return &mDrawableGroups[0];  } -LLCullResult::sg_list_t::iterator LLCullResult::endDrawableGroups() +LLCullResult::sg_iterator LLCullResult::endDrawableGroups()  {  	return mDrawableGroupsEnd;  } -LLCullResult::drawable_list_t::iterator LLCullResult::beginVisibleList() +LLCullResult::drawable_iterator LLCullResult::beginVisibleList()  { -	return mVisibleList.begin(); +	return &mVisibleList[0];  } -LLCullResult::drawable_list_t::iterator LLCullResult::endVisibleList() +LLCullResult::drawable_iterator LLCullResult::endVisibleList()  {  	return mVisibleListEnd;  } -LLCullResult::bridge_list_t::iterator LLCullResult::beginVisibleBridge() +LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge()  { -	return mVisibleBridge.begin(); +	return &mVisibleBridge[0];  } -LLCullResult::bridge_list_t::iterator LLCullResult::endVisibleBridge() +LLCullResult::bridge_iterator LLCullResult::endVisibleBridge()  {  	return mVisibleBridgeEnd;  } -LLCullResult::drawinfo_list_t::iterator LLCullResult::beginRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type)  { -	return mRenderMap[type].begin(); +	return &mRenderMap[type][0];  } -LLCullResult::drawinfo_list_t::iterator LLCullResult::endRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type)  {  	return mRenderMapEnd[type];  }  void LLCullResult::pushVisibleGroup(LLSpatialGroup* group)  { -	if (mVisibleGroupsSize < mVisibleGroups.size()) +	if (mVisibleGroupsSize < mVisibleGroupsAllocated)  	{  		mVisibleGroups[mVisibleGroupsSize] = group;  	}  	else  	{ -		mVisibleGroups.push_back(group); +		pushBack(mVisibleGroups, mVisibleGroupsAllocated, group);  	}  	++mVisibleGroupsSize; -	mVisibleGroupsEnd = mVisibleGroups.begin()+mVisibleGroupsSize; +	mVisibleGroupsEnd = &mVisibleGroups[mVisibleGroupsSize];  }  void LLCullResult::pushAlphaGroup(LLSpatialGroup* group)  { -	if (mAlphaGroupsSize < mAlphaGroups.size()) +	if (mAlphaGroupsSize < mAlphaGroupsAllocated)  	{  		mAlphaGroups[mAlphaGroupsSize] = group;  	}  	else  	{ -		mAlphaGroups.push_back(group); +		pushBack(mAlphaGroups, mAlphaGroupsAllocated, group);  	}  	++mAlphaGroupsSize; -	mAlphaGroupsEnd = mAlphaGroups.begin()+mAlphaGroupsSize; +	mAlphaGroupsEnd = &mAlphaGroups[mAlphaGroupsSize];  }  void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)  { -	if (mOcclusionGroupsSize < mOcclusionGroups.size()) +	if (mOcclusionGroupsSize < mOcclusionGroupsAllocated)  	{  		mOcclusionGroups[mOcclusionGroupsSize] = group;  	}  	else  	{ -		mOcclusionGroups.push_back(group); +		pushBack(mOcclusionGroups, mOcclusionGroupsAllocated, group);  	}  	++mOcclusionGroupsSize; -	mOcclusionGroupsEnd = mOcclusionGroups.begin()+mOcclusionGroupsSize; +	mOcclusionGroupsEnd = &mOcclusionGroups[mOcclusionGroupsSize];  }  void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)  { -	if (mDrawableGroupsSize < mDrawableGroups.size()) +	if (mDrawableGroupsSize < mDrawableGroupsAllocated)  	{  		mDrawableGroups[mDrawableGroupsSize] = group;  	}  	else  	{ -		mDrawableGroups.push_back(group); +		pushBack(mDrawableGroups, mDrawableGroupsAllocated, group);  	}  	++mDrawableGroupsSize; -	mDrawableGroupsEnd = mDrawableGroups.begin()+mDrawableGroupsSize; +	mDrawableGroupsEnd = &mDrawableGroups[mDrawableGroupsSize];  }  void LLCullResult::pushDrawable(LLDrawable* drawable)  { -	if (mVisibleListSize < mVisibleList.size()) +	if (mVisibleListSize < mVisibleListAllocated)  	{  		mVisibleList[mVisibleListSize] = drawable;  	}  	else  	{ -		mVisibleList.push_back(drawable); +		pushBack(mVisibleList, mVisibleListAllocated, drawable);  	}  	++mVisibleListSize; -	mVisibleListEnd = mVisibleList.begin()+mVisibleListSize; +	mVisibleListEnd = &mVisibleList[mVisibleListSize];  }  void LLCullResult::pushBridge(LLSpatialBridge* bridge)  { -	if (mVisibleBridgeSize < mVisibleBridge.size()) +	if (mVisibleBridgeSize < mVisibleBridgeAllocated)  	{  		mVisibleBridge[mVisibleBridgeSize] = bridge;  	}  	else  	{ -		mVisibleBridge.push_back(bridge); +		pushBack(mVisibleBridge, mVisibleBridgeAllocated, bridge);  	}  	++mVisibleBridgeSize; -	mVisibleBridgeEnd = mVisibleBridge.begin()+mVisibleBridgeSize; +	mVisibleBridgeEnd = &mVisibleBridge[mVisibleBridgeSize];  }  void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)  { -	if (mRenderMapSize[type] < mRenderMap[type].size()) +	if (mRenderMapSize[type] < mRenderMapAllocated[type])  	{  		mRenderMap[type][mRenderMapSize[type]] = draw_info;  	}  	else  	{ -		mRenderMap[type].push_back(draw_info); +		pushBack(mRenderMap[type], mRenderMapAllocated[type], draw_info);  	}  	++mRenderMapSize[type]; -	mRenderMapEnd[type] = mRenderMap[type].begin() + mRenderMapSize[type]; +	mRenderMapEnd[type] = &(mRenderMap[type][mRenderMapSize[type]]);  } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index f0e4f15a83..b1706d9d35 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -68,6 +68,16 @@ protected:  	~LLDrawInfo();	  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	LLDrawInfo(const LLDrawInfo& rhs)  	{ @@ -106,7 +116,7 @@ public:  	F32 mPartSize;  	F32 mVSize;  	LLSpatialGroup* mGroup; -	LLFace* mFace; //associated face +	LL_ALIGN_16(LLFace* mFace); //associated face  	F32 mDistance;  	U32 mDrawMode; @@ -181,7 +191,7 @@ public:  	};  }; -LL_ALIGN_PREFIX(64) +LL_ALIGN_PREFIX(16)  class LLSpatialGroup : public LLOctreeListener<LLDrawable>  {  	friend class LLSpatialPartition; @@ -193,6 +203,16 @@ public:  		*this = rhs;  	} +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)  	{  		llerrs << "Illegal operation!" << llendl; @@ -325,8 +345,15 @@ public:  	void dirtyGeom() { setState(GEOM_DIRTY); }  	void dirtyMesh() { setState(MESH_DIRTY); } + +	//octree wrappers to make code more readable  	element_list& getData() { return mOctreeNode->getData(); } +	element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } +	element_iter getDataEnd() { return mOctreeNode->getDataEnd(); } +	bool hasElement(LLDrawable* drawablep) { return std::find(mOctreeNode->getDataBegin(), mOctreeNode->getDataEnd(), drawablep) != mOctreeNode->getDataEnd(); } +  	U32 getElementCount() const { return mOctreeNode->getElementCount(); } +	bool isEmpty() const { return mOctreeNode->isEmpty(); }  	void drawObjectBox(LLColor4 col); @@ -370,12 +397,12 @@ public:  		V4_COUNT = 10  	} eV4Index; -	LLVector4a mBounds[2]; // bounding box (center, size) of this node and all its children (tight fit to objects) -	LLVector4a mExtents[2]; // extents (min, max) of this node and all its children -	LLVector4a mObjectExtents[2]; // extents (min, max) of objects in this node -	LLVector4a mObjectBounds[2]; // bounding box (center, size) of objects in this node -	LLVector4a mViewAngle; -	LLVector4a mLastUpdateViewAngle; +	LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) +	LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children +	LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node +	LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node +	LL_ALIGN_16(LLVector4a mViewAngle); +	LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);  	F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3() @@ -547,29 +574,34 @@ public:  	typedef std::vector<LLSpatialBridge*> bridge_list_t;  	typedef std::vector<LLDrawInfo*> drawinfo_list_t; +	typedef LLSpatialGroup** sg_iterator; +	typedef LLSpatialBridge** bridge_iterator; +	typedef LLDrawInfo** drawinfo_iterator; +	typedef LLDrawable** drawable_iterator; +  	void clear(); -	sg_list_t::iterator beginVisibleGroups(); -	sg_list_t::iterator endVisibleGroups(); +	sg_iterator beginVisibleGroups(); +	sg_iterator endVisibleGroups(); -	sg_list_t::iterator beginAlphaGroups(); -	sg_list_t::iterator endAlphaGroups(); +	sg_iterator beginAlphaGroups(); +	sg_iterator endAlphaGroups();  	bool hasOcclusionGroups() { return mOcclusionGroupsSize > 0; } -	sg_list_t::iterator beginOcclusionGroups(); -	sg_list_t::iterator endOcclusionGroups(); +	sg_iterator beginOcclusionGroups(); +	sg_iterator endOcclusionGroups(); -	sg_list_t::iterator beginDrawableGroups(); -	sg_list_t::iterator endDrawableGroups(); +	sg_iterator beginDrawableGroups(); +	sg_iterator endDrawableGroups(); -	drawable_list_t::iterator beginVisibleList(); -	drawable_list_t::iterator endVisibleList(); +	drawable_iterator beginVisibleList(); +	drawable_iterator endVisibleList(); -	bridge_list_t::iterator beginVisibleBridge(); -	bridge_list_t::iterator endVisibleBridge(); +	bridge_iterator beginVisibleBridge(); +	bridge_iterator endVisibleBridge(); -	drawinfo_list_t::iterator beginRenderMap(U32 type); -	drawinfo_list_t::iterator endRenderMap(U32 type); +	drawinfo_iterator beginRenderMap(U32 type); +	drawinfo_iterator endRenderMap(U32 type);  	void pushVisibleGroup(LLSpatialGroup* group);  	void pushAlphaGroup(LLSpatialGroup* group); @@ -589,28 +621,41 @@ public:  	void assertDrawMapsEmpty();  private: + +	template <class T, class V> void pushBack(T &head, U32& count, V* val); +  	U32					mVisibleGroupsSize;  	U32					mAlphaGroupsSize;  	U32					mOcclusionGroupsSize;  	U32					mDrawableGroupsSize;  	U32					mVisibleListSize;  	U32					mVisibleBridgeSize; + +	U32					mVisibleGroupsAllocated; +	U32					mAlphaGroupsAllocated; +	U32					mOcclusionGroupsAllocated; +	U32					mDrawableGroupsAllocated; +	U32					mVisibleListAllocated; +	U32					mVisibleBridgeAllocated; +  	U32					mRenderMapSize[LLRenderPass::NUM_RENDER_TYPES];  	sg_list_t			mVisibleGroups; -	sg_list_t::iterator mVisibleGroupsEnd; +	sg_iterator			mVisibleGroupsEnd;  	sg_list_t			mAlphaGroups; -	sg_list_t::iterator mAlphaGroupsEnd; +	sg_iterator			mAlphaGroupsEnd;  	sg_list_t			mOcclusionGroups; -	sg_list_t::iterator	mOcclusionGroupsEnd; +	sg_iterator			mOcclusionGroupsEnd;  	sg_list_t			mDrawableGroups; -	sg_list_t::iterator mDrawableGroupsEnd; +	sg_iterator			mDrawableGroupsEnd;  	drawable_list_t		mVisibleList; -	drawable_list_t::iterator mVisibleListEnd; +	drawable_iterator	mVisibleListEnd;  	bridge_list_t		mVisibleBridge; -	bridge_list_t::iterator mVisibleBridgeEnd; +	bridge_iterator		mVisibleBridgeEnd;  	drawinfo_list_t		mRenderMap[LLRenderPass::NUM_RENDER_TYPES]; -	drawinfo_list_t::iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES]; +	U32					mRenderMapAllocated[LLRenderPass::NUM_RENDER_TYPES]; +	drawinfo_iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES]; +  }; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 65393cc168..f64a72a616 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -56,6 +56,7 @@  #include "lldrawable.h"  extern LLPipeline gPipeline; +extern bool gShiftFrame;  LLColor4U MAX_WATER_COLOR(0, 48, 96, 240); @@ -294,7 +295,7 @@ void LLSurface::initTextures()  		mWaterObjp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, mRegionp);  		gPipeline.createObject(mWaterObjp);  		LLVector3d water_pos_global = from_region_handle(mRegionp->getHandle()); -		water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); +		water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT);		// region doesn't have a valid water height yet  		mWaterObjp->setPositionGlobal(water_pos_global);  	}  } @@ -621,6 +622,11 @@ void LLSurface::moveZ(const S32 x, const S32 y, const F32 delta)  void LLSurface::updatePatchVisibilities(LLAgent &agent)   { +	if (gShiftFrame) +	{ +		return; +	} +  	LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(gAgentCamera.getCameraPositionGlobal());  	LLSurfacePatch *patchp; diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 5077c2c7e1..a9ba2bce9c 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -43,6 +43,7 @@  #include "lldrawpool.h"  #include "noise.h" +extern bool gShiftFrame;  extern U64 gFrameTime;  extern LLPipeline gPipeline; @@ -218,7 +219,7 @@ void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3  	pos_agent.mV[VX] += x * mSurfacep->getMetersPerGrid();  	pos_agent.mV[VY] += y * mSurfacep->getMetersPerGrid();  	pos_agent.mV[VZ]  = *(mDataZ + point_offset); -	*vertex     = pos_agent; +	*vertex     = pos_agent-mVObjp->getRegion()->getOriginAgent();  	LLVector3 rel_pos = pos_agent - mSurfacep->getOriginAgent();  	LLVector3 tex_pos = rel_pos * (1.f/surface_stride); @@ -366,10 +367,13 @@ void LLSurfacePatch::updateCameraDistanceRegion(const LLVector3 &pos_region)  {  	if (LLPipeline::sDynamicLOD)  	{ -		LLVector3 dv = pos_region; -		dv -= mCenterRegion; -		mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/ -			llmax(LLVOSurfacePatch::sLODFactor, 0.1f); +		if (!gShiftFrame) +		{ +			LLVector3 dv = pos_region; +			dv -= mCenterRegion; +			mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/ +				llmax(LLVOSurfacePatch::sLODFactor, 0.1f); +		}  	}  	else  	{ diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 467115c928..ad09af6594 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -510,7 +510,13 @@ void LLTexLayerSetBuffer::doUpload()  			BOOL valid = FALSE;  			LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;  			S32 file_size = 0; -			U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size); +			 +			//data buffer MUST be allocated using LLImageBase +			LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE); +			file_size = file.getSize(); +			U8* data = integrity_test->allocateData(file_size); +			file.read(data, file_size); +			  			if (data)  			{  				valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data' diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h index 74c22b0cdf..fffe20208f 100644 --- a/indra/newview/lltexlayerparams.h +++ b/indra/newview/lltexlayerparams.h @@ -67,6 +67,16 @@ public:  	/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	// LLVisualParam Virtual functions  	///*virtual*/ BOOL		parseData(LLXmlTreeNode* node);  	/*virtual*/ void		apply( ESex avatar_sex ) {} @@ -76,11 +86,11 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion()									{ return 1.f; } -	/*virtual*/ const LLVector3&	getAvgDistortion()										{ return mAvgDistortionVec; } +	/*virtual*/ const LLVector4a&	getAvgDistortion()										{ return mAvgDistortionVec; }  	/*virtual*/ F32					getMaxDistortion()										{ return 3.f; } -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector3(1.f, 1.f, 1.f);} -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;}; +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector4a(1.f, 1.f, 1.f);} +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;};  	// New functions  	BOOL					render( S32 x, S32 y, S32 width, S32 height ); @@ -94,7 +104,7 @@ private:  	LLPointer<LLImageRaw>	mStaticImageRaw;  	BOOL					mNeedsCreateTexture;  	BOOL					mStaticImageInvalid; -	LLVector3				mAvgDistortionVec; +	LLVector4a				mAvgDistortionVec;  	F32						mCachedEffectiveWeight;  public: @@ -143,6 +153,16 @@ public:  	LLTexLayerParamColor( LLVOAvatar* avatar );  	/* virtual */ ~LLTexLayerParamColor(); +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;  	// LLVisualParam Virtual functions @@ -155,18 +175,18 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion()									{ return 1.f; } -	/*virtual*/ const LLVector3&	getAvgDistortion()										{ return mAvgDistortionVec; } +	/*virtual*/ const LLVector4a&	getAvgDistortion()										{ return mAvgDistortionVec; }  	/*virtual*/ F32					getMaxDistortion()										{ return 3.f; } -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector3(1.f, 1.f, 1.f); } -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;}; +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector4a(1.f, 1.f, 1.f); } +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;};  	// New functions  	LLColor4				getNetColor() const;  protected:  	virtual void onGlobalColorChanged(bool upload_bake) {}  private: -	LLVector3				mAvgDistortionVec; +	LLVector4a				mAvgDistortionVec;  };  class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index d0e6666885..e665403110 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2945,7 +2945,9 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)          ~lcl_responder()              { +				LL_CHECK_MEMORY                  mFetcher->decrCurlPOSTCount(); +				LL_CHECK_MEMORY              }  		// virtual diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index c58e1adb8c..db5ad9479c 100755 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -263,8 +263,8 @@ public :  		EService mService;  	}; -	typedef boost::intrusive_ptr<TranslationReceiver> TranslationReceiverPtr; -	typedef boost::intrusive_ptr<KeyVerificationReceiver> KeyVerificationReceiverPtr; +	typedef LLPointer<TranslationReceiver> TranslationReceiverPtr; +	typedef LLPointer<KeyVerificationReceiver> KeyVerificationReceiverPtr;  	/**  	 * Translate given text. diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 184033de42..b857c7fe89 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -51,9 +51,19 @@ const BOOL NOT_FOR_SELECTION = FALSE;  extern template class LLViewerCamera* LLSingleton<class LLViewerCamera>::getInstance();  #endif +LL_ALIGN_PREFIX(16)  class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera>  {  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	}  	typedef enum  	{ @@ -137,6 +147,7 @@ protected:  	S16					mZoomSubregion;  public: -}; +} LL_ALIGN_POSTFIX(16); +  #endif // LL_LLVIEWERCAMERA_H diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 9ef012ece1..d58ee05fb6 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -79,6 +79,7 @@  #include "llpostprocess.h"  extern LLPointer<LLViewerTexture> gStartTexture; +extern bool gShiftFrame;  LLPointer<LLViewerTexture> gDisconnectedImagep = NULL; @@ -162,8 +163,11 @@ void display_startup()  	glClear(GL_DEPTH_BUFFER_BIT);  } +static LLFastTimer::DeclareTimer FTM_UPDATE_CAMERA("Update Camera"); +  void display_update_camera()  { +	LLFastTimer t(FTM_UPDATE_CAMERA);  	LLMemType mt_uc(LLMemType::MTYPE_DISPLAY_UPDATE_CAMERA);  	// TODO: cut draw distance down if customizing avatar?  	// TODO: cut draw distance on per-parcel basis? @@ -217,6 +221,11 @@ static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_CLASS("Class");  static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_BUMP("Bump");  static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_LIST("List");  static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_DELETE("Delete"); +static LLFastTimer::DeclareTimer FTM_RESIZE_WINDOW("Resize Window"); +static LLFastTimer::DeclareTimer FTM_HUD_UPDATE("HUD Update"); +static LLFastTimer::DeclareTimer FTM_DISPLAY_UPDATE_GEOM("Update Geom"); +static LLFastTimer::DeclareTimer FTM_TEXTURE_UNBIND("Texture Unbind"); +static LLFastTimer::DeclareTimer FTM_TELEPORT_DISPLAY("Teleport Display");  // Paint the display!  void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) @@ -226,6 +235,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  	if (gWindowResized)  	{ //skip render on frames where window has been resized +		LLFastTimer t(FTM_RESIZE_WINDOW);  		gGL.flush();  		glClear(GL_COLOR_BUFFER_BIT);  		gViewerWindow->getWindow()->swapBuffers(); @@ -362,6 +372,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  	if (gTeleportDisplay)  	{ +		LLFastTimer t(FTM_TELEPORT_DISPLAY);  		LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport");  		const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. @@ -591,6 +602,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		// *TODO: merge these two methods  		{ +			LLFastTimer t(FTM_HUD_UPDATE);  			LLMemType mt_uh(LLMemType::MTYPE_DISPLAY_UPDATE_HUD);  			LLHUDManager::getInstance()->updateEffects();  			LLHUDObject::updateAll(); @@ -598,6 +610,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		}  		{ +			LLFastTimer t(FTM_DISPLAY_UPDATE_GEOM);  			LLMemType mt_ug(LLMemType::MTYPE_DISPLAY_UPDATE_GEOM);  			const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time  			gPipeline.createObjects(max_geom_update_time); @@ -607,6 +620,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		}  		gPipeline.updateGL(); +		  		stop_glerror();  		S32 water_clip = 0; @@ -938,14 +952,18 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  			stop_glerror();  		} -		for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) -		{ //dummy cleanup of any currently bound textures -			if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) -			{ -				gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); -				gGL.getTexUnit(i)->disable(); +		{ +			LLFastTimer t(FTM_TEXTURE_UNBIND); +			for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) +			{ //dummy cleanup of any currently bound textures +				if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) +				{ +					gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); +					gGL.getTexUnit(i)->disable(); +				}  			}  		} +  		LLAppViewer::instance()->pingMainloopTimeout("Display:RenderFlush");		  		if (to_texture) @@ -1011,6 +1029,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  	display_stats();  	LLAppViewer::instance()->pingMainloopTimeout("Display:Done"); + +	gShiftFrame = false;  }  void render_hud_attachments() diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index f029ae5302..5d1aa870a3 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -729,8 +729,10 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w  				F32* vw = (F32*) vertex_weightsp.get();  				F32* cw = (F32*) clothing_weightsp.get();	 -				LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), num_verts*2*sizeof(F32)); -				LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), num_verts*sizeof(F32));	 +				S32 tc_size = (num_verts*2*sizeof(F32)+0xF) & ~0xF; +				LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), tc_size); +				S32 vw_size = (num_verts*sizeof(F32)+0xF) & ~0xF;	 +				LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), vw_size);	  				LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32));	  			} diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7d7d1f3047..b048332e59 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -134,6 +134,7 @@ static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT	= 5;     // requests  static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL	= 10.0f; // seconds  extern BOOL gDebugClicks; +extern bool gShiftFrame;  // function prototypes  bool check_offer_throttle(const std::string& from_name, bool check_only); @@ -3339,9 +3340,9 @@ public :  	{  	} -	static boost::intrusive_ptr<ChatTranslationReceiver> build(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, const LLChat &chat, const LLSD &toast_args) +	static ChatTranslationReceiver* build(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, const LLChat &chat, const LLSD &toast_args)  	{ -		return boost::intrusive_ptr<ChatTranslationReceiver>(new ChatTranslationReceiver(from_lang, to_lang, mesg, chat, toast_args)); +		return new ChatTranslationReceiver(from_lang, to_lang, mesg, chat, toast_args);  	}  protected: @@ -3930,6 +3931,7 @@ void process_avatar_init_complete(LLMessageSystem* msg, void**)  void process_agent_movement_complete(LLMessageSystem* msg, void**)  { +	gShiftFrame = true;  	gAgentMovementCompleted = true;  	LLUUID agent_id; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 97783d843e..1447f133e6 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -199,6 +199,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe  	mID(id),  	mLocalID(0),  	mTotalCRC(0), +	mListIndex(-1),  	mTEImages(NULL),  	mGLName(0),  	mbCanSelect(TRUE), @@ -2190,8 +2191,8 @@ BOOL LLViewerObject::isActive() const  BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  { -	static LLFastTimer::DeclareTimer ftm("Viewer Object"); -	LLFastTimer t(ftm); +	//static LLFastTimer::DeclareTimer ftm("Viewer Object"); +	//LLFastTimer t(ftm);  	if (mDead)  	{ @@ -4811,9 +4812,11 @@ void LLViewerObject::deleteParticleSource()  // virtual  void LLViewerObject::updateDrawable(BOOL force_damped)  { -	if (mDrawable.notNull() &&  -		!mDrawable->isState(LLDrawable::ON_MOVE_LIST) && -		isChanged(MOVED)) +	if (!isChanged(MOVED)) +	{ //most common case, having an empty if case here makes for better branch prediction +	} +	else if (mDrawable.notNull() &&  +		!mDrawable->isState(LLDrawable::ON_MOVE_LIST))  	{  		BOOL damped_motion =   			!isChanged(SHIFTED) &&										// not shifted between regions this frame and... diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index fbf6361ffb..6f5f7aae42 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -232,6 +232,8 @@ public:  	const LLUUID &getID() const						{ return mID; }  	U32 getLocalID() const							{ return mLocalID; }  	U32 getCRC() const								{ return mTotalCRC; } +	S32 getListIndex() const						{ return mListIndex; } +	void setListIndex(S32 idx)						{ mListIndex = idx; }  	virtual BOOL isFlexible() const					{ return FALSE; }  	virtual BOOL isSculpted() const 				{ return FALSE; } @@ -606,6 +608,9 @@ public:  	// Last total CRC received from sim, used for caching  	U32				mTotalCRC; +	// index into LLViewerObjectList::mActiveObjects or -1 if not in list +	S32				mListIndex; +  	LLPointer<LLViewerTexture> *mTEImages;  	// Selection, picking and rendering variables diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 28298cedf9..b433484783 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -914,21 +914,30 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  	LLViewerObject *objectp = NULL;	  	// Make a copy of the list in case something in idleUpdate() messes with it -	std::vector<LLViewerObject*> idle_list; -	 +	static std::vector<LLViewerObject*> idle_list; + +	U32 idle_count = 0; +		  	static LLFastTimer::DeclareTimer idle_copy("Idle Copy");  	{  		LLFastTimer t(idle_copy); -		idle_list.reserve( mActiveObjects.size() ); - - 		for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); +		 + 		for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();  			active_iter != mActiveObjects.end(); active_iter++)  		{  			objectp = *active_iter;  			if (objectp)  			{ -				idle_list.push_back( objectp ); +				if (idle_count >= idle_list.size()) +				{ +					idle_list.push_back( objectp ); +				} +				else +				{ +					idle_list[idle_count] = objectp; +				} +				++idle_count;  			}  			else  			{	// There shouldn't be any NULL pointers in the list, but they have caused @@ -938,10 +947,13 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  		}  	} +	std::vector<LLViewerObject*>::iterator idle_end = idle_list.begin()+idle_count; +  	if (gSavedSettings.getBOOL("FreezeTime"))  	{ +		  		for (std::vector<LLViewerObject*>::iterator iter = idle_list.begin(); -			iter != idle_list.end(); iter++) +			iter != idle_end; iter++)  		{  			objectp = *iter;  			if (objectp->isAvatar()) @@ -953,17 +965,17 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  	else  	{  		for (std::vector<LLViewerObject*>::iterator idle_iter = idle_list.begin(); -			idle_iter != idle_list.end(); idle_iter++) +			idle_iter != idle_end; idle_iter++)  		{  			objectp = *idle_iter; -			if (!objectp->idleUpdate(agent, world, frame_time)) +			if (objectp->idleUpdate(agent, world, frame_time))  			{ -				//  If Idle Update returns false, kill object! -				kill_list.push_back(objectp); +				num_active_objects++;				  			}  			else  			{ -				num_active_objects++; +				//  If Idle Update returns false, kill object! +				kill_list.push_back(objectp);  			}  		}  		for (std::vector<LLViewerObject*>::iterator kill_iter = kill_list.begin(); @@ -1201,7 +1213,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)  	{  		//llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << llendl;  		objectp->setOnActiveList(FALSE); -		mActiveObjects.erase(objectp); +		removeFromActiveList(objectp);  	}  	if (objectp->isOnMap()) @@ -1378,6 +1390,27 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)  	mNumDeadObjects = 0;  } +void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) +{ +	S32 idx = objectp->getListIndex(); +	if (idx != -1) +	{ //remove by moving last element to this object's position +		llassert(mActiveObjects[idx] == objectp); +		 +		objectp->setListIndex(-1); + +		S32 last_index = mActiveObjects.size()-1; + +		if (idx != last_index) +		{ +			mActiveObjects[idx] = mActiveObjects[last_index]; +			mActiveObjects[idx]->setListIndex(idx); +		} + +		mActiveObjects.pop_back(); +	} +} +  void LLViewerObjectList::updateActive(LLViewerObject *objectp)  {  	LLMemType mt(LLMemType::MTYPE_OBJECT); @@ -1392,16 +1425,38 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp)  		if (active)  		{  			//llinfos << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << llendl; -			mActiveObjects.insert(objectp); -			objectp->setOnActiveList(TRUE); +			S32 idx = objectp->getListIndex(); +			if (idx <= -1) +			{ +				mActiveObjects.push_back(objectp); +				objectp->setListIndex(mActiveObjects.size()-1); +				objectp->setOnActiveList(TRUE); +			} +			else +			{ +				llassert(idx < mActiveObjects.size()); +				llassert(mActiveObjects[idx] == objectp); + +				if (idx >= mActiveObjects.size() || +					mActiveObjects[idx] != objectp) +				{ +					llwarns << "Invalid object list index detected!" << llendl; +				} +			}  		}  		else  		{  			//llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << llendl; -			mActiveObjects.erase(objectp); +			removeFromActiveList(objectp);  			objectp->setOnActiveList(FALSE);  		}  	} + +	//post condition: if object is active, it must be on the active list +	llassert(!active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) != mActiveObjects.end()); + +	//post condition: if object is not active, it must not be on the active list +	llassert(active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) == mActiveObjects.end());  }  void LLViewerObjectList::updateObjectCost(LLViewerObject* object) @@ -1472,6 +1527,10 @@ void LLViewerObjectList::onPhysicsFlagsFetchFailure(const LLUUID& object_id)  	mPendingPhysicsFlags.erase(object_id);  } +static LLFastTimer::DeclareTimer FTM_SHIFT_OBJECTS("Shift Objects"); +static LLFastTimer::DeclareTimer FTM_PIPELINE_SHIFT("Pipeline Shift"); +static LLFastTimer::DeclareTimer FTM_REGION_SHIFT("Region Shift"); +  void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  {  	// This is called when we shift our origin when we cross region boundaries... @@ -1483,6 +1542,8 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  		return;  	} +	LLFastTimer t(FTM_SHIFT_OBJECTS); +  	LLViewerObject *objectp;  	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)  	{ @@ -1499,8 +1560,15 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  		}  	} -	gPipeline.shiftObjects(offset); -	LLWorld::getInstance()->shiftRegions(offset); +	{ +		LLFastTimer t(FTM_PIPELINE_SHIFT); +		gPipeline.shiftObjects(offset); +	} + +	{ +		LLFastTimer t(FTM_REGION_SHIFT); +		LLWorld::getInstance()->shiftRegions(offset); +	}  }  void LLViewerObjectList::repartitionObjects() diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 64925f46ae..449a4633ff 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -118,7 +118,9 @@ public:  	void dirtyAllObjectInventory(); +	void removeFromActiveList(LLViewerObject* objectp);  	void updateActive(LLViewerObject *objectp); +	  	void updateAvatarVisibility();  	// Selection related stuff @@ -127,6 +129,7 @@ public:  	LLViewerObject *getSelectedObject(const U32 object_id);  	inline S32 getNumObjects() { return (S32) mObjects.size(); } +	inline S32 getNumActiveObjects() { return (S32) mActiveObjects.size(); }  	void addToMap(LLViewerObject *objectp);  	void removeFromMap(LLViewerObject *objectp); @@ -197,7 +200,7 @@ protected:  	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;  	vobj_list_t mObjects; -	std::set<LLPointer<LLViewerObject> > mActiveObjects; +	std::vector<LLPointer<LLViewerObject> > mActiveObjects;  	vobj_list_t mMapObjects; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 493195aaa3..47a99d7ea4 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -255,10 +255,9 @@ public:  		}  	} -    static boost::intrusive_ptr<BaseCapabilitiesComplete> build( U64 region_handle, S32 id ) +    static BaseCapabilitiesComplete* build( U64 region_handle, S32 id )      { -		return boost::intrusive_ptr<BaseCapabilitiesComplete>(  -				new BaseCapabilitiesComplete(region_handle, id) ); +		return new BaseCapabilitiesComplete(region_handle, id);      }  private: @@ -1487,7 +1486,8 @@ void LLViewerRegion::unpackRegionHandshake()  		// all of our terrain stuff, by  		if (compp->getParamsReady())  		{ -			getLand().dirtyAllPatches(); +			//this line creates frame stalls on region crossing and removing it appears to have no effect +			//getLand().dirtyAllPatches();  		}  		else  		{ diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h index dd7751acd7..3bc95cbfbf 100644 --- a/indra/newview/llviewervisualparam.h +++ b/indra/newview/llviewervisualparam.h @@ -83,11 +83,11 @@ public:  	// New Virtual functions  	virtual F32					getTotalDistortion() = 0; -	virtual const LLVector3&	getAvgDistortion() = 0; +	virtual const LLVector4a&	getAvgDistortion() = 0;  	virtual F32					getMaxDistortion() = 0; -	virtual LLVector3			getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; -	virtual const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; -	virtual const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; +	virtual LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; +	virtual const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; +	virtual const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;  	// interface methods  	F32					getDisplayOrder() const		{ return getInfo()->mEditGroupDisplayOrder; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 30bb787fa7..98ea923272 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -563,6 +563,9 @@ public:  			addText(xpos, ypos, llformat("%d Render Calls", gPipeline.mBatchCount));              ypos += y_inc; +			addText(xpos, ypos, llformat("%d/%d Objects Active", gObjectList.getNumActiveObjects(), gObjectList.getNumObjects())); +			ypos += y_inc; +  			addText(xpos, ypos, llformat("%d Matrix Ops", gPipeline.mMatrixOpCount));  			ypos += y_inc; @@ -4768,8 +4771,11 @@ void LLViewerWindow::requestResolutionUpdate()  	mResDirty = true;  } +static LLFastTimer::DeclareTimer FTM_WINDOW_CHECK_SETTINGS("Window Settings"); +  void LLViewerWindow::checkSettings()  { +	LLFastTimer t(FTM_WINDOW_CHECK_SETTINGS);  	if (mStatesDirty)  	{  		gGL.refreshState(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 33dc12c473..05febdf93b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -817,6 +817,7 @@ LLVOAvatar::~LLVOAvatar()  	lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;  	mRoot.removeAllChildren(); +	mJointMap.clear();  	deleteAndClearArray(mSkeleton);  	deleteAndClearArray(mCollisionVolumes); @@ -1459,8 +1460,6 @@ void LLVOAvatar::onShift(const LLVector4a& shift_vector)  	const LLVector3& shift = reinterpret_cast<const LLVector3&>(shift_vector);  	mLastAnimExtents[0] += shift;  	mLastAnimExtents[1] += shift; -	mNeedsImpostorUpdate = TRUE; -	mNeedsAnimUpdate = TRUE;  }  void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) @@ -1934,6 +1933,7 @@ void LLVOAvatar::buildCharacter()  	// remove all of mRoot's children  	//-------------------------------------------------------------------------  	mRoot.removeAllChildren(); +	mJointMap.clear();  	mIsBuilt = FALSE;  	//------------------------------------------------------------------------- @@ -2390,7 +2390,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)  	}  } -static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Update Avatar"); +static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update");  static LLFastTimer::DeclareTimer FTM_JOINT_UPDATE("Update Joints");  //------------------------------------------------------------------------ @@ -2692,7 +2692,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)  	if (isImpostor() && !mNeedsImpostorUpdate)  	{ -		LLVector4a ext[2]; +		LL_ALIGN_16(LLVector4a ext[2]);  		F32 distance;  		LLVector3 angle; @@ -5137,7 +5137,20 @@ const LLUUID& LLVOAvatar::getID() const  // RN: avatar joints are multi-rooted to include screen-based attachments  LLJoint *LLVOAvatar::getJoint( const std::string &name )  { -	LLJoint* jointp = mRoot.findJoint(name); +	joint_map_t::iterator iter = mJointMap.find(name); + +	LLJoint* jointp = NULL; + +	if (iter == mJointMap.end() || iter->second == NULL) +	{ //search for joint and cache found joint in lookup table +		jointp = mRoot.findJoint(name); +		mJointMap[name] = jointp; +	} +	else +	{ //return cached pointer +		jointp = iter->second; +	} +  	return jointp;  } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 6fb56a4c0b..f5692bb52f 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -93,6 +93,16 @@ protected:   **/  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);  	virtual void		markDead();  	static void			initClass(); // Initialize data that's only init'd once per class. @@ -215,7 +225,7 @@ public:  	bool isBuilt() const { return mIsBuilt; }  private: //aligned members -	LLVector4a	mImpostorExtents[2]; +	LL_ALIGN_16(LLVector4a	mImpostorExtents[2]);  private:  	BOOL			mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients @@ -356,6 +366,10 @@ public:  	LLVector3			mHeadOffset; // current head position  	LLViewerJoint		mRoot; + +	typedef std::map<std::string, LLJoint*> joint_map_t; +	joint_map_t			mJointMap; +  protected:  	static BOOL			parseSkeletonFile(const std::string& filename);  	void				buildCharacter(); diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 543891ca63..2b273e616c 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -49,6 +49,16 @@ class LLVOAvatarSelf :   **/  public: +	void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	} +  	LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);  	virtual 				~LLVOAvatarSelf();  	virtual void			markDead(); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 44968342bf..5ad9ccc9af 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -622,7 +622,7 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count  	mFaceList.clear();  	LLViewerCamera* camera = LLViewerCamera::getInstance(); -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawablep = *i; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index e21358b65a..9cce68fff6 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -52,8 +52,7 @@ LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;  S32 LLVOPartGroup::sVBSlotFree[];  S32* LLVOPartGroup::sVBSlotCursor = NULL; -//static -void LLVOPartGroup::restoreGL() +void LLVOPartGroup::initClass()  {  	for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)  	{ @@ -61,7 +60,11 @@ void LLVOPartGroup::restoreGL()  	}  	sVBSlotCursor = sVBSlotFree; +} +//static +void LLVOPartGroup::restoreGL() +{  	sVB = new LLVertexBuffer(VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);  	U32 count = LL_MAX_PARTICLE_COUNT;  	sVB->allocateBuffer(count*4, count*6, true); @@ -554,7 +557,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co  	mFaceList.clear();  	LLViewerCamera* camera = LLViewerCamera::getInstance(); -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawablep = *i; @@ -626,7 +629,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)  		LLFace* facep = *i;  		LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject(); -		if (facep->getIndicesStart() == 0xFFFFFFFF) +		if (!facep->isState(LLFace::PARTICLE))  		{ //set the indices of this face  			S32 idx = LLVOPartGroup::findAvailableVBSlot();  			if (idx >= 0) @@ -635,6 +638,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)  				facep->setIndicesIndex(idx*6);  				facep->setVertexBuffer(LLVOPartGroup::sVB);  				facep->setPoolType(LLDrawPool::POOL_ALPHA); +				facep->setState(LLFace::PARTICLE);  			}  			else  			{ diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h index 6160bceb24..43b2844f07 100644 --- a/indra/newview/llvopartgroup.h +++ b/indra/newview/llvopartgroup.h @@ -45,6 +45,7 @@ public:  	static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT];  	static S32* sVBSlotCursor; +	static void initClass();  	static void restoreGL();  	static void destroyGL();  	static S32 findAvailableVBSlot(); diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 3556bde9a8..337ddfb24d 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -374,7 +374,7 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  		// *TODO: I don't know what's so special about trees  		// that they don't get REBUILD_POSITION automatically  		// at a higher level. -		const LLVector3 &this_position = getPositionAgent(); +		const LLVector3 &this_position = getPositionRegion();  		if (this_position != mLastPosition)  		{  			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION); @@ -843,10 +843,10 @@ void LLVOTree::updateMesh()  	LLMatrix4 matrix;  	// Translate to tree base  HACK - adjustment in Z plants tree underground -	const LLVector3 &pos_agent = getPositionAgent(); +	const LLVector3 &pos_region = getPositionRegion();  	//gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);  	LLMatrix4 trans_mat; -	trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); +	trans_mat.setTranslation(pos_region.mV[VX], pos_region.mV[VY], pos_region.mV[VZ] - 0.1f);  	trans_mat *= matrix;  	// Rotate to tree position and bend for current trunk/wind diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0abe73d55e..0a5c8b5139 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -639,8 +639,8 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  {  	LLViewerObject::idleUpdate(agent, world, time); -	static LLFastTimer::DeclareTimer ftm("Volume Idle"); -	LLFastTimer t(ftm); +	//static LLFastTimer::DeclareTimer ftm("Volume Idle"); +	//LLFastTimer t(ftm);  	if (mDead || mDrawable.isNull())  	{ @@ -4251,7 +4251,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  		LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST);  		//get all the faces into a list -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter; @@ -4657,7 +4657,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  	if (!LLPipeline::sDelayVBUpdate)  	{  		//drawables have been rebuilt, clear rebuild status -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter;  			drawablep->clearState(LLDrawable::REBUILD_ALL); @@ -4697,7 +4697,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  		std::set<LLVertexBuffer*> mapped_buffers; -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter; @@ -4721,8 +4721,14 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  						if (buff)  						{  							llassert(!face->isState(LLFace::RIGGED)); -							face->getGeometryVolume(*volume, face->getTEOffset(),  -								vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex()); + +							if (!face->getGeometryVolume(*volume, face->getTEOffset(),  +								vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex())) +							{ //something's gone wrong with the vertex buffer accounting, rebuild this group  +								group->dirtyGeom(); +								gPipeline.markRebuild(group, TRUE); +							} +  							if (buff->isLocked())  							{ @@ -4759,7 +4765,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  		if(num_mapped_veretx_buffer != LLVertexBuffer::sMappedCount)   		{  			llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ;  -			for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +			for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  			{  				LLDrawable* drawablep = *drawable_iter;  				for (S32 i = 0; i < drawablep->getNumFaces(); ++i) @@ -5056,8 +5062,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::  					llassert(!facep->isState(LLFace::RIGGED)); -					facep->getGeometryVolume(*volume, te_idx,  -						vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true); +					if (!facep->getGeometryVolume(*volume, te_idx,  +						vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true)) +					{ +						llwarns << "Failed to get geometry for face!" << llendl; +					}  					if (drawablep->isState(LLDrawable::ANIMATED_CHILD))  					{ @@ -5227,7 +5236,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun  	//for each drawable -	for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +	for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  	{  		LLDrawable* drawablep = *drawable_iter; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 25fe085421..798927a45f 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -68,7 +68,7 @@ class LLVolumeInterface  public:  	virtual ~LLVolumeInterface() { }  	virtual LLVolumeInterfaceType getInterfaceType() const = 0; -	virtual BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0; +	virtual void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0;  	virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0;  	virtual LLVector3 getPivotPosition() const = 0;  	virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index b061c90d98..78ee3e4fd9 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -657,7 +657,10 @@ void LLWorld::updateRegions(F32 max_update_time)  		if (did_one && max_time <= 0.f)  			break;  		max_time = llmin(max_time, max_update_time*.1f); -		did_one |= regionp->idleUpdate(max_update_time); +		if (regionp->idleUpdate(max_update_time)) +		{ +			did_one = TRUE; +		}  	}  } @@ -837,6 +840,9 @@ void LLWorld::updateWaterObjects()  	}  	mHoleWaterObjects.clear(); +	// Use the water height of the region we're on for areas where there is no region +	F32 water_height = gAgent.getRegion()->getWaterHeight(); +  	// Now, get a list of the holes  	S32 x, y;  	for (x = min_x; x <= max_x; x += rwidth) @@ -845,12 +851,12 @@ void LLWorld::updateWaterObjects()  		{  			U64 region_handle = to_region_handle(x, y);  			if (!getRegionFromHandle(region_handle)) -			{ +			{	// No region at that area, so make water  				LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion());  				waterp->setUseTexture(FALSE);  				waterp->setPositionGlobal(LLVector3d(x + rwidth/2,  													 y + rwidth/2, -													 256.f+DEFAULT_WATER_HEIGHT)); +													 256.f + water_height));  				waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));  				gPipeline.createObject(waterp);  				mHoleWaterObjects.push_back(waterp); @@ -907,7 +913,7 @@ void LLWorld::updateWaterObjects()  		}  		waterp->setRegion(gAgent.getRegion()); -		LLVector3d water_pos(water_center_x, water_center_y, 256.f+DEFAULT_WATER_HEIGHT) ; +		LLVector3d water_pos(water_center_x, water_center_y, 256.f + water_height) ;  		LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);  		//stretch out to horizon diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f01626c0fc..b42a84da47 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -120,6 +120,8 @@  //#define DEBUG_INDICES  #endif +bool gShiftFrame = false; +  //cached settings  BOOL LLPipeline::RenderAvatarVP;  BOOL LLPipeline::VertexShaderEnable; @@ -217,7 +219,7 @@ BOOL	gDebugPipeline = FALSE;  LLPipeline gPipeline;  const LLMatrix4* gGLLastMatrix = NULL; -LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Geometry"); +LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Render Geometry");  LLFastTimer::DeclareTimer FTM_RENDER_GRASS("Grass");  LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE("Invisible");  LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION("Occlusion"); @@ -234,8 +236,13 @@ LLFastTimer::DeclareTimer FTM_RENDER_BUMP("Bump");  LLFastTimer::DeclareTimer FTM_RENDER_FULLBRIGHT("Fullbright");  LLFastTimer::DeclareTimer FTM_RENDER_GLOW("Glow");  LLFastTimer::DeclareTimer FTM_GEO_UPDATE("Geo Update"); +LLFastTimer::DeclareTimer FTM_PIPELINE_CREATE("Pipeline Create");  LLFastTimer::DeclareTimer FTM_POOLRENDER("RenderPool");  LLFastTimer::DeclareTimer FTM_POOLS("Pools"); +LLFastTimer::DeclareTimer FTM_DEFERRED_POOLRENDER("RenderPool (Deferred)"); +LLFastTimer::DeclareTimer FTM_DEFERRED_POOLS("Pools (Deferred)"); +LLFastTimer::DeclareTimer FTM_POST_DEFERRED_POOLRENDER("RenderPool (Post)"); +LLFastTimer::DeclareTimer FTM_POST_DEFERRED_POOLS("Pools (Post)");  LLFastTimer::DeclareTimer FTM_RENDER_BLOOM_FBO("First FBO");  LLFastTimer::DeclareTimer FTM_STATESORT("Sort Draw State");  LLFastTimer::DeclareTimer FTM_PIPELINE("Pipeline"); @@ -688,6 +695,8 @@ void LLPipeline::cleanup()  	mInitialized = FALSE;  	mDeferredVB = NULL; + +	mCubeVB = NULL;  }  //============================================================================ @@ -1371,7 +1380,7 @@ public:  	{  		LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); -		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->getData().empty()) +		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())  		{  			for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)  			{ @@ -1680,7 +1689,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)  void LLPipeline::createObjects(F32 max_dtime)  { -	LLFastTimer ftm(FTM_GEO_UPDATE); +	LLFastTimer ftm(FTM_PIPELINE_CREATE);  	LLMemType mt(LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS);  	LLTimer update_timer; @@ -1976,7 +1985,7 @@ void LLPipeline::clearReferences()  void check_references(LLSpatialGroup* group, LLDrawable* drawable)  { -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		if (drawable == *i)  		{ @@ -1998,7 +2007,7 @@ void check_references(LLDrawable* drawable, LLFace* face)  void check_references(LLSpatialGroup* group, LLFace* face)  { -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		check_references(drawable, face); @@ -2010,25 +2019,25 @@ void LLPipeline::checkReferences(LLFace* face)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, face);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, face);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, face);  		} -		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) +		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)  		{  			LLDrawable* drawable = *iter;  			check_references(drawable, face);	 @@ -2042,25 +2051,25 @@ void LLPipeline::checkReferences(LLDrawable* drawable)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, drawable);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, drawable);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, drawable);  		} -		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) +		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)  		{  			if (drawable == *iter)  			{ @@ -2093,19 +2102,19 @@ void LLPipeline::checkReferences(LLDrawInfo* draw_info)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, draw_info);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, draw_info);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, draw_info); @@ -2119,7 +2128,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			if (group == *iter)  			{ @@ -2127,7 +2136,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)  			}  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			if (group == *iter)  			{ @@ -2135,7 +2144,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)  			}  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			if (group == *iter)  			{ @@ -2374,7 +2383,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl  void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)  { -	if (group->getData().empty()) +	if (group->isEmpty())  	{   		return;  	} @@ -2477,7 +2486,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)  		}  		mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			group->doOcclusion(&camera); @@ -2513,14 +2522,19 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority)  static LLFastTimer::DeclareTimer FTM_SEED_VBO_POOLS("Seed VBO Pool"); +static LLFastTimer::DeclareTimer FTM_UPDATE_GL("Update GL"); +  void LLPipeline::updateGL()  { -	while (!LLGLUpdate::sGLQ.empty())  	{ -		LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); -		glu->updateGL(); -		glu->mInQ = FALSE; -		LLGLUpdate::sGLQ.pop_front(); +		LLFastTimer t(FTM_UPDATE_GL); +		while (!LLGLUpdate::sGLQ.empty()) +		{ +			LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); +			glu->updateGL(); +			glu->mInQ = FALSE; +			LLGLUpdate::sGLQ.pop_front(); +		}  	}  	{ //seed VBO Pools @@ -2529,11 +2543,13 @@ void LLPipeline::updateGL()  	}  } +static LLFastTimer::DeclareTimer FTM_REBUILD_PRIORITY_GROUPS("Rebuild Priority Groups"); +  void LLPipeline::rebuildPriorityGroups()  { +	LLFastTimer t(FTM_REBUILD_PRIORITY_GROUPS);  	LLTimer update_timer;  	LLMemType mt(LLMemType::MTYPE_PIPELINE); -	  	assertInitialized();  	gMeshRepo.notifyLoadedMeshes(); @@ -2552,7 +2568,9 @@ void LLPipeline::rebuildPriorityGroups()  	mGroupQ1Locked = false;  } -		 + +static LLFastTimer::DeclareTimer FTM_REBUILD_GROUPS("Rebuild Groups"); +  void LLPipeline::rebuildGroups()  {  	if (mGroupQ2.empty()) @@ -2560,6 +2578,7 @@ void LLPipeline::rebuildGroups()  		return;  	} +	LLFastTimer t(FTM_REBUILD_GROUPS);  	mGroupQ2Locked = true;  	// Iterate through some drawables on the non-priority build queue  	S32 size = (S32) mGroupQ2.size(); @@ -2803,6 +2822,10 @@ void LLPipeline::markShift(LLDrawable *drawablep)  	}  } +static LLFastTimer::DeclareTimer FTM_SHIFT_DRAWABLE("Shift Drawable"); +static LLFastTimer::DeclareTimer FTM_SHIFT_OCTREE("Shift Octree"); +static LLFastTimer::DeclareTimer FTM_SHIFT_HUD("Shift HUD"); +  void LLPipeline::shiftObjects(const LLVector3 &offset)  {  	LLMemType mt(LLMemType::MTYPE_PIPELINE_SHIFT_OBJECTS); @@ -2815,35 +2838,46 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)  	LLVector4a offseta;  	offseta.load3(offset.mV); -	for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin(); -		 iter != mShiftList.end(); iter++)  	{ -		LLDrawable *drawablep = *iter; -		if (drawablep->isDead()) +		LLFastTimer t(FTM_SHIFT_DRAWABLE); + +		for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin(); +			 iter != mShiftList.end(); iter++)  		{ -			continue; -		}	 -		drawablep->shiftPos(offseta);	 -		drawablep->clearState(LLDrawable::ON_SHIFT_LIST); +			LLDrawable *drawablep = *iter; +			if (drawablep->isDead()) +			{ +				continue; +			}	 +			drawablep->shiftPos(offseta);	 +			drawablep->clearState(LLDrawable::ON_SHIFT_LIST); +		} +		mShiftList.resize(0);  	} -	mShiftList.resize(0); -	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();  -			iter != LLWorld::getInstance()->getRegionList().end(); ++iter) +	  	{ -		LLViewerRegion* region = *iter; -		for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) +		LLFastTimer t(FTM_SHIFT_OCTREE); +		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();  +				iter != LLWorld::getInstance()->getRegionList().end(); ++iter)  		{ -			LLSpatialPartition* part = region->getSpatialPartition(i); -			if (part) +			LLViewerRegion* region = *iter; +			for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)  			{ -				part->shift(offseta); +				LLSpatialPartition* part = region->getSpatialPartition(i); +				if (part) +				{ +					part->shift(offseta); +				}  			}  		}  	} -	LLHUDText::shiftAll(offset); -	LLHUDNameTag::shiftAll(offset); +	{ +		LLFastTimer t(FTM_SHIFT_HUD); +		LLHUDText::shiftAll(offset); +		LLHUDNameTag::shiftAll(offset); +	}  	display_update_camera();  } @@ -2876,8 +2910,10 @@ void LLPipeline::markPartitionMove(LLDrawable* drawable)  	}  } +static LLFastTimer::DeclareTimer FTM_PROCESS_PARTITIONQ("PartitionQ");  void LLPipeline::processPartitionQ()  { +	LLFastTimer t(FTM_PROCESS_PARTITIONQ);  	for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter)  	{  		LLDrawable* drawable = *iter; @@ -2993,7 +3029,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  	//LLVertexBuffer::unbind();  	grabReferences(result); -	for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +	for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  	{  		LLSpatialGroup* group = *iter;  		group->checkOcclusion(); @@ -3004,7 +3040,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  		else  		{  			group->setVisible(); -			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  			{  				markVisible(*i, camera);  			} @@ -3019,9 +3055,9 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  	if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)  	{  		LLSpatialGroup* last_group = NULL; -		for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) +		for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)  		{ -			LLCullResult::bridge_list_t::iterator cur_iter = i; +			LLCullResult::bridge_iterator cur_iter = i;  			LLSpatialBridge* bridge = *cur_iter;  			LLSpatialGroup* group = bridge->getSpatialGroup(); @@ -3051,7 +3087,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  		}  	} -	for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +	for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  	{  		LLSpatialGroup* group = *iter;  		group->checkOcclusion(); @@ -3073,7 +3109,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  	{  		LLFastTimer ftm(FTM_STATESORT_DRAWABLE); -		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); +		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList();  			 iter != sCull->endVisibleList(); ++iter)  		{  			LLDrawable *drawablep = *iter; @@ -3092,7 +3128,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)  	LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);  	if (group->changeLOD())  	{ -		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  		{  			LLDrawable* drawablep = *i;  			stateSort(drawablep, camera); @@ -3209,13 +3245,13 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)  } -void forAllDrawables(LLCullResult::sg_list_t::iterator begin,  -					 LLCullResult::sg_list_t::iterator end, +void forAllDrawables(LLCullResult::sg_iterator begin,  +					 LLCullResult::sg_iterator end,  					 void (*func)(LLDrawable*))  { -	for (LLCullResult::sg_list_t::iterator i = begin; i != end; ++i) +	for (LLCullResult::sg_iterator i = begin; i != end; ++i)  	{ -		for (LLSpatialGroup::element_iter j = (*i)->getData().begin(); j != (*i)->getData().end(); ++j) +		for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j)  		{  			func(*j);	  		} @@ -3417,7 +3453,7 @@ void LLPipeline::postSort(LLCamera& camera)  	llpushcallstacks ;  	//rebuild drawable geometry -	for (LLCullResult::sg_list_t::iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i) +	for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (!sUseOcclusion ||  @@ -3435,7 +3471,7 @@ void LLPipeline::postSort(LLCamera& camera)  	//build render map -	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) +	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (sUseOcclusion &&  @@ -4138,7 +4174,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)  	LLMemType mt_rgd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED);  	LLFastTimer t(FTM_RENDER_GEOMETRY); -	LLFastTimer t2(FTM_POOLS); +	LLFastTimer t2(FTM_DEFERRED_POOLS);  	LLGLEnable cull(GL_CULL_FACE); @@ -4180,7 +4216,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)  		pool_set_t::iterator iter2 = iter1;  		if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)  		{ -			LLFastTimer t(FTM_POOLRENDER); +			LLFastTimer t(FTM_DEFERRED_POOLRENDER);  			gGLLastMatrix = NULL;  			gGL.loadMatrix(gGLModelView); @@ -4233,7 +4269,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)  void LLPipeline::renderGeomPostDeferred(LLCamera& camera)  {  	LLMemType mt_rgpd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF); -	LLFastTimer t(FTM_POOLS); +	LLFastTimer t(FTM_POST_DEFERRED_POOLS);  	U32 cur_type = 0;  	LLGLEnable cull(GL_CULL_FACE); @@ -4267,7 +4303,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)  		pool_set_t::iterator iter2 = iter1;  		if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)  		{ -			LLFastTimer t(FTM_POOLRENDER); +			LLFastTimer t(FTM_POST_DEFERRED_POOLRENDER);  			gGLLastMatrix = NULL;  			gGL.loadMatrix(gGLModelView); @@ -4457,7 +4493,7 @@ void LLPipeline::renderPhysicsDisplay()  		}  	} -	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) +	for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)  	{  		LLSpatialBridge* bridge = *i;  		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) @@ -4879,7 +4915,7 @@ void LLPipeline::renderDebug()  		}  	} -	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) +	for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)  	{  		LLSpatialBridge* bridge = *i;  		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) @@ -5131,8 +5167,11 @@ void LLPipeline::renderDebug()  	}  } +static LLFastTimer::DeclareTimer FTM_REBUILD_POOLS("Rebuild Pools"); +  void LLPipeline::rebuildPools()  { +	LLFastTimer t(FTM_REBUILD_POOLS);  	LLMemType mt(LLMemType::MTYPE_PIPELINE_REBUILD_POOLS);  	assertInitialized(); @@ -6691,13 +6730,16 @@ void LLPipeline::resetVertexBuffers()  	mResetVertexBuffers = true;  } +static LLFastTimer::DeclareTimer FTM_RESET_VB("Reset VB"); +  void LLPipeline::doResetVertexBuffers()  {  	if (!mResetVertexBuffers)  	{  		return;  	} -	 + +	LLFastTimer t(FTM_RESET_VB);  	mResetVertexBuffers = false;  	mCubeVB = NULL; @@ -9122,6 +9164,8 @@ void LLPipeline::generateHighlight(LLCamera& camera)  } +static LLFastTimer::DeclareTimer FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); +  void LLPipeline::generateSunShadow(LLCamera& camera)  {  	if (!sRenderDeferred || RenderShadowDetail <= 0) @@ -9129,6 +9173,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera)  		return;  	} +	LLFastTimer t(FTM_GEN_SUN_SHADOW); +  	BOOL skip_avatar_update = FALSE;  	if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)  	{ @@ -9878,7 +9924,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)  void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture)  { -	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) +	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (!group->isDead() && @@ -9891,6 +9937,12 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu  	}  } +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_MARK_VISIBLE("Impostor Mark Visible"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_SETUP("Impostor Setup"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_BACKGROUND("Impostor Background"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_ALLOCATE("Impostor Allocate"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_RESIZE("Impostor Resize"); +  void LLPipeline::generateImpostor(LLVOAvatar* avatar)  {  	LLMemType mt_gi(LLMemType::MTYPE_PIPELINE_GENERATE_IMPOSTOR); @@ -9946,101 +9998,114 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	sImpostorRender = TRUE;  	LLViewerCamera* viewer_camera = LLViewerCamera::getInstance(); -	markVisible(avatar->mDrawable, *viewer_camera); -	LLVOAvatar::sUseImpostors = FALSE; -	LLVOAvatar::attachment_map_t::iterator iter; -	for (iter = avatar->mAttachmentPoints.begin(); -		iter != avatar->mAttachmentPoints.end(); -		++iter)  	{ -		LLViewerJointAttachment *attachment = iter->second; -		for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); -			 attachment_iter != attachment->mAttachedObjects.end(); -			 ++attachment_iter) +		LLFastTimer t(FTM_IMPOSTOR_MARK_VISIBLE); +		markVisible(avatar->mDrawable, *viewer_camera); +		LLVOAvatar::sUseImpostors = FALSE; + +		LLVOAvatar::attachment_map_t::iterator iter; +		for (iter = avatar->mAttachmentPoints.begin(); +			iter != avatar->mAttachmentPoints.end(); +			++iter)  		{ -			if (LLViewerObject* attached_object = (*attachment_iter)) +			LLViewerJointAttachment *attachment = iter->second; +			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); +				 attachment_iter != attachment->mAttachedObjects.end(); +				 ++attachment_iter)  			{ -				markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera); +				if (LLViewerObject* attached_object = (*attachment_iter)) +				{ +					markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera); +				}  			}  		}  	}  	stateSort(*LLViewerCamera::getInstance(), result); -	const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); -	LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); -  	LLCamera camera = *viewer_camera; - -	camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); -	  	LLVector2 tdim; +	U32 resY = 0; +	U32 resX = 0; +	{ +		LLFastTimer t(FTM_IMPOSTOR_SETUP); +		const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); +		LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); -	LLVector4a half_height; -	half_height.setSub(ext[1], ext[0]); -	half_height.mul(0.5f); +		camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); +	 +		LLVector4a half_height; +		half_height.setSub(ext[1], ext[0]); +		half_height.mul(0.5f); -	LLVector4a left; -	left.load3(camera.getLeftAxis().mV); -	left.mul(left); -	left.normalize3fast(); +		LLVector4a left; +		left.load3(camera.getLeftAxis().mV); +		left.mul(left); +		left.normalize3fast(); -	LLVector4a up; -	up.load3(camera.getUpAxis().mV); -	up.mul(up); -	up.normalize3fast(); +		LLVector4a up; +		up.load3(camera.getUpAxis().mV); +		up.mul(up); +		up.normalize3fast(); -	tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); -	tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); +		tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); +		tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); -	gGL.matrixMode(LLRender::MM_PROJECTION); -	gGL.pushMatrix(); +		gGL.matrixMode(LLRender::MM_PROJECTION); +		gGL.pushMatrix(); -	F32 distance = (pos-camera.getOrigin()).length(); -	F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; -	F32 aspect = tdim.mV[0]/tdim.mV[1]; -	glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); -	glh_set_current_projection(persp); -	gGL.loadMatrix(persp.m); +		F32 distance = (pos-camera.getOrigin()).length(); +		F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; +		F32 aspect = tdim.mV[0]/tdim.mV[1]; +		glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); +		glh_set_current_projection(persp); +		gGL.loadMatrix(persp.m); -	gGL.matrixMode(LLRender::MM_MODELVIEW); -	gGL.pushMatrix(); -	glh::matrix4f mat; -	camera.getOpenGLTransform(mat.m); +		gGL.matrixMode(LLRender::MM_MODELVIEW); +		gGL.pushMatrix(); +		glh::matrix4f mat; +		camera.getOpenGLTransform(mat.m); -	mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; +		mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; -	gGL.loadMatrix(mat.m); -	glh_set_current_modelview(mat); +		gGL.loadMatrix(mat.m); +		glh_set_current_modelview(mat); -	glClearColor(0.0f,0.0f,0.0f,0.0f); -	gGL.setColorMask(true, true); +		glClearColor(0.0f,0.0f,0.0f,0.0f); +		gGL.setColorMask(true, true); -	// get the number of pixels per angle -	F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); +		// get the number of pixels per angle +		F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); -	//get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) -	U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); -	U32 resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); +		//get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) +		resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); +		resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); -	if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() || -		resY != avatar->mImpostor.getHeight()) -	{ -		avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE); +		if (!avatar->mImpostor.isComplete()) +		{ +			LLFastTimer t(FTM_IMPOSTOR_ALLOCATE); +			avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE); + +			if (LLPipeline::sRenderDeferred) +			{ +				addDeferredAttachments(avatar->mImpostor); +			} -		if (LLPipeline::sRenderDeferred) +			gGL.getTexUnit(0)->bind(&avatar->mImpostor); +			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); +			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +		} +		else if(resX != avatar->mImpostor.getWidth() || +			resY != avatar->mImpostor.getHeight())  		{ -			addDeferredAttachments(avatar->mImpostor); +			LLFastTimer t(FTM_IMPOSTOR_RESIZE); +			avatar->mImpostor.resize(resX,resY,GL_RGBA);  		} -		 -		gGL.getTexUnit(0)->bind(&avatar->mImpostor); -		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); -		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -	} -	avatar->mImpostor.bindTarget(); +		avatar->mImpostor.bindTarget(); +	}  	if (LLPipeline::sRenderDeferred)  	{ @@ -10057,6 +10122,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	}  	{ //create alpha mask based on depth buffer (grey out if muted) +		LLFastTimer t(FTM_IMPOSTOR_BACKGROUND);  		if (LLPipeline::sRenderDeferred)  		{  			GLuint buff = GL_COLOR_ATTACHMENT0; @@ -10142,22 +10208,22 @@ BOOL LLPipeline::hasRenderBatches(const U32 type) const  	return sCull->getRenderMapSize(type) > 0;  } -LLCullResult::drawinfo_list_t::iterator LLPipeline::beginRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLPipeline::beginRenderMap(U32 type)  {  	return sCull->beginRenderMap(type);  } -LLCullResult::drawinfo_list_t::iterator LLPipeline::endRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLPipeline::endRenderMap(U32 type)  {  	return sCull->endRenderMap(type);  } -LLCullResult::sg_list_t::iterator LLPipeline::beginAlphaGroups() +LLCullResult::sg_iterator LLPipeline::beginAlphaGroups()  {  	return sCull->beginAlphaGroups();  } -LLCullResult::sg_list_t::iterator LLPipeline::endAlphaGroups() +LLCullResult::sg_iterator LLPipeline::endAlphaGroups()  {  	return sCull->endAlphaGroups();  } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index ef1fd3279d..368be1c14d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -294,10 +294,10 @@ public:  	void setLight(LLDrawable *drawablep, BOOL is_light);  	BOOL hasRenderBatches(const U32 type) const; -	LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type); -	LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type); -	LLCullResult::sg_list_t::iterator beginAlphaGroups(); -	LLCullResult::sg_list_t::iterator endAlphaGroups(); +	LLCullResult::drawinfo_iterator beginRenderMap(U32 type); +	LLCullResult::drawinfo_iterator endRenderMap(U32 type); +	LLCullResult::sg_iterator beginAlphaGroups(); +	LLCullResult::sg_iterator endAlphaGroups();  	void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml index 54a312bd59..c5dfb703e5 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml @@ -11,6 +11,10 @@  		 name="unknown">          (unknown)  	</panel.string> +    <panel.string +         name="unknown_multiple"> +        (unknown / multiple) +    </panel.string>  	<panel.string  		 name="public">          (public) diff --git a/indra/newview/tests/lltranslate_test.cpp b/indra/newview/tests/lltranslate_test.cpp index 10e37fae97..fd9527d631 100644 --- a/indra/newview/tests/lltranslate_test.cpp +++ b/indra/newview/tests/lltranslate_test.cpp @@ -299,11 +299,6 @@ LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLCo  std::string LLControlGroup::getString(const std::string& name) { return "dummy"; }  LLControlGroup::~LLControlGroup() {} -namespace boost { -	void intrusive_ptr_add_ref(LLCurl::Responder*) {} -	void intrusive_ptr_release(LLCurl::Responder*) {} -} -  LLCurl::Responder::Responder() {}  void LLCurl::Responder::completedHeader(U32, std::string const&, LLSD const&) {}  void LLCurl::Responder::completedRaw(U32, const std::string&, const LLChannelDescriptors&, const LLIOPipe::buffer_ptr_t& buffer) {} @@ -314,7 +309,7 @@ void LLCurl::Responder::result(LLSD const&) {}  LLCurl::Responder::~Responder() {}  void LLHTTPClient::get(const std::string&, const LLSD&, ResponderPtr, const LLSD&, const F32) {} -void LLHTTPClient::get(const std::string&, boost::intrusive_ptr<LLCurl::Responder>, const LLSD&, const F32) {} +void LLHTTPClient::get(const std::string&, LLPointer<LLCurl::Responder>, const LLSD&, const F32) {}  LLBufferStream::LLBufferStream(const LLChannelDescriptors& channels, LLBufferArray* buffer)  :	std::iostream(&mStreamBuf), mStreamBuf(channels, buffer) {} diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 7c6b5403e1..04118a5c87 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -537,6 +537,7 @@ class WindowsManifest(ViewerManifest):                  result += 'File ' + pkg_file + '\n'              else:                  result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n' +          # at the end of a delete, just rmdir all the directories          if not install:              deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list] @@ -1080,7 +1081,13 @@ class Linux_i686Manifest(LinuxManifest):              # previous call did, without having to explicitly state the              # version number.              self.path("libfontconfig.so.*.*") -            self.path("libtcmalloc.so*") #formerly called google perf tools +            try: +                self.path("libtcmalloc.so*") #formerly called google perf tools +                pass +            except: +                print "tcmalloc files not found, skipping" +                pass +              try:                      self.path("libfmod-3.75.so")                      pass diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 4da774a5f6..5edbbf9914 100644 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -51,37 +51,6 @@ public:  }; -class LLUpdateChecker::Implementation: -	public LLHTTPClient::Responder -{ -public: -	Implementation(Client & client); -	~Implementation(); -	void checkVersion(std::string const & protocolVersion, std::string const & hostUrl,  -			   std::string const & servicePath, std::string channel, std::string version); -	 -	// Responder: -	virtual void completed(U32 status, -						   const std::string & reason, -						   const LLSD& content); -	virtual void error(U32 status, const std::string & reason); -	 -private:	 -	static const char * sProtocolVersion; -	 -	Client & mClient; -	LLHTTPClient mHttpClient; -	bool mInProgress; -	std::string mVersion; -	 -	std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl,  -						 std::string const & servicePath, std::string channel, std::string version); - -	LOG_CLASS(LLUpdateChecker::Implementation); -}; - - -  // LLUpdateChecker  //----------------------------------------------------------------------------- @@ -134,13 +103,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & protocolV  	std::string checkUrl = buildUrl(protocolVersion, hostUrl, servicePath, channel, version);  	LL_INFOS("UpdateCheck") << "checking for updates at " << checkUrl << llendl; -	// The HTTP client will wrap a raw pointer in a boost::intrusive_ptr causing the -	// passed object to be silently and automatically deleted.  We pass a self- -	// referential intrusive pointer to which we add a reference to keep the -	// client from deleting the update checker implementation instance. -	LLHTTPClient::ResponderPtr temporaryPtr(this); -	boost::intrusive_ptr_add_ref(temporaryPtr.get()); -	mHttpClient.get(checkUrl, temporaryPtr); +	mHttpClient.get(checkUrl, this);  }  void LLUpdateChecker::Implementation::completed(U32 status, diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index d882169068..23f62a7c5e 100644 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -29,6 +29,7 @@  #include <boost/shared_ptr.hpp> +#include "llhttpclient.h"  //  // Implements asynchronous checking for updates. @@ -36,7 +37,36 @@  class LLUpdateChecker {  public:  	class Client; -	class Implementation; +	class Implementation: + +	public LLHTTPClient::Responder +	{ +	public: +		Implementation(Client & client); +		~Implementation(); +		void checkVersion(std::string const & protocolVersion, std::string const & hostUrl,  +				   std::string const & servicePath, std::string channel, std::string version); +	 +		// Responder: +		virtual void completed(U32 status, +							   const std::string & reason, +							   const LLSD& content); +		virtual void error(U32 status, const std::string & reason); +	 +	private:	 +		static const char * sProtocolVersion; +	 +		Client & mClient; +		LLHTTPClient mHttpClient; +		bool mInProgress; +		std::string mVersion; +	 +		std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl,  +							 std::string const & servicePath, std::string channel, std::string version); + +		LOG_CLASS(LLUpdateChecker::Implementation); +	}; +  	// An exception that may be raised on check errors.  	class CheckError; @@ -48,7 +78,7 @@ public:  			   std::string const & servicePath, std::string channel, std::string version);  private: -	boost::shared_ptr<Implementation> mImplementation; +	LLPointer<Implementation> mImplementation;  }; | 
