This commit is contained in:
Inusaito Sayori
2013-12-04 14:05:46 -05:00
324 changed files with 14401 additions and 1349 deletions

3
.gitignore vendored
View File

@@ -26,3 +26,6 @@ qtcreator-build/
/.pc /.pc
/build-* /build-*
/viewer-* /viewer-*
/indra/newview/res/viewerRes.rc
/indra/newview/res/viewerRes_bc.rc
/indra/newview/English.lproj/InfoPlist.strings

View File

@@ -197,7 +197,7 @@ class AIStateMachine : public LLThreadSafeRefCount
bool mDebugAdvanceStatePending; // True while advance_state() was called by not handled yet. 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). bool mDebugRefCalled; // True when ref() is called (or will be called within the critial area of mMultiplexMutex).
#endif #endif
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
protected: protected:
bool mSMDebug; // Print debug output only when true. bool mSMDebug; // Print debug output only when true.
#endif #endif
@@ -210,7 +210,7 @@ class AIStateMachine : public LLThreadSafeRefCount
mThreadId(AIThreadID::none), mDebugLastState(bs_killed), mDebugShouldRun(false), mDebugAborted(false), mDebugContPending(false), mThreadId(AIThreadID::none), mDebugLastState(bs_killed), mDebugShouldRun(false), mDebugAborted(false), mDebugContPending(false),
mDebugSetStatePending(false), mDebugAdvanceStatePending(false), mDebugRefCalled(false), mDebugSetStatePending(false), mDebugAdvanceStatePending(false), mDebugRefCalled(false),
#endif #endif
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
mSMDebug(debug), mSMDebug(debug),
#endif #endif
mRuntime(0) mRuntime(0)

View File

