From 9db6bc0557ae5cd4996b5574733dcec6b7f693a7 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Tue, 15 Oct 2013 21:22:18 +0200 Subject: [PATCH 01/62] Add AIStateMachine::mSMDebug The patch is exclusively libcwd related. Turns off output from statemachines to dc::statemachine by default. Allows to turn on the debug output on a per statemachine basis (at compile time). --- indra/aistatemachine/aistatemachine.cpp | 64 +++++++++---------- indra/aistatemachine/aistatemachine.h | 10 ++- indra/aistatemachine/aistatemachinethread.h | 11 +++- indra/aistatemachine/aitimer.h | 8 ++- indra/cwdebug/debug.h | 2 + .../aicurleasyrequeststatemachine.cpp | 9 ++- .../llmessage/aicurleasyrequeststatemachine.h | 2 +- indra/newview/llmeshrepository.cpp | 5 +- .../statemachine/aifetchinventoryfolder.cpp | 2 +- .../statemachine/aifetchinventoryfolder.h | 10 ++- indra/newview/statemachine/aifilepicker.cpp | 6 +- indra/newview/statemachine/aifilepicker.h | 2 +- 12 files changed, 83 insertions(+), 48 deletions(-) diff --git a/indra/aistatemachine/aistatemachine.cpp b/indra/aistatemachine/aistatemachine.cpp index bf867fffd..642be5d2f 100644 --- a/indra/aistatemachine/aistatemachine.cpp +++ b/indra/aistatemachine/aistatemachine.cpp @@ -283,7 +283,7 @@ char const* HelloWorld::state_str_impl(state_type run_state) const void AIEngine::add(AIStateMachine* state_machine) { - Dout(dc::statemachine, "Adding state machine [" << (void*)state_machine << "] to " << mName); + Dout(dc::statemachine(state_machine->mSMDebug), "Adding state machine [" << (void*)state_machine << "] to " << mName); engine_state_type_wat engine_state_w(mEngineState); engine_state_w->list.push_back(QueueElement(state_machine)); if (engine_state_w->waiting) @@ -330,7 +330,7 @@ void AIEngine::mainloop(void) engine_state_type_wat engine_state_w(mEngineState); if (!active) { - Dout(dc::statemachine, "Erasing state machine [" << (void*)&state_machine << "] from " << mName); + Dout(dc::statemachine(state_machine.mSMDebug), "Erasing state machine [" << (void*)&state_machine << "] from " << mName); engine_state_w->list.erase(queued_element++); } else @@ -392,7 +392,7 @@ void AIStateMachine::multiplex(event_type event) // If this fails then you are using a pointer to a state machine instead of an LLPointer. llassert(event == initial_run || getNumRefs() > 0); - DoutEntering(dc::statemachine, "AIStateMachine::multiplex(" << event_str(event) << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::multiplex(" << event_str(event) << ") [" << (void*)this << "]"); base_state_type state; state_type run_state; @@ -407,7 +407,7 @@ void AIStateMachine::multiplex(event_type event) llassert(!mMultiplexMutex.isSelfLocked()); // We may never enter recursively! if (!mMultiplexMutex.tryLock()) { - Dout(dc::statemachine, "Leaving because it is already being run [" << (void*)this << "]"); + Dout(dc::statemachine(mSMDebug), "Leaving because it is already being run [" << (void*)this << "]"); return; } @@ -421,7 +421,7 @@ void AIStateMachine::multiplex(event_type event) // we should indeed run, again. if (event == schedule_run && !sub_state_type_rat(mSubState)->need_run) { - Dout(dc::statemachine, "Leaving because it was already being run [" << (void*)this << "]"); + Dout(dc::statemachine(mSMDebug), "Leaving because it was already being run [" << (void*)this << "]"); return; } @@ -440,9 +440,9 @@ void AIStateMachine::multiplex(event_type event) { #ifdef CWDEBUG if (state == bs_multiplex) - Dout(dc::statemachine, "Running state bs_multiplex / " << state_str_impl(run_state) << " [" << (void*)this << "]"); + Dout(dc::statemachine(mSMDebug), "Running state bs_multiplex / " << state_str_impl(run_state) << " [" << (void*)this << "]"); else - Dout(dc::statemachine, "Running state " << state_str(state) << " [" << (void*)this << "]"); + Dout(dc::statemachine(mSMDebug), "Running state " << state_str(state) << " [" << (void*)this << "]"); #endif #ifdef SHOW_ASSERT @@ -503,7 +503,7 @@ void AIStateMachine::multiplex(event_type event) // run of bs_reset is not a problem because it happens to be a NoOp. state = (state == bs_initialize) ? bs_reset : bs_abort; #ifdef CWDEBUG - Dout(dc::statemachine, "Late abort detected! Running state " << state_str(state) << " instead [" << (void*)this << "]"); + Dout(dc::statemachine(mSMDebug), "Late abort detected! Running state " << state_str(state) << " instead [" << (void*)this << "]"); #endif } #ifdef SHOW_ASSERT @@ -665,7 +665,7 @@ void AIStateMachine::multiplex(event_type event) #ifdef CWDEBUG if (state != state_w->base_state) - Dout(dc::statemachine, "Base state changed from " << state_str(state) << " to " << state_str(state_w->base_state) << + Dout(dc::statemachine(mSMDebug), "Base state changed from " << state_str(state) << " to " << state_str(state_w->base_state) << "; need_new_run = " << (need_new_run ? "true" : "false") << " [" << (void*)this << "]"); #endif } @@ -702,8 +702,8 @@ void AIStateMachine::multiplex(event_type event) } else { - // Remove this state machine from any engine. - // Cause the engine to remove us. + // Remove this state machine from any engine, + // causing the engine to remove us. state_w->current_engine = NULL; } @@ -749,7 +749,7 @@ void AIStateMachine::multiplex(event_type event) AIStateMachine::state_type AIStateMachine::begin_loop(base_state_type base_state) { - DoutEntering(dc::statemachine, "AIStateMachine::begin_loop(" << state_str(base_state) << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::begin_loop(" << state_str(base_state) << ") [" << (void*)this << "]"); sub_state_type_wat sub_state_w(mSubState); // Honor a subsequent call to idle() (only necessary in bs_multiplex, but it doesn't hurt to reset this flag in other states too). @@ -759,7 +759,7 @@ AIStateMachine::state_type AIStateMachine::begin_loop(base_state_type base_state // Honor previous calls to advance_state() (once run_state is initialized). if (base_state == bs_multiplex && sub_state_w->advance_state > sub_state_w->run_state) { - Dout(dc::statemachine, "Copying advance_state to run_state, because it is larger [" << state_str_impl(sub_state_w->advance_state) << " > " << state_str_impl(sub_state_w->run_state) << "]"); + Dout(dc::statemachine(mSMDebug), "Copying advance_state to run_state, because it is larger [" << state_str_impl(sub_state_w->advance_state) << " > " << state_str_impl(sub_state_w->run_state) << "]"); sub_state_w->run_state = sub_state_w->advance_state; } #ifdef SHOW_ASSERT @@ -789,7 +789,7 @@ AIStateMachine::state_type AIStateMachine::begin_loop(base_state_type base_state void AIStateMachine::run(AIStateMachine* parent, state_type new_parent_state, bool abort_parent, bool on_abort_signal_parent, AIEngine* default_engine) { - DoutEntering(dc::statemachine, "AIStateMachine::run(" << + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::run(" << (void*)parent << ", " << (parent ? parent->state_str_impl(new_parent_state) : "NA") << ", abort_parent = " << (abort_parent ? "true" : "false") << @@ -839,7 +839,7 @@ void AIStateMachine::run(AIStateMachine* parent, state_type new_parent_state, bo void AIStateMachine::run(callback_type::signal_type::slot_type const& slot, AIEngine* default_engine) { - DoutEntering(dc::statemachine, "AIStateMachine::run(, default_engine = " << default_engine->name() << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::run(, default_engine = " << default_engine->name() << ") [" << (void*)this << "]"); #ifdef SHOW_ASSERT { @@ -874,7 +874,7 @@ void AIStateMachine::run(callback_type::signal_type::slot_type const& slot, AIEn void AIStateMachine::callback(void) { - DoutEntering(dc::statemachine, "AIStateMachine::callback() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::callback() [" << (void*)this << "]"); bool aborted = sub_state_type_rat(mSubState)->aborted; if (mParent) @@ -920,7 +920,7 @@ void AIStateMachine::force_killed(void) void AIStateMachine::kill(void) { - DoutEntering(dc::statemachine, "AIStateMachine::kill() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::kill() [" << (void*)this << "]"); #ifdef SHOW_ASSERT { multiplex_state_type_rat state_r(mState); @@ -937,7 +937,7 @@ void AIStateMachine::kill(void) void AIStateMachine::reset() { - DoutEntering(dc::statemachine, "AIStateMachine::reset() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::reset() [" << (void*)this << "]"); #ifdef SHOW_ASSERT mDebugAborted = false; mDebugContPending = false; @@ -972,7 +972,7 @@ void AIStateMachine::reset() void AIStateMachine::set_state(state_type new_state) { - DoutEntering(dc::statemachine, "AIStateMachine::set_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::set_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]"); #ifdef SHOW_ASSERT { multiplex_state_type_rat state_r(mState); @@ -999,13 +999,13 @@ void AIStateMachine::set_state(state_type new_state) void AIStateMachine::advance_state(state_type new_state) { - DoutEntering(dc::statemachine, "AIStateMachine::advance_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::advance_state(" << state_str_impl(new_state) << ") [" << (void*)this << "]"); { sub_state_type_wat sub_state_w(mSubState); // Ignore call to advance_state when the currently queued state is already greater or equal to the requested state. if (sub_state_w->advance_state >= new_state) { - Dout(dc::statemachine, "Ignored, because " << state_str_impl(sub_state_w->advance_state) << " >= " << state_str_impl(new_state) << "."); + Dout(dc::statemachine(mSMDebug), "Ignored, because " << state_str_impl(sub_state_w->advance_state) << " >= " << state_str_impl(new_state) << "."); return; } // Ignore call to advance_state when the current state is greater than the requested state: the new state would be @@ -1014,7 +1014,7 @@ void AIStateMachine::advance_state(state_type new_state) // the state change is and should be being ignored: the statemachine would start running it's current state (again). if (sub_state_w->run_state > new_state) { - Dout(dc::statemachine, "Ignored, because " << state_str_impl(sub_state_w->run_state) << " > " << state_str_impl(new_state) << " (current state)."); + Dout(dc::statemachine(mSMDebug), "Ignored, because " << state_str_impl(sub_state_w->run_state) << " > " << state_str_impl(new_state) << " (current state)."); return; } // Increment state. @@ -1048,7 +1048,7 @@ void AIStateMachine::advance_state(state_type new_state) void AIStateMachine::idle(void) { - DoutEntering(dc::statemachine, "AIStateMachine::idle() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::idle() [" << (void*)this << "]"); #ifdef SHOW_ASSERT { multiplex_state_type_rat state_r(mState); @@ -1066,7 +1066,7 @@ void AIStateMachine::idle(void) // Ignore call to idle() when advance_state() was called since last call to set_state(). if (sub_state_w->skip_idle) { - Dout(dc::statemachine, "Ignored, because skip_idle is true (advance_state() was called last)."); + Dout(dc::statemachine(mSMDebug), "Ignored, because skip_idle is true (advance_state() was called last)."); return; } // Mark that we are idle. @@ -1077,7 +1077,7 @@ void AIStateMachine::idle(void) void AIStateMachine::cont(void) { - DoutEntering(dc::statemachine, "AIStateMachine::cont() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::cont() [" << (void*)this << "]"); { sub_state_type_wat sub_state_w(mSubState); // Void last call to idle(), if any. @@ -1097,7 +1097,7 @@ void AIStateMachine::cont(void) void AIStateMachine::abort(void) { - DoutEntering(dc::statemachine, "AIStateMachine::abort() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::abort() [" << (void*)this << "]"); bool is_waiting = false; { multiplex_state_type_rat state_r(mState); @@ -1128,7 +1128,7 @@ void AIStateMachine::abort(void) void AIStateMachine::finish(void) { - DoutEntering(dc::statemachine, "AIStateMachine::finish() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::finish() [" << (void*)this << "]"); #ifdef SHOW_ASSERT { multiplex_state_type_rat state_r(mState); @@ -1147,7 +1147,7 @@ void AIStateMachine::finish(void) void AIStateMachine::yield(void) { - DoutEntering(dc::statemachine, "AIStateMachine::yield() [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield() [" << (void*)this << "]"); multiplex_state_type_rat state_r(mState); // yield() may only be called from multiplex_impl(). llassert(state_r->base_state == bs_multiplex); @@ -1160,7 +1160,7 @@ void AIStateMachine::yield(void) void AIStateMachine::yield(AIEngine* engine) { llassert(engine); - DoutEntering(dc::statemachine, "AIStateMachine::yield(" << engine->name() << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield(" << engine->name() << ") [" << (void*)this << "]"); #ifdef SHOW_ASSERT { multiplex_state_type_rat state_r(mState); @@ -1175,7 +1175,7 @@ void AIStateMachine::yield(AIEngine* engine) void AIStateMachine::yield_frame(unsigned int frames) { - DoutEntering(dc::statemachine, "AIStateMachine::yield_frame(" << frames << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield_frame(" << frames << ") [" << (void*)this << "]"); mSleep = -(S64)frames; // Sleeping is always done from the main thread. yield(&gMainThreadEngine); @@ -1183,7 +1183,7 @@ void AIStateMachine::yield_frame(unsigned int frames) void AIStateMachine::yield_ms(unsigned int ms) { - DoutEntering(dc::statemachine, "AIStateMachine::yield_ms(" << ms << ") [" << (void*)this << "]"); + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield_ms(" << ms << ") [" << (void*)this << "]"); mSleep = get_clock_count() + calc_clock_frequency() * ms / 1000; // Sleeping is always done from the main thread. yield(&gMainThreadEngine); @@ -1233,7 +1233,7 @@ void AIEngine::threadloop(void) engine_state_type_wat engine_state_w(mEngineState); if (!active) { - Dout(dc::statemachine, "Erasing state machine [" << (void*)&state_machine << "] from " << mName); + Dout(dc::statemachine(state_machine.mSMDebug), "Erasing state machine [" << (void*)&state_machine << "] from " << mName); engine_state_w->list.erase(queued_element++); } else diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h index 2b019c91f..0086c03a7 100644 --- a/indra/aistatemachine/aistatemachine.h +++ b/indra/aistatemachine/aistatemachine.h @@ -195,13 +195,21 @@ class AIStateMachine : public LLThreadSafeRefCount bool mDebugAdvanceStatePending; // True while advance_state() was called by not handled yet. bool mDebugRefCalled; // True when ref() is called (or will be called within the critial area of mMultiplexMutex). #endif +#ifdef CWDEBUG + protected: + bool mSMDebug; // Print debug output only when true. +#endif + private: U64 mRuntime; // Total time spent running in the main thread (in clocks). public: - AIStateMachine(void) : mCallback(NULL), mDefaultEngine(NULL), mYieldEngine(NULL), + AIStateMachine(CWD_ONLY(bool debug)) : mCallback(NULL), mDefaultEngine(NULL), mYieldEngine(NULL), #ifdef SHOW_ASSERT mThreadId(AIThreadID::none), mDebugLastState(bs_killed), mDebugShouldRun(false), mDebugAborted(false), mDebugContPending(false), mDebugSetStatePending(false), mDebugAdvanceStatePending(false), mDebugRefCalled(false), +#endif +#ifdef CWDEBUG + mSMDebug(debug), #endif mRuntime(0) { } diff --git a/indra/aistatemachine/aistatemachinethread.h b/indra/aistatemachine/aistatemachinethread.h index 780060bb6..2891cbb77 100644 --- a/indra/aistatemachine/aistatemachinethread.h +++ b/indra/aistatemachine/aistatemachinethread.h @@ -181,7 +181,11 @@ class AIStateMachineThreadBase : public AIStateMachine { static state_type const max_state = wait_stopped + 1; protected: - AIStateMachineThreadBase(void) { } + AIStateMachineThreadBase(CWD_ONLY(bool debug)) +#ifdef CWDEBUG + : AIStateMachine(debug) +#endif + { } private: // Handle initializing the object. @@ -217,7 +221,10 @@ class AIStateMachineThread : public AIStateMachineThreadBase { public: // Constructor. - AIStateMachineThread(void) + AIStateMachineThread(CWD_ONLY(bool debug)) +#ifdef CWDEBUG + : AIStateMachineThreadBase(debug) +#endif { *AIThreadImpl::StateMachineThread_wat(mThreadImpl.mStateMachineThread) = this; } diff --git a/indra/aistatemachine/aitimer.h b/indra/aistatemachine/aitimer.h index 5b028c6e0..3ee510007 100644 --- a/indra/aistatemachine/aitimer.h +++ b/indra/aistatemachine/aitimer.h @@ -76,7 +76,11 @@ class AITimer : public AIStateMachine { F64 mInterval; //!< Input variable: interval after which the event will be generated, in seconds. public: - AITimer(void) : mInterval(0) { DoutEntering(dc::statemachine, "AITimer(void) [" << (void*)this << "]"); } + AITimer(CWD_ONLY(bool debug = false)) : +#ifdef CWDEBUG + AIStateMachine(debug), +#endif + mInterval(0) { DoutEntering(dc::statemachine(mSMDebug), "AITimer(void) [" << (void*)this << "]"); } /** * @brief Set the interval after which the timer should expire. @@ -96,7 +100,7 @@ class AITimer : public AIStateMachine { protected: // Call finish() (or abort()), not delete. - /*virtual*/ ~AITimer() { DoutEntering(dc::statemachine, "~AITimer() [" << (void*)this << "]"); mFrameTimer.cancel(); } + /*virtual*/ ~AITimer() { DoutEntering(dc::statemachine(mSMDebug), "~AITimer() [" << (void*)this << "]"); mFrameTimer.cancel(); } // Handle initializing the object. /*virtual*/ void initialize_impl(void); diff --git a/indra/cwdebug/debug.h b/indra/cwdebug/debug.h index 4167813ea..d3c4e686b 100644 --- a/indra/cwdebug/debug.h +++ b/indra/cwdebug/debug.h @@ -144,6 +144,7 @@ extern LL_COMMON_API fake_channel const snapshot; #define CWDEBUG_MARKER 0 #define BACKTRACE do { } while(0) +#define CWD_ONLY(...) #endif // !DOXYGEN @@ -180,6 +181,7 @@ extern LL_COMMON_API fake_channel const snapshot; #include #define CWD_API __attribute__ ((visibility("default"))) +#define CWD_ONLY(...) __VA_ARGS__ //! Debug specific code. namespace debug { diff --git a/indra/llmessage/aicurleasyrequeststatemachine.cpp b/indra/llmessage/aicurleasyrequeststatemachine.cpp index 0437055f5..294f41586 100644 --- a/indra/llmessage/aicurleasyrequeststatemachine.cpp +++ b/indra/llmessage/aicurleasyrequeststatemachine.cpp @@ -250,10 +250,13 @@ void AICurlEasyRequestStateMachine::finish_impl(void) } } -AICurlEasyRequestStateMachine::AICurlEasyRequestStateMachine(void) : +AICurlEasyRequestStateMachine::AICurlEasyRequestStateMachine(CWD_ONLY(bool debug)) : +#ifdef CWDEBUG + AIStateMachine(debug), +#endif mTotalDelayTimeout(AIHTTPTimeoutPolicy::getDebugSettingsCurlTimeout().getTotalDelay()) { - Dout(dc::statemachine, "Calling AICurlEasyRequestStateMachine(void) [" << (void*)this << "] [" << (void*)mCurlEasyRequest.get() << "]"); + Dout(dc::statemachine(mSMDebug), "Calling AICurlEasyRequestStateMachine(void) [" << (void*)this << "] [" << (void*)mCurlEasyRequest.get() << "]"); AICurlInterface::Stats::AICurlEasyRequestStateMachine_count++; } @@ -264,7 +267,7 @@ void AICurlEasyRequestStateMachine::setTotalDelayTimeout(F32 totalDelayTimeout) AICurlEasyRequestStateMachine::~AICurlEasyRequestStateMachine() { - Dout(dc::statemachine, "Calling ~AICurlEasyRequestStateMachine() [" << (void*)this << "] [" << (void*)mCurlEasyRequest.get() << "]"); + Dout(dc::statemachine(mSMDebug), "Calling ~AICurlEasyRequestStateMachine() [" << (void*)this << "] [" << (void*)mCurlEasyRequest.get() << "]"); --AICurlInterface::Stats::AICurlEasyRequestStateMachine_count; } diff --git a/indra/llmessage/aicurleasyrequeststatemachine.h b/indra/llmessage/aicurleasyrequeststatemachine.h index 662efbe20..9bab7166b 100644 --- a/indra/llmessage/aicurleasyrequeststatemachine.h +++ b/indra/llmessage/aicurleasyrequeststatemachine.h @@ -52,7 +52,7 @@ // Construction of a AICurlEasyRequestStateMachine might throw AICurlNoEasyHandle. class AICurlEasyRequestStateMachine : public AIStateMachine, public AICurlEasyHandleEvents { public: - AICurlEasyRequestStateMachine(void); + AICurlEasyRequestStateMachine(CWD_ONLY(bool debug = false)); // Transparent access. AICurlEasyRequest mCurlEasyRequest; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 55afaecee..80e68f608 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1414,7 +1414,10 @@ void LLMeshUploadThread::preStart() AIMeshUpload::AIMeshUpload(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, std::string const& upload_url, bool do_upload, LLHandle const& fee_observer, LLHandle const& upload_observer) : - mMeshUpload(new AIStateMachineThread), mWholeModelUploadURL(upload_url) +#ifdef CWDEBUG + AIStateMachine(false), +#endif + mMeshUpload(new AIStateMachineThread(CWD_ONLY(false))), mWholeModelUploadURL(upload_url) { mMeshUpload->thread_impl().init(data, scale, upload_textures, upload_skin, upload_joints, do_upload, fee_observer, upload_observer); } diff --git a/indra/newview/statemachine/aifetchinventoryfolder.cpp b/indra/newview/statemachine/aifetchinventoryfolder.cpp index d8e952c0d..840a0249e 100644 --- a/indra/newview/statemachine/aifetchinventoryfolder.cpp +++ b/indra/newview/statemachine/aifetchinventoryfolder.cpp @@ -155,7 +155,7 @@ void AIFetchInventoryFolder::multiplex_impl(state_type run_state) // Create the folder. mFolderUUID = gInventory.createNewCategory(mParentFolder, LLFolderType::FT_NONE, mFolderName); llassert_always(!mFolderUUID.isNull()); - Dout(dc::statemachine, "Created folder \"" << mFolderName << "\"."); + Dout(dc::statemachine(mSMDebug), "Created folder \"" << mFolderName << "\"."); mNeedNotifyObservers = true; } mCreated = true; diff --git a/indra/newview/statemachine/aifetchinventoryfolder.h b/indra/newview/statemachine/aifetchinventoryfolder.h index 2b10c0351..59419fc86 100644 --- a/indra/newview/statemachine/aifetchinventoryfolder.h +++ b/indra/newview/statemachine/aifetchinventoryfolder.h @@ -58,8 +58,12 @@ class AIFetchInventoryFolder : public AIStateMachine { bool mNeedNotifyObservers; public: - AIFetchInventoryFolder(void) : mCreate(false), mFetchContents(false), mExists(false), mCreated(false) - { Dout(dc::statemachine, "Calling AIFetchInventoryFolder constructor [" << (void*)this << "]"); } + AIFetchInventoryFolder(CWD_ONLY(bool debug = false)) : +#ifdef CWDEBUG + AIStateMachine(debug), +#endif + mCreate(false), mFetchContents(false), mExists(false), mCreated(false) + { Dout(dc::statemachine(mSMDebug), "Calling AIFetchInventoryFolder constructor [" << (void*)this << "]"); } /** * @brief Fetch an inventory folder by name, optionally creating it. @@ -132,7 +136,7 @@ class AIFetchInventoryFolder : public AIStateMachine { protected: // Call finish() (or abort()), not delete. - /*virtual*/ ~AIFetchInventoryFolder() { Dout(dc::statemachine, "Calling ~AIFetchInventoryFolder() [" << (void*)this << "]"); } + /*virtual*/ ~AIFetchInventoryFolder() { Dout(dc::statemachine(mSMDebug), "Calling ~AIFetchInventoryFolder() [" << (void*)this << "]"); } // Handle initializing the object. /*virtual*/ void initialize_impl(void); diff --git a/indra/newview/statemachine/aifilepicker.cpp b/indra/newview/statemachine/aifilepicker.cpp index 636fc2343..6754142e4 100644 --- a/indra/newview/statemachine/aifilepicker.cpp +++ b/indra/newview/statemachine/aifilepicker.cpp @@ -60,7 +60,11 @@ char const* AIFilePicker::state_str_impl(state_type run_state) const return "UNKNOWN STATE"; } -AIFilePicker::AIFilePicker(void) : mPluginManager(NULL), mCanceled(false) +AIFilePicker::AIFilePicker(CWD_ONLY(bool debug)) : +#ifdef CWDEBUG + AIStateMachine(debug), +#endif + mPluginManager(NULL), mCanceled(false) { } diff --git a/indra/newview/statemachine/aifilepicker.h b/indra/newview/statemachine/aifilepicker.h index cd1c7fe86..9ef02017b 100644 --- a/indra/newview/statemachine/aifilepicker.h +++ b/indra/newview/statemachine/aifilepicker.h @@ -168,7 +168,7 @@ public: public: // The derived class must have a default constructor. - AIFilePicker(void); + AIFilePicker(CWD_ONLY(bool debug = false)); // Create a dynamically created AIFilePicker object. static AIFilePicker* create(void) { AIFilePicker* filepicker = new AIFilePicker; return filepicker; } From 9114f04ef68faacd9a8a1bd1c23b6b620ee0eaab Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Tue, 15 Oct 2013 21:47:14 +0200 Subject: [PATCH 02/62] Add AIStateMachine::yield_if_not This can be used to switch to a specific engine. If the state machine is not running in the passed engine, then it performs a yield to that engine, otherwise it keeps running. Hence, putting this at the top of a state guarantees that it runs in that engine. For example: case FrontEnd_done: { // Unlock must be called by the same thread that locked it. if (yield_if_not(&gStateMachineThreadEngine)) { break; } // Here we are running in gStateMachineThreadEngine. ... --- indra/aistatemachine/aistatemachine.cpp | 10 ++++++++++ indra/aistatemachine/aistatemachine.h | 1 + 2 files changed, 11 insertions(+) diff --git a/indra/aistatemachine/aistatemachine.cpp b/indra/aistatemachine/aistatemachine.cpp index 642be5d2f..cec58baec 100644 --- a/indra/aistatemachine/aistatemachine.cpp +++ b/indra/aistatemachine/aistatemachine.cpp @@ -1173,6 +1173,16 @@ void AIStateMachine::yield(AIEngine* engine) mYieldEngine = engine; } +bool AIStateMachine::yield_if_not(AIEngine* engine) +{ + if (engine && multiplex_state_type_rat(mState)->current_engine != engine) + { + yield(engine); + return true; + } + return false; +} + void AIStateMachine::yield_frame(unsigned int frames) { DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::yield_frame(" << frames << ") [" << (void*)this << "]"); diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h index 0086c03a7..2e5a47acc 100644 --- a/indra/aistatemachine/aistatemachine.h +++ b/indra/aistatemachine/aistatemachine.h @@ -237,6 +237,7 @@ class AIStateMachine : public LLThreadSafeRefCount void yield(AIEngine* engine); // Yield to give CPU to other state machines, but do not go idle. Continue running from engine 'engine'. void yield_frame(unsigned int frames); // Run from the main-thread engine after at least 'frames' frames have passed. void yield_ms(unsigned int ms); // Run from the main-thread engine after roughly 'ms' miliseconds have passed. + bool yield_if_not(AIEngine* engine); // Do not really yield, unless the current engine is not 'engine'. Returns true if it switched engine. public: // This function can be called from multiplex_imp(), but also by a child state machine and From 09708b6318f4e27d58672ffee3bbd567ddce9c88 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Tue, 15 Oct 2013 19:05:17 +0200 Subject: [PATCH 03/62] Added AICondition. AICondition is like AIThreadSafeSimpleDC (it is derived from it), and wraps some variable, protecting it with a builtin mutex. While in a statemachine, one can call wait(condition) to make the state machine go idle, and call condition.signal() to wake it (or another) up again. While normally a condition variable is used as follows: condition.lock(); while (!whatwerewaitingfor) { condition.wait(); } // Here the condition is guaranteed to be true and we're // still in the critical area of the mutex. condition.unlock(); where the thread blocks in wait(), the statemachine actually returns CPU to the thread (the AIEngine), so there is no while loop involved, and our wait() doesn't even unlock the mutex: that happens because the state machine returns: condition_wat condition_w(condition); // Lock condition. if (!condition_w->whatwerewaitingfor()) // The variable(s) involved can only be accessed when condition is locked. { wait(condition); // Causes the state machine to go idle. This does not block. break; // Leave scope (unlock condition) and return to the mainloop - but as idle state machine. } // Here the condition is guaranteed to be true and we're // still in the critical area of the condition variable. In this case, when condition.signal() is called, the thread doesn't return from wait() with a locked mutex - but the statemachine executes the same state again, and enters from the top: locking the condition and doing the test again, just like it would be when this was a while loop. --- indra/aistatemachine/CMakeLists.txt | 2 + indra/aistatemachine/aicondition.cpp | 88 +++++++++++++++++++ indra/aistatemachine/aicondition.h | 110 ++++++++++++++++++++++++ indra/aistatemachine/aistatemachine.cpp | 94 ++++++++++++++++++++ indra/aistatemachine/aistatemachine.h | 6 +- 5 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 indra/aistatemachine/aicondition.cpp create mode 100644 indra/aistatemachine/aicondition.h diff --git a/indra/aistatemachine/CMakeLists.txt b/indra/aistatemachine/CMakeLists.txt index 6db29a007..806261201 100644 --- a/indra/aistatemachine/CMakeLists.txt +++ b/indra/aistatemachine/CMakeLists.txt @@ -21,6 +21,7 @@ set(aistatemachine_SOURCE_FILES aistatemachine.cpp aistatemachinethread.cpp aitimer.cpp + aicondition.cpp ) set(aistatemachine_HEADER_FILES @@ -29,6 +30,7 @@ set(aistatemachine_HEADER_FILES aistatemachine.h aistatemachinethread.h aitimer.h + aicondition.h ) set_source_files_properties(${aistatemachine_HEADER_FILES} diff --git a/indra/aistatemachine/aicondition.cpp b/indra/aistatemachine/aicondition.cpp new file mode 100644 index 000000000..fa35104a8 --- /dev/null +++ b/indra/aistatemachine/aicondition.cpp @@ -0,0 +1,88 @@ +/** + * @file aicondition.cpp + * @brief Implementation of AICondition + * + * Copyright (c) 2013, Aleric Inglewood. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution. + * + * CHANGELOG + * and additional copyright holders. + * + * 14/10/2013 + * Initial version, written by Aleric Inglewood @ SL + */ + +#include "aicondition.h" +#include "aistatemachine.h" + +void AIConditionBase::wait(AIStateMachine* state_machine) +{ + // The condition must be locked before calling AIStateMachine::wait(). + llassert(mutex().isSelfLocked()); + // Add the new state machine at the end. + mWaitingStateMachines.push_back(state_machine); +} + +void AIConditionBase::remove(AIStateMachine* state_machine) +{ + mutex().lock(); + // Remove all occurances of state_machine from the queue. + queue_t::iterator const end = mWaitingStateMachines.end(); + queue_t::iterator last = end; + for (queue_t::iterator iter = mWaitingStateMachines.begin(); iter != last; ++iter) + { + if (iter->get() == state_machine) + { + if (--last == iter) + { + break; + } + queue_t::value_type::swap(*iter, *last); + } + } + // This invalidates all iterators involved, including end, but not any iterators to the remaining elements. + mWaitingStateMachines.erase(last, end); + mutex().unlock(); +} + +void AIConditionBase::signal(int n) +{ + // The condition must be locked before calling AICondition::signal or AICondition::broadcast. + llassert(mutex().isSelfLocked()); + // Signal n state machines. + while (n > 0 && !mWaitingStateMachines.empty()) + { + LLPointer state_machine = mWaitingStateMachines.front(); + bool success = state_machine->signalled(); + // Only state machines that are actually still blocked should be in the queue: + // they are removed from the queue by calling AICondition::remove whenever + // they are unblocked for whatever reason... + llassert(success); + if (success) + { + ++n; + } + else + { + // We never get here... + remove(state_machine.get()); + } + } +} + diff --git a/indra/aistatemachine/aicondition.h b/indra/aistatemachine/aicondition.h new file mode 100644 index 000000000..05dd9ea42 --- /dev/null +++ b/indra/aistatemachine/aicondition.h @@ -0,0 +1,110 @@ +/** + * @file aicondition.h + * @brief Condition variable for statemachines. + * + * Copyright (c) 2013, Aleric Inglewood. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution. + * + * CHANGELOG + * and additional copyright holders. + * + * 14/10/2013 + * Initial version, written by Aleric Inglewood @ SL + */ + +#ifndef AICONDITION_H +#define AICONDITION_H + +#include +#include +#include "aithreadsafe.h" + +class AIStateMachine; +class LLMutex; + +// class AICondition +// +// Call AIStateMachine::wait(AICondition&) in the multiplex_impl of a state machine to +// make the state machine go idle until some thread calls AICondition::signal(). +// +// If the state machine is no longer running or wasn't waiting anymore because +// something else woke it up, then AICondition::signal() will wake up another +// state machine (if any). +// +// Usage: +// +// struct Foo { bool met(); }; // Returns true when the condition is met. +// AICondition Condition_t; +// AIAccess Condition_wat; +// +// // Some thread-safe condition variable. +// Condition_t condition; +// +// // Inside the state machine: +// { +// ... +// state WAIT_FOR_CONDITION: +// { +// // Lock condition and check it. Wait if condition is not met yet. +// { +// Condition_wat condition_w(condition); +// if (!condition_w->met()) +// { +// wait(condition); +// break; +// } +// } +// set_state(CONDITION_MET); +// break; +// } +// CONDITION_MET: +// { +// + +class AIConditionBase +{ + public: + virtual ~AIConditionBase() { } + + void signal(int n = 1); // Call this when the condition was met to release n state machines. + void broadcast(void) { signal(mWaitingStateMachines.size()); } // Release all blocked state machines. + + private: + // These functions are called by AIStateMachine. + friend class AIStateMachine; + void wait(AIStateMachine* state_machine); + void remove(AIStateMachine* state_machine); + + protected: + virtual LLMutex& mutex(void) = 0; + + protected: + typedef std::deque > queue_t; + queue_t mWaitingStateMachines; +}; + +template +class AICondition : public AIThreadSafeSimpleDC, public AIConditionBase +{ + protected: + /*virtual*/ LLMutex& mutex(void) { return this->mMutex; } +}; + +#endif + diff --git a/indra/aistatemachine/aistatemachine.cpp b/indra/aistatemachine/aistatemachine.cpp index cec58baec..d5e9726e3 100644 --- a/indra/aistatemachine/aistatemachine.cpp +++ b/indra/aistatemachine/aistatemachine.cpp @@ -33,6 +33,7 @@ #include "linden_common.h" #include "aistatemachine.h" +#include "aicondition.h" #include "lltimer.h" //================================================================== @@ -960,6 +961,8 @@ void AIStateMachine::reset() sub_state_w->reset = true; // Start running. sub_state_w->idle = false; + // We're not waiting for a condition. + sub_state_w->blocked = NULL; // Keep running till we reach at least bs_multiplex. sub_state_w->need_run = true; } @@ -983,6 +986,8 @@ void AIStateMachine::set_state(state_type new_state) } #endif sub_state_type_wat sub_state_w(mSubState); + // It should never happen that set_state() is called while we're blocked. + llassert(!sub_state_w->blocked); // Force current state to the requested state. sub_state_w->run_state = new_state; // Void last call to advance_state. @@ -1023,6 +1028,13 @@ void AIStateMachine::advance_state(state_type new_state) sub_state_w->idle = false; // Ignore a call to idle if it occurs before we leave multiplex_impl(). sub_state_w->skip_idle = true; + // No longer say we woke up when signalled() is called. + if (sub_state_w->blocked) + { + Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked); + sub_state_w->blocked->remove(this); + sub_state_w->blocked = NULL; + } // Mark that a re-entry of multiplex() is necessary. sub_state_w->need_run = true; #ifdef SHOW_ASSERT @@ -1075,6 +1087,40 @@ void AIStateMachine::idle(void) mSleep = 0; } +// This function is very much like idle(). +void AIStateMachine::wait(AIConditionBase& condition) +{ + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::wait(" << (void*)&condition << ") [" << (void*)this << "]"); +#ifdef SHOW_ASSERT + { + multiplex_state_type_rat state_r(mState); + // wait() may only be called multiplex_impl(). + llassert(state_r->base_state == bs_multiplex); + // May only be called by the thread that is holding mMultiplexMutex. + llassert(mThreadId.equals_current_thread()); + } + // wait() following set_state() cancels the reason to run because of the call to set_state. + mDebugSetStatePending = false; +#endif + sub_state_type_wat sub_state_w(mSubState); + // As wait() may only be called from within the state machine, it should never happen that the state machine is already idle. + llassert(!sub_state_w->idle); + // Ignore call to wait() when advance_state() was called since last call to set_state(). + if (sub_state_w->skip_idle) + { + Dout(dc::statemachine(mSMDebug), "Ignored, because skip_idle is true (advance_state() was called last)."); + return; + } + // Register ourselves with the condition object. + condition.wait(this); + // Mark that we are idle. + sub_state_w->idle = true; + // Mark that we are waiting for a condition. + sub_state_w->blocked = &condition; + // Not sleeping (anymore). + mSleep = 0; +} + void AIStateMachine::cont(void) { DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::cont() [" << (void*)this << "]"); @@ -1082,6 +1128,13 @@ void AIStateMachine::cont(void) sub_state_type_wat sub_state_w(mSubState); // Void last call to idle(), if any. sub_state_w->idle = false; + // No longer say we woke up when signalled() is called. + if (sub_state_w->blocked) + { + Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked); + sub_state_w->blocked->remove(this); + sub_state_w->blocked = NULL; + } // Mark that a re-entry of multiplex() is necessary. sub_state_w->need_run = true; #ifdef SHOW_ASSERT @@ -1095,6 +1148,40 @@ void AIStateMachine::cont(void) } } +// This function is very much like cont(), except that it has no effect when we are not in a blocked state. +// Returns true if the state machine was unblocked, false if it was already unblocked. +bool AIStateMachine::signalled(void) +{ + DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::signalled() [" << (void*)this << "]"); + { + sub_state_type_wat sub_state_w(mSubState); + // Test if we are blocked or not. + if (sub_state_w->blocked) + { + Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked); + sub_state_w->blocked->remove(this); + sub_state_w->blocked = NULL; + } + else + { + return false; + } + // Void last call to wait(). + sub_state_w->idle = false; + // Mark that a re-entry of multiplex() is necessary. + sub_state_w->need_run = true; +#ifdef SHOW_ASSERT + // From this moment. + mDebugContPending = true; +#endif + } + if (!mMultiplexMutex.isSelfLocked()) + { + multiplex(schedule_run); + } + return true; +} + void AIStateMachine::abort(void) { DoutEntering(dc::statemachine(mSMDebug), "AIStateMachine::abort() [" << (void*)this << "]"); @@ -1104,6 +1191,13 @@ void AIStateMachine::abort(void) sub_state_type_wat sub_state_w(mSubState); // Mark that we are aborted, iff we didn't already finish. sub_state_w->aborted = !sub_state_w->finished; + // No longer say we woke up when signalled() is called. + if (sub_state_w->blocked) + { + Dout(dc::statemachine(mSMDebug), "Removing statemachine from condition " << (void*)sub_state_w->blocked); + sub_state_w->blocked->remove(this); + sub_state_w->blocked = NULL; + } // Mark that a re-entry of multiplex() is necessary. sub_state_w->need_run = true; // Schedule a new run when this state machine is waiting. diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h index 2e5a47acc..dfac7ecb5 100644 --- a/indra/aistatemachine/aistatemachine.h +++ b/indra/aistatemachine/aistatemachine.h @@ -39,6 +39,7 @@ #include #include +class AIConditionBase; class AIStateMachine; class AIEngine @@ -132,6 +133,7 @@ class AIStateMachine : public LLThreadSafeRefCount struct sub_state_type { state_type run_state; state_type advance_state; + AIConditionBase* blocked; bool reset; bool need_run; bool idle; @@ -232,6 +234,7 @@ class AIStateMachine : public LLThreadSafeRefCount void set_state(state_type new_state); // Run this state the NEXT loop. // These functions can only be called from within multiplex_impl(). void idle(void); // Go idle unless cont() or advance_state() were called since the start of the current loop, or until they are called. + void wait(AIConditionBase& condition); // The same as idle(), but wake up when AICondition::signal() is called. void finish(void); // Mark that the state machine finished and schedule the call back. void yield(void); // Yield to give CPU to other state machines, but do not go idle. void yield(AIEngine* engine); // Yield to give CPU to other state machines, but do not go idle. Continue running from engine 'engine'. @@ -245,11 +248,12 @@ class AIStateMachine : public LLThreadSafeRefCount // to access this state machine. void abort(void); // Abort the state machine (unsuccessful finish). - // These are the only two functions that can be called by any thread at any moment. + // These are the only three functions that can be called by any thread at any moment. // Those threads should use an LLPointer to access this state machine. void cont(void); // Guarantee at least one full run of multiplex() after this function is called. Cancels the last call to idle(). void advance_state(state_type new_state); // Guarantee at least one full run of multiplex() after this function is called // iff new_state is larger than the last state that was processed. + bool signalled(void); // Call cont() iff this state machine is still blocked after a call to wait(). Returns false if it already unblocked. public: // Accessors. From 811f6701995cd7056883035ee41ef446fbe14154 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Wed, 16 Oct 2013 00:05:35 +0200 Subject: [PATCH 04/62] AIStateMachine fixes. Things (one debug code only) that don't happen currently, but that I ran into with AIMultiGrid. --- indra/aistatemachine/aistatemachine.cpp | 4 ++++ indra/aistatemachine/aistatemachine.h | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/indra/aistatemachine/aistatemachine.cpp b/indra/aistatemachine/aistatemachine.cpp index d5e9726e3..fcdb2d9c8 100644 --- a/indra/aistatemachine/aistatemachine.cpp +++ b/indra/aistatemachine/aistatemachine.cpp @@ -700,6 +700,10 @@ void AIStateMachine::multiplex(event_type event) // Mark that we're added to this engine, and at the same time, that we're not added to the previous one. state_w->current_engine = engine; } +#ifdef SHOW_ASSERT + // We are leaving the loop, but we're not idle. The statemachine should re-enter the loop again. + mDebugShouldRun = true; +#endif } else { diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h index dfac7ecb5..047fe0515 100644 --- a/indra/aistatemachine/aistatemachine.h +++ b/indra/aistatemachine/aistatemachine.h @@ -217,8 +217,16 @@ class AIStateMachine : public LLThreadSafeRefCount { } protected: - // The user should call finish() (or abort(), or kill() from the call back when finish_impl() calls run()), not delete a class derived from AIStateMachine directly. - virtual ~AIStateMachine() { llassert(multiplex_state_type_rat(mState)->base_state == bs_killed); } + // The user should call finish() (or abort(), or kill() from the call back when finish_impl() calls run()), + // not delete a class derived from AIStateMachine directly. Deleting it directly before calling run() is + // ok however. + virtual ~AIStateMachine() + { +#ifdef SHOW_ASSERT + base_state_type state = multiplex_state_type_rat(mState)->base_state; + llassert(state == bs_killed || state == bs_reset); +#endif + } public: // These functions may be called directly after creation, or from within finish_impl(), or from the call back function. From ec5aaa2af8818417286b276c7661b376cfdee172 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 18 Oct 2013 08:20:19 -0400 Subject: [PATCH 05/62] Modernize LLSelectMgr and fix leaks --- indra/newview/llselectmgr.cpp | 22 +++++++++++----------- indra/newview/llselectmgr.h | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 7bd68ad4a..84d0e2455 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -214,7 +214,6 @@ LLSelectMgr::LLSelectMgr() mGridMode = GRID_MODE_WORLD; gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD); - mGridValid = FALSE; mSelectedObjects = new LLObjectSelection(); mHoverObjects = new LLObjectSelection(); @@ -1202,7 +1201,6 @@ void LLSelectMgr::setGridMode(EGridMode mode) mGridMode = mode; gSavedSettings.setS32("GridMode", mode); updateSelectionCenter(); - mGridValid = FALSE; } void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &scale) @@ -1303,7 +1301,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & origin = mGridOrigin; rotation = mGridRotation; scale = mGridScale; - mGridValid = TRUE; } //----------------------------------------------------------------------------- @@ -3410,13 +3407,13 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, case 0: { // TODO: Make sure you have delete permissions on all of them. - LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); // attempt to derez into the trash. - LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id); + LLDeRezInfo info(DRD_TRASH, trash_id); LLSelectMgr::getInstance()->sendListToRegions("DeRezObject", packDeRezHeader, packObjectLocalID, - (void*)info, + (void*) &info, SEND_ONLY_ROOTS); // VEFFECT: Delete Object - one effect for all deletes if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) @@ -4164,13 +4161,15 @@ void LLSelectMgr::deselectAllIfTooFar() void LLSelectMgr::selectionSetObjectName(const std::string& name) { + std::string name_copy(name); + // we only work correctly if 1 object is selected. if(mSelectedObjects->getRootObjectCount() == 1) { sendListToRegions("ObjectName", packAgentAndSessionID, packObjectName, - (void*)(new std::string(name)), + (void*)(&name_copy), SEND_ONLY_ROOTS); } else if(mSelectedObjects->getObjectCount() == 1) @@ -4178,20 +4177,22 @@ void LLSelectMgr::selectionSetObjectName(const std::string& name) sendListToRegions("ObjectName", packAgentAndSessionID, packObjectName, - (void*)(new std::string(name)), + (void*)(&name_copy), SEND_INDIVIDUALS); } } void LLSelectMgr::selectionSetObjectDescription(const std::string& desc) { + std::string desc_copy(desc); + // we only work correctly if 1 object is selected. if(mSelectedObjects->getRootObjectCount() == 1) { sendListToRegions("ObjectDescription", packAgentAndSessionID, packObjectDescription, - (void*)(new std::string(desc)), + (void*)(&desc_copy), SEND_ONLY_ROOTS); } else if(mSelectedObjects->getObjectCount() == 1) @@ -4199,7 +4200,7 @@ void LLSelectMgr::selectionSetObjectDescription(const std::string& desc) sendListToRegions("ObjectDescription", packAgentAndSessionID, packObjectDescription, - (void*)(new std::string(desc)), + (void*)(&desc_copy), SEND_INDIVIDUALS); } } @@ -4726,7 +4727,6 @@ void LLSelectMgr::packObjectName(LLSelectNode* node, void* user_data) gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID()); gMessageSystem->addStringFast(_PREHASH_Name, *name); } - delete name; } // static diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 22175932f..dfe3df25f 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -758,7 +758,6 @@ private: LLVector3 mGridOrigin; LLVector3 mGridScale; EGridMode mGridMode; - BOOL mGridValid; BOOL mTEMode; // render te From 7813ca03da83c7dbf4dae481563caa34ae76301e Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 18 Oct 2013 08:21:57 -0400 Subject: [PATCH 06/62] LLFloaterInspect: bit of cleanup and allow sorting by creation date regardless of format --- indra/newview/llfloaterinspect.cpp | 27 +++++++++------------------ indra/newview/llfloaterinspect.h | 4 ---- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 448e1bb37..ba9233d65 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -89,7 +89,6 @@ LLFloaterInspect::~LLFloaterInspect(void) { gFloaterTools->setFocus(TRUE); } - //sInstance = NULL; } // static @@ -199,15 +198,6 @@ LLUUID LLFloaterInspect::getSelectedUUID() return LLUUID::null; } -void LLFloaterInspect::onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr) -{ - if (FloaterPtr) - { - LLFloaterInspect* floater = (LLFloaterInspect*)FloaterPtr; - floater->dirty(); - } -} - void LLFloaterInspect::refresh() { LLUUID creator_id; @@ -234,15 +224,14 @@ void LLFloaterInspect::refresh() { LLSelectNode* obj = *iter; LLSD row; - std::string owner_name, creator_name, time, last_owner_name; + std::string owner_name, creator_name, last_owner_name; if (obj->mCreationDate == 0) { // Don't have valid information from the server, so skip this one continue; } - time_t timestamp = (time_t) (obj->mCreationDate/1000000); - timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time); + // Singu Note: Diverge from LL and handle datetime column in a sortable manner later on const LLUUID& idOwner = obj->mPermissions->getOwner(); const LLUUID& idCreator = obj->mPermissions->getCreator(); @@ -266,7 +255,7 @@ void LLFloaterInspect::refresh() else { owner_name = LLTrans::getString("RetrievingData"); - LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::dirty, this)); } if (LLAvatarNameCache::get(idCreator, &av_name)) @@ -283,7 +272,7 @@ void LLFloaterInspect::refresh() else { creator_name = LLTrans::getString("RetrievingData"); - LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::dirty, this)); } // @@ -300,7 +289,7 @@ void LLFloaterInspect::refresh() else { last_owner_name = LLTrans::getString("RetrievingData"); - LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::dirty, this)); } // @@ -363,8 +352,10 @@ void LLFloaterInspect::refresh() row["columns"][7]["value"] = llformat("%d",total_inv); // row["columns"][8]["column"] = "creation_date"; - row["columns"][8]["type"] = "text"; - row["columns"][8]["value"] = time; + row["columns"][8]["type"] = "date"; + row["columns"][8]["value"] = LLDate(obj->mCreationDate/1000000); + static const LLCachedControl format("TimestampFormat"); + row["columns"][8]["format"] = format; mObjectList->addElement(row, ADD_TOP); } if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 52e6a7f9a..f977f5403 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -63,8 +63,6 @@ public: void onClickOwnerProfile(); void onSelectObject(); - static void onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr); - LLScrollListCtrl* mObjectList; protected: // protected members @@ -77,8 +75,6 @@ protected: private: LLFloaterInspect(); virtual ~LLFloaterInspect(void); - // static data -// static LLFloaterInspect* sInstance; LLSafeHandle mObjectSelection; // From ef3f78175c688947625c2fb4aa107be1eb8c1380 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 18 Oct 2013 08:28:39 -0400 Subject: [PATCH 07/62] Satisfy Issue 699: Let Alt-right clicking in mouselook bring up pie menu Also lltoolpie.cpp cleanup --- indra/newview/lltoolcomp.cpp | 1 + indra/newview/lltoolpie.cpp | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 2a79e0c32..f5459d867 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -764,6 +764,7 @@ BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) // be shown. return FALSE; */ + if (mask & MASK_ALT) return false; // Returning true will suppress the context menu return TRUE; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index e3dce440d..f1904b312 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -1092,9 +1092,6 @@ BOOL LLToolPie::handleRightClickPick() // didn't click in any UI object, so must have clicked in the world LLViewerObject *object = mPick.getObject(); - LLViewerObject *parent = NULL; - if(object) - parent = object->getRootEdit(); // Can't ignore children here. LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); From 65d2775e2a05e2958bd453cf231adb79cc64695b Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 18 Oct 2013 08:58:13 -0400 Subject: [PATCH 08/62] Address jonhboy's Request: Round land impact instead of chopping off the decimal --- indra/newview/llfloatertools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 99863e103..0cf47303f 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -527,7 +527,7 @@ void LLFloaterTools::refresh() { F32 link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost(); LLStringUtil::format_map_t prim_equiv_args; - prim_equiv_args["SEL_WEIGHT"] = llformat("%.1d", (S32)link_cost); + prim_equiv_args["SEL_WEIGHT"] = llformat("%.0f", link_cost); selection_args["PE_STRING"] = getString("status_selectprimequiv", prim_equiv_args); } else From 290b3d7106bd32212dd278c0a0ad52cee1c0947c Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 19 Oct 2013 15:22:03 +0200 Subject: [PATCH 09/62] Added Windows 64 support to repackage.sh --- scripts/repackage.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/repackage.sh b/scripts/repackage.sh index 6865ca08f..59e71173f 100755 --- a/scripts/repackage.sh +++ b/scripts/repackage.sh @@ -5,7 +5,7 @@ usage() { echo "Usage: repackage PLATFORM FILEIN.tar.bz2 [FILEOUT.tar.bz2] Repackage an archive from llautobuild format into singularity format -PLATFORM can be one of windows, linux, linux64, mac. +PLATFORM can be one of windows, windows64 linux, linux64, mac. " exit 0 } @@ -30,6 +30,13 @@ case "$1" in INCPATH="libraries/i686-win32/include" BINPATH="libraries/i686-win32/bin" ;; + --windows64|-w64|windows64|win64) + MODE=windows64 + LIBPATH="libraries/x86_64-win/lib/release" + LIBDPATH="libraries/x86_64-win/lib/debug" + INCPATH="libraries/x86_64-win/include" + BINPATH="libraries/x86_64-win/bin" + ;; --mac|--osx|--darwin|-x|mac|osx|darwin) MODE=osx LIBPATH="libraries/universal-darwin/lib/release" @@ -82,7 +89,7 @@ case "$FILEIN" in http\:\/\/*|https\:\/\/*) echo " Downloading..." cd "$TMP" - wget "$FILEIN" -O package.tar.bz2 + curl -L "$FILEIN" > package.tar.bz2 echo " Unpacking..." tar -xjvf package.tar.bz2 rm package.tar.bz2 From d03a012a41507bb6fe63f69850f96051bb74338d Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 19 Oct 2013 21:10:24 +0200 Subject: [PATCH 10/62] Added support for Visual Studio 2012 to develop.py and VSTool --- indra/develop.py | 5 +++++ indra/tools/vstool/VSTool.exe | Bin 24576 -> 24576 bytes indra/tools/vstool/main.cs | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/indra/develop.py b/indra/develop.py index 853c37e14..c723db053 100755 --- a/indra/develop.py +++ b/indra/develop.py @@ -443,9 +443,14 @@ class WindowsSetup(PlatformSetup): 'vc100' : { 'gen' : r'Visual Studio 10', 'ver' : r'10.0' + }, + 'vc110' : { + 'gen' : r'Visual Studio 11', + 'ver' : r'11.0' } } gens['vs2010'] = gens['vc100'] + gens['vs2012'] = gens['vc110'] search_path = r'C:\windows' exe_suffixes = ('.exe', '.bat', '.com') diff --git a/indra/tools/vstool/VSTool.exe b/indra/tools/vstool/VSTool.exe index 330cf75d59f37ec656f6991899a1f26409164af0..7ded46ecd84990ca8b80853d4c231a5e3f55ea79 100755 GIT binary patch delta 4171 zcma)9eQ;FO6+idAx9{y&HhKFJ!X~?Mvw>tovdL~DB*6p-31CXl01~v*S~i;p?6_at zw~2--o0h4?Kj;|WSf`d2QFKPDtv2Iy9BnaUKX9s@ibID^g;wpCb&5lE>c=4Ix%cgc zU~$Gb^Ugiz+;e~D+~56pyVEa{=@-epheBJ=jBSJB^A`|^i?{%y=m=WQ%<#+;qaOb- zz>UnY3*d}2Q?HrzWp zM=CaNa{@S5)JA2v7JEeO6tbAq>6FDFRNxq)GV4a$ea`2iI5;PU%g|J^9+cs7rtY_| zAQ;IWpAUSR`R|JQ0>f}AVsKTEVaOb#?3~X{`xY?lmoe=79Sa!E&4_`8UcIJOSVN^C zU9M?r0dH|l)t@a20qcaY(>$&=k}~tR>hEN00_IWgEkv9B*xN^3+*8ZvW%gHYCgtYg z%C#t8t&9fPOzCqnt=ye!kfzvpPW;+*0K93uU=dngAs#5B?zl2F2;TqB;Yj)Mn z%K61YITe}a4z5bE;0&@hF>4?8%l2NA=BR z4m&s3{P)uQe6{mjt>#fZm#+ajj{sKf=K%K)+dW|3QlrJJ3qgW+(Sb*dvAEO4Xl9qu z0Xs7ASt5T>;}2LwI<8Kn`G=Z@Jx?JBXGKFo=*ws!RqvFX)>P;`vl)%m&MRlJZ+?DW zj<{%*yHv`#8qH28(6q=cU2*2F+RB182N9-m4v5C)aAIMgHHU?Aa5Ff{ilw=$591Q^ z#a<#jtjcB9GB~VNkW`6wVQ3{c8y6Rg^xEhU_Hml(a2H&rn(=Gh+5*HAP^+1$zn3`8 z8~iH@DZC~c4&cWH+hxdY!}dH)X7(6ZH(W&ak0a>~JGR3^xIFCQZ`ibBXb{_{(H_T> z-mpHE9b>`xph~;p6O|dzE_qaz;UL#vk&`&=G?!%x>-8zDw~@;S6;|l) zm1h+hs_o|a!1YKTzzzlQqwIh>b7fu3t-)F46wyGmpCYrn>(-OP3t<-ZU3f^i6T)!3 z*|MG#z5&g!ti`hCghS8@t*w^zI$9C9#I3uRt|N`m1}C{Svov7$p~VP(8`ndC^C(65 z1f>Krl1yL;N`ZSs2#I(>U+HS+L0@q2Rmb*;0w&nRaqi;D?*5D}!o3Tgf&dSqA;M$a zb%GB*xk!JN>sGHNPjSzmxxB!oEU}q+PzvBhDZ(|}6J&c5qJoI~tQiu%3auR_yDzBm(L5~l+8}WP12Dq`r zw}~4rDDM)Le5$YwR}0q(ZO{ON!T?+cufPCw!V!20zE2KAP&f#O;YBWgDQc*n#;-rY zlucxajFBmFi2RIvK<0@}@Ye}#xIS)NIT7!B31tNytWTtr?N7w~VQ9nb-$HK*=EIF& z)-w9-8}VTLrG6T2 zBFaEEor_c5+|oR0o@wqa^p4QvWIV4ArE@7gt!MIamU2+f$CD{z&DYltMh7=`t{RN= z53E`lxpttVC(^&NyE`&C*xl99(X+9$v!mxOV4zq5-K1x9ieTgYdAy3pCh|ILpEB}# zx@{nvO6ds(ZM5;IWC8}0iTrx>#Oc(o4p_D^b<$D?w1-I3VrniXAk$rXbRGu_c^ca7q5#vnHPXoo;Zi+QOdBr@|@r%S3xzhCxq z{mJIxM-QF-cIaqlv-v{TcO-V7n?v0_Uy9iYo;dc%ir}?-?UF)J1i{nDUx#AE!9*?&V zgSMD0J&8Sbxym~|BY5mesSOHvyK2N96a)<_G~!fbk9Yc8ILvNSM3hSvRq*@m0l(kl zv04NRU`^$Uv)JM19=D>Pjd7UkwVoF5;4q&T7q>D!I8(nw7#W^zTzyhpEAa1Q5MUaA zu0c1p*erT1T1Gy{zt@bctCprQ-i)rRthpDJhjsxTE>w!oKgR(6MP_eUw@oO#_xy?8 zwRfab!AYGOxcq&gSX(p{)H8|fIDWqSLOX8S80iiLjeI;a9#3U6dS7TtH$rRIlsS9j zhM}j&Qd2<$$QXU037T1LB=+j*xDiPw6EtgNcjqICYuItV}$O`L|5<=W?lJf*+2ycrF)ew-EAl!pIM0c4xm} zK^>t2ABf2fJuyKsY0*Xx)%Q(crTREKlX#x?=*Aa>?F=oTEXLVz2j*ahZdjkxQ^6FI z>Aq0h7|Kj$Z_{ZgIFam6Byabkl_THA>Ob(Rp8l+c7Aio>?>oAk#O{1m7FAitstRpI=}?iTsYNSdS^$-1@9ygu zhPprI$e(+k_ujpG_uk#b`_7PkXUMY$7gQyWe*uc0zX2sK;s8jYB4R7Q)H8Z=ljoB( zK(A2r1018HQ9qB8Ep$Tz|2B!yW3+IRZ1O}>J@%AUI8e}FLnFZPFaSYr0qFcHN%1w_ z)$2?EXG3jDhZeLbXrx&us+_tK0WUxWt;o8NyQhOLhLdwj!j06(mLVoQLfq|WAm}MR z!5{>E{E9c47cpFh5^0Ty7`lv6HXU@cj#3QA?HG>TW+_H}J;uO9KRc&Z%%Os+w{zN6 zig#yDfxDB!fb(d=}M0|xCz7FD&np(Lp-c_-hc=(Zu2N0(! zQem-E_Nop!d(Vjg*3ivnP~k|pc}?ZL7`3yq%PN(HJ!wGBK-*a5a$Mlu%9n_$z&YT% z1IzM_IZI{N&>>NcaTm5DyH#Q>$PCAvZ4ol7#1hEDCAJ`$VD-qH$tKn;$9mQw$0&PH zjzP9oju!hej%GsaZaByfSG)4fC|=YXuxp}w6#ph(2W%UFKSkjHj@W3c!b$ISHGbWY z>)6@08gen4G#PS5n=~47S)0TSxwcJ2riW!FO>A6_ef8`;DMXoOiY)}$eR8zeBRJAx zs+i<%nPhEBfz8-_EU;DOWY3_FeH1A>i*f=FsqQk^1(Qz&L*Y8y)yr17Up3eVXtmS? z&eQ#xrLij}*K4BrnNk22b{5-;)(O!D5o-iHL;Qwi$cCe3t?&{Swq;K8J1hsTSk(K? zfZv%+2aaHt#P7AdRhIMnb|PNC3q55fE<2Nl-Ikkus}!irDq}AoQ^oDlW0o_}=XY98 z%X~!yXgZbjnt{GD(;?}ye}6hV8*on7`aPEC_9bEy7yxTBRvT%uFOUi!VjJ=3ii-JN zqN?KZK83G}dUw^<*3MPU{2x{OUTs}|5QE4fh{~`7$gnc6%qi{U*@WQY!UUZEo%iFj zv$Og_7dwv*b}G{~eg|uE7yYd}o`h+@w%hLtg{ilpMrvrj^YtVQJa9M`JwXCq8~Q zw3L{fh8yzt=m2$30X&Q24g=-&BW!T!tHYQnT*s5wkKekD>!A@a#t%}mIY6uMVFtKKnxP66DB?lDcN_ql2l$Y~Li`Fn-eV8onxZD+0SC%o z4>#u(etIi6^9HLgGgf!V-yuTMFdwQaRQCWAbOtU95_S_5m4Z z6C#BzcgYHzFKO}=-b13m-=)f_iOGIE1O#lkTFSQ7#%?@;1o|YtFR>NR27zUW6qX|@ z&?_|&anK+|6+BV(&`FL!6JiY7Bz7T=NP3PzzfpnC5cg3sa2A3=+|nw9s@YJC&=2ejyqk`o{TO~M+Tk*Hkkgj`?}zNYU- z{S*2+n1nt060{!DJBS6x^`qnl{7R3(Rd`K*5jE%ZUl2k>4Q{|+^N7$|B?Atq5{k(410mJ0%O5%?iOyCDg0KsR2}A0pciUUEj_ACx^P{|PR@C!mrz zNt1147dc3NL;g%Il1tXWyo?JPY85v-Z&1|t5&1JIrQMs6z`fNXAHXnoNz+&h%n#rHSth{m~);kEEH1W|5>T~!UszDGU;A?Y5w2;T@@O6d4Aq{`=dO}JBJSq_4F$~4m=1YfM zh87M Date: Sat, 19 Oct 2013 23:05:53 +0200 Subject: [PATCH 11/62] WIP win64 support --- indra/cmake/00-Common.cmake | 8 ++++++-- indra/cmake/GooglePerfTools.cmake | 4 ++-- indra/cmake/Variables.cmake | 19 +++++++++++++------ indra/develop.py | 4 ++++ indra/libhacd/hacdHACD.h | 4 +++- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index a45c07f69..2229b60ea 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -78,11 +78,15 @@ if (WINDOWS) /W3 /c /Zc:forScope - /Zc:wchar_t- + /Zc:wchar_t- /nologo /Oy- - /arch:SSE2 ) + + # SSE2 is implied on win64 + if (WORD_SIZE EQUAL 32) + add_definitions(/arch:SSE2) + endif (WORD_SIZE EQUAL 32) # configure win32 API for windows XP+ compatibility set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index d92c39ded..de669ce08 100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake @@ -12,10 +12,10 @@ else (STANDALONE) if (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64) use_prebuilt_binary(gperftools) endif (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64) - if (WINDOWS AND NOT DISABLE_TCMALLOC) + if (WINDOWS AND NOT DISABLE_TCMALLOC AND USE_GOOGLE_PERFTOOLS) set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib) set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"") - endif (WINDOWS AND NOT DISABLE_TCMALLOC) + endif (WINDOWS AND NOT DISABLE_TCMALLOC AND USE_GOOGLE_PERFTOOLS) if (LINUX) if(USE_GOOGLE_PERFTOOLS) set(TCMALLOC_LIBRARIES tcmalloc) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 10dd25ac2..70d025d85 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -37,10 +37,15 @@ set(LIBS_PREBUILT_DIR ${CMAKE_SOURCE_DIR}/../libraries CACHE PATH if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(WINDOWS ON BOOL FORCE) - set(ARCH i686) - set(LL_ARCH ${ARCH}_win32) - set(LL_ARCH_DIR ${ARCH}-win32) - set(WORD_SIZE 32) + if (WORD_SIZE EQUAL 32) + set(ARCH i686) + set(LL_ARCH ${ARCH}_win32) + set(LL_ARCH_DIR ${ARCH}-win32) + elseif (WORD_SIZE EQUAL 64) + set(ARCH x86_64) + set(LL_ARCH ${ARCH}_win) + set(LL_ARCH_DIR ${ARCH}-win) + endif (WORD_SIZE EQUAL 32) endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -119,15 +124,17 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(LL_ARCH_DIR universal-darwin) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -if (WINDOWS) +if (WINDOWS AND WORD_SIZE EQUAL 32) set(PREBUILT_TYPE windows) +elseif (WINDOWS AND WORD_SIZE EQUAL 64) + set(PREBUILT_TYPE windows64) elseif(DARWIN) set(PREBUILT_TYPE darwin) elseif(LINUX AND WORD_SIZE EQUAL 32) set(PREBUILT_TYPE linux) elseif(LINUX AND WORD_SIZE EQUAL 64) set(PREBUILT_TYPE linux64) -endif(WINDOWS) +endif(WINDOWS AND WORD_SIZE EQUAL 32) # Default deploy grid set(GRID agni CACHE STRING "Target Grid") diff --git a/indra/develop.py b/indra/develop.py index c723db053..4e93c27e9 100755 --- a/indra/develop.py +++ b/indra/develop.py @@ -449,6 +449,7 @@ class WindowsSetup(PlatformSetup): 'ver' : r'11.0' } } + gens['vs2010'] = gens['vc100'] gens['vs2012'] = gens['vc110'] @@ -508,6 +509,9 @@ class WindowsSetup(PlatformSetup): project_name=self.project_name, word_size=self.word_size, ) + if self.word_size == 64: + args["generator"] += r' Win64' + #if simple: # return 'cmake %(opts)s "%(dir)s"' % args return ('cmake -G "%(generator)s" ' diff --git a/indra/libhacd/hacdHACD.h b/indra/libhacd/hacdHACD.h index 0c9f11653..f3e0855b8 100644 --- a/indra/libhacd/hacdHACD.h +++ b/indra/libhacd/hacdHACD.h @@ -22,7 +22,9 @@ #include #include #include - +#if defined(_WIN32) && _MSC_VER >= 1700 +#include +#endif namespace HACD { const double sc_pi = 3.14159265; From bd4e988397b8e19f8167923ff6cbceba47bc2667 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 19 Oct 2013 20:38:50 -0400 Subject: [PATCH 12/62] Fix crash signature 222 --- indra/newview/llfloateravatarlist.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 4ce5e7c18..e6b8167ff 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -189,7 +189,17 @@ void LLAvatarListEntry::processProperties(void* data, EAvatarProcessorType type) using namespace boost::gregorian; int year, month, day; sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d",&month,&day,&year); - mAge = (day_clock::local_day() - date(year, month, day)).days(); + try + { + mAge = (day_clock::local_day() - date(year, month, day)).days(); + } + catch(const std::exception&) + { + llwarns << "Failed to extract age from APT_PROPERTIES for " << mID << ", received \"" << pAvatarData->born_on << "\". Requesting properties again." << llendl; + LLAvatarPropertiesProcessor::getInstance()->addObserver(mID, this); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(mID); + return; + } if (!mStats[STAT_TYPE_AGE] && mAge >= 0) //Only announce age once per entry. { static const LLCachedControl sAvatarAgeAlertDays(gSavedSettings, "AvatarAgeAlertDays"); From a33efc61a2f280d81869dfce67f3ccf0482d01ec Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 19 Oct 2013 20:54:02 -0400 Subject: [PATCH 13/62] Feature request by StephiDreamEvermore Doune: Implement the convenience of being able to set view offsets while modifier keys are held during scroll in third person camera (Play with camera position/angle) --- indra/newview/llagentcamera.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 05b3bd6df..3b81192f9 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2022,6 +2022,14 @@ LLVector3 LLAgentCamera::getCameraOffsetInitial() return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); } +// Adds change to vector CachedControl, vec, at idx +template +void change_vec(const T& change, LLCachedControl& vec, const U32& idx = VZ) +{ + Vec changed(vec); + changed[idx] += change; + vec = changed; +} //----------------------------------------------------------------------------- // handleScrollWheel() @@ -2057,6 +2065,24 @@ void LLAgentCamera::handleScrollWheel(S32 clicks) } else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON)) { + if (MASK mask = gKeyboard->currentMask(true)) // Singu Note: Conveniently set view offsets while modifier keys are held during scroll + { + if (mask & MASK_CONTROL|MASK_SHIFT) + { + const F32 change(static_cast(clicks) * 0.1f); + if (mask & MASK_SHIFT) + { + static LLCachedControl focus_offset("FocusOffsetRearView"); + change_vec(change, focus_offset); + } + if (mask & MASK_CONTROL) + { + static LLCachedControl camera_offset("CameraOffsetRearView"); + change_vec(change, camera_offset); + } + return; + } + } F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); static const LLCachedControl camera_offset_scale("CameraOffsetScale"); From 6bae4a8d925edd71640d22136798ef725b1cc612 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 20 Oct 2013 12:37:35 +0200 Subject: [PATCH 14/62] WIP: native win64 support --- indra/llcommon/llfasttimer_class.cpp | 2 +- indra/llcommon/llprocessor.cpp | 2 +- indra/llmath/llmath.h | 4 ++-- indra/llmath/llsimdmath.h | 2 +- indra/llwindow/llwindowwin32.cpp | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index 07ea31a5a..e753fe309 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -184,7 +184,7 @@ LLMutex* LLFastTimer::sLogLock = NULL; std::queue LLFastTimer::sLogQueue; const int LLFastTimer::NamedTimer::HISTORY_NUM = 300; -#if LL_WINDOWS +#if defined(LL_WINDOWS) && !defined(_WIN64) #define USE_RDTSC 1 #endif diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index ce2c593c5..a7d2eac67 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -416,7 +416,7 @@ static F64 calculate_cpu_frequency(U32 measure_msecs) unsigned long dwCurPriorityClass = GetPriorityClass(hProcess); int iCurThreadPriority = GetThreadPriority(hThread); unsigned long dwProcessMask, dwSystemMask, dwNewMask = 1; - GetProcessAffinityMask(hProcess, &dwProcessMask, &dwSystemMask); + GetProcessAffinityMask(hProcess, (PDWORD_PTR)&dwProcessMask, (PDWORD_PTR)&dwSystemMask); SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS); SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL); diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 6d3f06710..274663643 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -140,7 +140,7 @@ inline F64 llabs(const F64 a) inline S32 lltrunc( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) // Avoids changing the floating point control word. // Add or subtract 0.5 - epsilon and then round const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF }; @@ -166,7 +166,7 @@ inline S32 lltrunc( F64 f ) inline S32 llfloor( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) // Avoids changing the floating point control word. // Accurate (unlike Stereopsis version) for all values between S32_MIN and S32_MAX and slightly faster than Stereopsis version. // Add -(0.5 - epsilon) and then round diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h index cebd2ace7..798795a8b 100644 --- a/indra/llmath/llsimdmath.h +++ b/indra/llmath/llsimdmath.h @@ -31,7 +31,7 @@ #error "Please include llmath.h before this file." #endif -#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) ) +#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) && !defined(_WIN64) ) #error SSE2 not enabled. LLVector4a and related class will not compile. #endif diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 78f54a7a4..807c547bd 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -749,7 +749,7 @@ void LLWindowWin32::close() LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL; // Don't process events in our mainWindowProc any longer. - SetWindowLong(mWindowHandle, GWL_USERDATA, NULL); + SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL); // Make sure we don't leave a blank toolbar button. ShowWindow(mWindowHandle, SW_HIDE); @@ -1660,7 +1660,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL; } - SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this); + SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, (LONG_PTR)this); // register this window as handling drag/drop events from the OS DragAcceptFiles( mWindowHandle, TRUE ); @@ -1983,7 +1983,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // This helps prevent avatar walking after maximizing the window by double-clicking the title bar. static bool sHandleLeftMouseUp = true; - LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA); + LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr(h_wnd, GWLP_USERDATA); if (NULL != window_imp) From 17c59f25f584e14b44011eb6f0dd559c05a9dc79 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 20 Oct 2013 17:03:48 +0200 Subject: [PATCH 15/62] WIP[win64]: it builds, runs. webkit disabled in cmake for now --- indra/cmake/00-Common.cmake | 4 + indra/cmake/CopyWinLibs.cmake | 34 +++- indra/cmake/FMODEX.cmake | 30 ++-- indra/llplugin/CMakeLists.txt | 2 +- indra/newview/CMakeLists.txt | 29 +-- indra/newview/llfloaterpathfindingobjects.cpp | 4 +- indra/plugins/CMakeLists.txt | 7 +- indra/plugins/base_basic/CMakeLists.txt | 2 +- indra/plugins/base_media/CMakeLists.txt | 2 +- indra/plugins/example_basic/CMakeLists.txt | 2 +- indra/plugins/example_media/CMakeLists.txt | 2 +- indra/plugins/filepicker/CMakeLists.txt | 2 +- indra/plugins/webkit/CMakeLists.txt | 2 +- install.xml | 168 ++++++++++++++++++ 14 files changed, 253 insertions(+), 37 deletions(-) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 2229b60ea..f6a9c0772 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -46,6 +46,10 @@ if (WINDOWS) set(MSVC_DIR 10.0) set(MSVC_SUFFIX 100) endif (MSVC10) + if (MSVC11) + set(MSVC_DIR 11.0) + set(MSVC_SUFFIX 110) + endif (MSVC11) # Remove default /Zm1000 flag that cmake inserts string (REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") diff --git a/indra/cmake/CopyWinLibs.cmake b/indra/cmake/CopyWinLibs.cmake index 9d52499a1..5081e4ac5 100644 --- a/indra/cmake/CopyWinLibs.cmake +++ b/indra/cmake/CopyWinLibs.cmake @@ -6,6 +6,14 @@ include(CMakeCopyIfDifferent) +#if (WORD_SIZE EQUAL 32) +# set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") +# set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") +#else (WORD_SIZE EQUAL 32) + set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/x86_64-win/lib/debug") + set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/x86_64-win/lib/release") +#endif WORD_SIZE EQUAL 32) + set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32") set(vivox_files SLVoice.exe @@ -23,7 +31,7 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) -set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") +set(debug_src_dir "${debug_libs_dir}") set(debug_files libhunspell.dll libapr-1.dll @@ -43,6 +51,9 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) +# Singu TODO::WIN64 +if (WORD_SIZE EQUAL 32) + # Debug config runtime files required for the plugin test mule set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") set(plugintest_debug_files @@ -203,9 +214,12 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) -set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") +endif (WORD_SIZE EQUAL 32) +# /Singu TODO::WIN64 + +set(release_src_dir "${release_libs_dir}") set(release_files - libtcmalloc_minimal.dll +# libtcmalloc_minimal.dll libhunspell.dll libapr-1.dll libaprutil-1.dll @@ -217,7 +231,13 @@ set(release_files ) if(FMODEX) - find_path(FMODEX_BINARY_DIR fmodex.dll + if (WORD_SIZE EQUAL 32) + set(fmodex_dll_file "fmodex.dll") + else (WORD_SIZE EQUAL 32) + set(fmodex_dll_file "fmodex64.dll") + endif (WORD_SIZE EQUAL 32) + + find_path(FMODEX_BINARY_DIR "${fmodex_dll_file}" "${release_src_dir}" "${FMODEX_SDK_DIR}/api" "${FMODEX_SDK_DIR}" @@ -225,11 +245,11 @@ if(FMODEX) ) if(FMODEX_BINARY_DIR) - copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Release" out_targets fmodex.dll) + copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Release" out_targets "${fmodex_dll_file}") set(all_targets ${all_targets} ${out_targets}) - copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" out_targets fmodex.dll) + copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" out_targets "${fmodex_dll_file}") set(all_targets ${all_targets} ${out_targets}) - copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Debug" out_targets fmodex.dll) + copy_if_different("${FMODEX_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/Debug" out_targets "${fmodex_dll_file}") set(all_targets ${all_targets} ${out_targets}) endif(FMODEX_BINARY_DIR) endif(FMODEX) diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake index dbac0ebac..6f84dbebd 100644 --- a/indra/cmake/FMODEX.cmake +++ b/indra/cmake/FMODEX.cmake @@ -16,7 +16,7 @@ if (NOT FMODEX_LIBRARY) ) elseif(WORD_SIZE EQUAL 64) find_library(FMODEX_LIBRARY - fmodex64 fmodexL64 + fmodex64_vc fmodexL64_vc fmodex64 fmodexL64 PATHS "${FMODEX_SDK_DIR}/api/lib" "${FMODEX_SDK_DIR}/api" @@ -25,21 +25,31 @@ if (NOT FMODEX_LIBRARY) ) endif(WORD_SIZE EQUAL 32) endif(FMODEX_SDK_DIR) - if(WINDOWS AND NOT FMODEX_LIBRARY) + if(WINDOWS AND NOT FMODEX_SDK_DIR) set(FMODEX_PROG_DIR "$ENV{PROGRAMFILES}/FMOD SoundSystem/FMOD Programmers API Windows") - find_library(FMODEX_LIBRARY - fmodex_vc fmodexL_vc - PATHS - "${FMODEX_PROG_DIR}/api/lib" - "${FMODEX_PROG_DIR}/api" - "${FMODEX_PROG_DIR}" - ) + if(WORD_SIZE EQUAL 32) + find_library(FMODEX_LIBRARY + fmodex_vc fmodexL_vc + PATHS + "${FMODEX_PROG_DIR}/api/lib" + "${FMODEX_PROG_DIR}/api" + "${FMODEX_PROG_DIR}" + ) + else(WORD_SIZE EQUAL 32) + find_library(FMODEX_LIBRARY + fmodex64_vc fmodexL64_vc + PATHS + "${FMODEX_PROG_DIR}/api/lib" + "${FMODEX_PROG_DIR}/api" + "${FMODEX_PROG_DIR}" + ) + endif(WORD_SIZE EQUAL 32) if(FMODEX_LIBRARY) message(STATUS "Found fmodex in ${FMODEX_PROG_DIR}") set(FMODEX_SDK_DIR "${FMODEX_PROG_DIR}") set(FMODEX_SDK_DIR "${FMODEX_PROG_DIR}" CACHE PATH "Path to the FMOD Ex SDK." FORCE) endif(FMODEX_LIBRARY) - endif(WINDOWS AND NOT FMODEX_LIBRARY) + endif(WINDOWS AND NOT FMODEX_SDK_DIR) endif (NOT FMODEX_LIBRARY) find_path(FMODEX_INCLUDE_DIR fmod.hpp diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 446028b0f..5aa33696e 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -49,7 +49,7 @@ set_source_files_properties(${llplugin_HEADER_FILES} if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d7dbce179..98c48c22c 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1437,11 +1437,7 @@ set(PACKAGE ${PACKAGE_DEFAULT} CACHE BOOL "Add a package target that builds an installer package.") if (WINDOWS) - if(MSVC10) - set(release_flags "/MAPRelease/${VIEWER_BINARY_NAME}.map") - else(MSVC10) - set(release_flags "/MAP:Release/${VIEWER_BINARY_NAME}.map") - endif(MSVC10) + set(release_flags "/MAPRelease/${VIEWER_BINARY_NAME}.map") if (FMOD) if(MANIFEST_LIBRARIES) @@ -1451,12 +1447,18 @@ if (WINDOWS) endif(MANIFEST_LIBRARIES) endif (FMOD) if (FMODEX) + if (WORD_SIZE EQUAL 32) + set(fmodex_dll_file "fmodex.dll") + else (WORD_SIZE EQUAL 32) + set(fmodex_dll_file "fmodex64.dll") + endif (WORD_SIZE EQUAL 32) + if(MANIFEST_LIBRARIES) - set(MANIFEST_LIBRARIES "${MANIFEST_LIBRARIES}|${FMODEX_BINARY_DIR}/fmodex.dll") + set(MANIFEST_LIBRARIES "${MANIFEST_LIBRARIES}|${FMODEX_BINARY_DIR}/${fmodex_dll_file}") else(MANIFEST_LIBRARIES) - set(MANIFEST_LIBRARIES "--extra_libraries=${FMODEX_BINARY_DIR}/fmodex.dll") + set(MANIFEST_LIBRARIES "--extra_libraries=${FMODEX_BINARY_DIR}/${fmodex_dll_file}") endif(MANIFEST_LIBRARIES) - set(EXTRA_LINKER_FLAGS "/DELAYLOAD:fmodex.dll") + set(EXTRA_LINKER_FLAGS "/DELAYLOAD:${fmodex_dll_file}") endif (FMODEX) set_target_properties(${VIEWER_BINARY_NAME} @@ -1886,6 +1888,8 @@ if (WINDOWS) COMMENT "Copying SLPlugin executable to the runtime folder." ) +# Singu TODO::WIN64 + if(WORD_SIZE EQUAL 32) get_target_property(BUILT_WEBKIT_PLUGIN media_plugin_webkit LOCATION) add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD @@ -1897,6 +1901,7 @@ if (WINDOWS) ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin COMMENT "Copying WebKit Plugin to the runtime folder." ) + endif(WORD_SIZE EQUAL 32) get_target_property(BUILT_QUICKTIME_PLUGIN media_plugin_quicktime LOCATION) add_custom_command( @@ -1910,7 +1915,7 @@ if (WINDOWS) COMMENT "Copying Quicktime Plugin to the runtime folder." ) - get_target_property(BUILT_FILEPICKER_PLUGIN basic_plugin_filepicker LOCATION) + get_target_property(BUILT_FILEPICKER_PLUGIN basic_plugin_filepicker LOCATION) add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} @@ -1922,7 +1927,9 @@ if (WINDOWS) COMMENT "Copying filepicker Plugin to the runtime folder." ) - get_target_property(BUILT_WINMM_SHIM_PLUGIN winmm_shim LOCATION) +# winmm doesn't build on windows 64 + if(WORD_SIZE EQUAL 32) + get_target_property(BUILT_WINMM_SHIM_PLUGIN winmm_shim LOCATION) add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} @@ -1933,6 +1940,8 @@ if (WINDOWS) ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} COMMENT "Copying winmm.dll to the runtime folder." ) + endif(WORD_SIZE EQUAL 32) + # Copying the mime_types.xml file to app_settings set(mime_types_source "${CMAKE_SOURCE_DIR}/newview/skins/default/xui/en-us") set(mime_types_dest "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings") diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index 8a606a07b..b872b83a4 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -397,12 +397,14 @@ void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjec } LLScrollListItem *scrollListItem = mObjectsScrollList->addElement(rowParams); - +// Singu TODO::WIN64 +#if !defined(_WIN64) if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName()) { mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem)); pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1)); } +#endif } void LLFloaterPathfindingObjects::updateControlsOnScrollListChange() diff --git a/indra/plugins/CMakeLists.txt b/indra/plugins/CMakeLists.txt index bab7d936b..36ba40f4d 100644 --- a/indra/plugins/CMakeLists.txt +++ b/indra/plugins/CMakeLists.txt @@ -3,7 +3,10 @@ add_subdirectory(base_basic) add_subdirectory(base_media) add_subdirectory(filepicker) +# Singu TODO::WIN64 +if (NOT WINDOWS OR WORD_SIZE EQUAL 32) add_subdirectory(webkit) +endif (NOT WINDOWS OR WORD_SIZE EQUAL 32) if (LINUX) add_subdirectory(gstreamer010) @@ -13,9 +16,9 @@ if (WINDOWS OR DARWIN) add_subdirectory(quicktime) endif (WINDOWS OR DARWIN) -if (WINDOWS) +if (WINDOWS AND WORD_SIZE EQUAL 32) add_subdirectory(winmmshim) -endif (WINDOWS) +endif (WINDOWS AND WORD_SIZE EQUAL 32) add_subdirectory(example_basic) add_subdirectory(example_media) diff --git a/indra/plugins/base_basic/CMakeLists.txt b/indra/plugins/base_basic/CMakeLists.txt index 05b84324f..4ec14131b 100644 --- a/indra/plugins/base_basic/CMakeLists.txt +++ b/indra/plugins/base_basic/CMakeLists.txt @@ -17,7 +17,7 @@ include_directories( if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/indra/plugins/base_media/CMakeLists.txt b/indra/plugins/base_media/CMakeLists.txt index f7917a794..acd8d201c 100644 --- a/indra/plugins/base_media/CMakeLists.txt +++ b/indra/plugins/base_media/CMakeLists.txt @@ -31,7 +31,7 @@ include_directories( if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/indra/plugins/example_basic/CMakeLists.txt b/indra/plugins/example_basic/CMakeLists.txt index 98f5d1657..e97cd3243 100644 --- a/indra/plugins/example_basic/CMakeLists.txt +++ b/indra/plugins/example_basic/CMakeLists.txt @@ -19,7 +19,7 @@ include_directories( if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/indra/plugins/example_media/CMakeLists.txt b/indra/plugins/example_media/CMakeLists.txt index 0a8214eef..eefdd5251 100644 --- a/indra/plugins/example_media/CMakeLists.txt +++ b/indra/plugins/example_media/CMakeLists.txt @@ -30,7 +30,7 @@ include_directories( if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/indra/plugins/filepicker/CMakeLists.txt b/indra/plugins/filepicker/CMakeLists.txt index 2070b664b..c973954dd 100644 --- a/indra/plugins/filepicker/CMakeLists.txt +++ b/indra/plugins/filepicker/CMakeLists.txt @@ -25,7 +25,7 @@ include_directories( if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/indra/plugins/webkit/CMakeLists.txt b/indra/plugins/webkit/CMakeLists.txt index 2046e8033..615333227 100644 --- a/indra/plugins/webkit/CMakeLists.txt +++ b/indra/plugins/webkit/CMakeLists.txt @@ -35,7 +35,7 @@ include_directories( if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) - add_definitions(/FIXED:NO) + # add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) diff --git a/install.xml b/install.xml index ad06f4df5..8e42bec70 100644 --- a/install.xml +++ b/install.xml @@ -64,6 +64,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/glod-1.0pre4-windows-20110610.tar.bz2 + windows64 + + md5sum + df67aeb1ca4681dc4d9a556454203426 + url + https://files.streamgrid.net/win64/singularity/glod-1.0pre4-windows64-20131020.tar.bz2 + SDL @@ -126,6 +133,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/apr_suite-1.4.2-windows-20110504.tar.bz2 + windows64 + + md5sum + 7dcae03cad9bc04ac7e937284e6d102e + url + https://files.streamgrid.net/win64/singularity/apr_suite-1.4.5-windows64-20131019.tar.bz2 + ares @@ -166,6 +180,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/ares-1.7.1-windows-20110504.tar.bz2 + windows64 + + md5sum + 2ca54250b59170f3e5342dacad529859 + url + https://files.streamgrid.net/win64/singularity/ares-1.9.1-windows64-20131019.tar.bz2 + boost @@ -206,6 +227,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-windows-20130221.tar.bz2 + windows64 + + md5sum + 68c056e920ba2b25c0acded6f482a2e4 + url + https://files.streamgrid.net/win64/singularity/boost-1.53.0-windows64-20131019.tar.bz2 + colladadom @@ -246,6 +274,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/colladadom-2.2-windows-20131006.tar.bz2 + windows64 + + md5sum + acbe863e1b3df636e1245cc27c280e7b + url + https://files.streamgrid.net/win64/singularity/colladadom-2.2-windows64-20131020.tar.bz2 + curl @@ -286,6 +321,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/curl-7.21.1-windows-20110504.tar.bz2 + windows64 + + md5sum + ffb31d596f41b650bed49ac13bb513de + url + https://files.streamgrid.net/win64/singularity/curl-7.24.0-windows64-20131019.tar.bz2 + db @@ -400,6 +442,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/expat-2.0.1-windows-20110215.tar.bz2 + windows64 + + md5sum + 3239d5c50d6f2c857cc1a95674dbd1f5 + url + https://files.streamgrid.net/win64/singularity/expat-2.1.0-windows64-20131019.tar.bz2 + fontconfig @@ -441,6 +490,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/freeglut-2.6.0-windows-20110214.tar.bz2 + windows64 + + md5sum + 74758efd7fc6246f704ea702c4b3e310 + url + https://bitbucket.org/SingularityViewer/libraries/downloads/freeglut-2.6.0-windows-20110214.tar.bz2 + freetype @@ -481,6 +537,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/freetype-2.4.4-windows-20110218.tar.bz2 + windows64 + + md5sum + bfde86bbd84536448ac2a717ed1646d8 + url + https://files.streamgrid.net/win64/singularity/freetype-2.5.0.1-windows64-20131020.tar.bz2 + glext @@ -514,6 +577,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/glext-82-win32-linux.tar.bz2 + windows64 + + md5sum + efc62daedd2f89b46ef0e466b3ef460c + url + https://files.streamgrid.net/win64/singularity/glext-82-win32-linux.tar.bz2 + glib @@ -560,6 +630,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/glui-2.36-windows-20110214.tar.bz2 + windows64 + + md5sum + eeec9982df843043a18748276bbf39ce + url + https://bitbucket.org/SingularityViewer/libraries/downloads/glui-2.36-windows-20110214.tar.bz2 + google_breakpad @@ -596,6 +673,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/google_breakpad-0.0.0-rev1099-windows-20131002.tar.bz2 + windows64 + + md5sum + b13ebfa3a82d5396709c57ad83999d83 + url + https://files.streamgrid.net/win64/singularity/google_breakpad-0.0.0-rev1099-windows64-20131019.tar.bz2 + gperftools @@ -710,6 +794,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/hunspell-windows-20120704.tar.bz2 + windows64 + + md5sum + d3ee81e7dfe338b46efc2830930e771e + url + https://files.streamgrid.net/win64/singularity/libhunspell-1.3.2-windows64-20131020.tar.bz2 + jpeglib @@ -750,6 +841,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/jpeglib-8c-windows-20120704.tar.bz2 + windows64 + + md5sum + ae1e481e0538365d3c69a7801dff9467 + url + https://files.streamgrid.net/win64/singularity/jpeglib-8c-windows64-20131020.tar.bz2 + jsoncpp @@ -790,6 +888,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/jsoncpp-0.5.0-windows-20120704.tar.bz2 + windows64 + + md5sum + 8cf95eef2a95b71eb4a8ab59779bed52 + url + https://files.streamgrid.net/win64/singularity/jsoncpp-0.5.0-windows64-20131020.tar.bz2 + libpng @@ -830,6 +935,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/libpng-1.5.2-windows-20120704.tar.bz2 + windows64 + + md5sum + 9d2b32caa8b91ccb5c46be6a53eb071b + url + https://files.streamgrid.net/win64/singularity/libpng-1.5.10-windows64-20131020.tar.bz2 + libuuid @@ -914,6 +1026,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/llqtwebkit-4.7.1-windows-20120228.tar.bz2 + windows64 + + md5sum + ccb96fa1260ef6c3060d407b8c6b3972 + url + https://bitbucket.org/SingularityViewer/libraries/downloads/llqtwebkit-4.7.1-windows-20120228.tar.bz2 + mesa @@ -980,6 +1099,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/libndofdev-windows-20120704.tar.bz2 + windows64 + + md5sum + b59b4ddab26d4441829f50b48925baf0 + url + https://files.streamgrid.net/win64/singularity/libndofdev-0.1-windows64-20131020.tar.bz2 + ogg-vorbis @@ -1020,6 +1146,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/ogg_vorbis-1.2.2-1.3.2-windows-20110510.tar.bz2 + windows64 + + md5sum + a8ca0eef3d74936d504dab52ecc61ced + url + https://files.streamgrid.net/win64/singularity/ogg_vorbis-1.2.2-1.3.2-windows64-20131020.tar.bz2 + openSSL @@ -1056,6 +1189,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/openssl-1.0.0g-windows-20120207.tar.bz2 + windows64 + + md5sum + b50166f0b0a275c8ea0d3b11c578d792 + url + https://files.streamgrid.net/win64/singularity/openssl-1.0.0g-windows64-20131019.tar.bz2 + openal-soft @@ -1089,6 +1229,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/openal-1.12.854-1.1.0-windows-20110301.tar.bz2 + windows64 + + md5sum + e75f1529adcaa6e508d1725f59d93a16 + url + https://bitbucket.org/SingularityViewer/libraries/downloads/openal-1.12.854-1.1.0-windows-20110301.tar.bz2 + pcre @@ -1205,6 +1352,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/vivox-2.1.3010.6270-windows-20090309.tar.bz2 + windows64 + + md5sum + 752daa90e07c05202d1f76980cb955eb + url + https://bitbucket.org/SingularityViewer/libraries/downloads/vivox-2.1.3010.6270-windows-20090309.tar.bz2 + xmlrpc-epi @@ -1245,6 +1399,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/xmlrpc_epi-0.54.1-windows-20120704.tar.bz2 + windows64 + + md5sum + 94c26b93b855f5816bb29f308d9997fb + url + https://files.streamgrid.net/win64/singularity/xmlrpc_epi-0.54.1-windows64-20131019.tar.bz2 + zlib @@ -1285,6 +1446,13 @@ url https://bitbucket.org/SingularityViewer/libraries/downloads/zlib-1.2.5-windows-20120704.tar.bz2 + windows64 + + md5sum + 5aa50bd41d6cf0262a94760ef66bdbcf + url + https://files.streamgrid.net/win64/singularity/zlib-1.2.8-windows64-20131019.tar.bz2 + From f9531904f5b72713d636403e39ce5ef690ee1320 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 20 Oct 2013 18:07:23 +0200 Subject: [PATCH 16/62] WIP[win64]: Rebuilt jpeglib --- install.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.xml b/install.xml index 8e42bec70..d96497d2f 100644 --- a/install.xml +++ b/install.xml @@ -844,7 +844,7 @@ windows64 md5sum - ae1e481e0538365d3c69a7801dff9467 + 4c6600c70c1075fca2343fcd21b35cfe url https://files.streamgrid.net/win64/singularity/jpeglib-8c-windows64-20131020.tar.bz2 From 52c8c68d1280764f68426778d2014b3533ea7fe7 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 20 Oct 2013 20:16:21 +0200 Subject: [PATCH 17/62] Reduce unbearable notification span when a plugin fails to load --- indra/newview/llviewermedia.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 6cd1e611f..e9211231f 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1551,16 +1551,22 @@ void LLViewerMedia::proxyWindowClosed(const std::string &uuid) // static void LLViewerMedia::createSpareBrowserMediaSource() { + static bool failedLoading = false; + // If we don't have a spare browser media source, create one. // However, if PluginAttachDebuggerToPlugins is set then don't spawn a spare // SLPlugin process in order to not be confused by an unrelated gdb terminal // popping up at the moment we start a media plugin. - if (!sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) + if (!failedLoading && !sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) { // The null owner will keep the browser plugin from fully initializing // (specifically, it keeps LLPluginClassMedia from negotiating a size change, // which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color) sSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType("text/html", NULL, 0, 0); + if (!sSpareBrowserMediaSource) + { + failedLoading = true; + } } } @@ -1916,10 +1922,11 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ } LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL; + /* There is a reason why ^^ is ONCE LLSD args; args["MIME_TYPE"] = media_type; LLNotificationsUtil::add("NoPlugin", args); - + */ return NULL; } From 93e62a375c91dc8fb6695fce1470f5cedd9330a2 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 20 Oct 2013 20:17:03 +0200 Subject: [PATCH 18/62] WIP[win64]: Rebuilt jpeglib, libpng, fixed loading of fmodex --- indra/llaudio/llaudioengine_fmodex.cpp | 5 +++++ install.xml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index 300264d91..972725171 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -59,8 +59,13 @@ bool attemptDelayLoad() { __try { +#if defined(_WIN64) + if( FAILED( __HrLoadAllImportsForDll( "fmodex64.dll" ) ) ) + return false; +#else if( FAILED( __HrLoadAllImportsForDll( "fmodex.dll" ) ) ) return false; +#endif } __except( EXCEPTION_EXECUTE_HANDLER ) { diff --git a/install.xml b/install.xml index d96497d2f..b2aa1c991 100644 --- a/install.xml +++ b/install.xml @@ -844,7 +844,7 @@ windows64 md5sum - 4c6600c70c1075fca2343fcd21b35cfe + 79e328b10fae2090262c0bf02c9c5f71 url https://files.streamgrid.net/win64/singularity/jpeglib-8c-windows64-20131020.tar.bz2 @@ -938,7 +938,7 @@ windows64 md5sum - 9d2b32caa8b91ccb5c46be6a53eb071b + 00fc7bcb4016ecc57def9e3b3223d977 url https://files.streamgrid.net/win64/singularity/libpng-1.5.10-windows64-20131020.tar.bz2 From ea6adb7ae41d10d85a11e8af146ff9c0ac1906c9 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Mon, 21 Oct 2013 15:56:13 +0200 Subject: [PATCH 19/62] WIP[win64]: Sync this snipped with upstream to avoid texture indexing issues on Windows 64 --- indra/newview/llface.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 17ac4ef1a..80bbac340 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1860,15 +1860,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a texIdx; - U8 index = mTextureIndex < 255 ? mTextureIndex : 0; + S32 index = mTextureIndex < 255 ? mTextureIndex : 0; F32 val = 0.f; - U8* vp = (U8*) &val; - vp[0] = index; - vp[1] = 0; - vp[2] = 0; - vp[3] = 0; - + S32* vp = (S32*) &val; + *vp = index; + llassert(index <= LLGLSLShader::sIndexedTextureChannels-1); LLVector4Logical mask; From 73e1a9ad78f5d283fcd90f0dbb31ec3d22bfb6b9 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Mon, 21 Oct 2013 20:42:31 +0200 Subject: [PATCH 20/62] WIP[win64]: we haz 64 bit webkit --- indra/cmake/CopyWinLibs.cmake | 17 ++++++----------- indra/newview/CMakeLists.txt | 3 --- indra/plugins/CMakeLists.txt | 3 --- install.xml | 4 ++-- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/indra/cmake/CopyWinLibs.cmake b/indra/cmake/CopyWinLibs.cmake index 5081e4ac5..f588e7203 100644 --- a/indra/cmake/CopyWinLibs.cmake +++ b/indra/cmake/CopyWinLibs.cmake @@ -51,11 +51,8 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) -# Singu TODO::WIN64 -if (WORD_SIZE EQUAL 32) - # Debug config runtime files required for the plugin test mule -set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") +set(plugintest_debug_src_dir "${debug_libs_dir}") set(plugintest_debug_files libeay32.dll qtcored4.dll @@ -74,7 +71,7 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) # Debug config runtime files required for the plugin test mule (Qt image format plugins) -set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug/imageformats") +set(plugintest_debug_src_dir "${debug_libs_dir}/imageformats") set(plugintest_debug_files qgifd4.dll qicod4.dll @@ -100,7 +97,7 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) # Release & ReleaseDebInfo config runtime files required for the plugin test mule -set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") +set(plugintest_release_src_dir "${release_libs_dir}") set(plugintest_release_files libeay32.dll qtcore4.dll @@ -127,7 +124,7 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) # Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins) -set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/imageformats") +set(plugintest_release_src_dir "${release_libs_dir}/imageformats") set(plugintest_release_files qgif4.dll qico4.dll @@ -169,7 +166,7 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) # Debug config runtime files required for the plugins -set(plugins_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") +set(plugins_debug_src_dir "${debug_libs_dir}") set(plugins_debug_files libeay32.dll qtcored4.dll @@ -188,7 +185,7 @@ copy_if_different( set(all_targets ${all_targets} ${out_targets}) # Release & ReleaseDebInfo config runtime files required for the plugins -set(plugins_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") +set(plugins_release_src_dir "${release_libs_dir}") set(plugins_release_files libeay32.dll qtcore4.dll @@ -214,8 +211,6 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) -endif (WORD_SIZE EQUAL 32) -# /Singu TODO::WIN64 set(release_src_dir "${release_libs_dir}") set(release_files diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 98c48c22c..7ae9a2cf6 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1888,8 +1888,6 @@ if (WINDOWS) COMMENT "Copying SLPlugin executable to the runtime folder." ) -# Singu TODO::WIN64 - if(WORD_SIZE EQUAL 32) get_target_property(BUILT_WEBKIT_PLUGIN media_plugin_webkit LOCATION) add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD @@ -1901,7 +1899,6 @@ if (WINDOWS) ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin COMMENT "Copying WebKit Plugin to the runtime folder." ) - endif(WORD_SIZE EQUAL 32) get_target_property(BUILT_QUICKTIME_PLUGIN media_plugin_quicktime LOCATION) add_custom_command( diff --git a/indra/plugins/CMakeLists.txt b/indra/plugins/CMakeLists.txt index 36ba40f4d..259ed1bde 100644 --- a/indra/plugins/CMakeLists.txt +++ b/indra/plugins/CMakeLists.txt @@ -3,10 +3,7 @@ add_subdirectory(base_basic) add_subdirectory(base_media) add_subdirectory(filepicker) -# Singu TODO::WIN64 -if (NOT WINDOWS OR WORD_SIZE EQUAL 32) add_subdirectory(webkit) -endif (NOT WINDOWS OR WORD_SIZE EQUAL 32) if (LINUX) add_subdirectory(gstreamer010) diff --git a/install.xml b/install.xml index b2aa1c991..c9f3a4261 100644 --- a/install.xml +++ b/install.xml @@ -1029,9 +1029,9 @@ windows64 md5sum - ccb96fa1260ef6c3060d407b8c6b3972 + cf9e5d1d79531a7e4d45f78657da9c9b url - https://bitbucket.org/SingularityViewer/libraries/downloads/llqtwebkit-4.7.1-windows-20120228.tar.bz2 + https://files.streamgrid.net/win64/singularity/llqtwebkit-4.7.1-windows64-20131021.tar.bz2 From d95e1800e105f105e35ab252e3b44dac1f7a6867 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Oct 2013 15:15:17 -0400 Subject: [PATCH 21/62] Miscellaneous touchups Fixes chatbar not handling ctrl+shift+arrow for word selection lltoolmgr.cpp sync Removes some pointless dead code from llviewertexteditor.cpp --- indra/newview/lltoolmgr.cpp | 39 ++++++++++++++-------------- indra/newview/llviewertexteditor.cpp | 7 ----- indra/newview/llviewerwindow.cpp | 2 +- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 716edd7dd..92e525882 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -141,8 +141,6 @@ void LLToolMgr::initTools() gBasicToolset->addTool( LLToolCompInspect::getInstance() ); gFaceEditToolset->addTool( LLToolCamera::getInstance() ); - // In case focus was lost before we got here - clearSavedTool(); // On startup, use "select" tool setCurrentToolset(gBasicToolset); @@ -283,24 +281,7 @@ bool LLToolMgr::canEdit() void LLToolMgr::toggleBuildMode() { - if (inBuildMode()) - { - if (gSavedSettings.getBOOL("EditCameraMovement")) - { - // just reset the view, will pull us out of edit mode - handle_reset_view(); - } - else - { - // manually disable edit mode, but do not affect the camera - gAgentCamera.resetView(false); - gFloaterTools->close(); - gViewerWindow->showCursor(); - } - // avoid spurious avatar movements pulling out of edit mode - LLViewerJoystick::getInstance()->setNeedsReset(); - } - else + if (!inBuildMode()) { ECameraMode camMode = gAgentCamera.getCameraMode(); if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode) @@ -350,6 +331,24 @@ void LLToolMgr::toggleBuildMode() LLViewerJoystick::getInstance()->setNeedsReset(); } + else + { + if (gSavedSettings.getBOOL("EditCameraMovement")) + { + // just reset the view, will pull us out of edit mode + handle_reset_view(); + } + else + { + // manually disable edit mode, but do not affect the camera + gAgentCamera.resetView(false); + gFloaterTools->close(); + gViewerWindow->showCursor(); + } + // avoid spurious avatar movements pulling out of edit mode + LLViewerJoystick::getInstance()->setNeedsReset(); + } + } bool LLToolMgr::inBuildMode() diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 9704fe2cb..57e63be70 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1644,15 +1644,8 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF LLFontGL* font = LLView::selectFont(node); - // std::string text = node->getValue(); std::string text = node->getTextContents().substr(0, max_text_length - 1); - if (text.size() > max_text_length) - { - // Erase everything from max_text_length on. - text.erase(max_text_length); - } - LLViewerTextEditor* text_editor = new LLViewerTextEditor("text_editor", rect, max_text_length, diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 894b01b79..691df6035 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2809,7 +2809,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) case KEY_RIGHT: case KEY_UP: case KEY_DOWN: - if (mask == MASK_CONTROL) + if (mask & MASK_CONTROL) break; case KEY_PAGE_UP: case KEY_PAGE_DOWN: From dde18dfc0f6dec925717d02277418eb61f1687a3 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Oct 2013 16:01:31 -0400 Subject: [PATCH 22/62] Added a setting, LiruMouselookMenu, in case people don't want this feature. --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/lltoolcomp.cpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c1f005aba..1fce571f3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -786,6 +786,17 @@ Value 0 + LiruMouselookMenu + + Comment + Controls if holding Alt and right clicking in mouselook will bring up a menu + Persist + 1 + Type + Boolean + Value + 1 + LiruNewARCLimit Comment diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index f5459d867..9d520eaef 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -764,7 +764,7 @@ BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) // be shown. return FALSE; */ - if (mask & MASK_ALT) return false; + if (gSavedSettings.getBOOL("LiruMouselookMenu") && mask & MASK_ALT) return false; // Returning true will suppress the context menu return TRUE; From 5cd7f05851762dc7664f353554cf57b65e63a3d8 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Tue, 22 Oct 2013 00:58:05 +0200 Subject: [PATCH 23/62] VS2012 related changes --- indra/libhacd/hacdHACD.h | 2 +- indra/newview/llfloaterpathfindingobjects.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/indra/libhacd/hacdHACD.h b/indra/libhacd/hacdHACD.h index f3e0855b8..2ca9a4ae7 100644 --- a/indra/libhacd/hacdHACD.h +++ b/indra/libhacd/hacdHACD.h @@ -22,7 +22,7 @@ #include #include #include -#if defined(_WIN32) && _MSC_VER >= 1700 +#if defined(_MSC_VER) && _MSC_VER >= 1700 #include #endif namespace HACD diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index b872b83a4..7fe3311cb 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -397,14 +397,11 @@ void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjec } LLScrollListItem *scrollListItem = mObjectsScrollList->addElement(rowParams); -// Singu TODO::WIN64 -#if !defined(_WIN64) if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName()) { - mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem)); + mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem)); pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1)); } -#endif } void LLFloaterPathfindingObjects::updateControlsOnScrollListChange() From 22db8f56f1b09642b2297e658b8b8b43e04e6b80 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Tue, 22 Oct 2013 00:59:26 +0200 Subject: [PATCH 24/62] WIP[win64]: installer --- indra/cmake/CopyWinLibs.cmake | 18 ++++--- indra/lib/python/indra/util/llmanifest.py | 4 +- indra/newview/CMakeLists.txt | 2 + .../installers/windows/installer_template.nsi | 6 +-- indra/newview/viewer_manifest.py | 49 +++++++++++++------ 5 files changed, 55 insertions(+), 24 deletions(-) diff --git a/indra/cmake/CopyWinLibs.cmake b/indra/cmake/CopyWinLibs.cmake index f588e7203..7f47f60b7 100644 --- a/indra/cmake/CopyWinLibs.cmake +++ b/indra/cmake/CopyWinLibs.cmake @@ -6,13 +6,13 @@ include(CMakeCopyIfDifferent) -#if (WORD_SIZE EQUAL 32) -# set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") -# set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") -#else (WORD_SIZE EQUAL 32) +if(WORD_SIZE EQUAL 32) + set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") + set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") +else(WORD_SIZE EQUAL 32) set(debug_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/x86_64-win/lib/debug") set(release_libs_dir "${CMAKE_SOURCE_DIR}/../libraries/x86_64-win/lib/release") -#endif WORD_SIZE EQUAL 32) +endif(WORD_SIZE EQUAL 32) set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32") set(vivox_files @@ -214,7 +214,6 @@ set(all_targets ${all_targets} ${out_targets}) set(release_src_dir "${release_libs_dir}") set(release_files -# libtcmalloc_minimal.dll libhunspell.dll libapr-1.dll libaprutil-1.dll @@ -225,6 +224,13 @@ set(release_files glod.dll ) +if(WORD_SIZE EQUAL 32) + set(release_files ${release_files} + libtcmalloc_minimal.dll + ) +endif(WORD_SIZE EQUAL 32) + + if(FMODEX) if (WORD_SIZE EQUAL 32) set(fmodex_dll_file "fmodex.dll") diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 11945a239..1522e3e9a 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -192,6 +192,8 @@ def usage(srctree=""): arg['description'] % nd) def main(): + print "cwd:", os.getcwd() + print " ".join(sys.argv) option_names = [arg['name'] + '=' for arg in ARGUMENTS] option_names.append('help') options, remainder = getopt.getopt(sys.argv[1:], "", option_names) @@ -266,7 +268,7 @@ class LLManifest(object): __metaclass__ = LLManifestRegistry manifests = {} def for_platform(self, platform, arch = None): - if arch: + if arch and platform != "windows": platform = platform + '_' + arch return self.manifests[platform.lower()] for_platform = classmethod(for_platform) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 7ae9a2cf6..dad0d6bb5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1516,6 +1516,7 @@ if (WINDOWS) COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --arch=${ARCH} --artwork=${ARTWORK_DIR} --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} @@ -1537,6 +1538,7 @@ if (WINDOWS) COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --arch=${ARCH} --artwork=${ARTWORK_DIR} --actions=copy --branding_id=${VIEWER_BRANDING_ID} diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 8fa0a943c..7fb868205 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -63,7 +63,7 @@ LangString LanguageCode ${LANG_DUTCH} "nl" LangString LanguageCode ${LANG_PORTUGUESEBR} "pt" LangString LanguageCode ${LANG_SIMPCHINESE} "zh" -Name ${VIEWERNAME} +Name "${VIEWERNAME}" SubCaption 0 $(LicenseSubTitleSetup) ; override "license agreement" text @@ -71,7 +71,7 @@ BrandingText "Prepare to Implode!" ; bottom of window text Icon %%SOURCE%%\installers\windows\install_icon_singularity.ico UninstallIcon %%SOURCE%%\installers\windows\uninstall_icon_singularity.ico WindowIcon off ; show our icon in left corner -BGGradient 9090b0 000000 notext +# BGGradient 9090b0 000000 notext CRCCheck on ; make sure CRC is OK #InstProgressFlags smooth colored ; new colored smooth look InstProgressFlags @@ -80,7 +80,7 @@ ShowInstDetails show ; no details, no "show" button SetOverwrite on ; stomp files by default AutoCloseWindow true ; after all files install, close window -InstallDir "$PROGRAMFILES\${INSTNAME}" +InstallDir "%%INSTALLDIR%%" InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "" DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index b3d3bb508..3bfdd152f 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -176,6 +176,9 @@ class ViewerManifest(LLManifest): return " ".join((channel_flags, grid_flags, setting_flags)).strip() class WindowsManifest(ViewerManifest): + def is_win64(self): + return self.args.get('arch') == "x86_64" + def final_exe(self): return self.channel_oneword() + 'Viewer.exe' @@ -185,6 +188,11 @@ class WindowsManifest(ViewerManifest): # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe()) + + if self.is_win64(): + release_lib_dir = "../../libraries/x86_64-win/lib/release" + else: + release_lib_dir = "../../libraries/i686-win32/lib/release" # Plugin host application self.path(os.path.join(os.pardir, @@ -192,7 +200,7 @@ class WindowsManifest(ViewerManifest): "SLPlugin.exe") # Plugin volume control - if self.prefix(src=self.args['configuration'], dst=""): + if not self.is_win64() and self.prefix(src=self.args['configuration'], dst=""): self.path("winmm.dll") self.end_prefix() @@ -216,7 +224,7 @@ class WindowsManifest(ViewerManifest): #is shipped with windows anyway # For using FMOD for sound... DJS - #~if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): + #~if self.prefix(src=release_lib_dir, dst=""): #~try: #~self.path("fmod.dll") #~pass @@ -226,7 +234,7 @@ class WindowsManifest(ViewerManifest): #~self.end_prefix() # For textures - #if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): + #if self.prefix(src=release_lib_dir, dst=""): # self.path("openjpeg.dll") # self.end_prefix() @@ -246,7 +254,7 @@ class WindowsManifest(ViewerManifest): self.end_prefix() # For WebKit/Qt plugin runtimes - if self.prefix(src="../../libraries/i686-win32/lib/release", dst="llplugin"): + if self.prefix(src=release_lib_dir, dst="llplugin"): self.path("libeay32.dll") self.path("qtcore4.dll") self.path("qtgui4.dll") @@ -258,7 +266,7 @@ class WindowsManifest(ViewerManifest): self.end_prefix() # For WebKit/Qt plugin runtimes (image format plugins) - if self.prefix(src="../../libraries/i686-win32/lib/release/imageformats", dst="llplugin/imageformats"): + if self.prefix(src=release_lib_dir+"/imageformats", dst="llplugin/imageformats"): self.path("qgif4.dll") self.path("qico4.dll") self.path("qjpeg4.dll") @@ -267,7 +275,7 @@ class WindowsManifest(ViewerManifest): self.path("qtiff4.dll") self.end_prefix() - if self.prefix(src="../../libraries/i686-win32/lib/release/codecs", dst="llplugin/codecs"): + if self.prefix(src=release_lib_dir+"/codecs", dst="llplugin/codecs"): self.path("qcncodecs4.dll") self.path("qjpcodecs4.dll") self.path("qkrcodecs4.dll") @@ -282,7 +290,7 @@ class WindowsManifest(ViewerManifest): print err.message print "Skipping llcommon.dll (assuming llcommon was linked statically)" self.end_prefix() - if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): + if self.prefix(src=release_lib_dir, dst=""): self.path("libeay32.dll") self.path("ssleay32.dll") try: @@ -294,10 +302,11 @@ class WindowsManifest(ViewerManifest): self.end_prefix() # For google-perftools tcmalloc allocator. - self.path("../../libraries/i686-win32/lib/release/libtcmalloc_minimal.dll", dst="libtcmalloc_minimal.dll") + if not self.is_win64(): + self.path(release_lib_dir+"/libtcmalloc_minimal.dll", dst="libtcmalloc_minimal.dll") try: - if self.prefix("../../libraries/i686-win32/lib/release/msvcrt", dst=""): + if self.prefix(release_lib_dir+"/msvcrt", dst=""): self.path("*.dll") self.path("*.manifest") self.end_prefix() @@ -386,6 +395,13 @@ class WindowsManifest(ViewerManifest): prev = d return result + + def installer_file(self): + if self.is_win64(): + mask = "%s_%s_x86-64_Setup.exe" + else: + mask = "%s_%s_Setup.exe" + return mask % (self.channel_oneword(), '-'.join(self.args['version'])) def package_finish(self): # a standard map of strings for replacing in the templates @@ -401,6 +417,9 @@ class WindowsManifest(ViewerManifest): 'channel':self.channel(), 'channel_oneword':self.channel_oneword(), 'channel_unique':self.channel_unique(), + 'inst_name':self.channel_oneword() + ' (64 bit)' if self.is_win64() else self.channel_oneword(), + 'installer_file':self.installer_file(), + 'viewer_name': "%s%s" % (self.channel(), " (64 bit)" if self.is_win64() else "" ), } version_vars = """ @@ -409,13 +428,13 @@ class WindowsManifest(ViewerManifest): !define VERSION_LONG "%(version)s" !define VERSION_DASHES "%(version_dashes)s" """ % substitution_strings - installer_file = "%(channel_oneword)s_%(version_dashes)s_Setup.exe" + installer_file = "%(installer_file)s" grid_vars_template = """ OutFile "%(installer_file)s" - !define VIEWERNAME "%(channel)s" + !define VIEWERNAME "%(viewer_name)s" !define INSTFLAGS "%(flags)s" - !define INSTNAME "%(channel_oneword)s" - !define SHORTCUT "%(channel)s Viewer" + !define INSTNAME "%(inst_name)s" + !define SHORTCUT "%(viewer_name)s Viewer" !define URLNAME "secondlife" !define INSTALL_ICON "install_icon_singularity.ico" !define UNINSTALL_ICON "install_icon_singularity.ico" @@ -435,7 +454,9 @@ class WindowsManifest(ViewerManifest): "%%SOURCE%%":self.get_src_prefix(), "%%GRID_VARS%%":grid_vars_template % substitution_strings, "%%INSTALL_FILES%%":self.nsi_file_commands(True), - "%%DELETE_FILES%%":self.nsi_file_commands(False)}) + "%%DELETE_FILES%%":self.nsi_file_commands(False), + "%%INSTALLDIR%%":"%s\\%s" % ('$PROGRAMFILES64' if self.is_win64() else '$PROGRAMFILES', self.channel_oneword()), + }) # We use the Unicode version of NSIS, available from # http://www.scratchpaper.com/ From f7cea9ac74e1819e498858407b47367c6aebb4df Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Tue, 22 Oct 2013 01:08:39 +0200 Subject: [PATCH 25/62] Added a way to identify 64 bit viewer in help -> about --- indra/newview/llfloaterabout.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 944335528..d47f5fb43 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -136,6 +136,9 @@ LLFloaterAbout::LLFloaterAbout() // Version string std::string version = std::string(LLAppViewer::instance()->getSecondLifeTitle() +#if defined(_WIN64) || defined(__x86_64__) + + " (64 bit)" +#endif + llformat(" %d.%d.%d (%d) %s %s (%s)\n", gVersionMajor, gVersionMinor, gVersionPatch, LL_VIEWER_BUILD, __DATE__, __TIME__, From f545952136d9a2fd0ba96b8ead37fdaaef0e11eb Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Tue, 22 Oct 2013 11:25:32 +0200 Subject: [PATCH 26/62] Copy vc++ runtime libs, ignore size_t related warnings in the release build on win64 --- indra/cmake/00-Common.cmake | 6 ++- indra/cmake/CopyWinLibs.cmake | 99 ----------------------------------- indra/newview/CMakeLists.txt | 17 ++++++ 3 files changed, 21 insertions(+), 101 deletions(-) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index f6a9c0772..c2458b098 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -88,9 +88,11 @@ if (WINDOWS) ) # SSE2 is implied on win64 - if (WORD_SIZE EQUAL 32) + if(WORD_SIZE EQUAL 32) add_definitions(/arch:SSE2) - endif (WORD_SIZE EQUAL 32) + else(WORD_SIZE EQUAL 32) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4250 /wd4244") + endif(WORD_SIZE EQUAL 32) # configure win32 API for windows XP+ compatibility set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") diff --git a/indra/cmake/CopyWinLibs.cmake b/indra/cmake/CopyWinLibs.cmake index 7f47f60b7..afd4d31f7 100644 --- a/indra/cmake/CopyWinLibs.cmake +++ b/indra/cmake/CopyWinLibs.cmake @@ -306,105 +306,6 @@ copy_if_different( ) set(all_targets ${all_targets} ${out_targets}) -# Copy MS C runtime dlls, required for packaging. -# *TODO - Adapt this to support VC9 -if (MSVC80) - FIND_PATH(debug_msvc8_redist_path msvcr80d.dll - PATHS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT - NO_DEFAULT_PATH - NO_DEFAULT_PATH - ) - - if(EXISTS ${debug_msvc8_redist_path}) - set(debug_msvc8_files - msvcr80d.dll - msvcp80d.dll - Microsoft.VC80.DebugCRT.manifest - ) - - copy_if_different( - ${debug_msvc8_redist_path} - "${CMAKE_CURRENT_BINARY_DIR}/Debug" - out_targets - ${debug_msvc8_files} - ) - set(all_targets ${all_targets} ${out_targets}) - - set(debug_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Debug/${VIEWER_BINARY_NAME}.exe.config) - add_custom_command( - OUTPUT ${debug_appconfig_file} - COMMAND ${PYTHON_EXECUTABLE} - ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py - ${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest - ${CMAKE_CURRENT_SOURCE_DIR}/SecondLifeDebug.exe.config - ${debug_appconfig_file} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Debug/Microsoft.VC80.DebugCRT.manifest - COMMENT "Creating debug app config file" - ) - - endif (EXISTS ${debug_msvc8_redist_path}) - - FIND_PATH(release_msvc8_redist_path msvcr80.dll - PATHS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT - NO_DEFAULT_PATH - NO_DEFAULT_PATH - ) - - if(EXISTS ${release_msvc8_redist_path}) - set(release_msvc8_files - msvcr80.dll - msvcp80.dll - Microsoft.VC80.CRT.manifest - ) - - copy_if_different( - ${release_msvc8_redist_path} - "${CMAKE_CURRENT_BINARY_DIR}/Release" - out_targets - ${release_msvc8_files} - ) - set(all_targets ${all_targets} ${out_targets}) - - copy_if_different( - ${release_msvc8_redist_path} - "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" - out_targets - ${release_msvc8_files} - ) - set(all_targets ${all_targets} ${out_targets}) - - set(release_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/Release/${VIEWER_BINARY_NAME}.exe.config) - add_custom_command( - OUTPUT ${release_appconfig_file} - COMMAND ${PYTHON_EXECUTABLE} - ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py - ${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest - ${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config - ${release_appconfig_file} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Release/Microsoft.VC80.CRT.manifest - COMMENT "Creating release app config file" - ) - - set(relwithdebinfo_appconfig_file ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${VIEWER_BINARY_NAME}.exe.config) - add_custom_command( - OUTPUT ${relwithdebinfo_appconfig_file} - COMMAND ${PYTHON_EXECUTABLE} - ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/build_win32_appConfig.py - ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest - ${CMAKE_CURRENT_SOURCE_DIR}/SecondLife.exe.config - ${relwithdebinfo_appconfig_file} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/Microsoft.VC80.CRT.manifest - COMMENT "Creating relwithdebinfo app config file" - ) - - endif (EXISTS ${release_msvc8_redist_path}) -endif (MSVC80) - add_custom_target(copy_win_libs ALL DEPENDS ${all_targets} diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index dad0d6bb5..c679682a1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -47,6 +47,8 @@ include(LLAppearance) if (WINDOWS) include(CopyWinLibs) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) + include(InstallRequiredSystemLibraries) endif (WINDOWS) include_directories( @@ -1859,6 +1861,21 @@ endif (LL_TESTS) # Don't do these for DARWIN or LINUX here -- they're taken care of by viewer_manifest.py if (WINDOWS) + IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) + FOREACH(RUNTIME_LIB ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) + add_custom_command( + TARGET ${VIEWER_BINARY_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + -E + copy_if_different + ${RUNTIME_LIB} + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + COMMENT "Copying ${RUNTIME_LIB} to the runtime folder." + ) + ENDFOREACH(RUNTIME_LIB ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) + ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) + get_target_property(BUILT_LLCOMMON llcommon LOCATION) set_target_properties(llcommon From 9ec10cf2462df368202668a05a7417bedff08865 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Oct 2013 07:47:43 -0400 Subject: [PATCH 27/62] Reworked LLToolCompGun so piemenu in mouselook plays nicer with zoom feature Switches to exodus implementation Includes relicensing of LLViewerCamera and LLToolComp Maintains use of the old saved zoomed setting --- indra/newview/app_settings/settings.xml | 33 ----- indra/newview/lltoolcomp.cpp | 163 +++++++++++++++--------- indra/newview/lltoolcomp.h | 46 ++++--- indra/newview/llviewercamera.cpp | 46 ++++--- indra/newview/llviewercamera.h | 42 +++--- indra/newview/llviewerwindow.cpp | 20 --- 6 files changed, 177 insertions(+), 173 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1fce571f3..c3f3f2aa8 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -210,17 +210,6 @@ 100 - zmm_deffov - - Comment - Default field of viewer for right click mouse zoom. - Persist - 1 - Type - F32 - Value - 1.0 - zmm_mlfov Comment @@ -232,28 +221,6 @@ Value 1 - zmm_isinml - - Comment - mouselook - Persist - 0 - Type - Boolean - Value - 0 - - zmm_rightmousedown - - Comment - insert rude comment here - Persist - 0 - Type - Boolean - Value - 0 - AllowLargeSounds diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 9d520eaef..a205ca7ef 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -2,31 +2,25 @@ * @file lltoolcomp.cpp * @brief Composite tools * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -49,6 +43,7 @@ #include "lltoolmgr.h" #include "lltoolselectrect.h" #include "lltoolplacer.h" +#include "llviewercamera.h" // #include "llviewermenu.h" #include "llviewerobject.h" #include "llviewerwindow.h" @@ -57,7 +52,7 @@ #include "llfloatertools.h" #include "qtoolalign.h" #include "llviewercontrol.h" -#include "llviewercamera.h" + const S32 BUTTON_HEIGHT = 16; const S32 BUTTON_WIDTH_SMALL = 32; @@ -659,6 +654,7 @@ void LLToolCompRotate::render() LLToolCompGun::LLToolCompGun() : LLToolComposite(std::string("Mouselook")) + , mRightMouseButton(false), mMenuShown(false), mTimerFOV() // { mGun = new LLToolGun(this); mGrab = new LLToolGrab(this); @@ -666,8 +662,12 @@ LLToolCompGun::LLToolCompGun() setCurrentTool(mGun); mDefault = mGun; -} + // + mTimerFOV.stop(); + mStartFOV = mOriginalFOV = mTargetFOV = LLViewerCamera::getInstance()->getAndSaveDefaultFOV(); + // +} LLToolCompGun::~LLToolCompGun() { @@ -751,25 +751,9 @@ BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask); } - +/* Singu Note: Moved to bottom, upstream is Exodus BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - /* JC - suppress context menu 8/29/2002 - - // On right mouse, go through some convoluted steps to - // make the build menu appear. - setCurrentTool( (LLTool*) mNull ); - - // This should return FALSE, meaning the context menu will - // be shown. - return FALSE; - */ - if (gSavedSettings.getBOOL("LiruMouselookMenu") && mask & MASK_ALT) return false; - - // Returning true will suppress the context menu - return TRUE; -} - +*/ BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask) { @@ -800,27 +784,92 @@ void LLToolCompGun::handleDeselect() setMouseCapture(FALSE); } +// + +BOOL LLToolCompGun::handleRightMouseUp(S32 x, S32 y, MASK mask) +{ + // Singu Note: Beware the alt-click menu + if (mRightMouseButton) + { + mRightMouseButton = false; + + mStartFOV = LLViewerCamera::getInstance()->getDefaultFOV(); + mTargetFOV = mOriginalFOV; + mTimerFOV.start(); + } + + if (mMenuShown) + { + mMenuShown = false; + return LLToolComposite::handleRightMouseUp(x, y, mask); + } + + return TRUE; +} + +BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + // Singu Note: Beware the alt-click menu + if (gSavedSettings.getBOOL("LiruMouselookMenu") && mask & MASK_ALT) + { + mMenuShown = true; + return false; + } + + mRightMouseButton = true; + + if(!mTimerFOV.getStarted()) + { + mStartFOV = LLViewerCamera::getInstance()->getAndSaveDefaultFOV(); + mOriginalFOV = mStartFOV; + } + else mStartFOV = LLViewerCamera::getInstance()->getDefaultFOV(); + + mTargetFOV = gSavedPerAccountSettings.getF32("zmm_mlfov"); + mTimerFOV.start(); + + return TRUE; +} BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks) { - //::MOYMOD:: - if(gSavedSettings.getBOOL("zmm_isinml") == 1) + if (mRightMouseButton) { - if(clicks > 0) - { - gSavedSettings.setF32("zmm_mlfov", gSavedSettings.getF32("zmm_mlfov") / 1.1); - } - else if(clicks < 0) - { - gSavedSettings.setF32("zmm_mlfov", gSavedSettings.getF32("zmm_mlfov") * 1.1); - } - LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("zmm_deffov") / gSavedSettings.getF32("zmm_mlfov")); - return TRUE; - } - if (clicks > 0) - { - gAgentCamera.changeCameraToDefault(); + mStartFOV = LLViewerCamera::getInstance()->getDefaultFOV(); + gSavedPerAccountSettings.setF32( + "zmm_mlfov", + mTargetFOV = clicks > 0 ? + llclamp(mTargetFOV += (0.05f * clicks), 0.1f, 3.0f) : + llclamp(mTargetFOV -= (0.05f * -clicks), 0.1f, 3.0f) + ); + + mTimerFOV.start(); } + else if (clicks > 0) gAgentCamera.changeCameraToDefault(); + return TRUE; } + +// Zoom related stuff... + +void LLToolCompGun::draw() +{ + if (mTimerFOV.getStarted()) + { + if (!LLViewerCamera::getInstance()->mSavedFOVLoaded && mStartFOV != mTargetFOV) + { + F32 timer = mTimerFOV.getElapsedTimeF32(); + + if (timer > 0.15f) + { + LLViewerCamera::getInstance()->setDefaultFOV(mTargetFOV); + mTimerFOV.stop(); + } + else LLViewerCamera::getInstance()->setDefaultFOV(lerp(mStartFOV, mTargetFOV, timer * 6.66f)); + } + else mTimerFOV.stop(); + } +} + +// diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h index 81ed0ba8e..07cf2815b 100644 --- a/indra/newview/lltoolcomp.h +++ b/indra/newview/lltoolcomp.h @@ -2,31 +2,25 @@ * @file lltoolcomp.h * @brief Composite tools * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -219,10 +213,13 @@ public: LLToolCompGun(); virtual ~LLToolCompGun(); + virtual void draw(); // + // Overridden from LLToolComposite virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); @@ -235,6 +232,13 @@ protected: LLToolGun* mGun; LLToolGrab* mGrab; LLTool* mNull; + + // +private: + bool mRightMouseButton, mMenuShown; + LLTimer mTimerFOV; + F32 mOriginalFOV, mStartFOV, mTargetFOV; + // }; diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 9266dc434..b70183fd4 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -2,31 +2,25 @@ * @file llviewercamera.cpp * @brief LLViewerCamera class implementation * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$ */ @@ -113,6 +107,7 @@ LLViewerCamera::LLViewerCamera() : LLCamera() { calcProjection(getFar()); mCameraFOVDefault = DEFAULT_FIELD_OF_VIEW; + mSavedFOVDefault = DEFAULT_FIELD_OF_VIEW; // mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f); mPixelMeterRatio = 0.f; mScreenPixelArea = 0; @@ -927,6 +922,15 @@ void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads) mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f); } +// +void LLViewerCamera::loadDefaultFOV() +{ + setView(mSavedFOVDefault); + mSavedFOVLoaded = true; + mCameraFOVDefault = mSavedFOVDefault; + mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f); +} +// // static void LLViewerCamera::updateCameraAngle( void* user_data, const LLSD& value) diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 82d88bc3d..d9ac2af30 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -2,31 +2,25 @@ * @file llviewercamera.h * @brief LLViewerCamera class header file * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$ */ @@ -118,6 +112,11 @@ public: void setDefaultFOV(F32 fov) ; F32 getDefaultFOV() { return mCameraFOVDefault; } + bool mSavedFOVLoaded; // + F32 getAndSaveDefaultFOV() { mSavedFOVLoaded = false; return mSavedFOVDefault = mCameraFOVDefault; } // + void setAndSaveDefaultFOV(F32 fov) { setDefaultFOV(mSavedFOVDefault = fov); } // + void loadDefaultFOV(); // + BOOL cameraUnderWater() const; const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } @@ -141,6 +140,7 @@ protected: mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix mutable LLMatrix4 mModelviewMatrix; F32 mCameraFOVDefault; + F32 mSavedFOVDefault; // F32 mCosHalfCameraFOV; LLVector3 mLastPointOfInterest; F32 mPixelMeterRatio; // Divide by distance from camera to get pixels per meter at that distance. diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 691df6035..1348d23b8 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1015,18 +1015,6 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { - //From Phoenix - // Singu TODO: Change these from debug settings to externs? - gSavedSettings.setBOOL("zmm_rightmousedown", true); - if (gAgentCamera.cameraMouselook() && !gSavedSettings.getBOOL("zmm_isinml")) - { - llinfos << "zmmisinml set to true" << llendl; - gSavedSettings.setBOOL("zmm_isinml", true); - F32 deffov = LLViewerCamera::getInstance()->getDefaultFOV(); - gSavedSettings.setF32("zmm_deffov", deffov); - LLViewerCamera::getInstance()->setDefaultFOV(deffov/gSavedSettings.getF32("zmm_mlfov")); - } - S32 x = pos.mX; S32 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); @@ -1055,14 +1043,6 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - gSavedSettings.setBOOL("zmm_rightmousedown", false); - if(gSavedSettings.getBOOL("zmm_isinml")==1) - { - llinfos << "zmmisinml set to false" << llendl; - gSavedSettings.setBOOL("zmm_isinml",0); - LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("zmm_deffov")); - } - BOOL down = FALSE; return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } From b800e877f9b1703f9ea6ee1897d54001a38213bd Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Tue, 22 Oct 2013 14:01:46 +0200 Subject: [PATCH 28/62] More manifest gymnastics --- indra/newview/CMakeLists.txt | 2 +- indra/newview/viewer_manifest.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c679682a1..0ebcc899f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1870,7 +1870,7 @@ if (WINDOWS) -E copy_if_different ${RUNTIME_LIB} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Copying ${RUNTIME_LIB} to the runtime folder." ) ENDFOREACH(RUNTIME_LIB ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 3bfdd152f..f86d5fd4d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -305,11 +305,16 @@ class WindowsManifest(ViewerManifest): if not self.is_win64(): self.path(release_lib_dir+"/libtcmalloc_minimal.dll", dst="libtcmalloc_minimal.dll") + #try: + # if self.prefix(release_lib_dir+"/msvcrt", dst=""): + # self.path("*.dll") + # self.path("*.manifest") + # self.end_prefix() + #except: + # pass + try: - if self.prefix(release_lib_dir+"/msvcrt", dst=""): - self.path("*.dll") - self.path("*.manifest") - self.end_prefix() + self.path("msvc*.dll") except: pass From 45cd0157efdb8f8fcba3cd7893c28de6307eb47c Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Oct 2013 08:16:12 -0400 Subject: [PATCH 29/62] LLViewerWindow::handleKey(): Code cleanup, bit of harmless sync Moved Notifications Console into the advanced menu for login, so it's not shoved in as a hack, also a bit easier to access --- indra/newview/llviewermenu.cpp | 2 + indra/newview/llviewerwindow.cpp | 64 +++++--------------------------- 2 files changed, 11 insertions(+), 55 deletions(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 787a345c8..dcb7a4eb7 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -748,6 +748,8 @@ void init_menus() menu = new LLMenuGL(CLIENT_MENU_NAME); menu->setCanTearOff(FALSE); menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle, NULL, NULL)); + // Debugging view for unified notifications: CTRL-SHIFT-5 + menu->addChild(new LLMenuItemCallGL("Notifications Console...", handle_show_notifications_console, NULL, NULL, '5', MASK_CONTROL|MASK_SHIFT)); gLoginMenuBarView->addChild(menu); menu->updateParent(LLMenuGL::sMenuContainer); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1348d23b8..6b75e87c1 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2693,12 +2693,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } // HACK look for UI editing keys - if (LLView::sEditingUI) + if (LLView::sEditingUI && LLFloaterEditUI::processKeystroke(key, mask)) { - if (LLFloaterEditUI::processKeystroke(key, mask)) - { - return TRUE; - } + return TRUE; } // Explicit hack for debug menu. @@ -2709,31 +2706,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) toggle_debug_menus(NULL); } - // Explicit hack for debug menu. - //Singu note: We do not use the ForceShowGrid setting. Grid selection should always be visible. - /*if ((mask == (MASK_SHIFT | MASK_CONTROL)) && - ('G' == key || 'g' == key)) - { - if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page - { - BOOL visible = ! gSavedSettings.getBOOL("ForceShowGrid"); - gSavedSettings.setBOOL("ForceShowGrid", visible); - - // Initialize visibility (and don't force visibility - use prefs) - LLPanelLogin::updateLocationSelectorsVisibility(); - } - }*/ - - // Debugging view for unified notifications: CTRL-SHIFT-5 - // *FIXME: Having this special-cased right here (just so this can be invoked from the login screen) sucks. - if ((MASK_SHIFT & mask) - && (!(MASK_ALT & mask)) - && (MASK_CONTROL & mask) - && ('5' == key)) - { - LLFloaterNotificationConsole::showInstance(); - return TRUE; - } // handle shift-escape key (reset camera view) if (key == KEY_ESCAPE && mask == MASK_SHIFT) @@ -2742,18 +2714,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - // handle escape key - //if (key == KEY_ESCAPE && mask == MASK_NONE) - //{ - // *TODO: get this to play well with mouselook and hidden - // cursor modes, etc, and re-enable. - //if (gFocusMgr.getMouseCapture()) - //{ - // gFocusMgr.setMouseCapture(NULL); - // return TRUE; - //} - //} // let menus handle navigation keys if (gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) @@ -2778,10 +2739,13 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if (gChatBar->getCurrentChat().empty() || gSavedSettings.getBOOL("ArrowKeysMoveAvatar")) { - // Singu Note: We do this differently from LL to preserve the Ctrl- behavior in the chatbar + /* Singu Note: We do this differently from LL to preserve the Ctrl- behavior in the chatbar, and we don't need alt because we're not CHUI // let Control-Up and Control-Down through for chat line history, - //if (!(key == KEY_UP && mask == MASK_CONTROL) - // && !(key == KEY_DOWN && mask == MASK_CONTROL)) + if (!(key == KEY_UP && mask == MASK_CONTROL) + && !(key == KEY_DOWN && mask == MASK_CONTROL) + && !(key == KEY_UP && mask == MASK_ALT) + && !(key == KEY_DOWN && mask == MASK_ALT)) + */ { switch(key) { @@ -2803,6 +2767,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } } + if (keyboard_focus->handleKey(key, mask, FALSE)) { return TRUE; @@ -2827,17 +2792,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - // Topmost view gets a chance before the hierarchy - // *FIX: get rid of this? - //LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - //if (top_ctrl) - //{ - // if( top_ctrl->handleKey( key, mask, TRUE ) ) - // { - // return TRUE; - // } - //} - // give floaters first chance to handle TAB key // so frontmost floater gets focus if (key == KEY_TAB) From 75ee99f4d5748e37450f2c530971da8bb59d74b5 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Oct 2013 09:08:41 -0400 Subject: [PATCH 30/62] LLViewerWindow::handleKey(): More harmlessness (sync) Handle Tabbing through elements/floaters earlier. Combine g*Menu*View handleKey() checks. --- indra/newview/llviewerwindow.cpp | 52 ++++++++++++++------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6b75e87c1..ba1335b8d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2706,7 +2706,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) toggle_debug_menus(NULL); } - // handle shift-escape key (reset camera view) if (key == KEY_ESCAPE && mask == MASK_SHIFT) { @@ -2714,16 +2713,32 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - - - // let menus handle navigation keys - if (gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) + // let menus handle navigation keys for navigation + if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) + || (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))) { return TRUE; } - // let menus handle navigation keys - if (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE)) + + // give floaters first chance to handle TAB key + // so frontmost floater gets focus + // if nothing has focus, go to first or last UI element as appropriate + if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL)) { + if (gMenuHolder) gMenuHolder->hideMenus(); + + // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode + gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0); + + // do CTRL-TAB and CTRL-SHIFT-TAB logic + if (mask & MASK_SHIFT) + { + mRootView->focusPrevRoot(); + } + else + { + mRootView->focusNextRoot(); + } return TRUE; } @@ -2792,30 +2807,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - // give floaters first chance to handle TAB key - // so frontmost floater gets focus - if (key == KEY_TAB) - { - // if nothing has focus, go to first or last UI element as appropriate - if (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL) - { - if (gMenuHolder) gMenuHolder->hideMenus(); - // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode - gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0); - - // do CTRL-TAB and CTRL-SHIFT-TAB logic - if (mask & MASK_SHIFT) - { - mRootView->focusPrevRoot(); - } - else - { - mRootView->focusNextRoot(); - } - return TRUE; - } - } // give menus a chance to handle keys if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) From 1aee941cb6e88934de18ee9bafee90b11cd1afb5 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Oct 2013 09:19:38 -0400 Subject: [PATCH 31/62] LLViewerWindow::handleKey(): The work in progress bits of the sync, commented out --- indra/newview/llviewerwindow.cpp | 35 ++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ba1335b8d..17c8f6949 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2720,6 +2720,29 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } + LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); + + /* + // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus + // as long as focus isn't locked + if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked()) + { + // Check the current floater's menu first, if it has one. + if (gFocusMgr.keyboardFocusHasAccelerators() + && keyboard_focus + && keyboard_focus->handleKey(key,mask,FALSE)) + { + return TRUE; + } + + if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) + || (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) + { + return TRUE; + } + } + */ + // give floaters first chance to handle TAB key // so frontmost floater gets focus // if nothing has focus, go to first or last UI element as appropriate @@ -2741,9 +2764,15 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } return TRUE; } + /* Singu TODO: gEditMenu? + // hidden edit menu for cut/copy/paste + if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask)) + { + return TRUE; + } + */ // Traverses up the hierarchy - LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); if( keyboard_focus ) { // arrow keys move avatar while chatting hack @@ -2807,9 +2836,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - - - // give menus a chance to handle keys + // give menus a chance to handle unmodified accelerator keys if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) { From 574d0dab8dd00411b1f640261760b3b6fdcd94ab Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Oct 2013 22:39:15 -0400 Subject: [PATCH 32/62] LLViewerWindow::handleKey(): Also handle keys for navigating through the displayed menu --- indra/newview/llviewerwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 17c8f6949..03b3cd673 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2715,7 +2715,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // let menus handle navigation keys for navigation if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE)) - || (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))) + || (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE)) + || (gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))) { return TRUE; } From fd42029a615475adaf13b8f5d6e535f28d209366 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Oct 2013 23:35:53 -0400 Subject: [PATCH 33/62] LLViewerWindow::handleKey(): Partial Fix for Issue 704: Keyboard shortcuts that should be passed to focused text fields are instead passed to selected prims when building All edit keys now work, but Ctrl-A still doesn't work right, it must be grabbed by something else... Adds LLFocusMgr::keyboardFocusHasAccelerators() Adds virtual bool LLView::hasAccelerators() which returns false by default, overrides returning true placed in LLPreviewScript and LLPreviewNotecard Shortcut keys added to notecard and script menu xmls I'm thinking Qarl's Align tool handling may be receiving the Ctrl-A, we do seem to handle it differently than Exodus and Firestorm something modern could have broken the old way.. Come to think of it, those two features(Align and Select all prims) have a longstanding shortcut conflict in shortcuts... that's pretty nasty --- indra/llui/llfocusmgr.cpp | 14 ++++++ indra/llui/llfocusmgr.h | 1 + indra/llui/llview.h | 5 +++ indra/newview/llpreviewnotecard.h | 1 + indra/newview/llpreviewscript.h | 2 + indra/newview/llviewerwindow.cpp | 4 +- .../xui/en-us/floater_preview_notecard.xml | 36 ++++++---------- .../floater_preview_notecard_keep_discard.xml | 36 ++++++---------- .../xui/en-us/floater_script_ed_panel.xml | 43 ++++++------------- 9 files changed, 63 insertions(+), 79 deletions(-) diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 7817fd0d5..e5242f7db 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -366,6 +366,20 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f } } +bool LLFocusMgr::keyboardFocusHasAccelerators() const +{ + LLView* focus_view = dynamic_cast(mKeyboardFocus); + while(focus_view) + { + if (focus_view->hasAccelerators()) + { + return true; + } + + focus_view = focus_view->getParent(); + } + return false; +} void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor ) { diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 5f1466f5d..7e5e50dfb 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -121,6 +121,7 @@ public: void unlockFocus(); BOOL focusLocked() const { return mLockedView != NULL; } + bool keyboardFocusHasAccelerators() const; struct Impl; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index b009bab41..cc7ce21eb 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -357,6 +357,11 @@ public: BOOL focusNextRoot(); BOOL focusPrevRoot(); + // Normally we want the app menus to get priority on accelerated keys + // However, sometimes we want to give specific views a first chance + // at handling them. (eg. the script editor) + virtual bool hasAccelerators() const { return false; } + virtual void deleteAllChildren(); virtual void setTentative(BOOL b); diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 442673c0c..6ea6e1ba8 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -66,6 +66,7 @@ public: // llview virtual void draw(); + virtual bool hasAccelerators() const { return true; } virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void setEnabled( BOOL enabled ); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index ace3f9949..906708333 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -128,6 +128,8 @@ public: static BOOL enableSelectAllMenu(void* userdata); static BOOL enableDeselectMenu(void* userdata); + virtual bool hasAccelerators() const { return true; } + private: static bool onHelpWebDialog(const LLSD& notification, const LLSD& response); static void onBtnHelp(void* userdata); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 03b3cd673..7ea6c9890 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2723,7 +2723,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); - /* // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus // as long as focus isn't locked if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked()) @@ -2736,13 +2735,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } + /* Singu Note: This caused a bug where the menu ate keys before parents of keyboard_focus for some reason, breaking multifloaters usage of ctrl-w to close their selected child floater if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) || (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) { return TRUE; } + */ } - */ // give floaters first chance to handle TAB key // so frontmost floater gets focus diff --git a/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml index 5307864c6..90a0a592e 100644 --- a/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml +++ b/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml @@ -24,30 +24,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + Date: Tue, 22 Oct 2013 23:59:50 -0400 Subject: [PATCH 34/62] Sometimes UI get this syncing feeling... but then everything seems fine. --- indra/llui/llmenugl.cpp | 8 ++--- indra/llui/llmultifloater.cpp | 64 +++++++++++++++++++++++++++-------- indra/llui/llmultifloater.h | 6 +++- 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index c501d865c..a0355d003 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -626,12 +626,12 @@ BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) { // the menu items are in the child list in bottom up order LLView* prev_menu_item = parent_menu->findNextSibling(this); - return prev_menu_item ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; + return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; } else { LLView* next_menu_item = parent_menu->findPrevSibling(this); - return next_menu_item ? next_menu_item->handleMouseDown(x, 0, mask) : FALSE; + return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseDown(x, 0, mask) : FALSE; } } @@ -641,12 +641,12 @@ BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) if (y > getRect().getHeight() / 2) { LLView* prev_menu_item = parent_menu->findNextSibling(this); - return prev_menu_item ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; + return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; } else { LLView* next_menu_item = parent_menu->findPrevSibling(this); - return next_menu_item ? next_menu_item->handleMouseUp(x, 0, mask) : FALSE; + return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseUp(x, 0, mask) : FALSE; } } diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 07b811f71..1db97fe7c 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -187,7 +187,8 @@ BOOL LLMultiFloater::closeAllFloaters() //Tab did not actually close, possibly due to a pending Save Confirmation dialog.. //so try and close the next one in the list... tabToClose++; - }else + } + else { //Tab closed ok. lastTabCount = mTabContainer->getTabCount(); @@ -252,7 +253,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, else if (floaterp->getHost()) { // floaterp is hosted by somebody else and - // this is adding it, so remove it from it's old host + // this is adding it, so remove it from its old host floaterp->getHost()->removeFloater(floaterp); } else if (floaterp->getParent() == gFloaterView) @@ -302,8 +303,21 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, { floaterp->setVisible(FALSE); } + + // Tabs sometimes overlap resize handle + moveResizeHandlesToFront(); } +void LLMultiFloater::updateFloaterTitle(LLFloater* floaterp) +{ + S32 index = mTabContainer->getIndexForPanel(floaterp); + if (index != -1) + { + mTabContainer->setPanelTitle(index, floaterp->getShortTitle()); + } +} + + /** BOOL selectFloater(LLFloater* floaterp) @@ -329,8 +343,9 @@ void LLMultiFloater::selectPrevFloater() mTabContainer->selectPrevTab(); } -void LLMultiFloater::showFloater(LLFloater* floaterp) +void LLMultiFloater::showFloater(LLFloater* floaterp, LLTabContainer::eInsertionPoint insertion_point) { + if(!floaterp) return; // we won't select a panel that already is selected // it is hard to do this internally to tab container // as tab selection is handled via index and the tab at a given @@ -338,7 +353,7 @@ void LLMultiFloater::showFloater(LLFloater* floaterp) if (floaterp != mTabContainer->getCurrentPanel() && !mTabContainer->selectTabPanel(floaterp)) { - addFloater(floaterp, TRUE); + addFloater(floaterp, TRUE, insertion_point); } } @@ -417,6 +432,13 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) if (floater && floater->canClose() && floater->isCloseable()) { floater->close(); + + // EXT-5695 (Tabbed IM window loses focus if close any tabs by Ctrl+W) + // bring back focus on tab container if there are any tab left + if(mTabContainer->getTabCount() > 0) + { + mTabContainer->setFocus(TRUE); + } } return TRUE; } @@ -468,12 +490,17 @@ void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, BOOL flashing) void LLMultiFloater::onTabSelected() { - tabOpen((LLFloater*)mTabContainer->getCurrentPanel()); + LLFloater* floaterp = dynamic_cast(mTabContainer->getCurrentPanel()); + if (floaterp) + { + tabOpen(floaterp); + } } void LLMultiFloater::setCanResize(BOOL can_resize) { LLFloater::setCanResize(can_resize); + if (!mTabContainer) return; if (isResizable() && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM) { mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); @@ -510,16 +537,9 @@ void LLMultiFloater::updateResizeLimits() // initialize minimum size constraint to the original xml values. S32 new_min_width = mOrigMinWidth; S32 new_min_height = mOrigMinHeight; - // possibly increase minimum size constraint due to children's minimums. - for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) - { - LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx); - if (floaterp) - { - new_min_width = llmax(new_min_width, floaterp->getMinWidth() + LLPANEL_BORDER_WIDTH * 2); - new_min_height = llmax(new_min_height, floaterp->getMinHeight() + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); - } - } + + computeResizeLimits(new_min_width, new_min_height); + setResizeLimits(new_min_width, new_min_height); S32 cur_height = getRect().getHeight(); @@ -545,3 +565,17 @@ void LLMultiFloater::updateResizeLimits() gFloaterView->adjustToFitScreen(this, TRUE); } } + +void LLMultiFloater::computeResizeLimits(S32& new_min_width, S32& new_min_height) +{ + // possibly increase minimum size constraint due to children's minimums. + for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) + { + LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx); + if (floaterp) + { + new_min_width = llmax(new_min_width, floaterp->getMinWidth() + LLPANEL_BORDER_WIDTH * 2); + new_min_height = llmax(new_min_height, floaterp->getMinHeight() + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); + } + } +} diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index e56b387bc..b18ff292a 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -56,7 +56,7 @@ public: virtual void growToFit(S32 content_width, S32 content_height); virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); - virtual void showFloater(LLFloater* floaterp); + virtual void showFloater(LLFloater* floaterp, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); virtual void removeFloater(LLFloater* floaterp); virtual void tabOpen(LLFloater* opened_floater); @@ -76,6 +76,7 @@ public: void onTabSelected(); virtual void updateResizeLimits(); + virtual void updateFloaterTitle(LLFloater* floaterp); protected: struct LLFloaterData @@ -94,6 +95,9 @@ protected: LLTabContainer::TabPosition mTabPos; BOOL mAutoResize; S32 mOrigMinWidth, mOrigMinHeight; // logically const but initialized late + +private: + virtual void computeResizeLimits(S32& new_min_width, S32& new_min_height); }; #endif // LL_MULTI_FLOATER_H From 41303d0c9cf86124e1530113ce926954888a28b5 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 23 Oct 2013 17:44:27 -0400 Subject: [PATCH 35/62] Added "Log button opens external text editor (Windows only)" to Adv. Chat UI --- indra/newview/ascentprefschat.cpp | 2 ++ indra/newview/ascentprefschat.h | 1 + .../skins/default/xui/en-us/panel_preferences_ascent_chat.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 5def0f4bb..d504a38fa 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -297,6 +297,7 @@ void LLPrefsAscentChat::refreshValues() mOneLineConfButt = gSavedSettings.getBOOL("UseConciseConferenceButtons"); mOnlyComm = gSavedSettings.getBOOL("CommunicateSpecificShortcut"); mItalicizeActions = gSavedSettings.getBOOL("LiruItalicizeActions"); + mLegacyLogLaunch = gSavedSettings.getBOOL("LiruLegacyLogLaunch"); mLegacySpeakerNames = gSavedSettings.getBOOL("LiruLegacySpeakerNames"); //Autoresponse ------------------------------------------------------------------------ @@ -535,6 +536,7 @@ void LLPrefsAscentChat::cancel() gSavedSettings.setBOOL("UseConciseConferenceButtons", mOneLineConfButt); gSavedSettings.setBOOL("CommunicateSpecificShortcut", mOnlyComm); gSavedSettings.setBOOL("LiruItalicizeActions", mItalicizeActions); + gSavedSettings.setBOOL("LiruLegacyLogLaunch", mLegacyLogLaunch); gSavedSettings.setBOOL("LiruLegacySpeakerNames", mLegacySpeakerNames); //Autoresponse ------------------------------------------------------------------------ diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index 5e0ecd707..f4232bfd8 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -87,6 +87,7 @@ protected: bool mOnlyComm; bool mItalicizeActions; bool mLegacySpeakerNames; + bool mLegacyLogLaunch; //Autoresponse ------------------------------------------------------------------------ std::string mIMResponseAnyoneItemID; diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml index 82f6429bb..3d2b1325d 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml @@ -59,6 +59,7 @@ + From 2b7e78cb3b926a7f94251478c0302e9617e43c45 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 23 Oct 2013 17:47:33 -0400 Subject: [PATCH 36/62] That commit where I touch all the ascentprefs headers to make them conform to standard because it's been annoying me too long. --- indra/newview/ascentprefschat.h | 107 +++++++++++++-------------- indra/newview/ascentprefssys.h | 123 ++++++++++++++++---------------- indra/newview/ascentprefsvan.h | 77 ++++++++++---------- 3 files changed, 154 insertions(+), 153 deletions(-) diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index f4232bfd8..5b235dafa 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -38,13 +38,13 @@ class LLPrefsAscentChat : public LLPanel { public: - LLPrefsAscentChat(); - ~LLPrefsAscentChat(); + LLPrefsAscentChat(); + ~LLPrefsAscentChat(); - void apply(); - void cancel(); - void refresh(); - void refreshValues(); + void apply(); + void cancel(); + void refresh(); + void refreshValues(); protected: void onSpellAdd(); @@ -56,26 +56,27 @@ protected: void onCommitDialogBlock(LLUICtrl* ctrl, const LLSD& value); void onCommitKeywords(LLUICtrl* ctrl); - //Chat/IM ----------------------------------------------------------------------------- - BOOL mIMAnnounceIncoming; - BOOL mHideTypingNotification; - bool mInstantMessagesFriendsOnly; - BOOL mShowGroupNameInChatIM; - bool mShowDisplayNameChanges; - bool mUseTypingBubbles; - BOOL mPlayTypingSound; - BOOL mHideNotificationsInChat; - BOOL mEnableMUPose; - BOOL mEnableOOCAutoClose; - U32 mLinksForChattingObjects; - U32 mTimeFormat; - U32 mDateFormat; - U32 tempTimeFormat; - U32 tempDateFormat; - BOOL mSecondsInChatAndIMs; - BOOL mSecondsInLog; +private: + //Chat/IM ----------------------------------------------------------------------------- + bool mIMAnnounceIncoming; + bool mHideTypingNotification; + bool mInstantMessagesFriendsOnly; + bool mShowGroupNameInChatIM; + bool mShowDisplayNameChanges; + bool mUseTypingBubbles; + bool mPlayTypingSound; + bool mHideNotificationsInChat; + bool mEnableMUPose; + bool mEnableOOCAutoClose; + U32 mLinksForChattingObjects; + U32 mTimeFormat; + U32 mDateFormat; + U32 tempTimeFormat; + U32 tempDateFormat; + bool mSecondsInChatAndIMs; + bool mSecondsInLog; - //Chat UI ----------------------------------------------------------------------------- + //Chat UI ----------------------------------------------------------------------------- bool mWoLfVerticalIMTabs; bool mOtherChatsTornOff; bool mIMAnnounceStealFocus; @@ -95,39 +96,39 @@ protected: std::string mIMResponseMutedItemID; std::string mIMResponseBusyItemID; - //Spam -------------------------------------------------------------------------------- - BOOL mEnableAS; - BOOL mGlobalQueue; - U32 mChatSpamCount; - U32 mChatSpamTime; - BOOL mBlockDialogSpam; - BOOL mBlockAlertSpam; - BOOL mBlockFriendSpam; - BOOL mBlockGroupNoticeSpam; - BOOL mBlockGroupInviteSpam; - BOOL mBlockGroupFeeInviteSpam; - BOOL mBlockItemOfferSpam; + //Spam -------------------------------------------------------------------------------- + bool mEnableAS; + bool mGlobalQueue; + U32 mChatSpamCount; + U32 mChatSpamTime; + bool mBlockDialogSpam; + bool mBlockAlertSpam; + bool mBlockFriendSpam; + bool mBlockGroupNoticeSpam; + bool mBlockGroupInviteSpam; + bool mBlockGroupFeeInviteSpam; + bool mBlockItemOfferSpam; bool mBlockNotMineSpam; bool mBlockNotFriendSpam; - BOOL mBlockScriptSpam; - BOOL mBlockTeleportSpam; + bool mBlockScriptSpam; + bool mBlockTeleportSpam; bool mBlockTeleportRequestSpam; - BOOL mNotifyOnSpam; - BOOL mSoundMulti; - U32 mNewLines; - U32 mPreloadMulti; + bool mNotifyOnSpam; + bool mSoundMulti; + U32 mNewLines; + U32 mPreloadMulti; bool mEnableGestureSounds; - //Text Options ------------------------------------------------------------------------ - BOOL mSpellDisplay; - BOOL mKeywordsOn; - std::string mKeywordsList; - BOOL mKeywordsInChat; - BOOL mKeywordsInIM; - BOOL mKeywordsChangeColor; - LLColor4 mKeywordsColor; - BOOL mKeywordsPlaySound; - LLUUID mKeywordsSound; + //Text Options ------------------------------------------------------------------------ + bool mSpellDisplay; + bool mKeywordsOn; + std::string mKeywordsList; + bool mKeywordsInChat; + bool mKeywordsInIM; + bool mKeywordsChangeColor; + LLColor4 mKeywordsColor; + bool mKeywordsPlaySound; + LLUUID mKeywordsSound; }; #endif diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 701a8e582..a862e9166 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -38,13 +38,13 @@ class LLPrefsAscentSys : public LLPanel { public: - LLPrefsAscentSys(); - ~LLPrefsAscentSys(); + LLPrefsAscentSys(); + ~LLPrefsAscentSys(); - void apply(); - void cancel(); - void refresh(); - void refreshValues(); + void apply(); + void cancel(); + void refresh(); + void refreshValues(); protected: void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value); @@ -52,61 +52,62 @@ protected: void onCommitComboBox(LLUICtrl* ctrl, const LLSD& value); void onCommitTexturePicker(LLUICtrl* ctrl); - //General ----------------------------------------------------------------------------- - BOOL mDoubleClickTeleport; - BOOL mResetCameraAfterTP; - BOOL mOffsetTPByUserHeight; - bool mClearBeaconAfterTeleport; - bool mLiruFlyAfterTeleport; - bool mLiruContinueFlying; - BOOL mPreviewAnimInWorld; - BOOL mSaveScriptsAsMono; - BOOL mAlwaysRezInGroup; - BOOL mBuildAlwaysEnabled; - BOOL mAlwaysShowFly; - BOOL mDisableMinZoom; - BOOL mPowerUser; - BOOL mFetchInventoryOnLogin; - BOOL mEnableLLWind; - BOOL mEnableClouds; - BOOL mEnableClassicClouds; - BOOL mSpeedRez; - U32 mSpeedRezInterval; +private: + //General ----------------------------------------------------------------------------- + bool mDoubleClickTeleport; + bool mResetCameraAfterTP; + bool mOffsetTPByUserHeight; + bool mClearBeaconAfterTeleport; + bool mLiruFlyAfterTeleport; + bool mLiruContinueFlying; + bool mPreviewAnimInWorld; + bool mSaveScriptsAsMono; + bool mAlwaysRezInGroup; + bool mBuildAlwaysEnabled; + bool mAlwaysShowFly; + bool mDisableMinZoom; + bool mPowerUser; + bool mFetchInventoryOnLogin; + bool mEnableLLWind; + bool mEnableClouds; + bool mEnableClassicClouds; + bool mSpeedRez; + U32 mSpeedRezInterval; bool mUseWebProfiles; bool mUseWebSearch; - //Command Line ------------------------------------------------------------------------ - BOOL mCmdLine; - std::string mCmdLinePos; - std::string mCmdLineGround; - std::string mCmdLineHeight; - std::string mCmdLineTeleportHome; - std::string mCmdLineRezPlatform; - F32 mCmdPlatformSize; - std::string mCmdLineCalc; - std::string mCmdLineClearChat; - std::string mCmdLineDrawDistance; - std::string mCmdTeleportToCam; - std::string mCmdLineKeyToName; - std::string mCmdLineOfferTp; - std::string mCmdLineMapTo; - BOOL mCmdMapToKeepPos; - std::string mCmdLineTP2; - std::string mCmdLineAway; + //Command Line ------------------------------------------------------------------------ + bool mCmdLine; + std::string mCmdLinePos; + std::string mCmdLineGround; + std::string mCmdLineHeight; + std::string mCmdLineTeleportHome; + std::string mCmdLineRezPlatform; + F32 mCmdPlatformSize; + std::string mCmdLineCalc; + std::string mCmdLineClearChat; + std::string mCmdLineDrawDistance; + std::string mCmdTeleportToCam; + std::string mCmdLineKeyToName; + std::string mCmdLineOfferTp; + std::string mCmdLineMapTo; + bool mCmdMapToKeepPos; + std::string mCmdLineTP2; + std::string mCmdLineAway; std::string mCmdLineURL; - //Security ---------------------------------------------------------------------------- - BOOL mBroadcastViewerEffects; - BOOL mDisablePointAtAndBeam; - BOOL mPrivateLookAt; - BOOL mShowLookAt; - BOOL mQuietSnapshotsToDisk; - BOOL mDetachBridge; - BOOL mRevokePermsOnStandUp; - BOOL mDisableClickSit; + //Security ---------------------------------------------------------------------------- + bool mBroadcastViewerEffects; + bool mDisablePointAtAndBeam; + bool mPrivateLookAt; + bool mShowLookAt; + bool mQuietSnapshotsToDisk; + bool mDetachBridge; + bool mRevokePermsOnStandUp; + bool mDisableClickSit; bool mDisableClickSitOtherOwner; - BOOL mDisplayScriptJumps; - F32 mNumScriptDiff; + bool mDisplayScriptJumps; + F32 mNumScriptDiff; //Build ------------------------------------------------------------------------------- F32 mAlpha; @@ -115,14 +116,14 @@ protected: F32 mGlow; std::string mItem; std::string mMaterial; - BOOL mNextCopy; - BOOL mNextMod; - BOOL mNextTrans; + bool mNextCopy; + bool mNextMod; + bool mNextTrans; std::string mShiny; - BOOL mTemporary; + bool mTemporary; std::string mTexture; - BOOL mPhantom; - BOOL mPhysical; + bool mPhantom; + bool mPhysical; F32 mXsize; F32 mYsize; F32 mZsize; diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index 77285b23d..edbe2cefb 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -38,24 +38,26 @@ class LLPrefsAscentVan : public LLPanel { public: - LLPrefsAscentVan(); - ~LLPrefsAscentVan(); + LLPrefsAscentVan(); + ~LLPrefsAscentVan(); - void apply(); - void cancel(); - void refresh(); - void refreshValues(); + void apply(); + void cancel(); + void refresh(); + void refreshValues(); protected: void onCommitClientTag(LLUICtrl* ctrl); void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value); void onCommitTextModified(LLUICtrl* ctrl, const LLSD& value); static void onManualClientUpdate(); - //Main - BOOL mUseAccountSettings; - BOOL mShowTPScreen; - BOOL mPlayTPSound; - BOOL mShowLogScreens; + +private: + //Main + bool mUseAccountSettings; + bool mShowTPScreen; + bool mPlayTPSound; + bool mShowLogScreens; bool mDisableChatAnimation; bool mAddNotReplace; bool mTurnAround; @@ -64,41 +66,38 @@ protected: bool mUnfocusedFloatersOpaque; bool mCompleteNameProfiles; bool mScriptErrorsStealFocus; - //Tags\Colors - BOOL mAscentBroadcastTag; - std::string mReportClientUUID; - U32 mSelectedClient; - BOOL mShowSelfClientTag; - BOOL mShowSelfClientTagColor; - BOOL mShowFriendsTag; - BOOL mDisplayClientTagOnNewLine; - BOOL mCustomTagOn; - std::string mCustomTagLabel; - LLColor4 mCustomTagColor; - BOOL mShowOthersTag; - BOOL mShowOthersTagColor; - BOOL mShowIdleTime; - BOOL mUseStatusColors; - BOOL mUpdateTagsOnLoad; - LLColor4 mEffectColor; - LLColor4 mFriendColor; - LLColor4 mEstateOwnerColor; - LLColor4 mLindenColor; - LLColor4 mMutedColor; + //Tags\Colors + bool mAscentBroadcastTag; + std::string mReportClientUUID; + U32 mSelectedClient; + bool mShowSelfClientTag; + bool mShowSelfClientTagColor; + bool mShowFriendsTag; + bool mDisplayClientTagOnNewLine; + bool mCustomTagOn; + std::string mCustomTagLabel; + LLColor4 mCustomTagColor; + bool mShowOthersTag; + bool mShowOthersTagColor; + bool mShowIdleTime; + bool mUseStatusColors; + bool mUpdateTagsOnLoad; + LLColor4 mEffectColor; + LLColor4 mFriendColor; + LLColor4 mEstateOwnerColor; + LLColor4 mLindenColor; + LLColor4 mMutedColor; LLColor4 mMapAvatarColor; LLColor4 mCustomColor; bool mColorFriendChat; bool mColorEOChat; bool mColorLindenChat; bool mColorMutedChat; -// bool mColorCustomChat; - - F32 mAvatarXModifier; - F32 mAvatarYModifier; - F32 mAvatarZModifier; - -private: + // bool mColorCustomChat; + F32 mAvatarXModifier; + F32 mAvatarYModifier; + F32 mAvatarZModifier; }; #endif From 8e94c43a549984c0a3268698d4730c6202a3a424 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 23 Oct 2013 17:23:20 -0500 Subject: [PATCH 37/62] Fix a tp crash, and rework sound preloading slightly. --- indra/llaudio/llaudiodecodemgr.cpp | 42 +++--- indra/llaudio/llaudiodecodemgr.h | 2 +- indra/llaudio/llaudioengine.cpp | 208 ++++++++++++++++------------- indra/llaudio/llaudioengine.h | 29 ++-- indra/newview/llviewerobject.cpp | 2 +- 5 files changed, 147 insertions(+), 136 deletions(-) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index eea39f0c1..92a0b27e9 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -611,8 +611,10 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) llwarns << mCurrentDecodep->getUUID() << " has invalid vorbis data, aborting decode" << llendl; mCurrentDecodep->flushBadFile(); LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID()); - adp->setHasValidData(false); - adp->setHasCompletedDecode(true); + if(adp) + { + adp->setLoadState(LLAudioData::STATE_LOAD_ERROR); + } mCurrentDecodep = NULL; done = TRUE; } @@ -634,10 +636,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) } else if (mCurrentDecodep->isValid() && mCurrentDecodep->isDone()) { - adp->setHasCompletedDecode(true); - adp->setHasDecodedData(true); - adp->setHasValidData(true); - + adp->setLoadState(LLAudioData::STATE_LOAD_READY); // At this point, we could see if anyone needs this sound immediately, but // I'm not sure that there's a reason to - we need to poll all of the playing // sounds anyway. @@ -645,7 +644,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) } else { - adp->setHasCompletedDecode(true); + adp->setLoadState(LLAudioData::STATE_LOAD_ERROR); llinfos << "Vorbis decode failed for " << mCurrentDecodep->getUUID() << llendl; } mCurrentDecodep = NULL; @@ -688,8 +687,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) LLAudioData *adp = gAudiop->getAudioData(uuid); if(adp) { - adp->setHasValidData(false); - adp->setHasCompletedDecode(true); + adp->setLoadState(LLAudioData::STATE_LOAD_ERROR); } mCurrentDecodep = NULL; } @@ -715,23 +713,13 @@ void LLAudioDecodeMgr::processQueue(const F32 num_secs) mImpl->processQueue(num_secs); } -BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) +bool LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) { - if (gAudiop->hasDecodedFile(uuid)) - { - // Already have a decoded version, don't need to decode it. - //llinfos << "addDecodeRequest for " << uuid << " has decoded file already" << llendl; - return TRUE; - } - - if (gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND)) - { - // Just put it on the decode queue. - //llinfos << "addDecodeRequest for " << uuid << " has local asset file already" << llendl; - mImpl->mDecodeQueue.push(uuid); - return TRUE; - } - - //llinfos << "addDecodeRequest for " << uuid << " no file available" << llendl; - return FALSE; + if(!uuid.notNull()) + return false; + else if (!gAssetStorage || !gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND)) + return false; + + mImpl->mDecodeQueue.push(uuid); + return true; } diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h index e42fe8a40..917511daa 100644 --- a/indra/llaudio/llaudiodecodemgr.h +++ b/indra/llaudio/llaudiodecodemgr.h @@ -44,7 +44,7 @@ public: ~LLAudioDecodeMgr(); void processQueue(const F32 num_secs = 0.005); - BOOL addDecodeRequest(const LLUUID &uuid); + bool addDecodeRequest(const LLUUID &uuid); void addAudioRequest(const LLUUID &uuid); protected: diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index c1f362d32..6aed74daf 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -113,6 +113,8 @@ void LLAudioEngine::setDefaults() for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) mSecondaryGain[i] = 1.0f; + mCurrentTransfer = NULL; + mAllowLargeSounds = false; } @@ -354,6 +356,11 @@ void LLAudioEngine::idle(F32 max_decode_time) // Increment iter here (it is not used anymore), so we can use continue below to move on to the next source. ++iter; + if(!sourcep->isLoop() && sourcep->mPlayedOnce && (!sourcep->mChannelp || !sourcep->mChannelp->isPlaying())) + { + continue; + } + LLAudioData *adp = sourcep->getCurrentData(); //If there is no current data at all, or if it hasn't loaded, we must skip this source. if (!adp || !adp->getBuffer()) @@ -509,9 +516,8 @@ void LLAudioEngine::idle(F32 max_decode_time) // Decode audio files gAudioDecodeMgrp->processQueue(max_decode_time); - // Call this every frame, just in case we somehow - // missed picking it up in all the places that can add - // or request new data. + // Just call here every frame. It makes little sense to call elsewhere, + // as it's throttled to one active preloading loading sound at a time anyhow startNextTransfer(); updateInternetStream(); @@ -660,10 +666,7 @@ bool LLAudioEngine::preloadSound(const LLUUID &uuid) if(uuid.isNull()) return false; - gAudiop->getAudioData(uuid); // We don't care about the return value, this is just to make sure - // that we have an entry, which will mean that the audio engine knows about this - - if (gAudioDecodeMgrp->addDecodeRequest(uuid)) + if(getAudioData(uuid)->getLoadState() >= LLAudioData::STATE_LOAD_DECODING) { // This means that we do have a local copy, and we're working on decoding it. return true; @@ -1064,29 +1067,39 @@ bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid) } } - -bool LLAudioEngine::hasLocalFile(const LLUUID &uuid) -{ - // See if it's in the VFS. - return gVFS->getExists(uuid, LLAssetType::AT_SOUND); -} - - void LLAudioEngine::startNextTransfer() { //LL_INFOS("AudioEngine") << "LLAudioEngine::startNextTransfer()" << LL_ENDL; - if (!gAssetStorage->isUpstreamOK() || mCurrentTransfer.notNull() || getMuted()) + if (getMuted()) { - //LL_INFOS("AudioEngine") << "Transfer in progress, aborting" << LL_ENDL; return; } + else if(mCurrentTransferTimer.getElapsedTimeF32() <= .1f) + { + return; + } + else if(mCurrentTransfer && mCurrentTransfer->isInPreload()) + { + //Keep updating until it either errors out or completes. + mCurrentTransfer->updateLoadState(); + return; + } + else + { + mCurrentTransfer = NULL; + } + + //Technically, mCurrentTransfer could end up pointing to an audiodata object that's already + //being transmitted/decoded if such was spawned via needing it for playback immediately. + //This will effectively block us from choosing a lower priority audiodata object until the + //immediate ones are done, but it's not a real problem. // Get the ID for the next asset that we want to transfer. // Pick one in the following order: - LLUUID asset_id; S32 i; LLAudioSource *asp = NULL; LLAudioData *adp = NULL; + LLAudioData *cur_adp = NULL; data_map::iterator data_iter; // Check all channels for currently playing sounds. @@ -1119,15 +1132,15 @@ void LLAudioEngine::startNextTransfer() continue; } - if (!adp->hasLocalData() && adp->hasValidData()) + if (adp->isInPreload()) { - asset_id = adp->getID(); max_pri = asp->getPriority(); + cur_adp = adp; } } // Check all channels for currently queued sounds. - if (asset_id.isNull()) + if (!cur_adp) { max_pri = -1.f; for (i = 0; i < MAX_CHANNELS; i++) @@ -1155,16 +1168,16 @@ void LLAudioEngine::startNextTransfer() continue; } - if (!adp->hasLocalData() && adp->hasValidData()) + if (adp->isInPreload()) { - asset_id = adp->getID(); max_pri = asp->getPriority(); + cur_adp = adp; } } } // Check all live channels for other sounds (preloads). - if (asset_id.isNull()) + if (!cur_adp) { max_pri = -1.f; for (i = 0; i < MAX_CHANNELS; i++) @@ -1195,17 +1208,17 @@ void LLAudioEngine::startNextTransfer() continue; } - if (!adp->hasLocalData() && adp->hasValidData()) + if (adp->isInPreload()) { - asset_id = adp->getID(); max_pri = asp->getPriority(); + cur_adp = adp; } } } } // Check all sources - if (asset_id.isNull()) + if (!cur_adp) { max_pri = -1.f; source_map::iterator source_iter; @@ -1223,18 +1236,18 @@ void LLAudioEngine::startNextTransfer() } adp = asp->getCurrentData(); - if (adp && !adp->hasLocalData() && adp->hasValidData()) + if (adp && adp->isInPreload()) { - asset_id = adp->getID(); max_pri = asp->getPriority(); + cur_adp = adp; continue; } adp = asp->getQueuedData(); - if (adp && !adp->hasLocalData() && adp->hasValidData()) + if (adp && adp->isInPreload()) { - asset_id = adp->getID(); max_pri = asp->getPriority(); + cur_adp = adp; continue; } @@ -1246,35 +1259,41 @@ void LLAudioEngine::startNextTransfer() continue; } - if (!adp->hasLocalData() && adp->hasValidData()) + if (adp->isInPreload()) { - asset_id = adp->getID(); max_pri = asp->getPriority(); + cur_adp = adp; break; } } } } - if (asset_id.isNull() && !mPreloadSystemList.empty()) + if (!cur_adp) { - asset_id = mPreloadSystemList.front(); - mPreloadSystemList.pop_front(); + while(!mPreloadSystemList.empty()) + { + adp = getAudioData(mPreloadSystemList.front()); + mPreloadSystemList.pop_front(); + if(adp->isInPreload()) + { + cur_adp = adp; + break; + } + } } - else if(asset_id.notNull()) + else if(cur_adp) { - std::list::iterator it = std::find(mPreloadSystemList.begin(),mPreloadSystemList.end(),asset_id); + std::list::iterator it = std::find(mPreloadSystemList.begin(),mPreloadSystemList.end(),cur_adp->getID()); if(it != mPreloadSystemList.end()) mPreloadSystemList.erase(it); } - if (asset_id.notNull()) + if (cur_adp) { - LL_DEBUGS("AudioEngine") << "Getting asset data for: " << asset_id << LL_ENDL; - gAudiop->mCurrentTransfer = asset_id; - gAudiop->mCurrentTransferTimer.reset(); - gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND, - assetCallback, NULL); + mCurrentTransfer = cur_adp; + mCurrentTransferTimer.reset(); + mCurrentTransfer->updateLoadState(); } else { @@ -1289,22 +1308,20 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E if(!gAudiop) return; + LLAudioData *adp = gAudiop->getAudioData(uuid); + if (result_code) { LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL; // Need to mark data as bad to avoid constant rerequests. - LLAudioData *adp = gAudiop->getAudioData(uuid); + if (adp) - { // Make sure everything is cleared - adp->setHasValidData(false); - adp->setHasLocalData(false); - adp->setHasDecodedData(false); - adp->setHasCompletedDecode(true); + { + adp->setLoadState(LLAudioData::STATE_LOAD_ERROR); } } else { - LLAudioData *adp = gAudiop->getAudioData(uuid); if (!adp) { // Should never happen @@ -1313,13 +1330,11 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E else { // LL_INFOS("AudioEngine") << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL; - adp->setHasValidData(true); - adp->setHasLocalData(true); - gAudioDecodeMgrp->addDecodeRequest(uuid); + adp->setLoadState(LLAudioData::STATE_LOAD_REQ_DECODE); + //Immediate decode. + adp->updateLoadState(); } } - gAudiop->mCurrentTransfer = LLUUID::null; - gAudiop->startNextTransfer(); } @@ -1411,32 +1426,29 @@ void LLAudioSource::update() //Make sure this source looks like its brand new again to prevent removal. mPlayedOnce = false; mAgeTimer.reset(); - - gAudiop->startNextTransfer(); } LLAudioData *adp = getCurrentData(); if (adp && !adp->getBuffer()) { - // Update the audio buffer first - load a sound if we have it. - // Note that this could potentially cause us to waste time updating buffers - // for sounds that actually aren't playing, although this should be mitigated - // by the fact that we limit the number of buffers, and we flush buffers based - // on priority. - if (adp->hasDecodedData()) + if(adp->getLoadState() == LLAudioData::STATE_LOAD_ERROR) { - if(!adp->load() && adp->hasCompletedDecode()) - { - LL_WARNS("AudioEngine") << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL; - mCorrupted = true ; - } + LL_WARNS("AudioEngine") << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL; + mCorrupted = true ; } - else if (adp->hasLocalData() && adp->hasValidData()) + else if(adp->getLoadState() == LLAudioData::STATE_LOAD_READY) { - if (adp->getID().notNull()) - { - gAudioDecodeMgrp->addDecodeRequest(adp->getID()); - } + // Update the audio buffer first - load a sound if we have it. + // Note that this could potentially cause us to waste time updating buffers + // for sounds that actually aren't playing, although this should be mitigated + // by the fact that we limit the number of buffers, and we flush buffers based + // on priority. + adp->load(); //If it fails, just try again next update. + } + else + { + //The sound wasn't preloaded yet... so we must kick off the process. + adp->updateLoadState(); } } } @@ -1524,9 +1536,6 @@ bool LLAudioSource::play(const LLUUID &audio_uuid) mCurrentDatap = adp; - // Make sure the audio engine knows that we want to request this sound. - gAudiop->startNextTransfer(); - return true; } @@ -1536,7 +1545,6 @@ bool LLAudioSource::isDone() const static const F32 MAX_AGE = 60.f; static const F32 MAX_UNPLAYED_AGE = 15.f; static const F32 MAX_MUTED_AGE = 11.f; - if(mCorrupted) { // If we decode bad data then just kill this source entirely. @@ -1570,7 +1578,7 @@ bool LLAudioSource::isDone() const LLAudioData* adp = mCurrentDatap; //Still decoding. - if(adp && !adp->hasDecodedData() && adp->hasValidData()) + if(adp && adp->isInPreload()) return false; // We don't have a channel assigned, and it's been @@ -1599,7 +1607,6 @@ void LLAudioSource::preload(const LLUUID &audio_id) { // Add it to the preload list. mPreloadMap[audio_id] = gAudiop->getAudioData(audio_id); - gAudiop->startNextTransfer(); } } @@ -1617,7 +1624,7 @@ bool LLAudioSource::hasPendingPreloads() const { continue; } - if (!adp->hasDecodedData() && adp->hasValidData()) + if (adp->isInPreload()) { // This source is still waiting for a preload return true; @@ -1734,27 +1741,42 @@ bool LLAudioChannel::updateBuffer() LLAudioData::LLAudioData(const LLUUID &uuid) : mID(uuid), mBufferp(NULL), - mHasLocalData(false), - mHasDecodedData(false), - mHasCompletedDecode(false), - mHasValidData(true) + mLoadState(STATE_LOAD_ERROR) { if (uuid.isNull()) { // This is a null sound. return; } - - if (gAudiop && gAudiop->hasDecodedFile(uuid)) + + if(gAudiop->hasDecodedFile(getID())) + mLoadState = STATE_LOAD_READY; + else if(gAssetStorage && gAssetStorage->hasLocalAsset(getID(), LLAssetType::AT_SOUND)) + mLoadState = STATE_LOAD_REQ_DECODE; + else + mLoadState = STATE_LOAD_REQ_FETCH; +} + +void LLAudioData::updateLoadState() +{ + if(mLoadState == STATE_LOAD_REQ_DECODE && gAudioDecodeMgrp) { - // Already have a decoded version, don't need to decode it. - setHasLocalData(true); - setHasDecodedData(true); - setHasCompletedDecode(true); + if( gAudioDecodeMgrp->addDecodeRequest(getID()) ) + { + setLoadState(STATE_LOAD_DECODING); + LL_INFOS("AudioEngine") << "Decoding asset data for: " << getID() << LL_ENDL; + } + else + { + setLoadState(STATE_LOAD_ERROR); + } } - else if (gAssetStorage && gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND)) + else if(mLoadState == STATE_LOAD_REQ_FETCH && gAssetStorage && gAssetStorage->isUpstreamOK()) { - setHasLocalData(true); + LL_INFOS("AudioEngine") << "Fetching asset data for: " << getID() << LL_ENDL; + setLoadState(STATE_LOAD_FETCHING); + + gAssetStorage->getAssetData(getID(), LLAssetType::AT_SOUND, LLAudioEngine::assetCallback, NULL); } } diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index 4067f23a7..717e688df 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -177,7 +177,6 @@ public: void cleanupBuffer(LLAudioBuffer *bufferp); bool hasDecodedFile(const LLUUID &uuid); - bool hasLocalFile(const LLUUID &uuid); void setAllowLargeSounds(bool allow) { mAllowLargeSounds = allow ;} bool getAllowLargeSounds() const {return mAllowLargeSounds;} @@ -227,7 +226,7 @@ protected: S32 mNumChannels; bool mEnableWind; - LLUUID mCurrentTransfer; // Audio file currently being transferred by the system + LLAudioData* mCurrentTransfer; // Audio file currently being transferred by the system LLFrameTimer mCurrentTransferTimer; // A list of all audio sources that are known to the viewer at this time. @@ -400,25 +399,27 @@ public: LLUUID getID() const { return mID; } LLAudioBuffer *getBuffer() const { return mBufferp; } - bool hasLocalData() const { return mHasLocalData; } - bool hasDecodedData() const { return mHasDecodedData; } - bool hasCompletedDecode() const { return mHasCompletedDecode; } - bool hasValidData() const { return mHasValidData; } + enum ELoadState + { + STATE_LOAD_ERROR, + STATE_LOAD_REQ_FETCH, + STATE_LOAD_FETCHING, + STATE_LOAD_REQ_DECODE, + STATE_LOAD_DECODING, + STATE_LOAD_READY + }; + ELoadState getLoadState() const { return mLoadState; } + ELoadState setLoadState(ELoadState state) { return mLoadState = state; } + bool isInPreload() const { return mLoadState > STATE_LOAD_ERROR && mLoadState < STATE_LOAD_READY; } - void setHasLocalData(const bool hld) { mHasLocalData = hld; } - void setHasDecodedData(const bool hdd) { mHasDecodedData = hdd; } - void setHasCompletedDecode(const bool hcd) { mHasCompletedDecode = hcd; } - void setHasValidData(const bool hvd) { mHasValidData = hvd; } + void updateLoadState(); friend class LLAudioEngine; // Severe laziness, bad. protected: LLUUID mID; LLAudioBuffer *mBufferp; // If this data is being used by the audio system, a pointer to the buffer will be set here. - bool mHasLocalData; // Set true if the sound asset file is available locally - bool mHasDecodedData; // Set true if the sound file has been decoded - bool mHasCompletedDecode; // Set true when the sound is decoded - bool mHasValidData; // Set false if decoding failed, meaning the sound asset is bad + ELoadState mLoadState; }; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 9a23cf56c..45d486784 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4863,7 +4863,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (audio_uuid.isNull()) { - if (!mAudioSourcep) + if (!mAudioSourcep || (flags & LL_SOUND_FLAG_STOP && !mAudioSourcep->isLoop())) { return; } From 938736b77fe89435df61f549435d36e9834bb4ed Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Thu, 24 Oct 2013 01:25:45 +0200 Subject: [PATCH 38/62] Win64: moved prebuilts to their permanent location --- install.xml | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/install.xml b/install.xml index c9f3a4261..4a887b341 100644 --- a/install.xml +++ b/install.xml @@ -69,7 +69,7 @@ md5sum df67aeb1ca4681dc4d9a556454203426 url - https://files.streamgrid.net/win64/singularity/glod-1.0pre4-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/glod-1.0pre4-windows64-20131020.tar.bz2 @@ -138,7 +138,7 @@ md5sum 7dcae03cad9bc04ac7e937284e6d102e url - https://files.streamgrid.net/win64/singularity/apr_suite-1.4.5-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/apr_suite-1.4.5-windows64-20131019.tar.bz2 @@ -185,7 +185,7 @@ md5sum 2ca54250b59170f3e5342dacad529859 url - https://files.streamgrid.net/win64/singularity/ares-1.9.1-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/ares-1.9.1-windows64-20131019.tar.bz2 @@ -232,7 +232,7 @@ md5sum 68c056e920ba2b25c0acded6f482a2e4 url - https://files.streamgrid.net/win64/singularity/boost-1.53.0-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.53.0-windows64-20131019.tar.bz2 @@ -279,7 +279,7 @@ md5sum acbe863e1b3df636e1245cc27c280e7b url - https://files.streamgrid.net/win64/singularity/colladadom-2.2-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/colladadom-2.2-windows64-20131020.tar.bz2 @@ -326,7 +326,7 @@ md5sum ffb31d596f41b650bed49ac13bb513de url - https://files.streamgrid.net/win64/singularity/curl-7.24.0-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/curl-7.24.0-windows64-20131019.tar.bz2 @@ -447,7 +447,7 @@ md5sum 3239d5c50d6f2c857cc1a95674dbd1f5 url - https://files.streamgrid.net/win64/singularity/expat-2.1.0-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/expat-2.1.0-windows64-20131019.tar.bz2 @@ -542,7 +542,7 @@ md5sum bfde86bbd84536448ac2a717ed1646d8 url - https://files.streamgrid.net/win64/singularity/freetype-2.5.0.1-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/freetype-2.5.0.1-windows64-20131020.tar.bz2 @@ -559,21 +559,21 @@ linux md5sum - b94a97e60b37afee73f5525cd07ba959 + efc62daedd2f89b46ef0e466b3ef460c url https://bitbucket.org/SingularityViewer/libraries/downloads/glext-82-win32-linux.tar.bz2 linux64 md5sum - b94a97e60b37afee73f5525cd07ba959 + efc62daedd2f89b46ef0e466b3ef460c url https://bitbucket.org/SingularityViewer/libraries/downloads/glext-82-win32-linux.tar.bz2 windows md5sum - b94a97e60b37afee73f5525cd07ba959 + efc62daedd2f89b46ef0e466b3ef460c url https://bitbucket.org/SingularityViewer/libraries/downloads/glext-82-win32-linux.tar.bz2 @@ -582,7 +582,7 @@ md5sum efc62daedd2f89b46ef0e466b3ef460c url - https://files.streamgrid.net/win64/singularity/glext-82-win32-linux.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/glext-82-win32-linux.tar.bz2 @@ -678,7 +678,7 @@ md5sum b13ebfa3a82d5396709c57ad83999d83 url - https://files.streamgrid.net/win64/singularity/google_breakpad-0.0.0-rev1099-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/google_breakpad-0.0.0-rev1099-windows64-20131019.tar.bz2 @@ -799,7 +799,7 @@ md5sum d3ee81e7dfe338b46efc2830930e771e url - https://files.streamgrid.net/win64/singularity/libhunspell-1.3.2-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/libhunspell-1.3.2-windows64-20131020.tar.bz2 @@ -846,7 +846,7 @@ md5sum 79e328b10fae2090262c0bf02c9c5f71 url - https://files.streamgrid.net/win64/singularity/jpeglib-8c-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/jpeglib-8c-windows64-20131020.tar.bz2 @@ -893,7 +893,7 @@ md5sum 8cf95eef2a95b71eb4a8ab59779bed52 url - https://files.streamgrid.net/win64/singularity/jsoncpp-0.5.0-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/jsoncpp-0.5.0-windows64-20131020.tar.bz2 @@ -940,7 +940,7 @@ md5sum 00fc7bcb4016ecc57def9e3b3223d977 url - https://files.streamgrid.net/win64/singularity/libpng-1.5.10-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/libpng-1.5.10-windows64-20131020.tar.bz2 @@ -1031,7 +1031,7 @@ md5sum cf9e5d1d79531a7e4d45f78657da9c9b url - https://files.streamgrid.net/win64/singularity/llqtwebkit-4.7.1-windows64-20131021.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/llqtwebkit-4.7.1-windows64-20131021.tar.bz2 @@ -1104,7 +1104,7 @@ md5sum b59b4ddab26d4441829f50b48925baf0 url - https://files.streamgrid.net/win64/singularity/libndofdev-0.1-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/libndofdev-0.1-windows64-20131020.tar.bz2 @@ -1151,7 +1151,7 @@ md5sum a8ca0eef3d74936d504dab52ecc61ced url - https://files.streamgrid.net/win64/singularity/ogg_vorbis-1.2.2-1.3.2-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/ogg_vorbis-1.2.2-1.3.2-windows64-20131020.tar.bz2 @@ -1194,7 +1194,7 @@ md5sum b50166f0b0a275c8ea0d3b11c578d792 url - https://files.streamgrid.net/win64/singularity/openssl-1.0.0g-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/openssl-1.0.0g-windows64-20131019.tar.bz2 @@ -1404,7 +1404,7 @@ md5sum 94c26b93b855f5816bb29f308d9997fb url - https://files.streamgrid.net/win64/singularity/xmlrpc_epi-0.54.1-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/xmlrpc_epi-0.54.1-windows64-20131019.tar.bz2 @@ -1451,7 +1451,7 @@ md5sum 5aa50bd41d6cf0262a94760ef66bdbcf url - https://files.streamgrid.net/win64/singularity/zlib-1.2.8-windows64-20131019.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/zlib-1.2.8-windows64-20131019.tar.bz2 From fcce986266989c654191bc76a0f9494f6f1da537 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 24 Oct 2013 02:38:47 -0400 Subject: [PATCH 39/62] Fix crash signature 256 --- indra/newview/lltoolcomp.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index a205ca7ef..6264f52e0 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -654,7 +654,7 @@ void LLToolCompRotate::render() LLToolCompGun::LLToolCompGun() : LLToolComposite(std::string("Mouselook")) - , mRightMouseButton(false), mMenuShown(false), mTimerFOV() // + , mRightMouseButton(false), mMenuShown(false), mTimerFOV(), mOriginalFOV(), mStartFOV(), mTargetFOV() // { mGun = new LLToolGun(this); mGrab = new LLToolGrab(this); @@ -665,7 +665,6 @@ LLToolCompGun::LLToolCompGun() // mTimerFOV.stop(); - mStartFOV = mOriginalFOV = mTargetFOV = LLViewerCamera::getInstance()->getAndSaveDefaultFOV(); // } From f4f4a39c01692e100d8ef55f33675a570826b1ba Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Thu, 24 Oct 2013 09:53:51 +0200 Subject: [PATCH 40/62] Revert accidental removal of tcmalloc for 32 bit --- indra/cmake/GooglePerfTools.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index de669ce08..d92c39ded 100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake @@ -12,10 +12,10 @@ else (STANDALONE) if (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64) use_prebuilt_binary(gperftools) endif (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64) - if (WINDOWS AND NOT DISABLE_TCMALLOC AND USE_GOOGLE_PERFTOOLS) + if (WINDOWS AND NOT DISABLE_TCMALLOC) set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib) set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"") - endif (WINDOWS AND NOT DISABLE_TCMALLOC AND USE_GOOGLE_PERFTOOLS) + endif (WINDOWS AND NOT DISABLE_TCMALLOC) if (LINUX) if(USE_GOOGLE_PERFTOOLS) set(TCMALLOC_LIBRARIES tcmalloc) From 3979ad46f602e720e62e27803f20cb1afd227544 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Thu, 24 Oct 2013 10:24:18 +0200 Subject: [PATCH 41/62] Separate out the cache directory for windows 64 --- indra/llvfs/lldir.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index a93c833ba..c3a042247 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -363,7 +363,11 @@ std::string LLDir::buildSLOSCacheDir() const } else { +#if defined(_WIN64) + res = add(getOSCacheDir(), "SingularityViewer64"); +#else res = add(getOSCacheDir(), "SingularityViewer"); +#endif } return res; } From 8441bc80a4725d48635fac873951c8e95b73f0e5 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 16:26:46 -0500 Subject: [PATCH 42/62] Use LLStaticHashedString for faster uniform lookup. --- indra/llcommon/CMakeLists.txt | 1 + indra/llrender/llglslshader.cpp | 231 +++++++++++++++++++------- indra/llrender/llglslshader.h | 54 +++--- indra/llrender/llpostprocess.cpp | 61 ++++--- indra/llrender/llshadermgr.cpp | 53 +++++- indra/llrender/llshadermgr.h | 43 ++++- indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/lldrawpoolbump.cpp | 11 +- indra/newview/lldrawpoolterrain.cpp | 8 +- indra/newview/lldrawpoolwater.cpp | 62 +++---- indra/newview/lldrawpoolwlsky.cpp | 9 +- indra/newview/llface.cpp | 9 +- indra/newview/llmaniptranslate.cpp | 3 +- indra/newview/llviewershadermgr.cpp | 197 ++++++++++++---------- indra/newview/llviewershadermgr.h | 51 ------ indra/newview/llwaterparammanager.cpp | 12 +- indra/newview/llwlparammanager.cpp | 6 +- indra/newview/llwlparamset.cpp | 56 +++++-- indra/newview/llwlparamset.h | 8 +- indra/newview/pipeline.cpp | 24 ++- 20 files changed, 579 insertions(+), 322 deletions(-) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 472831e64..2b4c37be0 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -231,6 +231,7 @@ set(llcommon_HEADER_FILES llstrider.h llstring.h llstringtable.h + llstaticstringtable.h llsys.h llthread.h llthreadsafequeue.h diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index b8827db9e..7dcce3e76 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -91,11 +91,22 @@ LLShaderFeatures::LLShaderFeatures() // LLGLSL Shader implementation //=============================== LLGLSLShader::LLGLSLShader(S32 shader_class) -: mProgramObject(0), mShaderClass(shader_class), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE) + : mProgramObject(0), + mShaderClass(shader_class), + mAttributeMask(0), + mTotalUniformSize(0), + mActiveTextureChannels(0), + mShaderLevel(0), + mShaderGroup(SG_DEFAULT), + mUniformsDirty(FALSE) { LLShaderMgr::getGlobalShaderList().push_back(this); } +LLGLSLShader::~LLGLSLShader() +{ + +} void LLGLSLShader::unload() { stop_glerror(); @@ -103,6 +114,7 @@ void LLGLSLShader::unload() mTexture.clear(); mUniform.clear(); mShaderFiles.clear(); + mDefines.clear(); if (mProgramObject) { @@ -127,8 +139,8 @@ void LLGLSLShader::unload() stop_glerror(); } -BOOL LLGLSLShader::createShader(vector * attributes, - vector * uniforms, +BOOL LLGLSLShader::createShader(std::vector * attributes, + std::vector * uniforms, U32 varying_count, const char** varyings) { @@ -151,7 +163,7 @@ BOOL LLGLSLShader::createShader(vector * attributes, vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) { - GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, mFeatures.mIndexedTextureChannels); + GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels); LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL; if (shaderhandle > 0) { @@ -217,7 +229,8 @@ BOOL LLGLSLShader::createShader(vector * attributes, for (S32 i = 0; i < channel_count; i++) { - uniform1i(llformat("tex%d", i), i); + LLStaticHashedString uniName(llformat("tex%d", i)); + uniform1i(uniName, i); } S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten @@ -290,7 +303,7 @@ void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count) } } -BOOL LLGLSLShader::mapAttributes(const vector * attributes) +BOOL LLGLSLShader::mapAttributes(const std::vector * attributes) { //before linking, make sure reserved attributes always have consistent locations for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++) @@ -309,6 +322,8 @@ BOOL LLGLSLShader::mapAttributes(const vector * attributes) if (res) { //read back channel locations + mAttributeMask = 0; + //read back reserved channels first for (U32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedAttribs.size(); i++) { @@ -317,6 +332,7 @@ BOOL LLGLSLShader::mapAttributes(const vector * attributes) if (index != -1) { mAttribute[i] = index; + mAttributeMask |= 1 << i; LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL; } } @@ -324,7 +340,7 @@ BOOL LLGLSLShader::mapAttributes(const vector * attributes) { for (U32 i = 0; i < numAttributes; i++) { - const char* name = (*attributes)[i].c_str(); + const char* name = (*attributes)[i].String().c_str(); S32 index = glGetAttribLocationARB(mProgramObject, name); if (index != -1) { @@ -340,7 +356,7 @@ BOOL LLGLSLShader::mapAttributes(const vector * attributes) return FALSE; } -void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) +void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) { if (index == -1) { @@ -349,11 +365,55 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) GLenum type; GLsizei length; - GLint size; + GLint size = -1; char name[1024]; /* Flawfinder: ignore */ name[0] = 0; glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name); +#if !LL_DARWIN + if (size > 0) + { + switch(type) + { + case GL_FLOAT_VEC2: size *= 2; break; + case GL_FLOAT_VEC3: size *= 3; break; + case GL_FLOAT_VEC4: size *= 4; break; + case GL_DOUBLE: size *= 2; break; + case GL_DOUBLE_VEC2: size *= 2; break; + case GL_DOUBLE_VEC3: size *= 6; break; + case GL_DOUBLE_VEC4: size *= 8; break; + case GL_INT_VEC2: size *= 2; break; + case GL_INT_VEC3: size *= 3; break; + case GL_INT_VEC4: size *= 4; break; + case GL_UNSIGNED_INT_VEC2: size *= 2; break; + case GL_UNSIGNED_INT_VEC3: size *= 3; break; + case GL_UNSIGNED_INT_VEC4: size *= 4; break; + case GL_BOOL_VEC2: size *= 2; break; + case GL_BOOL_VEC3: size *= 3; break; + case GL_BOOL_VEC4: size *= 4; break; + case GL_FLOAT_MAT2: size *= 4; break; + case GL_FLOAT_MAT3: size *= 9; break; + case GL_FLOAT_MAT4: size *= 16; break; + case GL_FLOAT_MAT2x3: size *= 6; break; + case GL_FLOAT_MAT2x4: size *= 8; break; + case GL_FLOAT_MAT3x2: size *= 6; break; + case GL_FLOAT_MAT3x4: size *= 12; break; + case GL_FLOAT_MAT4x2: size *= 8; break; + case GL_FLOAT_MAT4x3: size *= 12; break; + case GL_DOUBLE_MAT2: size *= 8; break; + case GL_DOUBLE_MAT3: size *= 18; break; + case GL_DOUBLE_MAT4: size *= 32; break; + case GL_DOUBLE_MAT2x3: size *= 12; break; + case GL_DOUBLE_MAT2x4: size *= 16; break; + case GL_DOUBLE_MAT3x2: size *= 12; break; + case GL_DOUBLE_MAT3x4: size *= 24; break; + case GL_DOUBLE_MAT4x2: size *= 16; break; + case GL_DOUBLE_MAT4x3: size *= 24; break; + } + mTotalUniformSize += size; + } +#endif + S32 location = glGetUniformLocationARB(mProgramObject, name); if (location != -1) { @@ -365,7 +425,10 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) is_array[0] = 0; } - mUniformMap[name] = location; + LLStaticHashedString hashedName(name); + mUniformNameMap[location] = name; + mUniformMap[hashedName] = location; + LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL; //find the index of this uniform @@ -386,7 +449,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) for (U32 i = 0; i < uniforms->size(); i++) { if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1) - && ((*uniforms)[i] == name)) + && ((*uniforms)[i].String() == name)) { //found it mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location; @@ -396,7 +459,17 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) } } } - } +} + +void LLGLSLShader::addPermutation(std::string name, std::string value) +{ + mDefines[name] = value; +} + +void LLGLSLShader::removePermutation(std::string name) +{ + mDefines[name].erase(); +} GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) { @@ -410,13 +483,15 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) return -1; } -BOOL LLGLSLShader::mapUniforms(const vector * uniforms) +BOOL LLGLSLShader::mapUniforms(const vector * uniforms) { BOOL res = TRUE; + mTotalUniformSize = 0; mActiveTextureChannels = 0; mUniform.clear(); mUniformMap.clear(); + mUniformNameMap.clear(); mTexture.clear(); mValue.clear(); //initialize arrays @@ -437,6 +512,7 @@ BOOL LLGLSLShader::mapUniforms(const vector * uniforms) unbind(); + LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << llendl; return res; } @@ -495,6 +571,58 @@ void LLGLSLShader::bindNoShader(void) } } +S32 LLGLSLShader::bindTexture(const std::string &uniform, LLTexture *texture, LLTexUnit::eTextureType mode) +{ + S32 channel = 0; + channel = getUniformLocation(uniform); + + return bindTexture(channel, texture, mode); +} + +S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode) +{ + if (uniform < 0 || uniform >= (S32)mTexture.size()) + { + UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL; + return -1; + } + + uniform = mTexture[uniform]; + + if (uniform > -1) + { + gGL.getTexUnit(uniform)->bind(texture, mode); + } + + return uniform; +} + +S32 LLGLSLShader::unbindTexture(const std::string &uniform, LLTexUnit::eTextureType mode) +{ + S32 channel = 0; + channel = getUniformLocation(uniform); + + return unbindTexture(channel); +} + +S32 LLGLSLShader::unbindTexture(S32 uniform, LLTexUnit::eTextureType mode) +{ + if (uniform < 0 || uniform >= (S32)mTexture.size()) + { + UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL; + return -1; + } + + uniform = mTexture[uniform]; + + if (uniform > -1) + { + gGL.getTexUnit(uniform)->unbind(mode); + } + + return uniform; +} + S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode) { if (uniform < 0 || uniform >= (S32)mTexture.size()) @@ -817,18 +945,18 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c } } -GLint LLGLSLShader::getUniformLocation(const string& uniform) +GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform) { GLint ret = -1; if (mProgramObject > 0) { - std::map::iterator iter = mUniformMap.find(uniform); + LLStaticStringTable::iterator iter = mUniformMap.find(uniform); if (iter != mUniformMap.end()) { if (gDebugGL) { stop_glerror(); - if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.c_str())) + if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str())) { llerrs << "Uniform does not match." << llendl; } @@ -865,7 +993,7 @@ GLint LLGLSLShader::getAttribLocation(U32 attrib) } } -void LLGLSLShader::uniform1i(const string& uniform, GLint v) +void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v) { GLint location = getUniformLocation(uniform); @@ -881,7 +1009,24 @@ void LLGLSLShader::uniform1i(const string& uniform, GLint v) } } -void LLGLSLShader::uniform1f(const string& uniform, GLfloat v) +void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint j) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map::iterator iter = mValue.find(location); + LLVector4 vec(i,j,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform2iARB(location, i, j); + mValue[location] = vec; + } + } +} + + +void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v) { GLint location = getUniformLocation(uniform); @@ -897,7 +1042,7 @@ void LLGLSLShader::uniform1f(const string& uniform, GLfloat v) } } -void LLGLSLShader::uniform2f(const string& uniform, GLfloat x, GLfloat y) +void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y) { GLint location = getUniformLocation(uniform); @@ -914,7 +1059,7 @@ void LLGLSLShader::uniform2f(const string& uniform, GLfloat x, GLfloat y) } -void LLGLSLShader::uniform3f(const string& uniform, GLfloat x, GLfloat y, GLfloat z) +void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z) { GLint location = getUniformLocation(uniform); @@ -930,23 +1075,7 @@ void LLGLSLShader::uniform3f(const string& uniform, GLfloat x, GLfloat y, GLfloa } } -void LLGLSLShader::uniform4f(const string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GLint location = getUniformLocation(uniform); - - if (location >= 0) - { - std::map::iterator iter = mValue.find(location); - LLVector4 vec(x,y,z,w); - if (iter == mValue.end() || shouldChange(iter->second,vec)) - { - glUniform4fARB(location, x,y,z,w); - mValue[location] = vec; - } - } -} - -void LLGLSLShader::uniform1fv(const string& uniform, U32 count, const GLfloat* v) +void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { GLint location = getUniformLocation(uniform); @@ -962,7 +1091,7 @@ void LLGLSLShader::uniform1fv(const string& uniform, U32 count, const GLfloat* v } } -void LLGLSLShader::uniform2fv(const string& uniform, U32 count, const GLfloat* v) +void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { GLint location = getUniformLocation(uniform); @@ -978,7 +1107,7 @@ void LLGLSLShader::uniform2fv(const string& uniform, U32 count, const GLfloat* v } } -void LLGLSLShader::uniform3fv(const string& uniform, U32 count, const GLfloat* v) +void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { GLint location = getUniformLocation(uniform); @@ -994,7 +1123,7 @@ void LLGLSLShader::uniform3fv(const string& uniform, U32 count, const GLfloat* v } } -void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v) +void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { GLint location = getUniformLocation(uniform); @@ -1012,27 +1141,7 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v } } -void LLGLSLShader::uniformMatrix2fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v) -{ - GLint location = getUniformLocation(uniform); - - if (location >= 0) - { - glUniformMatrix2fvARB(location, count, transpose, v); - } -} - -void LLGLSLShader::uniformMatrix3fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v) -{ - GLint location = getUniformLocation(uniform); - - if (location >= 0) - { - glUniformMatrix3fvARB(location, count, transpose, v); - } -} - -void LLGLSLShader::uniformMatrix4fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v) +void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat* v) { GLint location = getUniformLocation(uniform); diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index a5817ce28..1f134a881 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -29,6 +29,7 @@ #include "llgl.h" #include "llrender.h" +#include "llstaticstringtable.h" class LLShaderFeatures { @@ -68,6 +69,7 @@ public: }; LLGLSLShader(S32 shader_class); + ~LLGLSLShader(); static GLhandleARB sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; @@ -75,16 +77,16 @@ public: static bool sNoFixedFunction; void unload(); - BOOL createShader(std::vector * attributes, - std::vector * uniforms, + BOOL createShader(std::vector * attributes, + std::vector * uniforms, U32 varying_count = 0, const char** varyings = NULL); BOOL attachObject(std::string object); void attachObject(GLhandleARB object); void attachObjects(GLhandleARB* objects = NULL, S32 count = 0); - BOOL mapAttributes(const std::vector * attributes); - BOOL mapUniforms(const std::vector * uniforms); - void mapUniform(GLint index, const std::vector * uniforms); + BOOL mapAttributes(const std::vector * attributes); + BOOL mapUniforms(const std::vector *); + void mapUniform(GLint index, const std::vector *); void uniform1i(U32 index, GLint i); void uniform1f(U32 index, GLfloat v); void uniform2f(U32 index, GLfloat x, GLfloat y); @@ -95,34 +97,35 @@ public: void uniform2fv(U32 index, U32 count, const GLfloat* v); void uniform3fv(U32 index, U32 count, const GLfloat* v); void uniform4fv(U32 index, U32 count, const GLfloat* v); - void uniform1i(const std::string& uniform, GLint i); - void uniform1f(const std::string& uniform, GLfloat v); - void uniform2f(const std::string& uniform, GLfloat x, GLfloat y); - void uniform3f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z); - void uniform4f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void uniform1iv(const std::string& uniform, U32 count, const GLint* i); - void uniform1fv(const std::string& uniform, U32 count, const GLfloat* v); - void uniform2fv(const std::string& uniform, U32 count, const GLfloat* v); - void uniform3fv(const std::string& uniform, U32 count, const GLfloat* v); - void uniform4fv(const std::string& uniform, U32 count, const GLfloat* v); + void uniform2i(const LLStaticHashedString& uniform, GLint i, GLint j); void uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); - void uniformMatrix2fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); - void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); - void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); + void uniform1i(const LLStaticHashedString& uniform, GLint i); + void uniform1f(const LLStaticHashedString& uniform, GLfloat v); + void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y); + void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z); + void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat *v); void setMinimumAlpha(F32 minimum); void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void vertexAttrib4fv(U32 index, GLfloat* v); - GLint getUniformLocation(const std::string& uniform); + //GLint getUniformLocation(const std::string& uniform); + GLint getUniformLocation(const LLStaticHashedString& uniform); GLint getUniformLocation(U32 index); GLint getAttribLocation(U32 attrib); GLint mapUniformTextureChannel(GLint location, GLenum type); + void addPermutation(std::string name, std::string value); + void removePermutation(std::string name); + //enable/disable texture channel for specified uniform //if given texture uniform is active in the shader, //the corresponding channel will be active upon return @@ -130,6 +133,13 @@ public: S32 enableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + // bindTexture returns the texture unit we've bound the texture to. + // You can reuse the return value to unbind a texture when required. + S32 bindTexture(const std::string& uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 unbindTexture(const std::string& uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 unbindTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + BOOL link(BOOL suppress_errors = FALSE); void bind(); void unbind(); @@ -142,10 +152,13 @@ public: GLhandleARB mProgramObject; std::vector mAttribute; //lookup table of attribute enum to attribute channel + U32 mAttributeMask; //mask of which reserved attributes are set (lines up with LLVertexBuffer::getTypeMask()) std::vector mUniform; //lookup table of uniform enum to uniform location - std::map mUniformMap; //lookup map of uniform name to uniform location + LLStaticStringTable mUniformMap; //lookup map of uniform name to uniform location + std::map mUniformNameMap; //lookup map of uniform location to uniform name std::map mValue; //lookup map of uniform location to last known value std::vector mTexture; + S32 mTotalUniformSize; S32 mActiveTextureChannels; S32 mShaderClass; S32 mShaderLevel; @@ -154,6 +167,7 @@ public: LLShaderFeatures mFeatures; std::vector< std::pair< std::string, GLenum > > mShaderFiles; std::string mName; + std::map mDefines; }; //UI shader (declared here so llui_libtest will link properly) diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 494774117..5164738d3 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -51,6 +51,28 @@ extern LLGLSLShader gPostPosterizeProgram; extern LLGLSLShader gPostMotionBlurProgram; extern LLGLSLShader gPostVignetteProgram; +static LLStaticHashedString sGamma("gamma"); +static LLStaticHashedString sBrightness("brightness"); +static LLStaticHashedString sContrast("contrast"); +static LLStaticHashedString sContrastBase("contrastBase"); +static LLStaticHashedString sSaturation("saturation"); +static LLStaticHashedString sBrightMult("brightMult"); +static LLStaticHashedString sNoiseStrength("noiseStrength"); +static LLStaticHashedString sLayerCount("layerCount"); + +static LLStaticHashedString sVignetteStrength("vignette_strength"); +static LLStaticHashedString sVignettRadius("vignette_radius"); +static LLStaticHashedString sVignetteDarkness("vignette_darkness"); +static LLStaticHashedString sVignetteDesaturation("vignette_desaturation"); +static LLStaticHashedString sVignetteChromaticAberration("vignette_chromatic_aberration"); +static LLStaticHashedString sScreenRes("screen_res"); + +static LLStaticHashedString sHorizontalPass("horizontalPass"); + +static LLStaticHashedString sPrevProj("prev_proj"); +static LLStaticHashedString sInvProj("inv_proj"); +static LLStaticHashedString sBlurStrength("blur_strength"); + static const unsigned int NOISE_SIZE = 512; static const char * const XML_FILENAME = "postprocesseffects.xml"; @@ -155,16 +177,16 @@ public: /*virtual*/ QuadType preDraw() { - getShader().uniform1f("gamma", mGamma); - getShader().uniform1f("brightness", mBrightness); - getShader().uniform1f("contrast", mContrast); + getShader().uniform1f(sGamma, mGamma); + getShader().uniform1f(sBrightness, mBrightness); + getShader().uniform1f(sContrast, mContrast); float baseI = (mContrastBase.get()[VX] + mContrastBase.get()[VY] + mContrastBase.get()[VZ]) / 3.0f; baseI = mContrastBase.get()[VW] / llmax(baseI,0.001f); float baseR = mContrastBase.get()[VX] * baseI; float baseG = mContrastBase.get()[VY] * baseI; float baseB = mContrastBase.get()[VZ] * baseI; - getShader().uniform3fv("contrastBase", 1, LLVector3(baseR, baseG, baseB).mV); - getShader().uniform1f("saturation", mSaturation); + getShader().uniform3fv(sContrastBase, 1, LLVector3(baseR, baseG, baseB).mV); + getShader().uniform1f(sSaturation, mSaturation); return QUAD_NORMAL; } @@ -187,8 +209,8 @@ public: { LLPostProcess::getInstance()->bindNoise(1); - getShader().uniform1f("brightMult", mBrightnessMult); - getShader().uniform1f("noiseStrength", mNoiseStrength); + getShader().uniform1f(sBrightMult, mBrightnessMult); + getShader().uniform1f(sNoiseStrength, mNoiseStrength); return QUAD_NOISE; } @@ -206,7 +228,7 @@ public: } /*virtual*/ QuadType preDraw() { - getShader().uniform1i("layerCount", mNumLayers); + getShader().uniform1i(sLayerCount, mNumLayers); return QUAD_NORMAL; } }; @@ -232,12 +254,13 @@ public: /*virtual*/ QuadType preDraw() { LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions(); - getShader().uniform1f("vignette_strength", mStrength); - getShader().uniform1f("vignette_radius", mRadius); - getShader().uniform1f("vignette_darkness", mDarkness); - getShader().uniform1f("vignette_desaturation", mDesaturation); - getShader().uniform1f("vignette_chromatic_aberration", mChromaticAberration); - getShader().uniform2fv("screen_res", 1, screen_rect.mV); + + getShader().uniform1f(sVignetteStrength, mStrength); + getShader().uniform1f(sVignettRadius, mRadius); + getShader().uniform1f(sVignetteDarkness, mDarkness); + getShader().uniform1f(sVignetteDesaturation, mDesaturation); + getShader().uniform1f(sVignetteChromaticAberration, mChromaticAberration); + getShader().uniform2fv(sScreenRes, 1, screen_rect.mV); return QUAD_NORMAL; } }; @@ -259,7 +282,7 @@ public: /*virtual*/ S32 getDepthChannel() const { return -1; } /*virtual*/ QuadType preDraw() { - mPassLoc = getShader().getUniformLocation("horizontalPass"); + mPassLoc = getShader().getUniformLocation(sHorizontalPass); return QUAD_NORMAL; } /*virtual*/ bool draw(U32 pass) @@ -295,10 +318,10 @@ public: LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions(); - getShader().uniformMatrix4fv("prev_proj", 1, GL_FALSE, prev_proj.m); - getShader().uniformMatrix4fv("inv_proj", 1, GL_FALSE, inv_proj.m); - getShader().uniform2fv("screen_res", 1, screen_rect.mV); - getShader().uniform1i("blur_strength", mStrength); + getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.m); + getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.m); + getShader().uniform2fv(sScreenRes, 1, screen_rect.mV); + getShader().uniform1i(sBlurStrength, mStrength); return QUAD_NORMAL; } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 006e0e4c9..27f90ae5c 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -528,7 +528,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns) } } -GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels) +GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map* defines, S32 texture_index_channels) { std::pair::iterator, std::multimap::iterator> range; range = mShaderObjects.equal_range(filename); @@ -669,8 +669,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if(SHPackDeferredNormals) text[count++] = strdup("#define PACK_NORMALS\n"); - //copy preprocessor definitions into buffer - for (std::map::iterator iter = mDefinitions.begin(); iter != mDefinitions.end(); ++iter) + if(defines) + { + for (std::map::iterator iter = defines->begin(); iter != defines->end(); ++iter) { std::string define = "#define " + iter->first + " " + iter->second + "\n"; text[count++] = (GLcharARB *) strdup(define.c_str()); @@ -924,7 +925,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (shader_level > 1) { shader_level--; - return loadShaderFile(filename,shader_level,type,texture_index_channels); + return loadShaderFile(filename,shader_level,type, defines, texture_index_channels); } LL_WARNS("ShaderLoading") << "Failed to load " << filename << LL_ENDL; } @@ -1044,7 +1045,9 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("texture_matrix1"); mReservedUniforms.push_back("texture_matrix2"); mReservedUniforms.push_back("texture_matrix3"); - llassert(mReservedUniforms.size() == LLShaderMgr::TEXTURE_MATRIX3+1); + mReservedUniforms.push_back("object_plane_s"); + mReservedUniforms.push_back("object_plane_t"); + llassert(mReservedUniforms.size() == LLShaderMgr::OBJECT_PLANE_T+1); mReservedUniforms.push_back("viewport"); @@ -1185,7 +1188,47 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("lightMap"); mReservedUniforms.push_back("bloomMap"); mReservedUniforms.push_back("projectionMap"); + mReservedUniforms.push_back("norm_mat"); + mReservedUniforms.push_back("matrixPalette"); + + mReservedUniforms.push_back("screenTex"); + mReservedUniforms.push_back("screenDepth"); + mReservedUniforms.push_back("refTex"); + mReservedUniforms.push_back("eyeVec"); + mReservedUniforms.push_back("time"); + mReservedUniforms.push_back("d1"); + mReservedUniforms.push_back("d2"); + mReservedUniforms.push_back("lightDir"); + mReservedUniforms.push_back("specular"); + mReservedUniforms.push_back("lightExp"); + mReservedUniforms.push_back("waterFogColor"); + mReservedUniforms.push_back("waterFogDensity"); + mReservedUniforms.push_back("waterFogKS"); + mReservedUniforms.push_back("refScale"); + mReservedUniforms.push_back("waterHeight"); + mReservedUniforms.push_back("waterPlane"); + mReservedUniforms.push_back("normScale"); + mReservedUniforms.push_back("fresnelScale"); + mReservedUniforms.push_back("fresnelOffset"); + mReservedUniforms.push_back("blurMultiplier"); + mReservedUniforms.push_back("sunAngle"); + mReservedUniforms.push_back("scaledAngle"); + mReservedUniforms.push_back("sunAngle2"); + + mReservedUniforms.push_back("camPosLocal"); + + mReservedUniforms.push_back("gWindDir"); + mReservedUniforms.push_back("gSinWaveParams"); + mReservedUniforms.push_back("gGravity"); + + mReservedUniforms.push_back("detail_0"); + mReservedUniforms.push_back("detail_1"); + mReservedUniforms.push_back("detail_2"); + mReservedUniforms.push_back("detail_3"); + mReservedUniforms.push_back("alpha_ramp"); + + mReservedUniforms.push_back("origin"); llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); std::set dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 7e30e75f0..6d4582ec3 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -47,6 +47,8 @@ public: TEXTURE_MATRIX1, TEXTURE_MATRIX2, TEXTURE_MATRIX3, + OBJECT_PLANE_S, + OBJECT_PLANE_T, VIEWPORT, LIGHT_POSITION, LIGHT_DIRECTION, @@ -164,6 +166,45 @@ public: DEFERRED_LIGHT, DEFERRED_BLOOM, DEFERRED_PROJECTION, + DEFERRED_NORM_MATRIX, + + AVATAR_MATRIX, + WATER_SCREENTEX, + WATER_SCREENDEPTH, + WATER_REFTEX, + WATER_EYEVEC, + WATER_TIME, + WATER_WAVE_DIR1, + WATER_WAVE_DIR2, + WATER_LIGHT_DIR, + WATER_SPECULAR, + WATER_SPECULAR_EXP, + WATER_FOGCOLOR, + WATER_FOGDENSITY, + WATER_FOGKS, + WATER_REFSCALE, + WATER_WATERHEIGHT, + WATER_WATERPLANE, + WATER_NORM_SCALE, + WATER_FRESNEL_SCALE, + WATER_FRESNEL_OFFSET, + WATER_BLUR_MULTIPLIER, + WATER_SUN_ANGLE, + WATER_SCALED_ANGLE, + WATER_SUN_ANGLE2, + + WL_CAMPOSLOCAL, + + AVATAR_WIND, + AVATAR_SINWAVE, + AVATAR_GRAVITY, + + TERRAIN_DETAIL0, + TERRAIN_DETAIL1, + TERRAIN_DETAIL2, + TERRAIN_DETAIL3, + TERRAIN_ALPHARAMP, + SHINY_ORIGIN, END_RESERVED_UNIFORMS } eGLSLReservedUniforms; @@ -176,7 +217,7 @@ public: void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE); BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); BOOL validateProgramObject(GLhandleARB obj); - GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels = -1); + GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map* defines = NULL, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 61762272d..2708a0538 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1509,7 +1509,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) stop_glerror(); - LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette", + LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv(LLViewerShaderMgr::AVATAR_MATRIX, maxJoints, FALSE, (GLfloat*) mat[0].mMatrix); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index f601bac76..f38b5991c 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1370,9 +1370,14 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI LLGLDisable blend(GL_BLEND); gGL.setColorMask(TRUE, TRUE); gNormalMapGenProgram.bind(); - gNormalMapGenProgram.uniform1f("norm_scale", gSavedSettings.getF32("RenderNormalMapScale")); - gNormalMapGenProgram.uniform1f("stepX", 1.f/bump->getWidth()); - gNormalMapGenProgram.uniform1f("stepY", 1.f/bump->getHeight()); + + static LLStaticHashedString sNormScale("norm_scale"); + static LLStaticHashedString sStepX("stepX"); + static LLStaticHashedString sStepY("stepY"); + + gNormalMapGenProgram.uniform1f(sNormScale, gSavedSettings.getF32("RenderNormalMapScale")); + gNormalMapGenProgram.uniform1f(sStepX, 1.f/bump->getWidth()); + gNormalMapGenProgram.uniform1f(sStepX, 1.f/bump->getHeight()); LLVector2 v((F32) bump->getWidth()/gPipeline.mScreen.getWidth(), (F32) bump->getHeight()/gPipeline.mScreen.getHeight()); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 8465d34a7..478374ee7 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -362,8 +362,8 @@ void LLDrawPoolTerrain::renderFullShader() LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; llassert(shader); - shader->uniform4fv("object_plane_s", 1, tp0.mV); - shader->uniform4fv("object_plane_t", 1, tp1.mV); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV); gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadIdentity(); @@ -873,8 +873,8 @@ void LLDrawPoolTerrain::renderSimple() if (LLGLSLShader::sNoFixedFunction) { - sShader->uniform4fv("object_plane_s", 1, tp0.mV); - sShader->uniform4fv("object_plane_t", 1, tp1.mV); + sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV); + sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV); } else { diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 91fbf7cbe..756318583 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -449,8 +449,8 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() } else { - shader->uniform4fv("object_plane_s", 1, tp0); - shader->uniform4fv("object_plane_t", 1, tp1); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); } gGL.diffuseColor3f(1.f, 1.f, 1.f); @@ -624,12 +624,12 @@ void LLDrawPoolWater::shade() mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT); } - S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX); + S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); if (screentex > -1) { - shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); - shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY, + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); + shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, param_mgr->getFogDensity()); gPipeline.mWaterDis.bindTexture(0, screentex); } @@ -641,7 +641,7 @@ void LLDrawPoolWater::shade() if (mVertexShaderLevel == 1) { sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue; - shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); } F32 screenRes[] = @@ -649,10 +649,10 @@ void LLDrawPoolWater::shade() 1.f/gGLViewport[2], 1.f/gGLViewport[3] }; - shader->uniform2fv("screenRes", 1, screenRes); + shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); stop_glerror(); - S32 diffTex = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); + S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); stop_glerror(); light_dir.normVec(); @@ -661,26 +661,26 @@ void LLDrawPoolWater::shade() light_diffuse *= 6.f; //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); - shader->uniform1f(LLViewerShaderMgr::WATER_WATERHEIGHT, eyedepth); - shader->uniform1f(LLViewerShaderMgr::WATER_TIME, sTime); - shader->uniform3fv(LLViewerShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); - shader->uniform3fv(LLViewerShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); - shader->uniform1f(LLViewerShaderMgr::WATER_SPECULAR_EXP, light_exp); - shader->uniform2fv(LLViewerShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); - shader->uniform2fv(LLViewerShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV); - shader->uniform3fv(LLViewerShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); + shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); + shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); + shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); + shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV); + shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); - shader->uniform3fv("normScale", 1, param_mgr->getNormalScale().mV); - shader->uniform1f("fresnelScale", param_mgr->getFresnelScale()); - shader->uniform1f("fresnelOffset", param_mgr->getFresnelOffset()); - shader->uniform1f("blurMultiplier", param_mgr->getBlurMultiplier()); + shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, param_mgr->getNormalScale().mV); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, param_mgr->getFresnelScale()); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, param_mgr->getFresnelOffset()); + shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, param_mgr->getBlurMultiplier()); F32 sunAngle = llmax(0.f, light_dir.mV[2]); F32 scaledAngle = 1.f - sunAngle; - shader->uniform1f("sunAngle", sunAngle); - shader->uniform1f("scaledAngle", scaledAngle); - shader->uniform1f("sunAngle2", 0.1f + 0.2f*sunAngle); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); + shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); LLColor4 water_color; LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); @@ -688,12 +688,12 @@ void LLDrawPoolWater::shade() if (LLViewerCamera::getInstance()->cameraUnderWater()) { water_color.setVec(1.f, 1.f, 1.f, 0.4f); - shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); } else { water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove()); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove()); } if (water_color.mV[3] > 0.9f) @@ -739,12 +739,12 @@ void LLDrawPoolWater::shade() } } - shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX); - shader->disableTexture(LLViewerShaderMgr::BUMP_MAP); - shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - shader->disableTexture(LLViewerShaderMgr::WATER_REFTEX); - shader->disableTexture(LLViewerShaderMgr::WATER_SCREENDEPTH); + shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); + shader->disableTexture(LLShaderMgr::BUMP_MAP); + shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); + shader->disableTexture(LLShaderMgr::WATER_REFTEX); + shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); if (deferred_render) { diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 104f6cac1..3d0762132 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -161,7 +161,8 @@ void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) cons gGL.translatef(0.f,-camHeightLocal, 0.f); // Draw WL Sky - shader->uniform3f("camPosLocal", 0.f, camHeightLocal, 0.f); + static LLStaticHashedString sCamPosLocal("camPosLocal"); + shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f); gSky.mVOWLSkyp->drawDome(); @@ -219,7 +220,8 @@ void LLDrawPoolWLSky::renderStars(void) const if (gPipeline.canUseVertexShaders()) { - star_shader->uniform1f("custom_alpha", star_alpha.mV[3]); + static LLStaticHashedString sCustomAlpha("custom_alpha"); + star_shader->uniform1f(sCustomAlpha, star_alpha.mV[3]); } else { @@ -294,7 +296,8 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (gPipeline.canUseVertexShaders()) { // Okay, so the moon isn't a star, but it's close enough. - star_shader->uniform1f("custom_alpha", color.mV[VW]); + static LLStaticHashedString sCustomAlpha("custom_alpha"); + star_shader->uniform1f(sCustomAlpha, color.mV[VW]); } else { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 17ac4ef1a..f39812631 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -60,6 +60,9 @@ #define LL_MAX_INDICES_COUNT 1000000 +static LLStaticHashedString sTextureIndexIn("texture_index_in"); +static LLStaticHashedString sColorIn("color_in"); + BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE #define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2]) @@ -1414,7 +1417,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, vp[2] = 0; vp[3] = 0; - gTransformPositionProgram.uniform1i("texture_index_in", val); + gTransformPositionProgram.uniform1i(sTextureIndexIn, val); glBeginTransformFeedback(GL_POINTS); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -1432,7 +1435,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, S32 val = *((S32*) color.mV); - gTransformColorProgram.uniform1i("color_in", val); + gTransformColorProgram.uniform1i(sColorIn, val); glBeginTransformFeedback(GL_POINTS); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); push_for_transform(buff, vf.mNumVertices, mGeomCount); @@ -1453,7 +1456,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, (glow << 16) | (glow << 24); - gTransformColorProgram.uniform1i("color_in", glow32); + gTransformColorProgram.uniform1i(sColorIn, glow32); glBeginTransformFeedback(GL_POINTS); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); push_for_transform(buff, vf.mNumVertices, mGeomCount); diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 7c9a0aadc..bdbc132c5 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1696,7 +1696,8 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, gGL.getModelviewMatrix().inverse().mult_vec_matrix(plane); - gClipProgram.uniform4fv("clip_plane", 1, plane.v); + static LLStaticHashedString sClipPlane("clip_plane"); + gClipProgram.uniform4fv(sClipPlane, 1, plane.v); BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES); #if ENABLE_CLASSIC_CLOUDS diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index ae089335e..f35c4af02 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -57,6 +57,13 @@ #define UNIFORM_ERRS LL_ERRS("Shader") #endif +static LLStaticHashedString sTexture0("texture0"); +static LLStaticHashedString sTexture1("texture1"); +static LLStaticHashedString sTex0("tex0"); +static LLStaticHashedString sTex1("tex1"); +static LLStaticHashedString sGlowMap("glowMap"); +static LLStaticHashedString sScreenMap("screenMap"); + // Lots of STL stuff in here, using namespace std to keep things more readable using std::vector; using std::pair; @@ -331,11 +338,6 @@ void LLViewerShaderMgr::setShaders() } } - //setup preprocessor definitions - LLShaderMgr::instance()->mDefinitions.clear(); - LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples")); - LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits); - initAttribsAndUniforms(); gPipeline.releaseGLBuffers(); @@ -724,7 +726,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() for (U32 i = 0; i < shaders.size(); i++) { // Note usage of GL_FRAGMENT_SHADER_ARB - if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB, index_channels[i]) == 0) + if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB, NULL, index_channels[i]) == 0) { return FALSE; } @@ -756,7 +758,7 @@ BOOL LLViewerShaderMgr::loadShadersEnvironment() gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB)); gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainF.glsl", GL_FRAGMENT_SHADER_ARB)); gTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT]; - success = gTerrainProgram.createShader(NULL, &mTerrainUniforms); + success = gTerrainProgram.createShader(NULL, NULL); } if (!success) @@ -792,7 +794,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB)); gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB)); gWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER]; - success = gWaterProgram.createShader(NULL, &mWaterUniforms); + success = gWaterProgram.createShader(NULL, NULL); } if (success) @@ -806,7 +808,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER]; gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gUnderWaterProgram.createShader(NULL, &mWaterUniforms); + success = gUnderWaterProgram.createShader(NULL, NULL); } if (success) @@ -824,7 +826,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gTerrainWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT]; gTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, &mTerrainUniforms); + terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, NULL); } /// Keep track of water shader levels @@ -872,7 +874,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER_ARB)); gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER_ARB)); gGlowProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; - success = gGlowProgram.createShader(NULL, &mGlowUniforms); + success = gGlowProgram.createShader(NULL, NULL); LLPipeline::sRenderGlow = success; } @@ -883,7 +885,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER_ARB)); gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER_ARB)); gGlowExtractProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; - success = gGlowExtractProgram.createShader(NULL, &mGlowExtractUniforms); + success = gGlowExtractProgram.createShader(NULL, NULL); LLPipeline::sRenderGlow = success; } } @@ -895,13 +897,16 @@ BOOL LLViewerShaderMgr::loadShadersEffects() //load Color Filter Shader //if (success) { - vector shaderUniforms; - shaderUniforms.reserve(6); - shaderUniforms.push_back("gamma"); - shaderUniforms.push_back("brightness"); - shaderUniforms.push_back("contrast"); - shaderUniforms.push_back("contrastBase"); - shaderUniforms.push_back("saturation"); + static std::vector shaderUniforms; + if(shaderUniforms.empty()) + { + shaderUniforms.reserve(6); + shaderUniforms.push_back(LLStaticHashedString("gamma")); + shaderUniforms.push_back(LLStaticHashedString("brightness")); + shaderUniforms.push_back(LLStaticHashedString("contrast")); + shaderUniforms.push_back(LLStaticHashedString("contrastBase")); + shaderUniforms.push_back(LLStaticHashedString("saturation")); + } gPostColorFilterProgram.mName = "Color Filter Shader (Post)"; gPostColorFilterProgram.mShaderFiles.clear(); @@ -911,36 +916,41 @@ BOOL LLViewerShaderMgr::loadShadersEffects() if(gPostColorFilterProgram.createShader(NULL, &shaderUniforms)) { gPostColorFilterProgram.bind(); - gPostColorFilterProgram.uniform1i("tex0", 0); + gPostColorFilterProgram.uniform1i(sTex0, 0); } } //load Night Vision Shader //if (success) { - vector shaderUniforms; - shaderUniforms.reserve(3); - shaderUniforms.push_back("brightMult"); - shaderUniforms.push_back("noiseStrength"); - + static std::vector shaderUniforms; + if(shaderUniforms.empty()) + { + shaderUniforms.reserve(3); + shaderUniforms.push_back(LLStaticHashedString("brightMult")); + shaderUniforms.push_back(LLStaticHashedString("noiseStrength")); + } gPostNightVisionProgram.mName = "Night Vision Shader (Post)"; gPostNightVisionProgram.mShaderFiles.clear(); gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/nightVisionF.glsl", GL_FRAGMENT_SHADER_ARB)); - gPostNightVisionProgram.mShaderFiles.push_back(make_pair("interface/twotextureaddV.glsl", GL_VERTEX_SHADER_ARB)); + gPostNightVisionProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB)); gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; if(gPostNightVisionProgram.createShader(NULL, &shaderUniforms)) { gPostNightVisionProgram.bind(); - gPostNightVisionProgram.uniform1i("tex0", 0); - gPostNightVisionProgram.uniform1i("tex1", 1); + gPostNightVisionProgram.uniform1i(sTex0, 0); + gPostNightVisionProgram.uniform1i(sTex1, 1); } } //if (success) { - vector shaderUniforms; - shaderUniforms.reserve(1); - shaderUniforms.push_back("horizontalPass"); + static std::vector shaderUniforms; + if(shaderUniforms.empty()) + { + shaderUniforms.reserve(1); + shaderUniforms.push_back(LLStaticHashedString("horizontalPass")); + } gPostGaussianBlurProgram.mName = "Gaussian Blur Shader (Post)"; gPostGaussianBlurProgram.mShaderFiles.clear(); @@ -950,14 +960,17 @@ BOOL LLViewerShaderMgr::loadShadersEffects() if(gPostGaussianBlurProgram.createShader(NULL, &shaderUniforms)) { gPostGaussianBlurProgram.bind(); - gPostGaussianBlurProgram.uniform1i("tex0", 0); + gPostGaussianBlurProgram.uniform1i(sTex0, 0); } } { - vector shaderUniforms; - shaderUniforms.reserve(1); - shaderUniforms.push_back("layerCount"); + static std::vector shaderUniforms; + if(shaderUniforms.empty()) + { + shaderUniforms.reserve(1); + shaderUniforms.push_back(LLStaticHashedString("layerCount")); + } gPostPosterizeProgram.mName = "Posterize Shader (Post)"; gPostPosterizeProgram.mShaderFiles.clear(); @@ -967,16 +980,19 @@ BOOL LLViewerShaderMgr::loadShadersEffects() if(gPostPosterizeProgram.createShader(NULL, &shaderUniforms)) { gPostPosterizeProgram.bind(); - gPostPosterizeProgram.uniform1i("tex0", 0); + gPostPosterizeProgram.uniform1i(sTex0, 0); } } { - vector shaderUniforms; - shaderUniforms.reserve(3); - shaderUniforms.push_back("inv_proj"); - shaderUniforms.push_back("prev_proj"); - shaderUniforms.push_back("screen_res"); + static std::vector shaderUniforms; + if(shaderUniforms.empty()) + { + shaderUniforms.reserve(3); + shaderUniforms.push_back(LLStaticHashedString("inv_proj")); + shaderUniforms.push_back(LLStaticHashedString("prev_proj")); + shaderUniforms.push_back(LLStaticHashedString("screen_res")); + } gPostMotionBlurProgram.mName = "Motion Blur Shader (Post)"; gPostMotionBlurProgram.mShaderFiles.clear(); @@ -986,17 +1002,20 @@ BOOL LLViewerShaderMgr::loadShadersEffects() if(gPostMotionBlurProgram.createShader(NULL, &shaderUniforms)) { gPostMotionBlurProgram.bind(); - gPostMotionBlurProgram.uniform1i("tex0", 0); - gPostMotionBlurProgram.uniform1i("tex1", 1); + gPostMotionBlurProgram.uniform1i(sTex0, 0); + gPostMotionBlurProgram.uniform1i(sTex1, 1); } } { - vector shaderUniforms; - shaderUniforms.reserve(3); - shaderUniforms.push_back("vignette_darkness"); - shaderUniforms.push_back("vignette_radius"); - shaderUniforms.push_back("screen_res"); + static std::vector shaderUniforms; + if(shaderUniforms.empty()) + { + shaderUniforms.reserve(3); + shaderUniforms.push_back(LLStaticHashedString("vignette_darkness")); + shaderUniforms.push_back(LLStaticHashedString("vignette_radius")); + shaderUniforms.push_back(LLStaticHashedString("screen_res")); + } gPostVignetteProgram.mName = "Vignette Shader (Post)"; gPostVignetteProgram.mShaderFiles.clear(); @@ -1006,7 +1025,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() if(gPostVignetteProgram.createShader(NULL, &shaderUniforms)) { gPostVignetteProgram.bind(); - gPostVignetteProgram.uniform1i("tex0", 0); + gPostVignetteProgram.uniform1i(sTex0, 0); } } @@ -1314,7 +1333,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredWaterProgram.createShader(NULL, &mWaterUniforms); + success = gDeferredWaterProgram.createShader(NULL, NULL); } if (success) @@ -1373,7 +1392,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarShadowProgram.createShader(NULL, &mAvatarUniforms); + success = gDeferredAvatarShadowProgram.createShader(NULL, NULL); } if (success) @@ -1394,7 +1413,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredTerrainProgram.createShader(NULL, &mTerrainUniforms); + success = gDeferredTerrainProgram.createShader(NULL, NULL); } if (success) @@ -1405,7 +1424,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarProgram.createShader(NULL, &mAvatarUniforms); + success = gDeferredAvatarProgram.createShader(NULL, NULL); } if (success) @@ -1425,7 +1444,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms); + success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL); gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true; gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true; @@ -1490,7 +1509,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gDeferredWLSkyProgram.createShader(NULL, &mWLUniforms); + success = gDeferredWLSkyProgram.createShader(NULL, NULL); } if (success) @@ -1501,14 +1520,19 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gDeferredWLCloudProgram.createShader(NULL, &mWLUniforms); + success = gDeferredWLCloudProgram.createShader(NULL, NULL); } if (success) { gDeferredStarProgram.mName = "Deferred Star Program"; - vector shaderUniforms(mWLUniforms); - shaderUniforms.push_back("custom_alpha"); + static std::vector shaderUniforms; + static bool bUniformsInitted = false; + if(!bUniformsInitted) + { + bUniformsInitted = true; + shaderUniforms.push_back(LLStaticHashedString("custom_alpha")); + } gDeferredStarProgram.mShaderFiles.clear(); gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1819,7 +1843,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gObjectShinyNonIndexedProgram.createShader(NULL, &mShinyUniforms); + success = gObjectShinyNonIndexedProgram.createShader(NULL, NULL); } if (success) @@ -1836,7 +1860,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectShinyNonIndexedWaterProgram.createShader(NULL, &mShinyUniforms); + success = gObjectShinyNonIndexedWaterProgram.createShader(NULL, NULL); } if (success) @@ -1852,7 +1876,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gObjectFullbrightShinyNonIndexedProgram.createShader(NULL, &mShinyUniforms); + success = gObjectFullbrightShinyNonIndexedProgram.createShader(NULL, NULL); } if (success) @@ -1870,7 +1894,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectFullbrightShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectFullbrightShinyNonIndexedWaterProgram.createShader(NULL, &mShinyUniforms); + success = gObjectFullbrightShinyNonIndexedWaterProgram.createShader(NULL, NULL); } if (success) @@ -1949,12 +1973,11 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectBumpProgram.mShaderFiles.push_back(make_pair("objects/bumpF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectBumpProgram.createShader(NULL, NULL); - if (success) { //lldrawpoolbump assumes "texture0" has channel 0 and "texture1" has channel 1 gObjectBumpProgram.bind(); - gObjectBumpProgram.uniform1i("texture0", 0); - gObjectBumpProgram.uniform1i("texture1", 1); + gObjectBumpProgram.uniform1i(sTexture0, 0); + gObjectBumpProgram.uniform1i(sTexture1, 1); gObjectBumpProgram.unbind(); } } @@ -2103,7 +2126,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gObjectShinyProgram.createShader(NULL, &mShinyUniforms); + success = gObjectShinyProgram.createShader(NULL, NULL); } if (success) @@ -2120,7 +2143,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectShinyWaterProgram.createShader(NULL, &mShinyUniforms); + success = gObjectShinyWaterProgram.createShader(NULL, NULL); } if (success) @@ -2136,7 +2159,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms); + success = gObjectFullbrightShinyProgram.createShader(NULL, NULL); } if (success) @@ -2154,7 +2177,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectFullbrightShinyWaterProgram.createShader(NULL, &mShinyUniforms); + success = gObjectFullbrightShinyWaterProgram.createShader(NULL, NULL); } if (mVertexShaderLevel[SHADER_AVATAR] > 0) @@ -2239,7 +2262,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gSkinnedObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gSkinnedObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms); + success = gSkinnedObjectFullbrightShinyProgram.createShader(NULL, NULL); } if (success) @@ -2256,7 +2279,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB)); gSkinnedObjectShinySimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gSkinnedObjectShinySimpleProgram.createShader(NULL, &mShinyUniforms); + success = gSkinnedObjectShinySimpleProgram.createShader(NULL, NULL); } if (success) @@ -2313,7 +2336,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gSkinnedObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gSkinnedObjectFullbrightShinyWaterProgram.createShader(NULL, &mShinyUniforms); + success = gSkinnedObjectFullbrightShinyWaterProgram.createShader(NULL, NULL); } if (success) @@ -2332,7 +2355,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gSkinnedObjectShinySimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gSkinnedObjectShinySimpleWaterProgram.createShader(NULL, &mShinyUniforms); + success = gSkinnedObjectShinySimpleWaterProgram.createShader(NULL, NULL); } } @@ -2370,7 +2393,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB)); gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR]; - success = gAvatarProgram.createShader(NULL, &mAvatarUniforms); + success = gAvatarProgram.createShader(NULL, NULL); if (success) { @@ -2389,7 +2412,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() // Note: no cloth under water: gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1); gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gAvatarWaterProgram.createShader(NULL, &mAvatarUniforms); + success = gAvatarWaterProgram.createShader(NULL, NULL); } /// Keep track of avatar levels @@ -2408,7 +2431,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB)); gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR]; - success = gAvatarPickProgram.createShader(NULL, &mAvatarUniforms); + success = gAvatarPickProgram.createShader(NULL, NULL); } if (success) @@ -2490,7 +2513,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { gSplatTextureRectProgram.bind(); - gSplatTextureRectProgram.uniform1i("screenMap", 0); + gSplatTextureRectProgram.uniform1i(sScreenMap, 0); gSplatTextureRectProgram.unbind(); } } @@ -2506,8 +2529,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { gGlowCombineProgram.bind(); - gGlowCombineProgram.uniform1i("glowMap", 0); - gGlowCombineProgram.uniform1i("screenMap", 1); + gGlowCombineProgram.uniform1i(sGlowMap, 0); + gGlowCombineProgram.uniform1i(sScreenMap, 1); gGlowCombineProgram.unbind(); } } @@ -2523,8 +2546,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { gGlowCombineFXAAProgram.bind(); - gGlowCombineFXAAProgram.uniform1i("glowMap", 0); - gGlowCombineFXAAProgram.uniform1i("screenMap", 1); + gGlowCombineFXAAProgram.uniform1i(sGlowMap, 0); + gGlowCombineFXAAProgram.uniform1i(sScreenMap, 1); gGlowCombineFXAAProgram.unbind(); } } @@ -2541,8 +2564,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { gTwoTextureAddProgram.bind(); - gTwoTextureAddProgram.uniform1i("tex0", 0); - gTwoTextureAddProgram.uniform1i("tex1", 1); + gTwoTextureAddProgram.uniform1i(sTex0, 0); + gTwoTextureAddProgram.uniform1i(sTex1, 1); } } @@ -2557,7 +2580,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { gOneTextureNoColorProgram.bind(); - gOneTextureNoColorProgram.uniform1i("tex0", 0); + gOneTextureNoColorProgram.uniform1i(sTex0, 0); } } @@ -2577,7 +2600,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { gSolidColorProgram.bind(); - gSolidColorProgram.uniform1i("tex0", 0); + gSolidColorProgram.uniform1i(sTex0, 0); gSolidColorProgram.unbind(); } } @@ -2660,7 +2683,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gWLSkyProgram.createShader(NULL, &mWLUniforms); + success = gWLSkyProgram.createShader(NULL, NULL); } if (success) @@ -2672,7 +2695,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); gWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; gWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; - success = gWLCloudProgram.createShader(NULL, &mWLUniforms); + success = gWLCloudProgram.createShader(NULL, NULL); } return success; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index a27200974..38b7342e2 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -80,57 +80,6 @@ public: SHADER_COUNT }; - typedef enum - { - SHINY_ORIGIN = END_RESERVED_UNIFORMS - } eShinyUniforms; - - typedef enum - { - WATER_SCREENTEX = END_RESERVED_UNIFORMS, - WATER_SCREENDEPTH, - WATER_REFTEX, - WATER_EYEVEC, - WATER_TIME, - WATER_WAVE_DIR1, - WATER_WAVE_DIR2, - WATER_LIGHT_DIR, - WATER_SPECULAR, - WATER_SPECULAR_EXP, - WATER_FOGCOLOR, - WATER_FOGDENSITY, - WATER_REFSCALE, - WATER_WATERHEIGHT, - } eWaterUniforms; - - typedef enum - { - WL_CAMPOSLOCAL = END_RESERVED_UNIFORMS, - WL_WATERHEIGHT - } eWLUniforms; - - typedef enum - { - TERRAIN_DETAIL0 = END_RESERVED_UNIFORMS, - TERRAIN_DETAIL1, - TERRAIN_DETAIL2, - TERRAIN_DETAIL3, - TERRAIN_ALPHARAMP - } eTerrainUniforms; - - typedef enum - { - GLOW_DELTA = END_RESERVED_UNIFORMS - } eGlowUniforms; - - typedef enum - { - AVATAR_MATRIX = END_RESERVED_UNIFORMS, - AVATAR_WIND, - AVATAR_SINWAVE, - AVATAR_GRAVITY, - } eAvatarUniforms; - // simple model of forward iterator // http://www.sgi.com/tech/stl/ForwardIterator.html class shader_iter diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 2e05207cc..26303187d 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -320,12 +320,12 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader) if (shader->mShaderGroup == LLGLSLShader::SG_WATER) { shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV); - shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); - shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV); - shader->uniform4fv("waterPlane", 1, mWaterPlane.mV); - shader->uniform1f("waterFogDensity", getFogDensity()); - shader->uniform1f("waterFogKS", mWaterFogKS); - shader->uniform1f("distance_multiplier", 0); + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, LLDrawPoolWater::sWaterFogColor.mV); + shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, mWaterPlane.mV); + shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, getFogDensity()); + shader->uniform1f(LLShaderMgr::WATER_FOGKS, mWaterFogKS); + shader->uniform1f(LLViewerShaderMgr::DISTANCE_MULTIPLIER, 0); } } diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 95eba470f..235a02c8c 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -373,8 +373,8 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); - shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); } else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) @@ -382,7 +382,7 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV); } - shader->uniform1f("scene_light_strength", mSceneLightStrength); + shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength); } diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index 8691a245c..63b58f4d3 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -44,6 +44,22 @@ #include +static LLStaticHashedString sStarBrightness("star_brightness"); +static LLStaticHashedString sPresetNum("preset_num"); +static LLStaticHashedString sSunAngle("sun_angle"); +static LLStaticHashedString sEastAngle("east_angle"); +static LLStaticHashedString sEnableCloudScroll("enable_cloud_scroll"); +static LLStaticHashedString sCloudScrollRate("cloud_scroll_rate"); +static LLStaticHashedString sLightNorm("lightnorm"); +static LLStaticHashedString sCloudDensity("cloud_pos_density1"); +static LLStaticHashedString sCloudScale("cloud_scale"); +static LLStaticHashedString sCloudShadow("cloud_shadow"); +static LLStaticHashedString sDensityMultiplier("density_multiplier"); +static LLStaticHashedString sDistanceMultiplier("distance_multiplier"); +static LLStaticHashedString sHazeDensity("haze_density"); +static LLStaticHashedString sHazeHorizon("haze_horizon"); +static LLStaticHashedString sMaxY("max_y"); + LLWLParamSet::LLWLParamSet(void) : mName("Unnamed Preset"), mCloudScrollXOffset(0.f), mCloudScrollYOffset(0.f) @@ -54,21 +70,24 @@ static LLFastTimer::DeclareTimer FTM_WL_PARAM_UPDATE("WL Param Update"); void LLWLParamSet::update(LLGLSLShader * shader) const { LLFastTimer t(FTM_WL_PARAM_UPDATE); - - for(LLSD::map_const_iterator i = mParamValues.beginMap(); - i != mParamValues.endMap(); - ++i) + LLSD::map_const_iterator i = mParamValues.beginMap(); + std::vector::const_iterator n = mParamHashedNames.begin(); + for(;(i != mParamValues.endMap()) && (n != mParamHashedNames.end());++i, n++) { - const std::string& param = i->first; + const LLStaticHashedString& param = *n; - if( param == "star_brightness" || param == "preset_num" || param == "sun_angle" || - param == "east_angle" || param == "enable_cloud_scroll" || - param == "cloud_scroll_rate" || param == "lightnorm" ) + // check that our pre-hashed names are still tracking the mParamValues map correctly + // + llassert(param.String() == i->first); + + if (param == sStarBrightness || param == sPresetNum || param == sSunAngle || + param == sEastAngle || param == sEnableCloudScroll || + param == sCloudScrollRate || param == sLightNorm ) { continue; } - if(param == "cloud_pos_density1") + if (param == sCloudDensity) { LLVector4 val; val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset; @@ -80,10 +99,10 @@ void LLWLParamSet::update(LLGLSLShader * shader) const shader->uniform4fv(param, 1, val.mV); stop_glerror(); } - else if (param == "cloud_scale" || param == "cloud_shadow" || - param == "density_multiplier" || param == "distance_multiplier" || - param == "haze_density" || param == "haze_horizon" || - param == "max_y" ) + else if (param == sCloudScale || param == sCloudShadow || + param == sDensityMultiplier || param == sDistanceMultiplier || + param == sHazeDensity || param == sHazeHorizon || + param == sMaxY ) { F32 val = (F32) i->second[0].asReal(); @@ -384,3 +403,14 @@ void LLWLParamSet::updateCloudScrolling(void) mCloudScrollYOffset += F32(delta_t * (getCloudScrollY() - 10.f) / 100.f); } } + +void LLWLParamSet::updateHashedNames() +{ + mParamHashedNames.clear(); + // Iterate through values + for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter) + { + mParamHashedNames.push_back(LLStaticHashedString(iter->first)); + } +} + diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h index 6e04ac110..16bdf8ba3 100644 --- a/indra/newview/llwlparamset.h +++ b/indra/newview/llwlparamset.h @@ -38,6 +38,7 @@ #include "v4math.h" #include "v4color.h" +#include "llstaticstringtable.h" class LLWLParamSet; class LLGLSLShader; @@ -54,9 +55,12 @@ public: private: LLSD mParamValues; - + std::vector mParamHashedNames; + float mCloudScrollXOffset, mCloudScrollYOffset; + void updateHashedNames(); + public: LLWLParamSet(); @@ -184,6 +188,8 @@ inline void LLWLParamSet::setAll(const LLSD& val) if(val.isMap()) { mParamValues = val; } + + updateHashedNames(); } inline const LLSD& LLWLParamSet::getAll() diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 86cdc5a4c..561b62dc3 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -204,6 +204,12 @@ LLFastTimer::DeclareTimer FTM_RENDER_DEFERRED("Deferred Shading"); static LLFastTimer::DeclareTimer FTM_STATESORT_DRAWABLE("Sort Drawables"); static LLFastTimer::DeclareTimer FTM_STATESORT_POSTSORT("Post Sort"); +static LLStaticHashedString sNormMat("norm_mat"); +static LLStaticHashedString sOffset("offset"); +static LLStaticHashedString sDelta("delta"); +static LLStaticHashedString sDistFactor("dist_factor"); +static LLStaticHashedString sKern("kern"); +static LLStaticHashedString sKernScale("kern_scale"); //---------------------------------------- std::string gPoolNames[] = { @@ -7478,10 +7484,10 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); - if (shader.getUniformLocation("norm_mat") >= 0) + if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) { glh::matrix4f norm_mat = glh_get_current_modelview().inverse().transpose(); - shader.uniformMatrix4fv("norm_mat", 1, FALSE, norm_mat.m); + shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); } } @@ -7617,8 +7623,8 @@ void LLPipeline::renderDeferredLighting() } } - gDeferredSunProgram.uniform3fv("offset", slice, offset); - gDeferredSunProgram.uniform2f("screenRes", mDeferredLight.getWidth(), mDeferredLight.getHeight()); + gDeferredSunProgram.uniform3fv(sOffset, slice, offset); + gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight()); { LLGLDisable blend(GL_BLEND); @@ -7662,10 +7668,10 @@ void LLPipeline::renderDeferredLighting() x += 1.f; } - gDeferredBlurLightProgram.uniform2f("delta", 1.f, 0.f); - gDeferredBlurLightProgram.uniform1f("dist_factor", dist_factor); - gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV); - gDeferredBlurLightProgram.uniform1f("kern_scale", blur_size * (kern_length/2.f - 0.5f)); + gDeferredBlurLightProgram.uniform2f(sDelta, 1.f, 0.f); + gDeferredBlurLightProgram.uniform1f(sDistFactor, dist_factor); + gDeferredBlurLightProgram.uniform3fv(sKern, kern_length, gauss[0].mV); + gDeferredBlurLightProgram.uniform1f(sKernScale, blur_size * (kern_length/2.f - 0.5f)); { LLGLDisable blend(GL_BLEND); @@ -7682,7 +7688,7 @@ void LLPipeline::renderDeferredLighting() mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); mDeferredLight.bindTarget(); - gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f); + gDeferredBlurLightProgram.uniform2f(sDelta, 0.f, 1.f); { LLGLDisable blend(GL_BLEND); From f4863527aa5e5a3cccd55b751bbd2383b9bc15c3 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 16:29:38 -0500 Subject: [PATCH 43/62] Migrate ui scale/translation transform matrix stacks to LLAlignedArray. --- indra/llcommon/llalignedarray.h | 6 +++++- indra/llcommon/llmemory.h | 8 -------- indra/llrender/llrender.cpp | 32 ++++++++++++-------------------- indra/llrender/llrender.h | 6 +++--- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/indra/llcommon/llalignedarray.h b/indra/llcommon/llalignedarray.h index 964b6d87a..14e25e78d 100644 --- a/indra/llcommon/llalignedarray.h +++ b/indra/llcommon/llalignedarray.h @@ -41,7 +41,11 @@ public: ~LLAlignedArray(); void push_back(const T& elem); - U32 size() const { return mElementCount; } + void pop_back() { if(!!mElementCount) --mElementCount; } + bool empty() const { return !mElementCount; } + T& front() { return operator[](0); } + T& back() { return operator[](mElementCount-1); } + U32 size() const { return mElementCount; } void resize(U32 size); T* append(S32 N); T& operator[](int idx); diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 5d73c2e8f..084f9780c 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -663,14 +663,6 @@ void LLPrivateMemoryPoolTester::operator delete[](void* addr) #endif #endif -LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); - -#ifdef SHOW_ASSERT -#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast(ptr),((U32)alignment)) -#else -#define ll_assert_aligned(ptr,alignment) -#endif - //EVENTUALLY REMOVE THESE: #include "llpointer.h" #include "llsingleton.h" diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index bbf70b9de..782562886 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1496,7 +1496,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) } LLVector4a add(x,y,z); - mUIOffset.back()->add(add); + mUIOffset.back().add(add); } void LLRender::scaleUI(F32 x, F32 y, F32 z) @@ -1507,33 +1507,27 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) } LLVector4a scale(x,y,z); - mUIScale.back()->mul(scale); + mUIScale.back().mul(scale); } void LLRender::pushUIMatrix() { if (mUIOffset.empty()) { - mUIOffset.push_back(static_cast(ll_aligned_malloc_16(sizeof(LLVector4a)))); - mUIOffset.back()->splat(0.f); + mUIOffset.push_back(LLVector4a(0.f)); } else { - const LLVector4a* last_entry = mUIOffset.back(); - mUIOffset.push_back(static_cast(ll_aligned_malloc_16(sizeof(LLVector4a)))); - *mUIOffset.back() = *last_entry; + mUIOffset.push_back(mUIOffset.back()); } if (mUIScale.empty()) { - mUIScale.push_back(static_cast(ll_aligned_malloc_16(sizeof(LLVector4a)))); - mUIScale.back()->splat(1.f); + mUIScale.push_back(LLVector4a(1.f)); } else { - const LLVector4a* last_entry = mUIScale.back(); - mUIScale.push_back(static_cast(ll_aligned_malloc_16(sizeof(LLVector4a)))); - *mUIScale.back() = *last_entry; + mUIScale.push_back(mUIScale.back()); } } @@ -1543,9 +1537,7 @@ void LLRender::popUIMatrix() { llerrs << "UI offset stack blown." << llendl; } - ll_aligned_free_16(mUIOffset.back()); mUIOffset.pop_back(); - ll_aligned_free_16(mUIScale.back()); mUIScale.pop_back(); } @@ -1555,7 +1547,7 @@ LLVector3 LLRender::getUITranslation() { return LLVector3(0,0,0); } - return LLVector3(mUIOffset.back()->getF32ptr()); + return LLVector3(mUIOffset.back().getF32ptr()); } LLVector3 LLRender::getUIScale() @@ -1564,7 +1556,7 @@ LLVector3 LLRender::getUIScale() { return LLVector3(1,1,1); } - return LLVector3(mUIScale.back()->getF32ptr()); + return LLVector3(mUIScale.back().getF32ptr()); } @@ -1574,8 +1566,8 @@ void LLRender::loadUIIdentity() { llerrs << "Need to push UI translation frame before clearing offset." << llendl; } - mUIOffset.back()->splat(0.f); - mUIScale.back()->splat(1.f); + mUIOffset.back().splat(0.f); + mUIScale.back().splat(1.f); } void LLRender::setColorMask(bool writeColor, bool writeAlpha) @@ -1977,8 +1969,8 @@ void LLRender::vertex4a(const LLVector4a& vertex) else { //LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back()); - mVerticesp[mCount].setAdd(vertex,*mUIOffset.back()); - mVerticesp[mCount].mul(*mUIScale.back()); + mVerticesp[mCount].setAdd(vertex,mUIOffset.back()); + mVerticesp[mCount].mul(mUIScale.back()); } if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile) diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index d8f01a75a..2ca28c669 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -38,6 +38,7 @@ #include "v3math.h" #include "v4coloru.h" #include "v4math.h" +#include "llalignedarray.h" #include "llstrider.h" #include "llpointer.h" #include "llglheaders.h" @@ -466,9 +467,8 @@ private: F32 mMaxAnisotropy; - std::vector mUIOffset; - std::vector mUIScale; - + LLAlignedArray mUIOffset; + LLAlignedArray mUIScale; }; extern F32 gGLModelView[16]; From 2a432f73da0f06345767791c20e9e56e98281314 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 16:36:38 -0500 Subject: [PATCH 44/62] Try and squelch some warnings regarding nightvision post shader on amd gpus. --- indra/llrender/llpostprocess.cpp | 62 ++++++++++++++++++++++---------- indra/llrender/llpostprocess.h | 2 +- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 5164738d3..2d1909600 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -335,7 +335,7 @@ public: LLPostProcess::LLPostProcess(void) : mVBO(NULL), mDepthTexture(0), - mNoiseTexture(NULL), + mNoiseTexture(0), mScreenWidth(0), mScreenHeight(0), mNoiseTextureScale(0.f), @@ -430,7 +430,10 @@ void LLPostProcess::createScreenTextures() stop_glerror(); if(mDepthTexture) + { LLImageGL::deleteTextures(1, &mDepthTexture); + mDepthTexture = 0; + } for(std::list >::iterator it=mShaders.begin();it!=mShaders.end();++it) { @@ -457,16 +460,25 @@ void LLPostProcess::createNoiseTexture() } } - mNoiseTexture = new LLImageGL(FALSE) ; - if(mNoiseTexture->createGLTexture()) + if(mNoiseTexture) { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture->getTexName()); - LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RED, NOISE_SIZE, NOISE_SIZE, GL_RED, GL_UNSIGNED_BYTE, &buffer[0]); - stop_glerror(); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - stop_glerror(); + LLImageGL::deleteTextures(1, &mNoiseTexture); + mNoiseTexture = 0; } + + LLImageGL::generateTextures(1, &mNoiseTexture); + stop_glerror(); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture); + stop_glerror(); + + if(gGLManager.mGLVersion >= 4.f) + LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_R8, NOISE_SIZE, NOISE_SIZE, GL_RED, GL_UNSIGNED_BYTE, &buffer[0], false); + else + LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE8, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0], false); + stop_glerror(); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); + stop_glerror(); } void LLPostProcess::destroyGL() @@ -476,7 +488,9 @@ void LLPostProcess::destroyGL() if(mDepthTexture) LLImageGL::deleteTextures(1, &mDepthTexture); mDepthTexture=0; - mNoiseTexture = NULL ; + if(mNoiseTexture) + LLImageGL::deleteTextures(1, &mNoiseTexture); + mNoiseTexture=0 ; mVBO = NULL ; } @@ -490,6 +504,7 @@ void LLPostProcess::copyFrameBuffer() { mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0); glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight); + stop_glerror(); if(mDepthTexture) { @@ -499,6 +514,7 @@ void LLPostProcess::copyFrameBuffer() { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture); glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight); + stop_glerror(); break; } } @@ -508,7 +524,7 @@ void LLPostProcess::copyFrameBuffer() void LLPostProcess::bindNoise(U32 channel) { - gGL.getTexUnit(channel)->bind(mNoiseTexture); + gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE,mNoiseTexture); } void LLPostProcess::renderEffects(unsigned int width, unsigned int height) @@ -531,8 +547,7 @@ void LLPostProcess::doEffects(void) { LLVertexBuffer::unbind(); - mNoiseTextureScale = 0.001f + ((100.f - mSelectedEffectInfo["noise_size"].asFloat()) / 100.f); - mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE); + mNoiseTextureScale = (1.f - (mSelectedEffectInfo["noise_size"].asFloat() - 1.f) *(9.f/990.f)) / (float)NOISE_SIZE; /// Copy the screen buffer to the render texture copyFrameBuffer(); @@ -585,13 +600,19 @@ void LLPostProcess::applyShaders(void) QuadType quad = (*it)->preDraw(); while((*it)->draw(pass++)) { - mRenderTarget[!primary_rendertarget].bindTarget(); + LLRenderTarget& write_target = mRenderTarget[!primary_rendertarget]; + LLRenderTarget& read_target = mRenderTarget[mRenderTarget[0].getFBO() ? primary_rendertarget : !primary_rendertarget]; + write_target.bindTarget(); if(color_channel >= 0) - mRenderTarget[mRenderTarget[0].getFBO() ? primary_rendertarget : !primary_rendertarget].bindTexture(0,color_channel); + read_target.bindTexture(0,color_channel); drawOrthoQuad(quad); - mRenderTarget[!primary_rendertarget].flush(); + + if(color_channel >= 0 && !mRenderTarget[0].getFBO()) + gGL.getTexUnit(color_channel)->unbind(read_target.getUsage()); + + write_target.flush(); if(mRenderTarget[0].getFBO()) primary_rendertarget = !primary_rendertarget; } @@ -616,8 +637,13 @@ void LLPostProcess::drawOrthoQuad(QuadType type) LLStrider uv2; mVBO->getTexCoord1Strider(uv2); - float offs[2] = {(float) rand() / (float) RAND_MAX, (float) rand() / (float) RAND_MAX}; - float scale[2] = {mScreenWidth * mNoiseTextureScale / mScreenHeight, mNoiseTextureScale}; + float offs[2] = { + llround(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE), + llround(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) }; + float scale[2] = { + (float)mScreenWidth * mNoiseTextureScale, + (float)mScreenHeight * mNoiseTextureScale }; + uv2[0] = LLVector2(offs[0],offs[1]); uv2[1] = LLVector2(offs[0],offs[1]+scale[1]); uv2[2] = LLVector2(offs[0]+scale[0],offs[1]); diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h index 6c3da675e..57bd58ef0 100644 --- a/indra/llrender/llpostprocess.h +++ b/indra/llrender/llpostprocess.h @@ -90,7 +90,7 @@ private: // However this is ONLY the case if fbos are actually supported, else swapping isn't needed. LLRenderTarget mRenderTarget[2]; U32 mDepthTexture; - LLPointer mNoiseTexture ; + U32 mNoiseTexture ; U32 mScreenWidth; U32 mScreenHeight; From 7c7c64bde3367df9e5bfe66365f1ede17d9bac66 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 16:39:31 -0500 Subject: [PATCH 45/62] Minor upstream catchup. Added LLImageRaw::duplicate and no_copy parameter to LLImageRaw::LLImageRaw --- indra/llimage/llimage.cpp | 20 +++++++++++++++++--- indra/llimage/llimage.h | 5 ++++- indra/newview/lldynamictexture.cpp | 9 +++------ indra/newview/llviewertexture.cpp | 13 +++++++++++-- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 6f3deba0c..2e0531263 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -299,10 +299,15 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components) ++sRawImageCount; } -LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components) +LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy) : LLImageBase(), mCacheEntries(0) { - if(allocateDataSize(width, height, components) && data) + + if(no_copy) + { + setDataAndSize(data, width, height, components); + } + else if(allocateDataSize(width, height, components) && data) { memcpy(getData(), data, width*height*components); } @@ -762,8 +767,17 @@ void LLImageRaw::fill( const LLColor4U& color ) } } +LLPointer LLImageRaw::duplicate() +{ + if(getNumRefs() < 2) + { + return this; //nobody else refences to this image, no need to duplicate. + } - + //make a duplicate + LLPointer dup = new LLImageRaw(getData(), getWidth(), getHeight(), getComponents()); + return dup; +} // Src and dst can be any size. Src and dst can each have 3 or 4 components. void LLImageRaw::copy(LLImageRaw* src) diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 012031338..1e94f49f4 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -173,7 +173,7 @@ protected: public: LLImageRaw(); LLImageRaw(U16 width, U16 height, S8 components); - LLImageRaw(U8 *data, U16 width, U16 height, S8 components); + LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy = false); LLImageRaw(LLImageRaw const* src, U16 width, U16 height, U16 crop_offset, bool crop_vertically); // Construct using createFromFile (used by tools) //LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false); @@ -204,6 +204,9 @@ public: // Copy operations + //duplicate this raw image if refCount > 1. + LLPointer duplicate(); + // Src and dst can be any size. Src and dst can each have 3 or 4 components. void copy( LLImageRaw* src ); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index e8f3fafbe..b88da4041 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -131,7 +131,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth) llassert(mFullHeight <= 512); llassert(mFullWidth <= 512); - if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete()) + if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI) { //using offscreen render target, just use the bottom left corner mOrigin.set(0, 0); } @@ -218,13 +218,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances() return TRUE; } -#if 0 //THIS CAUSES MAINT-1092 - bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete(); + bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI; + if (use_fbo) { gPipeline.mWaterDis.bindTarget(); } -#endif LLGLSLShader::bindNoShader(); LLVertexBuffer::unbind(); @@ -259,12 +258,10 @@ BOOL LLViewerDynamicTexture::updateAllInstances() } } -#if 0 //THIS CAUSES MAINT-1092 if (use_fbo) { gPipeline.mWaterDis.flush(); } -#endif return ret; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index f8e0f43ee..d14a47fa9 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1208,7 +1208,12 @@ void LLViewerFetchedTexture::addToCreateTexture() destroyRawImage(); return ; } - mRawImage->scale(w >> i, h >> i) ; + + { + //make a duplicate in case somebody else is using this raw image + mRawImage = mRawImage->duplicate(); + mRawImage->scale(w >> i, h >> i) ; + } } } } @@ -2540,7 +2545,11 @@ void LLViewerFetchedTexture::setCachedRawImage() mIsRawImageValid = 0; return; } - mRawImage->scale(w >> i, h >> i) ; + { + //make a duplicate in case somebody else is using this raw image + mRawImage = mRawImage->duplicate(); + mRawImage->scale(w >> i, h >> i) ; + } } if(mCachedRawImage.notNull()) mCachedRawImage->setInCache(false); From fc04f6b2e194af0151b9d8d86939a02cb9f36cc5 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 16:42:41 -0500 Subject: [PATCH 46/62] Added handling of GL_LUMINANCE pixel format to setManualImage. Was missing, although GL_LUMINANCE_ALPHA and GL_ALPHA were handled. Also added missing file hurr. --- indra/llcommon/llstaticstringtable.h | 82 ++++++++++++++++++++++++++++ indra/llrender/llimagegl.cpp | 20 +++++++ 2 files changed, 102 insertions(+) create mode 100644 indra/llcommon/llstaticstringtable.h diff --git a/indra/llcommon/llstaticstringtable.h b/indra/llcommon/llstaticstringtable.h new file mode 100644 index 000000000..f3c46e749 --- /dev/null +++ b/indra/llcommon/llstaticstringtable.h @@ -0,0 +1,82 @@ +/** + * @file llstringtable.h + * @brief The LLStringTable class provides a _fast_ method for finding + * unique copies of strings. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_STATIC_STRING_TABLE_H +#define LL_STATIC_STRING_TABLE_H + +#include "lldefs.h" +#include +#include "llstl.h" + +class LLStaticHashedString +{ +public: + + LLStaticHashedString(const std::string& s) + { + string_hash = makehash(s); + string = s; + } + + const std::string& String() const { return string; } + size_t Hash() const { return string_hash; } + + bool operator==(const LLStaticHashedString& b) const { return String() == b.String(); } + +protected: + + size_t makehash(const std::string& s) + { + size_t len = s.size(); + const char* c = s.c_str(); + size_t hashval = 0; + for (size_t i=0; i +class LLStaticStringTable + : public boost::unordered_map< LLStaticHashedString, MappedObject, LLStaticStringHasher > +{ +}; + +#endif + diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 69c52d67b..ce95d9c69 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1099,6 +1099,26 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt intformat = GL_RGBA8; } + if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE) + { //GL_LUMINANCE is deprecated, convert to GL_RGBA + use_scratch = true; + scratch = new U32[width*height]; + + U32 pixel_count = (U32) (width*height); + for (U32 i = 0; i < pixel_count; i++) + { + U8 lum = ((U8*) pixels)[i]; + + U8* pix = (U8*) &scratch[i]; + pix[0] = pix[1] = pix[2] = lum; + pix[3] = 1.f; + } + + pixformat = GL_RGBA; + intformat = GL_RGBA8; + } + + if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE) { //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA use_scratch = true; From 574022ed2c7aa72cc42661e6f13ca7428f667386 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 18:01:36 -0500 Subject: [PATCH 47/62] Made a few more fullbright face types occlude any glow behind them. --- .../app_settings/shaders/class1/deferred/fullbrightF.glsl | 1 + .../shaders/class1/lighting/lightFullbrightShinyF.glsl | 2 +- .../class1/lighting/lightFullbrightShinyNonIndexedF.glsl | 2 +- .../class1/lighting/lightFullbrightShinyWaterF.glsl | 2 +- .../lighting/lightFullbrightShinyWaterNonIndexedF.glsl | 2 +- .../shaders/class1/lighting/lightFullbrightWaterF.glsl | 2 +- .../app_settings/shaders/class1/lighting/lightShinyF.glsl | 2 +- .../shaders/class1/lighting/lightShinyNonIndexedF.glsl | 2 +- .../shaders/class1/lighting/lightShinyWaterF.glsl | 2 +- .../class1/lighting/lightShinyWaterNonIndexedF.glsl | 2 +- .../shaders/class1/objects/emissiveSkinnedV.glsl | 6 ++---- indra/newview/lldrawpoolbump.cpp | 4 ++++ indra/newview/llviewershadermgr.cpp | 7 +++++++ 13 files changed, 23 insertions(+), 13 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 36433a582..764afa7a7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -48,6 +48,7 @@ void main() color.rgb = fullbrightScaleSoftClip(color.rgb); + color.a = .0; frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index 777c8b45b..ff96409e8 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -50,7 +50,7 @@ void fullbright_shiny_lighting() color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 0.0; frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl index 4fa3b1d93..9311b786a 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyNonIndexedF.glsl @@ -51,7 +51,7 @@ void fullbright_shiny_lighting() color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 0.0; frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl index 58984a426..5886fc65b 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl @@ -48,7 +48,7 @@ void fullbright_shiny_lighting_water() color.rgb = fullbrightShinyAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 1.0; frag_color = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl index a39b7205d..e44865d4e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl @@ -49,7 +49,7 @@ void fullbright_shiny_lighting_water() color.rgb = fullbrightShinyAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 0.0; frag_color = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl index df182168f..d3dacf9bc 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl @@ -32,7 +32,7 @@ out vec4 frag_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 diffuseLookup(vec2 texcoord); +/* vec4 diffuseLookup(vec2 texcoord); */ vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl index 52e3b2ad0..9208c148e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl @@ -50,7 +50,7 @@ void shiny_lighting() color.rgb = atmosLighting(color.rgb); color.rgb = scaleSoftClip(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 1.0; frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl index 474d5ea49..92628faa6 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyNonIndexedF.glsl @@ -51,7 +51,7 @@ void shiny_lighting() color.rgb = atmosLighting(color.rgb); color.rgb = scaleSoftClip(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 1.0; frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl index d2a4c47aa..61841674e 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl @@ -47,7 +47,7 @@ void shiny_lighting_water() color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = atmosLighting(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 1.0; frag_color = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl index f3bd66236..0b6e835fd 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl @@ -48,7 +48,7 @@ void shiny_lighting_water() color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = atmosLighting(color.rgb); - color.a = max(color.a, vertex_color.a); + color.a = 1.0; frag_color = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index 8494ffba5..906490419 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -48,11 +48,9 @@ void main() mat = modelview_matrix * mat; vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; + vertex_color = emissive; + calcAtmospherics(pos.xyz); - vertex_color = emissive; - gl_Position = projection_matrix*vec4(pos, 1.0); - - } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index f38b5991c..259c0e495 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -570,6 +570,7 @@ void LLDrawPoolBump::renderFullbrightShiny() { LLGLEnable blend_enable(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_REPLACE); if (mVertexShaderLevel > 1) { LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); @@ -578,6 +579,7 @@ void LLDrawPoolBump::renderFullbrightShiny() { LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask); } + gGL.setSceneBlendType(LLRender::BT_ALPHA); } } @@ -896,7 +898,9 @@ void LLDrawPoolBump::renderPostDeferred(S32 pass) switch (pass) { case 0: + gGL.setColorMask(true, true); renderFullbrightShiny(); + gGL.setColorMask(true, false); break; case 1: renderBump(LLRenderPass::PASS_POST_BUMP); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index f35c4af02..d513b08f9 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2191,6 +2191,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectSimpleProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectSimpleProgram.mFeatures.hasLighting = true; gSkinnedObjectSimpleProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectSimpleProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectSimpleProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectSimpleProgram.mShaderFiles.clear(); gSkinnedObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2207,6 +2208,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightProgram.mFeatures.hasTransport = true; gSkinnedObjectFullbrightProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2257,6 +2259,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyProgram.mFeatures.isShiny = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightShinyProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightShinyProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2273,6 +2276,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleProgram.mFeatures.hasGamma = true; gSkinnedObjectShinySimpleProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectShinySimpleProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectShinySimpleProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectShinySimpleProgram.mFeatures.isShiny = true; gSkinnedObjectShinySimpleProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectShinySimpleProgram.mShaderFiles.clear(); @@ -2310,6 +2314,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightWaterProgram.mFeatures.hasTransport = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; @@ -2329,6 +2334,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isShiny = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; @@ -2347,6 +2353,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasGamma = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.isShiny = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.disableTextureIndex = true; From 8e55d5499e8c4d178ba1733792f7ae2f4630f0f3 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 18:07:56 -0500 Subject: [PATCH 48/62] Occlusion FBOs in deferred. --- indra/llrender/llgl.cpp | 3 +- .../class1/interface/downsampleDepthF.glsl | 67 ++++++++++ .../interface/downsampleDepthRectF.glsl | 69 ++++++++++ .../class1/interface/downsampleDepthV.glsl | 59 +++++++++ indra/newview/llviewershadermgr.cpp | 22 +++ indra/newview/llviewershadermgr.h | 3 + indra/newview/pipeline.cpp | 125 ++++++++++++++++-- indra/newview/pipeline.h | 10 +- 8 files changed, 346 insertions(+), 12 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index dcde319d2..9c5ffeb7d 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -727,7 +727,8 @@ bool LLGLManager::initGL() } stop_glerror(); - + + //Singu Note: Multisampled texture stuff in v3 is dead, however we DO use multisampled FBOs. if (mHasFramebufferMultisample) { glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples); diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl new file mode 100644 index 000000000..6523a06d2 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl @@ -0,0 +1,67 @@ +/** + * @file debugF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +uniform sampler2D depthMap; + +uniform float delta; + +VARYING vec2 tc0; +VARYING vec2 tc1; +VARYING vec2 tc2; +VARYING vec2 tc3; +VARYING vec2 tc4; +VARYING vec2 tc5; +VARYING vec2 tc6; +VARYING vec2 tc7; +VARYING vec2 tc8; + +void main() +{ + vec4 depth1 = + vec4(texture2D(depthMap, tc0).r, + texture2D(depthMap, tc1).r, + texture2D(depthMap, tc2).r, + texture2D(depthMap, tc3).r); + + vec4 depth2 = + vec4(texture2D(depthMap, tc4).r, + texture2D(depthMap, tc5).r, + texture2D(depthMap, tc6).r, + texture2D(depthMap, tc7).r); + + depth1 = min(depth1, depth2); + float depth = min(depth1.x, depth1.y); + depth = min(depth, depth1.z); + depth = min(depth, depth1.w); + depth = min(depth, texture2D(depthMap, tc8).r); + + gl_FragDepth = depth; +} diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl new file mode 100644 index 000000000..0e5dc0818 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl @@ -0,0 +1,69 @@ +/** + * @file debugF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +uniform sampler2DRect depthMap; + +uniform float delta; + +VARYING vec2 tc0; +VARYING vec2 tc1; +VARYING vec2 tc2; +VARYING vec2 tc3; +VARYING vec2 tc4; +VARYING vec2 tc5; +VARYING vec2 tc6; +VARYING vec2 tc7; +VARYING vec2 tc8; + +void main() +{ + vec4 depth1 = + vec4(texture2DRect(depthMap, tc0).r, + texture2DRect(depthMap, tc1).r, + texture2DRect(depthMap, tc2).r, + texture2DRect(depthMap, tc3).r); + + vec4 depth2 = + vec4(texture2DRect(depthMap, tc4).r, + texture2DRect(depthMap, tc5).r, + texture2DRect(depthMap, tc6).r, + texture2DRect(depthMap, tc7).r); + + depth1 = min(depth1, depth2); + float depth = min(depth1.x, depth1.y); + depth = min(depth, depth1.z); + depth = min(depth, depth1.w); + depth = min(depth, texture2DRect(depthMap, tc8).r); + + gl_FragDepth = depth; +} diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl new file mode 100644 index 000000000..71d80911d --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl @@ -0,0 +1,59 @@ +/** + * @file debugV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; + +uniform vec2 screen_res; + +uniform vec2 delta; + +VARYING vec2 tc0; +VARYING vec2 tc1; +VARYING vec2 tc2; +VARYING vec2 tc3; +VARYING vec2 tc4; +VARYING vec2 tc5; +VARYING vec2 tc6; +VARYING vec2 tc7; +VARYING vec2 tc8; + +void main() +{ + gl_Position = vec4(position, 1.0); + + vec2 tc = (position.xy*0.5+0.5)*screen_res; + tc0 = tc+vec2(-delta.x,-delta.y); + tc1 = tc+vec2(0,-delta.y); + tc2 = tc+vec2(delta.x,-delta.y); + tc3 = tc+vec2(-delta.x,0); + tc4 = tc+vec2(0,0); + tc5 = tc+vec2(delta.x,0); + tc6 = tc+vec2(-delta.x,delta.y); + tc7 = tc+vec2(0,delta.y); + tc8 = tc+vec2(delta.x,delta.y); +} + diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index d513b08f9..9aaa166a5 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -97,6 +97,8 @@ LLGLSLShader gTwoTextureAddProgram(LLViewerShaderMgr::SHADER_INTERFACE); LLGLSLShader gOneTextureNoColorProgram(LLViewerShaderMgr::SHADER_INTERFACE); LLGLSLShader gDebugProgram(LLViewerShaderMgr::SHADER_INTERFACE); LLGLSLShader gClipProgram(LLViewerShaderMgr::SHADER_INTERFACE); +LLGLSLShader gDownsampleDepthProgram(LLViewerShaderMgr::SHADER_INTERFACE); +LLGLSLShader gDownsampleDepthRectProgram(LLViewerShaderMgr::SHADER_INTERFACE); LLGLSLShader gAlphaMaskProgram(LLViewerShaderMgr::SHADER_INTERFACE); LLGLSLShader gUIProgram(LLViewerShaderMgr::SHADER_INTERFACE); @@ -2652,6 +2654,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface() success = gClipProgram.createShader(NULL, NULL); } + if (success) + { + gDownsampleDepthProgram.mName = "DownsampleDepth Shader"; + gDownsampleDepthProgram.mShaderFiles.clear(); + gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB)); + gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDownsampleDepthProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gDownsampleDepthProgram.createShader(NULL, NULL); + } + + if (success) + { + gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader"; + gDownsampleDepthRectProgram.mShaderFiles.clear(); + gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB)); + gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDownsampleDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gDownsampleDepthRectProgram.createShader(NULL, NULL); + } + if (success) { gAlphaMaskProgram.mName = "Alpha Mask Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 38b7342e2..b5319ae16 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -184,6 +184,7 @@ extern LLGLSLShader gTransformTexCoordProgram; extern LLGLSLShader gTransformNormalProgram; extern LLGLSLShader gTransformColorProgram; extern LLGLSLShader gTransformTangentProgram; + //utility shaders extern LLGLSLShader gOcclusionProgram; extern LLGLSLShader gOcclusionCubeProgram; @@ -193,6 +194,8 @@ extern LLGLSLShader gSplatTextureRectProgram; extern LLGLSLShader gGlowCombineFXAAProgram; extern LLGLSLShader gDebugProgram; extern LLGLSLShader gClipProgram; +extern LLGLSLShader gDownsampleDepthProgram; +extern LLGLSLShader gDownsampleDepthRectProgram; //output tex0[tc0] + tex1[tc1] extern LLGLSLShader gTwoTextureAddProgram; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 561b62dc3..0350f086e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -774,10 +774,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) BOOL RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField"); static const LLCachedControl RenderShadowResolutionScale("RenderShadowResolutionScale",1.0f); + const U32 occlusion_divisor = 3; //allocate deferred rendering color buffers if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; + if (!mOcclusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; if (!addDeferredAttachments(mDeferredScreen)) return false; if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; @@ -807,6 +809,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 0; i < 4; i++) { if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false; + if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false; } } else @@ -814,6 +817,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 0; i < 4; i++) { mShadow[i].release(); + mShadowOcclusion[i].release(); } } @@ -826,6 +830,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 4; i < 6; i++) { if (!mShadow[i].allocate(spot_shadow_map_width, height, 0, TRUE, FALSE)) return false; + if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE)) return false; } } else @@ -833,6 +838,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 4; i < 6; i++) { mShadow[i].release(); + mShadowOcclusion[i].release(); } } @@ -849,13 +855,14 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 0; i < 6; i++) { mShadow[i].release(); + mShadowOcclusion[i].release(); } mFXAABuffer.release(); mScreen.release(); mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first mDeferredDepth.release(); - - + mOcclusionDepth.release(); + if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false; if(samples > 1 && mScreen.getFBO()) { @@ -975,12 +982,14 @@ void LLPipeline::releaseScreenBuffers() mDeferredScreen.release(); mDeferredDepth.release(); mDeferredLight.release(); + mOcclusionDepth.release(); //mHighlight.release(); for (U32 i = 0; i < 6; i++) { mShadow[i].release(); + mShadowOcclusion[i].release(); } mSampleBuffer.release(); @@ -2167,7 +2176,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl if (to_texture) { - mScreen.bindTarget(); + if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) + { + mOcclusionDepth.bindTarget(); + } + else + { + mScreen.bindTarget(); + } } if (sUseOcclusion > 1) @@ -2305,7 +2321,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl if (to_texture) { - mScreen.flush(); + if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) + { + mOcclusionDepth.flush(); + } + else + { + mScreen.flush(); + } } } @@ -2373,6 +2396,79 @@ void LLPipeline::markOccluder(LLSpatialGroup* group) } } +void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) +{ + LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; + + LLGLSLShader* shader = NULL; + + if (scratch_space) + { + scratch_space->copyContents(source, + 0, 0, source.getWidth(), source.getHeight(), + 0, 0, scratch_space->getWidth(), scratch_space->getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); + } + + dest.bindTarget(); + dest.clear(GL_DEPTH_BUFFER_BIT); + + if(mDeferredVB.isNull()) + { + mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); + mDeferredVB->allocateBuffer(8, 0, true); + } + + LLStrider vert; + mDeferredVB->getVertexStrider(vert); + LLStrider tc0; + + vert[0].set(-1,1,0); + vert[1].set(-1,-3,0); + vert[2].set(3,1,0); + + if (source.getUsage() == LLTexUnit::TT_RECT_TEXTURE) + { + shader = &gDownsampleDepthRectProgram; + shader->bind(); + shader->uniform2f("delta", 1.f, 1.f); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight()); + } + else + { + shader = &gDownsampleDepthProgram; + shader->bind(); + shader->uniform2f("delta", 1.f/source.getWidth(), 1.f/source.getHeight()); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f); + } + + gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE); + + { + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + } + + dest.flush(); + + if (last_shader) + { + last_shader->bind(); + } + else + { + shader->unbind(); + } +} + +void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) +{ + downsampleDepthBuffer(source, dest, scratch_space); + dest.bindTarget(); + doOcclusion(camera); + dest.flush(); +} + void LLPipeline::doOcclusion(LLCamera& camera) { if (LLGLSLShader::sNoFixedFunction && LLPipeline::sUseOcclusion > 1 && sCull->hasOcclusionGroups()) @@ -4188,7 +4284,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) gGL.setColorMask(true, false); } -void LLPipeline::renderGeomPostDeferred(LLCamera& camera) +void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion) { LLFastTimer t(FTM_POST_DEFERRED_POOLS); U32 cur_type = 0; @@ -4204,7 +4300,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) gGL.setColorMask(true, false); pool_set_t::iterator iter1 = mPools.begin(); - BOOL occlude = LLPipeline::sUseOcclusion > 1; + BOOL occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion; while ( iter1 != mPools.end() ) { @@ -4218,7 +4314,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) gGLLastMatrix = NULL; gGL.loadMatrix(gGLModelView); LLGLSLShader::bindNoShader(); - doOcclusion(camera); + doOcclusion(camera, mScreen, mOcclusionDepth, &mDeferredDepth); gGL.setColorMask(true, false); } @@ -5310,7 +5406,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) // crazy cast so that we can overwrite the fade value // even though gcc enforces sets as const // (fade value doesn't affect sort so this is safe) - Light* farthest_light = ((Light*) (&(*(mNearbyLights.rbegin())))); + Light* farthest_light = (const_cast(&(*(mNearbyLights.rbegin())))); if (light->dist < farthest_light->dist) { if (farthest_light->fade >= 0.f) @@ -7755,7 +7851,7 @@ void LLPipeline::renderDeferredLighting() LLPipeline::END_RENDER_TYPES); - renderGeomPostDeferred(*LLViewerCamera::getInstance()); + renderGeomPostDeferred(*LLViewerCamera::getInstance(), false); gPipeline.popRenderTypeMask(); } @@ -8604,9 +8700,15 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowCubeProgram.bind(); } + LLRenderTarget& occlusion_target = mShadowOcclusion[LLViewerCamera::sCurCameraID-1]; + + occlusion_target.bindTarget(); updateCull(shadow_cam, result); + occlusion_target.flush(); + stateSort(shadow_cam, result); + //generate shadow map gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); @@ -8685,7 +8787,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowCubeProgram.bind(); gGLLastMatrix = NULL; gGL.loadMatrix(gGLModelView); - doOcclusion(shadow_cam); + + LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID-1]; + + doOcclusion(shadow_cam, occlusion_source, occlusion_target); if (use_shader) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 7db607b0b..b9204d878 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -177,6 +177,12 @@ public: // Object related methods void markVisible(LLDrawable *drawablep, LLCamera& camera); void markOccluder(LLSpatialGroup* group); + + //downsample source to dest, taking the maximum depth value per pixel in source and writing to dest + // if source's depth buffer cannot be bound for reading, a scratch space depth buffer must be provided + void downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); + + void doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); void doOcclusion(LLCamera& camera); void markNotCulled(LLSpatialGroup* group, LLCamera &camera); void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE); @@ -274,7 +280,7 @@ public: void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE); void renderGeomDeferred(LLCamera& camera); - void renderGeomPostDeferred(LLCamera& camera); + void renderGeomPostDeferred(LLCamera& camera, bool do_occlusion=true); void renderGeomShadow(LLCamera& camera); void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, U32 noise_map = 0xFFFFFFFF); void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep); @@ -573,6 +579,7 @@ public: LLRenderTarget mFXAABuffer; LLRenderTarget mEdgeMap; LLRenderTarget mDeferredDepth; + LLRenderTarget mOcclusionDepth; LLRenderTarget mDeferredLight; LLMultisampleBuffer mSampleBuffer; LLRenderTarget mPhysicsDisplay; @@ -585,6 +592,7 @@ public: //sun shadow map LLRenderTarget mShadow[6]; + LLRenderTarget mShadowOcclusion[6]; std::vector mShadowFrustPoints[4]; LLVector4 mShadowError; LLVector4 mShadowFOV; From 30c5b9514eb7356a2d354e03283396645f57a1db Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 18:09:34 -0500 Subject: [PATCH 49/62] Let the rendertarget dictate internal format when resizing. --- indra/llrender/llrendertarget.cpp | 6 ++++-- indra/llrender/llrendertarget.h | 2 +- indra/newview/pipeline.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 20a7999ce..6e47a9acd 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -72,7 +72,7 @@ LLRenderTarget::~LLRenderTarget() release(); } -void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt) +void LLRenderTarget::resize(U32 resx, U32 resy) { //for accounting, get the number of pixels added/subtracted S32 pix_diff = (resx*resy)-(mResX*mResY); @@ -80,10 +80,12 @@ void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt) mResX = resx; mResY = resy; + llassert(mInternalFormat.size() == mTex.size()); + for (U32 i = 0; i < mTex.size(); ++i) { //resize color attachments gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]); - LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); + LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, mInternalFormat[i], mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); sBytesAllocated += pix_diff*4; } diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index f2401eed4..a0f409334 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -79,7 +79,7 @@ public: // CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined // DO NOT use for screen space buffers or for scratch space for an image that might be uploaded // DO use for render targets that resize often and aren't likely to ruin someone's day if they break - void resize(U32 resx, U32 resy, U32 color_fmt); + void resize(U32 resx, U32 resy); //provide this render target with a multisample resource. void setSampleBuffer(LLMultisampleBuffer* buffer); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0350f086e..1fc9fa519 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9934,7 +9934,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) resY != avatar->mImpostor.getHeight()) { LLFastTimer t(FTM_IMPOSTOR_RESIZE); - avatar->mImpostor.resize(resX,resY,GL_RGBA); + avatar->mImpostor.resize(resX,resY); } avatar->mImpostor.bindTarget(); From edf75a71747ca6f50ba265c167064c2ee69a0b42 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 18:12:56 -0500 Subject: [PATCH 50/62] setCommitOnReturn moved to from llbutton to lluictrl, cleanup some focus/key handling, avoid needless reshape calls. --- indra/llui/llbutton.h | 3 -- indra/llui/llpanel.cpp | 70 +++++++++++++++-------------------------- indra/llui/lluictrl.cpp | 21 ++++++++++--- indra/llui/lluictrl.h | 6 ++++ indra/llui/llview.cpp | 5 ++- 5 files changed, 52 insertions(+), 53 deletions(-) diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 5710585fd..219b0dfec 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -207,9 +207,6 @@ public: void setImageFlash(LLPointer image); void setImagePressed(LLPointer image); - void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } - BOOL getCommitOnReturn() const { return mCommitOnReturn; } - static void onHeldDown(void *userdata); // to be called by gIdleCallbacks void setHelpURLCallback(const std::string &help_url); const std::string& getHelpURL() const { return mHelpURL; } diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index d9e1c7e94..c6ff2fa03 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -159,8 +159,12 @@ void LLPanel::addBorder(LLViewBorder::EBevel border_bevel, void LLPanel::removeBorder() { - delete mBorder; - mBorder = NULL; + if (mBorder) + { + removeChild(mBorder); + delete mBorder; + mBorder = NULL; + } } @@ -277,7 +281,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) // handle user hitting ESC to defocus if (key == KEY_ESCAPE && mask == MASK_NONE) { - gFocusMgr.setKeyboardFocus(NULL); + setFocus(FALSE); return TRUE; } else if( (mask == MASK_SHIFT) && (KEY_TAB == key)) @@ -304,29 +308,25 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) } } } - - // If we have a default button, click it when - // return is pressed, unless current focus is a return-capturing button - // in which case *that* button will handle the return key - LLButton* focused_button = dynamic_cast(cur_focus); - if (cur_focus && !(focused_button && focused_button->getCommitOnReturn())) + + // If RETURN was pressed and something has focus, call onCommit() + if (!handled && cur_focus && key == KEY_RETURN && mask == MASK_NONE) { - // RETURN key means hit default button in this case - if (key == KEY_RETURN && mask == MASK_NONE - && mDefaultBtn != NULL - && mDefaultBtn->getVisible() - && mDefaultBtn->getEnabled()) + if (cur_focus->getCommitOnReturn()) { + // current focus is a return-capturing element, + // let *that* element handle the return key + handled = FALSE; + } + else if (mDefaultBtn && mDefaultBtn->getVisible() && mDefaultBtn->getEnabled()) + { + // If we have a default button, click it when return is pressed mDefaultBtn->onCommit(); handled = TRUE; } - } - - if (key == KEY_RETURN && mask == MASK_NONE) - { - // set keyboard focus to self to trigger commitOnFocusLost behavior on current ctrl - if (cur_focus && cur_focus->acceptsTextInput()) + else if (cur_focus->acceptsTextInput()) { + // call onCommit for text input handling control cur_focus->onCommit(); handled = TRUE; } @@ -363,34 +363,16 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility ) void LLPanel::setFocus(BOOL b) { - if( b ) + if( b && !hasFocus()) { - if (!gFocusMgr.childHasKeyboardFocus(this)) - { - //refresh(); - if (!focusFirstItem()) - { - LLUICtrl::setFocus(TRUE); - } - onFocusReceived(); - } + // give ourselves focus preemptively, to avoid infinite loop + LLUICtrl::setFocus(TRUE); + // then try to pass to first valid child + focusFirstItem(); } else { - if( this == gFocusMgr.getKeyboardFocus() ) - { - gFocusMgr.setKeyboardFocus( NULL ); - } - else - { - //RN: why is this here? - LLView::ctrl_list_t ctrls = getCtrlList(); - for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) - { - LLUICtrl* ctrl = *ctrl_it; - ctrl->setFocus( FALSE ); - } - } + LLUICtrl::setFocus(b); } } diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index b70737c27..56bac0e92 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -56,7 +56,8 @@ LLUICtrl::LLUICtrl() : mDoubleClickSignal(NULL), mTentative(FALSE), mTabStop(TRUE), - mIsChrome(FALSE) + mIsChrome(FALSE), + mCommitOnReturn(FALSE) { } @@ -78,7 +79,8 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque mDoubleClickSignal(NULL), mTentative( FALSE ), mTabStop( TRUE ), - mIsChrome(FALSE) + mIsChrome(FALSE), + mCommitOnReturn(FALSE) { if(commit_callback) setCommitCallback(commit_callback); @@ -178,6 +180,13 @@ BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) return handled; } +// can't tab to children of a non-tab-stop widget +BOOL LLUICtrl::canFocusChildren() const +{ + return TRUE;//hasTabStop(); +} + + void LLUICtrl::onCommit() { if (mCommitSignal) @@ -528,7 +537,8 @@ BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) { // this assumes that this method is called on the focus root. LLCtrlQuery query = getTabOrderQuery(); - if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly")) + static LLUICachedControl tab_to_text_fields_only ("TabToTextFieldsOnly", false); + if(text_fields_only || tab_to_text_fields_only) { query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance()); } @@ -540,7 +550,8 @@ BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only) { // this assumes that this method is called on the focus root. LLCtrlQuery query = getTabOrderQuery(); - if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly")) + static LLUICachedControl tab_to_text_fields_only ("TabToTextFieldsOnly", false); + if(text_fields_only || tab_to_text_fields_only) { query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance()); } @@ -552,7 +563,7 @@ LLUICtrl* LLUICtrl::findRootMostFocusRoot() { LLUICtrl* focus_root = NULL; LLUICtrl* next_view = this; - while(next_view) + while(next_view/* && next_view->hasTabStop()*/) { if (next_view->isFocusRoot()) { diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index b7ebc5bcc..ba6acc98e 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -70,6 +70,7 @@ public: /*virtual*/ BOOL isCtrl() const; /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL canFocusChildren() const; /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); @@ -132,6 +133,9 @@ public: LLUICtrl* getParentUICtrl() const; + void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } + BOOL getCommitOnReturn() const { return mCommitOnReturn; } + //Start using these! boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ); @@ -198,6 +202,8 @@ private: BOOL mIsChrome; BOOL mTentative; + bool mCommitOnReturn; + class DefaultTabGroupFirstSorter; }; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 6d2ae643a..12c6ef34d 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1377,7 +1377,10 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft; S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom; viewp->translate( delta_x, delta_y ); - viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); + if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) + { + viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); + } } } From c1feb11d98ffc17d924a27ea4a82cb3e21b50f12 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 18:56:39 -0500 Subject: [PATCH 51/62] SH-3860. Cloud on first load issue. I'm sure the inaccessible jira has more details... --- indra/newview/llappearancemgr.cpp | 3 ++- indra/newview/llstartup.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index b840c63fc..9416febb2 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4332,9 +4332,10 @@ public: << llendl; //dec_busy_count(); gInventory.removeObserver(this); + doOnIdleOneTime(mCallable); // lets notify observers that loading is finished. - gAgentWearables.notifyLoadingFinished(); + //gAgentWearables.notifyLoadingFinished(); delete this; return; } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 43e8ca335..75978675c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3255,12 +3255,17 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, } else { + // FIXME SH-3860 - this creates a race condition, where COF + // changes (base outfit link added) after appearance update + // request has been submitted. sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit); bool do_copy = true; bool do_append = false; LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); - LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append); + // Need to fetch cof contents before we can wear. + callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(), + boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append)); lldebugs << "initial outfit category id: " << cat_id << llendl; } From 647456812546ab16ff9e41f5cb251086b40eb746 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 19:09:43 -0500 Subject: [PATCH 52/62] Call updateLOD when geom enters rigged state. --- indra/newview/llvovolume.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 29e0c1837..97802746e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4733,7 +4733,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (is_rigged) { - drawablep->setState(LLDrawable::RIGGED); + if (!drawablep->isState(LLDrawable::RIGGED)) + { + drawablep->setState(LLDrawable::RIGGED); + + //first time this is drawable is being marked as rigged, + // do another LoD update to use avatar bounding box + vobj->updateLOD(); + } } else { From 5e8c7264da9f99917b44e8fb17766436d9c1a52b Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 26 Oct 2013 19:58:54 -0500 Subject: [PATCH 53/62] Fix artifacts from local stash merge. --- indra/llrender/llshadermgr.cpp | 1 + indra/newview/llviewershadermgr.cpp | 43 +---------------------------- indra/newview/pipeline.cpp | 4 +-- 3 files changed, 4 insertions(+), 44 deletions(-) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 27f90ae5c..c4223da93 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -676,6 +676,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade std::string define = "#define " + iter->first + " " + iter->second + "\n"; text[count++] = (GLcharARB *) strdup(define.c_str()); } + } if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB) { diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 9aaa166a5..61c4fb06d 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -250,47 +250,6 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) if (mReservedAttribs.empty()) { LLShaderMgr::initAttribsAndUniforms(); - - mAvatarUniforms.push_back("matrixPalette"); - mAvatarUniforms.push_back("gWindDir"); - mAvatarUniforms.push_back("gSinWaveParams"); - mAvatarUniforms.push_back("gGravity"); - - mWLUniforms.push_back("camPosLocal"); - - mTerrainUniforms.reserve(5); - mTerrainUniforms.push_back("detail_0"); - mTerrainUniforms.push_back("detail_1"); - mTerrainUniforms.push_back("detail_2"); - mTerrainUniforms.push_back("detail_3"); - mTerrainUniforms.push_back("alpha_ramp"); - - mGlowUniforms.push_back("glowDelta"); - mGlowUniforms.push_back("glowStrength"); - - mGlowExtractUniforms.push_back("minLuminance"); - mGlowExtractUniforms.push_back("maxExtractAlpha"); - mGlowExtractUniforms.push_back("lumWeights"); - mGlowExtractUniforms.push_back("warmthWeights"); - mGlowExtractUniforms.push_back("warmthAmount"); - - mShinyUniforms.push_back("origin"); - - mWaterUniforms.reserve(12); - mWaterUniforms.push_back("screenTex"); - mWaterUniforms.push_back("screenDepth"); - mWaterUniforms.push_back("refTex"); - mWaterUniforms.push_back("eyeVec"); - mWaterUniforms.push_back("time"); - mWaterUniforms.push_back("d1"); - mWaterUniforms.push_back("d2"); - mWaterUniforms.push_back("lightDir"); - mWaterUniforms.push_back("specular"); - mWaterUniforms.push_back("lightExp"); - mWaterUniforms.push_back("fogCol"); - mWaterUniforms.push_back("kd"); - mWaterUniforms.push_back("refScale"); - mWaterUniforms.push_back("waterHeight"); } } @@ -935,7 +894,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() gPostNightVisionProgram.mName = "Night Vision Shader (Post)"; gPostNightVisionProgram.mShaderFiles.clear(); gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/nightVisionF.glsl", GL_FRAGMENT_SHADER_ARB)); - gPostNightVisionProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB)); + gPostNightVisionProgram.mShaderFiles.push_back(make_pair("interface/twotextureaddV.glsl", GL_VERTEX_SHADER_ARB)); gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; if(gPostNightVisionProgram.createShader(NULL, &shaderUniforms)) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1fc9fa519..2d1f229b8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2430,14 +2430,14 @@ void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& d { shader = &gDownsampleDepthRectProgram; shader->bind(); - shader->uniform2f("delta", 1.f, 1.f); + shader->uniform2f(sDelta, 1.f, 1.f); shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight()); } else { shader = &gDownsampleDepthProgram; shader->bind(); - shader->uniform2f("delta", 1.f/source.getWidth(), 1.f/source.getHeight()); + shader->uniform2f(sDelta, 1.f/source.getWidth(), 1.f/source.getHeight()); shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f); } From aa5bc7bc25640d1db5482f55801481e8b71d4f9a Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sun, 27 Oct 2013 15:14:11 +0100 Subject: [PATCH 54/62] Compile fix (libcwd) --- indra/aistatemachine/aicondition.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/aistatemachine/aicondition.cpp b/indra/aistatemachine/aicondition.cpp index fa35104a8..2c9a4f8e8 100644 --- a/indra/aistatemachine/aicondition.cpp +++ b/indra/aistatemachine/aicondition.cpp @@ -28,6 +28,7 @@ * Initial version, written by Aleric Inglewood @ SL */ +#include "sys.h" #include "aicondition.h" #include "aistatemachine.h" From 8670f45287dbb9ee56f15cedbf0dea368eaef5c1 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 28 Oct 2013 12:22:58 -0400 Subject: [PATCH 55/62] Fix mouselook crosshair drawing properly --- indra/newview/lltoolcomp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 6264f52e0..0651458c7 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -869,6 +869,7 @@ void LLToolCompGun::draw() } else mTimerFOV.stop(); } + LLToolComposite::draw(); // Singu Note: We call parent here, instead of being clueless and adding to LLViewerWindow::draw for crosshairs and such } // From 603221fa48055089965dbae4b486cdca73b15788 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Mon, 28 Oct 2013 19:26:17 +0100 Subject: [PATCH 56/62] Rebuilt glod using VC11 runtime --- install.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.xml b/install.xml index 4a887b341..2c02e94ba 100644 --- a/install.xml +++ b/install.xml @@ -67,9 +67,9 @@ windows64 md5sum - df67aeb1ca4681dc4d9a556454203426 + c6d96cc9f6d993e2147710a5fb0b089a url - https://bitbucket.org/SingularityViewer/libraries/downloads/glod-1.0pre4-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/glod-1.0pre4-windows64-20131028.tar.bz2 From d8728f17eee8b8f6884f1c7b3e738b9b9452f63f Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Mon, 28 Oct 2013 20:23:35 +0100 Subject: [PATCH 57/62] Don't install 64 bit viewer on 32 bit OS --- .../installers/windows/installer_template.nsi | 14 ++++++++++++++ indra/newview/viewer_manifest.py | 1 + 2 files changed, 15 insertions(+) diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 7fb868205..e78317e3f 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -35,6 +35,14 @@ RequestExecutionLevel admin ; on Vista we must be admin because we write to Prog %%GRID_VARS%% +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Alows us to determine if we're running on 64 bit OS; ${If} macros +!include "x64.nsh" +!include "LogicLib.nsh" + +;; are 64 bit binaries packaged in this installer +%%WIN64_BIN_BUILD%% + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; - language files - one for each language (or flavor thereof) ;; (these files are in the same place as the nsi template but the python script generates a new nsi file in the @@ -664,6 +672,12 @@ FunctionEnd ;; entry to the language ID selector below ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function .onInit +!ifdef WIN64_BIN_BUILD + ${IfNot} ${RunningX64} + MessageBox MB_OK|MB_ICONSTOP "This version requires 64 bit operating sytem." + Quit + ${EndIf} +!endif Push $0 ${GetParameters} $COMMANDLINE ; get our command line ${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f86d5fd4d..083a01887 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -461,6 +461,7 @@ class WindowsManifest(ViewerManifest): "%%INSTALL_FILES%%":self.nsi_file_commands(True), "%%DELETE_FILES%%":self.nsi_file_commands(False), "%%INSTALLDIR%%":"%s\\%s" % ('$PROGRAMFILES64' if self.is_win64() else '$PROGRAMFILES', self.channel_oneword()), + "%%WIN64_BIN_BUILD%%":"!define WIN64_BIN_BUILD 1" if self.is_win64() else "", }) # We use the Unicode version of NSIS, available from From 2c1512dcbe165ec4f4b7f621918c6555b4f4b9a2 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Mon, 28 Oct 2013 20:38:51 +0100 Subject: [PATCH 58/62] Try finding FMOD Ex from registry intall path instead of hard coded location --- indra/cmake/FMODEX.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake index 6f84dbebd..f3425f1b2 100644 --- a/indra/cmake/FMODEX.cmake +++ b/indra/cmake/FMODEX.cmake @@ -26,7 +26,7 @@ if (NOT FMODEX_LIBRARY) endif(WORD_SIZE EQUAL 32) endif(FMODEX_SDK_DIR) if(WINDOWS AND NOT FMODEX_SDK_DIR) - set(FMODEX_PROG_DIR "$ENV{PROGRAMFILES}/FMOD SoundSystem/FMOD Programmers API Windows") + GET_FILENAME_COMPONENT(FMODEX_PROG_DIR [HKEY_CURRENT_USER\\Software\\FMOD\ Programmers\ API\ Windows] ABSOLUTE CACHE) if(WORD_SIZE EQUAL 32) find_library(FMODEX_LIBRARY fmodex_vc fmodexL_vc From 3284b77df213fe5a8518f2e6cf1bc33c42c91892 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Mon, 28 Oct 2013 22:21:07 +0100 Subject: [PATCH 59/62] Downgraded freetype to 2.3.9 to avoid font issues in the newer version --- install.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.xml b/install.xml index 2c02e94ba..662b19f0e 100644 --- a/install.xml +++ b/install.xml @@ -540,9 +540,9 @@ windows64 md5sum - bfde86bbd84536448ac2a717ed1646d8 + 17f6c6e1b2d404a1e039aa23445f446c url - https://bitbucket.org/SingularityViewer/libraries/downloads/freetype-2.5.0.1-windows64-20131020.tar.bz2 + https://bitbucket.org/SingularityViewer/libraries/downloads/freetype-2.3.9-windows64-20131028.tar.bz2 From ec4679c2a85cb996e00e6f281a81926740f35bb8 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 29 Oct 2013 06:25:22 -0400 Subject: [PATCH 60/62] Fix the bug in which right click and then delete key would no longer work to delete objects Navigation handling without a currently selected menu entry now only happens if key is up or down arrow (mind the space changes) --- indra/llui/llmenugl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index a0355d003..7761f5eb8 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -4630,10 +4630,13 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) } else { - //highlight first enabled one - if(pMenu->highlightNextItem(NULL)) + if (key == KEY_UP || key == KEY_DOWN) // Singu Note: Only highlight if the user actually meant to navigate through the menu { - handled = true; + //highlight first enabled one + if (pMenu->highlightNextItem(NULL)) + { + handled = true; + } } } } From 02067f973ec7fee8bbc85235e44b42a8ac1cd1ba Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Tue, 29 Oct 2013 16:27:07 +0100 Subject: [PATCH 61/62] Prevent LLFace::getGeometryVolume from overwriting vbos past their end. Possible fix for a crash in LLFace::getGeometryVolume() Patch by NickyD/Firestorm Crash signature: 14 and 20 --- indra/newview/llface.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 0a885d305..d248a7371 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1189,6 +1189,21 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } + // The volume face vf can have more indices/vertices than this face. All striders below are aquired with a size of this face, but then written with num_verices/num_indices values, + // thus overflowing the buffer when vf holds more data. + // We can either clamp num_* down like here, or aquire all striders not using the face size, but the size if vf (that is swapping out mGeomCount with num_vertices and mIndicesCout with num_indices + // in all calls to nVertbuffer->get*Strider(...). Final solution is to just return FALSE and be done with it. + // + // The correct poison of choice is debatable, either copying not all data of vf (clamping) or writing more data than this face claims to have (aquiring bigger striders). Returning will not display this face at all. + // + // clamping it is for now. + + num_vertices = llclamp( num_vertices, (S32)0, (S32)mGeomCount ); + num_indices = llclamp( num_indices, (S32)0, (S32)mIndicesCount ); + + // + + //don't use map range (generates many redundant unmap calls) bool map_range = false; //gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange; @@ -1644,7 +1659,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (!do_xform) { LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM); - S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; + + // Don't round up, or there's high risk to write past buffer + + // S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; + S32 tc_size = (num_vertices*2*sizeof(F32)); + + // + LLVector4a::memcpyNonAliased16((F32*) tex_coords0.get(), (F32*) vf.mTexCoords, tc_size); } else From dfc965954edc3df6185d03075dbaea17696fb720 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 29 Oct 2013 22:26:58 +0100 Subject: [PATCH 62/62] Remove attachments from the avatar's attached list before destroying them. This should prevent the idle callbacks from accessing deleted attachments when looking for the CCS signature. --- indra/newview/llvoavatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d0cf9cf21..ed242be4e 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6442,8 +6442,6 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) if (attachment->isObjectAttached(viewer_object)) { - cleanupAttachedMesh( viewer_object ); - attachment->removeObject(viewer_object); std::vector >::iterator it = std::find(mAttachedObjectsVector.begin(),mAttachedObjectsVector.end(),std::make_pair(viewer_object,attachment)); if(it != mAttachedObjectsVector.end()) { @@ -6451,6 +6449,8 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) mAttachedObjectsVector.pop_back(); } + cleanupAttachedMesh( viewer_object ); + attachment->removeObject(viewer_object); lldebugs << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << llendl; return TRUE; }