Automated merge with file:///Users/nat/linden/viewer-maint-1144

master
Nat Goodspeed 2012-06-06 23:21:07 -04:00
commit 89ea7ccfc7
1436 changed files with 40082 additions and 33928 deletions

View File

@ -67,3 +67,4 @@ glob:indra/newview/filters.xml
glob:indra/newview/avatar_icons_cache.txt
glob:indra/newview/avatar_lad.log
glob:*.diff
*.rej

69
.hgtags
View File

@ -228,3 +228,72 @@ c4911ec8cd81e676dfd2af438b3e065407a94a7a 3.2.1-start
80f3e30d8aa4d8f674a48bd742aaa6d8e9eae0b5 3.2.3-start
a8c7030d6845186fac7c188be4323a0e887b4184 DRTVWR-99_3.2.1-release
a8c7030d6845186fac7c188be4323a0e887b4184 3.2.1-release
a9abb9633a266c8d2fe62411cfd1c86d32da72bf DRTVWR-60_2.7.1-release
fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-60_2.7.1-release
a9abb9633a266c8d2fe62411cfd1c86d32da72bf 2.7.1-release
fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.1-release
3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-start
a9abb9633a266c8d2fe62411cfd1c86d32da72bf DRTVWR-60_2.7.1-release
fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-60_2.7.1-release
a9abb9633a266c8d2fe62411cfd1c86d32da72bf 2.7.1-release
fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.1-release
3fe994349fae64fc40874bb59db387131eb35a41 DRTVWR-104_3.2.4-beta1
3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-beta1
8a44ff3d2104269ce76145c2772cf1bdff2a2abe 3.2.5-start
fe3a8e7973072ea62043c08b19b66626c1a720eb DRTVWR-62_2.7.2-release
fe3a8e7973072ea62043c08b19b66626c1a720eb 2.7.2-release
bd6bcde2584491fd9228f1fa51c4575f4e764e19 DRTVWR-103_3.2.4-release
bd6bcde2584491fd9228f1fa51c4575f4e764e19 3.2.4-release
3d2d5d244c6398a4214c666d5dd3965b0918709a DRTVWR-106_3.2.5-beta1
3d2d5d244c6398a4214c666d5dd3965b0918709a 3.2.5-beta1
65a2c1c8d855b88edfbea4e16ef2f27e7cff8b1d DRTVWR-107_3.2.5-beta2
65a2c1c8d855b88edfbea4e16ef2f27e7cff8b1d 3.2.5-beta2
c6175c955a19e9b9353d242889ec1779b5762522 DRTVWR-105_3.2.5-release
c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release
2174ed1c7129562428a5cfe8651ed77b8d26ae18 3.2.6-start
286d73ff5c19f6c00e023dc1b60975ed6bbe2872 DRTVWR-109_3.2.6-beta1
4891c46a56fed7512c783b9cbe7cb7260727bf0c 3.2.7-start
286d73ff5c19f6c00e023dc1b60975ed6bbe2872 3.2.6-beta1
c6175c955a19e9b9353d242889ec1779b5762522 DRTVWR-105_3.2.5-release
c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release
3d75c836d178c7c7e788f256afe195f6cab764a2 DRTVWR-111_3.2.7-beta1
3d75c836d178c7c7e788f256afe195f6cab764a2 3.2.7-beta1
89980333c99dbaf1787fe20784f1d8849e9b5d4f 3.2.8-start
16f8e2915f3f2e4d732fb3125daf229cb0fd1875 DRTVWR-114_3.2.8-beta1
16f8e2915f3f2e4d732fb3125daf229cb0fd1875 3.2.8-beta1
987425b1acf4752379b2e1eb20944b4b35d67a85 DRTVWR-115_3.2.8-beta2
987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2
51b2fd52e36aab8f670e0874e7e1472434ec4b4a DRTVWR-113_3.2.8-release
51b2fd52e36aab8f670e0874e7e1472434ec4b4a 3.2.8-release
37dd400ad721e2a89ee820ffc1e7e433c68f3ca2 3.2.9-start
e9c82fca5ae6fb8a8af29012d78fb194a29323f3 DRTVWR-117_3.2.9-beta1
e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1
a01ef9bed28627f4ca543fbc1d70c79cc297a90f DRTVWR-118_3.2.9-beta2
a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2
987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2
d5f263687f43f278107363365938f0a214920a4b DRTVWR-119
d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1
5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release
d5f263687f43f278107363365938f0a214920a4b 3.3.0-start
dffd0457ee0745de65bf95f0642a5c9e46b8e2f0 viewer-beta-candidate
d5f263687f43f278107363365938f0a214920a4b DRTVWR-119
d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1
5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release
28b95a6a28dca3338d9a1f4f204b96678df9f6a5 viewer-beta-candidate
b43cd25be49e3984ff5361cefad020e069131d98 3.3.1-start
3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 DRTVWR-125
3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 3.3.1-start
28b95a6a28dca3338d9a1f4f204b96678df9f6a5 3.3.1-beta1
1dc545e44617975da2a4a32fe303386c687a6ca1 viewer-beta-candidate
1dc545e44617975da2a4a32fe303386c687a6ca1 3.3.1-beta2
1dc545e44617975da2a4a32fe303386c687a6ca1 DRTVWR-139
5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
c623bbc854b6f7ee1b33a3718f76715046aa2937 viewer-release-candidate
c623bbc854b6f7ee1b33a3718f76715046aa2937 3.3.1-release
d29a260119f8d5a5d168e25fed0c7ea6b3f40161 3.3.2-beta1
675668bd24d3bea570814f71762a2a806f7e1b8d 3.3.2-beta2
c623bbc854b6f7ee1b33a3718f76715046aa2937 viewer-release-candidate
675668bd24d3bea570814f71762a2a806f7e1b8d viewer-release-candidate
675668bd24d3bea570814f71762a2a806f7e1b8d 3.3.2-release

70
BuildParams Executable file → Normal file
View File

@ -35,51 +35,27 @@ viewer-development.build_debug_release_separately = true
# Notifications - to configure email notices, add a setting like this:
# <username>_<reponame>.email = <email-address>
# =================================================================
# Viewer Development (snowstorm canonical build owned by Oz Linden)
# =================================================================
snowstorm_viewer-development.viewer_channel = "Second Life Development"
snowstorm_viewer-development.login_channel = "Second Life Development"
snowstorm_viewer-development.build_viewer_update_version_manager = false
snowstorm_viewer-development.email = viewer-development-builds@lists.secondlife.com
snowstorm_viewer-development.build_enforce_coding_policy = true
snowstorm_viewer-development.codeticket_add_context = true
Snowstorm_viewer-project-review.build_debug_release_separately = true
Snowstorm_viewer-project-review.codeticket_add_context = true
Snowstorm_viewer-project-review.viewer_channel = "Project Viewer - Snowstorm Team"
Snowstorm_viewer-project-review.login_channel = "Project Viewer - Snowstorm Team"
Snowstorm_viewer-project-review.codeticket_add_context = true
# =================================================================
# Canonical viewer integration builds - Oz Linden
# =================================================================
integration_viewer-development.viewer_channel = "Second Life Development"
integration_viewer-development.login_channel = "Second Life Development"
integration_viewer-development.build_viewer_update_version_manager = false
integration_viewer-development.email = viewer-development-builds@lists.secondlife.com
integration_viewer-development.build_enforce_coding_policy = true
integration_viewer-development.codeticket_add_context = true
# ========================================
# Viewer Beta (Owner: Dessie Linden)
# ========================================
viewer-beta.viewer_channel = "Second Life Beta Viewer"
viewer-beta.login_channel = "Second Life Beta Viewer"
viewer-beta.build_debug_release_separately = true
viewer-beta.build_viewer_update_version_manager = true
viewer-pre-beta.viewer_channel = "Second Life Beta Viewer"
viewer-pre-beta.login_channel = "Second Life Beta Viewer"
viewer-pre-beta.build_debug_release_separately = true
viewer-pre-beta.build_viewer_update_version_manager = true
# ========================================
# Viewer Release (Owner: Dessie Linden)
# ========================================
viewer-release.viewer_channel = "Second Life Release"
viewer-release.login_channel = "Second Life Release"
viewer-release.build_debug_release_separately = true
viewer-release.build_viewer_update_version_manager = true
viewer-pre-release.viewer_channel = "Second Life Release"
viewer-pre-release.login_channel = "Second Life Release"
viewer-pre-release.build_debug_release_separately = true
viewer-pre-release.build_viewer_update_version_manager = true
#viewer-pre-release.release-viewer.jira = DRTVWR-92
# ========================================
# mesh-development
# ========================================
@ -136,35 +112,31 @@ viewer-mesh.login_channel = "Project Viewer - Mesh"
viewer-mesh.viewer_grid = aditi
viewer-mesh.email = shining@lists.lindenlab.com
# ========================================
# CG
# ========================================
cg_viewer-development_lenny.show_changes_since = 4b140ce7839d
cg_viewer-development_lenny.email = cg@lindenlab.com
# ================
# oz
# ================
Snowstorm_viewer-project-review.build_debug_release_separately = true
Snowstorm_viewer-project-review.codeticket_add_context = true
Snowstorm_viewer-project-review.viewer_channel = "Project Viewer - Snowstorm Team"
Snowstorm_viewer-project-review.login_channel = "Project Viewer - Snowstorm Team"
Snowstorm_viewer-project-review.codeticket_add_context = true
oz_viewer-devreview.build_debug_release_separately = true
oz_viewer-devreview.codeticket_add_context = false
oz_viewer-devreview.build_enforce_coding_policy = true
oz_viewer-devreview.email = oz@lindenlab.com
oz_project-1.build_debug_release_separately = true
oz_project-1.codeticket_add_context = false
oz_project-2.build_debug_release_separately = true
oz_project-2.codeticket_add_context = false
oz_project-3.build_debug_release_separately = true
oz_project-3.codeticket_add_context = false
oz_project-4.build_debug_release_separately = true
oz_project-4.codeticket_add_context = false
oz_viewer-trial.build_debug_release_separately = true
oz_viewer-trial.codeticket_add_context = false
oz_viewer-trial.build_enforce_coding_policy = true
oz_viewer-trial.email = oz@lindenlab.com
oz_viewer-beta-review.build_debug_release_separately = true
oz_viewer-beta-review.codeticket_add_context = false
oz_viewer-beta-review.viewer_channel = "Second Life Beta Viewer"
oz_viewer-beta-review.login_channel = "Second Life Beta Viewer"
oz_viewer-beta-review.email = oz@lindenlab.com
# =================================================================
# asset delivery 2010 projects

View File

@ -1206,9 +1206,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>7108c2443dbcf4c032305814ce65ebb7</string>
<string>4a98d727561cd1f4ac5ee02907411df1</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111028.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20120228.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
@ -1218,9 +1218,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>c05a33ee8b6f253b5a744596dfc3707d</string>
<string>f50e5f0cc880c55b3f0f7e67dc8f7221</string>
<key>url</key>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-qt4.6-20101013.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Linux/installer/llqtwebkit-4.7.1-linux-20120228.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
@ -1230,9 +1230,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>24048a31d7b852774dc3117acbd4a86a</string>
<string>5e3cd6af397e853a963a6de40d440ff4</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111028.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20120228.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>

View File

@ -132,10 +132,6 @@ if test -f scripts/update_version_files.py ; then
end_section UpdateVer
fi
# Now retrieve the version for use in the version manager
# First three parts only, $revision will be appended automatically.
build_viewer_update_version_manager_version=`python scripts/get_version.py --viewer-version | sed 's/\.[0-9]*$//'`
if [ -z "$AUTOBUILD" ]
then
export autobuild_dir="$here/../../../autobuild/bin/"
@ -177,9 +173,6 @@ eval "$("$AUTOBUILD" source_environment)"
env|sort
# Install packages.
"$AUTOBUILD" install --skip-license-check
# Now run the build
succeeded=true
build_processes=
@ -195,10 +188,19 @@ do
begin_section "Do$variant"
build_dir=`build_dir_$arch $variant`
build_dir_stubs="$build_dir/win_setup/$variant"
begin_section "PreClean"
rm -rf "$build_dir"
end_section "PreClean"
mkdir -p "$build_dir"
mkdir -p "$build_dir/tmp"
#export TMP="$build_dir/tmp"
# Install packages.
begin_section "AutobuildInstall"
"$AUTOBUILD" install --verbose --skip-license-check
end_section "AutobuildInstall"
if pre_build "$variant" "$build_dir" >> "$build_log" 2>&1
then
if $build_link_parallel

View File

@ -103,6 +103,7 @@ Aleric Inglewood
STORM-163
STORM-955
STORM-960
STORM-1793
Ales Beaumont
VWR-9352
SNOW-240
@ -159,6 +160,7 @@ Alissa Sabre
VWR-12620
VWR-12789
SNOW-322
STORM-1723
Alliez Mysterio
Angus Boyd
VWR-592
@ -170,6 +172,8 @@ Ansariel Hiller
STORM-1101
VWR-25480
VWR-26150
STORM-1685
STORM-1713
Aralara Rajal
Ardy Lay
STORM-859
@ -230,7 +234,7 @@ Borg Capalini
Boroondas Gupte
OPEN-29
OPEN-39
OPEN-39
OPEN-54
OPEN-99
SNOW-278
SNOW-503
@ -392,6 +396,8 @@ Frontera Thor
Fury Rosewood
Gaberoonie Zanzibar
Ganymedes Costagravas
Geenz Spad
STORM-1823
Gene Frostbite
GeneJ Composer
Geneko Nemeth
@ -463,6 +469,8 @@ Hiro Sommambulist
VWR-132
VWR-136
VWR-143
Hitomi Tiponi
STORM-1741
Holger Gilruth
Horatio Freund
Hoze Menges
@ -482,6 +490,7 @@ Ima Mechanique
OPEN-76
STORM-959
STORM-1175
STORM-1708
Imnotgoing Sideways
Inma Rau
Innula Zenovka
@ -581,11 +590,45 @@ Jonathan Yap
STORM-976
STORM-1639
STORM-910
STORM-1653
STORM-1642
STORM-591
STORM-1105
STORM-1679
STORM-1222
STORM-1659
STORM-1674
STORM-1685
STORM-1718
STORM-1721
STORM-1718
STORM-1727
STORM-1725
STORM-1719
STORM-1712
STORM-1728
STORM-1736
STORM-1804
STORM-1734
STORM-1731
STORM-653
STORM-1737
STORM-1733
STORM-1741
STORM-1790
STORM-1795
STORM-1788
STORM-1803
STORM-1795
STORM-1799
STORM-1796
STORM-1807
STORM-1808
STORM-637
STORM-1822
STORM-1809
STORM-1793
STORM-1810
Kadah Coba
STORM-1060
Jondan Lundquist
@ -621,6 +664,7 @@ Kitty Barnett
STORM-1001
STORM-1175
VWR-24217
STORM-1804
Kolor Fall
Komiko Okamoto
Korvel Noh
@ -828,6 +872,7 @@ Nicky Perian
OPEN-1
STORM-1087
STORM-1090
STORM-1828
Nicoladie Gymnast
Nounouch Hapmouche
VWR-238
@ -920,6 +965,7 @@ Robin Cornelius
SNOW-599
SNOW-747
STORM-422
STORM-591
STORM-960
STORM-1019
STORM-1095
@ -1114,6 +1160,9 @@ Tofu Buzzard
CTS-411
STORM-546
VWR-24509
STORM-1684
SH-2477
STORM-1684
Tony Kembia
Torben Trautman
TouchaHoney Perhaps
@ -1143,6 +1192,8 @@ Unlikely Quintessa
UsikuFarasi Kanarik
Vadim Bigbear
VWR-2681
Vaalith Jinn
STORM-64
Vector Hastings
VWR-8726
Veritas Raymaker
@ -1211,6 +1262,8 @@ WolfPup Lowenhar
VWR-20741
VWR-20933
Wundur Primbee
Xellessanova Zenith
STORM-1793
Xiki Luik
xstorm Radek
YongYong Francois
@ -1233,6 +1286,7 @@ Zi Ree
VWR-1140
VWR-24017
VWR-25588
STORM-1790
Zipherius Turas
VWR-76
VWR-77

View File