@@ -182,7 +182,7 @@ class AIStateMachineThreadBase : public AIStateMachine {
protected: protected:
AIStateMachineThreadBase(CWD_ONLY(bool debug)) AIStateMachineThreadBase(CWD_ONLY(bool debug))
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
: AIStateMachine(debug) : AIStateMachine(debug)
#endif #endif
{ } { }
@@ -222,7 +222,7 @@ class AIStateMachineThread : public AIStateMachineThreadBase {
public: public:
// Constructor. // Constructor.
AIStateMachineThread(CWD_ONLY(bool debug)) AIStateMachineThread(CWD_ONLY(bool debug))
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
: AIStateMachineThreadBase(debug) : AIStateMachineThreadBase(debug)
#endif #endif
{ {

View File

@@ -77,7 +77,7 @@ class AITimer : public AIStateMachine {
public: public:
AITimer(CWD_ONLY(bool debug = false)) : AITimer(CWD_ONLY(bool debug = false)) :
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
AIStateMachine(debug), AIStateMachine(debug),
#endif #endif
mInterval(0) { DoutEntering(dc::statemachine(mSMDebug), "AITimer(void) [" << (void*)this << "]"); } mInterval(0) { DoutEntering(dc::statemachine(mSMDebug), "AITimer(void) [" << (void*)this << "]"); }

View File

@@ -33,6 +33,25 @@ configure_file(
${CMAKE_SOURCE_DIR}/llcommon/llversionviewer.h ${CMAKE_SOURCE_DIR}/llcommon/llversionviewer.h
) )
if (WINDOWS)
configure_file(
${CMAKE_SOURCE_DIR}/newview/res/viewerRes.rc.in
${CMAKE_SOURCE_DIR}/newview/res/viewerRes.rc
)
configure_file(
${CMAKE_SOURCE_DIR}/newview/res/viewerRes_bc.rc.in
${CMAKE_SOURCE_DIR}/newview/res/viewerRes_bc.rc
)
endif (WINDOWS)
if (DARWIN)
configure_file(
${CMAKE_SOURCE_DIR}/newview/English.lproj/InfoPlist.strings.in
${CMAKE_SOURCE_DIR}/newview/English.lproj/InfoPlist.strings
)
endif (DARWIN)
# Compose the version. # Compose the version.
set(viewer_VERSION "${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}") set(viewer_VERSION "${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}")
if (viewer_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$") if (viewer_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$")

View File

@@ -81,6 +81,7 @@ set(cmake_SOURCE_FILES
Linking.cmake Linking.cmake
MediaPluginBase.cmake MediaPluginBase.cmake
NDOF.cmake NDOF.cmake
NVAPI.cmake
OPENAL.cmake OPENAL.cmake
OpenGL.cmake OpenGL.cmake
OpenJPEG.cmake OpenJPEG.cmake

21
indra/cmake/NVAPI.cmake Normal file
View File

@@ -0,0 +1,21 @@
# -*- cmake -*-
include(Prebuilt)
include(Variables)
set(NVAPI ON CACHE BOOL "Use NVAPI.")
if (NVAPI)
if (WINDOWS)
use_prebuilt_binary(nvapi)
if (WORD_SIZE EQUAL 32)
set(NVAPI_LIBRARY nvapi)
elseif (WORD_SIZE EQUAL 64)
set(NVAPI_LIBRARY nvapi64)
endif (WORD_SIZE EQUAL 32)
else (WINDOWS)
set(NVAPI_LIBRARY "")
endif (WINDOWS)
else (NVAPI)
set(NVAPI_LIBRARY "")
endif (NVAPI)

View File

@@ -140,12 +140,13 @@ endif(WINDOWS AND WORD_SIZE EQUAL 32)
set(GRID agni CACHE STRING "Target Grid") set(GRID agni CACHE STRING "Target Grid")
set(VIEWER_CHANNEL "Singularity" CACHE STRING "Viewer Channel Name") set(VIEWER_CHANNEL "Singularity" CACHE STRING "Viewer Channel Name")
set(VIEWER_LOGIN_CHANNEL ${VIEWER_CHANNEL} CACHE STRING "Fake login channel for A/B Testing") set(VIEWER_LOGIN_CHANNEL "${VIEWER_CHANNEL}" CACHE STRING "Fake login channel for A/B Testing")
set(VIEWER_BRANDING_ID "singularity" CACHE STRING "Viewer branding id (currently secondlife|snowglobe)") set(VIEWER_BRANDING_ID "singularity" CACHE STRING "Viewer branding id (currently secondlife|snowglobe)")
# *TODO: break out proper Branding-secondlife.cmake, Branding-snowglobe.cmake, etc # *TODO: break out proper Branding-secondlife.cmake, Branding-snowglobe.cmake, etc
set(VIEWER_BRANDING_NAME "Singularity") string(REGEX REPLACE " +" "" VIEWER_CHANNEL_ONE_WORD "${VIEWER_CHANNEL}")
set(VIEWER_BRANDING_NAME_CAMELCASE "Singularity") set(VIEWER_BRANDING_NAME "${VIEWER_CHANNEL_ONE_WORD}")
set(VIEWER_BRANDING_NAME_CAMELCASE "${VIEWER_CHANNEL_ONE_WORD}")
set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.") set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.")

View File

@@ -74,6 +74,8 @@ struct fake_channel {
char const* mLabel; char const* mLabel;
fake_channel(int on, char const* label) : mOn(on), mLabel(label) { } fake_channel(int on, char const* label) : mOn(on), mLabel(label) { }
fake_channel(void) : mOn(0) { } fake_channel(void) : mOn(0) { }
fake_channel& operator()(bool) { return *this; }
fake_channel const& operator()(bool) const { return *this; }
bool is_on() const { return !!mOn; } bool is_on() const { return !!mOn; }
bool is_off() const { return !mOn; } bool is_off() const { return !mOn; }
void on() const { } void on() const { }
@@ -144,7 +146,11 @@ extern LL_COMMON_API fake_channel const snapshot;
#define CWDEBUG_MARKER 0 #define CWDEBUG_MARKER 0
#define BACKTRACE do { } while(0) #define BACKTRACE do { } while(0)
#ifdef DEBUG_CURLIO
#define CWD_ONLY(...) __VA_ARGS__
#else
#define CWD_ONLY(...) #define CWD_ONLY(...)
#endif
#endif // !DOXYGEN #endif // !DOXYGEN

View File

@@ -39,6 +39,13 @@ LLListener_OpenAL::~LLListener_OpenAL()
{ {
} }
void LLListener_OpenAL::init()
{
// do inherited
LLListener::init();
mRolloffFactor = 1.0f;
}
void LLListener_OpenAL::translate(LLVector3 offset) void LLListener_OpenAL::translate(LLVector3 offset)
{ {
//llinfos << "LLListener_OpenAL::translate() : " << offset << llendl; //llinfos << "LLListener_OpenAL::translate() : " << offset << llendl;

View File

@@ -38,6 +38,7 @@ class LLListener_OpenAL : public LLListener
public: public:
LLListener_OpenAL(); LLListener_OpenAL();
virtual ~LLListener_OpenAL(); virtual ~LLListener_OpenAL();
virtual void init();
virtual void translate(LLVector3 offset); virtual void translate(LLVector3 offset);
virtual void setPosition(LLVector3 pos); virtual void setPosition(LLVector3 pos);

View File

@@ -61,17 +61,13 @@ BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;
LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sMemAllocationTracker; LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sMemAllocationTracker;
#endif #endif
void ll_assert_aligned_func(uintptr_t ptr,U32 alignment)
{
#ifdef SHOW_ASSERT #ifdef SHOW_ASSERT
void singu_alignment_check_failed(void)
{
// Redundant, place to set breakpoints. // Redundant, place to set breakpoints.
if (ptr%alignment!=0) llassert(false);
{
llwarns << "alignment check failed" << llendl;
}
llassert(ptr%alignment==0);
#endif
} }
#endif
//static //static
void LLMemory::initClass() void LLMemory::initClass()

View File

@@ -42,10 +42,32 @@ class LLMutex ;
#define LL_CHECK_MEMORY #define LL_CHECK_MEMORY
#endif #endif
LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); //<singu>
// ll_assert_aligned seems to only exist to set breakpoints in case an alignment check fails.
// However, the implementation was horrible: the test was done using a integer modulo after
// calling a function; which is like 500 times slower then the below. That turned out to be
// significant compared to CPU cycles used to do vector calculations in side of which this test
// is used.
//
// This implementation uses a faster, inlined test, and then still calls a function when
// that fails to set a break point there if needed.
//
// This uses the fact that 'alignment' is literal int (aka, '16' or '64') that is a power of two.
// As a result, the modulo is converted by the compiler to a logical AND with alignment-1, what
// it cannot do if you don't inline the test.
#ifdef SHOW_ASSERT #ifdef SHOW_ASSERT
#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment)) LL_COMMON_API void singu_alignment_check_failed(void);
#define ll_assert_aligned(ptr,alignment) \
do \
{ \
if (LL_UNLIKELY(reinterpret_cast<intptr_t>(ptr) % alignment)) \
{ \
singu_alignment_check_failed(); \
} \
} \
while(0)
//</singu>
#else #else
#define ll_assert_aligned(ptr,alignment) #define ll_assert_aligned(ptr,alignment)
#endif #endif

View File

@@ -36,9 +36,6 @@
#include <winnls.h> // for WideCharToMultiByte #include <winnls.h> // for WideCharToMultiByte
#endif #endif
LLFastTimer::DeclareTimer FT_STRING_FORMAT("String Format");
std::string ll_safe_string(const char* in) std::string ll_safe_string(const char* in)
{ {
if(in) return std::string(in); if(in) return std::string(in);
@@ -1190,7 +1187,6 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
template<> template<>
S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions) S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions)
{ {
LLFastTimer ft(FT_STRING_FORMAT);
S32 res = 0; S32 res = 0;
std::string output; std::string output;
@@ -1263,7 +1259,6 @@ S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions)
template<> template<>
S32 LLStringUtil::format(std::string& s, const LLSD& substitutions) S32 LLStringUtil::format(std::string& s, const LLSD& substitutions)
{ {
LLFastTimer ft(FT_STRING_FORMAT);
S32 res = 0; S32 res = 0;
if (!substitutions.isMap()) if (!substitutions.isMap())

View File

@@ -52,7 +52,6 @@
#include "llsdserialize.h" #include "llsdserialize.h"
#include "aithreadsafe.h" #include "aithreadsafe.h"
#include "llqueuedthread.h" #include "llqueuedthread.h"
#include "lltimer.h" // ms_sleep
#include "llproxy.h" #include "llproxy.h"
#include "llhttpstatuscodes.h" #include "llhttpstatuscodes.h"
#include "aihttpheaders.h" #include "aihttpheaders.h"
@@ -766,8 +765,8 @@ DEFINE_FUNCTION_SETOPT4(curl_write_callback, CURLOPT_HEADERFUNCTION, CURLOPT_WRI
//DEFINE_FUNCTION_SETOPT1(curl_read_callback, CURLOPT_READFUNCTION) //DEFINE_FUNCTION_SETOPT1(curl_read_callback, CURLOPT_READFUNCTION)
DEFINE_FUNCTION_SETOPT1(curl_ssl_ctx_callback, CURLOPT_SSL_CTX_FUNCTION) DEFINE_FUNCTION_SETOPT1(curl_ssl_ctx_callback, CURLOPT_SSL_CTX_FUNCTION)
DEFINE_FUNCTION_SETOPT3(curl_conv_callback, CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, CURLOPT_CONV_FROM_UTF8_FUNCTION) DEFINE_FUNCTION_SETOPT3(curl_conv_callback, CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, CURLOPT_CONV_FROM_UTF8_FUNCTION)
#if 0 // Not used by the viewer.
DEFINE_FUNCTION_SETOPT1(curl_progress_callback, CURLOPT_PROGRESSFUNCTION) DEFINE_FUNCTION_SETOPT1(curl_progress_callback, CURLOPT_PROGRESSFUNCTION)
#if 0 // Not used by the viewer.
DEFINE_FUNCTION_SETOPT1(curl_seek_callback, CURLOPT_SEEKFUNCTION) DEFINE_FUNCTION_SETOPT1(curl_seek_callback, CURLOPT_SEEKFUNCTION)
DEFINE_FUNCTION_SETOPT1(curl_ioctl_callback, CURLOPT_IOCTLFUNCTION) DEFINE_FUNCTION_SETOPT1(curl_ioctl_callback, CURLOPT_IOCTLFUNCTION)
DEFINE_FUNCTION_SETOPT1(curl_sockopt_callback, CURLOPT_SOCKOPTFUNCTION) DEFINE_FUNCTION_SETOPT1(curl_sockopt_callback, CURLOPT_SOCKOPTFUNCTION)
@@ -902,6 +901,23 @@ void CurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* us
setopt(CURLOPT_SSL_CTX_DATA, this); setopt(CURLOPT_SSL_CTX_DATA, this);
} }
//static
int CurlEasyRequest::progressCallback(void* userdata, double dltotal, double dlnow, double ultotal, double ulnow)
{
CurlEasyRequest* self = static_cast<CurlEasyRequest*>(userdata);
ThreadSafeBufferedCurlEasyRequest* lockobj = self->get_lockobj();
AICurlEasyRequest_wat lock_self(*lockobj);
return self->mProgressCallback(self->mProgressCallbackUserData, dltotal, dlnow, ultotal, ulnow);
}
void CurlEasyRequest::setProgressCallback(curl_progress_callback callback, void* userdata)
{
mProgressCallback = callback;
mProgressCallbackUserData = userdata;
setopt(CURLOPT_PROGRESSFUNCTION, callback ? &CurlEasyRequest::progressCallback : NULL);
setopt(CURLOPT_PROGRESSDATA, userdata ? this : NULL);
}
#define llmaybewarns lllog(LLApp::isExiting() ? LLError::LEVEL_INFO : LLError::LEVEL_WARN, NULL, NULL, false, true) #define llmaybewarns lllog(LLApp::isExiting() ? LLError::LEVEL_INFO : LLError::LEVEL_WARN, NULL, NULL, false, true)
static size_t noHeaderCallback(char* ptr, size_t size, size_t nmemb, void* userdata) static size_t noHeaderCallback(char* ptr, size_t size, size_t nmemb, void* userdata)
@@ -928,12 +944,19 @@ static CURLcode noSSLCtxCallback(CURL* curl, void* sslctx, void* parm)
return CURLE_ABORTED_BY_CALLBACK; return CURLE_ABORTED_BY_CALLBACK;
} }
static int noProgressCallback(void* userdata, double, double, double, double)
{
llmaybewarns << "Calling noProgressCallback(); curl session aborted." << llendl;
return -1; // Cause a CURLE_ABORTED_BY_CALLBACK
}
void CurlEasyRequest::revokeCallbacks(void) void CurlEasyRequest::revokeCallbacks(void)
{ {
if (mHeaderCallback == &noHeaderCallback && if (mHeaderCallback == &noHeaderCallback &&
mWriteCallback == &noWriteCallback && mWriteCallback == &noWriteCallback &&
mReadCallback == &noReadCallback && mReadCallback == &noReadCallback &&
mSSLCtxCallback == &noSSLCtxCallback) mSSLCtxCallback == &noSSLCtxCallback &&
mProgressCallback == &noProgressCallback)
{ {
// Already revoked. // Already revoked.
return; return;
@@ -942,6 +965,7 @@ void CurlEasyRequest::revokeCallbacks(void)
mWriteCallback = &noWriteCallback; mWriteCallback = &noWriteCallback;
mReadCallback = &noReadCallback; mReadCallback = &noReadCallback;
mSSLCtxCallback = &noSSLCtxCallback; mSSLCtxCallback = &noSSLCtxCallback;
mProgressCallback = &noProgressCallback;
if (active() && !no_warning()) if (active() && !no_warning())
{ {
llwarns << "Revoking callbacks on a still active CurlEasyRequest object!" << llendl; llwarns << "Revoking callbacks on a still active CurlEasyRequest object!" << llendl;
@@ -950,6 +974,7 @@ void CurlEasyRequest::revokeCallbacks(void)
curl_easy_setopt(getEasyHandle(), CURLOPT_WRITEHEADER, &noWriteCallback); curl_easy_setopt(getEasyHandle(), CURLOPT_WRITEHEADER, &noWriteCallback);
curl_easy_setopt(getEasyHandle(), CURLOPT_READFUNCTION, &noReadCallback); curl_easy_setopt(getEasyHandle(), CURLOPT_READFUNCTION, &noReadCallback);
curl_easy_setopt(getEasyHandle(), CURLOPT_SSL_CTX_FUNCTION, &noSSLCtxCallback); curl_easy_setopt(getEasyHandle(), CURLOPT_SSL_CTX_FUNCTION, &noSSLCtxCallback);
curl_easy_setopt(getEasyHandle(), CURLOPT_PROGRESSFUNCTION, &noProgressCallback);
} }
CurlEasyRequest::~CurlEasyRequest() CurlEasyRequest::~CurlEasyRequest()
@@ -1078,6 +1103,8 @@ void CurlEasyRequest::applyDefaultOptions(void)
setopt(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); setopt(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
// Disable SSL/TLS session caching; some servers (aka id.secondlife.com) refuse connections when session ids are enabled. // Disable SSL/TLS session caching; some servers (aka id.secondlife.com) refuse connections when session ids are enabled.
setopt(CURLOPT_SSL_SESSIONID_CACHE, 0); setopt(CURLOPT_SSL_SESSIONID_CACHE, 0);
// Call the progress callback funtion.
setopt(CURLOPT_NOPROGRESS, 0);
// Set the CURL options for either SOCKS or HTTP proxy. // Set the CURL options for either SOCKS or HTTP proxy.
applyProxySettings(); applyProxySettings();
// Cause libcurl to print all it's I/O traffic on the debug channel. // Cause libcurl to print all it's I/O traffic on the debug channel.
@@ -1096,6 +1123,7 @@ void CurlEasyRequest::finalizeRequest(std::string const& url, AIHTTPTimeoutPolic
DoutCurlEntering("CurlEasyRequest::finalizeRequest(\"" << url << "\", " << policy.name() << ", " << (void*)state_machine << ")"); DoutCurlEntering("CurlEasyRequest::finalizeRequest(\"" << url << "\", " << policy.name() << ", " << (void*)state_machine << ")");
llassert(!mTimeoutPolicy); // May only call finalizeRequest once! llassert(!mTimeoutPolicy); // May only call finalizeRequest once!
mResult = CURLE_FAILED_INIT; // General error code; the final result code is stored here by MultiHandle::check_msg_queue when msg is CURLMSG_DONE. mResult = CURLE_FAILED_INIT; // General error code; the final result code is stored here by MultiHandle::check_msg_queue when msg is CURLMSG_DONE.
mIsHttps = strncmp(url.c_str(), "https:", 6) == 0;
#ifdef SHOW_ASSERT #ifdef SHOW_ASSERT
// Do a sanity check on the headers. // Do a sanity check on the headers.
int content_type_count = 0; int content_type_count = 0;
@@ -1140,7 +1168,13 @@ void CurlEasyRequest::finalizeRequest(std::string const& url, AIHTTPTimeoutPolic
// // get less connect time, while it still (also) has to wait for this DNS lookup. // // get less connect time, while it still (also) has to wait for this DNS lookup.
void CurlEasyRequest::set_timeout_opts(void) void CurlEasyRequest::set_timeout_opts(void)
{ {
setopt(CURLOPT_CONNECTTIMEOUT, mTimeoutPolicy->getConnectTimeout(getLowercaseHostname())); U16 connect_timeout = mTimeoutPolicy->getConnectTimeout(getLowercaseHostname());
if (mIsHttps && connect_timeout < 30)
{
DoutCurl("Incrementing CURLOPT_CONNECTTIMEOUT of \"" << mTimeoutPolicy->name() << "\" from " << connect_timeout << " to 30 seconds.");
connect_timeout = 30;
}
setopt(CURLOPT_CONNECTTIMEOUT, connect_timeout);
setopt(CURLOPT_TIMEOUT, mTimeoutPolicy->getCurlTransaction()); setopt(CURLOPT_TIMEOUT, mTimeoutPolicy->getCurlTransaction());
} }
@@ -1287,8 +1321,9 @@ BufferedCurlEasyRequest::~BufferedCurlEasyRequest()
// If the responder is still alive, then that means that BufferedCurlEasyRequest::processOutput was // If the responder is still alive, then that means that BufferedCurlEasyRequest::processOutput was
// never called, which means that the removed_from_multi_handle event never happened. // never called, which means that the removed_from_multi_handle event never happened.
// This is definitely an internal error as it can only happen when libcurl is too slow, // This is definitely an internal error as it can only happen when libcurl is too slow,
// in which case AICurlEasyRequestStateMachine::mTimer times out, but that already // in which case AICurlEasyRequestStateMachine::mTimer times out, a socket goes bad, or
// calls BufferedCurlEasyRequest::timed_out(). // the state machine is aborted, but those already call BufferedCurlEasyRequest::aborted()
// which sets mResponder to NULL.
llmaybeerrs << "Calling ~BufferedCurlEasyRequest() with active responder!" << llendl; llmaybeerrs << "Calling ~BufferedCurlEasyRequest() with active responder!" << llendl;
if (!LLApp::isRunning()) if (!LLApp::isRunning())
{ {
@@ -1298,30 +1333,23 @@ BufferedCurlEasyRequest::~BufferedCurlEasyRequest()
else else
{ {
// User chose to continue. // User chose to continue.
timed_out(); aborted(HTTP_INTERNAL_ERROR_OTHER, "BufferedCurlEasyRequest destructed with active responder");
} }
} }
--AICurlInterface::Stats::BufferedCurlEasyRequest_count; --AICurlInterface::Stats::BufferedCurlEasyRequest_count;
} }
void BufferedCurlEasyRequest::timed_out(void) void BufferedCurlEasyRequest::aborted(U32 http_status, std::string const& reason)
{ {
mResponder->finished(CURLE_OK, HTTP_INTERNAL_ERROR_CURL_LOCKUP, "Request timeout, aborted.", sChannels, mOutput); if (mResponder)
if (mResponder->needsHeaders())
{ {
send_buffer_events_to(NULL); // Revoke buffer events: we send them to the responder. mResponder->finished(CURLE_OK, http_status, reason, sChannels, mOutput);
if (mResponder->needsHeaders())
{
send_buffer_events_to(NULL); // Revoke buffer events: we send them to the responder.
}
mResponder = NULL;
} }
mResponder = NULL;
}
void BufferedCurlEasyRequest::bad_socket(void)
{
mResponder->finished(CURLE_OK, HTTP_INTERNAL_ERROR_CURL_BADSOCKET, "File descriptor went bad! Aborted.", sChannels, mOutput);
if (mResponder->needsHeaders())
{
send_buffer_events_to(NULL); // Revoke buffer events: we send them to the responder.
}
mResponder = NULL;
} }
#if defined(CWDEBUG) || defined(DEBUG_CURLIO) #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
@@ -1410,6 +1438,7 @@ void BufferedCurlEasyRequest::prepRequest(AICurlEasyRequest_wat& curl_easy_reque
curl_easy_request_w->setWriteCallback(&curlWriteCallback, lockobj); curl_easy_request_w->setWriteCallback(&curlWriteCallback, lockobj);
curl_easy_request_w->setReadCallback(&curlReadCallback, lockobj); curl_easy_request_w->setReadCallback(&curlReadCallback, lockobj);
curl_easy_request_w->setHeaderCallback(&curlHeaderCallback, lockobj); curl_easy_request_w->setHeaderCallback(&curlHeaderCallback, lockobj);
curl_easy_request_w->setProgressCallback(&curlProgressCallback, lockobj);
bool allow_cookies = headers.hasHeader("Cookie"); bool allow_cookies = headers.hasHeader("Cookie");
// Allow up to sixteen redirects. // Allow up to sixteen redirects.

View File

@@ -121,6 +121,7 @@ void AICurlEasyRequestStateMachine::multiplex_impl(state_type run_state)
bool empty_url = AICurlEasyRequest_rat(*mCurlEasyRequest)->getLowercaseServicename().empty(); bool empty_url = AICurlEasyRequest_rat(*mCurlEasyRequest)->getLowercaseServicename().empty();
if (empty_url) if (empty_url)
{ {
AICurlEasyRequest_wat(*mCurlEasyRequest)->aborted(HTTP_INTERNAL_ERROR_OTHER, "Not a valid URL.");
abort(); abort();
break; break;
} }
@@ -195,16 +196,14 @@ void AICurlEasyRequestStateMachine::multiplex_impl(state_type run_state)
case AICurlEasyRequestStateMachine_removed: case AICurlEasyRequestStateMachine_removed:
{ {
// The request was removed from the multi handle. // The request was removed from the multi handle.
if (mTimedOut)
{
AICurlEasyRequest_wat easy_request_w(*mCurlEasyRequest);
easy_request_w->timed_out();
}
// We're done. If we timed out, abort -- or else the application will // We're done. If we timed out, abort -- or else the application will
// think that getResult() will return a valid error code from libcurl. // think that getResult() will return a valid error code from libcurl.
if (mTimedOut) if (mTimedOut)
{
AICurlEasyRequest_wat(*mCurlEasyRequest)->aborted(HTTP_INTERNAL_ERROR_CURL_LOCKUP, "Request timeout, aborted.");
abort(); abort();
}
else else
finish(); finish();
@@ -212,7 +211,7 @@ void AICurlEasyRequestStateMachine::multiplex_impl(state_type run_state)
} }
case AICurlEasyRequestStateMachine_bad_file_descriptor: case AICurlEasyRequestStateMachine_bad_file_descriptor:
{ {
AICurlEasyRequest_wat(*mCurlEasyRequest)->bad_socket(); AICurlEasyRequest_wat(*mCurlEasyRequest)->aborted(HTTP_INTERNAL_ERROR_CURL_BADSOCKET, "File descriptor went bad! Aborted.");
abort(); abort();
} }
} }
@@ -224,7 +223,7 @@ void AICurlEasyRequestStateMachine::abort_impl(void)
// Revert call to addRequest() if that was already called (and the request wasn't removed again already). // Revert call to addRequest() if that was already called (and the request wasn't removed again already).
if (mAdded) if (mAdded)
{ {
// Note that it's safe to call this even if the curl thread already removed it, or will removes it // Note that it's safe to call this even if the curl thread already removed it, or will remove it
// after we called this, before processing the remove command; only the curl thread calls // after we called this, before processing the remove command; only the curl thread calls
// MultiHandle::remove_easy_request, which is a no-op when called twice for the same easy request. // MultiHandle::remove_easy_request, which is a no-op when called twice for the same easy request.
mAdded = false; mAdded = false;
@@ -251,7 +250,7 @@ void AICurlEasyRequestStateMachine::finish_impl(void)
} }
AICurlEasyRequestStateMachine::AICurlEasyRequestStateMachine(CWD_ONLY(bool debug)) : AICurlEasyRequestStateMachine::AICurlEasyRequestStateMachine(CWD_ONLY(bool debug)) :
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
AIStateMachine(debug), AIStateMachine(debug),
#endif #endif
mTotalDelayTimeout(AIHTTPTimeoutPolicy::getDebugSettingsCurlTimeout().getTotalDelay()) mTotalDelayTimeout(AIHTTPTimeoutPolicy::getDebugSettingsCurlTimeout().getTotalDelay())

View File

@@ -83,8 +83,8 @@ class CurlEasyHandle : public boost::noncopyable, protected AICurlEasyHandleEven
//DECLARE_SETOPT(curl_read_callback); Same type as curl_write_callback //DECLARE_SETOPT(curl_read_callback); Same type as curl_write_callback
DECLARE_SETOPT(curl_ssl_ctx_callback); DECLARE_SETOPT(curl_ssl_ctx_callback);
DECLARE_SETOPT(curl_conv_callback); DECLARE_SETOPT(curl_conv_callback);
#if 0 // Not used by the viewer.
DECLARE_SETOPT(curl_progress_callback); DECLARE_SETOPT(curl_progress_callback);
#if 0 // Not used by the viewer.
DECLARE_SETOPT(curl_seek_callback); DECLARE_SETOPT(curl_seek_callback);
DECLARE_SETOPT(curl_ioctl_callback); DECLARE_SETOPT(curl_ioctl_callback);
DECLARE_SETOPT(curl_sockopt_callback); DECLARE_SETOPT(curl_sockopt_callback);
@@ -235,6 +235,7 @@ class CurlEasyRequest : public CurlEasyHandle {
static size_t writeCallback(char* ptr, size_t size, size_t nmemb, void* userdata); static size_t writeCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
static size_t readCallback(char* ptr, size_t size, size_t nmemb, void* userdata); static size_t readCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
static CURLcode SSLCtxCallback(CURL* curl, void* sslctx, void* userdata); static CURLcode SSLCtxCallback(CURL* curl, void* sslctx, void* userdata);
static int progressCallback(void* userdata, double, double, double, double);
curl_write_callback mHeaderCallback; curl_write_callback mHeaderCallback;
void* mHeaderCallbackUserData; void* mHeaderCallbackUserData;
@@ -244,12 +245,15 @@ class CurlEasyRequest : public CurlEasyHandle {
void* mReadCallbackUserData; void* mReadCallbackUserData;
curl_ssl_ctx_callback mSSLCtxCallback; curl_ssl_ctx_callback mSSLCtxCallback;
void* mSSLCtxCallbackUserData; void* mSSLCtxCallbackUserData;
curl_progress_callback mProgressCallback;
void* mProgressCallbackUserData;
public: public:
void setHeaderCallback(curl_write_callback callback, void* userdata); void setHeaderCallback(curl_write_callback callback, void* userdata);
void setWriteCallback(curl_write_callback callback, void* userdata); void setWriteCallback(curl_write_callback callback, void* userdata);
void setReadCallback(curl_read_callback callback, void* userdata); void setReadCallback(curl_read_callback callback, void* userdata);
void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata); void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata);
void setProgressCallback(curl_progress_callback callback, void* userdata);
// Call this if the set callbacks are about to be invalidated. // Call this if the set callbacks are about to be invalidated.
void revokeCallbacks(void); void revokeCallbacks(void);
@@ -315,6 +319,7 @@ class CurlEasyRequest : public CurlEasyHandle {
AIPerServicePtr mPerServicePtr; // Pointer to the corresponding AIPerService. AIPerServicePtr mPerServicePtr; // Pointer to the corresponding AIPerService.
LLPointer<curlthread::HTTPTimeout> mTimeout;// Timeout administration object associated with last created CurlSocketInfo. LLPointer<curlthread::HTTPTimeout> mTimeout;// Timeout administration object associated with last created CurlSocketInfo.
bool mTimeoutIsOrphan; // Set to true when mTimeout is not (yet) associated with a CurlSocketInfo. bool mTimeoutIsOrphan; // Set to true when mTimeout is not (yet) associated with a CurlSocketInfo.
bool mIsHttps; // Set if the url starts with "https:".
#if defined(CWDEBUG) || defined(DEBUG_CURLIO) #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
public: public:
bool mDebugIsHeadOrGetMethod; bool mDebugIsHeadOrGetMethod;
@@ -385,11 +390,8 @@ class BufferedCurlEasyRequest : public CurlEasyRequest {
buffer_ptr_t& getInput(void) { return mInput; } buffer_ptr_t& getInput(void) { return mInput; }
buffer_ptr_t& getOutput(void) { return mOutput; } buffer_ptr_t& getOutput(void) { return mOutput; }
// Called if libcurl doesn't deliver within AIHTTPTimeoutPolicy::mMaximumTotalDelay seconds. // Called if the state machine is (about to be) aborted due to some error.
void timed_out(void); void aborted(U32 http_status, std::string const& reason);
// Called if the underlaying socket went bad (ie, when accidently closed by a buggy library).
void bad_socket(void);
// Called after removed_from_multi_handle was called. // Called after removed_from_multi_handle was called.
void processOutput(void); void processOutput(void);
@@ -443,6 +445,7 @@ class BufferedCurlEasyRequest : public CurlEasyRequest {
static size_t curlWriteCallback(char* data, size_t size, size_t nmemb, void* user_data); static size_t curlWriteCallback(char* data, size_t size, size_t nmemb, void* user_data);
static size_t curlReadCallback(char* data, size_t size, size_t nmemb, void* user_data); static size_t curlReadCallback(char* data, size_t size, size_t nmemb, void* user_data);
static size_t curlHeaderCallback(char* data, size_t size, size_t nmemb, void* user_data); static size_t curlHeaderCallback(char* data, size_t size, size_t nmemb, void* user_data);
static int curlProgressCallback(void* user_data, double dltotal, double dlnow, double ultotal, double ulnow);
// Called from curlHeaderCallback. // Called from curlHeaderCallback.
void setStatusAndReason(U32 status, std::string const& reason); void setStatusAndReason(U32 status, std::string const& reason);
@@ -462,7 +465,7 @@ class BufferedCurlEasyRequest : public CurlEasyRequest {
bool success(void) const { return mResult == CURLE_OK && mStatus >= 200 && mStatus < 400; } bool success(void) const { return mResult == CURLE_OK && mStatus >= 200 && mStatus < 400; }
// Return true when prepRequest was already called and the object has not been // Return true when prepRequest was already called and the object has not been
// invalidated as a result of calling timed_out(). // invalidated as a result of calling aborted().
bool isValid(void) const { return mResponder; } bool isValid(void) const { return mResponder; }
// Return the capability type of this request. // Return the capability type of this request.

View File

@@ -2140,7 +2140,8 @@ void BufferedCurlEasyRequest::processOutput(void)
sResponderCallbackMutex.unlock(); sResponderCallbackMutex.unlock();
mResponder = NULL; mResponder = NULL;
resetState(); // Commented out because this easy handle is not going to be reused; it makes no sense to reset its state.
//resetState();
} }
//static //static
@@ -2354,6 +2355,24 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
return header_len; return header_len;
} }
//static
int BufferedCurlEasyRequest::curlProgressCallback(void* user_data, double dltotal, double dlnow, double ultotal, double ulnow)
{
if (ultotal > 0) // Zero just means it isn't known yet.
{
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
DoutEntering(dc::curl, "BufferedCurlEasyRequest::curlProgressCallback(" << (void*)lockobj << ", " << dltotal << ", " << dlnow << ", " << ultotal << ", " << ulnow << ")");
if (ulnow == ultotal) // Everything uploaded?
{
AICurlEasyRequest_wat self_w(*lockobj);
self_w->httptimeout()->upload_finished();
}
}
return 0;
}
#if defined(CWDEBUG) || defined(DEBUG_CURLIO) #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
int debug_callback(CURL* handle, curl_infotype infotype, char* buf, size_t size, void* user_ptr) int debug_callback(CURL* handle, curl_infotype infotype, char* buf, size_t size, void* user_ptr)
{ {

View File

@@ -157,10 +157,11 @@ void HTTPTimeout::upload_starting(void)
// | // |
void HTTPTimeout::upload_finished(void) void HTTPTimeout::upload_finished(void)
{ {
// Disable this assert when there isn't enough debug output to do anything with it. // This function can be called more than once. Ignore the second call.
#if defined(CWDEBUG) || defined(DEBUG_CURLIO) if (mUploadFinished)
llassert(!mUploadFinished); // If we get here twice, then the 'upload finished' detection failed. {
#endif return;
}
mUploadFinished = true; mUploadFinished = true;
// Only accept a call to upload_starting() if being_redirected() is called after this point. // Only accept a call to upload_starting() if being_redirected() is called after this point.
mBeingRedirected = false; mBeingRedirected = false;

View File

@@ -565,7 +565,7 @@ void debug_curl_remove_easy(CURL* handle)
handles.erase(iter); handles.erase(iter);
Dout(dc::warning, "debug_curl_remove_easy(" << (void*)handle << "): removed"); Dout(dc::warning, "debug_curl_remove_easy(" << (void*)handle << "): removed");
} }
llassert(!print_debug(handle)); llassert(!gDebugCurlTerse || !print_debug(handle));
} }
bool debug_curl_print_debug(CURL* handle) bool debug_curl_print_debug(CURL* handle)
@@ -577,34 +577,28 @@ extern "C" {
void debug_curl_easy_cleanup(CURL* handle) void debug_curl_easy_cleanup(CURL* handle)
{ {
Dout(dc::curltr(print_debug(handle)), "curl_easy_cleanup(" << (AICURL*)handle << ")");
curl_easy_cleanup(handle); curl_easy_cleanup(handle);
if (print_debug(handle))
{
Dout(dc::curltr, "curl_easy_cleanup(" << (AICURL*)handle << ")");
}
} }
CURL* debug_curl_easy_duphandle(CURL* handle) CURL* debug_curl_easy_duphandle(CURL* handle)
{ {
CURL* ret; Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_duphandle(" << (AICURL*)handle << ") = ");
ret = curl_easy_duphandle(handle); CURL* ret = curl_easy_duphandle(handle);
if (!print_debug(handle)) return ret; Dout(dc::finish, (AICURL*)ret);
Dout(dc::curltr, "curl_easy_duphandle(" << (AICURL*)handle << ") = " << (AICURL*)ret);
return ret; return ret;
} }
char* debug_curl_easy_escape(CURL* curl, char* url, int length) char* debug_curl_easy_escape(CURL* curl, char* url, int length)
{ {
char* ret; Dout(dc::curltr(print_debug(curl))|continued_cf, "curl_easy_escape(" << (AICURL*)curl << ", \"" << url << "\", " << length << ") = ");
ret = curl_easy_escape(curl, url, length); char* ret = curl_easy_escape(curl, url, length);
if (!print_debug(curl)) return ret; Dout(dc::finish, '"' << ret << '"');
Dout(dc::curltr, "curl_easy_escape(" << (AICURL*)curl << ", \"" << url << "\", " << length << ") = \"" << ret << '"');
return ret; return ret;
} }
CURLcode debug_curl_easy_getinfo(CURL* handle, CURLINFO info, ...) CURLcode debug_curl_easy_getinfo(CURL* handle, CURLINFO info, ...)
{ {
CURLcode ret;
va_list ap; va_list ap;
union param_type { union param_type {
void* some_ptr; void* some_ptr;
@@ -616,27 +610,27 @@ CURLcode debug_curl_easy_getinfo(CURL* handle, CURLINFO info, ...)
va_start(ap, info); va_start(ap, info);
param.some_ptr = va_arg(ap, void*); param.some_ptr = va_arg(ap, void*);
va_end(ap); va_end(ap);
ret = curl_easy_getinfo(handle, info, param.some_ptr); Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", ");
if (!print_debug(handle)) return ret; CURLcode ret = curl_easy_getinfo(handle, info, param.some_ptr);
if (info == CURLINFO_PRIVATE) if (info == CURLINFO_PRIVATE)
{ {
Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", 0x" << std::hex << (size_t)param.some_ptr << std::dec << ") = " << ret); Dout(dc::finish, "0x" << std::hex << (size_t)param.some_ptr << std::dec << ") = " << ret);
} }
else else
{ {
switch((info & CURLINFO_TYPEMASK)) switch((info & CURLINFO_TYPEMASK))
{ {
case CURLINFO_STRING: case CURLINFO_STRING:
Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (char**){ \"" << (ret == CURLE_OK ? *param.char_ptr : " <unchanged> ") << "\" }) = " << ret); Dout(dc::finish, "(char**){ \"" << (ret == CURLE_OK ? *param.char_ptr : " <unchanged> ") << "\" }) = " << ret);
break; break;
case CURLINFO_LONG: case CURLINFO_LONG:
Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (long*){ " << (ret == CURLE_OK ? *param.long_ptr : 0L) << "L }) = " << ret); Dout(dc::finish, "(long*){ " << (ret == CURLE_OK ? *param.long_ptr : 0L) << "L }) = " << ret);
break; break;
case CURLINFO_DOUBLE: case CURLINFO_DOUBLE:
Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (double*){" << (ret == CURLE_OK ? *param.double_ptr : 0.) << "}) = " << ret); Dout(dc::finish, "(double*){" << (ret == CURLE_OK ? *param.double_ptr : 0.) << "}) = " << ret);
break; break;
case CURLINFO_SLIST: case CURLINFO_SLIST:
Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (curl_slist**){ " << (ret == CURLE_OK ? **param.curl_slist_ptr : unchanged_slist) << " }) = " << ret); Dout(dc::finish, "(curl_slist**){ " << (ret == CURLE_OK ? **param.curl_slist_ptr : unchanged_slist) << " }) = " << ret);
break; break;
} }
} }
@@ -645,36 +639,32 @@ CURLcode debug_curl_easy_getinfo(CURL* handle, CURLINFO info, ...)
CURL* debug_curl_easy_init(void) CURL* debug_curl_easy_init(void)
{ {
CURL* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_easy_init() = ");
ret = curl_easy_init(); CURL* ret = curl_easy_init();
if (gDebugCurlTerse) return ret; Dout(dc::finish, (AICURL*)ret);
Dout(dc::curltr, "curl_easy_init() = " << (AICURL*)ret);
return ret; return ret;
} }
CURLcode debug_curl_easy_pause(CURL* handle, int bitmask) CURLcode debug_curl_easy_pause(CURL* handle, int bitmask)
{ {
CURLcode ret; Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_pause(" << (AICURL*)handle << ", 0x" << std::hex << bitmask << std::dec << ") = ");
ret = curl_easy_pause(handle, bitmask); CURLcode ret = curl_easy_pause(handle, bitmask);
if (!print_debug(handle)) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_easy_pause(" << (AICURL*)handle << ", 0x" << std::hex << bitmask << std::dec << ") = " << ret);
return ret; return ret;
} }
CURLcode debug_curl_easy_perform(CURL* handle) CURLcode debug_curl_easy_perform(CURL* handle)
{ {
CURLcode ret; Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_perform(" << (AICURL*)handle << ") = ");
ret = curl_easy_perform(handle); CURLcode ret = curl_easy_perform(handle);
if (!print_debug(handle)) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_easy_perform(" << (AICURL*)handle << ") = " << ret);
return ret; return ret;
} }
void debug_curl_easy_reset(CURL* handle) void debug_curl_easy_reset(CURL* handle)
{ {
Dout(dc::curltr(print_debug(handle)), "curl_easy_reset(" << (AICURL*)handle << ")");
curl_easy_reset(handle); curl_easy_reset(handle);
if (!print_debug(handle)) return;
Dout(dc::curltr, "curl_easy_reset(" << (AICURL*)handle << ")");
} }
CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...) CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...)
@@ -710,11 +700,9 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...)
{ {
case CURLOPTTYPE_LONG: case CURLOPTTYPE_LONG:
{ {
Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", " << param.along << "L) = ");
ret = curl_easy_setopt(handle, option, param.along); ret = curl_easy_setopt(handle, option, param.along);
if (print_debug(handle)) Dout(dc::finish, ret);
{
Dout(dc::curltr, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", " << param.along << "L) = " << ret);
}
if (option == CURLOPT_POSTFIELDSIZE) if (option == CURLOPT_POSTFIELDSIZE)
{ {
postfieldsize = param.along; postfieldsize = param.along;
@@ -723,9 +711,7 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...)
} }
case CURLOPTTYPE_OBJECTPOINT: case CURLOPTTYPE_OBJECTPOINT:
{ {
ret = curl_easy_setopt(handle, option, param.ptr); LibcwDoutScopeBegin(LIBCWD_DEBUGCHANNELS, libcwd::libcw_do, dc::curltr(print_debug(handle))|continued_cf)
if (!print_debug(handle)) break;
LibcwDoutScopeBegin(LIBCWD_DEBUGCHANNELS, libcwd::libcw_do, dc::curltr)
LibcwDoutStream << "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", "; LibcwDoutStream << "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", ";
// For a subset of all options that take a char*, print the string passed. // For a subset of all options that take a char*, print the string passed.
if (option == CURLOPT_PROXY || // Set HTTP proxy to use. The parameter should be a char* to a zero terminated string holding the host name or dotted IP address. if (option == CURLOPT_PROXY || // Set HTTP proxy to use. The parameter should be a char* to a zero terminated string holding the host name or dotted IP address.
@@ -771,8 +757,10 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...)
{ {
LibcwDoutStream << "(object*)0x" << std::hex << (size_t)param.ptr << std::dec << ")"; LibcwDoutStream << "(object*)0x" << std::hex << (size_t)param.ptr << std::dec << ")";
} }
LibcwDoutStream << " = " << ret; LibcwDoutStream << " = ";
LibcwDoutScopeEnd; LibcwDoutScopeEnd;
ret = curl_easy_setopt(handle, option, param.ptr);
Dout(dc::finish, ret);
if (option == CURLOPT_HTTPHEADER && param.ptr) if (option == CURLOPT_HTTPHEADER && param.ptr)
{ {
debug::Indent indent(2); debug::Indent indent(2);
@@ -787,19 +775,15 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...)
break; break;
} }
case CURLOPTTYPE_FUNCTIONPOINT: case CURLOPTTYPE_FUNCTIONPOINT:
Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = ");
ret = curl_easy_setopt(handle, option, param.ptr); ret = curl_easy_setopt(handle, option, param.ptr);
if (print_debug(handle)) Dout(dc::finish, ret);
{
Dout(dc::curltr, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret);
}
break; break;
case CURLOPTTYPE_OFF_T: case CURLOPTTYPE_OFF_T:
{ {
Dout(dc::curltr(print_debug(handle))|continued_cf, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (curl_off_t)" << param.offset << ") = ");
ret = curl_easy_setopt(handle, option, param.offset); ret = curl_easy_setopt(handle, option, param.offset);
if (print_debug(handle)) Dout(dc::finish, ret);
{
Dout(dc::curltr, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (curl_off_t)" << param.offset << ") = " << ret);
}
if (option == CURLOPT_POSTFIELDSIZE_LARGE) if (option == CURLOPT_POSTFIELDSIZE_LARGE)
{ {
postfieldsize = (long)param.offset; postfieldsize = (long)param.offset;
@@ -814,103 +798,93 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...)
char const* debug_curl_easy_strerror(CURLcode errornum) char const* debug_curl_easy_strerror(CURLcode errornum)
{ {
char const* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_easy_strerror(" << errornum << ") = ");
ret = curl_easy_strerror(errornum); char const* ret = curl_easy_strerror(errornum);
if (gDebugCurlTerse) return ret; Dout(dc::finish, '"' << ret << '"');
Dout(dc::curltr, "curl_easy_strerror(" << errornum << ") = \"" << ret << '"');
return ret; return ret;
} }
char* debug_curl_easy_unescape(CURL* curl, char* url, int inlength, int* outlength) char* debug_curl_easy_unescape(CURL* curl, char* url, int inlength, int* outlength)
{ {
char* ret; Dout(dc::curltr(print_debug(curl))|continued_cf, "curl_easy_unescape(" << (AICURL*)curl << ", \"" << url << "\", " << inlength << ", ");
ret = curl_easy_unescape(curl, url, inlength, outlength); char* ret = curl_easy_unescape(curl, url, inlength, outlength);
if (!print_debug(curl)) return ret; Dout(dc::finish, ((ret && outlength) ? *outlength : 1) << ") = \"" << ret << '"');
Dout(dc::curltr, "curl_easy_unescape(" << (AICURL*)curl << ", \"" << url << "\", " << inlength << ", " << ((ret && outlength) ? *outlength : 1) << ") = \"" << ret << '"');
return ret; return ret;
} }
void debug_curl_free(char* ptr) void debug_curl_free(char* ptr)
{ {
Dout(dc::curltr(!gDebugCurlTerse), "curl_free(0x" << std::hex << (size_t)ptr << std::dec << ")");
curl_free(ptr); curl_free(ptr);
if (gDebugCurlTerse) return;
Dout(dc::curltr, "curl_free(0x" << std::hex << (size_t)ptr << std::dec << ")");
} }
time_t debug_curl_getdate(char const* datestring, time_t* now) time_t debug_curl_getdate(char const* datestring, time_t* now)
{ {
time_t ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_getdate(\"" << datestring << "\", " << (now == NULL ? "NULL" : "<erroneous non-NULL value for 'now'>") << ") = ");
ret = curl_getdate(datestring, now); time_t ret = curl_getdate(datestring, now);
if (gDebugCurlTerse) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_getdate(\"" << datestring << "\", " << (now == NULL ? "NULL" : "<erroneous non-NULL value for 'now'>") << ") = " << ret);
return ret; return ret;
} }
void debug_curl_global_cleanup(void) void debug_curl_global_cleanup(void)
{ {
curl_global_cleanup();
Dout(dc::curltr, "curl_global_cleanup()"); Dout(dc::curltr, "curl_global_cleanup()");
curl_global_cleanup();
} }
CURLcode debug_curl_global_init(long flags) CURLcode debug_curl_global_init(long flags)
{ {
CURLcode ret; Dout(dc::curltr|continued_cf, "curl_global_init(0x" << std::hex << flags << std::dec << ") = ");
ret = curl_global_init(flags); CURLcode ret = curl_global_init(flags);
Dout(dc::curltr, "curl_global_init(0x" << std::hex << flags << std::dec << ") = " << ret); Dout(dc::finish, ret);
return ret; return ret;
} }
CURLMcode debug_curl_multi_add_handle(CURLM* multi_handle, CURL* easy_handle) CURLMcode debug_curl_multi_add_handle(CURLM* multi_handle, CURL* easy_handle)
{ {
CURLMcode ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_add_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = ");
ret = curl_multi_add_handle(multi_handle, easy_handle); CURLMcode ret = curl_multi_add_handle(multi_handle, easy_handle);
if (gDebugCurlTerse) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_multi_add_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = " << ret);
return ret; return ret;
} }
CURLMcode debug_curl_multi_assign(CURLM* multi_handle, curl_socket_t sockfd, void* sockptr) CURLMcode debug_curl_multi_assign(CURLM* multi_handle, curl_socket_t sockfd, void* sockptr)
{ {
CURLMcode ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_assign(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << ", " << sockptr << ") = ");
ret = curl_multi_assign(multi_handle, sockfd, sockptr); CURLMcode ret = curl_multi_assign(multi_handle, sockfd, sockptr);
if (gDebugCurlTerse) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_multi_assign(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << ", " << sockptr << ") = " << ret);
return ret; return ret;
} }
CURLMcode debug_curl_multi_cleanup(CURLM* multi_handle) CURLMcode debug_curl_multi_cleanup(CURLM* multi_handle)
{ {
CURLMcode ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_cleanup(" << (AICURLM*)multi_handle << ") = ");
ret = curl_multi_cleanup(multi_handle); CURLMcode ret = curl_multi_cleanup(multi_handle);
if (gDebugCurlTerse) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_multi_cleanup(" << (AICURLM*)multi_handle << ") = " << ret);
return ret; return ret;
} }
CURLMsg* debug_curl_multi_info_read(CURLM* multi_handle, int* msgs_in_queue) CURLMsg* debug_curl_multi_info_read(CURLM* multi_handle, int* msgs_in_queue)
{ {
CURLMsg* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_info_read(" << (AICURLM*)multi_handle << ", ");
ret = curl_multi_info_read(multi_handle, msgs_in_queue); CURLMsg* ret = curl_multi_info_read(multi_handle, msgs_in_queue);
if (gDebugCurlTerse) return ret; Dout(dc::finish, "{" << *msgs_in_queue << "}) = " << ret);
Dout(dc::curltr, "curl_multi_info_read(" << (AICURLM*)multi_handle << ", {" << *msgs_in_queue << "}) = " << ret);
return ret; return ret;
} }
CURLM* debug_curl_multi_init(void) CURLM* debug_curl_multi_init(void)
{ {
CURLM* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_init() = ");
ret = curl_multi_init(); CURLM* ret = curl_multi_init();
if (gDebugCurlTerse) return ret; Dout(dc::finish, (AICURLM*)ret);
Dout(dc::curltr, "curl_multi_init() = " << (AICURLM*)ret);
return ret; return ret;
} }
CURLMcode debug_curl_multi_remove_handle(CURLM* multi_handle, CURL* easy_handle) CURLMcode debug_curl_multi_remove_handle(CURLM* multi_handle, CURL* easy_handle)
{ {
CURLMcode ret; Dout(dc::curltr(print_debug(easy_handle))|continued_cf, "curl_multi_remove_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = ");
ret = curl_multi_remove_handle(multi_handle, easy_handle); CURLMcode ret = curl_multi_remove_handle(multi_handle, easy_handle);
if (!print_debug(easy_handle)) return ret; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_multi_remove_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = " << ret);
return ret; return ret;
} }
@@ -945,24 +919,24 @@ CURLMcode debug_curl_multi_setopt(CURLM* multi_handle, CURLMoption option, ...)
switch (param_type) switch (param_type)
{ {
case CURLOPTTYPE_LONG: case CURLOPTTYPE_LONG:
Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", " << param.along << "L) = ");
ret = curl_multi_setopt(multi_handle, option, param.along); ret = curl_multi_setopt(multi_handle, option, param.along);
if (gDebugCurlTerse) break; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", " << param.along << "L) = " << ret);
break; break;
case CURLOPTTYPE_OBJECTPOINT: case CURLOPTTYPE_OBJECTPOINT:
Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (object*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = ");
ret = curl_multi_setopt(multi_handle, option, param.ptr); ret = curl_multi_setopt(multi_handle, option, param.ptr);
if (gDebugCurlTerse) break; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (object*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret);
break; break;
case CURLOPTTYPE_FUNCTIONPOINT: case CURLOPTTYPE_FUNCTIONPOINT:
Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = ");
ret = curl_multi_setopt(multi_handle, option, param.ptr); ret = curl_multi_setopt(multi_handle, option, param.ptr);
if (gDebugCurlTerse) break; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret);
break; break;
case CURLOPTTYPE_OFF_T: case CURLOPTTYPE_OFF_T:
Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (curl_off_t)" << param.offset << ") = ");
ret = curl_multi_setopt(multi_handle, option, param.offset); ret = curl_multi_setopt(multi_handle, option, param.offset);
if (gDebugCurlTerse) break; Dout(dc::finish, ret);
Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (curl_off_t)" << param.offset << ") = " << ret);
break; break;
default: // Stop compiler complaining about no default. default: // Stop compiler complaining about no default.
break; break;
@@ -972,54 +946,47 @@ CURLMcode debug_curl_multi_setopt(CURLM* multi_handle, CURLMoption option, ...)
CURLMcode debug_curl_multi_socket_action(CURLM* multi_handle, curl_socket_t sockfd, int ev_bitmask, int* running_handles) CURLMcode debug_curl_multi_socket_action(CURLM* multi_handle, curl_socket_t sockfd, int ev_bitmask, int* running_handles)
{ {
CURLMcode ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_socket_action(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << ", " << EvBitmask(ev_bitmask) << ", ");
ret = curl_multi_socket_action(multi_handle, sockfd, ev_bitmask, running_handles); CURLMcode ret = curl_multi_socket_action(multi_handle, sockfd, ev_bitmask, running_handles);
if (gDebugCurlTerse) return ret; Dout(dc::finish, "{" << (ret == CURLM_OK ? *running_handles : 0) << "}) = " << ret);
Dout(dc::curltr, "curl_multi_socket_action(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) <<
", " << EvBitmask(ev_bitmask) << ", {" << (ret == CURLM_OK ? *running_handles : 0) << "}) = " << ret);
return ret; return ret;
} }
char const* debug_curl_multi_strerror(CURLMcode errornum) char const* debug_curl_multi_strerror(CURLMcode errornum)
{ {
char const* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_multi_strerror(" << errornum << ") = ");
ret = curl_multi_strerror(errornum); char const* ret = curl_multi_strerror(errornum);
if (gDebugCurlTerse) return ret; Dout(dc::finish, '"' << ret << '"');
Dout(dc::curltr, "curl_multi_strerror(" << errornum << ") = \"" << ret << '"');
return ret; return ret;
} }
struct curl_slist* debug_curl_slist_append(struct curl_slist* list, char const* string) struct curl_slist* debug_curl_slist_append(struct curl_slist* list, char const* string)
{ {
struct curl_slist* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_slist_append((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ", \"" << string << "\") = ");
ret = curl_slist_append(list, string); struct curl_slist* ret = curl_slist_append(list, string);
if (gDebugCurlTerse) return ret; Dout(dc::finish, *ret);
Dout(dc::curltr, "curl_slist_append((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ", \"" << string << "\") = " << *ret);
return ret; return ret;
} }
void debug_curl_slist_free_all(struct curl_slist* list) void debug_curl_slist_free_all(struct curl_slist* list)
{ {
Dout(dc::curltr(!gDebugCurlTerse), "curl_slist_free_all((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ")");
curl_slist_free_all(list); curl_slist_free_all(list);
if (gDebugCurlTerse) return;
Dout(dc::curltr, "curl_slist_free_all((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ")");
} }
char* debug_curl_unescape(char const* url, int length) char* debug_curl_unescape(char const* url, int length)
{ {
char* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_unescape(\"" << url << "\", " << length << ") = ");
ret = curl_unescape(url, length); char* ret = curl_unescape(url, length);
if (gDebugCurlTerse) return ret; Dout(dc::finish, '"' << ret << '"');
Dout(dc::curltr, "curl_unescape(\"" << url << "\", " << length << ") = \"" << ret << '"');
return ret; return ret;
} }
char* debug_curl_version(void) char* debug_curl_version(void)
{ {
char* ret; Dout(dc::curltr(!gDebugCurlTerse)|continued_cf, "curl_version() = ");
ret = curl_version(); char* ret = curl_version();
if (gDebugCurlTerse) return ret; Dout(dc::finish, '"' << ret << '"');
Dout(dc::curltr, "curl_version() = \"" << ret << '"');
return ret; return ret;
} }

View File

@@ -526,7 +526,7 @@ private:
LLSD mResponse; LLSD mResponse;
protected: protected:
/*virtual*/ LLSD const& getLLSD(void) const { llassert(mFinished && mCode == CURLE_OK && mStatus == HTTP_OK); return mResponse; } /*virtual*/ LLSD const& getLLSD(void) const { llassert(mFinished && mCode == CURLE_OK); return mResponse; }
/*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer) /*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
{ {
decode_llsd_body(status, reason, channels, buffer, mResponse); // This puts the body asString() in mResponse in case of http error. decode_llsd_body(status, reason, channels, buffer, mResponse); // This puts the body asString() in mResponse in case of http error.
@@ -539,7 +539,7 @@ private:
std::string mResponse; std::string mResponse;
protected: protected:
/*virtual*/ std::string const& getRaw(void) const { llassert(mFinished && mCode == CURLE_OK && mStatus == HTTP_OK); return mResponse; } /*virtual*/ std::string const& getRaw(void) const { llassert(mFinished && mCode == CURLE_OK); return mResponse; }
/*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer) /*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
{ {
decode_raw_body(mCode, reason, channels, buffer, mResponse); decode_raw_body(mCode, reason, channels, buffer, mResponse);
@@ -636,7 +636,7 @@ static LLSD blocking_request(
response["body"] = responder->getLLSD(); response["body"] = responder->getLLSD();
} }
} }
else if (result == CURLE_OK) else if (result == CURLE_OK && !is_internal_http_error(http_status))
{ {
// We expect 404s, don't spam for them. // We expect 404s, don't spam for them.
if (http_status != 404) if (http_status != 404)

View File

@@ -2,37 +2,32 @@
* @file llfontfreetype.cpp * @file llfontfreetype.cpp
* @brief Freetype font library wrapper * @brief Freetype font library wrapper
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* 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
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * 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 * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#include "linden_common.h" #include "linden_common.h"
#include "llfontfreetype.h" #include "llfontfreetype.h"
#include "llfontgl.h"
// Freetype stuff // Freetype stuff
#include <ft2build.h> #include <ft2build.h>
@@ -103,36 +98,16 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index)
mYBitmapOffset(0), // Offset to the origin in the bitmap mYBitmapOffset(0), // Offset to the origin in the bitmap
mXBearing(0), // Distance from baseline to left in pixels mXBearing(0), // Distance from baseline to left in pixels
mYBearing(0), // Distance from baseline to top in pixels mYBearing(0), // Distance from baseline to top in pixels
mIsRendered(FALSE), mBitmapNum(0) // Which bitmap in the bitmap cache contains this glyph
mMetricsValid(FALSE)
{}
LLFontList::LLFontList()
{ {
} }
LLFontList::~LLFontList()
{
LLFontList::iterator iter;
for(iter = this->begin(); iter != this->end(); iter++)
{
delete *iter;
// The (now dangling) pointers in the vector will be cleaned up when the vector is deleted by the superclass destructor.
}
}
void LLFontList::addAtEnd(LLFontFreetype *font)
{
// Purely a convenience function
this->push_back(font);
}
LLFontFreetype::LLFontFreetype() LLFontFreetype::LLFontFreetype()
: mFontBitmapCachep(new LLFontBitmapCache), : mFontBitmapCachep(new LLFontBitmapCache),
mValid(FALSE), mValid(FALSE),
mAscender(0.f), mAscender(0.f),
mDescender(0.f), mDescender(0.f),
mLineHeight(0.f), mLineHeight(0.f),
mFallbackFontp(NULL),
mIsFallback(FALSE), mIsFallback(FALSE),
mFTFace(NULL), mFTFace(NULL),
mRenderGlyphCount(0), mRenderGlyphCount(0),
@@ -222,8 +197,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, const F32 point_size,
if (!mIsFallback || !sOpenGLcrashOnRestart) // because this often crashes under Linux... if (!mIsFallback || !sOpenGLcrashOnRestart) // because this often crashes under Linux...
{ {
// Add the empty glyph`5 // Add the default glyph
addGlyph(0, 0); addGlyphFromFont(this, 0, 0);
} }
mName = filename; mName = filename;
@@ -232,19 +207,26 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, const F32 point_size,
return TRUE; return TRUE;
} }
//virtual void LLFontFreetype::setFallbackFonts(const font_vector_t &font)
{
mFallbackFonts = font;
}
const LLFontFreetype::font_vector_t &LLFontFreetype::getFallbackFonts() const
{
return mFallbackFonts;
}
F32 LLFontFreetype::getLineHeight() const F32 LLFontFreetype::getLineHeight() const
{ {
return mLineHeight; return mLineHeight;
} }
//virtual
F32 LLFontFreetype::getAscenderHeight() const F32 LLFontFreetype::getAscenderHeight() const
{ {
return mAscender; return mAscender;
} }
//virtual
F32 LLFontFreetype::getDescenderHeight() const F32 LLFontFreetype::getDescenderHeight() const
{ {
return mDescender; return mDescender;
@@ -255,65 +237,18 @@ F32 LLFontFreetype::getXAdvance(const llwchar wch) const
if (mFTFace == NULL) if (mFTFace == NULL)
return 0.0; return 0.0;
llassert(!mIsFallback);
U32 glyph_index;
// Return existing info only if it is current // Return existing info only if it is current
LLFontGlyphInfo* gi = getGlyphInfo(wch); LLFontGlyphInfo* gi = getGlyphInfo(wch);
if (gi && gi->mMetricsValid) if (gi)
{ {
return gi->mXAdvance; return gi->mXAdvance;
} }
const LLFontFreetype* fontp = this;
// Initialize char to glyph map
glyph_index = FT_Get_Char_Index(mFTFace, wch);
if (glyph_index == 0 && mFallbackFontp)
{
LLFontList::iterator iter;
for(iter = mFallbackFontp->begin(); (iter != mFallbackFontp->end()) && (glyph_index == 0); iter++)
{
glyph_index = FT_Get_Char_Index((*iter)->mFTFace, wch);
if(glyph_index)
{
fontp = *iter;
}
}
}
if (glyph_index)
{
// This font has this glyph
fontp->renderGlyph(glyph_index);
// Create the entry if it's not there
char_glyph_info_map_t::iterator iter2 = mCharGlyphInfoMap.find(wch);
if (iter2 == mCharGlyphInfoMap.end())
{
gi = new LLFontGlyphInfo(glyph_index);
insertGlyphInfo(wch, gi);
}
else
{
gi = iter2->second;
}
gi->mWidth = fontp->mFTFace->glyph->bitmap.width;
gi->mHeight = fontp->mFTFace->glyph->bitmap.rows;
// Convert these from 26.6 units to float pixels.
gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f;
gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f;
gi->mMetricsValid = TRUE;
return gi->mXAdvance;
}
else else
{ {
gi = get_if_there(mCharGlyphInfoMap, (llwchar)0, (LLFontGlyphInfo*)NULL); char_glyph_info_map_t::iterator found_it = mCharGlyphInfoMap.find((llwchar)0);
if (gi) if (found_it != mCharGlyphInfoMap.end())
{ {
return gi->mXAdvance; return found_it->second->mXAdvance;
} }
} }
@@ -321,16 +256,24 @@ F32 LLFontFreetype::getXAdvance(const llwchar wch) const
return (F32)mFontBitmapCachep->getMaxCharWidth(); return (F32)mFontBitmapCachep->getMaxCharWidth();
} }
F32 LLFontFreetype::getXKerning(const llwchar char_left, const llwchar char_right) const F32 LLFontFreetype::getXAdvance(const LLFontGlyphInfo* glyph) const
{ {
if (mFTFace == NULL) if (mFTFace == NULL)
return 0.0; return 0.0;
llassert(!mIsFallback); return glyph->mXAdvance;
LLFontGlyphInfo* left_glyph_info = get_if_there(mCharGlyphInfoMap, char_left, (LLFontGlyphInfo*)NULL); }
F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const
{
if (mFTFace == NULL)
return 0.0;
//llassert(!mIsFallback);
LLFontGlyphInfo* left_glyph_info = getGlyphInfo(char_left);;
U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0; U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0;
// Kern this puppy. // Kern this puppy.
LLFontGlyphInfo* right_glyph_info = get_if_there(mCharGlyphInfoMap, char_right, (LLFontGlyphInfo*)NULL); LLFontGlyphInfo* right_glyph_info = getGlyphInfo(char_right);
U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0; U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0;
FT_Vector delta; FT_Vector delta;
@@ -340,21 +283,28 @@ F32 LLFontFreetype::getXKerning(const llwchar char_left, const llwchar char_righ
return delta.x*(1.f/64.f); return delta.x*(1.f/64.f);
} }
BOOL LLFontFreetype::hasGlyph(const llwchar wch) const F32 LLFontFreetype::getXKerning(const LLFontGlyphInfo* left_glyph_info, const LLFontGlyphInfo* right_glyph_info) const
{ {
llassert(!mIsFallback); if (mFTFace == NULL)
const LLFontGlyphInfo* gi = getGlyphInfo(wch); return 0.0;
if (gi && gi->mIsRendered)
{ U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0;
return TRUE; U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0;
}
else FT_Vector delta;
{
return FALSE; llverify(!FT_Get_Kerning(mFTFace, left_glyph, right_glyph, ft_kerning_unfitted, &delta));
}
return delta.x*(1.f/64.f);
} }
BOOL LLFontFreetype::addChar(const llwchar wch) const BOOL LLFontFreetype::hasGlyph(llwchar wch) const
{
llassert(!mIsFallback);
return(mCharGlyphInfoMap.find(wch) != mCharGlyphInfoMap.end());
}
LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch) const
{ {
if (mFTFace == NULL) if (mFTFace == NULL)
return FALSE; return FALSE;
@@ -368,36 +318,30 @@ BOOL LLFontFreetype::addChar(const llwchar wch) const
glyph_index = FT_Get_Char_Index(mFTFace, wch); glyph_index = FT_Get_Char_Index(mFTFace, wch);
if (glyph_index == 0) if (glyph_index == 0)
{ {
// Try looking it up in the backup Unicode font //llinfos << "Trying to add glyph from fallback font!" << llendl;
if (mFallbackFontp) font_vector_t::const_iterator iter;
for(iter = mFallbackFonts.begin(); iter != mFallbackFonts.end(); iter++)
{ {
//llinfos << "Trying to add glyph from fallback font!" << llendl; glyph_index = FT_Get_Char_Index((*iter)->mFTFace, wch);
LLFontList::iterator iter; if (glyph_index)
for(iter = mFallbackFontp->begin(); iter != mFallbackFontp->end(); iter++)
{ {
glyph_index = FT_Get_Char_Index((*iter)->mFTFace, wch); return addGlyphFromFont(*iter, wch, glyph_index);
if (glyph_index)
{
addGlyphFromFont(*iter, wch, glyph_index);
return TRUE;
}
} }
} }
} }
char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch); char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch);
if (iter == mCharGlyphInfoMap.end() || !(iter->second->mIsRendered)) if (iter == mCharGlyphInfoMap.end())
{ {
BOOL result = addGlyph(wch, glyph_index); return addGlyphFromFont(this, wch, glyph_index);
return result;
} }
return FALSE; return NULL;
} }
BOOL LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, const llwchar wch, const U32 glyph_index) const LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index) const
{ {
if (mFTFace == NULL) if (mFTFace == NULL)
return FALSE; return NULL;
//llassert(!mIsFallback); //llassert(!mIsFallback);
fontp->renderGlyph(glyph_index); fontp->renderGlyph(glyph_index);
@@ -420,8 +364,6 @@ BOOL LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, const llwchar
// Convert these from 26.6 units to float pixels. // Convert these from 26.6 units to float pixels.
gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f; gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f;
gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f; gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f;
gi->mIsRendered = TRUE;
gi->mMetricsValid = TRUE;
insertGlyphInfo(wch, gi); insertGlyphInfo(wch, gi);
@@ -492,17 +434,25 @@ BOOL LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, const llwchar
// omit it from the font-image. // omit it from the font-image.
} }
return TRUE; LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num);
LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
return gi;
} }
LLFontGlyphInfo* LLFontFreetype::getGlyphInfo(const llwchar wch) const LLFontGlyphInfo* LLFontFreetype::getGlyphInfo(llwchar wch) const
{ {
char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch); char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch);
if (iter != mCharGlyphInfoMap.end()) if (iter != mCharGlyphInfoMap.end())
{ {
return iter->second; return iter->second;
} }
return NULL; else
{
// this glyph doesn't yet exist, so render it and return the result
return addGlyph(wch);
}
} }
void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const
@@ -519,11 +469,6 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const
} }
} }
BOOL LLFontFreetype::addGlyph(const llwchar wch, const U32 glyph_index) const
{
return addGlyphFromFont(this, wch, glyph_index);
}
void LLFontFreetype::renderGlyph(const U32 glyph_index) const void LLFontFreetype::renderGlyph(const U32 glyph_index) const
{ {
if (mFTFace == NULL) if (mFTFace == NULL)
@@ -536,34 +481,62 @@ void LLFontFreetype::renderGlyph(const U32 glyph_index) const
mRenderGlyphCount++; mRenderGlyphCount++;
} }
void LLFontFreetype::resetBitmapCache() void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi)
{ {
// Iterate through glyphs and clear the mIsRendered flag resetBitmapCache();
for (char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.begin(); loadFace(mName,mPointSize,vert_dpi,horz_dpi,mFontBitmapCachep->getNumComponents(),mIsFallback);
iter != mCharGlyphInfoMap.end(); ++iter) if (!mIsFallback)
{ {
iter->second->mIsRendered = FALSE; // This is the head of the list - need to rebuild ourself and all fallbacks.
//FIXME: this is only strictly necessary when resetting the entire font, //loadFace(mName,mPointSize,vert_dpi,horz_dpi,mFontBitmapCachep->getNumComponents(),mIsFallback);
//not just flushing the bitmap if (mFallbackFonts.empty())
iter->second->mMetricsValid = FALSE; {
} llwarns << "LLFontGL::reset(), no fallback fonts present" << llendl;
mFontBitmapCachep->reset(); }
else
if (!mIsFallback || !sOpenGLcrashOnRestart) // because this often crashes under Linux... {
{ for(font_vector_t::iterator it = mFallbackFonts.begin();
// Add the empty glyph`5 it != mFallbackFonts.end();
addGlyph(0, 0); ++it)
{
(*it)->reset(vert_dpi, horz_dpi);
}
}
} }
} }
void LLFontFreetype::resetBitmapCache()
{
for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer());
mCharGlyphInfoMap.clear();
void LLFontFreetype::setSubImageLuminanceAlpha(const U32 x, mFontBitmapCachep->reset();
const U32 y,
const U32 bitmap_num, // Adding default glyph is skipped for fallback fonts here as well as in loadFace().
const U32 width, // This if was added as fix for EXT-4971.
const U32 height, if (!mIsFallback || !sOpenGLcrashOnRestart) // because this often crashes under Linux...
const U8 *data, {
S32 stride) const // Add the empty glyph
addGlyphFromFont(this, 0, 0);
}
}
void LLFontFreetype::destroyGL()
{
mFontBitmapCachep->destroyGL();
}
const std::string &LLFontFreetype::getName() const
{
return mName;
}
const LLPointer<LLFontBitmapCache> LLFontFreetype::getFontBitmapCache() const
{
return mFontBitmapCachep;
}
void LLFontFreetype::setSubImageLuminanceAlpha(const U32 x, const U32 y, const U32 bitmap_num, const U32 width, const U32 height, const U8 *data, S32 stride) const
{ {
LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);

View File

@@ -1,40 +1,34 @@
/** /**
* @file llfont.h * @file llfontfreetype.h
* @brief Font library wrapper * @brief Font library wrapper
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* 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
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * 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 * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#ifndef LL_LLFONTFREETYPE_H #ifndef LL_LLFONTFREETYPE_H
#define LL_LLFONTFREETYPE_H #define LL_LLFONTFREETYPE_H
#include <map> #include <boost/unordered_map.hpp>
#include "llmemory.h" #include "llpointer.h"
#include "llstl.h" #include "llstl.h"
#include "llimagegl.h" #include "llimagegl.h"
@@ -51,34 +45,30 @@ class LLFontFreetype;
struct FT_FaceRec_; struct FT_FaceRec_;
typedef struct FT_FaceRec_* LLFT_Face; typedef struct FT_FaceRec_* LLFT_Face;
extern LLFontManager *gFontManagerp;
class LLFontManager class LLFontManager
{ {
public: public:
static void initClass(); static void initClass();
static void cleanupClass(); static void cleanupClass();
public: private:
LLFontManager(); LLFontManager();
virtual ~LLFontManager(); ~LLFontManager();
}; };
class LLFontGlyphInfo struct LLFontGlyphInfo
{ {
public:
LLFontGlyphInfo(U32 index); LLFontGlyphInfo(U32 index);
public:
U32 mGlyphIndex; U32 mGlyphIndex;
// Metrics // Metrics
S32 mWidth; // In pixels S32 mWidth; // In pixels
S32 mHeight; // In pixels S32 mHeight; // In pixels
F32 mXAdvance; // In pixels F32 mXAdvance; // In pixels
F32 mYAdvance; // In pixels F32 mYAdvance; // In pixels
BOOL mMetricsValid; // We have up-to-date metrics for this glyph
// Information for actually rendering // Information for actually rendering
BOOL mIsRendered; // We actually have rendered this glyph
S32 mXBitmapOffset; // Offset to the origin in the bitmap S32 mXBitmapOffset; // Offset to the origin in the bitmap
S32 mYBitmapOffset; // Offset to the origin in the bitmap S32 mYBitmapOffset; // Offset to the origin in the bitmap
S32 mXBearing; // Distance from baseline to left in pixels S32 mXBearing; // Distance from baseline to left in pixels
@@ -86,37 +76,29 @@ public:
S32 mBitmapNum; // Which bitmap in the bitmap cache contains this glyph S32 mBitmapNum; // Which bitmap in the bitmap cache contains this glyph
}; };
// Used for lists of fallback fonts extern LLFontManager *gFontManagerp;
class LLFontList : public std::vector<LLFontFreetype*>
{
public:
LLFontList();
~LLFontList();
void addAtEnd(LLFontFreetype *font);
};
class LLFontFreetype class LLFontFreetype : public LLRefCount
{ {
public: public:
LLFontFreetype(); LLFontFreetype();
virtual ~LLFontFreetype(); ~LLFontFreetype();
// is_fallback should be true for fallback fonts that aren't used // is_fallback should be true for fallback fonts that aren't used
// to render directly (Unicode backup, primarily) // to render directly (Unicode backup, primarily)
virtual BOOL loadFace(const std::string& filename, BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback);
const F32 point_size,
const F32 vert_dpi, typedef std::vector<LLPointer<LLFontFreetype> > font_vector_t;
const F32 horz_dpi,
const S32 components, void setFallbackFonts(const font_vector_t &font);
BOOL is_fallback); const font_vector_t &getFallbackFonts() const;
void setFallbackFont(LLFontList *fontp) { mFallbackFontp = fontp; }
void setCharToGlyphMap(llwchar wch, U32 glyph_index) const; void setCharToGlyphMap(llwchar wch, U32 glyph_index) const;
// Global font metrics - in units of pixels // Global font metrics - in units of pixels
virtual F32 getLineHeight() const; F32 getLineHeight() const;
virtual F32 getAscenderHeight() const; F32 getAscenderHeight() const;
virtual F32 getDescenderHeight() const; F32 getDescenderHeight() const;
// For a lowercase "g": // For a lowercase "g":
@@ -145,51 +127,50 @@ public:
LAST_CHAR_FULL = 255 LAST_CHAR_FULL = 255
}; };
const LLFontGlyphInfo &getMetrics(const llwchar wc) const; F32 getXAdvance(llwchar wc) const;
F32 getXAdvance(const llwchar wc) const; F32 getXAdvance(const LLFontGlyphInfo* glyph) const;
F32 getXKerning(const llwchar char_left, const llwchar char_right) const; // Get the kerning between the two characters F32 getXKerning(llwchar char_left, llwchar char_right) const; // Get the kerning between the two characters
virtual void reset() = 0; F32 getXKerning(const LLFontGlyphInfo* left_glyph_info, const LLFontGlyphInfo* right_glyph_info) const; // Get the kerning between the two characters
LLFontGlyphInfo* getGlyphInfo(const llwchar wch) const;
void reset(F32 vert_dpi, F32 horz_dpi);
void destroyGL();
const std::string& getName() const;
const LLPointer<LLFontBitmapCache> getFontBitmapCache() const;
static bool sOpenGLcrashOnRestart; static bool sOpenGLcrashOnRestart;
protected: private:
virtual BOOL hasGlyph(const llwchar wch) const; // Has a glyph for this character
virtual BOOL addChar(const llwchar wch) const; // Add a new character to the font if necessary
virtual BOOL addGlyph(const llwchar wch, const U32 glyph_index) const; // Add a new glyph to the existing font
virtual BOOL addGlyphFromFont(const LLFontFreetype *fontp, const llwchar wch, const U32 glyph_index) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found)
virtual LLFontGlyphInfo* getGlyphInfo(const llwchar wch) const;
void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const;
void renderGlyph(const U32 glyph_index) const;
void resetBitmapCache(); void resetBitmapCache();
void setSubImageLuminanceAlpha(const U32 x, const U32 y, const U32 bitmap_num, const U32 width, const U32 height, const U8 *data, S32 stride = 0) const;
BOOL hasGlyph(llwchar wch) const; // Has a glyph for this character
LLFontGlyphInfo* addGlyph(llwchar wch) const; // Add a new character to the font if necessary
LLFontGlyphInfo* addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found)
void renderGlyph(U32 glyph_index) const;
void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const;
protected:
std::string mName; std::string mName;
F32 mPointSize; F32 mPointSize;
F32 mAscender; F32 mAscender;
F32 mDescender; F32 mDescender;
F32 mLineHeight; F32 mLineHeight;
mutable LLPointer<LLFontBitmapCache> mFontBitmapCachep;
LLFT_Face mFTFace; LLFT_Face mFTFace;
BOOL mIsFallback; BOOL mIsFallback;
LLFontList *mFallbackFontp; // A list of fallback fonts to look for glyphs in (for Unicode chars) font_vector_t mFallbackFonts; // A list of fallback fonts to look for glyphs in (for Unicode chars)
typedef std::map<llwchar, LLFontGlyphInfo*> char_glyph_info_map_t;
mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap
BOOL mValid; BOOL mValid;
void setSubImageLuminanceAlpha(const U32 x,
const U32 y, typedef boost::unordered_map<llwchar, LLFontGlyphInfo*> char_glyph_info_map_t;
const U32 bitmap_num, mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap
const U32 width,
const U32 height, mutable LLPointer<LLFontBitmapCache> mFontBitmapCachep;
const U8 *data,
S32 stride = 0) const;
mutable S32 mRenderGlyphCount; mutable S32 mRenderGlyphCount;
mutable S32 mAddGlyphCount; mutable S32 mAddGlyphCount;
}; };

View File

@@ -84,7 +84,6 @@ F32 llfont_round_y(F32 y)
} }
LLFontGL::LLFontGL() LLFontGL::LLFontGL()
: LLFontFreetype()
{ {
clearEmbeddedChars(); clearEmbeddedChars();
} }
@@ -96,66 +95,22 @@ LLFontGL::~LLFontGL()
void LLFontGL::reset() void LLFontGL::reset()
{ {
if (!mIsFallback) mFontFreetype->reset(sVertDPI, sHorizDPI);
{
// This is the head of the list - need to rebuild ourself and all fallbacks.
loadFace(mName,mPointSize,sVertDPI,sHorizDPI,mFontBitmapCachep->getNumComponents(),mIsFallback);
if (mFallbackFontp==NULL)
{
llwarns << "LLFontGL::reset(), no fallback fonts present" << llendl;
}
else
{
for (LLFontList::iterator it = mFallbackFontp->begin();
it != mFallbackFontp->end();
++it)
{
(*it)->reset();
}
}
}
resetBitmapCache();
} }
bool findOrCreateFont(LLFontGL*& fontp, const LLFontDescriptor& desc)
{
// Don't delete existing fonts, if any, here, because they've
// already been deleted by LLFontRegistry::clear()
fontp = LLFontGL::getFont(desc);
return (fontp != NULL);
}
void LLFontGL::destroyGL() void LLFontGL::destroyGL()
{ {
mFontBitmapCachep->destroyGL(); mFontFreetype->destroyGL();
} }
BOOL LLFontGL::loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback) BOOL LLFontGL::loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback)
{ {
if (!LLFontFreetype::loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback)) if(mFontFreetype == reinterpret_cast<LLFontFreetype*>(NULL))
{ {
return FALSE; mFontFreetype = new LLFontFreetype;
}
return TRUE;
}
BOOL LLFontGL::addChar(const llwchar wch) const
{
if (!LLFontFreetype::addChar(wch))
{
return FALSE;
} }
stop_glerror(); return mFontFreetype->loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback);
LLFontGlyphInfo *glyph_info = getGlyphInfo(wch);
U32 bitmap_num = glyph_info->mBitmapNum;
LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num);
LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
return TRUE;
} }
static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts"); static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts");
@@ -195,7 +150,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
return wstr.length() ; return wstr.length() ;
} }
if (wstr.empty()) if (wstr.empty() || !max_pixels)
{ {
return 0; return 0;
} }
@@ -255,13 +210,13 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
switch (valign) switch (valign)
{ {
case TOP: case TOP:
cur_y -= llceil(mAscender); cur_y -= llceil(mFontFreetype->getAscenderHeight());
break; break;
case BOTTOM: case BOTTOM:
cur_y += llceil(mDescender); cur_y += llceil(mFontFreetype->getDescenderHeight());
break; break;
case VCENTER: case VCENTER:
cur_y -= llceil((llceil(mAscender) - llceil(mDescender))/2.f); cur_y -= llceil((llceil(mFontFreetype->getAscenderHeight()) - llceil(mFontFreetype->getDescenderHeight())) / 2.f);
break; break;
case BASELINE: case BASELINE:
// Baseline, do nothing. // Baseline, do nothing.
@@ -289,7 +244,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
F32 start_x = (F32)llround(cur_x); F32 start_x = (F32)llround(cur_x);
const LLFontBitmapCache* font_bitmap_cache = mFontBitmapCachep; const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();
F32 inv_width = 1.f / font_bitmap_cache->getBitmapWidth(); F32 inv_width = 1.f / font_bitmap_cache->getBitmapWidth();
F32 inv_height = 1.f / font_bitmap_cache->getBitmapHeight(); F32 inv_height = 1.f / font_bitmap_cache->getBitmapHeight();
@@ -311,10 +266,17 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
} }
} }
const LLFontGlyphInfo* next_glyph = NULL;
// Remember last-used texture to avoid unnecesssary bind calls. const S32 GLYPH_BATCH_SIZE = 30;
LLImageGL *last_bound_texture = NULL; static LL_ALIGN_16(LLVector4a vertices[GLYPH_BATCH_SIZE * 4]);
static LLVector2 uvs[GLYPH_BATCH_SIZE * 4];
static LLColor4U colors[GLYPH_BATCH_SIZE * 4];
LLColor4U text_color(color);
S32 bitmap_num = -1;
S32 glyph_count = 0;
for (i = begin_offset; i < begin_offset + length; i++) for (i = begin_offset; i < begin_offset + length; i++)
{ {
llwchar wch = wstr[i]; llwchar wch = wstr[i];
@@ -343,19 +305,31 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
break; break;
} }
if (last_bound_texture != ext_image) gGL.getTexUnit(0)->bind(ext_image);
{
gGL.getTexUnit(0)->bind(ext_image);
last_bound_texture = ext_image;
}
// snap origin to whole screen pixel // snap origin to whole screen pixel
const F32 ext_x = (F32)llround(cur_render_x + (EXT_X_BEARING * sScaleX)); const F32 ext_x = (F32)llround(cur_render_x + (EXT_X_BEARING * sScaleX));
const F32 ext_y = (F32)llround(cur_render_y + (EXT_Y_BEARING * sScaleY + mAscender - mLineHeight)); const F32 ext_y = (F32)llround(cur_render_y + (EXT_Y_BEARING * sScaleY + mFontFreetype->getAscenderHeight() - mFontFreetype->getLineHeight()));
LLRectf uv_rect(0.f, 1.f, 1.f, 0.f); LLRectf uv_rect(0.f, 1.f, 1.f, 0.f);
LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y); LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y);
drawGlyph(screen_rect, uv_rect, LLColor4::white, style, shadow, drop_shadow_strength);
if (glyph_count > 0)
{
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
}
gGL.end();
glyph_count = 0;
}
renderQuad(vertices, uvs, colors, screen_rect, uv_rect, LLColor4U::white, 0);
//No batching here. It will never happen.
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, 4);
}
gGL.end();
if (!label.empty()) if (!label.empty())
{ {
@@ -364,13 +338,11 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
/*llfloor*/(ext_x / sScaleX) + ext_image->getWidth() + EXT_X_BEARING - sCurOrigin.mX, /*llfloor*/(ext_x / sScaleX) + ext_image->getWidth() + EXT_X_BEARING - sCurOrigin.mX,
/*llfloor*/(cur_render_y / sScaleY) - sCurOrigin.mY, /*llfloor*/(cur_render_y / sScaleY) - sCurOrigin.mY,
color, color,
halign, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL, halign, BASELINE, UNDERLINE, NO_SHADOW, S32_MAX, S32_MAX, NULL,
TRUE ); TRUE );
gGL.popMatrix(); gGL.popMatrix();
} }
gGL.color4fv(color.mV);
chars_drawn++; chars_drawn++;
cur_x += ext_advance; cur_x += ext_advance;
if (((i + 1) < length) && wstr[i+1]) if (((i + 1) < length) && wstr[i+1])
@@ -381,23 +353,36 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
} }
else else
{ {
if (!hasGlyph(wch)) const LLFontGlyphInfo* fgi = next_glyph;
next_glyph = NULL;
if(!fgi)
{ {
addChar(wch); fgi = mFontFreetype->getGlyphInfo(wch);
} }
const LLFontGlyphInfo* fgi= getGlyphInfo(wch);
if (!fgi) if (!fgi)
{ {
llerrs << "Missing Glyph Info" << llendl; llerrs << "Missing Glyph Info" << llendl;
break; break;
} }
// Per-glyph bitmap texture. // Per-glyph bitmap texture.
LLImageGL *image_gl = mFontBitmapCachep->getImageGL(fgi->mBitmapNum); S32 next_bitmap_num = fgi->mBitmapNum;
if (last_bound_texture != image_gl) if (next_bitmap_num != bitmap_num)
{ {
gGL.getTexUnit(0)->bind(image_gl); // Actually draw the queued glyphs before switching their texture;
last_bound_texture = image_gl; // otherwise the queued glyphs will be taken from wrong textures.
if (glyph_count > 0)
{
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
}
gGL.end();
glyph_count = 0;
}
bitmap_num = next_bitmap_num;
LLImageGL *font_image = font_bitmap_cache->getImageGL(bitmap_num);
gGL.getTexUnit(0)->bind(font_image);
} }
if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth)) if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth))
@@ -412,13 +397,24 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
(fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height, (fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height,
(fgi->mXBitmapOffset + fgi->mWidth) * inv_width, (fgi->mXBitmapOffset + fgi->mWidth) * inv_width,
(fgi->mYBitmapOffset - PAD_UVY) * inv_height); (fgi->mYBitmapOffset - PAD_UVY) * inv_height);
// snap glyph origin to whole screen pixel // snap glyph origin to whole screen pixel
LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing), LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing),
(F32)llround(cur_render_y + (F32)fgi->mYBearing), (F32)llround(cur_render_y + (F32)fgi->mYBearing),
(F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, (F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
(F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); (F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
drawGlyph(screen_rect, uv_rect, color, style, shadow, drop_shadow_strength); if (glyph_count >= GLYPH_BATCH_SIZE)
{
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
}
gGL.end();
glyph_count = 0;
}
drawGlyph(glyph_count, vertices, uvs, colors, screen_rect, uv_rect, text_color, style, shadow, drop_shadow_strength);
chars_drawn++; chars_drawn++;
cur_x += fgi->mXAdvance; cur_x += fgi->mXAdvance;
@@ -428,11 +424,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (next_char && (next_char < LAST_CHARACTER)) if (next_char && (next_char < LAST_CHARACTER))
{ {
// Kern this puppy. // Kern this puppy.
if (!hasGlyph(next_char)) next_glyph = mFontFreetype->getGlyphInfo(next_char);
{ cur_x += mFontFreetype->getXKerning(fgi, next_glyph);
addChar(next_char);
}
cur_x += getXKerning(wch, next_char);
} }
// Round after kerning. // Round after kerning.
@@ -447,6 +440,16 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
} }
} }
if(glyph_count)
{
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
}
gGL.end();
}
if (right_x) if (right_x)
{ {
*right_x = (cur_x - origin.mV[VX]) / sScaleX; *right_x = (cur_x - origin.mV[VX]) / sScaleX;
@@ -454,7 +457,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (style & UNDERLINE) if (style & UNDERLINE)
{ {
F32 descender = (F32)llfloor(mDescender); F32 descender = (F32)llfloor(mFontFreetype->getDescenderHeight());
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.begin(LLRender::LINES); gGL.begin(LLRender::LINES);
@@ -507,6 +510,22 @@ S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y
return renderUTF8(text, begin_offset, (F32)x, (F32)y, color, halign, valign, style, shadow, S32_MAX, S32_MAX, NULL, FALSE); return renderUTF8(text, begin_offset, (F32)x, (F32)y, color, halign, valign, style, shadow, S32_MAX, S32_MAX, NULL, FALSE);
} }
// font metrics - override for LLFontFreetype that returns units of virtual pixels
F32 LLFontGL::getAscenderHeight() const
{
return mFontFreetype->getAscenderHeight() / sScaleY;
}
F32 LLFontGL::getDescenderHeight() const
{
return mFontFreetype->getDescenderHeight() / sScaleY;
}
F32 LLFontGL::getLineHeight() const
{
return (F32)llround(mFontFreetype->getLineHeight() / sScaleY);
}
S32 LLFontGL::getWidth(const std::string& utf8text) const S32 LLFontGL::getWidth(const std::string& utf8text) const
{ {
LLWString wtext = utf8str_to_wstring(utf8text); LLWString wtext = utf8str_to_wstring(utf8text);
@@ -553,13 +572,13 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S
F32 cur_x = 0; F32 cur_x = 0;
const S32 max_index = begin_offset + max_chars; const S32 max_index = begin_offset + max_chars;
for (S32 i = begin_offset; i < max_index; i++)
const LLFontGlyphInfo* next_glyph = NULL;
F32 width_padding = 0.f;
for (S32 i = begin_offset; i < max_index && wchars[i] != 0; i++)
{ {
const llwchar wch = wchars[i]; const llwchar wch = wchars[i];
if (wch == 0)
{
break; // done
}
const embedded_data_t* ext_data = use_embedded ? getEmbeddedCharData(wch) : NULL; const embedded_data_t* ext_data = use_embedded ? getEmbeddedCharData(wch) : NULL;
if (ext_data) if (ext_data)
{ {
@@ -573,7 +592,23 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S
} }
else else
{ {
cur_x += getXAdvance(wch); const LLFontGlyphInfo* fgi = next_glyph;
next_glyph = NULL;
if(!fgi)
{
fgi = mFontFreetype->getGlyphInfo(wch);
}
F32 advance = mFontFreetype->getXAdvance(fgi);
// for the last character we want to measure the greater of its width and xadvance values
// so keep track of the difference between these values for the each character we measure
// so we can fix things up at the end
width_padding = llmax( 0.f, // always use positive padding amount
width_padding - advance, // previous padding left over after advance of current character
(F32)(fgi->mWidth + fgi->mXBearing) - advance); // difference between width of this character and advance to next character
cur_x += advance;
llwchar next_char = wchars[i+1]; llwchar next_char = wchars[i+1];
if (((i + 1) < begin_offset + max_chars) if (((i + 1) < begin_offset + max_chars)
@@ -581,13 +616,17 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S
&& (next_char < LAST_CHARACTER)) && (next_char < LAST_CHARACTER))
{ {
// Kern this puppy. // Kern this puppy.
cur_x += getXKerning(wch, next_char); next_glyph = mFontFreetype->getGlyphInfo(next_char);
cur_x += mFontFreetype->getXKerning(fgi, next_glyph);
} }
// Round after kerning.
cur_x = (F32)llround(cur_x);
} }
// Round after kerning.
cur_x = (F32)llround(cur_x);
} }
// add in extra pixels for last character's width past its xadvance
cur_x += width_padding;
return cur_x / sScaleX; return cur_x / sScaleX;
} }
@@ -616,7 +655,11 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
S32 start_of_last_word = 0; S32 start_of_last_word = 0;
BOOL in_word = FALSE; BOOL in_word = FALSE;
F32 scaled_max_pixels = (F32)llceil(max_pixels * sScaleX); // avoid S32 overflow when max_pixels == S32_MAX by staying in floating point
F32 scaled_max_pixels = max_pixels * sScaleX;
F32 width_padding = 0.f;
LLFontGlyphInfo* next_glyph = NULL;
S32 i; S32 i;
for (i=0; (i < max_chars); i++) for (i=0; (i < max_chars); i++)
@@ -677,9 +720,22 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
} }
} }
cur_x += getXAdvance(wch); LLFontGlyphInfo* fgi = next_glyph;
next_glyph = NULL;
if(!fgi)
{
fgi = mFontFreetype->getGlyphInfo(wch);
}
if (scaled_max_pixels < cur_x) // account for glyphs that run beyond the starting point for the next glyphs
width_padding = llmax( 0.f, // always use positive padding amount
width_padding - fgi->mXAdvance, // previous padding left over after advance of current character
(F32)(fgi->mWidth + fgi->mXBearing) - fgi->mXAdvance); // difference between width of this character and advance to next character
cur_x += fgi->mXAdvance;
// clip if current character runs past scaled_max_pixels (using width_padding)
if (scaled_max_pixels < cur_x + width_padding)
{ {
clip = TRUE; clip = TRUE;
break; break;
@@ -688,7 +744,8 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
if (((i+1) < max_chars) && wchars[i+1]) if (((i+1) < max_chars) && wchars[i+1])
{ {
// Kern this puppy. // Kern this puppy.
cur_x += getXKerning(wch, wchars[i+1]); next_glyph = mFontFreetype->getGlyphInfo(wchars[i+1]);
cur_x += mFontFreetype->getXKerning(fgi, next_glyph);
} }
} }
// Round after kerning. // Round after kerning.
@@ -743,14 +800,29 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_
llwchar wch = wchars[i]; llwchar wch = wchars[i];
const embedded_data_t* ext_data = getEmbeddedCharData(wch); const embedded_data_t* ext_data = getEmbeddedCharData(wch);
F32 char_width = ext_data ? getEmbeddedCharAdvance(ext_data) : getXAdvance(wch); F32 width = 0;
if( scaled_max_pixels < (total_width + char_width) ) if(ext_data)
{
width = getEmbeddedCharAdvance(ext_data);
}
else
{
const LLFontGlyphInfo* fgi= mFontFreetype->getGlyphInfo(wch);
// last character uses character width, since the whole character needs to be visible
// other characters just use advance
width = (i == start)
? (F32)(fgi->mWidth + fgi->mXBearing) // use actual width for last character
: fgi->mXAdvance; // use advance for all other characters
}
if( scaled_max_pixels < (total_width + width) )
{ {
break; break;
} }
total_width += char_width; total_width += width;
drawable_chars++; drawable_chars++;
if( max_chars >= 0 && drawable_chars >= max_chars ) if( max_chars >= 0 && drawable_chars >= max_chars )
@@ -761,14 +833,24 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_
if ( i > 0 ) if ( i > 0 )
{ {
// kerning // kerning
total_width += ext_data ? (EXT_KERNING * sScaleX) : getXKerning(wchars[i-1], wch); total_width += ext_data ? (EXT_KERNING * sScaleX) : mFontFreetype->getXKerning(wchars[i-1], wch);
} }
// Round after kerning. // Round after kerning.
total_width = llround(total_width); total_width = (F32)llround(total_width);
}
if (drawable_chars == 0)
{
return start_pos; // just draw last character
}
else
{
// if only 1 character is drawable, we want to return start_pos as the first character to draw
// if 2 are drawable, return start_pos and character before start_pos, etc.
return start_pos + 1 - drawable_chars;
} }
return start_pos - drawable_chars;
} }
@@ -780,7 +862,6 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, const S32 begin_offset,
} }
F32 cur_x = 0; F32 cur_x = 0;
S32 pos = 0;
target_x *= sScaleX; target_x *= sScaleX;
@@ -789,93 +870,76 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, const S32 begin_offset,
F32 scaled_max_pixels = max_pixels * sScaleX; F32 scaled_max_pixels = max_pixels * sScaleX;
for (S32 i = begin_offset; (i < max_index); i++) const LLFontGlyphInfo* next_glyph = NULL;
S32 pos;
for (pos = begin_offset; pos < max_index; pos++)
{ {
llwchar wch = wchars[i]; llwchar wch = wchars[pos];
if (!wch) if (!wch)
{ {
break; // done break; // done
} }
const embedded_data_t* ext_data = use_embedded ? getEmbeddedCharData(wch) : NULL; const embedded_data_t* ext_data = use_embedded ? getEmbeddedCharData(wch) : NULL;
if (ext_data) const LLFontGlyphInfo* glyph = next_glyph;
next_glyph = NULL;
if(!glyph && !ext_data)
{ {
F32 ext_advance = getEmbeddedCharAdvance(ext_data); glyph = mFontFreetype->getGlyphInfo(wch);
}
if (round) F32 char_width = ext_data ? getEmbeddedCharAdvance(ext_data) : mFontFreetype->getXAdvance(glyph);
{
// Note: if the mouse is on the left half of the character, the pick is to the character's left
// If it's on the right half, the pick is to the right.
if (target_x < cur_x + ext_advance/2)
{
break;
}
}
else
{
if (target_x < cur_x + ext_advance)
{
break;
}
}
if (scaled_max_pixels < cur_x + ext_advance) if (round)
{
// Note: if the mouse is on the left half of the character, the pick is to the character's left
// If it's on the right half, the pick is to the right.
if (target_x < cur_x + char_width*0.5f)
{ {
break; break;
} }
}
else if (target_x < cur_x + char_width)
{
break;
}
pos++; if (scaled_max_pixels < cur_x + char_width)
cur_x += ext_advance; {
break;
}
if (((i + 1) < max_index) cur_x += char_width;
&& (wchars[(i + 1)]))
if (((pos + 1) < max_index)
&& (wchars[(pos + 1)]))
{
if(ext_data)
{ {
cur_x += EXT_KERNING * sScaleX; cur_x += EXT_KERNING * sScaleX;
} }
// Round after kerning. else
cur_x = (F32)llfloor(cur_x + 0.5f); {
next_glyph = mFontFreetype->getGlyphInfo(wchars[pos + 1]);
cur_x += mFontFreetype->getXKerning(glyph, next_glyph);
}
} }
else
{
F32 char_width = getXAdvance(wch);
if (round)
{
// Note: if the mouse is on the left half of the character, the pick is to the character's left
// If it's on the right half, the pick is to the right.
if (target_x < cur_x + char_width*0.5f)
{
break;
}
}
else if (target_x < cur_x + char_width)
{
break;
}
if (scaled_max_pixels < cur_x + char_width) // Round after kerning.
{ cur_x = (F32)llround(cur_x);
break;
}
pos++;
cur_x += char_width;
if (((i + 1) < max_index)
&& (wchars[(i + 1)]))
{
llwchar next_char = wchars[i + 1];
// Kern this puppy.
cur_x += getXKerning(wch, next_char);
}
// Round after kerning.
cur_x = (F32)llround(cur_x);
}
} }
return pos; return llmin(max_chars, pos - begin_offset);
} }
const LLFontDescriptor& LLFontGL::getFontDesc() const
{
return mFontDescriptor;
}
const LLFontGL::embedded_data_t* LLFontGL::getEmbeddedCharData(const llwchar wch) const const LLFontGL::embedded_data_t* LLFontGL::getEmbeddedCharData(const llwchar wch) const
{ {
@@ -1041,9 +1105,11 @@ std::string LLFontGL::getStringFromStyle(U8 style)
} }
return style_string; return style_string;
} }
// static
std::string LLFontGL::nameFromFont(const LLFontGL* fontp) std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
{ {
return fontp->getFontDesc().getName(); return fontp->mFontDescriptor.getName();
} }
@@ -1269,95 +1335,95 @@ LLFontGL &LLFontGL::operator=(const LLFontGL &source)
return *this; return *this;
} }
void LLFontGL::renderQuad(const LLRectf& screen_rect, const LLRectf& uv_rect, F32 slant_amt) const void LLFontGL::renderQuad(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const
{ {
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); S32 index = 0;
gGL.vertex2f(llfont_round_x(screen_rect.mRight),
llfont_round_y(screen_rect.mTop));
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
gGL.vertex2f(llfont_round_x(screen_rect.mLeft), uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
llfont_round_y(screen_rect.mTop)); colors_out[index] = color;
index++;
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); vertex_out[index].set(screen_rect.mLeft, screen_rect.mTop, 0.f);
gGL.vertex2f(llfont_round_x(screen_rect.mLeft + slant_amt), uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
llfont_round_y(screen_rect.mBottom)); colors_out[index] = color;
index++;
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); vertex_out[index].set(screen_rect.mLeft, screen_rect.mBottom, 0.f);
gGL.vertex2f(llfont_round_x(screen_rect.mRight + slant_amt), uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
llfont_round_y(screen_rect.mBottom)); colors_out[index] = color;
index++;
vertex_out[index].set(screen_rect.mRight, screen_rect.mBottom, 0.f);
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
colors_out[index] = color;
} }
void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const
{ {
F32 slant_offset; F32 slant_offset;
slant_offset = ((style & ITALIC) ? ( -mAscender * 0.2f) : 0.f); slant_offset = ((style & ITALIC) ? ( -mFontFreetype->getAscenderHeight() * 0.2f) : 0.f);
gGL.begin(LLRender::QUADS); //FIXME: bold and drop shadow are mutually exclusive only for convenience
//Allow both when we need them.
if (style & BOLD)
{ {
//FIXME: bold and drop shadow are mutually exclusive only for convenience for (S32 pass = 0; pass < 2; pass++)
//Allow both when we need them.
if (style & BOLD)
{ {
gGL.color4fv(color.mV); LLRectf screen_rect_offset = screen_rect;
for (S32 pass = 0; pass < 2; pass++)
{
LLRectf screen_rect_offset = screen_rect;
screen_rect_offset.translate((F32)(pass * BOLD_OFFSET), 0.f); screen_rect_offset.translate((F32)(pass * BOLD_OFFSET), 0.f);
renderQuad(screen_rect_offset, uv_rect, slant_offset); renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_offset, uv_rect, color, slant_offset);
} glyph_count++;
} }
else if (shadow == DROP_SHADOW_SOFT)
{
LLColor4 shadow_color = LLFontGL::sShadowColor;
shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength * DROP_SHADOW_SOFT_STRENGTH;
gGL.color4fv(shadow_color.mV);
for (S32 pass = 0; pass < 5; pass++)
{
LLRectf screen_rect_offset = screen_rect;
switch(pass)
{
case 0:
screen_rect_offset.translate(-1.f, -1.f);
break;
case 1:
screen_rect_offset.translate(1.f, -1.f);
break;
case 2:
screen_rect_offset.translate(1.f, 1.f);
break;
case 3:
screen_rect_offset.translate(-1.f, 1.f);
break;
case 4:
screen_rect_offset.translate(0, -2.f);
break;
}
renderQuad(screen_rect_offset, uv_rect, slant_offset);
}
gGL.color4fv(color.mV);
renderQuad(screen_rect, uv_rect, slant_offset);
}
else if (shadow == DROP_SHADOW)
{
LLColor4 shadow_color = LLFontGL::sShadowColor;
shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength;
gGL.color4fv(shadow_color.mV);
LLRectf screen_rect_shadow = screen_rect;
screen_rect_shadow.translate(1.f, -1.f);
renderQuad(screen_rect_shadow, uv_rect, slant_offset);
gGL.color4fv(color.mV);
renderQuad(screen_rect, uv_rect, slant_offset);
}
else // normal rendering
{
gGL.color4fv(color.mV);
renderQuad(screen_rect, uv_rect, slant_offset);
}
} }
gGL.end(); else if (shadow == DROP_SHADOW_SOFT)
{
LLColor4U shadow_color = LLFontGL::sShadowColor;
shadow_color.mV[VALPHA] = U8(color.mV[VALPHA] * drop_shadow_strength * DROP_SHADOW_SOFT_STRENGTH);
for (S32 pass = 0; pass < 5; pass++)
{
LLRectf screen_rect_offset = screen_rect;
switch(pass)
{
case 0:
screen_rect_offset.translate(-1.f, -1.f);
break;
case 1:
screen_rect_offset.translate(1.f, -1.f);
break;
case 2:
screen_rect_offset.translate(1.f, 1.f);
break;
case 3:
screen_rect_offset.translate(-1.f, 1.f);
break;
case 4:
screen_rect_offset.translate(0, -2.f);
break;
}
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_offset, uv_rect, shadow_color, slant_offset);
glyph_count++;
}
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
glyph_count++;
}
else if (shadow == DROP_SHADOW)
{
LLColor4U shadow_color = LLFontGL::sShadowColor;
shadow_color.mV[VALPHA] = U8(color.mV[VALPHA] * drop_shadow_strength);
LLRectf screen_rect_shadow = screen_rect;
screen_rect_shadow.translate(1.f, -1.f);
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_shadow, uv_rect, shadow_color, slant_offset);
glyph_count++;
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
glyph_count++;
}
else // normal rendering
{
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
glyph_count++;
}
} }

