summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/CMakeLists.txt2
-rwxr-xr-xindra/cmake/00-Common.cmake3
-rw-r--r--indra/cmake/GLEXT.cmake4
-rwxr-xr-xindra/cmake/Havok.cmake6
-rwxr-xr-xindra/cmake/JsonCpp.cmake4
-rwxr-xr-xindra/cmake/Variables.cmake1
-rwxr-xr-xindra/cmake/run_build_test.py19
-rw-r--r--indra/llappearance/llpolymorph.h10
-rw-r--r--indra/llappearance/llpolyskeletaldistortion.h13
-rwxr-xr-xindra/llaudio/CMakeLists.txt1
-rwxr-xr-xindra/llcharacter/llkeyframemotion.cpp2
-rwxr-xr-xindra/llcommon/llerror.cpp2
-rwxr-xr-xindra/llcommon/lleventcoro.h2
-rw-r--r--indra/llcommon/lltraceaccumulators.h18
-rwxr-xr-xindra/llcommon/tests/llerror_test.cpp2
-rwxr-xr-xindra/llcommon/tests/llleap_test.cpp10
-rwxr-xr-xindra/llcommon/tests/llprocess_test.cpp6
-rwxr-xr-xindra/llcommon/tests/llsdserialize_test.cpp41
-rwxr-xr-xindra/llimage/llimage.cpp16
-rwxr-xr-xindra/llimage/llimagefilter.cpp2
-rwxr-xr-xindra/llkdu/llimagej2ckdu.h2
-rwxr-xr-xindra/llkdu/llkdumem.h2
-rwxr-xr-xindra/llkdu/tests/llimagej2ckdu_test.cpp2
-rwxr-xr-xindra/llmath/llmath.h36
-rwxr-xr-xindra/llmath/llquantize.h4
-rwxr-xr-xindra/llmath/llvolume.cpp2
-rwxr-xr-xindra/llmath/tests/llquaternion_test.cpp4
-rwxr-xr-xindra/llmath/tests/mathmisc_test.cpp24
-rwxr-xr-xindra/llmath/tests/v4coloru_test.cpp8
-rwxr-xr-xindra/llmath/v4color.cpp8
-rwxr-xr-xindra/llmath/v4coloru.h22
-rwxr-xr-xindra/llmessage/llregionhandle.h4
-rwxr-xr-xindra/llmessage/llthrottle.cpp2
-rwxr-xr-xindra/llmessage/message.cpp2
-rwxr-xr-xindra/llplugin/llpluginclassmedia.cpp2
-rw-r--r--indra/llprimitive/llmaterial.cpp20
-rwxr-xr-xindra/llprimitive/llmodel.cpp4
-rwxr-xr-xindra/llprimitive/llprimitive.cpp16
-rwxr-xr-xindra/llprimitive/llvolumemessage.cpp64
-rwxr-xr-xindra/llrender/llfontfreetype.cpp4
-rwxr-xr-xindra/llrender/llfontgl.cpp32
-rwxr-xr-xindra/llrender/llglslshader.cpp2066
-rw-r--r--indra/llrender/llrender2dutils.cpp16
-rwxr-xr-xindra/llrender/llshadermgr.cpp13
-rw-r--r--indra/llrender/lluiimage.cpp4
-rwxr-xr-xindra/llrender/llvertexbuffer.cpp6
-rwxr-xr-xindra/llui/llaccordionctrl.cpp2
-rwxr-xr-xindra/llui/llbadge.cpp8
-rwxr-xr-xindra/llui/llbutton.cpp8
-rwxr-xr-xindra/llui/llfloater.cpp30
-rwxr-xr-xindra/llui/llfocusmgr.h2
-rwxr-xr-xindra/llui/llfolderview.cpp8
-rw-r--r--indra/llui/llfolderviewitem.cpp16
-rwxr-xr-xindra/llui/lllayoutstack.cpp22
-rwxr-xr-xindra/llui/lllineeditor.cpp20
-rwxr-xr-xindra/llui/llmenugl.cpp6
-rwxr-xr-xindra/llui/llmodaldialog.cpp2
-rwxr-xr-xindra/llui/llprogressbar.cpp2
-rwxr-xr-xindra/llui/llrngwriter.cpp2
-rwxr-xr-xindra/llui/llscrollcontainer.cpp2
-rwxr-xr-xindra/llui/llscrolllistctrl.cpp4
-rwxr-xr-xindra/llui/llspinctrl.cpp2
-rwxr-xr-xindra/llui/llstatbar.cpp2
-rwxr-xr-xindra/llui/llstatgraph.cpp2
-rwxr-xr-xindra/llui/lltextbase.cpp6
-rwxr-xr-xindra/llui/lltexteditor.cpp2
-rwxr-xr-xindra/llui/lltimectrl.cpp2
-rwxr-xr-xindra/llui/llui.cpp16
-rwxr-xr-xindra/llui/lluictrlfactory.h2
-rwxr-xr-xindra/llui/llurlentry.cpp6
-rwxr-xr-xindra/llui/llxuiparser.cpp4
-rw-r--r--indra/llwindow/llopenglview-objc.h1
-rw-r--r--indra/llwindow/llopenglview-objc.mm170
-rwxr-xr-xindra/llwindow/llwindowmacosx.cpp44
-rwxr-xr-xindra/media_plugins/winmmshim/forwarding_api.cpp4
-rwxr-xr-xindra/media_plugins/winmmshim/forwarding_api.h4
-rw-r--r--indra/newview/VIEWER_VERSION.txt2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl6
-rwxr-xr-xindra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl9
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl6
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl8
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl22
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/postgiF.glsl6
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl25
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl26
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl25
-rw-r--r--indra/newview/llappdelegate-objc.mm2
-rwxr-xr-xindra/newview/llcommunicationchannel.cpp2
-rwxr-xr-xindra/newview/lldrawable.cpp2
-rwxr-xr-xindra/newview/lldrawpoolavatar.cpp3
-rwxr-xr-xindra/newview/lldrawpoolbump.cpp4
-rwxr-xr-xindra/newview/llfasttimerview.cpp12
-rwxr-xr-xindra/newview/llfeaturemanager.cpp221
-rwxr-xr-xindra/newview/llfeaturemanager.h3
-rwxr-xr-xindra/newview/llfilepicker.cpp21
-rwxr-xr-xindra/newview/llflexibleobject.cpp2
-rw-r--r--indra/newview/llflickrconnect.cpp2
-rwxr-xr-xindra/newview/llfloaterbuyland.cpp4
-rw-r--r--indra/newview/llfloatergroupbulkban.cpp2
-rwxr-xr-xindra/newview/llfloaterland.cpp8
-rwxr-xr-xindra/newview/llfloaterlandholdings.cpp4
-rwxr-xr-xindra/newview/llfloatermap.cpp4
-rwxr-xr-xindra/newview/llfloaterpathfindingcharacters.cpp2
-rwxr-xr-xindra/newview/llfloaterpathfindingobjects.cpp2
-rwxr-xr-xindra/newview/llfloaterpreference.cpp4
-rwxr-xr-xindra/newview/llfloatersnapshot.cpp4
-rwxr-xr-xindra/newview/llfloaterworldmap.cpp6
-rwxr-xr-xindra/newview/llglsandbox.cpp60
-rwxr-xr-xindra/newview/llhudnametag.cpp2
-rwxr-xr-xindra/newview/lllandmarkactions.cpp10
-rwxr-xr-xindra/newview/lllogchat.cpp2
-rwxr-xr-xindra/newview/llmanip.cpp4
-rwxr-xr-xindra/newview/llmaniprotate.cpp18
-rwxr-xr-xindra/newview/llmanipscale.cpp14
-rwxr-xr-xindra/newview/llmaniptranslate.cpp8
-rwxr-xr-xindra/newview/llmediactrl.cpp18
-rwxr-xr-xindra/newview/llnetmap.cpp28
-rwxr-xr-xindra/newview/llpanelclassified.cpp6
-rw-r--r--indra/newview/llpanelgroupbulk.cpp2
-rwxr-xr-xindra/newview/llpanelgroupinvite.cpp2
-rwxr-xr-xindra/newview/llpanelgrouplandmoney.cpp4
-rwxr-xr-xindra/newview/llpanellandmarkinfo.cpp6
-rwxr-xr-xindra/newview/llpanelmaininventory.cpp2
-rwxr-xr-xindra/newview/llpanelobject.cpp12
-rwxr-xr-xindra/newview/llpanelpick.cpp6
-rwxr-xr-xindra/newview/llpanelplaceinfo.cpp12
-rwxr-xr-xindra/newview/llpanelplaceprofile.cpp2
-rwxr-xr-xindra/newview/llpanelprimmediacontrols.cpp8
-rwxr-xr-xindra/newview/llslurl.cpp24
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp16
-rwxr-xr-xindra/newview/llsurface.cpp12
-rwxr-xr-xindra/newview/lltoolselectland.cpp4
-rw-r--r--indra/newview/lltwitterconnect.cpp2
-rwxr-xr-xindra/newview/llviewerdisplay.cpp8
-rwxr-xr-xindra/newview/llviewerkeyboard.cpp6
-rwxr-xr-xindra/newview/llviewermedia.cpp6
-rwxr-xr-xindra/newview/llviewerparcelmgr.cpp18
-rwxr-xr-xindra/newview/llviewerpartsim.cpp2
-rwxr-xr-xindra/newview/llviewerpartsource.cpp2
-rwxr-xr-xindra/newview/llviewertextureanim.cpp2
-rwxr-xr-xindra/newview/llviewerwindow.cpp94
-rwxr-xr-xindra/newview/llvlcomposition.cpp12
-rwxr-xr-xindra/newview/llvoavatar.cpp329
-rwxr-xr-xindra/newview/llvoicevivox.cpp2
-rwxr-xr-xindra/newview/llvopartgroup.cpp2
-rwxr-xr-xindra/newview/llvovolume.cpp8
-rwxr-xr-xindra/newview/llwindowlistener.cpp49
-rwxr-xr-xindra/newview/llwlanimator.cpp2
-rwxr-xr-xindra/newview/llworld.cpp4
-rwxr-xr-xindra/newview/llworldmapview.cpp44
-rwxr-xr-xindra/test/llsd_new_tut.cpp11
-rwxr-xr-xindra/test/lltut.h4
-rwxr-xr-xindra/test/namedtempfile.h10
-rwxr-xr-xindra/tools/vstool/VSTool.exebin24576 -> 24576 bytes
-rwxr-xr-xindra/tools/vstool/main.cs8
155 files changed, 2108 insertions, 2182 deletions
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index 24ea59ca49..29f02b58ba 100755
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -60,6 +60,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}viewer_components)
# Legacy C++ tests. Build always, run if LL_TESTS is true.
add_subdirectory(${VIEWER_PREFIX}test)
+if (ENABLE_MEDIA_PLUGINS)
# viewer media plugins
add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins)
@@ -68,6 +69,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins)
add_subdirectory(${VIEWER_PREFIX}test_apps/llplugintest)
add_subdirectory(${VIEWER_PREFIX}test_apps/llfbconnecttest)
endif (LL_TESTS AND NOT LINUX)
+endif (ENABLE_MEDIA_PLUGINS)
if (LINUX)
add_subdirectory(${VIEWER_PREFIX}linux_crash_logger)
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index d2faa2d8c5..ec076837f4 100755
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -54,7 +54,8 @@ if (WINDOWS)
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"
CACHE STRING "C++ compiler release options" FORCE)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
+ # zlib has assembly-language object files incompatible with SAFESEH
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE /SAFESEH:NO /NODEFAULTLIB:LIBCMT")
set(CMAKE_CXX_STANDARD_LIBRARIES "")
set(CMAKE_C_STANDARD_LIBRARIES "")
diff --git a/indra/cmake/GLEXT.cmake b/indra/cmake/GLEXT.cmake
index 15f7e1f2d5..2a08c8fbae 100644
--- a/indra/cmake/GLEXT.cmake
+++ b/indra/cmake/GLEXT.cmake
@@ -2,9 +2,9 @@
include(Prebuilt)
if (NOT USESYSTEMLIBS)
- if (LINUX OR WINDOWS)
+ if (WINDOWS OR LINUX)
use_prebuilt_binary(glext)
- endif (LINUX OR WINDOWS)
+ endif (WINDOWS OR LINUX)
use_prebuilt_binary(glh-linear)
set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
endif (NOT USESYSTEMLIBS)
diff --git a/indra/cmake/Havok.cmake b/indra/cmake/Havok.cmake
index 8b7f01d20b..798e59a679 100755
--- a/indra/cmake/Havok.cmake
+++ b/indra/cmake/Havok.cmake
@@ -3,7 +3,7 @@
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
-use_prebuilt_binary(havok-source)
+use_prebuilt_binary(havok_source)
set(Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Source)
list(APPEND Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Demo)
@@ -68,7 +68,7 @@ foreach(HAVOK_LIB ${HAVOK_LIBS})
endif(DEBUG_PREBUILT)
endif("${havok_${HAVOK_LIB}_extracted}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted")
- if(${CMAKE_BINARY_DIR}/temp/havok-source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0)
+ if(${CMAKE_BINARY_DIR}/temp/havok_source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0)
if(DEBUG_PREBUILT)
MESSAGE(STATUS "Extracting ${HAVOK_LIB}...")
endif(DEBUG_PREBUILT)
@@ -111,7 +111,7 @@ foreach(HAVOK_LIB ${HAVOK_LIBS})
set(havok_${HAVOK_LIB}_extracted 0)
file(WRITE ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted "${havok_${HAVOK_LIB}_extracted}")
- endif(${CMAKE_BINARY_DIR}/temp/havok-source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0)
+ endif(${CMAKE_BINARY_DIR}/temp/havok_source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0)
file(GLOB extracted_debug "${debug_dir}/*.o")
file(GLOB extracted_release "${release_dir}/*.o")
diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake
index d6d05af315..bf2d470269 100755
--- a/indra/cmake/JsonCpp.cmake
+++ b/indra/cmake/JsonCpp.cmake
@@ -11,8 +11,8 @@ else (USESYSTEMLIBS)
use_prebuilt_binary(jsoncpp)
if (WINDOWS)
set(JSONCPP_LIBRARIES
- debug json_vc100debug_libmt.lib
- optimized json_vc100_libmt)
+ debug json_libmtd.lib
+ optimized json_libmt)
elseif (DARWIN)
set(JSONCPP_LIBRARIES libjson_darwin_libmt.a)
elseif (LINUX)
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 8e220162ce..faca12c347 100755
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -26,6 +26,7 @@ set(VIEWER_PREFIX)
set(INTEGRATION_TESTS_PREFIX)
set(LL_TESTS ON CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation")
set(INCREMENTAL_LINK OFF CACHE BOOL "Use incremental linking on win32 builds (enable for faster links on some machines)")
+set(ENABLE_MEDIA_PLUGINS OFF CACHE BOOL "Turn off building media plugins if they are imported by third-party library mechanism")
if(LIBS_CLOSED_DIR)
file(TO_CMAKE_PATH "${LIBS_CLOSED_DIR}" LIBS_CLOSED_DIR)
diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py
index a2ef61c8fd..582185e5ab 100755
--- a/indra/cmake/run_build_test.py
+++ b/indra/cmake/run_build_test.py
@@ -46,6 +46,7 @@ $/LicenseInfo$
import os
import sys
+import errno
import signal
import subprocess
@@ -112,7 +113,23 @@ def main(command, libpath=[], vars={}):
print "Running: %s" % " ".join(command)
# Make sure we see all relevant output *before* child-process output.
sys.stdout.flush()
- return subprocess.call(command)
+ try:
+ return subprocess.call(command)
+ except OSError as err:
+ # If the caller is trying to execute a test program that doesn't
+ # exist, we want to produce a reasonable error message rather than a
+ # traceback. This happens when the build is halted by errors, but
+ # CMake tries to proceed with testing anyway <eyeroll/>. However, do
+ # NOT attempt to handle any error but "doesn't exist."
+ if err.errno != errno.ENOENT:
+ raise
+ # In practice, the pathnames into CMake's build tree are so long as to
+ # obscure the name of the test program. Just print its basename.
+ print "No such program %s; check for preceding build errors" % \
+ os.path.basename(command[0])
+ # What rc should we simulate for missing executable? Windows produces
+ # 9009.
+ return 9009
# swiped from vita, sigh, seems like a Bad Idea to introduce dependency
def translate_rc(rc):
diff --git a/indra/llappearance/llpolymorph.h b/indra/llappearance/llpolymorph.h
index 7e712f9e94..3c2c68079c 100644
--- a/indra/llappearance/llpolymorph.h
+++ b/indra/llappearance/llpolymorph.h
@@ -182,6 +182,16 @@ public:
void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);
void addPendingMorphMask() { mNumMorphMasksPending++; }
+ void* operator new(size_t size)
+ {
+ return ll_aligned_malloc_16(size);
+ }
+
+ void operator delete(void* ptr)
+ {
+ ll_aligned_free_16(ptr);
+ }
+
protected:
LLPolyMorphTarget(const LLPolyMorphTarget& pOther);
diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h
index ea2adb8a87..ab1a132d19 100644
--- a/indra/llappearance/llpolyskeletaldistortion.h
+++ b/indra/llappearance/llpolyskeletaldistortion.h
@@ -73,6 +73,19 @@ public:
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+
+
+ void* operator new(size_t size)
+ {
+ return ll_aligned_malloc_16(size);
+ }
+
+ void operator delete(void* ptr)
+ {
+ ll_aligned_free_16(ptr);
+ }
+
+
protected:
typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
bone_info_list_t mBoneInfoList;
diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt
index 1b2bdb9888..e943dd5d5c 100755
--- a/indra/llaudio/CMakeLists.txt
+++ b/indra/llaudio/CMakeLists.txt
@@ -3,7 +3,6 @@
project(llaudio)
include(00-Common)
-include(Audio)
include(LLAudio)
include(FMODEX)
include(OPENAL)
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 18844e9e51..cd201a65b4 100755
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -1048,7 +1048,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
LLVector3 source_to_target = target_pos - keyframe_source_pos;
- S32 max_iteration_count = llround(clamp_rescale(
+ S32 max_iteration_count = ll_round(clamp_rescale(
mCharacter->getPixelArea(),
MAX_PIXEL_AREA_CONSTRAINTS,
MIN_PIXEL_AREA_CONSTRAINTS,
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 22cd861c72..8119b14887 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -126,7 +126,7 @@ namespace {
mFile.close();
}
- bool okay() { return mFile; }
+ bool okay() { return mFile.good(); }
virtual void recordMessage(LLError::ELevel level,
const std::string& message)
diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h
index f55b74ac7e..abbeeaa373 100755
--- a/indra/llcommon/lleventcoro.h
+++ b/indra/llcommon/lleventcoro.h
@@ -67,7 +67,7 @@ public:
LLEventPumpOrPumpName() {}
operator LLEventPump& () const { return *mPump; }
LLEventPump& getPump() const { return *mPump; }
- operator bool() const { return mPump; }
+ operator bool() const { return bool(mPump); }
bool operator!() const { return ! mPump; }
private:
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index 42fad8a793..6f27b97dff 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -62,11 +62,11 @@ namespace LLTrace
{}
public:
-
- AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer())
- : mStorageSize(0),
+ AccumulatorBuffer()
+ : mStorageSize(0),
mStorage(NULL)
{
+ const AccumulatorBuffer& other = *getDefaultBuffer();
resize(sNextStorageSlot);
for (S32 i = 0; i < sNextStorageSlot; i++)
{
@@ -93,6 +93,18 @@ namespace LLTrace
return mStorage[index];
}
+
+ AccumulatorBuffer(const AccumulatorBuffer& other)
+ : mStorageSize(0),
+ mStorage(NULL)
+ {
+ resize(sNextStorageSlot);
+ for (S32 i = 0; i < sNextStorageSlot; i++)
+ {
+ mStorage[i] = other.mStorage[i];
+ }
+ }
+
void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other, EBufferAppendType append_type)
{
llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot);
diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp
index fee9492618..f51279e817 100755
--- a/indra/llcommon/tests/llerror_test.cpp
+++ b/indra/llcommon/tests/llerror_test.cpp
@@ -38,7 +38,9 @@
namespace
{
+#ifdef __clang__
# pragma clang diagnostic ignored "-Wunused-function"
+#endif
void test_that_error_h_includes_enough_things_to_compile_a_message()
{
LL_INFOS() << "!" << LL_ENDL;
diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp
index 9ea822cb8d..653b043de4 100755
--- a/indra/llcommon/tests/llleap_test.cpp
+++ b/indra/llcommon/tests/llleap_test.cpp
@@ -17,7 +17,7 @@
// std headers
// external library headers
#include <boost/assign/list_of.hpp>
-#include <boost/lambda/lambda.hpp>
+#include <boost/phoenix/core/argument.hpp>
#include <boost/foreach.hpp>
// other Linden headers
#include "../test/lltut.h"
@@ -109,7 +109,7 @@ namespace tut
llleap_data():
reader(".py",
// This logic is adapted from vita.viewerclient.receiveEvent()
- boost::lambda::_1 <<
+ boost::phoenix::placeholders::arg1 <<
"import re\n"
"import os\n"
"import sys\n"
@@ -403,7 +403,7 @@ namespace tut
AckAPI api;
Result result;
NamedTempFile script("py",
- boost::lambda::_1 <<
+ boost::phoenix::placeholders::arg1 <<
"from " << reader_module << " import *\n"
// make a request on our little API
"request(pump='" << api.getName() << "', data={})\n"
@@ -441,7 +441,7 @@ namespace tut
ReqIDAPI api;
Result result;
NamedTempFile script("py",
- boost::lambda::_1 <<
+ boost::phoenix::placeholders::arg1 <<
"import sys\n"
"from " << reader_module << " import *\n"
// Note that since reader imports llsd, this
@@ -484,7 +484,7 @@ namespace tut
ReqIDAPI api;
Result result;
NamedTempFile script("py",
- boost::lambda::_1 <<
+ boost::phoenix::placeholders::arg1 <<
"import sys\n"
"from " << reader_module << " import *\n"
// Generate a very large string value.
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp
index e4e766d51b..5ba343b183 100755
--- a/indra/llcommon/tests/llprocess_test.cpp
+++ b/indra/llcommon/tests/llprocess_test.cpp
@@ -85,7 +85,7 @@ static std::string readfile(const std::string& pathname, const std::string& desc
}
std::ifstream inf(pathname.c_str());
std::string output;
- tut::ensure(STRINGIZE("No output " << use_desc), std::getline(inf, output));
+ tut::ensure(STRINGIZE("No output " << use_desc), bool(std::getline(inf, output)));
std::string more;
while (std::getline(inf, more))
{
@@ -154,7 +154,7 @@ struct PythonProcessLauncher
void launch()
{
mPy = LLProcess::create(mParams);
- tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), mPy);
+ tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), bool(mPy));
}
/// Run Python script and wait for it to complete.
@@ -873,7 +873,7 @@ namespace tut
std::string threw; \
/* Both the following calls should work. */ \
(PROCESS).GETPIPE(VALID); \
- ensure(#GETOPTPIPE "(" #VALID ") failed", (PROCESS).GETOPTPIPE(VALID)); \
+ ensure(#GETOPTPIPE "(" #VALID ") failed", bool((PROCESS).GETOPTPIPE(VALID))); \
/* pass obviously bogus PIPESLOT */ \
CATCH_IN(threw, LLProcess::NoPipe, (PROCESS).GETPIPE(LLProcess::FILESLOT(4))); \
ensure_contains("didn't reject bad slot", threw, "no slot"); \
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index b5893135ea..6fbb9abfc0 100755
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -46,9 +46,10 @@ typedef U32 uint32_t;
#include "boost/range.hpp"
#include "boost/foreach.hpp"
#include "boost/function.hpp"
-#include "boost/lambda/lambda.hpp"
-#include "boost/lambda/bind.hpp"
-namespace lambda = boost::lambda;
+#include "boost/bind.hpp"
+#include "boost/phoenix/bind/bind_function.hpp"
+#include "boost/phoenix/core/argument.hpp"
+using namespace boost::phoenix;
#include "../llsd.h"
#include "../llsdserialize.h"
@@ -1612,6 +1613,20 @@ namespace tut
"print 'Running on', sys.platform\n");
}
+ // helper for test<3>
+ static void writeLLSDArray(std::ostream& out, const LLSD& array)
+ {
+ BOOST_FOREACH(LLSD item, llsd::inArray(array))
+ {
+ LLSDSerialize::toNotation(item, out);
+ // It's important to separate with newlines because Python's llsd
+ // module doesn't support parsing from a file stream, only from a
+ // string, so we have to know how much of the file to read into a
+ // string.
+ out << '\n';
+ }
+ }
+
template<> template<>
void TestPythonCompatibleObject::test<3>()
{
@@ -1639,26 +1654,16 @@ namespace tut
" assert False, 'Too many data items'\n";
// Create an llsdXXXXXX file containing 'data' serialized to
- // notation. It's important to separate with newlines because Python's
- // llsd module doesn't support parsing from a file stream, only from a
- // string, so we have to know how much of the file to read into a
- // string.
+ // notation.
NamedTempFile file("llsd",
// NamedTempFile's boost::function constructor
// takes a callable. To this callable it passes the
// std::ostream with which it's writing the
- // NamedTempFile. This lambda-based expression
- // first calls LLSD::Serialize() with that ostream,
- // then streams a newline to it, etc.
- (lambda::bind(LLSDSerialize::toNotation, cdata[0], lambda::_1),
- lambda::_1 << '\n',
- lambda::bind(LLSDSerialize::toNotation, cdata[1], lambda::_1),
- lambda::_1 << '\n',
- lambda::bind(LLSDSerialize::toNotation, cdata[2], lambda::_1),
- lambda::_1 << '\n'));
+ // NamedTempFile.
+ boost::bind(writeLLSDArray, _1, cdata));
python("read C++ notation",
- lambda::_1 <<
+ placeholders::arg1 <<
import_llsd <<
"def parse_each(iterable):\n"
" for item in iterable:\n"
@@ -1679,7 +1684,7 @@ namespace tut
NamedTempFile file("llsd", "");
python("write Python notation",
- lambda::_1 <<
+ placeholders::arg1 <<
"from __future__ import with_statement\n" <<
import_llsd <<
"DATA = [\n"
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index d336eeaabc..ecdcd95d29 100755
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -1036,13 +1036,13 @@ void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixe
a *= norm_factor; // skip conditional
S32 t4 = x * out_pixel_step * components;
- out[t4 + 0] = U8(llround(r));
+ out[t4 + 0] = U8(ll_round(r));
if (components >= 2)
- out[t4 + 1] = U8(llround(g));
+ out[t4 + 1] = U8(ll_round(g));
if (components >= 3)
- out[t4 + 2] = U8(llround(b));
+ out[t4 + 2] = U8(ll_round(b));
if( components == 4)
- out[t4 + 3] = U8(llround(a));
+ out[t4 + 3] = U8(ll_round(a));
}
}
}
@@ -1117,10 +1117,10 @@ void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S3
b *= norm_factor;
a *= norm_factor;
- in_scaled_r = U8(llround(r));
- in_scaled_g = U8(llround(g));
- in_scaled_b = U8(llround(b));
- in_scaled_a = U8(llround(a));
+ in_scaled_r = U8(ll_round(r));
+ in_scaled_g = U8(ll_round(g));
+ in_scaled_b = U8(ll_round(b));
+ in_scaled_a = U8(ll_round(a));
}
if( in_scaled_a )
diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp
index 3d0c488768..0b9d136910 100755
--- a/indra/llimage/llimagefilter.cpp
+++ b/indra/llimage/llimagefilter.cpp
@@ -266,7 +266,7 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image)
}
else
{
- llwarns << "Filter unknown, cannot execute filter command : " << filter_name << llendl;
+ LL_WARNS() << "Filter unknown, cannot execute filter command : " << filter_name << LL_ENDL;
}
}
}
diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h
index 762476ce69..02281152bf 100755
--- a/indra/llkdu/llimagej2ckdu.h
+++ b/indra/llkdu/llimagej2ckdu.h
@@ -43,7 +43,7 @@
#pragma clang diagnostic ignored "-Wunused-private-field"
#include "kdu_compressed.h"
#pragma clang diagnostic pop
-#elif
+#else
#include "kdu_compressed.h"
#endif
diff --git a/indra/llkdu/llkdumem.h b/indra/llkdu/llkdumem.h
index a0d304868e..fab913d93b 100755
--- a/indra/llkdu/llkdumem.h
+++ b/indra/llkdu/llkdumem.h
@@ -36,7 +36,7 @@
#pragma clang diagnostic ignored "-Wunused-private-field"
#include "kdu_image.h"
#pragma clang diagnostic pop
-#elif
+#else
#include "kdu_image.h"
#endif
diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp
index 1c9969a5df..dd20ac295d 100755
--- a/indra/llkdu/tests/llimagej2ckdu_test.cpp
+++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp
@@ -34,7 +34,7 @@
#pragma clang diagnostic ignored "-Wunused-private-field"
#include "llkdumem.h"
#pragma clang diagnostic pop
-#elif
+#else
#include "llkdumem.h"
#endif
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index a8b27ad189..93b9f22b25 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -206,16 +206,16 @@ inline S32 llceil( F32 f )
#ifndef BOGUS_ROUND
// Use this round. Does an arithmetic round (0.5 always rounds up)
-inline S32 llround(const F32 val)
+inline S32 ll_round(const F32 val)
{
return llfloor(val + 0.5f);
}
#else // BOGUS_ROUND
-// Old llround implementation - does banker's round (toward nearest even in the case of a 0.5.
+// Old ll_round implementation - does banker's round (toward nearest even in the case of a 0.5.
// Not using this because we don't have a consistent implementation on both platforms, use
// llfloor(val + 0.5f), which is consistent on all platforms.
-inline S32 llround(const F32 val)
+inline S32 ll_round(const F32 val)
{
#if LL_WINDOWS
// Note: assumes that the floating point control word is set to rounding mode (the default)
@@ -254,12 +254,12 @@ inline int round_int(double x)
}
#endif // BOGUS_ROUND
-inline F32 llround( F32 val, F32 nearest )
+inline F32 ll_round( F32 val, F32 nearest )
{
return F32(floor(val * (1.0f / nearest) + 0.5f)) * nearest;
}
-inline F64 llround( F64 val, F64 nearest )
+inline F64 ll_round( F64 val, F64 nearest )
{
return F64(floor(val * (1.0 / nearest) + 0.5)) * nearest;
}
@@ -309,25 +309,6 @@ const S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point represe
#define LL_MAN_INDEX 1
#endif
-/* Deprecated: use llround(), lltrunc(), or llfloor() instead
-// ================================================================================================
-// Real2Int
-// ================================================================================================
-inline S32 F64toS32(F64 val)
-{
- val = val + LL_DOUBLE_TO_FIX_MAGIC;
- return ((S32*)&val)[LL_MAN_INDEX] >> LL_SHIFT_AMOUNT;
-}
-
-// ================================================================================================
-// Real2Int
-// ================================================================================================
-inline S32 F32toS32(F32 val)
-{
- return F64toS32 ((F64)val);
-}
-*/
-
////////////////////////////////////////////////
//
// Fast exp and log
@@ -351,9 +332,7 @@ static union
#define LL_EXP_A (1048576 * OO_LN2) // use 1512775 for integer
#define LL_EXP_C (60801) // this value of C good for -4 < y < 4
-#define LL_FAST_EXP(y) (LLECO.n.i = llround(F32(LL_EXP_A*(y))) + (1072693248 - LL_EXP_C), LLECO.d)
-
-
+#define LL_FAST_EXP(y) (LLECO.n.i = ll_round(F32(LL_EXP_A*(y))) + (1072693248 - LL_EXP_C), LLECO.d)
inline F32 llfastpow(const F32 x, const F32 y)
{
@@ -370,9 +349,6 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs)
bar *= 10.f;
}
- //F32 new_foo = (F32)llround(foo * bar);
- // the llround() implementation sucks. Don't us it.
-
F32 sign = (foo > 0.f) ? 1.f : -1.f;
F32 new_foo = F32( S64(foo * bar + sign * 0.5f));
new_foo /= bar;
diff --git a/indra/llmath/llquantize.h b/indra/llmath/llquantize.h
index 1595dbecf8..10c950abbb 100755
--- a/indra/llmath/llquantize.h
+++ b/indra/llmath/llquantize.h
@@ -52,7 +52,7 @@ inline U16 F32_to_U16_ROUND(F32 val, F32 lower, F32 upper)
val /= (upper - lower);
// round the value. Sreturn the U16
- return (U16)(llround(val*U16MAX));
+ return (U16)(ll_round(val*U16MAX));
}
@@ -92,7 +92,7 @@ inline U8 F32_to_U8_ROUND(F32 val, F32 lower, F32 upper)
val /= (upper - lower);
// return the rounded U8
- return (U8)(llround(val*U8MAX));
+ return (U8)(ll_round(val*U8MAX));
}
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 49cd970392..dedd90eab2 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -558,7 +558,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3
// Scale to have size "match" scale. Compensates to get object to generally fill bounding box.
- S32 total_sides = llround(sides / ang_scale); // Total number of sides all around
+ S32 total_sides = ll_round(sides / ang_scale); // Total number of sides all around
if (total_sides < 8)
{
diff --git a/indra/llmath/tests/llquaternion_test.cpp b/indra/llmath/tests/llquaternion_test.cpp
index e69010b2d6..3490829743 100755
--- a/indra/llmath/tests/llquaternion_test.cpp
+++ b/indra/llmath/tests/llquaternion_test.cpp
@@ -175,10 +175,10 @@ namespace tut
void llquat_test_object_t::test<6>()
{
LLQuaternion quat1(3.0f, 2.0f, 6.0f, 0.0f), quat2(1.0f, 1.0f, 1.0f, 1.0f);
- ensure("1. The two values are different", llround(12.000000f, 2) == llround(dot(quat1, quat2), 2));
+ ensure("1. The two values are different", ll_round(12.000000f, 2) == ll_round(dot(quat1, quat2), 2));
LLQuaternion quat0(3.0f, 9.334f, 34.5f, 23.0f), quat(34.5f, 23.23f, 2.0f, 45.5f);
- ensure("2. The two values are different", llround(1435.828807f, 2) == llround(dot(quat0, quat), 2));
+ ensure("2. The two values are different", ll_round(1435.828807f, 2) == ll_round(dot(quat0, quat), 2));
}
//test case for LLQuaternion &LLQuaternion::constrain(F32 radians) fn.
diff --git a/indra/llmath/tests/mathmisc_test.cpp b/indra/llmath/tests/mathmisc_test.cpp
index 91a2e6c009..f12140cf8f 100755
--- a/indra/llmath/tests/mathmisc_test.cpp
+++ b/indra/llmath/tests/mathmisc_test.cpp
@@ -128,33 +128,33 @@ namespace tut
void math_object::test<8>()
{
F32 val = 430903.2f;
- S32 val1 = llround(val);
- ensure("float llround value 1", (430903 == val1));
+ S32 val1 = ll_round(val);
+ ensure("float ll_round value 1", (430903 == val1));
val = -430903.9f;
- val1 = llround(val);
- ensure("float llround value 2", (-430904 == val1));
+ val1 = ll_round(val);
+ ensure("float ll_round value 2", (-430904 == val1));
}
template<> template<>
void math_object::test<9>()
{
F32 val = 430905.2654f, nearest = 100.f;
- val = llround(val, nearest);
- ensure("float llround value 1", (430900 == val));
+ val = ll_round(val, nearest);
+ ensure("float ll_round value 1", (430900 == val));
val = -430905.2654f, nearest = 10.f;
- val = llround(val, nearest);
- ensure("float llround value 1", (-430910 == val));
+ val = ll_round(val, nearest);
+ ensure("float ll_round value 1", (-430910 == val));
}
template<> template<>
void math_object::test<10>()
{
F64 val = 430905.2654, nearest = 100.0;
- val = llround(val, nearest);
- ensure("double llround value 1", (430900 == val));
+ val = ll_round(val, nearest);
+ ensure("double ll_round value 1", (430900 == val));
val = -430905.2654, nearest = 10.0;
- val = llround(val, nearest);
- ensure("double llround value 1", (-430910.00000 == val));
+ val = ll_round(val, nearest);
+ ensure("double ll_round value 1", (-430910.00000 == val));
}
template<> template<>
diff --git a/indra/llmath/tests/v4coloru_test.cpp b/indra/llmath/tests/v4coloru_test.cpp
index 128f6f3564..12e607a820 100755
--- a/indra/llmath/tests/v4coloru_test.cpp
+++ b/indra/llmath/tests/v4coloru_test.cpp
@@ -300,8 +300,8 @@ namespace tut
LLColor4U llcolor4u(r,g,b,a),llcolor4u1;
const F32 fVal = 3.f;
llcolor4u1 = llcolor4u.multAll(fVal);
- ensure("multAll:Fail to multiply ", (((U8)llround(r * fVal) == llcolor4u1.mV[VX]) && (U8)llround(g * fVal) == llcolor4u1.mV[VY]
- && ((U8)llround(b * fVal) == llcolor4u1.mV[VZ])&& ((U8)llround(a * fVal) == llcolor4u1.mV[VW])));
+ ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VX]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VY]
+ && ((U8)ll_round(b * fVal) == llcolor4u1.mV[VZ])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VW])));
}
template<> template<>
@@ -329,8 +329,8 @@ namespace tut
llcolor4u.setVecScaleClamp(color3);
const S32 MAX_COLOR = 255;
F32 color_scale_factor = MAX_COLOR/r;
- S32 r2 = llround(r * color_scale_factor);
- S32 g2 = llround(g * color_scale_factor);
+ S32 r2 = ll_round(r * color_scale_factor);
+ S32 g2 = ll_round(g * color_scale_factor);
ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VX]) && (g2 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW])));
}
}
diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp
index cd2be7c8fd..79a64b24f2 100755
--- a/indra/llmath/v4color.cpp
+++ b/indra/llmath/v4color.cpp
@@ -125,10 +125,10 @@ LLColor4 LLColor4::cyan6(0.2f, 0.6f, 0.6f, 1.0f);
LLColor4::operator const LLColor4U() const
{
return LLColor4U(
- (U8)llclampb(llround(mV[VRED]*255.f)),
- (U8)llclampb(llround(mV[VGREEN]*255.f)),
- (U8)llclampb(llround(mV[VBLUE]*255.f)),
- (U8)llclampb(llround(mV[VALPHA]*255.f)));
+ (U8)llclampb(ll_round(mV[VRED]*255.f)),
+ (U8)llclampb(ll_round(mV[VGREEN]*255.f)),
+ (U8)llclampb(ll_round(mV[VBLUE]*255.f)),
+ (U8)llclampb(ll_round(mV[VALPHA]*255.f)));
}
LLColor4::LLColor4(const LLColor3 &vec, F32 a)
diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h
index 12da7e2dd7..fddad34978 100755
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -353,10 +353,10 @@ inline LLColor4U LLColor4U::multAll(const F32 k)
{
// Round to nearest
return LLColor4U(
- (U8)llround(mV[VX] * k),
- (U8)llround(mV[VY] * k),
- (U8)llround(mV[VZ] * k),
- (U8)llround(mV[VW] * k));
+ (U8)ll_round(mV[VX] * k),
+ (U8)ll_round(mV[VY] * k),
+ (U8)ll_round(mV[VZ] * k),
+ (U8)ll_round(mV[VW] * k));
}
/*
inline LLColor4U operator*(const LLColor4U &a, U8 k)
@@ -471,7 +471,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
color_scale_factor /= max_color;
}
const S32 MAX_COLOR = 255;
- S32 r = llround(color.mV[0] * color_scale_factor);
+ S32 r = ll_round(color.mV[0] * color_scale_factor);
if (r > MAX_COLOR)
{
r = MAX_COLOR;
@@ -482,7 +482,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
}
mV[0] = r;
- S32 g = llround(color.mV[1] * color_scale_factor);
+ S32 g = ll_round(color.mV[1] * color_scale_factor);
if (g > MAX_COLOR)
{
g = MAX_COLOR;
@@ -493,7 +493,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
}
mV[1] = g;
- S32 b = llround(color.mV[2] * color_scale_factor);
+ S32 b = ll_round(color.mV[2] * color_scale_factor);
if (b > MAX_COLOR)
{
b = MAX_COLOR;
@@ -505,7 +505,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
mV[2] = b;
// Alpha shouldn't be scaled, just clamped...
- S32 a = llround(color.mV[3] * MAX_COLOR);
+ S32 a = ll_round(color.mV[3] * MAX_COLOR);
if (a > MAX_COLOR)
{
a = MAX_COLOR;
@@ -527,7 +527,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
}
const S32 MAX_COLOR = 255;
- S32 r = llround(color.mV[0] * color_scale_factor);
+ S32 r = ll_round(color.mV[0] * color_scale_factor);
if (r > MAX_COLOR)
{
r = MAX_COLOR;
@@ -539,7 +539,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
}
mV[0] = r;
- S32 g = llround(color.mV[1] * color_scale_factor);
+ S32 g = ll_round(color.mV[1] * color_scale_factor);
if (g > MAX_COLOR)
{
g = MAX_COLOR;
@@ -551,7 +551,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
}
mV[1] = g;
- S32 b = llround(color.mV[2] * color_scale_factor);
+ S32 b = ll_round(color.mV[2] * color_scale_factor);
if (b > MAX_COLOR)
{
b = MAX_COLOR;
diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h
index e3ddd46acd..085757dcbc 100755
--- a/indra/llmessage/llregionhandle.h
+++ b/indra/llmessage/llregionhandle.h
@@ -73,7 +73,7 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl
}
else
{
- x_int = (U32)llround(x_pos);
+ x_int = (U32)ll_round(x_pos);
}
if (y_pos < 0.f)
{
@@ -82,7 +82,7 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl
}
else
{
- y_int = (U32)llround(y_pos);
+ y_int = (U32)ll_round(y_pos);
}
*region_handle = to_region_handle(x_int, y_int);
return TRUE;
diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp
index e484bd258d..7605da4d3f 100755
--- a/indra/llmessage/llthrottle.cpp
+++ b/indra/llmessage/llthrottle.cpp
@@ -391,7 +391,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
}
mBitsSentThisPeriod[i] = 0;
- total += llround(mBitsSentHistory[i]);
+ total += ll_round(mBitsSentHistory[i]);
}
// Look for busy channels
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index cc2d5d66ad..0c3c14969b 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -2752,7 +2752,7 @@ void LLMessageSystem::dumpReceiveCounts()
if (mt->mReceiveCount > 0)
{
LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
- << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime.value()) << "%" << LL_ENDL;
+ << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << ll_round(100 * mt->mDecodeTimeThisFrame / mReceiveTime.value()) << "%" << LL_ENDL;
}
}
}
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 0644d2638c..52626b0302 100755
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -32,8 +32,6 @@
#include "llpluginclassmedia.h"
#include "llpluginmessageclasses.h"
-#include "llqtwebkit.h"
-
static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256;
static int nextPowerOf2( int value )
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index 7f3c8da434..57ceb3e11b 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -119,18 +119,18 @@ LLSD LLMaterial::asLLSD() const
LLSD material_data;
material_data[MATERIALS_CAP_NORMAL_MAP_FIELD] = mNormalID;
- material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = llround(mNormalOffsetX * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = llround(mNormalOffsetY * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = llround(mNormalRepeatX * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = llround(mNormalRepeatY * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = llround(mNormalRotation * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = ll_round(mNormalOffsetX * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = ll_round(mNormalOffsetY * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = ll_round(mNormalRepeatX * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = ll_round(mNormalRepeatY * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = ll_round(mNormalRotation * MATERIALS_MULTIPLIER);
material_data[MATERIALS_CAP_SPECULAR_MAP_FIELD] = mSpecularID;
- material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = llround(mSpecularOffsetX * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = llround(mSpecularOffsetY * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = llround(mSpecularRepeatX * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = llround(mSpecularRepeatY * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = llround(mSpecularRotation * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = ll_round(mSpecularOffsetX * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = ll_round(mSpecularOffsetY * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = ll_round(mSpecularRepeatX * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = ll_round(mSpecularRepeatY * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = ll_round(mSpecularRotation * MATERIALS_MULTIPLIER);
material_data[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = mSpecularLightColor.getValue();
material_data[MATERIALS_CAP_SPECULAR_EXP_FIELD] = mSpecularLightExponent;
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index b4963225dc..b19df0200d 100755
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -172,7 +172,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (!pos_source)
{
- llwarns << "Unable to process mesh without position data; invalid model; invalid model." << llendl;
+ LL_WARNS() << "Unable to process mesh without position data; invalid model; invalid model." << LL_ENDL;
return LLModel::BAD_ELEMENT;
}
@@ -193,7 +193,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if ((vertex_count == 0) || (tc_count == 0))
{
- llwarns << "Unable to process mesh with empty position array; invalid model." << llendl;
+ LL_WARNS() << "Unable to process mesh with empty position array; invalid model." << LL_ENDL;
return LLModel::BAD_ELEMENT;
}
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 3bbc5d5571..6e4ccb9ea1 100755
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -1144,12 +1144,12 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const
const LLTextureEntry* te = getTE(face_index);
scale_s[face_index] = (F32) te->mScaleS;
scale_t[face_index] = (F32) te->mScaleT;
- offset_s[face_index] = (S16) llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
- offset_t[face_index] = (S16) llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
- image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
+ offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
bump[face_index] = te->getBumpShinyFullbright();
media_flags[face_index] = te->getMediaTexGen();
- glow[face_index] = (U8) llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
+ glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
// Directly sending material_ids is not safe!
memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */
@@ -1229,12 +1229,12 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const
const LLTextureEntry* te = getTE(face_index);
scale_s[face_index] = (F32) te->mScaleS;
scale_t[face_index] = (F32) te->mScaleT;
- offset_s[face_index] = (S16) llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
- offset_t[face_index] = (S16) llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
- image_rot[face_index] = (S16) llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
+ offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
+ image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
bump[face_index] = te->getBumpShinyFullbright();
media_flags[face_index] = te->getMediaTexGen();
- glow[face_index] = (U8) llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
+ glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
// Directly sending material_ids is not safe!
memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */
diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp
index a2c2666146..8d47a7147f 100755
--- a/indra/llprimitive/llvolumemessage.cpp
+++ b/indra/llprimitive/llvolumemessage.cpp
@@ -52,13 +52,13 @@ bool LLVolumeMessage::packProfileParams(
tempU8 = params->getCurveType();
mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8);
- tempU16 = (U16) llround( params->getBegin() / CUT_QUANTA);
+ tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA);
mesgsys->addU16Fast(_PREHASH_ProfileBegin, tempU16);
- tempU16 = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
+ tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
mesgsys->addU16Fast(_PREHASH_ProfileEnd, tempU16);
- tempU16 = (U16) llround(params->getHollow() / HOLLOW_QUANTA);
+ tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA);
mesgsys->addU16Fast(_PREHASH_ProfileHollow, tempU16);
return true;
@@ -80,13 +80,13 @@ bool LLVolumeMessage::packProfileParams(
tempU8 = params->getCurveType();
dp.packU8(tempU8, "Curve");
- tempU16 = (U16) llround( params->getBegin() / CUT_QUANTA);
+ tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA);
dp.packU16(tempU16, "Begin");
- tempU16 = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
+ tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
dp.packU16(tempU16, "End");
- tempU16 = (U16) llround(params->getHollow() / HOLLOW_QUANTA);
+ tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA);
dp.packU16(tempU16, "Hollow");
return true;
}
@@ -217,46 +217,46 @@ bool LLVolumeMessage::packPathParams(
U8 curve = params->getCurveType();
mesgsys->addU8Fast(_PREHASH_PathCurve, curve);
- U16 begin = (U16) llround(params->getBegin() / CUT_QUANTA);
+ U16 begin = (U16) ll_round(params->getBegin() / CUT_QUANTA);
mesgsys->addU16Fast(_PREHASH_PathBegin, begin);
- U16 end = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
+ U16 end = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
mesgsys->addU16Fast(_PREHASH_PathEnd, end);
// Avoid truncation problem with direct F32->U8 cast.
// (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
- U8 pack_scale_x = 200 - (U8) llround(params->getScaleX() / SCALE_QUANTA);
+ U8 pack_scale_x = 200 - (U8) ll_round(params->getScaleX() / SCALE_QUANTA);
mesgsys->addU8Fast(_PREHASH_PathScaleX, pack_scale_x );
- U8 pack_scale_y = 200 - (U8) llround(params->getScaleY() / SCALE_QUANTA);
+ U8 pack_scale_y = 200 - (U8) ll_round(params->getScaleY() / SCALE_QUANTA);
mesgsys->addU8Fast(_PREHASH_PathScaleY, pack_scale_y );
- U8 pack_shear_x = (U8) llround(params->getShearX() / SHEAR_QUANTA);
+ U8 pack_shear_x = (U8) ll_round(params->getShearX() / SHEAR_QUANTA);
mesgsys->addU8Fast(_PREHASH_PathShearX, pack_shear_x );
- U8 pack_shear_y = (U8) llround(params->getShearY() / SHEAR_QUANTA);
+ U8 pack_shear_y = (U8) ll_round(params->getShearY() / SHEAR_QUANTA);
mesgsys->addU8Fast(_PREHASH_PathShearY, pack_shear_y );
- S8 twist = (S8) llround(params->getTwist() / SCALE_QUANTA);
+ S8 twist = (S8) ll_round(params->getTwist() / SCALE_QUANTA);
mesgsys->addS8Fast(_PREHASH_PathTwist, twist);
- S8 twist_begin = (S8) llround(params->getTwistBegin() / SCALE_QUANTA);
+ S8 twist_begin = (S8) ll_round(params->getTwistBegin() / SCALE_QUANTA);
mesgsys->addS8Fast(_PREHASH_PathTwistBegin, twist_begin);
- S8 radius_offset = (S8) llround(params->getRadiusOffset() / SCALE_QUANTA);
+ S8 radius_offset = (S8) ll_round(params->getRadiusOffset() / SCALE_QUANTA);
mesgsys->addS8Fast(_PREHASH_PathRadiusOffset, radius_offset);
- S8 taper_x = (S8) llround(params->getTaperX() / TAPER_QUANTA);
+ S8 taper_x = (S8) ll_round(params->getTaperX() / TAPER_QUANTA);
mesgsys->addS8Fast(_PREHASH_PathTaperX, taper_x);
- S8 taper_y = (S8) llround(params->getTaperY() / TAPER_QUANTA);
+ S8 taper_y = (S8) ll_round(params->getTaperY() / TAPER_QUANTA);
mesgsys->addS8Fast(_PREHASH_PathTaperY, taper_y);
- U8 revolutions = (U8) llround( (params->getRevolutions() - 1.0f) / REV_QUANTA);
+ U8 revolutions = (U8) ll_round( (params->getRevolutions() - 1.0f) / REV_QUANTA);
mesgsys->addU8Fast(_PREHASH_PathRevolutions, revolutions);
- S8 skew = (S8) llround(params->getSkew() / SCALE_QUANTA);
+ S8 skew = (S8) ll_round(params->getSkew() / SCALE_QUANTA);
mesgsys->addS8Fast(_PREHASH_PathSkew, skew);
return true;
@@ -274,46 +274,46 @@ bool LLVolumeMessage::packPathParams(
U8 curve = params->getCurveType();
dp.packU8(curve, "Curve");
- U16 begin = (U16) llround(params->getBegin() / CUT_QUANTA);
+ U16 begin = (U16) ll_round(params->getBegin() / CUT_QUANTA);
dp.packU16(begin, "Begin");
- U16 end = 50000 - (U16) llround(params->getEnd() / CUT_QUANTA);
+ U16 end = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
dp.packU16(end, "End");
// Avoid truncation problem with direct F32->U8 cast.
// (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
- U8 pack_scale_x = 200 - (U8) llround(params->getScaleX() / SCALE_QUANTA);
+ U8 pack_scale_x = 200 - (U8) ll_round(params->getScaleX() / SCALE_QUANTA);
dp.packU8(pack_scale_x, "ScaleX");
- U8 pack_scale_y = 200 - (U8) llround(params->getScaleY() / SCALE_QUANTA);
+ U8 pack_scale_y = 200 - (U8) ll_round(params->getScaleY() / SCALE_QUANTA);
dp.packU8(pack_scale_y, "ScaleY");
- S8 pack_shear_x = (S8) llround(params->getShearX() / SHEAR_QUANTA);
+ S8 pack_shear_x = (S8) ll_round(params->getShearX() / SHEAR_QUANTA);
dp.packU8(*(U8 *)&pack_shear_x, "ShearX");
- S8 pack_shear_y = (S8) llround(params->getShearY() / SHEAR_QUANTA);
+ S8 pack_shear_y = (S8) ll_round(params->getShearY() / SHEAR_QUANTA);
dp.packU8(*(U8 *)&pack_shear_y, "ShearY");
- S8 twist = (S8) llround(params->getTwist() / SCALE_QUANTA);
+ S8 twist = (S8) ll_round(params->getTwist() / SCALE_QUANTA);
dp.packU8(*(U8 *)&twist, "Twist");
- S8 twist_begin = (S8) llround(params->getTwistBegin() / SCALE_QUANTA);
+ S8 twist_begin = (S8) ll_round(params->getTwistBegin() / SCALE_QUANTA);
dp.packU8(*(U8 *)&twist_begin, "TwistBegin");
- S8 radius_offset = (S8) llround(params->getRadiusOffset() / SCALE_QUANTA);
+ S8 radius_offset = (S8) ll_round(params->getRadiusOffset() / SCALE_QUANTA);
dp.packU8(*(U8 *)&radius_offset, "RadiusOffset");
- S8 taper_x = (S8) llround(params->getTaperX() / TAPER_QUANTA);
+ S8 taper_x = (S8) ll_round(params->getTaperX() / TAPER_QUANTA);
dp.packU8(*(U8 *)&taper_x, "TaperX");
- S8 taper_y = (S8) llround(params->getTaperY() / TAPER_QUANTA);
+ S8 taper_y = (S8) ll_round(params->getTaperY() / TAPER_QUANTA);
dp.packU8(*(U8 *)&taper_y, "TaperY");
- U8 revolutions = (U8) llround( (params->getRevolutions() - 1.0f) / REV_QUANTA);
+ U8 revolutions = (U8) ll_round( (params->getRevolutions() - 1.0f) / REV_QUANTA);
dp.packU8(*(U8 *)&revolutions, "Revolutions");
- S8 skew = (S8) llround(params->getSkew() / SCALE_QUANTA);
+ S8 skew = (S8) ll_round(params->getSkew() / SCALE_QUANTA);
dp.packU8(*(U8 *)&skew, "Skew");
return true;
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 254008fbcf..de26d19efc 100755
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -183,8 +183,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
mDescender = -mFTFace->descender * pixels_per_unit;
mLineHeight = mFTFace->height * pixels_per_unit;
- S32 max_char_width = llround(0.5f + (x_max - x_min));
- S32 max_char_height = llround(0.5f + (y_max - y_min));
+ S32 max_char_width = ll_round(0.5f + (x_max - x_min));
+ S32 max_char_height = ll_round(0.5f + (y_max - y_min));
mFontBitmapCachep->init(components, max_char_width, max_char_height);
claimMem(mFontBitmapCachep);
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index bedec4bd6f..53ca080d66 100755
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -211,10 +211,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
case LEFT:
break;
case RIGHT:
- cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX));
+ cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX));
break;
case HCENTER:
- cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2;
+ cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2;
break;
default:
break;
@@ -223,7 +223,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 = (F32)llround(cur_x);
+ F32 start_x = (F32)ll_round(cur_x);
const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();
@@ -237,12 +237,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (use_ellipses)
{
// check for too long of a string
- S32 string_width = llround(getWidthF32(wstr.c_str(), begin_offset, max_chars) * sScaleX);
+ S32 string_width = ll_round(getWidthF32(wstr.c_str(), begin_offset, max_chars) * sScaleX);
if (string_width > scaled_max_pixels)
{
// use four dots for ellipsis width to generate padding
const LLWString dots(utf8str_to_wstring(std::string("....")));
- scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str())));
+ scaled_max_pixels = llmax(0, scaled_max_pixels - ll_round(getWidthF32(dots.c_str())));
draw_ellipses = TRUE;
}
}
@@ -307,10 +307,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((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);
+ LLRectf screen_rect((F32)ll_round(cur_render_x + (F32)fgi->mXBearing),
+ (F32)ll_round(cur_render_y + (F32)fgi->mYBearing),
+ (F32)ll_round(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
+ (F32)ll_round(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
if (glyph_count >= GLYPH_BATCH_SIZE)
{
@@ -341,8 +341,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
// Must do this to cur_x, not just to cur_render_x, otherwise you
// will squish sub-pixel kerned characters too close together.
// For example, "CCCCC" looks bad.
- cur_x = (F32)llround(cur_x);
- //cur_y = (F32)llround(cur_y);
+ cur_x = (F32)ll_round(cur_x);
+ //cur_y = (F32)ll_round(cur_y);
cur_render_x = cur_x;
cur_render_y = cur_y;
@@ -452,7 +452,7 @@ S32 LLFontGL::getWidth(const std::string& utf8text, S32 begin_offset, S32 max_ch
S32 LLFontGL::getWidth(const llwchar* wchars, S32 begin_offset, S32 max_chars) const
{
F32 width = getWidthF32(wchars, begin_offset, max_chars);
- return llround(width);
+ return ll_round(width);
}
F32 LLFontGL::getWidthF32(const std::string& utf8text) const
@@ -514,7 +514,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars
cur_x += mFontFreetype->getXKerning(fgi, next_glyph);
}
// Round after kerning.
- cur_x = (F32)llround(cur_x);
+ cur_x = (F32)ll_round(cur_x);
}
// add in extra pixels for last character's width past its xadvance
@@ -622,7 +622,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
}
// Round after kerning.
- cur_x = (F32)llround(cur_x);
+ cur_x = (F32)ll_round(cur_x);
}
if( clip )
@@ -692,7 +692,7 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_
}
// Round after kerning.
- total_width = (F32)llround(total_width);
+ total_width = (F32)ll_round(total_width);
}
if (drawable_chars == 0)
@@ -775,7 +775,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t
// Round after kerning.
- cur_x = (F32)llround(cur_x);
+ cur_x = (F32)ll_round(cur_x);
}
return llmin(max_chars, pos - begin_offset);
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index b81dd4c9a1..3ceed95248 100755
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -61,33 +61,33 @@ U64 LLGLSLShader::sTotalSamplesDrawn = 0;
U32 LLGLSLShader::sTotalDrawCalls = 0;
//UI shader -- declared here so llui_libtest will link properly
-LLGLSLShader gUIProgram;
-LLGLSLShader gSolidColorProgram;
+LLGLSLShader gUIProgram;
+LLGLSLShader gSolidColorProgram;
BOOL shouldChange(const LLVector4& v1, const LLVector4& v2)
{
- return v1 != v2;
+ return v1 != v2;
}
LLShaderFeatures::LLShaderFeatures()
- : atmosphericHelpers(false)
- , calculatesLighting(false)
- , calculatesAtmospherics(false)
- , hasLighting(false)
- , isAlphaLighting(false)
- , isShiny(false)
- , isFullbright(false)
- , isSpecular(false)
- , hasWaterFog(false)
- , hasTransport(false)
- , hasSkinning(false)
- , hasObjectSkinning(false)
- , hasAtmospherics(false)
- , hasGamma(false)
- , mIndexedTextureChannels(0)
- , disableTextureIndex(false)
- , hasAlphaMask(false)
- , attachNothing(false)
+ : atmosphericHelpers(false)
+ , calculatesLighting(false)
+ , calculatesAtmospherics(false)
+ , hasLighting(false)
+ , isAlphaLighting(false)
+ , isShiny(false)
+ , isFullbright(false)
+ , isSpecular(false)
+ , hasWaterFog(false)
+ , hasTransport(false)
+ , hasSkinning(false)
+ , hasObjectSkinning(false)
+ , hasAtmospherics(false)
+ , hasGamma(false)
+ , mIndexedTextureChannels(0)
+ , disableTextureIndex(false)
+ , hasAlphaMask(false)
+ , attachNothing(false)
{
}
@@ -98,225 +98,225 @@ LLShaderFeatures::LLShaderFeatures()
//static
void LLGLSLShader::initProfile()
{
- sProfileEnabled = true;
- sTotalTimeElapsed = 0;
- sTotalTrianglesDrawn = 0;
- sTotalSamplesDrawn = 0;
- sTotalDrawCalls = 0;
-
- for (std::set<LLGLSLShader*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter)
- {
- (*iter)->clearStats();
- }
+ sProfileEnabled = true;
+ sTotalTimeElapsed = 0;
+ sTotalTrianglesDrawn = 0;
+ sTotalSamplesDrawn = 0;
+ sTotalDrawCalls = 0;
+
+ for (std::set<LLGLSLShader*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter)
+ {
+ (*iter)->clearStats();
+ }
}
struct LLGLSLShaderCompareTimeElapsed
{
- bool operator()(const LLGLSLShader* const& lhs, const LLGLSLShader* const& rhs)
- {
- return lhs->mTimeElapsed < rhs->mTimeElapsed;
- }
+ bool operator()(const LLGLSLShader* const& lhs, const LLGLSLShader* const& rhs)
+ {
+ return lhs->mTimeElapsed < rhs->mTimeElapsed;
+ }
};
//static
void LLGLSLShader::finishProfile(bool emit_report)
{
- sProfileEnabled = false;
-
- if (emit_report)
- {
- std::vector<LLGLSLShader*> sorted;
-
- for (std::set<LLGLSLShader*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter)
- {
- sorted.push_back(*iter);
- }
-
- std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed());
-
- for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter)
- {
- (*iter)->dumpStats();
- }
-
- LL_INFOS() << "-----------------------------------" << LL_ENDL;
- LL_INFOS() << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << LL_ENDL;
- LL_INFOS() << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << LL_ENDL;
- LL_INFOS() << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << LL_ENDL;
- }
+ sProfileEnabled = false;
+
+ if (emit_report)
+ {
+ std::vector<LLGLSLShader*> sorted;
+
+ for (std::set<LLGLSLShader*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter)
+ {
+ sorted.push_back(*iter);
+ }
+
+ std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed());
+
+ for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter)
+ {
+ (*iter)->dumpStats();
+ }
+
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
+ LL_INFOS() << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << LL_ENDL;
+ LL_INFOS() << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << LL_ENDL;
+ LL_INFOS() << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << LL_ENDL;
+ }
}
void LLGLSLShader::clearStats()
{
- mTrianglesDrawn = 0;
- mTimeElapsed = 0;
- mSamplesDrawn = 0;
- mDrawCalls = 0;
- mTextureStateFetched = false;
- mTextureMagFilter.clear();
- mTextureMinFilter.clear();
+ mTrianglesDrawn = 0;
+ mTimeElapsed = 0;
+ mSamplesDrawn = 0;
+ mDrawCalls = 0;
+ mTextureStateFetched = false;
+ mTextureMagFilter.clear();
+ mTextureMinFilter.clear();
}
void LLGLSLShader::dumpStats()
{
- if (mDrawCalls > 0)
- {
- LL_INFOS() << "=============================================" << LL_ENDL;
- LL_INFOS() << mName << LL_ENDL;
- for (U32 i = 0; i < mShaderFiles.size(); ++i)
- {
- LL_INFOS() << mShaderFiles[i].first << LL_ENDL;
- }
- for (U32 i = 0; i < mTexture.size(); ++i)
- {
- GLint idx = mTexture[i];
-
- if (idx >= 0)
- {
- GLint uniform_idx = getUniformLocation(i);
- LL_INFOS() << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << LL_ENDL;
- }
- }
- LL_INFOS() << "=============================================" << LL_ENDL;
-
- F32 ms = mTimeElapsed/1000000.f;
- F32 seconds = ms/1000.f;
-
- F32 pct_tris = (F32) mTrianglesDrawn/(F32)sTotalTrianglesDrawn*100.f;
- F32 tris_sec = (F32) (mTrianglesDrawn/1000000.0);
- tris_sec /= seconds;
-
- F32 pct_samples = (F32) ((F64)mSamplesDrawn/(F64)sTotalSamplesDrawn)*100.f;
- F32 samples_sec = (F32) mSamplesDrawn/1000000000.0;
- samples_sec /= seconds;
-
- F32 pct_calls = (F32) mDrawCalls/(F32)sTotalDrawCalls*100.f;
- U32 avg_batch = mTrianglesDrawn/mDrawCalls;
-
- LL_INFOS() << "Triangles Drawn: " << mTrianglesDrawn << " " << llformat("(%.2f pct of total, %.3f million/sec)", pct_tris, tris_sec ) << LL_ENDL;
- LL_INFOS() << "Draw Calls: " << mDrawCalls << " " << llformat("(%.2f pct of total, avg %d tris/call)", pct_calls, avg_batch) << LL_ENDL;
- LL_INFOS() << "SamplesDrawn: " << mSamplesDrawn << " " << llformat("(%.2f pct of total, %.3f billion/sec)", pct_samples, samples_sec) << LL_ENDL;
- LL_INFOS() << "Time Elapsed: " << mTimeElapsed << " " << llformat("(%.2f pct of total, %.5f ms)\n", (F32) ((F64)mTimeElapsed/(F64)sTotalTimeElapsed)*100.f, ms) << LL_ENDL;
- }
+ if (mDrawCalls > 0)
+ {
+ LL_INFOS() << "=============================================" << LL_ENDL;
+ LL_INFOS() << mName << LL_ENDL;
+ for (U32 i = 0; i < mShaderFiles.size(); ++i)
+ {
+ LL_INFOS() << mShaderFiles[i].first << LL_ENDL;
+ }
+ for (U32 i = 0; i < mTexture.size(); ++i)
+ {
+ GLint idx = mTexture[i];
+
+ if (idx >= 0)
+ {
+ GLint uniform_idx = getUniformLocation(i);
+ LL_INFOS() << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << LL_ENDL;
+ }
+ }
+ LL_INFOS() << "=============================================" << LL_ENDL;
+
+ F32 ms = mTimeElapsed/1000000.f;
+ F32 seconds = ms/1000.f;
+
+ F32 pct_tris = (F32) mTrianglesDrawn/(F32)sTotalTrianglesDrawn*100.f;
+ F32 tris_sec = (F32) (mTrianglesDrawn/1000000.0);
+ tris_sec /= seconds;
+
+ F32 pct_samples = (F32) ((F64)mSamplesDrawn/(F64)sTotalSamplesDrawn)*100.f;
+ F32 samples_sec = (F32) mSamplesDrawn/1000000000.0;
+ samples_sec /= seconds;
+
+ F32 pct_calls = (F32) mDrawCalls/(F32)sTotalDrawCalls*100.f;
+ U32 avg_batch = mTrianglesDrawn/mDrawCalls;
+
+ LL_INFOS() << "Triangles Drawn: " << mTrianglesDrawn << " " << llformat("(%.2f pct of total, %.3f million/sec)", pct_tris, tris_sec ) << LL_ENDL;
+ LL_INFOS() << "Draw Calls: " << mDrawCalls << " " << llformat("(%.2f pct of total, avg %d tris/call)", pct_calls, avg_batch) << LL_ENDL;
+ LL_INFOS() << "SamplesDrawn: " << mSamplesDrawn << " " << llformat("(%.2f pct of total, %.3f billion/sec)", pct_samples, samples_sec) << LL_ENDL;
+ LL_INFOS() << "Time Elapsed: " << mTimeElapsed << " " << llformat("(%.2f pct of total, %.5f ms)\n", (F32) ((F64)mTimeElapsed/(F64)sTotalTimeElapsed)*100.f, ms) << LL_ENDL;
+ }
}
//static
void LLGLSLShader::startProfile()
{
- if (sProfileEnabled && sCurBoundShaderPtr)
- {
- sCurBoundShaderPtr->placeProfileQuery();
- }
+ if (sProfileEnabled && sCurBoundShaderPtr)
+ {
+ sCurBoundShaderPtr->placeProfileQuery();
+ }
}
//static
void LLGLSLShader::stopProfile(U32 count, U32 mode)
{
- if (sProfileEnabled)
- {
- sCurBoundShaderPtr->readProfileQuery(count, mode);
- }
+ if (sProfileEnabled && sCurBoundShaderPtr)
+ {
+ sCurBoundShaderPtr->readProfileQuery(count, mode);
+ }
}
void LLGLSLShader::placeProfileQuery()
{
#if !LL_DARWIN
- if (mTimerQuery == 0)
- {
- glGenQueriesARB(1, &mSamplesQuery);
- glGenQueriesARB(1, &mTimerQuery);
- }
+ if (mTimerQuery == 0)
+ {
+ glGenQueriesARB(1, &mSamplesQuery);
+ glGenQueriesARB(1, &mTimerQuery);
+ }
- if (!mTextureStateFetched)
- {
- mTextureStateFetched = true;
- mTextureMagFilter.resize(mTexture.size());
- mTextureMinFilter.resize(mTexture.size());
+ if (!mTextureStateFetched)
+ {
+ mTextureStateFetched = true;
+ mTextureMagFilter.resize(mTexture.size());
+ mTextureMinFilter.resize(mTexture.size());
- U32 cur_active = gGL.getCurrentTexUnitIndex();
+ U32 cur_active = gGL.getCurrentTexUnitIndex();
- for (U32 i = 0; i < mTexture.size(); ++i)
- {
- GLint idx = mTexture[i];
+ for (U32 i = 0; i < mTexture.size(); ++i)
+ {
+ GLint idx = mTexture[i];
- if (idx >= 0)
- {
- gGL.getTexUnit(idx)->activate();
+ if (idx >= 0)
+ {
+ gGL.getTexUnit(idx)->activate();
- U32 mag = 0xFFFFFFFF;
- U32 min = 0xFFFFFFFF;
+ U32 mag = 0xFFFFFFFF;
+ U32 min = 0xFFFFFFFF;
- U32 type = LLTexUnit::getInternalType(gGL.getTexUnit(idx)->getCurrType());
+ U32 type = LLTexUnit::getInternalType(gGL.getTexUnit(idx)->getCurrType());
- glGetTexParameteriv(type, GL_TEXTURE_MAG_FILTER, (GLint*) &mag);
- glGetTexParameteriv(type, GL_TEXTURE_MIN_FILTER, (GLint*) &min);
+ glGetTexParameteriv(type, GL_TEXTURE_MAG_FILTER, (GLint*) &mag);
+ glGetTexParameteriv(type, GL_TEXTURE_MIN_FILTER, (GLint*) &min);
- mTextureMagFilter[i] = mag;
- mTextureMinFilter[i] = min;
- }
- }
+ mTextureMagFilter[i] = mag;
+ mTextureMinFilter[i] = min;
+ }
+ }
- gGL.getTexUnit(cur_active)->activate();
- }
+ gGL.getTexUnit(cur_active)->activate();
+ }
- glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery);
- glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery);
+ glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery);
+ glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery);
#endif
}
void LLGLSLShader::readProfileQuery(U32 count, U32 mode)
{
#if !LL_DARWIN
- glEndQueryARB(GL_TIME_ELAPSED);
- glEndQueryARB(GL_SAMPLES_PASSED);
-
- U64 time_elapsed = 0;
- glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed);
-
- U64 samples_passed = 0;
- glGetQueryObjectui64v(mSamplesQuery, GL_QUERY_RESULT, &samples_passed);
-
- sTotalTimeElapsed += time_elapsed;
- mTimeElapsed += time_elapsed;
-
- sTotalSamplesDrawn += samples_passed;
- mSamplesDrawn += samples_passed;
-
- U32 tri_count = 0;
- switch (mode)
- {
- case LLRender::TRIANGLES: tri_count = count/3; break;
- case LLRender::TRIANGLE_FAN: tri_count = count-2; break;
- case LLRender::TRIANGLE_STRIP: tri_count = count-2; break;
- default: tri_count = count; break; //points lines etc just use primitive count
- }
-
- mTrianglesDrawn += tri_count;
- sTotalTrianglesDrawn += tri_count;
-
- sTotalDrawCalls++;
- mDrawCalls++;
+ glEndQueryARB(GL_TIME_ELAPSED);
+ glEndQueryARB(GL_SAMPLES_PASSED);
+
+ U64 time_elapsed = 0;
+ glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed);
+
+ U64 samples_passed = 0;
+ glGetQueryObjectui64v(mSamplesQuery, GL_QUERY_RESULT, &samples_passed);
+
+ sTotalTimeElapsed += time_elapsed;
+ mTimeElapsed += time_elapsed;
+
+ sTotalSamplesDrawn += samples_passed;
+ mSamplesDrawn += samples_passed;
+
+ U32 tri_count = 0;
+ switch (mode)
+ {
+ case LLRender::TRIANGLES: tri_count = count/3; break;
+ case LLRender::TRIANGLE_FAN: tri_count = count-2; break;
+ case LLRender::TRIANGLE_STRIP: tri_count = count-2; break;
+ default: tri_count = count; break; //points lines etc just use primitive count
+ }
+
+ mTrianglesDrawn += tri_count;
+ sTotalTrianglesDrawn += tri_count;
+
+ sTotalDrawCalls++;
+ mDrawCalls++;
#endif
}
LLGLSLShader::LLGLSLShader()
- : mProgramObject(0),
- mAttributeMask(0),
- mTotalUniformSize(0),
- mActiveTextureChannels(0),
- mShaderLevel(0),
- mShaderGroup(SG_DEFAULT),
- mUniformsDirty(FALSE),
- mTimerQuery(0),
- mSamplesQuery(0)
+ : mProgramObject(0),
+ mAttributeMask(0),
+ mTotalUniformSize(0),
+ mActiveTextureChannels(0),
+ mShaderLevel(0),
+ mShaderGroup(SG_DEFAULT),
+ mUniformsDirty(FALSE),
+ mTimerQuery(0),
+ mSamplesQuery(0)
{
-
+
}
LLGLSLShader::~LLGLSLShader()
@@ -325,1077 +325,1077 @@ LLGLSLShader::~LLGLSLShader()
void LLGLSLShader::unload()
{
- sInstances.erase(this);
-
- stop_glerror();
- mAttribute.clear();
- mTexture.clear();
- mUniform.clear();
- mShaderFiles.clear();
- mDefines.clear();
-
- if (mProgramObject)
- {
- GLhandleARB obj[1024];
- GLsizei count;
-
- glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj);
- for (GLsizei i = 0; i < count; i++)
- {
+ sInstances.erase(this);
+
+ stop_glerror();
+ mAttribute.clear();
+ mTexture.clear();
+ mUniform.clear();
+ mShaderFiles.clear();
+ mDefines.clear();
+
+ if (mProgramObject)
+ {
+ GLhandleARB obj[1024];
+ GLsizei count;
+
+ glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj);
+ for (GLsizei i = 0; i < count; i++)
+ {
#if !LL_DARWIN
- if (glIsProgramARB(obj[i]))
+ if (glIsProgramARB(obj[i]))
#endif
- {
- glDeleteObjectARB(obj[i]);
- }
- }
-
- glDeleteObjectARB(mProgramObject);
-
- mProgramObject = 0;
- }
-
- if (mTimerQuery)
- {
- glDeleteQueriesARB(1, &mTimerQuery);
- mTimerQuery = 0;
- }
-
- if (mSamplesQuery)
- {
- glDeleteQueriesARB(1, &mSamplesQuery);
- mSamplesQuery = 0;
- }
-
- //hack to make apple not complain
- glGetError();
-
- stop_glerror();
+ {
+ glDeleteObjectARB(obj[i]);
+ }
+ }
+
+ glDeleteObjectARB(mProgramObject);
+
+ mProgramObject = 0;
+ }
+
+ if (mTimerQuery)
+ {
+ glDeleteQueriesARB(1, &mTimerQuery);
+ mTimerQuery = 0;
+ }
+
+ if (mSamplesQuery)
+ {
+ glDeleteQueriesARB(1, &mSamplesQuery);
+ mSamplesQuery = 0;
+ }
+
+ //hack to make apple not complain
+ glGetError();
+
+ stop_glerror();
}
BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
- std::vector<LLStaticHashedString> * uniforms,
- U32 varying_count,
- const char** varyings)
+ std::vector<LLStaticHashedString> * uniforms,
+ U32 varying_count,
+ const char** varyings)
{
- sInstances.insert(this);
+ sInstances.insert(this);
- //reloading, reset matrix hash values
- for (U32 i = 0; i < LLRender::NUM_MATRIX_MODES; ++i)
- {
- mMatHash[i] = 0xFFFFFFFF;
- }
- mLightHash = 0xFFFFFFFF;
+ //reloading, reset matrix hash values
+ for (U32 i = 0; i < LLRender::NUM_MATRIX_MODES; ++i)
+ {
+ mMatHash[i] = 0xFFFFFFFF;
+ }
+ mLightHash = 0xFFFFFFFF;
- llassert_always(!mShaderFiles.empty());
- BOOL success = TRUE;
+ llassert_always(!mShaderFiles.empty());
+ BOOL success = TRUE;
- // Create program
- mProgramObject = glCreateProgramObjectARB();
-
+ // Create program
+ mProgramObject = glCreateProgramObjectARB();
+
#if LL_DARWIN
// work-around missing mix(vec3,vec3,bvec3)
mDefines["OLD_SELECT"] = "1";
#endif
-
- //compile new source
- vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
- for ( ; fileIter != mShaderFiles.end(); fileIter++ )
- {
- GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
- LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL;
- if (shaderhandle > 0)
- {
- attachObject(shaderhandle);
- }
- else
- {
- success = FALSE;
- }
- }
-
- // Attach existing objects
- if (!LLShaderMgr::instance()->attachShaderFeatures(this))
- {
- return FALSE;
- }
-
- if (gGLManager.mGLSLVersionMajor < 2 && gGLManager.mGLSLVersionMinor < 3)
- { //indexed texture rendering requires GLSL 1.3 or later
- //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
- mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
- }
+
+ //compile new source
+ vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
+ for ( ; fileIter != mShaderFiles.end(); fileIter++ )
+ {
+ GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
+ LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL;
+ if (shaderhandle > 0)
+ {
+ attachObject(shaderhandle);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ // Attach existing objects
+ if (!LLShaderMgr::instance()->attachShaderFeatures(this))
+ {
+ return FALSE;
+ }
+
+ if (gGLManager.mGLSLVersionMajor < 2 && gGLManager.mGLSLVersionMinor < 3)
+ { //indexed texture rendering requires GLSL 1.3 or later
+ //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
+ mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
+ }
#ifdef GL_INTERLEAVED_ATTRIBS
- if (varying_count > 0 && varyings)
- {
- glTransformFeedbackVaryings(mProgramObject, varying_count, varyings, GL_INTERLEAVED_ATTRIBS);
- }
+ if (varying_count > 0 && varyings)
+ {
+ glTransformFeedbackVaryings(mProgramObject, varying_count, varyings, GL_INTERLEAVED_ATTRIBS);
+ }
#endif
- // Map attributes and uniforms
- if (success)
- {
- success = mapAttributes(attributes);
- }
- if (success)
- {
- success = mapUniforms(uniforms);
- }
- if( !success )
- {
- LL_WARNS("ShaderLoading") << "Failed to link shader: " << mName << LL_ENDL;
-
- // Try again using a lower shader level;
- if (mShaderLevel > 0)
- {
- LL_WARNS("ShaderLoading") << "Failed to link using shader level " << mShaderLevel << " trying again using shader level " << (mShaderLevel - 1) << LL_ENDL;
- mShaderLevel--;
- return createShader(attributes,uniforms);
- }
- }
- else if (mFeatures.mIndexedTextureChannels > 0)
- { //override texture channels for indexed texture rendering
- bind();
- S32 channel_count = mFeatures.mIndexedTextureChannels;
-
- for (S32 i = 0; i < channel_count; i++)
- {
- LLStaticHashedString uniName(llformat("tex%d", i));
- uniform1i(uniName, i);
- }
-
- S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten
- for (U32 i = 0; i < mTexture.size(); i++)
- {
- if (mTexture[i] > -1 && mTexture[i] < channel_count)
- {
- llassert(cur_tex < gGLManager.mNumTextureImageUnits);
- uniform1i(i, cur_tex);
- mTexture[i] = cur_tex++;
- }
- }
- unbind();
- }
-
- return success;
+ // Map attributes and uniforms
+ if (success)
+ {
+ success = mapAttributes(attributes);
+ }
+ if (success)
+ {
+ success = mapUniforms(uniforms);
+ }
+ if( !success )
+ {
+ LL_WARNS("ShaderLoading") << "Failed to link shader: " << mName << LL_ENDL;
+
+ // Try again using a lower shader level;
+ if (mShaderLevel > 0)
+ {
+ LL_WARNS("ShaderLoading") << "Failed to link using shader level " << mShaderLevel << " trying again using shader level " << (mShaderLevel - 1) << LL_ENDL;
+ mShaderLevel--;
+ return createShader(attributes,uniforms);
+ }
+ }
+ else if (mFeatures.mIndexedTextureChannels > 0)
+ { //override texture channels for indexed texture rendering
+ bind();
+ S32 channel_count = mFeatures.mIndexedTextureChannels;
+
+ for (S32 i = 0; i < channel_count; i++)
+ {
+ LLStaticHashedString uniName(llformat("tex%d", i));
+ uniform1i(uniName, i);
+ }
+
+ S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten
+ for (U32 i = 0; i < mTexture.size(); i++)
+ {
+ if (mTexture[i] > -1 && mTexture[i] < channel_count)
+ {
+ llassert(cur_tex < gGLManager.mNumTextureImageUnits);
+ uniform1i(i, cur_tex);
+ mTexture[i] = cur_tex++;
+ }
+ }
+ unbind();
+ }
+
+ return success;
}
BOOL LLGLSLShader::attachObject(std::string object)
{
- if (LLShaderMgr::instance()->mShaderObjects.count(object) > 0)
- {
- stop_glerror();
- glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mShaderObjects[object]);
- stop_glerror();
- return TRUE;
- }
- else
- {
- LL_WARNS("ShaderLoading") << "Attempting to attach shader object that hasn't been compiled: " << object << LL_ENDL;
- return FALSE;
- }
+ if (LLShaderMgr::instance()->mShaderObjects.count(object) > 0)
+ {
+ stop_glerror();
+ glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mShaderObjects[object]);
+ stop_glerror();
+ return TRUE;
+ }
+ else
+ {
+ LL_WARNS("ShaderLoading") << "Attempting to attach shader object that hasn't been compiled: " << object << LL_ENDL;
+ return FALSE;
+ }
}
void LLGLSLShader::attachObject(GLhandleARB object)
{
- if (object != 0)
- {
- stop_glerror();
- glAttachObjectARB(mProgramObject, object);
- stop_glerror();
- }
- else
- {
- LL_WARNS("ShaderLoading") << "Attempting to attach non existing shader object. " << LL_ENDL;
- }
+ if (object != 0)
+ {
+ stop_glerror();
+ glAttachObjectARB(mProgramObject, object);
+ stop_glerror();
+ }
+ else
+ {
+ LL_WARNS("ShaderLoading") << "Attempting to attach non existing shader object. " << LL_ENDL;
+ }
}
void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
{
- for (S32 i = 0; i < count; i++)
- {
- attachObject(objects[i]);
- }
+ for (S32 i = 0; i < count; i++)
+ {
+ attachObject(objects[i]);
+ }
}
BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attributes)
{
- //before linking, make sure reserved attributes always have consistent locations
- for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
- {
- const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
- glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
- }
-
- //link the program
- BOOL res = link();
-
- mAttribute.clear();
- U32 numAttributes = (attributes == NULL) ? 0 : attributes->size();
- mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, -1);
-
- if (res)
- { //read back channel locations
-
- mAttributeMask = 0;
-
- //read back reserved channels first
- for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
- {
- const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
- S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name);
- if (index != -1)
- {
- mAttribute[i] = index;
- mAttributeMask |= 1 << i;
- LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
- }
- }
- if (attributes != NULL)
- {
- for (U32 i = 0; i < numAttributes; i++)
- {
- const char* name = (*attributes)[i].String().c_str();
- S32 index = glGetAttribLocationARB(mProgramObject, name);
- if (index != -1)
- {
- mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index;
- LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
- }
- }
- }
-
- return TRUE;
- }
-
- return FALSE;
+ //before linking, make sure reserved attributes always have consistent locations
+ for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
+ {
+ const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
+ glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
+ }
+
+ //link the program
+ BOOL res = link();
+
+ mAttribute.clear();
+ U32 numAttributes = (attributes == NULL) ? 0 : attributes->size();
+ mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, -1);
+
+ if (res)
+ { //read back channel locations
+
+ mAttributeMask = 0;
+
+ //read back reserved channels first
+ for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
+ {
+ const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
+ S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name);
+ if (index != -1)
+ {
+ mAttribute[i] = index;
+ mAttributeMask |= 1 << i;
+ LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
+ }
+ }
+ if (attributes != NULL)
+ {
+ for (U32 i = 0; i < numAttributes; i++)
+ {
+ const char* name = (*attributes)[i].String().c_str();
+ S32 index = glGetAttribLocationARB(mProgramObject, name);
+ if (index != -1)
+ {
+ mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index;
+ LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
+ }
+ }
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> * uniforms)
{
- if (index == -1)
- {
- return;
- }
+ if (index == -1)
+ {
+ return;
+ }
- GLenum type;
- GLsizei length;
- GLint size = -1;
- char name[1024]; /* Flawfinder: ignore */
- name[0] = 0;
+ GLenum type;
+ GLsizei length;
+ GLint size = -1;
+ char name[1024]; /* Flawfinder: ignore */
+ name[0] = 0;
- glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
+ glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
#if !LL_DARWIN
- if (size > 0)
- {
- switch(type)
- {
- case GL_FLOAT_VEC2: size *= 2; break;
- case GL_FLOAT_VEC3: size *= 3; break;
- case GL_FLOAT_VEC4: size *= 4; break;
- case GL_DOUBLE: size *= 2; break;
- case GL_DOUBLE_VEC2: size *= 2; break;
- case GL_DOUBLE_VEC3: size *= 6; break;
- case GL_DOUBLE_VEC4: size *= 8; break;
- case GL_INT_VEC2: size *= 2; break;
- case GL_INT_VEC3: size *= 3; break;
- case GL_INT_VEC4: size *= 4; break;
- case GL_UNSIGNED_INT_VEC2: size *= 2; break;
- case GL_UNSIGNED_INT_VEC3: size *= 3; break;
- case GL_UNSIGNED_INT_VEC4: size *= 4; break;
- case GL_BOOL_VEC2: size *= 2; break;
- case GL_BOOL_VEC3: size *= 3; break;
- case GL_BOOL_VEC4: size *= 4; break;
- case GL_FLOAT_MAT2: size *= 4; break;
- case GL_FLOAT_MAT3: size *= 9; break;
- case GL_FLOAT_MAT4: size *= 16; break;
- case GL_FLOAT_MAT2x3: size *= 6; break;
- case GL_FLOAT_MAT2x4: size *= 8; break;
- case GL_FLOAT_MAT3x2: size *= 6; break;
- case GL_FLOAT_MAT3x4: size *= 12; break;
- case GL_FLOAT_MAT4x2: size *= 8; break;
- case GL_FLOAT_MAT4x3: size *= 12; break;
- case GL_DOUBLE_MAT2: size *= 8; break;
- case GL_DOUBLE_MAT3: size *= 18; break;
- case GL_DOUBLE_MAT4: size *= 32; break;
- case GL_DOUBLE_MAT2x3: size *= 12; break;
- case GL_DOUBLE_MAT2x4: size *= 16; break;
- case GL_DOUBLE_MAT3x2: size *= 12; break;
- case GL_DOUBLE_MAT3x4: size *= 24; break;
- case GL_DOUBLE_MAT4x2: size *= 16; break;
- case GL_DOUBLE_MAT4x3: size *= 24; break;
- }
- mTotalUniformSize += size;
- }
+ if (size > 0)
+ {
+ switch(type)
+ {
+ case GL_FLOAT_VEC2: size *= 2; break;
+ case GL_FLOAT_VEC3: size *= 3; break;
+ case GL_FLOAT_VEC4: size *= 4; break;
+ case GL_DOUBLE: size *= 2; break;
+ case GL_DOUBLE_VEC2: size *= 2; break;
+ case GL_DOUBLE_VEC3: size *= 6; break;
+ case GL_DOUBLE_VEC4: size *= 8; break;
+ case GL_INT_VEC2: size *= 2; break;
+ case GL_INT_VEC3: size *= 3; break;
+ case GL_INT_VEC4: size *= 4; break;
+ case GL_UNSIGNED_INT_VEC2: size *= 2; break;
+ case GL_UNSIGNED_INT_VEC3: size *= 3; break;
+ case GL_UNSIGNED_INT_VEC4: size *= 4; break;
+ case GL_BOOL_VEC2: size *= 2; break;
+ case GL_BOOL_VEC3: size *= 3; break;
+ case GL_BOOL_VEC4: size *= 4; break;
+ case GL_FLOAT_MAT2: size *= 4; break;
+ case GL_FLOAT_MAT3: size *= 9; break;
+ case GL_FLOAT_MAT4: size *= 16; break;
+ case GL_FLOAT_MAT2x3: size *= 6; break;
+ case GL_FLOAT_MAT2x4: size *= 8; break;
+ case GL_FLOAT_MAT3x2: size *= 6; break;
+ case GL_FLOAT_MAT3x4: size *= 12; break;
+ case GL_FLOAT_MAT4x2: size *= 8; break;
+ case GL_FLOAT_MAT4x3: size *= 12; break;
+ case GL_DOUBLE_MAT2: size *= 8; break;
+ case GL_DOUBLE_MAT3: size *= 18; break;
+ case GL_DOUBLE_MAT4: size *= 32; break;
+ case GL_DOUBLE_MAT2x3: size *= 12; break;
+ case GL_DOUBLE_MAT2x4: size *= 16; break;
+ case GL_DOUBLE_MAT3x2: size *= 12; break;
+ case GL_DOUBLE_MAT3x4: size *= 24; break;
+ case GL_DOUBLE_MAT4x2: size *= 16; break;
+ case GL_DOUBLE_MAT4x3: size *= 24; break;
+ }
+ mTotalUniformSize += size;
+ }
#endif
- S32 location = glGetUniformLocationARB(mProgramObject, name);
- if (location != -1)
- {
- //chop off "[0]" so we can always access the first element
- //of an array by the array name
- char* is_array = strstr(name, "[0]");
- if (is_array)
- {
- is_array[0] = 0;
- }
-
- LLStaticHashedString hashedName(name);
- mUniformNameMap[location] = name;
- mUniformMap[hashedName] = location;
-
- LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL;
-
- //find the index of this uniform
- for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++)
- {
- if ( (mUniform[i] == -1)
- && (LLShaderMgr::instance()->mReservedUniforms[i] == name))
- {
- //found it
- mUniform[i] = location;
- mTexture[i] = mapUniformTextureChannel(location, type);
- return;
- }
- }
-
- if (uniforms != NULL)
- {
- for (U32 i = 0; i < uniforms->size(); i++)
- {
- if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
- && ((*uniforms)[i].String() == name))
- {
- //found it
- mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
- mTexture[i+LLShaderMgr::instance()->mReservedUniforms.size()] = mapUniformTextureChannel(location, type);
- return;
- }
- }
- }
- }
+ S32 location = glGetUniformLocationARB(mProgramObject, name);
+ if (location != -1)
+ {
+ //chop off "[0]" so we can always access the first element
+ //of an array by the array name
+ char* is_array = strstr(name, "[0]");
+ if (is_array)
+ {
+ is_array[0] = 0;
+ }
+
+ LLStaticHashedString hashedName(name);
+ mUniformNameMap[location] = name;
+ mUniformMap[hashedName] = location;
+
+ LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL;
+
+ //find the index of this uniform
+ for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++)
+ {
+ if ( (mUniform[i] == -1)
+ && (LLShaderMgr::instance()->mReservedUniforms[i] == name))
+ {
+ //found it
+ mUniform[i] = location;
+ mTexture[i] = mapUniformTextureChannel(location, type);
+ return;
+ }
+ }
+
+ if (uniforms != NULL)
+ {
+ for (U32 i = 0; i < uniforms->size(); i++)
+ {
+ if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
+ && ((*uniforms)[i].String() == name))
+ {
+ //found it
+ mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
+ mTexture[i+LLShaderMgr::instance()->mReservedUniforms.size()] = mapUniformTextureChannel(location, type);
+ return;
+ }
+ }
+ }
+ }
}
void LLGLSLShader::addPermutation(std::string name, std::string value)
{
- mDefines[name] = value;
+ mDefines[name] = value;
}
void LLGLSLShader::removePermutation(std::string name)
{
- mDefines[name].erase();
+ mDefines[name].erase();
}
GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type)
{
- if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) ||
- type == GL_SAMPLER_2D_MULTISAMPLE)
- { //this here is a texture
- glUniform1iARB(location, mActiveTextureChannels);
- LL_DEBUGS("ShaderLoading") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL;
- return mActiveTextureChannels++;
- }
- return -1;
+ if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) ||
+ type == GL_SAMPLER_2D_MULTISAMPLE)
+ { //this here is a texture
+ glUniform1iARB(location, mActiveTextureChannels);
+ LL_DEBUGS("ShaderLoading") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL;
+ return mActiveTextureChannels++;
+ }
+ return -1;
}
BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
{
- BOOL res = TRUE;
-
- mTotalUniformSize = 0;
- mActiveTextureChannels = 0;
- mUniform.clear();
- mUniformMap.clear();
- mUniformNameMap.clear();
- mTexture.clear();
- mValue.clear();
- //initialize arrays
- U32 numUniforms = (uniforms == NULL) ? 0 : uniforms->size();
- mUniform.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1);
- mTexture.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1);
-
- bind();
-
- //get the number of active uniforms
- GLint activeCount;
- glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount);
-
- for (S32 i = 0; i < activeCount; i++)
- {
- mapUniform(i, uniforms);
- }
-
- unbind();
-
- LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
- return res;
+ BOOL res = TRUE;
+
+ mTotalUniformSize = 0;
+ mActiveTextureChannels = 0;
+ mUniform.clear();
+ mUniformMap.clear();
+ mUniformNameMap.clear();
+ mTexture.clear();
+ mValue.clear();
+ //initialize arrays
+ U32 numUniforms = (uniforms == NULL) ? 0 : uniforms->size();
+ mUniform.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1);
+ mTexture.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1);
+
+ bind();
+
+ //get the number of active uniforms
+ GLint activeCount;
+ glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount);
+
+ for (S32 i = 0; i < activeCount; i++)
+ {
+ mapUniform(i, uniforms);
+ }
+
+ unbind();
+
+ LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
+ return res;
}
BOOL LLGLSLShader::link(BOOL suppress_errors)
{
- BOOL success = LLShaderMgr::instance()->linkProgramObject(mProgramObject, suppress_errors);
+ BOOL success = LLShaderMgr::instance()->linkProgramObject(mProgramObject, suppress_errors);
- if (!suppress_errors)
- {
+ if (!suppress_errors)
+ {
LLShaderMgr::instance()->dumpObjectLog(mProgramObject, !success, mName);
- }
+ }
- return success;
+ return success;
}
void LLGLSLShader::bind()
{
- gGL.flush();
- if (gGLManager.mHasShaderObjects)
- {
- LLVertexBuffer::unbind();
- glUseProgramObjectARB(mProgramObject);
- sCurBoundShader = mProgramObject;
- sCurBoundShaderPtr = this;
- if (mUniformsDirty)
- {
- LLShaderMgr::instance()->updateShaderUniforms(this);
- mUniformsDirty = FALSE;
- }
- }
+ gGL.flush();
+ if (gGLManager.mHasShaderObjects)
+ {
+ LLVertexBuffer::unbind();
+ glUseProgramObjectARB(mProgramObject);
+ sCurBoundShader = mProgramObject;
+ sCurBoundShaderPtr = this;
+ if (mUniformsDirty)
+ {
+ LLShaderMgr::instance()->updateShaderUniforms(this);
+ mUniformsDirty = FALSE;
+ }
+ }
}
void LLGLSLShader::unbind()
{
- gGL.flush();
- if (gGLManager.mHasShaderObjects)
- {
- stop_glerror();
- if (gGLManager.mIsNVIDIA)
- {
- for (U32 i = 0; i < mAttribute.size(); ++i)
- {
- vertexAttrib4f(i, 0,0,0,1);
- stop_glerror();
- }
- }
- LLVertexBuffer::unbind();
- glUseProgramObjectARB(0);
- sCurBoundShader = 0;
- sCurBoundShaderPtr = NULL;
- stop_glerror();
- }
+ gGL.flush();
+ if (gGLManager.mHasShaderObjects)
+ {
+ stop_glerror();
+ if (gGLManager.mIsNVIDIA)
+ {
+ for (U32 i = 0; i < mAttribute.size(); ++i)
+ {
+ vertexAttrib4f(i, 0,0,0,1);
+ stop_glerror();
+ }
+ }
+ LLVertexBuffer::unbind();
+ glUseProgramObjectARB(0);
+ sCurBoundShader = 0;
+ sCurBoundShaderPtr = NULL;
+ stop_glerror();
+ }
}
void LLGLSLShader::bindNoShader(void)
{
- LLVertexBuffer::unbind();
- if (gGLManager.mHasShaderObjects)
- {
- glUseProgramObjectARB(0);
- sCurBoundShader = 0;
- sCurBoundShaderPtr = NULL;
- }
+ LLVertexBuffer::unbind();
+ if (gGLManager.mHasShaderObjects)
+ {
+ glUseProgramObjectARB(0);
+ sCurBoundShader = 0;
+ sCurBoundShaderPtr = NULL;
+ }
}
S32 LLGLSLShader::bindTexture(const std::string &uniform, LLTexture *texture, LLTexUnit::eTextureType mode)
{
- S32 channel = 0;
- channel = getUniformLocation(uniform);
-
- return bindTexture(channel, texture, mode);
+ S32 channel = 0;
+ channel = getUniformLocation(uniform);
+
+ return bindTexture(channel, texture, mode);
}
S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode)
{
- if (uniform < 0 || uniform >= (S32)mTexture.size())
- {
- UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
- return -1;
- }
-
- uniform = mTexture[uniform];
-
- if (uniform > -1)
- {
- gGL.getTexUnit(uniform)->bind(texture, mode);
- }
-
- return uniform;
+ if (uniform < 0 || uniform >= (S32)mTexture.size())
+ {
+ UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
+ return -1;
+ }
+
+ uniform = mTexture[uniform];
+
+ if (uniform > -1)
+ {
+ gGL.getTexUnit(uniform)->bind(texture, mode);
+ }
+
+ return uniform;
}
S32 LLGLSLShader::unbindTexture(const std::string &uniform, LLTexUnit::eTextureType mode)
{
- S32 channel = 0;
- channel = getUniformLocation(uniform);
-
- return unbindTexture(channel);
+ S32 channel = 0;
+ channel = getUniformLocation(uniform);
+
+ return unbindTexture(channel);
}
S32 LLGLSLShader::unbindTexture(S32 uniform, LLTexUnit::eTextureType mode)
{
- if (uniform < 0 || uniform >= (S32)mTexture.size())
- {
- UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
- return -1;
- }
-
- uniform = mTexture[uniform];
-
- if (uniform > -1)
- {
- gGL.getTexUnit(uniform)->unbind(mode);
- }
-
- return uniform;
+ if (uniform < 0 || uniform >= (S32)mTexture.size())
+ {
+ UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
+ return -1;
+ }
+
+ uniform = mTexture[uniform];
+
+ if (uniform > -1)
+ {
+ gGL.getTexUnit(uniform)->unbind(mode);
+ }
+
+ return uniform;
}
S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
{
- if (uniform < 0 || uniform >= (S32)mTexture.size())
- {
- UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
- return -1;
- }
- S32 index = mTexture[uniform];
- if (index != -1)
- {
- gGL.getTexUnit(index)->activate();
- gGL.getTexUnit(index)->enable(mode);
- }
- return index;
+ if (uniform < 0 || uniform >= (S32)mTexture.size())
+ {
+ UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
+ return -1;
+ }
+ S32 index = mTexture[uniform];
+ if (index != -1)
+ {
+ gGL.getTexUnit(index)->activate();
+ gGL.getTexUnit(index)->enable(mode);
+ }
+ return index;
}
S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode)
{
- if (uniform < 0 || uniform >= (S32)mTexture.size())
- {
- UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
- return -1;
- }
- S32 index = mTexture[uniform];
- if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE)
- {
- if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode)
- {
- if (gDebugSession)
- {
- gFailLog << "Texture channel " << index << " texture type corrupted." << std::endl;
- ll_fail("LLGLSLShader::disableTexture failed");
- }
- else
- {
- LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL;
- }
- }
- gGL.getTexUnit(index)->disable();
- }
- return index;
+ if (uniform < 0 || uniform >= (S32)mTexture.size())
+ {
+ UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
+ return -1;
+ }
+ S32 index = mTexture[uniform];
+ if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE)
+ {
+ if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode)
+ {
+ if (gDebugSession)
+ {
+ gFailLog << "Texture channel " << index << " texture type corrupted." << std::endl;
+ ll_fail("LLGLSLShader::disableTexture failed");
+ }
+ else
+ {
+ LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL;
+ }
+ }
+ gGL.getTexUnit(index)->disable();
+ }
+ return index;
}
void LLGLSLShader::uniform1i(U32 index, GLint x)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- if (iter == mValue.end() || iter->second.mV[0] != x)
- {
- glUniform1iARB(mUniform[index], x);
- mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ if (iter == mValue.end() || iter->second.mV[0] != x)
+ {
+ glUniform1iARB(mUniform[index], x);
+ mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
+ }
+ }
+ }
}
void LLGLSLShader::uniform1f(U32 index, GLfloat x)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- if (iter == mValue.end() || iter->second.mV[0] != x)
- {
- glUniform1fARB(mUniform[index], x);
- mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ if (iter == mValue.end() || iter->second.mV[0] != x)
+ {
+ glUniform1fARB(mUniform[index], x);
+ mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
+ }
+ }
+ }
}
void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(x,y,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform2fARB(mUniform[index], x, y);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(x,y,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform2fARB(mUniform[index], x, y);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(x,y,z,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform3fARB(mUniform[index], x, y, z);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(x,y,z,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform3fARB(mUniform[index], x, y, z);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(x,y,z,w);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform4fARB(mUniform[index], x, y, z, w);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(x,y,z,w);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform4fARB(mUniform[index], x, y, z, w);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(v[0],0.f,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform1ivARB(mUniform[index], count, v);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(v[0],0.f,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform1ivARB(mUniform[index], count, v);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(v[0],0.f,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform1fvARB(mUniform[index], count, v);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(v[0],0.f,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform1fvARB(mUniform[index], count, v);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(v[0],v[1],0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform2fvARB(mUniform[index], count, v);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(v[0],v[1],0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform2fvARB(mUniform[index], count, v);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(v[0],v[1],v[2],0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform3fvARB(mUniform[index], count, v);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(v[0],v[1],v[2],0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform3fvARB(mUniform[index], count, v);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
- LLVector4 vec(v[0],v[1],v[2],v[3]);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform4fvARB(mUniform[index], count, v);
- mValue[mUniform[index]] = vec;
- }
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ LLVector4 vec(v[0],v[1],v[2],v[3]);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform4fvARB(mUniform[index], count, v);
+ mValue[mUniform[index]] = vec;
+ }
+ }
+ }
}
void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- glUniformMatrix2fvARB(mUniform[index], count, transpose, v);
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ glUniformMatrix2fvARB(mUniform[index], count, transpose, v);
+ }
+ }
}
void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- glUniformMatrix3fvARB(mUniform[index], count, transpose, v);
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ glUniformMatrix3fvARB(mUniform[index], count, transpose, v);
+ }
+ }
}
void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v)
{
- if (mProgramObject > 0)
- {
- if (mUniform.size() <= index)
- {
- UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
- return;
- }
-
- if (mUniform[index] >= 0)
- {
- glUniformMatrix4fvARB(mUniform[index], count, transpose, v);
- }
- }
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ glUniformMatrix4fvARB(mUniform[index], count, transpose, v);
+ }
+ }
}
GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform)
{
- GLint ret = -1;
- if (mProgramObject > 0)
- {
- LLStaticStringTable<GLint>::iterator iter = mUniformMap.find(uniform);
- if (iter != mUniformMap.end())
- {
- if (gDebugGL)
- {
- stop_glerror();
- if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str()))
- {
- LL_ERRS() << "Uniform does not match." << LL_ENDL;
- }
- stop_glerror();
- }
- ret = iter->second;
- }
- }
-
- return ret;
+ GLint ret = -1;
+ if (mProgramObject > 0)
+ {
+ LLStaticStringTable<GLint>::iterator iter = mUniformMap.find(uniform);
+ if (iter != mUniformMap.end())
+ {
+ if (gDebugGL)
+ {
+ stop_glerror();
+ if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str()))
+ {
+ LL_ERRS() << "Uniform does not match." << LL_ENDL;
+ }
+ stop_glerror();
+ }
+ ret = iter->second;
+ }
+ }
+
+ return ret;
}
GLint LLGLSLShader::getUniformLocation(U32 index)
{
- GLint ret = -1;
- if (mProgramObject > 0)
- {
- llassert(index < mUniform.size());
- return mUniform[index];
- }
-
- return ret;
+ GLint ret = -1;
+ if (mProgramObject > 0)
+ {
+ llassert(index < mUniform.size());
+ return mUniform[index];
+ }
+
+ return ret;
}
GLint LLGLSLShader::getAttribLocation(U32 attrib)
{
- if (attrib < mAttribute.size())
- {
- return mAttribute[attrib];
- }
- else
- {
- return -1;
- }
+ if (attrib < mAttribute.size())
+ {
+ return mAttribute[attrib];
+ }
+ else
+ {
+ return -1;
+ }
}
void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(v,0.f,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform1iARB(location, v);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(v,0.f,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform1iARB(location, v);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint j)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(i,j,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform2iARB(location, i, j);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(i,j,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform2iARB(location, i, j);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(v,0.f,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform1fARB(location, v);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(v,0.f,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform1fARB(location, v);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(x,y,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform2fARB(location, x,y);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(x,y,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform2fARB(location, x,y);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(x,y,z,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec))
- {
- glUniform3fARB(location, x,y,z);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(x,y,z,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec))
+ {
+ glUniform3fARB(location, x,y,z);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(v[0],0.f,0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform1fvARB(location, count, v);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(v[0],0.f,0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform1fvARB(location, count, v);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(v[0],v[1],0.f,0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform2fvARB(location, count, v);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(v[0],v[1],0.f,0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform2fvARB(location, count, v);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- LLVector4 vec(v[0],v[1],v[2],0.f);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- glUniform3fvARB(location, count, v);
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ LLVector4 vec(v[0],v[1],v[2],0.f);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ glUniform3fvARB(location, count, v);
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- LLVector4 vec(v);
- std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
- if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
- {
- stop_glerror();
- glUniform4fvARB(location, count, v);
- stop_glerror();
- mValue[location] = vec;
- }
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ LLVector4 vec(v);
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
+ if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
+ {
+ stop_glerror();
+ glUniform4fvARB(location, count, v);
+ stop_glerror();
+ mValue[location] = vec;
+ }
+ }
}
void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat* v)
{
- GLint location = getUniformLocation(uniform);
-
- if (location >= 0)
- {
- stop_glerror();
- glUniformMatrix4fvARB(location, count, transpose, v);
- stop_glerror();
- }
+ GLint location = getUniformLocation(uniform);
+
+ if (location >= 0)
+ {
+ stop_glerror();
+ glUniformMatrix4fvARB(location, count, transpose, v);
+ stop_glerror();
+ }
}
void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
- if (mAttribute[index] > 0)
- {
- glVertexAttrib4fARB(mAttribute[index], x, y, z, w);
- }
+ if (mAttribute[index] > 0)
+ {
+ glVertexAttrib4fARB(mAttribute[index], x, y, z, w);
+ }
}
void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
{
- if (mAttribute[index] > 0)
- {
- glVertexAttrib4fvARB(mAttribute[index], v);
- }
+ if (mAttribute[index] > 0)
+ {
+ glVertexAttrib4fvARB(mAttribute[index], v);
+ }
}
void LLGLSLShader::setMinimumAlpha(F32 minimum)
{
- gGL.flush();
- uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum);
+ gGL.flush();
+ uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum);
}
diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp
index df5d79a436..4e2ebfd51e 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -433,8 +433,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
F32 image_width = image->getWidth(0);
F32 image_height = image->getHeight(0);
- S32 image_natural_width = llround(image_width * uv_width);
- S32 image_natural_height = llround(image_height * uv_height);
+ S32 image_natural_width = ll_round(image_width * uv_width);
+ S32 image_natural_height = ll_round(image_height * uv_height);
LLRectf draw_center_rect( uv_center_rect.mLeft * image_width,
uv_center_rect.mTop * image_height,
@@ -468,10 +468,10 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
draw_center_rect.setCenterAndSize(uv_center_rect.getCenterX() * width, uv_center_rect.getCenterY() * height, scaled_width, scaled_height);
}
- draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]);
- draw_center_rect.mTop = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]);
- draw_center_rect.mRight = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]);
- draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]);
+ draw_center_rect.mLeft = ll_round(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]);
+ draw_center_rect.mTop = ll_round(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]);
+ draw_center_rect.mRight = ll_round(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]);
+ draw_center_rect.mBottom = ll_round(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]);
LLRectf draw_outer_rect(ui_translation.mV[VX],
ui_translation.mV[VY] + height * ui_scale.mV[VY],
@@ -703,8 +703,8 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
ui_translation.mV[VY] += y;
ui_translation.scaleVec(ui_scale);
S32 index = 0;
- S32 scaled_width = llround(width * ui_scale.mV[VX]);
- S32 scaled_height = llround(height * ui_scale.mV[VY]);
+ S32 scaled_width = ll_round(width * ui_scale.mV[VX]);
+ S32 scaled_height = ll_round(height * ui_scale.mV[VY]);
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index a89ec675b4..b2be3cc3b6 100755
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -674,12 +674,17 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
if (defines)
{
for (boost::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
- {
- std::string define = "#define " + iter->first + " " + iter->second + "\n";
- text[count++] = (GLcharARB *) strdup(define.c_str());
- }
+ {
+ std::string define = "#define " + iter->first + " " + iter->second + "\n";
+ text[count++] = (GLcharARB *) strdup(define.c_str());
+ }
}
+ if( gGLManager.mIsATI )
+ {
+ text[ count++ ] = strdup( "#define IS_AMD_CARD 1\n" );
+ }
+
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
{
//use specified number of texture channels for indexed texture rendering
diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp
index 6f1fae92cd..5d8f92b2e6 100644
--- a/indra/llrender/lluiimage.cpp
+++ b/indra/llrender/lluiimage.cpp
@@ -149,13 +149,13 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
S32 LLUIImage::getWidth() const
{
// return clipped dimensions of actual image area
- return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth());
+ return ll_round((F32)mImage->getWidth(0) * mClipRegion.getWidth());
}
S32 LLUIImage::getHeight() const
{
// return clipped dimensions of actual image area
- return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight());
+ return ll_round((F32)mImage->getHeight(0) * mClipRegion.getHeight());
}
S32 LLUIImage::getTextureWidth() const
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index d06564df36..0fae600a90 100755
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -843,9 +843,11 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
{
LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
stop_glerror();
- LLGLSLShader::startProfile();
+ LLGLSLShader::startProfile();
+ stop_glerror();
glDrawArrays(sGLMode[mode], first, count);
- LLGLSLShader::stopProfile(count, mode);
+ stop_glerror();
+ LLGLSLShader::stopProfile(count, mode);
}
stop_glerror();
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 3067d9d1ba..623f570cef 100755
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -605,7 +605,7 @@ BOOL LLAccordionCtrl::autoScroll (S32 x, S32 y)
// autoscroll region should take up no more than one third of visible scroller area
S32 auto_scroll_region_height = llmin(rect_local.getHeight() / 3, 10);
- S32 auto_scroll_speed = llround(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
+ S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
LLRect bottom_scroll_rect = screen_local_extents;
bottom_scroll_rect.mTop = rect_local.mBottom + auto_scroll_region_height;
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index 30cb18812b..42726de0ad 100755
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -196,10 +196,10 @@ void renderBadgeBackground(F32 centerX, F32 centerY, F32 width, F32 height, cons
F32 x = LLFontGL::sCurOrigin.mX + centerX - width * 0.5f;
F32 y = LLFontGL::sCurOrigin.mY + centerY - height * 0.5f;
- LLRectf screen_rect(llround(x),
- llround(y),
- llround(x) + width,
- llround(y) + height);
+ LLRectf screen_rect(ll_round(x),
+ ll_round(y),
+ ll_round(x) + width,
+ ll_round(y) + height);
LLVector3 vertices[4];
vertices[0] = LLVector3(screen_rect.mRight, screen_rect.mTop, 1.0f);
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index ce8383857c..8c7df45884 100755
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -606,8 +606,8 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
overlay_height = mImageOverlay->getHeight();
F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
- overlay_width = llround((F32)overlay_width * scale_factor);
- overlay_height = llround((F32)overlay_height * scale_factor);
+ overlay_width = ll_round((F32)overlay_width * scale_factor);
+ overlay_height = ll_round((F32)overlay_height * scale_factor);
}
@@ -776,7 +776,7 @@ void LLButton::draw()
if (hasFocus())
{
F32 lerp_amt = gFocusMgr.getFocusFlashAmt();
- drawBorder(imagep, gFocusMgr.getFocusColor() % alpha, llround(lerp(1.f, 3.f, lerp_amt)));
+ drawBorder(imagep, gFocusMgr.getFocusColor() % alpha, ll_round(lerp(1.f, 3.f, lerp_amt)));
}
if (use_glow_effect)
@@ -1067,7 +1067,7 @@ void LLButton::resize(LLUIString label)
{
S32 overlay_width = mImageOverlay->getWidth();
F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight();
- overlay_width = llround((F32)overlay_width * scale_factor);
+ overlay_width = ll_round((F32)overlay_width * scale_factor);
switch(mImageOverlayAlignment)
{
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 3dbc9a5902..14f75a2352 100755
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1954,7 +1954,7 @@ void LLFloater::drawShadow(LLPanel* panel)
}
gl_drop_shadow(left, top, right, bottom,
shadow_color % getCurrentTransparency(),
- llround(shadow_offset));
+ ll_round(shadow_offset));
}
void LLFloater::updateTransparency(LLView* view, ETypeTransparency transparency_type)
@@ -2082,16 +2082,16 @@ void LLFloater::updateTitleButtons()
btn_rect.setLeftTopAndSize(
LLPANEL_BORDER_WIDTH,
getRect().getHeight() - close_box_from_top - (floater_close_box_size + 1) * button_count,
- llround((F32)floater_close_box_size * mButtonScale),
- llround((F32)floater_close_box_size * mButtonScale));
+ ll_round((F32)floater_close_box_size * mButtonScale),
+ ll_round((F32)floater_close_box_size * mButtonScale));
}
else
{
btn_rect.setLeftTopAndSize(
getRect().getWidth() - LLPANEL_BORDER_WIDTH - (floater_close_box_size + 1) * button_count,
getRect().getHeight() - close_box_from_top,
- llround((F32)floater_close_box_size * mButtonScale),
- llround((F32)floater_close_box_size * mButtonScale));
+ ll_round((F32)floater_close_box_size * mButtonScale),
+ ll_round((F32)floater_close_box_size * mButtonScale));
}
// first time here, init 'buttons_rect'
@@ -2142,16 +2142,16 @@ void LLFloater::buildButtons(const Params& floater_params)
btn_rect.setLeftTopAndSize(
LLPANEL_BORDER_WIDTH,
getRect().getHeight() - close_box_from_top - (floater_close_box_size + 1) * (i + 1),
- llround(floater_close_box_size * mButtonScale),
- llround(floater_close_box_size * mButtonScale));
+ ll_round(floater_close_box_size * mButtonScale),
+ ll_round(floater_close_box_size * mButtonScale));
}
else
{
btn_rect.setLeftTopAndSize(
getRect().getWidth() - LLPANEL_BORDER_WIDTH - (floater_close_box_size + 1) * (i + 1),
getRect().getHeight() - close_box_from_top,
- llround(floater_close_box_size * mButtonScale),
- llround(floater_close_box_size * mButtonScale));
+ ll_round(floater_close_box_size * mButtonScale),
+ ll_round(floater_close_box_size * mButtonScale));
}
LLButton::Params p;
@@ -3466,28 +3466,28 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const
LLCoordCommon out;
if (self.mX < -0.5f)
{
- out.mX = llround(rescale(self.mX, -1.f, -0.5f, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft));
+ out.mX = ll_round(rescale(self.mX, -1.f, -0.5f, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft));
}
else if (self.mX > 0.5f)
{
- out.mX = llround(rescale(self.mX, 0.5f, 1.f, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS));
+ out.mX = ll_round(rescale(self.mX, 0.5f, 1.f, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS));
}
else
{
- out.mX = llround(rescale(self.mX, -0.5f, 0.5f, snap_rect.mLeft, snap_rect.mRight - floater_width));
+ out.mX = ll_round(rescale(self.mX, -0.5f, 0.5f, snap_rect.mLeft, snap_rect.mRight - floater_width));
}
if (self.mY < -0.5f)
{
- out.mY = llround(rescale(self.mY, -1.f, -0.5f, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom));
+ out.mY = ll_round(rescale(self.mY, -1.f, -0.5f, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom));
}
else if (self.mY > 0.5f)
{
- out.mY = llround(rescale(self.mY, 0.5f, 1.f, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS));
+ out.mY = ll_round(rescale(self.mY, 0.5f, 1.f, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS));
}
else
{
- out.mY = llround(rescale(self.mY, -0.5f, 0.5f, snap_rect.mBottom, snap_rect.mTop - floater_height));
+ out.mY = ll_round(rescale(self.mY, -0.5f, 0.5f, snap_rect.mBottom, snap_rect.mTop - floater_height));
}
// return center point instead of lower left
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index 1c7326260c..afd2a8ce06 100755
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -92,7 +92,7 @@ public:
void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; }
F32 getFocusFlashAmt() const;
- S32 getFocusFlashWidth() const { return llround(lerp(1.f, 3.f, getFocusFlashAmt())); }
+ S32 getFocusFlashWidth() const { return ll_round(lerp(1.f, 3.f, getFocusFlashAmt())); }
LLColor4 getFocusColor() const;
void triggerFocusFlash();
BOOL getAppHasFocus() const { return mAppHasFocus; }
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index e20d6734f1..9f06ccc827 100755
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -306,18 +306,18 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height )
LLFolderViewFolder::arrange(&mMinWidth, &target_height);
LLRect scroll_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect());
- reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) );
+ reshape( llmax(scroll_rect.getWidth(), mMinWidth), ll_round(mCurHeight) );
LLRect new_scroll_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect());
if (new_scroll_rect.getWidth() != scroll_rect.getWidth())
{
- reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) );
+ reshape( llmax(scroll_rect.getWidth(), mMinWidth), ll_round(mCurHeight) );
}
// move item renamer text field to item's new position
updateRenamerPosition();
- return llround(mTargetHeight);
+ return ll_round(mTargetHeight);
}
static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View");
@@ -340,7 +340,7 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent)
scroll_rect = mScrollContainer->getContentWindowRect();
}
width = llmax(mMinWidth, scroll_rect.getWidth());
- height = llmax(llround(mCurHeight), scroll_rect.getHeight());
+ height = llmax(ll_round(mCurHeight), scroll_rect.getHeight());
// Restrict width within scroll container's width
if (mUseEllipses && mScrollContainer)
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 7c88f8fb9b..ffbc02fd08 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -862,7 +862,7 @@ void LLFolderViewItem::draw()
if (filter_string_length > 0)
{
- S32 left = llround(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2;
+ S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2;
S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2;
S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
S32 top = getRect().getHeight() - TOP_PAD;
@@ -1046,7 +1046,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
{
S32 child_width = *width;
S32 child_height = 0;
- S32 child_top = parent_item_height - llround(running_height);
+ S32 child_top = parent_item_height - ll_round(running_height);
target_height += folderp->arrange( &child_width, &child_height );
@@ -1065,7 +1065,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
{
S32 child_width = *width;
S32 child_height = 0;
- S32 child_top = parent_item_height - llround(running_height);
+ S32 child_top = parent_item_height - ll_round(running_height);
target_height += itemp->arrange( &child_width, &child_height );
// don't change width, as this item is as wide as its parent folder by construction
@@ -1102,7 +1102,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
folders_t::iterator fit = iter++;
// number of pixels that bottom of folder label is from top of parent folder
if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight()
- > llround(mCurHeight) + mMaxFolderItemOverlap)
+ > ll_round(mCurHeight) + mMaxFolderItemOverlap)
{
// hide if beyond current folder height
(*fit)->setVisible(FALSE);
@@ -1115,7 +1115,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
items_t::iterator iit = iter++;
// number of pixels that bottom of item label is from top of parent folder
if (getRect().getHeight() - (*iit)->getRect().mBottom
- > llround(mCurHeight) + mMaxFolderItemOverlap)
+ > ll_round(mCurHeight) + mMaxFolderItemOverlap)
{
(*iit)->setVisible(FALSE);
}
@@ -1127,12 +1127,12 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
}
// don't change width as this item is already as wide as its parent folder
- reshape(getRect().getWidth(),llround(mCurHeight));
+ reshape(getRect().getWidth(),ll_round(mCurHeight));
// pass current height value back to parent
- *height = llround(mCurHeight);
+ *height = ll_round(mCurHeight);
- return llround(mTargetHeight);
+ return ll_round(mTargetHeight);
}
BOOL LLFolderViewFolder::needsArrange()
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index c59286fc60..69246a2f57 100755
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -103,7 +103,7 @@ F32 LLLayoutPanel::getVisibleAmount() const
S32 LLLayoutPanel::getLayoutDim() const
{
- return llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
+ return ll_round((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
? getRect().getWidth()
: getRect().getHeight()));
}
@@ -130,7 +130,7 @@ void LLLayoutPanel::setTargetDim(S32 value)
S32 LLLayoutPanel::getVisibleDim() const
{
F32 min_dim = getRelevantMinDim();
- return llround(mVisibleAmt
+ return ll_round(mVisibleAmt
* (min_dim
+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
}
@@ -138,7 +138,7 @@ S32 LLLayoutPanel::getVisibleDim() const
void LLLayoutPanel::setOrientation( LLView::EOrientation orientation )
{
mOrientation = orientation;
- S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
+ S32 layout_dim = ll_round((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
? getRect().getWidth()
: getRect().getHeight()));
@@ -381,14 +381,14 @@ void LLLayoutStack::updateLayout()
{
panelp->mTargetDim = panelp->getRelevantMinDim();
}
- space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount());
+ space_to_distribute -= panelp->getVisibleDim() + ll_round((F32)mPanelSpacing * panelp->getVisibleAmount());
total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor();
}
llassert(total_visible_fraction < 1.05f);
// don't need spacing after last panel
- space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
+ space_to_distribute += panelp ? ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
S32 remaining_space = space_to_distribute;
F32 fraction_distributed = 0.f;
@@ -399,7 +399,7 @@ void LLLayoutStack::updateLayout()
if (panelp->mAutoResize)
{
F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction);
- S32 delta = llround((F32)space_to_distribute * fraction_to_distribute);
+ S32 delta = ll_round((F32)space_to_distribute * fraction_to_distribute);
fraction_distributed += fraction_to_distribute;
panelp->mTargetDim += delta;
remaining_space -= delta;
@@ -431,23 +431,23 @@ void LLLayoutStack::updateLayout()
LLRect panel_rect;
if (mOrientation == HORIZONTAL)
{
- panel_rect.setLeftTopAndSize(llround(cur_pos),
+ panel_rect.setLeftTopAndSize(ll_round(cur_pos),
getRect().getHeight(),
- llround(panel_dim),
+ ll_round(panel_dim),
getRect().getHeight());
}
else
{
panel_rect.setLeftTopAndSize(0,
- llround(cur_pos),
+ ll_round(cur_pos),
getRect().getWidth(),
- llround(panel_dim));
+ ll_round(panel_dim));
}
LLRect resize_bar_rect(panel_rect);
F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount();
F32 panel_visible_dim = panelp->getVisibleDim();
- S32 panel_spacing_round = (S32)(llround(panel_spacing));
+ S32 panel_spacing_round = (S32)(ll_round(panel_spacing));
if (mOrientation == HORIZONTAL)
{
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 45f4272aa7..ae94a021d1 100755
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -829,7 +829,7 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
// Scroll if mouse cursor outside of bounds
if (mScrollTimer.hasExpired())
{
- S32 increment = llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME);
+ S32 increment = ll_round(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME);
mScrollTimer.reset();
mScrollTimer.setTimerExpirySec(AUTO_SCROLL_TIME);
if( (x < mTextLeftEdge) && (mScrollHPos > 0 ) )
@@ -1833,7 +1833,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
select_left - mScrollHPos,
- mTextRightEdge - llround(rendered_pixels_right),
+ mTextRightEdge - ll_round(rendered_pixels_right),
&rendered_pixels_right);
}
@@ -1843,8 +1843,8 @@ void LLLineEditor::draw()
color.setAlpha(alpha);
// selected middle
S32 width = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos + rendered_text, select_right - mScrollHPos - rendered_text);
- width = llmin(width, mTextRightEdge - llround(rendered_pixels_right));
- gl_rect_2d(llround(rendered_pixels_right), cursor_top, llround(rendered_pixels_right)+width, cursor_bottom, color);
+ width = llmin(width, mTextRightEdge - ll_round(rendered_pixels_right));
+ gl_rect_2d(ll_round(rendered_pixels_right), cursor_top, ll_round(rendered_pixels_right)+width, cursor_bottom, color);
LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha );
rendered_text += mGLFont->render(
@@ -1855,7 +1855,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
select_right - mScrollHPos - rendered_text,
- mTextRightEdge - llround(rendered_pixels_right),
+ mTextRightEdge - ll_round(rendered_pixels_right),
&rendered_pixels_right);
}
@@ -1870,7 +1870,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mTextRightEdge - llround(rendered_pixels_right),
+ mTextRightEdge - ll_round(rendered_pixels_right),
&rendered_pixels_right);
}
}
@@ -1884,7 +1884,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mTextRightEdge - llround(rendered_pixels_right),
+ mTextRightEdge - ll_round(rendered_pixels_right),
&rendered_pixels_right);
}
#if 1 // for when we're ready for image art.
@@ -2044,7 +2044,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mTextRightEdge - llround(rendered_pixels_right),
+ mTextRightEdge - ll_round(rendered_pixels_right),
&rendered_pixels_right, FALSE);
}
@@ -2069,7 +2069,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mTextRightEdge - llround(rendered_pixels_right),
+ mTextRightEdge - ll_round(rendered_pixels_right),
&rendered_pixels_right, FALSE);
}
// Draw children (border)
@@ -2573,7 +2573,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length)
S32 LLLineEditor::getPreeditFontSize() const
{
- return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
+ return ll_round(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace)
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 8ef2b4ef5b..6b0acb5fb4 100755
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1573,7 +1573,7 @@ void LLMenuItemBranchDownGL::draw( void )
std::string::size_type offset = upper_case_label.find(getJumpKey());
if (offset != std::string::npos)
{
- S32 x_offset = llround((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
+ S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset);
S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1);
gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS);
@@ -3005,8 +3005,8 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask )
LLVector2 mouse_avg_dir((F32)mMouseVelX, (F32)mMouseVelY);
mouse_avg_dir.normVec();
F32 interp = 0.5f * (llclamp(mouse_dir * mouse_avg_dir, 0.f, 1.f));
- mMouseVelX = llround(lerp((F32)mouse_delta_x, (F32)mMouseVelX, interp));
- mMouseVelY = llround(lerp((F32)mouse_delta_y, (F32)mMouseVelY, interp));
+ mMouseVelX = ll_round(lerp((F32)mouse_delta_x, (F32)mMouseVelX, interp));
+ mMouseVelY = ll_round(lerp((F32)mouse_delta_y, (F32)mMouseVelY, interp));
mLastMouseX = x;
mLastMouseY = y;
diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp
index 33e66add18..8cf88ad5eb 100755
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -287,7 +287,7 @@ void LLModalDialog::draw()
void LLModalDialog::centerOnScreen()
{
LLVector2 window_size = LLUI::getWindowSize();
- centerWithin(LLRect(0, 0, llround(window_size.mV[VX]), llround(window_size.mV[VY])));
+ centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
}
diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp
index 84a890edfa..209796565c 100755
--- a/indra/llui/llprogressbar.cpp
+++ b/indra/llui/llprogressbar.cpp
@@ -77,7 +77,7 @@ void LLProgressBar::draw()
LLColor4 bar_color = mColorBar.get();
bar_color.mV[VALPHA] *= alpha; // modulate alpha
LLRect progress_rect = getLocalRect();
- progress_rect.mRight = llround(getRect().getWidth() * (mPercentDone / 100.f));
+ progress_rect.mRight = ll_round(getRect().getWidth() * (mPercentDone / 100.f));
mImageFill->draw(progress_rect, bar_color);
}
diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp
index 523bc7c667..e4a31d6a79 100755
--- a/indra/llui/llrngwriter.cpp
+++ b/indra/llui/llrngwriter.cpp
@@ -34,7 +34,7 @@
#pragma clang diagnostic ignored "-Wdelete-incomplete"
#include "lluictrlfactory.h"
#pragma clang diagnostic pop
-#elif
+#else
#include "lluictrlfactory.h"
#endif
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 898e13a2c5..f70eebc594 100755
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -314,7 +314,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
// clip rect against root view
inner_rect_local.intersectWith(screen_local_extents);
- S32 auto_scroll_speed = llround(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
+ S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
// autoscroll region should take up no more than one third of visible scroller area
S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, 10);
S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, 10);
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index cf8be57908..899a0bbab9 100755
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -648,7 +648,7 @@ bool LLScrollListCtrl::updateColumnWidths()
S32 new_width = 0;
if (column->mRelWidth >= 0)
{
- new_width = (S32)llround(column->mRelWidth*mItemListRect.getWidth());
+ new_width = (S32)ll_round(column->mRelWidth*mItemListRect.getWidth());
}
else if (column->mDynamicWidth)
{
@@ -2679,7 +2679,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params
}
if (new_column->mRelWidth >= 0)
{
- new_column->setWidth((S32)llround(new_column->mRelWidth*mItemListRect.getWidth()));
+ new_column->setWidth((S32)ll_round(new_column->mRelWidth*mItemListRect.getWidth()));
}
else if(new_column->mDynamicWidth)
{
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index ebdbdf59c0..8b1ba406c8 100755
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -153,7 +153,7 @@ F32 clamp_precision(F32 value, S32 decimal_precision)
for (S32 i = 0; i < decimal_precision; i++)
clamped_value *= 10.0;
- clamped_value = llround((F32)clamped_value);
+ clamped_value = ll_round((F32)clamped_value);
for (S32 i = 0; i < decimal_precision; i++)
clamped_value /= 10.0;
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 1bd2bc06f4..a972b65f4a 100755
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -711,7 +711,7 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect )
if (tick_begin > last_label + MIN_LABEL_SPACING)
{
gl_rect_2d(tick_begin, bar_rect.mTop, tick_end, bar_rect.mBottom - TICK_LENGTH, LLColor4(1.f, 1.f, 1.f, 0.25f));
- S32 label_pos = tick_begin - llround((F32)tick_label_width * ((F32)tick_begin / (F32)bar_rect.getWidth()));
+ S32 label_pos = tick_begin - ll_round((F32)tick_label_width * ((F32)tick_begin / (F32)bar_rect.getWidth()));
LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, label_pos, bar_rect.mBottom - TICK_LENGTH,
LLColor4(1.f, 1.f, 1.f, 0.5f),
LLFontGL::LEFT, LLFontGL::TOP);
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index 98962aff9a..3fe314e77a 100755
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -111,7 +111,7 @@ void LLStatGraph::draw()
color = it->mColor;
gGL.color4fv(color.mV);
- gl_rect_2d(1, llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
+ gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
}
void LLStatGraph::setMin(const F32 min)
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 9b125a85b9..367bc9a084 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1556,7 +1556,7 @@ void LLTextBase::reflow()
line_count));
line_start_index = segment->getStart() + seg_offset;
- cur_top -= llround((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
+ cur_top -= ll_round((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
remaining_pixels = text_available_width;
line_height = 0;
}
@@ -1568,7 +1568,7 @@ void LLTextBase::reflow()
last_segment_char_on_line,
line_rect,
line_count));
- cur_top -= llround((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
+ cur_top -= ll_round((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
break;
}
// ...or finished a segment and there are segments remaining on this line
@@ -1583,7 +1583,7 @@ void LLTextBase::reflow()
line_rect,
line_count));
line_start_index = segment->getStart() + seg_offset;
- cur_top -= llround((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
+ cur_top -= ll_round((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
line_height = 0;
remaining_pixels = text_available_width;
}
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index cf5fdef539..c433f8ccab 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2840,7 +2840,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
S32 LLTextEditor::getPreeditFontSize() const
{
- return llround((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
+ return ll_round((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
BOOL LLTextEditor::isDirty() const
diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp
index 271947db7a..516057f8fd 100755
--- a/indra/llui/lltimectrl.cpp
+++ b/indra/llui/lltimectrl.cpp
@@ -153,7 +153,7 @@ U32 LLTimeCtrl::getMinutes() const
void LLTimeCtrl::setTime24(F32 time)
{
time = llclamp(time, 0.0f, 23.99f); // fix out of range values
- mTime = llround(time * MINUTES_PER_HOUR); // fixes values like 4.99999
+ mTime = ll_round(time * MINUTES_PER_HOUR); // fixes values like 4.99999
updateText();
}
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 1f570edd88..aabc7ed2e4 100755
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -236,8 +236,8 @@ void LLUI::dirtyRect(LLRect rect)
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
S32 screen_x, screen_y;
- screen_x = llround((F32)x * getScaleFactor().mV[VX]);
- screen_y = llround((F32)y * getScaleFactor().mV[VY]);
+ screen_x = ll_round((F32)x * getScaleFactor().mV[VX]);
+ screen_y = ll_round((F32)y * getScaleFactor().mV[VY]);
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
@@ -248,8 +248,8 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y)
LLCoordWindow cursor_pos_window;
getWindow()->getCursorPosition(&cursor_pos_window);
LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
- *x = llround((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
- *y = llround((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
+ *x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
+ *y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
}
//static
@@ -369,15 +369,15 @@ LLVector2 LLUI::getWindowSize()
//static
void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y)
{
- *gl_x = llround((F32)screen_x * getScaleFactor().mV[VX]);
- *gl_y = llround((F32)screen_y * getScaleFactor().mV[VY]);
+ *gl_x = ll_round((F32)screen_x * getScaleFactor().mV[VX]);
+ *gl_y = ll_round((F32)screen_y * getScaleFactor().mV[VY]);
}
//static
void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y)
{
- *screen_x = llround((F32)gl_x / getScaleFactor().mV[VX]);
- *screen_y = llround((F32)gl_y / getScaleFactor().mV[VY]);
+ *screen_x = ll_round((F32)gl_x / getScaleFactor().mV[VX]);
+ *screen_y = ll_round((F32)gl_y / getScaleFactor().mV[VY]);
}
//static
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 17af45cc0c..3ce39c947f 100755
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -189,7 +189,7 @@ public:
#pragma clang diagnostic ignored "-Wdelete-incomplete"
delete view;
#pragma clang diagnostic pop
-#elif
+#else
delete view;
#endif
view = NULL;
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 6f3122e7a1..9c470b5cca 100755
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -835,9 +835,9 @@ void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data)
// If parcel name is empty use Sim_name (x, y, z) for parcel label.
else if (!parcel_data.sim_name.empty())
{
- S32 region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
- S32 region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
- S32 region_z = llround(parcel_data.global_z);
+ S32 region_x = ll_round(parcel_data.global_x) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round(parcel_data.global_y) % REGION_WIDTH_UNITS;
+ S32 region_z = ll_round(parcel_data.global_z);
label = llformat("%s (%d, %d, %d)",
parcel_data.sim_name.c_str(), region_x, region_y, region_z);
diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp
index f6a44338a4..99a0869ce3 100755
--- a/indra/llui/llxuiparser.cpp
+++ b/indra/llui/llxuiparser.cpp
@@ -58,6 +58,10 @@ static LLInitParam::Parser::parser_inspect_func_map_t sSimpleXUIInspectFuncs;
const char* NO_VALUE_MARKER = "no_value";
+#ifdef LL_WINDOWS
+const S32 LINE_NUMBER_HERE = 0;
+#endif
+
struct MaxOccursValues : public LLInitParam::TypeValuesHelper<U32, MaxOccursValues>
{
static void declareValues()
diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h
index f1fab3b2c6..072d40f739 100644
--- a/indra/llwindow/llopenglview-objc.h
+++ b/indra/llwindow/llopenglview-objc.h
@@ -79,6 +79,7 @@
@interface LLNonInlineTextView : NSTextView
{
LLOpenGLView *glview;
+ unichar mKeyPressed;
}
- (void) setGLView:(LLOpenGLView*)view;
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 141eab792a..773c093e2f 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -270,14 +270,14 @@ attributedStringInfo getSegments(NSAttributedString *str)
!([theEvent modifierFlags] & NSFunctionKeyMask) &&
!([theEvent modifierFlags] & NSHelpKeyMask))
{
- callRightMouseDown(mMousePos, mModifiers);
+ callRightMouseDown(mMousePos, [theEvent modifierFlags]);
mSimulatedRightClick = true;
} else {
if ([theEvent clickCount] >= 2)
{
- callDoubleClick(mMousePos, mModifiers);
+ callDoubleClick(mMousePos, [theEvent modifierFlags]);
} else if ([theEvent clickCount] == 1) {
- callLeftMouseDown(mMousePos, mModifiers);
+ callLeftMouseDown(mMousePos, [theEvent modifierFlags]);
}
}
}
@@ -286,21 +286,21 @@ attributedStringInfo getSegments(NSAttributedString *str)
{
if (mSimulatedRightClick)
{
- callRightMouseUp(mMousePos, mModifiers);
+ callRightMouseUp(mMousePos, [theEvent modifierFlags]);
mSimulatedRightClick = false;
} else {
- callLeftMouseUp(mMousePos, mModifiers);
+ callLeftMouseUp(mMousePos, [theEvent modifierFlags]);
}
}
- (void) rightMouseDown:(NSEvent *)theEvent
{
- callRightMouseDown(mMousePos, mModifiers);
+ callRightMouseDown(mMousePos, [theEvent modifierFlags]);
}
- (void) rightMouseUp:(NSEvent *)theEvent
{
- callRightMouseUp(mMousePos, mModifiers);
+ callRightMouseUp(mMousePos, [theEvent modifierFlags]);
}
- (void)mouseMoved:(NSEvent *)theEvent
@@ -341,12 +341,12 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) otherMouseDown:(NSEvent *)theEvent
{
- callMiddleMouseDown(mMousePos, mModifiers);
+ callMiddleMouseDown(mMousePos, [theEvent modifierFlags]);
}
- (void) otherMouseUp:(NSEvent *)theEvent
{
- callMiddleMouseUp(mMousePos, mModifiers);
+ callMiddleMouseUp(mMousePos, [theEvent modifierFlags]);
}
- (void) otherMouseDragged:(NSEvent *)theEvent
@@ -366,22 +366,27 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) keyUp:(NSEvent *)theEvent
{
- callKeyUp([theEvent keyCode], mModifiers);
+ callKeyUp([theEvent keyCode], [theEvent modifierFlags]);
}
- (void) keyDown:(NSEvent *)theEvent
{
uint keycode = [theEvent keyCode];
+ // We must not depend on flagsChange event to detect modifier flags changed,
+ // must depend on the modifire flags in the event parameter.
+ // Because flagsChange event handler misses event when other window is activated,
+ // e.g. OS Window for upload something or Input Window...
+ // mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit)
+ mModifiers = [theEvent modifierFlags];
bool acceptsText = mHasMarkedText ? false : callKeyDown(keycode, mModifiers);
+ unichar ch;
if (acceptsText &&
!mMarkedTextAllowed &&
+ !(mModifiers & (NSControlKeyMask | NSCommandKeyMask)) && // commands don't invoke InputWindow
![(LLAppDelegate*)[NSApp delegate] romanScript] &&
- [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSDeleteCharacter &&
- [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSBackspaceCharacter &&
- [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSDownArrowFunctionKey &&
- [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSUpArrowFunctionKey &&
- [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSLeftArrowFunctionKey &&
- [[theEvent charactersIgnoringModifiers] characterAtIndex:0] != NSRightArrowFunctionKey)
+ (ch = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]) > ' ' &&
+ ch != NSDeleteCharacter &&
+ (ch < 0xF700 || ch > 0xF8FF)) // 0xF700-0xF8FF: reserved for function keys on the keyboard(from NSEvent.h)
{
[(LLAppDelegate*)[NSApp delegate] showInputWindow:true withEvent:theEvent];
} else
@@ -498,31 +503,58 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
{
- if ([aString class] == NSClassFromString(@"NSConcreteMutableAttributedString"))
+ // Apple says aString can be either an NSString or NSAttributedString instance.
+ // But actually it's NSConcreteMutableAttributedString or __NSCFConstantString.
+ // I observed aString was __NSCFConstantString only aString was null string(zero length).
+ // Apple also says when aString is an NSString object,
+ // the receiver is expected to render the marked text with distinguishing appearance.
+ // So I tried to make attributedStringInfo, but it won't be used... (Pell Smit)
+
+ if (mMarkedTextAllowed)
{
- if (mMarkedTextAllowed)
+ unsigned int selected[2] = {
+ selectedRange.location,
+ selectedRange.length
+ };
+
+ unsigned int replacement[2] = {
+ replacementRange.location,
+ replacementRange.length
+ };
+
+ int string_length = [aString length];
+ unichar text[string_length];
+ attributedStringInfo segments;
+ // I used 'respondsToSelector:@selector(string)'
+ // to judge aString is an attributed string or not.
+ if ([aString respondsToSelector:@selector(string)])
+ {
+ // aString is attibuted
+ [[aString string] getCharacters:text range:NSMakeRange(0, string_length)];
+ segments = getSegments((NSAttributedString *)aString);
+ }
+ else
+ {
+ // aString is not attributed
+ [aString getCharacters:text range:NSMakeRange(0, string_length)];
+ segments.seg_lengths.push_back(string_length);
+ segments.seg_standouts.push_back(true);
+ }
+ setMarkedText(text, selected, replacement, string_length, segments);
+ if (string_length > 0)
{
- unsigned int selected[2] = {
- selectedRange.location,
- selectedRange.length
- };
-
- unsigned int replacement[2] = {
- replacementRange.location,
- replacementRange.length
- };
-
- unichar text[[aString length]];
- [[aString mutableString] getCharacters:text range:NSMakeRange(0, [aString length])];
- attributedStringInfo segments = getSegments((NSAttributedString *)aString);
- setMarkedText(text, selected, replacement, [aString length], segments);
mHasMarkedText = TRUE;
- mMarkedTextLength = [aString length];
- } else {
- if (mHasMarkedText)
- {
- [self unmarkText];
- }
+ mMarkedTextLength = string_length;
+ }
+ else
+ {
+ // we must clear the marked text when aString is null.
+ [self unmarkText];
+ }
+ } else {
+ if (mHasMarkedText)
+ {
+ [self unmarkText];
}
}
}
@@ -641,37 +673,63 @@ attributedStringInfo getSegments(NSAttributedString *str)
@implementation LLNonInlineTextView
+/* Input Window is a legacy of 20 century, so we want to remove related classes.
+ But unfortunately, Viwer web browser has no support for modern inline input,
+ we need to leave these classes...
+ We will be back to get rid of Input Window after fixing viewer web browser.
+
+ How Input Window should work:
+ 1) Input Window must not be empty.
+ It must close when it become empty result of edithing.
+ 2) Input Window must not close when it still has input data.
+ It must keep open user types next char before commit. by Pell Smit
+*/
+
- (void) setGLView:(LLOpenGLView *)view
{
glview = view;
}
-- (void) insertText:(id)insertString
+- (void)keyDown:(NSEvent *)theEvent
{
- [[self inputContext] discardMarkedText];
- [self setString:@""];
- [_window orderOut:_window];
- [self insertText:insertString replacementRange:NSMakeRange(0, [insertString length])];
+ // mKeyPressed is used later to determine whethere Input Window should close or not
+ mKeyPressed = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
+ // setMarkedText and insertText is called indirectly from inside keyDown: method
+ [super keyDown:theEvent];
}
-- (void) insertText:(id)aString replacementRange:(NSRange)replacementRange
+// setMarkedText: is called for incomplete input(on the way to conversion).
+- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
{
- [glview insertText:aString replacementRange:replacementRange];
+ [super setMarkedText:aString selectedRange:selectedRange replacementRange:replacementRange];
+ if ([aString length] == 0) // this means Input Widow becomes empty
+ {
+ [_window orderOut:_window]; // Close this to avoid empty Input Window
+ }
}
-- (void) insertNewline:(id)sender
+// insertText: is called for inserting commited text.
+// There are two ways to be called here:
+// a) explicitly commited (must close)
+// In case of user typed commit key(usually return key) or delete key or something
+// b) automatically commited (must not close)
+// In case of user typed next letter after conversion
+- (void) insertText:(id)aString replacementRange:(NSRange)replacementRange
{
- [[self textStorage] setValue:@""];
- [[self inputContext] discardMarkedText];
+ [[self inputContext] discardMarkedText];
[self setString:@""];
-}
-
-- (void)doCommandBySelector:(SEL)aSelector
-{
- if (aSelector == @selector(insertNewline:))
- {
- [self insertNewline:self];
- }
+ [glview insertText:aString replacementRange:replacementRange];
+ if (mKeyPressed == NSEnterCharacter ||
+ mKeyPressed == NSBackspaceCharacter ||
+ mKeyPressed == NSTabCharacter ||
+ mKeyPressed == NSNewlineCharacter ||
+ mKeyPressed == NSCarriageReturnCharacter ||
+ mKeyPressed == NSDeleteCharacter ||
+ (mKeyPressed >= 0xF700 && mKeyPressed <= 0xF8FF))
+ {
+ // this is case a) of above comment
+ [_window orderOut:_window]; // to avoid empty Input Window
+ }
}
@end
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 7972b66012..e50999dc36 100755
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -224,7 +224,10 @@ void callFocus()
void callFocusLost()
{
- gWindowImplementation->getCallbacks()->handleFocusLost(gWindowImplementation);
+ if (gWindowImplementation)
+ {
+ gWindowImplementation->getCallbacks()->handleFocusLost(gWindowImplementation);
+ }
}
void callRightMouseDown(float *pos, MASK mask)
@@ -235,8 +238,8 @@ void callRightMouseDown(float *pos, MASK mask)
}
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
gWindowImplementation->getCallbacks()->handleRightMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE));
}
@@ -248,8 +251,8 @@ void callRightMouseUp(float *pos, MASK mask)
}
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
gWindowImplementation->getCallbacks()->handleRightMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE));
}
@@ -261,8 +264,8 @@ void callLeftMouseDown(float *pos, MASK mask)
}
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
gWindowImplementation->getCallbacks()->handleMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE));
}
@@ -274,8 +277,8 @@ void callLeftMouseUp(float *pos, MASK mask)
}
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
gWindowImplementation->getCallbacks()->handleMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE));
}
@@ -288,8 +291,8 @@ void callDoubleClick(float *pos, MASK mask)
}
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
gWindowImplementation->getCallbacks()->handleDoubleClick(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE));
}
@@ -304,8 +307,8 @@ void callResize(unsigned int width, unsigned int height)
void callMouseMoved(float *pos, MASK mask)
{
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
float deltas[2];
gWindowImplementation->getMouseDeltas(deltas);
outCoords.mX += deltas[0];
@@ -351,8 +354,8 @@ void callDeltaUpdate(float *delta, MASK mask)
void callMiddleMouseDown(float *pos, MASK mask)
{
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
float deltas[2];
gWindowImplementation->getMouseDeltas(deltas);
outCoords.mX += deltas[0];
@@ -363,8 +366,8 @@ void callMiddleMouseDown(float *pos, MASK mask)
void callMiddleMouseUp(float *pos, MASK mask)
{
LLCoordGL outCoords;
- outCoords.mX = llround(pos[0]);
- outCoords.mY = llround(pos[1]);
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
float deltas[2];
gWindowImplementation->getMouseDeltas(deltas);
outCoords.mX += deltas[0];
@@ -500,8 +503,8 @@ void LLWindowMacOSX::updateMouseDeltas(float* deltas)
{
if (mCursorDecoupled)
{
- mCursorLastEventDeltaX = llround(deltas[0]);
- mCursorLastEventDeltaY = llround(-deltas[1]);
+ mCursorLastEventDeltaX = ll_round(deltas[0]);
+ mCursorLastEventDeltaY = ll_round(-deltas[1]);
if (mCursorIgnoreNextDelta)
{
@@ -1799,8 +1802,6 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key)
void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
{
- allowDirectMarkedTextInput(b, mGLView);
-
if (preeditor != mPreeditor && !b)
{
// This condition may occur by a call to
@@ -1830,6 +1831,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
return;
}
mLanguageTextInputAllowed = b;
+ allowDirectMarkedTextInput(b, mGLView); // mLanguageTextInputAllowed and mMarkedTextAllowed should be updated at once (by Pell Smit
}
void LLWindowMacOSX::interruptLanguageTextInput()
diff --git a/indra/media_plugins/winmmshim/forwarding_api.cpp b/indra/media_plugins/winmmshim/forwarding_api.cpp
index 495e08942b..33f0675028 100755
--- a/indra/media_plugins/winmmshim/forwarding_api.cpp
+++ b/indra/media_plugins/winmmshim/forwarding_api.cpp
@@ -1338,7 +1338,7 @@ extern "C" {
return joySetThreshold_orig( uJoyID, uThreshold);
}
- BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
+ BOOL WINAPI mciDriverNotify(HANDLE hwndCallback, MCIDEVICEID uDeviceID, UINT uStatus)
{
ll_winmm_shim_initialize();
//OutputDebugString(L"mciDriverNotify\n");
@@ -1610,7 +1610,7 @@ extern "C" {
return mciGetYieldProc_orig( mciId, pdwYieldData);
}
- UINT WINAPI mciLoadCommandResource(HINSTANCE hInstance, LPCWSTR lpResName, UINT uType)
+ UINT WINAPI mciLoadCommandResource(HANDLE hInstance, LPCWSTR lpResName, UINT uType)
{
ll_winmm_shim_initialize();
//OutputDebugString(L"mciLoadCommandResource");
diff --git a/indra/media_plugins/winmmshim/forwarding_api.h b/indra/media_plugins/winmmshim/forwarding_api.h
index 076a08f769..1418fc9e1d 100755
--- a/indra/media_plugins/winmmshim/forwarding_api.h
+++ b/indra/media_plugins/winmmshim/forwarding_api.h
@@ -306,7 +306,7 @@ typedef MMRESULT (WINAPI *joySetCapture_type)( HWND hwnd, UINT uJoyID, UINT uPer
extern joySetCapture_type joySetCapture_orig;
typedef MMRESULT (WINAPI *joySetThreshold_type)( UINT uJoyID, UINT uThreshold);
extern joySetThreshold_type joySetThreshold_orig;
-typedef BOOL (WINAPI *mciDriverNotify_type)(HWND hwndCallback, UINT uDeviceID, UINT uStatus);
+typedef BOOL(WINAPI *mciDriverNotify_type)(HANDLE hwndCallback, MCIDEVICEID uDeviceID, UINT uStatus);
extern mciDriverNotify_type mciDriverNotify_orig;
typedef UINT (WINAPI *mciDriverYield_type)(UINT uDeviceID);
extern mciDriverYield_type mciDriverYield_orig;
@@ -384,7 +384,7 @@ typedef HTASK (WINAPI *mciGetCreatorTask_type)( MCIDEVICEID mciId);
extern mciGetCreatorTask_type mciGetCreatorTask_orig;
typedef YIELDPROC (WINAPI *mciGetYieldProc_type)( MCIDEVICEID mciId, LPDWORD pdwYieldData);
extern mciGetYieldProc_type mciGetYieldProc_orig;
-typedef UINT (WINAPI *mciLoadCommandResource_type)(HINSTANCE hInstance, LPCWSTR lpResName, UINT uType);
+typedef UINT (WINAPI *mciLoadCommandResource_type)(HANDLE hInstance, LPCWSTR lpResName, UINT uType);
extern mciLoadCommandResource_type mciLoadCommandResource_orig;
typedef BOOL (WINAPI *mciExecute_type)(LPCSTR pszCommand);
extern mciExecute_type mciExecute_orig;
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index c6cff55cf7..a4de059bbc 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-3.7.21
+3.7.23
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index bc63d07d72..767fad016c 100755
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -40,4 +40,10 @@ mat4 getSkinnedTransform()
ret[3] = vec4(0,0,0,1);
return ret;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ vec4 dummy1 = matrixPalette[0];
+ vec4 dummy2 = matrixPalette[44];
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 57129c3bd1..6cd38d8ef5 100755
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -63,5 +63,14 @@ mat4 getObjectSkinnedTransform()
ret[3] = vec4(trans, 1.0);
return ret;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ mat3 dummy1 = matrixPalette[0];
+ vec3 dummy2 = translationPalette[0];
+ mat3 dummy3 = matrixPalette[51];
+ vec3 dummy4 = translationPalette[51];
+#endif
+
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index a4f54dff70..5264d6e1b4 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -132,5 +132,11 @@ void main()
col.y *= col.y;
frag_color = col;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ vec3 dummy1 = kern[0];
+ vec3 dummy2 = kern[3];
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 236567219b..1a464fec5d 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -161,4 +161,12 @@ void main()
frag_color.rgb = out_col;
frag_color.a = 0.0;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ vec4 dummy1 = light[0];
+ vec4 dummy2 = light_col[0];
+ vec4 dummy3 = light[LIGHT_COUNT-1];
+ vec4 dummy4 = light_col[LIGHT_COUNT-1];
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 0e6ab80d4d..c08e9d361a 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -127,13 +127,17 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
vec4 ret = texture2DLod(projectionMap, tc, lod);
ret.rgb = srgb_to_linear(ret.rgb);
- vec2 dist = tc-vec2(0.5);
+ vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
- float det = max(1.0-lod/(proj_lod*0.5), 0.0);
+ float det = min(lod/(proj_lod*0.5), 1.0);
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
+ float d = min(dist.x, dist.y);
+
+ d *= min(1, d * (proj_lod - lod));
+
+ float edge = 0.25*det;
+
+ ret *= clamp(d/edge, 0.0, 1.0);
return ret;
}
@@ -311,19 +315,17 @@ void main()
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
- stc /= stc.w;
+
if (stc.z > 0.0)
{
- float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
-
- stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+ stc /= stc.w;
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&
stc.y > 0.0)
{
- col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb*spec.rgb;
+ col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
index 96f9628424..018ced4cad 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
@@ -99,4 +99,10 @@ void main()
col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z;
frag_color.rgb = col;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ vec2 dummy1 = kern[0];
+ vec2 dummy2 = kern[31];
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 8d8a6c9dde..f50635a139 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -130,15 +130,19 @@ vec4 correctWithGamma(vec4 col)
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
- ret = correctWithGamma(ret);
+ ret.rgb = srgb_to_linear(ret.rgb);
- vec2 dist = tc-vec2(0.5);
+ vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
- float det = max(1.0-lod/(proj_lod*0.5), 0.0);
+ float det = min(lod/(proj_lod*0.5), 1.0);
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
+ float d = min(dist.x, dist.y);
+
+ d *= min(1, d * (proj_lod - lod));
+
+ float edge = 0.25*det;
+
+ ret *= clamp(d/edge, 0.0, 1.0);
return ret;
}
@@ -322,19 +326,14 @@ void main()
if (stc.z > 0.0)
{
- stc.xy /= stc.w;
-
- float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0);
-
- //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
- stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+ stc /= stc.w;
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&
stc.y > 0.0)
{
- col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-envIntensity*proj_lod).rgb*spec.rgb;
+ col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index c20e00163c..94bd07bec6 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -131,15 +131,19 @@ vec4 correctWithGamma(vec4 col)
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
- ret = correctWithGamma(ret);
-
- vec2 dist = tc-vec2(0.5);
+ ret.rgb = srgb_to_linear(ret.rgb);
- float det = max(1.0-lod/(proj_lod*0.5), 0.0);
+ vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
+ float det = min(lod/(proj_lod*0.5), 1.0);
+
+ float d = min(dist.x, dist.y);
+
+ d *= min(1, d * (proj_lod - lod));
+
+ float edge = 0.25*det;
+
+ ret *= clamp(d/edge, 0.0, 1.0);
return ret;
}
@@ -334,25 +338,21 @@ void main()
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
- stc /= stc.w;
if (stc.z > 0.0)
{
- float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
-
- stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+ stc /= stc.w;
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&
stc.y > 0.0)
{
- col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb*shadow*spec.rgb;
+ col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity;
}
}
}
}
-
//not sure why, but this line prevents MATBUG-194
col = max(col, vec3(0.0));
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 7689b72d20..92e1ac95a6 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -131,15 +131,19 @@ vec4 correctWithGamma(vec4 col)
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
- ret = correctWithGamma(ret);
+ ret.rgb = srgb_to_linear(ret.rgb);
- vec2 dist = tc-vec2(0.5);
+ vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
- float det = max(1.0-lod/(proj_lod*0.5), 0.0);
+ float det = min(lod/(proj_lod*0.5), 1.0);
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
+ float d = min(dist.x, dist.y);
+
+ d *= min(1, d * (proj_lod - lod));
+
+ float edge = 0.25*det;
+
+ ret *= clamp(d/edge, 0.0, 1.0);
return ret;
}
@@ -336,19 +340,14 @@ void main()
if (stc.z > 0.0)
{
- stc.xy /= stc.w;
-
- float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0);
-
- //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
- stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+ stc /= stc.w;
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&
stc.y > 0.0)
{
- col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-envIntensity*proj_lod).rgb*shadow*spec.rgb;
+ col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity;
}
}
}
diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm
index 988058aad3..aad5dbae7d 100644
--- a/indra/newview/llappdelegate-objc.mm
+++ b/indra/newview/llappdelegate-objc.mm
@@ -84,7 +84,7 @@
callWindowUnfocus();
}
-- (NSApplicationDelegateReply) applicationShouldTerminate:(NSApplication *)sender
+- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
{
if (!runMainLoop())
{
diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp
index 627c9eb5c0..cf98b56b4c 100755
--- a/indra/newview/llcommunicationchannel.cpp
+++ b/indra/newview/llcommunicationchannel.cpp
@@ -108,6 +108,6 @@ void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr)
|| (notificationType == "notifytoast"))
&& !pNotificationPtr->isCancelled())
{
- mHistory.insert(std::make_pair<LLDate, LLNotificationPtr>(pNotificationPtr->getDate(), pNotificationPtr));
+ mHistory.insert(history_list_t::value_type(pNotificationPtr->getDate(), pNotificationPtr));
}
}
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 7c96c71e21..3293b02131 100755
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -873,7 +873,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
}
pos -= camera.getOrigin();
- mDistanceWRTCamera = llround(pos.magVec(), 0.01f);
+ mDistanceWRTCamera = ll_round(pos.magVec(), 0.01f);
mVObjp->updateLOD();
}
}
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 393bd70382..ef121cd910 100755
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1624,7 +1624,8 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
{
F32 w = weight[j][k];
- idx[k] = llclamp((S32) floorf(w), 0, 63);
+ idx[k] = llclamp((S32) floorf(w), 0, JOINT_COUNT-1);
+
wght[k] = w - floorf(w);
scale += wght[k];
}
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 67d1642639..33f7bc305c 100755
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1329,7 +1329,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
for( i = minimum; i <= maximum; i++ )
{
F32 minus_one_to_one = F32(maximum - i) * twice_one_over_range - 1.f;
- bias_and_scale_lut[i] = llclampb(llround(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
+ bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
}
}
else
@@ -1337,7 +1337,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
for( i = minimum; i <= maximum; i++ )
{
F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f;
- bias_and_scale_lut[i] = llclampb(llround(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
+ bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
}
}
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index b618bdff2c..4a059fdc67 100755
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -219,7 +219,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
if (hasMouseCapture())
{
F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f);
- mScrollIndex = llround( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
+ mScrollIndex = ll_round( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods());
return TRUE;
}
@@ -1135,7 +1135,7 @@ void LLFastTimerView::drawLineGraph()
max_time = llmax(F32Microseconds(1.f), F32Microseconds(cur_max));
}
- max_calls = llround(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f)));
+ max_calls = ll_round(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f)));
if (llabs((S32)(max_calls - cur_max_calls)) <= 1)
{
max_calls = cur_max_calls;
@@ -1471,7 +1471,7 @@ void LLFastTimerView::drawBars()
LLRect frame_bar_rect;
frame_bar_rect.setLeftTopAndSize(mBarRect.mLeft,
bars_top,
- llround((mAverageTimerRow.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()),
+ ll_round((mAverageTimerRow.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()),
bar_height);
mAverageTimerRow.mTop = frame_bar_rect.mTop;
mAverageTimerRow.mBottom = frame_bar_rect.mBottom;
@@ -1485,7 +1485,7 @@ void LLFastTimerView::drawBars()
row.mTop = frame_bar_rect.mTop;
row.mBottom = frame_bar_rect.mBottom;
frame_bar_rect.mRight = frame_bar_rect.mLeft
- + llround((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth());
+ + ll_round((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth());
drawBar(frame_bar_rect, row, image_width, image_height);
frame_bar_rect.translate(0, -(bar_height + vpad));
@@ -1616,8 +1616,8 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width,
}
LLRect children_rect;
- children_rect.mLeft = llround(timer_bar.mChildrenStart / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
- children_rect.mRight = llround(timer_bar.mChildrenEnd / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
+ children_rect.mLeft = ll_round(timer_bar.mChildrenStart / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
+ children_rect.mRight = ll_round(timer_bar.mChildrenEnd / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
if (bar_rect.getHeight() > MIN_BAR_HEIGHT)
{
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index a1246e31d9..af84aea6a6 100755
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -77,10 +77,7 @@ const char FEATURE_TABLE_VER_FILENAME[] = "featuretable%s.%s.txt";
#endif
#if 0 // consuming code in #if 0 below
-const char GPU_TABLE_FILENAME[] = "gpu_table.txt";
#endif
-const char GPU_TABLE_VER_FILENAME[] = "gpu_table.%s.txt";
-
LLFeatureInfo::LLFeatureInfo(const std::string& name, const BOOL available, const F32 level)
: mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level)
{
@@ -430,6 +427,7 @@ bool LLFeatureManager::loadGPUClass()
{ //couldn't bench, use GLVersion
#if LL_DARWIN
//GLVersion is misleading on OSX, just default to class 3 if we can't bench
+ LL_WARNS() << "Unable to get an accurate benchmark; defaulting to class 3" << LL_ENDL;
mGPUClass = GPU_CLASS_3;
#else
if (gGLManager.mGLVersion < 2.f)
@@ -454,23 +452,31 @@ bool LLFeatureManager::loadGPUClass()
}
#endif
}
- else if (gbps < 5.f)
+ else if (gGLManager.mGLVersion <= 2.f)
+ {
+ mGPUClass = GPU_CLASS_0;
+ }
+ else if (gGLManager.mGLVersion <= 3.f)
+ {
+ mGPUClass = GPU_CLASS_1;
+ }
+ else if (gbps <= 5.f)
{
mGPUClass = GPU_CLASS_0;
}
- else if (gbps < 10.f)
+ else if (gbps <= 8.f)
{
mGPUClass = GPU_CLASS_1;
}
- else if (gbps < 20.f)
+ else if (gbps <= 16.f)
{
mGPUClass = GPU_CLASS_2;
}
- else if (gbps < 40.f)
+ else if (gbps <= 40.f)
{
mGPUClass = GPU_CLASS_3;
}
- else if (gbps < 80.f)
+ else if (gbps <= 80.f)
{
mGPUClass = GPU_CLASS_4;
}
@@ -478,195 +484,15 @@ bool LLFeatureManager::loadGPUClass()
{
mGPUClass = GPU_CLASS_5;
}
-
+
// defaults
mGPUString = gGLManager.getRawGLString();
mGPUSupported = TRUE;
-#if 0
- // first table is in the app dir
- std::string app_path = gDirUtilp->getAppRODataDir();
- app_path += gDirUtilp->getDirDelimiter();
- app_path += GPU_TABLE_FILENAME;
-
- // second table is downloaded with HTTP
- std::string http_filename = llformat(GPU_TABLE_VER_FILENAME, LLVersionInfo::getVersion().c_str());
- std::string http_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, http_filename);
-
- // use HTTP table if it exists
- std::string path;
- bool parse_ok = false;
- if (gDirUtilp->fileExists(http_path))
- {
- parse_ok = parseGPUTable(http_path);
- if (!parse_ok)
- {
- // the HTTP table failed to parse, so delete it
- LLFile::remove(http_path);
- LL_WARNS("RenderInit") << "Removed invalid gpu table '" << http_path << "'" << LL_ENDL;
- }
- }
-
- if (!parse_ok)
- {
- parse_ok = parseGPUTable(app_path);
- }
-#endif
- return true; // indicates that the file parsed correctly, not that the gpu was recognized
+ return true; // indicates that a gpu value was established
}
-bool LLFeatureManager::parseGPUTable(std::string filename)
-{
- llifstream file;
-
- LL_INFOS("RenderInit") << "Attempting to parse GPU table from " << filename << LL_ENDL;
- file.open(filename);
-
- if (file)
- {
- const char recognizer[] = "//GPU_TABLE";
- char first_line[MAX_STRING];
- file.getline(first_line, MAX_STRING);
- if (0 != strncmp(first_line, recognizer, strlen(recognizer)))
- {
- LL_WARNS("RenderInit") << "Invalid GPU table: " << filename << "!" << LL_ENDL;
- return false;
- }
- }
- else
- {
- LL_WARNS("RenderInit") << "Unable to open GPU table: " << filename << "!" << LL_ENDL;
- return false;
- }
-
- std::string rawRenderer = gGLManager.getRawGLString();
- std::string renderer = rawRenderer;
- for (std::string::iterator i = renderer.begin(); i != renderer.end(); ++i)
- {
- *i = tolower(*i);
- }
-
-#if LL_EXPORT_GPU_TABLE
- llofstream json;
- json.open("gpu_table.json");
-
- json << "var gpu_table = [" << std::endl;
-#endif
-
- bool gpuFound;
- U32 lineNumber;
- for (gpuFound = false, lineNumber = 0; !gpuFound && !file.eof(); lineNumber++)
- {
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
- buffer[0] = 0;
-
- file.getline(buffer, MAX_STRING);
-
- if (strlen(buffer) >= 2 && /*Flawfinder: ignore*/
- buffer[0] == '/' &&
- buffer[1] == '/')
- {
- // This is a comment.
- continue;
- }
-
- if (strlen(buffer) == 0) /*Flawfinder: ignore*/
- {
- // This is a blank line
- continue;
- }
-
- // setup the tokenizer
- std::string buf(buffer);
- std::string cls, label, expr, supported, stats_based, expected_gl_version;
- boost_tokenizer tokens(buf, boost::char_separator<char>("\t\n"));
- boost_tokenizer::iterator token_iter = tokens.begin();
-
- // grab the label, pseudo regular expression, and class
- if(token_iter != tokens.end())
- {
- label = *token_iter++;
- }
- if(token_iter != tokens.end())
- {
- expr = *token_iter++;
- }
- if(token_iter != tokens.end())
- {
- cls = *token_iter++;
- }
- if(token_iter != tokens.end())
- {
- supported = *token_iter++;
- }
- if (token_iter != tokens.end())
- {
- stats_based = *token_iter++;
- }
- if (token_iter != tokens.end())
- {
- expected_gl_version = *token_iter++;
- }
-
- if (label.empty() || expr.empty() || cls.empty() || supported.empty())
- {
- LL_WARNS("RenderInit") << "invald gpu_table.txt:" << lineNumber << ": '" << buffer << "'" << LL_ENDL;
- continue;
- }
-#if LL_EXPORT_GPU_TABLE
- json << "{'label' : '" << label << "',\n" <<
- "'regexp' : '" << expr << "',\n" <<
- "'class' : '" << cls << "',\n" <<
- "'supported' : '" << supported << "',\n" <<
- "'stats_based' : " << stats_based << ",\n" <<
- "'gl_version' : " << expected_gl_version << "\n},\n";
-#endif
-
- for (U32 i = 0; i < expr.length(); i++) /*Flawfinder: ignore*/
- {
- expr[i] = tolower(expr[i]);
- }
-
- // run the regular expression against the renderer
- boost::regex re(expr.c_str());
- if(boost::regex_search(renderer, re))
- {
- // if we found it, stop!
-#if !LL_EXPORT_GPU_TABLE
- gpuFound = true;
-#endif
- mGPUString = label;
- mGPUClass = (EGPUClass) strtol(cls.c_str(), NULL, 10);
- mGPUSupported = (BOOL) strtol(supported.c_str(), NULL, 10);
- sscanf(expected_gl_version.c_str(), "%f", &mExpectedGLVersion);
- }
- }
-#if LL_EXPORT_GPU_TABLE
- json << "];\n\n";
- json.close();
-#endif
- file.close();
-
- if ( gpuFound )
- {
- LL_INFOS("RenderInit") << "GPU '" << rawRenderer << "' recognized as '" << mGPUString << "'" << LL_ENDL;
- if (!mGPUSupported)
- {
- LL_INFOS("RenderInit") << "GPU '" << mGPUString << "' is not supported." << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("RenderInit") << "GPU '" << rawRenderer << "' not recognized" << LL_ENDL;
- }
-
-#if LL_DARWIN // never go over "Mid" settings by default on OS X
- mGPUClass = llmin(mGPUClass, GPU_CLASS_2);
-#endif
- return true;
-}
-
// responder saves table into file
class LLHTTPFeatureTableResponder : public LLHTTPClient::Responder
{
@@ -747,26 +573,11 @@ void fetch_feature_table(std::string table)
LLHTTPClient::get(url, new LLHTTPFeatureTableResponder(path));
}
-void fetch_gpu_table(std::string table)
-{
- const std::string base = gSavedSettings.getString("FeatureManagerHTTPTable");
-
- const std::string filename = llformat(table.c_str(), LLVersionInfo::getVersion().c_str());
-
- const std::string url = base + "/" + filename;
-
- const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
-
- LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL;
-
- LLHTTPClient::get(url, new LLHTTPFeatureTableResponder(path));
-}
// fetch table(s) from a website (S3)
void LLFeatureManager::fetchHTTPTables()
{
fetch_feature_table(FEATURE_TABLE_VER_FILENAME);
- fetch_gpu_table(GPU_TABLE_VER_FILENAME);
}
diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h
index 95141b241d..69078ccc21 100755
--- a/indra/newview/llfeaturemanager.h
+++ b/indra/newview/llfeaturemanager.h
@@ -162,9 +162,6 @@ protected:
bool parseFeatureTable(std::string filename);
///< @returns TRUE is file parsed correctly, FALSE if not
- bool parseGPUTable(std::string filename);
- ///< @returns true if file parsed correctly, false if not - does not reflect whether or not the gpu was recognized
-
void initBaseMask();
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 5debf71744..ef50594feb 100755
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -600,6 +600,9 @@ std::vector<std::string>* LLFilePicker::navOpenFilterProc(ELoadFilter filter) //
allowedv->push_back("slg");
break;
#endif
+ case FFLOAD_XML:
+ allowedv->push_back("xml");
+ break;
case FFLOAD_RAW:
allowedv->push_back("raw");
break;
@@ -702,7 +705,14 @@ bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filena
creator = "\?\?\?\?";
extension = "slg";
break;
-#endif
+#endif
+
+ case FFSAVE_XML:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "xml";
+ break;
+
case FFSAVE_RAW:
type = "\?\?\?\?";
creator = "\?\?\?\?";
@@ -1100,6 +1110,12 @@ static std::string add_anim_filter_to_gtkchooser(GtkWindow *picker)
return filtername;
}
+static std::string add_xml_filter_to_gtkchooser(GtkWindow *picker)
+{
+ return add_simple_pattern_filter_to_gtkchooser(picker, "*.xml",
+ LLTrans::getString("xml_files") + " (*.xml)");
+}
+
static std::string add_collada_filter_to_gtkchooser(GtkWindow *picker)
{
return add_simple_pattern_filter_to_gtkchooser(picker, "*.dae",
@@ -1293,6 +1309,9 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
case FFLOAD_ANIM:
filtername = add_anim_filter_to_gtkchooser(picker);
break;
+ case FFLOAD_XML:
+ filtername = add_xml_filter_to_gtkchooser(picker);
+ break;
case FFLOAD_COLLADA:
filtername = add_collada_filter_to_gtkchooser(picker);
break;
diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index b64034b945..b6e61f83b1 100755
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -308,7 +308,7 @@ void LLVolumeImplFlexible::updateRenderRes()
mRenderRes = (S32) (12.f*app_angle);
#else //legacy behavior
//number of segments only cares about z axis
- F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
+ F32 app_angle = ll_round((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
// Rendering sections increases with visible angle on the screen
mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView());
diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp
index b715896264..b75660ea00 100644
--- a/indra/newview/llflickrconnect.cpp
+++ b/indra/newview/llflickrconnect.cpp
@@ -400,7 +400,7 @@ void LLFlickrConnect::uploadPhoto(LLPointer<LLImageFormatted> image, const std::
}
else
{
- llwarns << "Image to upload is not a PNG or JPEG" << llendl;
+ LL_WARNS() << "Image to upload is not a PNG or JPEG" << LL_ENDL;
return;
}
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 8d4868d0d3..0a0e5ffc06 100755
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -389,9 +389,9 @@ void LLFloaterBuyLandUI::updateParcelInfo()
}
mParcelBillableArea =
- llround(mRegion->getBillableFactor() * mParcelActualArea);
+ ll_round(mRegion->getBillableFactor() * mParcelActualArea);
- mParcelSupportedObjects = llround(
+ mParcelSupportedObjects = ll_round(
parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
// Can't have more than region max tasks, regardless of parcel
// object bonus factor.
diff --git a/indra/newview/llfloatergroupbulkban.cpp b/indra/newview/llfloatergroupbulkban.cpp
index 54a2283b13..44074047a7 100644
--- a/indra/newview/llfloatergroupbulkban.cpp
+++ b/indra/newview/llfloatergroupbulkban.cpp
@@ -101,7 +101,7 @@ void LLFloaterGroupBulkBan::showForGroup(const LLUUID& group_id, uuid_vec_t* age
// Make sure group_id isn't null
if (group_id.isNull())
{
- llwarns << "LLFloaterGroupInvite::showForGroup with null group_id!" << llendl;
+ LL_WARNS() << "LLFloaterGroupInvite::showForGroup with null group_id!" << LL_ENDL;
return;
}
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 7621c35ed2..8c4feff1d9 100755
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -1224,7 +1224,7 @@ void LLPanelLandObjects::refresh()
{
S32 sw_max = parcel->getSimWideMaxPrimCapacity();
S32 sw_total = parcel->getSimWidePrimCount();
- S32 max = llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
+ S32 max = ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
S32 total = parcel->getPrimCount();
S32 owned = parcel->getOwnerPrimCount();
S32 group = parcel->getGroupPrimCount();
@@ -2049,9 +2049,9 @@ void LLPanelLandOptions::refresh()
else
{
mLocationText->setTextArg("[LANDING]",llformat("%d, %d, %d (%d\xC2\xB0)",
- llround(pos.mV[VX]),
- llround(pos.mV[VY]),
- llround(pos.mV[VZ]),
+ ll_round(pos.mV[VX]),
+ ll_round(pos.mV[VY]),
+ ll_round(pos.mV[VZ]),
user_look_at_angle));
}
diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp
index cf03087afb..f34760a6bf 100755
--- a/indra/newview/llfloaterlandholdings.cpp
+++ b/indra/newview/llfloaterlandholdings.cpp
@@ -208,8 +208,8 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**)
self->mActualArea += actual_area;
self->mBillableArea += billable_area;
- S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
- S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
+ S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS;
std::string location;
location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y);
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index bf5210206f..333ff863e5 100755
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -153,8 +153,8 @@ void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
radius -= 8.f;
text_box->setOrigin(
- llround(map_half_width - text_half_width + radius * cos( rotation )),
- llround(map_half_height - text_half_height + radius * sin( rotation )) );
+ ll_round(map_half_width - text_half_width + radius * cos( rotation )),
+ ll_round(map_half_height - text_half_height + radius * sin( rotation )) );
}
void LLFloaterMap::updateMinorDirections()
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index 69c9d94dfa..87f927ff65 100755
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -224,7 +224,7 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListItemData(const LLPa
columns[2]["column"] = "owner";
columns[2]["value"] = getOwnerName(pCharacterPtr);
- S32 cpuTime = llround(pCharacterPtr->getCPUTime());
+ S32 cpuTime = ll_round(pCharacterPtr->getCPUTime());
std::string cpuTimeString = llformat("%d", cpuTime);
LLStringUtil::format_map_t string_args;
string_args["[CPU_TIME]"] = cpuTimeString;
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index d72ee073e1..f6ff83eaf4 100755
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -406,7 +406,7 @@ void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjec
if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
{
- mMissingNameObjectsScrollListItems.insert(std::make_pair<std::string, LLScrollListItem *>(pObjectPtr->getUUID().asString(), scrollListItem));
+ mMissingNameObjectsScrollListItems.insert(scroll_list_item_map::value_type(pObjectPtr->getUUID().asString(), scrollListItem));
pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
}
}
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 1596861417..2047171e25 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -287,8 +287,8 @@ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator)
{
if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f)
{
- numerator = llround(decimal_val * test_denominator);
- denominator = llround(test_denominator);
+ numerator = ll_round(decimal_val * test_denominator);
+ denominator = ll_round(test_denominator);
break;
}
}
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 8677028942..971da74158 100755
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -911,11 +911,11 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3
//change another value proportionally
if(isWidthChanged)
{
- height = llround(width / aspect_ratio) ;
+ height = ll_round(width / aspect_ratio) ;
}
else
{
- width = llround(height * aspect_ratio) ;
+ width = ll_round(height * aspect_ratio) ;
}
//bound w/h by the max_value
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index ff66bdedb0..cc4753577d 100755
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -659,9 +659,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
std::string full_name = llformat("%s (%d, %d, %d)",
sim_name.c_str(),
- llround(region_x),
- llround(region_y),
- llround((F32)pos_global.mdV[VZ]));
+ ll_round(region_x),
+ ll_round(region_y),
+ ll_round((F32)pos_global.mdV[VZ]));
std::string tooltip("");
mTrackedStatus = LLTracker::TRACKING_LOCATION;
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 4b8ac2b3cf..c80dec0e75 100755
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -80,10 +80,10 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
S32 top = llmax(y, mDragStartY);
S32 bottom =llmin(y, mDragStartY);
- left = llround((F32) left * LLUI::getScaleFactor().mV[VX]);
- right = llround((F32) right * LLUI::getScaleFactor().mV[VX]);
- top = llround((F32) top * LLUI::getScaleFactor().mV[VY]);
- bottom = llround((F32) bottom * LLUI::getScaleFactor().mV[VY]);
+ left = ll_round((F32) left * LLUI::getScaleFactor().mV[VX]);
+ right = ll_round((F32) right * LLUI::getScaleFactor().mV[VX]);
+ top = ll_round((F32) top * LLUI::getScaleFactor().mV[VY]);
+ bottom = ll_round((F32) bottom * LLUI::getScaleFactor().mV[VY]);
F32 old_far_plane = LLViewerCamera::getInstance()->getFar();
F32 old_near_plane = LLViewerCamera::getInstance()->getNear();
@@ -881,13 +881,14 @@ void LLViewerObjectList::renderObjectBeacons()
F32 gpu_benchmark()
{
- if (!gGLManager.mHasShaderObjects)
- { //don't bother benchmarking the fixed function
+ if (!gGLManager.mHasShaderObjects || !gGLManager.mHasTimerQuery)
+ { // don't bother benchmarking the fixed function
+ // or venerable drivers which don't support accurate timing anyway
+ // and are likely to be correctly identified by the GPU table already.
return -1.f;
}
-
- if (gBenchmarkProgram.mProgramObject == 0)
+ if (gBenchmarkProgram.mProgramObject == 0)
{
LLViewerShaderMgr::instance()->initAttribsAndUniforms();
@@ -920,7 +921,10 @@ F32 gpu_benchmark()
//number of samples to take
const S32 samples = 64;
- LLGLSLShader::initProfile();
+ if (gGLManager.mHasTimerQuery)
+ {
+ LLGLSLShader::initProfile();
+ }
LLRenderTarget dest[count];
U32 source[count];
@@ -964,16 +968,16 @@ F32 gpu_benchmark()
v[0].set(-1,1,0);
v[1].set(-1,-3,0);
v[2].set(3,1,0);
+
buff->flush();
gBenchmarkProgram.bind();
- buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
-
- //wait for any previoius GL commands to finish
- glFinish();
bool busted_finish = false;
+ buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ glFinish();
+
for (S32 c = -1; c < samples; ++c)
{
LLTimer timer;
@@ -1013,6 +1017,7 @@ F32 gpu_benchmark()
if (!gGLManager.mHasTimerQuery && !busted_finish && gbps > 128.f)
{ //unrealistically high bandwidth for a card without timer queries, glFinish is probably ignored
busted_finish = true;
+ LL_WARNS() << "GPU Benchmark detected GL driver with broken glFinish implementation." << LL_ENDL;
}
else
{
@@ -1023,10 +1028,12 @@ F32 gpu_benchmark()
gBenchmarkProgram.unbind();
- LLGLSLShader::finishProfile(false);
-
- LLImageGL::deleteTextures(count, source);
+ if (gGLManager.mHasTimerQuery)
+ {
+ LLGLSLShader::finishProfile(false);
+ }
+ LLImageGL::deleteTextures(count, source);
std::sort(results.begin(), results.end());
@@ -1037,27 +1044,20 @@ F32 gpu_benchmark()
#if LL_DARWIN
if (gbps > 512.f)
{
- LL_INFOS() << "Memory bandwidth is improbably high and likely incorrect." << LL_ENDL;
+ LL_WARNS() << "Memory bandwidth is improbably high and likely incorrect; discarding result." << LL_ENDL;
//OSX is probably lying, discard result
gbps = -1.f;
}
#endif
- if (gGLManager.mHasTimerQuery)
- {
- F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
- F32 seconds = ms/1000.f;
+ F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
+ F32 seconds = ms/1000.f;
- F64 samples_drawn = res*res*count*samples;
- F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
- gbps = samples_sec*8;
+ F64 samples_drawn = res*res*count*samples;
+ F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
+ gbps = samples_sec*8;
- LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "ARB_timer_query unavailable." << LL_ENDL;
- }
+ LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
return gbps;
}
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 73711196e6..c7d108b6de 100755
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -310,7 +310,7 @@ void LLHUDNameTag::renderText(BOOL for_select)
{
LLUIImagePtr rect_top_image = LLUI::getUIImage("Rounded_Rect_Top");
LLRect label_top_rect = screen_rect;
- const S32 label_height = llround((mFontp->getLineHeight() * (F32)mLabelSegments.size() + (VERTICAL_PADDING / 3.f)));
+ const S32 label_height = ll_round((mFontp->getLineHeight() * (F32)mLabelSegments.size() + (VERTICAL_PADDING / 3.f)));
label_top_rect.mBottom = label_top_rect.mTop - label_height;
LLColor4 label_top_color = text_color;
label_top_color.mV[VALPHA] = gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor;
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index f893daaeb2..9c00243f44 100755
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -74,9 +74,9 @@ public:
if (!landmark->getGlobalPos(landmark_global_pos))
return false;
//we have to round off each coordinates to compare positions properly
- return llround(mPos.mdV[VX]) == llround(landmark_global_pos.mdV[VX])
- && llround(mPos.mdV[VY]) == llround(landmark_global_pos.mdV[VY])
- && llround(mPos.mdV[VZ]) == llround(landmark_global_pos.mdV[VZ]);
+ return ll_round(mPos.mdV[VX]) == ll_round(landmark_global_pos.mdV[VX])
+ && ll_round(mPos.mdV[VY]) == ll_round(landmark_global_pos.mdV[VY])
+ && ll_round(mPos.mdV[VZ]) == ll_round(landmark_global_pos.mdV[VZ]);
}
};
@@ -320,7 +320,7 @@ void LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(const LLVector3d& gl
{
LLVector3 pos = sim_infop->getLocalPos(global_pos);
std::string name = sim_infop->getName() ;
- cb(name, llround(pos.mV[VX]), llround(pos.mV[VY]),llround(pos.mV[VZ]));
+ cb(name, ll_round(pos.mV[VX]), ll_round(pos.mV[VY]),ll_round(pos.mV[VZ]));
}
else
{
@@ -364,7 +364,7 @@ void LLLandmarkActions::onRegionResponseNameAndCoords(region_name_and_coords_cal
{
LLVector3 local_pos = sim_infop->getLocalPos(global_pos);
std::string name = sim_infop->getName() ;
- cb(name, llround(local_pos.mV[VX]), llround(local_pos.mV[VY]), llround(local_pos.mV[VZ]));
+ cb(name, ll_round(local_pos.mV[VX]), ll_round(local_pos.mV[VY]), ll_round(local_pos.mV[VZ]));
}
}
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 06e517a861..cadbc16f1e 100755
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -1022,7 +1022,7 @@ void LLLoadHistoryThread::run()
{
loadHistory(mFileName, mMessages, mLoadParams);
int count = mMessages->size();
- llinfos << "mMessages->size(): " << count << llendl;
+ LL_INFOS() << "mMessages->size(): " << count << LL_ENDL;
setFinished();
}
}
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 0935691ebc..8567180dd6 100755
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -521,8 +521,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
std::string val_string;
std::string fraction_string;
- F32 val_to_print = llround(value, 0.001f);
- S32 fractional_portion = llround(fmodf(llabs(val_to_print), 1.f) * 100.f);
+ F32 val_to_print = ll_round(value, 0.001f);
+ S32 fractional_portion = ll_round(fmodf(llabs(val_to_print), 1.f) * 100.f);
if (val_to_print < 0.f)
{
if (fractional_portion == 0)
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 7861573908..f172aa0955 100755
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -368,9 +368,9 @@ void LLManipRotate::render()
LLQuaternion object_rot = first_object->getRotationEdit();
object_rot.getEulerAngles(&(euler_angles.mV[VX]), &(euler_angles.mV[VY]), &(euler_angles.mV[VZ]));
euler_angles *= RAD_TO_DEG;
- euler_angles.mV[VX] = llround(fmodf(euler_angles.mV[VX] + 360.f, 360.f), 0.05f);
- euler_angles.mV[VY] = llround(fmodf(euler_angles.mV[VY] + 360.f, 360.f), 0.05f);
- euler_angles.mV[VZ] = llround(fmodf(euler_angles.mV[VZ] + 360.f, 360.f), 0.05f);
+ euler_angles.mV[VX] = ll_round(fmodf(euler_angles.mV[VX] + 360.f, 360.f), 0.05f);
+ euler_angles.mV[VY] = ll_round(fmodf(euler_angles.mV[VY] + 360.f, 360.f), 0.05f);
+ euler_angles.mV[VZ] = ll_round(fmodf(euler_angles.mV[VZ] + 360.f, 360.f), 0.05f);
renderXYZ(euler_angles);
}
@@ -1240,10 +1240,10 @@ LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y )
F32 dist_from_sphere_center = sqrt(delta_x * delta_x + delta_y * delta_y);
LLVector3 axis = mMouseDown % mMouseCur;
+ F32 angle = atan2(sqrtf(axis * axis), mMouseDown * mMouseCur);
axis.normVec();
- F32 angle = acos(mMouseDown * mMouseCur);
LLQuaternion sphere_rot( angle, axis );
-
+
if (is_approx_zero(1.f - mMouseDown * mMouseCur))
{
return LLQuaternion::DEFAULT;
@@ -1524,7 +1524,6 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f);
F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT);
- //fmodf(llround(mouse_angle * RAD_TO_DEG, 7.5f) + 360.f, 360.f);
LLVector3 object_axis;
getObjectAxisClosestToMouse(object_axis);
@@ -1608,7 +1607,6 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f);
F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT);
- //fmodf(llround(mouse_angle * RAD_TO_DEG, 7.5f) + 360.f, 360.f);
LLVector3 object_axis;
getObjectAxisClosestToMouse(object_axis);
@@ -1638,9 +1636,9 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
mInSnapRegime = FALSE;
}
- angle = acos(mMouseCur * mMouseDown);
-
- F32 dir = (mMouseDown % mMouseCur) * constraint_axis; // cross product
+ LLVector3 cross_product = mMouseDown % mMouseCur;
+ angle = atan2(sqrtf(cross_product * cross_product), mMouseCur * mMouseDown);
+ F32 dir = cross_product * constraint_axis; // cross product
if( dir < 0.f )
{
angle *= -1.f;
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 84bec74a16..ed833cba53 100755
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -1552,8 +1552,8 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
mScaleSnapUnit1 = mScaleSnapUnit1 / (mSnapDir1 * mScaleDir);
mScaleSnapUnit2 = mScaleSnapUnit2 / (mSnapDir2 * mScaleDir);
- mTickPixelSpacing1 = llround((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir1).length());
- mTickPixelSpacing2 = llround((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir2).length());
+ mTickPixelSpacing1 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir1).length());
+ mTickPixelSpacing2 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir2).length());
if (uniform)
{
@@ -1624,8 +1624,8 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
F32 grid_offset2 = fmodf(dist_grid_axis, smallest_subdivision2);
// how many smallest grid units are we away from largest grid scale?
- S32 sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1);
- S32 sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2);
+ S32 sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1);
+ S32 sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2);
S32 num_ticks_per_side1 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision1));
S32 num_ticks_per_side2 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision2));
@@ -1679,7 +1679,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis()));
screen_translate_axis.normalize();
- S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing);
+ S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing);
for (pass = 0; pass < 3; pass++)
{
@@ -1759,8 +1759,8 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
stop_tick = llmin(max_ticks1, num_ticks_per_side1);
F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
- S32 label_sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1);
- S32 label_sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2);
+ S32 label_sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1);
+ S32 label_sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2);
for (S32 i = start_tick; i <= stop_tick; i++)
{
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index cd41183601..394db71fb9 100755
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1245,7 +1245,7 @@ void LLManipTranslate::renderSnapGuides()
// find distance to nearest smallest grid unit
F32 offset_nearest_grid_unit = fmodf(dist_grid_axis, smallest_grid_unit_scale);
// how many smallest grid units are we away from largest grid scale?
- S32 sub_div_offset = llround(fmodf(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale);
+ S32 sub_div_offset = ll_round(fmodf(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale);
S32 num_ticks_per_side = llmax(1, llfloor(0.5f * guide_size_meters / smallest_grid_unit_scale));
LLGLDepthTest gls_depth(GL_FALSE);
@@ -1360,12 +1360,12 @@ void LLManipTranslate::renderSnapGuides()
}
}
- sub_div_offset = llround(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale);
+ sub_div_offset = ll_round(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale);
LLVector2 screen_translate_axis(llabs(translate_axis * LLViewerCamera::getInstance()->getLeftAxis()), llabs(translate_axis * LLViewerCamera::getInstance()->getUpAxis()));
screen_translate_axis.normVec();
- S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing);
+ S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing);
// render tickmark values
for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++)
@@ -1403,7 +1403,7 @@ void LLManipTranslate::renderSnapGuides()
F32 offset_val = 0.5f * tick_offset.mV[ARROW_TO_AXIS[mManipPart]] / getMinGridScale();
EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
F32 text_highlight = 0.8f;
- if(i - llround(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime)
+ if(i - ll_round(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime)
{
text_highlight = 1.f;
}
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index f4e08dc790..b96bdd73ff 100755
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -120,8 +120,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
if(!getDecoupleTextureSize())
{
- S32 screen_width = llround((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]);
- S32 screen_height = llround((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]);
+ S32 screen_width = ll_round((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]);
+ S32 screen_height = ll_round((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]);
setTextureSize(screen_width, screen_height);
}
@@ -474,8 +474,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent )
{
if(!getDecoupleTextureSize())
{
- S32 screen_width = llround((F32)width * LLUI::getScaleFactor().mV[VX]);
- S32 screen_height = llround((F32)height * LLUI::getScaleFactor().mV[VY]);
+ S32 screen_width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]);
+ S32 screen_height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]);
// when floater is minimized, these sizes are negative
if ( screen_height > 0 && screen_width > 0 )
@@ -789,13 +789,13 @@ void LLMediaCtrl::draw()
{
// max width, adjusted height
width = r.getWidth();
- height = llmin(llmax(llround(width / media_aspect), 0), r.getHeight());
+ height = llmin(llmax(ll_round(width / media_aspect), 0), r.getHeight());
}
else
{
// max height, adjusted width
height = r.getHeight();
- width = llmin(llmax(llround(height * media_aspect), 0), r.getWidth());
+ width = llmin(llmax(ll_round(height * media_aspect), 0), r.getWidth());
}
}
else
@@ -879,14 +879,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
}
- x = llround((F32)x * LLUI::getScaleFactor().mV[VX]);
+ x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]);
if ( ! coords_opengl )
{
- y = llround((F32)(y) * LLUI::getScaleFactor().mV[VY]);
+ y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]);
}
else
{
- y = llround((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]);
+ y = ll_round((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]);
};
}
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 5abc9dbbe2..d7e7f13e87 100755
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -209,7 +209,7 @@ void LLNetMap::draw()
}
// figure out where agent is
- S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters());
+ S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters());
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -380,8 +380,8 @@ void LLNetMap::draw()
(pos_map.mV[VX] >= getRect().getWidth()) ||
(pos_map.mV[VY] >= getRect().getHeight()) )
{
- S32 x = llround( pos_map.mV[VX] );
- S32 y = llround( pos_map.mV[VY] );
+ S32 x = ll_round( pos_map.mV[VX] );
+ S32 y = ll_round( pos_map.mV[VY] );
LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10);
} else
{
@@ -421,12 +421,12 @@ void LLNetMap::draw()
// Draw dot for self avatar position
LLVector3d pos_global = gAgent.getPositionGlobal();
pos_map = globalPosToView(pos_global);
- S32 dot_width = llround(mDotRadius * 2.f);
+ S32 dot_width = ll_round(mDotRadius * 2.f);
LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
if (you)
{
- you->draw(llround(pos_map.mV[VX] - mDotRadius),
- llround(pos_map.mV[VY] - mDotRadius),
+ you->draw(ll_round(pos_map.mV[VX] - mDotRadius),
+ ll_round(pos_map.mV[VY] - mDotRadius),
dot_width,
dot_width);
@@ -530,8 +530,8 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
{
if (draw_arrow)
{
- S32 x = llround( pos_local.mV[VX] );
- S32 y = llround( pos_local.mV[VY] );
+ S32 x = ll_round( pos_local.mV[VX] );
+ S32 y = ll_round( pos_local.mV[VY] );
LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 );
LLWorldMapView::drawTrackingArrow( getRect(), x, y, color );
}
@@ -547,8 +547,8 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
{
- x -= llround(getRect().getWidth() / 2 + mCurPan.mV[VX]);
- y -= llround(getRect().getHeight() / 2 + mCurPan.mV[VY]);
+ x -= ll_round(getRect().getWidth() / 2 + mCurPan.mV[VX]);
+ y -= ll_round(getRect().getHeight() / 2 + mCurPan.mV[VY]);
LLVector3 pos_local( (F32)x, (F32)y, 0 );
@@ -684,7 +684,7 @@ void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &
LLVector3 local_pos;
local_pos.setVec( pos - mObjectImageCenterGlobal );
- S32 diameter_pixels = llround(2 * radius_meters * mObjectMapTPM);
+ S32 diameter_pixels = ll_round(2 * radius_meters * mObjectMapTPM);
renderPoint( local_pos, color, diameter_pixels );
}
@@ -700,8 +700,8 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
const S32 image_width = (S32)mObjectImagep->getWidth();
const S32 image_height = (S32)mObjectImagep->getHeight();
- S32 x_offset = llround(pos_local.mV[VX] * mObjectMapTPM + image_width / 2);
- S32 y_offset = llround(pos_local.mV[VY] * mObjectMapTPM + image_height / 2);
+ S32 x_offset = ll_round(pos_local.mV[VX] * mObjectMapTPM + image_width / 2);
+ S32 y_offset = ll_round(pos_local.mV[VY] * mObjectMapTPM + image_height / 2);
if ((x_offset < 0) || (x_offset >= image_width))
{
@@ -780,7 +780,7 @@ void LLNetMap::createObjectImage()
// ... which is, the diagonal of the rect.
F32 width = (F32)getRect().getWidth();
F32 height = (F32)getRect().getHeight();
- S32 square_size = llround( sqrt(width*width + height*height) );
+ S32 square_size = ll_round( sqrt(width*width + height*height) );
// Find the least power of two >= the minimum size.
const S32 MIN_SIZE = 64;
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 3cd39d7c7e..878f1af9ef 100755
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -462,9 +462,9 @@ std::string LLPanelClassifiedInfo::createLocationText(
if (!pos_global.isNull())
{
- S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
- S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
- S32 region_z = llround((F32)pos_global.mdV[VZ]);
+ S32 region_x = ll_round((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
+ S32 region_z = ll_round((F32)pos_global.mdV[VZ]);
location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
}
diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp
index 1eafc5bd64..76792cc6fd 100644
--- a/indra/newview/llpanelgroupbulk.cpp
+++ b/indra/newview/llpanelgroupbulk.cpp
@@ -387,7 +387,7 @@ void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids)
}
else
{
- llwarns << "llPanelGroupBulk: Selected avatar has no name: " << dest->getID() << llendl;
+ LL_WARNS() << "llPanelGroupBulk: Selected avatar has no name: " << dest->getID() << LL_ENDL;
names.push_back("(Unknown)");
}
}
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 236ad861a5..e662a05dfc 100755
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -492,7 +492,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
}
else
{
- llwarns << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << llendl;
+ LL_WARNS() << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << LL_ENDL;
names.push_back("(Unknown)");
}
}
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index 375c54479d..7f82eecdb0 100755
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -473,8 +473,8 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
land_type = LLTrans::getString("land_type_unknown");
}
- S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
- S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
+ S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS;
std::string location = sim_name + llformat(" (%d, %d)", region_x, region_y);
std::string area;
committed+=billable_area;
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 63ddc05037..a660cb3b21 100755
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -131,9 +131,9 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type)
if (name.empty())
{
- S32 region_x = llround(agent_pos.mV[VX]);
- S32 region_y = llround(agent_pos.mV[VY]);
- S32 region_z = llround(agent_pos.mV[VZ]);
+ S32 region_x = ll_round(agent_pos.mV[VX]);
+ S32 region_y = ll_round(agent_pos.mV[VY]);
+ S32 region_z = ll_round(agent_pos.mV[VZ]);
std::string region_name;
LLViewerRegion* region = parcel_mgr->getSelectionRegion();
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index a7c9dbdf7b..a5063de0f4 100755
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -246,7 +246,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
llofstream filtersFile(filterSaveName.str());
if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile))
{
- LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL;
+ LL_WARNS() << "Could not write to filters save file " << filterSaveName.str() << LL_ENDL;
}
else
filtersFile.close();
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 9123252f4c..ba23e7013d 100755
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -411,9 +411,9 @@ void LLPanelObject::getState( )
LLQuaternion object_rot = objectp->getRotationEdit();
object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ]));
mCurEulerDegrees *= RAD_TO_DEG;
- mCurEulerDegrees.mV[VX] = fmod(llround(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
- mCurEulerDegrees.mV[VY] = fmod(llround(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
- mCurEulerDegrees.mV[VZ] = fmod(llround(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
+ mCurEulerDegrees.mV[VX] = fmod(ll_round(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
+ mCurEulerDegrees.mV[VY] = fmod(ll_round(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
+ mCurEulerDegrees.mV[VZ] = fmod(ll_round(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
if (enable_rotate)
{
@@ -1567,9 +1567,9 @@ void LLPanelObject::sendRotation(BOOL btn_down)
if (mObject.isNull()) return;
LLVector3 new_rot(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get());
- new_rot.mV[VX] = llround(new_rot.mV[VX], OBJECT_ROTATION_PRECISION);
- new_rot.mV[VY] = llround(new_rot.mV[VY], OBJECT_ROTATION_PRECISION);
- new_rot.mV[VZ] = llround(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION);
+ new_rot.mV[VX] = ll_round(new_rot.mV[VX], OBJECT_ROTATION_PRECISION);
+ new_rot.mV[VY] = ll_round(new_rot.mV[VY], OBJECT_ROTATION_PRECISION);
+ new_rot.mV[VZ] = ll_round(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION);
// Note: must compare before conversion to radians
LLVector3 delta = new_rot - mCurEulerDegrees;
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 44cca21a76..8fa9aac024 100755
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -284,9 +284,9 @@ std::string LLPanelPickInfo::createLocationText(const std::string& owner_name, c
if (!pos_global.isNull())
{
- S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
- S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
- S32 region_z = llround((F32)pos_global.mdV[VZ]);
+ S32 region_x = ll_round((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
+ S32 region_z = ll_round((F32)pos_global.mdV[VZ]);
location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
}
return location_text;
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 4e7c5f6ed2..e62b5a4f1d 100755
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -231,15 +231,15 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
// If the region position is zero, grab position from the global
if(mPosRegion.isExactlyZero())
{
- region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
- region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
- region_z = llround(parcel_data.global_z);
+ region_x = ll_round(parcel_data.global_x) % REGION_WIDTH_UNITS;
+ region_y = ll_round(parcel_data.global_y) % REGION_WIDTH_UNITS;
+ region_z = ll_round(parcel_data.global_z);
}
else
{
- region_x = llround(mPosRegion.mV[VX]);
- region_y = llround(mPosRegion.mV[VY]);
- region_z = llround(mPosRegion.mV[VZ]);
+ region_x = ll_round(mPosRegion.mV[VX]);
+ region_y = ll_round(mPosRegion.mV[VY]);
+ region_z = ll_round(mPosRegion.mV[VZ]);
}
if (!parcel_data.name.empty())
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index ed91d277dd..e853b2d050 100755
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -551,7 +551,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
// Can't have more than region max tasks, regardless of parcel
// object bonus factor.
- S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
+ S32 primitives = llmin(ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
(S32)region->getMaxTasks());
const U8* available = (U8*)getString("available").c_str();
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 7c0e448a99..f42df221e4 100755
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -630,12 +630,12 @@ void LLPanelPrimMediaControls::updateShape()
// convert screenspace bbox to pixels (in screen coords)
LLRect window_rect = gViewerWindow->getWorldViewRectScaled();
LLCoordGL screen_min;
- screen_min.mX = llround((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
- screen_min.mY = llround((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
+ screen_min.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
+ screen_min.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
LLCoordGL screen_max;
- screen_max.mX = llround((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
- screen_max.mY = llround((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
+ screen_max.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
+ screen_max.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
// grow panel so that screenspace bounding box fits inside "media_region" element of panel
LLRect media_panel_rect;
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index 3a82233320..728fc69723 100755
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -323,9 +323,9 @@ LLSLURL::LLSLURL(const std::string& grid,
{
mGrid = grid;
mRegion = region;
- S32 x = llround( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
- S32 y = llround( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
- S32 z = llround( (F32)position[VZ] );
+ S32 x = ll_round( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
+ S32 y = ll_round( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
+ S32 z = ll_round( (F32)position[VZ] );
mType = LOCATION;
mPosition = LLVector3(x, y, z);
}
@@ -379,9 +379,9 @@ std::string LLSLURL::getSLURLString() const
case LOCATION:
{
// lookup the grid
- S32 x = llround( (F32)mPosition[VX] );
- S32 y = llround( (F32)mPosition[VY] );
- S32 z = llround( (F32)mPosition[VZ] );
+ S32 x = ll_round( (F32)mPosition[VX] );
+ S32 y = ll_round( (F32)mPosition[VY] );
+ S32 z = ll_round( (F32)mPosition[VZ] );
return LLGridManager::getInstance()->getSLURLBase(mGrid) +
LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z);
}
@@ -416,9 +416,9 @@ std::string LLSLURL::getLoginString() const
case LOCATION:
unescaped_start << "uri:"
<< mRegion << "&"
- << llround(mPosition[0]) << "&"
- << llround(mPosition[1]) << "&"
- << llround(mPosition[2]);
+ << ll_round(mPosition[0]) << "&"
+ << ll_round(mPosition[1]) << "&"
+ << ll_round(mPosition[2]);
break;
case HOME_LOCATION:
unescaped_start << "home";
@@ -462,9 +462,9 @@ std::string LLSLURL::getLocationString() const
{
return llformat("%s/%d/%d/%d",
mRegion.c_str(),
- (int)llround(mPosition[0]),
- (int)llround(mPosition[1]),
- (int)llround(mPosition[2]));
+ (int)ll_round(mPosition[0]),
+ (int)ll_round(mPosition[1]),
+ (int)ll_round(mPosition[2]));
}
// static
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 600ebf5914..ee5fd7cb71 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -177,14 +177,14 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail
if (image_aspect_ratio > window_aspect_ratio)
{
// trim off top and bottom
- S32 new_height = llround((F32)getRect().getWidth() / image_aspect_ratio);
+ S32 new_height = ll_round((F32)getRect().getWidth() / image_aspect_ratio);
rect.mBottom += (getRect().getHeight() - new_height) / 2;
rect.mTop -= (getRect().getHeight() - new_height) / 2;
}
else if (image_aspect_ratio < window_aspect_ratio)
{
// trim off left and right
- S32 new_width = llround((F32)getRect().getHeight() * image_aspect_ratio);
+ S32 new_width = ll_round((F32)getRect().getHeight() * image_aspect_ratio);
rect.mLeft += (getRect().getWidth() - new_width) / 2;
rect.mRight -= (getRect().getWidth() - new_width) / 2;
}
@@ -345,9 +345,9 @@ void LLSnapshotLivePreview::draw()
LLLocalClipRect clip(getLocalRect());
{
// draw diagonal stripe with gradient that passes over screen
- S32 x1 = gViewerWindow->getWindowWidthScaled() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f)));
- S32 x2 = x1 + llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
- S32 x3 = x2 + llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
+ S32 x1 = gViewerWindow->getWindowWidthScaled() * ll_round((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f)));
+ S32 x2 = x1 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
+ S32 x3 = x2 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
S32 y1 = 0;
S32 y2 = gViewerWindow->getWindowHeightScaled();
@@ -429,7 +429,7 @@ void LLSnapshotLivePreview::draw()
gGL.pushMatrix();
{
LLRect& rect = mImageRect[old_image_index];
- gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
+ gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - ll_round(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
gGL.begin(LLRender::QUADS);
{
@@ -483,13 +483,13 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize()
{
// image too wide, shrink to width
mThumbnailWidth = max_width;
- mThumbnailHeight = llround((F32)max_width / aspect_ratio);
+ mThumbnailHeight = ll_round((F32)max_width / aspect_ratio);
}
else
{
// image too tall, shrink to height
mThumbnailHeight = max_height;
- mThumbnailWidth = llround((F32)max_height * aspect_ratio);
+ mThumbnailWidth = ll_round((F32)max_height * aspect_ratio);
}
if (mThumbnailWidth > width || mThumbnailHeight > height)
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index e75af8db53..503dd6747d 100755
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -1232,10 +1232,10 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y,
S32 x_begin, y_begin, x_end, y_end;
- x_begin = llround(x * scale_inv);
- y_begin = llround(y * scale_inv);
- x_end = llround((x + width) * scale_inv);
- y_end = llround((y + width) * scale_inv);
+ x_begin = ll_round(x * scale_inv);
+ y_begin = ll_round(y * scale_inv);
+ x_end = ll_round((x + width) * scale_inv);
+ y_end = ll_round((y + width) * scale_inv);
if (x_end > tex_width)
{
@@ -1283,9 +1283,9 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y,
// Want non-linear curve for transparency gradient
coloru = MAX_WATER_COLOR;
const F32 frac = 1.f - 2.f/(2.f - (height - WATER_HEIGHT));
- S32 alpha = 64 + llround((255-64)*frac);
+ S32 alpha = 64 + ll_round((255-64)*frac);
- alpha = llmin(llround((F32)MAX_WATER_COLOR.mV[3]), alpha);
+ alpha = llmin(ll_round((F32)MAX_WATER_COLOR.mV[3]), alpha);
alpha = llmax(64, alpha);
coloru.mV[3] = alpha;
diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp
index 44c0cb3124..ff991dc9fd 100755
--- a/indra/newview/lltoolselectland.cpp
+++ b/indra/newview/lltoolselectland.cpp
@@ -219,8 +219,8 @@ void LLToolSelectLand::handleDeselect()
void LLToolSelectLand::roundXY(LLVector3d &vec)
{
- vec.mdV[VX] = llround( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
- vec.mdV[VY] = llround( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
+ vec.mdV[VX] = ll_round( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
+ vec.mdV[VY] = ll_round( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
}
diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp
index 7088558b83..e983bc883f 100644
--- a/indra/newview/lltwitterconnect.cpp
+++ b/indra/newview/lltwitterconnect.cpp
@@ -397,7 +397,7 @@ void LLTwitterConnect::uploadPhoto(LLPointer<LLImageFormatted> image, const std:
}
else
{
- llwarns << "Image to upload is not a PNG or JPEG" << llendl;
+ LL_WARNS() << "Image to upload is not a PNG or JPEG" << LL_ENDL;
return;
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 981e4c40aa..cd9b2ed11b 100755
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1176,8 +1176,8 @@ LLRect get_whole_screen_region()
if (zoom_factor > 1.f)
{
S32 num_horizontal_tiles = llceil(zoom_factor);
- S32 tile_width = llround((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor);
- S32 tile_height = llround((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor);
+ S32 tile_width = ll_round((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor);
+ S32 tile_height = ll_round((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor);
int tile_y = sub_region / num_horizontal_tiles;
int tile_x = sub_region - (tile_y * num_horizontal_tiles);
@@ -1471,8 +1471,8 @@ void render_ui_2d()
int pos_y = sub_region / llceil(zoom_factor);
int pos_x = sub_region - (pos_y*llceil(zoom_factor));
// offset for this tile
- LLFontGL::sCurOrigin.mX -= llround((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor);
- LLFontGL::sCurOrigin.mY -= llround((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor);
+ LLFontGL::sCurOrigin.mX -= ll_round((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor);
+ LLFontGL::sCurOrigin.mY -= ll_round((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor);
}
stop_glerror();
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index b6c27b0abc..0a9bc2a56c 100755
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -65,7 +65,7 @@ void agent_jump( EKeystate s )
{
if( KEYSTATE_UP == s ) return;
F32 time = gKeyboard->getCurKeyElapsedTime();
- S32 frame_count = llround(gKeyboard->getCurKeyElapsedFrameCount());
+ S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
if( time < FLY_TIME
|| frame_count <= FLY_FRAMES
@@ -125,7 +125,7 @@ static void agent_push_forwardbackward( EKeystate s, S32 direction, LLAgent::EDo
if (KEYSTATE_UP == s) return;
F32 time = gKeyboard->getCurKeyElapsedTime();
- S32 frame_count = llround(gKeyboard->getCurKeyElapsedFrameCount());
+ S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
{
@@ -176,7 +176,7 @@ static void agent_slide_leftright( EKeystate s, S32 direction, LLAgent::EDoubleT
agent_handle_doubletap_run(s, mode);
if( KEYSTATE_UP == s ) return;
F32 time = gKeyboard->getCurKeyElapsedTime();
- S32 frame_count = llround(gKeyboard->getCurKeyElapsedFrameCount());
+ S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
{
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 8499012cfc..a1451d770a 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -924,7 +924,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
{
F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
- pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension));
+ pimpl->setLowPrioritySizeLimit(ll_round(approximate_interest_dimension));
}
}
else
@@ -2330,8 +2330,8 @@ void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32
texture_y = 1.0 + texture_y;
// scale x and y to texel units.
- *x = llround(texture_x * mMediaSource->getTextureWidth());
- *y = llround((1.0f - texture_y) * mMediaSource->getTextureHeight());
+ *x = ll_round(texture_x * mMediaSource->getTextureWidth());
+ *y = ll_round((1.0f - texture_y) * mMediaSource->getTextureHeight());
// Adjust for the difference between the actual texture height and the amount of the texture in use.
*y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 7c94442f09..e85d8198aa 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -281,7 +281,7 @@ S32 LLViewerParcelMgr::getSelectedArea() const
F64 width = mEastNorth.mdV[VX] - mWestSouth.mdV[VX];
F64 height = mEastNorth.mdV[VY] - mWestSouth.mdV[VY];
F32 area = (F32)(width * height);
- rv = llround(area);
+ rv = ll_round(area);
}
return rv;
}
@@ -301,10 +301,10 @@ void LLViewerParcelMgr::writeHighlightSegments(F32 west, F32 south, F32 east,
F32 north)
{
S32 x, y;
- S32 min_x = llround( west / PARCEL_GRID_STEP_METERS );
- S32 max_x = llround( east / PARCEL_GRID_STEP_METERS );
- S32 min_y = llround( south / PARCEL_GRID_STEP_METERS );
- S32 max_y = llround( north / PARCEL_GRID_STEP_METERS );
+ S32 min_x = ll_round( west / PARCEL_GRID_STEP_METERS );
+ S32 max_x = ll_round( east / PARCEL_GRID_STEP_METERS );
+ S32 min_y = ll_round( south / PARCEL_GRID_STEP_METERS );
+ S32 max_y = ll_round( north / PARCEL_GRID_STEP_METERS );
const S32 STRIDE = mParcelsPerEdge+1;
@@ -416,12 +416,12 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_
LLVector3d northeast = pos_global;
southwest -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- southwest.mdV[VX] = llround( southwest.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
- southwest.mdV[VY] = llround( southwest.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
+ southwest.mdV[VX] = ll_round( southwest.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
+ southwest.mdV[VY] = ll_round( southwest.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
northeast += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- northeast.mdV[VX] = llround( northeast.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
- northeast.mdV[VY] = llround( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
+ northeast.mdV[VX] = ll_round( northeast.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
+ northeast.mdV[VY] = ll_round( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
// Snap to parcel
return selectLand( southwest, northeast, TRUE );
diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp
index 8b55f40baa..230bdca4ef 100755
--- a/indra/newview/llviewerpartsim.cpp
+++ b/indra/newview/llviewerpartsim.cpp
@@ -388,7 +388,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt)
}
// Do glow interpolation
- part->mGlow.mV[3] = (U8) llround(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f);
+ part->mGlow.mV[3] = (U8) ll_round(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f);
// Set the last update time to now.
part->mLastUpdateTime = cur_time;
diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp
index a7fd2e0fe4..7efa821bbf 100755
--- a/indra/newview/llviewerpartsource.cpp
+++ b/indra/newview/llviewerpartsource.cpp
@@ -313,7 +313,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
part->mStartGlow = mPartSysData.mPartData.mStartGlow;
part->mEndGlow = mPartSysData.mPartData.mEndGlow;
- part->mGlow = LLColor4U(0, 0, 0, (U8) llround(part->mStartGlow*255.f));
+ part->mGlow = LLColor4U(0, 0, 0, (U8) ll_round(part->mStartGlow*255.f));
if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_DROP)
{
diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp
index 2b364851a7..9af92d7377 100755
--- a/indra/newview/llviewertextureanim.cpp
+++ b/indra/newview/llviewertextureanim.cpp
@@ -179,7 +179,7 @@ S32 LLViewerTextureAnim::animateTextures(F32 &off_s, F32 &off_t,
if (!(mMode & SMOOTH))
{
- frame_counter = (F32)llround(frame_counter);
+ frame_counter = (F32)ll_round(frame_counter);
}
//
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 9dcd0b81e0..b63222590d 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -898,8 +898,8 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
const char* buttonstatestr = "";
S32 x = pos.mX;
S32 y = pos.mY;
- x = llround((F32)x / mDisplayScale.mV[VX]);
- y = llround((F32)y / mDisplayScale.mV[VY]);
+ x = ll_round((F32)x / mDisplayScale.mV[VX]);
+ y = ll_round((F32)y / mDisplayScale.mV[VY]);
// only send mouse clicks to UI if UI is visible
if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
@@ -1065,8 +1065,8 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
{
S32 x = pos.mX;
S32 y = pos.mY;
- x = llround((F32)x / mDisplayScale.mV[VX]);
- y = llround((F32)y / mDisplayScale.mV[VY]);
+ x = ll_round((F32)x / mDisplayScale.mV[VX]);
+ y = ll_round((F32)y / mDisplayScale.mV[VY]);
BOOL down = TRUE;
BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
@@ -1263,8 +1263,8 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask
S32 x = pos.mX;
S32 y = pos.mY;
- x = llround((F32)x / mDisplayScale.mV[VX]);
- y = llround((F32)y / mDisplayScale.mV[VY]);
+ x = ll_round((F32)x / mDisplayScale.mV[VX]);
+ y = ll_round((F32)y / mDisplayScale.mV[VY]);
mMouseInWindow = TRUE;
@@ -1722,7 +1722,7 @@ LLViewerWindow::LLViewerWindow(const Params& p)
LLCoordWindow size;
mWindow->getSize(&size);
mWindowRectRaw.set(0, size.mY, size.mX, 0);
- mWindowRectScaled.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0);
+ mWindowRectScaled.set(0, ll_round((F32)size.mY / mDisplayScale.mV[VY]), ll_round((F32)size.mX / mDisplayScale.mV[VX]), 0);
}
LLFontManager::initClass();
@@ -2250,8 +2250,8 @@ void LLViewerWindow::reshape(S32 width, S32 height)
LLUI::setScaleFactor(mDisplayScale);
// update our window rectangle
- mWindowRectScaled.mRight = mWindowRectScaled.mLeft + llround((F32)width / mDisplayScale.mV[VX]);
- mWindowRectScaled.mTop = mWindowRectScaled.mBottom + llround((F32)height / mDisplayScale.mV[VY]);
+ mWindowRectScaled.mRight = mWindowRectScaled.mLeft + ll_round((F32)width / mDisplayScale.mV[VX]);
+ mWindowRectScaled.mTop = mWindowRectScaled.mBottom + ll_round((F32)height / mDisplayScale.mV[VY]);
setup2DViewport();
@@ -2444,8 +2444,8 @@ void LLViewerWindow::draw()
microsecondsToTimecodeString(gFrameTime,text);
const LLFontGL* font = LLFontGL::getFontSansSerif();
font->renderUTF8(text, 0,
- llround((getWindowWidthScaled()/2)-100.f),
- llround((getWindowHeightScaled()-60.f)),
+ ll_round((getWindowWidthScaled()/2)-100.f),
+ ll_round((getWindowHeightScaled()-60.f)),
LLColor4( 1.f, 1.f, 1.f, 1.f ),
LLFontGL::LEFT, LLFontGL::TOP);
}
@@ -2521,7 +2521,7 @@ void LLViewerWindow::draw()
const S32 DIST_FROM_TOP = 20;
LLFontGL::getFontSansSerifBig()->renderUTF8(
mOverlayTitle, 0,
- llround( getWindowWidthScaled() * 0.5f),
+ ll_round( getWindowWidthScaled() * 0.5f),
getWindowHeightScaled() - DIST_FROM_TOP,
LLColor4(1, 1, 1, 0.4f),
LLFontGL::HCENTER, LLFontGL::TOP);
@@ -3373,7 +3373,7 @@ void LLViewerWindow::updateMouseDelta()
fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
- mCurrentMouseDelta.set(llround(fdx), llround(fdy));
+ mCurrentMouseDelta.set(ll_round(fdx), ll_round(fdy));
mouse_vel.setVec(fdx,fdy);
}
else
@@ -3488,10 +3488,10 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window)
new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1);
new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1);
- new_world_rect.mLeft = llround((F32)new_world_rect.mLeft * mDisplayScale.mV[VX]);
- new_world_rect.mRight = llround((F32)new_world_rect.mRight * mDisplayScale.mV[VX]);
- new_world_rect.mBottom = llround((F32)new_world_rect.mBottom * mDisplayScale.mV[VY]);
- new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
+ new_world_rect.mLeft = ll_round((F32)new_world_rect.mLeft * mDisplayScale.mV[VX]);
+ new_world_rect.mRight = ll_round((F32)new_world_rect.mRight * mDisplayScale.mV[VX]);
+ new_world_rect.mBottom = ll_round((F32)new_world_rect.mBottom * mDisplayScale.mV[VY]);
+ new_world_rect.mTop = ll_round((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
}
if (mWorldViewRectRaw != new_world_rect)
@@ -5140,10 +5140,10 @@ void LLViewerWindow::calcDisplayScale()
LLRect LLViewerWindow::calcScaledRect(const LLRect & rect, const LLVector2& display_scale)
{
LLRect res = rect;
- res.mLeft = llround((F32)res.mLeft / display_scale.mV[VX]);
- res.mRight = llround((F32)res.mRight / display_scale.mV[VX]);
- res.mBottom = llround((F32)res.mBottom / display_scale.mV[VY]);
- res.mTop = llround((F32)res.mTop / display_scale.mV[VY]);
+ res.mLeft = ll_round((F32)res.mLeft / display_scale.mV[VX]);
+ res.mRight = ll_round((F32)res.mRight / display_scale.mV[VX]);
+ res.mBottom = ll_round((F32)res.mBottom / display_scale.mV[VY]);
+ res.mTop = ll_round((F32)res.mTop / display_scale.mV[VY]);
return res;
}
@@ -5406,8 +5406,8 @@ void LLPickInfo::updateXYCoords()
LLPointer<LLViewerTexture> imagep = LLViewerTextureManager::getFetchedTexture(tep->getID());
if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull())
{
- mXYCoords.mX = llround(mUVCoords.mV[VX] * (F32)imagep->getWidth());
- mXYCoords.mY = llround((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight());
+ mXYCoords.mX = ll_round(mUVCoords.mV[VX] * (F32)imagep->getWidth());
+ mXYCoords.mY = ll_round((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight());
}
}
}
@@ -5436,7 +5436,7 @@ void LLPickInfo::getSurfaceInfo()
if (objectp)
{
- if (gViewerWindow->cursorIntersect(llround((F32)mMousePt.mX), llround((F32)mMousePt.mY), 1024.f,
+ if (gViewerWindow->cursorIntersect(ll_round((F32)mMousePt.mX), ll_round((F32)mMousePt.mY), 1024.f,
objectp, -1, mPickTransparent,
&mObjectFace,
&intersection,
@@ -5478,52 +5478,6 @@ void LLPickInfo::getSurfaceInfo()
}
}
-
-/* code to get UV via a special UV render - removed in lieu of raycast method
-LLVector2 LLPickInfo::pickUV()
-{
- LLVector2 result(-1.f, -1.f);
-
- LLViewerObject* objectp = getObject();
- if (!objectp)
- {
- return result;
- }
-
- if (mObjectFace > -1 &&
- objectp->mDrawable.notNull() && objectp->getPCode() == LL_PCODE_VOLUME &&
- mObjectFace < objectp->mDrawable->getNumFaces())
- {
- S32 scaled_x = llround((F32)mPickPt.mX * gViewerWindow->getDisplayScale().mV[VX]);
- S32 scaled_y = llround((F32)mPickPt.mY * gViewerWindow->getDisplayScale().mV[VY]);
- const S32 UV_PICK_WIDTH = 5;
- const S32 UV_PICK_HALF_WIDTH = (UV_PICK_WIDTH - 1) / 2;
- U8 uv_pick_buffer[UV_PICK_WIDTH * UV_PICK_WIDTH * 4];
- LLFace* facep = objectp->mDrawable->getFace(mObjectFace);
- if (facep)
- {
- LLGLState scissor_state(GL_SCISSOR_TEST);
- scissor_state.enable();
- LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH, FALSE);
- //glViewport(scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH);
- glScissor(scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH);
-
- glClear(GL_DEPTH_BUFFER_BIT);
-
- facep->renderSelectedUV();
-
- glReadPixels(scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH, GL_RGBA, GL_UNSIGNED_BYTE, uv_pick_buffer);
- U8* center_pixel = &uv_pick_buffer[4 * ((UV_PICK_WIDTH * UV_PICK_HALF_WIDTH) + UV_PICK_HALF_WIDTH + 1)];
-
- result.mV[VX] = (F32)((center_pixel[VGREEN] & 0xf) + (16.f * center_pixel[VRED])) / 4095.f;
- result.mV[VY] = (F32)((center_pixel[VGREEN] >> 4) + (16.f * center_pixel[VBLUE])) / 4095.f;
- }
- }
-
- return result;
-} */
-
-
//static
bool LLPickInfo::isFlora(LLViewerObject* object)
{
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 4e9400872a..c4430f4308 100755
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -123,10 +123,10 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y,
S32 x_begin, y_begin, x_end, y_end;
- x_begin = llround( x * mScaleInv );
- y_begin = llround( y * mScaleInv );
- x_end = llround( (x + width) * mScaleInv );
- y_end = llround( (y + width) * mScaleInv );
+ x_begin = ll_round( x * mScaleInv );
+ y_begin = ll_round( y * mScaleInv );
+ x_end = ll_round( (x + width) * mScaleInv );
+ y_end = ll_round( (y + width) * mScaleInv );
if (x_end > mWidth)
{
@@ -318,8 +318,8 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y,
S32 x_begin, y_begin, x_end, y_end;
x_begin = (S32)(x * mScaleInv);
y_begin = (S32)(y * mScaleInv);
- x_end = llround( (x + width) * mScaleInv );
- y_end = llround( (y + width) * mScaleInv );
+ x_end = ll_round( (x + width) * mScaleInv );
+ y_end = ll_round( (y + width) * mScaleInv );
if (x_end > mWidth)
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 9ba0c9a4b2..7bf90ef79e 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -453,7 +453,10 @@ public:
mCharacter = character;
BOOL success = true;
- if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) ) { success = false; }
+ if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) )
+ {
+ success = false;
+ }
if ( success )
{
@@ -808,14 +811,14 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c
//------------------------------------------------------------------------
LLVOAvatar::~LLVOAvatar()
{
- if (!mFullyLoaded)
- {
+ if (!mFullyLoaded)
+ {
debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud");
- }
- else
- {
+ }
+ else
+ {
debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding");
- }
+ }
logPendingPhases();
@@ -969,10 +972,11 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
iter != LLCharacter::sInstances.end(); ++iter)
{
LLVOAvatar* inst = (LLVOAvatar*) *iter;
- if (!inst)
- continue;
- S32 rez_status = inst->getRezzedStatus();
- counts[rez_status]++;
+ if (inst)
+ {
+ S32 rez_status = inst->getRezzedStatus();
+ counts[rez_status]++;
+ }
}
}
@@ -1342,38 +1346,36 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
{
LLViewerJointAttachment* attachment = iter->second;
- if (!attachment->getValid())
- {
- continue ;
- }
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
+ if (attachment->getValid())
{
- const LLViewerObject* attached_object = (*attachment_iter);
- if (attached_object && !attached_object->isHUDAttachment())
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
{
- LLDrawable* drawable = attached_object->mDrawable;
- if (drawable && !drawable->isState(LLDrawable::RIGGED))
+ const LLViewerObject* attached_object = (*attachment_iter);
+ if (attached_object && !attached_object->isHUDAttachment())
{
- LLSpatialBridge* bridge = drawable->getSpatialBridge();
- if (bridge)
+ LLDrawable* drawable = attached_object->mDrawable;
+ if (drawable && !drawable->isState(LLDrawable::RIGGED))
{
- const LLVector4a* ext = bridge->getSpatialExtents();
- LLVector4a distance;
- distance.setSub(ext[1], ext[0]);
- LLVector4a max_span(max_attachment_span);
+ LLSpatialBridge* bridge = drawable->getSpatialBridge();
+ if (bridge)
+ {
+ const LLVector4a* ext = bridge->getSpatialExtents();
+ LLVector4a distance;
+ distance.setSub(ext[1], ext[0]);
+ LLVector4a max_span(max_attachment_span);
- S32 lt = distance.lessThan(max_span).getGatheredBits() & 0x7;
+ S32 lt = distance.lessThan(max_span).getGatheredBits() & 0x7;
- // Only add the prim to spatial extents calculations if it isn't a megaprim.
- // max_attachment_span calculated at the start of the function
- // (currently 5 times our max prim size)
- if (lt == 0x7)
- {
- update_min_max(newMin,newMax,ext[0]);
- update_min_max(newMin,newMax,ext[1]);
+ // Only add the prim to spatial extents calculations if it isn't a megaprim.
+ // max_attachment_span calculated at the start of the function
+ // (currently 5 times our max prim size)
+ if (lt == 0x7)
+ {
+ update_min_max(newMin,newMax,ext[0]);
+ update_min_max(newMin,newMax,ext[1]);
+ }
}
}
}
@@ -1950,7 +1952,7 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
if (has_name && getNVPair("FirstName"))
{
mDebugExistenceTimer.reset();
- debugAvatarRezTime("AvatarRezArrivedNotification","avatar arrived");
+ debugAvatarRezTime("AvatarRezArrivedNotification","avatar arrived");
}
if(retval & LLViewerObject::INVALID_UPDATE)
@@ -1962,9 +1964,6 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
}
}
- //LL_INFOS() << getRotation() << LL_ENDL;
- //LL_INFOS() << getPosition() << LL_ENDL;
-
return retval;
}
@@ -1980,7 +1979,7 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU
result = gTextureList.findImage(uuid);
}
if (!result)
-{
+ {
const std::string url = getImageURL(te,uuid);
if (url.empty())
@@ -3324,7 +3323,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
removeAnimationData("Walk Speed");
}
mMotionController.setTimeStep(time_step);
-// LL_INFOS() << "Setting timestep to " << time_quantum * pixel_area_scale << LL_ENDL;
+ // LL_INFOS() << "Setting timestep to " << time_quantum * pixel_area_scale << LL_ENDL;
}
if (getParent() && !mIsSitting)
@@ -3465,7 +3464,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
fwdDir.normalize();
}
}
-
}
LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion();
@@ -3581,10 +3579,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// update animations
if (mSpecialRenderMode == 1) // Animation Preview
+ {
updateMotions(LLCharacter::FORCE_UPDATE);
+ }
else
+ {
updateMotions(LLCharacter::NORMAL_UPDATE);
-
+ }
+
// update head position
updateHeadOffset();
@@ -3681,10 +3683,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
//mesh vertices need to be reskinned
mNeedsSkin = TRUE;
-
-
-
-
return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3964,13 +3962,13 @@ U32 LLVOAvatar::renderSkinned()
if (face)
{
LLVertexBuffer* vb = face->getVertexBuffer();
- if (vb)
- {
- vb->flush();
+ if (vb)
+ {
+ vb->flush();
+ }
}
}
}
- }
else
{
mNeedsSkin = FALSE;
@@ -4150,7 +4148,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
{
LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
if (hair_mesh)
- {
+ {
num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
}
first_pass = FALSE;
@@ -5202,8 +5200,8 @@ BOOL LLVOAvatar::loadSkeletonNode ()
{
if (!LLAvatarAppearance::loadSkeletonNode())
{
- return FALSE;
- }
+ return FALSE;
+ }
// ATTACHMENTS
{
@@ -5954,27 +5952,24 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
break; // Do nothing
}
- /* switch(type)
- case LLWearableType::WT_SHIRT:
- indicator_te = TEX_UPPER_SHIRT; */
for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++tex_iter)
{
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second;
if (texture_dict->mWearableType == type)
- {
+ {
// Thus, you must check to see if the corresponding baked texture is defined.
// NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing
// this works for detecting a skirt (most important), but is ineffective at any piece of clothing that
// gets baked into a texture that always exists (upper or lower).
if (texture_dict->mIsUsedByBakedTexture)
- {
+ {
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex);
- }
+ }
return FALSE;
- }
+ }
}
return FALSE;
}
@@ -6044,7 +6039,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color)
}
else if (global_color == mTexEyeColor)
{
-// LL_INFOS() << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << LL_ENDL;
+ // LL_INFOS() << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << LL_ENDL;
invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet);
}
updateMeshTextures();
@@ -6104,9 +6099,9 @@ void LLVOAvatar::updateRezzedStatusTimers()
{
// load level has decreased. start phase timers for higher load levels.
for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++)
- {
+ {
startPhase("load_" + LLVOAvatar::rezStatusToString(i));
- }
+ }
}
else if (rez_status > mLastRezzedStatus)
{
@@ -6115,16 +6110,15 @@ void LLVOAvatar::updateRezzedStatusTimers()
{
stopPhase("load_" + LLVOAvatar::rezStatusToString(i));
stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false);
- }
+ }
if (rez_status == 3)
- {
+ {
// "fully loaded", mark any pending appearance change complete.
selfStopPhase("update_appearance_from_cof");
selfStopPhase("wear_inventory_category", false);
selfStopPhase("process_initial_wearables_update", false);
}
}
-
mLastRezzedStatus = rez_status;
}
}
@@ -6186,7 +6180,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check)
void LLVOAvatar::logPendingPhases()
{
if (!isAgentAvatarValid())
- {
+ {
return;
}
@@ -6202,14 +6196,14 @@ void LLVOAvatar::logPendingPhases()
if (!completed)
{
logMetricsTimerRecord(phase_name, elapsed, completed);
- }
+ }
}
}
- }
+}
//static
void LLVOAvatar::logPendingPhasesAllAvatars()
- {
+{
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
@@ -6220,14 +6214,14 @@ void LLVOAvatar::logPendingPhasesAllAvatars()
}
inst->logPendingPhases();
}
- }
+}
void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed)
- {
+{
if (!isAgentAvatarValid())
- {
+ {
return;
- }
+ }
LLSD record;
record["timer_name"] = phase_name;
@@ -6236,10 +6230,10 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse
record["completed"] = completed;
U32 grid_x(0), grid_y(0);
if (getRegion())
- {
+ {
record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion());
grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y);
- }
+ }
record["grid_x"] = LLSD::Integer(grid_x);
record["grid_y"] = LLSD::Integer(grid_y);
record["is_using_server_bakes"] = true;
@@ -6300,8 +6294,8 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE);
- if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
- {
+ if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
+ {
debugAvatarRezTime("AvatarRezNotification","fully loaded");
}
@@ -6357,9 +6351,7 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color)
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
- {
- mesh->setColor(color);
- }
+ mesh->setColor(color);
}
}
}
@@ -6459,7 +6451,7 @@ void LLVOAvatar::updateMeshTextures()
LLViewerTexLayerSet* layerset = getTexLayerSet(i);
if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() )
- {
+ {
LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID);
mBakedTextureDatas[i].mIsUsed = TRUE;
@@ -6468,12 +6460,12 @@ void LLVOAvatar::updateMeshTextures()
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
for (; iter != end; ++iter)
- {
+ {
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
- {
+ {
mesh->setTexture( baked_img );
- }
+ }
}
}
else if (!isUsingLocalAppearance() && is_layer_baked[i])
@@ -6502,9 +6494,9 @@ void LLVOAvatar::updateMeshTextures()
baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ),
src_callback_list, paused );
- // this could add paused texture callbacks
- mLoadedCallbacksPaused |= paused;
- checkTextureLoading();
+ // this could add paused texture callbacks
+ mLoadedCallbacksPaused |= paused;
+ checkTextureLoading();
}
}
else if (layerset && isUsingLocalAppearance())
@@ -6523,7 +6515,7 @@ void LLVOAvatar::updateMeshTextures()
if (mesh)
{
mesh->setLayerSet( layerset );
- }
+ }
}
}
else
@@ -6545,7 +6537,7 @@ void LLVOAvatar::updateMeshTextures()
{
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
- {
+ {
mesh->setColor( color );
mesh->setTexture( hair_img );
}
@@ -6641,13 +6633,13 @@ void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_com
for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin();
iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter)
-{
+ {
const LLMaskedMorph* maskedMorph = (*iter);
LLPolyMorphTarget* morph_target = dynamic_cast<LLPolyMorphTarget*>(maskedMorph->mMorphTarget);
if (morph_target)
- {
+ {
morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert);
-}
+ }
}
}
@@ -6946,9 +6938,9 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix,
outfile.open(fullpath, LL_APR_WB );
apr_file_t* file = outfile.getFileHandle();
if (!file)
- {
- return;
- }
+ {
+ return;
+ }
else
{
LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << LL_ENDL;
@@ -6983,7 +6975,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix,
apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", i, uuid_str.c_str());
}
apr_file_printf(file, "</textures>\n");
- }
+}
void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents)
{
@@ -7066,7 +7058,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe
if (it != contents.mParams.end())
{
S32 index = it - contents.mParams.begin();
- contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]);
+ contents.mParamAppearanceVersion = ll_round(contents.mParamWeights[index]);
LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << LL_ENDL;
}
}
@@ -7512,12 +7504,12 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
for (; iter != end; ++iter)
- {
+ {
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
- {
+ {
mesh->setTexture( image_baked );
- }
+ }
}
}
@@ -7541,14 +7533,13 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
{
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
- {
+ {
mesh->setColor( LLColor4::white );
}
}
}
}
}
-
dirtyMesh();
}
@@ -7560,7 +7551,7 @@ std::string get_sequential_numbered_file_name(const std::string& prefix,
file_num_type::iterator it = file_nums.find(prefix);
S32 num = 0;
if (it != file_nums.end())
-{
+ {
num = it->second;
}
file_nums[prefix] = num+1;
@@ -7593,65 +7584,58 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
LLAPRFile outfile;
std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- outfile.open(fullpath, LL_APR_WB );
- apr_file_t* file = outfile.getFileHandle();
- if (!file)
- {
- return;
- }
- else
+ if (APR_SUCCESS == outfile.open(fullpath, LL_APR_WB ))
{
+ apr_file_t* file = outfile.getFileHandle();
LL_INFOS() << "xmlfile write handle obtained : " << fullpath << LL_ENDL;
- }
-
- apr_file_printf( file, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n" );
- apr_file_printf( file, "<linden_genepool version=\"1.0\">\n" );
- apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
- if (group_by_wearables)
- {
- for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++)
- {
- const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type);
- apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
+ apr_file_printf( file, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n" );
+ apr_file_printf( file, "<linden_genepool version=\"1.0\">\n" );
+ apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
- for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
+ if (group_by_wearables)
{
- LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
- if( (viewer_param->getWearableType() == type) &&
- (viewer_param->isTweakable() ) )
+ for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++)
{
- dump_visual_param(file, viewer_param, viewer_param->getWeight());
- }
- }
+ const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type);
+ apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
- for (U8 te = 0; te < TEX_NUM_INDICES; te++)
- {
- if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type)
- {
- // MULTIPLE_WEARABLES: extend to multiple wearables?
- LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
- if( te_image )
+ for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
{
- std::string uuid_str;
- te_image->getID().toString( uuid_str );
- apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
+ LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
+ if( (viewer_param->getWearableType() == type) &&
+ (viewer_param->isTweakable() ) )
+ {
+ dump_visual_param(file, viewer_param, viewer_param->getWeight());
+ }
+ }
+
+ for (U8 te = 0; te < TEX_NUM_INDICES; te++)
+ {
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type)
+ {
+ // MULTIPLE_WEARABLES: extend to multiple wearables?
+ LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
+ if( te_image )
+ {
+ std::string uuid_str;
+ te_image->getID().toString( uuid_str );
+ apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
+ }
+ }
}
}
}
- }
- }
- else
- {
- // Just dump all params sequentially.
- for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
+ else
{
- LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
- dump_visual_param(file, viewer_param, viewer_param->getWeight());
- }
+ // Just dump all params sequentially.
+ for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
+ {
+ LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
+ dump_visual_param(file, viewer_param, viewer_param->getWeight());
+ }
- for (U8 te = 0; te < TEX_NUM_INDICES; te++)
- {
+ for (U8 te = 0; te < TEX_NUM_INDICES; te++)
{
// MULTIPLE_WEARABLES: extend to multiple wearables?
LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
@@ -7663,18 +7647,17 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
}
}
}
+ apr_file_printf( file, "\t</archetype>\n" );
+ apr_file_printf( file, "\n</linden_genepool>\n" );
+ bool ultra_verbose = false;
+ if (isSelf() && ultra_verbose)
+ {
+ // show the cloned params inside the wearables as well.
+ gAgentAvatarp->dumpWearableInfo(outfile);
+ }
+ outfile.close();
}
- apr_file_printf( file, "\t</archetype>\n" );
- apr_file_printf( file, "\n</linden_genepool>\n" );
-
- bool ultra_verbose = false;
- if (isSelf() && ultra_verbose)
- {
- // show the cloned params inside the wearables as well.
- gAgentAvatarp->dumpWearableInfo(outfile);
- }
- // File will close when handle goes out of scope
}
@@ -7788,7 +7771,7 @@ void LLVOAvatar::startAppearanceAnimation()
// virtual
void LLVOAvatar::removeMissingBakedTextures()
- {
+{
}
//virtual
@@ -8042,7 +8025,6 @@ void LLVOAvatar::calculateUpdateRenderCost()
}
}
}
-
}
// Diagnostic output to identify all avatar-related textures.
@@ -8054,9 +8036,8 @@ void LLVOAvatar::calculateUpdateRenderCost()
for (LLVOVolume::texture_cost_t::iterator it = textures.begin(); it != textures.end(); ++it)
{
LLUUID image_id = it->first;
- if( image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR)
- continue;
- if (all_textures.find(image_id) == all_textures.end())
+ if( ! (image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR)
+ && (all_textures.find(image_id) == all_textures.end()))
{
// attachment texture not previously seen.
LL_INFOS() << "attachment_texture: " << image_id.asString() << LL_ENDL;
@@ -8122,15 +8103,17 @@ LLColor4 LLVOAvatar::calcMutedAVColor(F32 value, S32 range_low, S32 range_high)
// static
BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index)
{
- if (index < 0 || index >= TEX_NUM_INDICES) return false;
- return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture;
+ return (index < 0 || index >= TEX_NUM_INDICES)
+ ? false
+ : LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture;
}
// static
BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index)
{
- if (index < 0 || index >= TEX_NUM_INDICES) return false;
- return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture;
+ return (index < 0 || index >= TEX_NUM_INDICES)
+ ? false
+ : LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture;
}
const std::string LLVOAvatar::getBakedStatusForPrintout() const
@@ -8180,7 +8163,7 @@ BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U
{
return FALSE;
}
-
+
if( !getImage( te, index ) )
{
LL_WARNS() << "getImage( " << te << ", " << index << " ) returned 0" << LL_ENDL;
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 54b4119331..f288a18bca 100755
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -2463,7 +2463,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void)
if(!p->mIsSelf)
{
// scale from the range 0.0-1.0 to vivox volume in the range 0-100
- S32 volume = llround(p->mVolume / VOLUME_SCALE_VIVOX);
+ S32 volume = ll_round(p->mVolume / VOLUME_SCALE_VIVOX);
bool mute = p->mOnMuteList;
if(mute)
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index a9a1393e54..1ba0868544 100755
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -681,7 +681,7 @@ void LLVOPartGroup::getGeometry(S32 idx,
}
else
{
- pglow = LLColor4U(0, 0, 0, (U8) llround(255.f*part.mStartGlow));
+ pglow = LLColor4U(0, 0, 0, (U8) ll_round(255.f*part.mStartGlow));
pcolor = part.mStartColor;
}
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 2d0992cea2..703334a6da 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1220,7 +1220,7 @@ S32 LLVOVolume::computeLODDetail(F32 distance, F32 radius)
{
// We've got LOD in the profile, and in the twist. Use radius.
F32 tan_angle = (LLVOVolume::sLODFactor*radius)/distance;
- cur_detail = LLVolumeLODGroup::getDetailFromTan(llround(tan_angle, 0.01f));
+ cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f));
}
else
{
@@ -1278,8 +1278,8 @@ BOOL LLVOVolume::calcLOD()
// DON'T Compensate for field of view changing on FOV zoom.
distance *= F_PI/3.f;
- cur_detail = computeLODDetail(llround(distance, 0.01f),
- llround(radius, 0.01f));
+ cur_detail = computeLODDetail(ll_round(distance, 0.01f),
+ ll_round(radius, 0.01f));
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LOD_INFO) &&
@@ -1292,7 +1292,7 @@ BOOL LLVOVolume::calcLOD()
if (cur_detail != mLOD)
{
- mAppAngle = llround((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
+ mAppAngle = ll_round((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
mLOD = cur_detail;
return TRUE;
}
diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp
index a8e06511d7..734018cfc2 100755
--- a/indra/newview/llwindowlistener.cpp
+++ b/indra/newview/llwindowlistener.cpp
@@ -44,10 +44,7 @@
#include <typeinfo>
#include <map>
#include <boost/scoped_ptr.hpp>
-#include <boost/lambda/core.hpp>
-#include <boost/lambda/bind.hpp>
-
-namespace bll = boost::lambda;
+#include <boost/bind.hpp>
LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& kbgetter)
: LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"),
@@ -358,6 +355,30 @@ static WhichButton buttons;
typedef boost::function<bool(LLCoordGL, MASK)> MouseFunc;
+// Wrap a function returning 'void' to return 'true' instead. I'm sure there's
+// a more generic way to accomplish this, but generically handling the
+// arguments seems to require variadic templates and perfect forwarding. (We
+// used to be able to write (boost::lambda::bind(...), true), counting on
+// boost::lambda's comma operator overload, until
+// https://svn.boost.org/trac/boost/ticket/10864. And boost::phoenix doesn't
+// seem to overload comma the same way; or at least not with bind().)
+class MouseFuncTrue
+{
+ typedef boost::function<void(LLCoordGL, MASK)> MouseFuncVoid;
+ MouseFuncVoid mFunc;
+
+public:
+ MouseFuncTrue(const MouseFuncVoid& func):
+ mFunc(func)
+ {}
+
+ bool operator()(LLCoordGL coords, MASK mask) const
+ {
+ mFunc(coords, mask);
+ return true;
+ }
+};
+
static void mouseEvent(const MouseFunc& func, const LLSD& request)
{
// Ensure we send response
@@ -464,11 +485,11 @@ void LLWindowListener::mouseDown(LLSD const & request)
if (actions.valid)
{
// Normally you can pass NULL to an LLWindow* without compiler
- // complaint, but going through boost::lambda::bind() evidently
+ // complaint, but going through boost::bind() evidently
// bypasses that special case: it only knows you're trying to pass an
// int to a pointer. Explicitly cast NULL to the desired pointer type.
- mouseEvent(bll::bind(actions.down, mWindow,
- static_cast<LLWindow*>(NULL), bll::_1, bll::_2),
+ mouseEvent(boost::bind(actions.down, mWindow,
+ static_cast<LLWindow*>(NULL), _1, _2),
request);
}
}
@@ -478,8 +499,8 @@ void LLWindowListener::mouseUp(LLSD const & request)
Actions actions(buttons.lookup(request["button"]));
if (actions.valid)
{
- mouseEvent(bll::bind(actions.up, mWindow,
- static_cast<LLWindow*>(NULL), bll::_1, bll::_2),
+ mouseEvent(boost::bind(actions.up, mWindow,
+ static_cast<LLWindow*>(NULL), _1, _2),
request);
}
}
@@ -489,12 +510,10 @@ void LLWindowListener::mouseMove(LLSD const & request)
// We want to call the same central mouseEvent() routine for
// handleMouseMove() as for button clicks. But handleMouseMove() returns
// void, whereas mouseEvent() accepts a function returning bool -- and
- // uses that bool return. Use (void-lambda-expression, true) to construct
- // a callable that returns bool anyway. Pass 'true' because we expect that
- // our caller will usually treat 'false' as a problem.
- mouseEvent((bll::bind(&LLWindowCallbacks::handleMouseMove, mWindow,
- static_cast<LLWindow*>(NULL), bll::_1, bll::_2),
- true),
+ // uses that bool return. Use MouseFuncTrue to construct a callable that
+ // returns bool anyway.
+ mouseEvent(MouseFuncTrue(boost::bind(&LLWindowCallbacks::handleMouseMove, mWindow,
+ static_cast<LLWindow*>(NULL), _1, _2)),
request);
}
diff --git a/indra/newview/llwlanimator.cpp b/indra/newview/llwlanimator.cpp
index e568638cf6..2142885767 100755
--- a/indra/newview/llwlanimator.cpp
+++ b/indra/newview/llwlanimator.cpp
@@ -242,7 +242,7 @@ std::string LLWLAnimator::timeToString(F32 curTime)
// get hours and minutes
hours = (S32) (24.0 * curTime);
curTime -= ((F32) hours / 24.0f);
- min = llround(24.0f * 60.0f * curTime);
+ min = ll_round(24.0f * 60.0f * curTime);
// handle case where it's 60
if(min == 60)
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index f95bbe241a..74fb1ec78e 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -977,8 +977,8 @@ void LLWorld::updateWaterObjects()
}
// Resize and reshape the water objects
- const S32 water_center_x = center_x + llround((wx + dim[0]) * 0.5f * gDirAxes[dir][0]);
- const S32 water_center_y = center_y + llround((wy + dim[1]) * 0.5f * gDirAxes[dir][1]);
+ const S32 water_center_x = center_x + ll_round((wx + dim[0]) * 0.5f * gDirAxes[dir][0]);
+ const S32 water_center_y = center_y + ll_round((wy + dim[1]) * 0.5f * gDirAxes[dir][1]);
LLVOWater* waterp = mEdgeWaterObjects[dir];
if (!waterp || waterp->isDead())
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 2ebefbdb11..62fad32246 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -419,8 +419,8 @@ void LLWorldMapView::draw()
if (overlayimage)
{
// Inform the fetch mechanism of the size we need
- S32 draw_size = llround(sMapScale);
- overlayimage->setKnownDrawSize(llround(draw_size * LLUI::getScaleFactor().mV[VX]), llround(draw_size * LLUI::getScaleFactor().mV[VY]));
+ S32 draw_size = ll_round(sMapScale);
+ overlayimage->setKnownDrawSize(ll_round(draw_size * LLUI::getScaleFactor().mV[VX]), ll_round(draw_size * LLUI::getScaleFactor().mV[VY]));
// Draw something whenever we have enough info
if (overlayimage->hasGLTexture())
{
@@ -508,7 +508,7 @@ void LLWorldMapView::draw()
drawImage(pos_global, sAvatarYouImage);
LLVector3 pos_map = globalPosToView(pos_global);
- if (!pointInView(llround(pos_map.mV[VX]), llround(pos_map.mV[VY])))
+ if (!pointInView(ll_round(pos_map.mV[VX]), ll_round(pos_map.mV[VY])))
{
drawTracking(pos_global,
lerp(LLColor4::yellow, LLColor4::orange, 0.4f),
@@ -773,8 +773,8 @@ void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLUIImagePtr image)
void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color)
{
LLVector3 pos_map = globalPosToView( global_pos );
- image->draw(llround(pos_map.mV[VX] - image->getWidth() /2.f),
- llround(pos_map.mV[VY] - image->getHeight()/2.f),
+ image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
+ ll_round(pos_map.mV[VY] - image->getHeight()/2.f),
color);
}
@@ -783,8 +783,8 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i
LLVector3 pos_map = globalPosToView( global_pos );
for(U32 i=0; i<count; i++)
{
- image->draw(llround(pos_map.mV[VX] - image->getWidth() /2.f),
- llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
+ image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
+ ll_round(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
color);
}
}
@@ -958,8 +958,8 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
const std::string& label, const std::string& tooltip, S32 vert_offset )
{
LLVector3 pos_local = globalPosToView( pos_global );
- S32 x = llround( pos_local.mV[VX] );
- S32 y = llround( pos_local.mV[VY] );
+ S32 x = ll_round( pos_local.mV[VX] );
+ S32 y = ll_round( pos_local.mV[VY] );
LLFontGL* font = LLFontGL::getFontSansSerifSmall();
S32 text_x = x;
S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight());
@@ -1110,8 +1110,8 @@ static void drawDot(F32 x_pixels, F32 y_pixels,
if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD)
{
- dot_image->draw(llround(x_pixels) - dot_image->getWidth()/2,
- llround(y_pixels) - dot_image->getHeight()/2,
+ dot_image->draw(ll_round(x_pixels) - dot_image->getWidth()/2,
+ ll_round(y_pixels) - dot_image->getHeight()/2,
color);
}
else
@@ -1166,9 +1166,9 @@ void LLWorldMapView::drawAvatar(F32 x_pixels,
dot_image = sAvatarAboveImage;
}
}
- S32 dot_width = llround(dot_radius * 2.f);
- dot_image->draw(llround(x_pixels - dot_radius),
- llround(y_pixels - dot_radius),
+ S32 dot_width = ll_round(dot_radius * 2.f);
+ dot_image->draw(ll_round(x_pixels - dot_radius),
+ ll_round(y_pixels - dot_radius),
dot_width,
dot_width,
color);
@@ -1195,8 +1195,8 @@ void LLWorldMapView::drawIconName(F32 x_pixels,
const std::string& second_line)
{
const S32 VERT_PAD = 8;
- S32 text_x = llround(x_pixels);
- S32 text_y = llround(y_pixels
+ S32 text_x = ll_round(x_pixels);
+ S32 text_y = ll_round(y_pixels
- BIG_DOT_RADIUS
- VERT_PAD);
@@ -1384,8 +1384,8 @@ void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation )
F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
text_box->setOrigin(
- llround(map_half_width - text_half_width + radius * cos( rotation )),
- llround(map_half_height - text_half_height + radius * sin( rotation )) );
+ ll_round(map_half_width - text_half_width + radius * cos( rotation )),
+ ll_round(map_half_height - text_half_height + radius * sin( rotation )) );
}
@@ -1433,8 +1433,8 @@ void LLWorldMapView::reshape( S32 width, S32 height, BOOL called_from_parent )
bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track)
{
LLVector3 pos_view = globalPosToView(item.getGlobalPosition());
- S32 item_x = llround(pos_view.mV[VX]);
- S32 item_y = llround(pos_view.mV[VY]);
+ S32 item_x = ll_round(pos_view.mV[VX]);
+ S32 item_y = ll_round(pos_view.mV[VY]);
if (x < item_x - BIG_DOT_RADIUS) return false;
if (x > item_x + BIG_DOT_RADIUS) return false;
@@ -1598,8 +1598,8 @@ BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask )
{
gFocusMgr.setMouseCapture( this );
- mMouseDownPanX = llround(sPanX);
- mMouseDownPanY = llround(sPanY);
+ mMouseDownPanX = ll_round(sPanX);
+ mMouseDownPanY = ll_round(sPanY);
mMouseDownX = x;
mMouseDownY = y;
sHandledLastClick = TRUE;
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp
index 81db191ca6..458df3361e 100755
--- a/indra/test/llsd_new_tut.cpp
+++ b/indra/test/llsd_new_tut.cpp
@@ -33,18 +33,7 @@
#include "llsdtraits.h"
#include "llstring.h"
-#if LL_WINDOWS
-#include <float.h>
-namespace
-{
- int fpclassify(double x)
- {
- return _fpclass(x);
- }
-}
-#else
using std::fpclassify;
-#endif
namespace tut
{
diff --git a/indra/test/lltut.h b/indra/test/lltut.h
index b334fb51e2..9835565bb6 100755
--- a/indra/test/lltut.h
+++ b/indra/test/lltut.h
@@ -75,10 +75,14 @@ namespace tut
// overloads declared above.
// turn off warnings about unused functions from clang for tut package
+#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
+#endif
#include <tut/tut.hpp>
+#if __clang__
#pragma clang diagnostic pop
+#endif
// The functions BELOW this point actually consume tut.hpp functionality.
namespace tut
diff --git a/indra/test/namedtempfile.h b/indra/test/namedtempfile.h
index 6069064627..7d59cad32c 100755
--- a/indra/test/namedtempfile.h
+++ b/indra/test/namedtempfile.h
@@ -17,8 +17,8 @@
#include "apr_file_io.h"
#include <string>
#include <boost/function.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
+#include <boost/phoenix/core/argument.hpp>
+#include <boost/phoenix/operator/bitwise.hpp>
#include <boost/noncopyable.hpp>
#include <iostream>
#include <sstream>
@@ -34,19 +34,19 @@ public:
NamedTempFile(const std::string& pfx, const std::string& content, apr_pool_t* pool=gAPRPoolp):
mPool(pool)
{
- createFile(pfx, boost::lambda::_1 << content);
+ createFile(pfx, boost::phoenix::placeholders::arg1 << content);
}
// Disambiguate when passing string literal
NamedTempFile(const std::string& pfx, const char* content, apr_pool_t* pool=gAPRPoolp):
mPool(pool)
{
- createFile(pfx, boost::lambda::_1 << content);
+ createFile(pfx, boost::phoenix::placeholders::arg1 << content);
}
// Function that accepts an ostream ref and (presumably) writes stuff to
// it, e.g.:
- // (boost::lambda::_1 << "the value is " << 17 << '\n')
+ // (boost::phoenix::placeholders::arg1 << "the value is " << 17 << '\n')
typedef boost::function<void(std::ostream&)> Streamer;
NamedTempFile(const std::string& pfx, const Streamer& func, apr_pool_t* pool=gAPRPoolp):
diff --git a/indra/tools/vstool/VSTool.exe b/indra/tools/vstool/VSTool.exe
index 8be428614e..854290b90a 100755
--- a/indra/tools/vstool/VSTool.exe
+++ b/indra/tools/vstool/VSTool.exe
Binary files differ
diff --git a/indra/tools/vstool/main.cs b/indra/tools/vstool/main.cs
index cc73261e30..ef2e582b90 100755
--- a/indra/tools/vstool/main.cs
+++ b/indra/tools/vstool/main.cs
@@ -555,6 +555,10 @@ namespace VSTool
version = "VC100";
break;
+ case "12.00":
+ version = "VC120";
+ break;
+
default:
throw new ApplicationException("Unknown .sln version: " + format);
}
@@ -595,6 +599,10 @@ namespace VSTool
progid = "VisualStudio.DTE.10.0";
break;
+ case "VC120":
+ progid = "VisualStudio.DTE.12.0";
+ break;
+
default:
throw new ApplicationException("Can't handle VS version: " + version);
}