@ -46,7 +46,7 @@ if (WINDOWS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP -D_SCL_SECURE_NO_WARNINGS=1"
CACHE STRING "C++ compiler debug options" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob2 -D_SECURE_STL=0"
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Ob0 -D_SECURE_STL=0"
CACHE STRING "C++ compiler release-with-debug options" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /Ob2 -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
@ -62,7 +62,7 @@ if (WINDOWS)
/D_UNICODE
/GS
/TP
/W2
/W3
/c
/Zc:forScope
/nologo

View File

@ -18,5 +18,5 @@ else (STANDALONE)
elseif (LINUX)
set(JSONCPP_LIBRARIES libjson_linux-gcc-4.1.3_libmt.a)
endif (WINDOWS)
set(JSONCPP_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
set(JSONCPP_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
endif (STANDALONE)

View File

@ -13,7 +13,7 @@ elseif (LINUX)
set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin)
elseif (DARWIN)
set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)")
set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs")
endif (WINDOWS)
# Autobuild packages must provide 'release' versions of libraries, but may provide versions for
@ -33,7 +33,14 @@ else(WINDOWS OR DARWIN)
set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
endif(WINDOWS OR DARWIN)
list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
# When we're building something other than Release, append the
# packages/lib/release directory to deal with autobuild packages that don't
# provide (e.g.) lib/debug libraries.
list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}, extending AUTOBUILD_LIBS_INSTALL_DIRS")
endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(STATUS "For ${CMAKE_BUILD_TYPE}, AUTOBUILD_LIBS_INSTALL_DIRS: ${AUTOBUILD_LIBS_INSTALL_DIRS}")
link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
if (LINUX)

View File

@ -0,0 +1,15 @@
# -*- cmake -*-
if (VIEWER)
set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off")
if (INCLUDE_VLD_CMAKE)
if (WINDOWS)
add_definitions(-DINCLUDE_VLD=1)
endif (WINDOWS)
endif (INCLUDE_VLD_CMAKE)
endif (VIEWER)

View File

@ -70,9 +70,10 @@ elseif (LINUX)
QtNetwork
QtGui
QtCore
qgif
qjpeg
jpeg
jscore
# qgif
# qjpeg
# jpeg
fontconfig
X11
Xrender

View File

0
indra/linux_crash_logger/llcrashloggerlinux.cpp Executable file → Normal file
View File

0
indra/linux_crash_logger/llcrashloggerlinux.h Executable file → Normal file
View File

View File

@ -215,7 +215,7 @@ BOOL LLVorbisDecodeState::initDecode()
return(FALSE);
}
S32 sample_count = ov_pcm_total(&mVF, -1);
S32 sample_count = (S32)ov_pcm_total(&mVF, -1);
size_t size_guess = (size_t)sample_count;
vorbis_info* vi = ov_info(&mVF, -1);
size_guess *= (vi? vi->channels : 1);

View File

@ -1264,6 +1264,7 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mSyncSlave(false),
mQueueSounds(false),
mPlayedOnce(false),
mCorrupted(false),
mType(type),
mChannelp(NULL),
mCurrentDatap(NULL),
@ -1296,16 +1297,25 @@ void LLAudioSource::setChannel(LLAudioChannel *channelp)
void LLAudioSource::update()
{
if(mCorrupted)
{
return ; //no need to update
}
if (!getCurrentBuffer())
{
if (getCurrentData())
{
// Hack - try and load the sound. Will do this as a callback
// on decode later.
if (getCurrentData()->load())
if (getCurrentData()->load() && getCurrentData()->getBuffer())
{
play(getCurrentData()->getID());
}
}
else
{
mCorrupted = true ;
}
}
}
}
@ -1421,6 +1431,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
bool LLAudioSource::isDone() const
{
if(mCorrupted)
{
return true ;
}
const F32 MAX_AGE = 60.f;
const F32 MAX_UNPLAYED_AGE = 15.f;
const F32 MAX_MUTED_AGE = 11.f;
@ -1736,7 +1751,7 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
}
}
//return false when the audio file is corrupted.
bool LLAudioData::load()
{
// For now, just assume we're going to use one buffer per audiodata.
@ -1752,7 +1767,7 @@ bool LLAudioData::load()
{
// No free buffers, abort.
llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
return false;
return true;
}
std::string uuid_str;

View File

@ -37,6 +37,7 @@
#include "lluuid.h"
#include "llframetimer.h"
#include "llassettype.h"
#include "llextendedstatus.h"
#include "lllistener.h"
@ -334,6 +335,7 @@ protected:
bool mSyncSlave;
bool mQueueSounds;
bool mPlayedOnce;
bool mCorrupted;
S32 mType;
LLVector3d mPositionGlobal;
LLVector3 mVelocity;

View File

@ -1570,7 +1570,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
constraint_it++)
{
U8 byte = constraint_it->mChainLength;
dp.packU8(byte, "chain_lenght");
dp.packU8(byte, "chain_length");
byte = constraint_it->mConstraintType;
dp.packU8(byte, "constraint_type");

View File

@ -126,7 +126,7 @@ public:
virtual void addDebugText( const std::string& text ) = 0;
virtual const LLUUID& getID() = 0;
virtual const LLUUID& getID() const = 0;
//-------------------------------------------------------------------------
// End Interface
//-------------------------------------------------------------------------

View File

@ -52,34 +52,11 @@
#include <ctime>
#include <iosfwd>
// Work around Microsoft compiler warnings in STL headers
#ifdef LL_WINDOWS
#pragma warning (disable : 4702) // unreachable code
#pragma warning (disable : 4244) // conversion from time_t to S32
#endif // LL_WINDOWS
// *TODO: Eliminate these, most library .cpp files don't need them.
// Add them to llviewerprecompiledheaders.h if necessary.
#include <list>
#include <map>
#include <vector>
#include <string>
#ifdef LL_WINDOWS
// Reenable warnings we disabled above
#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
// moved msvc warnings to llpreprocessor.h *TODO - delete this comment after merge conflicts are unlikely -brad
#endif // LL_WINDOWS
// Linden only libs in alpha-order other than stdtypes.h
// *NOTE: Please keep includes here to a minimum, see above.
#include "stdtypes.h"
#include "lldefs.h"
#include "llerror.h"
#include "llextendedstatus.h"
// Don't do this, adds 15K lines of header code to every library file.
//#include "llfasttimer.h"
#include "llfile.h"
#include "llformat.h"
#endif

View File

@ -106,6 +106,11 @@ std::string LLAvatarName::getCompleteName() const
std::string LLAvatarName::getLegacyName() const
{
if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
{
return mDisplayName;
}
std::string name;
name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
name = mLegacyFirstName;

View File

@ -617,6 +617,12 @@ namespace LLError
s.defaultLevel = level;
}
ELevel getDefaultLevel()
{
Settings& s = Settings::get();
return s.defaultLevel;
}
void setFunctionLevel(const std::string& function_name, ELevel level)
{
Globals& g = Globals::get();

View File

@ -75,6 +75,7 @@ namespace LLError
LL_COMMON_API void setPrintLocation(bool);
LL_COMMON_API void setDefaultLevel(LLError::ELevel);
LL_COMMON_API ELevel getDefaultLevel();
LL_COMMON_API void setFunctionLevel(const std::string& function_name, LLError::ELevel);
LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel);
LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel);

View File

@ -430,13 +430,13 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
{
// The new node isn't last. Place it between the previous node and
// the successor.
newNode = (myprev + mydmi->second)/2.0;
newNode = (myprev + mydmi->second)/2.f;
}
else
{
// The new node is last. Bump myprev up to the next integer, add
// 1.0 and use that.
newNode = std::ceil(myprev) + 1.0;
newNode = std::ceil(myprev) + 1.f;
}
// Now that newNode has a value that places it appropriately in mSignal,
// connect it.

View File