View File

@@ -28,23 +28,24 @@
#ifndef LL_LLFONTGL_H #ifndef LL_LLFONTGL_H
#define LL_LLFONTGL_H #define LL_LLFONTGL_H
#include "llfontfreetype.h"
#include "lltexture.h"
#include "v2math.h"
#include "llcoord.h" #include "llcoord.h"
#include "llrect.h"
#include "llfontregistry.h" #include "llfontregistry.h"
#include "lltexture.h"
#include "llpointer.h"
#include "llrect.h"
#include "v2math.h"
class LLImageGL;
class LLColor4; class LLColor4;
// Key used to request a font. // Key used to request a font.
class LLFontDescriptor; class LLFontDescriptor;
class LLFontFreetype;
// Structure used to store previously requested fonts. // Structure used to store previously requested fonts.
class LLFontRegistry; class LLFontRegistry;
class LLFontGL : public LLFontFreetype class LLFontGL
{ {
public: public:
enum HAlign enum HAlign
@@ -88,7 +89,7 @@ public:
void destroyGL(); void destroyGL();
/* virtual*/ BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback); BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback);
S32 render(const LLWString &text, S32 begin_offset, S32 render(const LLWString &text, S32 begin_offset,
const LLRect& rect, const LLRect& rect,
@@ -118,9 +119,9 @@ public:
S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const; S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const;
// font metrics - override for LLFont that returns units of virtual pixels // font metrics - override for LLFont that returns units of virtual pixels
/*virtual*/ F32 getLineHeight() const { return (F32)llround(mLineHeight / sScaleY); } F32 getAscenderHeight() const;
/*virtual*/ F32 getAscenderHeight() const { return (F32)llround(mAscender / sScaleY); } F32 getDescenderHeight() const;
/*virtual*/ F32 getDescenderHeight() const { return (F32)llround(mDescender / sScaleY); } F32 getLineHeight() const;
S32 getWidth(const std::string& utf8text) const; S32 getWidth(const std::string& utf8text) const;
S32 getWidth(const llwchar* wchars) const; S32 getWidth(const llwchar* wchars) const;
@@ -151,8 +152,7 @@ public:
// Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars) // Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars)
S32 charFromPixelOffset(const llwchar* wchars, const S32 char_offset, F32 x, F32 max_pixels=F32_MAX, S32 max_chars = S32_MAX, BOOL round = TRUE, BOOL use_embedded = FALSE) const; S32 charFromPixelOffset(const llwchar* wchars, const S32 char_offset, F32 x, F32 max_pixels=F32_MAX, S32 max_chars = S32_MAX, BOOL round = TRUE, BOOL use_embedded = FALSE) const;
const LLFontDescriptor &getFontDesc() const { return mFontDesc; } const LLFontDescriptor& getFontDesc() const;
void setFontDesc(const LLFontDescriptor& font_desc) { mFontDesc = font_desc; }
LLTexture *getTexture() const; LLTexture *getTexture() const;
@@ -222,22 +222,23 @@ public:
static F32 sScaleY; static F32 sScaleY;
static BOOL sDisplayFont ; static BOOL sDisplayFont ;
static std::string sAppDir; // For loading fonts static std::string sAppDir; // For loading fonts
private:
friend class LLFontRegistry;
friend class LLTextBillboard; friend class LLTextBillboard;
friend class LLHUDText; friend class LLHUDText;
LLFontGL(const LLFontGL &source); LLFontGL(const LLFontGL &source);
LLFontGL &operator=(const LLFontGL &source); LLFontGL &operator=(const LLFontGL &source);
protected:
/*virtual*/ BOOL addChar(const llwchar wch) const;
protected: protected:
typedef std::map<llwchar,embedded_data_t*> embedded_map_t; typedef std::map<llwchar,embedded_data_t*> embedded_map_t;
mutable embedded_map_t mEmbeddedChars; mutable embedded_map_t mEmbeddedChars;
LLFontDescriptor mFontDesc; LLFontDescriptor mFontDescriptor;
LLPointer<LLFontFreetype> mFontFreetype;
void renderQuad(const LLRectf& screen_rect, const LLRectf& uv_rect, F32 slant_amt) const; void renderQuad(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const;
void drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const; void drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const;
// Registry holds all instantiated fonts. // Registry holds all instantiated fonts.
static LLFontRegistry* sFontRegistry; static LLFontRegistry* sFontRegistry;

View File

@@ -421,7 +421,8 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
llwarns << "createFont failed, no file names specified" << llendl; llwarns << "createFont failed, no file names specified" << llendl;
return NULL; return NULL;
} }
LLFontList *fontlistp = new LLFontList;
LLFontFreetype::font_vector_t fontlist;
LLFontGL *result = NULL; LLFontGL *result = NULL;
// Snarf all fonts we can into fontlistp. First will get pulled // Snarf all fonts we can into fontlistp. First will get pulled
@@ -466,19 +467,26 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
is_first_found = false; is_first_found = false;
} }
else else
fontlistp->addAtEnd(fontp); {
fontlist.push_back(fontp->mFontFreetype);
delete fontp;
fontp = NULL;
}
} }
} }
if (result && !fontlistp->empty())
if (result && !fontlist.empty())
{ {
result->setFallbackFont(fontlistp); result->mFontFreetype->setFallbackFonts(fontlist);
} }
norm_desc.setStyle(match_desc->getStyle()); norm_desc.setStyle(match_desc->getStyle());
if (result)
result->setFontDesc(norm_desc);
if (!result) if (result)
{
result->mFontDescriptor = desc;
}
else
{ {
llwarns << "createFont failed in some way" << llendl; llwarns << "createFont failed in some way" << llendl;
} }

