diff options
Diffstat (limited to 'indra')
68 files changed, 1249 insertions, 506 deletions
diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 0d0b85ba60..ff7ad1c289 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -232,7 +232,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) mIKSolver.solve(); // use blending... - F32 slerp_amt = LLCriticalDamp::getInterpolant(TARGET_LAG_HALF_LIFE); + F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TARGET_LAG_HALF_LIFE); shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot); elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot); diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 15a58a8389..4a8af2f00c 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -182,8 +182,8 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) LLQuaternion currentRootRotWorld = mRootJoint->getWorldRotation(); LLQuaternion currentInvRootRotWorld = ~currentRootRotWorld; - F32 head_slerp_amt = LLCriticalDamp::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE); - F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE); + F32 head_slerp_amt = LLSmoothInterpolation::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE); + F32 torso_slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE); LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index c6f45bffa2..831a0a6719 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1031,11 +1031,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 if (constraint->mSharedData->mChainLength != 0 && dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength) { - constraint->mWeight = lerp(constraint->mWeight, 0.f, LLCriticalDamp::getInterpolant(0.1f)); + constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 0.f, 0.1f); } else { - constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(0.3f)); + constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 1.f, 0.3f); } F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f : @@ -1082,9 +1082,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // convert intermediate joint positions to world coordinates positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition(); F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f); -// llinfos << "Interpolant " << LLCriticalDamp::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; +// llinfos << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; positions[joint_num] = lerp(positions[joint_num], kinematic_position, - LLCriticalDamp::getInterpolant(time_constant, FALSE)); + LLSmoothInterpolation::getInterpolant(time_constant, FALSE)); } S32 iteration_count; diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index d52eb89a5c..e188b06c03 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -258,7 +258,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) // but this will cause the animation playback rate calculation below to // kick in too slowly and sometimes start playing the animation in reverse. - //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLCriticalDamp::getInterpolant(0.1f)); + //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLSmoothInterpolation::getInterpolant(0.1f)); ////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED); //F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL; @@ -287,7 +287,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX); // blend towards new speed adjustment value - F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT)); + F32 new_speed_adjust = LLSmoothInterpolation::lerp(mAdjustedSpeed, desired_speed_multiplier, SPEED_ADJUST_TIME_CONSTANT); // limit that rate at which the speed adjustment changes F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time); @@ -305,8 +305,8 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { // standing/turning // damp out speed adjustment to 0 - mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f)); - //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f)); + mAnimSpeed = LLSmoothInterpolation::lerp(mAnimSpeed, 1.f, 0.2f); + //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f)); } // broadcast walk speed change @@ -383,7 +383,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor; // roll is critically damped interpolation between current roll and angular velocity-derived target roll - mRoll = lerp(mRoll, target_roll, LLCriticalDamp::getInterpolant(0.1f)); + mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, LLUnit<LLUnits::Milliseconds, F32>(100)); LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index 2551f125d0..af2e10220a 100644 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -73,7 +73,7 @@ void LLMotion::fadeOut() { if (mFadeWeight > 0.01f) { - mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(0.15f)); + mFadeWeight = lerp(mFadeWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.15f)); } else { @@ -88,7 +88,7 @@ void LLMotion::fadeIn() { if (mFadeWeight < 0.99f) { - mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(0.15f)); + mFadeWeight = lerp(mFadeWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.15f)); } else { diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp index 489aef923c..633c1d51eb 100644 --- a/indra/llcharacter/lltargetingmotion.cpp +++ b/indra/llcharacter/lltargetingmotion.cpp @@ -106,7 +106,7 @@ BOOL LLTargetingMotion::onActivate() //----------------------------------------------------------------------------- BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) { - F32 slerp_amt = LLCriticalDamp::getInterpolant(TORSO_TARGET_HALF_LIFE); + F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_TARGET_HALF_LIFE); LLVector3 target; LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp index 87d79b1ee0..59a31bf9df 100644 --- a/indra/llcommon/llcriticaldamp.cpp +++ b/indra/llcommon/llcriticaldamp.cpp @@ -27,18 +27,38 @@ #include "linden_common.h" #include "llcriticaldamp.h" +#include <algorithm> //----------------------------------------------------------------------------- // static members //----------------------------------------------------------------------------- -LLFrameTimer LLCriticalDamp::sInternalTimer; -std::map<F32, F32> LLCriticalDamp::sInterpolants; -F32 LLCriticalDamp::sTimeDelta; +LLFrameTimer LLSmoothInterpolation::sInternalTimer; +std::vector<LLSmoothInterpolation::Interpolant> LLSmoothInterpolation::sInterpolants; +F32 LLSmoothInterpolation::sTimeDelta; + +// helper functors +struct LLSmoothInterpolation::CompareTimeConstants +{ + bool operator()(const F32& a, const LLSmoothInterpolation::Interpolant& b) const + { + return a < b.mTimeScale; + } + + bool operator()(const LLSmoothInterpolation::Interpolant& a, const F32& b) const + { + return a.mTimeScale < b; // bottom of a is higher than bottom of b + } + + bool operator()(const LLSmoothInterpolation::Interpolant& a, const LLSmoothInterpolation::Interpolant& b) const + { + return a.mTimeScale < b.mTimeScale; // bottom of a is higher than bottom of b + } +}; //----------------------------------------------------------------------------- -// LLCriticalDamp() +// LLSmoothInterpolation() //----------------------------------------------------------------------------- -LLCriticalDamp::LLCriticalDamp() +LLSmoothInterpolation::LLSmoothInterpolation() { sTimeDelta = 0.f; } @@ -47,43 +67,54 @@ LLCriticalDamp::LLCriticalDamp() //----------------------------------------------------------------------------- // updateInterpolants() //----------------------------------------------------------------------------- -void LLCriticalDamp::updateInterpolants() +void LLSmoothInterpolation::updateInterpolants() { sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32(); - F32 time_constant; - - for (std::map<F32, F32>::iterator iter = sInterpolants.begin(); - iter != sInterpolants.end(); iter++) + for (S32 i = 0; i < sInterpolants.size(); i++) { - time_constant = iter->first; - F32 new_interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant); - new_interpolant = llclamp(new_interpolant, 0.f, 1.f); - sInterpolants[time_constant] = new_interpolant; + Interpolant& interp = sInterpolants[i]; + interp.mInterpolant = calcInterpolant(interp.mTimeScale); } } //----------------------------------------------------------------------------- // getInterpolant() //----------------------------------------------------------------------------- -F32 LLCriticalDamp::getInterpolant(const F32 time_constant, BOOL use_cache) +F32 LLSmoothInterpolation::getInterpolant(LLUnit<LLUnits::Seconds, F32> time_constant, bool use_cache) { if (time_constant == 0.f) { return 1.f; } - if (use_cache && sInterpolants.count(time_constant)) + if (use_cache) { - return sInterpolants[time_constant]; + interpolant_vec_t::iterator find_it = std::lower_bound(sInterpolants.begin(), sInterpolants.end(), time_constant.value(), CompareTimeConstants()); + if (find_it != sInterpolants.end() && find_it->mTimeScale == time_constant) + { + return find_it->mInterpolant; + } + else + { + Interpolant interp; + interp.mTimeScale = time_constant.value(); + interp.mInterpolant = calcInterpolant(time_constant.value()); + sInterpolants.insert(find_it, interp); + return interp.mInterpolant; + } } - - F32 interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant); - interpolant = llclamp(interpolant, 0.f, 1.f); - if (use_cache) + else { - sInterpolants[time_constant] = interpolant; + return calcInterpolant(time_constant.value()); + } +} - return interpolant; +//----------------------------------------------------------------------------- +// getInterpolant() +//----------------------------------------------------------------------------- +F32 LLSmoothInterpolation::calcInterpolant(F32 time_constant) +{ + return llclamp(1.f - pow(2.f, -sTimeDelta / time_constant), 0.f, 1.f); } diff --git a/indra/llcommon/llcriticaldamp.h b/indra/llcommon/llcriticaldamp.h index 52f052ae25..ab5d4ba6e2 100644 --- a/indra/llcommon/llcriticaldamp.h +++ b/indra/llcommon/llcriticaldamp.h @@ -28,26 +28,46 @@ #ifndef LL_LLCRITICALDAMP_H #define LL_LLCRITICALDAMP_H -#include <map> +#include <vector> #include "llframetimer.h" +#include "llunit.h" -class LL_COMMON_API LLCriticalDamp +class LL_COMMON_API LLSmoothInterpolation { public: - LLCriticalDamp(); + LLSmoothInterpolation(); // MANIPULATORS static void updateInterpolants(); // ACCESSORS - static F32 getInterpolant(const F32 time_constant, BOOL use_cache = TRUE); + static F32 getInterpolant(LLUnit<LLUnits::Seconds, F32> time_constant, bool use_cache = true); -protected: + template<typename T> + static T lerp(T a, T b, LLUnit<LLUnits::Seconds, F32> time_constant, bool use_cache = true) + { + F32 interpolant = getInterpolant(time_constant, use_cache); + return ((a * (1.f - interpolant)) + + (b * interpolant)); + } + +protected: + static F32 calcInterpolant(F32 time_constant); + + struct CompareTimeConstants; static LLFrameTimer sInternalTimer; // frame timer for calculating deltas - static std::map<F32, F32> sInterpolants; + struct Interpolant + { + F32 mTimeScale; + F32 mInterpolant; + }; + typedef std::vector<Interpolant> interpolant_vec_t; + static interpolant_vec_t sInterpolants; static F32 sTimeDelta; }; +typedef LLSmoothInterpolation LLCriticalDamp; + #endif // LL_LLCRITICALDAMP_H diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 9bca3625b6..71bf1e53e4 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -674,57 +674,6 @@ struct MemFootprint<std::list<T> > } }; -template <size_t ALIGNMENT, size_t RESERVE> -void* allocAligned(size_t size) -{ - llstatic_assert((ALIGNMENT > 0) && (ALIGNMENT & (ALIGNMENT - 1)) == 0, "Alignment must be a power of 2"); - - void* padded_allocation; - const size_t aligned_reserve = (RESERVE / ALIGNMENT) - + ((RESERVE % ALIGNMENT) ? ALIGNMENT : 0); - const size_t size_with_reserve = size + aligned_reserve; - if (ALIGNMENT <= LL_DEFAULT_HEAP_ALIGN) - { - padded_allocation = malloc(size_with_reserve); - } - else - { -#if LL_WINDOWS - padded_allocation = _aligned_malloc(size_with_reserve, ALIGNMENT); -#elif LL_DARWIN - padded_allocation = ll_aligned_malloc(size_with_reserve, ALIGNMENT); -#else - if (LL_UNLIKELY(0 != posix_memalign(&padded_allocation, 16, size))) - padded_allocation = NULL; -#endif - } - return (char*)padded_allocation + aligned_reserve; -} - -template<size_t ALIGNMENT, size_t RESERVE> -void deallocAligned(void* ptr) -{ - const size_t aligned_reserve = (RESERVE / ALIGNMENT) - + ((RESERVE % ALIGNMENT) ? ALIGNMENT : 0); - - void* original_allocation = (char*)ptr - aligned_reserve; - - if (ALIGNMENT <= LL_DEFAULT_HEAP_ALIGN) - { - free(original_allocation); - } - else - { -#if LL_WINDOWS - _aligned_free(original_allocation); -#elif LL_DARWIN - ll_aligned_free(original_allocation); -#else - free(original_allocation); -#endif - } -} - template<typename DERIVED, size_t ALIGNMENT = LL_DEFAULT_HEAP_ALIGN> class MemTrackable { @@ -736,7 +685,7 @@ class MemTrackable public: typedef void mem_trackable_tag_t; - ~MemTrackable() + virtual ~MemTrackable() { memDisclaim(mMemFootprint); } @@ -750,24 +699,19 @@ public: accumulator->mAllocatedCount++; } - // reserve 4 bytes for allocation size (and preserving requested alignment) - void* allocation = allocAligned<ALIGNMENT, sizeof(size_t)>(size); - ((size_t*)allocation)[-1] = size; - - return allocation; + return ::operator new(size); } - void operator delete(void* ptr) + void operator delete(void* ptr, size_t size) { - size_t allocation_size = ((size_t*)ptr)[-1]; MemStatAccumulator* accumulator = DERIVED::sMemStat.getPrimaryAccumulator(); if (accumulator) { - accumulator->mSize -= allocation_size; + accumulator->mSize -= size; accumulator->mAllocatedCount--; accumulator->mDeallocatedCount++; } - deallocAligned<ALIGNMENT, sizeof(size_t)>(ptr); + ::operator delete(ptr); } void *operator new [](size_t size) @@ -779,24 +723,19 @@ public: accumulator->mAllocatedCount++; } - // reserve 4 bytes for allocation size (and preserving requested alignment) - void* allocation = allocAligned<ALIGNMENT, sizeof(size_t)>(size); - ((size_t*)allocation)[-1] = size; - - return allocation; + return ::operator new[](size); } - void operator delete[](void* ptr) + void operator delete[](void* ptr, size_t size) { - size_t* allocation_size = (size_t*)((char*)ptr - 8); MemStatAccumulator* accumulator = DERIVED::sMemStat.getPrimaryAccumulator(); if (accumulator) { - accumulator->mSize -= *allocation_size; + accumulator->mSize -= size; accumulator->mAllocatedCount--; accumulator->mDeallocatedCount++; } - deallocAligned<ALIGNMENT, sizeof(size_t)>(ptr); + ::operator delete[](ptr); } // claim memory associated with other objects/data as our own, adding to our calculated footprint @@ -853,8 +792,6 @@ public: private: size_t mMemFootprint; - - template<typename TRACKED, typename TRACKED_IS_TRACKER = void> struct TrackMemImpl { diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index ef0a633c9c..5d74ea32df 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -291,23 +291,6 @@ U32 Recording::getSampleCount( const TraceType<CountAccumulator<S64> >& stat ) c return (*mMeasurementsFloat)[stat.getIndex()].getSampleCount(); } - -F64 Recording::getPerSec( const TraceType<MeasurementAccumulator<F64> >& stat ) const -{ - F64 sum = (*mMeasurementsFloat)[stat.getIndex()].getSum(); - return (sum != 0.0) - ? (sum / mElapsedSeconds) - : 0.0; -} - -F64 Recording::getPerSec( const TraceType<MeasurementAccumulator<S64> >& stat ) const -{ - S64 sum = (*mMeasurements)[stat.getIndex()].getSum(); - return (sum != 0) - ? ((F64)sum / mElapsedSeconds) - : 0.0; -} - F64 Recording::getMin( const TraceType<MeasurementAccumulator<F64> >& stat ) const { return (*mMeasurementsFloat)[stat.getIndex()].getMin(); @@ -372,41 +355,30 @@ U32 Recording::getSampleCount( const TraceType<MeasurementAccumulator<S64> >& st // PeriodicRecording /////////////////////////////////////////////////////////////////////// -PeriodicRecording::PeriodicRecording( S32 num_periods, EPlayState state) -: mNumPeriods(num_periods), +PeriodicRecording::PeriodicRecording( U32 num_periods, EPlayState state) +: mAutoResize(num_periods == 0), mCurPeriod(0), - mTotalValid(false), - mRecordingPeriods( new Recording[num_periods]) -{ - llassert(mNumPeriods > 0); - setPlayState(state); -} - -PeriodicRecording::PeriodicRecording(PeriodicRecording& other) -: mNumPeriods(other.mNumPeriods), - mCurPeriod(other.mCurPeriod), - mTotalValid(other.mTotalValid), - mTotalRecording(other.mTotalRecording) + mTotalValid(false) { - mRecordingPeriods = new Recording[mNumPeriods]; - for (S32 i = 0; i < mNumPeriods; i++) + if (num_periods) { - mRecordingPeriods[i] = other.mRecordingPeriods[i]; + mRecordingPeriods.resize(num_periods); } + setPlayState(state); } - -PeriodicRecording::~PeriodicRecording() -{ - delete[] mRecordingPeriods; -} - - void PeriodicRecording::nextPeriod() { EPlayState play_state = getPlayState(); Recording& old_recording = getCurRecordingPeriod(); - mCurPeriod = (mCurPeriod + 1) % mNumPeriods; + if (mAutoResize) + { + mRecordingPeriods.push_back(Recording()); + } + U32 num_periods = mRecordingPeriods.size(); + mCurPeriod = (num_periods > 0) + ? (mCurPeriod + 1) % num_periods + : mCurPeriod + 1; old_recording.splitTo(getCurRecordingPeriod()); switch(play_state) @@ -429,9 +401,21 @@ Recording& PeriodicRecording::getTotalRecording() if (!mTotalValid) { mTotalRecording.reset(); - for (S32 i = mCurPeriod + 1; i < mCurPeriod + mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + + if (num_periods) + { + for (S32 i = mCurPeriod + 1; i < mCurPeriod + num_periods; i++) + { + mTotalRecording.appendRecording(mRecordingPeriods[i % num_periods]); + } + } + else { - mTotalRecording.appendRecording(mRecordingPeriods[i % mNumPeriods]); + for (S32 i = 0; i < mCurPeriod; i++) + { + mTotalRecording.appendRecording(mRecordingPeriods[i]); + } } } mTotalValid = true; @@ -547,7 +531,7 @@ void ExtendableRecording::splitFrom(ExtendableRecording& other) PeriodicRecording& get_frame_recording() { - static LLThreadLocalPointer<PeriodicRecording> sRecording(new PeriodicRecording(200, PeriodicRecording::STARTED)); + static LLThreadLocalPointer<PeriodicRecording> sRecording(new PeriodicRecording(1000, PeriodicRecording::STARTED)); return *sRecording; } diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index a5edcb857a..3e7ed2b592 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -100,15 +100,10 @@ private: namespace LLTrace { - struct RecordingBuffers + class RecordingBuffers { + public: RecordingBuffers(); - LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<F64> > > mCountsFloat; - LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<F64> > > mMeasurementsFloat; - LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<S64> > > mCounts; - LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<S64> > > mMeasurements; - LLCopyOnWritePointer<AccumulatorBuffer<TimeBlockAccumulator> > mStackTimers; - LLCopyOnWritePointer<AccumulatorBuffer<MemStatAccumulator> > mMemStats; void handOffTo(RecordingBuffers& other); void makePrimary(); @@ -120,6 +115,13 @@ namespace LLTrace void mergeBuffers(const RecordingBuffers& other); void resetBuffers(RecordingBuffers* other = NULL); + protected: + LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<F64> > > mCountsFloat; + LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<F64> > > mMeasurementsFloat; + LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<S64> > > mCounts; + LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<S64> > > mMeasurements; + LLCopyOnWritePointer<AccumulatorBuffer<TimeBlockAccumulator> > mStackTimers; + LLCopyOnWritePointer<AccumulatorBuffer<MemStatAccumulator> > mMemStats; }; class Recording : public LLStopWatchControlsMixin<Recording>, public RecordingBuffers @@ -182,14 +184,6 @@ namespace LLTrace return (T)getSum(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } - F64 getPerSec(const TraceType<MeasurementAccumulator<F64> >& stat) const; - F64 getPerSec(const TraceType<MeasurementAccumulator<S64> >& stat) const; - template <typename T> - T getPerSec(const MeasurementStatHandle<T>& stat) const - { - return (T)getPerSec(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); - } - F64 getMin(const TraceType<MeasurementAccumulator<F64> >& stat) const; S64 getMin(const TraceType<MeasurementAccumulator<S64> >& stat) const; template <typename T> @@ -255,16 +249,15 @@ namespace LLTrace : public LLStopWatchControlsMixin<PeriodicRecording> { public: - PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); - PeriodicRecording(PeriodicRecording& recording); - ~PeriodicRecording(); + PeriodicRecording(U32 num_periods, EPlayState state = STOPPED); void nextPeriod(); - S32 getNumPeriods() { return mNumPeriods; } + U32 getNumPeriods() { return mRecordingPeriods.size(); } Recording& getLastRecordingPeriod() { - return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; + U32 num_periods = mRecordingPeriods.size(); + return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods]; } const Recording& getLastRecordingPeriod() const @@ -282,16 +275,18 @@ namespace LLTrace return mRecordingPeriods[mCurPeriod]; } - Recording& getPrevRecordingPeriod(S32 offset) + Recording& getPrevRecordingPeriod(U32 offset) { - offset = llclamp(offset, 0, mNumPeriods - 1); - return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; + U32 num_periods = mRecordingPeriods.size(); + offset = llclamp(offset, 0u, num_periods - 1); + return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } - const Recording& getPrevRecordingPeriod(S32 offset) const + const Recording& getPrevRecordingPeriod(U32 offset) const { - offset = llclamp(offset, 0, mNumPeriods - 1); - return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; + U32 num_periods = mRecordingPeriods.size(); + offset = llclamp(offset, 0u, num_periods - 1); + return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } Recording snapshotCurRecordingPeriod() const @@ -307,7 +302,8 @@ namespace LLTrace typename T::value_t getPeriodMin(const TraceType<T>& stat) const { typename T::value_t min_val = (std::numeric_limits<typename T::value_t>::max)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); } @@ -318,7 +314,8 @@ namespace LLTrace F64 getPeriodMinPerSec(const TraceType<T>& stat) const { F64 min_val = (std::numeric_limits<F64>::max)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat)); } @@ -329,7 +326,8 @@ namespace LLTrace typename T::value_t getPeriodMax(const TraceType<T>& stat) const { typename T::value_t max_val = (std::numeric_limits<typename T::value_t>::min)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); } @@ -340,7 +338,8 @@ namespace LLTrace F64 getPeriodMaxPerSec(const TraceType<T>& stat) const { F64 max_val = (std::numeric_limits<F64>::min)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat)); } @@ -351,14 +350,15 @@ namespace LLTrace typename MeanValueType<TraceType<T> >::type getPeriodMean(const TraceType<T>& stat) const { typename MeanValueType<TraceType<T> >::type mean = 0.0; - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) { mean += mRecordingPeriods[i].getSum(stat); } } - mean /= mNumPeriods; + mean /= num_periods; return mean; } @@ -366,14 +366,15 @@ namespace LLTrace typename MeanValueType<TraceType<T> >::type getPeriodMeanPerSec(const TraceType<T>& stat) const { typename MeanValueType<TraceType<T> >::type mean = 0.0; - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) { mean += mRecordingPeriods[i].getPerSec(stat); } } - mean /= mNumPeriods; + mean /= num_periods; return mean; } @@ -388,11 +389,11 @@ namespace LLTrace /*virtual*/ void splitFrom(PeriodicRecording& other); private: - Recording* mRecordingPeriods; + std::vector<Recording> mRecordingPeriods; Recording mTotalRecording; bool mTotalValid; - S32 mNumPeriods, - mCurPeriod; + const bool mAutoResize; + S32 mCurPeriod; }; PeriodicRecording& get_frame_recording(); diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 823550db5d..f86f111b90 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -143,7 +143,7 @@ struct LLUnit void operator *= (LLUnit<OTHER_UNIT, OTHER_STORAGE> multiplicand) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template - llstatic_assert_template(OTHER_UNIT, 0, "Multiplication of unit types not supported."); + llstatic_assert_template(OTHER_UNIT, false, "Multiplication of unit types not supported."); } void operator /= (storage_t divisor) @@ -155,7 +155,7 @@ struct LLUnit void operator /= (LLUnit<OTHER_UNIT, OTHER_STORAGE> divisor) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template - llstatic_assert_template(OTHER_UNIT, 0, "Illegal in-place division of unit types."); + llstatic_assert_template(OTHER_UNIT, false, "Illegal in-place division of unit types."); } template<typename SOURCE_UNITS, typename SOURCE_STORAGE> @@ -315,7 +315,7 @@ template<typename UNIT_TYPE1, typename STORAGE_TYPE1, typename UNIT_TYPE2, typen LLUnit<UNIT_TYPE1, STORAGE_TYPE1> operator * (LLUnit<UNIT_TYPE1, STORAGE_TYPE1>, LLUnit<UNIT_TYPE2, STORAGE_TYPE2>) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template - llstatic_assert_template(STORAGE_TYPE1, 0, "Multiplication of unit types results in new unit type - not supported."); + llstatic_assert_template(STORAGE_TYPE1, false, "Multiplication of unit types results in new unit type - not supported."); return LLUnit<UNIT_TYPE1, STORAGE_TYPE1>(); } @@ -335,7 +335,7 @@ template<typename UNIT_TYPE1, typename STORAGE_TYPE1, typename UNIT_TYPE2, typen LLUnitImplicit<UNIT_TYPE1, STORAGE_TYPE1> operator * (LLUnitImplicit<UNIT_TYPE1, STORAGE_TYPE1>, LLUnitImplicit<UNIT_TYPE2, STORAGE_TYPE2>) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template - llstatic_assert_template(STORAGE_TYPE1, 0, "Multiplication of unit types results in new unit type - not supported."); + llstatic_assert_template(STORAGE_TYPE1, false, "Multiplication of unit types results in new unit type - not supported."); return LLUnitImplicit<UNIT_TYPE1, STORAGE_TYPE1>(); } diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp index 4118896768..b6f2694742 100644 --- a/indra/llimage/tests/llimageworker_test.cpp +++ b/indra/llimage/tests/llimageworker_test.cpp @@ -44,7 +44,7 @@ // * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) // * A simulator for a class can be implemented here. Please comment and document thoroughly. -LLTrace::MemStat LLImageBase::sMemStat("LLImage"); +LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage"); LLImageBase::LLImageBase() diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index c28f121eb8..14fbf344ab 100755 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -44,7 +44,7 @@ // End Stubbing // ------------------------------------------------------------------------------------------- // Stub the LL Image Classes -LLTrace::MemStat LLImageBase::sMemStat("LLImage"); +LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage"); LLImageRaw::LLImageRaw() { } LLImageRaw::~LLImageRaw() { } diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 705fe16559..93ffa7b70d 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -758,11 +758,11 @@ void LLButton::draw() mCurGlowStrength = lerp(mCurGlowStrength, mFlashing ? (flash? 1.0 : 0.0) : mHoverGlowStrength, - LLCriticalDamp::getInterpolant(0.05f)); + LLSmoothInterpolation::getInterpolant(0.05f)); } else { - mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f)); } // Draw button image, if available. diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index e08ccb0b78..06f8e72c9c 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -49,7 +49,6 @@ LLContainerView::LLContainerView(const LLContainerView::Params& p) mLabel(p.label), mDisplayChildren(p.display_children) { - mCollapsible = TRUE; mScrollContainer = NULL; } @@ -75,6 +74,11 @@ bool LLContainerView::addChild(LLView* child, S32 tab_group) return res; } +BOOL LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + return handleMouseDown(x, y, mask); +} + BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -84,7 +88,7 @@ BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) } if (!handled) { - if( mCollapsible && mShowLabel && (y >= getRect().getHeight() - 10) ) + if( mShowLabel && (y >= getRect().getHeight() - 10) ) { setDisplayChildren(!mDisplayChildren); reshape(getRect().getWidth(), getRect().getHeight(), FALSE); diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index e81600fd6c..ac92b19977 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -66,6 +66,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -87,8 +88,5 @@ public: protected: BOOL mDisplayChildren; std::string mLabel; -public: - BOOL mCollapsible; - }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4c730286da..d4a310b8cf 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -42,12 +42,6 @@ static const F32 MAX_FRACTIONAL_SIZE = 1.f; static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack"); static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel"); -void LLLayoutStack::OrientationNames::declareValues() -{ - declare("horizontal", HORIZONTAL); - declare("vertical", VERTICAL); -} - // // LLLayoutPanel // @@ -141,7 +135,7 @@ S32 LLLayoutPanel::getVisibleDim() const + (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt)))); } -void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation ) +void LLLayoutPanel::setOrientation( LLView::EOrientation orientation ) { mOrientation = orientation; S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL) @@ -592,7 +586,7 @@ bool LLLayoutStack::animatePanels() { if (!mAnimatedThisFrame) { - panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant)); + panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant)); if (panelp->mVisibleAmt > 0.99f) { panelp->mVisibleAmt = 1.f; @@ -617,7 +611,7 @@ bool LLLayoutStack::animatePanels() { if (!mAnimatedThisFrame) { - panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); + panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant)); if (panelp->mVisibleAmt < 0.001f) { panelp->mVisibleAmt = 0.f; @@ -644,7 +638,7 @@ bool LLLayoutStack::animatePanels() { if (!mAnimatedThisFrame) { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant)); } if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 648cd5fdce..f1668d7473 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -37,24 +37,13 @@ class LLLayoutPanel; class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> { public: - typedef enum e_layout_orientation - { - HORIZONTAL, - VERTICAL - } ELayoutOrientation; - - struct OrientationNames - : public LLInitParam::TypeValuesHelper<ELayoutOrientation, OrientationNames> - { - static void declareValues(); - }; struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry> {}; struct Params : public LLInitParam::Block<Params, LLView::Params> { - Mandatory<ELayoutOrientation, OrientationNames> orientation; + Mandatory<EOrientation> orientation; Optional<S32> border_size; Optional<bool> animate, clip; @@ -104,7 +93,7 @@ private: bool animatePanels(); void createResizeBar(LLLayoutPanel* panel); - const ELayoutOrientation mOrientation; + const EOrientation mOrientation; typedef std::vector<LLLayoutPanel*> e_panel_list_t; e_panel_list_t mPanels; @@ -179,7 +168,7 @@ public: F32 getVisibleAmount() const; S32 getVisibleDim() const; - void setOrientation(LLLayoutStack::ELayoutOrientation orientation); + void setOrientation(LLView::EOrientation orientation); void storeOriginalDim(); void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; } @@ -198,7 +187,7 @@ protected: F32 mFractionalSize; S32 mTargetDim; bool mIgnoreReshape; - LLLayoutStack::ELayoutOrientation mOrientation; + LLView::EOrientation mOrientation; class LLResizeBar* mResizeBar; }; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index cd6cc6a75e..13888920f9 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3673,7 +3673,7 @@ void LLTearOffMenu::draw() if (getRect().getHeight() != mTargetHeight) { // animate towards target height - reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f)))); + reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f)))); } LLFloater::draw(); } diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index 9fa917eca1..6c97f80e31 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -96,6 +96,3 @@ protected: }; #endif // LL_MULTI_FLOATER_H - - - diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 5d3bf7a670..92a80c73fe 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -493,11 +493,11 @@ void LLScrollbar::draw() BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) { - mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f)); } else { - mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f)); } // Draw background and thumb. diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index ff74f753b9..3f3ca1378b 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -40,13 +40,11 @@ class LLScrollbar { public: - enum ORIENTATION { HORIZONTAL, VERTICAL }; - typedef boost::function<void (S32, LLScrollbar*)> callback_t; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { - Mandatory<ORIENTATION> orientation; + Mandatory<EOrientation> orientation; Mandatory<S32> doc_size; Mandatory<S32> doc_pos; Mandatory<S32> page_size; @@ -131,7 +129,7 @@ private: callback_t mChangeCallback; - const ORIENTATION mOrientation; + const EOrientation mOrientation; S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize. S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size) S32 mPageSize; // Maximum number of lines that can be seen at one time. diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 2fd187a526..2abfb15494 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -140,7 +140,7 @@ LLScrollContainer::~LLScrollContainer( void ) { // mScrolledView and mScrollbar are child views, so the LLView // destructor takes care of memory deallocation. - for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) + for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { mScrollbar[i] = NULL; } @@ -211,7 +211,7 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) { return TRUE; } - for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) + for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { if( mScrollbar[i]->handleKeyHere(key, mask) ) { diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index d87c95b3d7..f9ce4a74ef 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -56,7 +56,6 @@ class LLScrollContainer : public LLUICtrl public: // Note: vertical comes before horizontal because vertical // scrollbars have priority for mouse and keyboard events. - enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -126,7 +125,7 @@ private: void updateScroll(); void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const; - LLScrollbar* mScrollbar[SCROLLBAR_COUNT]; + LLScrollbar* mScrollbar[ORIENTATION_COUNT]; S32 mSize; BOOL mIsOpaque; LLUIColor mBackgroundColor; diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 700c17ea3e..3b492d8182 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -34,8 +34,6 @@ class LLSlider : public LLF32UICtrl { public: - enum ORIENTATION { HORIZONTAL, VERTICAL }; - struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params> { Optional<std::string> orientation; @@ -98,7 +96,7 @@ private: LLPointer<LLUIImage> mTrackHighlightHorizontalImage; LLPointer<LLUIImage> mTrackHighlightVerticalImage; - const ORIENTATION mOrientation; + const EOrientation mOrientation; LLRect mThumbRect; LLUIColor mTrackColor; diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 954f615210..cda40aac72 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -36,6 +36,7 @@ #include "lluictrlfactory.h" #include "lltracerecording.h" +#include "llcriticaldamp.h" /////////////////////////////////////////////////////////////////////////////////// @@ -45,6 +46,7 @@ LLStatBar::LLStatBar(const Params& p) mUnitLabel(p.unit_label), mMinBar(p.bar_min), mMaxBar(p.bar_max), + mCurMaxBar(p.bar_max), mCountFloatp(LLTrace::CountStatHandle<>::getInstance(p.stat)), mCountIntp(LLTrace::CountStatHandle<S64>::getInstance(p.stat)), mMeasurementFloatp(LLTrace::MeasurementStatHandle<>::getInstance(p.stat)), @@ -54,10 +56,14 @@ LLStatBar::LLStatBar(const Params& p) mPrecision(p.precision), mUpdatesPerSec(p.update_rate), mUnitScale(p.unit_scale), + mNumFrames(p.num_frames), + mMaxHeight(p.max_height), mPerSec(p.show_per_sec), mDisplayBar(p.show_bar), mDisplayHistory(p.show_history), - mDisplayMean(p.show_mean) + mDisplayMean(p.show_mean), + mOrientation(p.orientation), + mScaleRange(p.scale_range) {} BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) @@ -82,7 +88,7 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) LLView* parent = getParent(); parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); - return FALSE; + return TRUE; } void LLStatBar::draw() @@ -92,6 +98,7 @@ void LLStatBar::draw() max = 0.f, mean = 0.f; + S32 num_samples = 0; LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); if (mCountFloatp) @@ -104,6 +111,7 @@ void LLStatBar::draw() min = frame_recording.getPeriodMinPerSec(*mCountFloatp); max = frame_recording.getPeriodMaxPerSec(*mCountFloatp); mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp); + num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountFloatp); } else { @@ -111,6 +119,7 @@ void LLStatBar::draw() min = frame_recording.getPeriodMin(*mCountFloatp); max = frame_recording.getPeriodMax(*mCountFloatp); mean = frame_recording.getPeriodMean(*mCountFloatp); + num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountFloatp); } } else if (mCountIntp) @@ -123,6 +132,7 @@ void LLStatBar::draw() min = frame_recording.getPeriodMinPerSec(*mCountIntp); max = frame_recording.getPeriodMaxPerSec(*mCountIntp); mean = frame_recording.getPeriodMeanPerSec(*mCountIntp); + num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountIntp); } else { @@ -130,6 +140,7 @@ void LLStatBar::draw() min = frame_recording.getPeriodMin(*mCountIntp); max = frame_recording.getPeriodMax(*mCountIntp); mean = frame_recording.getPeriodMean(*mCountIntp); + num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountIntp); } } else if (mMeasurementFloatp) @@ -139,6 +150,7 @@ void LLStatBar::draw() min = recording.getMin(*mMeasurementFloatp); max = recording.getMax(*mMeasurementFloatp); mean = recording.getMean(*mMeasurementFloatp); + num_samples = frame_recording.getTotalRecording().getSampleCount(*mMeasurementFloatp); } else if (mMeasurementIntp) { @@ -147,6 +159,7 @@ void LLStatBar::draw() min = recording.getMin(*mMeasurementIntp); max = recording.getMax(*mMeasurementIntp); mean = recording.getMean(*mMeasurementIntp); + num_samples = frame_recording.getTotalRecording().getSampleCount(*mMeasurementIntp); } current *= mUnitScale; @@ -167,15 +180,41 @@ void LLStatBar::draw() mUpdateTimer.reset(); } - S32 width = getRect().getWidth() - 40; - S32 max_width = width; - S32 bar_top = getRect().getHeight() - 15; // 16 pixels from top. - S32 bar_height = bar_top - 20; - S32 tick_height = 4; - S32 tick_width = 1; - S32 left, top, right, bottom; + S32 bar_top, bar_left, bar_right, bar_bottom; + if (mOrientation == HORIZONTAL) + { + bar_top = llmax(5, getRect().getHeight() - 15); + bar_left = 0; + bar_right = getRect().getWidth() - 40; + bar_bottom = llmin(bar_top - 5, 0); + } + else // VERTICAL + { + bar_top = llmax(5, getRect().getHeight() - 15); + bar_left = 0; + bar_right = getRect().getWidth(); + bar_bottom = llmin(bar_top - 5, 20); + } + const S32 tick_length = 4; + const S32 tick_width = 1; + + if (mScaleRange && num_samples) + { + F32 cur_max = mLabelSpacing; + while(max > cur_max) + { + cur_max += mLabelSpacing; + } + mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, cur_max, 0.05f); + } + else + { + mCurMaxBar = mMaxBar; + } - F32 value_scale = max_width/(mMaxBar - mMinBar); + F32 value_scale = (mOrientation == HORIZONTAL) + ? (bar_top - bar_bottom)/(mCurMaxBar - mMinBar) + : (bar_right - bar_left)/(mCurMaxBar - mMinBar); LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), LLFontGL::LEFT, LLFontGL::TOP); @@ -194,9 +233,18 @@ void LLStatBar::draw() } // Draw the value. - LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, width, getRect().getHeight(), - LLColor4(1.f, 1.f, 1.f, 0.5f), - LLFontGL::RIGHT, LLFontGL::TOP); + if (mOrientation == HORIZONTAL) + { + LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(), + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::RIGHT, LLFontGL::TOP); + } + else + { + LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(), + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::RIGHT, LLFontGL::TOP); + } value_format = llformat( "%%.%df", mPrecision); if (mDisplayBar && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp)) @@ -204,131 +252,197 @@ void LLStatBar::draw() std::string tick_label; // Draw the tick marks. - F32 tick_value; - top = bar_top; - bottom = bar_top - bar_height - tick_height/2; - LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mTickSpacing) + for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing) { - left = llfloor((tick_value - mMinBar)*value_scale); - right = left + tick_width; - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.1f)); + const S32 begin = llfloor((tick_value - mMinBar)*value_scale); + const S32 end = begin + tick_width; + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_left, end, bar_right - tick_length/2, begin, LLColor4(1.f, 1.f, 1.f, 0.1f)); + } + else + { + gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length/2, LLColor4(1.f, 1.f, 1.f, 0.1f)); + } } // Draw the tick labels (and big ticks). - bottom = bar_top - bar_height - tick_height; - for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mLabelSpacing) + for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mLabelSpacing) { - left = llfloor((tick_value - mMinBar)*value_scale); - right = left + tick_width; - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.25f)); - + const S32 begin = llfloor((tick_value - mMinBar)*value_scale); + const S32 end = begin + tick_width; tick_label = llformat( value_format.c_str(), tick_value); + // draw labels for the tick marks - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, left - 1, bar_top - bar_height - tick_height, - LLColor4(1.f, 1.f, 1.f, 0.5f), - LLFontGL::LEFT, LLFontGL::TOP); + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f)); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_right, begin, + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::LEFT, LLFontGL::VCENTER); + } + else + { + gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f)); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, begin - 1, bar_bottom - tick_length, + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::RIGHT, LLFontGL::TOP); + } } - // Now, draw the bars - top = bar_top; - bottom = bar_top - bar_height; - // draw background bar. - left = 0; - right = width; - gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_rect_2d(bar_left, bar_top, bar_right, bar_bottom, LLColor4(0.f, 0.f, 0.f, 0.25f)); if (frame_recording.getNumPeriods() == 0) { // No data, don't draw anything... return; } + // draw min and max - left = (S32) ((min - mMinBar) * value_scale); + S32 begin = (S32) ((min - mMinBar) * value_scale); - if (left < 0) + if (begin < 0) { - left = 0; + begin = 0; llwarns << "Min:" << min << llendl; } - right = (S32) ((max - mMinBar) * value_scale); - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 0.25f)); + S32 end = (S32) ((max - mMinBar) * value_scale); + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 0.25f)); + } + else // VERTICAL + { + gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 0.25f)); + } + + F32 span = (mOrientation == HORIZONTAL) + ? (bar_right - bar_left) + : (bar_top - bar_bottom); if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp)) { - S32 num_values = frame_recording.getNumPeriods() - 1; + const S32 num_values = frame_recording.getNumPeriods() - 1; + F32 begin = 0; + F32 end = 0; S32 i; - for (i = 1; i <= num_values; i++) + gGL.color4f( 1.f, 0.f, 0.f, 1.f ); + gGL.begin( LLRender::QUADS ); + const S32 max_frame = llmin(mNumFrames, num_values); + U32 num_samples = 0; + for (i = 1; i <= max_frame; i++) { + F32 offset = ((F32)i / (F32)mNumFrames) * span; + LLTrace::Recording& recording = frame_recording.getPrevRecordingPeriod(i); if (mPerSec) { if (mCountFloatp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1; + begin = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale); + end = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mCountFloatp); } else if (mCountIntp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1; + begin = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale); + end = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mCountIntp); } else if (mMeasurementFloatp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale) + 1; + //rate isn't defined for measurement stats, so use mean + begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mMeasurementFloatp); } else if (mMeasurementIntp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale) + 1; + //rate isn't defined for measurement stats, so use mean + begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale); + end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mMeasurementIntp); } - gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f)); } else { if (mCountFloatp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale) + 1; + begin = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale); + end = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mCountFloatp); } else if (mCountIntp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale) + 1; + begin = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale); + end = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mCountIntp); } else if (mMeasurementFloatp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale) + 1; + begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale); + end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mMeasurementFloatp); } else if (mMeasurementIntp) { - left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale); - right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale) + 1; + begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale); + end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1; + num_samples = recording.getSampleCount(*mMeasurementIntp); } - gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f)); + } + + if (!num_samples) continue; + + if (mOrientation == HORIZONTAL) + { + gGL.vertex2f((F32)bar_right - offset, end); + gGL.vertex2f((F32)bar_right - offset, begin); + gGL.vertex2f((F32)bar_right - offset - 1.f, begin); + gGL.vertex2f((F32)bar_right - offset - 1.f, end); + } + else + { + gGL.vertex2i(begin, (F32)bar_bottom+offset+1.f); + gGL.vertex2i(begin, (F32)bar_bottom+offset); + gGL.vertex2i(end, (F32)bar_bottom+offset); + gGL.vertex2i(end, (F32)bar_bottom+offset+1.f); } } + gGL.end(); } else { + S32 begin = (S32) ((current - mMinBar) * value_scale) - 1; + S32 end = (S32) ((current - mMinBar) * value_scale) + 1; // draw current - left = (S32) ((current - mMinBar) * value_scale) - 1; - right = (S32) ((current - mMinBar) * value_scale) + 1; - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 1.f)); + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 1.f)); + } + else + { + gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 1.f)); + } } // draw mean bar - top = bar_top + 2; - bottom = bar_top - bar_height - 2; - left = (S32) ((mean - mMinBar) * value_scale) - 1; - right = (S32) ((mean - mMinBar) * value_scale) + 1; - gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 1.f, 0.f, 1.f)); + { + const S32 begin = (S32) ((mean - mMinBar) * value_scale) - 1; + const S32 end = (S32) ((mean - mMinBar) * value_scale) + 1; + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_left - 2, begin, bar_right + 2, end, LLColor4(0.f, 1.f, 0.f, 1.f)); + } + else + { + gl_rect_2d(begin, bar_top + 2, end, bar_bottom - 2, LLColor4(0.f, 1.f, 0.f, 1.f)); + } + } } LLView::draw(); @@ -359,7 +473,14 @@ LLRect LLStatBar::getRequiredRect() { if (mDisplayHistory) { - rect.mTop = 35 + LLTrace::get_frame_recording().getNumPeriods(); + if (mOrientation == HORIZONTAL) + { + rect.mTop = mMaxHeight; + } + else + { + rect.mTop = 35 + llmin(mMaxHeight, llmin(mNumFrames, (S32)LLTrace::get_frame_recording().getNumPeriods())); + } } else { diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index c366fd65db..74a3ebde2f 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -52,9 +52,13 @@ public: Optional<bool> show_per_sec, show_bar, show_history, - show_mean; + show_mean, + scale_range; + Optional<S32> num_frames, + max_height; Optional<std::string> stat; + Optional<EOrientation> orientation; Params() : label("label"), @@ -67,10 +71,14 @@ public: update_rate("update_rate", 5.0f), unit_scale("unit_scale", 1.f), show_per_sec("show_per_sec", true), - show_bar("show_bar", TRUE), + show_bar("show_bar", true), show_history("show_history", false), show_mean("show_mean", true), - stat("stat") + scale_range("scale_range", true), + num_frames("num_frames", 300), + max_height("max_height", 200), + stat("stat"), + orientation("orientation", VERTICAL) { changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); } @@ -88,27 +96,32 @@ public: /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. private: - F32 mMinBar; - F32 mMaxBar; - F32 mTickSpacing; - F32 mLabelSpacing; - U32 mPrecision; - F32 mUpdatesPerSec; - F32 mUnitScale; - BOOL mPerSec; // Use the per sec stats. - BOOL mDisplayBar; // Display the bar graph. - BOOL mDisplayHistory; - BOOL mDisplayMean; // If true, display mean, if false, display current value - - LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp; - LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp; + F32 mMinBar; + F32 mMaxBar; + F32 mCurMaxBar; + F32 mTickSpacing; + F32 mLabelSpacing; + U32 mPrecision; + F32 mUpdatesPerSec; + F32 mUnitScale; + S32 mNumFrames; + S32 mMaxHeight; + bool mPerSec; // Use the per sec stats. + bool mDisplayBar; // Display the bar graph. + bool mDisplayHistory; + bool mDisplayMean; // If true, display mean, if false, display current value + bool mScaleRange; + EOrientation mOrientation; + + LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp; + LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp; LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* mMeasurementFloatp; LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* mMeasurementIntp; LLFrameTimer mUpdateTimer; - LLUIString mLabel; - std::string mUnitLabel; - F32 mValue; + LLUIString mLabel; + std::string mUnitLabel; + F32 mValue; }; #endif diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index 22c276a018..bdb378c9c5 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -58,14 +58,6 @@ LLStatGraph::LLStatGraph(const Params& p) { mThresholds.push_back(Threshold(it->value(), it->color)); } - - //mThresholdColors[0] = LLColor4(0.f, 1.f, 0.f, 1.f); - //mThresholdColors[1] = LLColor4(1.f, 1.f, 0.f, 1.f); - //mThresholdColors[2] = LLColor4(1.f, 0.f, 0.f, 1.f); - //mThresholdColors[3] = LLColor4(1.f, 0.f, 0.f, 1.f); - //mThresholds[0] = 50.f; - //mThresholds[1] = 75.f; - //mThresholds[2] = 100.f; } void LLStatGraph::draw() @@ -116,15 +108,6 @@ void LLStatGraph::draw() LLColor4 color; - //S32 i; - //for (i = 0; i < mNumThresholds - 1; i++) - //{ - // if (mThresholds[i] > mValue) - // { - // break; - // } - //} - threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor())); if (it != mThresholds.begin()) diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 57856ff6f2..c9e33ed902 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -57,8 +57,8 @@ public: struct StatParams : public LLInitParam::ChoiceBlock<StatParams> { - Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* > count_stat_float; - Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* > count_stat_int; + Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* > count_stat_float; + Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* > count_stat_int; Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* > measurement_stat_float; Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* > measurement_stat_int; }; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 5fc2cc350d..4df35f77a5 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -406,7 +406,7 @@ void LLTabContainer::draw() } } - setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f))); + setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f))); BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 81ea0ebf0c..2297285c39 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -42,9 +42,9 @@ namespace LLToolBarEnums { - LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType) + LLView::EOrientation getOrientation(SideType sideType) { - LLLayoutStack::ELayoutOrientation orientation = LLLayoutStack::HORIZONTAL; + LLView::EOrientation orientation = LLLayoutStack::HORIZONTAL; if ((sideType == SIDE_LEFT) || (sideType == SIDE_RIGHT)) { @@ -172,7 +172,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) // Initialize the base object LLUICtrl::initFromParams(p); - LLLayoutStack::ELayoutOrientation orientation = getOrientation(p.side); + LLView::EOrientation orientation = getOrientation(p.side); LLLayoutStack::Params centering_stack_p; centering_stack_p.name = "centering_stack"; @@ -524,7 +524,7 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) int rank = 0; // Convert the toolbar coord into button panel coords - LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType); + LLView::EOrientation orientation = getOrientation(mSideType); S32 button_panel_x = 0; S32 button_panel_y = 0; localPointToOtherView(x, y, &button_panel_x, &button_panel_y, mButtonPanel); @@ -643,7 +643,7 @@ void LLToolBar::updateLayoutAsNeeded() { if (!mNeedsLayout) return; - LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType); + LLView::EOrientation orientation = getOrientation(mSideType); // our terminology for orientation-agnostic layout is such that // length refers to a distance in the direction we stack the buttons diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index a50c60282c..2ffcc8b574 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -124,7 +124,7 @@ namespace LLToolBarEnums SIDE_TOP, }; - LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType); + LLView::EOrientation getOrientation(SideType sideType); } // NOTE: This needs to occur before Param block declaration for proper compilation. diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 587953477d..ba88396294 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -83,6 +83,16 @@ template class LLView* LLView::getChild<class LLView>( static LLDefaultChildRegistry::Register<LLView> r("view"); +namespace LLInitParam +{ + void TypeValues<LLView::EOrientation>::declareValues() + { + declare("horizontal", LLView::HORIZONTAL); + declare("vertical", LLView::VERTICAL); + } +} + + LLView::Follows::Follows() : string(""), flags("flags", FOLLOWS_LEFT | FOLLOWS_TOP) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index e18cfff8e5..88813da3c6 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -105,6 +105,9 @@ class LLView public LLTrace::MemTrackable<LLView> // track memory usage { public: + + enum EOrientation { HORIZONTAL, VERTICAL, ORIENTATION_COUNT }; + struct Follows : public LLInitParam::ChoiceBlock<Follows> { Alternative<std::string> string; @@ -676,6 +679,16 @@ public: static LLTrace::MemStatHandle sMemStat; }; +namespace LLInitParam +{ +template<> +struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<LLView::EOrientation> +{ + static void declareValues(); +}; +} + + class LLCompareByTabOrder { public: diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 16d82d5a0a..575400941f 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -239,6 +239,7 @@ set(viewer_SOURCE_FILES llfloaterregiondebugconsole.cpp llfloaterregioninfo.cpp llfloaterreporter.cpp + llfloatersceneloadstats.cpp llfloaterscriptdebug.cpp llfloaterscriptlimits.cpp llfloatersearch.cpp @@ -462,7 +463,7 @@ set(viewer_SOURCE_FILES llremoteparcelrequest.cpp llsavedsettingsglue.cpp llsaveoutfitcombobtn.cpp - llscenemonitor.cpp + llscenemonitor.cpp llsceneview.cpp llscreenchannel.cpp llscriptfloater.cpp @@ -587,7 +588,7 @@ set(viewer_SOURCE_FILES llviewernetwork.cpp llviewerobject.cpp llviewerobjectlist.cpp - llvieweroctree.cpp + llvieweroctree.cpp llviewerparcelmedia.cpp llviewerparcelmediaautoplay.cpp llviewerparcelmgr.cpp @@ -816,6 +817,7 @@ set(viewer_HEADER_FILES llfloaterregiondebugconsole.h llfloaterregioninfo.h llfloaterreporter.h + llfloatersceneloadstats.h llfloaterscriptdebug.h llfloaterscriptlimits.h llfloatersearch.h @@ -1030,7 +1032,7 @@ set(viewer_HEADER_FILES llrootview.h llsavedsettingsglue.h llsaveoutfitcombobtn.h - llscenemonitor.h + llscenemonitor.h llsceneview.h llscreenchannel.h llscriptfloater.h @@ -1155,7 +1157,7 @@ set(viewer_HEADER_FILES llviewernetwork.h llviewerobject.h llviewerobjectlist.h - llvieweroctree.h + llvieweroctree.h llviewerparcelmedia.h llviewerparcelmediaautoplay.h llviewerparcelmgr.h diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 4fb298df13..4e60127ef3 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1046,6 +1046,14 @@ const LLVector3d &LLAgent::getPositionGlobal() const return mPositionGlobal; } +bool LLAgent::isPositionChanged() const +{ + LLVector3d diff; + diff = mPositionGlobal - mLastPositionGlobal; + + return diff.lengthSquared() > 1.0; +} + //----------------------------------------------------------------------------- // getPositionAgent() //----------------------------------------------------------------------------- diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 99904e118c..a1e899b45d 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -250,6 +250,8 @@ public: const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; } void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; } + + bool isPositionChanged() const; private: std::set<U64> mRegionsVisited; // Stat - what distinct regions has the avatar been to? F64 mDistanceTraveled; // Stat - how far has the avatar moved? diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 4e6079e3f2..6648431459 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -336,7 +336,7 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) LLVector3 agent_at_axis = gAgent.getAtAxis(); agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); agent_at_axis.normalize(); - gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); + gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); } setFocusOnAvatar(TRUE, ANIMATE); @@ -1246,7 +1246,7 @@ void LLAgentCamera::updateCamera() gAgentCamera.clearPanKeys(); // lerp camera focus offset - mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); + mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); if ( mCameraMode == CAMERA_MODE_FOLLOW ) { @@ -1364,7 +1364,7 @@ void LLAgentCamera::updateCamera() { const F32 SMOOTHING_HALF_LIFE = 0.02f; - F32 smoothing = LLCriticalDamp::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); + F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); if (!mFocusObject) // we differentiate on avatar mode { @@ -1394,7 +1394,7 @@ void LLAgentCamera::updateCamera() } - mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE)); + mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE)); // llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl; @@ -1809,7 +1809,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (mTargetCameraDistance != mCurrentCameraDistance) { - F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE); + F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE); mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); } @@ -1827,7 +1827,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (isAgentAvatarValid()) { LLVector3d camera_lag_d; - F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE); + F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE); LLVector3 target_lag; LLVector3 vel = gAgent.getVelocity(); @@ -1872,7 +1872,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f)); + mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f)); } camera_lag_d.setVec(mCameraLag); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c00fddbb24..0cb7c7b030 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4210,7 +4210,7 @@ void LLAppViewer::idle() LLFrameTimer::updateFrameCount(); LLEventTimer::updateClass(); LLNotificationsUI::LLToast::updateClass(); - LLCriticalDamp::updateInterpolants(); + LLSmoothInterpolation::updateInterpolants(); LLMortician::updateClass(); LLFilePickerThread::clearDead(); //calls LLFilePickerThread::notify() @@ -4865,7 +4865,7 @@ void LLAppViewer::idleNetwork() gPrintMessagesThisFrame = FALSE; } } - sample(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects); + add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects); // Retransmit unacknowledged packets. gXferManager->retransmitUnackedPackets(); diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 9c3d9f4d34..a0c71b0f73 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -557,7 +557,7 @@ F32 LLDrawable::updateXform(BOOL undamped) if (damped && isVisible()) { - F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); + F32 lerp_amt = llclamp(LLSmoothInterpolation::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt); dist_squared = dist_vec_squared(new_pos, target_pos); diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 3893b0e772..6caa89a611 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -263,7 +263,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) { F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); mScrollIndex = llround( lerp * (F32)(mRecording->getNumPeriods() - MAX_VISIBLE_HISTORY)); - mScrollIndex = llclamp( mScrollIndex, 0, mRecording->getNumPeriods()); + mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording->getNumPeriods()); return TRUE; } mHoverTimer = NULL; @@ -272,7 +272,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) if(mPauseHistory && mBarRect.pointInRect(x, y)) { mHoverBarIndex = llmin((mBarRect.mTop - y) / (mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2)) - 1, - mRecording->getNumPeriods() - 1, + (S32)mRecording->getNumPeriods() - 1, MAX_VISIBLE_HISTORY); if (mHoverBarIndex == 0) { @@ -381,7 +381,7 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) setPauseState(true); mScrollIndex = llclamp( mScrollIndex + clicks, 0, - llmin(mRecording->getNumPeriods(), (S32)mRecording->getNumPeriods() - MAX_VISIBLE_HISTORY)); + llmin((S32)mRecording->getNumPeriods(), (S32)mRecording->getNumPeriods() - MAX_VISIBLE_HISTORY)); return TRUE; } @@ -1128,13 +1128,13 @@ void LLFastTimerView::drawLineGraph() } //interpolate towards new maximum - max_time = lerp(max_time.value(), cur_max.value(), LLCriticalDamp::getInterpolant(0.1f)); + max_time = lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f)); if (max_time - cur_max <= 1 || cur_max - max_time <= 1) { max_time = llmax(LLUnit<LLUnits::Microseconds, F32>(1), LLUnit<LLUnits::Microseconds, F32>(cur_max)); } - max_calls = llround(lerp((F32)max_calls, (F32) cur_max_calls, LLCriticalDamp::getInterpolant(0.1f))); + max_calls = llround(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; @@ -1144,7 +1144,7 @@ void LLFastTimerView::drawLineGraph() F32 alpha_target = (max_time > cur_max) ? llmin(max_time / cur_max - 1.f,1.f) : llmin(cur_max/ max_time - 1.f,1.f); - alpha_interp = lerp(alpha_interp, alpha_target, LLCriticalDamp::getInterpolant(0.1f)); + alpha_interp = lerp(alpha_interp, alpha_target, LLSmoothInterpolation::getInterpolant(0.1f)); if (mHoverID != NULL) { @@ -1425,7 +1425,7 @@ void LLFastTimerView::drawBars() // Special: -1 = show running average LLPointer<LLUIImage> bar_image = LLUI::getUIImage("Rounded_Square"); gGL.getTexUnit(0)->bind(bar_image->getImage()); - const S32 histmax = llmin(mRecording->getNumPeriods(), MAX_VISIBLE_HISTORY) + 1; + const S32 histmax = llmin((S32)mRecording->getNumPeriods(), MAX_VISIBLE_HISTORY) + 1; for (S32 bar_index = 0; bar_index < histmax && y > LINE_GRAPH_HEIGHT; bar_index++) { diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 05d73c2416..e2beb272e6 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -525,11 +525,11 @@ void LLFloaterColorPicker::draw() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); } mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); diff --git a/indra/newview/llfloatersceneloadstats.cpp b/indra/newview/llfloatersceneloadstats.cpp new file mode 100644 index 0000000000..95e8fbf4dd --- /dev/null +++ b/indra/newview/llfloatersceneloadstats.cpp @@ -0,0 +1,37 @@ +/** + * @file llfloatersceneloadstats.cpp + * @author Richard Nelson + * @brief debug floater for measuring various scene load statistics + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatersceneloadstats.h" + + +LLFloaterSceneLoadStats::LLFloaterSceneLoadStats( const LLSD& key ) +: LLFloater(key) +{ + +} diff --git a/indra/newview/llfloatersceneloadstats.h b/indra/newview/llfloatersceneloadstats.h new file mode 100644 index 0000000000..095541f2f6 --- /dev/null +++ b/indra/newview/llfloatersceneloadstats.h @@ -0,0 +1,39 @@ +/** + * @file llfloatersceneloadstats.h + * @brief debug floater for measuring various scene load statistics + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_FLOATERSCENELOADSTATS_H +#define LL_FLOATERSCENELOADSTATS_H + +#include "llfloater.h" + +class LLFloaterSceneLoadStats : public LLFloater +{ + friend class LLFloaterReg; +private: + LLFloaterSceneLoadStats(const LLSD& key); +}; + +#endif // LL_FLOATERSCENELOADSTATS_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 04fc572220..285f52fcd6 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -478,7 +478,7 @@ void LLSnapshotLivePreview::draw() { if (mFlashAlpha < 1.f) { - mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f)); + mFlashAlpha = lerp(mFlashAlpha, 1.f, LLSmoothInterpolation::getInterpolant(0.02f)); } else { @@ -487,7 +487,7 @@ void LLSnapshotLivePreview::draw() } else { - mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f)); + mFlashAlpha = lerp(mFlashAlpha, 0.f, LLSmoothInterpolation::getInterpolant(0.15f)); } // Draw shining animation if appropriate. diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 3aa16b4413..4eb84224bc 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -1293,7 +1293,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) // animate current height towards target height if (llabs(mCurHeight - mTargetHeight) > 1.f) { - mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(mIsOpen ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT)); + mCurHeight = lerp(mCurHeight, mTargetHeight, LLSmoothInterpolation::getInterpolant(mIsOpen ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT)); requestArrange(); @@ -2538,11 +2538,11 @@ void LLFolderViewFolder::draw() } else if (mIsOpen) { - mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f)); + mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLSmoothInterpolation::getInterpolant(0.04f)); } else { - mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f)); + mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLSmoothInterpolation::getInterpolant(0.025f)); } bool possibly_has_children = false; diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp index b670af1782..d6dc964802 100644 --- a/indra/newview/llfollowcam.cpp +++ b/indra/newview/llfollowcam.cpp @@ -328,11 +328,11 @@ void LLFollowCam::update() F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance; */ - F32 focusLagLerp = LLCriticalDamp::getInterpolant( mFocusLag ); + F32 focusLagLerp = LLSmoothInterpolation::getInterpolant( mFocusLag ); focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp ); mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(focus_pt_agent); } - mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(0.05f)); + mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f)); }// if focus is not locked --------------------------------------------- @@ -415,7 +415,7 @@ void LLFollowCam::update() //------------------------------------------------------------------------------------------------- if ( distanceFromPositionToIdealPosition > mPositionThreshold ) { - F32 positionPullLerp = LLCriticalDamp::getInterpolant( mPositionLag ); + F32 positionPullLerp = LLSmoothInterpolation::getInterpolant( mPositionLag ); simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp ); } @@ -435,7 +435,7 @@ void LLFollowCam::update() updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent); mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(simulated_pos_agent); - mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(0.05f)); + mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f)); } // if position is not locked ----------------------------------------------------------- @@ -490,7 +490,7 @@ BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_pos if ( cameraOffsetAngle > mBehindnessMaxAngle ) { - F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(mBehindnessLag); + F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLSmoothInterpolation::getInterpolant(mBehindnessLag); cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT)); cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it constraint_active = TRUE; diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index c12916ec6b..3ac11f906b 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -981,7 +981,7 @@ void LLHUDNameTag::updateAll() // { // continue; // } - (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLCriticalDamp::getInterpolant(POSITION_DAMPING_TC)); + (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLSmoothInterpolation::getInterpolant(POSITION_DAMPING_TC)); } } diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 826e8d560a..0468560e96 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -240,7 +240,7 @@ void LLManipRotate::render() if (mManipPart == LL_ROT_Z) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.pushMatrix(); { // selected part @@ -251,7 +251,7 @@ void LLManipRotate::render() } else if (mManipPart == LL_ROT_Y) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.pushMatrix(); { gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); @@ -262,7 +262,7 @@ void LLManipRotate::render() } else if (mManipPart == LL_ROT_X) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.pushMatrix(); { gGL.rotatef( 90.f, 0.f, 1.f, 0.f ); @@ -273,13 +273,13 @@ void LLManipRotate::render() } else if (mManipPart == LL_ROT_ROLL) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } else if (mManipPart == LL_NO_PART) { if (mHighlightedPart == LL_NO_PART) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } LLGLEnable cull_face(GL_CULL_FACE); @@ -294,7 +294,7 @@ void LLManipRotate::render() { if (mHighlightedPart == LL_ROT_Z) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i); @@ -312,7 +312,7 @@ void LLManipRotate::render() gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); if (mHighlightedPart == LL_ROT_Y) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i); @@ -330,7 +330,7 @@ void LLManipRotate::render() gGL.rotatef( 90.f, 0.f, 1.f, 0.f ); if (mHighlightedPart == LL_ROT_X) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); // hovering over part @@ -346,7 +346,7 @@ void LLManipRotate::render() if (mHighlightedPart == LL_ROT_ROLL) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } } diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 00a0bf8894..2d09fb6fe5 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -535,11 +535,11 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) { if (mHighlightedPart == MANIPULATOR_IDS[i]) { - mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } else { - mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 362308c176..cf5c646893 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1921,18 +1921,18 @@ void LLManipTranslate::renderTranslationHandles() { if (index == mManipPart - LL_X_ARROW || index == mHighlightedPart - LL_X_ARROW) { - mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); - mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); } else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE) { - mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); - mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); } else { - mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); - mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); } } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 1bda7640bd..0abfb59ffd 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -162,7 +162,7 @@ void LLNetMap::draw() static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true); if (auto_center) { - mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(0.1f)); + mCurPan = lerp(mCurPan, mTargetPan, LLSmoothInterpolation::getInterpolant(0.1f)); } // Prepare a scissor region diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 82ab90e325..0145f6f37e 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -37,6 +37,8 @@ #include "llwindow.h" #include "llpointer.h" #include "llspatialpartition.h" +#include "llagent.h" +#include "pipeline.h" LLSceneMonitorView* gSceneMonitorView = NULL; @@ -67,7 +69,10 @@ LLSceneMonitor::LLSceneMonitor() : mDiffPixelRatio(0.5f) { mFrames[0] = NULL; - mFrames[1] = NULL; + mFrames[1] = NULL; + + mRecording = new LLTrace::ExtendableRecording(); + mRecording->start(); } LLSceneMonitor::~LLSceneMonitor() @@ -78,6 +83,10 @@ LLSceneMonitor::~LLSceneMonitor() void LLSceneMonitor::destroyClass() { reset(); + + delete mRecording; + mRecording = NULL; + mDitheringTexture = NULL; } void LLSceneMonitor::reset() @@ -100,6 +109,67 @@ void LLSceneMonitor::reset() } } +void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) +{ +#if 1 + //4 * 4 matrix + mDitherMatrixWidth = 4; + S32 dither_matrix[4][4] = + { + {1, 9, 3, 11}, + {13, 5, 15, 7}, + {4, 12, 2, 10}, + {16, 8, 14, 6} + }; + + mDitherScale = 255.f / 17; +#else + //8 * 8 matrix + mDitherMatrixWidth = 16; + S32 dither_matrix[16][16] = + { + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22}, + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22} + }; + + mDitherScale = 255.f / 65; +#endif + + LLPointer<LLImageRaw> image_raw = new LLImageRaw(mDitherMatrixWidth, mDitherMatrixWidth, 3); + U8* data = image_raw->getData(); + for (S32 i = 0; i < mDitherMatrixWidth; i++) + { + for (S32 j = 0; j < mDitherMatrixWidth; j++) + { + U8 val = dither_matrix[i][j]; + *data++ = val; + *data++ = val; + *data++ = val; + } + } + + mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ; + mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP); + mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT); + + mDitherScaleS = (F32)width / mDitherMatrixWidth; + mDitherScaleT = (F32)height / mDitherMatrixWidth; +} + void LLSceneMonitor::setDebugViewerVisible(BOOL visible) { mDebugViewerVisible = visible; @@ -137,6 +207,11 @@ bool LLSceneMonitor::preCapture() return false; } + if(gAgent.isPositionChanged()) + { + mRecording->reset(); + } + if(timer.getElapsedTimeF32() < mSamplingTime) { return false; @@ -197,6 +272,9 @@ void LLSceneMonitor::freezeScene() // freeze everything else gSavedSettings.setBOOL("FreezeTime", TRUE); + + gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); } void LLSceneMonitor::unfreezeScene() @@ -206,6 +284,9 @@ void LLSceneMonitor::unfreezeScene() // thaw everything else gSavedSettings.setBOOL("FreezeTime", FALSE); + + gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); } void LLSceneMonitor::capture() @@ -268,10 +349,13 @@ void LLSceneMonitor::compare() { mDiff = new LLRenderTarget(); mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); + + generateDitheringTexture(width, height); } else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { mDiff->resize(width, height, GL_RGBA); + generateDitheringTexture(width, height); } mDiff->bindTarget(); @@ -279,6 +363,10 @@ void LLSceneMonitor::compare() gTwoTextureCompareProgram.bind(); + gTwoTextureCompareProgram.uniform1f("dither_scale", mDitherScale); + gTwoTextureCompareProgram.uniform1f("dither_scale_s", mDitherScaleS); + gTwoTextureCompareProgram.uniform1f("dither_scale_t", mDitherScaleT); + gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->bind(mFrames[0]); @@ -289,6 +377,11 @@ void LLSceneMonitor::compare() gGL.getTexUnit(1)->bind(mFrames[1]); gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(2)->activate(); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->bind(mDitheringTexture); + gGL.getTexUnit(2)->activate(); + gl_rect_2d_simple_tex(width, height); mDiff->flush(); @@ -299,6 +392,8 @@ void LLSceneMonitor::compare() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->disable(); + gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); mHasNewDiff = TRUE; @@ -368,6 +463,7 @@ void LLSceneMonitor::calcDiffAggregate() } } +static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { if(!mHasNewQueryResult) @@ -388,6 +484,11 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + if(mDiffResult > 0.01f) + { + mRecording->extend(); + sample(sFramePixelDiff, mDiffResult); + } //llinfos << count << " : " << mDiffResult << llendl; } //------------------------------------------------------------------------------------------------------------- @@ -455,6 +556,11 @@ void LLSceneMonitorView::draw() num_str = llformat("Sampling time: %.3f seconds", LLSceneMonitor::getInstance()->getSamplingTime()); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getAcceptedRecording().getDuration().value()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; LLView::draw(); } diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 02e3d57d46..709650e206 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -31,9 +31,11 @@ #include "llmath.h" #include "llfloater.h" #include "llcharacter.h" +#include "lltracerecording.h" class LLCharacter; class LLRenderTarget; +class LLViewerTexture; class LLSceneMonitor : public LLSingleton<LLSceneMonitor> { @@ -61,11 +63,14 @@ public: bool isEnabled()const {return mEnabled;} bool needsUpdate() const; + LLTrace::ExtendableRecording* getRecording() const {return mRecording;} + private: void freezeScene(); void unfreezeScene(); void reset(); bool preCapture(); + void generateDitheringTexture(S32 width, S32 height); private: BOOL mEnabled; @@ -85,7 +90,15 @@ private: F32 mSamplingTime; //time interval to capture frames, in seconds F32 mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension + LLPointer<LLViewerTexture> mDitheringTexture; + S32 mDitherMatrixWidth; + F32 mDitherScale; + F32 mDitherScaleS; + F32 mDitherScaleT; + std::vector<LLAnimPauseRequest> mAvatarPauseHandles; + + LLTrace::ExtendableRecording* mRecording; }; class LLSceneMonitorView : public LLFloater diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ec36cf48c2..e227722b29 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -549,11 +549,11 @@ void LLFloaterTexturePicker::draw() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); } updateImageStats(); diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 81ad96f39e..da7b259377 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -517,7 +517,7 @@ void LLToolBarView::draw() { if (mToolbars[i]) { - LLLayoutStack::ELayoutOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType()); + LLView::EOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType()); if (orientation == LLLayoutStack::HORIZONTAL) { @@ -535,8 +535,8 @@ void LLToolBarView::draw() for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++) { mToolbars[i]->getParent()->setVisible(mShowToolbars - && (mToolbars[i]->hasButtons() - || isToolDragged())); + && (mToolbars[i]->hasButtons() + || isToolDragged())); } // Draw drop zones if drop of a tool is active diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 2aec25b7aa..0889c3ec6c 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1041,7 +1041,7 @@ void render_hud_attachments() // clamp target zoom level to reasonable values gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f); // smoothly interpolate current zoom level - gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f)); + gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLSmoothInterpolation::getInterpolant(0.03f)); if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 69586e3634..792c55441d 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -28,63 +28,62 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterreg.h" - #include "llviewerfloaterreg.h" -#include "llfloaterautoreplacesettings.h" -#include "llcompilequeue.h" + #include "llcallfloater.h" +#include "llcommandhandler.h" +#include "llcompilequeue.h" #include "llfasttimerview.h" #include "llfloaterabout.h" #include "llfloaterauction.h" +#include "llfloaterautoreplacesettings.h" #include "llfloateravatar.h" #include "llfloateravatarpicker.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" #include "llfloaterbuildoptions.h" +#include "llfloaterbulkpermission.h" +#include "llfloaterbump.h" #include "llfloaterbuy.h" #include "llfloaterbuycontents.h" #include "llfloaterbuycurrency.h" #include "llfloaterbuycurrencyhtml.h" #include "llfloaterbuyland.h" -#include "llfloaterbulkpermission.h" -#include "llfloaterbump.h" #include "llfloaterbvhpreview.h" #include "llfloatercamera.h" #include "llfloaterdeleteenvpreset.h" +#include "llfloaterdestinations.h" #include "llfloaterdisplayname.h" #include "llfloatereditdaycycle.h" #include "llfloatereditsky.h" #include "llfloatereditwater.h" #include "llfloaterenvironmentsettings.h" #include "llfloaterevent.h" -#include "llfloaterdestinations.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" #include "llfloatergroups.h" #include "llfloaterhardwaresettings.h" #include "llfloaterhelpbrowser.h" -#include "llfloaterwebcontent.h" -#include "llfloaterwebprofile.h" -#include "llfloatermediasettings.h" #include "llfloaterhud.h" #include "llfloaterimagepreview.h" -#include "llimfloater.h" #include "llfloaterinspect.h" #include "llfloaterinventory.h" #include "llfloaterjoystick.h" #include "llfloaterland.h" #include "llfloaterlandholdings.h" #include "llfloatermap.h" +#include "llfloatermediasettings.h" #include "llfloatermemleak.h" +#include "llfloatermodelpreview.h" #include "llfloaternamedesc.h" #include "llfloaternotificationsconsole.h" #include "llfloaterobjectweights.h" #include "llfloateropenobject.h" #include "llfloateroutbox.h" #include "llfloaterpathfindingcharacters.h" -#include "llfloaterpathfindinglinksets.h" #include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" #include "llfloaterpay.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" @@ -93,6 +92,7 @@ #include "llfloaterregiondebugconsole.h" #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" +#include "llfloatersceneloadstats.h" #include "llfloaterscriptdebug.h" #include "llfloaterscriptlimits.h" #include "llfloatersearch.h" @@ -107,15 +107,18 @@ #include "llfloatertestlistview.h" #include "llfloatertexturefetchdebugger.h" #include "llfloatertools.h" -#include "llfloatertos.h" #include "llfloatertopobjects.h" +#include "llfloatertos.h" #include "llfloatertoybox.h" #include "llfloatertranslationsettings.h" #include "llfloateruipreview.h" #include "llfloatervoiceeffect.h" +#include "llfloaterwebcontent.h" +#include "llfloaterwebprofile.h" #include "llfloaterwhitelistentry.h" #include "llfloaterwindowsize.h" #include "llfloaterworldmap.h" +#include "llimfloater.h" #include "llimfloatercontainer.h" #include "llinspectavatar.h" #include "llinspectgroup.h" @@ -124,6 +127,7 @@ #include "llinspecttoast.h" #include "llmoveview.h" #include "llnearbychat.h" +#include "llnearbychatbar.h" #include "llpanelblockedlist.h" #include "llpanelclassified.h" #include "llpreviewanim.h" @@ -132,11 +136,8 @@ #include "llpreviewscript.h" #include "llpreviewsound.h" #include "llpreviewtexture.h" -#include "llsyswellwindow.h" #include "llscriptfloater.h" -#include "llfloatermodelpreview.h" -#include "llcommandhandler.h" -#include "llnearbychatbar.h" +#include "llsyswellwindow.h" // *NOTE: Please add files in alphabetical order to keep merges easy. @@ -298,6 +299,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>); + LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSceneLoadStats>); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>); LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index db169b86a4..483e42d296 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4065,7 +4065,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) { LLTracker::stopTracking(NULL); } - else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() ) + else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() && look_at.isExactlyZero()) { //look at the beacon LLVector3 global_agent_pos = agent_pos; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 921c681e2a..0e2c53ee5b 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -88,7 +88,8 @@ LLTrace::CountStatHandle<> FPS("fpsstat"), KILLED("killed", "Number of times killed"), FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"), TEX_BAKES("texbakes"), - TEX_REBAKES("texrebakes"); + TEX_REBAKES("texrebakes"), + NUM_NEW_OBJECTS("numnewobjectsstat"); LLTrace::CountStatHandle<LLTrace::Kilobits> KBIT("kbitstat"), LAYERS_KBIT("layerskbitstat"), OBJECT_KBIT("objectkbitstat"), @@ -133,7 +134,6 @@ LLTrace::MeasurementStatHandle<> FPS_SAMPLE("fpssample"), NUM_RAW_IMAGES("numrawimagesstat"), NUM_OBJECTS("numobjectsstat"), NUM_ACTIVE_OBJECTS("numactiveobjectsstat"), - NUM_NEW_OBJECTS("numnewobjectsstat"), NUM_SIZE_CULLED("numsizeculledstat"), NUM_VIS_CULLED("numvisculledstat"), ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"), diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 069a726e5e..00e8c66b54 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -90,7 +90,8 @@ extern LLTrace::CountStatHandle<> FPS, KILLED, FRAMETIME_DOUBLED, TEX_BAKES, - TEX_REBAKES; + TEX_REBAKES, + NUM_NEW_OBJECTS; extern LLTrace::CountStatHandle<LLTrace::Kilobits> KBIT, @@ -137,7 +138,6 @@ extern LLTrace::MeasurementStatHandle<> FPS_SAMPLE, NUM_RAW_IMAGES, NUM_OBJECTS, NUM_ACTIVE_OBJECTS, - NUM_NEW_OBJECTS, NUM_SIZE_CULLED, NUM_VIS_CULLED, ENABLE_VBO, diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1d43f96fb7..5a07cdf7c9 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2917,7 +2917,7 @@ void LLVOAvatar::idleUpdateWindEffect() LLVector3 velocity = getVelocity(); F32 speed = velocity.length(); //RN: velocity varies too much frame to frame for this to work - mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f)); + mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLSmoothInterpolation::getInterpolant(0.02f)); mLastVel = velocity; LLVector4 wind; wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity); @@ -2940,11 +2940,11 @@ void LLVOAvatar::idleUpdateWindEffect() F32 interp; if (wind.mV[VW] > mWindVec.mV[VW]) { - interp = LLCriticalDamp::getInterpolant(0.2f); + interp = LLSmoothInterpolation::getInterpolant(0.2f); } else { - interp = LLCriticalDamp::getInterpolant(0.4f); + interp = LLSmoothInterpolation::getInterpolant(0.4f); } mWindVec = lerp(mWindVec, wind, interp); @@ -3794,7 +3794,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // Set the root rotation, but do so incrementally so that it // lags in time by some fixed amount. - //F32 u = LLCriticalDamp::getInterpolant(PELVIS_LAG); + //F32 u = LLSmoothInterpolation::getInterpolant(PELVIS_LAG); F32 pelvis_lag_time = 0.f; if (self_in_mouselook) { diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index e088f94d64..aba9df24c9 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1172,7 +1172,7 @@ void send_agent_resume() } // Resume data collection to ignore invalid rates - LLViewerStats::instance().getRecording().resume();//getInstance()->mFPSStat.reset(); + LLViewerStats::instance().getRecording().resume(); LLAppViewer::instance()->resumeMainloopTimeout(); } diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index ccc513b80d..f821cb1ec1 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -302,8 +302,8 @@ void LLWorldMapView::draw() mVisibleRegions.clear(); // animate pan if necessary - sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); - sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); + sPanX = lerp(sPanX, sTargetPanX, LLSmoothInterpolation::getInterpolant(0.1f)); + sPanY = lerp(sPanY, sTargetPanY, LLSmoothInterpolation::getInterpolant(0.1f)); const S32 width = getRect().getWidth(); const S32 height = getRect().getHeight(); diff --git a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml new file mode 100644 index 0000000000..f4021d210a --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml @@ -0,0 +1,484 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater legacy_header_height="18" + can_resize="true" + height="400" + layout="topleft" + name="Scene Load Statistics" + save_rect="true" + save_visibility="true" + title="SCENE LOAD STATISTICS" + width="260"> + <button top="20" + bottom="60" + left="10" + width="100" + label="Pause" + name="playpause"/> + <scroll_container follows="top|left|bottom|right" + bottom="400" + layout="topleft" + left="0" + name="statistics_scroll" + reserve_scroll_corner="true" + top="60" + width="260"> + <container_view follows="top|left|bottom|right" + height="378" + layout="topleft" + left="2" + name="statistics_view" + top="20" + width="245" > +<!--Basic Section--> + <stat_view name="basic" + label="Basic" + show_label="true" + setting="OpenDebugStatBasic"> + <stat_bar name="frame difference" + label="Frame Pixel Difference" + orientation="horizontal" + unit_label="%" + stat="FramePixelDifference" + bar_max="100" + tick_spacing="10" + label_spacing="20" + unit_scale="100" + precision="0"/> + <stat_bar name="bandwidth" + label="Bandwidth" + orientation="horizontal" + unit_label="kbps" + stat="kbitstat" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0"/> + <stat_bar name="packet_loss" + label="Packet Loss" + orientation="horizontal" + unit_label=" %" + stat="packetslostpercentstat" + bar_max="5" + tick_spacing="0.5" + label_spacing="1" + precision="3" + show_bar="false" + show_mean="true"/> + </stat_view> +<!--Advanced Section--> + <stat_view name="advanced" + label="Advanced" + show_label="true" + setting="OpenDebugStatAdvanced"> + <stat_view name="render" + label="Render" + show_label="true" + setting="OpenDebugStatRender"> + <stat_bar name="objs" + label="Total Objects" + orientation="horizontal" + unit_label="" + stat="numobjectsstat" + bar_max="50000" + tick_spacing="5000" + label_spacing="10000" + precision="0" + show_bar="false"/> + <stat_bar name="newobjs" + label="New Objects" + orientation="horizontal" + unit_label="/sec" + stat="numnewobjectsstat" + bar_max="2000" + tick_spacing="200" + label_spacing="400" + show_bar="false"/> + <stat_bar name="object_cache_hits" + label="Object Cache Hit Rate" + orientation="horizontal" + stat="object_cache_hits" + bar_max="100" + unit_label="%" + tick_spacing="20" + label_spacing="20" + show_history="true" + show_bar="false"/> + </stat_view> +<!--Texture Stats--> + <stat_view name="texture" + label="Texture" + show_label="true"> + <stat_bar name="texture_cache_hits" + label="Cache Hit Rate" + orientation="horizontal" + stat="texture_cache_hits" + bar_max="100.f" + unit_label="%" + tick_spacing="20" + label_spacing="20" + show_history="true" + show_bar="false"/> + <stat_bar name="texture_cache_read_latency" + label="Cache Read Latency" + orientation="horizontal" + unit_label="msec" + stat="texture_cache_read_latency" + bar_max="1000.f" + tick_spacing="100" + label_spacing="200" + show_history="true" + show_bar="false"/> + <stat_bar name="numimagesstat" + label="Count" + orientation="horizontal" + stat="numimagesstat" + bar_max="8000.f" + tick_spacing="2000.f" + label_spacing="4000.f" + show_bar="false"/> + <stat_bar name="numrawimagesstat" + label="Raw Count" + orientation="horizontal" + stat="numrawimagesstat" + bar_max="8000.f" + tick_spacing="2000.f" + label_spacing="4000.f" + show_bar="false"/> + </stat_view> +<!--Network Stats--> + <stat_view name="network" + label="Network" + show_label="true" + setting="OpenDebugStatNet"> + <stat_bar name="packetsinstat" + label="Packets In" + orientation="horizontal" + stat="packetsinstat" + unit_label="/sec" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="packetsoutstat" + label="Packets Out" + orientation="horizontal" + stat="packetsoutstat" + unit_label="/sec" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="objectkbitstat" + label="Objects" + orientation="horizontal" + stat="objectkbitstat" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="texturekbitstat" + label="Texture" + orientation="horizontal" + stat="texturekbitstat" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="assetkbitstat" + label="Asset" + orientation="horizontal" + stat="assetkbitstat" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="layerskbitstat" + label="Layers" + orientation="horizontal" + stat="layerskbitstat" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="actualinkbitstat" + label="Actual In" + orientation="horizontal" + stat="actualinkbitstat" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="actualoutkbitstat" + label="Actual Out" + orientation="horizontal" + stat="actualoutkbitstat" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false"/> + <stat_bar name="vfspendingoperations" + label="VFS Pending Operations" + orientation="horizontal" + stat="vfspendingoperations" + unit_label=" Ops." + show_bar="false"/> + </stat_view> + </stat_view> +<!--Sim Stats--> + <stat_view name="sim" + label="Simulator" + show_label="true" + setting="OpenDebugStatSim"> + <stat_bar name="simobjects" + label="Objects" + orientation="horizontal" + stat="simobjects" + precision="0" + bar_max="30000.f" + tick_spacing="5000.f" + label_spacing="10000.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simactiveobjects" + label="Active Objects" + orientation="horizontal" + stat="simactiveobjects" + precision="0" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simactivescripts" + label="Active Scripts" + orientation="horizontal" + stat="simactivescripts" + precision="0" + bar_max="15000.f" + tick_spacing="1875.f" + label_spacing="3750.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="siminpps" + label="Packets In" + orientation="horizontal" + stat="siminpps" + unit_label="pps" + precision="0" + bar_max="2000.f" + tick_spacing="250.f" + label_spacing="1000.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simoutpps" + label="Packets Out" + orientation="horizontal" + stat="simoutpps" + unit_label="pps" + precision="0" + bar_max="2000.f" + tick_spacing="250.f" + label_spacing="1000.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simpendingdownloads" + label="Pending Downloads" + orientation="horizontal" + stat="simpendingdownloads" + precision="0" + bar_max="800.f" + tick_spacing="100.f" + label_spacing="200.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simpendinguploads" + label="Pending Uploads" + orientation="horizontal" + stat="simpendinguploads" + precision="0" + bar_max="100.f" + tick_spacing="25.f" + label_spacing="50.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simtotalunackedbytes" + label="Total Unacked Bytes" + orientation="horizontal" + stat="simtotalunackedbytes" + unit_label="kb" + precision="1" + bar_max="100000.f" + tick_spacing="25000.f" + label_spacing="50000.f" + show_bar="false" + show_mean="false"/> + <stat_view name="simperf" + label="Time (ms)" + show_label="true"> + <stat_bar name="simframemsec" + label="Total Frame Time" + orientation="horizontal" + stat="simframemsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simnetmsec" + label="Net Time" + orientation="horizontal" + stat="simnetmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimphysicsmsec" + label="Physics Time" + orientation="horizontal" + stat="simsimphysicsmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimothermsec" + label="Simulation Time" + orientation="horizontal" + stat="simsimothermsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simagentmsec" + label="Agent Time" + orientation="horizontal" + stat="simagentmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simimagesmsec" + label="Images Time" + orientation="horizontal" + stat="simimagesmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simscriptmsec" + label="Script Time" + orientation="horizontal" + stat="simscriptmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsparemsec" + label="Spare Time" + orientation="horizontal" + stat="simsparemsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> +<!--2nd level time blocks under 'Details' second--> + <stat_view name="timedetails" + label="Time Details (ms)" + show_label="true"> + <stat_bar name="simsimphysicsstepmsec" + label=" Physics Step" + orientation="horizontal" + stat="simsimphysicsstepmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimphysicsshapeupdatemsec" + label=" Update Phys Shapes" + orientation="horizontal" + stat="simsimphysicsshapeupdatemsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimphysicsothermsec" + label=" Physics Other" + orientation="horizontal" + stat="simsimphysicsothermsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsleepmsec" + label=" Sleep Time" + orientation="horizontal" + stat="simsleepmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simpumpiomsec" + label=" Pump IO" + orientation="horizontal" + stat="simpumpiomsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + label_spacing="20.f" + show_bar="false" + show_mean="false"/> + </stat_view> + </stat_view> + </stat_view> + </container_view> + </scroll_container> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index 273954ee3e..a3f2fb0b9c 100644 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -35,6 +35,7 @@ setting="OpenDebugStatBasic"> <stat_bar name="fps" + orientation="horizontal" label="FPS" unit_label="fps" stat="fpsstat" @@ -69,7 +70,6 @@ tick_spacing="0.5" label_spacing="1" precision="3" - show_per_sec="false" show_bar="false" show_mean="true"> </stat_bar> @@ -84,7 +84,6 @@ label_spacing="1000" precision="0" show_bar="false" - show_per_sec="false" show_mean="false"> </stat_bar> </stat_view> @@ -136,7 +135,6 @@ tick_spacing="5000" label_spacing="10000" precision="0" - show_per_sec="false" show_bar="false"> </stat_bar> <stat_bar @@ -148,7 +146,6 @@ bar_max="2000" tick_spacing="200" label_spacing="400" - show_per_sec="true" show_bar="false"> </stat_bar> <stat_bar @@ -161,7 +158,6 @@ tick_spacing="20" label_spacing="20" show_history="true" - show_per_sec="false" show_bar="false"> </stat_bar> </stat_view> @@ -180,7 +176,6 @@ tick_spacing="20" label_spacing="20" show_history="true" - show_per_sec="false" show_bar="false"> </stat_bar> <stat_bar @@ -193,7 +188,6 @@ tick_spacing="100" label_spacing="200" show_history="true" - show_per_sec="false" show_bar="false"> </stat_bar> <stat_bar @@ -204,7 +198,6 @@ bar_max="8000.f" tick_spacing="2000.f" label_spacing="4000.f" - show_per_sec="false" show_bar="false"> </stat_bar> @@ -216,7 +209,6 @@ bar_max="8000.f" tick_spacing="2000.f" label_spacing="4000.f" - show_per_sec="false" show_bar="false"> </stat_bar> @@ -231,7 +223,6 @@ tick_spacing="100.f" label_spacing="200.f" precision="1" - show_per_sec="false" show_bar="false"> </stat_bar> @@ -246,7 +237,6 @@ tick_spacing="100.f" label_spacing="200.f" precision="3" - show_per_sec="false" show_bar="false"> </stat_bar> @@ -261,7 +251,6 @@ tick_spacing="100.f" label_spacing="200.f" precision="3" - show_per_sec="false" show_bar="false"> </stat_bar> @@ -276,7 +265,6 @@ tick_spacing="100.f" label_spacing="200.f" precision="3" - show_per_sec="false" show_bar="false"> </stat_bar> </stat_view> @@ -397,7 +385,6 @@ label="VFS Pending Operations" stat="vfspendingoperations" unit_label=" Ops." - show_per_sec="false" show_bar="false" > </stat_bar> </stat_view> @@ -417,7 +404,6 @@ bar_max="1.f" tick_spacing="0.16666f" label_spacing="0.33333f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -431,7 +417,6 @@ bar_max="45.f" tick_spacing="7.5f" label_spacing="15.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -445,7 +430,6 @@ bar_max="45.f" tick_spacing="7.5.f" label_spacing="15.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -463,7 +447,6 @@ bar_max="500.f" tick_spacing="50.f" label_spacing="100.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -477,7 +460,6 @@ bar_max="500.f" tick_spacing="50.f" label_spacing="100.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -492,7 +474,6 @@ bar_max="1024.f" tick_spacing="128.f" label_spacing="256.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -507,7 +488,6 @@ bar_max="100.f" tick_spacing="25.f" label_spacing="50.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -521,7 +501,6 @@ bar_max="80.f" tick_spacing="10.f" label_spacing="40.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -535,7 +514,6 @@ bar_max="40.f" tick_spacing="5.f" label_spacing="10.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -549,7 +527,6 @@ bar_max="30000.f" tick_spacing="5000.f" label_spacing="10000.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -563,7 +540,6 @@ bar_max="5000.f" tick_spacing="750.f" label_spacing="1250.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -577,7 +553,6 @@ bar_max="15000.f" tick_spacing="1875.f" label_spacing="3750.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -591,7 +566,6 @@ tick_spacing="10" label_spacing="20" precision="3" - show_per_sec="false" show_bar="false" show_mean="true"> </stat_bar> @@ -606,7 +580,6 @@ bar_max="5000.f" tick_spacing="750.f" label_spacing="1250.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -625,7 +598,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -639,7 +611,6 @@ bar_max="45" tick_spacing="4" label_spacing="8" - show_per_sec="false" show_bar="false"> </stat_bar> <stat_bar @@ -652,7 +623,6 @@ tick_spacing="10" label_spacing="20" precision="1" - show_per_sec="false" show_bar="false" show_mean="true"> </stat_bar> @@ -668,7 +638,6 @@ bar_max="2000.f" tick_spacing="250.f" label_spacing="1000.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -683,7 +652,6 @@ bar_max="2000.f" tick_spacing="250.f" label_spacing="1000.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -697,7 +665,6 @@ bar_max="800.f" tick_spacing="100.f" label_spacing="200.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -711,7 +678,6 @@ bar_max="100.f" tick_spacing="25.f" label_spacing="50.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -726,7 +692,6 @@ bar_max="100000.f" tick_spacing="25000.f" label_spacing="50000.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -745,7 +710,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -760,7 +724,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -775,7 +738,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -790,7 +752,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -805,7 +766,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -820,7 +780,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -835,7 +794,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -850,7 +808,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -869,7 +826,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -883,7 +839,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -897,7 +852,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -911,7 +865,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> @@ -925,7 +878,6 @@ bar_max="40.f" tick_spacing="10.f" label_spacing="20.f" - show_per_sec="false" show_bar="false" show_mean="false" > </stat_bar> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 8fe955aed8..5b6a6f908a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1384,6 +1384,14 @@ function="Floater.Toggle" parameter="stats" /> </menu_item_check> + <menu_item_call + label="Scene Load Statistics" + name="Scene Load Statistics" + shortcut="control|shift|2"> + <on_click + function="Floater.Show" + parameter="scene_load_stats" /> + </menu_item_call> <menu_item_check label="Show Draw Weight for Avatars" name="Avatar Rendering Cost"> |