@ -175,7 +175,7 @@ void LLMD5::update(std::istream& stream){
while (stream.good()){
stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable.
len=stream.gcount();
len=(int)stream.gcount();
update(buffer, len);
}

View File

@ -159,6 +159,7 @@ void LLMemory::logMemoryInfo(BOOL update)
if(update)
{
updateMemoryInfo() ;
LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ;
}
llinfos << "Current allocated physical memory(KB): " << sAllocatedMemInKB << llendl ;

View File

@ -132,7 +132,7 @@
#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"
#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden
#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
//#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
#pragma warning( disable : 4996 ) // warning: deprecated
@ -151,6 +151,8 @@
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
#pragma warning (disable : 4018) // '<' : signed/unsigned mismatch
#endif // LL_MSVC
#if LL_WINDOWS

View File

@ -109,7 +109,7 @@ void LLQueuedThread::shutdown()
// MAIN THREAD
// virtual
S32 LLQueuedThread::update(U32 max_time_ms)
S32 LLQueuedThread::update(F32 max_time_ms)
{
if (!mStarted)
{
@ -122,7 +122,7 @@ S32 LLQueuedThread::update(U32 max_time_ms)
return updateQueue(max_time_ms);
}
S32 LLQueuedThread::updateQueue(U32 max_time_ms)
S32 LLQueuedThread::updateQueue(F32 max_time_ms)
{
F64 max_time = (F64)max_time_ms * .001;
LLTimer timer;

View File

@ -173,8 +173,8 @@ protected:
public:
bool waitForResult(handle_t handle, bool auto_complete = true);
virtual S32 update(U32 max_time_ms);
S32 updateQueue(U32 max_time_ms);
virtual S32 update(F32 max_time_ms);
S32 updateQueue(F32 max_time_ms);
void waitOnPending();
void printQueueStats();

View File

@ -24,6 +24,9 @@
* $/LicenseInfo$
*/
// Must turn on conditional declarations in header file so definitions end up
// with proper linkage.
#define LLSD_DEBUG_INFO
#include "linden_common.h"
#include "llsd.h"
@ -31,6 +34,7 @@
#include "../llmath/llmath.h"
#include "llformat.h"
#include "llsdserialize.h"
#include "stringize.h"
#ifndef LL_RELEASE_FOR_DOWNLOAD
#define NAME_UNNAMED_NAMESPACE
@ -50,6 +54,18 @@ namespace
using namespace LLSDUnnamedNamespace;
#endif
namespace llsd
{
// statics
S32 sLLSDAllocationCount = 0;
S32 sLLSDNetObjects = 0;
} // namespace llsd
#define ALLOC_LLSD_OBJECT { llsd::sLLSDNetObjects++; llsd::sLLSDAllocationCount++; }
#define FREE_LLSD_OBJECT { llsd::sLLSDNetObjects--; }
class LLSD::Impl
/**< This class is the abstract base class of the implementation of LLSD
It provides the reference counting implementation, and the default
@ -58,13 +74,10 @@ class LLSD::Impl
*/
{
private:
U32 mUseCount;
protected:
Impl();
enum StaticAllocationMarker { STATIC };
enum StaticAllocationMarker { STATIC_USAGE_COUNT = 0xFFFFFFFF };
Impl(StaticAllocationMarker);
///< This constructor is used for static objects and causes the
// suppresses adjusting the debugging counters when they are
@ -72,8 +85,10 @@ protected:
virtual ~Impl();
bool shared() const { return mUseCount > 1; }
bool shared() const { return (mUseCount > 1) && (mUseCount != STATIC_USAGE_COUNT); }
U32 mUseCount;
public:
static void reset(Impl*& var, Impl* impl);
///< safely set var to refer to the new impl (possibly shared)
@ -128,6 +143,18 @@ public:
virtual LLSD::array_const_iterator beginArray() const { return endArray(); }
virtual LLSD::array_const_iterator endArray() const { static const std::vector<LLSD> empty; return empty.end(); }
virtual void dumpStats() const;
virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
// Container subclasses contain LLSD objects, rather than directly
// containing Impl objects. This helper forwards through LLSD.
void calcStats(const LLSD& llsd, S32 type_counts[], S32 share_counts[]) const
{
safe(llsd.impl).calcStats(type_counts, share_counts);
}
static const Impl& getImpl(const LLSD& llsd) { return safe(llsd.impl); }
static Impl& getImpl(LLSD& llsd) { return safe(llsd.impl); }
static const LLSD& undef();
static U32 sAllocationCount;
@ -360,6 +387,9 @@ namespace
LLSD::map_iterator endMap() { return mData.end(); }
virtual LLSD::map_const_iterator beginMap() const { return mData.begin(); }
virtual LLSD::map_const_iterator endMap() const { return mData.end(); }
virtual void dumpStats() const;
virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
};
ImplMap& ImplMap::makeMap(LLSD::Impl*& var)
@ -414,6 +444,34 @@ namespace
return i->second;
}
void ImplMap::dumpStats() const
{
std::cout << "Map size: " << mData.size() << std::endl;
std::cout << "LLSD Net Objects: " << llsd::sLLSDNetObjects << std::endl;
std::cout << "LLSD allocations: " << llsd::sLLSDAllocationCount << std::endl;
std::cout << "LLSD::Impl Net Objects: " << sOutstandingCount << std::endl;
std::cout << "LLSD::Impl allocations: " << sAllocationCount << std::endl;
Impl::dumpStats();
}
void ImplMap::calcStats(S32 type_counts[], S32 share_counts[]) const
{
LLSD::map_const_iterator iter = beginMap();
while (iter != endMap())
{
//std::cout << " " << (*iter).first << ": " << (*iter).second << std::endl;
Impl::calcStats((*iter).second, type_counts, share_counts);
iter++;
}
// Add in the values for this map
Impl::calcStats(type_counts, share_counts);
}
class ImplArray : public LLSD::Impl
{
private:
@ -449,6 +507,8 @@ namespace
LLSD::array_iterator endArray() { return mData.end(); }
virtual LLSD::array_const_iterator beginArray() const { return mData.begin(); }
virtual LLSD::array_const_iterator endArray() const { return mData.end(); }
virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
};
ImplArray& ImplArray::makeArray(Impl*& var)
@ -490,12 +550,13 @@ namespace
void ImplArray::insert(LLSD::Integer i, const LLSD& v)
{
if (i < 0) {
if (i < 0)
{
return;
}
DataVector::size_type index = i;
if (index >= mData.size())
if (index >= mData.size()) // tbd - sanity check limit for index ?
{
mData.resize(index + 1);
}
@ -543,6 +604,19 @@ namespace
return mData[index];
}
void ImplArray::calcStats(S32 type_counts[], S32 share_counts[]) const
{
LLSD::array_const_iterator iter = beginArray();
while (iter != endArray())
{ // Add values for all items held in the array
Impl::calcStats((*iter), type_counts, share_counts);
iter++;
}
// Add in the values for this array
Impl::calcStats(type_counts, share_counts);
}
}
LLSD::Impl::Impl()
@ -564,8 +638,11 @@ LLSD::Impl::~Impl()
void LLSD::Impl::reset(Impl*& var, Impl* impl)
{
if (impl) ++impl->mUseCount;
if (var && --var->mUseCount == 0)
if (impl && impl->mUseCount != STATIC_USAGE_COUNT)
{
++impl->mUseCount;
}
if (var && var->mUseCount != STATIC_USAGE_COUNT && --var->mUseCount == 0)
{
delete var;
}
@ -574,13 +651,13 @@ void LLSD::Impl::reset(Impl*& var, Impl* impl)
LLSD::Impl& LLSD::Impl::safe(Impl* impl)
{
static Impl theUndefined(STATIC);
static Impl theUndefined(STATIC_USAGE_COUNT);
return impl ? *impl : theUndefined;
}
const LLSD::Impl& LLSD::Impl::safe(const Impl* impl)
{
static Impl theUndefined(STATIC);
static Impl theUndefined(STATIC_USAGE_COUNT);
return impl ? *impl : theUndefined;
}
@ -656,6 +733,43 @@ const LLSD& LLSD::Impl::undef()
return immutableUndefined;
}
void LLSD::Impl::dumpStats() const
{
S32 type_counts[LLSD::TypeLLSDNumTypes + 1];
memset(&type_counts, 0, sizeof(type_counts));
S32 share_counts[LLSD::TypeLLSDNumTypes + 1];
memset(&share_counts, 0, sizeof(share_counts));
// Add info from all the values this object has
calcStats(type_counts, share_counts);
S32 type_index = LLSD::TypeLLSDTypeBegin;
while (type_index != LLSD::TypeLLSDTypeEnd)
{
std::cout << LLSD::typeString((LLSD::Type)type_index) << " type "
<< type_counts[type_index] << " objects, "
<< share_counts[type_index] << " shared"
<< std::endl;
type_index++;
}
}
void LLSD::Impl::calcStats(S32 type_counts[], S32 share_counts[]) const
{
S32 tp = S32(type());
if (0 <= tp && tp < LLSD::TypeLLSDNumTypes)
{
type_counts[tp]++;
if (shared())
{
share_counts[tp]++;
}
}
}
U32 LLSD::Impl::sAllocationCount = 0;
U32 LLSD::Impl::sOutstandingCount = 0;
@ -681,10 +795,10 @@ namespace
}
LLSD::LLSD() : impl(0) { }
LLSD::~LLSD() { Impl::reset(impl, 0); }
LLSD::LLSD() : impl(0) { ALLOC_LLSD_OBJECT; }
LLSD::~LLSD() { FREE_LLSD_OBJECT; Impl::reset(impl, 0); }
LLSD::LLSD(const LLSD& other) : impl(0) { assign(other); }
LLSD::LLSD(const LLSD& other) : impl(0) { ALLOC_LLSD_OBJECT; assign(other); }
void LLSD::assign(const LLSD& other) { Impl::assign(impl, other.impl); }
@ -692,18 +806,18 @@ void LLSD::clear() { Impl::assignUndefined(impl); }
LLSD::Type LLSD::type() const { return safe(impl).type(); }
// Scaler Constructors
LLSD::LLSD(Boolean v) : impl(0) { assign(v); }
LLSD::LLSD(Integer v) : impl(0) { assign(v); }
LLSD::LLSD(Real v) : impl(0) { assign(v); }
LLSD::LLSD(const UUID& v) : impl(0) { assign(v); }
LLSD::LLSD(const String& v) : impl(0) { assign(v); }
LLSD::LLSD(const Date& v) : impl(0) { assign(v); }
LLSD::LLSD(const URI& v) : impl(0) { assign(v); }
LLSD::LLSD(const Binary& v) : impl(0) { assign(v); }
// Scalar Constructors
LLSD::LLSD(Boolean v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(Integer v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(Real v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const UUID& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const String& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const Date& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const URI& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const Binary& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
// Convenience Constructors
LLSD::LLSD(F32 v) : impl(0) { assign((Real)v); }
LLSD::LLSD(F32 v) : impl(0) { ALLOC_LLSD_OBJECT; assign((Real)v); }
// Scalar Assignment
void LLSD::assign(Boolean v) { safe(impl).assign(impl, v); }
@ -726,7 +840,7 @@ LLSD::URI LLSD::asURI() const { return safe(impl).asURI(); }
LLSD::Binary LLSD::asBinary() const { return safe(impl).asBinary(); }
// const char * helpers
LLSD::LLSD(const char* v) : impl(0) { assign(v); }
LLSD::LLSD(const char* v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
void LLSD::assign(const char* v)
{
if(v) assign(std::string(v));
@ -784,9 +898,6 @@ LLSD& LLSD::operator[](Integer i)
const LLSD& LLSD::operator[](Integer i) const
{ return safe(impl).ref(i); }
U32 LLSD::allocationCount() { return Impl::sAllocationCount; }
U32 LLSD::outstandingCount() { return Impl::sOutstandingCount; }
static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
{
// sStorage is used to hold the string representation of the llsd last
@ -801,15 +912,9 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
{
std::ostringstream out;
if (useXMLFormat)
{
LLSDXMLStreamer xml_streamer(llsd);
out << xml_streamer;
}
out << LLSDXMLStreamer(llsd);
else
{
LLSDNotationStreamer notation_streamer(llsd);
out << notation_streamer;
}
out << LLSDNotationStreamer(llsd);
out_string = out.str();
}
int len = out_string.length();
@ -840,3 +945,38 @@ LLSD::array_iterator LLSD::beginArray() { return makeArray(impl).beginArray();
LLSD::array_iterator LLSD::endArray() { return makeArray(impl).endArray(); }
LLSD::array_const_iterator LLSD::beginArray() const{ return safe(impl).beginArray(); }
LLSD::array_const_iterator LLSD::endArray() const { return safe(impl).endArray(); }
namespace llsd
{
U32 allocationCount() { return LLSD::Impl::sAllocationCount; }
U32 outstandingCount() { return LLSD::Impl::sOutstandingCount; }
// Diagnostic dump of contents in an LLSD object
void dumpStats(const LLSD& llsd) { LLSD::Impl::getImpl(llsd).dumpStats(); }
} // namespace llsd
// static
std::string LLSD::typeString(Type type)
{
static const char * sTypeNameArray[] = {
"Undefined",
"Boolean",
"Integer",
"Real",
"String",
"UUID",
"Date",
"URI",
"Binary",
"Map",
"Array"
};
if (0 <= type && type < LL_ARRAY_SIZE(sTypeNameArray))
{
return sTypeNameArray[type];
}
return STRINGIZE("** invalid type value " << type);
}

View File

@ -40,10 +40,10 @@
/**
LLSD provides a flexible data system similar to the data facilities of
dynamic languages like Perl and Python. It is created to support exchange
of structured data between loosly coupled systems. (Here, "loosly coupled"
of structured data between loosely coupled systems. (Here, "loosely coupled"
means not compiled together into the same module.)
Data in such exchanges must be highly tollerant of changes on either side
Data in such exchanges must be highly tolerant of changes on either side
such as:
- recompilation
- implementation in a different langauge
@ -51,19 +51,19 @@
- execution of older versions (with fewer parameters)
To this aim, the C++ API of LLSD strives to be very easy to use, and to
default to "the right thing" whereever possible. It is extremely tollerant
default to "the right thing" wherever possible. It is extremely tolerant
of errors and unexpected situations.
The fundimental class is LLSD. LLSD is a value holding object. It holds
The fundamental class is LLSD. LLSD is a value holding object. It holds
one value that is either undefined, one of the scalar types, or a map or an
array. LLSD objects have value semantics (copying them copies the value,
though it can be considered efficient, due to shareing.), and mutable.
though it can be considered efficient, due to sharing), and mutable.
Undefined is the singular value given to LLSD objects that are not
initialized with any data. It is also used as the return value for
operations that return an LLSD,
operations that return an LLSD.
The sclar data types are:
The scalar data types are:
- Boolean - true or false
- Integer - a 32 bit signed integer
- Real - a 64 IEEE 754 floating point value
@ -80,9 +80,73 @@
An array is a sequence of zero or more LLSD values.
Thread Safety
In general, these LLSD classes offer *less* safety than STL container
classes. Implementations prior to this one were unsafe even when
completely unrelated LLSD trees were in two threads due to reference
sharing of special 'undefined' values that participated in the reference
counting mechanism.
The dereference-before-refcount and aggressive tree sharing also make
it impractical to share an LLSD across threads. A strategy of passing
ownership or a copy to another thread is still difficult due to a lack
of a cloning interface but it can be done with some care.
One way of transferring ownership is as follows:
void method(const LLSD input) {
...
LLSD * xfer_tree = new LLSD();
{
// Top-level values
(* xfer_tree)['label'] = "Some text";
(* xfer_tree)['mode'] = APP_MODE_CONSTANT;
// There will be a second-level
LLSD subtree(LLSD::emptyMap());
(* xfer_tree)['subtree'] = subtree;
// Do *not* copy from LLSD objects via LLSD
// intermediaries. Only use plain-old-data
// types as intermediaries to prevent reference
// sharing.
subtree['value1'] = input['value1'].asInteger();
subtree['value2'] = input['value2'].asString();
// Close scope and drop 'subtree's reference.
// Only xfer_tree has a reference to the second
// level data.
}
...
// Transfer the LLSD pointer to another thread. Ownership
// transfers, this thread no longer has a reference to any
// part of the xfer_tree and there's nothing to free or
// release here. Receiving thread does need to delete the
// pointer when it is done with the LLSD. Transfer
// mechanism must perform correct data ordering operations
// as dictated by architecture.
other_thread.sendMessageAndPointer("Take This", xfer_tree);
xfer_tree = NULL;
Avoid this pattern which provides half of a race condition:
void method(const LLSD input) {
...
LLSD xfer_tree(LLSD::emptyMap());
xfer_tree['label'] = "Some text";
xfer_tree['mode'] = APP_MODE_CONSTANT;
...
other_thread.sendMessageAndPointer("Take This", xfer_tree);
@nosubgrouping
*/
// Normally undefined, used for diagnostics
//#define LLSD_DEBUG_INFO 1
class LL_COMMON_API LLSD
{
public:
@ -202,7 +266,7 @@ public:
//@}
/** @name Character Pointer Helpers
These are helper routines to make working with char* the same as easy as
These are helper routines to make working with char* as easy as
working with strings.
*/
//@{
@ -266,7 +330,7 @@ public:
/** @name Type Testing */
//@{
enum Type {
TypeUndefined,
TypeUndefined = 0,
TypeBoolean,
TypeInteger,
TypeReal,
@ -276,7 +340,10 @@ public:
TypeURI,
TypeBinary,
TypeMap,
TypeArray
TypeArray,
TypeLLSDTypeEnd,
TypeLLSDTypeBegin = TypeUndefined,
TypeLLSDNumTypes = (TypeLLSDTypeEnd - TypeLLSDTypeBegin)
};
Type type() const;
@ -302,7 +369,7 @@ public:
If you get a linker error about these being missing, you have made
mistake in your code. DO NOT IMPLEMENT THESE FUNCTIONS as a fix.
All of thse problems stem from trying to support char* in LLSD or in
All of these problems stem from trying to support char* in LLSD or in
std::string. There are too many automatic casts that will lead to
using an arbitrary pointer or scalar type to std::string.
*/
@ -311,7 +378,7 @@ public:
void assign(const void*); ///< assign from arbitrary pointers
LLSD& operator=(const void*); ///< assign from arbitrary pointers
bool has(Integer) const; ///< has only works for Maps
bool has(Integer) const; ///< has() only works for Maps
//@}
/** @name Implementation */
@ -320,13 +387,7 @@ public:
class Impl;
private:
Impl* impl;
//@}
/** @name Unit Testing Interface */
//@{
public:
static U32 allocationCount(); ///< how many Impls have been made
static U32 outstandingCount(); ///< how many Impls are still alive
friend class LLSD::Impl;
//@}
private:
@ -338,6 +399,10 @@ private:
/// Returns Notation version of llsd -- only to be called from debugger
static const char *dump(const LLSD &llsd);
//@}
public:
static std::string typeString(Type type); // Return human-readable type as a string
};
struct llsd_select_bool : public std::unary_function<LLSD, LLSD::Boolean>
@ -385,9 +450,32 @@ struct llsd_select_string : public std::unary_function<LLSD, LLSD::String>
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd);
namespace llsd
{
#ifdef LLSD_DEBUG_INFO
/** @name Unit Testing Interface */
//@{
LL_COMMON_API void dumpStats(const LLSD&); ///< Output information on object and usage
/// @warn THE FOLLOWING COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED
/// ENVIRONMENT.
///
/// These counts track LLSD::Impl (hidden) objects.
LL_COMMON_API U32 allocationCount(); ///< how many Impls have been made
LL_COMMON_API U32 outstandingCount(); ///< how many Impls are still alive
/// These counts track LLSD (public) objects.
LL_COMMON_API extern S32 sLLSDAllocationCount; ///< Number of LLSD objects ever created
LL_COMMON_API extern S32 sLLSDNetObjects; ///< Number of LLSD objects that exist
#endif
//@}
} // namespace llsd
/** QUESTIONS & TO DOS
- Would Binary be more convenient as usigned char* buffer semantics?
- Should Binary be convertable to/from String, and if so how?
- Would Binary be more convenient as unsigned char* buffer semantics?
- Should Binary be convertible to/from String, and if so how?
- as UTF8 encoded strings (making not like UUID<->String)
- as Base64 or Base96 encoded (making like UUID<->String)
- Conversions to std::string and LLUUID do not result in easy assignment

View File

@ -110,7 +110,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
if (!strncasecmp(LEGACY_NON_HEADER, hdr_buf, strlen(LEGACY_NON_HEADER))) /* Flawfinder: ignore */
{
legacy_no_header = true;
inbuf = str.gcount();
inbuf = (int)str.gcount();
}
else
{
@ -343,7 +343,7 @@ std::istream& LLSDParser::get(
char delim) const
{
istr.get(s, n, delim);
if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
return istr;
}
@ -353,7 +353,7 @@ std::istream& LLSDParser::get(
char delim) const
{
istr.get(sb, delim);
if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
return istr;
}
@ -377,7 +377,7 @@ std::istream& LLSDParser::read(
std::streamsize n) const
{
istr.read(s, n);
if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
return istr;
}
@ -789,7 +789,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
if(len)
{
value.resize(len);
account(fullread(istr, (char *)&value[0], len));
account((int)fullread(istr, (char *)&value[0], len));
}
c = get(istr); // strip off the trailing double-quote
data = value;
@ -1069,7 +1069,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
if(size > 0)
{
value.resize(size);
account(fullread(istr, (char*)&value[0], size));
account((int)fullread(istr, (char*)&value[0], size));
}
data = value;
}
@ -1200,7 +1200,7 @@ bool LLSDBinaryParser::parseString(
if(size)
{
buf.resize(size);
account(fullread(istr, &buf[0], size));
account((int)fullread(istr, &buf[0], size));
value.assign(buf.begin(), buf.end());
}
return true;
@ -1642,7 +1642,7 @@ int deserialize_string_raw(
const S32 BUF_LEN = 20;
char buf[BUF_LEN]; /* Flawfinder: ignore */
istr.get(buf, BUF_LEN - 1, ')');
count += istr.gcount();
count += (int)istr.gcount();
int c = istr.get();
c = istr.get();
count += 2;
@ -1657,7 +1657,7 @@ int deserialize_string_raw(
if(len)
{
buf.resize(len);
count += fullread(istr, (char *)&buf[0], len);
count += (int)fullread(istr, (char *)&buf[0], len);
value.assign(buf.begin(), buf.end());
}
c = istr.get();

View File

@ -464,7 +464,7 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data)
}
}
status = XML_ParseBuffer(mParser, num_read, false);
status = XML_ParseBuffer(mParser, (int)num_read, false);
if (status == XML_STATUS_ERROR)
{
break;

View File

@ -308,7 +308,7 @@ class LLSDParam<T> \
{ \
public: \
LLSDParam(const LLSD& value): \
_value(value.AS()) \
_value((T)value.AS()) \
{} \
\
operator T() const { return _value; } \

View File

@ -593,7 +593,7 @@ void LLStatTime::stop()
{
if ( LLStatAccum::SCALE_PER_FRAME == scale )
{
return mTotalTimeInFrame;
return (F32)mTotalTimeInFrame;
}
else
{

View File

@ -608,6 +608,7 @@ LLCPUInfo::LLCPUInfo()
out << " (" << mCPUMHz << " MHz)";
}
mCPUString = out.str();
LLStringUtil::trim(mCPUString);
}
bool LLCPUInfo::hasAltivec() const
@ -1363,11 +1364,21 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
if (! src) goto err;
do
while ((bytes = (S32)fread(buffer, sizeof(U8), COMPRESS_BUFFER_SIZE, src)) > 0)
{
bytes = (S32)fread(buffer, sizeof(U8), COMPRESS_BUFFER_SIZE,src);
gzwrite(dst, buffer, bytes);
} while(feof(src) == 0);
if (gzwrite(dst, buffer, bytes) <= 0)
{
llwarns << "gzwrite failed: " << gzerror(dst, NULL) << llendl;
goto err;
}
}
if (ferror(src))
{
llwarns << "Error reading " << srcfile << llendl;
goto err;
}
gzclose(dst);
dst = NULL;
#if LL_WINDOWS

View File

@ -337,11 +337,7 @@ LLMutex::~LLMutex()
void LLMutex::lock()
{
#if LL_DARWIN
if (mLockingThread == LLThread::currentID())
#else
if (mLockingThread == sThreadID)
#endif
if(isSelfLocked())
{ //redundant lock
mCount++;
return;
@ -398,6 +394,15 @@ bool LLMutex::isLocked()
}
}
bool LLMutex::isSelfLocked()
{
#if LL_DARWIN
return mLockingThread == LLThread::currentID();
#else
return mLockingThread == sThreadID;
#endif
}
U32 LLMutex::lockingThread() const
{
return mLockingThread;

View File

@ -151,6 +151,7 @@ public:
void lock(); // blocks
void unlock();
bool isLocked(); // non-blocking, but does do a lock/unlock so not free
bool isSelfLocked(); //return true if locked in a same thread
U32 lockingThread() const; //get ID of locking thread
protected:
@ -187,11 +188,14 @@ public:
LLMutexLock(LLMutex* mutex)
{
mMutex = mutex;
mMutex->lock();
if(mMutex)
mMutex->lock();
}
~LLMutexLock()
{
mMutex->unlock();
if(mMutex)
mMutex->unlock();
}
private:
LLMutex* mMutex;

View File

@ -83,7 +83,7 @@ U32 micro_sleep(U64 us, U32 max_yields)
{
// max_yields is unused; just fiddle with it to avoid warnings.
max_yields = 0;
ms_sleep(us / 1000);
ms_sleep((U32)(us / 1000));
return 0;
}
#elif LL_LINUX || LL_SOLARIS || LL_DARWIN

View File

@ -28,8 +28,8 @@
#define LL_LLVERSIONVIEWER_H
const S32 LL_VERSION_MAJOR = 3;
const S32 LL_VERSION_MINOR = 2;
const S32 LL_VERSION_PATCH = 4;
const S32 LL_VERSION_MINOR = 3;
const S32 LL_VERSION_PATCH = 2;
const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Developer";

View File

@ -81,7 +81,7 @@ void LLWorkerThread::clearDeleteList()
}
// virtual
S32 LLWorkerThread::update(U32 max_time_ms)
S32 LLWorkerThread::update(F32 max_time_ms)
{
S32 res = LLQueuedThread::update(max_time_ms);
// Delete scheduled workers

View File

@ -86,7 +86,7 @@ public:
LLWorkerThread(const std::string& name, bool threaded = true, bool should_pause = false);
~LLWorkerThread();
/*virtual*/ S32 update(U32 max_time_ms);
/*virtual*/ S32 update(F32 max_time_ms);
handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL);

2
indra/llcrashlogger/llcrashlogger.cpp Executable file → Normal file
View File

@ -250,7 +250,7 @@ void LLCrashLogger::gatherFiles()
if(minidump_stream.is_open())
{
minidump_stream.seekg(0, std::ios::end);
size_t length = minidump_stream.tellg();
size_t length = (size_t)minidump_stream.tellg();
minidump_stream.seekg(0, std::ios::beg);
LLSD::Binary data;

0
indra/llcrashlogger/llcrashlogger.h Executable file → Normal file
View File

View File

@ -195,7 +195,7 @@ U8* LLImageBase::allocateData(S32 size)
mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
if (!mData)
{
llwarns << "allocate image data: " << size << llendl;
llwarns << "Failed to allocate image data size [" << size << "]" << llendl;
size = 0 ;
mWidth = mHeight = 0 ;
mBadBufferAllocation = true ;

View File

@ -501,10 +501,10 @@ void LLImageCompressionTester::outputTestRecord(LLSD *sd)
F32 decompressionRate = 0.0f;
F32 compressionRate = 0.0f;
F32 totalkBInDecompression = (F32)(mTotalBytesInDecompression) / 1000.0;
F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.0;
F32 totalkBInCompression = (F32)(mTotalBytesInCompression) / 1000.0;
F32 totalkBOutCompression = (F32)(mTotalBytesOutCompression) / 1000.0;
F32 totalkBInDecompression = (F32)(mTotalBytesInDecompression) / 1000.f;
F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.f;
F32 totalkBInCompression = (F32)(mTotalBytesInCompression) / 1000.f;
F32 totalkBOutCompression = (F32)(mTotalBytesOutCompression) / 1000.f;
if (!is_approx_zero(mTotalTimeDecompression))
{

View File

@ -60,6 +60,12 @@ BOOL LLImagePNG::updateData()
// Decode the PNG data and extract sizing information
LLPngWrapper pngWrapper;
if (!pngWrapper.isValidPng(getData()))
{
setLastError("LLImagePNG data does not have a valid PNG header!");
return FALSE;
}
LLPngWrapper::ImageInfo infop;
if (! pngWrapper.readPng(getData(), NULL, &infop))
{
@ -90,6 +96,12 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time)
// Decode the PNG data into the raw image
LLPngWrapper pngWrapper;
if (!pngWrapper.isValidPng(getData()))
{
setLastError("LLImagePNG data does not have a valid PNG header!");
return FALSE;
}
if (! pngWrapper.readPng(getData(), raw_image))
{
setLastError(pngWrapper.getErrorMessage());

View File

@ -46,7 +46,7 @@ LLImageDecodeThread::~LLImageDecodeThread()
// MAIN THREAD
// virtual
S32 LLImageDecodeThread::update(U32 max_time_ms)
S32 LLImageDecodeThread::update(F32 max_time_ms)
{
LLMutexLock lock(mCreationMutex);
for (creation_list_t::iterator iter = mCreationList.begin();

View File

@ -78,7 +78,7 @@ public:
handle_t decodeImage(LLImageFormatted* image,
U32 priority, S32 discard, BOOL needs_aux,
Responder* responder);
S32 update(U32 max_time_ms);
S32 update(F32 max_time_ms);
// Used by unit tests to check the consistency of the thread instance
S32 tut_size();

View File

@ -48,6 +48,31 @@ LLGlobalEconomy::LLGlobalEconomy()
LLGlobalEconomy::~LLGlobalEconomy()
{ }
void LLGlobalEconomy::addObserver(LLEconomyObserver* observer)
{
mObservers.push_back(observer);
}
void LLGlobalEconomy::removeObserver(LLEconomyObserver* observer)
{
std::list<LLEconomyObserver*>::iterator it =
std::find(mObservers.begin(), mObservers.end(), observer);
if (it != mObservers.end())
{
mObservers.erase(it);
}
}
void LLGlobalEconomy::notifyObservers()
{
for (std::list<LLEconomyObserver*>::iterator it = mObservers.begin();
it != mObservers.end();
++it)
{
(*it)->onEconomyDataChange();
}
}
// static
void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data)
{
@ -88,6 +113,8 @@ void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy*
econ_data->setTeleportPriceExponent(f);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i);
econ_data->setPriceGroupCreate(i);
econ_data->notifyObservers();
}
S32 LLGlobalEconomy::calculateTeleportCost(F32 distance) const

View File

@ -31,6 +31,16 @@
class LLMessageSystem;
class LLVector3;
/**
* Register an observer to be notified of economy data updates coming from server.
*/
class LLEconomyObserver
{
public:
virtual ~LLEconomyObserver() {}
virtual void onEconomyDataChange() = 0;
};
class LLGlobalEconomy
{
public:
@ -46,6 +56,10 @@ public:
virtual void print();
void addObserver(LLEconomyObserver* observer);
void removeObserver(LLEconomyObserver* observer);
void notifyObservers();
static void processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data);
S32 calculateTeleportCost(F32 distance) const;
@ -89,6 +103,8 @@ private:
S32 mTeleportMinPrice;
F32 mTeleportPriceExponent;
S32 mPriceGroupCreate;
std::list<LLEconomyObserver*> mObservers;
};

View File

@ -405,7 +405,7 @@ U32 LLInventoryItem::getCRC32() const
//lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl;
crc += mSaleInfo.getCRC32();
//lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl;
crc += mCreationDate;
crc += (U32)mCreationDate;
//lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl;
return crc;
}
@ -521,7 +521,7 @@ void LLInventoryItem::packMessage(LLMessageSystem* msg) const
mSaleInfo.packMessage(msg);
msg->addStringFast(_PREHASH_Name, mName);
msg->addStringFast(_PREHASH_Description, mDescription);
msg->addS32Fast(_PREHASH_CreationDate, mCreationDate);
msg->addS32Fast(_PREHASH_CreationDate, (S32)mCreationDate);
U32 crc = getCRC32();
msg->addU32Fast(_PREHASH_CRC, crc);
}

View File

@ -75,10 +75,6 @@ set(llmath_HEADER_FILES
llvector4a.h
llvector4a.inl
llvector4logical.h
llv4math.h
llv4matrix3.h
llv4matrix4.h
llv4vector3.h
llvolume.h
llvolumemgr.h
llvolumeoctree.h

View File

@ -174,7 +174,7 @@ private:
F32 _log(const F32& a) const { return log(a); }
F32 _exp(const F32& a) const { return exp(a); }
F32 _fabs(const F32& a) const { return fabs(a); }
F32 _floor(const F32& a) const { return llfloor(a); }
F32 _floor(const F32& a) const { return (F32)llfloor(a); }
F32 _ceil(const F32& a) const { return llceil(a); }
F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }

View File

@ -26,80 +26,87 @@
#ifndef LL_LLCOORD_H
#define LL_LLCOORD_H
template<typename> class LLCoord;
struct LL_COORD_TYPE_GL;
struct LL_COORD_TYPE_WINDOW;
struct LL_COORD_TYPE_SCREEN;
typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
struct LLCoordCommon
{
LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {}
LLCoordCommon() : mX(0), mY(0) {}
S32 mX;
S32 mY;
};
// A two-dimensional pixel value
class LLCoord
template<typename COORD_FRAME>
class LLCoord : protected COORD_FRAME
{
public:
S32 mX;
S32 mY;
typedef LLCoord<COORD_FRAME> self_t;
typename COORD_FRAME::value_t mX;
typename COORD_FRAME::value_t mY;
LLCoord(): mX(0), mY(0)
{}
LLCoord(S32 x, S32 y): mX(x), mY(y)
{}
virtual ~LLCoord()
LLCoord(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y): mX(x), mY(y)
{}
virtual void set(S32 x, S32 y) { mX = x; mY = y; }
LLCoord(const LLCoordCommon& other)
{
COORD_FRAME::convertFromCommon(other);
}
LLCoordCommon convert() const
{
return COORD_FRAME::convertToCommon();
}
void set(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y) { mX = x; mY = y;}
bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const self_t& other) const { return !(*this == other); }
static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast<const self_t&>(self); }
static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast<self_t&>(self); }
};
// GL coordinates start in the client region of a window,
// with left, bottom = 0, 0
class LLCoordGL : public LLCoord
struct LL_COORD_TYPE_GL
{
public:
LLCoordGL() : LLCoord()
{}
LLCoordGL(S32 x, S32 y) : LLCoord(x, y)
{}
bool operator==(const LLCoordGL& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordGL& other) const { return !(*this == other); }
typedef S32 value_t;
LLCoordCommon convertToCommon() const
{
const LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
return LLCoordCommon(self.mX, self.mY);
}
void convertFromCommon(const LLCoordCommon& from)
{
LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
self.mX = from.mX;
self.mY = from.mY;
}
};
//bool operator ==(const LLCoordGL& a, const LLCoordGL& b);
// Window coords include things like window borders,
// menu regions, etc.
class LLCoordWindow : public LLCoord
struct LL_COORD_TYPE_WINDOW
{
public:
LLCoordWindow() : LLCoord()
{}
LLCoordWindow(S32 x, S32 y) : LLCoord(x, y)
{}
bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
typedef S32 value_t;
LLCoordCommon convertToCommon() const;
void convertFromCommon(const LLCoordCommon& from);
};
// Screen coords start at left, top = 0, 0
class LLCoordScreen : public LLCoord
struct LL_COORD_TYPE_SCREEN
{
public:
LLCoordScreen() : LLCoord()
{}
LLCoordScreen(S32 x, S32 y) : LLCoord(x, y)
{}
bool operator==(const LLCoordScreen& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordScreen& other) const { return !(*this == other); }
};
typedef S32 value_t;
class LLCoordFont : public LLCoord
{
public:
F32 mZ;
LLCoordFont() : LLCoord(), mZ(0.f)
{}
LLCoordFont(S32 x, S32 y, F32 z = 0) : LLCoord(x,y), mZ(z)
{}
void set(S32 x, S32 y) { LLCoord::set(x,y); mZ = 0.f; }
void set(S32 x, S32 y, F32 z) { mX = x; mY = y; mZ = z; }
bool operator==(const LLCoordFont& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordFont& other) const { return !(*this == other); }
LLCoordCommon convertToCommon() const;
void convertFromCommon(const LLCoordCommon& from);
};
#endif

View File

@ -80,8 +80,8 @@ public:
typedef LLOctreeTraveler<T> oct_traveler;
typedef LLTreeTraveler<T> tree_traveler;
typedef typename std::set<LLPointer<T> > element_list;
typedef typename std::set<LLPointer<T> >::iterator element_iter;
typedef typename std::set<LLPointer<T> >::const_iterator const_element_iter;
typedef typename element_list::iterator element_iter;
typedef typename element_list::const_iterator const_element_iter;
typedef typename std::vector<LLTreeListener<T>*>::iterator tree_listener_iter;
typedef typename std::vector<LLOctreeNode<T>* > child_list;
typedef LLTreeNode<T> BaseType;
@ -114,6 +114,8 @@ public:
mOctant = ((oct_node*) mParent)->getOctant(mCenter);
}
mElementCount = 0;
clearChildren();
}
@ -219,11 +221,11 @@ public:
void accept(oct_traveler* visitor) { visitor->visit(this); }
virtual bool isLeaf() const { return mChild.empty(); }
U32 getElementCount() const { return mData.size(); }
U32 getElementCount() const { return mElementCount; }
element_list& getData() { return mData; }
const element_list& getData() const { return mData; }
U32 getChildCount() const { return mChild.size(); }
U32 getChildCount() const { return mChildCount; }
oct_node* getChild(U32 index) { return mChild[index]; }
const oct_node* getChild(U32 index) const { return mChild[index]; }
child_list& getChildren() { return mChild; }
@ -300,17 +302,13 @@ public:
if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||
(data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity)))
{ //it belongs here
#if LL_OCTREE_PARANOIA_CHECK
//if this is a redundant insertion, error out (should never happen)
if (mData.find(data) != mData.end())
{
llwarns << "Redundant octree insertion detected. " << data << llendl;
return false;
}
#endif
llassert(mData.find(data) == mData.end());
mData.insert(data);
BaseType::insert(data);
mElementCount = mData.size();
return true;
}
else
@ -346,6 +344,8 @@ public:
{
mData.insert(data);
BaseType::insert(data);
mElementCount = mData.size();
return true;
}
@ -399,6 +399,7 @@ public:
if (mData.find(data) != mData.end())
{ //we have data
mData.erase(data);
mElementCount = mData.size();
notifyRemoval(data);
checkAlive();
return true;
@ -436,6 +437,7 @@ public:
if (mData.find(data) != mData.end())
{
mData.erase(data);
mElementCount = mData.size();
notifyRemoval(data);
llwarns << "FOUND!" << llendl;
checkAlive();
@ -452,7 +454,7 @@ public:
void clearChildren()
{
mChild.clear();
mChildCount = 0;
U32* foo = (U32*) mChildMap;
foo[0] = foo[1] = 0xFFFFFFFF;
}
@ -512,9 +514,10 @@ public:
}
#endif
mChildMap[child->getOctant()] = (U8) mChild.size();
mChildMap[child->getOctant()] = mChildCount;
mChild.push_back(child);
++mChildCount;
child->setParent(this);
if (!silent)
@ -534,21 +537,20 @@ public:
oct_listener* listener = getOctListener(i);
listener->handleChildRemoval(this, getChild(index));
}
if (destroy)
{
mChild[index]->destroy();
delete mChild[index];
}
mChild.erase(mChild.begin() + index);
--mChildCount;
//rebuild child map
U32* foo = (U32*) mChildMap;
foo[0] = foo[1] = 0xFFFFFFFF;
for (U32 i = 0; i < mChild.size(); ++i)
for (U32 i = 0; i < mChildCount; ++i)
{
mChildMap[mChild[i]->getOctant()] = i;
}
@ -601,8 +603,10 @@ protected:
child_list mChild;
U8 mChildMap[8];
U32 mChildCount;
element_list mData;
U32 mElementCount;
};

View File

@ -1,141 +0,0 @@
/**
* @file llv4math.h
* @brief LLV4* class header file - vector processor enabled math
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLV4MATH_H
#define LL_LLV4MATH_H
// *NOTE: We do not support SSE acceleration on Windows builds.
// Our minimum specification for the viewer includes 1 GHz Athlon processors,
// which covers the Athlon Thunderbird series that does not support SSE.
//
// Our header files include statements like this
// const F32 HAVOK_TIMESTEP = 1.f / 45.f;
// This creates "globals" that are included in each .obj file. If a single
// .cpp file has SSE code generation turned on (eg, llviewerjointmesh_sse.cpp)
// these globals will be initialized using SSE instructions. This causes SL
// to crash before main() on processors without SSE. Untangling all these
// headers/variables is too much work for the small performance gains of
// vectorization.
//
// Therefore we only support vectorization on builds where the everything is
// built with SSE or Altivec. See https://jira.secondlife.com/browse/VWR-1610
// and https://jira.lindenlab.com/browse/SL-47720 for details.
//
// Sorry the code is such a mess. JC
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4MATH - GNUC
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#if LL_GNUC && __GNUC__ >= 4 && __SSE__
#define LL_VECTORIZE 1
#if LL_DARWIN
#include <Accelerate/Accelerate.h>
#include <xmmintrin.h>
typedef vFloat V4F32;
#else
#include <xmmintrin.h>
typedef float V4F32 __attribute__((vector_size(16)));
#endif
#endif
#if LL_GNUC
#define LL_LLV4MATH_ALIGN_PREFIX
#define LL_LLV4MATH_ALIGN_POSTFIX __attribute__((aligned(16)))
#endif
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4MATH - MSVC
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Only vectorize if the entire Windows build uses SSE.
// _M_IX86_FP is set when SSE code generation is turned on, and I have
// confirmed this in VS2003, VS2003 SP1, and VS2005. JC
#if LL_MSVC && _M_IX86_FP
#define LL_VECTORIZE 1
#include <xmmintrin.h>
typedef __m128 V4F32;
#endif
#if LL_MSVC
#define LL_LLV4MATH_ALIGN_PREFIX __declspec(align(16))
#define LL_LLV4MATH_ALIGN_POSTFIX
#endif
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4MATH - default - no vectorization
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#if !LL_VECTORIZE
#define LL_VECTORIZE 0
struct V4F32 { F32 __pad__[4]; };
inline F32 llv4lerp(F32 a, F32 b, F32 w) { return ( b - a ) * w + a; }
#endif
#ifndef LL_LLV4MATH_ALIGN_PREFIX
# define LL_LLV4MATH_ALIGN_PREFIX
#endif
#ifndef LL_LLV4MATH_ALIGN_POSTFIX
# define LL_LLV4MATH_ALIGN_POSTFIX
#endif
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4MATH
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#define LLV4_NUM_AXIS 4
class LLV4Vector3;
class LLV4Matrix3;
class LLV4Matrix4;
#endif

View File

@ -1,220 +0,0 @@
/**
* @file llviewerjointmesh.cpp
* @brief LLV4* class header file - vector processor enabled math
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLV4MATRIX3_H
#define LL_LLV4MATRIX3_H
#include "llv4math.h"
#include "llv4vector3.h"
#include "m3math.h" // for operator LLMatrix3()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix3
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
LL_LLV4MATH_ALIGN_PREFIX
class LLV4Matrix3
{
public:
union {
F32 mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS];
V4F32 mV[LLV4_NUM_AXIS];
};
void lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w);
void multiply(const LLVector3 &a, LLVector3& out) const;
void multiply(const LLVector4 &a, LLV4Vector3& out) const;
void multiply(const LLVector3 &a, LLV4Vector3& out) const;
const LLV4Matrix3& transpose();
const LLV4Matrix3& operator=(const LLMatrix3& a);
operator LLMatrix3() const { return (reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0])))->getMat3(); }
friend LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b);
}
LL_LLV4MATH_ALIGN_POSTFIX;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix3 - SSE
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#if LL_VECTORIZE
inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w)
{
__m128 vw = _mm_set1_ps(w);
mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a
mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]);
mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]);
}
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const
{
LLV4Vector3 j;
j.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
o.setVec(j.mV);
}
inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const
{
o.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
}
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const
{
o.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix3
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#else
inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w)
{
mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w);
mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w);
mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w);
mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w);
mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w);
mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w);
mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w);
mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w);
mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w);
}
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const
{
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
a.mV[VY] * mMatrix[VY][VX] +
a.mV[VZ] * mMatrix[VZ][VX],
a.mV[VX] * mMatrix[VX][VY] +
a.mV[VY] * mMatrix[VY][VY] +
a.mV[VZ] * mMatrix[VZ][VY],
a.mV[VX] * mMatrix[VX][VZ] +
a.mV[VY] * mMatrix[VY][VZ] +
a.mV[VZ] * mMatrix[VZ][VZ]);
}
inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const
{
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
a.mV[VY] * mMatrix[VY][VX] +
a.mV[VZ] * mMatrix[VZ][VX],
a.mV[VX] * mMatrix[VX][VY] +
a.mV[VY] * mMatrix[VY][VY] +
a.mV[VZ] * mMatrix[VZ][VY],
a.mV[VX] * mMatrix[VX][VZ] +
a.mV[VY] * mMatrix[VY][VZ] +
a.mV[VZ] * mMatrix[VZ][VZ]);
}
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const
{
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
a.mV[VY] * mMatrix[VY][VX] +
a.mV[VZ] * mMatrix[VZ][VX],
a.mV[VX] * mMatrix[VX][VY] +
a.mV[VY] * mMatrix[VY][VY] +
a.mV[VZ] * mMatrix[VZ][VY],
a.mV[VX] * mMatrix[VX][VZ] +
a.mV[VY] * mMatrix[VY][VZ] +
a.mV[VZ] * mMatrix[VZ][VZ]);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix3
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#endif
inline const LLV4Matrix3& LLV4Matrix3::transpose()
{
#if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS)
_MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]);
return *this;
#else
F32 temp;
temp = mMatrix[VX][VY]; mMatrix[VX][VY] = mMatrix[VY][VX]; mMatrix[VY][VX] = temp;
temp = mMatrix[VX][VZ]; mMatrix[VX][VZ] = mMatrix[VZ][VX]; mMatrix[VZ][VX] = temp;
temp = mMatrix[VY][VZ]; mMatrix[VY][VZ] = mMatrix[VZ][VY]; mMatrix[VZ][VY] = temp;
#endif
return *this;
}
inline const LLV4Matrix3& LLV4Matrix3::operator=(const LLMatrix3& a)
{
memcpy(mMatrix[VX], a.mMatrix[VX], sizeof(F32) * 3 );
memcpy(mMatrix[VY], a.mMatrix[VY], sizeof(F32) * 3 );
memcpy(mMatrix[VZ], a.mMatrix[VZ], sizeof(F32) * 3 );
return *this;
}
inline LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b)
{
return LLVector3(
a.mV[VX] * b.mMatrix[VX][VX] +
a.mV[VY] * b.mMatrix[VY][VX] +
a.mV[VZ] * b.mMatrix[VZ][VX],
a.mV[VX] * b.mMatrix[VX][VY] +
a.mV[VY] * b.mMatrix[VY][VY] +
a.mV[VZ] * b.mMatrix[VZ][VY],
a.mV[VX] * b.mMatrix[VX][VZ] +
a.mV[VY] * b.mMatrix[VY][VZ] +
a.mV[VZ] * b.mMatrix[VZ][VZ] );
}
#endif

View File

@ -1,249 +0,0 @@
/**
* @file llviewerjointmesh.cpp
* @brief LLV4* class header file - vector processor enabled math
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLV4MATRIX4_H
#define LL_LLV4MATRIX4_H
#include "llv4math.h"
#include "llv4matrix3.h" // just for operator LLV4Matrix3()
#include "llv4vector3.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix4
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
LL_LLV4MATH_ALIGN_PREFIX
class LLV4Matrix4
{
public:
union {
F32 mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS];
V4F32 mV[LLV4_NUM_AXIS];
};
void lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w);
void multiply(const LLVector3 &a, LLVector3& o) const;
void multiply(const LLVector3 &a, LLV4Vector3& o) const;
const LLV4Matrix4& transpose();
const LLV4Matrix4& translate(const LLVector3 &vec);
const LLV4Matrix4& translate(const LLV4Vector3 &vec);
const LLV4Matrix4& operator=(const LLMatrix4& a);
operator LLMatrix4() const { return *(reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0]))); }
operator LLV4Matrix3() const { return *(reinterpret_cast<const LLV4Matrix3*>(const_cast<const F32*>(&mMatrix[0][0]))); }
friend LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b);
}
LL_LLV4MATH_ALIGN_POSTFIX;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix4 - SSE
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#if LL_VECTORIZE
inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w)
{
__m128 vw = _mm_set1_ps(w);
mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a
mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]);
mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]);
mV[VW] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VW], a.mV[VW]), vw), a.mV[VW]);
}
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const
{
LLV4Vector3 j;
j.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
o.setVec(j.mV);
}
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const
{
o.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
}
inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec)
{
mV[VW] = _mm_add_ps(mV[VW], vec.v);
return (*this);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix4
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#else
inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w)
{
mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w);
mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w);
mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w);
mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w);
mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w);
mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w);
mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w);
mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w);
mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w);
mMatrix[VW][VX] = llv4lerp(a.mMatrix[VW][VX], b.mMatrix[VW][VX], w);
mMatrix[VW][VY] = llv4lerp(a.mMatrix[VW][VY], b.mMatrix[VW][VY], w);
mMatrix[VW][VZ] = llv4lerp(a.mMatrix[VW][VZ], b.mMatrix[VW][VZ], w);
}
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const
{
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
a.mV[VY] * mMatrix[VY][VX] +
a.mV[VZ] * mMatrix[VZ][VX] +
mMatrix[VW][VX],
a.mV[VX] * mMatrix[VX][VY] +
a.mV[VY] * mMatrix[VY][VY] +
a.mV[VZ] * mMatrix[VZ][VY] +
mMatrix[VW][VY],
a.mV[VX] * mMatrix[VX][VZ] +
a.mV[VY] * mMatrix[VY][VZ] +
a.mV[VZ] * mMatrix[VZ][VZ] +
mMatrix[VW][VZ]);
}
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const
{
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
a.mV[VY] * mMatrix[VY][VX] +
a.mV[VZ] * mMatrix[VZ][VX] +
mMatrix[VW][VX],
a.mV[VX] * mMatrix[VX][VY] +
a.mV[VY] * mMatrix[VY][VY] +
a.mV[VZ] * mMatrix[VZ][VY] +
mMatrix[VW][VY],
a.mV[VX] * mMatrix[VX][VZ] +
a.mV[VY] * mMatrix[VY][VZ] +
a.mV[VZ] * mMatrix[VZ][VZ] +
mMatrix[VW][VZ]);
}
inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec)
{
mMatrix[3][0] += vec.mV[0];
mMatrix[3][1] += vec.mV[1];
mMatrix[3][2] += vec.mV[2];
return (*this);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Matrix4
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#endif
inline const LLV4Matrix4& LLV4Matrix4::operator=(const LLMatrix4& a)
{
memcpy(mMatrix, a.mMatrix, sizeof(F32) * 16 );
return *this;
}
inline const LLV4Matrix4& LLV4Matrix4::transpose()
{
#if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS)
_MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]);
#else
LLV4Matrix4 mat;
mat.mMatrix[0][0] = mMatrix[0][0];
mat.mMatrix[1][0] = mMatrix[0][1];
mat.mMatrix[2][0] = mMatrix[0][2];
mat.mMatrix[3][0] = mMatrix[0][3];
mat.mMatrix[0][1] = mMatrix[1][0];
mat.mMatrix[1][1] = mMatrix[1][1];
mat.mMatrix[2][1] = mMatrix[1][2];
mat.mMatrix[3][1] = mMatrix[1][3];
mat.mMatrix[0][2] = mMatrix[2][0];
mat.mMatrix[1][2] = mMatrix[2][1];
mat.mMatrix[2][2] = mMatrix[2][2];
mat.mMatrix[3][2] = mMatrix[2][3];
mat.mMatrix[0][3] = mMatrix[3][0];
mat.mMatrix[1][3] = mMatrix[3][1];
mat.mMatrix[2][3] = mMatrix[3][2];
mat.mMatrix[3][3] = mMatrix[3][3];
*this = mat;
#endif
return *this;
}
inline const LLV4Matrix4& LLV4Matrix4::translate(const LLVector3 &vec)
{
mMatrix[3][0] += vec.mV[0];
mMatrix[3][1] += vec.mV[1];
mMatrix[3][2] += vec.mV[2];
return (*this);
}
inline LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b)
{
return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] +
a.mV[VY] * b.mMatrix[VY][VX] +
a.mV[VZ] * b.mMatrix[VZ][VX] +
b.mMatrix[VW][VX],
a.mV[VX] * b.mMatrix[VX][VY] +
a.mV[VY] * b.mMatrix[VY][VY] +
a.mV[VZ] * b.mMatrix[VZ][VY] +
b.mMatrix[VW][VY],
a.mV[VX] * b.mMatrix[VX][VZ] +
a.mV[VY] * b.mMatrix[VY][VZ] +
a.mV[VZ] * b.mMatrix[VZ][VZ] +
b.mMatrix[VW][VZ]);
}
#endif

View File

@ -1,80 +0,0 @@
/**
* @file llviewerjointmesh.cpp
* @brief LLV4* class header file - vector processor enabled math
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLV4VECTOR3_H
#define LL_LLV4VECTOR3_H
#include "llv4math.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Vector3
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
LL_LLV4MATH_ALIGN_PREFIX
class LLV4Vector3
{
public:
union {
F32 mV[LLV4_NUM_AXIS];
V4F32 v;
};
enum {
ALIGNMENT = 16
};
void setVec(F32 x, F32 y, F32 z);
void setVec(F32 a);
}
LL_LLV4MATH_ALIGN_POSTFIX;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// LLV4Vector3
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline void LLV4Vector3::setVec(F32 x, F32 y, F32 z)
{
mV[VX] = x;
mV[VY] = y;
mV[VZ] = z;
}
inline void LLV4Vector3::setVec(F32 a)
{
#if LL_VECTORIZE
v = _mm_set1_ps(a);
#else
setVec(a, a, a);
#endif
}
#endif

View File

@ -2078,6 +2078,7 @@ LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL ge
mFaceMask = 0x0;
mDetail = detail;
mSculptLevel = -2;
mSurfaceArea = 1.f; //only calculated for sculpts, defaults to 1 for all other prims
mIsMeshAssetLoaded = FALSE;
mLODScaleBias.setVec(1,1,1);
mHullPoints = NULL;
@ -2903,7 +2904,7 @@ F32 LLVolume::sculptGetSurfaceArea()
// compute the area of the quad by taking the length of the cross product of the two triangles
LLVector3 cross1 = (p1 - p2) % (p1 - p3);
LLVector3 cross2 = (p4 - p2) % (p4 - p3);
area += (cross1.magVec() + cross2.magVec()) / 2.0;
area += (cross1.magVec() + cross2.magVec()) / 2.f;
}
}
@ -3144,6 +3145,8 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
{
F32 area = sculptGetSurfaceArea();
mSurfaceArea = area;
const F32 SCULPT_MAX_AREA = 384.f;
if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA)
@ -4305,15 +4308,25 @@ S32 LLVolume::getNumTriangleIndices() const
}
S32 LLVolume::getNumTriangles() const
S32 LLVolume::getNumTriangles(S32* vcount) const
{
U32 triangle_count = 0;
U32 vertex_count = 0;
for (S32 i = 0; i < getNumVolumeFaces(); ++i)
{
triangle_count += getVolumeFace(i).mNumIndices/3;
const LLVolumeFace& face = getVolumeFace(i);
triangle_count += face.mNumIndices/3;
vertex_count += face.mNumVertices;
}
if (vcount)
{
*vcount = vertex_count;
}
return triangle_count;
}
@ -4607,18 +4620,83 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en
genBinormals(i);
}
if (!face.mOctree)
{
face.createOctree();
}
//LLVector4a* p = (LLVector4a*) face.mPositions;
if (isUnique())
{ //don't bother with an octree for flexi volumes
U32 tri_count = face.mNumIndices/3;
LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, bi_normal);
intersect.traverse(face.mOctree);
if (intersect.mHitFace)
for (U32 j = 0; j < tri_count; ++j)
{
U16 idx0 = face.mIndices[j*3+0];
U16 idx1 = face.mIndices[j*3+1];
U16 idx2 = face.mIndices[j*3+2];
const LLVector4a& v0 = face.mPositions[idx0];
const LLVector4a& v1 = face.mPositions[idx1];
const LLVector4a& v2 = face.mPositions[idx2];
F32 a,b,t;
if (LLTriangleRayIntersect(v0, v1, v2,
start, dir, a, b, t))
{
if ((t >= 0.f) && // if hit is after start
(t <= 1.f) && // and before end
(t < closest_t)) // and this hit is closer
{
closest_t = t;
hit_face = i;
if (intersection != NULL)
{
LLVector4a intersect = dir;
intersect.mul(closest_t);
intersect.add(start);
intersection->set(intersect.getF32ptr());
}
if (tex_coord != NULL)
{
LLVector2* tc = (LLVector2*) face.mTexCoords;
*tex_coord = ((1.f - a - b) * tc[idx0] +
a * tc[idx1] +
b * tc[idx2]);
}
if (normal!= NULL)
{
LLVector4* norm = (LLVector4*) face.mNormals;
*normal = ((1.f - a - b) * LLVector3(norm[idx0]) +
a * LLVector3(norm[idx1]) +
b * LLVector3(norm[idx2]));
}
if (bi_normal != NULL)
{
LLVector4* binormal = (LLVector4*) face.mBinormals;
*bi_normal = ((1.f - a - b) * LLVector3(binormal[idx0]) +
a * LLVector3(binormal[idx1]) +
b * LLVector3(binormal[idx2]));
}
}
}
}
}
else
{
hit_face = i;
if (!face.mOctree)
{
face.createOctree();
}
LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, bi_normal);
intersect.traverse(face.mOctree);
if (intersect.mHitFace)
{
hit_face = i;
}
}
}
}
@ -5812,7 +5890,7 @@ F32 find_vertex_score(LLVCacheVertexData& data)
}
//bonus points for having low valence
F32 valence_boost = powf(data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
F32 valence_boost = powf((F32)data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
score += FindVertexScore_ValenceBoostScale * valence_boost;
return score;

View File

@ -963,6 +963,7 @@ public:
S32 getNumFaces() const;
S32 getNumVolumeFaces() const { return mVolumeFaces.size(); }
F32 getDetail() const { return mDetail; }
F32 getSurfaceArea() const { return mSurfaceArea; }
const LLVolumeParams& getParams() const { return mParams; }
LLVolumeParams getCopyOfParams() const { return mParams; }
const LLProfile& getProfile() const { return *mProfilep; }
@ -990,7 +991,7 @@ public:
S32 getNumTriangleIndices() const;
static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts);
S32 getNumTriangles() const;
S32 getNumTriangles(S32* vcount = NULL) const;
void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
std::vector<LLVector3> &normals,
@ -1065,6 +1066,7 @@ public:
BOOL mUnique;
F32 mDetail;
S32 mSculptLevel;
F32 mSurfaceArea; //unscaled surface area
BOOL mIsMeshAssetLoaded;
LLVolumeParams mParams;

View File

@ -858,25 +858,25 @@ LLSD LLMatrix4::getValue() const
void LLMatrix4::setValue(const LLSD& data)
{
mMatrix[0][0] = data[0].asReal();
mMatrix[0][1] = data[1].asReal();
mMatrix[0][2] = data[2].asReal();
mMatrix[0][3] = data[3].asReal();
mMatrix[0][0] = (F32)data[0].asReal();
mMatrix[0][1] = (F32)data[1].asReal();
mMatrix[0][2] = (F32)data[2].asReal();
mMatrix[0][3] = (F32)data[3].asReal();
mMatrix[1][0] = data[4].asReal();
mMatrix[1][1] = data[5].asReal();
mMatrix[1][2] = data[6].asReal();
mMatrix[1][3] = data[7].asReal();
mMatrix[1][0] = (F32)data[4].asReal();
mMatrix[1][1] = (F32)data[5].asReal();
mMatrix[1][2] = (F32)data[6].asReal();
mMatrix[1][3] = (F32)data[7].asReal();
mMatrix[2][0] = data[8].asReal();
mMatrix[2][1] = data[9].asReal();
mMatrix[2][2] = data[10].asReal();
mMatrix[2][3] = data[11].asReal();
mMatrix[2][0] = (F32)data[8].asReal();
mMatrix[2][1] = (F32)data[9].asReal();
mMatrix[2][2] = (F32)data[10].asReal();
mMatrix[2][3] = (F32)data[11].asReal();
mMatrix[3][0] = data[12].asReal();
mMatrix[3][1] = data[13].asReal();
mMatrix[3][2] = data[14].asReal();
mMatrix[3][3] = data[15].asReal();
mMatrix[3][0] = (F32)data[12].asReal();
mMatrix[3][1] = (F32)data[13].asReal();
mMatrix[3][2] = (F32)data[14].asReal();
mMatrix[3][3] = (F32)data[15].asReal();
}

View File

@ -149,8 +149,8 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
setName( buf );
buf.assign( str, pos2, std::string::npos );
setDescription( buf );
llinfos << "uuid: " << mUuid << llendl;
llinfos << "creator: " << mCreatorID << llendl;
LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << llendl;
LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << llendl;
}
///----------------------------------------------------------------------------
@ -434,9 +434,9 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
// IW - uuid is passed by value to avoid side effects, please don't re-add &
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
{
lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
if (user_data)
{
@ -446,7 +446,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
if (mShutDown)
{
llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
if (callback)
{
@ -468,7 +468,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
// Try static VFS first.
if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
{
llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
return;
}
@ -486,7 +486,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
}
llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
}
else
{
@ -520,7 +520,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
}
if (duplicate)
{
llinfos << "Adding additional non-duplicate request for asset " << uuid
LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid
<< "." << LLAssetType::lookup(type) << llendl;
}
@ -584,9 +584,9 @@ void LLAssetStorage::downloadCompleteCallback(
LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status)
{
llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id
<< "," << LLAssetType::lookup(file_type) << llendl;
LLAssetRequest* req = (LLAssetRequest*)user_data;
if(!req)
@ -731,7 +731,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadEstateAssetCompleteCallback, req);
llinfos << "Starting transfer for " << asset_id << llendl;
LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << llendl;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
@ -871,7 +871,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadInvItemCompleteCallback, req);
llinfos << "Starting transfer for inventory asset "
LL_DEBUGS("AssetStorage") << "Starting transfer for inventory asset "
<< item_id << " owned by " << owner_id << "," << task_id
<< llendl;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
@ -1211,7 +1211,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt,
request_list_t* requests = getRequestList(rt);
if (deletePendingRequestImpl(requests, asset_type, asset_id))
{
llinfos << "Asset " << getRequestName(rt) << " request for "
LL_DEBUGS("AssetStorage") << "Asset " << getRequestName(rt) << " request for "
<< asset_id << "." << LLAssetType::lookup(asset_type)
<< " removed from pending queue." << llendl;
return true;
@ -1307,7 +1307,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData)
{
// this is a duplicate from the same subsystem - throw it away
llinfos << "Discarding duplicate request for UUID " << uuid << llendl;
LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << llendl;
return;
}
}
@ -1490,7 +1490,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET
{
if( !metric_recipient )
{
llinfos << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
return;
}

View File

@ -32,6 +32,9 @@
#include "llmath.h"
#include "llmemtype.h"
#include "llstl.h"
#include "llthread.h"
#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED llassert(!mMutexp || mMutexp->isSelfLocked());
/**
* LLSegment
@ -224,7 +227,8 @@ void LLHeapBuffer::allocate(S32 size)
* LLBufferArray
*/
LLBufferArray::LLBufferArray() :
mNextBaseChannel(0)
mNextBaseChannel(0),
mMutexp(NULL)
{
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
}
@ -233,6 +237,8 @@ LLBufferArray::~LLBufferArray()
{
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
std::for_each(mBuffers.begin(), mBuffers.end(), DeletePointer());
delete mMutexp;
}
// static
@ -243,14 +249,57 @@ LLChannelDescriptors LLBufferArray::makeChannelConsumer(
return rv;
}
void LLBufferArray::lock()
{
if(mMutexp)
{
mMutexp->lock() ;
}
}
void LLBufferArray::unlock()
{
if(mMutexp)
{
mMutexp->unlock() ;
}
}
LLMutex* LLBufferArray::getMutex()
{
return mMutexp ;
}
void LLBufferArray::setThreaded(bool threaded)
{
if(threaded)
{
if(!mMutexp)
{
mMutexp = new LLMutex(NULL);
}
}
else
{
if(mMutexp)
{
delete mMutexp ;
mMutexp = NULL ;
}
}
}
LLChannelDescriptors LLBufferArray::nextChannel()
{
LLChannelDescriptors rv(mNextBaseChannel++);
return rv;
}
//mMutexp should be locked before calling this.
S32 LLBufferArray::capacity() const
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
S32 total = 0;
const_buffer_iterator_t iter = mBuffers.begin();
const_buffer_iterator_t end = mBuffers.end();
@ -263,6 +312,8 @@ S32 LLBufferArray::capacity() const
bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
{
LLMutexLock lock(mMutexp) ;
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
std::vector<LLSegment> segments;
if(copyIntoBuffers(channel, src, len, segments))
@ -273,8 +324,11 @@ bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
return false;
}
//mMutexp should be locked before calling this.
bool LLBufferArray::prepend(S32 channel, const U8* src, S32 len)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
std::vector<LLSegment> segments;
if(copyIntoBuffers(channel, src, len, segments))
@ -293,6 +347,8 @@ bool LLBufferArray::insertAfter(
{
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
std::vector<LLSegment> segments;
LLMutexLock lock(mMutexp) ;
if(mSegments.end() != segment)
{
++segment;
@ -305,8 +361,11 @@ bool LLBufferArray::insertAfter(
return false;
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
segment_iterator_t end = mSegments.end();
segment_iterator_t it = getSegment(address);
@ -335,20 +394,26 @@ LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
return rv;
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::beginSegment()
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
return mSegments.begin();
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::endSegment()
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
return mSegments.end();
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
U8* address,
LLSegment& segment)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
segment_iterator_t rv = mSegments.begin();
segment_iterator_t end = mSegments.end();
@ -395,8 +460,10 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
return rv;
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
segment_iterator_t end = mSegments.end();
if(!address)
{
@ -414,9 +481,11 @@ LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
return end;
}
//mMutexp should be locked before calling this.
LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment(
U8* address) const
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
const_segment_iterator_t end = mSegments.end();
if(!address)
{
@ -466,6 +535,8 @@ S32 LLBufferArray::countAfter(S32 channel, U8* start) const
S32 count = 0;
S32 offset = 0;
const_segment_iterator_t it;
LLMutexLock lock(mMutexp) ;
const_segment_iterator_t end = mSegments.end();
if(start)
{
@ -517,6 +588,8 @@ U8* LLBufferArray::readAfter(
len = 0;
S32 bytes_to_copy = 0;
const_segment_iterator_t it;
LLMutexLock lock(mMutexp) ;
const_segment_iterator_t end = mSegments.end();
if(start)
{
@ -568,6 +641,7 @@ U8* LLBufferArray::seek(
U8* start,
S32 delta) const
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
const_segment_iterator_t it;
const_segment_iterator_t end = mSegments.end();
@ -709,9 +783,14 @@ U8* LLBufferArray::seek(
return rv;
}
//test use only
bool LLBufferArray::takeContents(LLBufferArray& source)
{
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
LLMutexLock lock(mMutexp);
source.lock();
std::copy(
source.mBuffers.begin(),
source.mBuffers.end(),
@ -723,13 +802,17 @@ bool LLBufferArray::takeContents(LLBufferArray& source)
std::back_insert_iterator<segment_list_t>(mSegments));
source.mSegments.clear();
source.mNextBaseChannel = 0;
source.unlock();
return true;
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
S32 channel,
S32 len)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
// start at the end of the buffers, because it is the most likely
// to have free space.
@ -765,8 +848,10 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
return send;
}
//mMutexp should be locked before calling this.
bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
// Find out which buffer contains the segment, and if it is found,
@ -792,13 +877,14 @@ bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
return rv;
}
//mMutexp should be locked before calling this.
bool LLBufferArray::copyIntoBuffers(
S32 channel,
const U8* src,
S32 len,
std::vector<LLSegment>& segments)
{
ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
LLMemType m1(LLMemType::MTYPE_IO_BUFFER);
if(!src || !len) return false;
S32 copied = 0;

View File

@ -39,6 +39,7 @@
#include <list>
#include <vector>
class LLMutex;
/**
* @class LLChannelDescriptors
* @brief A way simple interface to accesss channels inside a buffer
@ -564,6 +565,29 @@ public:
* @return Returns true on success.
*/
bool eraseSegment(const segment_iterator_t& iter);
/**
* @brief Lock the mutex if it exists
* This method locks mMutexp to make accessing LLBufferArray thread-safe
*/
void lock();
/**
* @brief Unlock the mutex if it exists
*/
void unlock();
/**
* @brief Return mMutexp
*/
LLMutex* getMutex();
/**
* @brief Set LLBufferArray to be shared across threads or not
* This method is to create mMutexp if is threaded.
* @param threaded Indicates this LLBufferArray instance is shared across threads if true.
*/
void setThreaded(bool threaded);
//@}
protected:
@ -595,6 +619,7 @@ protected:
S32 mNextBaseChannel;
buffer_list_t mBuffers;
segment_list_t mSegments;
LLMutex* mMutexp;
};
#endif // LL_LLBUFFER_H

View File

@ -31,6 +31,7 @@
#include "llbuffer.h"
#include "llmemtype.h"
#include "llthread.h"
static const S32 DEFAULT_OUTPUT_SEGMENT_SIZE = 1024 * 4;
@ -62,6 +63,7 @@ int LLBufferStreamBuf::underflow()
return EOF;
}
LLMutexLock lock(mBuffer->getMutex());
LLBufferArray::segment_iterator_t iter;
LLBufferArray::segment_iterator_t end = mBuffer->endSegment();
U8* last_pos = (U8*)gptr();
@ -149,6 +151,7 @@ int LLBufferStreamBuf::overflow(int c)
// since we got here, we have a buffer, and we have a character to
// put on it.
LLBufferArray::segment_iterator_t it;
LLMutexLock lock(mBuffer->getMutex());
it = mBuffer->makeSegment(mChannels.out(), DEFAULT_OUTPUT_SEGMENT_SIZE);
if(it != mBuffer->endSegment())
{
@ -210,6 +213,7 @@ int LLBufferStreamBuf::sync()
// *NOTE: I bet we could just --address if address is not NULL.
// Need to think about that.
LLMutexLock lock(mBuffer->getMutex());
address = mBuffer->seek(mChannels.out(), address, -1);
if(address)
{
@ -273,6 +277,8 @@ streampos LLBufferStreamBuf::seekoff(
// NULL is fine
break;
}
LLMutexLock lock(mBuffer->getMutex());
address = mBuffer->seek(mChannels.in(), base_addr, off);
if(address)
{
@ -304,6 +310,8 @@ streampos LLBufferStreamBuf::seekoff(
// NULL is fine
break;
}
LLMutexLock lock(mBuffer->getMutex());
address = mBuffer->seek(mChannels.out(), base_addr, off);
if(address)
{

File diff suppressed because it is too large Load Diff

137
indra/llmessage/llcurl.h Executable file → Normal file
View File

@ -42,8 +42,11 @@
#include "lliopipe.h"
#include "llsd.h"
#include "llthread.h"
#include "llqueuedthread.h"
#include "llframetimer.h"
class LLMutex;
class LLCurlThread;
// For whatever reason, this is not typedef'd in curl.h
typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
@ -56,8 +59,6 @@ public:
class Easy;
class Multi;
static bool sMultiThreaded;
struct TransferInfo
{
TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {}
@ -162,7 +163,7 @@ public:
/**
* @ brief Initialize LLCurl class
*/
static void initClass(bool multi_threaded = false);
static void initClass(F32 curl_reuest_timeout = 120.f, S32 max_number_handles = 256, bool multi_threaded = false);
/**
* @ brief Cleanup LLCurl class
@ -181,10 +182,25 @@ public:
static void ssl_locking_callback(int mode, int type, const char *file, int line);
static unsigned long ssl_thread_id(void);
static LLCurlThread* getCurlThread() { return sCurlThread ;}
static CURLM* newMultiHandle() ;
static CURLMcode deleteMultiHandle(CURLM* handle) ;
static CURL* newEasyHandle() ;
static void deleteEasyHandle(CURL* handle) ;
private:
static std::string sCAPath;
static std::string sCAFile;
static const unsigned int MAX_REDIRECTS;
static LLCurlThread* sCurlThread;
static LLMutex* sHandleMutexp ;
static S32 sTotalHandles ;
static S32 sMaxHandles;
public:
static bool sNotQuitting;
static F32 sCurlRequestTimeOut;
};
class LLCurl::Easy
@ -216,7 +232,7 @@ public:
U32 report(CURLcode);
void getTransferInfo(LLCurl::TransferInfo* info);
void prepRequest(const std::string& url, const std::vector<std::string>& headers, ResponderPtr, S32 time_out = 0, bool post = false);
void prepRequest(const std::string& url, const std::vector<std::string>& headers, LLCurl::ResponderPtr, S32 time_out = 0, bool post = false);
const char* getErrorBuffer();
@ -247,64 +263,120 @@ private:
// Note: char*'s not strings since we pass pointers to curl
std::vector<char*> mStrings;
ResponderPtr mResponder;
LLCurl::ResponderPtr mResponder;
static std::set<CURL*> sFreeHandles;
static std::set<CURL*> sActiveHandles;
static LLMutex* sHandleMutex;
static LLMutex* sMultiMutex;
static LLMutex* sHandleMutexp ;
};
class LLCurl::Multi : public LLThread
class LLCurl::Multi
{
LOG_CLASS(Multi);
friend class LLCurlThread ;
private:
~Multi();
void markDead() ;
bool doPerform();
public:
typedef enum
{
PERFORM_STATE_READY=0,
PERFORM_STATE_PERFORMING=1,
PERFORM_STATE_COMPLETED=2
STATE_READY=0,
STATE_PERFORMING=1,
STATE_COMPLETED=2
} ePerformState;
Multi();
~Multi();
Multi(F32 idle_time_out = 0.f);
Easy* allocEasy();
bool addEasy(Easy* easy);
LLCurl::Easy* allocEasy();
bool addEasy(LLCurl::Easy* easy);
void removeEasy(LLCurl::Easy* easy);
void removeEasy(Easy* easy);
void lock() ;
void unlock() ;
void setState(ePerformState state) ;
ePerformState getState() ;
bool isCompleted() ;
bool isValid() {return mCurlMultiHandle != NULL ;}
bool isDead() {return mDead;}
bool waitToComplete() ;
S32 process();
void perform();
void doPerform();
virtual void run();
CURLMsg* info_read(S32* msgs_in_queue);
S32 mQueued;
S32 mErrorCount;
S32 mPerformState;
LLCondition* mSignal;
bool mQuitting;
bool mThreaded;
private:
void easyFree(Easy*);
void easyFree(LLCurl::Easy*);
void cleanup() ;
CURLM* mCurlMultiHandle;
typedef std::set<Easy*> easy_active_list_t;
typedef std::set<LLCurl::Easy*> easy_active_list_t;
easy_active_list_t mEasyActiveList;
typedef std::map<CURL*, Easy*> easy_active_map_t;
typedef std::map<CURL*, LLCurl::Easy*> easy_active_map_t;
easy_active_map_t mEasyActiveMap;
typedef std::set<Easy*> easy_free_list_t;
typedef std::set<LLCurl::Easy*> easy_free_list_t;
easy_free_list_t mEasyFreeList;
LLQueuedThread::handle_t mHandle ;
ePerformState mState;
BOOL mDead ;
LLMutex* mMutexp ;
LLMutex* mDeletionMutexp ;
LLMutex* mEasyMutexp ;
LLFrameTimer mIdleTimer ;
F32 mIdleTimeOut;
};
class LLCurlThread : public LLQueuedThread
{
public:
class CurlRequest : public LLQueuedThread::QueuedRequest
{
protected:
virtual ~CurlRequest(); // use deleteRequest()
public:
CurlRequest(handle_t handle, LLCurl::Multi* multi, LLCurlThread* curl_thread);
/*virtual*/ bool processRequest();
/*virtual*/ void finishRequest(bool completed);
private:
// input
LLCurl::Multi* mMulti;
LLCurlThread* mCurlThread;
};
friend class CurlRequest;
public:
LLCurlThread(bool threaded = true) ;
virtual ~LLCurlThread() ;
S32 update(F32 max_time_ms);
void addMulti(LLCurl::Multi* multi) ;
void killMulti(LLCurl::Multi* multi) ;
private:
bool doMultiPerform(LLCurl::Multi* multi) ;
void deleteMulti(LLCurl::Multi* multi) ;
void cleanupMulti(LLCurl::Multi* multi) ;
} ;
namespace boost
{
void intrusive_ptr_add_ref(LLCurl::Responder* p);
@ -339,7 +411,6 @@ private:
LLCurl::Multi* mActiveMulti;
S32 mActiveRequestCount;
BOOL mProcessing;
U32 mThreadID; // debug
};
class LLCurlEasyRequest
@ -357,9 +428,11 @@ public:
void slist_append(const char* str);
void sendRequest(const std::string& url);
void requestComplete();
void perform();
bool getResult(CURLcode* result, LLCurl::TransferInfo* info = NULL);
std::string getErrorString();
bool isCompleted() {return mMulti->isCompleted() ;}
bool wait() { return mMulti->waitToComplete(); }
bool isValid() {return mMulti && mMulti->isValid(); }
LLCurl::Easy* getEasy() const { return mEasy; }

View File

@ -232,7 +232,8 @@ LLSD LLHTTPAssetRequest::getFullDetails() const
void LLHTTPAssetRequest::setupCurlHandle()
{
// *NOTE: Similar code exists in mapserver/llcurlutil.cpp JC
mCurlHandle = curl_easy_init();
mCurlHandle = LLCurl::newEasyHandle();
llassert_always(mCurlHandle != NULL) ;
// Apply proxy settings if configured to do so
LLProxy::getInstance()->applyProxySettings(mCurlHandle);
@ -278,7 +279,7 @@ void LLHTTPAssetRequest::setupCurlHandle()
void LLHTTPAssetRequest::cleanupCurlHandle()
{
curl_easy_cleanup(mCurlHandle);
LLCurl::deleteEasyHandle(mCurlHandle);
if (mAssetStoragep)
{
// Terminating a request. Thus upload or download is no longer pending.
@ -429,12 +430,13 @@ void LLHTTPAssetStorage::_init(const std::string& web_host, const std::string& l
// curl_global_init moved to LLCurl::initClass()
mCurlMultiHandle = curl_multi_init();
mCurlMultiHandle = LLCurl::newMultiHandle() ;
llassert_always(mCurlMultiHandle != NULL) ;
}
LLHTTPAssetStorage::~LLHTTPAssetStorage()
{
curl_multi_cleanup(mCurlMultiHandle);
LLCurl::deleteMultiHandle(mCurlMultiHandle);
mCurlMultiHandle = NULL;
// curl_global_cleanup moved to LLCurl::initClass()

View File

@ -158,7 +158,7 @@ namespace
if(fstream.is_open())
{
fstream.seekg(0, std::ios::end);
U32 fileSize = fstream.tellg();
U32 fileSize = (U32)fstream.tellg();
fstream.seekg(0, std::ios::beg);
std::vector<char> fileBuffer(fileSize);
fstream.read(&fileBuffer[0], fileSize);
@ -228,6 +228,12 @@ static void request(
LLPumpIO::chain_t chain;
LLURLRequest* req = new LLURLRequest(method, url);
if(!req->isValid())//failed
{
delete req ;
return ;
}
req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
@ -423,7 +429,9 @@ static LLSD blocking_request(
{
lldebugs << "blockingRequest of " << url << llendl;
char curl_error_buffer[CURL_ERROR_SIZE] = "\0";
CURL* curlp = curl_easy_init();
CURL* curlp = LLCurl::newEasyHandle();
llassert_always(curlp != NULL) ;
LLHTTPBuffer http_buffer;
std::string body_str;
@ -517,7 +525,7 @@ static LLSD blocking_request(
}
// * Cleanup
curl_easy_cleanup(curlp);
LLCurl::deleteEasyHandle(curlp);
return response;
}

View File

@ -818,6 +818,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
// Copy everything after mLast read to the out.
LLBufferArray::segment_iterator_t seg_iter;
buffer->lock();
seg_iter = buffer->splitAfter(mLastRead);
if(seg_iter != buffer->endSegment())
{
@ -838,7 +840,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
}
#endif
}
buffer->unlock();
//
// *FIX: get rid of extra bytes off the end
//

View File

@ -75,6 +75,12 @@ LLIOPipe::~LLIOPipe()
//lldebugs << "destroying LLIOPipe" << llendl;
}
//virtual
bool LLIOPipe::isValid()
{
return true ;
}
// static
std::string LLIOPipe::lookupStatusString(EStatus status)
{

View File

@ -231,6 +231,8 @@ public:
*/
virtual ~LLIOPipe();
virtual bool isValid() ;
protected:
/**
* @brief Base Constructor.

View File

@ -445,6 +445,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
// efficient - not only because writev() is better, but also
// because we won't have to do as much work to find the start
// address.
buffer->lock();
LLBufferArray::segment_iterator_t it;
LLBufferArray::segment_iterator_t end = buffer->endSegment();
LLSegment segment;
@ -524,6 +525,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
}
}
buffer->unlock();
PUMP_DEBUG;
if(done && eos)
{

View File

@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders(
// not to read past limit when we get() the newline.
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
istr.getline(mBuffer, max_get, '\r');
mScanCount += istr.gcount();
mScanCount += (S32)istr.gcount();
int c = istr.get();
if(EOF == c)
{
@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator(
// past limit when we get() the newline.
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
istr.getline(mBuffer, max_get, '\r');
mScanCount += istr.gcount();
mScanCount += (S32)istr.gcount();
if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
{
// that's way too long to be a separator, so ignore it.

View File

@ -195,7 +195,7 @@ bool LLPumpIO::prime(apr_pool_t* pool)
return ((pool == NULL) ? false : true);
}
bool LLPumpIO::addChain(const chain_t& chain, F32 timeout)
bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request)
{
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
if(chain.empty()) return false;
@ -204,8 +204,10 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout)
LLScopedLock lock(mChainsMutex);
#endif
LLChainInfo info;
info.mHasCurlRequest = has_curl_request;
info.setTimeoutSeconds(timeout);
info.mData = LLIOPipe::buffer_ptr_t(new LLBufferArray);
info.mData->setThreaded(has_curl_request);
LLLinkInfo link;
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
lldebugs << "LLPumpIO::addChain() " << chain[0] << " '"
@ -440,6 +442,15 @@ void LLPumpIO::pump()
static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain)
{
std::for_each(
(*run_chain).mDescriptors.begin(),
(*run_chain).mDescriptors.end(),
ll_delete_apr_pollset_fd_client_data());
return mRunningChains.erase(run_chain);
}
//timeout is in microseconds
void LLPumpIO::pump(const S32& poll_timeout)
{
@ -585,10 +596,16 @@ void LLPumpIO::pump(const S32& poll_timeout)
// << (*run_chain).mChainLinks[0].mPipe
// << " because we reached the end." << llendl;
#endif
run_chain = mRunningChains.erase(run_chain);
run_chain = removeRunningChain(run_chain);
continue;
}
}
else if(isChainExpired(*run_chain))
{
run_chain = removeRunningChain(run_chain);
continue;
}
PUMP_DEBUG;
if((*run_chain).mLock)
{
@ -696,11 +713,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
PUMP_DEBUG;
// This chain is done. Clean up any allocated memory and
// erase the chain info.
std::for_each(
(*run_chain).mDescriptors.begin(),
(*run_chain).mDescriptors.end(),
ll_delete_apr_pollset_fd_client_data());
run_chain = mRunningChains.erase(run_chain);
run_chain = removeRunningChain(run_chain);
// *NOTE: may not always need to rebuild the pollset.
mRebuildPollset = true;
@ -1095,6 +1108,24 @@ void LLPumpIO::processChain(LLChainInfo& chain)
PUMP_DEBUG;
}
bool LLPumpIO::isChainExpired(LLChainInfo& chain)
{
if(!chain.mHasCurlRequest)
{
return false ;
}
for(links_t::iterator iter = chain.mChainLinks.begin(); iter != chain.mChainLinks.end(); ++iter)
{
if(!(*iter).mPipe->isValid())
{
return true ;
}
}
return false ;
}
bool LLPumpIO::handleChainError(
LLChainInfo& chain,
LLIOPipe::EStatus error)
@ -1136,6 +1167,9 @@ bool LLPumpIO::handleChainError(
#endif
keep_going = false;
break;
case LLIOPipe::STATUS_EXPIRED:
keep_going = false;
break ;
default:
if(LLIOPipe::isSuccess(error))
{
@ -1157,7 +1191,8 @@ bool LLPumpIO::handleChainError(
LLPumpIO::LLChainInfo::LLChainInfo() :
mInit(false),
mLock(0),
mEOS(false)
mEOS(false),
mHasCurlRequest(false)
{
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
mTimer.setTimerExpirySec(DEFAULT_CHAIN_EXPIRY_SECS);

View File

@ -111,9 +111,10 @@ public:
* @param chain The pipes for the chain
* @param timeout The number of seconds in the future to
* expire. Pass in 0.0f to never expire.
* @param has_curl_request The chain contains LLURLRequest if true.
* @return Returns true if anything was added to the pump.
*/
bool addChain(const chain_t& chain, F32 timeout);
bool addChain(const chain_t& chain, F32 timeout, bool has_curl_request = false);
/**
* @brief Struct to associate a pipe with it's buffer io indexes.
@ -356,12 +357,13 @@ protected:
// basic member data
bool mInit;
bool mEOS;
bool mHasCurlRequest;
S32 mLock;
LLFrameTimer mTimer;
links_t::iterator mHead;
links_t mChainLinks;
LLIOPipe::buffer_ptr_t mData;
bool mEOS;
LLIOPipe::buffer_ptr_t mData;
LLSD mContext;
// tracking inside the pump
@ -402,7 +404,7 @@ protected:
protected:
void initialize(apr_pool_t* pool);
void cleanup();
current_chain_t removeRunningChain(current_chain_t& chain) ;
/**
* @brief Given the internal state of the chains, rebuild the pollset
* @see setConditional()
@ -429,6 +431,9 @@ protected:
*/
bool handleChainError(LLChainInfo& chain, LLIOPipe::EStatus error);
//if the chain is expired, remove it
bool isChainExpired(LLChainInfo& chain) ;
public:
/**
* @brief Return number of running chains.

View File

@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
request,
url, "POST", reply, error),
LLSD(), // headers
timeout);
(F32)timeout);
return false;
}

View File

@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
// S64 not supported in LLSD so we just truncate it
case MVT_S64:
addS32(varname, *(S64*)mvci.getData());
addS32(varname, (S32)*(S64*)mvci.getData());
break;
case MVT_F32:

View File

@ -291,9 +291,10 @@ S32 getElementSize(const LLSD& llsd)
case LLSD::TypeMap:
case LLSD::TypeArray:
case LLSD::TypeUndefined:
default: // TypeLLSDTypeEnd, TypeLLSDNumTypes, etc.
return 0;
}
return 0;
//return 0;
}
//virtual

View File

@ -240,9 +240,16 @@ public:
virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
{
lldebugs << "LLSDRPCClientFactory::build" << llendl;
LLIOPipe::ptr_t service(new Client);
chain.push_back(service);
LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST));
if(!http->isValid())
{
llwarns << "Creating LLURLRequest failed." << llendl ;
delete http;
return false;
}
LLIOPipe::ptr_t service(new Client);
chain.push_back(service);
LLIOPipe::ptr_t http_pipe(http);
http->addHeader("Content-Type: text/llsd");
if(mURL.empty())
@ -283,9 +290,16 @@ public:
virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
{
lldebugs << "LLXMLSDRPCClientFactory::build" << llendl;
LLIOPipe::ptr_t service(new Client);
chain.push_back(service);
LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST));
if(!http->isValid())
{
llwarns << "Creating LLURLRequest failed." << llendl ;
delete http;
return false ;
}
LLIOPipe::ptr_t service(new Client);
chain.push_back(service);
LLIOPipe::ptr_t http_pipe(http);
http->addHeader("Content-Type: text/xml");
if(mURL.empty())

View File

@ -64,7 +64,7 @@ public:
~LLURLRequestDetail();
std::string mURL;
LLCurlEasyRequest* mCurlRequest;
LLBufferArray* mResponseBuffer;
LLIOPipe::buffer_ptr_t mResponseBuffer;
LLChannelDescriptors mChannels;
U8* mLastRead;
U32 mBodyLimit;
@ -75,7 +75,6 @@ public:
LLURLRequestDetail::LLURLRequestDetail() :
mCurlRequest(NULL),
mResponseBuffer(NULL),
mLastRead(NULL),
mBodyLimit(0),
mByteAccumulator(0),
@ -84,13 +83,18 @@ LLURLRequestDetail::LLURLRequestDetail() :
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
mCurlRequest = new LLCurlEasyRequest();
if(!mCurlRequest->isValid()) //failed.
{
delete mCurlRequest ;
mCurlRequest = NULL ;
}
}
LLURLRequestDetail::~LLURLRequestDetail()
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
delete mCurlRequest;
mResponseBuffer = NULL;
mLastRead = NULL;
}
@ -170,6 +174,7 @@ LLURLRequest::~LLURLRequest()
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
delete mDetail;
mDetail = NULL ;
}
void LLURLRequest::setURL(const std::string& url)
@ -251,12 +256,24 @@ void LLURLRequest::allowCookies()
mDetail->mCurlRequest->setoptString(CURLOPT_COOKIEFILE, "");
}
//virtual
bool LLURLRequest::isValid()
{
return mDetail->mCurlRequest && mDetail->mCurlRequest->isValid();
}
// virtual
LLIOPipe::EStatus LLURLRequest::handleError(
LLIOPipe::EStatus status,
LLPumpIO* pump)
{
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
if(!isValid())
{
return STATUS_EXPIRED ;
}
if(mCompletionCallback && pump)
{
LLURLRequestComplete* complete = NULL;
@ -325,7 +342,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
// *FIX: bit of a hack, but it should work. The configure and
// callback method expect this information to be ready.
mDetail->mResponseBuffer = buffer.get();
mDetail->mResponseBuffer = buffer;
mDetail->mChannels = channels;
if(!configure())
{
@ -344,7 +361,10 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");
{
LLFastTimer t(FTM_URL_PERFORM);
mDetail->mCurlRequest->perform();
if(!mDetail->mCurlRequest->wait())
{
return status ;
}
}
while(1)
@ -439,6 +459,12 @@ void LLURLRequest::initialize()
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
mState = STATE_INITIALIZED;
mDetail = new LLURLRequestDetail;
if(!isValid())
{
return ;
}
mDetail->mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
mDetail->mCurlRequest->setWriteCallback(&downCallback, (void*)this);
mDetail->mCurlRequest->setReadCallback(&upCallback, (void*)this);

View File

@ -188,6 +188,8 @@ public:
*/
void allowCookies();
/*virtual*/ bool isValid() ;
public:
/**
* @brief Give this pipe a chance to handle a generated error

View File

@ -29,6 +29,7 @@
#include "message.h"
#include "lltimer.h"
#include "llextendedstatus.h"
const S32 LL_XFER_LARGE_PAYLOAD = 7680;

View File

@ -3147,7 +3147,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
}
U32 now = time(NULL);
U32 now = (U32)time(NULL);
now /= window;
@ -3167,7 +3167,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
}
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
U32 now = time(NULL);
U32 now = (U32)time(NULL);
now /= window;
@ -3213,7 +3213,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
}
U32 now = time(NULL);
U32 now = (U32)time(NULL);
now /= window;

View File

@ -35,7 +35,7 @@ import re
import errno
import socket
VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "1") # default to verbose
VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "0") # default to quiet
# Support usage such as INTEGRATION_TEST_VERBOSE=off -- distressing to user if
# that construct actually turns on verbosity...
VERBOSE = not re.match(r"(0|off|false|quiet)$", VERBOSE, re.IGNORECASE)

View File

@ -41,7 +41,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
LOG_CLASS(LLPluginClassMedia);
public:
LLPluginClassMedia(LLPluginClassMediaOwner *owner);
~LLPluginClassMedia();
virtual ~LLPluginClassMedia();
// local initialization, called by the media manager when creating a source
bool init(const std::string &launcher_filename,
@ -270,7 +270,7 @@ public:
std::string getHoverText() const { return mHoverText; };
std::string getHoverLink() const { return mHoverLink; };
std::string getMediaName() const { return mMediaName; };
const std::string& getMediaName() const { return mMediaName; };
std::string getMediaDescription() const { return mMediaDescription; };
// Crash the plugin. If you use this outside of a testbed, you will be punished.

View File

@ -39,7 +39,7 @@
class LLPluginInstanceMessageListener
{
public:
~LLPluginInstanceMessageListener();
virtual ~LLPluginInstanceMessageListener();
/** Plugin receives message from plugin loader shell. */
virtual void receivePluginMessage(const std::string &message) = 0;
};

View File

@ -94,10 +94,10 @@ void LLPluginMessagePipeOwner::killMessagePipe(void)
LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket):
mInputMutex(gAPRPoolp),
mOutputMutex(gAPRPoolp),
mOutputStartIndex(0),
mOwner(owner),
mSocket(socket)
{
mOwner->setMessagePipe(this);
}
@ -113,6 +113,14 @@ bool LLPluginMessagePipe::addMessage(const std::string &message)
{
// queue the message for later output
LLMutexLock lock(&mOutputMutex);
// If we're starting to use up too much memory, clear
if (mOutputStartIndex > 1024 * 1024)
{
mOutput = mOutput.substr(mOutputStartIndex);
mOutputStartIndex = 0;
}
mOutput += message;
mOutput += MESSAGE_DELIMITER; // message separator
@ -165,35 +173,44 @@ bool LLPluginMessagePipe::pumpOutput()
if(mSocket)
{
apr_status_t status;
apr_size_t size;
apr_size_t in_size, out_size;
LLMutexLock lock(&mOutputMutex);
if(!mOutput.empty())
const char * output_data = &(mOutput.data()[mOutputStartIndex]);
if(*output_data != '\0')
{
// write any outgoing messages
size = (apr_size_t)mOutput.size();
in_size = (apr_size_t) (mOutput.size() - mOutputStartIndex);
out_size = in_size;
setSocketTimeout(0);
// LL_INFOS("Plugin") << "before apr_socket_send, size = " << size << LL_ENDL;
status = apr_socket_send(
mSocket->getSocket(),
(const char*)mOutput.data(),
&size);
status = apr_socket_send(mSocket->getSocket(),
output_data,
&out_size);
// LL_INFOS("Plugin") << "after apr_socket_send, size = " << size << LL_ENDL;
if(status == APR_SUCCESS)
if((status == APR_SUCCESS) || APR_STATUS_IS_EAGAIN(status))
{
// success
mOutput = mOutput.substr(size);
}
else if(APR_STATUS_IS_EAGAIN(status))
{
// Socket buffer is full...
// remove the written part from the buffer and try again later.
mOutput = mOutput.substr(size);
// Success or Socket buffer is full...
// If we've pumped the entire string, clear it
if (out_size == in_size)
{
mOutputStartIndex = 0;
mOutput.clear();
}
else
{
llassert(in_size > out_size);
// Remove the written part from the buffer and try again later.
mOutputStartIndex += out_size;
}
}
else if(APR_STATUS_IS_EOF(status))
{

View File

@ -40,7 +40,7 @@ class LLPluginMessagePipeOwner
LOG_CLASS(LLPluginMessagePipeOwner);
public:
LLPluginMessagePipeOwner();
~LLPluginMessagePipeOwner();
virtual ~LLPluginMessagePipeOwner();
// called with incoming messages
virtual void receiveMessageRaw(const std::string &message) = 0;
@ -86,6 +86,7 @@ protected:
std::string mInput;
LLMutex mOutputMutex;
std::string mOutput;
std::string::size_type mOutputStartIndex;
LLPluginMessagePipeOwner *mOwner;
LLSocket::ptr_t mSocket;

View File

@ -41,7 +41,7 @@
class LLPluginProcessParentOwner
{
public:
~LLPluginProcessParentOwner();
virtual ~LLPluginProcessParentOwner();
virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
// This will only be called when the plugin has died unexpectedly

View File

@ -31,11 +31,18 @@
#include "llconvexdecomposition.h"
#include "llsdserialize.h"
#include "llvector4a.h"
#if LL_MSVC
#pragma warning (disable : 4263)
#pragma warning (disable : 4264)
#endif
#include "dae.h"
#include "dae/daeErrorHandler.h"
#include "dom/domConstants.h"
#include "dom/domMesh.h"
#if LL_MSVC
#pragma warning (default : 4263)
#pragma warning (default : 4264)
#endif
#ifdef LL_STANDALONE
# include <zlib.h>

View File

@ -168,8 +168,8 @@ void LLTextureAnim::unpackTAMessage(LLDataPacker &dp)
mMode = data[0];
mFace = data[1];
mSizeX = llmax((U8)1, data[2]);
mSizeY = llmax((U8)1, data[3]);
mSizeX = data[2];
mSizeY = data[3];
htonmemcpy(&mStart, data + 4, MVT_F32, sizeof(F32));
htonmemcpy(&mLength, data + 8, MVT_F32, sizeof(F32));
htonmemcpy(&mRate, data + 12, MVT_F32, sizeof(F32));

View File

@ -34,9 +34,9 @@
//============================================================================
LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params)
{
LLXMLNode *ret = new LLXMLNode("profile", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE);
ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
@ -46,9 +46,9 @@ LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
}
LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params)
{
LLXMLNode *ret = new LLXMLNode("path", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE);
ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV);
@ -63,12 +63,15 @@ LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
}
LLXMLNode *LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
{
LLXMLNode *ret = new LLXMLNode("shape", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE);
exportPathParams(&params->getPathParams())->setParent(ret);
exportProfileParams(&params->getProfileParams())->setParent(ret);
LLPointer<LLXMLNode> node ;
node = exportPathParams(&params->getPathParams()) ;
node->setParent(ret);
node = exportProfileParams(&params->getProfileParams()) ;
node->setParent(ret);
return ret;
}

View File

@ -34,11 +34,11 @@
class LLVolumeXml
{
public:
static LLXMLNode* exportProfileParams(const LLProfileParams* params);
static LLPointer<LLXMLNode> exportProfileParams(const LLProfileParams* params);
static LLXMLNode* exportPathParams(const LLPathParams* params);
static LLPointer<LLXMLNode> exportPathParams(const LLPathParams* params);
static LLXMLNode* exportVolumeParams(const LLVolumeParams* params);
static LLPointer<LLXMLNode> exportVolumeParams(const LLVolumeParams* params);
};
#endif // LL_LLVOLUMEXML_H

View File

@ -36,6 +36,7 @@
#include "m4math.h"
#include "llrender.h"
#include "llglslshader.h"
#include "llglheaders.h"
@ -195,7 +196,7 @@ void LLCubeMap::enableTexture(S32 stage)
void LLCubeMap::enableTextureCoords(S32 stage)
{
mTextureCoordStage = stage;
if (gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
{
if (stage > 0)
{
@ -237,7 +238,7 @@ void LLCubeMap::disableTexture(void)
void LLCubeMap::disableTextureCoords(void)
{
if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
{
if (mTextureCoordStage > 0)
{
@ -264,19 +265,19 @@ void LLCubeMap::setMatrix(S32 stage)
gGL.getTexUnit(stage)->activate();
}
LLVector3 x(LLVector3d(gGLModelView+0));
LLVector3 y(LLVector3d(gGLModelView+4));
LLVector3 z(LLVector3d(gGLModelView+8));
LLVector3 x(gGLModelView+0);
LLVector3 y(gGLModelView+4);
LLVector3 z(gGLModelView+8);
LLMatrix3 mat3;
mat3.setRows(x,y,z);
LLMatrix4 trans(mat3);
trans.transpose();
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadMatrixf((F32 *)trans.mMatrix);
glMatrixMode(GL_MODELVIEW);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.pushMatrix();
gGL.loadMatrix((F32 *)trans.mMatrix);
gGL.matrixMode(LLRender::MM_MODELVIEW);
/*if (stage > 0)
{
@ -292,9 +293,9 @@ void LLCubeMap::restoreMatrix()
{
gGL.getTexUnit(mMatrixStage)->activate();
}
glMatrixMode(GL_TEXTURE);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
/*if (mMatrixStage > 0)
{

View File

@ -55,7 +55,10 @@ FT_Library gFTLibrary = NULL;
//static
void LLFontManager::initClass()
{
gFontManagerp = new LLFontManager;
if (!gFontManagerp)
{
gFontManagerp = new LLFontManager;
}
}
//static
@ -136,7 +139,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
FT_Done_Face(mFTFace);
mFTFace = NULL;
}
int error;
error = FT_New_Face( gFTLibrary,

View File

@ -56,8 +56,9 @@ std::string LLFontGL::sAppDir;
LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
LLFontRegistry* LLFontGL::sFontRegistry = NULL;
LLCoordFont LLFontGL::sCurOrigin;
std::vector<LLCoordFont> LLFontGL::sOriginStack;
LLCoordGL LLFontGL::sCurOrigin;
F32 LLFontGL::sCurDepth;
std::vector<std::pair<LLCoordGL, F32> > LLFontGL::sOriginStack;
const F32 EXT_X_BEARING = 1.f;
const F32 EXT_Y_BEARING = 0.f;
@ -68,20 +69,6 @@ const F32 PIXEL_CORRECTION_DISTANCE = 0.01f;
const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture
const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f;
static F32 llfont_round_x(F32 x)
{
//return llfloor((x-LLFontGL::sCurOrigin.mX)/LLFontGL::sScaleX+0.5f)*LLFontGL::sScaleX+LLFontGL::sCurOrigin.mX;
//return llfloor(x/LLFontGL::sScaleX+0.5f)*LLFontGL::sScaleY;
return x;
}
static F32 llfont_round_y(F32 y)
{
//return llfloor((y-LLFontGL::sCurOrigin.mY)/LLFontGL::sScaleY+0.5f)*LLFontGL::sScaleY+LLFontGL::sCurOrigin.mY;
//return llfloor(y+0.5f);
return y;
}
LLFontGL::LLFontGL()
{
}
@ -115,23 +102,23 @@ static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts");
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const
{
F32 x = rect.mLeft;
F32 x = (F32)rect.mLeft;
F32 y = 0.f;
switch(valign)
{
case TOP:
y = rect.mTop;
y = (F32)rect.mTop;
break;
case VCENTER:
y = rect.getCenterY();
y = (F32)rect.getCenterY();
break;
case BASELINE:
case BOTTOM:
y = rect.mBottom;
y = (F32)rect.mBottom;
break;
default:
y = rect.mBottom;
y = (F32)rect.mBottom;
break;
}
return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_ellipses);
@ -177,21 +164,11 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
gGL.loadUIIdentity();
//gGL.translateUI(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
// this code snaps the text origin to a pixel grid to start with
//F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
//F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
//gGL.translateUI(-pixel_offset_x, -pixel_offset_y, 0.f);
LLVector2 origin(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY));
// snap the text origin to a pixel grid to start with
origin.mV[VX] -= llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
origin.mV[VY] -= llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
// Depth translation, so that floating text appears 'inworld'
// and is correclty occluded.
gGL.translatef(0.f,0.f,sCurOrigin.mZ);
// Depth translation, so that floating text appears 'in-world'
// and is correctly occluded.
gGL.translatef(0.f,0.f,sCurDepth);
S32 chars_drawn = 0;
S32 i;
@ -215,16 +192,17 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
cur_y = ((F32)y * sScaleY) + origin.mV[VY];
// Offset y by vertical alignment.
// use unscaled font metrics here
switch (valign)
{
case TOP:
cur_y -= mFontFreetype->getAscenderHeight();
cur_y -= llceil(mFontFreetype->getAscenderHeight());
break;
case BOTTOM:
cur_y += mFontFreetype->getDescenderHeight();
cur_y += llceil(mFontFreetype->getDescenderHeight());
break;
case VCENTER:
cur_y -= (mFontFreetype->getAscenderHeight() - mFontFreetype->getDescenderHeight()) / 2.f;
cur_y -= llceil((llceil(mFontFreetype->getAscenderHeight()) - llceil(mFontFreetype->getDescenderHeight())) / 2.f);
break;
case BASELINE:
// Baseline, do nothing.
@ -250,7 +228,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
cur_render_y = cur_y;
cur_render_x = cur_x;
F32 start_x = llround(cur_x);
F32 start_x = (F32)llround(cur_x);
const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();
@ -304,6 +282,18 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
S32 next_bitmap_num = fgi->mBitmapNum;
if (next_bitmap_num != bitmap_num)
{
// Actually draw the queued glyphs before switching their texture;
// otherwise the queued glyphs will be taken from wrong textures.
if (glyph_count > 0)
{
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
}
gGL.end();
glyph_count = 0;
}
bitmap_num = next_bitmap_num;
LLImageGL *font_image = font_bitmap_cache->getImageGL(bitmap_num);
gGL.getTexUnit(0)->bind(font_image);
@ -322,10 +312,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
(fgi->mXBitmapOffset + fgi->mWidth) * inv_width,
(fgi->mYBitmapOffset - PAD_UVY) * inv_height);
// snap glyph origin to whole screen pixel
LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing),
llround(cur_render_y + (F32)fgi->mYBearing),
llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing),
(F32)llround(cur_render_y + (F32)fgi->mYBearing),
(F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
(F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
if (glyph_count >= GLYPH_BATCH_SIZE)
{
@ -378,12 +368,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
//FIXME: add underline as glyph?
if (style_to_add & UNDERLINE)
{
F32 descender = mFontFreetype->getDescenderHeight();
F32 descender = (F32)llfloor(mFontFreetype->getDescenderHeight());
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.begin(LLRender::LINES);
gGL.vertex2f(start_x, cur_y - (descender));
gGL.vertex2f(cur_x, cur_y - (descender));
gGL.vertex2f(start_x, cur_y - descender);
gGL.vertex2f(cur_x, cur_y - descender);
gGL.end();
}
@ -432,19 +422,9 @@ S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y
}
// font metrics - override for LLFontFreetype that returns units of virtual pixels
F32 LLFontGL::getLineHeight() const
S32 LLFontGL::getLineHeight() const
{
return (F32)llround(mFontFreetype->getLineHeight() / sScaleY);
}
F32 LLFontGL::getAscenderHeight() const
{
return (F32)llround(mFontFreetype->getAscenderHeight() / sScaleY);
}
F32 LLFontGL::getDescenderHeight() const
{
return (F32)llround(mFontFreetype->getDescenderHeight() / sScaleY);
return llceil(mFontFreetype->getAscenderHeight() / sScaleY) + llceil(mFontFreetype->getDescenderHeight() / sScaleY);
}
S32 LLFontGL::getWidth(const std::string& utf8text) const
@ -633,7 +613,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
}
// Round after kerning.
cur_x = llround(cur_x);
cur_x = (F32)llround(cur_x);
drawn_x = cur_x;
}
@ -704,7 +684,7 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_
}
// Round after kerning.
total_width = llround(total_width);
total_width = (F32)llround(total_width);
}
if (drawable_chars == 0)
@ -787,7 +767,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t
// Round after kerning.
cur_x = llround(cur_x);
cur_x = (F32)llround(cur_x);
}
return llmin(max_chars, pos - begin_offset);
@ -1134,22 +1114,22 @@ void LLFontGL::renderQuad(LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* c
{
S32 index = 0;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mTop), 0.f);
vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mTop, 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mTop), 0.f);
vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mTop, 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
colors_out[index] = color;
index++;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mBottom), 0.f);
vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mBottom, 0.f);
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
colors_out[index] = color;
index++;
vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mBottom), 0.f);
vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mBottom, 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
colors_out[index] = color;
}

View File

@ -115,9 +115,7 @@ public:
S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const;
// font metrics - override for LLFontFreetype that returns units of virtual pixels
F32 getLineHeight() const;
F32 getAscenderHeight() const;
F32 getDescenderHeight() const;
S32 getLineHeight() const;
S32 getWidth(const std::string& utf8text) const;
S32 getWidth(const llwchar* wchars) const;
@ -188,8 +186,9 @@ public:
static std::string getFontPathLocal();
static std::string getFontPathSystem();
static LLCoordFont sCurOrigin;
static std::vector<LLCoordFont> sOriginStack;
static LLCoordGL sCurOrigin;
static F32 sCurDepth;
static std::vector<std::pair<LLCoordGL, F32> > sOriginStack;
static LLColor4 sShadowColor;

Some files were not shown because too many files have changed in this diff Show More