View File

@@ -755,10 +755,12 @@ bool LLGLManager::initGL()
#endif #endif
stop_glerror(); stop_glerror();
#if LL_WINDOWS
if (mIsIntel && mGLVersion <= 3.f) if (mIsIntel && mGLVersion <= 3.f)
{ //never try to use framebuffer objects on older intel drivers (crashy) { //never try to use framebuffer objects on older intel drivers (crashy)
mHasFramebufferObject = FALSE; mHasFramebufferObject = FALSE;
} }
#endif
stop_glerror(); stop_glerror();

View File

@@ -610,6 +610,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
text[count++] = strdup("#define ATTRIBUTE attribute\n"); text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n"); text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n"); text[count++] = strdup("#define VARYING_FLAT varying\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
} }
else if (minor_version <= 29) else if (minor_version <= 29)
{ {
@@ -620,6 +624,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
text[count++] = strdup("#define ATTRIBUTE attribute\n"); text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n"); text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n"); text[count++] = strdup("#define VARYING_FLAT varying\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
} }
} }
else else
@@ -628,6 +636,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
{ {
//set version to 1.30 //set version to 1.30
text[count++] = strdup("#version 130\n"); text[count++] = strdup("#version 130\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
//some implementations of GLSL 1.30 require integer precision be explicitly declared //some implementations of GLSL 1.30 require integer precision be explicitly declared
text[count++] = strdup("precision mediump int;\n"); text[count++] = strdup("precision mediump int;\n");
@@ -636,8 +649,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
else else
{ //set version to 400 { //set version to 400
text[count++] = strdup("#version 400\n"); text[count++] = strdup("#version 400\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
} }
text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n"); text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
text[count++] = strdup("#define FXAA_GLSL_130 1\n"); text[count++] = strdup("#define FXAA_GLSL_130 1\n");

View File

@@ -2109,7 +2109,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)))) if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))))
{ {
LLFastTimer t(FTM_BIND_GL_BUFFER); //LLFastTimer t(FTM_BIND_GL_BUFFER);
/*if (sMapped) /*if (sMapped)
{ {
llerrs << "VBO bound while another VBO mapped!" << llendl; llerrs << "VBO bound while another VBO mapped!" << llendl;

View File

@@ -398,7 +398,10 @@ void LLLineEditor::setCursor( S32 pos )
{ {
S32 width_chars_to_left = mGLFont->getWidth(mText.getWString().c_str(), 0, mScrollHPos); S32 width_chars_to_left = mGLFont->getWidth(mText.getWString().c_str(), 0, mScrollHPos);
S32 last_visible_char = mGLFont->maxDrawableChars(mText.getWString().c_str(), llmax(0.f, (F32)(mMaxHPixels - mMinHPixels + width_chars_to_left))); S32 last_visible_char = mGLFont->maxDrawableChars(mText.getWString().c_str(), llmax(0.f, (F32)(mMaxHPixels - mMinHPixels + width_chars_to_left)));
S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mMaxHPixels - mMinHPixels - UI_LINEEDITOR_CURSOR_THICKNESS - UI_LINEEDITOR_H_PAD), mText.length(), getCursor()); // character immediately to left of cursor should be last one visible (SCROLL_INCREMENT_ADD will scroll in more characters)
// or first character if cursor is at beginning
S32 new_last_visible_char = llmax(0, getCursor() - 1);
S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mMaxHPixels - mMinHPixels - UI_LINEEDITOR_CURSOR_THICKNESS - UI_LINEEDITOR_H_PAD), mText.length(), new_last_visible_char);
if (old_cursor_pos == last_visible_char) if (old_cursor_pos == last_visible_char)
{ {
mScrollHPos = llmin(mText.length(), llmax(min_scroll, mScrollHPos + SCROLL_INCREMENT_ADD)); mScrollHPos = llmin(mText.length(), llmax(min_scroll, mScrollHPos + SCROLL_INCREMENT_ADD));
@@ -1887,14 +1890,14 @@ void LLLineEditor::draw()
{ {
S32 select_left; S32 select_left;
S32 select_right; S32 select_right;
if( mSelectionStart < getCursor() ) if (mSelectionStart < mSelectionEnd)
{ {
select_left = mSelectionStart; select_left = mSelectionStart;
select_right = getCursor(); select_right = mSelectionEnd;
} }
else else
{ {
select_left = getCursor(); select_left = mSelectionEnd;
select_right = mSelectionStart; select_right = mSelectionStart;
} }
@@ -1921,10 +1924,11 @@ void LLLineEditor::draw()
width = llmin(width, mMaxHPixels - llround(rendered_pixels_right)); width = llmin(width, mMaxHPixels - llround(rendered_pixels_right));
gl_rect_2d(llround(rendered_pixels_right), cursor_top, llround(rendered_pixels_right)+width, cursor_bottom, color); gl_rect_2d(llround(rendered_pixels_right), cursor_top, llround(rendered_pixels_right)+width, cursor_bottom, color);
LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha );
rendered_text += mGLFont->render( rendered_text += mGLFont->render(
mText, mScrollHPos + rendered_text, mText, mScrollHPos + rendered_text,
rendered_pixels_right, text_bottom, rendered_pixels_right, text_bottom,
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha ), tmp_color,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::LEFT, LLFontGL::BOTTOM,
LLFontGL::NORMAL, LLFontGL::NORMAL,
LLFontGL::NO_SHADOW, LLFontGL::NO_SHADOW,
@@ -1936,7 +1940,7 @@ void LLLineEditor::draw()
if( (rendered_pixels_right < (F32)mMaxHPixels) && (rendered_text < text_len) ) if( (rendered_pixels_right < (F32)mMaxHPixels) && (rendered_text < text_len) )
{ {
// unselected, right side // unselected, right side
mGLFont->render( rendered_text += mGLFont->render(
mText, mScrollHPos + rendered_text, mText, mScrollHPos + rendered_text,
rendered_pixels_right, text_bottom, rendered_pixels_right, text_bottom,
text_color, text_color,
@@ -1950,7 +1954,7 @@ void LLLineEditor::draw()
} }
else else
{ {
mGLFont->render( rendered_text = mGLFont->render(
mText, mScrollHPos, mText, mScrollHPos,
rendered_pixels_right, text_bottom, rendered_pixels_right, text_bottom,
text_color, text_color,
@@ -1993,8 +1997,9 @@ void LLLineEditor::draw()
cursor_right, cursor_bottom, text_color); cursor_right, cursor_bottom, text_color);
if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection()) if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection())
{ {
LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha );
mGLFont->render(mText, getCursor(), (F32)(cursor_left + UI_LINEEDITOR_CURSOR_THICKNESS / 2), text_bottom, mGLFont->render(mText, getCursor(), (F32)(cursor_left + UI_LINEEDITOR_CURSOR_THICKNESS / 2), text_bottom,
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha ), tmp_color,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::LEFT, LLFontGL::BOTTOM,
LLFontGL::NORMAL, LLFontGL::NORMAL,
LLFontGL::NO_SHADOW, LLFontGL::NO_SHADOW,
@@ -2787,13 +2792,19 @@ void LLLineEditor::updateAllowingLanguageInput()
// fine on 1.15.0.2, since all prevalidate func reject any // fine on 1.15.0.2, since all prevalidate func reject any
// non-ASCII characters. I'm not sure on future versions, // non-ASCII characters. I'm not sure on future versions,
// however... // however...
LLWindow* window = getWindow();
if (!window)
{
// test app, no window available
return;
}
if (hasFocus() && !mReadOnly && !mDrawAsterixes && mPrevalidateFunc == NULL) if (hasFocus() && !mReadOnly && !mDrawAsterixes && mPrevalidateFunc == NULL)
{ {
getWindow()->allowLanguageTextInput(this, TRUE); window->allowLanguageTextInput(this, TRUE);
} }
else else
{ {
getWindow()->allowLanguageTextInput(this, FALSE); window->allowLanguageTextInput(this, FALSE);
} }
} }

View File

@@ -1964,6 +1964,8 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
child->getAttributeString("name", item_name); child->getAttributeString("name", item_name);
child->getAttributeString("label", source_label); child->getAttributeString("label", source_label);
LLStringUtil::format(source_label, LLTrans::getDefaultArgs());
// parse jump key out of label // parse jump key out of label
typedef boost::tokenizer<boost::char_separator<char> > tokenizer; typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep("_"); boost::char_separator<char> sep("_");
@@ -2303,6 +2305,8 @@ LLView* LLMenuGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
std::string label = name; std::string label = name;
node->getAttributeString("label", label); node->getAttributeString("label", label);
LLStringUtil::format(label, LLTrans::getDefaultArgs());
// parse jump key out of label // parse jump key out of label
std::string new_menu_label; std::string new_menu_label;

View File

@@ -41,6 +41,7 @@
#include "llnotifications.h" #include "llnotifications.h"
#include "aialert.h" #include "aialert.h"
#include "aistatemachine.h"
#include "../newview/hippogridmanager.h" #include "../newview/hippogridmanager.h"
@@ -50,6 +51,9 @@
#endif #endif
#include <boost/regex.hpp> #include <boost/regex.hpp>
// Two macros, used to make access to mItems thread-safe, to keep the diff to a minimum.
#define AILOCK_mItems mItems_wat mItems_w(mItems_sf); LLNotificationSet& mItems(*mItems_w)
#define AILOCK_const_mItems mItems_crat mItems_r(mItems_sf); LLNotificationSet const& mItems(*mItems_r)
const std::string NOTIFICATION_PERSIST_VERSION = "0.93"; const std::string NOTIFICATION_PERSIST_VERSION = "0.93";
@@ -99,6 +103,7 @@ private:
output["version"] = NOTIFICATION_PERSIST_VERSION; output["version"] = NOTIFICATION_PERSIST_VERSION;
LLSD& data = output["data"]; LLSD& data = output["data"];
AILOCK_mItems;
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it) for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
{ {
if (!LLNotificationTemplates::instance().templateExists((*it)->getName())) continue; if (!LLNotificationTemplates::instance().templateExists((*it)->getName())) continue;
@@ -156,6 +161,7 @@ private:
void onDelete(LLNotificationPtr pNotification) void onDelete(LLNotificationPtr pNotification)
{ {
// we want to keep deleted notifications in our log // we want to keep deleted notifications in our log
AILOCK_mItems;
mItems.insert(pNotification); mItems.insert(pNotification);
return; return;
@@ -757,6 +763,7 @@ void LLNotificationChannelBase::connectChanged(const LLStandardSignal::slot_type
// all of the notifications that are already in the channel // all of the notifications that are already in the channel
// we use a special signal called "load" in case the channel wants to care // we use a special signal called "load" in case the channel wants to care
// only about new notifications // only about new notifications
AILOCK_mItems;
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it) for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
{ {
slot(LLSD().with("sigtype", "load").with("id", (*it)->id())); slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
@@ -796,7 +803,10 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload)
// internal call, for use in avoiding lookup // internal call, for use in avoiding lookup
bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPtr pNotification) bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPtr pNotification)
{ {
llassert(AIThreadID::in_main_thread());
std::string cmd = payload["sigtype"]; std::string cmd = payload["sigtype"];
AILOCK_mItems;
LLNotificationSet::iterator foundItem = mItems.find(pNotification); LLNotificationSet::iterator foundItem = mItems.find(pNotification);
bool wasFound = (foundItem != mItems.end()); bool wasFound = (foundItem != mItems.end());
bool passesFilter = mFilter(pNotification); bool passesFilter = mFilter(pNotification);
@@ -943,6 +953,7 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
{ {
mComparator = comparator; mComparator = comparator;
LLNotificationSet s2(mComparator); LLNotificationSet s2(mComparator);
AILOCK_mItems;
s2.insert(mItems.begin(), mItems.end()); s2.insert(mItems.begin(), mItems.end());
mItems.swap(s2); mItems.swap(s2);
@@ -952,16 +963,19 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
bool LLNotificationChannel::isEmpty() const bool LLNotificationChannel::isEmpty() const
{ {
AILOCK_const_mItems;
return mItems.empty(); return mItems.empty();
} }
LLNotificationChannel::Iterator LLNotificationChannel::begin() LLNotificationChannel::Iterator LLNotificationChannel::begin()
{ {
AILOCK_const_mItems;
return mItems.begin(); return mItems.begin();
} }
LLNotificationChannel::Iterator LLNotificationChannel::end() LLNotificationChannel::Iterator LLNotificationChannel::end()
{ {
AILOCK_const_mItems;
return mItems.end(); return mItems.end();
} }
@@ -1488,40 +1502,158 @@ LLNotificationPtr LLNotifications::add(AIAlert::Error const& error, int type, un
return add(LLNotification::Params((type == AIAlert::modal || error.is_modal()) ? "AIAlertModal" : "AIAlert").substitutions(substitutions)); return add(LLNotification::Params((type == AIAlert::modal || error.is_modal()) ? "AIAlertModal" : "AIAlert").substitutions(substitutions));
} }
//--------------------------------------------------------------------------------
// class UpdateItem
//
// Allow LLNotifications::add, LLNotifications::cancel and LLNotifications::update
// to be called from any thread.
struct UpdateItem
{
char const* sigtype;
LLNotificationPtr pNotif;
UpdateItem(char const* st, LLNotificationPtr const& np) : sigtype(st), pNotif(np) { }
void doit(void) const;
};
void UpdateItem::doit(void) const
{
LLNotifications::getInstance()->updateItem(LLSD().with("sigtype", sigtype).with("id", pNotif->id()), pNotif);
if (!strcmp(sigtype, "delete"))
{
pNotif->cancel();
}
}
class UpdateItemSM : public AIStateMachine
{
protected:
typedef AIStateMachine direct_base_type;
enum update_item_state_type {
UpdateItem_idle = direct_base_type::max_state,
UpdateItem_doit
};
public:
static state_type const max_state = UpdateItem_doit + 1;
public:
UpdateItemSM(void) : AIStateMachine(CWD_ONLY(true)) { }
static void add(UpdateItem const& ui);
private:
static UpdateItemSM* sSelf;
typedef std::deque<UpdateItem> updateQueue_type;
AIThreadSafeSimpleDC<updateQueue_type> mUpdateQueue;
typedef AIAccess<updateQueue_type> mUpdateQueue_wat;
typedef AIAccess<updateQueue_type> mUpdateQueue_rat;
typedef AIAccessConst<updateQueue_type> mUpdateQueue_crat;
protected:
/*virtual*/ ~UpdateItemSM() { }
protected:
/*virtual*/ void initialize_impl(void) { set_state(UpdateItem_idle); }
/*virtual*/ void multiplex_impl(state_type run_state);
/*virtual*/ void abort_impl(void) { }
/*virtual*/ void finish_impl(void) { }
/*virtual*/ char const* state_str_impl(state_type run_state) const;
};
//static
UpdateItemSM* UpdateItemSM::sSelf;
void UpdateItemSM::add(UpdateItem const& ui)
{
if (!sSelf)
{
sSelf = new UpdateItemSM;
sSelf->run(NULL, 0, false, true, &gMainThreadEngine);
}
if (AIThreadID::in_main_thread())
{
ui.doit();
return;
}
mUpdateQueue_wat mUpdateQueue_w(sSelf->mUpdateQueue);
mUpdateQueue_w->push_back(ui);
sSelf->advance_state(UpdateItem_doit);
}
char const* UpdateItemSM::state_str_impl(state_type run_state) const
{
switch(run_state)
{
// A complete listing of hello_world_state_type.
AI_CASE_RETURN(UpdateItem_idle);
AI_CASE_RETURN(UpdateItem_doit);
}
llassert(false);
return "UNKNOWN STATE";
}
void UpdateItemSM::multiplex_impl(state_type run_state)
{
switch(run_state)
{
case UpdateItem_idle:
idle();
break;
case UpdateItem_doit:
{
mUpdateQueue_wat mUpdateQueue_w(sSelf->mUpdateQueue);
while (!mUpdateQueue_w->empty())
{
UpdateItem const& ui(mUpdateQueue_w->front());
ui.doit();
mUpdateQueue_w->pop_front();
}
set_state(UpdateItem_idle);
break;
}
}
}
// end of UpdateItemSM
//--------------------------------------------------------------------------------
void LLNotifications::add(const LLNotificationPtr pNotif) void LLNotifications::add(const LLNotificationPtr pNotif)
{ {
if (pNotif == NULL) return; if (pNotif == NULL) return;
// first see if we already have it -- if so, that's a problem // first see if we already have it -- if so, that's a problem
AILOCK_mItems;
LLNotificationSet::iterator it=mItems.find(pNotif); LLNotificationSet::iterator it=mItems.find(pNotif);
if (it != mItems.end()) if (it != mItems.end())
{ {
llerrs << "Notification added a second time to the master notification channel." << llendl; llerrs << "Notification added a second time to the master notification channel." << llendl;
} }
updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif); UpdateItemSM::add(UpdateItem("add", pNotif));
} }
void LLNotifications::cancel(LLNotificationPtr pNotif) void LLNotifications::cancel(LLNotificationPtr pNotif)
{ {
if (pNotif == NULL || pNotif->isCancelled()) return; if (pNotif == NULL || pNotif->isCancelled()) return;
AILOCK_mItems;
LLNotificationSet::iterator it=mItems.find(pNotif); LLNotificationSet::iterator it=mItems.find(pNotif);
if (it == mItems.end()) if (it == mItems.end())
{ {
llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl; llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
} }
updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif); UpdateItemSM::add(UpdateItem("delete", pNotif));
pNotif->cancel();
} }
void LLNotifications::update(const LLNotificationPtr pNotif) void LLNotifications::update(const LLNotificationPtr pNotif)
{ {
AILOCK_mItems;
LLNotificationSet::iterator it=mItems.find(pNotif); LLNotificationSet::iterator it=mItems.find(pNotif);
if (it != mItems.end()) if (it != mItems.end())
{ {
updateItem(LLSD().with("sigtype", "change").with("id", pNotif->id()), pNotif); UpdateItemSM::add(UpdateItem("change", pNotif));
} }
} }
@@ -1529,6 +1661,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif)
LLNotificationPtr LLNotifications::find(LLUUID const& uuid) LLNotificationPtr LLNotifications::find(LLUUID const& uuid)
{ {
LLNotificationPtr target = LLNotificationPtr(new LLNotification(uuid)); LLNotificationPtr target = LLNotificationPtr(new LLNotification(uuid));
AILOCK_mItems;
LLNotificationSet::iterator it=mItems.find(target); LLNotificationSet::iterator it=mItems.find(target);
if (it == mItems.end()) if (it == mItems.end())
{ {
@@ -1543,6 +1676,7 @@ LLNotificationPtr LLNotifications::find(LLUUID const& uuid)
void LLNotifications::forEachNotification(NotificationProcess process) void LLNotifications::forEachNotification(NotificationProcess process)
{ {
AILOCK_mItems;
std::for_each(mItems.begin(), mItems.end(), process); std::for_each(mItems.begin(), mItems.end(), process);
} }

View File

@@ -107,6 +107,7 @@
#include "llxmlnode.h" #include "llxmlnode.h"
#include "llnotificationptr.h" #include "llnotificationptr.h"
#include "llnotificationcontext.h" #include "llnotificationcontext.h"
#include "aithreadsafe.h"
namespace AIAlert { class Error; } namespace AIAlert { class Error; }
@@ -196,6 +197,7 @@ class LLNotification :
{ {
LOG_CLASS(LLNotification); LOG_CLASS(LLNotification);
friend class LLNotifications; friend class LLNotifications;
friend class UpdateItem;
public: public:
// parameter object used to instantiate a new notification // parameter object used to instantiate a new notification
@@ -566,9 +568,10 @@ class LLNotificationChannelBase :
public boost::signals2::trackable public boost::signals2::trackable
{ {
LOG_CLASS(LLNotificationChannelBase); LOG_CLASS(LLNotificationChannelBase);
friend class UpdateItem;
public: public:
LLNotificationChannelBase(LLNotificationFilter filter, LLNotificationComparator comp) : LLNotificationChannelBase(LLNotificationFilter filter, LLNotificationComparator comp) :
mFilter(filter), mItems(comp) mFilter(filter), mItems_sf(comp)
{} {}
virtual ~LLNotificationChannelBase() {} virtual ~LLNotificationChannelBase() {}
// you can also connect to a Channel, so you can be notified of // you can also connect to a Channel, so you can be notified of
@@ -582,7 +585,9 @@ public:
const LLNotificationFilter& getFilter() { return mFilter; } const LLNotificationFilter& getFilter() { return mFilter; }
protected: protected:
LLNotificationSet mItems; AIThreadSafeSimpleDC<LLNotificationSet> mItems_sf;
typedef AIAccess<LLNotificationSet> mItems_wat;
typedef AIAccessConst<LLNotificationSet> mItems_crat;
LLStandardSignal mChanged; LLStandardSignal mChanged;
LLStandardSignal mPassedFilter; LLStandardSignal mPassedFilter;
LLStandardSignal mFailedFilter; LLStandardSignal mFailedFilter;

View File

@@ -36,6 +36,7 @@
#include "linden_common.h" #include "linden_common.h"
#include "llresmgr.h" #include "llresmgr.h"
#include "llimagegl.h"
#include "llfontgl.h" #include "llfontgl.h"
#include "llerror.h" #include "llerror.h"
#include "llstring.h" #include "llstring.h"

View File

@@ -33,6 +33,8 @@
#include "linden_common.h" #include "linden_common.h"
#include "llstyle.h" #include "llstyle.h"
#include "llfontgl.h"
#include "llstring.h" #include "llstring.h"
#include "llui.h" #include "llui.h"

View File

@@ -91,14 +91,19 @@ bool LLTrans::parseStrings(const std::string& xml_filename, const std::set<std::
return true; return true;
} }
static LLFastTimer::DeclareTimer FTM_GET_TRANS("Translate string"); static LLAtomicU32 sStringTemplates_accesses;
int const access_increment = 1000;
static void log_sStringTemplates_accesses(void)
{
llinfos << "LLTrans::getString/findString called " << sStringTemplates_accesses << " in total." << llendl;
}
//static //static
std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
{ {
// Don't care about time as much as call count. Make sure we're not // Singu note: make sure LLTrans isn't used in a tight loop.
// calling LLTrans::getString() in an inner loop. JC if (sStringTemplates_accesses++ % access_increment == access_increment - 1) log_sStringTemplates_accesses();
LLFastTimer timer(FTM_GET_TRANS);
template_map_t::iterator iter = sStringTemplates.find(xml_desc); template_map_t::iterator iter = sStringTemplates.find(xml_desc);
@@ -125,9 +130,11 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::
//static //static
std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args) std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args)
{ {
// Don't care about time as much as call count. Make sure we're not // Singu note: make sure LLTrans isn't used in a tight loop.
// calling LLTrans::getString() in an inner loop. JC if (sStringTemplates_accesses++ % access_increment == 0) log_sStringTemplates_accesses();
LLFastTimer timer(FTM_GET_TRANS);
// Since sStringTemplates is read-only after it's initial initialization during start up,
// this function is already thread-safe.
template_map_t::iterator iter = sStringTemplates.find(xml_desc); template_map_t::iterator iter = sStringTemplates.find(xml_desc);
if (iter != sStringTemplates.end()) if (iter != sStringTemplates.end())
@@ -146,7 +153,8 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args
//static //static
bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
{ {
LLFastTimer timer(FTM_GET_TRANS); // Singu note: make sure LLTrans isn't used in a tight loop.
if (sStringTemplates_accesses++ % access_increment == 0) log_sStringTemplates_accesses();
template_map_t::iterator iter = sStringTemplates.find(xml_desc); template_map_t::iterator iter = sStringTemplates.find(xml_desc);
if (iter != sStringTemplates.end()) if (iter != sStringTemplates.end())
@@ -168,7 +176,8 @@ bool LLTrans::findString(std::string &result, const std::string &xml_desc, const
//static //static
bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args) bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args)
{ {
//V3: LLFastTimer timer(FTM_GET_TRANS); // Singu note: make sure LLTrans isn't used in a tight loop.
if (sStringTemplates_accesses++ % access_increment == 0) log_sStringTemplates_accesses();
template_map_t::iterator iter = sStringTemplates.find(xml_desc); template_map_t::iterator iter = sStringTemplates.find(xml_desc);
if (iter != sStringTemplates.end()) if (iter != sStringTemplates.end())

View File

@@ -38,6 +38,7 @@ include(LLXML)
#include(LScript) #include(LScript)
include(Linking) include(Linking)
include(NDOF) include(NDOF)
include(NVAPI)
include(StateMachine) include(StateMachine)
include(TemplateCheck) include(TemplateCheck)
include(UI) include(UI)
@@ -1140,7 +1141,6 @@ if (DARWIN)
${VIEWER_BRANDING_ID}.icns ${VIEWER_BRANDING_ID}.icns
macview.r macview.r
gpu_table.txt gpu_table.txt
Info-${VIEWER_BRANDING_NAME_CAMELCASE}.plist
SecondLife.nib/ SecondLife.nib/
# CMake doesn't seem to support Xcode language variants well just yet # CMake doesn't seem to support Xcode language variants well just yet
English.lproj/InfoPlist.strings English.lproj/InfoPlist.strings
@@ -1433,13 +1433,7 @@ if (!DISABLE_TEMPLATE_CHECK)
check_message_template(${VIEWER_BINARY_NAME}) check_message_template(${VIEWER_BINARY_NAME})
endif (!DISABLE_TEMPLATE_CHECK) endif (!DISABLE_TEMPLATE_CHECK)
# We package by default on Linux so we can run from newview/packaged. set(PACKAGE OFF CACHE BOOL
if (LINUX)
set(PACKAGE_DEFAULT ON)
else (LINUX)
set(PACKAGE_DEFAULT OFF)
endif (LINUX)
set(PACKAGE ${PACKAGE_DEFAULT} CACHE BOOL
"Add a package target that builds an installer package.") "Add a package target that builds an installer package.")
if (WINDOWS) if (WINDOWS)
@@ -1598,6 +1592,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${LLMATH_LIBRARIES} ${LLMATH_LIBRARIES}
${LLCOMMON_LIBRARIES} ${LLCOMMON_LIBRARIES}
${NDOF_LIBRARY} ${NDOF_LIBRARY}
${NVAPI_LIBRARY}
${viewer_LIBRARIES} ${viewer_LIBRARIES}
${Boost_CONTEXT_LIBRARY} ${Boost_CONTEXT_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
@@ -1711,7 +1706,7 @@ if (DARWIN)
MACOSX_BUNDLE_BUNDLE_NAME "${VIEWER_BRANDING_NAME}" MACOSX_BUNDLE_BUNDLE_NAME "${VIEWER_BRANDING_NAME}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${viewer_VERSION}" MACOSX_BUNDLE_SHORT_VERSION_STRING "${viewer_VERSION}"
MACOSX_BUNDLE_BUNDLE_VERSION "${viewer_VERSION}" MACOSX_BUNDLE_BUNDLE_VERSION "${viewer_VERSION}"
MACOSX_BUNDLE_COPYRIGHT "Copyright 2010 Balseraph Software Group" MACOSX_BUNDLE_COPYRIGHT "Copyright 2013 Siana Gearz"
) )
add_custom_command( add_custom_command(
@@ -1760,32 +1755,10 @@ if (DARWIN)
--grid=${GRID} --grid=${GRID}
--login_channel=${VIEWER_LOGIN_CHANNEL} --login_channel=${VIEWER_LOGIN_CHANNEL}
--source=${CMAKE_CURRENT_SOURCE_DIR} --source=${CMAKE_CURRENT_SOURCE_DIR}
--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${Product}.touched
DEPENDS DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
) )
# Viewer-Development doesn't have this duplicate of the above command, here..
# this may be a botched merge, but Mac seems to be picky, so I'm leaving it ~Liru
add_custom_command(
TARGET package POST_BUILD
COMMAND ${PYTHON_EXECUTABLE}
ARGS
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
--artwork=${ARTWORK_DIR}
--branding_id=${VIEWER_BRANDING_ID}
--build=${CMAKE_CURRENT_BINARY_DIR}
--buildtype=${CMAKE_BUILD_TYPE}
--channel=${VIEWER_CHANNEL}
--configuration=${CMAKE_CFG_INTDIR}
--dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app
--grid=${GRID}
--login_channel=${VIEWER_LOGIN_CHANNEL}
--source=${CMAKE_CURRENT_SOURCE_DIR}
--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
)
endif (PACKAGE) endif (PACKAGE)
endif (DARWIN) endif (DARWIN)
@@ -1813,7 +1786,7 @@ if (PACKAGE)
list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}") list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}")
list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}") list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}")
set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2")
set(VIEWER_EXE_GLOBS "'Singularity' SLPlugin") set(VIEWER_EXE_GLOBS "'${VIEWER_BRANDING_NAME}' SLPlugin")
set(VIEWER_LIB_GLOB "*.dylib") set(VIEWER_LIB_GLOB "*.dylib")
endif (DARWIN) endif (DARWIN)
if (LINUX) if (LINUX)

View File

@@ -1,7 +0,0 @@
/* Localized versions of Info.plist keys */
CFBundleName = "Singularity";
CFBundleShortVersionString = "Singularity Viewer 1.7.0.0";
CFBundleGetInfoString = "Singularity Viewer 1.7.0.0, Copyright 2012 Siana Gearz";

View File

@@ -0,0 +1,6 @@
/* Localized versions of Info.plist keys */
CFBundleName = "${VIEWER_CHANNEL_ONE_WORD}";
CFBundleShortVersionString = "${VIEWER_CHANNEL} Viewer ${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}";
CFBundleGetInfoString = "${VIEWER_CHANNEL} Viewer ${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}, Copyright 2012 Siana Gearz";

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Singularity</string>
<key>CFBundleIconFile</key>
<string>singularity.icns</string>
<key>CFBundleIdentifier</key>
<string>org.singularityviewer.singularity</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Singularity</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Second Life URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>secondlife</string>
</array>
<key>LSIsAppleDefaultForScheme</key>
<true/>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.0.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View File

@@ -2,7 +2,7 @@
<array> <array>
<map> <map>
<key>default_grids_version</key><string>21</string> <key>default_grids_version</key><string>22</string>
</map> </map>
<!-- Second Life --> <!-- Second Life -->
@@ -20,6 +20,7 @@
<key>render_compat</key><boolean>1</boolean> <key>render_compat</key><boolean>1</boolean>
<key>inventory_links</key><boolean>1</boolean> <key>inventory_links</key><boolean>1</boolean>
<key>auto_update</key><boolean>0</boolean> <key>auto_update</key><boolean>0</boolean>
<key>locked</key><boolean>1</boolean>
</map> </map>
<map> <map>

View File

@@ -13785,6 +13785,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>1</integer>
</map> </map>
<key>RevokePermsOnStopAnimation</key>
<map>
<key>Comment</key>
<string>Clear animation permssions when choosing "Stop Animating Me"</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RotateRight</key> <key>RotateRight</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
@@ -17780,6 +17791,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
</map> </map>
<key>CrashReportID</key>
<map>
<key>Comment</key>
<string>ID of the last crash report sent. Zero indicates that no crash report has been sent. Non-zero value can be useful infermation for developers to track a specific issue</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
</map> </map>
</llsd> </llsd>

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#define INDEXED 1 #define INDEXED 1
#define NON_INDEXED 2 #define NON_INDEXED 2

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,8 +23,6 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;
#else #else

View File

@@ -23,8 +23,8 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable //#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;
@@ -34,7 +34,7 @@ out vec4 frag_color;
#define FXAA_PC 1 #define FXAA_PC 1
//#define FXAA_GLSL_130 1 //#define FXAA_GLSL_130 1
#define FXAA_QUALITY__PRESET 12 #define FXAA_QUALITY_M_PRESET 12
/*============================================================================ /*============================================================================
@@ -67,7 +67,7 @@ Example,
#define FXAA_PC 1 #define FXAA_PC 1
#define FXAA_HLSL_5 1 #define FXAA_HLSL_5 1
#define FXAA_QUALITY__PRESET 12 #define FXAA_QUALITY_M_PRESET 12
Or, Or,
@@ -366,7 +366,7 @@ A. Or use FXAA_GREEN_AS_LUMA.
/*============================================================================ /*============================================================================
FXAA CONSOLE PS3 - TUNING KNOBS FXAA CONSOLE PS3 - TUNING KNOBS
============================================================================*/ ============================================================================*/
#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS #ifndef FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS
// //
// Consoles the sharpness of edges on PS3 only. // Consoles the sharpness of edges on PS3 only.
// Non-PS3 tuning is done with shader input. // Non-PS3 tuning is done with shader input.
@@ -380,17 +380,17 @@ A. Or use FXAA_GREEN_AS_LUMA.
// 2.0 is really soft (good for vector graphics inputs) // 2.0 is really soft (good for vector graphics inputs)
// //
#if 1 #if 1
#define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0 #define FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS 8.0
#endif #endif
#if 0 #if 0
#define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0 #define FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS 4.0
#endif #endif
#if 0 #if 0
#define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0 #define FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS 2.0
#endif #endif
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD #ifndef FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD
// //
// Only effects PS3. // Only effects PS3.
// Non-PS3 tuning is done with shader input. // Non-PS3 tuning is done with shader input.
@@ -408,9 +408,9 @@ A. Or use FXAA_GREEN_AS_LUMA.
// 0.25 leaves more aliasing, and is sharper // 0.25 leaves more aliasing, and is sharper
// //
#if 1 #if 1
#define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125 #define FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD 0.125
#else #else
#define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25 #define FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD 0.25
#endif #endif
#endif #endif
@@ -419,7 +419,7 @@ A. Or use FXAA_GREEN_AS_LUMA.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
NOTE the other tuning knobs are now in the shader function inputs! NOTE the other tuning knobs are now in the shader function inputs!
============================================================================*/ ============================================================================*/
#ifndef FXAA_QUALITY__PRESET #ifndef FXAA_QUALITY_M_PRESET
// //
// Choose the quality preset. // Choose the quality preset.
// This needs to be compiled into the shader as it effects code. // This needs to be compiled into the shader as it effects code.
@@ -440,7 +440,7 @@ NOTE the other tuning knobs are now in the shader function inputs!
// _ = the lowest digit is directly related to performance // _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style // _ = the highest digit is directly related to style
// //
#define FXAA_QUALITY__PRESET 12 #define FXAA_QUALITY_M_PRESET 12
#endif #endif
@@ -453,198 +453,198 @@ NOTE the other tuning knobs are now in the shader function inputs!
/*============================================================================ /*============================================================================
FXAA QUALITY - MEDIUM DITHER PRESETS FXAA QUALITY - MEDIUM DITHER PRESETS
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 10) #if (FXAA_QUALITY_M_PRESET == 10)
#define FXAA_QUALITY__PS 3 #define FXAA_QUALITY_M_PS 3
#define FXAA_QUALITY__P0 1.5 #define FXAA_QUALITY_M_P0 1.5
#define FXAA_QUALITY__P1 3.0 #define FXAA_QUALITY_M_P1 3.0
#define FXAA_QUALITY__P2 12.0 #define FXAA_QUALITY_M_P2 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 11) #if (FXAA_QUALITY_M_PRESET == 11)
#define FXAA_QUALITY__PS 4 #define FXAA_QUALITY_M_PS 4
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 3.0 #define FXAA_QUALITY_M_P2 3.0
#define FXAA_QUALITY__P3 12.0 #define FXAA_QUALITY_M_P3 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 12) #if (FXAA_QUALITY_M_PRESET == 12)
#define FXAA_QUALITY__PS 5 #define FXAA_QUALITY_M_PS 5
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 4.0 #define FXAA_QUALITY_M_P3 4.0
#define FXAA_QUALITY__P4 12.0 #define FXAA_QUALITY_M_P4 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 13) #if (FXAA_QUALITY_M_PRESET == 13)
#define FXAA_QUALITY__PS 6 #define FXAA_QUALITY_M_PS 6
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 4.0 #define FXAA_QUALITY_M_P4 4.0
#define FXAA_QUALITY__P5 12.0 #define FXAA_QUALITY_M_P5 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 14) #if (FXAA_QUALITY_M_PRESET == 14)
#define FXAA_QUALITY__PS 7 #define FXAA_QUALITY_M_PS 7
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 4.0 #define FXAA_QUALITY_M_P5 4.0
#define FXAA_QUALITY__P6 12.0 #define FXAA_QUALITY_M_P6 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 15) #if (FXAA_QUALITY_M_PRESET == 15)
#define FXAA_QUALITY__PS 8 #define FXAA_QUALITY_M_PS 8
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_M_P5 2.0
#define FXAA_QUALITY__P6 4.0 #define FXAA_QUALITY_M_P6 4.0
#define FXAA_QUALITY__P7 12.0 #define FXAA_QUALITY_M_P7 12.0
#endif #endif
/*============================================================================ /*============================================================================
FXAA QUALITY - LOW DITHER PRESETS FXAA QUALITY - LOW DITHER PRESETS
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 20) #if (FXAA_QUALITY_M_PRESET == 20)
#define FXAA_QUALITY__PS 3 #define FXAA_QUALITY_M_PS 3
#define FXAA_QUALITY__P0 1.5 #define FXAA_QUALITY_M_P0 1.5
#define FXAA_QUALITY__P1 2.0 #define FXAA_QUALITY_M_P1 2.0
#define FXAA_QUALITY__P2 8.0 #define FXAA_QUALITY_M_P2 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 21) #if (FXAA_QUALITY_M_PRESET == 21)
#define FXAA_QUALITY__PS 4 #define FXAA_QUALITY_M_PS 4
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 8.0 #define FXAA_QUALITY_M_P3 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 22) #if (FXAA_QUALITY_M_PRESET == 22)
#define FXAA_QUALITY__PS 5 #define FXAA_QUALITY_M_PS 5
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 8.0 #define FXAA_QUALITY_M_P4 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 23) #if (FXAA_QUALITY_M_PRESET == 23)
#define FXAA_QUALITY__PS 6 #define FXAA_QUALITY_M_PS 6
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 8.0 #define FXAA_QUALITY_M_P5 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 24) #if (FXAA_QUALITY_M_PRESET == 24)
#define FXAA_QUALITY__PS 7 #define FXAA_QUALITY_M_PS 7
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 3.0 #define FXAA_QUALITY_M_P5 3.0
#define FXAA_QUALITY__P6 8.0 #define FXAA_QUALITY_M_P6 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 25) #if (FXAA_QUALITY_M_PRESET == 25)
#define FXAA_QUALITY__PS 8 #define FXAA_QUALITY_M_PS 8
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_M_P5 2.0
#define FXAA_QUALITY__P6 4.0 #define FXAA_QUALITY_M_P6 4.0
#define FXAA_QUALITY__P7 8.0 #define FXAA_QUALITY_M_P7 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 26) #if (FXAA_QUALITY_M_PRESET == 26)
#define FXAA_QUALITY__PS 9 #define FXAA_QUALITY_M_PS 9
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_M_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_M_P6 2.0
#define FXAA_QUALITY__P7 4.0 #define FXAA_QUALITY_M_P7 4.0
#define FXAA_QUALITY__P8 8.0 #define FXAA_QUALITY_M_P8 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 27) #if (FXAA_QUALITY_M_PRESET == 27)
#define FXAA_QUALITY__PS 10 #define FXAA_QUALITY_M_PS 10
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_M_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_M_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_M_P7 2.0
#define FXAA_QUALITY__P8 4.0 #define FXAA_QUALITY_M_P8 4.0
#define FXAA_QUALITY__P9 8.0 #define FXAA_QUALITY_M_P9 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 28) #if (FXAA_QUALITY_M_PRESET == 28)
#define FXAA_QUALITY__PS 11 #define FXAA_QUALITY_M_PS 11
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_M_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_M_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_M_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_M_P8 2.0
#define FXAA_QUALITY__P9 4.0 #define FXAA_QUALITY_M_P9 4.0
#define FXAA_QUALITY__P10 8.0 #define FXAA_QUALITY_M_P10 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 29) #if (FXAA_QUALITY_M_PRESET == 29)
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_M_PS 12
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_M_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_M_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_M_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_M_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_M_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_M_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_M_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_M_P8 2.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_M_P9 2.0
#define FXAA_QUALITY__P10 4.0 #define FXAA_QUALITY_M_P10 4.0
#define FXAA_QUALITY__P11 8.0 #define FXAA_QUALITY_M_P11 8.0
#endif #endif
/*============================================================================ /*============================================================================
FXAA QUALITY - EXTREME QUALITY FXAA QUALITY - EXTREME QUALITY
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 39) #if (FXAA_QUALITY_M_PRESET == 39)
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_M_PS 12
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_M_P0 1.0
#define FXAA_QUALITY__P1 1.0 #define FXAA_QUALITY_M_P1 1.0
#define FXAA_QUALITY__P2 1.0 #define FXAA_QUALITY_M_P2 1.0
#define FXAA_QUALITY__P3 1.0 #define FXAA_QUALITY_M_P3 1.0
#define FXAA_QUALITY__P4 1.0 #define FXAA_QUALITY_M_P4 1.0
#define FXAA_QUALITY__P5 1.5 #define FXAA_QUALITY_M_P5 1.5
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_M_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_M_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_M_P8 2.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_M_P9 2.0
#define FXAA_QUALITY__P10 4.0 #define FXAA_QUALITY_M_P10 4.0
#define FXAA_QUALITY__P11 8.0 #define FXAA_QUALITY_M_P11 8.0
#endif #endif
@@ -869,7 +869,7 @@ FxaaFloat4 FxaaPixelShader(
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// This does not effect PS3, as this needs to be compiled in. // This does not effect PS3, as this needs to be compiled in.
// Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. // Use FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS for PS3.
// Due to the PS3 being ALU bound, // Due to the PS3 being ALU bound,
// there are only three safe values here: 2 and 4 and 8. // there are only three safe values here: 2 and 4 and 8.
// These options use the shaders ability to a free *|/ by 2|4|8. // These options use the shaders ability to a free *|/ by 2|4|8.
@@ -883,7 +883,7 @@ FxaaFloat4 FxaaPixelShader(
// This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define. // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// This does not effect PS3, as this needs to be compiled in. // This does not effect PS3, as this needs to be compiled in.
// Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3. // Use FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD for PS3.
// Due to the PS3 being ALU bound, // Due to the PS3 being ALU bound,
// there are only two safe values here: 1/4 and 1/8. // there are only two safe values here: 1/4 and 1/8.
// These options use the shaders ability to a free *|/ by 2|4|8. // These options use the shaders ability to a free *|/ by 2|4|8.
@@ -1041,11 +1041,11 @@ FxaaFloat4 FxaaPixelShader(
if( horzSpan) posB.y += lengthSign * 0.5; if( horzSpan) posB.y += lengthSign * 0.5;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
FxaaFloat2 posN; FxaaFloat2 posN;
posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; posN.x = posB.x - offNP.x * FXAA_QUALITY_M_P0;
posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; posN.y = posB.y - offNP.y * FXAA_QUALITY_M_P0;
FxaaFloat2 posP; FxaaFloat2 posP;
posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; posP.x = posB.x + offNP.x * FXAA_QUALITY_M_P0;
posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; posP.y = posB.y + offNP.y * FXAA_QUALITY_M_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
FxaaFloat subpixE = subpixC * subpixC; FxaaFloat subpixE = subpixC * subpixC;
@@ -1061,11 +1061,11 @@ FxaaFloat4 FxaaPixelShader(
lumaEndP -= lumaNN * 0.5; lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled; FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled; FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P1;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P1;
FxaaBool doneNP = (!doneN) || (!doneP); FxaaBool doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P1;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P1;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
@@ -1074,13 +1074,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P2;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P2;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P2;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P2;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 3) #if (FXAA_QUALITY_M_PS > 3)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1088,13 +1088,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P3;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P3;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P3;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P3;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 4) #if (FXAA_QUALITY_M_PS > 4)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1102,13 +1102,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P4;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P4;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P4;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P4;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 5) #if (FXAA_QUALITY_M_PS > 5)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1116,13 +1116,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P5;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P5;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P5;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P5;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 6) #if (FXAA_QUALITY_M_PS > 6)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1130,13 +1130,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P6;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P6;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P6;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P6;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 7) #if (FXAA_QUALITY_M_PS > 7)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1144,13 +1144,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P7;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P7;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P7;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P7;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 8) #if (FXAA_QUALITY_M_PS > 8)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1158,13 +1158,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P8;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P8;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P8;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P8;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 9) #if (FXAA_QUALITY_M_PS > 9)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1172,13 +1172,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P9;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P9;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P9;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P9;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 10) #if (FXAA_QUALITY_M_PS > 10)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1186,13 +1186,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P10;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P10;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P10;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P10;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 11) #if (FXAA_QUALITY_M_PS > 11)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1200,13 +1200,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P11;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P11;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P11;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P11;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 12) #if (FXAA_QUALITY_M_PS > 12)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@@ -1214,11 +1214,11 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_M_P12;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_M_P12;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_M_P12;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_M_P12;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
} }
#endif #endif
@@ -1291,9 +1291,9 @@ FxaaFloat4 FxaaPixelShader(
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Instead of using this on PC, I'd suggest just using FXAA Quality with Instead of using this on PC, I'd suggest just using FXAA Quality with
#define FXAA_QUALITY__PRESET 10 #define FXAA_QUALITY_M_PRESET 10
Or Or
#define FXAA_QUALITY__PRESET 20 #define FXAA_QUALITY_M_PRESET 20
Either are higher qualilty and almost as fast as this on modern PC GPUs. Either are higher qualilty and almost as fast as this on modern PC GPUs.
============================================================================*/ ============================================================================*/
#if (FXAA_PC_CONSOLE == 1) #if (FXAA_PC_CONSOLE == 1)
@@ -1704,7 +1704,7 @@ half4 FxaaPixelShader(
// (5) // (5)
half4 dir1_pos; half4 dir1_pos;
dir1_pos.xy = normalize(dir.xyz).xz; dir1_pos.xy = normalize(dir.xyz).xz;
half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
// (6) // (6)
half4 dir2_pos; half4 dir2_pos;
@@ -2019,7 +2019,7 @@ half4 FxaaPixelShader(
// (6) // (6)
half4 dir1_pos; half4 dir1_pos;
dir1_pos.xy = normalize(dir).xz; dir1_pos.xy = normalize(dir).xz;
half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE_M_PS3_EDGE_SHARPNESS);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
// (7) // (7)
half4 dir2_pos; half4 dir2_pos;
@@ -2061,7 +2061,7 @@ half4 FxaaPixelShader(
temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
half4 rgby2; half4 rgby2;
rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD; half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE_M_PS3_EDGE_THRESHOLD;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
// (12) // (12)
rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -31,8 +31,8 @@ out vec4 frag_color;
//class 1 -- no shadows //class 1 -- no shadows
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable //#extension GL_ARB_shader_texture_lod : enable
uniform sampler2DRect diffuseRect; uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect; uniform sampler2DRect specularRect;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,8 +23,8 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable //#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,8 +23,8 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable //#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -25,7 +25,7 @@
//class 1, no shadow, no SSAO, should never be called //class 1, no shadow, no SSAO, should never be called
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -151,7 +151,7 @@ void main()
vec4 fb = texture2D(screenTex, distort); vec4 fb = texture2D(screenTex, distort);
frag_data[0] = vec4(linear_to_srgb(fb.rgb), 1.0); // diffuse frag_data[0] = vec4(/*linear_to_srgb*/(fb.rgb), 1.0); // diffuse
frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec
frag_data[2] = vec4(encode_normal(wavef), 0.0, 0.0); // normalxyz, displace frag_data[2] = vec4(encode_normal(wavef), 0.0, 0.0); // normalxyz, displace
} }

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_data[3]; out vec4 frag_data[3];

View File

@@ -5,7 +5,7 @@
* $License$ * $License$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -5,7 +5,7 @@
* $License$ * $License$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -5,7 +5,7 @@
* $License$ * $License$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -5,7 +5,7 @@
* $License$ * $License$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -1,4 +1,4 @@
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -5,7 +5,7 @@
* $License$ * $License$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -29,7 +29,7 @@ out vec4 frag_color;
#define frag_color gl_FragColor #define frag_color gl_FragColor
#endif #endif
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
uniform sampler2D glowMap; uniform sampler2D glowMap;
uniform sampler2DRect screenMap; uniform sampler2DRect screenMap;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,8 +23,8 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable //#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,8 +23,8 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable //#extension GL_ARB_shader_texture_lod : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -23,7 +23,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -22,7 +22,7 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#extension GL_ARB_texture_rectangle : enable //#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR #ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color; out vec4 frag_color;

View File

@@ -1,4 +1,4 @@
version 27 version 28
// NOTE: This is mostly identical to featuretable_mac.txt with a few differences // NOTE: This is mostly identical to featuretable_mac.txt with a few differences
// Should be combined into one table // Should be combined into one table
@@ -301,7 +301,7 @@ RenderObjectBump 0 0
list OpenGLPre15 list OpenGLPre15
RenderVBOEnable 1 0 RenderVBOEnable 1 0
list Intel list IntelPre30
RenderAnisotropic 1 0 RenderAnisotropic 1 0
// Avoid some Intel crashes on Linux // Avoid some Intel crashes on Linux
RenderCubeMap 0 0 RenderCubeMap 0 0

View File

@@ -301,7 +301,11 @@ Intel Eaglelake .*Intel.*Eaglelake.* 0 1
Intel Graphics Media HD .*Intel.*Graphics Media.*HD.* 0 1 Intel Graphics Media HD .*Intel.*Graphics Media.*HD.* 0 1
Intel HD Graphics 2000 .*Intel.*HD Graphics 2000.* 1 1 Intel HD Graphics 2000 .*Intel.*HD Graphics 2000.* 1 1
Intel HD Graphics 3000 .*Intel.*HD Graphics 3000.* 2 1 Intel HD Graphics 3000 .*Intel.*HD Graphics 3000.* 2 1
Intel HD Graphics 3000 .*Intel.*Sandybridge.* 2 1
Intel HD Graphics 4000 .*Intel.*HD Graphics 4000.* 2 1 Intel HD Graphics 4000 .*Intel.*HD Graphics 4000.* 2 1
Intel HD Graphics 4000 .*Intel.*Ivybridge.* 2 1
Intel HD Graphics 5000 .*Intel.*HD Graphics 5.* 2 1
Intel HD Graphics 5000 .*Intel.*Haswell.* 2 1
Intel HD Graphics .*Intel.*HD Graphics.* 2 1 Intel HD Graphics .*Intel.*HD Graphics.* 2 1
Intel Mobile 4 Series .*Intel.*Mobile.* 4 Series.* 0 1 Intel Mobile 4 Series .*Intel.*Mobile.* 4 Series.* 0 1
Intel Media Graphics HD .*Intel.*Media Graphics HD.* 0 1 Intel Media Graphics HD .*Intel.*Media Graphics HD.* 0 1
@@ -312,6 +316,7 @@ Intel HD Graphics 2000 .*Intel.*HD2000.* 1 1
Intel HD Graphics 3000 .*Intel.*HD3000.* 2 1 Intel HD Graphics 3000 .*Intel.*HD3000.* 2 1
Matrox .*Matrox.* 0 0 Matrox .*Matrox.* 0 0
Mesa .*Mesa.* 0 0 Mesa .*Mesa.* 0 0
Gallium .*Gallium.* 1 1
NVIDIA 205 .*NVIDIA .*GeForce 205.* 2 1 NVIDIA 205 .*NVIDIA .*GeForce 205.* 2 1
NVIDIA 210 .*NVIDIA .*GeForce 210.* 2 1 NVIDIA 210 .*NVIDIA .*GeForce 210.* 2 1
NVIDIA 310M .*NVIDIA .*GeForce 310M.* 1 1 NVIDIA 310M .*NVIDIA .*GeForce 310M.* 1 1
@@ -407,6 +412,12 @@ NVIDIA GTX 670 .*NVIDIA .*GTX *67.* 3 1
NVIDIA GTX 680M .*NVIDIA .*GTX *680M.* 3 1 NVIDIA GTX 680M .*NVIDIA .*GTX *680M.* 3 1
NVIDIA GTX 680 .*NVIDIA .*GTX *68.* 3 1 NVIDIA GTX 680 .*NVIDIA .*GTX *68.* 3 1
NVIDIA GTX 690 .*NVIDIA .*GTX *69.* 3 1 NVIDIA GTX 690 .*NVIDIA .*GTX *69.* 3 1
NVIDIA GTX 750 .*NVIDIA .*GTX *75.* 3 1
NVIDIA GTX 760 .*NVIDIA .*GTX *76.* 3 1
NVIDIA GTX 770 .*NVIDIA .*GTX *77.* 3 1
NVIDIA GTX 780 .*NVIDIA .*GTX *78.* 3 1
NVIDIA GTX TITAN .*NVIDIA .*GTX *TITAN.* 3 1
NVIDIA GT 7xxM .*NVIDIA .*GT *7.* 3 1
NVIDIA C51 .*NVIDIA .*C51.* 0 1 NVIDIA C51 .*NVIDIA .*C51.* 0 1
NVIDIA G72 .*NVIDIA .*G72.* 1 1 NVIDIA G72 .*NVIDIA .*G72.* 1 1
NVIDIA G73 .*NVIDIA .*G73.* 1 1 NVIDIA G73 .*NVIDIA .*G73.* 1 1

View File

@@ -16,6 +16,7 @@
#include "lltrans.h" #include "lltrans.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llweb.h" #include "llweb.h"
#include "aialert.h"
// ******************************************************************** // ********************************************************************
// Global Variables // Global Variables
@@ -56,6 +57,7 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) :
mRenderCompat(true), mRenderCompat(true),
mInvLinks(false), mInvLinks(false),
mAutoUpdate(false), mAutoUpdate(false),
mLocked(false),
mMaxAgentGroups(-1), mMaxAgentGroups(-1),
mCurrencySymbol("OS$"), mCurrencySymbol("OS$"),
mCurrencyText("OS Dollars"), mCurrencyText("OS Dollars"),
@@ -157,18 +159,34 @@ void HippoGridInfo::setGridNick(std::string gridNick)
} }
} }
void HippoGridInfo::useHttps()
{
// If the Login URI starts with "http:", replace that with "https:".
if (mLoginUri.substr(0, 5) == "http:")
{
mLoginUri = "https:" + mLoginUri.substr(5);
}
}
void HippoGridInfo::setLoginUri(const std::string& loginUri) void HippoGridInfo::setLoginUri(const std::string& loginUri)
{ {
std::string uri = loginUri; mLoginUri = sanitizeUri(loginUri);
mLoginUri = sanitizeUri(uri); if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.agni.lindenlab.com")
if (utf8str_tolower(LLURI(uri).hostName()) == "login.agni.lindenlab.com")
{ {
mIsInProductionGrid = true; mIsInProductionGrid = true;
useHttps();
setPlatform(PLATFORM_SECONDLIFE);
} }
if (utf8str_tolower(LLURI(uri).hostName()) == "login.avination.com" || if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.aditi.lindenlab.com")
utf8str_tolower(LLURI(uri).hostName()) == "login.avination.net") {
useHttps();
setPlatform(PLATFORM_SECONDLIFE);
}
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.com" ||
utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.net")
{ {
mIsInAvination = true; mIsInAvination = true;
useHttps();
} }
} }
@@ -179,8 +197,7 @@ void HippoGridInfo::setLoginPage(const std::string& loginPage)
void HippoGridInfo::setHelperUri(const std::string& helperUri) void HippoGridInfo::setHelperUri(const std::string& helperUri)
{ {
std::string uri = helperUri; mHelperUri = sanitizeUri(helperUri);
mHelperUri = sanitizeUri(uri);
} }
void HippoGridInfo::setWebSite(const std::string& website) void HippoGridInfo::setWebSite(const std::string& website)
@@ -398,15 +415,13 @@ void HippoGridInfo::onXmlCharacterData(void* userData, const XML_Char* s, int le
case XML_LOGINURI: case XML_LOGINURI:
{ {
std::string loginuri(s, len); self->setLoginUri(std::string(s, len));
self->mLoginUri = sanitizeUri( loginuri );
break; break;
} }
case XML_HELPERURI: case XML_HELPERURI:
{ {
std::string helperuri(s, len); self->setHelperUri(std::string(s, len));
self->mHelperUri = sanitizeUri( helperuri );
break; break;
} }
@@ -437,24 +452,45 @@ void HippoGridInfo::onXmlCharacterData(void* userData, const XML_Char* s, int le
} }
} }
// Throws AIAlert::ErrorCode with the http status as 'code' (HTTP_OK on XML parse error).
bool HippoGridInfo::retrieveGridInfo() void HippoGridInfo::getGridInfo()
{ {
if (mLoginUri == "") return false; if (mLoginUri.empty())
// If last character in uri is not "/"
std::string uri = mLoginUri;
if (uri.compare(uri.length()-1, 1, "/") != 0)
{ {
uri += '/'; // By passing 0 we automatically get GridInfoErrorInstruction appended.
THROW_ALERTC(0, "GridInfoErrorNoLoginURI");
} }
// Make sure the uri ends on a '/'.
std::string uri = mLoginUri;
if (uri.compare(uri.length() - 1, 1, "/") != 0)
{
uri += '/';
}
std::string reply; std::string reply;
int result = LLHTTPClient::blockingGetRaw(uri + "get_grid_info", reply); int result = LLHTTPClient::blockingGetRaw(uri + "get_grid_info", reply);
if (result != 200) return false; if (result != HTTP_OK)
{
char const* xml_desc;
switch (result)
{
case HTTP_NOT_FOUND:
xml_desc = "GridInfoErrorNotFound";
break;
case HTTP_METHOD_NOT_ALLOWED:
xml_desc = "GridInfoErrorNotAllowed";
break;
default:
xml_desc = "AIError";
break;
}
// LLHTTPClient::blockingGetRaw puts any error message in the reply.
THROW_ALERTC(result, xml_desc, AIArgs("[ERROR]", reply));
}
llinfos << "Received: " << reply << llendl; llinfos << "Received: " << reply << llendl;
bool success = true;
XML_Parser parser = XML_ParserCreate(0); XML_Parser parser = XML_ParserCreate(0);
XML_SetUserData(parser, this); XML_SetUserData(parser, this);
XML_SetElementHandler(parser, onXmlElementStart, onXmlElementEnd); XML_SetElementHandler(parser, onXmlElementStart, onXmlElementEnd);
@@ -462,15 +498,11 @@ bool HippoGridInfo::retrieveGridInfo()
mXmlState = XML_VOID; mXmlState = XML_VOID;
if (!XML_Parse(parser, reply.data(), reply.size(), TRUE)) if (!XML_Parse(parser, reply.data(), reply.size(), TRUE))
{ {
llwarns << "XML Parse Error: " << XML_ErrorString(XML_GetErrorCode(parser)) << llendl; THROW_ALERTC(HTTP_OK, "GridInfoParseError", AIArgs("[XML_ERROR]", XML_ErrorString(XML_GetErrorCode(parser))));
success = false;
} }
XML_ParserFree(parser); XML_ParserFree(parser);
return success;
} }
std::string HippoGridInfo::getUploadFee() const std::string HippoGridInfo::getUploadFee() const
{ {
std::string fee; std::string fee;
@@ -558,22 +590,40 @@ const char* HippoGridInfo::getPlatformString(Platform platform)
} }
// static // static
std::string HippoGridInfo::sanitizeUri(std::string &uri) std::string HippoGridInfo::sanitizeUri(std::string const& uri_in)
{ {
// if (uri.empty()) { std::string uri = uri_in;
// return "";
// }
// // If last character in uri is not "/" // Strip any leading and trailing spaces.
// // NOTE: This wrongly assumes that all URIs should end with "/"! LLStringUtil::trim(uri);
// if (uri.compare(uri.length()-1, 1, "/") != 0) {
// return uri + '/'; // Only use https when it was entered.
// } bool use_https = uri.substr(0, 6) == "https:";
// Strip off attempts to use some prefix that is just wrong.
// We accept the following:
// "" (nothing)
// "http:" or "https:", optionally followed by one or more '/'.
std::string::size_type pos = uri.find_first_not_of("htps");
if (pos != std::string::npos && pos < 6 && uri[pos] == ':')
{
do { ++pos; } while(uri[pos] == '/');
uri = uri.substr(pos);
}
// Add (back) the prefix.
if (use_https)
{
uri = "https://" + uri;
}
else
{
uri = "http://" + uri;
}
return uri; return uri;
} }
void HippoGridInfo::initFallback() void HippoGridInfo::initFallback()
{ {
FALLBACK_GRIDINFO.setPlatform(PLATFORM_OPENSIM); FALLBACK_GRIDINFO.setPlatform(PLATFORM_OPENSIM);
@@ -607,11 +657,6 @@ bool HippoGridInfo::getAutoUpdate()
return mAutoUpdate; return mAutoUpdate;
} }
void HippoGridInfo::setAutoUpdate(bool b)
{
mAutoUpdate = b;
}
bool HippoGridInfo::getUPCSupported() bool HippoGridInfo::getUPCSupported()
{ {
if(isSecondLife()) if(isSecondLife())
@@ -967,7 +1012,8 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer)
if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]);
if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]);
if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]); if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]);
if (gridMap.has("auto_update")) grid->setAutoUpdate(gridMap["auto_update"]); if (gridMap.has("auto_update")) grid->mAutoUpdate = gridMap["auto_update"];
if (gridMap.has("locked")) grid->mLocked = gridMap["locked"];
if (newGrid) addGrid(grid); if (newGrid) addGrid(grid);
} }
} }
@@ -1004,6 +1050,7 @@ void HippoGridManager::saveFile()
gridInfo[i]["render_compat"] = grid->isRenderCompat(); gridInfo[i]["render_compat"] = grid->isRenderCompat();
gridInfo[i]["inventory_links"] = grid->supportsInvLinks(); gridInfo[i]["inventory_links"] = grid->supportsInvLinks();
gridInfo[i]["auto_update"] = grid->getAutoUpdate(); gridInfo[i]["auto_update"] = grid->getAutoUpdate();
gridInfo[i]["locked"] = grid->getLocked();
} }
// write client grid info file // write client grid info file

View File

@@ -22,6 +22,7 @@ class LLSD;
class HippoGridInfo class HippoGridInfo
{ {
friend class HippoGridManager;
public: public:
enum Platform { enum Platform {
PLATFORM_OTHER = 0, PLATFORM_OTHER = 0,
@@ -96,9 +97,9 @@ public:
bool supportsInvLinks(); bool supportsInvLinks();
void setSupportsInvLinks(bool b); void setSupportsInvLinks(bool b);
bool getAutoUpdate(); bool getAutoUpdate();
void setAutoUpdate(bool b); bool getLocked() { return mLocked; }
bool retrieveGridInfo(); void getGridInfo();
static const char* getPlatformString(Platform platform); static const char* getPlatformString(Platform platform);
static std::string sanitizeGridNick(const std::string &gridnick); static std::string sanitizeGridNick(const std::string &gridnick);
@@ -124,6 +125,7 @@ private:
bool mRenderCompat; bool mRenderCompat;
bool mInvLinks; bool mInvLinks;
bool mAutoUpdate; bool mAutoUpdate;
bool mLocked;
bool mUPCSupported; bool mUPCSupported;
int mMaxAgentGroups; int mMaxAgentGroups;
@@ -142,7 +144,8 @@ private:
}; };
XmlState mXmlState; XmlState mXmlState;
static std::string sanitizeUri(std::string &uri); static std::string sanitizeUri(std::string const& uri_in);
void useHttps(void);
void formatFee(std::string &fee, int cost, bool showFree) const; void formatFee(std::string &fee, int cost, bool showFree) const;
static void onXmlElementStart(void* userData, const XML_Char* name, const XML_Char** atts); static void onXmlElementStart(void* userData, const XML_Char* name, const XML_Char** atts);

View File

@@ -42,7 +42,7 @@
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"
#include "llhttpstatuscodes.h"
// ******************************************************************** // ********************************************************************
@@ -61,6 +61,7 @@ class HippoPanelGridsImpl : public HippoPanelGrids
enum State { NORMAL, ADD_NEW, ADD_COPY }; enum State { NORMAL, ADD_NEW, ADD_COPY };
State mState; State mState;
std::string mCurGrid; std::string mCurGrid;
bool mIsEditable;
void loadCurGrid(); void loadCurGrid();
bool saveCurGrid(); bool saveCurGrid();
@@ -78,6 +79,8 @@ class HippoPanelGridsImpl : public HippoPanelGrids
static void onClickGridInfo(void *data); static void onClickGridInfo(void *data);
static void onClickHelpRenderCompat(void *data); static void onClickHelpRenderCompat(void *data);
static void onClickAdvanced(void *data); static void onClickAdvanced(void *data);
void enableEditing(bool);
}; };
@@ -103,7 +106,7 @@ HippoPanelGrids *HippoPanelGrids::create()
HippoPanelGridsImpl::HippoPanelGridsImpl() : HippoPanelGridsImpl::HippoPanelGridsImpl() :
mState(NORMAL) mState(NORMAL), mIsEditable(true)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_grids.xml"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_grids.xml");
} }
@@ -194,27 +197,10 @@ void HippoPanelGridsImpl::refresh()
childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " ");
childSetEnabled("btn_delete", (selectIndex >= 0)); childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable );
childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0)); childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0));
childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0)); childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0));
childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY)); childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY));
if (childGetValue("platform").asString() == "SecondLife") {
// disable platform selector, if logged into the grid edited and it is SL
// so object export restrictions cannot be circumvented by changing the platform
bool enablePlatform = (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) ||
(mCurGrid != gHippoGridManager->getConnectedGrid()->getGridName());
childSetEnabled("platform", enablePlatform);
childSetEnabled("search", false);
childSetText("search", LLStringExplicit(""));
childSetEnabled("render_compat", false);
childSetValue("render_compat", false);
} else {
childSetEnabled("platform", true);
childSetEnabled("search", true);
childSetText("search", gHippoGridManager->getConnectedGrid()->getSearchUrl());
childSetEnabled("render_compat", true);
}
} }
@@ -256,9 +242,11 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetText("helperuri", gridInfo->getHelperUri()); childSetText("helperuri", gridInfo->getHelperUri());
childSetText("website", gridInfo->getWebSite()); childSetText("website", gridInfo->getWebSite());
childSetText("support", gridInfo->getSupportUrl()); childSetText("support", gridInfo->getSupportUrl());
childSetText("search", gridInfo->getSearchUrl());
childSetText("register", gridInfo->getRegisterUrl()); childSetText("register", gridInfo->getRegisterUrl());
childSetText("password", gridInfo->getPasswordUrl()); childSetText("password", gridInfo->getPasswordUrl());
childSetValue("render_compat", gridInfo->isRenderCompat()); childSetValue("render_compat", gridInfo->isRenderCompat());
enableEditing(!gridInfo->getLocked());
} else { } else {
std::string empty = ""; std::string empty = "";
LLComboBox *platform = getChild<LLComboBox>("platform"); LLComboBox *platform = getChild<LLComboBox>("platform");
@@ -269,10 +257,11 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetText("helperuri", empty); childSetText("helperuri", empty);
childSetText("website", empty); childSetText("website", empty);
childSetText("support", empty); childSetText("support", empty);
childSetText("search", empty);
childSetText("register", empty); childSetText("register", empty);
childSetText("password", empty); childSetText("password", empty);
childSetEnabled("render_compat", true);
childSetValue("render_compat", true); childSetValue("render_compat", true);
enableEditing(true);
} }
if (mState == ADD_NEW) { if (mState == ADD_NEW) {
@@ -281,6 +270,7 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetText("loginuri", required); childSetText("loginuri", required);
} else if (mState == ADD_COPY) { } else if (mState == ADD_COPY) {
childSetText("gridname", std::string("<required>")); childSetText("gridname", std::string("<required>"));
enableEditing(true);
} else if (mState != NORMAL) { } else if (mState != NORMAL) {
llwarns << "Illegal state " << mState << '.' << llendl; llwarns << "Illegal state " << mState << '.' << llendl;
} }
@@ -294,7 +284,7 @@ bool HippoPanelGridsImpl::saveCurGrid()
HippoGridInfo *gridInfo = 0; HippoGridInfo *gridInfo = 0;
gridInfo = gHippoGridManager->getGrid(mCurGrid); gridInfo = gHippoGridManager->getGrid(mCurGrid);
//gridInfo->retrieveGridInfo(); //gridInfo->getGridInfo();
refresh(); refresh();
std::string gridname = childGetValue("gridname"); std::string gridname = childGetValue("gridname");
@@ -333,7 +323,28 @@ bool HippoPanelGridsImpl::saveCurGrid()
mCurGrid = gridname; mCurGrid = gridname;
gridInfo = new HippoGridInfo(gridname); gridInfo = new HippoGridInfo(gridname);
gHippoGridManager->addGrid(gridInfo); gHippoGridManager->addGrid(gridInfo);
gridInfo->retrieveGridInfo(); try
{
gridInfo->getGridInfo();
}
catch (AIAlert::ErrorCode const& error)
{
if (error.getCode() == HTTP_NOT_FOUND || error.getCode() == HTTP_METHOD_NOT_ALLOWED)
{
// Ignore this error; it might be a user entered entry for a grid that has no get_grid_info support.
llwarns << AIAlert::text(error) << llendl;
}
else if (error.getCode() == HTTP_OK)
{
// XML parse error.
AIAlert::add("GridInfoError", error);
}
else
{
// Append GridInfoErrorInstruction to error message.
AIAlert::add("GridInfoError", AIAlert::Error(AIAlert::Prefix(), AIAlert::not_modal, error, "GridInfoErrorInstruction"));
}
}
} }
if (!gridInfo) { if (!gridInfo) {
@@ -394,7 +405,10 @@ void HippoPanelGridsImpl::retrieveGridInfo()
} }
grid->setLoginUri(loginuri); grid->setLoginUri(loginuri);
if (grid->retrieveGridInfo()) { try
{
grid->getGridInfo();
if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER) if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER)
getChild<LLComboBox>("platform")->setCurrentByIndex(grid->getPlatform()); getChild<LLComboBox>("platform")->setCurrentByIndex(grid->getPlatform());
if (grid->getGridName() != "") childSetText("gridname", grid->getGridName()); if (grid->getGridName() != "") childSetText("gridname", grid->getGridName());
@@ -407,8 +421,18 @@ void HippoPanelGridsImpl::retrieveGridInfo()
if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl()); if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl());
if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl()); if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl());
if (grid->getGridMessage() != "") childSetText("gridmessage", grid->getGridMessage()); if (grid->getGridMessage() != "") childSetText("gridmessage", grid->getGridMessage());
} else { }
LLNotificationsUtil::add("GridInfoError"); catch(AIAlert::ErrorCode const& error)
{
if (error.getCode() == HTTP_METHOD_NOT_ALLOWED || error.getCode() == HTTP_OK)
{
AIAlert::add("GridInfoError", error);
}
else
{
// Append GridInfoErrorInstruction to error message.
AIAlert::add("GridInfoError", AIAlert::Error(AIAlert::Prefix(), AIAlert::not_modal, error, "GridInfoErrorInstruction"));
}
} }
if (cleanupGrid) delete grid; if (cleanupGrid) delete grid;
@@ -472,8 +496,10 @@ void HippoPanelGridsImpl::onClickDefault(void *data)
{ {
HippoPanelGridsImpl *self = (HippoPanelGridsImpl*)data; HippoPanelGridsImpl *self = (HippoPanelGridsImpl*)data;
if (self->mState == NORMAL) { if (self->mState == NORMAL) {
self->saveCurGrid(); if (self->saveCurGrid())
gHippoGridManager->setDefaultGrid(self->mCurGrid); {
gHippoGridManager->setDefaultGrid(self->mCurGrid);
}
self->refresh(); self->refresh();
} }
} }
@@ -538,3 +564,31 @@ void HippoPanelGridsImpl::onClickHelpRenderCompat(void *data)
{ {
LLNotificationsUtil::add("HelpRenderCompat"); LLNotificationsUtil::add("HelpRenderCompat");
} }
void HippoPanelGridsImpl::enableEditing(bool b)
{
static const char * elements [] = {
"platform",
"gridname",
"loginuri",
"loginpage",
"helperuri",
"website",
"support",
"register",
"password",
"search",
"btn_delete",
"btn_gridinfo",
"render_compat",
"gridmessage",
0
};
for(int i = 0; elements[i]; ++i ) {
this->childSetEnabled(elements[i], b);
}
mIsEditable = b;
}

View File

@@ -77,7 +77,9 @@ fi
export SDL_VIDEO_X11_DGAMOUSE=0 export SDL_VIDEO_X11_DGAMOUSE=0
## - Works around a problem with misconfigured 64-bit systems not finding GL ## - Works around a problem with misconfigured 64-bit systems not finding GL
export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}":/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri # This is less needed nowadays; don't uncomment this unless LibGL can't find your
# drivers automatically.
#export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}":/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri
## - The 'scim' GTK IM module widely crashes the viewer. Avoid it. ## - The 'scim' GTK IM module widely crashes the viewer. Avoid it.
if [ "$GTK_IM_MODULE" = "scim" ]; then if [ "$GTK_IM_MODULE" = "scim" ]; then

View File

@@ -84,6 +84,7 @@
#include "llworld.h" #include "llworld.h"
#include "llworldmap.h" #include "llworldmap.h"
#include "llworldmapmessage.h" #include "llworldmapmessage.h"
#include "../lscript/lscript_byteformat.h"
//Misc non-standard includes //Misc non-standard includes
#include "llurldispatcher.h" #include "llurldispatcher.h"
@@ -3061,7 +3062,7 @@ LLQuaternion LLAgent::getHeadRotation()
return rot; return rot;
} }
void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request) void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request)
{ {
if (gAgentID.isNull()) if (gAgentID.isNull())
{ {
@@ -3076,7 +3077,7 @@ void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimReque
msg->addUUIDFast(_PREHASH_AgentID, getID()); msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
for (S32 i = 0; i < anim_ids.count(); i++) for (U32 i = 0; i < anim_ids.size(); i++)
{ {
if (anim_ids[i].isNull()) if (anim_ids[i].isNull())
{ {
@@ -3118,6 +3119,55 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request)
sendReliableMessage(); sendReliableMessage();
} }
// Send a message to the region to stop the NULL animation state
// This will reset animation state overrides for the agent.
void LLAgent::sendAnimationStateReset()
{
if (gAgentID.isNull() || !mRegionp)
{
return;
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_AgentAnimation);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_AnimationList);
msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
sendReliableMessage();
}
// Send a message to the region to revoke sepecified permissions on ALL scripts in the region
// If the target is an object in the region, permissions in scripts on that object are cleared.
// If it is the region ID, all scripts clear the permissions for this agent
void LLAgent::sendRevokePermissions(const LLUUID & target, U32 permissions)
{
// Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
// are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
if (gAgentID.notNull() && gMessageSystem)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RevokePermissions);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_Data);
msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
msg->addU32Fast(_PREHASH_ObjectPermissions, permissions);
sendReliableMessage();
}
}
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i // [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
void LLAgent::setAlwaysRun() void LLAgent::setAlwaysRun()
{ {
@@ -4338,6 +4388,8 @@ void LLAgent::stopCurrentAnimations()
// avatar, propagating this change back to the server. // avatar, propagating this change back to the server.
if (isAgentAvatarValid()) if (isAgentAvatarValid())
{ {
std::vector<LLUUID> anim_ids;
for ( LLVOAvatar::AnimIterator anim_it = for ( LLVOAvatar::AnimIterator anim_it =
gAgentAvatarp->mPlayingAnimations.begin(); gAgentAvatarp->mPlayingAnimations.begin();
anim_it != gAgentAvatarp->mPlayingAnimations.end(); anim_it != gAgentAvatarp->mPlayingAnimations.end();
@@ -4355,7 +4407,24 @@ void LLAgent::stopCurrentAnimations()
// stop this animation locally // stop this animation locally
gAgentAvatarp->stopMotion(anim_it->first, TRUE); gAgentAvatarp->stopMotion(anim_it->first, TRUE);
// ...and tell the server to tell everyone. // ...and tell the server to tell everyone.
sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP); anim_ids.push_back(anim_it->first);
}
}
sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
// Tell the region to clear any animation state overrides
sendAnimationStateReset();
// Revoke all animation permissions
if (mRegionp &&
gSavedSettings.getBOOL("RevokePermsOnStopAnimation"))
{
U32 permissions = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION] | LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS];
sendRevokePermissions(mRegionp->getRegionID(), permissions);
if (gAgentAvatarp->isSitting())
{ // Also stand up, since auto-granted sit animation permission has been revoked
gAgent.standUp();
} }
} }

View File

@@ -464,8 +464,11 @@ public:
void stopCurrentAnimations(); void stopCurrentAnimations();
void requestStopMotion(LLMotion* motion); void requestStopMotion(LLMotion* motion);
void onAnimStop(const LLUUID& id); void onAnimStop(const LLUUID& id);
void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request); void sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request);
void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
void sendAnimationStateReset();
void sendRevokePermissions(const LLUUID & target, U32 permissions);
void endAnimationUpdateUI(); void endAnimationUpdateUI();
void unpauseAnimation() { mPauseRequest = NULL; } void unpauseAnimation() { mPauseRequest = NULL; }
BOOL getCustomAnim() const { return mCustomAnim; } BOOL getCustomAnim() const { return mCustomAnim; }

View File

@@ -40,7 +40,8 @@
#include "llappviewerwin32.h" #include "llappviewerwin32.h"
#include "llwindowwin32.cpp" // *FIX: for setting gIconResource. #include "llwindowwin32.h" // *FIX: for setting gIconResource.
#include "llgl.h"
#include "res/resource.h" // *FIX: for setting gIconResource. #include "res/resource.h" // *FIX: for setting gIconResource.
#include <fcntl.h> //_O_APPEND #include <fcntl.h> //_O_APPEND
@@ -52,6 +53,11 @@
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "lldxhardware.h" #include "lldxhardware.h"
#include "nvapi/nvapi.h"
#include "nvapi/NvApiDriverSettings.h"
#include <stdlib.h>
#include "llweb.h" #include "llweb.h"
#include "llsecondlifeurls.h" #include "llsecondlifeurls.h"
@@ -79,6 +85,19 @@ extern "C" {
const std::string LLAppViewerWin32::sWindowClass = "Second Life"; const std::string LLAppViewerWin32::sWindowClass = "Second Life";
/*
This function is used to print to the command line a text message
describing the nvapi error and quits
*/
void nvapi_error(NvAPI_Status status)
{
NvAPI_ShortString szDesc = {0};
NvAPI_GetErrorMessage(status, szDesc);
llwarns << szDesc << llendl;
//should always trigger when asserts are enabled
//llassert(status == NVAPI_OK);
}
// Create app mutex creates a unique global windows object. // Create app mutex creates a unique global windows object.
// If the object can be created it returns true, otherwise // If the object can be created it returns true, otherwise
@@ -101,6 +120,79 @@ bool create_app_mutex()
return result; return result;
} }
void ll_nvapi_init(NvDRSSessionHandle hSession)
{
// (2) load all the system settings into the session
NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
NvAPI_UnicodeString profile_name;
//std::string app_name = LLTrans::getString("APP_NAME");
std::string app_name("Second Life"); // <alchemy/>
llutf16string w_app_name = utf8str_to_utf16str(app_name);
wsprintf(profile_name, L"%s", w_app_name.c_str());
status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
// (3) Obtain the current profile.
NvDRSProfileHandle hProfile = 0;
status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
// load settings for querying
status = NvAPI_DRS_LoadSettings(hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
//get the preferred power management mode for Second Life
NVDRS_SETTING drsSetting = {0};
drsSetting.version = NVDRS_SETTING_VER;
status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
if (status == NVAPI_SETTING_NOT_FOUND)
{ //only override if the user hasn't specifically set this setting
// (4) Specify that we want the VSYNC disabled setting
// first we fill the NVDRS_SETTING struct, then we call the function
drsSetting.version = NVDRS_SETTING_VER;
drsSetting.settingId = PREFERRED_PSTATE_ID;
drsSetting.settingType = NVDRS_DWORD_TYPE;
drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
// (5) Now we apply (or save) our changes to the system
status = NvAPI_DRS_SaveSettings(hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
}
else if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
}
//#define DEBUGGING_SEH_FILTER 1 //#define DEBUGGING_SEH_FILTER 1
#if DEBUGGING_SEH_FILTER #if DEBUGGING_SEH_FILTER
# define WINMAIN DebuggingWinMain # define WINMAIN DebuggingWinMain
@@ -157,6 +249,27 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
return -1; return -1;
} }
NvAPI_Status status;
// Initialize NVAPI
status = NvAPI_Initialize();
NvDRSSessionHandle hSession = 0;
if (status == NVAPI_OK)
{
// Create the session handle to access driver settings
status = NvAPI_DRS_CreateSession(&hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
}
else
{
//override driver setting as needed
ll_nvapi_init(hSession);
}
}
// Have to wait until after logging is initialized to display LFH info // Have to wait until after logging is initialized to display LFH info
if (num_heaps > 0) if (num_heaps > 0)
{ {
@@ -224,6 +337,15 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LLAppViewer::sUpdaterInfo = NULL ; LLAppViewer::sUpdaterInfo = NULL ;
} }
// (NVAPI) (6) We clean up. This is analogous to doing a free()
if (hSession)
{
NvAPI_DRS_DestroySession(hSession);
hSession = 0;
}
return 0; return 0;
} }

View File

@@ -68,6 +68,12 @@ public:
msg += ": " + content["message"].asString(); msg += ": " + content["message"].asString();
} }
llinfos << msg << llendl; llinfos << msg << llendl;
if (content.has("report_id"))
{
gSavedSettings.setS32("CrashReportID", content["report_id"].asInteger());
}
} }
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const

View File

@@ -626,6 +626,10 @@ void LLFeatureManager::applyBaseMasks()
{ {
maskFeatures("GeForceFX"); maskFeatures("GeForceFX");
} }
if (gGLManager.mIsIntel && gGLManager.mGLVersion<3.0f)
{
maskFeatures("IntelPre30");
}
if (gGLManager.mIsIntel) if (gGLManager.mIsIntel)
{ {
maskFeatures("Intel"); maskFeatures("Intel");

View File

@@ -37,7 +37,7 @@
#include "llfloaterfriends.h" #include "llfloaterfriends.h"
#include "llsdutil_math.h"
#include "llagent.h" #include "llagent.h"
#include "llavataractions.h" #include "llavataractions.h"
#include "llavatarnamecache.h" #include "llavatarnamecache.h"

View File

@@ -1062,7 +1062,7 @@ void LLFolderViewItem::draw()
&& root_is_loading && root_is_loading
&& mShowLoadStatus)) && mShowLoadStatus))
{ {
std::string load_string = " ( " + LLTrans::getString("LoadingData") + " ) "; static std::string const load_string = " ( " + LLTrans::getString("LoadingData") + " ) ";
font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor, font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x, FALSE); S32_MAX, S32_MAX, &right_x, FALSE);

View File

@@ -88,6 +88,7 @@
// //
const char* DEFAULT_DESC = "(No Description)"; const char* DEFAULT_DESC = "(No Description)";
const F32 DELAY_BEFORE_SHOW_TIP = 0.35f; const F32 DELAY_BEFORE_SHOW_TIP = 0.35f;
const F32 DELAY_BEFORE_REFRESH_TIP = 0.50f;
// //
// Local globals // Local globals
@@ -113,6 +114,9 @@ LLHoverView::LLHoverView(const std::string& name, const LLRect& rect)
mUseHover = TRUE; mUseHover = TRUE;
mTyping = FALSE; mTyping = FALSE;
mHoverOffset.clearVec(); mHoverOffset.clearVec();
//<singu>
mLastTextHoverObject = NULL;
//</singu>
} }
LLHoverView::~LLHoverView() LLHoverView::~LLHoverView()
@@ -139,6 +143,9 @@ void LLHoverView::updateHover(LLTool* current_tool)
mStartHoverPickTimer = TRUE; mStartHoverPickTimer = TRUE;
// Clear the existing text so that we do not briefly show the wrong data. // Clear the existing text so that we do not briefly show the wrong data.
mText.clear(); mText.clear();
//<singu>
mLastTextHoverObject = NULL;
//</singu>
} }
if (mDoneHoverPick) if (mDoneHoverPick)
@@ -222,6 +229,18 @@ void LLHoverView::updateText()
LLViewerObject* hit_object = getLastHoverObject(); LLViewerObject* hit_object = getLastHoverObject();
std::string line; std::string line;
//<singu>
if (hit_object == mLastTextHoverObject &&
!(mLastTextHoverObjectTimer.getStarted() && mLastTextHoverObjectTimer.hasExpired()))
{
// mText is already up to date.
return;
}
mLastTextHoverObject = hit_object;
mLastTextHoverObjectTimer.stop();
bool retrieving_data = false;
//</singu>
mText.clear(); mText.clear();
if ( hit_object ) if ( hit_object )
{ {
@@ -403,6 +422,7 @@ void LLHoverView::updateText()
else else
{ {
line.append(LLTrans::getString("RetrievingData")); line.append(LLTrans::getString("RetrievingData"));
retrieving_data = true;
} }
} }
else else
@@ -417,12 +437,14 @@ void LLHoverView::updateText()
else else
{ {
line.append(LLTrans::getString("RetrievingData")); line.append(LLTrans::getString("RetrievingData"));
retrieving_data = true;
} }
} }
} }
else else
{ {
line.append(LLTrans::getString("RetrievingData")); line.append(LLTrans::getString("RetrievingData"));
retrieving_data = true;
} }
mText.push_back(line); mText.push_back(line);
@@ -514,6 +536,7 @@ void LLHoverView::updateText()
{ {
LLStringUtil::format_map_t args; LLStringUtil::format_map_t args;
args["[MESSAGE]"] = LLTrans::getString("RetrievingData"); args["[MESSAGE]"] = LLTrans::getString("RetrievingData");
retrieving_data = true;
line.append(LLTrans::getString("TooltipForSaleMsg", args)); line.append(LLTrans::getString("TooltipForSaleMsg", args));
} }
mText.push_back(line); mText.push_back(line);
@@ -604,6 +627,7 @@ void LLHoverView::updateText()
else else
{ {
line.append(LLTrans::getString("RetrievingData")); line.append(LLTrans::getString("RetrievingData"));
retrieving_data = true;
} }
} }
else if(gCacheName->getFullName(owner, name)) else if(gCacheName->getFullName(owner, name))
@@ -616,11 +640,13 @@ void LLHoverView::updateText()
else else
{ {
line.append(LLTrans::getString("RetrievingData")); line.append(LLTrans::getString("RetrievingData"));
retrieving_data = true;
} }
} }
else else
{ {
line.append(LLTrans::getString("RetrievingData")); line.append(LLTrans::getString("RetrievingData"));
retrieving_data = true;
} }
mText.push_back(line); mText.push_back(line);
@@ -699,8 +725,15 @@ void LLHoverView::updateText()
mText.push_back(line); mText.push_back(line);
} }
} }
}
//<singu>
if (retrieving_data)
{
// Keep doing this twice per second, until all data was retrieved.
mLastTextHoverObjectTimer.start(DELAY_BEFORE_REFRESH_TIP);
}
//</singu>
}
void LLHoverView::draw() void LLHoverView::draw()
{ {

View File

@@ -105,6 +105,8 @@ protected:
// If not null and not dead, we're over an object. // If not null and not dead, we're over an object.
LLPointer<LLViewerObject> mLastHoverObject; LLPointer<LLViewerObject> mLastHoverObject;
LLViewerObject* mLastTextHoverObject; // Singu extension: the value of mLastHoverObject that corresponds to mText.
LLFrameTimer mLastTextHoverObjectTimer; // Singu extension: times how long ago the text was updated (while retrieving data).
LLPickInfo mLastPickInfo; LLPickInfo mLastPickInfo;
// If not LLVector3d::ZERO, we're over land. // If not LLVector3d::ZERO, we're over land.

View File

@@ -1414,7 +1414,7 @@ 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, 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<LLWholeModelFeeObserver> const& fee_observer, LLHandle<LLWholeModelUploadObserver> const& upload_observer) : LLHandle<LLWholeModelFeeObserver> const& fee_observer, LLHandle<LLWholeModelUploadObserver> const& upload_observer) :
#ifdef CWDEBUG #if defined(CWDEBUG) || defined(DEBUG_CURLIO)
AIStateMachine(false), AIStateMachine(false),
#endif #endif
mMeshUpload(new AIStateMachineThread<LLMeshUploadThread>(CWD_ONLY(false))), mWholeModelUploadURL(upload_url) mMeshUpload(new AIStateMachineThread<LLMeshUploadThread>(CWD_ONLY(false))), mWholeModelUploadURL(upload_url)

View File

@@ -1038,8 +1038,10 @@ void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl)
{ {
HippoGridInfo* info(new HippoGridInfo("")); // Start off with empty grid name, otherwise we don't know what to name HippoGridInfo* info(new HippoGridInfo("")); // Start off with empty grid name, otherwise we don't know what to name
info->setLoginUri(grid); info->setLoginUri(grid);
if (info->retrieveGridInfo()) // There's info from this URI try
{ {
info->getGridInfo();
grid = info->getGridName(); grid = info->getGridName();
if (HippoGridInfo* nick_info = gHippoGridManager->getGrid(info->getGridNick())) // Grid of same nick exists if (HippoGridInfo* nick_info = gHippoGridManager->getGrid(info->getGridNick())) // Grid of same nick exists
{ {
@@ -1051,8 +1053,23 @@ void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl)
gHippoGridManager->addGrid(info); // deletes info if not needed (existing or no name) gHippoGridManager->addGrid(info); // deletes info if not needed (existing or no name)
} }
} }
else catch(AIAlert::ErrorCode const& error)
{ {
// Inform the user of the problem, but only if something was entered that at least looks like a Login URI.
std::string::size_type pos1 = grid.find('.');
std::string::size_type pos2 = grid.find_last_of(".:");
if (grid.substr(0, 4) == "http" || (pos1 != std::string::npos && pos1 != pos2))
{
if (error.getCode() == HTTP_METHOD_NOT_ALLOWED || error.getCode() == HTTP_OK)
{
AIAlert::add("GridInfoError", error);
}
else
{
// Append GridInfoErrorInstruction to error message.
AIAlert::add("GridInfoError", AIAlert::Error(AIAlert::Prefix(), AIAlert::not_modal, error, "GridInfoErrorInstruction"));
}
}
delete info; delete info;
grid = gHippoGridManager->getCurrentGridName(); grid = gHippoGridManager->getCurrentGridName();
} }

View File

@@ -45,7 +45,8 @@ typedef std::map<std::string, std::string> controller_map_t;
typedef std::map<std::string, F32> default_controller_map_t; typedef std::map<std::string, F32> default_controller_map_t;
#define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f #define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f
#define TIME_ITERATION_STEP 0.1f #define TIME_ITERATION_STEP 0.05f
#define MINIMUM_UPDATE_TIMESTEP 0.025f
inline F64 llsgn(const F64 a) inline F64 llsgn(const F64 a)
{ {
@@ -592,7 +593,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
const F32 time_delta = time - mLastTime; const F32 time_delta = time - mLastTime;
// Don't update too frequently, to avoid precision errors from small time slices. // Don't update too frequently, to avoid precision errors from small time slices.
if (time_delta <= .01) if (time_delta <= MINIMUM_UPDATE_TIMESTEP)
{ {
return FALSE; return FALSE;
} }

View File

@@ -45,6 +45,7 @@
#include "llagentcamera.h" #include "llagentcamera.h"
#include "llbutton.h" #include "llbutton.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerkeyboard.h"
#include "lldrawable.h" #include "lldrawable.h"
#include "llhoverview.h" #include "llhoverview.h"
#include "llhudmanager.h" #include "llhudmanager.h"
@@ -312,9 +313,15 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
return TRUE; return TRUE;
} }
static bool right_hold_mouse_walk=false;
BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
{ {
if(right_hold_mouse_walk)
{
agent_push_forward(KEYSTATE_LEVEL);
}
S32 dx = gViewerWindow->getCurrentMouseDX(); S32 dx = gViewerWindow->getCurrentMouseDX();
S32 dy = gViewerWindow->getCurrentMouseDY(); S32 dy = gViewerWindow->getCurrentMouseDY();
@@ -449,8 +456,36 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
return TRUE; return TRUE;
} }
BOOL LLToolCamera::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
if(mMouseSteering)
{
agent_push_forward(KEYSTATE_DOWN);
right_hold_mouse_walk = true;
return TRUE;
}
else
{
return FALSE;
}
}
BOOL LLToolCamera::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
if(mMouseSteering || right_hold_mouse_walk)
{
agent_push_forward(KEYSTATE_UP);
right_hold_mouse_walk = false;
return TRUE;
}
else
{
return FALSE;
}
}
void LLToolCamera::onMouseCaptureLost() void LLToolCamera::onMouseCaptureLost()
{ {
releaseMouse(); releaseMouse();
handleRightMouseUp(0,0,0);
} }

View File

@@ -47,6 +47,8 @@ public:
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
virtual void onMouseCaptureLost(); virtual void onMouseCaptureLost();

View File

@@ -298,6 +298,11 @@ LLUserAuth::UserAuthcode LLUserAuth::authResponse()
// if curl was ok, parse the download area. // if curl was ok, parse the download area.
CURLcode result = mResponder->result_code(); CURLcode result = mResponder->result_code();
if (is_internal_http_error(mResponder->http_status()))
{
// result can be a meaningless CURLE_OK in the case of an internal error.
result = CURLE_FAILED_INIT; // Just some random error to get the default case below.
}
switch (result) switch (result)
{ {
case CURLE_OK: case CURLE_OK:

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